max_stars_repo_path
stringlengths
4
237
max_stars_repo_name
stringlengths
6
117
max_stars_count
int64
0
95.2k
id
stringlengths
1
7
content
stringlengths
12
593k
input_ids
sequencelengths
7
549k
c3/qiskit/__init__.py
picbeats/c3
45
1600080
from .c3_provider import C3Provider # noqa __version__ = "0.1"
[ 1, 515, 869, 29883, 29941, 29918, 18121, 1053, 315, 29941, 6980, 29871, 396, 694, 25621, 13, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29896, 29908, 13, 2 ]
tmac/models.py
Nondairy-Creamer/tmac
0
15798
<reponame>Nondairy-Creamer/tmac import numpy as np import torch import time from scipy import optimize from scipy.stats import norm import tmac.probability_distributions as tpd import tmac.fourier as tfo def tmac_ac(red_np, green_np, optimizer='BFGS', verbose=False, truncate_freq=False): """ Implementation of the Two-channel motion artifact correction method (TMAC) This is tmac_ac because it is the additive and circular boundary version This code takes in imaging fluoresence data from two simultaneously recorded channels and attempts to remove shared motion artifacts between the two channels Args: red_np: numpy array, [time, neurons], activity independent channel green_np: numpy array, [time, neurons], activity dependent channel optimizer: string, scipy optimizer verbose: boolean, if true, outputs when inference is complete on each neuron and estimates time to finish truncate_freq: boolean, if true truncates low amplitude frequencies in Fourier domain. This should give the same results but may give sensitivity to the initial conditions Returns: a dictionary containing: all the inferred parameters of the model """ # optimization is performed using Scipy optimize, so all tensors should stay on the CPU device = 'cpu' dtype = torch.float64 red_nan = np.any(np.isnan(red_np)) red_inf = np.any(np.isinf(red_np)) green_nan = np.any(np.isnan(green_np)) green_inf = np.any(np.isinf(green_np)) if red_nan or red_inf or green_nan or green_inf: raise Exception('Input data cannot have any nan or inf') # convert data to units of fold mean and subtract mean red_np = red_np / np.mean(red_np, axis=0) - 1 green_np = green_np / np.mean(green_np, axis=0) - 1 # convert to tensors and fourier transform red = torch.tensor(red_np, device=device, dtype=dtype) green = torch.tensor(green_np, device=device, dtype=dtype) red_fft = tfo.real_fft(red) green_fft = tfo.real_fft(green) # estimate all model parameters from the data variance_r_noise_init = np.var(red_np, axis=0) variance_g_noise_init = np.var(green_np, axis=0) variance_a_init = np.var(green_np, axis=0) variance_m_init = np.var(red_np, axis=0) # initialize length scale using the autocorrelation of the data length_scale_a_init = np.zeros(red_np.shape[1]) length_scale_m_init = np.zeros(red_np.shape[1]) for n in range(green_np.shape[1]): # approximate as the standard deviation of a gaussian fit to the autocorrelation function length_scale_m_init[n] = initialize_length_scale(red_np[:, n]) length_scale_a_init[n] = initialize_length_scale(green_np[:, n]) # preallocate space for all the training variables a_trained = np.zeros(red_np.shape) m_trained = np.zeros(red_np.shape) variance_r_noise_trained = np.zeros(variance_r_noise_init.shape) variance_g_noise_trained = np.zeros(variance_g_noise_init.shape) variance_a_trained = np.zeros(variance_a_init.shape) length_scale_a_trained = np.zeros(length_scale_a_init.shape) variance_m_trained = np.zeros(variance_m_init.shape) length_scale_m_trained = np.zeros(length_scale_m_init.shape) # loop through each neuron and perform inference start = time.time() for n in range(red_np.shape[1]): # get the initial values for the hyperparameters of this neuron # All hyperparameters are positive so we fit them in log space evidence_training_variables = np.log([variance_r_noise_init[n], variance_g_noise_init[n], variance_a_init[n], length_scale_a_init[n], variance_m_init[n], length_scale_m_init[n]]) # define the evidence loss function. This function takes in and returns pytorch tensors def evidence_loss_fn(training_variables): return -tpd.tmac_evidence_and_posterior(red[:, n], red_fft[:, n], training_variables[0], green[:, n], green_fft[:, n], training_variables[1], training_variables[2], training_variables[3], training_variables[4], training_variables[5], truncate_freq=truncate_freq) # a wrapper function of evidence that takes in and returns numpy variables def evidence_loss_fn_np(training_variables_in): training_variables = torch.tensor(training_variables_in, dtype=dtype, device=device) return evidence_loss_fn(training_variables).numpy() # wrapper function of for Jacobian of the evidence that takes in and returns numpy variables def evidence_loss_jacobian_np(training_variables_in): training_variables = torch.tensor(training_variables_in, dtype=dtype, device=device, requires_grad=True) loss = evidence_loss_fn(training_variables) return torch.autograd.grad(loss, training_variables, create_graph=False)[0].numpy() # optimization function with Jacobian from pytorch trained_variances = optimize.minimize(evidence_loss_fn_np, evidence_training_variables, jac=evidence_loss_jacobian_np, method=optimizer) # calculate the posterior values # The posterior is gaussian so we don't need to optimize, we find a and m in one step trained_variance_torch = torch.tensor(trained_variances.x, dtype=dtype, device=device) a, m = tpd.tmac_evidence_and_posterior(red[:, n], red_fft[:, n], trained_variance_torch[0], green[:, n], green_fft[:, n], trained_variance_torch[1], trained_variance_torch[2], trained_variance_torch[3], trained_variance_torch[4], trained_variance_torch[5], calculate_posterior=True, truncate_freq=truncate_freq) a_trained[:, n] = a.numpy() m_trained[:, n] = m.numpy() variance_r_noise_trained[n] = torch.exp(trained_variance_torch[0]).numpy() variance_g_noise_trained[n] = torch.exp(trained_variance_torch[1]).numpy() variance_a_trained[n] = torch.exp(trained_variance_torch[2]).numpy() length_scale_a_trained[n] = torch.exp(trained_variance_torch[3]).numpy() variance_m_trained[n] = torch.exp(trained_variance_torch[4]).numpy() length_scale_m_trained[n] = torch.exp(trained_variance_torch[5]).numpy() if verbose: decimals = 1e3 # print out timing elapsed = time.time() - start remaining = elapsed / (n + 1) * (red_np.shape[1] - (n + 1)) elapsed_truncated = np.round(elapsed * decimals) / decimals remaining_truncated = np.round(remaining * decimals) / decimals print(str(n + 1) + '/' + str(red_np.shape[1]) + ' neurons complete') print(str(elapsed_truncated) + 's elapsed, estimated ' + str(remaining_truncated) + 's remaining') trained_variables = {'a': a_trained, 'm': m_trained, 'variance_r_noise': variance_r_noise_trained, 'variance_g_noise': variance_g_noise_trained, 'variance_a': variance_a_trained, 'length_scale_a': length_scale_a_trained, 'variance_m': variance_m_trained, 'length_scale_m': length_scale_m_trained, } return trained_variables def initialize_length_scale(y): """ Function to fit a Gaussian to the autocorrelation of y Args: y: numpy vector Returns: Standard deviation of a Gaussian fit to the autocorrelation of y """ x = np.arange(-len(y)/2, len(y)/2) + 0.5 y_z_score = (y - np.mean(y)) / np.std(y) y_corr = np.correlate(y_z_score, y_z_score, mode='same') # fit the std of a gaussian to the correlation function def loss(p): return p[0] * norm.pdf(x, 0, p[1]) - y_corr p_init = np.array((np.max(y_corr), 1.0)) p_hat = optimize.leastsq(loss, p_init)[0] # return the standard deviation return p_hat[1]
[ 1, 529, 276, 1112, 420, 29958, 29940, 898, 1466, 29891, 29899, 29907, 1633, 261, 29914, 29873, 8628, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 931, 13, 3166, 4560, 2272, 1053, 24656, 13, 3166, 4560, 2272, 29889, 16202, 1053, 6056, 13, 5215, 260, 8628, 29889, 22795, 3097, 29918, 27691, 29879, 408, 260, 15926, 13, 5215, 260, 8628, 29889, 29888, 283, 4336, 408, 260, 1181, 13, 13, 13, 1753, 260, 8628, 29918, 562, 29898, 1127, 29918, 9302, 29892, 7933, 29918, 9302, 29892, 5994, 3950, 2433, 28062, 10749, 742, 26952, 29922, 8824, 29892, 21022, 403, 29918, 29888, 7971, 29922, 8824, 1125, 13, 1678, 9995, 1954, 14607, 310, 278, 7803, 29899, 12719, 10884, 24238, 26385, 1158, 313, 29911, 1529, 29907, 29897, 13, 13, 1678, 910, 338, 260, 8628, 29918, 562, 1363, 372, 338, 278, 788, 3321, 322, 19308, 10452, 1873, 13, 1678, 910, 775, 4893, 297, 6382, 292, 20501, 2361, 663, 848, 515, 1023, 21699, 10478, 18196, 322, 14734, 304, 3349, 13, 1678, 7258, 10884, 24238, 29879, 1546, 278, 1023, 18196, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 2654, 29918, 9302, 29901, 12655, 1409, 29892, 518, 2230, 29892, 26808, 787, 1402, 6354, 7417, 8242, 13, 4706, 7933, 29918, 9302, 29901, 12655, 1409, 29892, 518, 2230, 29892, 26808, 787, 1402, 6354, 14278, 8242, 13, 4706, 5994, 3950, 29901, 1347, 29892, 4560, 2272, 5994, 3950, 13, 4706, 26952, 29901, 7223, 29892, 565, 1565, 29892, 14391, 746, 27262, 338, 4866, 373, 1269, 26808, 265, 322, 21875, 931, 304, 8341, 13, 4706, 21022, 403, 29918, 29888, 7971, 29901, 7223, 29892, 565, 1565, 21022, 1078, 4482, 28347, 29511, 297, 27506, 5354, 29889, 910, 881, 2367, 278, 1021, 13, 9651, 2582, 541, 1122, 2367, 4771, 24858, 304, 278, 2847, 5855, 13, 13, 1678, 16969, 29901, 263, 8600, 6943, 29901, 599, 278, 10115, 1127, 4128, 310, 278, 1904, 13, 1678, 9995, 13, 13, 1678, 396, 13883, 338, 8560, 773, 5636, 2272, 24656, 29892, 577, 599, 25187, 943, 881, 7952, 373, 278, 10808, 13, 1678, 4742, 353, 525, 21970, 29915, 13, 1678, 26688, 353, 4842, 305, 29889, 7411, 29953, 29946, 13, 13, 1678, 2654, 29918, 13707, 353, 7442, 29889, 1384, 29898, 9302, 29889, 275, 13707, 29898, 1127, 29918, 9302, 876, 13, 1678, 2654, 29918, 7192, 353, 7442, 29889, 1384, 29898, 9302, 29889, 275, 7192, 29898, 1127, 29918, 9302, 876, 13, 1678, 7933, 29918, 13707, 353, 7442, 29889, 1384, 29898, 9302, 29889, 275, 13707, 29898, 12692, 29918, 9302, 876, 13, 1678, 7933, 29918, 7192, 353, 7442, 29889, 1384, 29898, 9302, 29889, 275, 7192, 29898, 12692, 29918, 9302, 876, 13, 13, 1678, 565, 2654, 29918, 13707, 470, 2654, 29918, 7192, 470, 7933, 29918, 13707, 470, 7933, 29918, 7192, 29901, 13, 4706, 12020, 8960, 877, 4290, 848, 2609, 505, 738, 23432, 470, 3041, 1495, 13, 13, 1678, 396, 3588, 848, 304, 10340, 310, 900, 29881, 2099, 322, 23197, 2099, 13, 1678, 2654, 29918, 9302, 353, 2654, 29918, 9302, 847, 7442, 29889, 12676, 29898, 1127, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 448, 29871, 29896, 13, 1678, 7933, 29918, 9302, 353, 7933, 29918, 9302, 847, 7442, 29889, 12676, 29898, 12692, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 448, 29871, 29896, 13, 13, 1678, 396, 3588, 304, 25187, 943, 322, 12584, 4336, 4327, 13, 1678, 2654, 353, 4842, 305, 29889, 20158, 29898, 1127, 29918, 9302, 29892, 4742, 29922, 10141, 29892, 26688, 29922, 29881, 1853, 29897, 13, 1678, 7933, 353, 4842, 305, 29889, 20158, 29898, 12692, 29918, 9302, 29892, 4742, 29922, 10141, 29892, 26688, 29922, 29881, 1853, 29897, 13, 1678, 2654, 29918, 600, 29873, 353, 260, 1181, 29889, 6370, 29918, 600, 29873, 29898, 1127, 29897, 13, 1678, 7933, 29918, 600, 29873, 353, 260, 1181, 29889, 6370, 29918, 600, 29873, 29898, 12692, 29897, 13, 13, 1678, 396, 12678, 599, 1904, 4128, 515, 278, 848, 13, 1678, 20162, 29918, 29878, 29918, 1217, 895, 29918, 2344, 353, 7442, 29889, 1707, 29898, 1127, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 13, 1678, 20162, 29918, 29887, 29918, 1217, 895, 29918, 2344, 353, 7442, 29889, 1707, 29898, 12692, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 13, 1678, 20162, 29918, 29874, 29918, 2344, 353, 7442, 29889, 1707, 29898, 12692, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 13, 1678, 20162, 29918, 29885, 29918, 2344, 353, 7442, 29889, 1707, 29898, 1127, 29918, 9302, 29892, 9685, 29922, 29900, 29897, 13, 13, 1678, 396, 11905, 3309, 6287, 773, 278, 1120, 542, 272, 23445, 310, 278, 848, 13, 1678, 3309, 29918, 7052, 29918, 29874, 29918, 2344, 353, 7442, 29889, 3298, 359, 29898, 1127, 29918, 9302, 29889, 12181, 29961, 29896, 2314, 13, 1678, 3309, 29918, 7052, 29918, 29885, 29918, 2344, 353, 7442, 29889, 3298, 359, 29898, 1127, 29918, 9302, 29889, 12181, 29961, 29896, 2314, 13, 13, 1678, 363, 302, 297, 3464, 29898, 12692, 29918, 9302, 29889, 12181, 29961, 29896, 29962, 1125, 13, 4706, 396, 26368, 408, 278, 3918, 29522, 310, 263, 330, 17019, 6216, 304, 278, 1120, 542, 272, 23445, 740, 13, 4706, 3309, 29918, 7052, 29918, 29885, 29918, 2344, 29961, 29876, 29962, 353, 11905, 29918, 2848, 29918, 7052, 29898, 1127, 29918, 9302, 7503, 29892, 302, 2314, 13, 4706, 3309, 29918, 7052, 29918, 29874, 29918, 2344, 29961, 29876, 29962, 353, 11905, 29918, 2848, 29918, 7052, 29898, 12692, 29918, 9302, 7503, 29892, 302, 2314, 13, 13, 1678, 396, 758, 15956, 403, 2913, 363, 599, 278, 6694, 3651, 13, 1678, 263, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1127, 29918, 9302, 29889, 12181, 29897, 13, 1678, 286, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1127, 29918, 9302, 29889, 12181, 29897, 13, 1678, 20162, 29918, 29878, 29918, 1217, 895, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1707, 8837, 29918, 29878, 29918, 1217, 895, 29918, 2344, 29889, 12181, 29897, 13, 1678, 20162, 29918, 29887, 29918, 1217, 895, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1707, 8837, 29918, 29887, 29918, 1217, 895, 29918, 2344, 29889, 12181, 29897, 13, 1678, 20162, 29918, 29874, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1707, 8837, 29918, 29874, 29918, 2344, 29889, 12181, 29897, 13, 1678, 3309, 29918, 7052, 29918, 29874, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 2848, 29918, 7052, 29918, 29874, 29918, 2344, 29889, 12181, 29897, 13, 1678, 20162, 29918, 29885, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 1707, 8837, 29918, 29885, 29918, 2344, 29889, 12181, 29897, 13, 1678, 3309, 29918, 7052, 29918, 29885, 29918, 3018, 1312, 353, 7442, 29889, 3298, 359, 29898, 2848, 29918, 7052, 29918, 29885, 29918, 2344, 29889, 12181, 29897, 13, 13, 1678, 396, 2425, 1549, 1269, 26808, 265, 322, 2189, 27262, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 363, 302, 297, 3464, 29898, 1127, 29918, 9302, 29889, 12181, 29961, 29896, 29962, 1125, 13, 4706, 396, 679, 278, 2847, 1819, 363, 278, 11266, 16744, 310, 445, 26808, 265, 13, 4706, 396, 2178, 11266, 16744, 526, 6374, 577, 591, 6216, 963, 297, 1480, 2913, 13, 4706, 10757, 29918, 26495, 29918, 20897, 353, 7442, 29889, 1188, 4197, 1707, 8837, 29918, 29878, 29918, 1217, 895, 29918, 2344, 29961, 29876, 1402, 20162, 29918, 29887, 29918, 1217, 895, 29918, 2344, 29961, 29876, 1402, 20162, 29918, 29874, 29918, 2344, 29961, 29876, 1402, 13, 462, 462, 795, 3309, 29918, 7052, 29918, 29874, 29918, 2344, 29961, 29876, 1402, 20162, 29918, 29885, 29918, 2344, 29961, 29876, 1402, 3309, 29918, 7052, 29918, 29885, 29918, 2344, 29961, 29876, 24960, 13, 13, 4706, 396, 4529, 278, 10757, 6410, 740, 29889, 910, 740, 4893, 297, 322, 3639, 282, 3637, 25350, 25187, 943, 13, 4706, 822, 10757, 29918, 6758, 29918, 9144, 29898, 26495, 29918, 20897, 1125, 13, 9651, 736, 448, 9392, 29881, 29889, 29873, 8628, 29918, 5750, 5084, 29918, 392, 29918, 2490, 261, 1611, 29898, 1127, 7503, 29892, 302, 1402, 2654, 29918, 600, 29873, 7503, 29892, 302, 1402, 6694, 29918, 20897, 29961, 29900, 1402, 13, 462, 462, 462, 268, 7933, 7503, 29892, 302, 1402, 7933, 29918, 600, 29873, 7503, 29892, 302, 1402, 6694, 29918, 20897, 29961, 29896, 1402, 13, 462, 462, 462, 1678, 6694, 29918, 20897, 29961, 29906, 1402, 6694, 29918, 20897, 29961, 29941, 1402, 13, 462, 462, 462, 1678, 6694, 29918, 20897, 29961, 29946, 1402, 6694, 29918, 20897, 29961, 29945, 1402, 13, 462, 462, 462, 1678, 21022, 403, 29918, 29888, 7971, 29922, 509, 4661, 403, 29918, 29888, 7971, 29897, 13, 13, 4706, 396, 263, 14476, 740, 310, 10757, 393, 4893, 297, 322, 3639, 12655, 3651, 13, 4706, 822, 10757, 29918, 6758, 29918, 9144, 29918, 9302, 29898, 26495, 29918, 20897, 29918, 262, 1125, 13, 9651, 6694, 29918, 20897, 353, 4842, 305, 29889, 20158, 29898, 26495, 29918, 20897, 29918, 262, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29897, 13, 9651, 736, 10757, 29918, 6758, 29918, 9144, 29898, 26495, 29918, 20897, 467, 23749, 580, 13, 13, 4706, 396, 14476, 740, 310, 363, 10968, 713, 310, 278, 10757, 393, 4893, 297, 322, 3639, 12655, 3651, 13, 4706, 822, 10757, 29918, 6758, 29918, 29926, 562, 711, 713, 29918, 9302, 29898, 26495, 29918, 20897, 29918, 262, 1125, 13, 9651, 6694, 29918, 20897, 353, 4842, 305, 29889, 20158, 29898, 26495, 29918, 20897, 29918, 262, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29892, 6858, 29918, 5105, 29922, 5574, 29897, 13, 9651, 6410, 353, 10757, 29918, 6758, 29918, 9144, 29898, 26495, 29918, 20897, 29897, 13, 9651, 736, 4842, 305, 29889, 1300, 468, 3665, 29889, 5105, 29898, 6758, 29892, 6694, 29918, 20897, 29892, 1653, 29918, 4262, 29922, 8824, 9601, 29900, 1822, 23749, 580, 13, 13, 4706, 396, 13883, 740, 411, 10968, 713, 515, 282, 3637, 25350, 13, 4706, 16370, 29918, 1707, 713, 778, 353, 24656, 29889, 1195, 326, 675, 29898, 5750, 5084, 29918, 6758, 29918, 9144, 29918, 9302, 29892, 10757, 29918, 26495, 29918, 20897, 29892, 13, 462, 462, 795, 432, 562, 29922, 5750, 5084, 29918, 6758, 29918, 29926, 562, 711, 713, 29918, 9302, 29892, 13, 462, 462, 795, 1158, 29922, 20640, 3950, 29897, 13, 13, 4706, 396, 8147, 278, 13446, 1819, 13, 4706, 396, 450, 13446, 338, 330, 17019, 577, 591, 1016, 29915, 29873, 817, 304, 24656, 29892, 591, 1284, 263, 322, 286, 297, 697, 4331, 13, 4706, 16370, 29918, 1707, 8837, 29918, 7345, 305, 353, 4842, 305, 29889, 20158, 29898, 3018, 1312, 29918, 1707, 713, 778, 29889, 29916, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29897, 13, 4706, 263, 29892, 286, 353, 260, 15926, 29889, 29873, 8628, 29918, 5750, 5084, 29918, 392, 29918, 2490, 261, 1611, 29898, 1127, 7503, 29892, 302, 1402, 2654, 29918, 600, 29873, 7503, 29892, 302, 1402, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29900, 1402, 7933, 7503, 29892, 302, 1402, 7933, 29918, 600, 29873, 7503, 29892, 302, 1402, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29896, 1402, 13, 462, 462, 1669, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29906, 1402, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29941, 1402, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29946, 1402, 16370, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29945, 1402, 13, 462, 462, 1669, 8147, 29918, 2490, 261, 1611, 29922, 5574, 29892, 21022, 403, 29918, 29888, 7971, 29922, 509, 4661, 403, 29918, 29888, 7971, 29897, 13, 13, 4706, 263, 29918, 3018, 1312, 7503, 29892, 302, 29962, 353, 263, 29889, 23749, 580, 13, 4706, 286, 29918, 3018, 1312, 7503, 29892, 302, 29962, 353, 286, 29889, 23749, 580, 13, 4706, 20162, 29918, 29878, 29918, 1217, 895, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29900, 14664, 23749, 580, 13, 4706, 20162, 29918, 29887, 29918, 1217, 895, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29896, 14664, 23749, 580, 13, 4706, 20162, 29918, 29874, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29906, 14664, 23749, 580, 13, 4706, 3309, 29918, 7052, 29918, 29874, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29941, 14664, 23749, 580, 13, 4706, 20162, 29918, 29885, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29946, 14664, 23749, 580, 13, 4706, 3309, 29918, 7052, 29918, 29885, 29918, 3018, 1312, 29961, 29876, 29962, 353, 4842, 305, 29889, 4548, 29898, 3018, 1312, 29918, 1707, 8837, 29918, 7345, 305, 29961, 29945, 14664, 23749, 580, 13, 13, 4706, 565, 26952, 29901, 13, 9651, 1602, 326, 1338, 353, 29871, 29896, 29872, 29941, 13, 9651, 396, 1596, 714, 28750, 13, 9651, 560, 28170, 353, 931, 29889, 2230, 580, 448, 1369, 13, 9651, 9886, 353, 560, 28170, 847, 313, 29876, 718, 29871, 29896, 29897, 334, 313, 1127, 29918, 9302, 29889, 12181, 29961, 29896, 29962, 448, 313, 29876, 718, 29871, 29896, 876, 13, 9651, 560, 28170, 29918, 509, 4661, 630, 353, 7442, 29889, 14486, 29898, 295, 28170, 334, 1602, 326, 1338, 29897, 847, 1602, 326, 1338, 13, 9651, 9886, 29918, 509, 4661, 630, 353, 7442, 29889, 14486, 29898, 1745, 17225, 334, 1602, 326, 1338, 29897, 847, 1602, 326, 1338, 13, 9651, 1596, 29898, 710, 29898, 29876, 718, 29871, 29896, 29897, 718, 8207, 29915, 718, 851, 29898, 1127, 29918, 9302, 29889, 12181, 29961, 29896, 2314, 718, 525, 26808, 787, 4866, 1495, 13, 9651, 1596, 29898, 710, 29898, 295, 28170, 29918, 509, 4661, 630, 29897, 718, 525, 29879, 560, 28170, 29892, 15899, 525, 718, 851, 29898, 1745, 17225, 29918, 509, 4661, 630, 29897, 718, 525, 29879, 9886, 1495, 13, 13, 1678, 16370, 29918, 20897, 353, 11117, 29874, 2396, 263, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 29885, 2396, 286, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 1707, 8837, 29918, 29878, 29918, 1217, 895, 2396, 20162, 29918, 29878, 29918, 1217, 895, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 1707, 8837, 29918, 29887, 29918, 1217, 895, 2396, 20162, 29918, 29887, 29918, 1217, 895, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 1707, 8837, 29918, 29874, 2396, 20162, 29918, 29874, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 2848, 29918, 7052, 29918, 29874, 2396, 3309, 29918, 7052, 29918, 29874, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 1707, 8837, 29918, 29885, 2396, 20162, 29918, 29885, 29918, 3018, 1312, 29892, 13, 462, 308, 525, 2848, 29918, 7052, 29918, 29885, 2396, 3309, 29918, 7052, 29918, 29885, 29918, 3018, 1312, 29892, 13, 462, 308, 500, 13, 13, 1678, 736, 16370, 29918, 20897, 13, 13, 13, 1753, 11905, 29918, 2848, 29918, 7052, 29898, 29891, 1125, 13, 1678, 9995, 6680, 304, 6216, 263, 22477, 304, 278, 1120, 542, 272, 23445, 310, 343, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 343, 29901, 12655, 4608, 13, 13, 1678, 16969, 29901, 10117, 29522, 310, 263, 22477, 6216, 304, 278, 1120, 542, 272, 23445, 310, 343, 13, 1678, 9995, 13, 13, 1678, 921, 353, 7442, 29889, 279, 927, 6278, 2435, 29898, 29891, 6802, 29906, 29892, 7431, 29898, 29891, 6802, 29906, 29897, 718, 29871, 29900, 29889, 29945, 13, 1678, 343, 29918, 29920, 29918, 13628, 353, 313, 29891, 448, 7442, 29889, 12676, 29898, 29891, 876, 847, 7442, 29889, 4172, 29898, 29891, 29897, 13, 1678, 343, 29918, 29725, 353, 7442, 29889, 2616, 2674, 403, 29898, 29891, 29918, 29920, 29918, 13628, 29892, 343, 29918, 29920, 29918, 13628, 29892, 4464, 2433, 17642, 1495, 13, 13, 1678, 396, 6216, 278, 3659, 310, 263, 330, 17019, 304, 278, 19869, 740, 13, 1678, 822, 6410, 29898, 29886, 1125, 13, 4706, 736, 282, 29961, 29900, 29962, 334, 6056, 29889, 5140, 29898, 29916, 29892, 29871, 29900, 29892, 282, 29961, 29896, 2314, 448, 343, 29918, 29725, 13, 13, 1678, 282, 29918, 2344, 353, 7442, 29889, 2378, 3552, 9302, 29889, 3317, 29898, 29891, 29918, 29725, 511, 29871, 29896, 29889, 29900, 876, 13, 1678, 282, 29918, 2455, 353, 24656, 29889, 280, 579, 3044, 29898, 6758, 29892, 282, 29918, 2344, 9601, 29900, 29962, 13, 13, 1678, 396, 736, 278, 3918, 29522, 13, 1678, 736, 282, 29918, 2455, 29961, 29896, 29962, 13, 13, 2 ]
tests/test_providers/test_cryptographic.py
Shanmugapriya03/mimesis
1
66086
<gh_stars>1-10 import re import pytest from mimesis import Cryptographic from mimesis.enums import Algorithm from mimesis.exceptions import NonEnumerableError from . import patterns class TestCryptographic(object): @pytest.fixture def crypto(self): return Cryptographic() def test_str(self, crypto): assert re.match(patterns.PROVIDER_STR_REGEX, str(crypto)) def test_uuid(self, crypto): assert re.match(patterns.UUID_REGEX, crypto.uuid()) @pytest.mark.parametrize( 'algorithm, length', [ (Algorithm.MD5, 32), (Algorithm.SHA1, 40), (Algorithm.SHA224, 56), (Algorithm.SHA256, 64), (Algorithm.SHA384, 96), (Algorithm.SHA512, 128), ], ) def test_hash(self, crypto, algorithm, length): result = crypto.hash(algorithm=algorithm) assert len(result) == length def test_hash_non_enum(self, crypto): with pytest.raises(NonEnumerableError): crypto.hash(algorithm='nil') @pytest.mark.parametrize('entropy', [32, 64, 128]) def test_token_bytes(self, crypto, entropy): result = crypto.token_bytes(entropy=entropy) assert len(result) == entropy assert isinstance(result, bytes) @pytest.mark.parametrize('entropy', [32, 64, 128]) def test_token_hex(self, crypto, entropy): result = crypto.token_hex(entropy=entropy) # Each byte converted to two hex digits. assert len(result) == entropy * 2 assert isinstance(result, str) @pytest.mark.parametrize('entropy', [32, 64, 128]) def test_token_urlsafe(self, crypto, entropy): result = crypto.token_urlsafe(entropy=entropy) assert len(result) > entropy assert isinstance(result, str) @pytest.mark.parametrize( 'length', [ 8, 16, ], ) def test_mnemonic_phrase(self, crypto, length): result = crypto.mnemonic_phrase(length=length) assert isinstance(result, str) result = result.split(' ') assert len(result) == length class TestSeededCryptographic(object): @pytest.fixture def c1(self, seed): return Cryptographic(seed=seed) @pytest.fixture def c2(self, seed): return Cryptographic(seed=seed) def test_uuid(self, c1, c2): assert c1.uuid() == c2.uuid() def test_hash(self, c1, c2): assert c1.hash() == c2.hash() assert c1.hash(algorithm=Algorithm.SHA512) == \ c2.hash(algorithm=Algorithm.SHA512) def test_mnemonic_phrase(self, c1, c2): assert c1.mnemonic_phrase() == c2.mnemonic_phrase() assert c1.mnemonic_phrase(length=16) == \ c2.mnemonic_phrase(length=16)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 337, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 286, 1355, 275, 1053, 315, 4641, 12122, 13, 3166, 286, 1355, 275, 29889, 264, 6762, 1053, 29068, 13, 3166, 286, 1355, 275, 29889, 11739, 29879, 1053, 10050, 29923, 14068, 2392, 13, 13, 3166, 869, 1053, 15038, 13, 13, 13, 1990, 4321, 29907, 4641, 12122, 29898, 3318, 1125, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 13, 1678, 822, 274, 17929, 29898, 1311, 1125, 13, 4706, 736, 315, 4641, 12122, 580, 13, 13, 1678, 822, 1243, 29918, 710, 29898, 1311, 29892, 274, 17929, 1125, 13, 4706, 4974, 337, 29889, 4352, 29898, 11037, 29879, 29889, 8618, 13044, 1001, 29918, 10810, 29918, 1525, 1692, 29990, 29892, 851, 29898, 29883, 17929, 876, 13, 13, 1678, 822, 1243, 29918, 25118, 29898, 1311, 29892, 274, 17929, 1125, 13, 4706, 4974, 337, 29889, 4352, 29898, 11037, 29879, 29889, 29965, 11150, 29918, 1525, 1692, 29990, 29892, 274, 17929, 29889, 25118, 3101, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 4706, 525, 20567, 29892, 3309, 742, 518, 13, 9651, 313, 22461, 4540, 29889, 5773, 29945, 29892, 29871, 29941, 29906, 511, 13, 9651, 313, 22461, 4540, 29889, 23498, 29896, 29892, 29871, 29946, 29900, 511, 13, 9651, 313, 22461, 4540, 29889, 23498, 29906, 29906, 29946, 29892, 29871, 29945, 29953, 511, 13, 9651, 313, 22461, 4540, 29889, 23498, 29906, 29945, 29953, 29892, 29871, 29953, 29946, 511, 13, 9651, 313, 22461, 4540, 29889, 23498, 29941, 29947, 29946, 29892, 29871, 29929, 29953, 511, 13, 9651, 313, 22461, 4540, 29889, 23498, 29945, 29896, 29906, 29892, 29871, 29896, 29906, 29947, 511, 13, 4706, 21251, 13, 1678, 1723, 13, 1678, 822, 1243, 29918, 8568, 29898, 1311, 29892, 274, 17929, 29892, 5687, 29892, 3309, 1125, 13, 4706, 1121, 353, 274, 17929, 29889, 8568, 29898, 20567, 29922, 20567, 29897, 13, 4706, 4974, 7431, 29898, 2914, 29897, 1275, 3309, 13, 13, 1678, 822, 1243, 29918, 8568, 29918, 5464, 29918, 18605, 29898, 1311, 29892, 274, 17929, 1125, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 12283, 29923, 14068, 2392, 1125, 13, 9651, 274, 17929, 29889, 8568, 29898, 20567, 2433, 8834, 1495, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 296, 14441, 742, 518, 29941, 29906, 29892, 29871, 29953, 29946, 29892, 29871, 29896, 29906, 29947, 2314, 13, 1678, 822, 1243, 29918, 6979, 29918, 13193, 29898, 1311, 29892, 274, 17929, 29892, 24687, 1125, 13, 4706, 1121, 353, 274, 17929, 29889, 6979, 29918, 13193, 29898, 296, 14441, 29922, 296, 14441, 29897, 13, 4706, 4974, 7431, 29898, 2914, 29897, 1275, 24687, 13, 4706, 4974, 338, 8758, 29898, 2914, 29892, 6262, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 296, 14441, 742, 518, 29941, 29906, 29892, 29871, 29953, 29946, 29892, 29871, 29896, 29906, 29947, 2314, 13, 1678, 822, 1243, 29918, 6979, 29918, 20970, 29898, 1311, 29892, 274, 17929, 29892, 24687, 1125, 13, 4706, 1121, 353, 274, 17929, 29889, 6979, 29918, 20970, 29898, 296, 14441, 29922, 296, 14441, 29897, 13, 4706, 396, 7806, 7023, 11543, 304, 1023, 15090, 13340, 29889, 13, 4706, 4974, 7431, 29898, 2914, 29897, 1275, 24687, 334, 29871, 29906, 13, 4706, 4974, 338, 8758, 29898, 2914, 29892, 851, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 296, 14441, 742, 518, 29941, 29906, 29892, 29871, 29953, 29946, 29892, 29871, 29896, 29906, 29947, 2314, 13, 1678, 822, 1243, 29918, 6979, 29918, 2271, 11177, 29898, 1311, 29892, 274, 17929, 29892, 24687, 1125, 13, 4706, 1121, 353, 274, 17929, 29889, 6979, 29918, 2271, 11177, 29898, 296, 14441, 29922, 296, 14441, 29897, 13, 4706, 4974, 7431, 29898, 2914, 29897, 1405, 24687, 13, 4706, 4974, 338, 8758, 29898, 2914, 29892, 851, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 4706, 525, 2848, 742, 518, 13, 632, 29947, 29892, 13, 632, 29896, 29953, 29892, 13, 4706, 21251, 13, 1678, 1723, 13, 1678, 822, 1243, 29918, 29885, 15344, 8927, 29918, 24588, 559, 29898, 1311, 29892, 274, 17929, 29892, 3309, 1125, 13, 4706, 1121, 353, 274, 17929, 29889, 29885, 15344, 8927, 29918, 24588, 559, 29898, 2848, 29922, 2848, 29897, 13, 4706, 4974, 338, 8758, 29898, 2914, 29892, 851, 29897, 13, 4706, 1121, 353, 1121, 29889, 5451, 877, 25710, 13, 4706, 4974, 7431, 29898, 2914, 29897, 1275, 3309, 13, 13, 13, 1990, 4321, 2008, 19226, 29907, 4641, 12122, 29898, 3318, 1125, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 13, 1678, 822, 274, 29896, 29898, 1311, 29892, 16717, 1125, 13, 4706, 736, 315, 4641, 12122, 29898, 26776, 29922, 26776, 29897, 13, 13, 1678, 732, 2272, 1688, 29889, 7241, 15546, 13, 1678, 822, 274, 29906, 29898, 1311, 29892, 16717, 1125, 13, 4706, 736, 315, 4641, 12122, 29898, 26776, 29922, 26776, 29897, 13, 13, 1678, 822, 1243, 29918, 25118, 29898, 1311, 29892, 274, 29896, 29892, 274, 29906, 1125, 13, 4706, 4974, 274, 29896, 29889, 25118, 580, 1275, 274, 29906, 29889, 25118, 580, 13, 13, 1678, 822, 1243, 29918, 8568, 29898, 1311, 29892, 274, 29896, 29892, 274, 29906, 1125, 13, 4706, 4974, 274, 29896, 29889, 8568, 580, 1275, 274, 29906, 29889, 8568, 580, 13, 4706, 4974, 274, 29896, 29889, 8568, 29898, 20567, 29922, 22461, 4540, 29889, 23498, 29945, 29896, 29906, 29897, 1275, 320, 13, 1669, 274, 29906, 29889, 8568, 29898, 20567, 29922, 22461, 4540, 29889, 23498, 29945, 29896, 29906, 29897, 13, 13, 1678, 822, 1243, 29918, 29885, 15344, 8927, 29918, 24588, 559, 29898, 1311, 29892, 274, 29896, 29892, 274, 29906, 1125, 13, 4706, 4974, 274, 29896, 29889, 29885, 15344, 8927, 29918, 24588, 559, 580, 1275, 274, 29906, 29889, 29885, 15344, 8927, 29918, 24588, 559, 580, 13, 4706, 4974, 274, 29896, 29889, 29885, 15344, 8927, 29918, 24588, 559, 29898, 2848, 29922, 29896, 29953, 29897, 1275, 320, 13, 1669, 274, 29906, 29889, 29885, 15344, 8927, 29918, 24588, 559, 29898, 2848, 29922, 29896, 29953, 29897, 13, 2 ]
bmsapp/views_api_v2.py
alanmitchell/bmon
11
1603917
"""Version 2.x of the API. Relies on functions in API v1. """ import logging from collections import Counter import pytz from django.http import JsonResponse from dateutil.parser import parse from django.views.decorators.csrf import csrf_exempt from bmsapp import models from bmsapp.data_util import weighted_resample_timeseries from bmsapp.readingdb import bmsdata from bmsapp.views_api_v1 import ( fail_payload, invalid_query_params, sensor_info, check_sensor_reading_params ) # Version number of this API API_VERSION = 2.0 # Make a logger for this module _logger = logging.getLogger('bms.' + __name__) @csrf_exempt def api_version(request): """API method that returns the version number of the API """ result = { 'status': 'success', 'data': { 'version': API_VERSION, } } return JsonResponse(result) @csrf_exempt def sensor_readings(request): """API Method. Returns readings from multiple sensors, perhaps time-averaged and filtered by a date/time range. Parameters ---------- request: Django request object The 'request' object can have the following query parameters: sensor_id: The Sensor ID of a sensor to include. This parameter can occur multiple times to request data from multiple sensors. start_ts: (optional) A date/time indicating the earliest reading to return. If not present, the earliest reading in the database is returned. Format is a string date/time, interpretable by dateutil.parser.parse. end_ts: (optional) A date/time indicating the latest reading to return. If not present records through the latest record in the database are returned. Format is a string date/time, interpretable by dateutil.parser.parse. timezone: (optional) A timezone name, present in the pytz.timezone database see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones e.g. "US/Alaska". The timestamps for the sensor readings are returned consistent with this timezone. Also, 'start_ts' and 'end_ts' are interpreted as being in this timezone. If this parameter is not provided, the timezone of the first building associated with the requested sensor is used. If no building is associated with the sensor, UTC is the assumed timezone. averaging: (optional) If provided, sensor readings are averaged into evenly spaced time intervals as indicated by this parameter. The 'averaging' time interval must be provided as a string such as '4H' (4 hours), '2D' (2 days), or any interval describable by Pandas time offset notation: http://pandas.pydata.org/pandas-docs/stable/timeseries.html#offset-aliases label_offset: (optional) Only used if an 'averaging' parameter is provided. This parameter controls what point in the time averaging interval is used to produce the timestamp for the returned reading. 'label_offset' uses the same format as 'averaging', i.e. Pandas time offset notation, and the value is the time distance from the start of averaging interval to the location of the timestamp. For example, a value of '30min' means place the timestamp 30 minutes after the start of the interval. If no 'label_offset' is provided, the 'label_offset' is assumed to be 0, i.e. the starting edge of the averaging interval is marked by the timestamp. Note that the convention in all of the BMON timeseries plots is to place the timestamp at the *center* of the averaging interval; that is *not* the default in this function because of the difficulty in automatically calculating the proper label_offset for the middle of the interval. Returns ------- A JSON response containing an indicator of success or failure, the readings organized how they would be exported from a Pandas DataFrame using the "to_json(orient='split')" method, and the timezone of the timestamps returned. """ try: db = bmsdata.BMSdata() # reading database messages = {} # used to store input validity messages. # get the list of requested sensors sensor_ids = request.GET.getlist('sensor_id') # must be at least one sensor. if len(sensor_ids) == 0: messages['sensor_id'] = 'There must be at least one requested sensor.' # check to see if any are invalid sensors_not_valid = [] for sensor_id in sensor_ids: if not db.sensor_id_exists(sensor_id): sensors_not_valid.append(sensor_id) if len(sensors_not_valid): messages['sensor_id'] = f"Sensors {', '.join(sensors_not_valid)} not present in the reading database." # Check the input parameters and get the values param_messages, start_ts, end_ts, timezone, averaging, label_offset = \ check_sensor_reading_params(request) messages.update(param_messages) # check for extra, improper query parameters messages.update(invalid_query_params(request, ['sensor_id', 'timezone', 'start_ts', 'end_ts', 'averaging', 'label_offset'])) if messages: # Input errors occurred return fail_payload(messages) # if there is no requested timezone (or an invalid one), use the # the most common timezone from the buildings associated with the list of sensors. if timezone is None: timezone = pytz.timezone('UTC') # default timezone if no valid building tz present tzs = [] for sensor in sensor_ids: for bldg in sensor_info(sensor)['buildings']: tzs.append(bldg['timezone']) most_common_tz = Counter(tzs).most_common(1) if most_common_tz: tz_name, tz_count = most_common_tz[0] try: timezone = pytz.timezone(tz_name) except: # stick with default pass # record the name of the final timezone tz_name = str(timezone) # ---- Get the Sensor Readings # if start and end timestamps are present, convert to Unix Epoch values if start_ts: ts_aware = timezone.localize(start_ts) start_ts = ts_aware.timestamp() if end_ts: ts_aware = timezone.localize(end_ts) end_ts = ts_aware.timestamp() # get the sensor readings df = db.dataframeForMultipleIDs(sensor_ids, start_ts=start_ts, end_ts=end_ts, tz=timezone) # if averaging is requested, do it! if averaging and len(df) > 0: df = weighted_resample_timeseries(df,averaging,label_offset).dropna(how='all') # make a dictionary that is formatted with orientation 'split', which is the most # compact form to send the DataFrame result = { 'status': 'success', 'data': { 'readings': df.to_dict(orient='split'), 'reading_timezone': tz_name, } } return JsonResponse(result) except Exception as e: # A processing error occurred. _logger.exception('Error retrieving sensor readings.') result = { 'status': 'error', 'message': str(e) } return JsonResponse(result, status=500) @csrf_exempt def sensors(request): """Returns information about one or more sensors. Parameters ---------- request: Django request object The 'request' object can have the following query parameters: sensor_id: The Sensor ID of a sensor to include. This parameter can occur multiple times to request data from multiple sensors. If the sensor_id parameter is not present, information for **all** sensors is returned. Returns ------- A JSON response containing an indicator of success or failure, a list of sensors including sensor properties and building association information if available. """ try: #------ Check the query parameters messages = invalid_query_params(request, ['sensor_id']) # get a list of all the Sensor IDs in the reading database db = bmsdata.BMSdata() # reading database all_sensor_ids = db.sensor_id_list() # determine the list of Sensor IDs requested by this call sensor_ids = request.GET.getlist('sensor_id') if len(sensor_ids) == 0: # no sensors were in the request, which means this should # return all sensors. sensor_ids = all_sensor_ids else: # check to make sure all the Sensor IDs are valid. invalid_ids = set(sensor_ids) - set(all_sensor_ids) if len(invalid_ids): messages['sensor_id'] = f"Invalid Sensor IDs: {', '.join(list(invalid_ids))}" if messages: return fail_payload(messages) fields_to_exclude = ['_state'] def clean_sensor(s): """Function to clean up Sensor object property dictionary and add some additional info. Parameter 's' is the dictionary of the Django Sensor object, gotten from sensor.__dict__ """ # remove fields to exclude for fld in fields_to_exclude: s.pop(fld, None) # look up the sensor units if present unit_id = s.pop('unit_id') if unit_id: unit = models.Unit.objects.get(pk=unit_id) s['unit'] = unit.label else: s['unit'] = '' # Add a list of buildings that this sensor is associated with. if s['id'] is not None: bldgs = [] for link in models.BldgToSensor.objects.filter(sensor=s['id']): bldgs.append( {'bldg_id': link.building.pk, 'sensor_group': link.sensor_group.title, 'sort_order': link.sort_order} ) s['buildings'] = bldgs else: # no buildings s['buildings'] = [] return s sensors = [] # list holding sensor information to return # get a default dictionary to use if the Sensor ID is not in the Django model # object list. default_props = models.Sensor().__dict__ for sensor_id in sensor_ids: try: sensor = models.Sensor.objects.get(sensor_id=sensor_id) sensor_props = sensor.__dict__ except: # No Django sensor object yet (this is an unassigned sensor). # Use default values sensor_props = default_props.copy() sensor_props['sensor_id'] = sensor_id sensors.append(clean_sensor(sensor_props)) result = { 'status': 'success', 'data': { 'sensors': sensors, } } return JsonResponse(result) except Exception as e: # A processing error occurred. _logger.exception('Error retrieving sensor information') result = { 'status': 'error', 'message': str(e) } return JsonResponse(result, status=500) @csrf_exempt def buildings(request): """Returns information about one or more buildings. Parameters ---------- request: Django request object The 'request' object can have the following query parameters: building_id: The Building ID (Django model primary key) of a building to include. This parameter can occur multiple times to request data from multiple buildings. If the building_id parameter is not present, information for **all** buildings is returned. Returns ------- A JSON response containing an indicator of success or failure, a list of buildings including building properties and sensor association information if available. For fuel_rate and electric_rate fields, associated objects are substituted for the IDs. """ try: #------ Check the query parameters messages = invalid_query_params(request, ['building_id']) # Make a list of all building IDs. all_bldg_ids = [b.pk for b in models.Building.objects.all()] # determine the list of Building IDs requested by this call bldg_ids = request.GET.getlist('building_id') bldg_ids = [int(i) for i in bldg_ids] if len(bldg_ids) == 0: # no builidings were in the request, which means this should # return all buildings. bldg_ids = all_bldg_ids else: # check to make sure all the Building IDs are valid. invalid_ids = set(bldg_ids) - set(all_bldg_ids) if len(invalid_ids): invalid_ids = [str(i) for i in invalid_ids] messages['building_id'] = f"Invalid Building IDs: {', '.join(list(invalid_ids))}" if messages: return fail_payload(messages) fields_to_exclude = ['_state'] def clean_bldg(b): """Function to clean up Building object property dictionary and add some additional info. Parameter 'b' is the dictionary of the Django Building object, gotten from building.__dict__ """ # remove fields to exclude for fld in fields_to_exclude: b.pop(fld, None) # look up the current Building mode if present current_mode_id = b.pop('current_mode_id') if current_mode_id: current_mode = models.BuildingMode.objects.get(pk=current_mode_id) b['current_mode'] = current_mode.name else: b['current_mode'] = '' # Add the fuel and elecric rate objects fuel_rate_id = b.pop('fuel_rate_id') if fuel_rate_id: b['fuel_rate'] = models.FuelRate.objects.get(pk=fuel_rate_id).__dict__ b['fuel_rate'].pop('_state') else: b['fuel_rate'] = None electric_rate_id = b.pop('electric_rate_id') if electric_rate_id: b['electric_rate'] = models.ElectricRate.objects.get(pk=electric_rate_id).__dict__ b['electric_rate'].pop('_state') else: b['electric_rate'] = None # Add a list of sensors that this building is associated with. # Note that the Sensor ID here is not the Django model primay key; it # is the sensor_id field of the Sensor object, to be consistent with the # sensors() endpoint of this API. sensors = [] for link in models.BldgToSensor.objects.filter(building=b['id']): sensors.append( {'sensor_id': link.sensor.sensor_id, 'sensor_group': link.sensor_group.title, 'sort_order': link.sort_order} ) b['sensors'] = sensors # Add a list of organizations that this building is associated with. orgs = [] for org in models.Organization.objects.filter(buildings=b['id']): orgs.append( (org.pk, org.title) ) b['organizations'] = orgs return b bldgs = [] # list holding building information to return for bldg_id in bldg_ids: bldg = models.Building.objects.get(pk=bldg_id) bldg_props = bldg.__dict__ bldgs.append(clean_bldg(bldg_props)) result = { 'status': 'success', 'data': { 'buildings': bldgs, } } return JsonResponse(result) except Exception as e: # A processing error occurred. _logger.exception('Error retrieving building information') result = { 'status': 'error', 'message': str(e) } return JsonResponse(result, status=500) @csrf_exempt def organizations(request): """Returns information about one or more organizations. Parameters ---------- request: Django request object The 'request' object can have the following query parameters: organization_id: The Organization ID (Django model primary key) of a organization to include. This parameter can occur multiple times to request data from multiple organizations. If the organization_id parameter is not present, information for **all** organizations is returned. Returns ------- A JSON response containing an indicator of success or failure, a list of organizations including organization properties and building association information if available. """ try: #------ Check the query parameters messages = invalid_query_params(request, ['organization_id']) # Make a list of all organization IDs. all_org_ids = [o.pk for o in models.Organization.objects.all()] # determine the list of Organization IDs requested by this call org_ids = request.GET.getlist('organization_id') org_ids = [int(i) for i in org_ids] if len(org_ids) == 0: # no builidings were in the request, which means this should # return all buildings. org_ids = all_org_ids else: # check to make sure all the Organization IDs are valid. invalid_ids = set(org_ids) - set(all_org_ids) if len(invalid_ids): invalid_ids = [str(i) for i in invalid_ids] messages['organization_id'] = f"Invalid Organization IDs: {', '.join(list(invalid_ids))}" if messages: return fail_payload(messages) fields_to_exclude = ['_state'] def clean_org(o): """Function to clean up Organization object property dictionary and add some additional info. Parameter 'o' is the dictionary of the Django Organization object, gotten from organization.__dict__ """ # remove fields to exclude for fld in fields_to_exclude: o.pop(fld, None) return o orgs = [] # list holding building information to return for org_id in org_ids: org = models.Organization.objects.get(pk=org_id) org_props = org.__dict__ # Add associated buildings bldgs = [] for bldg in org.buildings.all(): bldgs.append( (bldg.pk, bldg.title) ) org_props['buildings'] = bldgs orgs.append(clean_org(org_props)) result = { 'status': 'success', 'data': { 'organizations': orgs, } } return JsonResponse(result) except Exception as e: # A processing error occurred. _logger.exception('Error retrieving organization information') result = { 'status': 'error', 'message': str(e) } return JsonResponse(result, status=500)
[ 1, 9995, 6594, 29871, 29906, 29889, 29916, 310, 278, 3450, 29889, 29871, 6376, 583, 373, 3168, 297, 3450, 325, 29896, 29889, 13, 15945, 29908, 13, 5215, 12183, 13, 3166, 16250, 1053, 315, 5336, 13, 13, 5215, 282, 3637, 29920, 13, 3166, 9557, 29889, 1124, 1053, 14355, 5103, 13, 3166, 2635, 4422, 29889, 16680, 1053, 6088, 13, 3166, 9557, 29889, 7406, 29889, 19557, 4097, 29889, 2395, 9600, 1053, 5939, 9600, 29918, 735, 3456, 13, 13, 3166, 289, 1516, 932, 1053, 4733, 13, 3166, 289, 1516, 932, 29889, 1272, 29918, 4422, 1053, 7688, 287, 29918, 690, 981, 29918, 3706, 6358, 13, 13, 3166, 289, 1516, 932, 29889, 19715, 2585, 1053, 289, 1516, 1272, 13, 3166, 289, 1516, 932, 29889, 7406, 29918, 2754, 29918, 29894, 29896, 1053, 313, 13, 1678, 4418, 29918, 23813, 29892, 29871, 13, 1678, 8340, 29918, 1972, 29918, 7529, 29892, 13, 1678, 23530, 29918, 3888, 29892, 13, 1678, 1423, 29918, 29879, 6073, 29918, 19715, 29918, 7529, 13, 29897, 13, 13, 29937, 10079, 1353, 310, 445, 3450, 13, 8787, 29918, 16358, 353, 29871, 29906, 29889, 29900, 13, 13, 29937, 8561, 263, 17927, 363, 445, 3883, 13, 29918, 21707, 353, 12183, 29889, 657, 16363, 877, 29890, 1516, 6169, 718, 4770, 978, 1649, 29897, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 7882, 29918, 3259, 29898, 3827, 1125, 13, 1678, 9995, 8787, 1158, 393, 3639, 278, 1873, 1353, 310, 278, 3450, 13, 1678, 9995, 13, 1678, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 8698, 742, 13, 9651, 525, 1272, 2396, 426, 13, 18884, 525, 3259, 2396, 3450, 29918, 16358, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 1678, 736, 14355, 5103, 29898, 2914, 29897, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 23530, 29918, 949, 886, 29898, 3827, 1125, 13, 1678, 9995, 8787, 8108, 29889, 29871, 16969, 1303, 886, 515, 2999, 4771, 943, 29892, 6060, 931, 29899, 12483, 4063, 13, 1678, 322, 22289, 491, 263, 2635, 29914, 2230, 3464, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2009, 29901, 1678, 15337, 2009, 1203, 13, 13, 1678, 450, 525, 3827, 29915, 1203, 508, 505, 278, 1494, 2346, 4128, 29901, 13, 4706, 23530, 29918, 333, 29901, 450, 317, 6073, 3553, 310, 263, 23530, 304, 3160, 29889, 29871, 910, 3443, 508, 6403, 13, 9651, 2999, 3064, 304, 2009, 848, 515, 2999, 4771, 943, 29889, 13, 4706, 1369, 29918, 1372, 29901, 313, 25253, 29897, 319, 2635, 29914, 2230, 23941, 278, 24577, 5183, 304, 736, 29889, 13, 9651, 960, 451, 2198, 29892, 278, 24577, 5183, 297, 278, 2566, 338, 4133, 29889, 13, 9651, 19191, 338, 263, 1347, 2635, 29914, 2230, 29892, 5133, 2371, 491, 2635, 4422, 29889, 16680, 29889, 5510, 29889, 13, 4706, 1095, 29918, 1372, 29901, 313, 25253, 29897, 319, 2635, 29914, 2230, 23941, 278, 9281, 5183, 304, 736, 29889, 13, 9651, 960, 451, 2198, 6475, 1549, 278, 9281, 2407, 297, 278, 2566, 526, 4133, 29889, 13, 9651, 19191, 338, 263, 1347, 2635, 29914, 2230, 29892, 5133, 2371, 491, 2635, 4422, 29889, 16680, 29889, 5510, 29889, 13, 4706, 29431, 29901, 313, 25253, 29897, 319, 29431, 1024, 29892, 2198, 297, 278, 282, 3637, 29920, 29889, 2230, 8028, 2566, 13, 9651, 1074, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 1293, 29918, 974, 29918, 17559, 29918, 9803, 29918, 2230, 29918, 29920, 2873, 13, 9651, 321, 29889, 29887, 29889, 376, 3308, 29914, 2499, 16191, 1642, 29871, 450, 5335, 342, 15092, 363, 278, 23530, 1303, 886, 526, 4133, 13, 9651, 13747, 411, 445, 29431, 29889, 29871, 3115, 29892, 525, 2962, 29918, 1372, 29915, 322, 525, 355, 29918, 1372, 29915, 526, 21551, 13, 9651, 408, 1641, 297, 445, 29431, 29889, 29871, 960, 445, 3443, 338, 451, 4944, 29892, 278, 29431, 310, 13, 9651, 278, 937, 5214, 6942, 411, 278, 13877, 23530, 338, 1304, 29889, 29871, 960, 694, 13, 9651, 5214, 338, 6942, 411, 278, 23530, 29892, 17998, 338, 278, 12023, 29431, 29889, 13, 4706, 4759, 6751, 29901, 313, 25253, 29897, 960, 4944, 29892, 23530, 1303, 886, 526, 4759, 4063, 964, 1584, 368, 26325, 287, 13, 9651, 931, 18747, 408, 18694, 491, 445, 3443, 29889, 29871, 450, 525, 12483, 6751, 29915, 931, 7292, 13, 9651, 1818, 367, 4944, 408, 263, 1347, 1316, 408, 525, 29946, 29950, 29915, 313, 29946, 6199, 511, 525, 29906, 29928, 29915, 313, 29906, 3841, 511, 470, 738, 7292, 13, 9651, 2342, 29890, 519, 491, 349, 7086, 931, 9210, 12640, 29901, 13, 9651, 1732, 597, 15112, 29889, 2272, 1272, 29889, 990, 29914, 15112, 29899, 2640, 29914, 13844, 29914, 3706, 6358, 29889, 1420, 29937, 10289, 29899, 2606, 2129, 13, 4706, 3858, 29918, 10289, 29901, 313, 25253, 29897, 9333, 1304, 565, 385, 525, 12483, 6751, 29915, 3443, 338, 4944, 29889, 29871, 910, 13, 9651, 3443, 11761, 825, 1298, 297, 278, 931, 4759, 6751, 7292, 338, 1304, 304, 7738, 13, 9651, 278, 14334, 363, 278, 4133, 5183, 29889, 29871, 525, 1643, 29918, 10289, 29915, 3913, 278, 1021, 3402, 408, 13, 9651, 525, 12483, 6751, 742, 474, 29889, 29872, 29889, 349, 7086, 931, 9210, 12640, 29892, 322, 278, 995, 338, 278, 931, 5418, 13, 9651, 515, 278, 1369, 310, 4759, 6751, 7292, 304, 278, 4423, 310, 278, 14334, 29889, 1152, 1342, 29892, 13, 9651, 263, 995, 310, 525, 29941, 29900, 1195, 29915, 2794, 2058, 278, 14334, 29871, 29941, 29900, 6233, 1156, 278, 1369, 310, 278, 13, 9651, 7292, 29889, 13, 9651, 960, 694, 525, 1643, 29918, 10289, 29915, 338, 4944, 29892, 278, 525, 1643, 29918, 10289, 29915, 338, 12023, 304, 367, 29871, 29900, 29892, 474, 29889, 29872, 29889, 13, 9651, 278, 6257, 7636, 310, 278, 4759, 6751, 7292, 338, 10902, 491, 278, 14334, 29889, 29871, 3940, 13, 9651, 393, 278, 15687, 297, 599, 310, 278, 350, 22877, 3064, 6358, 24580, 338, 304, 2058, 278, 14334, 13, 9651, 472, 278, 334, 5064, 29930, 310, 278, 4759, 6751, 7292, 29936, 393, 338, 334, 1333, 29930, 278, 2322, 297, 445, 13, 9651, 740, 1363, 310, 278, 14656, 297, 6336, 25202, 278, 1571, 13, 9651, 3858, 29918, 10289, 363, 278, 7256, 310, 278, 7292, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 319, 4663, 2933, 6943, 385, 27717, 310, 2551, 470, 10672, 29892, 278, 1303, 886, 19098, 13, 1678, 920, 896, 723, 367, 5609, 287, 515, 263, 349, 7086, 3630, 4308, 773, 278, 376, 517, 29918, 3126, 29898, 12236, 2433, 5451, 1495, 29908, 13, 1678, 1158, 29892, 322, 278, 29431, 310, 278, 5335, 342, 15092, 4133, 29889, 13, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 13, 4706, 4833, 353, 289, 1516, 1272, 29889, 29933, 4345, 1272, 580, 29871, 396, 5183, 2566, 13, 13, 4706, 7191, 353, 6571, 259, 396, 1304, 304, 3787, 1881, 2854, 537, 7191, 29889, 13, 13, 4706, 396, 679, 278, 1051, 310, 13877, 4771, 943, 13, 4706, 23530, 29918, 4841, 353, 2009, 29889, 7194, 29889, 657, 1761, 877, 29879, 6073, 29918, 333, 1495, 13, 13, 4706, 396, 1818, 367, 472, 3203, 697, 23530, 29889, 13, 4706, 565, 7431, 29898, 29879, 6073, 29918, 4841, 29897, 1275, 29871, 29900, 29901, 13, 9651, 7191, 1839, 29879, 6073, 29918, 333, 2033, 353, 29871, 525, 8439, 1818, 367, 472, 3203, 697, 13877, 23530, 6169, 29871, 13, 13, 4706, 396, 1423, 304, 1074, 565, 738, 526, 8340, 13, 4706, 4771, 943, 29918, 1333, 29918, 3084, 353, 5159, 13, 4706, 363, 23530, 29918, 333, 297, 23530, 29918, 4841, 29901, 13, 9651, 565, 451, 4833, 29889, 29879, 6073, 29918, 333, 29918, 9933, 29898, 29879, 6073, 29918, 333, 1125, 13, 18884, 4771, 943, 29918, 1333, 29918, 3084, 29889, 4397, 29898, 29879, 6073, 29918, 333, 29897, 13, 4706, 565, 7431, 29898, 23149, 943, 29918, 1333, 29918, 3084, 1125, 13, 9651, 7191, 1839, 29879, 6073, 29918, 333, 2033, 353, 285, 29908, 29903, 575, 943, 426, 742, 15300, 7122, 29898, 23149, 943, 29918, 1333, 29918, 3084, 2915, 451, 2198, 297, 278, 5183, 2566, 1213, 13, 13, 4706, 396, 5399, 278, 1881, 4128, 322, 679, 278, 1819, 13, 4706, 1828, 29918, 19158, 29892, 1369, 29918, 1372, 29892, 1095, 29918, 1372, 29892, 29431, 29892, 4759, 6751, 29892, 3858, 29918, 10289, 353, 320, 13, 9651, 1423, 29918, 29879, 6073, 29918, 19715, 29918, 7529, 29898, 3827, 29897, 13, 4706, 7191, 29889, 5504, 29898, 3207, 29918, 19158, 29897, 13, 13, 4706, 396, 1423, 363, 4805, 29892, 4857, 546, 2346, 4128, 13, 4706, 7191, 29889, 5504, 29898, 20965, 29918, 1972, 29918, 7529, 29898, 3827, 29892, 13, 462, 462, 632, 6024, 29879, 6073, 29918, 333, 742, 525, 2230, 8028, 742, 525, 2962, 29918, 1372, 742, 525, 355, 29918, 1372, 742, 525, 12483, 6751, 742, 525, 1643, 29918, 10289, 25901, 13, 13, 4706, 565, 7191, 29901, 13, 9651, 396, 10567, 4436, 10761, 13, 9651, 736, 4418, 29918, 23813, 29898, 19158, 29897, 13, 13, 4706, 396, 565, 727, 338, 694, 13877, 29431, 313, 272, 385, 8340, 697, 511, 671, 278, 13, 4706, 396, 278, 1556, 3619, 29431, 515, 278, 13814, 6942, 411, 278, 1051, 310, 4771, 943, 29889, 13, 4706, 565, 29431, 338, 6213, 29901, 13, 9651, 29431, 353, 282, 3637, 29920, 29889, 2230, 8028, 877, 26913, 1495, 259, 396, 2322, 29431, 565, 694, 2854, 5214, 260, 29920, 2198, 13, 9651, 260, 22381, 353, 5159, 13, 9651, 363, 23530, 297, 23530, 29918, 4841, 29901, 13, 18884, 363, 289, 430, 29887, 297, 23530, 29918, 3888, 29898, 29879, 6073, 29897, 1839, 4282, 886, 2033, 29901, 13, 462, 1678, 260, 22381, 29889, 4397, 29898, 29890, 430, 29887, 1839, 2230, 8028, 11287, 29871, 13, 9651, 1556, 29918, 9435, 29918, 17559, 353, 315, 5336, 29898, 17559, 29879, 467, 3242, 29918, 9435, 29898, 29896, 29897, 13, 9651, 565, 1556, 29918, 9435, 29918, 17559, 29901, 13, 18884, 260, 29920, 29918, 978, 29892, 260, 29920, 29918, 2798, 353, 1556, 29918, 9435, 29918, 17559, 29961, 29900, 29962, 13, 18884, 1018, 29901, 13, 462, 1678, 29431, 353, 282, 3637, 29920, 29889, 2230, 8028, 29898, 17559, 29918, 978, 29897, 13, 18884, 5174, 29901, 13, 462, 1678, 396, 12070, 411, 2322, 13, 462, 1678, 1209, 13, 13, 4706, 396, 2407, 278, 1024, 310, 278, 2186, 29431, 13, 4706, 260, 29920, 29918, 978, 353, 851, 29898, 2230, 8028, 29897, 13, 13, 4706, 396, 23250, 3617, 278, 317, 6073, 7523, 886, 13, 4706, 396, 565, 1369, 322, 1095, 5335, 342, 15092, 526, 2198, 29892, 3588, 304, 26663, 382, 1129, 305, 1819, 13, 4706, 565, 1369, 29918, 1372, 29901, 13, 9651, 18696, 29918, 28327, 353, 29431, 29889, 2997, 675, 29898, 2962, 29918, 1372, 29897, 13, 9651, 1369, 29918, 1372, 353, 18696, 29918, 28327, 29889, 16394, 580, 13, 13, 4706, 565, 1095, 29918, 1372, 29901, 13, 9651, 18696, 29918, 28327, 353, 29431, 29889, 2997, 675, 29898, 355, 29918, 1372, 29897, 13, 9651, 1095, 29918, 1372, 353, 18696, 29918, 28327, 29889, 16394, 580, 13, 13, 4706, 396, 679, 278, 23530, 1303, 886, 13, 4706, 4489, 353, 4833, 29889, 1272, 2557, 2831, 15329, 552, 1367, 29879, 29898, 29879, 6073, 29918, 4841, 29892, 1369, 29918, 1372, 29922, 2962, 29918, 1372, 29892, 1095, 29918, 1372, 29922, 355, 29918, 1372, 29892, 260, 29920, 29922, 2230, 8028, 29897, 13, 13, 4706, 396, 565, 4759, 6751, 338, 13877, 29892, 437, 372, 29991, 13, 4706, 565, 4759, 6751, 322, 7431, 29898, 2176, 29897, 1405, 29871, 29900, 29901, 13, 9651, 4489, 353, 7688, 287, 29918, 690, 981, 29918, 3706, 6358, 29898, 2176, 29892, 12483, 6751, 29892, 1643, 29918, 10289, 467, 8865, 1056, 29898, 3525, 2433, 497, 1495, 13, 13, 4706, 396, 1207, 263, 8600, 393, 338, 20917, 411, 19843, 525, 5451, 742, 607, 338, 278, 1556, 13, 4706, 396, 11071, 883, 304, 3638, 278, 3630, 4308, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 8698, 742, 13, 9651, 525, 1272, 2396, 426, 13, 18884, 525, 949, 886, 2396, 4489, 29889, 517, 29918, 8977, 29898, 12236, 2433, 5451, 5477, 13, 18884, 525, 19715, 29918, 2230, 8028, 2396, 260, 29920, 29918, 978, 29892, 13, 9651, 500, 13, 4706, 500, 13, 13, 4706, 736, 14355, 5103, 29898, 2914, 29897, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 396, 319, 9068, 1059, 10761, 29889, 13, 4706, 903, 21707, 29889, 11739, 877, 2392, 5663, 15387, 23530, 1303, 886, 29889, 1495, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 2704, 742, 13, 9651, 525, 4906, 2396, 851, 29898, 29872, 29897, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29892, 4660, 29922, 29945, 29900, 29900, 29897, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 4771, 943, 29898, 3827, 1125, 13, 1678, 9995, 11609, 29879, 2472, 1048, 697, 470, 901, 4771, 943, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2009, 29901, 1678, 15337, 2009, 1203, 13, 13, 1678, 450, 525, 3827, 29915, 1203, 508, 505, 278, 1494, 2346, 4128, 29901, 13, 4706, 23530, 29918, 333, 29901, 450, 317, 6073, 3553, 310, 263, 23530, 304, 3160, 29889, 29871, 910, 3443, 508, 6403, 13, 9651, 2999, 3064, 304, 2009, 848, 515, 2999, 4771, 943, 29889, 29871, 960, 278, 23530, 29918, 333, 13, 9651, 3443, 338, 451, 2198, 29892, 2472, 363, 3579, 497, 1068, 4771, 943, 338, 4133, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 319, 4663, 2933, 6943, 385, 27717, 310, 2551, 470, 10672, 29892, 263, 1051, 310, 13, 1678, 4771, 943, 3704, 23530, 4426, 322, 5214, 15477, 2472, 13, 1678, 565, 3625, 29889, 13, 1678, 9995, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 22158, 5399, 278, 2346, 4128, 13, 4706, 7191, 353, 8340, 29918, 1972, 29918, 7529, 29898, 3827, 29892, 6024, 29879, 6073, 29918, 333, 11287, 13, 4706, 396, 679, 263, 1051, 310, 599, 278, 317, 6073, 23481, 297, 278, 5183, 2566, 13, 4706, 4833, 353, 289, 1516, 1272, 29889, 29933, 4345, 1272, 580, 29871, 396, 5183, 2566, 13, 4706, 599, 29918, 29879, 6073, 29918, 4841, 353, 4833, 29889, 29879, 6073, 29918, 333, 29918, 1761, 580, 13, 13, 4706, 396, 8161, 278, 1051, 310, 317, 6073, 23481, 13877, 491, 445, 1246, 13, 4706, 23530, 29918, 4841, 353, 2009, 29889, 7194, 29889, 657, 1761, 877, 29879, 6073, 29918, 333, 1495, 13, 13, 4706, 565, 7431, 29898, 29879, 6073, 29918, 4841, 29897, 1275, 29871, 29900, 29901, 13, 9651, 396, 694, 4771, 943, 892, 297, 278, 2009, 29892, 607, 2794, 445, 881, 13, 9651, 396, 736, 599, 4771, 943, 29889, 13, 9651, 23530, 29918, 4841, 353, 599, 29918, 29879, 6073, 29918, 4841, 13, 4706, 1683, 29901, 13, 9651, 396, 1423, 304, 1207, 1854, 599, 278, 317, 6073, 23481, 526, 2854, 29889, 13, 9651, 8340, 29918, 4841, 353, 731, 29898, 29879, 6073, 29918, 4841, 29897, 448, 731, 29898, 497, 29918, 29879, 6073, 29918, 4841, 29897, 13, 9651, 565, 7431, 29898, 20965, 29918, 4841, 1125, 13, 18884, 7191, 1839, 29879, 6073, 29918, 333, 2033, 353, 285, 29908, 13919, 317, 6073, 23481, 29901, 426, 742, 15300, 7122, 29898, 1761, 29898, 20965, 29918, 4841, 876, 5038, 13, 308, 13, 4706, 565, 7191, 29901, 13, 9651, 736, 4418, 29918, 23813, 29898, 19158, 29897, 13, 13, 4706, 4235, 29918, 517, 29918, 735, 2325, 353, 6024, 29918, 3859, 2033, 13, 4706, 822, 5941, 29918, 29879, 6073, 29898, 29879, 1125, 13, 9651, 9995, 6678, 304, 5941, 701, 317, 6073, 1203, 2875, 8600, 322, 13, 9651, 788, 777, 5684, 5235, 29889, 13, 9651, 24953, 525, 29879, 29915, 338, 278, 8600, 310, 278, 15337, 317, 6073, 1203, 29892, 2355, 841, 13, 9651, 515, 23530, 17255, 8977, 1649, 13, 9651, 9995, 13, 9651, 396, 3349, 4235, 304, 19060, 13, 9651, 363, 285, 430, 297, 4235, 29918, 517, 29918, 735, 2325, 29901, 13, 18884, 269, 29889, 7323, 29898, 29888, 430, 29892, 6213, 29897, 13, 13, 9651, 396, 1106, 701, 278, 23530, 10340, 565, 2198, 13, 9651, 5190, 29918, 333, 353, 269, 29889, 7323, 877, 5441, 29918, 333, 1495, 13, 9651, 565, 5190, 29918, 333, 29901, 13, 18884, 5190, 353, 4733, 29889, 8325, 29889, 12650, 29889, 657, 29898, 20571, 29922, 5441, 29918, 333, 29897, 13, 18884, 269, 1839, 5441, 2033, 353, 5190, 29889, 1643, 13, 9651, 1683, 29901, 13, 18884, 269, 1839, 5441, 2033, 353, 6629, 13, 13, 9651, 396, 3462, 263, 1051, 310, 13814, 393, 445, 23530, 338, 6942, 411, 29889, 13, 9651, 565, 269, 1839, 333, 2033, 338, 451, 6213, 29901, 13, 18884, 289, 430, 3174, 353, 5159, 13, 18884, 363, 1544, 297, 4733, 29889, 29933, 430, 29887, 1762, 29903, 6073, 29889, 12650, 29889, 4572, 29898, 29879, 6073, 29922, 29879, 1839, 333, 2033, 1125, 13, 462, 1678, 289, 430, 3174, 29889, 4397, 29898, 29871, 13, 462, 4706, 11117, 29890, 430, 29887, 29918, 333, 2396, 1544, 29889, 25237, 29889, 20571, 29892, 29871, 13, 462, 4706, 525, 29879, 6073, 29918, 2972, 2396, 1544, 29889, 29879, 6073, 29918, 2972, 29889, 3257, 29892, 13, 462, 4706, 525, 6605, 29918, 2098, 2396, 1544, 29889, 6605, 29918, 2098, 29913, 29871, 13, 462, 1678, 1723, 13, 18884, 269, 1839, 4282, 886, 2033, 353, 289, 430, 3174, 13, 9651, 1683, 29901, 13, 18884, 396, 694, 13814, 29871, 13, 18884, 269, 1839, 4282, 886, 2033, 353, 5159, 13, 632, 13, 9651, 736, 269, 13, 13, 4706, 4771, 943, 353, 5159, 1678, 396, 1051, 13587, 23530, 2472, 304, 736, 13, 13, 4706, 396, 679, 263, 2322, 8600, 304, 671, 565, 278, 317, 6073, 3553, 338, 451, 297, 278, 15337, 1904, 13, 4706, 396, 1203, 1051, 29889, 13, 4706, 2322, 29918, 11030, 353, 4733, 29889, 29903, 6073, 2141, 1649, 8977, 1649, 13, 4706, 363, 23530, 29918, 333, 297, 23530, 29918, 4841, 29901, 13, 13, 9651, 1018, 29901, 13, 18884, 23530, 353, 4733, 29889, 29903, 6073, 29889, 12650, 29889, 657, 29898, 29879, 6073, 29918, 333, 29922, 29879, 6073, 29918, 333, 29897, 13, 18884, 23530, 29918, 11030, 353, 23530, 17255, 8977, 1649, 13, 9651, 5174, 29901, 13, 18884, 396, 1939, 15337, 23530, 1203, 3447, 313, 1366, 338, 385, 443, 465, 12961, 23530, 467, 13, 18884, 396, 4803, 2322, 1819, 13, 18884, 23530, 29918, 11030, 353, 2322, 29918, 11030, 29889, 8552, 580, 13, 18884, 23530, 29918, 11030, 1839, 29879, 6073, 29918, 333, 2033, 353, 23530, 29918, 333, 13, 9651, 4771, 943, 29889, 4397, 29898, 14941, 29918, 29879, 6073, 29898, 29879, 6073, 29918, 11030, 876, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 8698, 742, 13, 9651, 525, 1272, 2396, 426, 13, 18884, 525, 23149, 943, 2396, 4771, 943, 29892, 13, 9651, 500, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29897, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 396, 319, 9068, 1059, 10761, 29889, 13, 4706, 903, 21707, 29889, 11739, 877, 2392, 5663, 15387, 23530, 2472, 1495, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 2704, 742, 13, 9651, 525, 4906, 2396, 851, 29898, 29872, 29897, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29892, 4660, 29922, 29945, 29900, 29900, 29897, 13, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 13814, 29898, 3827, 1125, 13, 1678, 9995, 11609, 29879, 2472, 1048, 697, 470, 901, 13814, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2009, 29901, 1678, 15337, 2009, 1203, 13, 13, 1678, 450, 525, 3827, 29915, 1203, 508, 505, 278, 1494, 2346, 4128, 29901, 13, 4706, 5214, 29918, 333, 29901, 450, 17166, 3553, 313, 29928, 5364, 1904, 7601, 1820, 29897, 310, 263, 5214, 304, 3160, 29889, 13, 9651, 910, 3443, 508, 6403, 2999, 3064, 304, 2009, 848, 515, 2999, 13814, 29889, 13, 9651, 960, 278, 5214, 29918, 333, 3443, 338, 451, 2198, 29892, 2472, 363, 3579, 497, 1068, 29871, 13, 9651, 13814, 338, 4133, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 319, 4663, 2933, 6943, 385, 27717, 310, 2551, 470, 10672, 29892, 263, 1051, 310, 13, 1678, 13814, 3704, 5214, 4426, 322, 23530, 15477, 2472, 13, 1678, 565, 3625, 29889, 29871, 1152, 26413, 29918, 10492, 322, 12646, 29918, 10492, 4235, 29892, 6942, 3618, 13, 1678, 526, 5960, 277, 3860, 363, 278, 23481, 29889, 13, 1678, 9995, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 22158, 5399, 278, 2346, 4128, 13, 4706, 7191, 353, 8340, 29918, 1972, 29918, 7529, 29898, 3827, 29892, 6024, 25237, 29918, 333, 11287, 13, 13, 4706, 396, 8561, 263, 1051, 310, 599, 5214, 23481, 29889, 13, 4706, 599, 29918, 29890, 430, 29887, 29918, 4841, 353, 29871, 518, 29890, 29889, 20571, 363, 289, 297, 4733, 29889, 8893, 292, 29889, 12650, 29889, 497, 580, 29962, 13, 13, 4706, 396, 8161, 278, 1051, 310, 17166, 23481, 13877, 491, 445, 1246, 13, 4706, 289, 430, 29887, 29918, 4841, 353, 2009, 29889, 7194, 29889, 657, 1761, 877, 25237, 29918, 333, 1495, 13, 4706, 289, 430, 29887, 29918, 4841, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 289, 430, 29887, 29918, 4841, 29962, 13, 13, 4706, 565, 7431, 29898, 29890, 430, 29887, 29918, 4841, 29897, 1275, 29871, 29900, 29901, 13, 9651, 396, 694, 1321, 309, 333, 886, 892, 297, 278, 2009, 29892, 607, 2794, 445, 881, 13, 9651, 396, 736, 599, 13814, 29889, 13, 9651, 289, 430, 29887, 29918, 4841, 353, 599, 29918, 29890, 430, 29887, 29918, 4841, 13, 4706, 1683, 29901, 13, 9651, 396, 1423, 304, 1207, 1854, 599, 278, 17166, 23481, 526, 2854, 29889, 13, 9651, 8340, 29918, 4841, 353, 731, 29898, 29890, 430, 29887, 29918, 4841, 29897, 448, 731, 29898, 497, 29918, 29890, 430, 29887, 29918, 4841, 29897, 13, 9651, 565, 7431, 29898, 20965, 29918, 4841, 1125, 13, 18884, 8340, 29918, 4841, 353, 518, 710, 29898, 29875, 29897, 363, 474, 297, 8340, 29918, 4841, 29962, 13, 18884, 7191, 1839, 25237, 29918, 333, 2033, 353, 285, 29908, 13919, 17166, 23481, 29901, 426, 742, 15300, 7122, 29898, 1761, 29898, 20965, 29918, 4841, 876, 5038, 13, 308, 13, 4706, 565, 7191, 29901, 13, 9651, 736, 4418, 29918, 23813, 29898, 19158, 29897, 13, 13, 4706, 4235, 29918, 517, 29918, 735, 2325, 353, 6024, 29918, 3859, 2033, 13, 4706, 822, 5941, 29918, 29890, 430, 29887, 29898, 29890, 1125, 13, 9651, 9995, 6678, 304, 5941, 701, 17166, 1203, 2875, 8600, 322, 13, 9651, 788, 777, 5684, 5235, 29889, 13, 9651, 24953, 525, 29890, 29915, 338, 278, 8600, 310, 278, 15337, 17166, 1203, 29892, 2355, 841, 13, 9651, 515, 5214, 17255, 8977, 1649, 13, 9651, 9995, 13, 9651, 396, 3349, 4235, 304, 19060, 13, 9651, 363, 285, 430, 297, 4235, 29918, 517, 29918, 735, 2325, 29901, 13, 18884, 289, 29889, 7323, 29898, 29888, 430, 29892, 6213, 29897, 13, 13, 9651, 396, 1106, 701, 278, 1857, 17166, 4464, 565, 2198, 13, 9651, 1857, 29918, 8513, 29918, 333, 353, 289, 29889, 7323, 877, 3784, 29918, 8513, 29918, 333, 1495, 13, 9651, 565, 1857, 29918, 8513, 29918, 333, 29901, 13, 18884, 1857, 29918, 8513, 353, 4733, 29889, 8893, 292, 6818, 29889, 12650, 29889, 657, 29898, 20571, 29922, 3784, 29918, 8513, 29918, 333, 29897, 13, 18884, 289, 1839, 3784, 29918, 8513, 2033, 353, 1857, 29918, 8513, 29889, 978, 13, 9651, 1683, 29901, 13, 18884, 289, 1839, 3784, 29918, 8513, 2033, 353, 6629, 13, 13, 9651, 396, 3462, 278, 26413, 322, 4552, 29883, 2200, 6554, 3618, 13, 9651, 26413, 29918, 10492, 29918, 333, 353, 289, 29889, 7323, 877, 29888, 2491, 29918, 10492, 29918, 333, 1495, 13, 9651, 565, 26413, 29918, 10492, 29918, 333, 29901, 13, 18884, 289, 1839, 29888, 2491, 29918, 10492, 2033, 353, 4733, 29889, 29943, 2491, 19907, 29889, 12650, 29889, 657, 29898, 20571, 29922, 29888, 2491, 29918, 10492, 29918, 333, 467, 1649, 8977, 1649, 13, 18884, 289, 1839, 29888, 2491, 29918, 10492, 13359, 7323, 877, 29918, 3859, 1495, 13, 9651, 1683, 29901, 13, 18884, 289, 1839, 29888, 2491, 29918, 10492, 2033, 353, 6213, 13, 13, 9651, 12646, 29918, 10492, 29918, 333, 353, 289, 29889, 7323, 877, 15436, 2200, 29918, 10492, 29918, 333, 1495, 13, 9651, 565, 12646, 29918, 10492, 29918, 333, 29901, 13, 18884, 289, 1839, 15436, 2200, 29918, 10492, 2033, 353, 4733, 29889, 29923, 781, 2200, 19907, 29889, 12650, 29889, 657, 29898, 20571, 29922, 15436, 2200, 29918, 10492, 29918, 333, 467, 1649, 8977, 1649, 13, 18884, 289, 1839, 15436, 2200, 29918, 10492, 13359, 7323, 877, 29918, 3859, 1495, 13, 9651, 1683, 29901, 13, 18884, 289, 1839, 15436, 2200, 29918, 10492, 2033, 353, 6213, 13, 268, 13, 9651, 396, 3462, 263, 1051, 310, 4771, 943, 393, 445, 5214, 338, 6942, 411, 29889, 13, 9651, 396, 3940, 393, 278, 317, 6073, 3553, 1244, 338, 451, 278, 15337, 1904, 1903, 388, 1820, 29936, 372, 13, 9651, 396, 338, 278, 23530, 29918, 333, 1746, 310, 278, 317, 6073, 1203, 29892, 304, 367, 13747, 411, 278, 13, 9651, 396, 4771, 943, 580, 16248, 310, 445, 3450, 29889, 13, 9651, 4771, 943, 353, 5159, 13, 9651, 363, 1544, 297, 4733, 29889, 29933, 430, 29887, 1762, 29903, 6073, 29889, 12650, 29889, 4572, 29898, 25237, 29922, 29890, 1839, 333, 2033, 1125, 13, 18884, 4771, 943, 29889, 4397, 29898, 29871, 13, 462, 1678, 11117, 29879, 6073, 29918, 333, 2396, 1544, 29889, 29879, 6073, 29889, 29879, 6073, 29918, 333, 29892, 29871, 13, 462, 1678, 525, 29879, 6073, 29918, 2972, 2396, 1544, 29889, 29879, 6073, 29918, 2972, 29889, 3257, 29892, 13, 462, 1678, 525, 6605, 29918, 2098, 2396, 1544, 29889, 6605, 29918, 2098, 29913, 29871, 13, 18884, 1723, 13, 9651, 289, 1839, 23149, 943, 2033, 353, 4771, 943, 13, 13, 9651, 396, 3462, 263, 1051, 310, 25700, 393, 445, 5214, 338, 6942, 411, 29889, 13, 9651, 1638, 29879, 353, 5159, 13, 9651, 363, 1638, 297, 4733, 29889, 27356, 2133, 29889, 12650, 29889, 4572, 29898, 4282, 886, 29922, 29890, 1839, 333, 2033, 1125, 13, 18884, 1638, 29879, 29889, 4397, 29898, 13, 462, 1678, 313, 990, 29889, 20571, 29892, 1638, 29889, 3257, 29897, 13, 18884, 1723, 13, 9651, 289, 1839, 6388, 17063, 2033, 353, 1638, 29879, 13, 632, 13, 9651, 736, 289, 13, 13, 4706, 289, 430, 3174, 353, 5159, 1678, 396, 1051, 13587, 5214, 2472, 304, 736, 13, 4706, 363, 289, 430, 29887, 29918, 333, 297, 289, 430, 29887, 29918, 4841, 29901, 13, 9651, 289, 430, 29887, 353, 4733, 29889, 8893, 292, 29889, 12650, 29889, 657, 29898, 20571, 29922, 29890, 430, 29887, 29918, 333, 29897, 13, 9651, 289, 430, 29887, 29918, 11030, 353, 289, 430, 29887, 17255, 8977, 1649, 13, 9651, 289, 430, 3174, 29889, 4397, 29898, 14941, 29918, 29890, 430, 29887, 29898, 29890, 430, 29887, 29918, 11030, 876, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 8698, 742, 13, 9651, 525, 1272, 2396, 426, 13, 18884, 525, 4282, 886, 2396, 289, 430, 3174, 29892, 13, 9651, 500, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29897, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 396, 319, 9068, 1059, 10761, 29889, 13, 4706, 903, 21707, 29889, 11739, 877, 2392, 5663, 15387, 5214, 2472, 1495, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 2704, 742, 13, 9651, 525, 4906, 2396, 851, 29898, 29872, 29897, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29892, 4660, 29922, 29945, 29900, 29900, 29897, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 25700, 29898, 3827, 1125, 13, 1678, 9995, 11609, 29879, 2472, 1048, 697, 470, 901, 25700, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2009, 29901, 1678, 15337, 2009, 1203, 13, 13, 1678, 450, 525, 3827, 29915, 1203, 508, 505, 278, 1494, 2346, 4128, 29901, 13, 4706, 13013, 29918, 333, 29901, 450, 9205, 2133, 3553, 313, 29928, 5364, 1904, 7601, 1820, 29897, 310, 263, 13013, 304, 3160, 29889, 13, 9651, 910, 3443, 508, 6403, 2999, 3064, 304, 2009, 848, 515, 2999, 25700, 29889, 13, 9651, 960, 278, 13013, 29918, 333, 3443, 338, 451, 2198, 29892, 2472, 363, 3579, 497, 1068, 29871, 13, 9651, 25700, 338, 4133, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 319, 4663, 2933, 6943, 385, 27717, 310, 2551, 470, 10672, 29892, 263, 1051, 310, 13, 1678, 25700, 3704, 13013, 4426, 322, 5214, 15477, 2472, 13, 1678, 565, 3625, 29889, 13, 1678, 9995, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 22158, 5399, 278, 2346, 4128, 13, 4706, 7191, 353, 8340, 29918, 1972, 29918, 7529, 29898, 3827, 29892, 6024, 6388, 2133, 29918, 333, 11287, 13, 13, 4706, 396, 8561, 263, 1051, 310, 599, 13013, 23481, 29889, 13, 4706, 599, 29918, 990, 29918, 4841, 353, 29871, 518, 29877, 29889, 20571, 363, 288, 297, 4733, 29889, 27356, 2133, 29889, 12650, 29889, 497, 580, 29962, 13, 13, 4706, 396, 8161, 278, 1051, 310, 9205, 2133, 23481, 13877, 491, 445, 1246, 13, 4706, 1638, 29918, 4841, 353, 2009, 29889, 7194, 29889, 657, 1761, 877, 6388, 2133, 29918, 333, 1495, 13, 4706, 1638, 29918, 4841, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 1638, 29918, 4841, 29962, 13, 13, 4706, 565, 7431, 29898, 990, 29918, 4841, 29897, 1275, 29871, 29900, 29901, 13, 9651, 396, 694, 1321, 309, 333, 886, 892, 297, 278, 2009, 29892, 607, 2794, 445, 881, 13, 9651, 396, 736, 599, 13814, 29889, 13, 9651, 1638, 29918, 4841, 353, 599, 29918, 990, 29918, 4841, 13, 4706, 1683, 29901, 13, 9651, 396, 1423, 304, 1207, 1854, 599, 278, 9205, 2133, 23481, 526, 2854, 29889, 13, 9651, 8340, 29918, 4841, 353, 731, 29898, 990, 29918, 4841, 29897, 448, 731, 29898, 497, 29918, 990, 29918, 4841, 29897, 13, 9651, 565, 7431, 29898, 20965, 29918, 4841, 1125, 13, 18884, 8340, 29918, 4841, 353, 518, 710, 29898, 29875, 29897, 363, 474, 297, 8340, 29918, 4841, 29962, 13, 18884, 7191, 1839, 6388, 2133, 29918, 333, 2033, 353, 285, 29908, 13919, 9205, 2133, 23481, 29901, 426, 742, 15300, 7122, 29898, 1761, 29898, 20965, 29918, 4841, 876, 5038, 13, 308, 13, 4706, 565, 7191, 29901, 13, 9651, 736, 4418, 29918, 23813, 29898, 19158, 29897, 13, 13, 4706, 4235, 29918, 517, 29918, 735, 2325, 353, 6024, 29918, 3859, 2033, 13, 4706, 822, 5941, 29918, 990, 29898, 29877, 1125, 13, 9651, 9995, 6678, 304, 5941, 701, 9205, 2133, 1203, 2875, 8600, 322, 13, 9651, 788, 777, 5684, 5235, 29889, 13, 9651, 24953, 525, 29877, 29915, 338, 278, 8600, 310, 278, 15337, 9205, 2133, 1203, 29892, 2355, 841, 13, 9651, 515, 13013, 17255, 8977, 1649, 13, 9651, 9995, 13, 9651, 396, 3349, 4235, 304, 19060, 13, 9651, 363, 285, 430, 297, 4235, 29918, 517, 29918, 735, 2325, 29901, 13, 18884, 288, 29889, 7323, 29898, 29888, 430, 29892, 6213, 29897, 13, 632, 13, 9651, 736, 288, 13, 13, 4706, 1638, 29879, 353, 5159, 1678, 396, 1051, 13587, 5214, 2472, 304, 736, 13, 4706, 363, 1638, 29918, 333, 297, 1638, 29918, 4841, 29901, 13, 9651, 1638, 353, 4733, 29889, 27356, 2133, 29889, 12650, 29889, 657, 29898, 20571, 29922, 990, 29918, 333, 29897, 13, 9651, 1638, 29918, 11030, 353, 1638, 17255, 8977, 1649, 13, 632, 13, 9651, 396, 3462, 6942, 13814, 13, 9651, 289, 430, 3174, 353, 5159, 13, 9651, 363, 289, 430, 29887, 297, 1638, 29889, 4282, 886, 29889, 497, 7295, 13, 18884, 289, 430, 3174, 29889, 4397, 29898, 313, 29890, 430, 29887, 29889, 20571, 29892, 289, 430, 29887, 29889, 3257, 29897, 1723, 13, 9651, 1638, 29918, 11030, 1839, 4282, 886, 2033, 353, 289, 430, 3174, 13, 13, 9651, 1638, 29879, 29889, 4397, 29898, 14941, 29918, 990, 29898, 990, 29918, 11030, 876, 13, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 8698, 742, 13, 9651, 525, 1272, 2396, 426, 13, 18884, 525, 6388, 17063, 2396, 1638, 29879, 29892, 13, 9651, 500, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29897, 13, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 396, 319, 9068, 1059, 10761, 29889, 13, 4706, 903, 21707, 29889, 11739, 877, 2392, 5663, 15387, 13013, 2472, 1495, 13, 4706, 1121, 353, 426, 13, 9651, 525, 4882, 2396, 525, 2704, 742, 13, 9651, 525, 4906, 2396, 851, 29898, 29872, 29897, 13, 4706, 500, 13, 4706, 736, 14355, 5103, 29898, 2914, 29892, 4660, 29922, 29945, 29900, 29900, 29897, 13, 2 ]
services/dao/AutoScaleSettingDao.py
liujiage/DevOpsK8s
1
80216
from abc import ABC from common.StrUtils import isEmpty, isAnyEmpty from common.TimeUtils import getTimeStr from services.dao.SqliteDao import SqliteDao from vo.AutoScaleSettingVO import AutoScaleSettingVO from vo.LogVO import LogVO ''' @Author Jiage @Date 2022-02-09 @Function query auto scale and update scale ''' class AutoScaleSettingDao(SqliteDao): ''' @Author Jiage @Date 2022-02-08 @Function query deploys log ''' def query(self, value=None) -> AutoScaleSettingVO: records = self.fetch( 'select mini_size,max_size,mem_exc,deploy_name from auto_scale_setting') ass = AutoScaleSettingVO() if isEmpty(records): return ass record = records[0] ass.miniSize = record[0] ass.maxSize = record[1] ass.memExc = record[2] ass.deployName = record[3] return ass ''' @Author Jiage @Date 2022-02-08 @Function Save data into the database as a log ''' def updateOrInsert(self, value: AutoScaleSettingVO) -> int: print("'%d' - ,'%d' - ,'%d', - '%s')" % (value.miniSize, value.maxSize, value.memExc, value.deployName)) # first delete data self.execute("delete from auto_scale_setting") self.execute( "insert into auto_scale_setting(mini_size,max_size,mem_exc,deploy_name) " "values('%d','%d','%d', '%s')" % (value.miniSize, value.maxSize, value.memExc, value.deployName)) return 1
[ 1, 515, 25638, 1053, 16417, 13, 13, 3166, 3619, 29889, 5015, 12177, 1053, 338, 8915, 29892, 338, 10773, 8915, 13, 3166, 3619, 29889, 2481, 12177, 1053, 679, 2481, 5015, 13, 3166, 5786, 29889, 1388, 29877, 29889, 10520, 568, 29928, 6241, 1053, 13093, 568, 29928, 6241, 13, 3166, 992, 29889, 12300, 17185, 29020, 24898, 1053, 11133, 17185, 29020, 24898, 13, 3166, 992, 29889, 3403, 24898, 1053, 4522, 24898, 13, 13, 12008, 13, 29992, 13720, 18122, 482, 13, 29992, 2539, 29871, 29906, 29900, 29906, 29906, 29899, 29900, 29906, 29899, 29900, 29929, 13, 29992, 6678, 2346, 4469, 6287, 322, 2767, 6287, 13, 12008, 13, 13, 13, 1990, 11133, 17185, 29020, 29928, 6241, 29898, 10520, 568, 29928, 6241, 1125, 13, 1678, 14550, 13, 1678, 732, 13720, 18122, 482, 13, 1678, 732, 2539, 29871, 29906, 29900, 29906, 29906, 29899, 29900, 29906, 29899, 29900, 29947, 13, 1678, 732, 6678, 2346, 1401, 417, 952, 1480, 13, 1678, 14550, 13, 13, 1678, 822, 2346, 29898, 1311, 29892, 995, 29922, 8516, 29897, 1599, 11133, 17185, 29020, 24898, 29901, 13, 4706, 6475, 353, 1583, 29889, 9155, 29898, 13, 9651, 525, 2622, 20629, 29918, 2311, 29892, 3317, 29918, 2311, 29892, 6954, 29918, 735, 29883, 29892, 16519, 29918, 978, 515, 4469, 29918, 7052, 29918, 26740, 1495, 13, 4706, 1223, 353, 11133, 17185, 29020, 24898, 580, 13, 4706, 565, 338, 8915, 29898, 3757, 4339, 1125, 736, 1223, 13, 4706, 2407, 353, 6475, 29961, 29900, 29962, 13, 4706, 1223, 29889, 1195, 29875, 3505, 353, 2407, 29961, 29900, 29962, 13, 4706, 1223, 29889, 3317, 3505, 353, 2407, 29961, 29896, 29962, 13, 4706, 1223, 29889, 6954, 1252, 29883, 353, 2407, 29961, 29906, 29962, 13, 4706, 1223, 29889, 16519, 1170, 353, 2407, 29961, 29941, 29962, 13, 4706, 736, 1223, 13, 13, 1678, 14550, 13, 1678, 732, 13720, 18122, 482, 13, 1678, 732, 2539, 29871, 29906, 29900, 29906, 29906, 29899, 29900, 29906, 29899, 29900, 29947, 13, 1678, 732, 6678, 16913, 848, 964, 278, 2566, 408, 263, 1480, 13, 1678, 14550, 13, 13, 1678, 822, 2767, 2816, 17491, 29898, 1311, 29892, 995, 29901, 11133, 17185, 29020, 24898, 29897, 1599, 938, 29901, 13, 4706, 1596, 703, 29915, 29995, 29881, 29915, 448, 1919, 29915, 29995, 29881, 29915, 448, 1919, 29915, 29995, 29881, 742, 448, 14210, 29879, 1495, 29908, 1273, 313, 1767, 29889, 1195, 29875, 3505, 29892, 995, 29889, 3317, 3505, 29892, 995, 29889, 6954, 1252, 29883, 29892, 995, 29889, 16519, 1170, 876, 13, 4706, 396, 937, 5217, 848, 13, 4706, 1583, 29889, 7978, 703, 8143, 515, 4469, 29918, 7052, 29918, 26740, 1159, 13, 4706, 1583, 29889, 7978, 29898, 13, 9651, 376, 7851, 964, 4469, 29918, 7052, 29918, 26740, 29898, 1195, 29875, 29918, 2311, 29892, 3317, 29918, 2311, 29892, 6954, 29918, 735, 29883, 29892, 16519, 29918, 978, 29897, 376, 13, 9651, 376, 5975, 877, 29995, 29881, 3788, 29995, 29881, 3788, 29995, 29881, 742, 14210, 29879, 1495, 29908, 1273, 313, 1767, 29889, 1195, 29875, 3505, 29892, 995, 29889, 3317, 3505, 29892, 995, 29889, 6954, 1252, 29883, 29892, 995, 29889, 16519, 1170, 876, 13, 4706, 736, 29871, 29896, 13, 13, 13, 2 ]
podcast/migrations/0029_auto_20171211_0424.py
richardcornish/django-applepodcast
7
68984
# Generated by Django 2.0 on 2017-12-11 04:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('podcast', '0028_auto_20171211_0424'), ] operations = [ migrations.AlterField( model_name='show', name='managing_editor', field=models.EmailField(help_text='E-mail of administrative contact', max_length=255, verbose_name='editor e-mail'), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29900, 373, 29871, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29896, 29896, 29871, 29900, 29946, 29901, 29906, 29946, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 15334, 4384, 742, 525, 29900, 29900, 29906, 29947, 29918, 6921, 29918, 29906, 29900, 29896, 29955, 29896, 29906, 29896, 29896, 29918, 29900, 29946, 29906, 29946, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4294, 742, 13, 9651, 1024, 2433, 1171, 6751, 29918, 15204, 742, 13, 9651, 1746, 29922, 9794, 29889, 9823, 3073, 29898, 8477, 29918, 726, 2433, 29923, 29899, 2549, 310, 19185, 6958, 742, 4236, 29918, 2848, 29922, 29906, 29945, 29945, 29892, 26952, 29918, 978, 2433, 15204, 321, 29899, 2549, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
src/fparser/common/tests/test_base_classes.py
sturmianseq/fparser
33
12881
# -*- coding: utf-8 -*- ############################################################################## # Copyright (c) 2017 Science and Technology Facilities Council # # All rights reserved. # # Modifications made as part of the fparser project are distributed # under the following license: # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its # contributors may be used to endorse or promote products derived from # this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT # HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ############################################################################## # Modified M.Hambley, UK Met Office ############################################################################## ''' Test battery associated with fparser.common.base_classes package. ''' import re import pytest import fparser.common.base_classes import fparser.common.readfortran import fparser.common.sourceinfo import fparser.common.utils from fparser import api def test_statement_logging(log, monkeypatch): ''' Tests the Statement class' logging methods. ''' class DummyParser(object): ''' Null parser harness. ''' def __init__(self, reader): self.reader = reader reader = fparser.common.readfortran.FortranStringReader("dummy = 1") parser = DummyParser(reader) monkeypatch.setattr(fparser.common.base_classes.Statement, 'process_item', lambda x: None, raising=False) unit_under_test = fparser.common.base_classes.Statement(parser, None) unit_under_test.error('Scary biscuits') assert(log.messages == {'critical': [], 'debug': [], 'error': ['Scary biscuits'], 'info': [], 'warning': []}) log.reset() unit_under_test.warning('Trepidacious Cetations') assert(log.messages == {'critical': [], 'debug': [], 'error': [], 'info': [], 'warning': ['Trepidacious Cetations']}) log.reset() unit_under_test.info('Hilarious Ontologies') assert(log.messages == {'critical': [], 'debug': [], 'error': [], 'info': ['Hilarious Ontologies'], 'warning': []}) def test_log_comment_mix(log): ''' Tests that unexpected Fortran 90 comment in fixed format source is logged. ''' class EndDummy(fparser.common.base_classes.EndStatement): ''' Dummy EndStatement. ''' match = re.compile(r'\s*end(\s*thing\s*\w*|)\s*\Z', re.I).match class BeginHarness(fparser.common.base_classes.BeginStatement): ''' Dummy BeginStatement. ''' end_stmt_cls = EndDummy classes = [] match = re.compile(r'\s*thing\s+(\w*)\s*\Z', re.I).match def get_classes(self): ''' Returns an empty list of contained statements. ''' return [] code = ' x=1 ! Cheese' parent = fparser.common.readfortran.FortranStringReader( code, ignore_comments=False) parent.set_format(fparser.common.sourceinfo.FortranFormat(False, True)) item = fparser.common.readfortran.Line(code, (1, 1), None, None, parent) with pytest.raises(fparser.common.utils.AnalyzeError): __ = BeginHarness(parent, item) expected = ' 1: x=1 ! Cheese <== ' \ + 'no parse pattern found for "x=1 ! cheese" ' \ + "in 'BeginHarness' block, " \ + 'trying to remove inline comment (not in Fortran 77).' result = log.messages['warning'][0].split('\n')[1] assert result == expected def test_log_unexpected(log): ''' Tests that an unexpected thing between begin and end statements logs an event. ''' class EndThing(fparser.common.base_classes.EndStatement): ''' Dummy EndStatement class. ''' isvalid = True match = re.compile(r'\s*end(\s+thing(\s+\w+)?)?\s*$', re.I).match class BeginThing(fparser.common.base_classes.BeginStatement): ''' Dummy BeginStatement class. ''' end_stmt_cls = EndThing classes = [] match = re.compile(r'\s*thing\s+(\w+)?\s*$', re.I).match def get_classes(self): ''' Returns an empty list of contained classes. ''' return [] code = [' jumper', ' end thing'] parent = fparser.common.readfortran.FortranStringReader('\n'.join(code)) parent.set_format(fparser.common.sourceinfo.FortranFormat(False, True)) item = fparser.common.readfortran.Line(code[0], (1, 1), None, None, parent) with pytest.raises(fparser.common.utils.AnalyzeError): __ = BeginThing(parent, item) expected = ' 1: jumper <== no parse pattern found for "jumper" ' \ "in 'BeginThing' block." result = log.messages['warning'][0].split('\n')[1] assert result == expected def test_space_after_enddo(): '''Make sure that there is no space after an 'END DO' without name, but there is a space if there is a name after 'END DO'. ''' # Unnamed loop: source_str = '''\ subroutine foo integer i, r do i = 1,100 r = r + 1 end do end subroutine foo ''' tree = api.parse(source_str, isfree=True, isstrict=False) assert "END DO " not in tree.tofortran() # Named loop: source_str = '''\ subroutine foo integer i, r loop1: do i = 1,100 r = r + 1 end do loop1 end subroutine foo ''' tree = api.parse(source_str, isfree=True, isstrict=False) assert "END DO loop1" in tree.tofortran()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 9327, 322, 17968, 14184, 9770, 8831, 13, 29937, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 3382, 8232, 1754, 408, 760, 310, 278, 285, 16680, 2060, 526, 13235, 13, 29937, 1090, 278, 1494, 19405, 29901, 13, 29937, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 4944, 393, 278, 1494, 5855, 526, 13, 29937, 1539, 29901, 13, 29937, 13, 29937, 29871, 29896, 29889, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 13, 29937, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 13, 29937, 29871, 29906, 29889, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 13, 29937, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 13, 29937, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 29937, 13, 29937, 29871, 29941, 29889, 2448, 2121, 278, 1024, 310, 278, 3509, 1266, 19464, 3643, 278, 2983, 310, 967, 13, 29937, 17737, 29560, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 10723, 515, 13, 29937, 445, 7047, 1728, 2702, 7536, 3971, 10751, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 8707, 29911, 3960, 29933, 2692, 24125, 13, 29937, 376, 3289, 8519, 29908, 5300, 13764, 29979, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 29892, 2672, 6154, 15789, 4214, 29892, 350, 2692, 6058, 13, 29937, 27848, 3352, 7495, 29892, 6093, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 15842, 13, 29937, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 319, 1525, 28657, 13875, 8890, 29928, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 315, 4590, 29979, 22789, 3912, 13, 29937, 379, 5607, 8032, 6323, 8707, 29911, 3960, 29933, 2692, 24125, 20700, 17705, 6181, 15842, 13764, 29979, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 2672, 29907, 1367, 3919, 1964, 29892, 13, 29937, 317, 4162, 8426, 1964, 29892, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 313, 1177, 6154, 15789, 4214, 29892, 350, 2692, 6058, 13, 29937, 27848, 3352, 7495, 29892, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 11247, 1799, 8079, 501, 1660, 29892, 13, 29937, 360, 8254, 29892, 6323, 13756, 29943, 1806, 29903, 29936, 6323, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 12766, 17171, 29928, 5300, 6732, 13764, 29979, 13, 29937, 6093, 18929, 8079, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 13, 29937, 313, 1177, 6154, 15789, 4214, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 9033, 3235, 4214, 2672, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 13, 29937, 8079, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 3382, 2164, 341, 29889, 29950, 314, 569, 29891, 29892, 10261, 4737, 11367, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 12008, 13, 3057, 16988, 6942, 411, 285, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 3577, 29889, 13, 12008, 13, 5215, 337, 13, 5215, 11451, 1688, 13, 13, 5215, 285, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 13, 5215, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 13, 5215, 285, 16680, 29889, 9435, 29889, 4993, 3888, 13, 5215, 285, 16680, 29889, 9435, 29889, 13239, 13, 3166, 285, 16680, 1053, 7882, 13, 13, 13, 1753, 1243, 29918, 20788, 29918, 21027, 29898, 1188, 29892, 1601, 446, 1478, 905, 1125, 13, 1678, 14550, 13, 1678, 4321, 29879, 278, 6666, 882, 770, 29915, 12183, 3519, 29889, 13, 1678, 14550, 13, 1678, 770, 360, 11770, 11726, 29898, 3318, 1125, 13, 4706, 14550, 13, 4706, 19014, 13812, 4023, 2264, 29889, 13, 4706, 14550, 13, 4706, 822, 4770, 2344, 12035, 1311, 29892, 9591, 1125, 13, 9651, 1583, 29889, 16950, 353, 9591, 13, 13, 1678, 9591, 353, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 29889, 29943, 441, 661, 1231, 6982, 703, 29881, 11770, 353, 29871, 29896, 1159, 13, 1678, 13812, 353, 360, 11770, 11726, 29898, 16950, 29897, 13, 13, 1678, 1601, 446, 1478, 905, 29889, 842, 5552, 29898, 29888, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 14473, 29892, 13, 462, 4706, 525, 5014, 29918, 667, 742, 14013, 921, 29901, 6213, 29892, 29263, 29922, 8824, 29897, 13, 1678, 5190, 29918, 5062, 29918, 1688, 353, 285, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 14473, 29898, 16680, 29892, 6213, 29897, 13, 13, 1678, 5190, 29918, 5062, 29918, 1688, 29889, 2704, 877, 4421, 653, 2652, 4979, 1169, 1495, 13, 1678, 4974, 29898, 1188, 29889, 19158, 1275, 11117, 9695, 936, 2396, 19997, 13, 462, 9651, 525, 8382, 2396, 1678, 19997, 13, 462, 9651, 525, 2704, 2396, 1678, 6024, 4421, 653, 2652, 4979, 1169, 7464, 13, 462, 9651, 525, 3888, 2396, 268, 19997, 13, 462, 9651, 525, 27392, 2396, 29871, 5159, 1800, 13, 13, 1678, 1480, 29889, 12071, 580, 13, 1678, 5190, 29918, 5062, 29918, 1688, 29889, 27392, 877, 29911, 3445, 1458, 8802, 15018, 800, 1495, 13, 1678, 4974, 29898, 1188, 29889, 19158, 1275, 11117, 9695, 936, 2396, 19997, 13, 462, 9651, 525, 8382, 2396, 1678, 19997, 13, 462, 9651, 525, 2704, 2396, 1678, 19997, 13, 462, 9651, 525, 3888, 2396, 268, 19997, 13, 462, 9651, 525, 27392, 2396, 29871, 6024, 29911, 3445, 1458, 8802, 15018, 800, 2033, 1800, 13, 13, 1678, 1480, 29889, 12071, 580, 13, 1678, 5190, 29918, 5062, 29918, 1688, 29889, 3888, 877, 29950, 309, 1306, 681, 18265, 11763, 1495, 13, 1678, 4974, 29898, 1188, 29889, 19158, 1275, 11117, 9695, 936, 2396, 19997, 13, 462, 9651, 525, 8382, 2396, 1678, 19997, 13, 462, 9651, 525, 2704, 2396, 1678, 19997, 13, 462, 9651, 525, 3888, 2396, 268, 6024, 29950, 309, 1306, 681, 18265, 11763, 7464, 13, 462, 9651, 525, 27392, 2396, 29871, 5159, 1800, 13, 13, 13, 1753, 1243, 29918, 1188, 29918, 9342, 29918, 28084, 29898, 1188, 1125, 13, 1678, 14550, 13, 1678, 4321, 29879, 393, 15668, 7236, 661, 29871, 29929, 29900, 3440, 297, 4343, 3402, 2752, 338, 13817, 29889, 13, 1678, 14550, 13, 1678, 770, 2796, 29928, 11770, 29898, 29888, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 5044, 14473, 1125, 13, 4706, 14550, 13, 4706, 360, 11770, 2796, 14473, 29889, 13, 4706, 14550, 13, 4706, 1993, 353, 337, 29889, 12198, 29898, 29878, 12764, 29879, 29930, 355, 1194, 29879, 29930, 1918, 29905, 29879, 17710, 29893, 29930, 29989, 2144, 29879, 17710, 29999, 742, 337, 29889, 29902, 467, 4352, 13, 13, 1678, 770, 14893, 21972, 2264, 29898, 29888, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 17946, 14473, 1125, 13, 4706, 14550, 13, 4706, 360, 11770, 14893, 14473, 29889, 13, 4706, 14550, 13, 4706, 1095, 29918, 17868, 29918, 25932, 353, 2796, 29928, 11770, 13, 4706, 4413, 353, 5159, 13, 4706, 1993, 353, 337, 29889, 12198, 29898, 29878, 12764, 29879, 29930, 1918, 29905, 29879, 29974, 1194, 29893, 29930, 2144, 29879, 17710, 29999, 742, 337, 29889, 29902, 467, 4352, 13, 13, 4706, 822, 679, 29918, 13203, 29898, 1311, 1125, 13, 9651, 14550, 13, 9651, 16969, 385, 4069, 1051, 310, 11122, 9506, 29889, 13, 9651, 14550, 13, 9651, 736, 5159, 13, 13, 1678, 775, 353, 525, 418, 921, 29922, 29896, 1738, 6561, 968, 29915, 13, 1678, 3847, 353, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 29889, 29943, 441, 661, 1231, 6982, 29898, 13, 4706, 775, 29892, 11455, 29918, 21032, 29922, 8824, 29897, 13, 1678, 3847, 29889, 842, 29918, 4830, 29898, 29888, 16680, 29889, 9435, 29889, 4993, 3888, 29889, 29943, 441, 661, 5809, 29898, 8824, 29892, 5852, 876, 13, 1678, 2944, 353, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 29889, 3542, 29898, 401, 29892, 313, 29896, 29892, 29871, 29896, 511, 6213, 29892, 6213, 29892, 3847, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 29888, 16680, 29889, 9435, 29889, 13239, 29889, 2744, 14997, 911, 2392, 1125, 13, 4706, 4770, 353, 14893, 21972, 2264, 29898, 3560, 29892, 2944, 29897, 13, 1678, 3806, 353, 525, 268, 29896, 29901, 418, 921, 29922, 29896, 1738, 6561, 968, 529, 1360, 525, 320, 13, 1669, 718, 525, 1217, 6088, 4766, 1476, 363, 376, 29916, 29922, 29896, 1738, 923, 968, 29908, 525, 320, 13, 1669, 718, 376, 262, 525, 17946, 21972, 2264, 29915, 2908, 29892, 376, 320, 13, 1669, 718, 525, 2202, 292, 304, 3349, 10583, 3440, 313, 1333, 297, 7236, 661, 29871, 29955, 29955, 467, 29915, 13, 1678, 1121, 353, 1480, 29889, 19158, 1839, 27392, 2033, 29961, 29900, 1822, 5451, 28909, 29876, 29861, 29896, 29962, 13, 1678, 4974, 1121, 1275, 3806, 13, 13, 13, 1753, 1243, 29918, 1188, 29918, 348, 9684, 29898, 1188, 1125, 13, 1678, 14550, 13, 1678, 4321, 29879, 393, 385, 15668, 2655, 1546, 3380, 322, 1095, 9506, 10748, 385, 13, 1678, 1741, 29889, 13, 1678, 14550, 13, 1678, 770, 2796, 1349, 292, 29898, 29888, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 5044, 14473, 1125, 13, 4706, 14550, 13, 4706, 360, 11770, 2796, 14473, 770, 29889, 13, 4706, 14550, 13, 4706, 338, 3084, 353, 5852, 13, 4706, 1993, 353, 337, 29889, 12198, 29898, 29878, 12764, 29879, 29930, 355, 1194, 29879, 29974, 1918, 1194, 29879, 3124, 29893, 29974, 6877, 6877, 29905, 29879, 29394, 742, 337, 29889, 29902, 467, 4352, 13, 13, 1678, 770, 14893, 1349, 292, 29898, 29888, 16680, 29889, 9435, 29889, 3188, 29918, 13203, 29889, 17946, 14473, 1125, 13, 4706, 14550, 13, 4706, 360, 11770, 14893, 14473, 770, 29889, 13, 4706, 14550, 13, 4706, 1095, 29918, 17868, 29918, 25932, 353, 2796, 1349, 292, 13, 4706, 4413, 353, 5159, 13, 4706, 1993, 353, 337, 29889, 12198, 29898, 29878, 12764, 29879, 29930, 1918, 29905, 29879, 29974, 1194, 29893, 29974, 6877, 29905, 29879, 29394, 742, 337, 29889, 29902, 467, 4352, 13, 13, 4706, 822, 679, 29918, 13203, 29898, 1311, 1125, 13, 9651, 14550, 13, 9651, 16969, 385, 4069, 1051, 310, 11122, 4413, 29889, 13, 9651, 14550, 13, 9651, 736, 5159, 13, 13, 1678, 775, 353, 6024, 418, 432, 398, 546, 742, 525, 418, 1095, 2655, 2033, 13, 1678, 3847, 353, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 29889, 29943, 441, 661, 1231, 6982, 28909, 29876, 4286, 7122, 29898, 401, 876, 13, 1678, 3847, 29889, 842, 29918, 4830, 29898, 29888, 16680, 29889, 9435, 29889, 4993, 3888, 29889, 29943, 441, 661, 5809, 29898, 8824, 29892, 5852, 876, 13, 1678, 2944, 353, 285, 16680, 29889, 9435, 29889, 949, 3921, 661, 29889, 3542, 29898, 401, 29961, 29900, 1402, 313, 29896, 29892, 29871, 29896, 511, 6213, 29892, 6213, 29892, 3847, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 29888, 16680, 29889, 9435, 29889, 13239, 29889, 2744, 14997, 911, 2392, 1125, 13, 4706, 4770, 353, 14893, 1349, 292, 29898, 3560, 29892, 2944, 29897, 13, 1678, 3806, 353, 525, 268, 29896, 29901, 418, 432, 398, 546, 529, 1360, 694, 6088, 4766, 1476, 363, 376, 29926, 398, 546, 29908, 525, 320, 13, 1669, 376, 262, 525, 17946, 1349, 292, 29915, 2908, 1213, 13, 1678, 1121, 353, 1480, 29889, 19158, 1839, 27392, 2033, 29961, 29900, 1822, 5451, 28909, 29876, 29861, 29896, 29962, 13, 1678, 4974, 1121, 1275, 3806, 13, 13, 13, 1753, 1243, 29918, 3493, 29918, 7045, 29918, 355, 1867, 7295, 13, 1678, 14550, 9984, 1854, 393, 727, 338, 694, 2913, 1156, 385, 525, 11794, 11662, 29915, 1728, 1024, 29892, 13, 1678, 541, 727, 338, 263, 2913, 565, 727, 338, 263, 1024, 1156, 525, 11794, 11662, 4286, 13, 1678, 14550, 13, 13, 1678, 396, 853, 17514, 2425, 29901, 13, 1678, 2752, 29918, 710, 353, 14550, 29905, 13, 1678, 1014, 14608, 457, 7953, 13, 1678, 6043, 474, 29892, 364, 13, 1678, 437, 474, 353, 29871, 29896, 29892, 29896, 29900, 29900, 13, 418, 364, 353, 364, 718, 29871, 29896, 13, 1678, 1095, 437, 13, 1678, 1095, 1014, 14608, 457, 7953, 13, 1678, 14550, 13, 1678, 5447, 353, 7882, 29889, 5510, 29898, 4993, 29918, 710, 29892, 338, 9021, 29922, 5574, 29892, 338, 710, 919, 29922, 8824, 29897, 13, 1678, 4974, 376, 11794, 11662, 376, 451, 297, 5447, 29889, 517, 3921, 661, 580, 13, 13, 1678, 396, 405, 2795, 2425, 29901, 13, 1678, 2752, 29918, 710, 353, 14550, 29905, 13, 1678, 1014, 14608, 457, 7953, 13, 1678, 6043, 474, 29892, 364, 13, 1678, 2425, 29896, 29901, 437, 474, 353, 29871, 29896, 29892, 29896, 29900, 29900, 13, 418, 364, 353, 364, 718, 29871, 29896, 13, 1678, 1095, 437, 2425, 29896, 13, 1678, 1095, 1014, 14608, 457, 7953, 13, 1678, 14550, 13, 1678, 5447, 353, 7882, 29889, 5510, 29898, 4993, 29918, 710, 29892, 338, 9021, 29922, 5574, 29892, 338, 710, 919, 29922, 8824, 29897, 13, 1678, 4974, 376, 11794, 11662, 2425, 29896, 29908, 297, 5447, 29889, 517, 3921, 661, 580, 13, 2 ]
T14-01/program.py
maa76/SSof-Project1920
2
1600300
b = "mars"; a = "vasco"; a = ("hello %s world %s" % a, b)
[ 1, 289, 353, 376, 29885, 1503, 1769, 13, 29874, 353, 376, 4428, 1111, 1769, 13, 29874, 353, 4852, 12199, 1273, 29879, 3186, 1273, 29879, 29908, 1273, 263, 29892, 289, 29897, 13, 2 ]
simple_exercises/profiti/sum_of_two_matrices.py
ilante/programming_immanuela_englander
0
184110
A=[[1,2, 8], [3, 7,4]] B=[[5,6, 9], [7,6 ,0]] c=[] for i in range(len(A)): #range of len gives me indecesc. c.append([]) for j in range(len(A[i])): sum = A[i][j]+B[i][j] c[i].append(sum) print(c) # for i in range(len(A)): #range of len gives me indeces # for j in range(len(A[i])): #again indeces # sum = A[i][j]+B[i][j] # rowlist.append(sum) # print(rowlist) # rowlist =[]
[ 1, 319, 29922, 8999, 29896, 29892, 29906, 29892, 29871, 29947, 1402, 518, 29941, 29892, 29871, 29955, 29892, 29946, 5262, 13, 29933, 29922, 8999, 29945, 29892, 29953, 29892, 29871, 29929, 1402, 518, 29955, 29892, 29953, 1919, 29900, 5262, 13, 29883, 29922, 2636, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 29909, 22164, 396, 3881, 310, 7431, 4076, 592, 5704, 778, 29883, 29889, 13, 1678, 274, 29889, 4397, 4197, 2314, 13, 1678, 363, 432, 297, 3464, 29898, 2435, 29898, 29909, 29961, 29875, 12622, 29901, 13, 4706, 2533, 353, 319, 29961, 29875, 3816, 29926, 10062, 29933, 29961, 29875, 3816, 29926, 29962, 13, 4706, 274, 29961, 29875, 1822, 4397, 29898, 2083, 29897, 13, 2158, 29898, 29883, 29897, 13, 29937, 363, 474, 297, 3464, 29898, 2435, 29898, 29909, 22164, 396, 3881, 310, 7431, 4076, 592, 5704, 778, 13, 29937, 268, 363, 432, 297, 3464, 29898, 2435, 29898, 29909, 29961, 29875, 12622, 29901, 396, 351, 475, 5704, 778, 13, 4706, 396, 2533, 353, 319, 29961, 29875, 3816, 29926, 10062, 29933, 29961, 29875, 3816, 29926, 29962, 13, 1678, 396, 268, 1948, 1761, 29889, 4397, 29898, 2083, 29897, 13, 1678, 396, 1596, 29898, 798, 1761, 29897, 13, 1678, 396, 1948, 1761, 353, 2636, 13, 13, 2 ]
BasicSpeechToText/app.py
AzureAdvocateBit/SpeechToTextSamples-1
22
123910
<filename>BasicSpeechToText/app.py<gh_stars>10-100 import os import time from dotenv import load_dotenv import azure.cognitiveservices.speech as speechsdk # Load the speech key and region from the .env file load_dotenv() key = os.getenv("KEY") region = os.getenv("REGION") stop = False # When a sentence is recognized, print it to the screen. # If stop is said, stop the app def recognized(args): global stop print(args.result.text) if args.result.text == "Stop.": stop = True # Create a speech configuration using the following: # The API key and region loaded from the .env file # The language that will be recognized, in this example Great British English (en-GB) # # See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/language-support?WT.mc_id=build2020_ca-github-jabenn # for the list of supported languages that can be recognized speech_config = speechsdk.SpeechConfig(subscription=key, region=region, speech_recognition_language="en-GB") # Create a speech recognizer recognizer = speechsdk.SpeechRecognizer(speech_config=speech_config) # Connect up the recognized event recognizer.recognized.connect(recognized) # Start continuous recognition # This happens in the background, so the app continues to run, hence the need for an infinite loop recognizer.start_continuous_recognition() print("Say something! Say stop when you are done.") # Loop until we hear stop while not stop: time.sleep(0.1)
[ 1, 529, 9507, 29958, 16616, 10649, 5309, 1762, 1626, 29914, 932, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 2897, 13, 5215, 931, 13, 3166, 8329, 6272, 1053, 2254, 29918, 6333, 6272, 13, 5215, 15699, 29889, 29883, 3811, 277, 3145, 6972, 1575, 29889, 5965, 5309, 408, 12032, 15348, 13, 13, 29937, 16012, 278, 12032, 1820, 322, 5120, 515, 278, 869, 6272, 934, 13, 1359, 29918, 6333, 6272, 580, 13, 1989, 353, 2897, 29889, 657, 6272, 703, 10818, 1159, 13, 12803, 353, 2897, 29889, 657, 6272, 703, 18166, 2725, 1159, 13, 13, 9847, 353, 7700, 13, 13, 29937, 1932, 263, 10541, 338, 14831, 29892, 1596, 372, 304, 278, 4315, 29889, 13, 29937, 960, 5040, 338, 1497, 29892, 5040, 278, 623, 13, 1753, 14831, 29898, 5085, 1125, 13, 1678, 5534, 5040, 13, 1678, 1596, 29898, 5085, 29889, 2914, 29889, 726, 29897, 13, 13, 1678, 565, 6389, 29889, 2914, 29889, 726, 1275, 376, 16329, 29889, 1115, 13, 4706, 5040, 353, 5852, 13, 13, 13, 29937, 6204, 263, 12032, 5285, 773, 278, 1494, 29901, 13, 29937, 29871, 450, 3450, 1820, 322, 5120, 7500, 515, 278, 869, 6272, 934, 13, 29937, 29871, 450, 4086, 393, 674, 367, 14831, 29892, 297, 445, 1342, 7027, 4908, 4223, 313, 264, 29899, 7210, 29897, 13, 29937, 13, 29937, 2823, 2045, 597, 2640, 29889, 4994, 29889, 510, 29914, 264, 29899, 375, 29914, 17688, 29914, 29883, 3811, 3321, 29899, 9916, 29914, 5965, 5309, 29899, 5509, 29914, 11675, 29899, 5924, 29973, 17755, 29889, 14047, 29918, 333, 29922, 4282, 29906, 29900, 29906, 29900, 29918, 1113, 29899, 3292, 29899, 29926, 370, 2108, 13, 29937, 363, 278, 1051, 310, 6969, 10276, 393, 508, 367, 14831, 13, 5965, 5309, 29918, 2917, 353, 12032, 15348, 29889, 10649, 5309, 3991, 29898, 1491, 22371, 29922, 1989, 29892, 13, 462, 462, 539, 5120, 29922, 12803, 29892, 13, 462, 462, 539, 12032, 29918, 29423, 654, 29918, 11675, 543, 264, 29899, 7210, 1159, 13, 13, 29937, 6204, 263, 12032, 5936, 3950, 13, 29423, 3950, 353, 12032, 15348, 29889, 10649, 5309, 27475, 29898, 5965, 5309, 29918, 2917, 29922, 5965, 5309, 29918, 2917, 29897, 13, 13, 29937, 14971, 701, 278, 14831, 1741, 13, 29423, 3950, 29889, 29423, 1891, 29889, 6915, 29898, 29423, 1891, 29897, 13, 13, 29937, 7370, 9126, 19679, 13, 29937, 910, 5930, 297, 278, 3239, 29892, 577, 278, 623, 18172, 304, 1065, 29892, 8151, 278, 817, 363, 385, 10362, 2425, 13, 29423, 3950, 29889, 2962, 29918, 20621, 681, 29918, 29423, 654, 580, 13, 13, 2158, 703, 29903, 388, 1554, 29991, 14891, 5040, 746, 366, 526, 2309, 23157, 13, 13, 29937, 21493, 2745, 591, 8293, 5040, 13, 8000, 451, 5040, 29901, 13, 1678, 931, 29889, 17059, 29898, 29900, 29889, 29896, 29897, 13, 2 ]
xldlib/exception/codes.py
Alexhuszagh/XLDiscoverer
0
178336
''' Exceptions/codes ________________ Organized error codes for reporting errors and exceptions. :copyright: (c) 2015 The Regents of the University of California. :license: GNU GPL, see licenses/GNU GPLv3.txt for more details. ''' CODES = { "000": ("Cannot find file%(-s)s in row%(-s)s {0}." " Deleting th%(-at)s entr%(-y)s..."), "001": ("File%(-s)s in row%(-s)s {0} not recognized." " Deleting th%(-at)s entr%(-y)s..."), "002": ("Engine in row%(-s)s {0} do not match the isotope-label profile." " Deleting th%(-at)s entr%(-y)s..."), "003": ("Files in row%(-s)s {0} do not have matching MS2/MS3 scans. " "Deleting those entries..."), "004": ("Some columns are missing data.", "WARNING: Missing data"), "005": ("The content of the clipboard is bigger than available " "space.\nSome data loss will occur. Still want to paste?", "WARNING: Data clipping"), "006": ("The content of the clipboard is bigger or smaller than " "the range selected.\nStill want to paste?", "WARNING: Data clipping"), "007": "Calculations are running. Are you sure you want to close?", "008": ("Input Error", "Unequal number of files entered"), "009": ("Truncated mod found from Protein Prospector. " "Please check your report settings."), "010": ("Parser Error", "Malfunctioning parser unable to match " "scan row. Please contact {}"), "011": ("Warning: Data for MS3 scan%(-s)s {{}} in file {} do not " "have matching MS2 precursors. This data was removed..."), "012": ("Input Error", "ERROR: Please select a cross-linker " "before running Xl Discoverer."), "013": ("Input Error", "Cannot find the path specified"), "014": ("Gradient times are not close enough to analyze the same " "transition over multiple files. Turning global quantitation " "off."), "015": ("Files in row%(-s)s {0} do not have any searchable matched " "peptides. Deleting those entries..."), "016": ("Input Error", "Likely truncated MS3 scan detected. " "Invalid (blank) entry in Matched Output."), "017": ("Input Error", "Invalid entry in Matched Output."), "018": ("Parser Error", "Malfunctioning parser cannot parse " "scan data. Please contact <EMAIL>"), "019": ("Error", "An unknown error occured, please check the log file"), "020": ("Input Error", "Selected cross-linkers do not match the " "selected isotopic profile."), "021": ("The sort data does not exist in the transitions " "file and therefore cannot be sorted.", "Sorting Error"), "022": "{0} column%(-s)s missing in current matched scans file", "023": ("Input Error", "Could not recognize the spectral file entered."), "024": ('Please add the chemical formula for "{}" to xlpy/matched/' 'proteome_discoverer/mods.py in MONOMERS'), "025": ("Warning: Protease specified in matched output and was not found " "in local protease list."), "026": ("Some entered files do not exist", "WARNING: Missing data"), }
[ 1, 14550, 13, 1678, 8960, 29879, 29914, 18137, 13, 1678, 903, 14365, 7652, 22359, 13, 13, 1678, 9205, 1891, 1059, 11561, 363, 23415, 4436, 322, 15283, 29889, 13, 13, 1678, 584, 8552, 1266, 29901, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 450, 2169, 1237, 310, 278, 3014, 310, 8046, 29889, 13, 1678, 584, 506, 1947, 29901, 15143, 402, 7390, 29892, 1074, 7794, 11259, 29914, 29954, 11601, 402, 7390, 29894, 29941, 29889, 3945, 363, 901, 4902, 29889, 13, 12008, 13, 13, 16524, 29903, 353, 426, 13, 1678, 376, 29900, 29900, 29900, 1115, 4852, 29089, 1284, 934, 29995, 6278, 29879, 29897, 29879, 297, 1948, 29995, 6278, 29879, 29897, 29879, 426, 29900, 29913, 1213, 13, 9651, 376, 897, 1026, 292, 266, 29995, 6278, 271, 29897, 29879, 9953, 29995, 6278, 29891, 29897, 29879, 856, 4968, 13, 1678, 376, 29900, 29900, 29896, 1115, 4852, 2283, 29995, 6278, 29879, 29897, 29879, 297, 1948, 29995, 6278, 29879, 29897, 29879, 426, 29900, 29913, 451, 14831, 1213, 13, 9651, 376, 897, 1026, 292, 266, 29995, 6278, 271, 29897, 29879, 9953, 29995, 6278, 29891, 29897, 29879, 856, 4968, 13, 1678, 376, 29900, 29900, 29906, 1115, 4852, 12412, 297, 1948, 29995, 6278, 29879, 29897, 29879, 426, 29900, 29913, 437, 451, 1993, 278, 338, 327, 2300, 29899, 1643, 8722, 1213, 13, 9651, 376, 897, 1026, 292, 266, 29995, 6278, 271, 29897, 29879, 9953, 29995, 6278, 29891, 29897, 29879, 856, 4968, 13, 13, 1678, 376, 29900, 29900, 29941, 1115, 4852, 10547, 297, 1948, 29995, 6278, 29879, 29897, 29879, 426, 29900, 29913, 437, 451, 505, 9686, 10888, 29906, 29914, 4345, 29941, 885, 550, 29889, 376, 13, 9651, 376, 2772, 1026, 292, 1906, 9976, 856, 4968, 13, 1678, 376, 29900, 29900, 29946, 1115, 4852, 9526, 4341, 526, 4567, 848, 19602, 376, 29956, 25614, 29901, 4750, 292, 848, 4968, 13, 1678, 376, 29900, 29900, 29945, 1115, 4852, 1576, 2793, 310, 278, 20102, 3377, 338, 16600, 1135, 3625, 376, 13, 9651, 376, 3493, 7790, 29876, 9526, 848, 6410, 674, 6403, 29889, 12074, 864, 304, 11417, 29973, 613, 13, 9651, 376, 29956, 25614, 29901, 3630, 9335, 3262, 4968, 13, 1678, 376, 29900, 29900, 29953, 1115, 4852, 1576, 2793, 310, 278, 20102, 3377, 338, 16600, 470, 7968, 1135, 376, 13, 9651, 376, 1552, 3464, 4629, 7790, 29876, 855, 453, 864, 304, 11417, 29973, 613, 13, 9651, 376, 29956, 25614, 29901, 3630, 9335, 3262, 4968, 13, 1678, 376, 29900, 29900, 29955, 1115, 376, 27065, 800, 526, 2734, 29889, 4683, 366, 1854, 366, 864, 304, 3802, 29973, 613, 13, 1678, 376, 29900, 29900, 29947, 1115, 4852, 4290, 4829, 613, 376, 29965, 484, 15380, 1353, 310, 2066, 7802, 4968, 13, 1678, 376, 29900, 29900, 29929, 1115, 4852, 2308, 4661, 630, 878, 1476, 515, 14409, 262, 1019, 21494, 272, 29889, 376, 13, 9651, 376, 12148, 1423, 596, 3461, 6055, 1213, 511, 13, 1678, 376, 29900, 29896, 29900, 1115, 4852, 11726, 4829, 613, 376, 22995, 2220, 292, 13812, 9368, 304, 1993, 376, 13, 9651, 376, 16192, 1948, 29889, 3529, 6958, 6571, 4968, 13, 1678, 376, 29900, 29896, 29896, 1115, 4852, 22709, 29901, 3630, 363, 10888, 29941, 12812, 29995, 6278, 29879, 29897, 29879, 8620, 930, 297, 934, 6571, 437, 451, 376, 13, 9651, 376, 17532, 9686, 10888, 29906, 8303, 1295, 943, 29889, 910, 848, 471, 6206, 856, 4968, 13, 1678, 376, 29900, 29896, 29906, 1115, 4852, 4290, 4829, 613, 376, 11432, 29901, 3529, 1831, 263, 4891, 29899, 2324, 261, 376, 13, 9651, 376, 11083, 2734, 1060, 29880, 8565, 957, 261, 1213, 511, 13, 1678, 376, 29900, 29896, 29941, 1115, 4852, 4290, 4829, 613, 376, 29089, 1284, 278, 2224, 6790, 4968, 13, 1678, 376, 29900, 29896, 29946, 1115, 4852, 25584, 993, 3064, 526, 451, 3802, 3307, 304, 27599, 278, 1021, 376, 13, 9651, 376, 20543, 975, 2999, 2066, 29889, 9603, 292, 5534, 4323, 7018, 376, 13, 9651, 376, 2696, 1213, 511, 13, 1678, 376, 29900, 29896, 29945, 1115, 4852, 10547, 297, 1948, 29995, 6278, 29879, 29897, 29879, 426, 29900, 29913, 437, 451, 505, 738, 2740, 519, 19228, 376, 13, 9651, 376, 412, 415, 2247, 29889, 897, 1026, 292, 1906, 9976, 856, 4968, 13, 1678, 376, 29900, 29896, 29953, 1115, 4852, 4290, 4829, 613, 376, 29931, 638, 873, 21022, 630, 10888, 29941, 12812, 17809, 29889, 376, 13, 9651, 376, 13919, 313, 19465, 29897, 6251, 297, 14514, 287, 10604, 1213, 511, 13, 1678, 376, 29900, 29896, 29955, 1115, 4852, 4290, 4829, 613, 376, 13919, 6251, 297, 14514, 287, 10604, 1213, 511, 13, 1678, 376, 29900, 29896, 29947, 1115, 4852, 11726, 4829, 613, 376, 22995, 2220, 292, 13812, 2609, 6088, 376, 13, 9651, 376, 16192, 848, 29889, 3529, 6958, 529, 26862, 6227, 29958, 4968, 13, 1678, 376, 29900, 29896, 29929, 1115, 4852, 2392, 613, 376, 2744, 9815, 1059, 2179, 2955, 29892, 3113, 1423, 278, 1480, 934, 4968, 13, 1678, 376, 29900, 29906, 29900, 1115, 4852, 4290, 4829, 613, 376, 8592, 4891, 29899, 2324, 414, 437, 451, 1993, 278, 376, 13, 9651, 376, 8391, 338, 327, 459, 293, 8722, 1213, 511, 13, 1678, 376, 29900, 29906, 29896, 1115, 4852, 1576, 2656, 848, 947, 451, 1863, 297, 278, 1301, 2187, 376, 13, 9651, 376, 1445, 322, 5480, 2609, 367, 12705, 19602, 376, 13685, 292, 4829, 4968, 13, 1678, 376, 29900, 29906, 29906, 1115, 29850, 29900, 29913, 1897, 29995, 6278, 29879, 29897, 29879, 4567, 297, 1857, 19228, 885, 550, 934, 613, 13, 1678, 376, 29900, 29906, 29941, 1115, 4852, 4290, 4829, 613, 376, 23323, 451, 18720, 278, 23161, 934, 7802, 1213, 511, 13, 1678, 376, 29900, 29906, 29946, 1115, 6702, 12148, 788, 278, 22233, 7063, 363, 29850, 5038, 304, 921, 29880, 2272, 29914, 4352, 287, 22208, 13, 9651, 525, 14676, 608, 29918, 2218, 11911, 261, 29914, 1545, 29879, 29889, 2272, 297, 341, 1164, 6488, 23598, 5477, 13, 1678, 376, 29900, 29906, 29945, 1115, 4852, 22709, 29901, 14409, 559, 6790, 297, 19228, 1962, 322, 471, 451, 1476, 376, 13, 9651, 376, 262, 1887, 3279, 559, 1051, 1213, 511, 13, 1678, 376, 29900, 29906, 29953, 1115, 4852, 9526, 7802, 2066, 437, 451, 1863, 613, 376, 29956, 25614, 29901, 4750, 292, 848, 4968, 13, 29913, 13, 2 ]
sky/migrations/0008_remove_news_label.py
eethan1/IMnight2018_Backend
0
26423
# Generated by Django 2.0 on 2018-02-24 11:21 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('sky', '0007_auto_20180224_1120'), ] operations = [ migrations.RemoveField( model_name='news', name='label', ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29900, 373, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29906, 29899, 29906, 29946, 29871, 29896, 29896, 29901, 29906, 29896, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 7912, 742, 525, 29900, 29900, 29900, 29955, 29918, 6921, 29918, 29906, 29900, 29896, 29947, 29900, 29906, 29906, 29946, 29918, 29896, 29896, 29906, 29900, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 15753, 742, 13, 9651, 1024, 2433, 1643, 742, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
aoc/event2019/day19/solve.py
rjbatista/AoC
0
21501
<filename>aoc/event2019/day19/solve.py from event2019.day13.computer_v4 import Computer_v4 ######## # PART 1 computer = Computer_v4([]) computer.load_code("event2019/day19/input.txt") def get_value(x, y): out = [] computer.reload_code() computer.run([x, y], out) return out[0] def get_area(side = 50): area = [] min_x, width = 0, 0 for y in range(side): row_min_x = None x = min_x # first '#' while True: val = get_value(x, y) if val != 1: x += 1 else: row_min_x = x min_x = x break if x == side: break if row_min_x != None: # last '#' if width > 0: x += width - 1 while True: val = get_value(x, y) if val == 1: x += 1 else: width = x - row_min_x break assert x != side area += [(row_min_x, width)] return area answer = sum([width for x, width in get_area() if x != None]) print("Part 1 =", answer) assert answer == 203 # check with accepted answer ######## # PART 2 def get_top_right_in_beam(square_size = 100): # skip ahead depending on square size x, y = (square_size * 5, square_size * 10) while True: if get_value(x, y) == 1: if get_value(x + square_size - 1, y - square_size + 1) == 1: # True implies top_left and bottom_right return x, y - square_size + 1 y += 1 else: x += 1 x, y = get_top_right_in_beam() answer = 10000 * x + y print("Part 2 =", 10000 * x + y) assert answer == 8771057 # check with accepted answer
[ 1, 529, 9507, 29958, 29874, 542, 29914, 3696, 29906, 29900, 29896, 29929, 29914, 3250, 29896, 29929, 29914, 2929, 345, 29889, 2272, 13, 3166, 1741, 29906, 29900, 29896, 29929, 29889, 3250, 29896, 29941, 29889, 12097, 261, 29918, 29894, 29946, 1053, 20972, 29918, 29894, 29946, 13, 13, 7346, 13, 29937, 349, 8322, 29871, 29896, 13, 13, 12097, 261, 353, 20972, 29918, 29894, 29946, 4197, 2314, 13, 12097, 261, 29889, 1359, 29918, 401, 703, 3696, 29906, 29900, 29896, 29929, 29914, 3250, 29896, 29929, 29914, 2080, 29889, 3945, 1159, 13, 13, 13, 1753, 679, 29918, 1767, 29898, 29916, 29892, 343, 1125, 13, 1678, 714, 353, 5159, 13, 1678, 6601, 29889, 28120, 29918, 401, 580, 13, 1678, 6601, 29889, 3389, 4197, 29916, 29892, 343, 1402, 714, 29897, 13, 13, 1678, 736, 714, 29961, 29900, 29962, 13, 13, 13, 1753, 679, 29918, 6203, 29898, 2975, 353, 29871, 29945, 29900, 1125, 13, 1678, 4038, 353, 5159, 13, 1678, 1375, 29918, 29916, 29892, 2920, 353, 29871, 29900, 29892, 29871, 29900, 13, 1678, 363, 343, 297, 3464, 29898, 2975, 1125, 13, 4706, 1948, 29918, 1195, 29918, 29916, 353, 6213, 13, 13, 4706, 921, 353, 1375, 29918, 29916, 13, 4706, 396, 937, 16321, 29915, 13, 4706, 1550, 5852, 29901, 13, 9651, 659, 353, 679, 29918, 1767, 29898, 29916, 29892, 343, 29897, 13, 632, 13, 9651, 565, 659, 2804, 29871, 29896, 29901, 13, 18884, 921, 4619, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 1948, 29918, 1195, 29918, 29916, 353, 921, 13, 18884, 1375, 29918, 29916, 353, 921, 13, 18884, 2867, 13, 13, 9651, 565, 921, 1275, 2625, 29901, 13, 18884, 2867, 13, 13, 4706, 565, 1948, 29918, 1195, 29918, 29916, 2804, 6213, 29901, 13, 9651, 396, 1833, 16321, 29915, 13, 9651, 565, 2920, 1405, 29871, 29900, 29901, 13, 18884, 921, 4619, 2920, 448, 29871, 29896, 13, 9651, 1550, 5852, 29901, 13, 18884, 659, 353, 679, 29918, 1767, 29898, 29916, 29892, 343, 29897, 13, 462, 13, 18884, 565, 659, 1275, 29871, 29896, 29901, 13, 462, 1678, 921, 4619, 29871, 29896, 13, 18884, 1683, 29901, 13, 462, 1678, 2920, 353, 921, 448, 1948, 29918, 1195, 29918, 29916, 13, 462, 1678, 2867, 13, 13, 18884, 4974, 921, 2804, 2625, 13, 13, 4706, 4038, 4619, 17288, 798, 29918, 1195, 29918, 29916, 29892, 2920, 4638, 13, 268, 13, 1678, 736, 4038, 13, 13, 13, 12011, 353, 2533, 4197, 2103, 363, 921, 29892, 2920, 297, 679, 29918, 6203, 580, 565, 921, 2804, 6213, 2314, 13, 2158, 703, 7439, 29871, 29896, 353, 613, 1234, 29897, 13, 9294, 1234, 1275, 29871, 29906, 29900, 29941, 396, 1423, 411, 9259, 1234, 13, 13, 7346, 13, 29937, 349, 8322, 29871, 29906, 13, 13, 1753, 679, 29918, 3332, 29918, 1266, 29918, 262, 29918, 915, 314, 29898, 17619, 29918, 2311, 353, 29871, 29896, 29900, 29900, 1125, 13, 1678, 396, 14383, 14432, 8679, 373, 6862, 2159, 13, 1678, 921, 29892, 343, 353, 313, 17619, 29918, 2311, 334, 29871, 29945, 29892, 6862, 29918, 2311, 334, 29871, 29896, 29900, 29897, 13, 1678, 1550, 5852, 29901, 13, 4706, 565, 679, 29918, 1767, 29898, 29916, 29892, 343, 29897, 1275, 29871, 29896, 29901, 13, 9651, 565, 679, 29918, 1767, 29898, 29916, 718, 6862, 29918, 2311, 448, 29871, 29896, 29892, 343, 448, 6862, 29918, 2311, 718, 29871, 29896, 29897, 1275, 29871, 29896, 29901, 29871, 396, 5852, 10469, 2246, 29918, 1563, 322, 5970, 29918, 1266, 13, 18884, 736, 921, 29892, 343, 448, 6862, 29918, 2311, 718, 29871, 29896, 13, 13, 9651, 343, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 921, 4619, 29871, 29896, 13, 13, 13, 29916, 29892, 343, 353, 679, 29918, 3332, 29918, 1266, 29918, 262, 29918, 915, 314, 580, 13, 12011, 353, 29871, 29896, 29900, 29900, 29900, 29900, 334, 921, 718, 343, 13, 2158, 703, 7439, 29871, 29906, 353, 613, 29871, 29896, 29900, 29900, 29900, 29900, 334, 921, 718, 343, 29897, 13, 9294, 1234, 1275, 29871, 29947, 29955, 29955, 29896, 29900, 29945, 29955, 396, 1423, 411, 9259, 1234, 13, 2 ]
test-crates/pyo3-mixed/test_pyo3_mixed.py
thedrow/maturin
854
108932
#!/usr/bin/env python3 import pyo3_mixed def test_get_42(): assert pyo3_mixed.get_42() == 42
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 282, 9029, 29941, 29918, 29885, 11925, 13, 13, 13, 1753, 1243, 29918, 657, 29918, 29946, 29906, 7295, 13, 1678, 4974, 282, 9029, 29941, 29918, 29885, 11925, 29889, 657, 29918, 29946, 29906, 580, 1275, 29871, 29946, 29906, 13, 2 ]
pynamodb/tests/integration/config.py
augustincouette/PynamoDB
3
51877
<reponame>augustincouette/PynamoDB<filename>pynamodb/tests/integration/config.py """ Integration test settings """ DYNAMODB_HOST = 'http://localhost:8000'
[ 1, 529, 276, 1112, 420, 29958, 2987, 504, 3742, 283, 2353, 29914, 29925, 2926, 29877, 4051, 29966, 9507, 29958, 29886, 2926, 10396, 29914, 21150, 29914, 27925, 29914, 2917, 29889, 2272, 13, 15945, 29908, 13, 23573, 362, 1243, 6055, 13, 15945, 29908, 13, 13, 29928, 29979, 3521, 6720, 4051, 29918, 20832, 353, 525, 1124, 597, 7640, 29901, 29947, 29900, 29900, 29900, 29915, 2 ]
launch_error_1.py
TheBigCharles/Saviour
3
132484
<filename>launch_error_1.py import smtplib from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart from email.mime.application import MIMEApplication fromaddr = '<EMAIL>' password = '<PASSWORD>' toaddrs = ['<EMAIL>'] content = 'Sorry, there is an error with the file. [FileNotFoundError]' textApart = MIMEText(content) m = MIMEMultipart() m.attach(textApart) m['Subject'] = '[FileNotFoundError]' try: server = smtplib.SMTP('smtp.yeah.net') server.login(fromaddr,password) server.sendmail(fromaddr, toaddrs, m.as_string()) server.quit() except smtplib.SMTPException as e: pass
[ 1, 529, 9507, 29958, 15343, 29918, 2704, 29918, 29896, 29889, 2272, 13, 5215, 1560, 9392, 1982, 13, 3166, 4876, 29889, 29885, 603, 29889, 726, 1053, 341, 8890, 1626, 13, 3166, 4876, 29889, 29885, 603, 29889, 3027, 1053, 341, 8890, 2940, 13, 3166, 4876, 29889, 29885, 603, 29889, 18056, 442, 1053, 341, 8890, 6857, 27494, 13, 3166, 4876, 29889, 29885, 603, 29889, 6214, 1053, 341, 8890, 4873, 13, 13, 13, 3166, 10030, 353, 12801, 26862, 6227, 16299, 13, 13, 5630, 353, 12801, 25711, 17013, 16299, 13, 13, 517, 1202, 2288, 353, 6024, 29966, 26862, 6227, 29958, 2033, 13, 13, 13, 3051, 353, 525, 29903, 3818, 29892, 727, 338, 385, 1059, 411, 278, 934, 29889, 518, 2283, 17413, 2392, 29962, 29915, 13, 13, 726, 29909, 1595, 353, 341, 8890, 1626, 29898, 3051, 29897, 13, 13, 29885, 353, 341, 8890, 6857, 27494, 580, 13, 29885, 29889, 14930, 29898, 726, 29909, 1595, 29897, 13, 13, 29885, 1839, 20622, 2033, 353, 525, 29961, 2283, 17413, 2392, 29962, 29915, 13, 13, 2202, 29901, 13, 13, 4706, 1923, 353, 1560, 9392, 1982, 29889, 17061, 3557, 877, 3844, 9392, 29889, 4099, 801, 29889, 1212, 1495, 13, 13, 4706, 1923, 29889, 7507, 29898, 3166, 10030, 29892, 5630, 29897, 13, 13, 4706, 1923, 29889, 6717, 2549, 29898, 3166, 10030, 29892, 304, 1202, 2288, 29892, 286, 29889, 294, 29918, 1807, 3101, 13, 13, 4706, 1923, 29889, 28358, 580, 13, 13, 19499, 1560, 9392, 1982, 29889, 17061, 3557, 2451, 408, 321, 29901, 13, 13, 4706, 1209, 2 ]
sina_spider/items.py
yanwen0614/Weibo
0
7158
# -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html from scrapy import Item, Field class TweetsItem(Item): # define the fields for your item here like: Author = Field() Title = Field() Create_time = Field() Id = Field() Context = Field() Source = Field() Url = Field() class TopicItem(Item): Url = Field() Title = Field() Category = Field() context = Field() Id = Field() Hotlevel = Field() Time = Field() def main(): item = TopicItem() pass if __name__ == '__main__': main()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 22402, 1244, 278, 4733, 363, 596, 885, 2390, 287, 4452, 13, 29937, 13, 29937, 2823, 5106, 297, 29901, 13, 29937, 1732, 597, 1514, 29889, 1557, 336, 2272, 29889, 990, 29914, 264, 29914, 12333, 29914, 3332, 1199, 29914, 7076, 29889, 1420, 13, 13, 3166, 24559, 2272, 1053, 10976, 29892, 8989, 13, 13, 13, 1990, 27637, 1691, 2001, 29898, 2001, 1125, 13, 1678, 396, 4529, 278, 4235, 363, 596, 2944, 1244, 763, 29901, 13, 1678, 13361, 353, 8989, 580, 13, 1678, 18527, 353, 8989, 580, 13, 1678, 6204, 29918, 2230, 353, 8989, 580, 13, 1678, 5163, 353, 8989, 580, 13, 1678, 15228, 353, 8989, 580, 13, 1678, 7562, 353, 8989, 580, 13, 1678, 501, 2096, 353, 8989, 580, 13, 13, 13, 1990, 7488, 293, 2001, 29898, 2001, 1125, 13, 1678, 501, 2096, 353, 8989, 580, 13, 1678, 18527, 353, 8989, 580, 13, 1678, 17943, 353, 8989, 580, 13, 1678, 3030, 353, 8989, 580, 13, 1678, 5163, 353, 8989, 580, 13, 1678, 8843, 5563, 353, 8989, 580, 13, 1678, 5974, 353, 8989, 580, 13, 13, 1753, 1667, 7295, 13, 1678, 2944, 353, 7488, 293, 2001, 580, 13, 1678, 1209, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 2 ]
brightness.py
darevish/scripts
0
181981
#!/usr/bin/python # use this instead: # http://ubuntuforums.org/showthread.php?t=2243162&p=13127246#post13127246 import sys minBrightness = 100; maxBrightnessFile = open("/sys/class/backlight/intel_backlight/max_brightness", "r"); maxBrightness = int(maxBrightnessFile.read()); maxBrightnessFile.close(); brightnessFile = open("/sys/class/backlight/intel_backlight/brightness", "r+") brightness = int(brightnessFile.read()) brightnessFile.seek(0) brightnessFile.truncate() try: step = int( sys.argv[1] ); except (IndexError, ValueError): step = 0; brightness += step if brightness > maxBrightness: brightness = maxBrightness elif brightness < minBrightness: brightness = minBrightness brightnessFile.write( str(brightness) + "\n" ); brightnessFile.close();
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 29937, 671, 445, 2012, 29901, 13, 29937, 1732, 597, 431, 1657, 1137, 272, 6762, 29889, 990, 29914, 4294, 7097, 29889, 1961, 29973, 29873, 29922, 29906, 29906, 29946, 29941, 29896, 29953, 29906, 29987, 29886, 29922, 29896, 29941, 29896, 29906, 29955, 29906, 29946, 29953, 29937, 2490, 29896, 29941, 29896, 29906, 29955, 29906, 29946, 29953, 13, 13, 5215, 10876, 13, 13, 1195, 29933, 1266, 2264, 353, 29871, 29896, 29900, 29900, 29936, 13, 13, 3317, 29933, 1266, 2264, 2283, 353, 1722, 11974, 9675, 29914, 1990, 29914, 1627, 4366, 29914, 524, 295, 29918, 1627, 4366, 29914, 3317, 29918, 1182, 523, 2264, 613, 376, 29878, 1496, 13, 3317, 29933, 1266, 2264, 353, 938, 29898, 3317, 29933, 1266, 2264, 2283, 29889, 949, 3310, 13, 3317, 29933, 1266, 2264, 2283, 29889, 5358, 890, 13, 13, 1182, 523, 2264, 2283, 353, 1722, 11974, 9675, 29914, 1990, 29914, 1627, 4366, 29914, 524, 295, 29918, 1627, 4366, 29914, 1182, 523, 2264, 613, 376, 29878, 29974, 1159, 13, 1182, 523, 2264, 353, 938, 29898, 1182, 523, 2264, 2283, 29889, 949, 3101, 13, 1182, 523, 2264, 2283, 29889, 344, 1416, 29898, 29900, 29897, 13, 1182, 523, 2264, 2283, 29889, 509, 4661, 403, 580, 13, 13, 2202, 29901, 13, 1678, 4331, 353, 938, 29898, 10876, 29889, 19218, 29961, 29896, 29962, 3482, 13, 19499, 313, 3220, 2392, 29892, 7865, 2392, 1125, 13, 1678, 4331, 353, 29871, 29900, 29936, 13, 13, 1182, 523, 2264, 4619, 4331, 13, 13, 361, 11785, 2264, 1405, 4236, 29933, 1266, 2264, 29901, 13, 1678, 11785, 2264, 353, 4236, 29933, 1266, 2264, 13, 23681, 11785, 2264, 529, 1375, 29933, 1266, 2264, 29901, 13, 1678, 11785, 2264, 353, 1375, 29933, 1266, 2264, 13, 13, 1182, 523, 2264, 2283, 29889, 3539, 29898, 851, 29898, 1182, 523, 2264, 29897, 718, 6634, 29876, 29908, 3482, 13, 1182, 523, 2264, 2283, 29889, 5358, 890, 13, 2 ]
python/demo_queries/volumes/treatments_by_volume.py
jocelynpender/fna-query
0
193880
<filename>python/demo_queries/volumes/treatments_by_volume.py from src.query import * if __name__ == '__main__': ask_query("[[Volume::Volume 17]]", "taxa_volume_17.csv")
[ 1, 529, 9507, 29958, 4691, 29914, 17482, 29918, 339, 6358, 29914, 1555, 9351, 29914, 2484, 271, 1860, 29918, 1609, 29918, 24623, 29889, 2272, 13, 3166, 4765, 29889, 1972, 1053, 334, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 2244, 29918, 1972, 703, 8999, 24679, 1057, 24679, 29871, 29896, 29955, 5262, 613, 376, 941, 17367, 29918, 24623, 29918, 29896, 29955, 29889, 7638, 1159, 13, 2 ]
src/scraping/newslists_scrapers/ukrnet.py
mstrechen/news-scraper
0
38971
from queue import Queue from datetime import datetime, timedelta from .INewslistScraper import INewslistScraper from .. import article from .. import driver class Scraper(INewslistScraper): def __init__(self, limit: int = 100): INewslistScraper.__init__(self, limit) self._tag_to_url = { "politics" : "https://www.ukr.net/news/politika.html", "economics" : "https://www.ukr.net/news/jekonomika.html", "accidents" : "https://www.ukr.net/news/proisshestvija.html", "society" : "https://www.ukr.net/news/society.html", "technologies" : "https://www.ukr.net/news/tehnologii.html", "science" : "https://www.ukr.net/news/science.html", "auto" : "https://www.ukr.net/news/avto.html", "sport" : "https://www.ukr.net/news/sport.html", "health" : "https://www.ukr.net/news/zdorove.html", "celebrities" : "https://www.ukr.net/news/show_biznes.html", "global" : "https://www.ukr.net/news/za_rubezhom.html", "fun" : "https://www.ukr.net/news/kurezy.html", "photoreport" : "https://www.ukr.net/news/fotoreportazh.html", "video" : "https://www.ukr.net/news/video.html" } self.driver = driver.driver self.xpath = { "absolute_article_path" : '//*[@id="main"]/div/article/section' } self.monthshorts = [u"січ", u"лют", u"бер", u"кві", u"тра", \ u"чер", u"лип", u"сер", u"вер", u"жов", u"лис", u"гру"] def _load_more(self): self.driver.execute_script("window.scrollTo(0, document.body.scrollHeight);") def _date_from_ukr_to_datetime(self, s: str, index: int): mon = s[s.find(' ') + 1 :] day = int(s[: s.find(' ')]) return datetime(datetime.today().year, self.monthshorts.index(mon) + 1, \ day, index // 60, index % 60) def _convert_datetime(self, s: str, index: int): s = s.strip() if s.find(':') != -1: h = int(s[:2]) m = int(s[3:]) return datetime.today() + timedelta(hours=h, minutes=m) return self._date_from_ukr_to_datetime(s, index) def _parse_by_tag(self, tag, url, queue: Queue): dr = self.driver dr.get(url) elems = dr.find_elements_by_xpath(self.xpath["absolute_article_path"]) prev_cnt = 0 while len(elems) < self.limit and len(elems) != prev_cnt: self._load_more() prev_cnt = len(elems) elems = dr.find_elements_by_xpath(self.xpath["absolute_article_path"]) for e, index in zip(elems, range(self.limit)): dt = e.find_element_by_tag_name("time") dt = self._convert_datetime(dt.text, index) e = e.find_element_by_tag_name("div") e = e.find_element_by_tag_name("div") link = e.find_element_by_tag_name("a") e_url = link.get_attribute("href") e_headline = link.text queue.put_nowait(article.Article(e_url, e_headline, dt, tags=[tag])) def push_articles_list(self, queue: Queue): for tag in self._tag_to_url: self._parse_by_tag(tag, self._tag_to_url[tag], queue)
[ 1, 515, 9521, 1053, 5462, 434, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 13, 13, 3166, 869, 1177, 809, 29879, 1761, 4421, 336, 546, 1053, 2672, 809, 29879, 1761, 4421, 336, 546, 13, 13, 13, 3166, 6317, 1053, 4274, 13, 3166, 6317, 1053, 7156, 13, 13, 1990, 2522, 336, 546, 29898, 1177, 809, 29879, 1761, 4421, 336, 546, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4046, 29901, 938, 353, 29871, 29896, 29900, 29900, 1125, 13, 4706, 2672, 809, 29879, 1761, 4421, 336, 546, 17255, 2344, 12035, 1311, 29892, 4046, 29897, 13, 4706, 1583, 3032, 4039, 29918, 517, 29918, 2271, 353, 426, 13, 9651, 376, 20087, 1199, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 20087, 4106, 29889, 1420, 613, 13, 9651, 376, 29872, 4599, 1199, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 1324, 29895, 4917, 4106, 29889, 1420, 613, 13, 9651, 376, 5753, 16719, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 771, 790, 29882, 342, 29894, 8044, 29889, 1420, 613, 13, 9651, 376, 2839, 3305, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 2839, 3305, 29889, 1420, 613, 13, 9651, 376, 21695, 11763, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 371, 3123, 1189, 2236, 29889, 1420, 613, 13, 9651, 376, 29879, 15277, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 29879, 15277, 29889, 1420, 613, 13, 9651, 376, 6921, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 485, 517, 29889, 1420, 613, 13, 9651, 376, 29879, 637, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 29879, 637, 29889, 1420, 613, 13, 9651, 376, 354, 4298, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 8849, 272, 994, 29889, 1420, 613, 13, 9651, 376, 346, 19982, 768, 583, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 4294, 29918, 29890, 466, 4515, 29889, 1420, 613, 13, 9651, 376, 10945, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 1362, 29918, 29878, 4003, 29920, 9706, 29889, 1420, 613, 13, 9651, 376, 7692, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 29895, 545, 1537, 29889, 1420, 613, 13, 9651, 376, 561, 327, 487, 637, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 29888, 327, 487, 637, 834, 29882, 29889, 1420, 613, 13, 9651, 376, 9641, 29908, 584, 376, 991, 597, 1636, 29889, 2679, 29878, 29889, 1212, 29914, 15753, 29914, 9641, 29889, 1420, 29908, 13, 4706, 500, 13, 4706, 1583, 29889, 9465, 353, 7156, 29889, 9465, 13, 4706, 1583, 29889, 23635, 353, 426, 13, 9651, 376, 23552, 29918, 7914, 29918, 2084, 29908, 584, 525, 458, 29930, 17548, 333, 543, 3396, 3108, 29914, 4563, 29914, 7914, 29914, 2042, 29915, 13, 4706, 500, 13, 13, 4706, 1583, 29889, 10874, 12759, 29879, 353, 518, 29884, 29908, 7723, 29981, 613, 318, 29908, 2583, 29932, 613, 318, 29908, 7279, 613, 318, 29908, 29951, 3452, 613, 318, 29908, 6711, 613, 320, 13, 9651, 318, 29908, 20142, 613, 318, 29908, 644, 29964, 613, 318, 29908, 14315, 613, 318, 29908, 3531, 613, 318, 29908, 29998, 516, 613, 318, 29908, 644, 29935, 613, 318, 29908, 29969, 1086, 3108, 13, 13, 1678, 822, 903, 1359, 29918, 5514, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9465, 29889, 7978, 29918, 2154, 703, 7165, 29889, 10510, 1762, 29898, 29900, 29892, 1842, 29889, 2587, 29889, 10510, 7011, 416, 1159, 13, 13, 1678, 822, 903, 1256, 29918, 3166, 29918, 2679, 29878, 29918, 517, 29918, 12673, 29898, 1311, 29892, 269, 29901, 851, 29892, 2380, 29901, 938, 1125, 13, 4706, 1601, 353, 269, 29961, 29879, 29889, 2886, 877, 25710, 718, 29871, 29896, 584, 29962, 13, 4706, 2462, 353, 938, 29898, 29879, 7503, 269, 29889, 2886, 877, 25710, 2314, 13, 4706, 736, 12865, 29898, 12673, 29889, 27765, 2141, 6360, 29892, 1583, 29889, 10874, 12759, 29879, 29889, 2248, 29898, 3712, 29897, 718, 29871, 29896, 29892, 320, 13, 4706, 2462, 29892, 2380, 849, 29871, 29953, 29900, 29892, 2380, 1273, 29871, 29953, 29900, 29897, 13, 13, 1678, 822, 903, 13441, 29918, 12673, 29898, 1311, 29892, 269, 29901, 851, 29892, 2380, 29901, 938, 1125, 13, 4706, 269, 353, 269, 29889, 17010, 580, 13, 4706, 565, 269, 29889, 2886, 877, 29901, 1495, 2804, 448, 29896, 29901, 13, 9651, 298, 353, 938, 29898, 29879, 7503, 29906, 2314, 13, 9651, 286, 353, 938, 29898, 29879, 29961, 29941, 29901, 2314, 13, 9651, 736, 12865, 29889, 27765, 580, 718, 5335, 287, 2554, 29898, 29882, 2470, 29922, 29882, 29892, 6233, 29922, 29885, 29897, 13, 4706, 736, 1583, 3032, 1256, 29918, 3166, 29918, 2679, 29878, 29918, 517, 29918, 12673, 29898, 29879, 29892, 2380, 29897, 13, 13, 1678, 822, 903, 5510, 29918, 1609, 29918, 4039, 29898, 1311, 29892, 4055, 29892, 3142, 29892, 9521, 29901, 5462, 434, 1125, 13, 4706, 4192, 353, 1583, 29889, 9465, 13, 4706, 4192, 29889, 657, 29898, 2271, 29897, 13, 4706, 4552, 1516, 353, 4192, 29889, 2886, 29918, 17664, 29918, 1609, 29918, 23635, 29898, 1311, 29889, 23635, 3366, 23552, 29918, 7914, 29918, 2084, 20068, 13, 4706, 12379, 29918, 20047, 353, 29871, 29900, 13, 4706, 1550, 7431, 29898, 6146, 1516, 29897, 529, 1583, 29889, 13400, 322, 7431, 29898, 6146, 1516, 29897, 2804, 12379, 29918, 20047, 29901, 13, 9651, 1583, 3032, 1359, 29918, 5514, 580, 13, 9651, 12379, 29918, 20047, 353, 7431, 29898, 6146, 1516, 29897, 13, 9651, 4552, 1516, 353, 4192, 29889, 2886, 29918, 17664, 29918, 1609, 29918, 23635, 29898, 1311, 29889, 23635, 3366, 23552, 29918, 7914, 29918, 2084, 20068, 13, 13, 4706, 363, 321, 29892, 2380, 297, 14319, 29898, 6146, 1516, 29892, 3464, 29898, 1311, 29889, 13400, 22164, 13, 9651, 11636, 353, 321, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 4039, 29918, 978, 703, 2230, 1159, 13, 9651, 11636, 353, 1583, 3032, 13441, 29918, 12673, 29898, 6008, 29889, 726, 29892, 2380, 29897, 13, 9651, 321, 353, 321, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 4039, 29918, 978, 703, 4563, 1159, 13, 9651, 321, 353, 321, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 4039, 29918, 978, 703, 4563, 1159, 13, 9651, 1544, 353, 321, 29889, 2886, 29918, 5029, 29918, 1609, 29918, 4039, 29918, 978, 703, 29874, 1159, 13, 9651, 321, 29918, 2271, 353, 1544, 29889, 657, 29918, 12715, 703, 12653, 1159, 13, 9651, 321, 29918, 2813, 1220, 353, 1544, 29889, 726, 13, 9651, 9521, 29889, 649, 29918, 3707, 1249, 29898, 7914, 29889, 9986, 2512, 29898, 29872, 29918, 2271, 29892, 321, 29918, 2813, 1220, 29892, 11636, 29892, 8282, 11759, 4039, 12622, 13, 13, 13, 13, 1678, 822, 5503, 29918, 18569, 29918, 1761, 29898, 1311, 29892, 9521, 29901, 5462, 434, 1125, 13, 4706, 363, 4055, 297, 1583, 3032, 4039, 29918, 517, 29918, 2271, 29901, 13, 9651, 1583, 3032, 5510, 29918, 1609, 29918, 4039, 29898, 4039, 29892, 1583, 3032, 4039, 29918, 517, 29918, 2271, 29961, 4039, 1402, 9521, 29897, 13, 2 ]
example_problems/tutorial/piastrelle/services/eval_num_sol_server.py
romeorizzi/TALight
4
122844
<reponame>romeorizzi/TALight #!/usr/bin/env python3 from sys import stderr, exit from time import monotonic from TALinputs import TALinput from multilanguage import Env, Lang, TALcolors from piastrelle_lib import Par # METADATA OF THIS TAL_SERVICE: args_list = [ ('answ_modulus',int), ('goal',str), ('code_lang',str), ] ENV =Env(args_list) TAc =TALcolors(ENV) LANG=Lang(ENV, TAc, lambda fstring: eval(f"f'{fstring}'")) # START CODING YOUR SERVICE: MAX_N_PAIRS = 14 if ENV["code_lang"]=="compiled": MAX_N_PAIRS += 1 instances = list(range(MAX_N_PAIRS + 1)) if ENV["goal"] == "efficient": MAX_N_PAIRS = 1000 if ENV["answ_modulus"] == 0: MAX_N_PAIRS = 100 if ENV["code_lang"]=="compiled": MAX_N_PAIRS *= 2 scaling_factor = 1.2 n = instances[-1] while True: n = 1 + int(n * scaling_factor) if n > MAX_N_PAIRS: break instances.append(n) p = Par(MAX_N_PAIRS, nums_modulus=ENV["answ_modulus"]) def one_test(n): assert n <= MAX_N_PAIRS risp_correct = p.num_sol(n) TAc.print(n, "yellow", ["bold"]) start = monotonic() risp = TALinput(int, 1, TAc=TAc)[0] end = monotonic() t = end - start # è un float, in secondi if ENV["answ_modulus"] == 0: if risp != risp_correct: TAc.print(LANG.render_feedback("not-equal", f'# No. Your solution is NOT correct. The number of well-formed tilings of a corridor of dimension 1x {n} is:\n {risp_correct}. Not {risp}.'), "red", ["bold"]) exit(0) elif (risp % ENV["answ_modulus"]) != (risp_correct % ENV["answ_modulus"]): TAc.print(LANG.render_feedback("not-equiv", f'No. You solution is not correct. The number of well-formed tilings of a corridor of dimension 1x{n} is {risp_correct}. Taken modulus {ENV["answ_modulus"]} this value boils down to {risp_correct % ENV["answ_modulus"]}. Not {risp}.'), "red", ["bold"]) exit(0) return t for n in instances: time = one_test(n) print(f"#Correct! [took {time} secs on your machine]") if time > 1: if n > 13: TAc.print(LANG.render_feedback("seems-correct-weak", f'# Ok. :) Your solution correctly computes the number of well formed tilings of a corridor of dimension 1x{n}.'), "green") TAc.print(LANG.render_feedback("not-efficient", f'# No. Your solution is not efficient. Run on your machine, it took more than one second to compute the number of well-formed tilings of a corridor of dimension 1x{n} .'), "red", ["bold"]) exit(0) TAc.print(LANG.render_feedback("seems-correct-strong", f'# Ok. :) Your solution appears to be correct (checked on several instances).'), "green") TAc.print(LANG.render_feedback("efficient", f'# Ok. :) Your solution is efficient: its running time is logarithmic in the number of tilings it counts.'), "green") exit(0)
[ 1, 529, 276, 1112, 420, 29958, 4871, 272, 466, 2526, 29914, 29911, 1964, 523, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 3166, 10876, 1053, 380, 20405, 29892, 6876, 13, 3166, 931, 1053, 21196, 8927, 13, 13, 3166, 323, 1964, 2080, 29879, 1053, 323, 1964, 2080, 13, 3166, 1773, 309, 3000, 1053, 1174, 29894, 29892, 10476, 29892, 323, 1964, 27703, 13, 13, 3166, 2930, 579, 2674, 280, 29918, 1982, 1053, 1459, 13, 13, 29937, 341, 2544, 3035, 8254, 8079, 3446, 3235, 323, 1964, 29918, 6304, 19059, 29901, 13, 5085, 29918, 1761, 353, 518, 13, 1678, 6702, 550, 29893, 29918, 1545, 14999, 742, 524, 511, 13, 1678, 6702, 28111, 742, 710, 511, 13, 1678, 6702, 401, 29918, 3893, 742, 710, 511, 13, 29962, 13, 13, 25838, 353, 21745, 29898, 5085, 29918, 1761, 29897, 13, 6040, 29883, 353, 29911, 1964, 27703, 29898, 25838, 29897, 13, 29931, 19453, 29922, 29931, 574, 29898, 25838, 29892, 323, 10644, 29892, 14013, 285, 1807, 29901, 19745, 29898, 29888, 29908, 29888, 29915, 29912, 29888, 1807, 10162, 5783, 13, 13, 29937, 6850, 8322, 4810, 29928, 4214, 612, 22970, 26996, 19059, 29901, 13, 12648, 29918, 29940, 29918, 7228, 8193, 29903, 353, 29871, 29896, 29946, 13, 361, 12524, 29963, 3366, 401, 29918, 3893, 3108, 26359, 2388, 2356, 1115, 13, 1678, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 4619, 29871, 29896, 13, 2611, 2925, 353, 1051, 29898, 3881, 29898, 12648, 29918, 29940, 29918, 7228, 8193, 29903, 718, 29871, 29896, 876, 13, 361, 12524, 29963, 3366, 28111, 3108, 1275, 376, 8462, 1115, 13, 1678, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 353, 29871, 29896, 29900, 29900, 29900, 13, 1678, 565, 12524, 29963, 3366, 550, 29893, 29918, 1545, 14999, 3108, 1275, 29871, 29900, 29901, 13, 4706, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 353, 29871, 29896, 29900, 29900, 13, 1678, 565, 12524, 29963, 3366, 401, 29918, 3893, 3108, 26359, 2388, 2356, 1115, 13, 4706, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 334, 29922, 29871, 29906, 13, 1678, 21640, 29918, 19790, 353, 29871, 29896, 29889, 29906, 13, 1678, 302, 353, 8871, 14352, 29896, 29962, 13, 1678, 1550, 5852, 29901, 13, 4706, 302, 353, 29871, 29896, 718, 938, 29898, 29876, 334, 21640, 29918, 19790, 29897, 13, 4706, 565, 302, 1405, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 29901, 13, 9651, 2867, 13, 4706, 8871, 29889, 4397, 29898, 29876, 29897, 13, 13, 29886, 353, 1459, 29898, 12648, 29918, 29940, 29918, 7228, 8193, 29903, 29892, 954, 29879, 29918, 1545, 14999, 29922, 25838, 3366, 550, 29893, 29918, 1545, 14999, 20068, 13, 13, 1753, 697, 29918, 1688, 29898, 29876, 1125, 13, 1678, 4974, 302, 5277, 18134, 29918, 29940, 29918, 7228, 8193, 29903, 13, 1678, 22475, 29918, 15728, 353, 282, 29889, 1949, 29918, 2929, 29898, 29876, 29897, 13, 1678, 323, 10644, 29889, 2158, 29898, 29876, 29892, 376, 29136, 613, 6796, 8934, 20068, 13, 1678, 1369, 353, 21196, 8927, 580, 13, 1678, 22475, 353, 323, 1964, 2080, 29898, 524, 29892, 29871, 29896, 29892, 323, 10644, 29922, 6040, 29883, 9601, 29900, 29962, 13, 1678, 1095, 353, 21196, 8927, 580, 13, 1678, 260, 353, 1095, 448, 1369, 396, 2077, 443, 5785, 29892, 297, 1473, 29875, 13, 1678, 565, 12524, 29963, 3366, 550, 29893, 29918, 1545, 14999, 3108, 1275, 29871, 29900, 29901, 13, 4706, 565, 22475, 2804, 22475, 29918, 15728, 29901, 13, 9651, 323, 10644, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 1333, 29899, 11745, 613, 285, 29915, 29937, 1939, 29889, 3575, 1650, 338, 6058, 1959, 29889, 450, 1353, 310, 1532, 29899, 15628, 6928, 886, 310, 263, 1034, 2429, 272, 310, 9927, 29871, 29896, 29916, 426, 29876, 29913, 338, 3583, 29876, 426, 3780, 29886, 29918, 15728, 1836, 2216, 426, 3780, 29886, 1836, 5477, 376, 1127, 613, 6796, 8934, 20068, 462, 308, 13, 9651, 6876, 29898, 29900, 29897, 13, 1678, 25342, 313, 3780, 29886, 1273, 12524, 29963, 3366, 550, 29893, 29918, 1545, 14999, 20068, 2804, 313, 3780, 29886, 29918, 15728, 1273, 12524, 29963, 3366, 550, 29893, 29918, 1545, 14999, 3108, 1125, 13, 4706, 323, 10644, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 1333, 29899, 9402, 613, 285, 29915, 3782, 29889, 887, 1650, 338, 451, 1959, 29889, 450, 1353, 310, 1532, 29899, 15628, 6928, 886, 310, 263, 1034, 2429, 272, 310, 9927, 29871, 29896, 29916, 29912, 29876, 29913, 338, 426, 3780, 29886, 29918, 15728, 1836, 323, 9424, 878, 14999, 426, 25838, 3366, 550, 29893, 29918, 1545, 14999, 3108, 29913, 445, 995, 1045, 2719, 1623, 304, 426, 3780, 29886, 29918, 15728, 1273, 12524, 29963, 3366, 550, 29893, 29918, 1545, 14999, 3108, 1836, 2216, 426, 3780, 29886, 1836, 5477, 376, 1127, 613, 6796, 8934, 20068, 462, 13, 4706, 6876, 29898, 29900, 29897, 13, 1678, 736, 260, 1678, 13, 308, 13, 1454, 302, 297, 8871, 29901, 13, 259, 931, 353, 697, 29918, 1688, 29898, 29876, 29897, 13, 259, 1596, 29898, 29888, 29908, 29937, 12521, 1621, 29991, 518, 517, 554, 426, 2230, 29913, 409, 2395, 373, 596, 4933, 29962, 1159, 13, 259, 565, 931, 1405, 29871, 29896, 29901, 13, 539, 565, 302, 1405, 29871, 29896, 29941, 29901, 13, 965, 323, 10644, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 344, 1567, 29899, 15728, 29899, 25129, 613, 285, 29915, 29937, 3674, 29889, 4248, 29871, 3575, 1650, 5149, 2912, 267, 278, 1353, 310, 1532, 8429, 6928, 886, 310, 263, 1034, 2429, 272, 310, 9927, 29871, 29896, 29916, 29912, 29876, 1836, 5477, 376, 12692, 1159, 13, 539, 323, 10644, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 1333, 29899, 8462, 613, 285, 29915, 29937, 1939, 29889, 3575, 1650, 338, 451, 8543, 29889, 7525, 373, 596, 4933, 29892, 372, 3614, 901, 1135, 697, 1473, 304, 10272, 278, 1353, 310, 1532, 29899, 15628, 6928, 886, 310, 263, 1034, 2429, 272, 310, 9927, 29871, 29896, 29916, 29912, 29876, 29913, 869, 5477, 376, 1127, 613, 6796, 8934, 20068, 308, 13, 539, 6876, 29898, 29900, 29897, 13, 4706, 13, 6040, 29883, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 344, 1567, 29899, 15728, 29899, 1110, 613, 285, 29915, 29937, 3674, 29889, 4248, 29871, 3575, 1650, 5692, 304, 367, 1959, 313, 11238, 373, 3196, 8871, 467, 5477, 376, 12692, 1159, 13, 6040, 29883, 29889, 2158, 29898, 29931, 19453, 29889, 9482, 29918, 18798, 1627, 703, 8462, 613, 285, 29915, 29937, 3674, 29889, 4248, 29871, 3575, 1650, 338, 8543, 29901, 967, 2734, 931, 338, 1480, 23830, 13076, 297, 278, 1353, 310, 6928, 886, 372, 18139, 29889, 5477, 376, 12692, 1159, 13, 13, 13322, 29898, 29900, 29897, 13, 2 ]
examples/constraints.py
jbarberia/PFNET.py
3
31955
#***************************************************# # This file is part of PFNET. # # # # Copyright (c) 2015, <NAME>. # # # # PFNET is released under the BSD 2-clause license. # #***************************************************# # Optimization Problems - Constraints import sys sys.path.append('.') import pfnet net = pfnet.Parser(sys.argv[1]).parse(sys.argv[1]) net.set_flags('bus', 'variable', 'any', ['voltage magnitude','voltage angle']) print(net.num_vars == 2*net.num_buses) constr = pfnet.Constraint('AC power balance',net) print(constr.name == 'AC power balance') x = net.get_var_values() constr.analyze() print(constr.num_extra_vars) constr.eval(x + 0.01) constr.eval(x) import numpy as np f = constr.f print(type(f), f.shape) print(np.linalg.norm(f,np.inf)) bus = net.get_bus(5) Hi = constr.get_H_single(bus.dP_index) print(type(Hi), Hi.shape, Hi.nnz) coefficients = np.random.randn(f.size) constr.combine_H(coefficients) H = constr.H_combined print(type(H), H.shape, H.nnz)
[ 1, 396, 7775, 7775, 7775, 17435, 29937, 13, 29937, 910, 934, 338, 760, 310, 349, 29943, 6006, 29889, 462, 539, 396, 13, 29937, 462, 462, 462, 259, 396, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 29892, 529, 5813, 15513, 539, 396, 13, 29937, 462, 462, 462, 259, 396, 13, 29937, 349, 29943, 6006, 338, 5492, 1090, 278, 350, 7230, 29871, 29906, 29899, 16398, 1509, 19405, 29889, 396, 13, 29937, 7775, 7775, 7775, 17435, 29937, 13, 13, 29937, 20693, 326, 2133, 11583, 29879, 448, 1281, 4151, 9466, 13, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 12839, 1495, 13, 5215, 282, 29888, 1212, 13, 13, 1212, 353, 282, 29888, 1212, 29889, 11726, 29898, 9675, 29889, 19218, 29961, 29896, 14664, 5510, 29898, 9675, 29889, 19218, 29961, 29896, 2314, 13, 13, 1212, 29889, 842, 29918, 15764, 877, 8262, 742, 13, 795, 525, 11918, 742, 13, 795, 525, 1384, 742, 13, 795, 6024, 1555, 29873, 482, 18497, 3788, 1555, 29873, 482, 10696, 11287, 13, 13, 2158, 29898, 1212, 29889, 1949, 29918, 16908, 1275, 29871, 29906, 29930, 1212, 29889, 1949, 29918, 29890, 6394, 29897, 13, 13, 535, 710, 353, 282, 29888, 1212, 29889, 21529, 877, 2477, 3081, 17346, 742, 1212, 29897, 13, 13, 2158, 29898, 535, 710, 29889, 978, 1275, 525, 2477, 3081, 17346, 1495, 13, 13, 29916, 353, 7787, 29889, 657, 29918, 1707, 29918, 5975, 580, 13, 13, 535, 710, 29889, 24209, 911, 580, 13, 13, 2158, 29898, 535, 710, 29889, 1949, 29918, 17833, 29918, 16908, 29897, 13, 13, 535, 710, 29889, 14513, 29898, 29916, 718, 29871, 29900, 29889, 29900, 29896, 29897, 13, 535, 710, 29889, 14513, 29898, 29916, 29897, 13, 13, 5215, 12655, 408, 7442, 13, 13, 29888, 353, 378, 710, 29889, 29888, 13, 13, 2158, 29898, 1853, 29898, 29888, 511, 285, 29889, 12181, 29897, 13, 13, 2158, 29898, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29888, 29892, 9302, 29889, 7192, 876, 13, 13, 8262, 353, 7787, 29889, 657, 29918, 8262, 29898, 29945, 29897, 13, 13, 18567, 353, 378, 710, 29889, 657, 29918, 29950, 29918, 14369, 29898, 8262, 29889, 29881, 29925, 29918, 2248, 29897, 13, 13, 2158, 29898, 1853, 29898, 18567, 511, 6324, 29889, 12181, 29892, 6324, 29889, 15755, 29920, 29897, 13, 13, 1111, 8462, 29879, 353, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 29888, 29889, 2311, 29897, 13, 13, 535, 710, 29889, 17743, 457, 29918, 29950, 29898, 1111, 8462, 29879, 29897, 13, 13, 29950, 353, 378, 710, 29889, 29950, 29918, 17743, 1312, 13, 13, 2158, 29898, 1853, 29898, 29950, 511, 379, 29889, 12181, 29892, 379, 29889, 15755, 29920, 29897, 13, 13, 259, 13, 13, 13, 2 ]
acurl/tests/test_to_curl.py
markgreene74/mite
17
48313
import pytest from helpers import create_request import acurl def test_to_curl(): r = create_request("GET", "http://foo.com") assert r.to_curl() == "curl -X GET http://foo.com" def test_to_curl_headers(): r = create_request( "GET", "http://foo.com", headers=("Foo: bar", "My-Header: is-awesome") ) assert ( r.to_curl() == "curl -X GET -H 'Foo: bar' -H 'My-Header: is-awesome' http://foo.com" ) def test_to_curl_cookies(): r = create_request( "GET", "http://foo.com", cookies=(acurl._Cookie(False, "foo.com", True, "/", False, 0, "123", "456"),), ) assert r.to_curl() == "curl -X GET --cookie 123=456 http://foo.com" def test_to_curl_multiple_cookies(): r = create_request( "GET", "http://foo.com", cookies=( acurl._Cookie(False, "foo.com", True, "/", False, 0, "123", "456"), acurl._Cookie(False, "foo.com", True, "/", False, 0, "789", "abc"), ), ) assert r.to_curl() == "curl -X GET --cookie '123=456;789=abc' http://foo.com" @pytest.mark.skip(reason="unimplemented") def test_to_curl_cookies_wrong_domain(): # I'm not sure if this is a valid test case...Request objects should # probably only be constructed via Session.request, which always creates # cookies for the domain of the request. So the case this is exercising # won't ever happen. r = create_request( "GET", "http://foo.com", cookies=( acurl._Cookie( False, "bar.com", # The domain doesn't match, the cookie should not be passed True, "/", False, 0, "123", "456", ), ), ) assert r.to_curl() == "curl -X GET http://foo.com" def test_to_curl_auth(): r = create_request("GET", "http://foo.com", auth=("user", "pass")) assert r.to_curl() == "curl -X GET --user user:pass http://foo.com"
[ 1, 1053, 11451, 1688, 13, 3166, 1371, 414, 1053, 1653, 29918, 3827, 13, 13, 5215, 1274, 2271, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 18963, 7295, 13, 1678, 364, 353, 1653, 29918, 3827, 703, 7194, 613, 376, 1124, 597, 5431, 29889, 510, 1159, 13, 1678, 4974, 364, 29889, 517, 29918, 18963, 580, 1275, 376, 18963, 448, 29990, 12354, 268, 1732, 597, 5431, 29889, 510, 29908, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 18963, 29918, 13662, 7295, 13, 1678, 364, 353, 1653, 29918, 3827, 29898, 13, 4706, 376, 7194, 613, 376, 1124, 597, 5431, 29889, 510, 613, 9066, 29922, 703, 14016, 29901, 2594, 613, 376, 3421, 29899, 7850, 29901, 338, 29899, 1450, 14151, 1159, 13, 1678, 1723, 13, 1678, 4974, 313, 13, 4706, 364, 29889, 517, 29918, 18963, 580, 13, 4706, 1275, 376, 18963, 448, 29990, 12354, 448, 29950, 525, 14016, 29901, 2594, 29915, 448, 29950, 525, 3421, 29899, 7850, 29901, 338, 29899, 1450, 14151, 29915, 1678, 1732, 597, 5431, 29889, 510, 29908, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 18963, 29918, 15108, 583, 7295, 13, 1678, 364, 353, 1653, 29918, 3827, 29898, 13, 4706, 376, 7194, 613, 13, 4706, 376, 1124, 597, 5431, 29889, 510, 613, 13, 4706, 21046, 7607, 562, 2271, 3032, 24914, 29898, 8824, 29892, 376, 5431, 29889, 510, 613, 5852, 29892, 5591, 613, 7700, 29892, 29871, 29900, 29892, 376, 29896, 29906, 29941, 613, 376, 29946, 29945, 29953, 4968, 511, 13, 1678, 1723, 13, 1678, 4974, 364, 29889, 517, 29918, 18963, 580, 1275, 376, 18963, 448, 29990, 12354, 29871, 1192, 21509, 29871, 29896, 29906, 29941, 29922, 29946, 29945, 29953, 259, 1732, 597, 5431, 29889, 510, 29908, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 18963, 29918, 20787, 29918, 15108, 583, 7295, 13, 1678, 364, 353, 1653, 29918, 3827, 29898, 13, 4706, 376, 7194, 613, 13, 4706, 376, 1124, 597, 5431, 29889, 510, 613, 13, 4706, 21046, 7607, 13, 9651, 1274, 2271, 3032, 24914, 29898, 8824, 29892, 376, 5431, 29889, 510, 613, 5852, 29892, 5591, 613, 7700, 29892, 29871, 29900, 29892, 376, 29896, 29906, 29941, 613, 376, 29946, 29945, 29953, 4968, 13, 9651, 1274, 2271, 3032, 24914, 29898, 8824, 29892, 376, 5431, 29889, 510, 613, 5852, 29892, 5591, 613, 7700, 29892, 29871, 29900, 29892, 376, 29955, 29947, 29929, 613, 376, 10736, 4968, 13, 4706, 10353, 13, 1678, 1723, 13, 1678, 4974, 364, 29889, 517, 29918, 18963, 580, 1275, 376, 18963, 448, 29990, 12354, 29871, 1192, 21509, 525, 29896, 29906, 29941, 29922, 29946, 29945, 29953, 29936, 29955, 29947, 29929, 29922, 10736, 29915, 259, 1732, 597, 5431, 29889, 510, 29908, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 11014, 29898, 23147, 543, 348, 326, 2037, 287, 1159, 13, 1753, 1243, 29918, 517, 29918, 18963, 29918, 15108, 583, 29918, 15866, 549, 29918, 7247, 7295, 13, 1678, 396, 306, 29915, 29885, 451, 1854, 565, 445, 338, 263, 2854, 1243, 1206, 856, 3089, 3618, 881, 13, 1678, 396, 3117, 871, 367, 13319, 3025, 16441, 29889, 3827, 29892, 607, 2337, 10017, 13, 1678, 396, 21046, 363, 278, 5354, 310, 278, 2009, 29889, 29871, 1105, 278, 1206, 445, 338, 24472, 3476, 292, 13, 1678, 396, 2113, 29915, 29873, 3926, 3799, 29889, 13, 1678, 364, 353, 1653, 29918, 3827, 29898, 13, 4706, 376, 7194, 613, 13, 4706, 376, 1124, 597, 5431, 29889, 510, 613, 13, 4706, 21046, 7607, 13, 9651, 1274, 2271, 3032, 24914, 29898, 13, 18884, 7700, 29892, 13, 18884, 376, 1646, 29889, 510, 613, 29871, 396, 450, 5354, 1838, 29915, 29873, 1993, 29892, 278, 15327, 881, 451, 367, 4502, 13, 18884, 5852, 29892, 13, 18884, 5591, 613, 13, 18884, 7700, 29892, 13, 462, 29900, 29892, 13, 18884, 376, 29896, 29906, 29941, 613, 13, 18884, 376, 29946, 29945, 29953, 613, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 1723, 13, 1678, 4974, 364, 29889, 517, 29918, 18963, 580, 1275, 376, 18963, 448, 29990, 12354, 1732, 597, 5431, 29889, 510, 29908, 13, 13, 13, 1753, 1243, 29918, 517, 29918, 18963, 29918, 5150, 7295, 13, 1678, 364, 353, 1653, 29918, 3827, 703, 7194, 613, 376, 1124, 597, 5431, 29889, 510, 613, 4817, 29922, 703, 1792, 613, 376, 3364, 5783, 13, 1678, 4974, 364, 29889, 517, 29918, 18963, 580, 1275, 376, 18963, 448, 29990, 12354, 259, 1192, 1792, 1404, 29901, 3364, 29871, 1732, 597, 5431, 29889, 510, 29908, 13, 2 ]
tests/silhouette_test.py
JesusFreke/fscad
35
51505
<gh_stars>10-100 # Copyright 2019 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import adsk.fusion from adsk.core import Point3D, Vector3D import unittest # note: load_tests is required for the "pattern" test filtering functionality in loadTestsFromModule in run() from fscad.test_utils import FscadTestCase, load_tests from fscad.fscad import * class SilhouetteTest(FscadTestCase): def test_orthogonal_face_silhouette(self): rect = Rect(1, 1) silhouette = Silhouette(rect.faces[0], adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), rect.size().asArray()) def test_non_orthogonal_face_silhouette(self): rect = Rect(1, 1) rect.ry(45) silhouette = Silhouette(rect.faces[0], adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), (rect.size().x, rect.size().y, 0)) def test_parallel_face_silhouette(self): rect = Rect(1, 1) rect.ry(90) silhouette = Silhouette(rect.faces[0], adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), (0, 0, 0)) def test_body_silhouette(self): box = Box(1, 1, 1) box.ry(45) silhouette = Silhouette(box.bodies[0], adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), (box.size().x, box.size().y, 0)) def test_component_silhouette(self): rect = Rect(1, 1) rect.ry(45) silhouette = Silhouette(rect, adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), (rect.size().x, rect.size().y, 0)) def test_multiple_disjoint_faces_silhouette(self): rect1 = Rect(1, 1) rect2 = Rect(1, 1) rect2.ry(45) rect2.tx(2) assembly = Group([rect1, rect2]) silhouette = Silhouette(assembly.faces, adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertTrue(abs(silhouette.size().x - assembly.size().x) < app().pointTolerance) self.assertTrue(abs(silhouette.size().y - assembly.size().y) < app().pointTolerance) self.assertEquals(silhouette.size().z, 0) def test_multiple_overlapping_faces_silhouette(self): rect1 = Rect(1, 1) rect2 = Rect(1, 1) rect2.ry(45) rect2.translate(.5, .5) assembly = Group([rect1, rect2]) silhouette = Silhouette(assembly.faces, adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertTrue(abs(silhouette.size().x - assembly.size().x) < app().pointTolerance) self.assertTrue(abs(silhouette.size().y - assembly.size().y) < app().pointTolerance) self.assertEquals(silhouette.size().z, 0) def test_cylinder_silhouette(self): cyl = Cylinder(1, 1) silhouette = Silhouette(cyl, adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), (cyl.size().x, cyl.size().y, 0)) def test_single_edge(self): circle = Circle(1) silhouette = Silhouette(circle.edges[0], adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1))) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), circle.size().asArray()) def test_multiple_edges(self): rect = Rect(1, 1) hole1 = Circle(.1) hole2 = Circle(.2) hole1.place( (-hole1 == -rect) + .1, (-hole1 == -rect) + .1, ~hole1 == ~rect) hole2.place( (+hole2 == +rect) - .1, (+hole2 == +rect) - .1, ~hole2 == ~rect) assembly = Difference(rect, hole1, hole2) silhouette = Silhouette(assembly.faces[0].outer_edges, assembly.get_plane()) silhouette.create_occurrence(True) self.assertEquals(silhouette.size().asArray(), rect.size().asArray()) self.assertEquals(len(silhouette.edges), 4) def test_named_edges(self): box = Box(1, 1, 1) silhouette = Silhouette( box, adsk.core.Plane.create( Point3D.create(0, 0, -1), Vector3D.create(0, 0, 1)), named_edges={ "front": box.shared_edges(box.bottom, box.front), "back": box.shared_edges(box.bottom, box.back), "left": box.shared_edges(box.bottom, box.left), "right": box.shared_edges(box.bottom, box.right)}) silhouette.create_occurrence(create_children=True) edge_finder = Box(.1, .1, .1) edge_finder.place( ~edge_finder == ~silhouette, -edge_finder == -silhouette, ~edge_finder == ~silhouette) found_edges = silhouette.find_edges(edge_finder) named_edges = silhouette.named_edges("front") self.assertEquals(len(found_edges), 1) self.assertEquals(found_edges, named_edges) edge_finder.place( ~edge_finder == ~silhouette, +edge_finder == +silhouette, ~edge_finder == ~silhouette) found_edges = silhouette.find_edges(edge_finder) named_edges = silhouette.named_edges("back") self.assertEquals(len(found_edges), 1) self.assertEquals(found_edges, named_edges) edge_finder.place( +edge_finder == +silhouette, ~edge_finder == ~silhouette, ~edge_finder == ~silhouette) found_edges = silhouette.find_edges(edge_finder) named_edges = silhouette.named_edges("right") self.assertEquals(len(found_edges), 1) self.assertEquals(found_edges, named_edges) edge_finder.place( -edge_finder == -silhouette, ~edge_finder == ~silhouette, ~edge_finder == ~silhouette) found_edges = silhouette.find_edges(edge_finder) named_edges = silhouette.named_edges("left") self.assertEquals(len(found_edges), 1) self.assertEquals(found_edges, named_edges) def run(context): import sys test_suite = unittest.defaultTestLoader.loadTestsFromModule(sys.modules[__name__], #pattern="named_edges", ) unittest.TextTestRunner(failfast=True).run(test_suite)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 5087, 365, 12182, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 2045, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 5215, 594, 808, 29889, 29888, 3958, 13, 3166, 594, 808, 29889, 3221, 1053, 8984, 29941, 29928, 29892, 16510, 29941, 29928, 13, 13, 5215, 443, 27958, 13, 13, 29937, 4443, 29901, 2254, 29918, 21150, 338, 3734, 363, 278, 376, 11037, 29908, 1243, 21166, 9863, 297, 2254, 24376, 4591, 7355, 297, 1065, 580, 13, 3166, 285, 1557, 328, 29889, 1688, 29918, 13239, 1053, 383, 1557, 328, 3057, 8259, 29892, 2254, 29918, 21150, 13, 3166, 285, 1557, 328, 29889, 29888, 1557, 328, 1053, 334, 13, 13, 13, 1990, 5664, 10774, 2353, 3057, 29898, 29943, 1557, 328, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 2072, 23419, 29918, 2161, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1621, 29889, 8726, 29961, 29900, 1402, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 7705, 29889, 2311, 2141, 294, 2588, 3101, 13, 13, 1678, 822, 1243, 29918, 5464, 29918, 2072, 23419, 29918, 2161, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 7705, 29889, 719, 29898, 29946, 29945, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1621, 29889, 8726, 29961, 29900, 1402, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 313, 1621, 29889, 2311, 2141, 29916, 29892, 7705, 29889, 2311, 2141, 29891, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 1243, 29918, 23482, 29918, 2161, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 7705, 29889, 719, 29898, 29929, 29900, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1621, 29889, 8726, 29961, 29900, 1402, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 1243, 29918, 2587, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 3800, 353, 11773, 29898, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 4706, 3800, 29889, 719, 29898, 29946, 29945, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1884, 29889, 29890, 397, 583, 29961, 29900, 1402, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 313, 1884, 29889, 2311, 2141, 29916, 29892, 3800, 29889, 2311, 2141, 29891, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 1243, 29918, 9700, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 7705, 29889, 719, 29898, 29946, 29945, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1621, 29892, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 313, 1621, 29889, 2311, 2141, 29916, 29892, 7705, 29889, 2311, 2141, 29891, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 2218, 12090, 29918, 8726, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 29896, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 13, 4706, 7705, 29906, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 7705, 29906, 29889, 719, 29898, 29946, 29945, 29897, 13, 4706, 7705, 29906, 29889, 7508, 29898, 29906, 29897, 13, 13, 4706, 11470, 353, 6431, 4197, 1621, 29896, 29892, 7705, 29906, 2314, 13, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 26936, 29889, 8726, 29892, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 6897, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29916, 448, 11470, 29889, 2311, 2141, 29916, 29897, 529, 623, 2141, 3149, 29911, 324, 261, 749, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 6897, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29891, 448, 11470, 29889, 2311, 2141, 29891, 29897, 529, 623, 2141, 3149, 29911, 324, 261, 749, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29920, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 957, 433, 3262, 29918, 8726, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 7705, 29896, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 13, 4706, 7705, 29906, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 7705, 29906, 29889, 719, 29898, 29946, 29945, 29897, 13, 4706, 7705, 29906, 29889, 21652, 11891, 29945, 29892, 869, 29945, 29897, 13, 13, 4706, 11470, 353, 6431, 4197, 1621, 29896, 29892, 7705, 29906, 2314, 13, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 26936, 29889, 8726, 29892, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 6897, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29916, 448, 11470, 29889, 2311, 2141, 29916, 29897, 529, 623, 2141, 3149, 29911, 324, 261, 749, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 6897, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29891, 448, 11470, 29889, 2311, 2141, 29891, 29897, 529, 623, 2141, 3149, 29911, 324, 261, 749, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 29920, 29892, 29871, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 1270, 29880, 4995, 29918, 25590, 10774, 2353, 29898, 1311, 1125, 13, 4706, 20396, 353, 315, 2904, 4995, 29898, 29896, 29892, 29871, 29896, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 1270, 29880, 29892, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 313, 1270, 29880, 29889, 2311, 2141, 29916, 29892, 20396, 29889, 2311, 2141, 29891, 29892, 29871, 29900, 876, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 12864, 29898, 1311, 1125, 13, 4706, 8607, 353, 27927, 29898, 29896, 29897, 13, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 16622, 29889, 287, 2710, 29961, 29900, 1402, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 9651, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 9651, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 4961, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 8607, 29889, 2311, 2141, 294, 2588, 3101, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 287, 2710, 29898, 1311, 1125, 13, 4706, 7705, 353, 22914, 29898, 29896, 29892, 29871, 29896, 29897, 13, 13, 4706, 16188, 29896, 353, 27927, 11891, 29896, 29897, 13, 4706, 16188, 29906, 353, 27927, 11891, 29906, 29897, 13, 13, 4706, 16188, 29896, 29889, 6689, 29898, 13, 9651, 8521, 29716, 29896, 1275, 448, 1621, 29897, 718, 869, 29896, 29892, 13, 9651, 8521, 29716, 29896, 1275, 448, 1621, 29897, 718, 869, 29896, 29892, 13, 9651, 3695, 29716, 29896, 1275, 3695, 1621, 29897, 13, 13, 4706, 16188, 29906, 29889, 6689, 29898, 13, 9651, 20532, 29716, 29906, 1275, 718, 1621, 29897, 448, 869, 29896, 29892, 13, 9651, 20532, 29716, 29906, 1275, 718, 1621, 29897, 448, 869, 29896, 29892, 13, 9651, 3695, 29716, 29906, 1275, 3695, 1621, 29897, 13, 13, 4706, 11470, 353, 360, 17678, 29898, 1621, 29892, 16188, 29896, 29892, 16188, 29906, 29897, 13, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 26936, 29889, 8726, 29961, 29900, 1822, 5561, 29918, 287, 2710, 29892, 11470, 29889, 657, 29918, 22116, 3101, 13, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 14776, 29898, 25590, 10774, 2353, 29889, 2311, 2141, 294, 2588, 3285, 7705, 29889, 2311, 2141, 294, 2588, 3101, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 25590, 10774, 2353, 29889, 287, 2710, 511, 29871, 29946, 29897, 13, 13, 1678, 822, 1243, 29918, 17514, 29918, 287, 2710, 29898, 1311, 1125, 13, 4706, 3800, 353, 11773, 29898, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 29897, 13, 4706, 4047, 10774, 2353, 353, 5664, 10774, 2353, 29898, 13, 9651, 3800, 29892, 13, 9651, 594, 808, 29889, 3221, 29889, 3247, 1662, 29889, 3258, 29898, 13, 18884, 8984, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 448, 29896, 511, 13, 18884, 16510, 29941, 29928, 29889, 3258, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 8243, 13, 9651, 4257, 29918, 287, 2710, 3790, 13, 18884, 376, 8862, 1115, 3800, 29889, 12366, 29918, 287, 2710, 29898, 1884, 29889, 8968, 29892, 3800, 29889, 8862, 511, 13, 18884, 376, 1627, 1115, 3800, 29889, 12366, 29918, 287, 2710, 29898, 1884, 29889, 8968, 29892, 3800, 29889, 1627, 511, 13, 18884, 376, 1563, 1115, 3800, 29889, 12366, 29918, 287, 2710, 29898, 1884, 29889, 8968, 29892, 3800, 29889, 1563, 511, 13, 18884, 376, 1266, 1115, 3800, 29889, 12366, 29918, 287, 2710, 29898, 1884, 29889, 8968, 29892, 3800, 29889, 1266, 26972, 13, 4706, 4047, 10774, 2353, 29889, 3258, 29918, 15693, 26841, 29898, 3258, 29918, 11991, 29922, 5574, 29897, 13, 13, 4706, 7636, 29918, 2886, 261, 353, 11773, 11891, 29896, 29892, 869, 29896, 29892, 869, 29896, 29897, 13, 4706, 7636, 29918, 2886, 261, 29889, 6689, 29898, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29892, 13, 9651, 448, 12864, 29918, 2886, 261, 1275, 448, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29897, 13, 4706, 1476, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 2886, 29918, 287, 2710, 29898, 12864, 29918, 2886, 261, 29897, 13, 4706, 4257, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 17514, 29918, 287, 2710, 703, 8862, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 11940, 29918, 287, 2710, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 11940, 29918, 287, 2710, 29892, 4257, 29918, 287, 2710, 29897, 13, 13, 4706, 7636, 29918, 2886, 261, 29889, 6689, 29898, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29892, 13, 9651, 718, 12864, 29918, 2886, 261, 1275, 718, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29897, 13, 4706, 1476, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 2886, 29918, 287, 2710, 29898, 12864, 29918, 2886, 261, 29897, 13, 4706, 4257, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 17514, 29918, 287, 2710, 703, 1627, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 11940, 29918, 287, 2710, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 11940, 29918, 287, 2710, 29892, 4257, 29918, 287, 2710, 29897, 13, 13, 4706, 7636, 29918, 2886, 261, 29889, 6689, 29898, 13, 9651, 718, 12864, 29918, 2886, 261, 1275, 718, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29897, 13, 4706, 1476, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 2886, 29918, 287, 2710, 29898, 12864, 29918, 2886, 261, 29897, 13, 4706, 4257, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 17514, 29918, 287, 2710, 703, 1266, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 11940, 29918, 287, 2710, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 11940, 29918, 287, 2710, 29892, 4257, 29918, 287, 2710, 29897, 13, 13, 4706, 7636, 29918, 2886, 261, 29889, 6689, 29898, 13, 9651, 448, 12864, 29918, 2886, 261, 1275, 448, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29892, 13, 9651, 3695, 12864, 29918, 2886, 261, 1275, 3695, 25590, 10774, 2353, 29897, 13, 4706, 1476, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 2886, 29918, 287, 2710, 29898, 12864, 29918, 2886, 261, 29897, 13, 4706, 4257, 29918, 287, 2710, 353, 4047, 10774, 2353, 29889, 17514, 29918, 287, 2710, 703, 1563, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 2435, 29898, 11940, 29918, 287, 2710, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 11940, 29918, 287, 2710, 29892, 4257, 29918, 287, 2710, 29897, 13, 13, 13, 13, 1753, 1065, 29898, 4703, 1125, 13, 1678, 1053, 10876, 13, 1678, 1243, 29918, 13495, 353, 443, 27958, 29889, 4381, 3057, 10036, 29889, 1359, 24376, 4591, 7355, 29898, 9675, 29889, 7576, 29961, 1649, 978, 1649, 1402, 13, 462, 462, 462, 18884, 396, 11037, 543, 17514, 29918, 287, 2710, 613, 13, 462, 462, 462, 18884, 1723, 13, 1678, 443, 27958, 29889, 1626, 3057, 16802, 29898, 14057, 11255, 29922, 5574, 467, 3389, 29898, 1688, 29918, 13495, 29897, 13, 2 ]
ML-gane.py
HackerLion123/Machine-Learning
1
176311
from sklearn import tree; Test_data = [[]]
[ 1, 515, 2071, 19668, 1053, 5447, 29936, 13, 3057, 29918, 1272, 353, 518, 2636, 29962, 13, 2 ]
scripts/matcher/utils/utils.py
jakubarendac/fingerflow
0
95782
import os import numpy as np def preprocess_item(filename, folder): return np.genfromtxt( f"{folder}/{filename}", delimiter=",") def load_folder_data(folder): data = [] labels = [] for _, _, files in os.walk(folder): raw_data = [preprocess_item(filename, folder) for filename in files] labels = [int(filename.split("_")[0]) for filename in files] data = np.stack(raw_data) return data, np.array(labels) def load_dataset(dataset_path, positive=True, negative=True): print('START: loading data') data, labels = load_folder_data(dataset_path) numClasses = np.max(labels) + 1 idx = [np.where(labels == i)[0] for i in range(0, numClasses)] pairImages = [] pairLabels = [] for idxA, _ in enumerate(data): # grab the current image and label belonging to the current # iteration currentImage = data[idxA] label = labels[idxA] # randomly pick an image that belongs to the *same* class # label if positive: idxB = np.random.choice(idx[label]) posData = data[idxB] # prepare a positive pair and update the images and labels # lists, respectively np.random.shuffle(currentImage) pairImages.append([currentImage, posData]) pairLabels.append([1]) # grab the indices for each of the class labels *not* equal to # the current label and randomly pick an image corresponding # to a label *not* equal to the current label # print(labels) if negative: negIdx = np.where(labels != label)[0] negData = data[np.random.choice(negIdx)] # prepare a negative pair of images and update our lists np.random.shuffle(currentImage) pairImages.append([currentImage, negData]) pairLabels.append([0]) # return a 2-tuple of our image pairs and labels print('FINISH: loading data') return (np.array(pairImages), np.array(pairLabels).astype('float32'))
[ 1, 1053, 2897, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 758, 5014, 29918, 667, 29898, 9507, 29892, 4138, 1125, 13, 1678, 736, 7442, 29889, 1885, 3166, 3945, 29898, 13, 4706, 285, 29908, 29912, 12083, 6822, 29912, 9507, 17671, 28552, 543, 29892, 1159, 13, 13, 13, 1753, 2254, 29918, 12083, 29918, 1272, 29898, 12083, 1125, 13, 1678, 848, 353, 5159, 13, 1678, 11073, 353, 5159, 13, 13, 1678, 363, 17117, 17117, 2066, 297, 2897, 29889, 20919, 29898, 12083, 1125, 13, 4706, 10650, 29918, 1272, 353, 518, 1457, 5014, 29918, 667, 29898, 9507, 29892, 4138, 29897, 363, 10422, 297, 2066, 29962, 13, 13, 4706, 11073, 353, 518, 524, 29898, 9507, 29889, 5451, 703, 29918, 1159, 29961, 29900, 2314, 363, 10422, 297, 2066, 29962, 13, 13, 4706, 848, 353, 7442, 29889, 1429, 29898, 1610, 29918, 1272, 29897, 13, 13, 1678, 736, 848, 29892, 7442, 29889, 2378, 29898, 21134, 29897, 13, 13, 13, 1753, 2254, 29918, 24713, 29898, 24713, 29918, 2084, 29892, 6374, 29922, 5574, 29892, 8178, 29922, 5574, 1125, 13, 1678, 1596, 877, 25826, 29901, 8363, 848, 1495, 13, 1678, 848, 29892, 11073, 353, 2254, 29918, 12083, 29918, 1272, 29898, 24713, 29918, 2084, 29897, 13, 13, 1678, 954, 27403, 353, 7442, 29889, 3317, 29898, 21134, 29897, 718, 29871, 29896, 13, 1678, 22645, 353, 518, 9302, 29889, 3062, 29898, 21134, 1275, 474, 9601, 29900, 29962, 363, 474, 297, 3464, 29898, 29900, 29892, 954, 27403, 4638, 13, 13, 1678, 5101, 20163, 353, 5159, 13, 1678, 5101, 4775, 29879, 353, 5159, 13, 13, 1678, 363, 22645, 29909, 29892, 903, 297, 26985, 29898, 1272, 1125, 13, 4706, 396, 17229, 278, 1857, 1967, 322, 3858, 23329, 304, 278, 1857, 13, 4706, 396, 12541, 13, 4706, 1857, 2940, 353, 848, 29961, 13140, 29909, 29962, 13, 4706, 3858, 353, 11073, 29961, 13140, 29909, 29962, 13, 4706, 396, 20459, 5839, 385, 1967, 393, 14393, 304, 278, 334, 17642, 29930, 770, 13, 4706, 396, 3858, 13, 13, 4706, 565, 6374, 29901, 13, 9651, 22645, 29933, 353, 7442, 29889, 8172, 29889, 16957, 29898, 13140, 29961, 1643, 2314, 13, 13, 9651, 926, 1469, 353, 848, 29961, 13140, 29933, 29962, 13, 9651, 396, 19012, 263, 6374, 5101, 322, 2767, 278, 4558, 322, 11073, 13, 9651, 396, 8857, 29892, 8307, 13, 9651, 7442, 29889, 8172, 29889, 845, 21897, 29898, 3784, 2940, 29897, 13, 9651, 5101, 20163, 29889, 4397, 4197, 3784, 2940, 29892, 926, 1469, 2314, 13, 9651, 5101, 4775, 29879, 29889, 4397, 4197, 29896, 2314, 13, 13, 4706, 396, 17229, 278, 16285, 363, 1269, 310, 278, 770, 11073, 334, 1333, 29930, 5186, 304, 13, 4706, 396, 278, 1857, 3858, 322, 20459, 5839, 385, 1967, 6590, 13, 4706, 396, 304, 263, 3858, 334, 1333, 29930, 5186, 304, 278, 1857, 3858, 13, 4706, 396, 1596, 29898, 21134, 29897, 13, 13, 4706, 565, 8178, 29901, 13, 9651, 3480, 1204, 29916, 353, 7442, 29889, 3062, 29898, 21134, 2804, 3858, 9601, 29900, 29962, 13, 13, 9651, 3480, 1469, 353, 848, 29961, 9302, 29889, 8172, 29889, 16957, 29898, 10052, 1204, 29916, 4638, 13, 9651, 396, 19012, 263, 8178, 5101, 310, 4558, 322, 2767, 1749, 8857, 13, 9651, 7442, 29889, 8172, 29889, 845, 21897, 29898, 3784, 2940, 29897, 13, 9651, 5101, 20163, 29889, 4397, 4197, 3784, 2940, 29892, 3480, 1469, 2314, 13, 9651, 5101, 4775, 29879, 29889, 4397, 4197, 29900, 2314, 13, 13, 4706, 396, 736, 263, 29871, 29906, 29899, 23583, 310, 1749, 1967, 11000, 322, 11073, 13, 1678, 1596, 877, 29943, 1177, 3235, 29950, 29901, 8363, 848, 1495, 13, 13, 1678, 736, 313, 9302, 29889, 2378, 29898, 18784, 20163, 511, 7442, 29889, 2378, 29898, 18784, 4775, 29879, 467, 579, 668, 877, 7411, 29941, 29906, 8785, 13, 2 ]
reversi.py
holishing/Othello
0
75484
#!/usr/bin/env python3 import argparse from game.game import Game def main(): """ Reversi game with human player vs AI player. """ parser = argparse.ArgumentParser() parser.add_argument('--timeout', help="Number of seconds the brain is allowed to think before making its move", type=int, default=1) parser.add_argument('--text', help="Display the game in text mode", action='store_false') parser.add_argument('--player', help="Player first", action='store_true') parser.add_argument('--ai', help="AI first", action='store_true') parser.add_argument('--verify', help="Verify AI using a random player", action='store_true') args = parser.parse_args() if args.timeout < 0: exit() players=['player', 'player'] if args.player: players = ['player', 'ai'] if args.ai: players = ['ai', 'player'] elif args.verify: players = ['ai', 'random'] game = Game(timeout=args.timeout, colour=args.text, players=players) game.run() if __name__ == "__main__": main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 1852, 5510, 13, 3166, 3748, 29889, 11802, 1053, 8448, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 830, 874, 29875, 3748, 411, 5199, 4847, 7186, 319, 29902, 4847, 29889, 13, 1678, 9995, 13, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 15619, 742, 1371, 543, 4557, 310, 6923, 278, 17294, 338, 6068, 304, 1348, 1434, 3907, 967, 4337, 613, 13, 462, 4706, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 726, 742, 1371, 543, 9323, 278, 3748, 297, 1426, 4464, 613, 3158, 2433, 8899, 29918, 4541, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 9106, 742, 1371, 543, 9075, 937, 613, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1794, 742, 1371, 543, 23869, 937, 613, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 27902, 742, 1371, 543, 6565, 1598, 319, 29902, 773, 263, 4036, 4847, 613, 3158, 2433, 8899, 29918, 3009, 1495, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 15619, 529, 29871, 29900, 29901, 13, 4706, 6876, 580, 13, 13, 1678, 10769, 29922, 1839, 9106, 742, 525, 9106, 2033, 13, 1678, 565, 6389, 29889, 9106, 29901, 13, 4706, 10769, 353, 6024, 9106, 742, 525, 1794, 2033, 13, 1678, 565, 6389, 29889, 1794, 29901, 13, 4706, 10769, 353, 6024, 1794, 742, 525, 9106, 2033, 13, 1678, 25342, 6389, 29889, 27902, 29901, 13, 4706, 10769, 353, 6024, 1794, 742, 525, 8172, 2033, 13, 13, 1678, 3748, 353, 8448, 29898, 15619, 29922, 5085, 29889, 15619, 29892, 13, 18884, 12384, 29922, 5085, 29889, 726, 29892, 13, 18884, 10769, 29922, 1456, 414, 29897, 13, 1678, 3748, 29889, 3389, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
list_albums.py
gvellut/flickr_api_utils
0
85466
<filename>list_albums.py<gh_stars>0 from datetime import datetime, timezone from addict import Dict as Addict from api_auth import auth_flickr flickr = auth_flickr() def get_albums(): return _get_album_page(1, []) def _get_album_page(page, acc): search_result = Addict(flickr.photosets.getList(page=page)) albums = search_result.photosets for album in albums.photoset: date_create = int(album.date_create) dt_date_create = datetime.fromtimestamp(date_create, timezone.utc) acc.append((album.title._content, dt_date_create, album.id)) if albums.page < albums.pages: return _get_album_page(page + 1, acc) else: return acc albums_with_cd = get_albums() albums_with_cd.sort(key=lambda x: x[1], reverse=True) for (title, date) in albums_with_cd: print(f"{date.strftime('%Y-%m-%d')} => {title}")
[ 1, 529, 9507, 29958, 1761, 29918, 10336, 29879, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 12865, 1053, 12865, 29892, 29431, 13, 13, 3166, 788, 919, 1053, 360, 919, 408, 3462, 919, 13, 13, 3166, 7882, 29918, 5150, 1053, 4817, 29918, 29888, 1406, 29878, 13, 13, 29888, 1406, 29878, 353, 4817, 29918, 29888, 1406, 29878, 580, 13, 13, 13, 1753, 679, 29918, 10336, 29879, 7295, 13, 1678, 736, 903, 657, 29918, 10336, 29918, 3488, 29898, 29896, 29892, 518, 2314, 13, 13, 13, 1753, 903, 657, 29918, 10336, 29918, 3488, 29898, 3488, 29892, 1035, 1125, 13, 1678, 2740, 29918, 2914, 353, 3462, 919, 29898, 29888, 1406, 29878, 29889, 561, 15788, 1691, 29889, 657, 1293, 29898, 3488, 29922, 3488, 876, 13, 1678, 20618, 353, 2740, 29918, 2914, 29889, 561, 15788, 1691, 13, 13, 1678, 363, 3769, 297, 20618, 29889, 561, 15788, 300, 29901, 13, 4706, 2635, 29918, 3258, 353, 938, 29898, 10336, 29889, 1256, 29918, 3258, 29897, 13, 4706, 11636, 29918, 1256, 29918, 3258, 353, 12865, 29889, 3166, 16394, 29898, 1256, 29918, 3258, 29892, 29431, 29889, 329, 29883, 29897, 13, 4706, 1035, 29889, 4397, 3552, 10336, 29889, 3257, 3032, 3051, 29892, 11636, 29918, 1256, 29918, 3258, 29892, 3769, 29889, 333, 876, 13, 13, 1678, 565, 20618, 29889, 3488, 529, 20618, 29889, 12292, 29901, 13, 4706, 736, 903, 657, 29918, 10336, 29918, 3488, 29898, 3488, 718, 29871, 29896, 29892, 1035, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 1035, 13, 13, 13, 10336, 29879, 29918, 2541, 29918, 2252, 353, 679, 29918, 10336, 29879, 580, 13, 10336, 29879, 29918, 2541, 29918, 2252, 29889, 6605, 29898, 1989, 29922, 2892, 921, 29901, 921, 29961, 29896, 1402, 11837, 29922, 5574, 29897, 13, 13, 1454, 313, 3257, 29892, 2635, 29897, 297, 20618, 29918, 2541, 29918, 2252, 29901, 13, 1678, 1596, 29898, 29888, 29908, 29912, 1256, 29889, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1495, 29913, 1149, 426, 3257, 27195, 13, 2 ]
howdoyoulike/howdoyoulike/urls.py
benjamin0/how-do-you-like-them-apples
0
73116
from django.conf.urls import patterns, include, url from django.contrib import admin urlpatterns = patterns('', # Examples: url(r'^admin/', include(admin.site.urls)), url(r'^grappelli/', include('grappelli.urls')), # grappelli URLS url(r'^calls/$', 'calls.views.call'), )
[ 1, 515, 9557, 29889, 5527, 29889, 26045, 1053, 15038, 29892, 3160, 29892, 3142, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 13, 2271, 11037, 29879, 353, 15038, 877, 742, 13, 1678, 396, 1222, 9422, 29901, 13, 1678, 3142, 29898, 29878, 29915, 29985, 6406, 29914, 742, 3160, 29898, 6406, 29889, 2746, 29889, 26045, 8243, 13, 1678, 3142, 29898, 29878, 29915, 29985, 3874, 407, 5481, 29914, 742, 3160, 877, 3874, 407, 5481, 29889, 26045, 1495, 511, 396, 2646, 407, 5481, 3988, 29903, 13, 1678, 3142, 29898, 29878, 29915, 29985, 29883, 4293, 13346, 742, 525, 29883, 4293, 29889, 7406, 29889, 4804, 5477, 13, 29897, 13, 2 ]
pyaction/__init__.py
a-maliarov/pyaction
9
155831
<gh_stars>1-10 # -*- coding: utf-8 -*- """ pyaction ~~~~~~~~ PyAction is a module dedicated to eliminate rewriting the same code from project to project by providing a set of tools according to specific python fields. Library hierarchy (this must be set and be followed in any case): pyaction/ field_name/ __init__.py objects.py utils.py Rules: 1. An __init__ file within a field folder should provide a short description of the field and contain imports of the main objects within this field to be operated by the end user. 2. The file called "objects.py" should contain all the main objects of the field to be used by the end user. 3. The file called "utils.py" should contain all the utilities to be used by the "objects.py" and not the end user. 4. The file called "exceptions.py" should contain all the exceptions to be used by both developers and the end users. """ from .general import * from .multiprocessing_ import * from .datetime_ import * from .beautifulsoup_ import * #-----------------------------------------------------------------------------
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 2272, 2467, 13, 26594, 13, 13, 19737, 4276, 338, 263, 3883, 16955, 304, 27399, 337, 16554, 278, 1021, 775, 515, 13, 4836, 304, 2060, 491, 13138, 263, 731, 310, 8492, 5034, 304, 2702, 3017, 13, 9621, 29889, 13, 13, 12284, 21277, 313, 1366, 1818, 367, 731, 322, 367, 5643, 297, 738, 1206, 1125, 13, 2272, 2467, 29914, 13, 1678, 1746, 29918, 978, 29914, 13, 4706, 4770, 2344, 26914, 2272, 13, 4706, 3618, 29889, 2272, 13, 4706, 3667, 29879, 29889, 2272, 13, 13, 29934, 2540, 29901, 13, 29896, 29889, 530, 4770, 2344, 1649, 934, 2629, 263, 1746, 4138, 881, 3867, 263, 3273, 6139, 13, 974, 278, 1746, 322, 1712, 24802, 310, 278, 1667, 3618, 2629, 445, 1746, 304, 367, 13, 3372, 630, 491, 278, 1095, 1404, 29889, 13, 29906, 29889, 450, 934, 2000, 376, 12650, 29889, 2272, 29908, 881, 1712, 599, 278, 1667, 3618, 310, 278, 13, 2671, 304, 367, 1304, 491, 278, 1095, 1404, 29889, 13, 29941, 29889, 450, 934, 2000, 376, 13239, 29889, 2272, 29908, 881, 1712, 599, 278, 3667, 1907, 304, 367, 1304, 491, 13, 1552, 376, 12650, 29889, 2272, 29908, 322, 451, 278, 1095, 1404, 29889, 13, 29946, 29889, 450, 934, 2000, 376, 11739, 29879, 29889, 2272, 29908, 881, 1712, 599, 278, 15283, 304, 367, 13, 3880, 491, 1716, 18777, 322, 278, 1095, 4160, 29889, 13, 13, 15945, 29908, 13, 13, 3166, 869, 17492, 1053, 334, 13, 3166, 869, 18056, 307, 985, 292, 29918, 1053, 334, 13, 3166, 869, 12673, 29918, 1053, 334, 13, 3166, 869, 915, 1300, 6845, 29879, 1132, 29918, 1053, 334, 13, 13, 29937, 2683, 2683, 2683, 2683, 9072, 29899, 13, 2 ]
src/16/16204.py
youngdaLee/Baekjoon
11
86138
""" 16204. 카드 뽑기 작성자: xCrypt0r 언어: Python 3 사용 메모리: 29,380 KB 소요 시간: 76 ms 해결 날짜: 2020년 9월 13일 """ def main(): N, M, K = map(int, input().split()) print(min(M, K) - max(M, K) + N) if __name__ == '__main__': main()
[ 1, 9995, 13, 29896, 29953, 29906, 29900, 29946, 29889, 29871, 239, 188, 183, 31493, 29871, 238, 192, 148, 30827, 13, 13, 239, 161, 148, 31126, 31013, 29901, 921, 29907, 4641, 29900, 29878, 13, 239, 153, 187, 31129, 29901, 5132, 29871, 29941, 13, 30791, 31737, 29871, 238, 172, 151, 31962, 30826, 29901, 29871, 29906, 29929, 29892, 29941, 29947, 29900, 476, 29933, 13, 31189, 31527, 29871, 30889, 237, 179, 135, 29901, 29871, 29955, 29953, 10887, 13, 31435, 237, 181, 179, 29871, 238, 133, 163, 239, 170, 159, 29901, 29871, 29906, 29900, 29906, 29900, 31571, 29871, 29929, 31950, 29871, 29896, 29941, 31153, 13, 15945, 29908, 13, 13, 1753, 1667, 7295, 13, 1678, 405, 29892, 341, 29892, 476, 353, 2910, 29898, 524, 29892, 1881, 2141, 5451, 3101, 13, 13, 1678, 1596, 29898, 1195, 29898, 29924, 29892, 476, 29897, 448, 4236, 29898, 29924, 29892, 476, 29897, 718, 405, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
src/pythonScripts/DrivePart/download.py
sahilbest999/FVS-GIT-CLONE
0
25705
<reponame>sahilbest999/FVS-GIT-CLONE import pickle import os import re import io import response import upload import authenticate from googleapiclient.errors import HttpError from googleapiclient.discovery import build from google_auth_oauthlib.flow import InstalledAppFlow from google.auth.transport.requests import Request from googleapiclient.http import MediaIoBaseDownload import requests from tqdm import tqdm from tabulate import tabulate import re def download(file_id, destination, saveName="", service=authenticate.get_gdrive_service()): if not os.path.exists(destination): print(f"DESTINATION {destination} not found") return 0 try: file = service.files().get(fileId=file_id, fields="name, size, mimeType").execute() print(file) except HttpError as e: # print(e.content) err_code = int(e.resp['status']) print("Error Code ", err_code) if err_code == 404: print(f"FILE WITH ID {file_id} NOT FOUND") return 0 if not saveName: saveName = file['name'] mime = file['mimeType'] if mime == 'application/vnd.google-apps.document' or mime == 'application/vnd.google-apps.spreadsheet' or mime == 'application/vnd.google-apps.presentation': if downloadGsuit(file_id, destination, saveName, mime, service) == 1: return 1 else: return 0 if not os.path.splitext(file['name'])[1]: saveName += resolveExtension(file['mimeType']) print("Save name->",saveName) request = service.files().get_media(fileId = file_id) fh = io.BytesIO() downloader = MediaIoBaseDownload(fh, request) done = False while not done: status, done = downloader.next_chunk() print(f"Download {int(status.progress()*100)}") fh.seek(0) # destination = os.path.join(destination, saveName) destination += saveName newPath = checkFileAlreadyExists(destination) print(type(newPath)) print("New File Destination -> ", newPath) with open(newPath, "wb") as f: f.write(fh.read()) f.close() return 1 def checkFileAlreadyExists(path, i=1, iter=0): if os.path.exists(path): if iter == 0: pos = len(path) - 1 - path[::-1].find('.') new = path[:pos] + "("+str(i)+")" + path[pos:] else: pos = len(path) - 3 - path[::-1].find('.') new = path[:pos] + str(i) + path[pos+1:] if(os.path.exists(new)): i+=1 iter+=1 return checkFileAlreadyExists(new, i, iter) else: print("Returned Value", new) return new else: print("Returned Value", path) return path def downloadGsuit(file_id, destination, saveName, mime, service): print("IT IS A Gsuit Document") newMime={ "application/vnd.google-apps.document": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "application/vnd.google-apps.spreadsheet": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "application/vnd.google-apps.presentation": "application/vnd.openxmlformats-officedocument.presentationml.presentation", }[mime] request = service.files().export_media(fileId=file_id, mimeType=newMime) fh = io.BytesIO() downloader = MediaIoBaseDownload(fh, request) done = False while not done: status, done = downloader.next_chunk() print(f"Dowloaded {int(status.progress()*100)}") fh.seek(0) if not os.path.splitext(saveName)[1]: saveName += resolveExtension(mime) destination += saveName destination = checkFileAlreadyExists(destination) print(destination) with open(destination, "wb") as f: f.write(fh.read()) f.close() return 1 def resolveExtension(mimeType): return { "audio/aac": ".aac", "application/x-abiword": ".abw", "application/x-freearc": ".arc", "video/x-msvideo": ".avi", "application/vnd.amazon.ebook": ".azw", "application/octet-stream": ".bin", "image/bmp": ".bmp", "application/x-bzip": ".bz", "application/x-bzip2": ".bz2", "application/x-csh": ".csh", "text/css": ".css", "text/csv": ".csv", "application/msword": ".doc", "application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx", "application/vnd.ms-fontobject": ".eot", "application/epub+zip": ".epub", "application/gzip": ".gz", "image/gif": ".gif", "text/html": ".html", "image/vnd.microsoft.icon": ".ico", "text/calendar": ".ics", "application/java-archive": ".jar", "image/jpeg": ".jpg", "text/javascript": ".js", "application/json": ".json", "application/ld+json": ".jsonld", "audio/midi audio/x-midi": ".mid", "text/javascript": ".mjs", "audio/mpeg": ".mp3", "video/mpeg": ".mpeg", "application/vnd.apple.installer+xml": ".mpkg", "application/vnd.oasis.opendocument.presentation": ".odp", "application/vnd.oasis.opendocument.spreadsheet": ".ods", "application/vnd.oasis.opendocument.text": ".odt", "audio/ogg": ".oga", "video/ogg": ".ogv", "application/ogg": ".ogx", "audio/opus": ".opus", "font/otf": ".otf", "image/png": ".png", "application/pdf": ".pdf", "application/x-httpd-php": ".php", "application/vnd.ms-powerpoint": ".ppt", "application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx", "application/vnd.rar": ".rar", "application/rtf": ".rtf", "application/x-sh": ".sh", "image/svg+xml": ".svg", "application/x-shockwave-flash": ".swf", "application/x-tar": ".tar", "image/tiff": ".tif.tiff", "video/mp2t": ".ts", "font/ttf": ".ttf", "text/plain": ".txt", "application/vnd.visio": ".vsd", "audio/wav": ".wav", "audio/webm": ".weba", "video/webm": ".webm", "image/webp": ".webp", "font/woff": ".woff", "font/woff2": ".woff2", "application/xhtml+xml": ".xhtml", "application/vnd.ms-excel": ".xls", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx", "application/xml": "xml", "application/vnd.mozilla.xul+xml": ".xul", "application/zip": ".zip", "video/3gpp": ".3gp", "video/3gpp2": ".3g2", "application/x-7z-compressed": ".7z", "application/vnd.google-apps.document": ".docx", "application/vnd.google-apps.spreadsheet": ".xlsx", "application/vnd.google-apps.presentation": ".pptx", }[mimeType] download("1ikrvmXBcn_ZeXR3a8A6bdSQb_PG0DXGK", "/home/uttkarsh/Pictures/Test/ht/") #MIME TYPE:- # google doc - application/vnd.google-apps.document # google sheets - application/vnd.google-apps.spreadsheet # google slides - application/vnd.google-apps.presentation # normalFile - 1FlMtPenfHeB5GyLHwKKmrQ9omla2kk-R ------------ working # docs - 1TLvU8TSmHONcQttjnvufVeMhr83z-FrHOhexHNdJM-Q ------------ working # sheets - 1D6h9YFmZCdjY8WryicXODjOqSoHuJdjYBhH8DeKkn-A ------------ working # slides - 1Eg2BjGuZG15mu-Rd_e0mZVlVv6nD9IxbVORu0KzQucU ------------ working # folder - 1ggGA6H5ztS5IdgRxMAiQxhzDdFDSLh2A ------------ ask # photo - 1XKNBHQG-Alq1m3kypPq0d0s9WBvvmpgV ------------ working # video - 1ikrvmXBcn_ZeXR3a8A6bdSQb_PG0DXGK ------------ working
[ 1, 529, 276, 1112, 420, 29958, 29879, 801, 309, 13318, 29929, 29929, 29929, 29914, 29943, 21819, 29899, 29954, 1806, 29899, 6154, 12413, 13, 5215, 5839, 280, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 12013, 13, 5215, 2933, 13, 5215, 6441, 13, 5215, 15585, 403, 13, 3166, 5386, 481, 293, 1593, 29889, 12523, 1053, 9056, 2392, 29871, 13, 3166, 5386, 481, 293, 1593, 29889, 2218, 11911, 29891, 1053, 2048, 13, 3166, 5386, 29918, 5150, 29918, 23106, 1982, 29889, 1731, 1053, 2799, 4212, 2052, 17907, 13, 3166, 5386, 29889, 5150, 29889, 27882, 29889, 24830, 1053, 10729, 13, 3166, 5386, 481, 293, 1593, 29889, 1124, 1053, 8213, 29902, 29877, 5160, 22954, 13, 5215, 7274, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 3166, 4434, 5987, 1053, 4434, 5987, 13, 5215, 337, 13, 13, 1753, 5142, 29898, 1445, 29918, 333, 29892, 12551, 29892, 4078, 1170, 543, 613, 2669, 29922, 27218, 403, 29889, 657, 29918, 29887, 21594, 29918, 5509, 580, 1125, 13, 13, 29871, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 23848, 1125, 13, 1678, 1596, 29898, 29888, 29908, 2287, 1254, 1177, 8098, 426, 23848, 29913, 451, 1476, 1159, 13, 1678, 736, 29871, 29900, 13, 13, 29871, 1018, 29901, 13, 1678, 934, 353, 2669, 29889, 5325, 2141, 657, 29898, 1445, 1204, 29922, 1445, 29918, 333, 29892, 4235, 543, 978, 29892, 2159, 29892, 286, 603, 1542, 2564, 7978, 580, 13, 1678, 1596, 29898, 1445, 29897, 13, 29871, 5174, 9056, 2392, 408, 321, 29901, 13, 1678, 396, 1596, 29898, 29872, 29889, 3051, 29897, 13, 1678, 4589, 29918, 401, 353, 938, 29898, 29872, 29889, 13713, 1839, 4882, 11287, 13, 1678, 1596, 703, 2392, 5920, 9162, 4589, 29918, 401, 29897, 13, 1678, 565, 4589, 29918, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 418, 1596, 29898, 29888, 29908, 7724, 22659, 3553, 426, 1445, 29918, 333, 29913, 6058, 18322, 18783, 1159, 13, 1678, 736, 29871, 29900, 13, 13, 29871, 565, 451, 4078, 1170, 29901, 13, 1678, 4078, 1170, 353, 934, 1839, 978, 2033, 13, 259, 13, 29871, 286, 603, 353, 934, 1839, 29885, 603, 1542, 2033, 13, 29871, 565, 286, 603, 1275, 525, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 3225, 29915, 470, 286, 603, 1275, 525, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 1028, 27844, 29915, 470, 286, 603, 1275, 525, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 26081, 2396, 13, 1678, 565, 5142, 29954, 29658, 29898, 1445, 29918, 333, 29892, 12551, 29892, 4078, 1170, 29892, 286, 603, 29892, 2669, 29897, 1275, 29871, 29896, 29901, 13, 418, 736, 29871, 29896, 13, 1678, 1683, 29901, 736, 29871, 29900, 13, 259, 13, 29871, 565, 451, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 1445, 1839, 978, 2033, 9601, 29896, 5387, 13, 1678, 4078, 1170, 4619, 8814, 17657, 29898, 1445, 1839, 29885, 603, 1542, 11287, 13, 29871, 1596, 703, 11371, 1024, 976, 613, 7620, 1170, 29897, 13, 259, 13, 29871, 2009, 353, 2669, 29889, 5325, 2141, 657, 29918, 9799, 29898, 1445, 1204, 353, 934, 29918, 333, 29897, 13, 29871, 285, 29882, 353, 12013, 29889, 11207, 5971, 580, 13, 29871, 5142, 261, 353, 8213, 29902, 29877, 5160, 22954, 29898, 29888, 29882, 29892, 2009, 29897, 13, 29871, 2309, 353, 7700, 13, 259, 13, 29871, 1550, 451, 2309, 29901, 13, 1678, 4660, 29892, 2309, 353, 5142, 261, 29889, 4622, 29918, 29812, 580, 13, 1678, 1596, 29898, 29888, 29908, 22954, 426, 524, 29898, 4882, 29889, 18035, 580, 29930, 29896, 29900, 29900, 2915, 1159, 13, 13, 29871, 285, 29882, 29889, 344, 1416, 29898, 29900, 29897, 13, 29871, 396, 12551, 353, 2897, 29889, 2084, 29889, 7122, 29898, 23848, 29892, 4078, 1170, 29897, 13, 29871, 12551, 4619, 4078, 1170, 13, 29871, 716, 2605, 353, 1423, 2283, 2499, 2040, 24217, 29898, 23848, 29897, 13, 29871, 1596, 29898, 1853, 29898, 1482, 2605, 876, 13, 29871, 1596, 703, 4373, 3497, 15435, 3381, 1599, 9162, 716, 2605, 29897, 13, 13, 29871, 411, 1722, 29898, 1482, 2605, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 1678, 285, 29889, 3539, 29898, 29888, 29882, 29889, 949, 3101, 13, 1678, 285, 29889, 5358, 580, 13, 259, 13, 29871, 736, 29871, 29896, 13, 13, 1753, 1423, 2283, 2499, 2040, 24217, 29898, 2084, 29892, 474, 29922, 29896, 29892, 4256, 29922, 29900, 1125, 13, 29871, 565, 2897, 29889, 2084, 29889, 9933, 29898, 2084, 1125, 13, 1678, 565, 4256, 1275, 29871, 29900, 29901, 13, 418, 926, 353, 7431, 29898, 2084, 29897, 448, 29871, 29896, 448, 2224, 29961, 1057, 29899, 29896, 1822, 2886, 12839, 1495, 13, 418, 716, 353, 2224, 7503, 1066, 29962, 718, 376, 703, 29974, 710, 29898, 29875, 7240, 1159, 29908, 718, 2224, 29961, 1066, 17531, 13, 1678, 1683, 29901, 29871, 13, 418, 926, 353, 7431, 29898, 2084, 29897, 448, 29871, 29941, 448, 2224, 29961, 1057, 29899, 29896, 1822, 2886, 12839, 1495, 13, 418, 716, 353, 2224, 7503, 1066, 29962, 718, 851, 29898, 29875, 29897, 718, 2224, 29961, 1066, 29974, 29896, 17531, 13, 13, 1678, 565, 29898, 359, 29889, 2084, 29889, 9933, 29898, 1482, 22164, 13, 418, 474, 23661, 29896, 13, 418, 4256, 23661, 29896, 13, 418, 736, 1423, 2283, 2499, 2040, 24217, 29898, 1482, 29892, 474, 29892, 4256, 29897, 13, 1678, 1683, 29901, 13, 418, 1596, 703, 11609, 287, 7865, 613, 716, 29897, 13, 418, 736, 716, 13, 29871, 1683, 29901, 13, 1678, 1596, 703, 11609, 287, 7865, 613, 2224, 29897, 13, 1678, 736, 2224, 13, 13, 1753, 5142, 29954, 29658, 29898, 1445, 29918, 333, 29892, 12551, 29892, 4078, 1170, 29892, 286, 603, 29892, 2669, 1125, 13, 259, 13, 29871, 1596, 703, 1806, 8519, 319, 402, 29658, 10854, 1159, 13, 259, 13, 29871, 716, 29924, 603, 3790, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 3225, 1115, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1742, 19170, 828, 29889, 3225, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 1028, 27844, 1115, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1028, 27844, 828, 29889, 9855, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 26081, 1115, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 26081, 828, 29889, 26081, 613, 13, 29871, 500, 29961, 29885, 603, 29962, 13, 259, 13, 29871, 2009, 353, 2669, 29889, 5325, 2141, 15843, 29918, 9799, 29898, 1445, 1204, 29922, 1445, 29918, 333, 29892, 286, 603, 1542, 29922, 1482, 29924, 603, 29897, 13, 29871, 285, 29882, 353, 12013, 29889, 11207, 5971, 580, 13, 29871, 5142, 261, 353, 8213, 29902, 29877, 5160, 22954, 29898, 29888, 29882, 29892, 2009, 29897, 13, 29871, 2309, 353, 7700, 13, 29871, 1550, 451, 2309, 29901, 13, 1678, 4660, 29892, 2309, 353, 5142, 261, 29889, 4622, 29918, 29812, 580, 13, 1678, 1596, 29898, 29888, 29908, 29928, 340, 15638, 426, 524, 29898, 4882, 29889, 18035, 580, 29930, 29896, 29900, 29900, 2915, 1159, 13, 13, 29871, 285, 29882, 29889, 344, 1416, 29898, 29900, 29897, 13, 29871, 565, 451, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 7620, 1170, 9601, 29896, 5387, 13, 1678, 4078, 1170, 4619, 8814, 17657, 29898, 29885, 603, 29897, 13, 29871, 12551, 4619, 4078, 1170, 13, 29871, 12551, 353, 1423, 2283, 2499, 2040, 24217, 29898, 23848, 29897, 13, 29871, 1596, 29898, 23848, 29897, 13, 29871, 411, 1722, 29898, 23848, 29892, 376, 29893, 29890, 1159, 408, 285, 29901, 13, 1678, 285, 29889, 3539, 29898, 29888, 29882, 29889, 949, 3101, 13, 1678, 285, 29889, 5358, 580, 13, 259, 13, 29871, 736, 29871, 29896, 13, 13, 1753, 8814, 17657, 29898, 29885, 603, 1542, 1125, 13, 29871, 13, 29871, 736, 426, 13, 1678, 376, 18494, 29914, 29874, 562, 1115, 11393, 29874, 562, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 19266, 1742, 1115, 11393, 370, 29893, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 10745, 799, 29883, 1115, 11393, 5666, 613, 13, 1678, 376, 9641, 29914, 29916, 29899, 1516, 9641, 1115, 11393, 17345, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 17260, 29889, 19273, 1115, 11393, 834, 29893, 613, 13, 1678, 376, 6214, 29914, 20082, 300, 29899, 5461, 1115, 11393, 2109, 613, 13, 1678, 376, 3027, 29914, 29890, 1526, 1115, 11393, 29890, 1526, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 29890, 7554, 1115, 11393, 29890, 29920, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 29890, 7554, 29906, 1115, 11393, 29890, 29920, 29906, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 29883, 845, 1115, 11393, 29883, 845, 613, 13, 1678, 376, 726, 29914, 4268, 1115, 11393, 4268, 613, 13, 1678, 376, 726, 29914, 7638, 1115, 11393, 7638, 613, 13, 1678, 376, 6214, 29914, 1516, 1742, 1115, 11393, 1514, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1742, 19170, 828, 29889, 3225, 1115, 11393, 1514, 29916, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 1516, 29899, 29888, 10268, 1675, 1115, 11393, 29872, 327, 613, 13, 1678, 376, 6214, 29914, 1022, 431, 29974, 7554, 1115, 11393, 1022, 431, 613, 13, 1678, 376, 6214, 29914, 29887, 7554, 1115, 11393, 18828, 613, 13, 1678, 376, 3027, 29914, 18660, 1115, 11393, 18660, 613, 13, 1678, 376, 726, 29914, 1420, 1115, 11393, 1420, 613, 13, 1678, 376, 3027, 29914, 29894, 299, 29889, 4994, 29889, 4144, 1115, 11393, 1417, 613, 13, 1678, 376, 726, 29914, 23392, 1115, 11393, 1199, 613, 13, 1678, 376, 6214, 29914, 1645, 29899, 10867, 1115, 11393, 4758, 613, 13, 1678, 376, 3027, 29914, 26568, 1115, 11393, 6173, 613, 13, 1678, 376, 726, 29914, 7729, 1115, 11393, 1315, 613, 13, 1678, 376, 6214, 29914, 3126, 1115, 11393, 3126, 613, 13, 1678, 376, 6214, 29914, 430, 29974, 3126, 1115, 11393, 3126, 430, 613, 13, 1678, 376, 18494, 29914, 6563, 29875, 30081, 18494, 29914, 29916, 29899, 6563, 29875, 1115, 11393, 6563, 613, 13, 1678, 376, 726, 29914, 7729, 1115, 11393, 29885, 1315, 613, 13, 1678, 376, 18494, 29914, 20856, 1115, 11393, 1526, 29941, 613, 13, 1678, 376, 9641, 29914, 20856, 1115, 11393, 20856, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 11548, 29889, 6252, 261, 29974, 3134, 1115, 11393, 1526, 9415, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 29877, 25101, 29889, 459, 355, 4463, 29889, 26081, 1115, 11393, 397, 29886, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 29877, 25101, 29889, 459, 355, 4463, 29889, 1028, 27844, 1115, 11393, 19653, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 29877, 25101, 29889, 459, 355, 4463, 29889, 726, 1115, 11393, 397, 29873, 613, 13, 1678, 376, 18494, 29914, 468, 29887, 1115, 11393, 14895, 613, 13, 1678, 376, 9641, 29914, 468, 29887, 1115, 11393, 468, 29894, 613, 13, 1678, 376, 6214, 29914, 468, 29887, 1115, 11393, 468, 29916, 613, 13, 1678, 376, 18494, 29914, 26466, 1115, 11393, 26466, 613, 13, 1678, 376, 5657, 29914, 327, 29888, 1115, 11393, 327, 29888, 613, 13, 1678, 376, 3027, 29914, 2732, 1115, 11393, 2732, 613, 13, 1678, 376, 6214, 29914, 5140, 1115, 11393, 5140, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 1124, 29881, 29899, 1961, 1115, 11393, 1961, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 1516, 29899, 13519, 3149, 1115, 11393, 407, 29873, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 26081, 828, 29889, 26081, 1115, 11393, 407, 7508, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 13678, 1115, 11393, 13678, 613, 13, 1678, 376, 6214, 29914, 2273, 29888, 1115, 11393, 2273, 29888, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 845, 1115, 11393, 845, 613, 13, 1678, 376, 3027, 29914, 15120, 29974, 3134, 1115, 11393, 15120, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 845, 1698, 27766, 29899, 28041, 1115, 11393, 2774, 29888, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 12637, 1115, 11393, 12637, 613, 13, 1678, 376, 3027, 29914, 29873, 2593, 1115, 11393, 29873, 361, 29889, 29873, 2593, 613, 13, 1678, 376, 9641, 29914, 1526, 29906, 29873, 1115, 11393, 1372, 613, 13, 1678, 376, 5657, 29914, 698, 29888, 1115, 11393, 698, 29888, 613, 13, 1678, 376, 726, 29914, 24595, 1115, 11393, 3945, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 1730, 601, 1115, 11393, 4270, 29881, 613, 13, 1678, 376, 18494, 29914, 29893, 485, 1115, 11393, 29893, 485, 613, 13, 1678, 376, 18494, 29914, 2676, 29885, 1115, 11393, 705, 2291, 613, 13, 1678, 376, 9641, 29914, 2676, 29885, 1115, 11393, 2676, 29885, 613, 13, 1678, 376, 3027, 29914, 2676, 29886, 1115, 11393, 2676, 29886, 613, 13, 1678, 376, 5657, 29914, 827, 600, 1115, 11393, 827, 600, 613, 13, 1678, 376, 5657, 29914, 827, 600, 29906, 1115, 11393, 827, 600, 29906, 613, 13, 1678, 376, 6214, 29914, 28392, 29974, 3134, 1115, 11393, 28392, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 1516, 29899, 24633, 1115, 11393, 20267, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3150, 3134, 689, 1446, 29899, 29877, 2416, 287, 4463, 29889, 1028, 27844, 828, 29889, 9855, 1115, 11393, 20267, 29916, 613, 13, 1678, 376, 6214, 29914, 3134, 1115, 376, 3134, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 13025, 29889, 29916, 352, 29974, 3134, 1115, 11393, 29916, 352, 613, 13, 1678, 376, 6214, 29914, 7554, 1115, 11393, 7554, 613, 13, 1678, 376, 9641, 29914, 29941, 29887, 407, 1115, 11393, 29941, 29887, 29886, 613, 13, 1678, 376, 9641, 29914, 29941, 29887, 407, 29906, 1115, 11393, 29941, 29887, 29906, 613, 13, 1678, 376, 6214, 29914, 29916, 29899, 29955, 29920, 29899, 510, 13120, 1115, 11393, 29955, 29920, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 3225, 1115, 11393, 1514, 29916, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 1028, 27844, 1115, 11393, 20267, 29916, 613, 13, 1678, 376, 6214, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 26081, 1115, 11393, 407, 7508, 613, 13, 29871, 500, 29961, 29885, 603, 1542, 29962, 13, 13, 10382, 703, 29896, 638, 27465, 29990, 29933, 18038, 29918, 24625, 29990, 29934, 29941, 29874, 29947, 29909, 29953, 6448, 29903, 29984, 29890, 29918, 16903, 29900, 29928, 29990, 29954, 29968, 613, 5591, 5184, 29914, 4774, 5689, 845, 29914, 29925, 10373, 29914, 3057, 29914, 400, 29914, 1159, 13, 13, 29937, 29924, 8890, 323, 6959, 13018, 13, 29937, 5386, 1574, 448, 1678, 2280, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 3225, 13, 29937, 5386, 26718, 448, 2280, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 1028, 27844, 13, 29937, 5386, 2243, 2247, 448, 2280, 29914, 29894, 299, 29889, 3608, 29899, 13371, 29889, 26081, 13, 13, 29937, 4226, 2283, 448, 29871, 29896, 8754, 29924, 29873, 29925, 23578, 3868, 29933, 29945, 29954, 29891, 29931, 29950, 29893, 29968, 29968, 29885, 29878, 29984, 29929, 290, 433, 29906, 6859, 29899, 29934, 965, 448, 1378, 5634, 1985, 13, 29937, 10561, 448, 29871, 29896, 14632, 29894, 29965, 29947, 9375, 29885, 29950, 1164, 29883, 29984, 698, 29926, 29876, 29894, 1137, 29963, 29872, 29924, 1092, 29947, 29941, 29920, 29899, 14438, 8187, 20970, 29950, 29940, 29881, 29967, 29924, 29899, 29984, 418, 448, 1378, 5634, 1985, 13, 29937, 26718, 448, 29871, 29896, 29928, 29953, 29882, 29929, 29979, 29943, 29885, 29999, 29907, 19776, 29979, 29947, 29956, 719, 293, 29990, 13668, 29926, 29949, 29939, 6295, 29950, 29884, 29967, 19776, 29979, 29933, 29882, 29950, 29947, 2772, 29968, 3959, 29899, 29909, 1678, 448, 1378, 5634, 1985, 13, 29937, 2243, 2247, 448, 29871, 29896, 29923, 29887, 29906, 29933, 29926, 9485, 29999, 29954, 29896, 29945, 2589, 29899, 29934, 29881, 29918, 29872, 29900, 29885, 29999, 29963, 29880, 29963, 29894, 29953, 29876, 29928, 29929, 29902, 29916, 29890, 29963, 1955, 29884, 29900, 29968, 29920, 29984, 1682, 29965, 1678, 448, 1378, 5634, 1985, 13, 29937, 4138, 448, 29871, 29896, 1505, 12739, 29953, 29950, 29945, 2065, 29903, 29945, 1204, 29887, 29934, 29916, 1529, 29875, 29984, 29916, 29882, 29920, 29928, 29881, 29943, 8452, 29931, 29882, 29906, 29909, 1669, 448, 1378, 5634, 2244, 13, 29937, 15373, 448, 29871, 29896, 29990, 29968, 23189, 29950, 29984, 29954, 29899, 2499, 29939, 29896, 29885, 29941, 29895, 1478, 29925, 29939, 29900, 29881, 29900, 29879, 29929, 29956, 29933, 29894, 29894, 1526, 29887, 29963, 18884, 448, 1378, 5634, 1985, 13, 29937, 4863, 448, 29871, 29896, 638, 27465, 29990, 29933, 18038, 29918, 24625, 29990, 29934, 29941, 29874, 29947, 29909, 29953, 6448, 29903, 29984, 29890, 29918, 16903, 29900, 29928, 29990, 29954, 29968, 18884, 448, 1378, 5634, 1985, 13, 2 ]
AHCraft/crafter.py
Saad888/AutoHotCraft
3
125423
import time from AHKManager import AHKManager class Crafter: def __init__(self, AHKObj): """ This loop will run the expected sequence of actions required to craft based on requested parameters""" # Parameters for system self.user_inturrupt = False self.script = AHKObj def update(self, macros, food, pot, confirm, window, escape, settings, UIUpdate): """ Update all keybinds internally macros: list of tuple (hotkey: str, timer: int) food: tuple (hotkey: str, remaining: int, timer: int) pot: tuple (hotkey: str, remaining: int) confirm: str with hotkey window: str with crafting window hotkey settings: Tuple of three Bol values: (use_food, use_pot, use_collect) UIUpdate: Callback function to place message on UI """ # Counters: self.craft_count = 1 self.total_time = 0 self.food_used = 0 self.pots_used = 0 self.macros = macros self.use_food, self.use_pot, self.use_collect = settings self.hk_food = food[0] if self.use_food else None self.food_remains = food[1] if self.use_food else None self.food_timer = food[2] if self.use_food else None self.hk_pot = pot[0] if self.use_pot else None self.pot_remains = pot[1] if self.use_pot else None self.pot_timer = 15 self.hk_craft = window self.hk_confirm = confirm self.hk_escape = escape # Sequences Update: self.sq_craft = [] for macro in self.macros: self.sq_craft.append((macro[0], macro[1] + 1)) # Add 1 second buffer # Start the craft self.sq_begin_craft = [ (self.hk_confirm, 1), (self.hk_confirm, 1), (self.hk_confirm, 2) ] # End Craft (from end of craft) self.sq_end_craft = [] if self.use_collect: self.sq_end_craft.append((confirm, 1)) self.sq_end_craft.append((confirm, 3)) # Exit Craft (from crafting window) self.sq_exit_craft = [ (self.hk_escape, 2) ] # Food and pots self.sq_food = [(self.hk_food, 4)] self.sq_pot = [(self.hk_pot, 3)] # Restart Craft self.sq_restart_craft = [ (self.hk_craft, 1), (self.hk_confirm, 1), (self.hk_confirm, 1), (self.hk_confirm, 1), (self.hk_confirm, 2) ] self.UI_update = UIUpdate def start(self, args): """ Updates parameters and Begins separate thread for crafting loop """ self.update(*args) self.mainloop() def mainloop(self): """ Runs the main crafting loop """ loop_time = time.perf_counter() loop_start = loop_time self.user_inturrupt = False food_remains = self.food_remains * 60 if self.use_food else None pot_remains = self.pot_remains * 60 if self.use_pot else None refresh_food, refresh_pot = False, False macro_time = 0 for macro in self.macros: macro_time += macro[1] while self.user_inturrupt is False: # Main looper sequence = [] sequence += self.macros # Add crafting macros to sequence sequence += self.sq_end_craft UI_text = f"Craft number {self.craft_count} ...\n" # Sets food timers # If food or pots need to be refreshed, do so, else start next craft if self.use_food: food_remains -= (time.perf_counter() - loop_time) refresh_food = food_remains - (macro_time + 15) < 60 UI_text += f'Food: ~{food_remains / 60:0.2f} min remains' UI_text += ', refreshing after craft' if refresh_food else '' UI_text += '\n' if self.use_pot: pot_remains -= (time.perf_counter() - loop_time) refresh_pot = pot_remains - (macro_time + 15) < 60 UI_text += f'Pot: ~{pot_remains / 60:0.2f} min remains' UI_text += ', refreshing after craft' if refresh_pot else '' UI_text += '\n' if refresh_food or refresh_pot: sequence += self.sq_exit_craft if refresh_food: sequence += self.sq_food food_remains = self.food_timer * 60 + macro_time if refresh_pot: sequence += self.sq_pot pot_remains = self.pot_timer * 60 + macro_time sequence += self.sq_restart_craft else: sequence += self.sq_begin_craft loop_time = time.perf_counter() self.UI_update(UI_text) self.run_sequence(sequence) self.total_time = time.perf_counter() - loop_start if self.user_inturrupt is False: self.craft_count += 1 self.food_used += 1 if refresh_food else 0 self.pots_used += 1 if refresh_pot else 0 if self.user_inturrupt is True: mins = int(self.total_time / 60) secs = int(self.total_time - (mins * 60)) UI_text = f"{self.craft_count} crafts complete " UI_text += f"in {mins}:{secs:02d} minutes\n" if self.use_food: UI_text += f"{self.food_used} food consumed\n" if self.use_pot: UI_text += f"{self.pots_used} pots consumed\n" self.UI_update(UI_text) def run_sequence(self, sequence): """ Runs the sequence, provided in a list in the form (hotkey, timer)""" for hotkey, wait in sequence: print(f'Execute {hotkey} with delay {wait}s') self.script.execute(hotkey) for i in range(wait): time.sleep(1) if self.user_inturrupt is True: break if self.user_inturrupt is True: break if __name__ == "__main__": print('Starting test') AHK = AHKManager("C:\\Program Files\\AutoHotkey\\AutoHotkey.exe") tester = Crafter(AHK) tester.start( macros=[("{1}", 3), ("{2}", 3), ("{3}", 3)], food=None, pot=None, confirm='{C}', window='{W}', settings=(False, False, False) ) """ Update all keybinds internally macros: list of tuple (hotkey: str, timer: int) food: tuple (hotkey: str, remaining: int, timer: int) pot: tuple (hotkey: str, remaining: int) confirm: str with hotkey window: str with crafting window hotkey settings: Tuple of three Bol values: (use_food, use_pot, use_collect) """
[ 1, 1053, 931, 13, 3166, 319, 29950, 29968, 3260, 1053, 319, 29950, 29968, 3260, 13, 13, 13, 1990, 14279, 906, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 319, 29950, 29968, 9930, 1125, 13, 4706, 9995, 910, 2425, 674, 1065, 278, 3806, 5665, 310, 8820, 3734, 29871, 13, 4706, 304, 25554, 2729, 373, 13877, 4128, 15945, 29908, 13, 13, 4706, 396, 12662, 2699, 363, 1788, 29871, 13, 4706, 1583, 29889, 1792, 29918, 524, 332, 6685, 353, 7700, 13, 4706, 1583, 29889, 2154, 353, 319, 29950, 29968, 9930, 13, 268, 13, 13, 1678, 822, 2767, 29898, 1311, 29892, 5825, 1883, 29892, 9687, 29892, 3104, 29892, 9659, 29892, 3474, 29892, 10169, 29892, 6055, 29892, 29871, 13, 1669, 3740, 6422, 1125, 13, 4706, 9995, 10318, 599, 1820, 5355, 29879, 25106, 29871, 13, 4706, 5825, 1883, 29901, 1051, 310, 18761, 313, 8711, 1989, 29901, 851, 29892, 12237, 29901, 938, 29897, 13, 4706, 9687, 29901, 18761, 313, 8711, 1989, 29901, 851, 29892, 9886, 29901, 938, 29892, 12237, 29901, 938, 29897, 13, 4706, 3104, 29901, 18761, 313, 8711, 1989, 29901, 851, 29892, 9886, 29901, 938, 29897, 13, 4706, 9659, 29901, 851, 411, 7375, 1989, 539, 13, 4706, 3474, 29901, 851, 411, 25554, 292, 3474, 7375, 1989, 259, 13, 4706, 6055, 29901, 12603, 552, 310, 2211, 8922, 1819, 29901, 13, 9651, 313, 1509, 29918, 1181, 397, 29892, 671, 29918, 17765, 29892, 671, 29918, 15914, 29897, 13, 4706, 3740, 6422, 29901, 8251, 1627, 740, 304, 2058, 2643, 373, 3740, 13, 4706, 9995, 13, 13, 4706, 396, 6237, 2153, 29901, 13, 4706, 1583, 29889, 17293, 29918, 2798, 353, 29871, 29896, 13, 4706, 1583, 29889, 7827, 29918, 2230, 353, 29871, 29900, 13, 4706, 1583, 29889, 1181, 397, 29918, 3880, 353, 29871, 29900, 13, 4706, 1583, 29889, 29886, 1862, 29918, 3880, 353, 29871, 29900, 13, 13, 13, 4706, 1583, 29889, 8628, 1883, 353, 5825, 1883, 13, 4706, 1583, 29889, 1509, 29918, 1181, 397, 29892, 1583, 29889, 1509, 29918, 17765, 29892, 1583, 29889, 1509, 29918, 15914, 353, 6055, 13, 13, 4706, 1583, 29889, 29882, 29895, 29918, 1181, 397, 353, 9687, 29961, 29900, 29962, 565, 1583, 29889, 1509, 29918, 1181, 397, 1683, 6213, 13, 4706, 1583, 29889, 1181, 397, 29918, 1745, 2708, 353, 9687, 29961, 29896, 29962, 565, 1583, 29889, 1509, 29918, 1181, 397, 1683, 6213, 13, 4706, 1583, 29889, 1181, 397, 29918, 20404, 353, 9687, 29961, 29906, 29962, 565, 1583, 29889, 1509, 29918, 1181, 397, 1683, 6213, 13, 13, 4706, 1583, 29889, 29882, 29895, 29918, 17765, 353, 3104, 29961, 29900, 29962, 565, 1583, 29889, 1509, 29918, 17765, 1683, 6213, 13, 4706, 1583, 29889, 17765, 29918, 1745, 2708, 353, 3104, 29961, 29896, 29962, 565, 1583, 29889, 1509, 29918, 17765, 1683, 6213, 13, 4706, 1583, 29889, 17765, 29918, 20404, 353, 29871, 29896, 29945, 13, 13, 4706, 1583, 29889, 29882, 29895, 29918, 17293, 353, 3474, 13, 4706, 1583, 29889, 29882, 29895, 29918, 26897, 353, 9659, 13, 4706, 1583, 29889, 29882, 29895, 29918, 21587, 353, 10169, 13, 13, 308, 13, 4706, 396, 922, 339, 2063, 10318, 29901, 13, 4706, 1583, 29889, 3044, 29918, 17293, 353, 5159, 13, 4706, 363, 11758, 297, 1583, 29889, 8628, 1883, 29901, 13, 9651, 1583, 29889, 3044, 29918, 17293, 29889, 4397, 3552, 25254, 29961, 29900, 1402, 11758, 29961, 29896, 29962, 718, 29871, 29896, 876, 29871, 396, 3462, 29871, 29896, 1473, 6835, 13, 308, 13, 4706, 396, 7370, 278, 25554, 13, 4706, 1583, 29889, 3044, 29918, 463, 29918, 17293, 353, 518, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29906, 29897, 13, 4706, 4514, 13, 13, 4706, 396, 2796, 315, 4154, 313, 3166, 1095, 310, 25554, 29897, 13, 4706, 1583, 29889, 3044, 29918, 355, 29918, 17293, 353, 5159, 13, 4706, 565, 1583, 29889, 1509, 29918, 15914, 29901, 13, 9651, 1583, 29889, 3044, 29918, 355, 29918, 17293, 29889, 4397, 3552, 26897, 29892, 29871, 29896, 876, 13, 4706, 1583, 29889, 3044, 29918, 355, 29918, 17293, 29889, 4397, 3552, 26897, 29892, 29871, 29941, 876, 13, 13, 4706, 396, 25954, 315, 4154, 313, 3166, 25554, 292, 3474, 29897, 13, 4706, 1583, 29889, 3044, 29918, 13322, 29918, 17293, 353, 518, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 21587, 29892, 29871, 29906, 29897, 13, 4706, 4514, 13, 13, 4706, 396, 25453, 322, 282, 1862, 13, 4706, 1583, 29889, 3044, 29918, 1181, 397, 353, 17288, 1311, 29889, 29882, 29895, 29918, 1181, 397, 29892, 29871, 29946, 4638, 13, 4706, 1583, 29889, 3044, 29918, 17765, 353, 17288, 1311, 29889, 29882, 29895, 29918, 17765, 29892, 29871, 29941, 4638, 13, 13, 4706, 396, 11654, 442, 315, 4154, 13, 4706, 1583, 29889, 3044, 29918, 5060, 442, 29918, 17293, 353, 518, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 17293, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29896, 511, 29871, 13, 9651, 313, 1311, 29889, 29882, 29895, 29918, 26897, 29892, 29871, 29906, 29897, 13, 4706, 4514, 13, 13, 4706, 1583, 29889, 3120, 29918, 5504, 353, 3740, 6422, 13, 13, 13, 1678, 822, 1369, 29898, 1311, 29892, 6389, 1125, 13, 4706, 9995, 5020, 15190, 4128, 322, 14893, 29879, 5004, 3244, 363, 25554, 292, 2425, 9995, 13, 4706, 1583, 29889, 5504, 10456, 5085, 29897, 13, 4706, 1583, 29889, 3396, 7888, 580, 13, 13, 1678, 822, 1667, 7888, 29898, 1311, 1125, 13, 4706, 9995, 390, 6948, 278, 1667, 25554, 292, 2425, 9995, 13, 4706, 2425, 29918, 2230, 353, 931, 29889, 546, 29888, 29918, 11808, 580, 13, 4706, 2425, 29918, 2962, 353, 2425, 29918, 2230, 13, 4706, 1583, 29889, 1792, 29918, 524, 332, 6685, 353, 7700, 13, 13, 4706, 9687, 29918, 1745, 2708, 353, 1583, 29889, 1181, 397, 29918, 1745, 2708, 334, 29871, 29953, 29900, 565, 1583, 29889, 1509, 29918, 1181, 397, 1683, 6213, 13, 4706, 3104, 29918, 1745, 2708, 353, 1583, 29889, 17765, 29918, 1745, 2708, 334, 29871, 29953, 29900, 565, 1583, 29889, 1509, 29918, 17765, 1683, 6213, 13, 4706, 11086, 29918, 1181, 397, 29892, 11086, 29918, 17765, 353, 7700, 29892, 7700, 13, 13, 4706, 11758, 29918, 2230, 353, 29871, 29900, 13, 4706, 363, 11758, 297, 1583, 29889, 8628, 1883, 29901, 13, 9651, 11758, 29918, 2230, 4619, 11758, 29961, 29896, 29962, 13, 13, 4706, 1550, 1583, 29889, 1792, 29918, 524, 332, 6685, 338, 7700, 29901, 13, 9651, 396, 4241, 2425, 261, 13, 9651, 5665, 353, 5159, 13, 9651, 5665, 4619, 1583, 29889, 8628, 1883, 29871, 396, 3462, 25554, 292, 5825, 1883, 304, 5665, 13, 9651, 5665, 4619, 1583, 29889, 3044, 29918, 355, 29918, 17293, 13, 9651, 3740, 29918, 726, 353, 285, 29908, 29907, 4154, 1353, 426, 1311, 29889, 17293, 29918, 2798, 29913, 2023, 29905, 29876, 29908, 13, 13, 9651, 396, 317, 1691, 9687, 5335, 414, 13, 9651, 396, 960, 9687, 470, 282, 1862, 817, 304, 367, 11086, 287, 29892, 437, 577, 29892, 1683, 1369, 2446, 25554, 13, 9651, 565, 1583, 29889, 1509, 29918, 1181, 397, 29901, 13, 18884, 9687, 29918, 1745, 2708, 22361, 313, 2230, 29889, 546, 29888, 29918, 11808, 580, 448, 2425, 29918, 2230, 29897, 13, 18884, 11086, 29918, 1181, 397, 353, 9687, 29918, 1745, 2708, 448, 313, 25254, 29918, 2230, 718, 29871, 29896, 29945, 29897, 529, 29871, 29953, 29900, 13, 18884, 3740, 29918, 726, 4619, 285, 29915, 29943, 2092, 29901, 3695, 29912, 1181, 397, 29918, 1745, 2708, 847, 29871, 29953, 29900, 29901, 29900, 29889, 29906, 29888, 29913, 1375, 9242, 29915, 13, 18884, 3740, 29918, 726, 4619, 13420, 2143, 690, 2790, 1156, 25554, 29915, 565, 11086, 29918, 1181, 397, 1683, 6629, 13, 18884, 3740, 29918, 726, 4619, 11297, 29876, 29915, 13, 9651, 565, 1583, 29889, 1509, 29918, 17765, 29901, 13, 18884, 3104, 29918, 1745, 2708, 22361, 313, 2230, 29889, 546, 29888, 29918, 11808, 580, 448, 2425, 29918, 2230, 29897, 13, 18884, 11086, 29918, 17765, 353, 3104, 29918, 1745, 2708, 448, 313, 25254, 29918, 2230, 718, 29871, 29896, 29945, 29897, 529, 29871, 29953, 29900, 13, 18884, 3740, 29918, 726, 4619, 285, 29915, 29925, 327, 29901, 3695, 29912, 17765, 29918, 1745, 2708, 847, 29871, 29953, 29900, 29901, 29900, 29889, 29906, 29888, 29913, 1375, 9242, 29915, 13, 18884, 3740, 29918, 726, 4619, 13420, 2143, 690, 2790, 1156, 25554, 29915, 565, 11086, 29918, 17765, 1683, 6629, 13, 18884, 3740, 29918, 726, 4619, 11297, 29876, 29915, 13, 632, 13, 9651, 565, 11086, 29918, 1181, 397, 470, 11086, 29918, 17765, 29901, 13, 18884, 5665, 4619, 1583, 29889, 3044, 29918, 13322, 29918, 17293, 13, 18884, 565, 11086, 29918, 1181, 397, 29901, 13, 462, 1678, 5665, 4619, 1583, 29889, 3044, 29918, 1181, 397, 13, 462, 1678, 9687, 29918, 1745, 2708, 353, 1583, 29889, 1181, 397, 29918, 20404, 334, 29871, 29953, 29900, 718, 11758, 29918, 2230, 13, 18884, 565, 11086, 29918, 17765, 29901, 13, 462, 1678, 5665, 4619, 1583, 29889, 3044, 29918, 17765, 13, 462, 1678, 3104, 29918, 1745, 2708, 353, 1583, 29889, 17765, 29918, 20404, 334, 29871, 29953, 29900, 718, 11758, 29918, 2230, 13, 18884, 5665, 4619, 1583, 29889, 3044, 29918, 5060, 442, 29918, 17293, 13, 9651, 1683, 29901, 13, 18884, 5665, 4619, 1583, 29889, 3044, 29918, 463, 29918, 17293, 13, 13, 9651, 2425, 29918, 2230, 353, 931, 29889, 546, 29888, 29918, 11808, 580, 13, 9651, 1583, 29889, 3120, 29918, 5504, 29898, 3120, 29918, 726, 29897, 13, 9651, 1583, 29889, 3389, 29918, 16506, 29898, 16506, 29897, 13, 13, 13, 9651, 1583, 29889, 7827, 29918, 2230, 353, 931, 29889, 546, 29888, 29918, 11808, 580, 448, 2425, 29918, 2962, 13, 9651, 565, 1583, 29889, 1792, 29918, 524, 332, 6685, 338, 7700, 29901, 29871, 13, 18884, 1583, 29889, 17293, 29918, 2798, 4619, 29871, 29896, 13, 18884, 1583, 29889, 1181, 397, 29918, 3880, 4619, 29871, 29896, 565, 11086, 29918, 1181, 397, 1683, 29871, 29900, 13, 18884, 1583, 29889, 29886, 1862, 29918, 3880, 4619, 29871, 29896, 565, 11086, 29918, 17765, 1683, 29871, 29900, 13, 9651, 565, 1583, 29889, 1792, 29918, 524, 332, 6685, 338, 5852, 29901, 13, 18884, 286, 1144, 353, 938, 29898, 1311, 29889, 7827, 29918, 2230, 847, 29871, 29953, 29900, 29897, 13, 18884, 409, 2395, 353, 938, 29898, 1311, 29889, 7827, 29918, 2230, 448, 313, 29885, 1144, 334, 29871, 29953, 29900, 876, 13, 18884, 3740, 29918, 726, 353, 285, 29908, 29912, 1311, 29889, 17293, 29918, 2798, 29913, 25554, 29879, 4866, 376, 13, 18884, 3740, 29918, 726, 4619, 285, 29908, 262, 426, 29885, 1144, 6177, 29912, 344, 2395, 29901, 29900, 29906, 29881, 29913, 6233, 29905, 29876, 29908, 13, 18884, 565, 1583, 29889, 1509, 29918, 1181, 397, 29901, 13, 462, 1678, 3740, 29918, 726, 4619, 285, 29908, 29912, 1311, 29889, 1181, 397, 29918, 3880, 29913, 9687, 11233, 287, 29905, 29876, 29908, 13, 18884, 565, 1583, 29889, 1509, 29918, 17765, 29901, 13, 462, 1678, 3740, 29918, 726, 4619, 285, 29908, 29912, 1311, 29889, 29886, 1862, 29918, 3880, 29913, 282, 1862, 11233, 287, 29905, 29876, 29908, 13, 18884, 1583, 29889, 3120, 29918, 5504, 29898, 3120, 29918, 726, 29897, 13, 13, 13, 13, 1678, 822, 1065, 29918, 16506, 29898, 1311, 29892, 5665, 1125, 13, 4706, 9995, 390, 6948, 278, 5665, 29892, 4944, 297, 263, 1051, 297, 278, 883, 313, 8711, 1989, 29892, 12237, 5513, 15945, 13, 4706, 363, 7375, 1989, 29892, 4480, 297, 5665, 29901, 13, 9651, 1596, 29898, 29888, 29915, 12296, 426, 8711, 1989, 29913, 411, 9055, 426, 10685, 29913, 29879, 1495, 13, 9651, 1583, 29889, 2154, 29889, 7978, 29898, 8711, 1989, 29897, 13, 9651, 363, 474, 297, 3464, 29898, 10685, 1125, 13, 18884, 931, 29889, 17059, 29898, 29896, 29897, 13, 18884, 565, 1583, 29889, 1792, 29918, 524, 332, 6685, 338, 5852, 29901, 29871, 13, 462, 1678, 2867, 13, 9651, 565, 1583, 29889, 1792, 29918, 524, 332, 6685, 338, 5852, 29901, 29871, 13, 18884, 2867, 13, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1596, 877, 4763, 292, 1243, 1495, 13, 1678, 319, 29950, 29968, 353, 319, 29950, 29968, 3260, 703, 29907, 22298, 9283, 12745, 1966, 12300, 28917, 1989, 1966, 12300, 28917, 1989, 29889, 8097, 1159, 13, 1678, 1243, 261, 353, 14279, 906, 29898, 29909, 29950, 29968, 29897, 13, 1678, 1243, 261, 29889, 2962, 29898, 13, 4706, 5825, 1883, 11759, 703, 29912, 29896, 17671, 29871, 29941, 511, 4852, 29912, 29906, 17671, 29871, 29941, 511, 4852, 29912, 29941, 17671, 29871, 29941, 29897, 1402, 29871, 13, 4706, 9687, 29922, 8516, 29892, 29871, 13, 4706, 3104, 29922, 8516, 29892, 29871, 13, 4706, 9659, 2433, 29912, 29907, 29913, 742, 29871, 13, 4706, 3474, 2433, 29912, 29956, 29913, 742, 29871, 13, 4706, 6055, 7607, 8824, 29892, 7700, 29892, 7700, 29897, 13, 1678, 1723, 13, 13, 15945, 29908, 10318, 599, 1820, 5355, 29879, 25106, 29871, 13, 8628, 1883, 29901, 1051, 310, 18761, 313, 8711, 1989, 29901, 851, 29892, 12237, 29901, 938, 29897, 13, 1181, 397, 29901, 18761, 313, 8711, 1989, 29901, 851, 29892, 9886, 29901, 938, 29892, 12237, 29901, 938, 29897, 13, 17765, 29901, 18761, 313, 8711, 1989, 29901, 851, 29892, 9886, 29901, 938, 29897, 13, 26897, 29901, 851, 411, 7375, 1989, 539, 13, 7165, 29901, 851, 411, 25554, 292, 3474, 7375, 1989, 259, 13, 11027, 29901, 12603, 552, 310, 2211, 8922, 1819, 29901, 13, 1678, 313, 1509, 29918, 1181, 397, 29892, 671, 29918, 17765, 29892, 671, 29918, 15914, 29897, 13, 15945, 29908, 2 ]
sources/trmm/arcpy_trmm_custom_raster.py
SERVIR/ReferenceNode_ETL
0
118334
# Developer: SpatialDev # Company: Spatial Development International # standard library import os import sys from datetime import datetime, timedelta # third-party from arcpy.sa import * import arcpy class TRMMCustomRasterRequest: """ encapsulates a request to the TRMMCustomRasterCreator to create a custom raster from the TRMM raster catalog. request_options <dict>: contains the following additional options: factory_specifications <dict>: options for the output raster 'output_raster_fullpath' <str>: the fullpath and name of the output raster 'clip_extent' <str>: the processing extent contained within "-180.0 -50.0 180.0 50.0" and given in the same format "xMin yMin xMax yMax" 'clip_raster' <arcpy.Raster>: the fullpath to a raster to be used in clipping the TRMM output raster using arcpy.Clip_management 'CopyRaster_management_config' <dict>: config for arcpy.CopyRaster_Management 'AddColormap_management_config' <dict>: config for arcpy.AddColormap_management input_raster_catalog_options <dict>: options for the input raster catalog 'raster_catalog_fullpath' <str>: fullpath to the source raster catalog "raster_name_field" <str>: the field in the raster catalog that contains the names of the rasters "datetime_field" <str>: the field in the raster catalog that contains the datetime for the rasters 'datetime_sql_cast' <str>: the DATETIME cast expression based on the underlying SQL type ex: "date" 'datetime_field_format' <str>: the format of the given datetime_field. ex: '%m-%d-%Y %I:%M:%S %p', 'start_datetime' <str>: the start datetime given in the format %Y%m%d%H with 'h' being a 24-hour. ex: "2012-02-29 at 3PM == 201202291500" 'end_datetime' <str>: the end datetime given in the format %Y%m%d%H with 'h' being a 24-hour. ex: "2012-02-29 at 3PM == 201202291500" """ def __init__(self, request_options): self.factory_specifications = request_options['factory_specifications'] self.input_raster_catalog_options = request_options['input_raster_catalog_options'] self.debug_logger = request_options.get('debug_logger',lambda*a,**kwa:None) self.exception_handler = request_options.get('exception_handler',lambda*a,**kwa:None) def getFactorySpecifications(self): return self.factory_specifications def getRasterCatalogFullpath(self): return self.input_raster_catalog_options['raster_catalog_fullpath'] def extractRastersToWorkspace(self, path_to_extract_into): try: rasters_to_extract_list = self._getListOfRasterNamesFromRasterCatalog() extracted_rasters_list = self._extractRastersFromRasterCatalog(rasters_to_extract_list, path_to_extract_into) return extracted_rasters_list except Exception as e: self.debug_logger("==================== EXCEPTION (extractRastersToWorkspace) ====================") self.debug_logger(str(e), str(arcpy.GetMessages(2))) self.exception_handler(dict(exception=str(e), messages=str(arcpy.GetMessages(2)))) def _getListOfRasterNamesFromRasterCatalog(self, additional_where_clause=""): self.debug_logger("_getListOfRasterNamesFromRasterCatalog()") raster_name_field = self.input_raster_catalog_options['raster_name_field'] where_clause = self._createWhereClause() where_clause += self.input_raster_catalog_options.get('additional_where_clause',"") rows = arcpy.SearchCursor(self.input_raster_catalog_options['raster_catalog_fullpath'], where_clause, "", raster_name_field) try: return [str(row.getValue(raster_name_field)) for row in rows] finally: del rows def _createWhereClause(self): start_datetime = self.input_raster_catalog_options['start_datetime'] end_datetime = self.input_raster_catalog_options['end_datetime'] datetime_field = self.input_raster_catalog_options['datetime_field'] datetime_field_format = self.input_raster_catalog_options['datetime_field_format'] datetime_sql_cast = self.input_raster_catalog_options['datetime_sql_cast'] where_clause = "%s <= %s \'%s\'" % (datetime_field, datetime_sql_cast, start_datetime.strftime(datetime_field_format)) where_clause += " AND %s >= %s \'%s\'" % (datetime_field, datetime_sql_cast, end_datetime.strftime(datetime_field_format)) self.debug_logger("where_clause",where_clause) return where_clause def _extractRastersFromRasterCatalog(self, rasters_to_extract_list, path_to_extract_into): extracted_raster_list = [] joinPath = os.path.join raster_name_field = self.input_raster_catalog_options['raster_name_field'] output_raster_catalog = self.input_raster_catalog_options['raster_catalog_fullpath'] for raster_name in rasters_to_extract_list: extracted_raster_fullpath = joinPath(path_to_extract_into, raster_name) self.debug_logger("processing raster...",raster_name) if arcpy.Exists(extracted_raster_fullpath) and (raster_name not in extracted_raster_list): extracted_raster_list.append(raster_name) else: where_clause = "%s = \'%s\'" % (raster_name_field, str(raster_name)) arcpy.RasterCatalogToRasterDataset_management(output_raster_catalog, raster_name, where_clause) extracted_raster_list.append(raster_name) return extracted_raster_list class TRMMCustomRasterCreator: """creates a custom raster from a given TRMMCustomRasterRequest object. raster_creator_options <dict>: config options for the TRMM raster creator. 'workspace_fullpath' <str>: output workspace location for the raster creation process 'remove_all_rasters_on_finish' <bool>: cleans up all raster output on finish. 'archive_options' <dict>: local extracted rasters can be kept in the workspace to allow for faster processing in future runs 'raster_name_prefix' <str>: given to differentiate between extracted rasters when deleting ex: "t_" 'local_raster_archive_days' <int>: rasters outside this number will be deleted ex: 90 'raster_name_datetime_format' <str>: to determine if a raster is outside the archive days, each name must be in an easily convertable datetime string format. ex: "t_%Y%m%d%H" 'debug_logger' <object.method>: method that will be passes variable string arguments to display current progress and values 'exception_handler' <object.method>: method that will be variable string arguments with exception information """ def __init__(self, raster_creator_options): self.raster_creator_options = raster_creator_options self.workspace_fullpath = raster_creator_options['workspace_fullpath'] self.custom_raster_requests = [] if not os.path.isdir(self.workspace_fullpath): os.mkdir(self.workspace_fullpath) self.debug_logger = raster_creator_options.get('debug_logger',lambda*a,**kwa:None) self.exception_handler = raster_creator_options.get('exception_handler',lambda*a,**kwa:None) def addCustomRasterReuests(self, custom_raster_requests): self.custom_raster_requests = custom_raster_requests def createCustomRasters(self): self.debug_logger("Starting TRMM Custom Raster Creation Process") try: arcpy.env.extent = arcpy.Extent(-180.0, -50.0, 180.0, 50.0) # max and min extent values a given TRMM raster arcpy.env.workspace = self.workspace_fullpath arcpy.env.overwriteOutput = True arcpy.CheckOutExtension("spatial") for custom_raster in self.custom_raster_requests: self.debug_logger("Processing Raster") factory_specifications = custom_raster.getFactorySpecifications() output_raster_fullpath = factory_specifications['output_raster_fullpath'] raster_catalog_is_not_locked = arcpy.TestSchemaLock(custom_raster.getRasterCatalogFullpath()) extracted_raster_list = custom_raster.extractRastersToWorkspace(self.workspace_fullpath) self.debug_logger("Len(extracted_raster_list)", len(extracted_raster_list)) if extracted_raster_list and raster_catalog_is_not_locked: final_raster = self._createCumulativeRaster(extracted_raster_list, factory_specifications) self._saveRaster(final_raster, output_raster_fullpath, factory_specifications) self._finishCustomRasterManagment() self.debug_logger("Finished TRMM Custom Raster Creation Process") except Exception as e: self.debug_logger("==================== EXCEPTION (createCustomRasters) ====================") self.debug_logger(str(e), str(arcpy.GetMessages(2))) self.exception_handler(dict(exception=str(e), messages=str(arcpy.GetMessages(2)))) finally: arcpy.CheckInExtension("spatial") self.debug_logger("checked IN spatial extension") def _createCumulativeRaster(self, rasters_list, factory_specifications): self.debug_logger("Creating Cumulative Raster...") final_raster = sum([Con(IsNull(raster), 0, raster) for raster in rasters_list]) # for each raster in the list, set all NULL to 0 then SUM final_raster = Float(final_raster) final_raster = final_raster * 3 # multiply by 3 since each TRMM raster 3-hour period is an average not a sum if factory_specifications.get('clip_extent', None): self.debug_logger("Adding Clip Extent...") output_clip_raster = os.path.join(os.path.join(sys.path[0], "scratch.gdb"),"temp_clip") final_raster = arcpy.Clip_management(final_raster, factory_specifications['clip_extent'], output_clip_raster) elif factory_specifications.get('clip_raster', None): self.debug_logger("Adding Clip Raster...") final_raster = final_raster * Raster(factory_specifications['clip_raster']) final_raster = SetNull(final_raster == 0, final_raster) # set 0's back to NULL after all mathematical operations are peformed self.debug_logger("SetNull(final_raster == 0, final_raster)") return final_raster def _saveRaster(self, raster_to_save, output_raster_fullpath, factory_specifications): self.debug_logger("Saving Final Raster") if factory_specifications.get('AddColormap_management_config', None): self.debug_logger("Adding Color Map...") color_map_config = factory_specifications['AddColormap_management_config'] r = arcpy.AddColormap_management(raster_to_save, color_map_config.get('in_template_raster',''), color_map_config['input_CLR_file']) self.debug_logger("AddColormap_management Result", r.status) raster_name = os.path.basename(output_raster_fullpath) raster_to_save.save(raster_name) local_raster_fullpath = os.path.join(self.workspace_fullpath, raster_name) self.debug_logger("local_raster_fullpath",local_raster_fullpath) self.debug_logger("output_raster_fullpath",output_raster_fullpath) self._removeExistingRasterIfExists(output_raster_fullpath) self._copyRaster(factory_specifications['CopyRaster_management_config'], local_raster_fullpath, output_raster_fullpath) self._removeExistingRasterIfExists(local_raster_fullpath) def _copyRaster(self, copy_raster_managment_config, local_raster_fullpath, output_raster_fullpath): self.debug_logger("Copying Raster...", output_raster_fullpath) r = arcpy.CopyRaster_management(local_raster_fullpath, output_raster_fullpath, copy_raster_managment_config.get('config_keyword',''), copy_raster_managment_config.get('background_value',''), copy_raster_managment_config.get('nodata_value',''), copy_raster_managment_config.get('onebit_to_eightbit',''), copy_raster_managment_config.get('colormap_to_RGB',''), copy_raster_managment_config.get('pixel_type','') ) self.debug_logger("CopyRaster_management Result", r.status) def _removeExistingRasterIfExists(self, output_raster_fullpath): if arcpy.Exists(output_raster_fullpath): self.debug_logger("Deleting...", output_raster_fullpath) r = arcpy.Delete_management(output_raster_fullpath) self.debug_logger("Delete_management Result", r.status) def _finishCustomRasterManagment(self): self.debug_logger("Finishing Custom Raster Creation") archive_options = self.raster_creator_options.get('archive_options', None) remove_all_rasters_on_finish = self.raster_creator_options.get('remove_all_rasters_on_finish', False) if archive_options and not remove_all_rasters_on_finish: raster_name_prefix = archive_options.get('raster_name_prefix', None) archive_days = archive_options.get('local_raster_archive_days', None) raster_name_datetime_format = archive_options.get('raster_name_datetime_format', None) if (raster_name_prefix and archive_days and raster_name_datetime_format): archive_date = datetime.utcnow() - timedelta(days=archive_days) local_raster_list = [r for r in arcpy.ListRasters(raster_name_prefix+"*","*") if str(r[:len(raster_name_prefix)]).lower() == str(raster_name_prefix)] list_of_rasters_to_delete = [raster for raster in local_raster_list if datetime.strptime(str(raster), raster_name_datetime_format) < archive_date] self._deleteRasters(list_of_rasters_to_delete) elif remove_all_rasters_on_finish: self.debug_logger("Removing All Rasters In Local Workspace...") self._deleteRasters(arcpy.ListRasters("*")) def _deleteRasters(self, list_of_rasters_to_delete): for r in list_of_rasters_to_delete: arcpy.Delete_management(r)
[ 1, 396, 10682, 261, 29901, 1706, 15238, 16618, 13, 29937, 6938, 29901, 259, 1706, 15238, 14650, 4623, 13, 13, 29937, 3918, 3489, 13, 5215, 2897, 13, 5215, 10876, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 13, 13, 29937, 4654, 29899, 22633, 13, 3166, 15232, 2272, 29889, 4977, 1053, 334, 13, 5215, 15232, 2272, 13, 13, 13, 1990, 10014, 7428, 7281, 29934, 1901, 3089, 29901, 13, 268, 13, 1678, 9995, 2094, 2547, 352, 1078, 263, 2009, 304, 278, 10014, 7428, 7281, 29934, 1901, 9832, 1061, 304, 1653, 263, 2888, 364, 1901, 515, 278, 10014, 7428, 364, 1901, 16653, 29889, 13, 308, 13, 4706, 2009, 29918, 6768, 529, 8977, 23917, 3743, 278, 1494, 5684, 3987, 29901, 13, 632, 13, 9651, 12529, 29918, 6550, 8232, 529, 8977, 23917, 3987, 363, 278, 1962, 364, 1901, 13, 462, 3986, 13, 18884, 525, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 29915, 529, 710, 23917, 278, 2989, 2084, 322, 1024, 310, 278, 1962, 364, 1901, 13, 18884, 525, 24049, 29918, 1062, 296, 29915, 529, 710, 23917, 278, 9068, 15834, 11122, 2629, 11663, 29896, 29947, 29900, 29889, 29900, 448, 29945, 29900, 29889, 29900, 29871, 29896, 29947, 29900, 29889, 29900, 29871, 29945, 29900, 29889, 29900, 29908, 322, 2183, 297, 278, 1021, 3402, 376, 29916, 8140, 343, 8140, 921, 7976, 343, 7976, 29908, 13, 18884, 525, 24049, 29918, 29878, 1901, 29915, 529, 5666, 2272, 29889, 29934, 1901, 23917, 278, 2989, 2084, 304, 263, 364, 1901, 304, 367, 1304, 297, 9335, 3262, 278, 10014, 7428, 1962, 364, 1901, 773, 15232, 2272, 29889, 29907, 3466, 29918, 21895, 13, 18884, 525, 11882, 29934, 1901, 29918, 21895, 29918, 2917, 29915, 529, 8977, 23917, 2295, 363, 15232, 2272, 29889, 11882, 29934, 1901, 29918, 27107, 13, 18884, 525, 2528, 1625, 555, 481, 29918, 21895, 29918, 2917, 29915, 529, 8977, 23917, 2295, 363, 15232, 2272, 29889, 2528, 1625, 555, 481, 29918, 21895, 13, 462, 13, 9651, 1881, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 529, 8977, 23917, 3987, 363, 278, 1881, 364, 1901, 16653, 13, 632, 13, 18884, 525, 29878, 1901, 29918, 28045, 29918, 8159, 2084, 29915, 529, 710, 23917, 2989, 2084, 304, 278, 2752, 364, 1901, 16653, 13, 18884, 376, 29878, 1901, 29918, 978, 29918, 2671, 29908, 529, 710, 23917, 278, 1746, 297, 278, 364, 1901, 16653, 393, 3743, 278, 2983, 310, 278, 364, 1901, 29879, 13, 18884, 376, 12673, 29918, 2671, 29908, 529, 710, 23917, 278, 1746, 297, 278, 364, 1901, 16653, 393, 3743, 278, 12865, 363, 278, 364, 1901, 29879, 13, 18884, 525, 12673, 29918, 2850, 29918, 4384, 29915, 529, 710, 23917, 278, 27640, 2544, 8890, 4320, 4603, 2729, 373, 278, 14407, 3758, 1134, 429, 29901, 376, 1256, 29908, 13, 18884, 525, 12673, 29918, 2671, 29918, 4830, 29915, 529, 710, 23917, 278, 3402, 310, 278, 2183, 12865, 29918, 2671, 29889, 429, 29901, 14210, 29885, 19222, 29881, 19222, 29979, 1273, 29902, 16664, 29924, 16664, 29903, 1273, 29886, 742, 13, 18884, 525, 2962, 29918, 12673, 29915, 529, 710, 23917, 278, 1369, 12865, 2183, 297, 278, 3402, 1273, 29979, 29995, 29885, 29995, 29881, 29995, 29950, 411, 525, 29882, 29915, 1641, 263, 29871, 29906, 29946, 29899, 18721, 29889, 429, 29901, 376, 29906, 29900, 29896, 29906, 29899, 29900, 29906, 29899, 29906, 29929, 472, 29871, 29941, 13427, 1275, 29871, 29906, 29900, 29896, 29906, 29900, 29906, 29906, 29929, 29896, 29945, 29900, 29900, 29908, 13, 18884, 525, 355, 29918, 12673, 29915, 529, 710, 23917, 278, 1095, 12865, 2183, 297, 278, 3402, 1273, 29979, 29995, 29885, 29995, 29881, 29995, 29950, 411, 525, 29882, 29915, 1641, 263, 29871, 29906, 29946, 29899, 18721, 29889, 429, 29901, 376, 29906, 29900, 29896, 29906, 29899, 29900, 29906, 29899, 29906, 29929, 472, 29871, 29941, 13427, 1275, 29871, 29906, 29900, 29896, 29906, 29900, 29906, 29906, 29929, 29896, 29945, 29900, 29900, 29908, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2009, 29918, 6768, 1125, 13, 308, 13, 4706, 1583, 29889, 14399, 29918, 6550, 8232, 353, 2009, 29918, 6768, 1839, 14399, 29918, 6550, 8232, 2033, 4706, 13, 4706, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 353, 2009, 29918, 6768, 1839, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 2033, 13, 4706, 1583, 29889, 8382, 29918, 21707, 353, 2009, 29918, 6768, 29889, 657, 877, 8382, 29918, 21707, 742, 2892, 29930, 29874, 29892, 1068, 29895, 2766, 29901, 8516, 29897, 13, 4706, 1583, 29889, 11739, 29918, 13789, 353, 2009, 29918, 6768, 29889, 657, 877, 11739, 29918, 13789, 742, 2892, 29930, 29874, 29892, 1068, 29895, 2766, 29901, 8516, 29897, 13, 308, 13, 1678, 822, 679, 5126, 10299, 8232, 29898, 1311, 1125, 13, 308, 13, 4706, 736, 1583, 29889, 14399, 29918, 6550, 8232, 13, 268, 13, 1678, 822, 679, 29934, 1901, 29907, 3968, 13658, 2084, 29898, 1311, 1125, 13, 308, 13, 4706, 736, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 29878, 1901, 29918, 28045, 29918, 8159, 2084, 2033, 13, 308, 13, 1678, 822, 6597, 29934, 1901, 29879, 1762, 5531, 3493, 29898, 1311, 29892, 2224, 29918, 517, 29918, 21111, 29918, 8941, 1125, 13, 308, 13, 4706, 1018, 29901, 13, 308, 13, 9651, 364, 1901, 29879, 29918, 517, 29918, 21111, 29918, 1761, 353, 1583, 3032, 657, 1293, 2776, 29934, 1901, 8659, 4591, 29934, 1901, 29907, 3968, 580, 13, 9651, 23892, 29918, 29878, 1901, 29879, 29918, 1761, 353, 1583, 3032, 21111, 29934, 1901, 29879, 4591, 29934, 1901, 29907, 3968, 29898, 29878, 1901, 29879, 29918, 517, 29918, 21111, 29918, 1761, 29892, 2224, 29918, 517, 29918, 21111, 29918, 8941, 29897, 13, 268, 13, 9651, 736, 23892, 29918, 29878, 1901, 29879, 29918, 1761, 13, 268, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 9166, 2751, 8528, 4741, 7982, 2725, 313, 21111, 29934, 1901, 29879, 1762, 5531, 3493, 29897, 1275, 9166, 26359, 29897, 13, 9651, 1583, 29889, 8382, 29918, 21707, 29898, 710, 29898, 29872, 511, 851, 29898, 5666, 2272, 29889, 2577, 25510, 29898, 29906, 4961, 13, 9651, 1583, 29889, 11739, 29918, 13789, 29898, 8977, 29898, 11739, 29922, 710, 29898, 29872, 511, 7191, 29922, 710, 29898, 5666, 2272, 29889, 2577, 25510, 29898, 29906, 13697, 13, 308, 13, 1678, 822, 903, 657, 1293, 2776, 29934, 1901, 8659, 4591, 29934, 1901, 29907, 3968, 29898, 1311, 29892, 5684, 29918, 3062, 29918, 16398, 1509, 13776, 1125, 13, 308, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 29918, 657, 1293, 2776, 29934, 1901, 8659, 4591, 29934, 1901, 29907, 3968, 580, 1159, 13, 308, 13, 4706, 364, 1901, 29918, 978, 29918, 2671, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 29878, 1901, 29918, 978, 29918, 2671, 2033, 13, 4706, 988, 29918, 16398, 1509, 353, 1583, 3032, 3258, 11921, 20216, 1509, 580, 13, 4706, 988, 29918, 16398, 1509, 4619, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 29889, 657, 877, 1202, 3245, 29918, 3062, 29918, 16398, 1509, 742, 29908, 1159, 13, 13, 4706, 4206, 353, 15232, 2272, 29889, 7974, 19890, 29898, 1311, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 29878, 1901, 29918, 28045, 29918, 8159, 2084, 7464, 988, 29918, 16398, 1509, 29892, 12633, 364, 1901, 29918, 978, 29918, 2671, 29897, 13, 4706, 1018, 29901, 13, 9651, 736, 518, 710, 29898, 798, 29889, 23433, 29898, 29878, 1901, 29918, 978, 29918, 2671, 876, 363, 1948, 297, 4206, 29962, 13, 4706, 7146, 29901, 13, 9651, 628, 4206, 13, 632, 13, 1678, 822, 903, 3258, 11921, 20216, 1509, 29898, 1311, 1125, 13, 308, 13, 4706, 1369, 29918, 12673, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 2962, 29918, 12673, 2033, 13, 4706, 1095, 29918, 12673, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 355, 29918, 12673, 2033, 13, 4706, 12865, 29918, 2671, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 12673, 29918, 2671, 2033, 13, 4706, 12865, 29918, 2671, 29918, 4830, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 12673, 29918, 2671, 29918, 4830, 2033, 13, 4706, 12865, 29918, 2850, 29918, 4384, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 12673, 29918, 2850, 29918, 4384, 2033, 13, 308, 13, 4706, 988, 29918, 16398, 1509, 353, 11860, 29879, 5277, 1273, 29879, 320, 29915, 29995, 29879, 29905, 11838, 1273, 313, 12673, 29918, 2671, 29892, 12865, 29918, 2850, 29918, 4384, 29892, 1369, 29918, 12673, 29889, 710, 615, 603, 29898, 12673, 29918, 2671, 29918, 4830, 876, 13, 4706, 988, 29918, 16398, 1509, 4619, 376, 5300, 1273, 29879, 6736, 1273, 29879, 320, 29915, 29995, 29879, 29905, 11838, 1273, 313, 12673, 29918, 2671, 29892, 12865, 29918, 2850, 29918, 4384, 29892, 1095, 29918, 12673, 29889, 710, 615, 603, 29898, 12673, 29918, 2671, 29918, 4830, 876, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 3062, 29918, 16398, 1509, 613, 3062, 29918, 16398, 1509, 29897, 13, 308, 13, 4706, 736, 988, 29918, 16398, 1509, 13, 632, 13, 1678, 822, 903, 21111, 29934, 1901, 29879, 4591, 29934, 1901, 29907, 3968, 29898, 1311, 29892, 364, 1901, 29879, 29918, 517, 29918, 21111, 29918, 1761, 29892, 2224, 29918, 517, 29918, 21111, 29918, 8941, 1125, 13, 13, 4706, 23892, 29918, 29878, 1901, 29918, 1761, 353, 5159, 13, 4706, 5988, 2605, 353, 2897, 29889, 2084, 29889, 7122, 13, 4706, 364, 1901, 29918, 978, 29918, 2671, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 29878, 1901, 29918, 978, 29918, 2671, 2033, 13, 4706, 1962, 29918, 29878, 1901, 29918, 28045, 353, 1583, 29889, 2080, 29918, 29878, 1901, 29918, 28045, 29918, 6768, 1839, 29878, 1901, 29918, 28045, 29918, 8159, 2084, 2033, 13, 308, 13, 4706, 363, 364, 1901, 29918, 978, 297, 364, 1901, 29879, 29918, 517, 29918, 21111, 29918, 1761, 29901, 13, 632, 13, 9651, 23892, 29918, 29878, 1901, 29918, 8159, 2084, 353, 5988, 2605, 29898, 2084, 29918, 517, 29918, 21111, 29918, 8941, 29892, 364, 1901, 29918, 978, 29897, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 19170, 364, 1901, 856, 613, 29878, 1901, 29918, 978, 29897, 13, 632, 13, 9651, 565, 15232, 2272, 29889, 24217, 29898, 21111, 287, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 322, 313, 29878, 1901, 29918, 978, 451, 297, 23892, 29918, 29878, 1901, 29918, 1761, 1125, 13, 18884, 23892, 29918, 29878, 1901, 29918, 1761, 29889, 4397, 29898, 29878, 1901, 29918, 978, 29897, 13, 462, 4706, 13, 9651, 1683, 29901, 13, 18884, 988, 29918, 16398, 1509, 353, 11860, 29879, 353, 320, 29915, 29995, 29879, 29905, 11838, 1273, 313, 29878, 1901, 29918, 978, 29918, 2671, 29892, 851, 29898, 29878, 1901, 29918, 978, 876, 13, 18884, 15232, 2272, 29889, 29934, 1901, 29907, 3968, 1762, 29934, 1901, 16390, 24541, 29918, 21895, 29898, 4905, 29918, 29878, 1901, 29918, 28045, 29892, 364, 1901, 29918, 978, 29892, 988, 29918, 16398, 1509, 29897, 13, 18884, 23892, 29918, 29878, 1901, 29918, 1761, 29889, 4397, 29898, 29878, 1901, 29918, 978, 29897, 13, 462, 13, 4706, 736, 23892, 29918, 29878, 1901, 29918, 1761, 13, 13, 13, 1990, 10014, 7428, 7281, 29934, 1901, 9832, 1061, 29901, 13, 268, 13, 1678, 9995, 1037, 1078, 263, 2888, 364, 1901, 515, 263, 2183, 10014, 7428, 7281, 29934, 1901, 3089, 1203, 29889, 13, 268, 13, 4706, 364, 1901, 29918, 1037, 1061, 29918, 6768, 529, 8977, 23917, 2295, 3987, 363, 278, 10014, 7428, 364, 1901, 907, 1061, 29889, 13, 268, 13, 9651, 525, 1287, 3493, 29918, 8159, 2084, 29915, 529, 710, 23917, 1962, 664, 3493, 4423, 363, 278, 364, 1901, 11265, 1889, 462, 462, 795, 13, 9651, 525, 5992, 29918, 497, 29918, 29878, 1901, 29879, 29918, 265, 29918, 4951, 728, 29915, 529, 11227, 23917, 4531, 550, 701, 599, 364, 1901, 1962, 373, 8341, 29889, 13, 308, 13, 9651, 525, 10867, 29918, 6768, 29915, 529, 8977, 23917, 1887, 23892, 364, 1901, 29879, 508, 367, 8126, 297, 278, 664, 3493, 304, 2758, 363, 8473, 9068, 297, 5434, 6057, 13, 632, 13, 18884, 525, 29878, 1901, 29918, 978, 29918, 13506, 29915, 529, 710, 23917, 2183, 304, 17473, 403, 1546, 23892, 364, 1901, 29879, 746, 21228, 429, 29901, 376, 29873, 27508, 13, 18884, 525, 2997, 29918, 29878, 1901, 29918, 10867, 29918, 16700, 29915, 529, 524, 23917, 364, 1901, 29879, 5377, 445, 1353, 674, 367, 11132, 429, 29901, 29871, 29929, 29900, 13, 18884, 525, 29878, 1901, 29918, 978, 29918, 12673, 29918, 4830, 29915, 529, 710, 23917, 304, 8161, 565, 263, 364, 1901, 338, 5377, 278, 18871, 3841, 29892, 29871, 13, 462, 1269, 1024, 1818, 367, 297, 385, 5948, 3588, 519, 12865, 1347, 3402, 29889, 429, 29901, 376, 29873, 29918, 29995, 29979, 29995, 29885, 29995, 29881, 29995, 29950, 29908, 13, 268, 13, 9651, 525, 8382, 29918, 21707, 29915, 529, 3318, 29889, 5696, 23917, 1158, 393, 674, 367, 14517, 2286, 1347, 6273, 304, 2479, 1857, 6728, 322, 1819, 13, 9651, 525, 11739, 29918, 13789, 29915, 529, 3318, 29889, 5696, 23917, 1158, 393, 674, 367, 2286, 1347, 6273, 411, 3682, 2472, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29871, 364, 1901, 29918, 1037, 1061, 29918, 6768, 1125, 13, 308, 13, 4706, 1583, 29889, 29878, 1901, 29918, 1037, 1061, 29918, 6768, 353, 364, 1901, 29918, 1037, 1061, 29918, 6768, 13, 4706, 1583, 29889, 1287, 3493, 29918, 8159, 2084, 353, 364, 1901, 29918, 1037, 1061, 29918, 6768, 1839, 1287, 3493, 29918, 8159, 2084, 2033, 13, 4706, 1583, 29889, 6341, 29918, 29878, 1901, 29918, 24830, 353, 5159, 13, 308, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 1311, 29889, 1287, 3493, 29918, 8159, 2084, 1125, 13, 9651, 2897, 29889, 11256, 3972, 29898, 1311, 29889, 1287, 3493, 29918, 8159, 2084, 29897, 13, 632, 13, 4706, 1583, 29889, 8382, 29918, 21707, 353, 364, 1901, 29918, 1037, 1061, 29918, 6768, 29889, 657, 877, 8382, 29918, 21707, 742, 2892, 29930, 29874, 29892, 1068, 29895, 2766, 29901, 8516, 29897, 13, 4706, 1583, 29889, 11739, 29918, 13789, 353, 364, 1901, 29918, 1037, 1061, 29918, 6768, 29889, 657, 877, 11739, 29918, 13789, 742, 2892, 29930, 29874, 29892, 1068, 29895, 2766, 29901, 8516, 29897, 13, 308, 13, 1678, 822, 788, 7281, 29934, 1901, 1123, 29884, 9197, 29898, 1311, 29892, 2888, 29918, 29878, 1901, 29918, 24830, 1125, 13, 308, 13, 4706, 1583, 29889, 6341, 29918, 29878, 1901, 29918, 24830, 353, 2888, 29918, 29878, 1901, 29918, 24830, 13, 308, 13, 1678, 822, 1653, 7281, 29934, 1901, 29879, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 4763, 292, 10014, 7428, 8701, 390, 1901, 6760, 362, 10554, 1159, 13, 13, 4706, 1018, 29901, 13, 9651, 15232, 2272, 29889, 6272, 29889, 1062, 296, 353, 15232, 2272, 29889, 5647, 296, 6278, 29896, 29947, 29900, 29889, 29900, 29892, 448, 29945, 29900, 29889, 29900, 29892, 29871, 29896, 29947, 29900, 29889, 29900, 29892, 29871, 29945, 29900, 29889, 29900, 29897, 396, 4236, 322, 1375, 15834, 1819, 263, 2183, 10014, 7428, 364, 1901, 13, 9651, 15232, 2272, 29889, 6272, 29889, 1287, 3493, 353, 1583, 29889, 1287, 3493, 29918, 8159, 2084, 13, 9651, 15232, 2272, 29889, 6272, 29889, 957, 3539, 6466, 353, 5852, 13, 9651, 15232, 2272, 29889, 5596, 3744, 17657, 703, 1028, 15238, 1159, 13, 13, 9651, 363, 2888, 29918, 29878, 1901, 297, 1583, 29889, 6341, 29918, 29878, 1901, 29918, 24830, 29901, 13, 18884, 1583, 29889, 8382, 29918, 21707, 703, 7032, 292, 390, 1901, 1159, 13, 462, 13, 18884, 12529, 29918, 6550, 8232, 353, 2888, 29918, 29878, 1901, 29889, 657, 5126, 10299, 8232, 580, 13, 18884, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 353, 12529, 29918, 6550, 8232, 1839, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 2033, 13, 18884, 364, 1901, 29918, 28045, 29918, 275, 29918, 1333, 29918, 29113, 353, 15232, 2272, 29889, 3057, 12763, 16542, 29898, 6341, 29918, 29878, 1901, 29889, 657, 29934, 1901, 29907, 3968, 13658, 2084, 3101, 13, 462, 13, 18884, 23892, 29918, 29878, 1901, 29918, 1761, 353, 2888, 29918, 29878, 1901, 29889, 21111, 29934, 1901, 29879, 1762, 5531, 3493, 29898, 1311, 29889, 1287, 3493, 29918, 8159, 2084, 29897, 13, 18884, 1583, 29889, 8382, 29918, 21707, 703, 21515, 29898, 21111, 287, 29918, 29878, 1901, 29918, 1761, 19123, 7431, 29898, 21111, 287, 29918, 29878, 1901, 29918, 1761, 876, 13, 13, 18884, 565, 23892, 29918, 29878, 1901, 29918, 1761, 322, 364, 1901, 29918, 28045, 29918, 275, 29918, 1333, 29918, 29113, 29901, 13, 13, 462, 1678, 2186, 29918, 29878, 1901, 353, 1583, 3032, 3258, 29907, 398, 28524, 29934, 1901, 29898, 21111, 287, 29918, 29878, 1901, 29918, 1761, 29892, 12529, 29918, 6550, 8232, 29897, 13, 462, 1678, 1583, 3032, 7620, 29934, 1901, 29898, 8394, 29918, 29878, 1901, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 12529, 29918, 6550, 8232, 29897, 13, 13, 9651, 1583, 3032, 4951, 728, 7281, 29934, 1901, 2517, 351, 358, 580, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 12881, 3276, 10014, 7428, 8701, 390, 1901, 6760, 362, 10554, 1159, 13, 308, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 9166, 2751, 8528, 4741, 7982, 2725, 313, 3258, 7281, 29934, 1901, 29879, 29897, 1275, 9166, 26359, 29897, 13, 9651, 1583, 29889, 8382, 29918, 21707, 29898, 710, 29898, 29872, 511, 851, 29898, 5666, 2272, 29889, 2577, 25510, 29898, 29906, 4961, 13, 9651, 1583, 29889, 11739, 29918, 13789, 29898, 8977, 29898, 11739, 29922, 710, 29898, 29872, 511, 7191, 29922, 710, 29898, 5666, 2272, 29889, 2577, 25510, 29898, 29906, 13697, 13, 632, 13, 4706, 7146, 29901, 13, 9651, 15232, 2272, 29889, 5596, 797, 17657, 703, 1028, 15238, 1159, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 11238, 2672, 18652, 6081, 1159, 13, 13, 1678, 822, 903, 3258, 29907, 398, 28524, 29934, 1901, 29898, 1311, 29892, 364, 1901, 29879, 29918, 1761, 29892, 12529, 29918, 6550, 8232, 1125, 13, 308, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 9832, 1218, 315, 398, 28524, 390, 1901, 856, 1159, 13, 4706, 2186, 29918, 29878, 1901, 353, 2533, 4197, 1168, 29898, 3624, 7327, 29898, 29878, 1901, 511, 29871, 29900, 29892, 364, 1901, 29897, 363, 364, 1901, 297, 364, 1901, 29879, 29918, 1761, 2314, 396, 363, 1269, 364, 1901, 297, 278, 1051, 29892, 731, 599, 4265, 304, 29871, 29900, 769, 22753, 13, 4706, 2186, 29918, 29878, 1901, 353, 27842, 29898, 8394, 29918, 29878, 1901, 29897, 13, 4706, 2186, 29918, 29878, 1901, 353, 2186, 29918, 29878, 1901, 334, 29871, 29941, 396, 22932, 491, 29871, 29941, 1951, 1269, 10014, 7428, 364, 1901, 29871, 29941, 29899, 18721, 3785, 338, 385, 6588, 451, 263, 2533, 13, 308, 13, 4706, 565, 12529, 29918, 6550, 8232, 29889, 657, 877, 24049, 29918, 1062, 296, 742, 6213, 1125, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 2528, 292, 315, 3466, 7338, 296, 856, 1159, 13, 9651, 1962, 29918, 24049, 29918, 29878, 1901, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 7122, 29898, 9675, 29889, 2084, 29961, 29900, 1402, 376, 10526, 905, 29889, 29887, 2585, 4968, 29908, 7382, 29918, 24049, 1159, 13, 9651, 2186, 29918, 29878, 1901, 353, 15232, 2272, 29889, 29907, 3466, 29918, 21895, 29898, 8394, 29918, 29878, 1901, 29892, 12529, 29918, 6550, 8232, 1839, 24049, 29918, 1062, 296, 7464, 1962, 29918, 24049, 29918, 29878, 1901, 29897, 13, 13, 4706, 25342, 12529, 29918, 6550, 8232, 29889, 657, 877, 24049, 29918, 29878, 1901, 742, 6213, 1125, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 2528, 292, 315, 3466, 390, 1901, 856, 1159, 13, 9651, 2186, 29918, 29878, 1901, 353, 2186, 29918, 29878, 1901, 334, 390, 1901, 29898, 14399, 29918, 6550, 8232, 1839, 24049, 29918, 29878, 1901, 11287, 29871, 13, 308, 13, 4706, 2186, 29918, 29878, 1901, 353, 3789, 7327, 29898, 8394, 29918, 29878, 1901, 1275, 29871, 29900, 29892, 2186, 29918, 29878, 1901, 29897, 396, 731, 29871, 29900, 29915, 29879, 1250, 304, 4265, 1156, 599, 19475, 6931, 526, 1236, 15628, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 2697, 7327, 29898, 8394, 29918, 29878, 1901, 1275, 29871, 29900, 29892, 2186, 29918, 29878, 1901, 25760, 13, 308, 13, 4706, 736, 2186, 29918, 29878, 1901, 13, 308, 13, 1678, 822, 903, 7620, 29934, 1901, 29898, 1311, 29892, 364, 1901, 29918, 517, 29918, 7620, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 12529, 29918, 6550, 8232, 1125, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 29903, 5555, 9550, 390, 1901, 1159, 13, 13, 4706, 565, 12529, 29918, 6550, 8232, 29889, 657, 877, 2528, 1625, 555, 481, 29918, 21895, 29918, 2917, 742, 6213, 1125, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 2528, 292, 9159, 7315, 856, 1159, 13, 632, 13, 9651, 2927, 29918, 1958, 29918, 2917, 353, 12529, 29918, 6550, 8232, 1839, 2528, 1625, 555, 481, 29918, 21895, 29918, 2917, 2033, 13, 9651, 364, 353, 15232, 2272, 29889, 2528, 1625, 555, 481, 29918, 21895, 29898, 29878, 1901, 29918, 517, 29918, 7620, 29892, 2927, 29918, 1958, 29918, 2917, 29889, 657, 877, 262, 29918, 6886, 29918, 29878, 1901, 3788, 5477, 2927, 29918, 1958, 29918, 2917, 1839, 2080, 29918, 6154, 29934, 29918, 1445, 11287, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 2528, 1625, 555, 481, 29918, 21895, 7867, 613, 364, 29889, 4882, 29897, 13, 632, 13, 4706, 364, 1901, 29918, 978, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 4706, 364, 1901, 29918, 517, 29918, 7620, 29889, 7620, 29898, 29878, 1901, 29918, 978, 29897, 29871, 13, 4706, 1887, 29918, 29878, 1901, 29918, 8159, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 1287, 3493, 29918, 8159, 2084, 29892, 364, 1901, 29918, 978, 29897, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 2997, 29918, 29878, 1901, 29918, 8159, 2084, 613, 2997, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 613, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 308, 13, 4706, 1583, 3032, 5992, 1252, 15423, 29934, 1901, 3644, 24217, 29898, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 4706, 1583, 3032, 8552, 29934, 1901, 29898, 14399, 29918, 6550, 8232, 1839, 11882, 29934, 1901, 29918, 21895, 29918, 2917, 7464, 1887, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 308, 13, 4706, 1583, 3032, 5992, 1252, 15423, 29934, 1901, 3644, 24217, 29898, 2997, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 308, 13, 1678, 822, 903, 8552, 29934, 1901, 29898, 1311, 29892, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29892, 1887, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 1125, 13, 308, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 11882, 292, 390, 1901, 856, 613, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 4706, 364, 353, 15232, 2272, 29889, 11882, 29934, 1901, 29918, 21895, 29898, 2997, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29892, 13, 9651, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 2917, 29918, 26766, 3788, 5477, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 7042, 29918, 1767, 3788, 5477, 13, 9651, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 29876, 397, 532, 29918, 1767, 3788, 5477, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 650, 2966, 29918, 517, 29918, 29872, 523, 2966, 3788, 5477, 29871, 13, 9651, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 1054, 555, 481, 29918, 517, 29918, 28212, 3788, 5477, 3509, 29918, 29878, 1901, 29918, 1171, 351, 358, 29918, 2917, 29889, 657, 877, 29886, 15711, 29918, 1853, 3788, 1495, 13, 4706, 1723, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 11882, 29934, 1901, 29918, 21895, 7867, 613, 364, 29889, 4882, 29897, 13, 268, 13, 1678, 822, 903, 5992, 1252, 15423, 29934, 1901, 3644, 24217, 29898, 1311, 29892, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 1125, 13, 308, 13, 4706, 565, 15232, 2272, 29889, 24217, 29898, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 1125, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 2772, 1026, 292, 856, 613, 1962, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 9651, 364, 353, 15232, 2272, 29889, 12498, 29918, 21895, 29898, 4905, 29918, 29878, 1901, 29918, 8159, 2084, 29897, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 12498, 29918, 21895, 7867, 613, 364, 29889, 4882, 29897, 13, 13, 1678, 822, 903, 4951, 728, 7281, 29934, 1901, 2517, 351, 358, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8382, 29918, 21707, 703, 12881, 14424, 8701, 390, 1901, 6760, 362, 1159, 13, 308, 13, 4706, 18871, 29918, 6768, 353, 1583, 29889, 29878, 1901, 29918, 1037, 1061, 29918, 6768, 29889, 657, 877, 10867, 29918, 6768, 742, 6213, 29897, 13, 4706, 3349, 29918, 497, 29918, 29878, 1901, 29879, 29918, 265, 29918, 4951, 728, 353, 1583, 29889, 29878, 1901, 29918, 1037, 1061, 29918, 6768, 29889, 657, 877, 5992, 29918, 497, 29918, 29878, 1901, 29879, 29918, 265, 29918, 4951, 728, 742, 7700, 29897, 13, 308, 13, 4706, 565, 18871, 29918, 6768, 322, 451, 3349, 29918, 497, 29918, 29878, 1901, 29879, 29918, 265, 29918, 4951, 728, 29901, 13, 632, 13, 9651, 364, 1901, 29918, 978, 29918, 13506, 353, 18871, 29918, 6768, 29889, 657, 877, 29878, 1901, 29918, 978, 29918, 13506, 742, 6213, 29897, 13, 9651, 18871, 29918, 16700, 353, 18871, 29918, 6768, 29889, 657, 877, 2997, 29918, 29878, 1901, 29918, 10867, 29918, 16700, 742, 6213, 29897, 13, 9651, 364, 1901, 29918, 978, 29918, 12673, 29918, 4830, 353, 18871, 29918, 6768, 29889, 657, 877, 29878, 1901, 29918, 978, 29918, 12673, 29918, 4830, 742, 6213, 29897, 13, 632, 13, 9651, 565, 313, 29878, 1901, 29918, 978, 29918, 13506, 322, 18871, 29918, 16700, 322, 364, 1901, 29918, 978, 29918, 12673, 29918, 4830, 1125, 13, 462, 13, 18884, 18871, 29918, 1256, 353, 12865, 29889, 329, 29883, 3707, 580, 448, 5335, 287, 2554, 29898, 16700, 29922, 10867, 29918, 16700, 29897, 13, 18884, 1887, 29918, 29878, 1901, 29918, 1761, 353, 518, 29878, 363, 364, 297, 15232, 2272, 29889, 1293, 29934, 1901, 29879, 29898, 29878, 1901, 29918, 978, 29918, 13506, 13578, 29930, 3284, 29930, 1159, 565, 851, 29898, 29878, 7503, 2435, 29898, 29878, 1901, 29918, 978, 29918, 13506, 4638, 467, 13609, 580, 1275, 851, 29898, 29878, 1901, 29918, 978, 29918, 13506, 4638, 13, 18884, 1051, 29918, 974, 29918, 29878, 1901, 29879, 29918, 517, 29918, 8143, 353, 518, 29878, 1901, 363, 364, 1901, 297, 1887, 29918, 29878, 1901, 29918, 1761, 565, 12865, 29889, 710, 415, 603, 29898, 710, 29898, 29878, 1901, 511, 364, 1901, 29918, 978, 29918, 12673, 29918, 4830, 29897, 529, 18871, 29918, 1256, 29962, 13, 18884, 1583, 3032, 8143, 29934, 1901, 29879, 29898, 1761, 29918, 974, 29918, 29878, 1901, 29879, 29918, 517, 29918, 8143, 29897, 13, 462, 268, 13, 4706, 25342, 3349, 29918, 497, 29918, 29878, 1901, 29879, 29918, 265, 29918, 4951, 728, 29901, 13, 632, 13, 9651, 1583, 29889, 8382, 29918, 21707, 703, 7301, 21081, 2178, 390, 1901, 29879, 512, 9959, 5244, 3493, 856, 1159, 13, 9651, 1583, 3032, 8143, 29934, 1901, 29879, 29898, 5666, 2272, 29889, 1293, 29934, 1901, 29879, 703, 29930, 5783, 13, 632, 13, 1678, 822, 903, 8143, 29934, 1901, 29879, 29898, 1311, 29892, 1051, 29918, 974, 29918, 29878, 1901, 29879, 29918, 517, 29918, 8143, 1125, 13, 308, 13, 4706, 363, 364, 297, 1051, 29918, 974, 29918, 29878, 1901, 29879, 29918, 517, 29918, 8143, 29901, 13, 9651, 15232, 2272, 29889, 12498, 29918, 21895, 29898, 29878, 29897, 2 ]
reader_model.py
ranjeethmahankali/BIMToVec
0
128808
from ops import * import math import random ATOM_NUM = 5 ATOM_SIZE = 32 WORD_SIZE = 64 WORD_SAMPLE_SIZE = 20 ALPHABET = list("abcdefghijklmnopqrstuvwxyz") EMBEDDINGS = loadFromFile("savedEmbeddings/embeddings.pkl") EMBEDDING_TENSOR = tf.constant(value=EMBEDDINGS, dtype=tf.float32) def get_char_list_vec(word): chars = "" if len(word) < WORD_SAMPLE_SIZE: while len(chars) < WORD_SAMPLE_SIZE: chars += word if len(chars) > WORD_SAMPLE_SIZE: chars = chars[:WORD_SAMPLE_SIZE] # print(chars) else: chars = random.sample(list(word), WORD_SAMPLE_SIZE) vec = [] for ch in chars: vec += [(ALPHABET.index(ch)+1)/len(ALPHABET)] return np.reshape(np.array(vec),[1,-1]) LAYERS = [(ATOM_NUM*ATOM_SIZE)+WORD_SAMPLE_SIZE, 640, 1280, 1536, 1280, 640, WORD_SIZE] with tf.variable_scope("vars"): weights = [ weightVariable([LAYERS[i], LAYERS[i+1]], name="w%s"%i) for i in range(len(LAYERS)-1) ] biases = [ biasVariable([LAYERS[i+1]], name="b%s"%i) for i in range(len(LAYERS)-1) ] atoms_placeholder = tf.placeholder(shape=[None, (ATOM_NUM*ATOM_SIZE)+WORD_SAMPLE_SIZE], dtype = tf.float32, name="atoms") word_true = tf.placeholder(shape=[None], dtype = tf.int64, name="word_true_index") keep_prob = tf.placeholder(tf.float32, name = "keep_prob") h = 0 for i in range(len(weights)): L = atoms_placeholder if i == 0 else h h = tf.matmul(L, weights[i])+biases[i] h = tf.nn.tanh(h) if i == len(weights)-1 else tf.nn.relu(h) if i == len(weights)-2: h = tf.nn.dropout(h, keep_prob) norm = tf.sqrt(tf.reduce_sum(tf.square(h), axis=1, keep_dims=True)) embed_predict = (h/norm) similarity_predict = tf.matmul(embed_predict, tf.transpose(EMBEDDING_TENSOR)) sim_predict_norm = (1+tf.clip_by_value(similarity_predict, 0.01, math.inf))/2 prediction = tf.argmax(similarity_predict,axis=1) embed_true = tf.nn.embedding_lookup(EMBEDDING_TENSOR, word_true) similarity = tf.matmul(embed_true, tf.transpose(EMBEDDING_TENSOR)) sim_norm = (1+similarity)/2 cross_entropy = tf.reduce_mean(-tf.reduce_sum(sim_norm * tf.log(sim_predict_norm), 1)) diff_loss = tf.reduce_mean(tf.reduce_sum(tf.square(embed_predict-embed_true))) tf.summary.scalar("cross_entropy", cross_entropy) tf.summary.scalar("diff_loss", diff_loss) # all_vars = tf.trainable_variables() # vars = [v for v in all_vars if 'vars' in v.name] # l2_loss = 0 # for v in vars: # l2_loss += alpha*tf.nn.l2_loss(v) # # tf.summary.scalar("l2_loss", l2_loss) # pred_word_index = tf.nn.embedding_lookup(EMBEDDING_TENSOR, prediction) accuracy = 100*tf.reduce_mean(tf.cast(tf.equal(prediction, word_true),tf.float32)) # optim = tf.train.AdamOptimizer(learning_rate).minimize(cross_entropy+l2_loss-accuracy) # optim = tf.train.GradientDescentOptimizer(0.1).minimize(cross_entropy-accuracy) # optim = tf.train.AdamOptimizer(learning_rate).minimize(cross_entropy+l2_loss-accuracy) optim = tf.train.AdamOptimizer(learning_rate).minimize((cross_entropy/15)+diff_loss - accuracy)
[ 1, 515, 288, 567, 1053, 334, 13, 5215, 5844, 13, 5215, 4036, 13, 13, 1299, 6488, 29918, 13967, 353, 29871, 29945, 13, 1299, 6488, 29918, 14226, 353, 29871, 29941, 29906, 13, 17013, 29918, 14226, 353, 29871, 29953, 29946, 13, 17013, 29918, 8132, 3580, 1307, 29918, 14226, 353, 29871, 29906, 29900, 13, 13, 1964, 19689, 2882, 2544, 353, 1051, 703, 10736, 1753, 12443, 823, 6321, 23521, 459, 29939, 29878, 303, 4090, 29893, 20230, 1159, 13, 29923, 9486, 3352, 29928, 4214, 29903, 353, 2254, 4591, 2283, 703, 17314, 6026, 2580, 29881, 886, 29914, 17987, 29881, 886, 29889, 29886, 6321, 1159, 13, 29923, 9486, 3352, 29928, 4214, 29918, 29911, 1430, 29903, 1955, 353, 15886, 29889, 23362, 29898, 1767, 29922, 29923, 9486, 3352, 29928, 4214, 29903, 29892, 26688, 29922, 13264, 29889, 7411, 29941, 29906, 29897, 13, 13, 1753, 679, 29918, 3090, 29918, 1761, 29918, 2003, 29898, 1742, 1125, 13, 1678, 22524, 353, 5124, 13, 1678, 565, 7431, 29898, 1742, 29897, 529, 399, 25593, 29918, 8132, 3580, 1307, 29918, 14226, 29901, 13, 4706, 1550, 7431, 29898, 305, 1503, 29897, 529, 399, 25593, 29918, 8132, 3580, 1307, 29918, 14226, 29901, 13, 9651, 22524, 4619, 1734, 13, 4706, 565, 7431, 29898, 305, 1503, 29897, 1405, 399, 25593, 29918, 8132, 3580, 1307, 29918, 14226, 29901, 13, 9651, 22524, 353, 22524, 7503, 17013, 29918, 8132, 3580, 1307, 29918, 14226, 29962, 13, 9651, 396, 1596, 29898, 305, 1503, 29897, 13, 1678, 1683, 29901, 13, 4706, 22524, 353, 4036, 29889, 11249, 29898, 1761, 29898, 1742, 511, 399, 25593, 29918, 8132, 3580, 1307, 29918, 14226, 29897, 13, 13, 1678, 9649, 353, 5159, 13, 1678, 363, 521, 297, 22524, 29901, 13, 4706, 9649, 4619, 17288, 1964, 19689, 2882, 2544, 29889, 2248, 29898, 305, 7240, 29896, 6802, 2435, 29898, 1964, 19689, 2882, 2544, 4638, 13, 13, 1678, 736, 7442, 29889, 690, 14443, 29898, 9302, 29889, 2378, 29898, 2003, 511, 29961, 29896, 6653, 29896, 2314, 13, 13, 18799, 23598, 353, 17288, 1299, 6488, 29918, 13967, 29930, 1299, 6488, 29918, 14226, 7240, 17013, 29918, 8132, 3580, 1307, 29918, 14226, 29892, 29871, 29953, 29946, 29900, 29892, 29871, 29896, 29906, 29947, 29900, 29892, 29871, 29896, 29945, 29941, 29953, 29892, 29871, 29896, 29906, 29947, 29900, 29892, 29871, 29953, 29946, 29900, 29892, 399, 25593, 29918, 14226, 29962, 13, 13, 2541, 15886, 29889, 11918, 29918, 6078, 703, 16908, 29908, 1125, 13, 1678, 18177, 353, 518, 13, 4706, 7688, 16174, 4197, 18799, 23598, 29961, 29875, 1402, 17900, 29979, 23598, 29961, 29875, 29974, 29896, 20526, 1024, 543, 29893, 29995, 29879, 29908, 29995, 29875, 29897, 363, 474, 297, 3464, 29898, 2435, 29898, 18799, 23598, 6817, 29896, 29897, 13, 1678, 4514, 13, 13, 1678, 4768, 2129, 353, 518, 13, 4706, 24003, 16174, 4197, 18799, 23598, 29961, 29875, 29974, 29896, 20526, 1024, 543, 29890, 29995, 29879, 29908, 29995, 29875, 29897, 363, 474, 297, 3464, 29898, 2435, 29898, 18799, 23598, 6817, 29896, 29897, 13, 1678, 4514, 13, 13, 271, 4835, 29918, 27074, 353, 15886, 29889, 27074, 29898, 12181, 11759, 8516, 29892, 313, 1299, 6488, 29918, 13967, 29930, 1299, 6488, 29918, 14226, 7240, 17013, 29918, 8132, 3580, 1307, 29918, 14226, 1402, 13, 462, 539, 26688, 353, 15886, 29889, 7411, 29941, 29906, 29892, 1024, 543, 271, 4835, 1159, 13, 1742, 29918, 3009, 353, 15886, 29889, 27074, 29898, 12181, 11759, 8516, 1402, 26688, 353, 15886, 29889, 524, 29953, 29946, 29892, 1024, 543, 1742, 29918, 3009, 29918, 2248, 1159, 13, 17462, 29918, 22795, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 1024, 353, 376, 17462, 29918, 22795, 1159, 13, 13, 29882, 353, 29871, 29900, 13, 1454, 474, 297, 3464, 29898, 2435, 29898, 705, 5861, 22164, 13, 1678, 365, 353, 28422, 29918, 27074, 565, 474, 1275, 29871, 29900, 1683, 298, 13, 1678, 298, 353, 15886, 29889, 2922, 16109, 29898, 29931, 29892, 18177, 29961, 29875, 2314, 29974, 5365, 2129, 29961, 29875, 29962, 13, 1678, 298, 353, 15886, 29889, 15755, 29889, 13161, 29882, 29898, 29882, 29897, 565, 474, 1275, 7431, 29898, 705, 5861, 6817, 29896, 1683, 15886, 29889, 15755, 29889, 2674, 29884, 29898, 29882, 29897, 13, 1678, 565, 474, 1275, 7431, 29898, 705, 5861, 6817, 29906, 29901, 13, 4706, 298, 353, 15886, 29889, 15755, 29889, 8865, 449, 29898, 29882, 29892, 3013, 29918, 22795, 29897, 13, 13, 12324, 353, 15886, 29889, 3676, 29898, 13264, 29889, 17469, 29918, 2083, 29898, 13264, 29889, 17619, 29898, 29882, 511, 9685, 29922, 29896, 29892, 3013, 29918, 6229, 29879, 29922, 5574, 876, 13, 17987, 29918, 27711, 353, 313, 29882, 29914, 12324, 29897, 13, 29764, 537, 29918, 27711, 353, 15886, 29889, 2922, 16109, 29898, 17987, 29918, 27711, 29892, 15886, 29889, 3286, 4220, 29898, 29923, 9486, 3352, 29928, 4214, 29918, 29911, 1430, 29903, 1955, 876, 13, 3601, 29918, 27711, 29918, 12324, 353, 313, 29896, 29974, 13264, 29889, 24049, 29918, 1609, 29918, 1767, 29898, 29764, 537, 29918, 27711, 29892, 29871, 29900, 29889, 29900, 29896, 29892, 5844, 29889, 7192, 876, 29914, 29906, 13, 11965, 2463, 353, 15886, 29889, 1191, 3317, 29898, 29764, 537, 29918, 27711, 29892, 8990, 29922, 29896, 29897, 13, 13, 17987, 29918, 3009, 353, 15886, 29889, 15755, 29889, 17987, 8497, 29918, 20401, 29898, 29923, 9486, 3352, 29928, 4214, 29918, 29911, 1430, 29903, 1955, 29892, 1734, 29918, 3009, 29897, 13, 29764, 537, 353, 15886, 29889, 2922, 16109, 29898, 17987, 29918, 3009, 29892, 15886, 29889, 3286, 4220, 29898, 29923, 9486, 3352, 29928, 4214, 29918, 29911, 1430, 29903, 1955, 876, 13, 3601, 29918, 12324, 353, 313, 29896, 29974, 29764, 537, 6802, 29906, 13, 13, 19128, 29918, 296, 14441, 353, 15886, 29889, 17469, 29918, 12676, 6278, 13264, 29889, 17469, 29918, 2083, 29898, 3601, 29918, 12324, 334, 15886, 29889, 1188, 29898, 3601, 29918, 27711, 29918, 12324, 511, 29871, 29896, 876, 13, 12765, 29918, 6758, 353, 15886, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 17469, 29918, 2083, 29898, 13264, 29889, 17619, 29898, 17987, 29918, 27711, 29899, 17987, 29918, 3009, 4961, 13, 13, 13264, 29889, 7727, 29889, 19529, 279, 703, 19128, 29918, 296, 14441, 613, 4891, 29918, 296, 14441, 29897, 13, 13264, 29889, 7727, 29889, 19529, 279, 703, 12765, 29918, 6758, 613, 2923, 29918, 6758, 29897, 13, 13, 29937, 599, 29918, 16908, 353, 15886, 29889, 14968, 519, 29918, 20897, 580, 13, 29937, 24987, 353, 518, 29894, 363, 325, 297, 599, 29918, 16908, 565, 525, 16908, 29915, 297, 325, 29889, 978, 29962, 13, 29937, 301, 29906, 29918, 6758, 353, 29871, 29900, 13, 29937, 363, 325, 297, 24987, 29901, 13, 29937, 268, 301, 29906, 29918, 6758, 4619, 15595, 29930, 13264, 29889, 15755, 29889, 29880, 29906, 29918, 6758, 29898, 29894, 29897, 13, 29937, 13, 29937, 15886, 29889, 7727, 29889, 19529, 279, 703, 29880, 29906, 29918, 6758, 613, 301, 29906, 29918, 6758, 29897, 13, 13, 29937, 4450, 29918, 1742, 29918, 2248, 353, 15886, 29889, 15755, 29889, 17987, 8497, 29918, 20401, 29898, 29923, 9486, 3352, 29928, 4214, 29918, 29911, 1430, 29903, 1955, 29892, 18988, 29897, 13, 562, 2764, 4135, 353, 29871, 29896, 29900, 29900, 29930, 13264, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 4384, 29898, 13264, 29889, 11745, 29898, 11965, 2463, 29892, 1734, 29918, 3009, 511, 13264, 29889, 7411, 29941, 29906, 876, 13, 29937, 5994, 353, 15886, 29889, 14968, 29889, 3253, 314, 20624, 326, 3950, 29898, 21891, 29918, 10492, 467, 1195, 326, 675, 29898, 19128, 29918, 296, 14441, 29974, 29880, 29906, 29918, 6758, 29899, 562, 2764, 4135, 29897, 13, 29937, 5994, 353, 15886, 29889, 14968, 29889, 25584, 993, 4002, 1760, 20624, 326, 3950, 29898, 29900, 29889, 29896, 467, 1195, 326, 675, 29898, 19128, 29918, 296, 14441, 29899, 562, 2764, 4135, 29897, 13, 29937, 5994, 353, 15886, 29889, 14968, 29889, 3253, 314, 20624, 326, 3950, 29898, 21891, 29918, 10492, 467, 1195, 326, 675, 29898, 19128, 29918, 296, 14441, 29974, 29880, 29906, 29918, 6758, 29899, 562, 2764, 4135, 29897, 13, 20640, 353, 15886, 29889, 14968, 29889, 3253, 314, 20624, 326, 3950, 29898, 21891, 29918, 10492, 467, 1195, 326, 675, 3552, 19128, 29918, 296, 14441, 29914, 29896, 29945, 7240, 12765, 29918, 6758, 448, 13600, 29897, 2 ]
searx/searx/engines/bing_videos.py
wgranados/quadbot
3
106689
""" Bing (Videos) @website https://www.bing.com/videos @provide-api yes (http://datamarket.azure.com/dataset/bing/search) @using-api no @results HTML @stable no @parse url, title, content, thumbnail """ from json import loads from lxml import html from searx.engines.bing_images import _fetch_supported_languages, supported_languages_url from searx.engines.xpath import extract_text from searx.url_utils import urlencode from searx.utils import match_language categories = ['videos'] paging = True safesearch = True time_range_support = True number_of_results = 10 language_support = True search_url = 'https://www.bing.com/videos/asyncv2?{query}&async=content&'\ 'first={offset}&count={number_of_results}&CW=1366&CH=25&FORM=R5VR5' time_range_string = '&qft=+filterui:videoage-lt{interval}' time_range_dict = {'day': '1440', 'week': '10080', 'month': '43200', 'year': '525600'} # safesearch definitions safesearch_types = {2: 'STRICT', 1: 'DEMOTE', 0: 'OFF'} # do search-request def request(query, params): offset = (params['pageno'] - 1) * 10 + 1 # safesearch cookie params['cookies']['SRCHHPGUSR'] = \ 'ADLT=' + safesearch_types.get(params['safesearch'], 'DEMOTE') # language cookie language = match_language(params['language'], supported_languages, language_aliases).lower() params['cookies']['_EDGE_S'] = 'mkt=' + language + '&F=1' # query and paging params['url'] = search_url.format(query=urlencode({'q': query}), offset=offset, number_of_results=number_of_results) # time range if params['time_range'] in time_range_dict: params['url'] += time_range_string.format(interval=time_range_dict[params['time_range']]) return params # get response from search-request def response(resp): results = [] dom = html.fromstring(resp.text) for result in dom.xpath('//div[@class="dg_u"]'): url = result.xpath('./div[@class="mc_vtvc"]/a/@href')[0] url = 'https://bing.com' + url title = extract_text(result.xpath('./div/a/div/div[@class="mc_vtvc_title"]/@title')) content = extract_text(result.xpath('./div/a/div/div/div/div/text()')) thumbnail = result.xpath('./div/a/div/div/img/@src')[0] results.append({'url': url, 'title': title, 'content': content, 'thumbnail': thumbnail, 'template': 'videos.html'}) if len(results) >= number_of_results: break return results
[ 1, 9995, 13, 350, 292, 313, 29963, 7958, 29897, 13, 13, 732, 22942, 268, 2045, 597, 1636, 29889, 10549, 29889, 510, 29914, 29894, 7958, 13, 732, 16123, 680, 29899, 2754, 4874, 313, 1124, 597, 4130, 314, 935, 300, 29889, 17688, 29889, 510, 29914, 24713, 29914, 10549, 29914, 4478, 29897, 13, 13, 732, 4746, 29899, 2754, 259, 694, 13, 732, 9902, 268, 4544, 13, 732, 13844, 418, 694, 13, 732, 5510, 539, 3142, 29892, 3611, 29892, 2793, 29892, 266, 21145, 13, 15945, 29908, 13, 13, 3166, 4390, 1053, 15376, 13, 3166, 301, 3134, 1053, 3472, 13, 3166, 409, 279, 29916, 29889, 996, 1475, 29889, 10549, 29918, 8346, 1053, 903, 9155, 29918, 23765, 29918, 29880, 8737, 29892, 6969, 29918, 29880, 8737, 29918, 2271, 13, 3166, 409, 279, 29916, 29889, 996, 1475, 29889, 23635, 1053, 6597, 29918, 726, 13, 3166, 409, 279, 29916, 29889, 2271, 29918, 13239, 1053, 3142, 12508, 13, 3166, 409, 279, 29916, 29889, 13239, 1053, 1993, 29918, 11675, 13, 13, 13, 20683, 353, 6024, 29894, 7958, 2033, 13, 29886, 6751, 353, 5852, 13, 29879, 2142, 267, 2842, 353, 5852, 13, 2230, 29918, 3881, 29918, 5924, 353, 5852, 13, 4537, 29918, 974, 29918, 9902, 353, 29871, 29896, 29900, 13, 11675, 29918, 5924, 353, 5852, 13, 13, 4478, 29918, 2271, 353, 525, 991, 597, 1636, 29889, 10549, 29889, 510, 29914, 29894, 7958, 29914, 12674, 29894, 29906, 29973, 29912, 1972, 15704, 12674, 29922, 3051, 29987, 12764, 13, 632, 525, 4102, 3790, 10289, 15704, 2798, 3790, 4537, 29918, 974, 29918, 9902, 15704, 29907, 29956, 29922, 29896, 29941, 29953, 29953, 29987, 3210, 29922, 29906, 29945, 29987, 19094, 29922, 29934, 29945, 29963, 29934, 29945, 29915, 13, 2230, 29918, 3881, 29918, 1807, 353, 525, 29987, 29939, 615, 29922, 29974, 4572, 1481, 29901, 9641, 482, 29899, 1896, 29912, 19207, 10162, 13, 2230, 29918, 3881, 29918, 8977, 353, 11117, 3250, 2396, 525, 29896, 29946, 29946, 29900, 742, 13, 462, 259, 525, 18448, 2396, 525, 29896, 29900, 29900, 29947, 29900, 742, 13, 462, 259, 525, 10874, 2396, 525, 29946, 29941, 29906, 29900, 29900, 742, 13, 462, 259, 525, 6360, 2396, 525, 29945, 29906, 29945, 29953, 29900, 29900, 10827, 13, 13, 29937, 9437, 267, 2842, 15848, 13, 29879, 2142, 267, 2842, 29918, 8768, 353, 426, 29906, 29901, 525, 1254, 3960, 1783, 742, 13, 462, 268, 29896, 29901, 525, 2287, 29924, 2891, 29923, 742, 13, 462, 268, 29900, 29901, 525, 27681, 10827, 13, 13, 13, 29937, 437, 2740, 29899, 3827, 13, 1753, 2009, 29898, 1972, 29892, 8636, 1125, 13, 1678, 9210, 353, 313, 7529, 1839, 29886, 5370, 29877, 2033, 448, 29871, 29896, 29897, 334, 29871, 29896, 29900, 718, 29871, 29896, 13, 13, 1678, 396, 9437, 267, 2842, 15327, 13, 1678, 8636, 1839, 15108, 583, 16215, 14098, 3210, 3954, 29954, 3308, 29934, 2033, 353, 320, 13, 4706, 525, 3035, 5850, 2433, 718, 9437, 267, 2842, 29918, 8768, 29889, 657, 29898, 7529, 1839, 29879, 2142, 267, 2842, 7464, 525, 2287, 29924, 2891, 29923, 1495, 13, 13, 1678, 396, 4086, 15327, 13, 1678, 4086, 353, 1993, 29918, 11675, 29898, 7529, 1839, 11675, 7464, 6969, 29918, 29880, 8737, 29892, 4086, 29918, 2606, 2129, 467, 13609, 580, 13, 1678, 8636, 1839, 15108, 583, 16215, 29918, 3352, 1692, 29918, 29903, 2033, 353, 525, 29885, 1193, 2433, 718, 4086, 718, 525, 29987, 29943, 29922, 29896, 29915, 13, 13, 1678, 396, 2346, 322, 282, 6751, 13, 1678, 8636, 1839, 2271, 2033, 353, 2740, 29918, 2271, 29889, 4830, 29898, 1972, 29922, 2271, 12508, 3319, 29915, 29939, 2396, 2346, 9594, 13, 462, 462, 418, 9210, 29922, 10289, 29892, 13, 462, 462, 418, 1353, 29918, 974, 29918, 9902, 29922, 4537, 29918, 974, 29918, 9902, 29897, 13, 13, 1678, 396, 931, 3464, 13, 1678, 565, 8636, 1839, 2230, 29918, 3881, 2033, 297, 931, 29918, 3881, 29918, 8977, 29901, 13, 4706, 8636, 1839, 2271, 2033, 4619, 931, 29918, 3881, 29918, 1807, 29889, 4830, 29898, 19207, 29922, 2230, 29918, 3881, 29918, 8977, 29961, 7529, 1839, 2230, 29918, 3881, 2033, 2314, 13, 13, 1678, 736, 8636, 13, 13, 13, 29937, 679, 2933, 515, 2740, 29899, 3827, 13, 1753, 2933, 29898, 13713, 1125, 13, 1678, 2582, 353, 5159, 13, 13, 1678, 2432, 353, 3472, 29889, 3166, 1807, 29898, 13713, 29889, 726, 29897, 13, 13, 1678, 363, 1121, 297, 2432, 29889, 23635, 877, 458, 4563, 17548, 1990, 543, 20726, 29918, 29884, 3108, 29374, 13, 4706, 3142, 353, 1121, 29889, 23635, 877, 6904, 4563, 17548, 1990, 543, 14047, 29918, 21908, 7071, 3108, 29914, 29874, 29368, 12653, 29861, 29900, 29962, 13, 4706, 3142, 353, 525, 991, 597, 10549, 29889, 510, 29915, 718, 3142, 13, 4706, 3611, 353, 6597, 29918, 726, 29898, 2914, 29889, 23635, 877, 6904, 4563, 29914, 29874, 29914, 4563, 29914, 4563, 17548, 1990, 543, 14047, 29918, 21908, 7071, 29918, 3257, 3108, 29368, 3257, 8785, 13, 4706, 2793, 353, 6597, 29918, 726, 29898, 2914, 29889, 23635, 877, 6904, 4563, 29914, 29874, 29914, 4563, 29914, 4563, 29914, 4563, 29914, 4563, 29914, 726, 580, 8785, 13, 4706, 266, 21145, 353, 1121, 29889, 23635, 877, 6904, 4563, 29914, 29874, 29914, 4563, 29914, 4563, 29914, 2492, 29368, 4351, 29861, 29900, 29962, 13, 13, 4706, 2582, 29889, 4397, 3319, 29915, 2271, 2396, 3142, 29892, 13, 462, 4706, 525, 3257, 2396, 3611, 29892, 13, 462, 4706, 525, 3051, 2396, 2793, 29892, 13, 462, 4706, 525, 386, 21145, 2396, 266, 21145, 29892, 13, 462, 4706, 525, 6886, 2396, 525, 29894, 7958, 29889, 1420, 29915, 1800, 13, 13, 4706, 565, 7431, 29898, 9902, 29897, 6736, 1353, 29918, 974, 29918, 9902, 29901, 13, 9651, 2867, 13, 13, 1678, 736, 2582, 13, 2 ]
src/core/widgets/komorebi/active_layout.py
younger-1/yasb
53
151252
import logging from collections import deque from PyQt6.QtWidgets import QWidget, QLabel from PyQt6.QtCore import pyqtSignal from core.utils.win32.utilities import get_monitor_hwnd from core.event_service import EventService from core.event_enums import KomorebiEvent from core.widgets.base import BaseWidget from core.utils.komorebi.client import KomorebiClient from core.validation.widgets.komorebi.active_layout import VALIDATION_SCHEMA try: from core.utils.komorebi.event_listener import KomorebiEventListener except ImportError: KomorebiEventListener = None logging.warning("Failed to load Komorebi Event Listener") layout_cmds = { "BSP": "bsp", "Columns": "columns", "Rows": "rows", "VerticalStack": "vertical-stack", "HorizontalStack": "horizontal-stack", "UltrawideVerticalStack": "ultrawide-vertical-stack" } layout_snake_case = { "BSP": "bsp", "Columns": "columns", "Rows": "rows", "VerticalStack": "vertical_stack", "HorizontalStack": "horizontal_stack", "UltrawideVerticalStack": "ultrawide_vertical_stack" } class ActiveLayoutWidget(BaseWidget): k_signal_connect = pyqtSignal(dict) k_signal_disconnect = pyqtSignal() k_signal_layout_change = pyqtSignal(dict, dict) validation_schema = VALIDATION_SCHEMA event_listener = KomorebiEventListener def __init__(self, label: str, layout_icons: dict[str, str], hide_if_offline: bool, callbacks: dict[str, str]): super().__init__(class_name="komorebi-active-layout") self._label = label self._layout_icons = layout_icons self._layouts = deque([ 'bsp', 'columns', 'rows', 'vertical-stack', 'horizontal-stack', 'ultrawide-vertical-stack' ]) self._hide_if_offline = hide_if_offline self._event_service = EventService() self._komorebic = KomorebiClient() self._komorebi_screen = None self._komorebi_workspaces = [] self._focused_workspace = {} self._active_layout_text = QLabel() self._active_layout_text.setProperty("class", "label") self._active_layout_text.hide() self.widget_layout.addWidget(self._active_layout_text) self.callback_left = callbacks['on_left'] self.callback_right = callbacks['on_right'] self.callback_middle = callbacks['on_middle'] self.register_callback("next_layout", self._next_layout) self.register_callback("prev_layout", self._prev_layout) self.register_callback("flip_layout", self._komorebic.flip_layout) self.register_callback("toggle_tiling", lambda: self._komorebic.toggle("tiling")) self.register_callback("toggle_float", lambda: self._komorebic.toggle("float")) self.register_callback("toggle_monocle", lambda: self._komorebic.toggle("monocle")) self.register_callback("toggle_maximise", lambda: self._komorebic.toggle("maximise")) self.register_callback("toggle_pause", lambda: self._komorebic.toggle("pause")) self._register_signals_and_events() def _next_layout(self): if self._is_shift_layout_allowed(): self._layouts.rotate(1) self._komorebic.change_layout(self._layouts[0]) def _prev_layout(self): if self._is_shift_layout_allowed(): self._layouts.rotate(-1) self._komorebic.change_layout(self._layouts[0]) def _is_shift_layout_allowed(self): return not bool( not self._focused_workspace.get('tile', False) or self._focused_workspace.get('monocle_container', None) or self._focused_workspace.get('maximized_window', None) or self._komorebi_state.get('is_paused', False) ) def _register_signals_and_events(self): active_layout_change_event_watchlist = [ KomorebiEvent.ChangeLayout, KomorebiEvent.TogglePause, KomorebiEvent.ToggleTiling, KomorebiEvent.ToggleMonocle, KomorebiEvent.ToggleMaximise ] self.k_signal_connect.connect(self._on_komorebi_connect_event) self.k_signal_disconnect.connect(self._on_komorebi_disconnect_event) self.k_signal_layout_change.connect(self._on_komorebi_layout_change_event) self._event_service.register_event(KomorebiEvent.KomorebiConnect, self.k_signal_connect) self._event_service.register_event(KomorebiEvent.KomorebiDisconnect, self.k_signal_disconnect) for event_type in active_layout_change_event_watchlist: self._event_service.register_event(event_type, self.k_signal_layout_change) def _on_komorebi_connect_event(self, state: dict) -> None: self._update_active_layout(state, is_connect_event=True) def _on_komorebi_layout_change_event(self, _event: dict, state: dict) -> None: self._update_active_layout(state) def _on_komorebi_disconnect_event(self) -> None: if self._hide_if_offline: self._active_layout_text.hide() def _update_active_layout(self, state: dict, is_connect_event=False): try: if self._update_komorebi_state(state): self._focused_workspace = self._komorebic.get_focused_workspace(self._komorebi_screen) if not self._focused_workspace: return layout_name, layout_icon = self._get_layout_label_info() if is_connect_event: conn_layout_name = self._focused_workspace['layout']['Default'] conn_layout_cmd = layout_cmds.get(conn_layout_name, 'bsp') while self._layouts[0] != conn_layout_cmd: self._layouts.rotate(1) self._active_layout_text.setText( self._label.replace("{icon}", layout_icon).replace("{layout_name}", layout_name) ) if self._active_layout_text.isHidden(): self._active_layout_text.show() except Exception: logging.exception("Failed to update komorebi status and widget button state") def _get_layout_label_info(self): if self._komorebi_state.get('is_paused', False): layout_name = 'Paused' layout_icon = self._layout_icons['paused'] elif not self._focused_workspace.get('tile', False): layout_name = 'Floating' layout_icon = self._layout_icons['floating'] elif self._focused_workspace.get('maximized_window', None): layout_name = 'Maximised' layout_icon = self._layout_icons['maximised'] elif self._focused_workspace.get('monocle_container', None): layout_name = 'Monocle' layout_icon = self._layout_icons['monocle'] else: layout_name = self._focused_workspace['layout']['Default'] layout_icon = self._layout_icons.get(layout_snake_case[layout_name], 'unknown layout') return layout_name, layout_icon def _update_komorebi_state(self, komorebi_state: dict): try: self._screen_hwnd = get_monitor_hwnd(int(QWidget.winId(self))) self._komorebi_state = komorebi_state if self._komorebi_state: self._komorebi_screen = self._komorebic.get_screen_by_hwnd(self._komorebi_state, self._screen_hwnd) self._komorebi_workspaces = self._komorebic.get_workspaces(self._komorebi_screen) return True except TypeError: return False
[ 1, 1053, 12183, 13, 3166, 16250, 1053, 316, 802, 13, 3166, 10772, 17303, 29953, 29889, 17303, 8801, 29879, 1053, 660, 8801, 29892, 660, 4775, 13, 3166, 10772, 17303, 29953, 29889, 17303, 9203, 1053, 11451, 17915, 10140, 284, 13, 3166, 7136, 29889, 13239, 29889, 5080, 29941, 29906, 29889, 4422, 1907, 1053, 679, 29918, 3712, 2105, 29918, 26828, 299, 13, 3166, 7136, 29889, 3696, 29918, 5509, 1053, 6864, 3170, 13, 3166, 7136, 29889, 3696, 29918, 264, 6762, 1053, 7107, 487, 5365, 2624, 13, 3166, 7136, 29889, 8030, 29879, 29889, 3188, 1053, 7399, 8801, 13, 3166, 7136, 29889, 13239, 29889, 7218, 487, 5365, 29889, 4645, 1053, 7107, 487, 5365, 4032, 13, 3166, 7136, 29889, 18157, 29889, 8030, 29879, 29889, 7218, 487, 5365, 29889, 4925, 29918, 2680, 1053, 12599, 1367, 8098, 29918, 29903, 3210, 26862, 13, 13, 2202, 29901, 13, 1678, 515, 7136, 29889, 13239, 29889, 7218, 487, 5365, 29889, 3696, 29918, 25894, 1053, 7107, 487, 5365, 12825, 13, 19499, 16032, 2392, 29901, 13, 1678, 7107, 487, 5365, 12825, 353, 6213, 13, 1678, 12183, 29889, 27392, 703, 17776, 304, 2254, 7107, 487, 5365, 6864, 2391, 759, 1159, 13, 13, 2680, 29918, 9006, 29879, 353, 426, 13, 1678, 376, 29933, 5550, 1115, 376, 29890, 1028, 613, 13, 1678, 376, 14289, 1115, 376, 13099, 613, 13, 1678, 376, 10661, 1115, 376, 5727, 613, 13, 1678, 376, 29270, 7264, 1115, 376, 18575, 29899, 1429, 613, 13, 1678, 376, 24932, 7264, 1115, 376, 22672, 29899, 1429, 613, 13, 1678, 376, 29965, 1896, 1610, 680, 29270, 7264, 1115, 376, 499, 1610, 680, 29899, 18575, 29899, 1429, 29908, 13, 29913, 13, 13, 2680, 29918, 29879, 21040, 29918, 4878, 353, 426, 13, 1678, 376, 29933, 5550, 1115, 376, 29890, 1028, 613, 13, 1678, 376, 14289, 1115, 376, 13099, 613, 13, 1678, 376, 10661, 1115, 376, 5727, 613, 13, 1678, 376, 29270, 7264, 1115, 376, 18575, 29918, 1429, 613, 13, 1678, 376, 24932, 7264, 1115, 376, 22672, 29918, 1429, 613, 13, 1678, 376, 29965, 1896, 1610, 680, 29270, 7264, 1115, 376, 499, 1610, 680, 29918, 18575, 29918, 1429, 29908, 13, 29913, 13, 13, 13, 1990, 10731, 3453, 8801, 29898, 5160, 8801, 1125, 13, 1678, 413, 29918, 25436, 29918, 6915, 353, 11451, 17915, 10140, 284, 29898, 8977, 29897, 13, 1678, 413, 29918, 25436, 29918, 2218, 6915, 353, 11451, 17915, 10140, 284, 580, 13, 1678, 413, 29918, 25436, 29918, 2680, 29918, 3167, 353, 11451, 17915, 10140, 284, 29898, 8977, 29892, 9657, 29897, 13, 13, 1678, 8845, 29918, 11010, 353, 12599, 1367, 8098, 29918, 29903, 3210, 26862, 13, 1678, 1741, 29918, 25894, 353, 7107, 487, 5365, 12825, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3858, 29901, 851, 29892, 5912, 29918, 27078, 29901, 9657, 29961, 710, 29892, 851, 1402, 9563, 29918, 361, 29918, 2696, 1220, 29901, 6120, 29892, 6939, 29879, 29901, 9657, 29961, 710, 29892, 851, 29962, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1990, 29918, 978, 543, 7218, 487, 5365, 29899, 4925, 29899, 2680, 1159, 13, 4706, 1583, 3032, 1643, 353, 3858, 13, 4706, 1583, 3032, 2680, 29918, 27078, 353, 5912, 29918, 27078, 13, 4706, 1583, 3032, 2680, 29879, 353, 316, 802, 4197, 13, 9651, 525, 29890, 1028, 742, 525, 13099, 742, 525, 5727, 742, 525, 18575, 29899, 1429, 742, 525, 22672, 29899, 1429, 742, 525, 499, 1610, 680, 29899, 18575, 29899, 1429, 29915, 13, 308, 2314, 13, 4706, 1583, 3032, 11458, 29918, 361, 29918, 2696, 1220, 353, 9563, 29918, 361, 29918, 2696, 1220, 13, 4706, 1583, 3032, 3696, 29918, 5509, 353, 6864, 3170, 580, 13, 4706, 1583, 3032, 7218, 487, 29890, 293, 353, 7107, 487, 5365, 4032, 580, 13, 4706, 1583, 3032, 7218, 487, 5365, 29918, 10525, 353, 6213, 13, 4706, 1583, 3032, 7218, 487, 5365, 29918, 1287, 22854, 353, 5159, 13, 4706, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 353, 6571, 13, 13, 4706, 1583, 3032, 4925, 29918, 2680, 29918, 726, 353, 660, 4775, 580, 13, 4706, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 842, 4854, 703, 1990, 613, 376, 1643, 1159, 13, 4706, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 11458, 580, 13, 13, 4706, 1583, 29889, 8030, 29918, 2680, 29889, 1202, 8801, 29898, 1311, 3032, 4925, 29918, 2680, 29918, 726, 29897, 13, 13, 4706, 1583, 29889, 14035, 29918, 1563, 353, 6939, 29879, 1839, 265, 29918, 1563, 2033, 13, 4706, 1583, 29889, 14035, 29918, 1266, 353, 6939, 29879, 1839, 265, 29918, 1266, 2033, 13, 4706, 1583, 29889, 14035, 29918, 17662, 353, 6939, 29879, 1839, 265, 29918, 17662, 2033, 13, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 4622, 29918, 2680, 613, 1583, 3032, 4622, 29918, 2680, 29897, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 16304, 29918, 2680, 613, 1583, 3032, 16304, 29918, 2680, 29897, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 29888, 3466, 29918, 2680, 613, 1583, 3032, 7218, 487, 29890, 293, 29889, 29888, 3466, 29918, 2680, 29897, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 13270, 29918, 1376, 292, 613, 14013, 29901, 1583, 3032, 7218, 487, 29890, 293, 29889, 13270, 703, 1376, 292, 5783, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 13270, 29918, 7411, 613, 14013, 29901, 1583, 3032, 7218, 487, 29890, 293, 29889, 13270, 703, 7411, 5783, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 13270, 29918, 3712, 542, 280, 613, 14013, 29901, 1583, 3032, 7218, 487, 29890, 293, 29889, 13270, 703, 3712, 542, 280, 5783, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 13270, 29918, 27525, 895, 613, 14013, 29901, 1583, 3032, 7218, 487, 29890, 293, 29889, 13270, 703, 27525, 895, 5783, 13, 4706, 1583, 29889, 9573, 29918, 14035, 703, 13270, 29918, 29886, 1071, 613, 14013, 29901, 1583, 3032, 7218, 487, 29890, 293, 29889, 13270, 703, 29886, 1071, 5783, 13, 13, 4706, 1583, 3032, 9573, 29918, 4530, 1338, 29918, 392, 29918, 13604, 580, 13, 13, 1678, 822, 903, 4622, 29918, 2680, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 275, 29918, 10889, 29918, 2680, 29918, 24622, 7295, 13, 9651, 1583, 3032, 2680, 29879, 29889, 23361, 29898, 29896, 29897, 13, 9651, 1583, 3032, 7218, 487, 29890, 293, 29889, 3167, 29918, 2680, 29898, 1311, 3032, 2680, 29879, 29961, 29900, 2314, 13, 13, 1678, 822, 903, 16304, 29918, 2680, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 275, 29918, 10889, 29918, 2680, 29918, 24622, 7295, 13, 9651, 1583, 3032, 2680, 29879, 29889, 23361, 6278, 29896, 29897, 13, 9651, 1583, 3032, 7218, 487, 29890, 293, 29889, 3167, 29918, 2680, 29898, 1311, 3032, 2680, 29879, 29961, 29900, 2314, 13, 13, 1678, 822, 903, 275, 29918, 10889, 29918, 2680, 29918, 24622, 29898, 1311, 1125, 13, 4706, 736, 451, 6120, 29898, 13, 9651, 451, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 29873, 488, 742, 7700, 29897, 470, 13, 9651, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 3712, 542, 280, 29918, 7611, 742, 6213, 29897, 470, 13, 9651, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 27525, 1891, 29918, 7165, 742, 6213, 29897, 470, 13, 9651, 1583, 3032, 7218, 487, 5365, 29918, 3859, 29889, 657, 877, 275, 29918, 29886, 15244, 742, 7700, 29897, 13, 4706, 1723, 13, 13, 1678, 822, 903, 9573, 29918, 4530, 1338, 29918, 392, 29918, 13604, 29898, 1311, 1125, 13, 4706, 6136, 29918, 2680, 29918, 3167, 29918, 3696, 29918, 12344, 1761, 353, 518, 13, 9651, 7107, 487, 5365, 2624, 29889, 7277, 3453, 29892, 13, 9651, 7107, 487, 5365, 2624, 29889, 27199, 29925, 1071, 29892, 13, 9651, 7107, 487, 5365, 2624, 29889, 27199, 29911, 6504, 29892, 13, 9651, 7107, 487, 5365, 2624, 29889, 27199, 7185, 542, 280, 29892, 13, 9651, 7107, 487, 5365, 2624, 29889, 27199, 7976, 326, 895, 13, 4706, 4514, 13, 13, 4706, 1583, 29889, 29895, 29918, 25436, 29918, 6915, 29889, 6915, 29898, 1311, 3032, 265, 29918, 7218, 487, 5365, 29918, 6915, 29918, 3696, 29897, 13, 4706, 1583, 29889, 29895, 29918, 25436, 29918, 2218, 6915, 29889, 6915, 29898, 1311, 3032, 265, 29918, 7218, 487, 5365, 29918, 2218, 6915, 29918, 3696, 29897, 13, 4706, 1583, 29889, 29895, 29918, 25436, 29918, 2680, 29918, 3167, 29889, 6915, 29898, 1311, 3032, 265, 29918, 7218, 487, 5365, 29918, 2680, 29918, 3167, 29918, 3696, 29897, 13, 13, 4706, 1583, 3032, 3696, 29918, 5509, 29889, 9573, 29918, 3696, 29898, 29968, 290, 487, 5365, 2624, 29889, 29968, 290, 487, 5365, 17918, 29892, 29871, 1583, 29889, 29895, 29918, 25436, 29918, 6915, 29897, 13, 4706, 1583, 3032, 3696, 29918, 5509, 29889, 9573, 29918, 3696, 29898, 29968, 290, 487, 5365, 2624, 29889, 29968, 290, 487, 5365, 4205, 6915, 29892, 1583, 29889, 29895, 29918, 25436, 29918, 2218, 6915, 29897, 13, 13, 4706, 363, 1741, 29918, 1853, 297, 6136, 29918, 2680, 29918, 3167, 29918, 3696, 29918, 12344, 1761, 29901, 13, 9651, 1583, 3032, 3696, 29918, 5509, 29889, 9573, 29918, 3696, 29898, 3696, 29918, 1853, 29892, 1583, 29889, 29895, 29918, 25436, 29918, 2680, 29918, 3167, 29897, 13, 13, 1678, 822, 903, 265, 29918, 7218, 487, 5365, 29918, 6915, 29918, 3696, 29898, 1311, 29892, 2106, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 1583, 3032, 5504, 29918, 4925, 29918, 2680, 29898, 3859, 29892, 338, 29918, 6915, 29918, 3696, 29922, 5574, 29897, 13, 13, 1678, 822, 903, 265, 29918, 7218, 487, 5365, 29918, 2680, 29918, 3167, 29918, 3696, 29898, 1311, 29892, 903, 3696, 29901, 9657, 29892, 2106, 29901, 9657, 29897, 1599, 6213, 29901, 13, 4706, 1583, 3032, 5504, 29918, 4925, 29918, 2680, 29898, 3859, 29897, 13, 13, 1678, 822, 903, 265, 29918, 7218, 487, 5365, 29918, 2218, 6915, 29918, 3696, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 565, 1583, 3032, 11458, 29918, 361, 29918, 2696, 1220, 29901, 13, 9651, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 11458, 580, 13, 13, 1678, 822, 903, 5504, 29918, 4925, 29918, 2680, 29898, 1311, 29892, 2106, 29901, 9657, 29892, 338, 29918, 6915, 29918, 3696, 29922, 8824, 1125, 13, 4706, 1018, 29901, 13, 9651, 565, 1583, 3032, 5504, 29918, 7218, 487, 5365, 29918, 3859, 29898, 3859, 1125, 13, 18884, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 353, 1583, 3032, 7218, 487, 29890, 293, 29889, 657, 29918, 29888, 542, 3880, 29918, 1287, 3493, 29898, 1311, 3032, 7218, 487, 5365, 29918, 10525, 29897, 13, 13, 18884, 565, 451, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29901, 13, 462, 1678, 736, 13, 13, 18884, 5912, 29918, 978, 29892, 5912, 29918, 4144, 353, 1583, 3032, 657, 29918, 2680, 29918, 1643, 29918, 3888, 580, 13, 13, 18884, 565, 338, 29918, 6915, 29918, 3696, 29901, 13, 462, 1678, 11009, 29918, 2680, 29918, 978, 353, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 1839, 2680, 16215, 4592, 2033, 13, 462, 1678, 11009, 29918, 2680, 29918, 9006, 353, 5912, 29918, 9006, 29879, 29889, 657, 29898, 13082, 29918, 2680, 29918, 978, 29892, 525, 29890, 1028, 1495, 13, 13, 462, 1678, 1550, 1583, 3032, 2680, 29879, 29961, 29900, 29962, 2804, 11009, 29918, 2680, 29918, 9006, 29901, 13, 462, 4706, 1583, 3032, 2680, 29879, 29889, 23361, 29898, 29896, 29897, 13, 13, 18884, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 12038, 29898, 13, 462, 1678, 1583, 3032, 1643, 29889, 6506, 703, 29912, 4144, 17671, 5912, 29918, 4144, 467, 6506, 703, 29912, 2680, 29918, 978, 17671, 5912, 29918, 978, 29897, 13, 18884, 1723, 13, 13, 18884, 565, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 275, 25108, 7295, 13, 462, 1678, 1583, 3032, 4925, 29918, 2680, 29918, 726, 29889, 4294, 580, 13, 4706, 5174, 8960, 29901, 13, 9651, 12183, 29889, 11739, 703, 17776, 304, 2767, 4677, 487, 5365, 4660, 322, 11109, 2826, 2106, 1159, 13, 13, 1678, 822, 903, 657, 29918, 2680, 29918, 1643, 29918, 3888, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 7218, 487, 5365, 29918, 3859, 29889, 657, 877, 275, 29918, 29886, 15244, 742, 7700, 1125, 13, 9651, 5912, 29918, 978, 353, 525, 29925, 15244, 29915, 13, 9651, 5912, 29918, 4144, 353, 1583, 3032, 2680, 29918, 27078, 1839, 29886, 15244, 2033, 13, 4706, 25342, 451, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 29873, 488, 742, 7700, 1125, 13, 9651, 5912, 29918, 978, 353, 525, 29943, 417, 1218, 29915, 13, 9651, 5912, 29918, 4144, 353, 1583, 3032, 2680, 29918, 27078, 1839, 29888, 417, 1218, 2033, 13, 4706, 25342, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 27525, 1891, 29918, 7165, 742, 6213, 1125, 13, 9651, 5912, 29918, 978, 353, 525, 7976, 326, 3368, 29915, 13, 9651, 5912, 29918, 4144, 353, 1583, 3032, 2680, 29918, 27078, 1839, 27525, 3368, 2033, 13, 4706, 25342, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 29889, 657, 877, 3712, 542, 280, 29918, 7611, 742, 6213, 1125, 13, 9651, 5912, 29918, 978, 353, 525, 7185, 542, 280, 29915, 13, 9651, 5912, 29918, 4144, 353, 1583, 3032, 2680, 29918, 27078, 1839, 3712, 542, 280, 2033, 13, 4706, 1683, 29901, 13, 9651, 5912, 29918, 978, 353, 1583, 3032, 29888, 542, 3880, 29918, 1287, 3493, 1839, 2680, 16215, 4592, 2033, 13, 9651, 5912, 29918, 4144, 353, 1583, 3032, 2680, 29918, 27078, 29889, 657, 29898, 2680, 29918, 29879, 21040, 29918, 4878, 29961, 2680, 29918, 978, 1402, 525, 26690, 5912, 1495, 13, 13, 4706, 736, 5912, 29918, 978, 29892, 5912, 29918, 4144, 13, 13, 1678, 822, 903, 5504, 29918, 7218, 487, 5365, 29918, 3859, 29898, 1311, 29892, 4677, 487, 5365, 29918, 3859, 29901, 9657, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 10525, 29918, 26828, 299, 353, 679, 29918, 3712, 2105, 29918, 26828, 299, 29898, 524, 29898, 29984, 8801, 29889, 5080, 1204, 29898, 1311, 4961, 13, 9651, 1583, 3032, 7218, 487, 5365, 29918, 3859, 353, 4677, 487, 5365, 29918, 3859, 13, 13, 9651, 565, 1583, 3032, 7218, 487, 5365, 29918, 3859, 29901, 13, 18884, 1583, 3032, 7218, 487, 5365, 29918, 10525, 353, 1583, 3032, 7218, 487, 29890, 293, 29889, 657, 29918, 10525, 29918, 1609, 29918, 26828, 299, 29898, 1311, 3032, 7218, 487, 5365, 29918, 3859, 29892, 1583, 3032, 10525, 29918, 26828, 299, 29897, 13, 18884, 1583, 3032, 7218, 487, 5365, 29918, 1287, 22854, 353, 1583, 3032, 7218, 487, 29890, 293, 29889, 657, 29918, 1287, 22854, 29898, 1311, 3032, 7218, 487, 5365, 29918, 10525, 29897, 13, 18884, 736, 5852, 13, 4706, 5174, 20948, 29901, 13, 9651, 736, 7700, 13, 2 ]
level_18/level_18random.py
hermes-jr/adventofcode-in-python
0
86381
<filename>level_18/level_18random.py #!/usr/bin/python import copy import random WIDTH = 70 HEIGHT = 46 STEPS = 1000000 lights = [[0 for x in range(WIDTH)] for x in range(HEIGHT)] dark = '\x1b[32;40m#\x1b[0m' bright = '\x1b[32;1m#\x1b[0m' nocolor = '#' random.seed() for i in range(HEIGHT): for j in range(WIDTH): lights[i][j] = random.randint(0,1) nextgen = copy.deepcopy(lights) def neighbour_vals(x, y): for i in range(x - 1, x + 2): for j in range(y - 1, y + 2): if((i in range(HEIGHT) and j in range(WIDTH)) and (x != i or y != j)): # definitely need some sleep. why the fuck OR works here instead of AND?! yield lights[i][j] history = list() def animate(): global lights global nextgen global history for i in range(HEIGHT): for j in range(WIDTH): if( lights[i][j] == 1): if(sum(neighbour_vals(i, j)) not in (2, 3) ): nextgen[i][j] = 0 if( lights[i][j] == 0): if( sum(neighbour_vals(i, j)) == 3 ): nextgen[i][j] = 1 lights = copy.deepcopy(nextgen) if(len(history) > 7): history.pop(0) if(history[0] == history[6] or history[0] == history[5]): print("Endless loop detected, I quit.") quit() history.append(lights) for i in range(HEIGHT): line = '' for j in range(WIDTH): if(nextgen[i][j] == 1): line += nocolor else: line += '.' print("{0:3d}: {1}".format(i + 1, line)) for i in range(STEPS): if __debug__: print ("step {0:3d}".format(i + 1)) animate() print ("original {} lights on ".format( sum(map(sum, lights)) )) print ("nextgen {} lights on ".format( sum(map(sum, nextgen)) ))
[ 1, 529, 9507, 29958, 5563, 29918, 29896, 29947, 29914, 5563, 29918, 29896, 29947, 8172, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 5215, 3509, 13, 5215, 4036, 13, 13, 22574, 353, 29871, 29955, 29900, 13, 9606, 22530, 353, 29871, 29946, 29953, 13, 1254, 29923, 7024, 353, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 4366, 29879, 353, 5519, 29900, 363, 921, 297, 3464, 29898, 22574, 4638, 363, 921, 297, 3464, 29898, 9606, 22530, 4638, 13, 13, 26031, 353, 11297, 29916, 29896, 29890, 29961, 29941, 29906, 29936, 29946, 29900, 29885, 29937, 29905, 29916, 29896, 29890, 29961, 29900, 29885, 29915, 13, 1182, 523, 353, 11297, 29916, 29896, 29890, 29961, 29941, 29906, 29936, 29896, 29885, 29937, 29905, 29916, 29896, 29890, 29961, 29900, 29885, 29915, 13, 10763, 324, 272, 353, 16321, 29915, 13, 13, 8172, 29889, 26776, 580, 13, 1454, 474, 297, 3464, 29898, 9606, 22530, 1125, 13, 12, 1454, 432, 297, 3464, 29898, 22574, 1125, 13, 12, 12, 12, 4366, 29879, 29961, 29875, 3816, 29926, 29962, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29896, 29897, 13, 13, 4622, 1885, 353, 3509, 29889, 24535, 8552, 29898, 4366, 29879, 29897, 13, 13, 1753, 17647, 29918, 791, 29879, 29898, 29916, 29892, 343, 1125, 13, 12, 1454, 474, 297, 3464, 29898, 29916, 448, 29871, 29896, 29892, 921, 718, 29871, 29906, 1125, 13, 12, 12, 1454, 432, 297, 3464, 29898, 29891, 448, 29871, 29896, 29892, 343, 718, 29871, 29906, 1125, 13, 12, 12, 12, 361, 3552, 29875, 297, 3464, 29898, 9606, 22530, 29897, 322, 432, 297, 3464, 29898, 22574, 876, 322, 313, 29916, 2804, 474, 470, 343, 2804, 432, 22164, 396, 11630, 817, 777, 8709, 29889, 2020, 278, 285, 2707, 6323, 1736, 1244, 2012, 310, 5300, 29973, 29991, 13, 12, 12, 12, 12, 29891, 969, 26068, 29961, 29875, 3816, 29926, 29962, 13, 13, 18434, 353, 1051, 580, 13, 13, 1753, 26015, 7295, 13, 12, 10945, 26068, 13, 12, 10945, 2446, 1885, 13, 12, 10945, 4955, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9606, 22530, 1125, 13, 12, 12, 1454, 432, 297, 3464, 29898, 22574, 1125, 13, 12, 12, 12, 361, 29898, 26068, 29961, 29875, 3816, 29926, 29962, 1275, 29871, 29896, 1125, 13, 12, 12, 12, 12, 361, 29898, 2083, 29898, 484, 1141, 6526, 29918, 791, 29879, 29898, 29875, 29892, 432, 876, 451, 297, 313, 29906, 29892, 29871, 29941, 29897, 29871, 1125, 13, 12, 12, 12, 12, 12, 4622, 1885, 29961, 29875, 3816, 29926, 29962, 353, 29871, 29900, 13, 12, 12, 12, 361, 29898, 26068, 29961, 29875, 3816, 29926, 29962, 1275, 29871, 29900, 1125, 13, 12, 12, 12, 12, 361, 29898, 2533, 29898, 484, 1141, 6526, 29918, 791, 29879, 29898, 29875, 29892, 432, 876, 1275, 29871, 29941, 29871, 1125, 13, 12, 12, 12, 12, 12, 4622, 1885, 29961, 29875, 3816, 29926, 29962, 353, 29871, 29896, 13, 12, 13, 12, 4366, 29879, 353, 3509, 29889, 24535, 8552, 29898, 4622, 1885, 29897, 13, 13, 12, 361, 29898, 2435, 29898, 18434, 29897, 1405, 29871, 29955, 1125, 13, 12, 12, 18434, 29889, 7323, 29898, 29900, 29897, 13, 12, 12, 361, 29898, 18434, 29961, 29900, 29962, 1275, 4955, 29961, 29953, 29962, 470, 4955, 29961, 29900, 29962, 1275, 4955, 29961, 29945, 29962, 1125, 13, 12, 12, 12, 2158, 703, 5044, 2222, 2425, 17809, 29892, 306, 23283, 23157, 13, 12, 12, 12, 28358, 580, 13, 12, 18434, 29889, 4397, 29898, 4366, 29879, 29897, 13, 13, 12, 1454, 474, 297, 3464, 29898, 9606, 22530, 1125, 13, 12, 12, 1220, 353, 6629, 13, 12, 12, 1454, 432, 297, 3464, 29898, 22574, 1125, 13, 12, 12, 12, 361, 29898, 4622, 1885, 29961, 29875, 3816, 29926, 29962, 1275, 29871, 29896, 1125, 1196, 4619, 302, 542, 324, 272, 13, 12, 12, 12, 2870, 29901, 1196, 4619, 525, 6169, 13, 12, 12, 2158, 703, 29912, 29900, 29901, 29941, 29881, 6177, 426, 29896, 29913, 1642, 4830, 29898, 29875, 718, 29871, 29896, 29892, 1196, 876, 13, 13, 1454, 474, 297, 3464, 29898, 1254, 29923, 7024, 1125, 13, 12, 361, 4770, 8382, 1649, 29901, 1596, 4852, 10568, 426, 29900, 29901, 29941, 29881, 29913, 1642, 4830, 29898, 29875, 718, 29871, 29896, 876, 13, 12, 20131, 580, 13, 13, 2158, 4852, 13492, 6571, 26068, 373, 11393, 4830, 29898, 2533, 29898, 1958, 29898, 2083, 29892, 26068, 876, 29871, 876, 13, 2158, 4852, 4622, 1885, 6571, 26068, 373, 11393, 4830, 29898, 2533, 29898, 1958, 29898, 2083, 29892, 2446, 1885, 876, 29871, 876, 13, 2 ]
model-archiver/model_archiver/arg_parser.py
zmhassan/mxnet-model-server
1
178623
<reponame>zmhassan/mxnet-model-server # Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in compliance with the License. # A copy of the License is located at # http://www.apache.org/licenses/LICENSE-2.0 # or in the "license" file accompanying this file. This file is distributed # on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either # express or implied. See the License for the specific language governing # permissions and limitations under the License. """ This module parses the arguments given through the mxnet-model-server command-line. This is used by model-server at runtime. """ import argparse import os from .manifest_components.manifest import RuntimeType # noinspection PyTypeChecker class ArgParser(object): """ Argument parser for model-export-tool commands More detailed example is available at https://github.com/awslabs/mxnet-model-server/blob/master/README.md """ @staticmethod def export_model_args_parser(): """ Argument parser for mxnet-model-export """ parser_export = argparse.ArgumentParser(prog='model-archiver', description='Model Archiver Tool', formatter_class=argparse.RawTextHelpFormatter) parser_export.add_argument('--model-name', required=True, type=str, default=None, help='Exported model name. Exported file will be named as\n' 'model-name.mar and saved in current working directory if no --export-path is\n' 'specified, else it will be saved under the export path') parser_export.add_argument('--model-path', required=True, type=str, default=None, help='Path to the folder containing model related files.') parser_export.add_argument('--handler', required=True, dest="handler", type=str, default=None, help='Handler path to handle custom MMS inference logic.') parser_export.add_argument('--runtime', required=False, type=str, default=RuntimeType.PYTHON.value, choices=[s.value for s in RuntimeType], help='The runtime specifies which language to run your inference code on.\n' 'The default runtime is "python".') parser_export.add_argument('--export-path', required=False, type=str, default=os.getcwd(), help='Path where the exported .mar file will be saved. This is an optional\n' 'parameter. If --export-path is not specified, the file will be saved in the\n' 'current working directory. ') parser_export.add_argument('--archive-format', required=False, type=str, default="default", choices=["tgz", "no-archive", "default"], help='The format in which the model artifacts are archived.\n' '"tgz": This creates the model-archive in <model-name>.tar.gz format.\n' 'If platform hosting MMS requires model-artifacts to be in ".tar.gz"\n' 'use this option.\n' '"no-archive": This option creates an non-archived version of model artifacts\n' 'at "export-path/{model-name}" location. As a result of this choice, \n' 'MANIFEST file will be created at "export-path/{model-name}" location\n' 'without archiving these model files\n' '"default": This creates the model-archive in <model-name>.mar format.\n' 'This is the default archiving format. Models archived in this format\n' 'will be readily hostable on native MMS.\n') parser_export.add_argument('-f', '--force', required=False, action='store_true', help='When the -f or --force flag is specified, an existing .mar file with same\n' 'name as that provided in --model-name in the path specified by --export-path\n' 'will overwritten') parser_export.add_argument('-c', '--convert', required=False, action='store_true', help='When this option is used, model-archiver looks for special files and tries\n' 'preprocesses them. For example, if this option is chosen when running\n' 'model-archiver tool on a model with ".onnx" extension, the tool will try and\n' 'convert ".onnx" model into an MXNet model.') return parser_export
[ 1, 529, 276, 1112, 420, 29958, 14018, 29882, 465, 273, 29914, 16838, 1212, 29899, 4299, 29899, 2974, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29955, 16631, 29889, 510, 29892, 9266, 29889, 470, 967, 23736, 1078, 29889, 2178, 26863, 2538, 9841, 29889, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 2564, 13, 29937, 887, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 319, 3509, 310, 278, 19245, 338, 5982, 472, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 470, 297, 278, 376, 506, 1947, 29908, 934, 10259, 1384, 292, 445, 934, 29889, 910, 934, 338, 13235, 13, 29937, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 13, 29937, 4653, 470, 2411, 2957, 29889, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 13, 29937, 11239, 322, 27028, 1090, 278, 19245, 29889, 13, 13, 15945, 29908, 13, 4013, 3883, 610, 29879, 267, 278, 6273, 2183, 1549, 278, 286, 29916, 1212, 29899, 4299, 29899, 2974, 1899, 29899, 1220, 29889, 910, 338, 1304, 491, 1904, 29899, 2974, 13, 271, 10073, 29889, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 3166, 869, 29135, 29918, 14036, 29889, 29135, 1053, 24875, 1542, 13, 13, 13, 29937, 694, 1144, 27988, 10772, 1542, 5596, 261, 13, 1990, 11842, 11726, 29898, 3318, 1125, 13, 13, 1678, 9995, 13, 1678, 23125, 13812, 363, 1904, 29899, 15843, 29899, 10154, 8260, 13, 1678, 5853, 13173, 1342, 338, 3625, 472, 2045, 597, 3292, 29889, 510, 29914, 1450, 2536, 6897, 29914, 16838, 1212, 29899, 4299, 29899, 2974, 29914, 10054, 29914, 6207, 29914, 16310, 2303, 29889, 3487, 13, 1678, 9995, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 5609, 29918, 4299, 29918, 5085, 29918, 16680, 7295, 13, 13, 4706, 9995, 23125, 13812, 363, 286, 29916, 1212, 29899, 4299, 29899, 15843, 13, 4706, 9995, 13, 13, 4706, 13812, 29918, 15843, 353, 1852, 5510, 29889, 15730, 11726, 29898, 29097, 2433, 4299, 29899, 1279, 2147, 742, 6139, 2433, 3195, 2595, 2147, 21704, 742, 13, 462, 462, 18884, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 22131, 1626, 29648, 18522, 29897, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 4299, 29899, 978, 742, 13, 462, 462, 259, 3734, 29922, 5574, 29892, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 29922, 8516, 29892, 13, 462, 462, 259, 1371, 2433, 26382, 287, 1904, 1024, 29889, 1222, 637, 287, 934, 674, 367, 4257, 408, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 4299, 29899, 978, 29889, 3034, 322, 7160, 297, 1857, 1985, 3884, 565, 694, 1192, 15843, 29899, 2084, 338, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 6550, 2164, 29892, 1683, 372, 674, 367, 7160, 1090, 278, 5609, 2224, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 4299, 29899, 2084, 742, 13, 462, 462, 259, 3734, 29922, 5574, 29892, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 29922, 8516, 29892, 13, 462, 462, 259, 1371, 2433, 2605, 304, 278, 4138, 6943, 1904, 4475, 2066, 29889, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 13789, 742, 13, 462, 462, 259, 3734, 29922, 5574, 29892, 13, 462, 462, 259, 2731, 543, 13789, 613, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 29922, 8516, 29892, 13, 462, 462, 259, 1371, 2433, 4598, 2224, 304, 4386, 2888, 341, 4345, 27262, 5900, 29889, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 15634, 742, 13, 462, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 29922, 7944, 1542, 29889, 20055, 4690, 1164, 29889, 1767, 29892, 13, 462, 462, 259, 19995, 11759, 29879, 29889, 1767, 363, 269, 297, 24875, 1542, 1402, 13, 462, 462, 259, 1371, 2433, 1576, 10073, 1580, 11057, 607, 4086, 304, 1065, 596, 27262, 775, 373, 7790, 29876, 29915, 13, 462, 462, 4706, 525, 1576, 2322, 10073, 338, 376, 4691, 1642, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 15843, 29899, 2084, 742, 13, 462, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 29922, 359, 29889, 657, 29883, 9970, 3285, 13, 462, 462, 259, 1371, 2433, 2605, 988, 278, 5609, 287, 869, 3034, 934, 674, 367, 7160, 29889, 910, 338, 385, 13136, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 15501, 29889, 960, 1192, 15843, 29899, 2084, 338, 451, 6790, 29892, 278, 934, 674, 367, 7160, 297, 278, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 3784, 1985, 3884, 29889, 25710, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 489, 10867, 29899, 4830, 742, 13, 462, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 462, 259, 1134, 29922, 710, 29892, 13, 462, 462, 259, 2322, 543, 4381, 613, 13, 462, 462, 259, 19995, 29922, 3366, 29873, 18828, 613, 376, 1217, 29899, 10867, 613, 376, 4381, 12436, 13, 462, 462, 259, 1371, 2433, 1576, 3402, 297, 607, 278, 1904, 24238, 29879, 526, 3190, 2347, 7790, 29876, 29915, 13, 462, 462, 4706, 18793, 29873, 18828, 1115, 910, 10017, 278, 1904, 29899, 10867, 297, 529, 4299, 29899, 978, 15513, 12637, 29889, 18828, 3402, 7790, 29876, 29915, 13, 462, 462, 4706, 525, 3644, 7481, 23376, 341, 4345, 6858, 1904, 29899, 8813, 29879, 304, 367, 297, 11393, 12637, 29889, 18828, 26732, 29876, 29915, 13, 462, 462, 4706, 525, 1509, 445, 2984, 7790, 29876, 29915, 13, 462, 462, 4706, 18793, 1217, 29899, 10867, 1115, 910, 2984, 10017, 385, 1661, 29899, 1279, 2347, 1873, 310, 1904, 24238, 29879, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 271, 376, 15843, 29899, 2084, 19248, 4299, 29899, 978, 5038, 4423, 29889, 1094, 263, 1121, 310, 445, 7348, 29892, 320, 29876, 29915, 13, 462, 462, 4706, 525, 27616, 6545, 29923, 1254, 934, 674, 367, 2825, 472, 376, 15843, 29899, 2084, 19248, 4299, 29899, 978, 5038, 4423, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 14037, 3190, 4357, 1438, 1904, 2066, 29905, 29876, 29915, 13, 462, 462, 4706, 18793, 4381, 1115, 910, 10017, 278, 1904, 29899, 10867, 297, 529, 4299, 29899, 978, 15513, 3034, 3402, 7790, 29876, 29915, 13, 462, 462, 4706, 525, 4013, 338, 278, 2322, 3190, 4357, 3402, 29889, 3382, 1379, 3190, 2347, 297, 445, 3402, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 14043, 367, 28520, 3495, 519, 373, 7531, 341, 4345, 7790, 29876, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 29899, 29888, 742, 525, 489, 10118, 742, 13, 462, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 462, 259, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 462, 259, 1371, 2433, 10401, 278, 448, 29888, 470, 1192, 10118, 7353, 338, 6790, 29892, 385, 5923, 869, 3034, 934, 411, 1021, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 978, 408, 393, 4944, 297, 1192, 4299, 29899, 978, 297, 278, 2224, 6790, 491, 1192, 15843, 29899, 2084, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 14043, 975, 17625, 1495, 13, 13, 4706, 13812, 29918, 15843, 29889, 1202, 29918, 23516, 877, 29899, 29883, 742, 525, 489, 13441, 742, 13, 462, 462, 259, 3734, 29922, 8824, 29892, 13, 462, 462, 259, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 462, 259, 1371, 2433, 10401, 445, 2984, 338, 1304, 29892, 1904, 29899, 1279, 2147, 3430, 363, 4266, 2066, 322, 14335, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 1457, 5014, 267, 963, 29889, 1152, 1342, 29892, 565, 445, 2984, 338, 10434, 746, 2734, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 4299, 29899, 1279, 2147, 5780, 373, 263, 1904, 411, 11393, 3409, 29916, 29908, 6081, 29892, 278, 5780, 674, 1018, 322, 29905, 29876, 29915, 13, 462, 462, 4706, 525, 13441, 11393, 3409, 29916, 29908, 1904, 964, 385, 341, 29990, 6779, 1904, 29889, 1495, 13, 13, 13, 4706, 736, 13812, 29918, 15843, 13, 2 ]
Menu.py
OaksTree1/PyPrac
0
1603765
from Database.database import dataBase from Models.Blog import blog class Menu(object): def __init__(self): self.user = raw_input("Enter your username: ") self.user_have_blog = None if self._user_account(): print("Welcome Back {user}".format(user = self.user)) else: self._register_user() def run_menu(self): read_or_write = raw_input("Do you want to read (R) or write(W):") if(read_or_write == "R"): self._list_blogs() self._view_blogs() elif(read_or_write == "W"): self.user_have_blog.new_post() else: print("Thank you for Trying") def _user_account(self): blogsearch = dataBase.find_one(collection='Blogs',query= {'author': self.user}) if blogsearch is not None: self.user_have_blog = blog.From_mongo(blogsearch['id']) return True else: return False def _register_user(self): title = raw_input("enter Post title") description = raw_input("enter post description") blog_write = blog(author=self.user, title = title, description = description) blog_write.save_to_mongo() self.user_have_blog = blog_write def _list_blogs(self): AllBlogs = dataBase.find(collection='Blogs', query={}) for dablog in AllBlogs: print("ID: {id}, :Title: {title}, Author: {author}".format(id = dablog['id'], title = dablog['title'], author = dablog['author'])) def _view_blogs(self): blog_to_see = raw_input("What is the ID of the blog you want:") blogsee = blog.From_mongo(blog_to_see) postsee = blogsee.get_post() for dapost in postsee: print("Date: {date}, Title: {title}\n\n{content}".format(date = dapost['date_created'], title = dapost['title'], content = dapost['content']))
[ 1, 515, 5470, 29889, 9803, 1053, 848, 5160, 13, 3166, 3382, 1379, 29889, 29933, 1188, 1053, 12618, 13, 13, 1990, 20019, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 1792, 353, 10650, 29918, 2080, 703, 10399, 596, 8952, 29901, 16521, 13, 4706, 1583, 29889, 1792, 29918, 17532, 29918, 7312, 353, 6213, 13, 4706, 565, 1583, 3032, 1792, 29918, 10149, 7295, 13, 9651, 1596, 703, 28862, 2763, 7437, 426, 1792, 29913, 1642, 4830, 29898, 1792, 353, 1583, 29889, 1792, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 9573, 29918, 1792, 580, 13, 1678, 822, 1065, 29918, 6510, 29898, 1311, 1125, 13, 4706, 1303, 29918, 272, 29918, 3539, 353, 10650, 29918, 2080, 703, 6132, 366, 864, 304, 1303, 313, 29934, 29897, 470, 2436, 29898, 29956, 1125, 1159, 13, 4706, 565, 29898, 949, 29918, 272, 29918, 3539, 1275, 376, 29934, 29908, 1125, 13, 9651, 1583, 3032, 1761, 29918, 25762, 580, 13, 9651, 1583, 3032, 1493, 29918, 25762, 580, 13, 4706, 25342, 29898, 949, 29918, 272, 29918, 3539, 1275, 376, 29956, 29908, 1125, 13, 9651, 1583, 29889, 1792, 29918, 17532, 29918, 7312, 29889, 1482, 29918, 2490, 580, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 25271, 366, 363, 24428, 1159, 13, 13, 1678, 822, 903, 1792, 29918, 10149, 29898, 1311, 1125, 13, 4706, 12618, 4478, 353, 848, 5160, 29889, 2886, 29918, 650, 29898, 10855, 2433, 29933, 20756, 742, 1972, 29922, 11117, 8921, 2396, 1583, 29889, 1792, 1800, 13, 4706, 565, 12618, 4478, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 1792, 29918, 17532, 29918, 7312, 353, 12618, 29889, 4591, 29918, 29885, 7443, 29898, 7312, 4478, 1839, 333, 11287, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 1678, 822, 903, 9573, 29918, 1792, 29898, 1311, 1125, 13, 4706, 3611, 353, 10650, 29918, 2080, 703, 5893, 4918, 3611, 1159, 13, 4706, 6139, 353, 10650, 29918, 2080, 703, 5893, 1400, 6139, 1159, 13, 4706, 12618, 29918, 3539, 353, 12618, 29898, 8921, 29922, 1311, 29889, 1792, 29892, 3611, 353, 3611, 29892, 6139, 353, 6139, 29897, 13, 4706, 12618, 29918, 3539, 29889, 7620, 29918, 517, 29918, 29885, 7443, 580, 13, 4706, 1583, 29889, 1792, 29918, 17532, 29918, 7312, 353, 12618, 29918, 3539, 13, 13, 1678, 822, 903, 1761, 29918, 25762, 29898, 1311, 1125, 13, 4706, 2178, 29933, 20756, 353, 848, 5160, 29889, 2886, 29898, 10855, 2433, 29933, 20756, 742, 2346, 3790, 1800, 13, 4706, 363, 270, 370, 1188, 297, 2178, 29933, 20756, 29901, 13, 9651, 1596, 703, 1367, 29901, 426, 333, 1118, 584, 7030, 29901, 426, 3257, 1118, 13361, 29901, 426, 8921, 29913, 1642, 4830, 29898, 333, 353, 270, 370, 1188, 1839, 333, 7464, 3611, 353, 270, 370, 1188, 1839, 3257, 7464, 4148, 353, 270, 370, 1188, 1839, 8921, 25901, 13, 13, 1678, 822, 903, 1493, 29918, 25762, 29898, 1311, 1125, 13, 4706, 12618, 29918, 517, 29918, 4149, 353, 10650, 29918, 2080, 703, 5618, 338, 278, 3553, 310, 278, 12618, 366, 864, 29901, 1159, 13, 4706, 12618, 4149, 353, 12618, 29889, 4591, 29918, 29885, 7443, 29898, 7312, 29918, 517, 29918, 4149, 29897, 13, 4706, 1400, 4149, 353, 12618, 4149, 29889, 657, 29918, 2490, 580, 13, 13, 4706, 363, 270, 481, 520, 297, 1400, 4149, 29901, 13, 9651, 1596, 703, 2539, 29901, 426, 1256, 1118, 18527, 29901, 426, 3257, 1012, 29876, 29905, 29876, 29912, 3051, 29913, 1642, 4830, 29898, 1256, 353, 270, 481, 520, 1839, 1256, 29918, 11600, 7464, 3611, 353, 270, 481, 520, 1839, 3257, 7464, 2793, 353, 270, 481, 520, 1839, 3051, 25901, 13, 13, 13, 13, 13, 2 ]
tests/test_tokenizer.py
cd109/scrappybara
0
49489
<reponame>cd109/scrappybara import unittest from scrappybara.preprocessing.tokenizer import Tokenizer _TOKENIZE = Tokenizer() class TestTokenizer(unittest.TestCase): # BLOCKS # --------------------------------------------------------------------------> def test_indirect_speech_blocks(self): self.assertEqual('Well , he said ༺1༻'.split(), _TOKENIZE('Well, he said ༺1༻')) self.assertEqual('⦅1⦆ Well , he said ༺1༻'.split(), _TOKENIZE('⦅1⦆ Well, he said ༺1༻')) # SHORT TEXT # --------------------------------------------------------------------------> def test_split_special_words(self): self.assertEqual('I can not do that .'.split(), _TOKENIZE('I cannot do that.')) self.assertEqual('Can not do that !'.split(), _TOKENIZE('Cannot do that!')) def test_links(self): self.assertEqual('domain.com'.split(), _TOKENIZE('domain.com')) self.assertEqual('Cellucor.com'.split(), _TOKENIZE('Cellucor.com')) self.assertEqual('DOMAIN.COM'.split(), _TOKENIZE('DOMAIN.COM')) self.assertEqual('sub.domain.com.au'.split(), _TOKENIZE('sub.domain.com.au')) self.assertEqual('sub.domain123.com.au'.split(), _TOKENIZE('sub.domain123.com.au')) self.assertEqual('<EMAIL>'.split(), _TOKENIZE('<EMAIL>')) self.assertEqual('<EMAIL>'.split(), _TOKENIZE('<EMAIL>')) self.assertEqual('tacos.pic.twitter.com/Q4usgzGMHq'.split(), _TOKENIZE('tacos.pic.twitter.com/Q4usgzGMHq')) def test_dots_single_tokens_nosplit(self): self.assertEqual('a.'.split(), _TOKENIZE('a.')) self.assertEqual('.end'.split(), _TOKENIZE('.end')) self.assertEqual('.End'.split(), _TOKENIZE('.End')) self.assertEqual('1 .'.split(), _TOKENIZE('1.')) self.assertEqual('.11'.split(), _TOKENIZE('.11')) self.assertEqual('1.deliver'.split(), _TOKENIZE('1.deliver')) self.assertEqual('1.Deliver'.split(), _TOKENIZE('1.Deliver')) self.assertEqual('deliver.1'.split(), _TOKENIZE('deliver.1')) self.assertEqual('deliveR.1'.split(), _TOKENIZE('deliveR.1')) self.assertEqual('.deliver'.split(), _TOKENIZE('.deliver')) self.assertEqual('.Deliver'.split(), _TOKENIZE('.Deliver')) self.assertEqual('aaa.deliver'.split(), _TOKENIZE('aaa.deliver')) self.assertEqual('aaA.Deliver'.split(), _TOKENIZE('aaA.Deliver')) self.assertEqual('$1.3M'.split(), _TOKENIZE('$1.3M')) self.assertEqual('1.1'.split(), _TOKENIZE('1.1')) self.assertEqual('123.123'.split(), _TOKENIZE('123.123')) self.assertEqual('123.123.1'.split(), _TOKENIZE('123.123.1')) self.assertEqual('1.1.1.1'.split(), _TOKENIZE('1.1.1.1')) self.assertEqual('A.B.1.C'.split(), _TOKENIZE('A.B.1.C')) self.assertEqual('A.B.C'.split(), _TOKENIZE('A.B.C')) self.assertEqual('A.B.C.'.split(), _TOKENIZE('A.B.C.')) self.assertEqual('e.g.'.split(), _TOKENIZE('e.g.')) self.assertEqual('e.g'.split(), _TOKENIZE('e.g')) self.assertEqual('A.A'.split(), _TOKENIZE('A.A')) self.assertEqual('U.S.'.split(), _TOKENIZE('U.S.')) self.assertEqual('u.s.'.split(), _TOKENIZE('u.s.')) self.assertEqual('1.A'.split(), _TOKENIZE('1.A')) self.assertEqual('A.1'.split(), _TOKENIZE('A.1')) self.assertEqual('I1.I0I'.split(), _TOKENIZE('I1.I0I')) self.assertEqual('items.101'.split(), _TOKENIZE('items.101')) self.assertEqual('items.I0I.A'.split(), _TOKENIZE('items.I0I.A')) def test_multiple_dots_split(self): self.assertEqual('a new ... Sentence'.split(), _TOKENIZE('a new... Sentence')) self.assertEqual('bla ...'.split(), _TOKENIZE('bla...')) def test_multiple_sentence_enders(self): self.assertEqual('a new !!! Sentence'.split(), _TOKENIZE('a new!!! Sentence')) self.assertEqual('a new ?? Sentence'.split(), _TOKENIZE('a new?? Sentence')) self.assertEqual('a new ??! Sentence'.split(), _TOKENIZE('a new??! Sentence')) def test_dots_split(self): self.assertEqual('a new . Sentence'.split(), _TOKENIZE('a new.Sentence')) self.assertEqual('December 4 . Sentence'.split(), _TOKENIZE('December 4. Sentence')) self.assertEqual('try mindfulchef.com . And this .'.split(), _TOKENIZE('try mindfulchef.com. And this.')) self.assertEqual('a new . Sentence'.split(), _TOKENIZE('a new. Sentence')) self.assertEqual('Fine Arts . She'.split(), _TOKENIZE('Fine Arts. She')) self.assertEqual('in june 1962 . Blabla'.split(), _TOKENIZE('in june 1962. Blabla')) self.assertEqual('information etc . SVN , NN'.split(), _TOKENIZE('information etc. SVN, NN')) def test_dots_nosplit(self): self.assertEqual('use .NET'.split(), _TOKENIZE('use .NET')) self.assertEqual('a new.sentence'.split(), _TOKENIZE('a new.sentence')) self.assertEqual('a new .sentence'.split(), _TOKENIZE('a new .sentence')) self.assertEqual('a new. sentence'.split(), _TOKENIZE('a new. sentence')) self.assertEqual('market in 2015. includes'.split(), _TOKENIZE('market in 2015. includes')) self.assertEqual('the 69th regt. ,'.split(), _TOKENIZE('the 69th regt.,')) self.assertEqual('the 69th regt. :'.split(), _TOKENIZE('the 69th regt.:')) self.assertEqual('the 69th regt. ;'.split(), _TOKENIZE('the 69th regt.;')) self.assertEqual('the 69th regt . )'.split(), _TOKENIZE('the 69th regt.)')) self.assertEqual('a srgt . ( born )'.split(), _TOKENIZE('a srgt. (born)')) self.assertEqual('4. bought'.split(), _TOKENIZE('4. bought')) self.assertEqual('4 . I bought'.split(), _TOKENIZE('4. I bought')) self.assertEqual('A. I bought'.split(), _TOKENIZE('A. I bought')) self.assertEqual('A. I bought A. I bought'.split(), _TOKENIZE('A. I bought A. I bought')) self.assertEqual('1.A. I bought'.split(), _TOKENIZE('1.A. I bought')) self.assertEqual('1.A I bought'.split(), _TOKENIZE('1.A I bought')) self.assertEqual('( 1 . Todo Cambia )'.split(), _TOKENIZE('(1. Todo Cambia)')) self.assertEqual('( 1. todo )'.split(), _TOKENIZE('(1. todo)')) self.assertEqual('manuf. comm. strategies'.split(), _TOKENIZE('manuf. comm. strategies')) self.assertEqual('tech ASP .NET'.split(), _TOKENIZE('tech ASP .NET')) self.assertEqual('items is N. shore'.split(), _TOKENIZE('items is N. shore')) self.assertEqual('his name is <NAME>'.split(), _TOKENIZE('his name is <NAME>')) self.assertEqual('his name is a. gray'.split(), _TOKENIZE('his name is a. gray')) self.assertEqual('Engage U.S. donors'.split(), _TOKENIZE('Engage U.S. donors')) self.assertEqual('the min. is 3'.split(), _TOKENIZE('the min. is 3')) self.assertEqual('the Bld. is'.split(), _TOKENIZE('the Bld. is')) self.assertEqual('the BLD. is'.split(), _TOKENIZE('the BLD. is')) self.assertEqual('he is dr. Robin'.split(), _TOKENIZE('he is dr. Robin')) self.assertEqual('Dr. Robin'.split(), _TOKENIZE('Dr. Robin')) self.assertEqual('13th ed. New York'.split(), _TOKENIZE('13th ed. New York')) self.assertEqual('he is Sr. Programmer'.split(), _TOKENIZE('he is Sr. Programmer')) self.assertEqual('bullet 1. do this'.split(), _TOKENIZE('bullet 1. do this')) self.assertEqual('bullet 01. do this'.split(), _TOKENIZE('bullet 01. do this')) self.assertEqual('bullet.2 do this'.split(), _TOKENIZE('bullet.2 do this')) self.assertEqual('of .20 inch'.split(), _TOKENIZE('of .20 inch')) self.assertEqual('a. b. ('.split(), _TOKENIZE('a. b. (')) self.assertEqual('an n. g. :'.split(), _TOKENIZE('an n. g. :')) self.assertEqual('in u.s. !'.split(), _TOKENIZE('in u.s. !')) self.assertEqual(', vols. :'.split(), _TOKENIZE(', vols. :')) self.assertEqual('a volume . "'.split(), _TOKENIZE('a volume. "')) self.assertEqual("a volume . '".split(), _TOKENIZE("a volume. '")) self.assertEqual('a volume . ('.split(), _TOKENIZE('a volume. (')) self.assertEqual('a volume . )'.split(), _TOKENIZE('a volume. )')) self.assertEqual('a volume . ['.split(), _TOKENIZE('a volume. [')) self.assertEqual('a volume . ]'.split(), _TOKENIZE('a volume. ]')) self.assertEqual('a volume . {'.split(), _TOKENIZE('a volume. {')) self.assertEqual('a volume . }'.split(), _TOKENIZE('a volume. }')) self.assertEqual('a volume . |'.split(), _TOKENIZE('a volume. |')) self.assertEqual('a volume . *'.split(), _TOKENIZE('a volume. *')) def test_exclamation_points_split(self): self.assertEqual('this is you ! Omg'.split(), _TOKENIZE('this is you! Omg')) self.assertEqual('this is you !'.split(), _TOKENIZE('this is you!')) self.assertEqual('this is you !!!'.split(), _TOKENIZE('this is you!!!')) self.assertEqual('my man ! - marcus'.split(), _TOKENIZE('my man! - marcus')) def test_exclamation_points_nosplit(self): self.assertEqual('innovate ! project'.split(), _TOKENIZE('innovate! project')) def test_non_ambiguous_seperators(self): self.assertEqual('this [ is ] you'.split(), _TOKENIZE('this [is] you')) self.assertEqual('this ( is ) you'.split(), _TOKENIZE('this (is) you')) self.assertEqual('this { is } you'.split(), _TOKENIZE('this {is} you')) self.assertEqual('this is you ? omg'.split(), _TOKENIZE('this is you? omg')) self.assertEqual('this is you ???'.split(), _TOKENIZE('this is you???')) self.assertEqual(r'me \ you'.split(), _TOKENIZE(r'me\you')) self.assertEqual('me | you'.split(), _TOKENIZE('me|you')) self.assertEqual('the " cat " jumps'.split(), _TOKENIZE('the "cat" jumps')) self.assertEqual('the cat ; jumps'.split(), _TOKENIZE('the cat; jumps')) self.assertEqual('the cat : jumps'.split(), _TOKENIZE('the cat: jumps')) self.assertEqual('failures : include'.split(), _TOKENIZE('failures :include')) self.assertEqual('sell > 12'.split(), _TOKENIZE('sell >12')) self.assertEqual('sell < 12'.split(), _TOKENIZE('sell <12')) self.assertEqual('ca = breakfast'.split(), _TOKENIZE('ca=breakfast')) self.assertEqual('targets ='.split(), _TOKENIZE('targets=')) def test_lt_gt(self): self.assertEqual('sell <-- 12'.split(), _TOKENIZE('sell <-- 12')) # ?? self.assertEqual('sell -> 12'.split(), _TOKENIZE('sell -> 12')) self.assertEqual('This is < me >'.split(), _TOKENIZE('This is <me>')) self.assertEqual('Sell > 50%'.split(), _TOKENIZE('Sell >50%')) self.assertEqual('Sell < 50%'.split(), _TOKENIZE('Sell <50%')) def test_star(self): self.assertEqual('discussion * integration'.split(), _TOKENIZE('discussion*integration')) self.assertEqual('discussion * integration'.split(), _TOKENIZE('discussion****integration')) self.assertEqual('123*123'.split(), _TOKENIZE('123*123')) self.assertEqual('123*abc'.split(), _TOKENIZE('123*abc')) def test_plus(self): self.assertEqual('responsibilities + timeline'.split(), _TOKENIZE('responsibilities+timeline')) self.assertEqual('hagen + greg + kris'.split(), _TOKENIZE('hagen+greg+kris')) self.assertEqual('LTED + Wifi + BLE + Secret'.split(), _TOKENIZE(' LTED+Wifi+BLE+Secret ')) self.assertEqual('3+ at'.split(), _TOKENIZE('3+at')) self.assertEqual('312+ at'.split(), _TOKENIZE('312+at')) self.assertEqual('aa+'.split(), _TOKENIZE('aa+')) def test_ampercases(self): self.assertEqual('new & old'.split(), _TOKENIZE('new&old')) self.assertEqual('New & Old'.split(), _TOKENIZE('New&Old')) self.assertEqual('NEW&OLD'.split(), _TOKENIZE('NEW&OLD')) self.assertEqual('t&cs'.split(), _TOKENIZE('t&cs')) self.assertEqual('T&CS'.split(), _TOKENIZE('T&CS')) self.assertEqual('schedule & provide'.split(), _TOKENIZE('schedule& provide')) self.assertEqual('schedule & provide'.split(), _TOKENIZE('schedule& provide')) self.assertEqual('invest R&D'.split(), _TOKENIZE('invest R&D')) self.assertEqual('invest R&D'.split(), _TOKENIZE('invest R &D')) self.assertEqual('invest R&D'.split(), _TOKENIZE('invest R& D')) self.assertEqual('invest R&D'.split(), _TOKENIZE('invest R & D')) self.assertEqual('invest R & 1'.split(), _TOKENIZE('invest R &1')) self.assertEqual('invest R & DD'.split(), _TOKENIZE('invest R& DD')) self.assertEqual('R&D lab'.split(), _TOKENIZE('R&D lab')) self.assertEqual('R&D lab'.split(), _TOKENIZE('R& D lab')) self.assertEqual('R&D lab'.split(), _TOKENIZE('R &D lab')) self.assertEqual('R&D lab'.split(), _TOKENIZE('R & D lab')) self.assertEqual('invest R&D lab'.split(), _TOKENIZE('invest R&D lab')) self.assertEqual('invest R&D lab'.split(), _TOKENIZE('invest R &D lab')) self.assertEqual('invest R&D lab'.split(), _TOKENIZE('invest R& D lab')) self.assertEqual('invest R&D lab'.split(), _TOKENIZE('invest R & D lab')) self.assertEqual('invest AR&D lab'.split(), _TOKENIZE('invest A R & D lab')) self.assertEqual('invest R&DA lab'.split(), _TOKENIZE('invest R & D A lab')) self.assertEqual('invest RR & R2 A lab'.split(), _TOKENIZE('invest RR & R2 A lab')) self.assertEqual('kitchen & utility'.split(), _TOKENIZE('kitchen&utility')) def test_slashes(self): self.assertEqual('10/10/2010'.split(), _TOKENIZE('10/10/2010')) self.assertEqual('b2b / b2c'.split(), _TOKENIZE('b2b/b2c')) self.assertEqual('me / you'.split(), _TOKENIZE('me/you')) self.assertEqual('me / you'.split(), _TOKENIZE('me /you')) self.assertEqual('me / you'.split(), _TOKENIZE('me/ you')) self.assertEqual('/ external'.split(), _TOKENIZE('/external')) self.assertEqual('p/a'.split(), _TOKENIZE('p/a')) self.assertEqual('A/B'.split(), _TOKENIZE('A/B')) self.assertEqual('A/'.split(), _TOKENIZE('A/')) self.assertEqual('/B'.split(), _TOKENIZE('/B')) def test_emdashes(self): self.assertEqual('- this'.split(), _TOKENIZE('–this')) def test_percentage(self): self.assertEqual('%12'.split(), _TOKENIZE('%12')) self.assertEqual('12%'.split(), _TOKENIZE('12%')) self.assertEqual('% savings'.split(), _TOKENIZE('%savings')) self.assertEqual('save % savings'.split(), _TOKENIZE('save%savings')) def test_colon(self): self.assertEqual('example : bla'.split(), _TOKENIZE('example: bla')) self.assertEqual('raise Q1 : Raise 1$'.split(), _TOKENIZE('raise Q1: Raise 1$')) self.assertEqual('support : revise'.split(), _TOKENIZE('support:revise')) self.assertEqual('payroll : hr'.split(), _TOKENIZE('payroll:hr')) self.assertEqual('Support : Revise'.split(), _TOKENIZE('Support:Revise')) self.assertEqual('re:invent'.split(), _TOKENIZE('re:invent')) self.assertEqual('conduct 1:1s'.split(), _TOKENIZE('conduct 1:1s')) self.assertEqual('ISO 123:123'.split(), _TOKENIZE('ISO 123:123')) self.assertEqual('A:B'.split(), _TOKENIZE('A:B')) self.assertEqual('step : 703'.split(), _TOKENIZE('step:703')) self.assertEqual('Sell 12 :'.split(), _TOKENIZE('Sell 12:')) self.assertEqual('Strategy : HR'.split(), _TOKENIZE('Strategy:HR')) self.assertEqual('2 : HR'.split(), _TOKENIZE('2:HR')) self.assertEqual('12243 : engage'.split(), _TOKENIZE('12243:engage')) def test_arrows(self): self.assertEqual('Sell 12->23'.split(), _TOKENIZE('Sell 12->23')) self.assertEqual('Sell 12 > 23'.split(), _TOKENIZE('Sell 12>23')) self.assertEqual('a => b'.split(), _TOKENIZE('a = > b')) self.assertEqual('x >= 12.5'.split(), _TOKENIZE(' x > = 12.5')) self.assertEqual('x <= 12.5'.split(), _TOKENIZE(' x < = 12.5')) def test_comas(self): self.assertEqual('hello , hi'.split(), _TOKENIZE('hello, hi')) self.assertEqual('123 , all good'.split(), _TOKENIZE('123, all good')) self.assertEqual('all good , 123'.split(), _TOKENIZE('all good,123')) self.assertEqual('123,123'.split(), _TOKENIZE('123,123')) def test_single_quotes(self): self.assertEqual("Rocco 's blob".split(), _TOKENIZE("Rocco 's blob")) self.assertEqual("His name is ' Rob ' bob".split(), _TOKENIZE("His name is 'Rob' bob")) self.assertEqual("His name is Rob ' bob '".split(), _TOKENIZE("His name is Rob 'bob'")) self.assertEqual("launch ' go live ' strategy".split(), _TOKENIZE("launch 'go live'strategy")) self.assertEqual("james o'hare".split(), _TOKENIZE("james o'hare")) self.assertEqual("' proposal".split(), _TOKENIZE("'proposal")) self.assertEqual('Deliver 4ft'.split(), _TOKENIZE("Deliver 4'")) self.assertEqual('Deliver 4in'.split(), _TOKENIZE('Deliver 4"')) self.assertEqual('Deliver 4ft4in'.split(), _TOKENIZE('Deliver 4\'4"')) self.assertEqual("' we will run items again '".split(), _TOKENIZE("'we will run items again'")) self.assertEqual("ceo order ' macbook pro '".split(), _TOKENIZE("ceo order 'macbook pro'")) self.assertEqual("rock 'n' roll".split(), _TOKENIZE("rock 'n' roll")) self.assertEqual("rock 'n roll".split(), _TOKENIZE("rock 'n roll")) self.assertEqual("rock n' roll".split(), _TOKENIZE("rock n' roll")) def test_clitics(self): self.assertEqual("Jane 's blob".split(), _TOKENIZE("Jane's blob")) self.assertEqual("sdo 's".split(), _TOKENIZE("sdo's")) self.assertEqual("make SOP 's today".split(), _TOKENIZE("make SOP's today")) self.assertEqual("I 'd eat".split(), _TOKENIZE("I'd eat")) self.assertEqual("I 'm blob".split(), _TOKENIZE("I'm blob")) self.assertEqual("They 'll come".split(), _TOKENIZE("They'll come")) self.assertEqual("They 're blobs".split(), _TOKENIZE("They're blobs")) self.assertEqual("They 've eaten".split(), _TOKENIZE("They've eaten")) self.assertEqual("They are n't blobs".split(), _TOKENIZE("They aren't blobs")) self.assertEqual("They ca n't blobs".split(), _TOKENIZE("They can't blobs")) self.assertEqual("They have n't blobs".split(), _TOKENIZE("They haven't blobs")) self.assertEqual("They is n't blobs".split(), _TOKENIZE("They isn't blobs")) self.assertEqual('ifp \'s'.split(), _TOKENIZE('ifp\'s')) def test_multi_special_chars(self): self.assertEqual('bla // bla'.split(), _TOKENIZE('bla // bla')) self.assertEqual('bla {{ bla }}'.split(), _TOKENIZE('bla {{bla}}')) self.assertEqual('bla {{ bla }}'.split(), _TOKENIZE('bla {{bla}}')) def test_bullets(self): self.assertEqual('year . * introduce'.split(), _TOKENIZE('year. *introduce')) self.assertEqual('year . - introduce'.split(), _TOKENIZE('year. -introduce')) def test_special_chars(self): self.assertEqual('_tag #MenArePigs'.split(), _TOKENIZE('_tag #MenArePigs')) self.assertEqual('_tag @MenArePigs'.split(), _TOKENIZE('_tag @MenArePigs')) def test_protected_patterns(self): self.assertEqual('visit http://bla.com.au'.split(), _TOKENIZE('visit http://bla.com.au')) self.assertEqual('visit https://bla.com.au/'.split(), _TOKENIZE('visit https://bla.com.au/')) self.assertEqual('visit www.bla.com.au/bla.pdf'.split(), _TOKENIZE('visit www.bla.com.au/bla.pdf')) self.assertEqual('visit www.Bla.com and www.Bla2.com'.split(), _TOKENIZE('visit www.Bla.com and www.Bla2.com')) def test_sentence_parts(self): self.assertEqual('on Oct. 29 , 2017 .'.split(), _TOKENIZE('on Oct. 29, 2017.')) self.assertEqual('involve the U.S. ?'.split(), _TOKENIZE('involve the U.S.?')) self.assertEqual('" Jump " , he said .'.split(), _TOKENIZE('"Jump", he said.')) self.assertEqual('" Jump . " , he said .'.split(), _TOKENIZE('"Jump.", he said.')) self.assertEqual('" Jump . " he said .'.split(), _TOKENIZE('"Jump." he said.')) def test_multi_dots(self): self.assertEqual('Ms. Dean .'.split(), _TOKENIZE('Ms. Dean.')) self.assertEqual('Ms. Dean . Mrs Dean .'.split(), _TOKENIZE('Ms. Dean. Mrs Dean.')) self.assertEqual('Sgt. Pepp. went there'.split(), _TOKENIZE('Sgt. Pepp. went there')) def test_smileys(self): self.assertEqual(':-)'.split(), _TOKENIZE(':-)')) # LONG TEXT # --------------------------------------------------------------------------> def test_text_1(self): self.assertEqual('said Lt. Gov. <NAME> in a Dec. 19 press release .'.split(), _TOKENIZE('said Lt. Gov. B<NAME> in a Dec. 19 press release.')) def test_text_2(self): self.assertEqual('headquarters in Ghent , Belgium . The company develops'.split(), _TOKENIZE('headquarters in Ghent, Belgium. The company develops')) def test_text_3(self): self.assertEqual('The fastest in the world , by a long margin . Concentrate . Got a picture in mind ?'.split(), _TOKENIZE('The fastest in the world, by a long margin. Concentrate. Got a picture in mind?')) def test_text_4(self): self.assertEqual('" I wrote , \' Making lemonade out of lemons . \' " The post marked the start .'.split(), _TOKENIZE('"I wrote, \'Making lemonade out of lemons.\' " The post marked the start.')) def test_text_5(self): self.assertEqual('" I wrote , " Making lemonade out of lemons . " " The post marked the start .'.split(), _TOKENIZE('"I wrote, "Making lemonade out of lemons." " The post marked the start.')) def test_text_6(self): self.assertEqual("I say , ' Why did I do that ! ' It keeps you inspired !".split(), _TOKENIZE("I say, 'Why did I do that!' It keeps you inspired!")) def test_text_7(self): self.assertEqual("I say , ' Why did I do that ? ' It keeps you inspired !".split(), _TOKENIZE("I say, 'Why did I do that?' It keeps you inspired!")) def test_text_8(self): self.assertEqual("They have become my online ' support ' group .".split(), _TOKENIZE("They have become my online 'support' group.")) if __name__ == '__main__': unittest.main()
[ 1, 529, 276, 1112, 420, 29958, 2252, 29896, 29900, 29929, 29914, 1557, 336, 23717, 13839, 13, 5215, 443, 27958, 13, 13, 3166, 24559, 23717, 13839, 29889, 1457, 19170, 29889, 6979, 3950, 1053, 25159, 3950, 13, 13, 29918, 4986, 29968, 1430, 29902, 10721, 353, 25159, 3950, 580, 13, 13, 13, 1990, 4321, 6066, 3950, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 396, 350, 21339, 29903, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 976, 13, 13, 1678, 822, 1243, 29918, 513, 1088, 29918, 5965, 5309, 29918, 1271, 29879, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 11284, 1919, 540, 1497, 29871, 227, 191, 189, 29896, 227, 191, 190, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 11284, 29892, 540, 1497, 29871, 227, 191, 189, 29896, 227, 191, 190, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 229, 169, 136, 29896, 229, 169, 137, 5674, 1919, 540, 1497, 29871, 227, 191, 189, 29896, 227, 191, 190, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 229, 169, 136, 29896, 229, 169, 137, 5674, 29892, 540, 1497, 29871, 227, 191, 189, 29896, 227, 191, 190, 8785, 13, 13, 1678, 396, 24972, 8476, 323, 12194, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 976, 13, 13, 1678, 822, 1243, 29918, 5451, 29918, 18732, 29918, 9303, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29902, 508, 451, 437, 393, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29902, 2609, 437, 393, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 6028, 451, 437, 393, 1738, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29089, 437, 393, 29991, 8785, 13, 13, 1678, 822, 1243, 29918, 4965, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 7247, 29889, 510, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7247, 29889, 510, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 4617, 1682, 272, 29889, 510, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 4617, 1682, 272, 29889, 510, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 3970, 29032, 29889, 19795, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 3970, 29032, 29889, 19795, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1491, 29889, 7247, 29889, 510, 29889, 585, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1491, 29889, 7247, 29889, 510, 29889, 585, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1491, 29889, 7247, 29896, 29906, 29941, 29889, 510, 29889, 585, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1491, 29889, 7247, 29896, 29906, 29941, 29889, 510, 29889, 585, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29966, 26862, 6227, 29958, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29966, 26862, 6227, 29958, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29966, 26862, 6227, 29958, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29966, 26862, 6227, 29958, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 21229, 359, 29889, 16447, 29889, 24946, 29889, 510, 29914, 29984, 29946, 375, 18828, 21576, 29950, 29939, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 21229, 359, 29889, 16447, 29889, 24946, 29889, 510, 29914, 29984, 29946, 375, 18828, 21576, 29950, 29939, 8785, 13, 13, 1678, 822, 1243, 29918, 7778, 29918, 14369, 29918, 517, 12360, 29918, 17639, 2830, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 29889, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 12839, 355, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 12839, 355, 8785, 13, 4706, 1583, 29889, 9294, 9843, 12839, 5044, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 12839, 5044, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 12839, 29896, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 12839, 29896, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 6144, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 6144, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 13157, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 13157, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 6144, 2147, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 6144, 2147, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 6144, 573, 29934, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 6144, 573, 29934, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 12839, 6144, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 12839, 6144, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 12839, 13157, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 12839, 13157, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7340, 29874, 29889, 6144, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7340, 29874, 29889, 6144, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7340, 29909, 29889, 13157, 2147, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7340, 29909, 29889, 13157, 2147, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29938, 29896, 29889, 29941, 29924, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29938, 29896, 29889, 29941, 29924, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 29889, 29896, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29889, 29896, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 29889, 29896, 29906, 29941, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29889, 29896, 29906, 29941, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 29896, 29889, 29896, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 29896, 29889, 29896, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 29933, 29889, 29896, 29889, 29907, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 29933, 29889, 29896, 29889, 29907, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 29933, 29889, 29907, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 29933, 29889, 29907, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 29933, 29889, 29907, 29889, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 29933, 29889, 29907, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29872, 29889, 29887, 29889, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29872, 29889, 29887, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29872, 29889, 29887, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29872, 29889, 29887, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 29909, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 29909, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29965, 29889, 29903, 29889, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29965, 29889, 29903, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29884, 29889, 29879, 29889, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29884, 29889, 29879, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 29909, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 29909, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29902, 29896, 29889, 29902, 29900, 29902, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29902, 29896, 29889, 29902, 29900, 29902, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7076, 29889, 29896, 29900, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7076, 29889, 29896, 29900, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7076, 29889, 29902, 29900, 29902, 29889, 29909, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7076, 29889, 29902, 29900, 29902, 29889, 29909, 8785, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 7778, 29918, 5451, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 2023, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 856, 28048, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 17530, 2023, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 17530, 856, 8785, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 18616, 663, 29918, 21043, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 1738, 6824, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 21004, 28048, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 13626, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 8773, 28048, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 13626, 29991, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 8773, 29991, 28048, 663, 8785, 13, 13, 1678, 822, 1243, 29918, 7778, 29918, 5451, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 869, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 29889, 29903, 296, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 6185, 1096, 29871, 29946, 869, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 6185, 1096, 29871, 29946, 29889, 28048, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 2202, 3458, 1319, 1173, 29888, 29889, 510, 869, 1126, 445, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 2202, 3458, 1319, 1173, 29888, 29889, 510, 29889, 1126, 445, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 869, 28048, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 29889, 28048, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29943, 457, 11401, 869, 2296, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29943, 457, 11401, 29889, 2296, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 432, 1540, 29871, 29896, 29929, 29953, 29906, 869, 3164, 370, 433, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 432, 1540, 29871, 29896, 29929, 29953, 29906, 29889, 3164, 370, 433, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 19678, 2992, 869, 13955, 29940, 1919, 405, 29940, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 19678, 2992, 29889, 13955, 29940, 29892, 405, 29940, 8785, 13, 13, 1678, 822, 1243, 29918, 7778, 29918, 17639, 2830, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1509, 869, 6006, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1509, 869, 6006, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 29889, 18616, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 29889, 18616, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 869, 18616, 663, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 869, 18616, 663, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 716, 29889, 10541, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 716, 29889, 10541, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 28549, 297, 29871, 29906, 29900, 29896, 29945, 29889, 7805, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 28549, 297, 29871, 29906, 29900, 29896, 29945, 29889, 7805, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 29889, 1919, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 1696, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 29889, 584, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 4898, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 29889, 2056, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 8670, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 869, 1723, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 29871, 29953, 29929, 386, 1072, 29873, 1846, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 27236, 4141, 869, 313, 6345, 1723, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 27236, 4141, 29889, 313, 4939, 29897, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29946, 29889, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29946, 29889, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29946, 869, 306, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29946, 29889, 306, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 306, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 306, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29889, 306, 18093, 319, 29889, 306, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29889, 306, 18093, 319, 29889, 306, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 29909, 29889, 306, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 29909, 29889, 306, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29889, 29909, 306, 18093, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29889, 29909, 306, 18093, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29898, 29871, 29896, 869, 7561, 29877, 9287, 423, 1723, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29898, 29896, 29889, 7561, 29877, 9287, 423, 29897, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29898, 29871, 29896, 29889, 10481, 29871, 1723, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29898, 29896, 29889, 10481, 29897, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1171, 1137, 29889, 844, 29889, 16650, 583, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1171, 1137, 29889, 844, 29889, 16650, 583, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 11345, 12738, 869, 6006, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 11345, 12738, 869, 6006, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7076, 338, 405, 29889, 19055, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7076, 338, 405, 29889, 19055, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 22880, 1024, 338, 529, 5813, 29958, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 22880, 1024, 338, 529, 5813, 29958, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 22880, 1024, 338, 263, 29889, 16749, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 22880, 1024, 338, 263, 29889, 16749, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 8100, 482, 501, 29889, 29903, 29889, 1016, 943, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 8100, 482, 501, 29889, 29903, 29889, 1016, 943, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 1375, 29889, 338, 29871, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 1375, 29889, 338, 29871, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 350, 430, 29889, 338, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 350, 430, 29889, 338, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 350, 10249, 29889, 338, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 350, 10249, 29889, 338, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 354, 338, 4192, 29889, 13104, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 354, 338, 4192, 29889, 13104, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 25639, 29889, 13104, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 25639, 29889, 13104, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29941, 386, 1226, 29889, 1570, 3088, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29941, 386, 1226, 29889, 1570, 3088, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 354, 338, 26250, 29889, 7835, 1050, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 354, 338, 26250, 29889, 7835, 1050, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 18850, 29871, 29896, 29889, 437, 445, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 18850, 29871, 29896, 29889, 437, 445, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 18850, 29871, 29900, 29896, 29889, 437, 445, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 18850, 29871, 29900, 29896, 29889, 437, 445, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 18850, 29889, 29906, 437, 445, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 18850, 29889, 29906, 437, 445, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 974, 869, 29906, 29900, 297, 305, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 974, 869, 29906, 29900, 297, 305, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 29889, 289, 29889, 313, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 29889, 289, 29889, 6702, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 273, 302, 29889, 330, 29889, 584, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 273, 302, 29889, 330, 29889, 584, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 318, 29889, 29879, 29889, 1738, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 318, 29889, 29879, 29889, 1738, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29317, 1700, 29879, 29889, 584, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 29317, 1700, 29879, 29889, 584, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 376, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 376, 8785, 13, 4706, 1583, 29889, 9294, 9843, 703, 29874, 7977, 869, 525, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29874, 7977, 29889, 525, 5783, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 313, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 6702, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 1723, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 1723, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 518, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 6024, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 4514, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 4514, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 426, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 426, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 500, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 500, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 891, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 891, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 7977, 869, 334, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 7977, 29889, 334, 8785, 13, 13, 1678, 822, 1243, 29918, 735, 15719, 362, 29918, 9748, 29918, 5451, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 338, 366, 1738, 13352, 29887, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 338, 366, 29991, 13352, 29887, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 338, 366, 1738, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 338, 366, 29991, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 338, 366, 1738, 6824, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 338, 366, 21004, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1357, 767, 1738, 448, 1766, 8668, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1357, 767, 29991, 448, 1766, 8668, 8785, 13, 13, 1678, 822, 1243, 29918, 735, 15719, 362, 29918, 9748, 29918, 17639, 2830, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 2559, 586, 403, 1738, 2060, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 2559, 586, 403, 29991, 2060, 8785, 13, 13, 1678, 822, 1243, 29918, 5464, 29918, 14727, 681, 29918, 344, 546, 4097, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 518, 338, 4514, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 518, 275, 29962, 366, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 313, 338, 1723, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 313, 275, 29897, 366, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 426, 338, 500, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 426, 275, 29913, 366, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 338, 366, 1577, 2703, 29887, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 338, 366, 29973, 2703, 29887, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1366, 338, 366, 1577, 8773, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1366, 338, 366, 28772, 8785, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29878, 29915, 1004, 320, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 29898, 29878, 29915, 1004, 29905, 6293, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1004, 891, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1004, 29989, 6293, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 376, 6635, 376, 432, 17204, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 376, 4117, 29908, 432, 17204, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 6635, 2056, 432, 17204, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 6635, 29936, 432, 17204, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1552, 6635, 584, 432, 17204, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1552, 6635, 29901, 432, 17204, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 14057, 1973, 584, 3160, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 14057, 1973, 584, 2856, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29879, 514, 1405, 29871, 29896, 29906, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29879, 514, 1405, 29896, 29906, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29879, 514, 529, 29871, 29896, 29906, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29879, 514, 529, 29896, 29906, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1113, 353, 26044, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1113, 29922, 8690, 11255, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 5182, 29879, 353, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 5182, 29879, 2433, 876, 13, 13, 1678, 822, 1243, 29918, 1896, 29918, 4141, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29879, 514, 529, 489, 29871, 29896, 29906, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29879, 514, 529, 489, 29871, 29896, 29906, 8785, 29871, 396, 13626, 13, 4706, 1583, 29889, 9294, 9843, 877, 29879, 514, 1599, 29871, 29896, 29906, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29879, 514, 1599, 29871, 29896, 29906, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 4013, 338, 529, 592, 1405, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 4013, 338, 529, 1004, 29958, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 514, 1405, 29871, 29945, 29900, 29995, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 514, 1405, 29945, 29900, 29995, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 514, 529, 29871, 29945, 29900, 29995, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 514, 529, 29945, 29900, 29995, 8785, 13, 13, 1678, 822, 1243, 29918, 8508, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 26404, 334, 13465, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 26404, 29930, 27925, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 26404, 334, 13465, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 26404, 2328, 27925, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 29930, 29896, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29930, 29896, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 29930, 10736, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29930, 10736, 8785, 13, 13, 1678, 822, 1243, 29918, 11242, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 26679, 747, 9770, 718, 5335, 5570, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 26679, 747, 9770, 29974, 9346, 5570, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 25771, 718, 1395, 29887, 718, 413, 3780, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 25771, 29974, 7642, 29974, 29895, 3780, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 5850, 3352, 718, 399, 6832, 718, 350, 1307, 718, 10213, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 365, 29911, 3352, 29974, 29956, 6832, 29974, 29933, 1307, 29974, 28459, 525, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29941, 29974, 472, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29941, 29974, 271, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29941, 29896, 29906, 29974, 472, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29941, 29896, 29906, 29974, 271, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7340, 29974, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7340, 29974, 8785, 13, 13, 1678, 822, 1243, 29918, 314, 546, 11436, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1482, 669, 2030, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1482, 29987, 1025, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 4373, 669, 8198, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 4373, 29987, 21648, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 28577, 29987, 5607, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 28577, 29987, 5607, 29928, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29873, 29987, 2395, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29873, 29987, 2395, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29911, 29987, 9295, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29911, 29987, 9295, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 816, 11272, 669, 3867, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 816, 11272, 29987, 3867, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 816, 11272, 669, 3867, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 816, 11272, 29987, 3867, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29987, 29928, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 29928, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29987, 360, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 360, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 669, 29871, 29896, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 29896, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 669, 360, 29928, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29987, 360, 29928, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29934, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29934, 29987, 29928, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29934, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29934, 29987, 360, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29934, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29934, 669, 29928, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29934, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29934, 669, 360, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29987, 29928, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 29928, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29987, 360, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 360, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 9033, 29987, 29928, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 319, 390, 669, 360, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29987, 7698, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 669, 360, 319, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 10147, 390, 29934, 669, 390, 29906, 319, 9775, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 10147, 390, 29934, 669, 390, 29906, 319, 9775, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29895, 23213, 669, 19725, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29895, 23213, 29987, 329, 1793, 8785, 13, 13, 1678, 822, 1243, 29918, 17057, 267, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29900, 29914, 29896, 29900, 29914, 29906, 29900, 29896, 29900, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29900, 29914, 29896, 29900, 29914, 29906, 29900, 29896, 29900, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29890, 29906, 29890, 847, 289, 29906, 29883, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29890, 29906, 29890, 29914, 29890, 29906, 29883, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1004, 847, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1004, 29914, 6293, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1004, 847, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1004, 847, 6293, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1004, 847, 366, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1004, 29914, 366, 8785, 13, 4706, 1583, 29889, 9294, 9843, 11219, 7029, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 11219, 23176, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29886, 29914, 29874, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29886, 29914, 29874, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29914, 29933, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29914, 29933, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29914, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29914, 8785, 13, 4706, 1583, 29889, 9294, 9843, 11219, 29933, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 11219, 29933, 8785, 13, 13, 1678, 822, 1243, 29918, 331, 14592, 267, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29899, 445, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29994, 1366, 8785, 13, 13, 1678, 822, 1243, 29918, 25376, 482, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29995, 29896, 29906, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29995, 29896, 29906, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29995, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29995, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29995, 4048, 886, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29995, 29879, 485, 886, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 7620, 1273, 4048, 886, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 7620, 29995, 29879, 485, 886, 8785, 13, 13, 1678, 822, 1243, 29918, 17308, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 4773, 584, 12995, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 4773, 29901, 12995, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 22692, 660, 29896, 584, 6981, 895, 29871, 29896, 29938, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 22692, 660, 29896, 29901, 6981, 895, 29871, 29896, 29938, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 5924, 584, 6664, 895, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 5924, 29901, 13478, 895, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 10472, 1245, 584, 22157, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 10472, 1245, 29901, 1092, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 14039, 584, 11459, 895, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 14039, 29901, 1123, 29894, 895, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 276, 29901, 262, 794, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 276, 29901, 262, 794, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 535, 2199, 29871, 29896, 29901, 29896, 29879, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 535, 2199, 29871, 29896, 29901, 29896, 29879, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29096, 29871, 29896, 29906, 29941, 29901, 29896, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29096, 29871, 29896, 29906, 29941, 29901, 29896, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29909, 29901, 29933, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29909, 29901, 29933, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 10568, 584, 29871, 29955, 29900, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 10568, 29901, 29955, 29900, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 514, 29871, 29896, 29906, 584, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 514, 29871, 29896, 29906, 29901, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 26910, 584, 379, 29934, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 26910, 29901, 20938, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29906, 584, 379, 29934, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29906, 29901, 20938, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29906, 29946, 29941, 584, 3033, 482, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29906, 29946, 29941, 29901, 996, 482, 8785, 13, 13, 1678, 822, 1243, 29918, 2936, 29879, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 514, 29871, 29896, 29906, 976, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 514, 29871, 29896, 29906, 976, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 514, 29871, 29896, 29906, 1405, 29871, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 514, 29871, 29896, 29906, 29958, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29874, 1149, 289, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29874, 353, 1405, 289, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29916, 6736, 29871, 29896, 29906, 29889, 29945, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 921, 1405, 353, 29871, 29896, 29906, 29889, 29945, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29916, 5277, 29871, 29896, 29906, 29889, 29945, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 921, 529, 353, 29871, 29896, 29906, 29889, 29945, 8785, 13, 13, 1678, 822, 1243, 29918, 510, 294, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 12199, 1919, 7251, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 12199, 29892, 7251, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 1919, 599, 1781, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29892, 599, 1781, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 497, 1781, 1919, 29871, 29896, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 497, 1781, 29892, 29896, 29906, 29941, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29896, 29906, 29941, 29892, 29896, 29906, 29941, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29896, 29906, 29941, 29892, 29896, 29906, 29941, 8785, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 339, 4769, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 29934, 542, 1111, 525, 29879, 23755, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29934, 542, 1111, 525, 29879, 23755, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29950, 275, 1024, 338, 525, 6417, 525, 289, 711, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29950, 275, 1024, 338, 525, 21860, 29915, 289, 711, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29950, 275, 1024, 338, 6417, 525, 289, 711, 525, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29950, 275, 1024, 338, 6417, 525, 29890, 711, 29915, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15343, 525, 748, 5735, 525, 13705, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15343, 525, 1484, 5735, 29915, 710, 8963, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29926, 1280, 288, 29915, 29882, 598, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29926, 1280, 288, 29915, 29882, 598, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29915, 24963, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29915, 771, 1066, 284, 5783, 13, 4706, 1583, 29889, 9294, 9843, 877, 13157, 2147, 29871, 29946, 615, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 13157, 2147, 29871, 29946, 29915, 5783, 13, 4706, 1583, 29889, 9294, 9843, 877, 13157, 2147, 29871, 29946, 262, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 13157, 2147, 29871, 29946, 29908, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 13157, 2147, 29871, 29946, 615, 29946, 262, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 13157, 2147, 29871, 29946, 20333, 29946, 29908, 8785, 13, 4706, 1583, 29889, 9294, 9843, 703, 29915, 591, 674, 1065, 4452, 1449, 525, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29915, 705, 674, 1065, 4452, 1449, 29915, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 346, 29877, 1797, 525, 5825, 2909, 410, 525, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 346, 29877, 1797, 525, 8628, 2909, 410, 29915, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 20821, 525, 29876, 29915, 9679, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 20821, 525, 29876, 29915, 9679, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 20821, 525, 29876, 9679, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 20821, 525, 29876, 9679, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 20821, 302, 29915, 9679, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 20821, 302, 29915, 9679, 5783, 13, 13, 1678, 822, 1243, 29918, 695, 277, 1199, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 29967, 1662, 525, 29879, 23755, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29967, 1662, 29915, 29879, 23755, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29879, 1867, 525, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29879, 1867, 29915, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 5675, 317, 4590, 525, 29879, 9826, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 5675, 317, 4590, 29915, 29879, 9826, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29902, 525, 29881, 17545, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29902, 29915, 29881, 17545, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 29902, 525, 29885, 23755, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 29902, 29915, 29885, 23755, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 525, 645, 2041, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 29915, 645, 2041, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 525, 276, 23755, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 29915, 276, 23755, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 525, 345, 321, 2579, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 29915, 345, 321, 2579, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 526, 302, 29915, 29873, 23755, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 9455, 29915, 29873, 23755, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 5777, 302, 29915, 29873, 23755, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 508, 29915, 29873, 23755, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 505, 302, 29915, 29873, 23755, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 7359, 29915, 29873, 23755, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 338, 302, 29915, 29873, 23755, 29879, 1642, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 3508, 29915, 29873, 23755, 29879, 5783, 13, 4706, 1583, 29889, 9294, 9843, 877, 361, 29886, 320, 29915, 29879, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 361, 29886, 20333, 29879, 8785, 13, 13, 1678, 822, 1243, 29918, 9910, 29918, 18732, 29918, 305, 1503, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 17530, 849, 12995, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 17530, 849, 12995, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 17530, 8620, 12995, 9156, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 17530, 8620, 17530, 930, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 17530, 8620, 12995, 9156, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 17530, 8620, 17530, 930, 8785, 13, 13, 1678, 822, 1243, 29918, 8645, 10376, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 6360, 869, 334, 14944, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 6360, 29889, 334, 524, 3518, 346, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 6360, 869, 448, 14944, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 6360, 29889, 448, 524, 3518, 346, 8785, 13, 13, 1678, 822, 1243, 29918, 18732, 29918, 305, 1503, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29918, 4039, 396, 28154, 17506, 29925, 23379, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29918, 4039, 396, 28154, 17506, 29925, 23379, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29918, 4039, 732, 28154, 17506, 29925, 23379, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29918, 4039, 732, 28154, 17506, 29925, 23379, 8785, 13, 13, 1678, 822, 1243, 29918, 24681, 29918, 11037, 29879, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1730, 277, 1732, 597, 17530, 29889, 510, 29889, 585, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1730, 277, 1732, 597, 17530, 29889, 510, 29889, 585, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1730, 277, 2045, 597, 17530, 29889, 510, 29889, 585, 29914, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1730, 277, 2045, 597, 17530, 29889, 510, 29889, 585, 29914, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1730, 277, 7821, 29889, 17530, 29889, 510, 29889, 585, 29914, 17530, 29889, 5140, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1730, 277, 7821, 29889, 17530, 29889, 510, 29889, 585, 29914, 17530, 29889, 5140, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 1730, 277, 7821, 29889, 29933, 433, 29889, 510, 322, 7821, 29889, 29933, 433, 29906, 29889, 510, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 1730, 277, 7821, 29889, 29933, 433, 29889, 510, 322, 7821, 29889, 29933, 433, 29906, 29889, 510, 8785, 13, 13, 1678, 822, 1243, 29918, 18616, 663, 29918, 20895, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 265, 4756, 29889, 29871, 29906, 29929, 1919, 29871, 29906, 29900, 29896, 29955, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 265, 4756, 29889, 29871, 29906, 29929, 29892, 29871, 29906, 29900, 29896, 29955, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 262, 1555, 345, 278, 501, 29889, 29903, 29889, 1577, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 262, 1555, 345, 278, 501, 29889, 29903, 29889, 29973, 8785, 13, 4706, 1583, 29889, 9294, 9843, 877, 29908, 435, 3427, 376, 1919, 540, 1497, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29908, 29967, 3427, 613, 540, 1497, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29908, 435, 3427, 869, 376, 1919, 540, 1497, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29908, 29967, 3427, 19602, 540, 1497, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29908, 435, 3427, 869, 376, 540, 1497, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29908, 29967, 3427, 1213, 540, 1497, 6169, 876, 13, 13, 1678, 822, 1243, 29918, 9910, 29918, 7778, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29924, 29879, 29889, 23263, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29924, 29879, 29889, 23263, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29924, 29879, 29889, 23263, 869, 6285, 23263, 869, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29924, 29879, 29889, 23263, 29889, 6285, 23263, 6169, 876, 13, 4706, 1583, 29889, 9294, 9843, 877, 29903, 4141, 29889, 3938, 407, 29889, 3512, 727, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 29903, 4141, 29889, 3938, 407, 29889, 3512, 727, 8785, 13, 13, 1678, 822, 1243, 29918, 3844, 488, 952, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 13018, 29897, 4286, 5451, 3285, 903, 4986, 29968, 1430, 29902, 10721, 877, 13018, 29897, 8785, 13, 13, 1678, 396, 365, 20614, 323, 12194, 13, 1678, 396, 448, 2683, 2683, 2683, 2683, 1378, 976, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29896, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 4977, 333, 365, 29873, 29889, 402, 586, 29889, 529, 5813, 29958, 297, 263, 3826, 29889, 29871, 29896, 29929, 3965, 6507, 869, 4286, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 877, 4977, 333, 365, 29873, 29889, 402, 586, 29889, 350, 29966, 5813, 29958, 297, 263, 3826, 29889, 29871, 29896, 29929, 3965, 6507, 6169, 876, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29906, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 2813, 19252, 297, 13491, 296, 1919, 9923, 1974, 869, 450, 5001, 2693, 29879, 4286, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 877, 2813, 19252, 297, 13491, 296, 29892, 9923, 1974, 29889, 450, 5001, 2693, 29879, 8785, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29941, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 1576, 5172, 342, 297, 278, 3186, 1919, 491, 263, 1472, 5906, 869, 1281, 1760, 10492, 869, 15992, 263, 7623, 297, 3458, 1577, 4286, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 877, 1576, 5172, 342, 297, 278, 3186, 29892, 491, 263, 1472, 5906, 29889, 1281, 1760, 10492, 29889, 15992, 263, 7623, 297, 3458, 29973, 8785, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29946, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29908, 306, 5456, 1919, 320, 29915, 341, 5086, 454, 3712, 1943, 714, 310, 9336, 787, 869, 320, 29915, 376, 450, 1400, 10902, 278, 1369, 869, 4286, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 877, 29908, 29902, 5456, 29892, 320, 29915, 29924, 5086, 454, 3712, 1943, 714, 310, 9336, 787, 7790, 29915, 376, 450, 1400, 10902, 278, 1369, 6169, 876, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29945, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 877, 29908, 306, 5456, 1919, 376, 341, 5086, 454, 3712, 1943, 714, 310, 9336, 787, 869, 376, 376, 450, 1400, 10902, 278, 1369, 869, 4286, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 877, 29908, 29902, 5456, 29892, 376, 29924, 5086, 454, 3712, 1943, 714, 310, 9336, 787, 1213, 376, 450, 1400, 10902, 278, 1369, 6169, 876, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29953, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 29902, 1827, 1919, 525, 3750, 1258, 306, 437, 393, 1738, 525, 739, 14874, 366, 20603, 1738, 1642, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 703, 29902, 1827, 29892, 525, 11008, 1258, 306, 437, 393, 20714, 739, 14874, 366, 20603, 3850, 876, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29955, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 29902, 1827, 1919, 525, 3750, 1258, 306, 437, 393, 1577, 525, 739, 14874, 366, 20603, 1738, 1642, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 703, 29902, 1827, 29892, 525, 11008, 1258, 306, 437, 393, 17901, 739, 14874, 366, 20603, 3850, 876, 13, 13, 1678, 822, 1243, 29918, 726, 29918, 29947, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 703, 15597, 505, 4953, 590, 7395, 525, 2304, 525, 2318, 869, 1642, 5451, 3285, 13, 462, 308, 903, 4986, 29968, 1430, 29902, 10721, 703, 15597, 505, 4953, 590, 7395, 525, 5924, 29915, 2318, 1213, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
p240_search_a_2d_matrix_ii.py
feigaochn/leetcode
0
115380
<reponame>feigaochn/leetcode # coding: utf-8 # author: <NAME> # # Search A 2d Matrix Ii # Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: # Integers in each row are sorted in ascending from left to right. # Integers in each column are sorted in ascending from top to bottom. # For example, # Consider the following matrix: # [ # [1, 4, 7, 11, 15], # [2, 5, 8, 12, 19], # [3, 6, 9, 16, 22], # [10, 13, 14, 17, 24], # [18, 21, 23, 26, 30] # ] # Given target = 5, return true. # Given target = 20, return false. # Subscribe to see which companies asked this question class Solution(object): def searchMatrix(self, matrix, target): """ :type matrix: List[List[int]] :type target: int :rtype: bool """ def search(row1, row2, col1, col2): """Search target in sub matrix[row1:row2][col1:col2]""" # zero elements if row1 >= row2 or col1 >= col2: return False if matrix[row1][col1] == target: return True # target less than up-left corner if target < matrix[row1][col1]: return False # target greater than low-right corner if target > matrix[row2 - 1][col2 - 1]: return False row3 = (row1 + row2 + 1) // 2 col3 = (col1 + col2 + 1) // 2 # print(row1, row3, row2, col1, col3, col2) result = (search(row1, row3, col1, col3) or search(row1, row3, col3, col2) or search(row3, row2, col1, col3) or search(row3, row2, col3, col2)) # print(row1, row2, col1, col2, result) return result return search(0, len(matrix), 0, len(matrix[0])) def main(): solver = Solution() tests = [ ([ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19], [3, 6, 9, 16, 22], [10, 13, 14, 17, 24], [18, 21, 23, 26, 30] ], 5), ([ [1, 4, 7, 11, 15], [2, 5, 8, 12, 19], [3, 6, 9, 16, 22], [10, 13, 14, 17, 24], [18, 21, 23, 26, 30] ], 20) ] for test in tests: print(test) print(' ->') result = solver.searchMatrix(*test) print(result) print('~' * 10) pass if __name__ == '__main__': main() pass
[ 1, 529, 276, 1112, 420, 29958, 1725, 4324, 2878, 29876, 29914, 280, 300, 401, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 4148, 29901, 529, 5813, 29958, 13, 29937, 13, 29937, 11856, 319, 29871, 29906, 29881, 22513, 306, 29875, 13, 13, 29937, 14350, 385, 8543, 5687, 393, 29645, 363, 263, 995, 297, 385, 286, 921, 302, 4636, 29889, 910, 4636, 756, 278, 1494, 4426, 29901, 13, 29937, 512, 371, 5743, 297, 1269, 1948, 526, 12705, 297, 12066, 2548, 515, 2175, 304, 1492, 29889, 13, 29937, 512, 371, 5743, 297, 1269, 1897, 526, 12705, 297, 12066, 2548, 515, 2246, 304, 5970, 29889, 13, 29937, 1152, 1342, 29892, 13, 29937, 10056, 278, 1494, 4636, 29901, 13, 29937, 518, 13, 29937, 259, 518, 29896, 29892, 1678, 29946, 29892, 259, 29955, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29945, 1402, 13, 29937, 259, 518, 29906, 29892, 1678, 29945, 29892, 259, 29947, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29929, 1402, 13, 29937, 259, 518, 29941, 29892, 1678, 29953, 29892, 259, 29929, 29892, 29871, 29896, 29953, 29892, 29871, 29906, 29906, 1402, 13, 29937, 259, 518, 29896, 29900, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29955, 29892, 29871, 29906, 29946, 1402, 13, 29937, 259, 518, 29896, 29947, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29953, 29892, 29871, 29941, 29900, 29962, 13, 29937, 4514, 13, 29937, 11221, 3646, 353, 29871, 29945, 29892, 736, 1565, 29889, 13, 29937, 11221, 3646, 353, 29871, 29906, 29900, 29892, 736, 2089, 29889, 13, 29937, 3323, 13086, 304, 1074, 607, 14582, 4433, 445, 1139, 13, 13, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 2740, 14609, 29898, 1311, 29892, 4636, 29892, 3646, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 4636, 29901, 2391, 29961, 1293, 29961, 524, 5262, 13, 4706, 584, 1853, 3646, 29901, 938, 13, 4706, 584, 29878, 1853, 29901, 6120, 13, 4706, 9995, 13, 13, 4706, 822, 2740, 29898, 798, 29896, 29892, 1948, 29906, 29892, 784, 29896, 29892, 784, 29906, 1125, 13, 9651, 9995, 7974, 3646, 297, 1014, 4636, 29961, 798, 29896, 29901, 798, 29906, 3816, 1054, 29896, 29901, 1054, 29906, 29962, 15945, 29908, 13, 9651, 396, 5225, 3161, 13, 9651, 565, 1948, 29896, 6736, 1948, 29906, 470, 784, 29896, 6736, 784, 29906, 29901, 13, 18884, 736, 7700, 13, 9651, 565, 4636, 29961, 798, 29896, 3816, 1054, 29896, 29962, 1275, 3646, 29901, 13, 18884, 736, 5852, 13, 9651, 396, 3646, 3109, 1135, 701, 29899, 1563, 11155, 13, 9651, 565, 3646, 529, 4636, 29961, 798, 29896, 3816, 1054, 29896, 5387, 13, 18884, 736, 7700, 13, 9651, 396, 3646, 7621, 1135, 4482, 29899, 1266, 11155, 13, 9651, 565, 3646, 1405, 4636, 29961, 798, 29906, 448, 29871, 29896, 3816, 1054, 29906, 448, 29871, 29896, 5387, 13, 18884, 736, 7700, 13, 9651, 1948, 29941, 353, 313, 798, 29896, 718, 1948, 29906, 718, 29871, 29896, 29897, 849, 29871, 29906, 13, 9651, 784, 29941, 353, 313, 1054, 29896, 718, 784, 29906, 718, 29871, 29896, 29897, 849, 29871, 29906, 13, 9651, 396, 1596, 29898, 798, 29896, 29892, 1948, 29941, 29892, 1948, 29906, 29892, 784, 29896, 29892, 784, 29941, 29892, 784, 29906, 29897, 13, 9651, 1121, 353, 313, 4478, 29898, 798, 29896, 29892, 1948, 29941, 29892, 784, 29896, 29892, 784, 29941, 29897, 13, 462, 418, 470, 2740, 29898, 798, 29896, 29892, 1948, 29941, 29892, 784, 29941, 29892, 784, 29906, 29897, 13, 462, 418, 470, 2740, 29898, 798, 29941, 29892, 1948, 29906, 29892, 784, 29896, 29892, 784, 29941, 29897, 13, 462, 418, 470, 2740, 29898, 798, 29941, 29892, 1948, 29906, 29892, 784, 29941, 29892, 784, 29906, 876, 13, 9651, 396, 1596, 29898, 798, 29896, 29892, 1948, 29906, 29892, 784, 29896, 29892, 784, 29906, 29892, 1121, 29897, 13, 9651, 736, 1121, 13, 13, 4706, 736, 2740, 29898, 29900, 29892, 7431, 29898, 5344, 511, 29871, 29900, 29892, 7431, 29898, 5344, 29961, 29900, 12622, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 899, 369, 353, 24380, 580, 13, 1678, 6987, 353, 518, 13, 4706, 9310, 13, 632, 518, 29896, 29892, 29871, 29946, 29892, 29871, 29955, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29945, 1402, 13, 632, 518, 29906, 29892, 29871, 29945, 29892, 29871, 29947, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29929, 1402, 13, 632, 518, 29941, 29892, 29871, 29953, 29892, 29871, 29929, 29892, 29871, 29896, 29953, 29892, 29871, 29906, 29906, 1402, 13, 632, 518, 29896, 29900, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29955, 29892, 29871, 29906, 29946, 1402, 13, 632, 518, 29896, 29947, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29953, 29892, 29871, 29941, 29900, 29962, 13, 308, 21251, 29871, 29945, 511, 13, 4706, 9310, 13, 632, 518, 29896, 29892, 29871, 29946, 29892, 29871, 29955, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29945, 1402, 13, 632, 518, 29906, 29892, 29871, 29945, 29892, 29871, 29947, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29929, 1402, 13, 632, 518, 29941, 29892, 29871, 29953, 29892, 29871, 29929, 29892, 29871, 29896, 29953, 29892, 29871, 29906, 29906, 1402, 13, 632, 518, 29896, 29900, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29955, 29892, 29871, 29906, 29946, 1402, 13, 632, 518, 29896, 29947, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29953, 29892, 29871, 29941, 29900, 29962, 13, 308, 21251, 29871, 29906, 29900, 29897, 13, 1678, 4514, 13, 1678, 363, 1243, 297, 6987, 29901, 13, 4706, 1596, 29898, 1688, 29897, 13, 4706, 1596, 877, 1599, 1495, 13, 4706, 1121, 353, 899, 369, 29889, 4478, 14609, 10456, 1688, 29897, 13, 4706, 1596, 29898, 2914, 29897, 13, 4706, 1596, 877, 30022, 29915, 334, 29871, 29896, 29900, 29897, 13, 1678, 1209, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 1678, 1209, 13, 2 ]
tests/models/test_prodotti.py
20tab/python-fattureincloud
2
133717
<gh_stars>1-10 from unittest import TestCase from requests_mock import Mocker from fattureincloud.client import FattureInCloudAPI from tests.mocking import mocker_register_uri class TestProdotti(TestCase): """Define simple test case for base client request.""" maxDiff = None def setUp(self): """Set client with key and uid.""" self.client = FattureInCloudAPI(api_uid="123456", api_key="qwerty") @Mocker() def test_prodotti(self, mocker): """Test prodotti.""" mocker_register_uri( mocker, self.client.host, "/prodotti/lista", "prodotti/prodotti.json" ) self.assertEqual(len(self.client.prodotti.lista()), 2) @Mocker() def test_prodotti_2_pages(self, mocker): """Test prodotti with 2 pages.""" mocker_register_uri( mocker, self.client.host, "/prodotti/lista", "prodotti/prodotti_2_pages.json", ) self.assertEqual(len(self.client.prodotti.lista()), 4) def test_nuovo(self): """Test nuovo method.""" with self.assertRaises(NotImplementedError): self.client.prodotti.nuovo() def test_importa(self): """Test importa method.""" with self.assertRaises(NotImplementedError): self.client.prodotti.importa() def test_modifica(self): """Test modifica method.""" with self.assertRaises(NotImplementedError): self.client.prodotti.modifica() def test_elimina(self): """Test elimina method.""" with self.assertRaises(NotImplementedError): self.client.prodotti.elimina()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 13, 3166, 7274, 29918, 17640, 1053, 341, 8658, 13, 13, 3166, 285, 1131, 545, 262, 9274, 29889, 4645, 1053, 383, 1131, 545, 797, 20442, 8787, 13, 3166, 6987, 29889, 17640, 292, 1053, 286, 8658, 29918, 9573, 29918, 5338, 13, 13, 13, 1990, 4321, 1184, 29881, 16853, 29898, 3057, 8259, 1125, 13, 1678, 9995, 3206, 457, 2560, 1243, 1206, 363, 2967, 3132, 2009, 1213, 15945, 13, 13, 1678, 4236, 26023, 353, 6213, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 9995, 2697, 3132, 411, 1820, 322, 318, 333, 1213, 15945, 13, 4706, 1583, 29889, 4645, 353, 383, 1131, 545, 797, 20442, 8787, 29898, 2754, 29918, 5416, 543, 29896, 29906, 29941, 29946, 29945, 29953, 613, 7882, 29918, 1989, 543, 29939, 556, 1017, 1159, 13, 13, 1678, 732, 29924, 8658, 580, 13, 1678, 822, 1243, 29918, 10633, 16853, 29898, 1311, 29892, 286, 8658, 1125, 13, 4706, 9995, 3057, 11859, 16853, 1213, 15945, 13, 4706, 286, 8658, 29918, 9573, 29918, 5338, 29898, 13, 9651, 286, 8658, 29892, 1583, 29889, 4645, 29889, 3069, 29892, 5591, 10633, 16853, 29914, 19641, 613, 376, 10633, 16853, 29914, 10633, 16853, 29889, 3126, 29908, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1311, 29889, 4645, 29889, 10633, 16853, 29889, 19641, 25739, 29871, 29906, 29897, 13, 13, 1678, 732, 29924, 8658, 580, 13, 1678, 822, 1243, 29918, 10633, 16853, 29918, 29906, 29918, 12292, 29898, 1311, 29892, 286, 8658, 1125, 13, 4706, 9995, 3057, 11859, 16853, 411, 29871, 29906, 6515, 1213, 15945, 13, 4706, 286, 8658, 29918, 9573, 29918, 5338, 29898, 13, 9651, 286, 8658, 29892, 13, 9651, 1583, 29889, 4645, 29889, 3069, 29892, 13, 9651, 5591, 10633, 16853, 29914, 19641, 613, 13, 9651, 376, 10633, 16853, 29914, 10633, 16853, 29918, 29906, 29918, 12292, 29889, 3126, 613, 13, 4706, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 1311, 29889, 4645, 29889, 10633, 16853, 29889, 19641, 25739, 29871, 29946, 29897, 13, 13, 1678, 822, 1243, 29918, 3433, 6962, 29898, 1311, 1125, 13, 4706, 9995, 3057, 20353, 1158, 1213, 15945, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3664, 1888, 2037, 287, 2392, 1125, 13, 9651, 1583, 29889, 4645, 29889, 10633, 16853, 29889, 3433, 6962, 580, 13, 13, 1678, 822, 1243, 29918, 5215, 29874, 29898, 1311, 1125, 13, 4706, 9995, 3057, 1053, 29874, 1158, 1213, 15945, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3664, 1888, 2037, 287, 2392, 1125, 13, 9651, 1583, 29889, 4645, 29889, 10633, 16853, 29889, 5215, 29874, 580, 13, 13, 1678, 822, 1243, 29918, 1545, 15039, 29898, 1311, 1125, 13, 4706, 9995, 3057, 878, 15039, 1158, 1213, 15945, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3664, 1888, 2037, 287, 2392, 1125, 13, 9651, 1583, 29889, 4645, 29889, 10633, 16853, 29889, 1545, 15039, 580, 13, 13, 1678, 822, 1243, 29918, 295, 326, 1099, 29898, 1311, 1125, 13, 4706, 9995, 3057, 29007, 1099, 1158, 1213, 15945, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 3664, 1888, 2037, 287, 2392, 1125, 13, 9651, 1583, 29889, 4645, 29889, 10633, 16853, 29889, 295, 326, 1099, 580, 13, 2 ]
contact/views.py
rsHalford/xhalford-django
2
21914
from django.shortcuts import render from django.views.generic import ListView from contact.models import Profile class Contact(ListView): model = Profile template_name = "contact.html"
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 7406, 29889, 19206, 1053, 22184, 13, 3166, 6958, 29889, 9794, 1053, 20802, 13, 13, 1990, 22387, 29898, 15660, 1125, 13, 1678, 1904, 353, 20802, 13, 1678, 4472, 29918, 978, 353, 376, 12346, 29889, 1420, 29908, 13, 2 ]
010-binarysearch.py
dasalgadoc/PythonNotes
0
43666
import random def binary_search(data, target, low_index, high_index): """ Binary Search recursiva """ if (low_index > high_index): return False mid_index = (low_index + high_index) // 2 if target == data[mid_index]: return True elif target < data[mid_index]: return binary_search(data, target, low_index, mid_index - 1) else: return binary_search(data, target, mid_index + 1, high_index) def loop_binary_search(data, target, low_index, high_index): """ Binary Search Iterativa """ while(low_index < high_index): mid_index = (low_index + high_index) // 2 if target == data[mid_index]: return True elif target < data[mid_index]: high_index = (mid_index - 1) else: low_index = (mid_index + 1) return False if __name__ == "__main__": """ Suponga un arreglo ordenado, en el cual vamos a buscar un elemento. Optimizar una búsqueda en esta lista consiste en dividir la lista en partes e ir comparando el número con la parte dividida, en esto consiste la búsqueda binaria. Se implementarán dos forma en este Script""" data = [random.randint(0,100) for i in range(10)] data.sort() print(data) target = int(input("Numero a encontrar:\t")) f = binary_search(data, target, 0, len(data) - 1) print(f) f = loop_binary_search(data, target, 0, len(data) - 1) print(f)
[ 1, 1053, 4036, 13, 13, 1753, 7581, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 4482, 29918, 2248, 29892, 1880, 29918, 2248, 1125, 13, 1678, 9995, 29479, 11856, 8304, 4244, 9995, 13, 1678, 565, 313, 677, 29918, 2248, 1405, 1880, 29918, 2248, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 7145, 29918, 2248, 353, 313, 677, 29918, 2248, 718, 1880, 29918, 2248, 29897, 849, 29871, 29906, 13, 13, 1678, 565, 3646, 1275, 848, 29961, 6563, 29918, 2248, 5387, 13, 4706, 736, 5852, 13, 1678, 25342, 3646, 529, 848, 29961, 6563, 29918, 2248, 5387, 13, 4706, 736, 7581, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 4482, 29918, 2248, 29892, 7145, 29918, 2248, 448, 29871, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 7581, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 7145, 29918, 2248, 718, 29871, 29896, 29892, 1880, 29918, 2248, 29897, 13, 13, 13, 1753, 2425, 29918, 19541, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 4482, 29918, 2248, 29892, 1880, 29918, 2248, 1125, 13, 1678, 9995, 29479, 11856, 20504, 8657, 9995, 13, 1678, 1550, 29898, 677, 29918, 2248, 529, 1880, 29918, 2248, 1125, 13, 4706, 7145, 29918, 2248, 353, 313, 677, 29918, 2248, 718, 1880, 29918, 2248, 29897, 849, 29871, 29906, 13, 4706, 565, 3646, 1275, 848, 29961, 6563, 29918, 2248, 5387, 13, 9651, 736, 5852, 13, 4706, 25342, 3646, 529, 848, 29961, 6563, 29918, 2248, 5387, 13, 9651, 1880, 29918, 2248, 353, 313, 6563, 29918, 2248, 448, 29871, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 4482, 29918, 2248, 353, 313, 6563, 29918, 2248, 718, 29871, 29896, 29897, 13, 13, 1678, 736, 7700, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 9995, 13786, 549, 29874, 443, 564, 1727, 417, 16075, 912, 29892, 427, 560, 8351, 325, 14054, 263, 3593, 4287, 443, 1543, 29877, 29889, 13, 1678, 20693, 326, 15356, 1185, 289, 7381, 339, 8710, 427, 7444, 15023, 1136, 2488, 427, 25227, 381, 425, 15023, 427, 760, 267, 321, 29871, 13, 1678, 3805, 5734, 1743, 560, 13831, 378, 425, 3810, 25227, 1458, 29892, 427, 18261, 1136, 2488, 425, 289, 7381, 339, 8710, 9016, 4568, 29889, 13, 13, 1678, 922, 2334, 279, 1715, 3248, 5954, 427, 4404, 14415, 15945, 29908, 13, 13, 1678, 848, 353, 518, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29896, 29900, 29900, 29897, 363, 474, 297, 3464, 29898, 29896, 29900, 4638, 13, 13, 1678, 848, 29889, 6605, 580, 13, 13, 1678, 1596, 29898, 1272, 29897, 13, 13, 1678, 3646, 353, 938, 29898, 2080, 703, 8009, 1489, 263, 14567, 279, 3583, 29873, 5783, 13, 13, 1678, 285, 353, 7581, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 29871, 29900, 29892, 7431, 29898, 1272, 29897, 448, 29871, 29896, 29897, 13, 13, 1678, 1596, 29898, 29888, 29897, 13, 13, 1678, 285, 353, 2425, 29918, 19541, 29918, 4478, 29898, 1272, 29892, 3646, 29892, 29871, 29900, 29892, 7431, 29898, 1272, 29897, 448, 29871, 29896, 29897, 13, 13, 1678, 1596, 29898, 29888, 29897, 13, 2 ]
tests/test_template_helpers.py
ramiro/flourish
12
136294
# encoding: utf-8 import pytest from flourish import Flourish from flourish.helpers import publication_range class TestFlourish: @classmethod def setup_class(cls): with pytest.warns(None) as warnings: cls.flourish = Flourish('tests/source') def test_publication_range(self): assert u'2015–2016' == publication_range(self.flourish)
[ 1, 396, 8025, 29901, 23616, 29899, 29947, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 1652, 473, 728, 1053, 2379, 473, 728, 13, 3166, 1652, 473, 728, 29889, 3952, 6774, 1053, 17745, 29918, 3881, 13, 13, 13, 1990, 4321, 8754, 473, 728, 29901, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6230, 29918, 1990, 29898, 25932, 1125, 13, 4706, 411, 11451, 1688, 29889, 4495, 1983, 29898, 8516, 29897, 408, 18116, 29901, 13, 9651, 1067, 29879, 29889, 1579, 473, 728, 353, 2379, 473, 728, 877, 21150, 29914, 4993, 1495, 13, 13, 1678, 822, 1243, 29918, 3597, 362, 29918, 3881, 29898, 1311, 1125, 13, 4706, 4974, 318, 29915, 29906, 29900, 29896, 29945, 29994, 29906, 29900, 29896, 29953, 29915, 1275, 17745, 29918, 3881, 29898, 1311, 29889, 1579, 473, 728, 29897, 13, 2 ]
xplainer/backend/tools/lime.py
liborvaneksw/xplainer
4
44359
import tensorflow as tf from lime import lime_image from skimage.segmentation import mark_boundaries from xplainer.backend.tools.abstract_tool import AbstractTool, GeneralSettings from xplainer.backend.utils.image import prepare_for_prediction, get_base64png class Lime(AbstractTool): def name(self): return "LIME" def category(self): return "Local" def description(self): return "Local Interpretable Model-Agnostic Explanations." def source_name(self) -> str: return "lime" def source_url(self) -> str: return "https://github.com/marcotcr/lime" def tool_parameters(self) -> dict: return { "list": [ { "param": "batch_size", "name": "Batch size", "type": "int", "default": 10, "min": 1, "step": 1, }, { "param": "num_features", "name": "Features", "type": "int", "default": 100000, "min": 1, "step": 10000, }, { "param": "num_samples", "name": "Samples", "type": "int", "default": 100, "min": 1, "step": 100, }, { "param": "positive_only", "name": "Positive only", "type": "bool", "default": True, }, { "param": "superpixels", "name": "Superpixels", "type": "int", "default": 5, "min": 1, "step": 1, }, { "param": "min_weight", "name": "Min weight", "type": "float", "default": 0.0, "min": 0.0, "step": 0.1, }, {"param": "hide_rest", "name": "Hide rest", "description": None, "type": "bool", "default": True,}, ], "layout": [ ["batch_size", "num_features", "num_samples"], ["superpixels", "min_weight", "positive_only", "hide_rest"], ], } def explain( self, model: tf.keras.Model, image_path: str, general_settings: GeneralSettings, tool_settings: dict = None ) -> list: image = prepare_for_prediction(model, image_path) onehot, labels = self._get_labels(model, image, general_settings) image = tf.cast(image, dtype=tf.float64) explainer = lime_image.LimeImageExplainer() explanation = explainer.explain_instance( image.numpy()[0], model.predict, labels=labels, batch_size=tool_settings["batch_size"], num_features=tool_settings["num_features"], num_samples=tool_settings["num_samples"], ) results = [] for label in labels: temp, mask = explanation.get_image_and_mask( label, positive_only=tool_settings["positive_only"], num_features=tool_settings["superpixels"], min_weight=tool_settings["min_weight"], hide_rest=tool_settings["hide_rest"], ) result_image = mark_boundaries(temp / 2 + 0.5, mask) result_image = tf.image.convert_image_dtype(result_image, dtype=tf.uint8, saturate=True) image_base46 = get_base64png(result_image) results.append( {"label_id": int(label), "probability": float(onehot[label]), "image": image_base46,} ) return results
[ 1, 1053, 26110, 408, 15886, 13, 3166, 301, 603, 1053, 301, 603, 29918, 3027, 13, 3166, 2071, 3027, 29889, 28192, 362, 1053, 2791, 29918, 9917, 4314, 13, 13, 3166, 921, 13974, 4983, 29889, 27852, 29889, 8504, 29889, 16595, 29918, 10154, 1053, 25513, 12229, 29892, 4593, 9585, 13, 3166, 921, 13974, 4983, 29889, 27852, 29889, 13239, 29889, 3027, 1053, 19012, 29918, 1454, 29918, 11965, 2463, 29892, 679, 29918, 3188, 29953, 29946, 2732, 13, 13, 13, 1990, 365, 603, 29898, 9118, 12229, 1125, 13, 1678, 822, 1024, 29898, 1311, 1125, 13, 4706, 736, 376, 5265, 2303, 29908, 13, 13, 1678, 822, 7663, 29898, 1311, 1125, 13, 4706, 736, 376, 7717, 29908, 13, 13, 1678, 822, 6139, 29898, 1311, 1125, 13, 4706, 736, 376, 7717, 4124, 1457, 2371, 8125, 29899, 29909, 5138, 520, 293, 1222, 9018, 800, 1213, 13, 13, 1678, 822, 2752, 29918, 978, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 28046, 29908, 13, 13, 1678, 822, 2752, 29918, 2271, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 376, 991, 597, 3292, 29889, 510, 29914, 3034, 26235, 7283, 29914, 28046, 29908, 13, 13, 1678, 822, 5780, 29918, 16744, 29898, 1311, 29897, 1599, 9657, 29901, 13, 4706, 736, 426, 13, 9651, 376, 1761, 1115, 518, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 16175, 29918, 2311, 613, 13, 462, 1678, 376, 978, 1115, 376, 23145, 2159, 613, 13, 462, 1678, 376, 1853, 1115, 376, 524, 613, 13, 462, 1678, 376, 4381, 1115, 29871, 29896, 29900, 29892, 13, 462, 1678, 376, 1195, 1115, 29871, 29896, 29892, 13, 462, 1678, 376, 10568, 1115, 29871, 29896, 29892, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 1949, 29918, 22100, 613, 13, 462, 1678, 376, 978, 1115, 376, 8263, 3698, 613, 13, 462, 1678, 376, 1853, 1115, 376, 524, 613, 13, 462, 1678, 376, 4381, 1115, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29892, 13, 462, 1678, 376, 1195, 1115, 29871, 29896, 29892, 13, 462, 1678, 376, 10568, 1115, 29871, 29896, 29900, 29900, 29900, 29900, 29892, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 1949, 29918, 27736, 613, 13, 462, 1678, 376, 978, 1115, 376, 29903, 9422, 613, 13, 462, 1678, 376, 1853, 1115, 376, 524, 613, 13, 462, 1678, 376, 4381, 1115, 29871, 29896, 29900, 29900, 29892, 13, 462, 1678, 376, 1195, 1115, 29871, 29896, 29892, 13, 462, 1678, 376, 10568, 1115, 29871, 29896, 29900, 29900, 29892, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 1066, 3321, 29918, 6194, 613, 13, 462, 1678, 376, 978, 1115, 376, 9135, 3321, 871, 613, 13, 462, 1678, 376, 1853, 1115, 376, 11227, 613, 13, 462, 1678, 376, 4381, 1115, 5852, 29892, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 9136, 29886, 861, 1379, 613, 13, 462, 1678, 376, 978, 1115, 376, 19111, 29886, 861, 1379, 613, 13, 462, 1678, 376, 1853, 1115, 376, 524, 613, 13, 462, 1678, 376, 4381, 1115, 29871, 29945, 29892, 13, 462, 1678, 376, 1195, 1115, 29871, 29896, 29892, 13, 462, 1678, 376, 10568, 1115, 29871, 29896, 29892, 13, 18884, 2981, 13, 18884, 426, 13, 462, 1678, 376, 3207, 1115, 376, 1195, 29918, 7915, 613, 13, 462, 1678, 376, 978, 1115, 376, 8140, 7688, 613, 13, 462, 1678, 376, 1853, 1115, 376, 7411, 613, 13, 462, 1678, 376, 4381, 1115, 29871, 29900, 29889, 29900, 29892, 13, 462, 1678, 376, 1195, 1115, 29871, 29900, 29889, 29900, 29892, 13, 462, 1678, 376, 10568, 1115, 29871, 29900, 29889, 29896, 29892, 13, 18884, 2981, 13, 18884, 8853, 3207, 1115, 376, 11458, 29918, 5060, 613, 376, 978, 1115, 376, 29950, 680, 1791, 613, 376, 8216, 1115, 6213, 29892, 376, 1853, 1115, 376, 11227, 613, 376, 4381, 1115, 5852, 29892, 1118, 13, 9651, 21251, 13, 9651, 376, 2680, 1115, 518, 13, 18884, 6796, 16175, 29918, 2311, 613, 376, 1949, 29918, 22100, 613, 376, 1949, 29918, 27736, 12436, 13, 18884, 6796, 9136, 29886, 861, 1379, 613, 376, 1195, 29918, 7915, 613, 376, 1066, 3321, 29918, 6194, 613, 376, 11458, 29918, 5060, 12436, 13, 9651, 21251, 13, 4706, 500, 13, 13, 1678, 822, 5649, 29898, 13, 4706, 1583, 29892, 1904, 29901, 15886, 29889, 3946, 294, 29889, 3195, 29892, 1967, 29918, 2084, 29901, 851, 29892, 2498, 29918, 11027, 29901, 4593, 9585, 29892, 5780, 29918, 11027, 29901, 9657, 353, 6213, 13, 1678, 1723, 1599, 1051, 29901, 13, 4706, 1967, 353, 19012, 29918, 1454, 29918, 11965, 2463, 29898, 4299, 29892, 1967, 29918, 2084, 29897, 13, 4706, 697, 8711, 29892, 11073, 353, 1583, 3032, 657, 29918, 21134, 29898, 4299, 29892, 1967, 29892, 2498, 29918, 11027, 29897, 13, 13, 4706, 1967, 353, 15886, 29889, 4384, 29898, 3027, 29892, 26688, 29922, 13264, 29889, 7411, 29953, 29946, 29897, 13, 4706, 3641, 4983, 353, 301, 603, 29918, 3027, 29889, 29931, 603, 2940, 9544, 433, 4983, 580, 13, 4706, 8252, 353, 3641, 4983, 29889, 4548, 7420, 29918, 8758, 29898, 13, 9651, 1967, 29889, 23749, 580, 29961, 29900, 1402, 13, 9651, 1904, 29889, 27711, 29892, 13, 9651, 11073, 29922, 21134, 29892, 13, 9651, 9853, 29918, 2311, 29922, 10154, 29918, 11027, 3366, 16175, 29918, 2311, 12436, 13, 9651, 954, 29918, 22100, 29922, 10154, 29918, 11027, 3366, 1949, 29918, 22100, 12436, 13, 9651, 954, 29918, 27736, 29922, 10154, 29918, 11027, 3366, 1949, 29918, 27736, 12436, 13, 4706, 1723, 13, 13, 4706, 2582, 353, 5159, 13, 4706, 363, 3858, 297, 11073, 29901, 13, 9651, 5694, 29892, 11105, 353, 8252, 29889, 657, 29918, 3027, 29918, 392, 29918, 13168, 29898, 13, 18884, 3858, 29892, 13, 18884, 6374, 29918, 6194, 29922, 10154, 29918, 11027, 3366, 1066, 3321, 29918, 6194, 12436, 13, 18884, 954, 29918, 22100, 29922, 10154, 29918, 11027, 3366, 9136, 29886, 861, 1379, 12436, 13, 18884, 1375, 29918, 7915, 29922, 10154, 29918, 11027, 3366, 1195, 29918, 7915, 12436, 13, 18884, 9563, 29918, 5060, 29922, 10154, 29918, 11027, 3366, 11458, 29918, 5060, 12436, 13, 9651, 1723, 13, 13, 9651, 1121, 29918, 3027, 353, 2791, 29918, 9917, 4314, 29898, 7382, 847, 29871, 29906, 718, 29871, 29900, 29889, 29945, 29892, 11105, 29897, 13, 9651, 1121, 29918, 3027, 353, 15886, 29889, 3027, 29889, 13441, 29918, 3027, 29918, 29881, 1853, 29898, 2914, 29918, 3027, 29892, 26688, 29922, 13264, 29889, 13470, 29947, 29892, 269, 1337, 403, 29922, 5574, 29897, 13, 13, 9651, 1967, 29918, 3188, 29946, 29953, 353, 679, 29918, 3188, 29953, 29946, 2732, 29898, 2914, 29918, 3027, 29897, 13, 9651, 2582, 29889, 4397, 29898, 13, 18884, 8853, 1643, 29918, 333, 1115, 938, 29898, 1643, 511, 376, 22795, 3097, 1115, 5785, 29898, 650, 8711, 29961, 1643, 11724, 376, 3027, 1115, 1967, 29918, 3188, 29946, 29953, 29892, 29913, 13, 9651, 1723, 13, 13, 4706, 736, 2582, 13, 2 ]
src/main/python/spec_checker/modules/cpu.py
houdinii/specCheckWithGui
1
116511
<filename>src/main/python/spec_checker/modules/cpu.py import psutil import pythoncom pythoncom.CoInitialize() class CpuRecord: """Holds and records the number of cores, usage, and frequency of the primary cpu Keyword Arguments: physical_cores -- Number of physical cores present (Default: None) total_cores -- Total number of cores including virtual cores (Default: None) min_frequency -- Minimum frequency (Default: None) max_frequency -- Maximum frequency (Default: None) current_frequency -- Current frequency (Default: None) total_usage -- Total usage as a percent (Default: None) """ def __init__(self, physical_cores=0, total_cores=0, min_frequency=None, max_frequency=None, current_frequency=None, total_usage=None): self.physical_cores = physical_cores self.total_cores = total_cores self.min_frequency = min_frequency self.max_frequency = max_frequency self.current_frequency = current_frequency self.total_usage = total_usage def __repr__(self): return f"<CpuRecord physical_cores:{self.physical_cores} total_cores:{self.total_cores}>" def __str__(self): return f""" CPU Information: Physical Cores: {self.physical_cores} Total Cores: {self.total_cores} Minimum Frequency: {self.min_frequency} Maximum Frequency: {self.max_frequency} Current Frequency: {self.current_frequency} Total Usage Percent: {self.total_usage}""" def test(self): """Performs the cpu test and records record to self Returns: <CpuRecord> """ self.physical_cores = psutil.cpu_count(logical=False) self.total_cores = psutil.cpu_count(logical=True) self.min_frequency = f"{psutil.cpu_freq().min:.2f}Mhz" self.max_frequency = f"{psutil.cpu_freq().max:.2f}Mhz" self.current_frequency = f"{psutil.cpu_freq().current:.2f}Mhz" self.total_usage = f"{psutil.cpu_percent()}%" return self
[ 1, 529, 9507, 29958, 4351, 29914, 3396, 29914, 4691, 29914, 6550, 29918, 3198, 261, 29914, 7576, 29914, 21970, 29889, 2272, 13, 5215, 6529, 4422, 13, 5215, 3017, 510, 13, 4691, 510, 29889, 7967, 6644, 6646, 580, 13, 13, 13, 1990, 315, 3746, 9182, 29901, 13, 1678, 9995, 29950, 3361, 322, 6475, 278, 1353, 310, 28337, 29892, 8744, 29892, 322, 10868, 310, 278, 7601, 26403, 13, 13, 1678, 7670, 1742, 11842, 9331, 29901, 13, 4706, 9128, 29918, 29883, 2361, 418, 1192, 9681, 310, 9128, 28337, 2198, 313, 4592, 29901, 6213, 29897, 13, 4706, 3001, 29918, 29883, 2361, 308, 1192, 14990, 1353, 310, 28337, 3704, 6901, 28337, 313, 4592, 29901, 6213, 29897, 13, 4706, 1375, 29918, 10745, 23860, 539, 1192, 3080, 12539, 10868, 313, 4592, 29901, 6213, 29897, 13, 4706, 4236, 29918, 10745, 23860, 539, 1192, 5918, 12539, 10868, 313, 4592, 29901, 6213, 29897, 13, 4706, 1857, 29918, 10745, 23860, 259, 1192, 9626, 10868, 313, 4592, 29901, 6213, 29897, 13, 4706, 3001, 29918, 21125, 308, 1192, 14990, 8744, 408, 263, 10151, 313, 4592, 29901, 6213, 29897, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9128, 29918, 29883, 2361, 29922, 29900, 29892, 3001, 29918, 29883, 2361, 29922, 29900, 29892, 1375, 29918, 10745, 23860, 29922, 8516, 29892, 13, 462, 4236, 29918, 10745, 23860, 29922, 8516, 29892, 1857, 29918, 10745, 23860, 29922, 8516, 29892, 3001, 29918, 21125, 29922, 8516, 1125, 13, 4706, 1583, 29889, 14017, 936, 29918, 29883, 2361, 353, 9128, 29918, 29883, 2361, 13, 4706, 1583, 29889, 7827, 29918, 29883, 2361, 353, 3001, 29918, 29883, 2361, 13, 4706, 1583, 29889, 1195, 29918, 10745, 23860, 353, 1375, 29918, 10745, 23860, 13, 4706, 1583, 29889, 3317, 29918, 10745, 23860, 353, 4236, 29918, 10745, 23860, 13, 4706, 1583, 29889, 3784, 29918, 10745, 23860, 353, 1857, 29918, 10745, 23860, 13, 4706, 1583, 29889, 7827, 29918, 21125, 353, 3001, 29918, 21125, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 285, 29908, 29966, 29907, 3746, 9182, 9128, 29918, 29883, 2361, 26254, 1311, 29889, 14017, 936, 29918, 29883, 2361, 29913, 3001, 29918, 29883, 2361, 26254, 1311, 29889, 7827, 29918, 29883, 2361, 29913, 11903, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 15945, 29908, 13, 6271, 29965, 10343, 29901, 13, 25847, 936, 315, 2361, 29901, 426, 1311, 29889, 14017, 936, 29918, 29883, 2361, 29913, 13, 11536, 315, 2361, 29901, 426, 1311, 29889, 7827, 29918, 29883, 2361, 29913, 13, 8140, 12539, 3878, 23860, 29901, 426, 1311, 29889, 1195, 29918, 10745, 23860, 29913, 13, 7976, 12539, 3878, 23860, 29901, 426, 1311, 29889, 3317, 29918, 10745, 23860, 29913, 13, 7583, 3878, 23860, 29901, 426, 1311, 29889, 3784, 29918, 10745, 23860, 29913, 13, 11536, 10783, 482, 2431, 1760, 29901, 426, 1311, 29889, 7827, 29918, 21125, 5038, 15945, 13, 13, 1678, 822, 1243, 29898, 1311, 1125, 13, 4706, 9995, 5894, 9514, 278, 26403, 1243, 322, 6475, 2407, 304, 1583, 13, 13, 4706, 16969, 29901, 529, 29907, 3746, 9182, 29958, 13, 4706, 9995, 13, 4706, 1583, 29889, 14017, 936, 29918, 29883, 2361, 353, 6529, 4422, 29889, 21970, 29918, 2798, 29898, 1188, 936, 29922, 8824, 29897, 13, 4706, 1583, 29889, 7827, 29918, 29883, 2361, 353, 6529, 4422, 29889, 21970, 29918, 2798, 29898, 1188, 936, 29922, 5574, 29897, 13, 4706, 1583, 29889, 1195, 29918, 10745, 23860, 353, 285, 29908, 29912, 567, 4422, 29889, 21970, 29918, 29888, 7971, 2141, 1195, 29901, 29889, 29906, 29888, 29913, 29924, 29882, 29920, 29908, 13, 4706, 1583, 29889, 3317, 29918, 10745, 23860, 353, 285, 29908, 29912, 567, 4422, 29889, 21970, 29918, 29888, 7971, 2141, 3317, 29901, 29889, 29906, 29888, 29913, 29924, 29882, 29920, 29908, 13, 4706, 1583, 29889, 3784, 29918, 10745, 23860, 353, 285, 29908, 29912, 567, 4422, 29889, 21970, 29918, 29888, 7971, 2141, 3784, 29901, 29889, 29906, 29888, 29913, 29924, 29882, 29920, 29908, 13, 4706, 1583, 29889, 7827, 29918, 21125, 353, 285, 29908, 29912, 567, 4422, 29889, 21970, 29918, 25376, 580, 10560, 29908, 13, 4706, 736, 1583, 13, 2 ]
PhyTestOnline/PhyTestOnline.py
JerryLife/PhyTestOnline
1
24662
<gh_stars>1-10 # -*- coding: utf-8 -*- # Copyright (C) 2016 <NAME> import urllib import urllib2 import re import xlwt START_PAGE = 0 # start page ALL_PAGE = 82 # number of all pages class PhyTestOnline(object): """ This class is specially for a HUST Physics Test Online providing a crawler to download the Keys and to save them as Excel(.xls). For convenience, you can just use PhyTestOnline.main() to finish the whole procedure. Attention: This is a simple practice in crawler, which is only for study and communication. It should never be used for illegal or improper ways like cheating. If so, the one who did it is responsible for his own behavior instead of the author. """ def __init__(self, baseURL="http://172.16.31.10/admin/menu/query/queryandchoose/xianshi?paperNum=0"): self.baseURL = baseURL def getFirstPage(self, url=None): if not url: url = self.baseURL try: user_agent = 'Mozilla/5.0 (Windows NT 10.0; WOW64) ' \ 'AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36' headers = {'User-Agent': user_agent} data = urllib.urlencode({}) request = urllib2.Request(url, data, headers) response = urllib2.urlopen(request, timeout=10) content = response.read() return content.decode('GBK') except urllib2.URLError, e: if hasattr(e, "reason"): print "Fail to connect to PhysicsTestOnline:", e.reason return None def getText(self, url=None): textModel = re.compile('<td width="146">([0-9]+\.jpg)') ansModel = re.compile('<td width="41">(.*)</td>') html = self.getFirstPage(url) if not html: return None text = re.findall(textModel, html) ans = re.findall(ansModel, html) if len(text) == len(ans): print "%d Got" % len(ans) return zip(text, ans) else: print "Answer or picture lost!" return None def getAll(self, allPage=ALL_PAGE): startPage = self.baseURL[0:-1] ansList = [] for i in range(START_PAGE, allPage+1): url = startPage + str(i) ans = self.getText(url) if not ans: pass else: print "Page%d finished.%d%%" % (i, i*100/allPage) ansList += ans print "Program complete." return ansList def saveAns(self, ansList, fileName='D:\TestAnswer.xls'): ans = xlwt.Workbook() sheet = ans.add_sheet('Sheet1') numOfProblems = len(ansList) for i in range(numOfProblems): sheet.write(i, 0, ansList[i][0]) sheet.write(i, 1, ansList[i][1]) print "Line %d saved.%d%% Finished" % (i+1, (i+1)*100/numOfProblems) # need protect? ans.protect = True ans.wnd_protect = True ans.obj_protect = True ans.save(fileName) print "All saved." return None def main(self): ansList = self.getAll() iSave = raw_input('Save now? y/n: ') if iSave == 'y': self.saveAns(ansList) else: return None return True ans = PhyTestOnline() ans.main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29953, 529, 5813, 3238, 13, 30004, 13, 5215, 3142, 1982, 30004, 13, 5215, 3142, 1982, 29906, 30004, 13, 5215, 337, 30004, 13, 5215, 921, 29880, 14554, 30004, 13, 30004, 13, 25826, 29918, 7228, 1692, 353, 29871, 29900, 29871, 396, 1369, 1813, 30004, 13, 9818, 29918, 7228, 1692, 353, 29871, 29947, 29906, 259, 396, 1353, 310, 599, 6515, 30004, 13, 30004, 13, 1990, 1963, 29891, 3057, 2951, 1220, 29898, 3318, 1125, 30004, 13, 1678, 9995, 30004, 13, 4706, 910, 770, 338, 961, 5584, 363, 263, 379, 17321, 29837, 4321, 13542, 13138, 263, 29349, 1358, 304, 5142, 30004, 13, 1678, 278, 4813, 952, 322, 304, 4078, 963, 408, 11388, 11891, 20267, 467, 1152, 29703, 29892, 366, 508, 925, 671, 1963, 29891, 3057, 2951, 1220, 29889, 3396, 26471, 13, 1678, 304, 8341, 278, 3353, 8792, 22993, 13, 4706, 6212, 2509, 29901, 910, 338, 263, 2560, 6944, 297, 29349, 1358, 29892, 607, 338, 871, 363, 6559, 322, 12084, 22993, 13, 1678, 739, 881, 2360, 367, 1304, 363, 27302, 470, 4857, 546, 5837, 763, 923, 1218, 29889, 960, 577, 29892, 278, 697, 1058, 1258, 372, 338, 30004, 13, 1678, 14040, 363, 670, 1914, 6030, 2012, 310, 278, 4148, 22993, 13, 1678, 9995, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2967, 4219, 543, 1124, 597, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29941, 29896, 29889, 29896, 29900, 29914, 6406, 29914, 6510, 29914, 1972, 29914, 1972, 392, 21803, 29914, 5389, 550, 2918, 29973, 19773, 8009, 29922, 29900, 29908, 1125, 30004, 13, 4706, 1583, 29889, 3188, 4219, 353, 2967, 4219, 30004, 13, 30004, 13, 1678, 822, 679, 6730, 5074, 29898, 1311, 29892, 3142, 29922, 8516, 1125, 30004, 13, 4706, 565, 451, 3142, 29901, 30004, 13, 9651, 3142, 353, 1583, 29889, 3188, 4219, 30004, 13, 4706, 1018, 29901, 30004, 13, 9651, 1404, 29918, 14748, 353, 525, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 7685, 405, 29911, 29871, 29896, 29900, 29889, 29900, 29936, 399, 9806, 29953, 29946, 29897, 525, 320, 30004, 13, 462, 308, 525, 2052, 280, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10228, 29914, 29945, 29946, 29889, 29900, 29889, 29906, 29947, 29946, 29900, 29889, 29929, 29929, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 29915, 30004, 13, 9651, 9066, 353, 11117, 2659, 29899, 19661, 2396, 1404, 29918, 14748, 8117, 13, 9651, 848, 353, 3142, 1982, 29889, 2271, 12508, 3319, 1800, 30004, 13, 9651, 2009, 353, 3142, 1982, 29906, 29889, 3089, 29898, 2271, 29892, 848, 29892, 9066, 8443, 13, 9651, 2933, 353, 3142, 1982, 29906, 29889, 332, 417, 2238, 29898, 3827, 29892, 11815, 29922, 29896, 29900, 8443, 13, 9651, 2793, 353, 2933, 29889, 949, 26471, 13, 9651, 736, 2793, 29889, 13808, 877, 7210, 29968, 1495, 30004, 13, 4706, 5174, 3142, 1982, 29906, 29889, 4574, 1307, 24616, 29892, 321, 29901, 30004, 13, 9651, 565, 756, 5552, 29898, 29872, 29892, 376, 23147, 29908, 1125, 30004, 13, 18884, 1596, 376, 16243, 304, 4511, 304, 29837, 3057, 2951, 1220, 29901, 613, 321, 29889, 23147, 30004, 13, 18884, 736, 6213, 30004, 13, 30004, 13, 1678, 822, 679, 1626, 29898, 1311, 29892, 3142, 29922, 8516, 1125, 30004, 13, 4706, 1426, 3195, 353, 337, 29889, 12198, 877, 29966, 1594, 2920, 543, 29896, 29946, 29953, 1013, 4197, 29900, 29899, 29929, 29962, 3124, 29889, 6173, 29897, 1495, 30004, 13, 4706, 6063, 3195, 353, 337, 29889, 12198, 877, 29966, 1594, 2920, 543, 29946, 29896, 1013, 28104, 29897, 829, 1594, 29958, 1495, 30004, 13, 4706, 3472, 353, 1583, 29889, 657, 6730, 5074, 29898, 2271, 8443, 13, 4706, 565, 451, 3472, 29901, 30004, 13, 9651, 736, 6213, 30004, 13, 4706, 1426, 353, 337, 29889, 2886, 497, 29898, 726, 3195, 29892, 3472, 8443, 13, 4706, 6063, 353, 337, 29889, 2886, 497, 29898, 550, 3195, 29892, 3472, 8443, 13, 4706, 565, 7431, 29898, 726, 29897, 1275, 7431, 29898, 550, 1125, 30004, 13, 9651, 1596, 11860, 29881, 15992, 29908, 1273, 7431, 29898, 550, 8443, 13, 9651, 736, 14319, 29898, 726, 29892, 6063, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 376, 22550, 470, 7623, 5714, 3850, 30004, 13, 9651, 736, 6213, 30004, 13, 30004, 13, 1678, 822, 679, 3596, 29898, 1311, 29892, 599, 5074, 29922, 9818, 29918, 7228, 1692, 1125, 30004, 13, 4706, 1369, 5074, 353, 1583, 29889, 3188, 4219, 29961, 29900, 13018, 29896, 29962, 30004, 13, 4706, 6063, 1293, 353, 5159, 30004, 13, 4706, 363, 474, 297, 3464, 29898, 25826, 29918, 7228, 1692, 29892, 599, 5074, 29974, 29896, 1125, 30004, 13, 9651, 3142, 353, 1369, 5074, 718, 851, 29898, 29875, 8443, 13, 9651, 6063, 353, 1583, 29889, 18516, 29898, 2271, 8443, 13, 9651, 565, 451, 6063, 29901, 30004, 13, 18884, 1209, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1596, 376, 5074, 29995, 29881, 7743, 29889, 29995, 29881, 7686, 29908, 1273, 313, 29875, 29892, 474, 29930, 29896, 29900, 29900, 29914, 497, 5074, 8443, 13, 18884, 6063, 1293, 4619, 6063, 30004, 13, 4706, 1596, 376, 9283, 4866, 1213, 30004, 13, 4706, 736, 6063, 1293, 30004, 13, 30004, 13, 1678, 822, 4078, 29909, 1983, 29898, 1311, 29892, 6063, 1293, 29892, 29729, 2433, 29928, 3583, 3057, 22550, 29889, 20267, 29374, 30004, 13, 4706, 6063, 353, 921, 29880, 14554, 29889, 26501, 26471, 13, 4706, 9869, 353, 6063, 29889, 1202, 29918, 9855, 877, 10654, 29896, 1495, 30004, 13, 4706, 954, 2776, 26604, 29879, 353, 7431, 29898, 550, 1293, 8443, 13, 30004, 13, 4706, 363, 474, 297, 3464, 29898, 1949, 2776, 26604, 29879, 1125, 30004, 13, 9651, 9869, 29889, 3539, 29898, 29875, 29892, 29871, 29900, 29892, 6063, 1293, 29961, 29875, 3816, 29900, 2314, 30004, 13, 9651, 9869, 29889, 3539, 29898, 29875, 29892, 29871, 29896, 29892, 6063, 1293, 29961, 29875, 3816, 29896, 2314, 30004, 13, 9651, 1596, 376, 3542, 1273, 29881, 7160, 29889, 29995, 29881, 7686, 4231, 3276, 29908, 1273, 313, 29875, 29974, 29896, 29892, 313, 29875, 29974, 29896, 11877, 29896, 29900, 29900, 29914, 1949, 2776, 26604, 29879, 8443, 13, 30004, 13, 4706, 396, 817, 12566, 29973, 30004, 13, 4706, 6063, 29889, 14676, 312, 353, 5852, 30004, 13, 4706, 6063, 29889, 29893, 299, 29918, 14676, 312, 353, 5852, 30004, 13, 4706, 6063, 29889, 5415, 29918, 14676, 312, 353, 5852, 30004, 13, 30004, 13, 4706, 6063, 29889, 7620, 29898, 28926, 8443, 13, 4706, 1596, 376, 3596, 7160, 1213, 30004, 13, 4706, 736, 6213, 30004, 13, 30004, 13, 1678, 822, 1667, 29898, 1311, 1125, 30004, 13, 4706, 6063, 1293, 353, 1583, 29889, 657, 3596, 26471, 13, 4706, 474, 11371, 353, 10650, 29918, 2080, 877, 11371, 1286, 29973, 343, 29914, 29876, 29901, 525, 8443, 13, 4706, 565, 474, 11371, 1275, 525, 29891, 2396, 30004, 13, 9651, 1583, 29889, 7620, 29909, 1983, 29898, 550, 1293, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 6213, 30004, 13, 4706, 736, 5852, 30004, 13, 30004, 13, 30004, 13, 550, 353, 1963, 29891, 3057, 2951, 1220, 26471, 13, 550, 29889, 3396, 580, 2 ]
tests/test_search.py
chdean/usajobs
2
83589
<reponame>chdean/usajobs import usajobs import pytest import requests def test_search(): test_url = 'https://api.usa.gov/jobs/search.json?query=park+ranger&size=100' test_data = requests.get(test_url).json() results = usajobs.search('park ranger', step=5, as_dict=True) assert len(results) == len(test_data) # hack
[ 1, 529, 276, 1112, 420, 29958, 305, 311, 273, 29914, 375, 1175, 26290, 13, 5215, 502, 1175, 26290, 13, 5215, 11451, 1688, 13, 5215, 7274, 13, 13, 13, 1753, 1243, 29918, 4478, 7295, 13, 1678, 1243, 29918, 2271, 353, 525, 991, 597, 2754, 29889, 11326, 29889, 13513, 29914, 9057, 29879, 29914, 4478, 29889, 3126, 29973, 1972, 29922, 6378, 29974, 29878, 4600, 29987, 2311, 29922, 29896, 29900, 29900, 29915, 13, 1678, 1243, 29918, 1272, 353, 7274, 29889, 657, 29898, 1688, 29918, 2271, 467, 3126, 580, 13, 1678, 2582, 353, 502, 1175, 26290, 29889, 4478, 877, 6378, 364, 4600, 742, 4331, 29922, 29945, 29892, 408, 29918, 8977, 29922, 5574, 29897, 13, 1678, 4974, 7431, 29898, 9902, 29897, 1275, 7431, 29898, 1688, 29918, 1272, 29897, 29871, 396, 15833, 13, 2 ]
metis/metis/__init__.py
joshblum/chronology
0
139019
<gh_stars>0 from gevent import monkey; monkey.patch_all() import os VERSION = (0, 1, 'alpha') def get_version(version=None): version = version or VERSION assert(len(version) == 3) return '%s.%s %s' % version # The file path will have `metis.zip` in it if its being run on Spark workers. # In that case we don't want to run the following initialization code because # it can (and does) break things. if 'metis.zip' in str(__file__): app = None else: from flask import Flask METIS_PATH = os.path.realpath(os.path.dirname(__file__)) app = Flask(__name__) app.config.from_pyfile('%s/conf/default_settings.py' % METIS_PATH) app.config['PATH'] = METIS_PATH import metis.views # noqa
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 1737, 794, 1053, 1601, 1989, 29936, 1601, 1989, 29889, 5041, 29918, 497, 580, 13, 13, 5215, 2897, 13, 13, 16358, 353, 313, 29900, 29892, 29871, 29896, 29892, 525, 2312, 1495, 13, 13, 13, 1753, 679, 29918, 3259, 29898, 3259, 29922, 8516, 1125, 13, 29871, 1873, 353, 1873, 470, 478, 1001, 13381, 13, 29871, 4974, 29898, 2435, 29898, 3259, 29897, 1275, 29871, 29941, 29897, 13, 29871, 736, 14210, 29879, 29889, 29995, 29879, 1273, 29879, 29915, 1273, 1873, 13, 13, 13, 29937, 450, 934, 2224, 674, 505, 421, 2527, 275, 29889, 7554, 29952, 297, 372, 565, 967, 1641, 1065, 373, 20814, 17162, 29889, 13, 29937, 512, 393, 1206, 591, 1016, 29915, 29873, 864, 304, 1065, 278, 1494, 17865, 775, 1363, 13, 29937, 372, 508, 313, 392, 947, 29897, 2867, 2712, 29889, 13, 361, 525, 2527, 275, 29889, 7554, 29915, 297, 851, 22168, 1445, 1649, 1125, 13, 29871, 623, 353, 6213, 13, 2870, 29901, 13, 29871, 515, 29784, 1053, 2379, 1278, 13, 13, 29871, 341, 2544, 3235, 29918, 10145, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 876, 13, 13, 29871, 623, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 29871, 623, 29889, 2917, 29889, 3166, 29918, 2272, 1445, 877, 29995, 29879, 29914, 5527, 29914, 4381, 29918, 11027, 29889, 2272, 29915, 1273, 341, 2544, 3235, 29918, 10145, 29897, 13, 29871, 623, 29889, 2917, 1839, 10145, 2033, 353, 341, 2544, 3235, 29918, 10145, 13, 13, 29871, 1053, 1539, 275, 29889, 7406, 29871, 396, 694, 25621, 13, 2 ]
mysite/urls.py
mnithya/cs3240-s15-team06-test
0
26786
from django.conf.urls import include, url from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns urlpatterns = [ # Examples: # url(r'^$', 'mysite.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', 'polls.views.home', name='home'), url(r'^admin/', include(admin.site.urls)), # user auth urls url(r'^accounts/login/$', 'polls.views.login'), url(r'^accounts/auth/$', 'polls.views.auth_view'), url(r'^accounts/logout/$', 'polls.views.logout'), url(r'^accounts/loggedin/$', 'polls.views.loggedin'), url(r'^accounts/invalid/$', 'polls.views.invalid_login'), url(r'^accounts/register/$', 'polls.views.register_user'), url(r'^accounts/register_success/$', 'polls.views.register_success'), # report url(r'^reports/new/$', 'polls.views.new_report'), url(r'^reports/list/$', 'polls.views.user_report'), url(r'^reports/detail/(?P<id>\d+)/$', 'polls.views.report_details'), url(r'^reports/delete/(?P<id>\d+)/$','polls.views.delete'), url(r'^reports/all/$','polls.views.report_all'), url(r'^reports/edit/(?P<id>\d+)/$', 'polls.views.edit_report'), # folder url(r'^folder/new/$', 'polls.views.new_folder'), #search url(r'^search-form/$', 'polls.views.search_form'), url(r'^search/$', 'polls.views.search'), ]
[ 1, 515, 9557, 29889, 5527, 29889, 26045, 1053, 3160, 29892, 3142, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 9557, 29889, 21570, 29889, 7959, 5325, 29889, 26045, 1053, 2294, 5325, 29918, 2271, 11037, 29879, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 396, 1222, 9422, 29901, 13, 1678, 396, 3142, 29898, 29878, 29915, 29985, 29938, 742, 525, 5781, 568, 29889, 7406, 29889, 5184, 742, 1024, 2433, 5184, 5477, 13, 1678, 396, 3142, 29898, 29878, 29915, 29985, 7312, 29914, 742, 3160, 877, 7312, 29889, 26045, 1495, 511, 13, 18884, 13, 18884, 13, 1678, 3142, 29898, 29878, 29915, 29985, 29938, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 5184, 742, 1024, 2433, 5184, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 6406, 29914, 742, 3160, 29898, 6406, 29889, 2746, 29889, 26045, 8243, 13, 13, 18884, 13, 1678, 396, 1404, 4817, 23942, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 7507, 13346, 742, 29871, 525, 29886, 3028, 29879, 29889, 7406, 29889, 7507, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 5150, 13346, 742, 29871, 525, 29886, 3028, 29879, 29889, 7406, 29889, 5150, 29918, 1493, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 1188, 449, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 1188, 449, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 1188, 3192, 262, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 1188, 3192, 262, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 20965, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 20965, 29918, 7507, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 9573, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 9573, 29918, 1792, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 10149, 29879, 29914, 9573, 29918, 8698, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 9573, 29918, 8698, 5477, 13, 268, 13, 1678, 396, 3461, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 1482, 13346, 742, 29871, 525, 29886, 3028, 29879, 29889, 7406, 29889, 1482, 29918, 12276, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 1761, 13346, 742, 29871, 525, 29886, 3028, 29879, 29889, 7406, 29889, 1792, 29918, 12276, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 16432, 29914, 10780, 29925, 29966, 333, 14247, 29881, 29974, 6802, 29938, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 12276, 29918, 14144, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 8143, 29914, 10780, 29925, 29966, 333, 14247, 29881, 29974, 6802, 29938, 3788, 29886, 3028, 29879, 29889, 7406, 29889, 8143, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 497, 13346, 3788, 29886, 3028, 29879, 29889, 7406, 29889, 12276, 29918, 497, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 276, 4011, 29914, 5628, 29914, 10780, 29925, 29966, 333, 14247, 29881, 29974, 6802, 29938, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 5628, 29918, 12276, 5477, 13, 18884, 13, 1678, 396, 4138, 13, 1678, 3142, 29898, 29878, 29915, 29985, 12083, 29914, 1482, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 1482, 29918, 12083, 5477, 13, 268, 13, 1678, 396, 4478, 13, 1678, 3142, 29898, 29878, 29915, 29985, 4478, 29899, 689, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 4478, 29918, 689, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 4478, 13346, 742, 525, 29886, 3028, 29879, 29889, 7406, 29889, 4478, 5477, 13, 18884, 13, 29962, 13, 2 ]
tests/test_user_model.py
Lifeistrange/flaskweb
0
60613
#!/usr/bin/env python # coding=utf-8 import unittest from app.domain.model import User, AnonymousUser, Permission, Role class UserModelTestCase(unittest.TestCase): def test_password_setter(self): u = User(password = '<PASSWORD>') self.assertTrue(u.password_hash is not None) def test_no_password_getter(self): u = User(password = '<PASSWORD>') with self.assertRaises(AttributeError): u.password def test_password_verifcation(self): u = User(password = '<PASSWORD>') self.assertTrue(u.verify_password('<PASSWORD>')) self.assertFalse(u.verify_password('<PASSWORD>')) def test_password_salts_are_random(self): u = User(password = '<PASSWORD>') u2 = User(password = '<PASSWORD>') self.assertTrue(u.password_hash != u2.password_hash) def test_roles_and_permissions(self): Role.insert_roles() u = User(email='<EMAIL>', password="<PASSWORD>") self.assertTrue(u.can(Permission.WRITE_ARTICLES)) self.assertFalse(u.can(Permission.MODERATE_COMMENTS)) def test_anonymous_user(self): u = AnonymousUser() self.assertFalse(u.can(Permission.FOLLOW))
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 13, 5215, 443, 27958, 13, 3166, 623, 29889, 7247, 29889, 4299, 1053, 4911, 29892, 530, 11428, 2659, 29892, 20894, 2333, 29892, 1528, 280, 13, 13, 1990, 4911, 3195, 3057, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 5630, 29918, 842, 357, 29898, 1311, 1125, 13, 4706, 318, 353, 4911, 29898, 5630, 353, 12801, 25711, 17013, 29958, 1495, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29884, 29889, 5630, 29918, 8568, 338, 451, 6213, 29897, 13, 13, 1678, 822, 1243, 29918, 1217, 29918, 5630, 29918, 657, 357, 29898, 1311, 1125, 13, 4706, 318, 353, 4911, 29898, 5630, 353, 12801, 25711, 17013, 29958, 1495, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 6708, 2392, 1125, 13, 9651, 318, 29889, 5630, 13, 13, 1678, 822, 1243, 29918, 5630, 29918, 369, 361, 9252, 29898, 1311, 1125, 13, 4706, 318, 353, 4911, 29898, 5630, 353, 12801, 25711, 17013, 29958, 1495, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29884, 29889, 27902, 29918, 5630, 877, 29966, 25711, 17013, 29958, 8785, 13, 4706, 1583, 29889, 9294, 8824, 29898, 29884, 29889, 27902, 29918, 5630, 877, 29966, 25711, 17013, 29958, 8785, 13, 13, 1678, 822, 1243, 29918, 5630, 29918, 19585, 1372, 29918, 598, 29918, 8172, 29898, 1311, 1125, 13, 4706, 318, 353, 4911, 29898, 5630, 353, 12801, 25711, 17013, 29958, 1495, 13, 4706, 318, 29906, 353, 4911, 29898, 5630, 353, 12801, 25711, 17013, 29958, 1495, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29884, 29889, 5630, 29918, 8568, 2804, 318, 29906, 29889, 5630, 29918, 8568, 29897, 13, 632, 13, 1678, 822, 1243, 29918, 307, 793, 29918, 392, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 1528, 280, 29889, 7851, 29918, 307, 793, 580, 13, 4706, 318, 353, 4911, 29898, 5269, 2433, 29966, 26862, 6227, 29958, 742, 4800, 543, 29966, 25711, 17013, 29958, 1159, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29884, 29889, 3068, 29898, 27293, 29889, 16365, 29918, 8322, 2965, 17101, 876, 13, 4706, 1583, 29889, 9294, 8824, 29898, 29884, 29889, 3068, 29898, 27293, 29889, 6720, 8032, 3040, 29918, 3217, 7428, 3919, 29903, 876, 13, 13, 1678, 822, 1243, 29918, 25772, 29918, 1792, 29898, 1311, 1125, 13, 4706, 318, 353, 530, 11428, 2659, 580, 13, 4706, 1583, 29889, 9294, 8824, 29898, 29884, 29889, 3068, 29898, 27293, 29889, 5800, 2208, 9806, 876, 13, 2 ]
Minimum Index Sum of Two Lists.py
sugia/leetcode
0
193714
''' Suppose Andy and Doris want to choose a restaurant for dinner, and they both have a list of favorite restaurants represented by strings. You need to help them find out their common interest with the least list index sum. If there is a choice tie between answers, output all of them with no order requirement. You could assume there always exists an answer. Example 1: Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"] ["Piatti", "The Grill at Torrey Pines", "Hungry Hunter Steakhouse", "Shogun"] Output: ["Shogun"] Explanation: The only restaurant they both like is "Shogun". Example 2: Input: ["Shogun", "Tapioca Express", "Burger King", "KFC"] ["KFC", "Shogun", "Burger King"] Output: ["Shogun"] Explanation: The restaurant they both like and have the least index sum is "Shogun" with index sum 1 (0+1). Note: The length of both lists will be in the range of [1, 1000]. The length of strings in both lists will be in the range of [1, 30]. The index is starting from 0 to the list length minus 1. No duplicates in both lists. ''' class Solution(object): def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] :rtype: List[str] """ if len(list1) < len(list2): return self.findRestaurant(list2, list1) key_to_idx = {} for i in xrange(len(list2)): key_to_idx[list2[i]] = i res = [] idx_sum = float('inf') for i in xrange(len(list1)): if list1[i] in key_to_idx: tmp = i + key_to_idx[list1[i]] if tmp < idx_sum: res = [list1[i]] idx_sum = tmp elif tmp == idx_sum: res.append(list1[i]) return res
[ 1, 14550, 13, 20182, 852, 21828, 322, 9579, 275, 864, 304, 6755, 263, 27144, 363, 17803, 29892, 322, 896, 1716, 505, 263, 1051, 310, 25448, 12374, 1934, 9875, 491, 6031, 29889, 13, 13, 3492, 817, 304, 1371, 963, 1284, 714, 1009, 3619, 4066, 411, 278, 3203, 1051, 2380, 2533, 29889, 960, 727, 338, 263, 7348, 22134, 1546, 6089, 29892, 1962, 599, 310, 963, 411, 694, 1797, 11809, 29889, 887, 1033, 5251, 727, 2337, 4864, 385, 1234, 29889, 13, 13, 14023, 29871, 29896, 29901, 13, 4290, 29901, 13, 3366, 2713, 468, 348, 613, 376, 29911, 2754, 6400, 14657, 613, 376, 29933, 26120, 4088, 613, 376, 29968, 8610, 3108, 13, 3366, 12197, 11556, 613, 376, 1576, 1632, 453, 472, 4794, 8903, 349, 1475, 613, 376, 29950, 348, 14793, 25703, 2443, 557, 8697, 613, 376, 2713, 468, 348, 3108, 13, 6466, 29901, 6796, 2713, 468, 348, 3108, 13, 1252, 9018, 362, 29901, 450, 871, 27144, 896, 1716, 763, 338, 376, 2713, 468, 348, 1642, 13, 14023, 29871, 29906, 29901, 13, 4290, 29901, 13, 3366, 2713, 468, 348, 613, 376, 29911, 2754, 6400, 14657, 613, 376, 29933, 26120, 4088, 613, 376, 29968, 8610, 3108, 13, 3366, 29968, 8610, 613, 376, 2713, 468, 348, 613, 376, 29933, 26120, 4088, 3108, 13, 6466, 29901, 6796, 2713, 468, 348, 3108, 13, 1252, 9018, 362, 29901, 450, 27144, 896, 1716, 763, 322, 505, 278, 3203, 2380, 2533, 338, 376, 2713, 468, 348, 29908, 411, 2380, 2533, 29871, 29896, 313, 29900, 29974, 29896, 467, 13, 9842, 29901, 13, 1576, 3309, 310, 1716, 8857, 674, 367, 297, 278, 3464, 310, 518, 29896, 29892, 29871, 29896, 29900, 29900, 29900, 1822, 13, 1576, 3309, 310, 6031, 297, 1716, 8857, 674, 367, 297, 278, 3464, 310, 518, 29896, 29892, 29871, 29941, 29900, 1822, 13, 1576, 2380, 338, 6257, 515, 29871, 29900, 304, 278, 1051, 3309, 26134, 29871, 29896, 29889, 13, 3782, 20955, 297, 1716, 8857, 29889, 13, 12008, 13, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 1284, 29934, 22837, 424, 29898, 1311, 29892, 1051, 29896, 29892, 1051, 29906, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 1051, 29896, 29901, 2391, 29961, 710, 29962, 13, 4706, 584, 1853, 1051, 29906, 29901, 2391, 29961, 710, 29962, 13, 4706, 584, 29878, 1853, 29901, 2391, 29961, 710, 29962, 13, 4706, 9995, 13, 308, 13, 4706, 565, 7431, 29898, 1761, 29896, 29897, 529, 7431, 29898, 1761, 29906, 1125, 13, 9651, 736, 1583, 29889, 2886, 29934, 22837, 424, 29898, 1761, 29906, 29892, 1051, 29896, 29897, 13, 308, 13, 4706, 1820, 29918, 517, 29918, 13140, 353, 6571, 13, 4706, 363, 474, 297, 921, 3881, 29898, 2435, 29898, 1761, 29906, 22164, 13, 9651, 1820, 29918, 517, 29918, 13140, 29961, 1761, 29906, 29961, 29875, 5262, 353, 474, 13, 632, 13, 4706, 620, 353, 5159, 13, 4706, 22645, 29918, 2083, 353, 5785, 877, 7192, 1495, 13, 308, 13, 4706, 363, 474, 297, 921, 3881, 29898, 2435, 29898, 1761, 29896, 22164, 13, 9651, 565, 1051, 29896, 29961, 29875, 29962, 297, 1820, 29918, 517, 29918, 13140, 29901, 13, 18884, 13128, 353, 474, 718, 1820, 29918, 517, 29918, 13140, 29961, 1761, 29896, 29961, 29875, 5262, 13, 18884, 565, 13128, 529, 22645, 29918, 2083, 29901, 13, 462, 1678, 620, 353, 518, 1761, 29896, 29961, 29875, 5262, 13, 462, 1678, 22645, 29918, 2083, 353, 13128, 13, 18884, 25342, 13128, 1275, 22645, 29918, 2083, 29901, 13, 462, 1678, 620, 29889, 4397, 29898, 1761, 29896, 29961, 29875, 2314, 13, 462, 268, 13, 4706, 736, 620, 13, 308, 13, 2 ]
upsampling/utils/__init__.py
Giamm9998/face_detection_on_sim_events
5
1614347
<filename>upsampling/utils/__init__.py from .dataset import Sequence from .upsampler import Upsampler from .utils import get_sequence_or_none
[ 1, 529, 9507, 29958, 14340, 314, 10335, 29914, 13239, 29914, 1649, 2344, 26914, 2272, 13, 3166, 869, 24713, 1053, 922, 3910, 13, 3166, 869, 14340, 314, 20069, 1053, 501, 567, 314, 20069, 13, 3166, 869, 13239, 1053, 679, 29918, 16506, 29918, 272, 29918, 9290, 13, 2 ]
efficiency_mark.py
DaCentDD/asvspoof2019
0
60950
import os import statistics import librosa import sox from concurrent.futures import ThreadPoolExecutor directory = "flac" lengths = [] for file in os.listdir(directory): print(file) length = librosa.get_duration(filename=f"flac\\{file}") lengths.append(length) transform = sox.Transformer(); transform.trim(length*0.25) transform.build_file(f"flac\\{file}", f"75%\\{file}") lengths.append(librosa.get_duration(filename=f"75%\\{file}")) with (open("median_length.txt", "a")) as info: info.writelines(f"100%: {statistics.median(lengths)}")
[ 1, 1053, 2897, 13, 5215, 13964, 13, 5215, 4303, 1883, 29874, 13, 5215, 577, 29916, 13, 3166, 21984, 29889, 29888, 329, 1973, 1053, 10480, 11426, 13366, 13, 13, 12322, 353, 376, 29888, 4620, 29908, 13, 2848, 29879, 353, 5159, 13, 13, 1454, 934, 297, 2897, 29889, 1761, 3972, 29898, 12322, 1125, 29871, 13, 1678, 1596, 29898, 1445, 29897, 13, 1678, 3309, 353, 4303, 1883, 29874, 29889, 657, 29918, 19708, 29898, 9507, 29922, 29888, 29908, 29888, 4620, 1966, 29912, 1445, 27195, 13, 1678, 27497, 29889, 4397, 29898, 2848, 29897, 13, 1678, 4327, 353, 577, 29916, 29889, 13372, 261, 890, 13, 1678, 4327, 29889, 15450, 29898, 2848, 29930, 29900, 29889, 29906, 29945, 29897, 29871, 13, 1678, 4327, 29889, 4282, 29918, 1445, 29898, 29888, 29908, 29888, 4620, 1966, 29912, 1445, 17671, 285, 29908, 29955, 29945, 29995, 1966, 29912, 1445, 27195, 13, 1678, 27497, 29889, 4397, 29898, 1982, 1883, 29874, 29889, 657, 29918, 19708, 29898, 9507, 29922, 29888, 29908, 29955, 29945, 29995, 1966, 29912, 1445, 5038, 876, 13, 13, 13, 2541, 313, 3150, 703, 2168, 713, 29918, 2848, 29889, 3945, 613, 376, 29874, 5783, 408, 5235, 29901, 13, 1678, 5235, 29889, 8231, 24210, 29898, 29888, 29908, 29896, 29900, 29900, 29995, 29901, 426, 6112, 6765, 29889, 2168, 713, 29898, 2848, 29879, 2915, 1159, 13, 13, 13, 13, 13, 13, 13, 268, 13, 13, 2 ]
rlil/presets/continuous/models.py
syuntoku14/pytorch-rl-il
43
1601135
<filename>rlil/presets/continuous/models.py ''' Pytorch models for continuous control. ''' import numpy as np import torch from rlil import nn def fc_q(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, 1), ) def fc_v(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, 1), ) def fc_deterministic_policy(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.action_space.shape[0]), ) def fc_deterministic_noisy_policy(env, hidden1=400, hidden2=300): return nn.Sequential( nn.NoisyFactorizedLinear(env.state_space.shape[0], hidden1), nn.LeakyReLU(), nn.NoisyFactorizedLinear(hidden1, hidden2), nn.LeakyReLU(), nn.NoisyFactorizedLinear(hidden2, env.action_space.shape[0]), ) def fc_soft_policy(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.action_space.shape[0] * 2), ) def fc_actor_critic(env, hidden1=400, hidden2=300): features = nn.Sequential( nn.Linear(env.state_space.shape[0], hidden1), nn.LeakyReLU(), ) v = nn.Sequential( nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, 1) ) policy = nn.Sequential( nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.action_space.shape[0] * 2) ) return features, v, policy def fc_discriminator(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, 1), nn.Sigmoid()) def fc_bcq_encoder(env, latent_dim=32, hidden1=400, hidden2=300): # output mean and log_var return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, latent_dim * 2) ) def fc_bcq_decoder(env, latent_dim=32, hidden1=300, hidden2=400): return nn.Sequential( nn.Linear(env.state_space.shape[0] + latent_dim, hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.action_space.shape[0]) ) def fc_bcq_deterministic_policy(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.action_space.shape[0]), ) def fc_reward(env, hidden1=400, hidden2=300): return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, 1) ) def fc_dynamics(env, hidden1=500, hidden2=500): return nn.Sequential( nn.Linear(env.state_space.shape[0] + env.action_space.shape[0], hidden1), nn.LeakyReLU(), nn.Linear(hidden1, hidden2), nn.LeakyReLU(), nn.Linear(hidden2, env.state_space.shape[0]), )
[ 1, 529, 9507, 29958, 2096, 309, 29914, 4569, 1691, 29914, 20621, 681, 29914, 9794, 29889, 2272, 13, 12008, 13, 29925, 3637, 25350, 4733, 363, 9126, 2761, 29889, 13, 12008, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 3166, 364, 29880, 309, 1053, 302, 29876, 13, 13, 13, 1753, 285, 29883, 29918, 29939, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 13, 462, 29871, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 29871, 29896, 511, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 29894, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 29871, 29896, 511, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 4801, 837, 262, 4695, 29918, 22197, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 11724, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 4801, 837, 262, 4695, 29918, 1217, 13344, 29918, 22197, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 3782, 13344, 29943, 7168, 1891, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 3782, 13344, 29943, 7168, 1891, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 3782, 13344, 29943, 7168, 1891, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 11724, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 2695, 29918, 22197, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 334, 29871, 29906, 511, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 7168, 29918, 9695, 293, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 5680, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 1678, 1723, 13, 13, 1678, 325, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 29871, 29896, 29897, 13, 1678, 1723, 13, 13, 1678, 8898, 353, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 334, 29871, 29906, 29897, 13, 1678, 1723, 13, 13, 1678, 736, 5680, 29892, 325, 29892, 8898, 13, 13, 13, 1753, 285, 29883, 29918, 2218, 29883, 20386, 1061, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 13, 462, 29871, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 29871, 29896, 511, 13, 4706, 302, 29876, 29889, 29903, 335, 29885, 3398, 3101, 13, 13, 13, 1753, 285, 29883, 29918, 12328, 29939, 29918, 3977, 6119, 29898, 6272, 29892, 3405, 296, 29918, 6229, 29922, 29941, 29906, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 396, 1962, 2099, 322, 1480, 29918, 1707, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 13, 462, 29871, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 3405, 296, 29918, 6229, 334, 29871, 29906, 29897, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 12328, 29939, 29918, 7099, 6119, 29898, 6272, 29892, 3405, 296, 29918, 6229, 29922, 29941, 29906, 29892, 7934, 29896, 29922, 29941, 29900, 29900, 29892, 7934, 29906, 29922, 29946, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 3405, 296, 29918, 6229, 29892, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 2314, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 12328, 29939, 29918, 4801, 837, 262, 4695, 29918, 22197, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 13, 462, 29871, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 11724, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 276, 1328, 29898, 6272, 29892, 7934, 29896, 29922, 29946, 29900, 29900, 29892, 7934, 29906, 29922, 29941, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 13, 462, 29871, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 29871, 29896, 29897, 13, 1678, 1723, 13, 13, 13, 1753, 285, 29883, 29918, 29881, 2926, 1199, 29898, 6272, 29892, 7934, 29896, 29922, 29945, 29900, 29900, 29892, 7934, 29906, 29922, 29945, 29900, 29900, 1125, 13, 1678, 736, 302, 29876, 29889, 16941, 2556, 29898, 13, 4706, 302, 29876, 29889, 12697, 29898, 6272, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 29962, 718, 13, 462, 29871, 8829, 29889, 2467, 29918, 3493, 29889, 12181, 29961, 29900, 1402, 7934, 29896, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29896, 29892, 7934, 29906, 511, 13, 4706, 302, 29876, 29889, 3226, 557, 29891, 1123, 29931, 29965, 3285, 13, 4706, 302, 29876, 29889, 12697, 29898, 10892, 29906, 29892, 8829, 29889, 3859, 29918, 3493, 29889, 12181, 29961, 29900, 11724, 13, 1678, 1723, 13, 2 ]
app.py
chezhia/robinhood-portfolio
87
76680
<gh_stars>10-100 import os import numpy as np import seaborn as sns import matplotlib.pyplot as plt import matplotlib.ticker as ticker import matplotlib.dates as mdates from flask import Flask, render_template, request from backend.backend import BackendClass from io import BytesIO # Initialize MY_DPI = 96 DATAFILE = 'data/data.h5' USERFILE = 'data/user.pkl' sns.set_style("whitegrid") app = Flask(__name__) app.config['SECRET_KEY'] = 'My_l0ng_very_secure_secret_k3y' app.config['DEBUG'] = False app.config['TESTING'] = False def plot_returns(data): # Set up the matplotlib figure f, ax = plt.subplots(figsize=(900/MY_DPI, 400/MY_DPI), dpi=MY_DPI) x = data.index.values y = data.values ax.plot(x, y, linewidth=1.0, color='#2c7fb8') ax.axhline(y=0, color='#e34a33', linestyle='-', linewidth=0.5) ax.set_ylabel("Portfolio returns") # format y-axis ax.get_yaxis().set_major_formatter( ticker.FuncFormatter(lambda x, p: '${:.0f}'.format(x))) # format dates # months_ticks = mdates.MonthLocator() # every month date_fmt = mdates.DateFormatter('%b-%Y') # ax.xaxis.set_major_locator(months_ticks) ax.xaxis.set_major_formatter(date_fmt) ax.grid(False, axis='both', linestyle='-', linewidth=0.5, color="#deebf7") # saving and exporting the svg with BytesIO() as img_svg: f.savefig(img_svg, format='svg', dpi=MY_DPI, bbox_inches='tight') figdata_svg =\ '<svg' + img_svg.getvalue().decode('utf-8').split('<svg')[1] plt.close(f) return figdata_svg def plot_heatmap(corr): # prepare data corr = corr.copy() mask = np.zeros_like(corr, dtype=np.bool) mask[np.triu_indices_from(mask)] = True # Set up the matplotlib figure f, ax = plt.subplots(figsize=(900/MY_DPI, 400/MY_DPI), dpi=MY_DPI) # Generate a custom diverging colormap cmap = sns.diverging_palette(220, 20, n=10, as_cmap=True) # Draw the heatmap with the mask and correct aspect ratio ax = sns.heatmap( corr, mask=mask, cmap=cmap, center=0, square=False, linewidths=.5, cbar_kws={ "shrink": .8, 'format': '%.2f'}, annot=True, fmt=".3f") plt.setp(ax.get_yticklabels(), rotation=0) # saving and exporting the svg with BytesIO() as img_svg: f.savefig(img_svg, format='svg', dpi=MY_DPI, bbox_inches='tight') figdata_svg =\ '<svg' + img_svg.getvalue().decode('utf-8').split('<svg')[1] plt.close(f) return figdata_svg # default route @app.route('/', methods=["GET", "POST"]) def portfolio(): date_fmt = '{:%d-%b-%Y}' # initiate backend and get all values bc = BackendClass(DATAFILE, USERFILE) bc = bc.calculate_all() # create plots plot_corr_svg = plot_heatmap(bc.stock['corr']) plot_returns_svg = plot_returns(bc.portfolio['daily']) # handle update of market or robinhood data if request.method == 'POST': if request.form['refresh'] == 'market': bc.update_market_data() elif request.form['refresh'] == 'robinhood': user = request.form['inputUser'] password = request.form['inputPassword'] bc.update_robinhood_data(user, password) bc = bc.calculate_all() return render_template( 'pages/portfolio.html', plot_returns_svg=plot_returns_svg, plot_corr_svg=plot_corr_svg, portfolio=bc.portfolio, trades=bc.trades, stock=bc.stock, markowitz=bc.markowitz, rb_dates=[date_fmt.format(x) for x in bc.user['rb_dates']], mkt_dates=[date_fmt.format(x) for x in bc.user['mkt_dates']], today=date_fmt.format(bc.user['today']), ) if __name__ == '__main__': PORT = int(os.getenv('PORT', 8080)) HOST = os.getenv('HOST', '0.0.0.0') app.run(debug=True, host=HOST, port=PORT)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 2897, 13, 5215, 12655, 408, 7442, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 22889, 29889, 29873, 6541, 408, 260, 6541, 13, 5215, 22889, 29889, 15190, 408, 286, 15190, 13, 3166, 29784, 1053, 2379, 1278, 29892, 4050, 29918, 6886, 29892, 2009, 13, 3166, 14998, 29889, 27852, 1053, 7437, 355, 2385, 13, 3166, 12013, 1053, 2648, 2167, 5971, 13, 13, 29937, 25455, 13, 17870, 29918, 29928, 2227, 353, 29871, 29929, 29953, 13, 14573, 7724, 353, 525, 1272, 29914, 1272, 29889, 29882, 29945, 29915, 13, 11889, 7724, 353, 525, 1272, 29914, 1792, 29889, 29886, 6321, 29915, 13, 29879, 1983, 29889, 842, 29918, 3293, 703, 1332, 277, 387, 2429, 1159, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 932, 29889, 2917, 1839, 1660, 22245, 29911, 29918, 10818, 2033, 353, 525, 3421, 29918, 29880, 29900, 865, 29918, 1201, 29918, 24216, 29918, 19024, 29918, 29895, 29941, 29891, 29915, 13, 932, 29889, 2917, 1839, 18525, 2033, 353, 7700, 13, 932, 29889, 2917, 1839, 18267, 4214, 2033, 353, 7700, 13, 13, 13, 1753, 6492, 29918, 18280, 29898, 1272, 1125, 13, 1678, 396, 3789, 701, 278, 22889, 4377, 13, 1678, 285, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29929, 29900, 29900, 29914, 17870, 29918, 29928, 2227, 29892, 29871, 29946, 29900, 29900, 29914, 17870, 29918, 29928, 2227, 511, 270, 1631, 29922, 17870, 29918, 29928, 2227, 29897, 13, 1678, 921, 353, 848, 29889, 2248, 29889, 5975, 13, 1678, 343, 353, 848, 29889, 5975, 13, 13, 1678, 4853, 29889, 5317, 29898, 29916, 29892, 343, 29892, 1196, 2103, 29922, 29896, 29889, 29900, 29892, 2927, 2433, 29937, 29906, 29883, 29955, 14943, 29947, 1495, 13, 1678, 4853, 29889, 1165, 7760, 29898, 29891, 29922, 29900, 29892, 2927, 2433, 29937, 29872, 29941, 29946, 29874, 29941, 29941, 742, 6276, 342, 1508, 2433, 29899, 742, 1196, 2103, 29922, 29900, 29889, 29945, 29897, 13, 1678, 4853, 29889, 842, 29918, 29891, 1643, 703, 2290, 25648, 3639, 1159, 13, 13, 1678, 396, 3402, 343, 29899, 8990, 13, 1678, 4853, 29889, 657, 29918, 29891, 8990, 2141, 842, 29918, 21355, 29918, 689, 2620, 29898, 13, 4706, 260, 6541, 29889, 14400, 18522, 29898, 2892, 921, 29892, 282, 29901, 525, 5303, 29901, 29889, 29900, 29888, 29913, 4286, 4830, 29898, 29916, 4961, 13, 13, 1678, 396, 3402, 10116, 13, 1678, 396, 7378, 29918, 29873, 7358, 353, 286, 15190, 29889, 13953, 3524, 1061, 580, 29871, 396, 1432, 4098, 13, 1678, 2635, 29918, 23479, 353, 286, 15190, 29889, 2539, 18522, 877, 29995, 29890, 19222, 29979, 1495, 13, 1678, 396, 4853, 29889, 29916, 8990, 29889, 842, 29918, 21355, 29918, 2029, 1061, 29898, 10874, 29879, 29918, 29873, 7358, 29897, 13, 1678, 4853, 29889, 29916, 8990, 29889, 842, 29918, 21355, 29918, 689, 2620, 29898, 1256, 29918, 23479, 29897, 13, 13, 1678, 4853, 29889, 7720, 29898, 8824, 29892, 9685, 2433, 20313, 742, 6276, 342, 1508, 2433, 29899, 742, 1196, 2103, 29922, 29900, 29889, 29945, 29892, 2927, 9880, 311, 774, 29888, 29955, 1159, 13, 13, 1678, 396, 14238, 322, 5609, 292, 278, 25773, 13, 1678, 411, 2648, 2167, 5971, 580, 408, 10153, 29918, 15120, 29901, 13, 4706, 285, 29889, 7620, 1003, 29898, 2492, 29918, 15120, 29892, 3402, 2433, 15120, 742, 270, 1631, 29922, 17870, 29918, 29928, 2227, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 4706, 2537, 1272, 29918, 15120, 17313, 13, 9651, 12801, 15120, 29915, 718, 10153, 29918, 15120, 29889, 657, 1767, 2141, 13808, 877, 9420, 29899, 29947, 2824, 5451, 877, 29966, 15120, 29861, 29896, 29962, 13, 1678, 14770, 29889, 5358, 29898, 29888, 29897, 13, 1678, 736, 2537, 1272, 29918, 15120, 13, 13, 13, 1753, 6492, 29918, 354, 271, 1958, 29898, 29725, 1125, 13, 1678, 396, 19012, 848, 13, 1678, 27760, 353, 27760, 29889, 8552, 580, 13, 1678, 11105, 353, 7442, 29889, 3298, 359, 29918, 4561, 29898, 29725, 29892, 26688, 29922, 9302, 29889, 11227, 29897, 13, 1678, 11105, 29961, 9302, 29889, 3626, 29884, 29918, 513, 1575, 29918, 3166, 29898, 13168, 4638, 353, 5852, 13, 13, 1678, 396, 3789, 701, 278, 22889, 4377, 13, 1678, 285, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29929, 29900, 29900, 29914, 17870, 29918, 29928, 2227, 29892, 29871, 29946, 29900, 29900, 29914, 17870, 29918, 29928, 2227, 511, 270, 1631, 29922, 17870, 29918, 29928, 2227, 29897, 13, 13, 1678, 396, 3251, 403, 263, 2888, 17089, 3460, 784, 555, 481, 13, 1678, 274, 1958, 353, 269, 1983, 29889, 29881, 2147, 3460, 29918, 29886, 26456, 29898, 29906, 29906, 29900, 29892, 29871, 29906, 29900, 29892, 302, 29922, 29896, 29900, 29892, 408, 29918, 29883, 1958, 29922, 5574, 29897, 13, 13, 1678, 396, 18492, 278, 12871, 1958, 411, 278, 11105, 322, 1959, 9565, 11959, 13, 1678, 4853, 353, 269, 1983, 29889, 354, 271, 1958, 29898, 13, 4706, 27760, 29892, 11105, 29922, 13168, 29892, 274, 1958, 29922, 29883, 1958, 29892, 4818, 29922, 29900, 29892, 13, 4706, 6862, 29922, 8824, 29892, 1196, 2103, 29879, 21098, 29945, 29892, 13, 4706, 274, 1646, 29918, 29895, 5652, 3790, 13, 9651, 376, 845, 29878, 682, 1115, 869, 29947, 29892, 13, 9651, 525, 4830, 2396, 14210, 29889, 29906, 29888, 16675, 13, 4706, 9732, 29922, 5574, 29892, 19200, 29569, 29941, 29888, 1159, 13, 1678, 14770, 29889, 842, 29886, 29898, 1165, 29889, 657, 29918, 3637, 860, 21134, 3285, 13733, 29922, 29900, 29897, 13, 13, 1678, 396, 14238, 322, 5609, 292, 278, 25773, 13, 1678, 411, 2648, 2167, 5971, 580, 408, 10153, 29918, 15120, 29901, 13, 4706, 285, 29889, 7620, 1003, 29898, 2492, 29918, 15120, 29892, 3402, 2433, 15120, 742, 270, 1631, 29922, 17870, 29918, 29928, 2227, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 4706, 2537, 1272, 29918, 15120, 17313, 13, 9651, 12801, 15120, 29915, 718, 10153, 29918, 15120, 29889, 657, 1767, 2141, 13808, 877, 9420, 29899, 29947, 2824, 5451, 877, 29966, 15120, 29861, 29896, 29962, 13, 1678, 14770, 29889, 5358, 29898, 29888, 29897, 13, 1678, 736, 2537, 1272, 29918, 15120, 13, 13, 13, 29937, 2322, 5782, 13, 29992, 932, 29889, 13134, 11219, 742, 3519, 29922, 3366, 7194, 613, 376, 5438, 20068, 13, 1753, 2011, 25648, 7295, 13, 1678, 2635, 29918, 23479, 353, 22372, 16664, 29881, 19222, 29890, 19222, 29979, 10162, 13, 1678, 396, 14511, 403, 14998, 322, 679, 599, 1819, 13, 1678, 289, 29883, 353, 7437, 355, 2385, 29898, 14573, 7724, 29892, 3148, 1001, 7724, 29897, 13, 1678, 289, 29883, 353, 289, 29883, 29889, 15807, 403, 29918, 497, 580, 13, 13, 1678, 396, 1653, 24580, 13, 1678, 6492, 29918, 29725, 29918, 15120, 353, 6492, 29918, 354, 271, 1958, 29898, 12328, 29889, 17712, 1839, 29725, 11287, 13, 1678, 6492, 29918, 18280, 29918, 15120, 353, 6492, 29918, 18280, 29898, 12328, 29889, 637, 25648, 1839, 29881, 8683, 11287, 13, 13, 1678, 396, 4386, 2767, 310, 9999, 470, 696, 2109, 6614, 848, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 565, 2009, 29889, 689, 1839, 22379, 2033, 1275, 525, 28549, 2396, 13, 9651, 289, 29883, 29889, 5504, 29918, 28549, 29918, 1272, 580, 13, 4706, 25342, 2009, 29889, 689, 1839, 22379, 2033, 1275, 525, 307, 2109, 6614, 2396, 13, 9651, 1404, 353, 2009, 29889, 689, 1839, 2080, 2659, 2033, 13, 9651, 4800, 353, 2009, 29889, 689, 1839, 2080, 10048, 2033, 13, 9651, 289, 29883, 29889, 5504, 29918, 307, 2109, 6614, 29918, 1272, 29898, 1792, 29892, 4800, 29897, 13, 13, 1678, 289, 29883, 353, 289, 29883, 29889, 15807, 403, 29918, 497, 580, 13, 13, 1678, 736, 4050, 29918, 6886, 29898, 13, 4706, 525, 12292, 29914, 637, 25648, 29889, 1420, 742, 13, 4706, 6492, 29918, 18280, 29918, 15120, 29922, 5317, 29918, 18280, 29918, 15120, 29892, 13, 4706, 6492, 29918, 29725, 29918, 15120, 29922, 5317, 29918, 29725, 29918, 15120, 29892, 13, 4706, 2011, 25648, 29922, 12328, 29889, 637, 25648, 29892, 13, 4706, 534, 3076, 29922, 12328, 29889, 509, 3076, 29892, 13, 4706, 10961, 29922, 12328, 29889, 17712, 29892, 13, 4706, 2791, 340, 2784, 29922, 12328, 29889, 3502, 340, 2784, 29892, 13, 4706, 364, 29890, 29918, 15190, 11759, 1256, 29918, 23479, 29889, 4830, 29898, 29916, 29897, 363, 921, 297, 289, 29883, 29889, 1792, 1839, 6050, 29918, 15190, 2033, 1402, 13, 4706, 286, 1193, 29918, 15190, 11759, 1256, 29918, 23479, 29889, 4830, 29898, 29916, 29897, 363, 921, 297, 289, 29883, 29889, 1792, 1839, 29885, 1193, 29918, 15190, 2033, 1402, 13, 4706, 9826, 29922, 1256, 29918, 23479, 29889, 4830, 29898, 12328, 29889, 1792, 1839, 27765, 2033, 511, 13, 1678, 1723, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 349, 8476, 353, 938, 29898, 359, 29889, 657, 6272, 877, 15082, 742, 29871, 29947, 29900, 29947, 29900, 876, 13, 1678, 379, 3718, 353, 2897, 29889, 657, 6272, 877, 20832, 742, 525, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 1495, 13, 1678, 623, 29889, 3389, 29898, 8382, 29922, 5574, 29892, 3495, 29922, 20832, 29892, 2011, 29922, 15082, 29897, 13, 2 ]
cli/tests/awsbatch/conftest.py
jason-mccloskey/aws-parallelcluster
1
1607560
<gh_stars>1-10 """ This module loads pytest fixtures and plugins needed by all tests. It's very useful for fixtures that need to be shared among all tests. """ from __future__ import print_function import boto3 import pytest from botocore.stub import Stubber from common import DEFAULT_AWSBATCHCLICONFIG_MOCK_CONFIG @pytest.fixture def failed_with_message(capsys): """Assert that the command exited with a specific error message.""" __tracebackhide__ = True def _failed_with_message(func, message, *args, **kwargs): __tracebackhide__ = True with pytest.raises(SystemExit) as error: func(*args, **kwargs) assert error.type == SystemExit assert error.value.code == 1 if message: assert capsys.readouterr().err == message return _failed_with_message @pytest.fixture() def test_datadir(request, datadir): """ Inject the datadir with resources for the specific test function. If the test function is declared in a class then datadir is ClassName/FunctionName otherwise it is only FunctionName. """ function_name = request.function.__name__ if not request.cls: return datadir / function_name class_name = request.cls.__name__ return datadir / "{0}/{1}".format(class_name, function_name) @pytest.fixture() def awsbatchcliconfig_mock(request, mocker): """Mock AWSBatchCliConfig object with a default mock.""" module_under_test = request.module.__name__.replace("test_", "") mock = mocker.patch("awsbatch." + module_under_test + ".AWSBatchCliConfig", autospec=True) for key, value in DEFAULT_AWSBATCHCLICONFIG_MOCK_CONFIG.items(): setattr(mock.return_value, key, value) return mock @pytest.fixture() def convert_to_date_mock(request, mocker): """Mock convert_to_date function by enforcing the timezone to UTC.""" module_under_test = request.module.__name__.replace("test_", "") def _convert_to_date_utc(*args, **kwargs): from awsbatch.utils import convert_to_date from dateutil import tz # executes convert_to_date but overrides arguments so that timezone is enforced to utc if "timezone" in kwargs: del kwargs["timezone"] return convert_to_date(timezone=tz.tzutc(), *args, **kwargs) return mocker.patch("awsbatch." + module_under_test + ".convert_to_date", wraps=_convert_to_date_utc) @pytest.fixture() def boto3_stubber(request, mocker): """ Create a function to easily mock boto3 clients. To mock a boto3 service simply pass the name of the service to mock and the mocked requests, where mocked_requests is an object containing the method to mock, the response to return and the expected params for the boto3 method that gets called. The function makes use of botocore.Stubber to mock the boto3 API calls. Multiple boto3 services can be mocked as part of the same test. """ __tracebackhide__ = True created_stubbers = [] mocked_clients = {} region = "us-east-1" # Mock Boto3ClientFactory in the module under test. # Use a side_effect to allow mocking multiple clients in the same test function. module_under_test = request.module.__name__.replace("test_", "") mocked_client_factory = mocker.patch("awsbatch." + module_under_test + ".Boto3ClientFactory", autospec=True) mocked_client_factory.return_value.get_client.side_effect = lambda x: mocked_clients[x] mocked_client_factory.return_value.region = region def _boto3_stubber(service, mocked_requests): client = boto3.client(service, region) stubber = Stubber(client) # Save a ref to the stubber so that we can deactivate it at the end of the test. created_stubbers.append(stubber) # Attach mocked requests to the Stubber and activate it. if not isinstance(mocked_requests, list): mocked_requests = [mocked_requests] for mocked_request in mocked_requests: stubber.add_response( mocked_request.method, mocked_request.response, expected_params=mocked_request.expected_params ) stubber.activate() # Add stubber to the collection of mocked clients. This allows to mock multiple clients. # Mocking twice the same client will replace the previous one. mocked_clients[service] = client return client # yield allows to return the value and then continue the execution when the test is over. # Used for resources cleanup. yield _boto3_stubber # Assert that all mocked requests were consumed and deactivate all stubbers. for stubber in created_stubbers: stubber.assert_no_pending_responses() stubber.deactivate()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 13, 4013, 3883, 15376, 11451, 1688, 5713, 486, 1973, 322, 18224, 4312, 491, 599, 6987, 29889, 13, 13, 3112, 29915, 29879, 1407, 5407, 363, 5713, 486, 1973, 393, 817, 304, 367, 7258, 4249, 599, 6987, 29889, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 289, 3747, 29941, 13, 5215, 11451, 1688, 13, 3166, 9225, 542, 487, 29889, 303, 431, 1053, 624, 431, 495, 13, 13, 3166, 3619, 1053, 22236, 29918, 29376, 1744, 14789, 6154, 2965, 1164, 18667, 29918, 6720, 7077, 29918, 25903, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 13, 1753, 5229, 29918, 2541, 29918, 4906, 29898, 29883, 2547, 952, 1125, 13, 1678, 9995, 14697, 393, 278, 1899, 429, 1573, 411, 263, 2702, 1059, 2643, 1213, 15945, 13, 1678, 4770, 15003, 1627, 11458, 1649, 353, 5852, 13, 13, 1678, 822, 903, 26061, 29918, 2541, 29918, 4906, 29898, 9891, 29892, 2643, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 4770, 15003, 1627, 11458, 1649, 353, 5852, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 3924, 24365, 29897, 408, 1059, 29901, 13, 9651, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 4974, 1059, 29889, 1853, 1275, 2184, 24365, 13, 4706, 4974, 1059, 29889, 1767, 29889, 401, 1275, 29871, 29896, 13, 4706, 565, 2643, 29901, 13, 9651, 4974, 2117, 9675, 29889, 949, 5561, 29878, 2141, 3127, 1275, 2643, 13, 13, 1678, 736, 903, 26061, 29918, 2541, 29918, 4906, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 1243, 29918, 4130, 328, 381, 29898, 3827, 29892, 1418, 328, 381, 1125, 13, 1678, 9995, 13, 1678, 512, 622, 278, 1418, 328, 381, 411, 7788, 363, 278, 2702, 1243, 740, 29889, 13, 13, 1678, 960, 278, 1243, 740, 338, 8052, 297, 263, 770, 769, 1418, 328, 381, 338, 4134, 1170, 29914, 6678, 1170, 13, 1678, 6467, 372, 338, 871, 6680, 1170, 29889, 13, 1678, 9995, 13, 1678, 740, 29918, 978, 353, 2009, 29889, 2220, 17255, 978, 1649, 13, 1678, 565, 451, 2009, 29889, 25932, 29901, 13, 4706, 736, 1418, 328, 381, 847, 740, 29918, 978, 13, 13, 1678, 770, 29918, 978, 353, 2009, 29889, 25932, 17255, 978, 1649, 13, 1678, 736, 1418, 328, 381, 847, 29850, 29900, 6822, 29912, 29896, 29913, 1642, 4830, 29898, 1990, 29918, 978, 29892, 740, 29918, 978, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 25879, 16175, 28746, 265, 1003, 29918, 17640, 29898, 3827, 29892, 286, 8658, 1125, 13, 1678, 9995, 18680, 319, 29956, 1744, 905, 29907, 492, 3991, 1203, 411, 263, 2322, 11187, 1213, 15945, 13, 1678, 3883, 29918, 5062, 29918, 1688, 353, 2009, 29889, 5453, 17255, 978, 26914, 6506, 703, 1688, 29918, 613, 20569, 13, 1678, 11187, 353, 286, 8658, 29889, 5041, 703, 10467, 16175, 1213, 718, 3883, 29918, 5062, 29918, 1688, 718, 11393, 29376, 1744, 905, 29907, 492, 3991, 613, 1120, 359, 3135, 29922, 5574, 29897, 13, 1678, 363, 1820, 29892, 995, 297, 22236, 29918, 29376, 1744, 14789, 6154, 2965, 1164, 18667, 29918, 6720, 7077, 29918, 25903, 29889, 7076, 7295, 13, 4706, 731, 5552, 29898, 17640, 29889, 2457, 29918, 1767, 29892, 1820, 29892, 995, 29897, 13, 1678, 736, 11187, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 3588, 29918, 517, 29918, 1256, 29918, 17640, 29898, 3827, 29892, 286, 8658, 1125, 13, 1678, 9995, 18680, 3588, 29918, 517, 29918, 1256, 740, 491, 24555, 3277, 278, 29431, 304, 17998, 1213, 15945, 13, 1678, 3883, 29918, 5062, 29918, 1688, 353, 2009, 29889, 5453, 17255, 978, 26914, 6506, 703, 1688, 29918, 613, 20569, 13, 13, 1678, 822, 903, 13441, 29918, 517, 29918, 1256, 29918, 329, 29883, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 515, 25879, 16175, 29889, 13239, 1053, 3588, 29918, 517, 29918, 1256, 13, 4706, 515, 2635, 4422, 1053, 260, 29920, 13, 13, 4706, 396, 24138, 3588, 29918, 517, 29918, 1256, 541, 975, 24040, 6273, 577, 393, 29431, 338, 24555, 1133, 304, 3477, 29883, 13, 4706, 565, 376, 2230, 8028, 29908, 297, 9049, 5085, 29901, 13, 9651, 628, 9049, 5085, 3366, 2230, 8028, 3108, 13, 4706, 736, 3588, 29918, 517, 29918, 1256, 29898, 2230, 8028, 29922, 17559, 29889, 17559, 329, 29883, 3285, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 736, 286, 8658, 29889, 5041, 703, 10467, 16175, 1213, 718, 3883, 29918, 5062, 29918, 1688, 718, 11393, 13441, 29918, 517, 29918, 1256, 613, 11463, 567, 29922, 29918, 13441, 29918, 517, 29918, 1256, 29918, 329, 29883, 29897, 13, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 289, 3747, 29941, 29918, 303, 431, 495, 29898, 3827, 29892, 286, 8658, 1125, 13, 1678, 9995, 13, 1678, 6204, 263, 740, 304, 5948, 11187, 289, 3747, 29941, 13154, 29889, 13, 13, 1678, 1763, 11187, 263, 289, 3747, 29941, 2669, 3763, 1209, 278, 1024, 310, 278, 2669, 304, 11187, 322, 13, 1678, 278, 11187, 287, 7274, 29892, 988, 11187, 287, 29918, 24830, 338, 385, 1203, 6943, 278, 1158, 304, 11187, 29892, 13, 1678, 278, 2933, 304, 736, 322, 278, 3806, 8636, 363, 278, 289, 3747, 29941, 1158, 393, 4947, 2000, 29889, 13, 13, 1678, 450, 740, 3732, 671, 310, 9225, 542, 487, 29889, 855, 431, 495, 304, 11187, 278, 289, 3747, 29941, 3450, 5717, 29889, 13, 1678, 26905, 289, 3747, 29941, 5786, 508, 367, 11187, 287, 408, 760, 310, 278, 1021, 1243, 29889, 13, 1678, 9995, 13, 1678, 4770, 15003, 1627, 11458, 1649, 353, 5852, 13, 1678, 2825, 29918, 303, 431, 2596, 353, 5159, 13, 1678, 11187, 287, 29918, 11303, 1237, 353, 6571, 13, 1678, 5120, 353, 376, 375, 29899, 23027, 29899, 29896, 29908, 13, 1678, 396, 26297, 350, 3747, 29941, 4032, 5126, 297, 278, 3883, 1090, 1243, 29889, 13, 1678, 396, 4803, 263, 2625, 29918, 15987, 304, 2758, 11187, 292, 2999, 13154, 297, 278, 1021, 1243, 740, 29889, 13, 1678, 3883, 29918, 5062, 29918, 1688, 353, 2009, 29889, 5453, 17255, 978, 26914, 6506, 703, 1688, 29918, 613, 20569, 13, 1678, 11187, 287, 29918, 4645, 29918, 14399, 353, 286, 8658, 29889, 5041, 703, 10467, 16175, 1213, 718, 3883, 29918, 5062, 29918, 1688, 718, 11393, 29933, 3747, 29941, 4032, 5126, 613, 1120, 359, 3135, 29922, 5574, 29897, 13, 1678, 11187, 287, 29918, 4645, 29918, 14399, 29889, 2457, 29918, 1767, 29889, 657, 29918, 4645, 29889, 2975, 29918, 15987, 353, 14013, 921, 29901, 11187, 287, 29918, 11303, 1237, 29961, 29916, 29962, 13, 1678, 11187, 287, 29918, 4645, 29918, 14399, 29889, 2457, 29918, 1767, 29889, 12803, 353, 5120, 13, 13, 1678, 822, 903, 29890, 3747, 29941, 29918, 303, 431, 495, 29898, 5509, 29892, 11187, 287, 29918, 24830, 1125, 13, 4706, 3132, 353, 289, 3747, 29941, 29889, 4645, 29898, 5509, 29892, 5120, 29897, 13, 4706, 19281, 495, 353, 624, 431, 495, 29898, 4645, 29897, 13, 4706, 396, 16913, 263, 2143, 304, 278, 19281, 495, 577, 393, 591, 508, 316, 11236, 403, 372, 472, 278, 1095, 310, 278, 1243, 29889, 13, 4706, 2825, 29918, 303, 431, 2596, 29889, 4397, 29898, 303, 431, 495, 29897, 13, 13, 4706, 396, 6212, 496, 11187, 287, 7274, 304, 278, 624, 431, 495, 322, 5039, 403, 372, 29889, 13, 4706, 565, 451, 338, 8758, 29898, 17640, 287, 29918, 24830, 29892, 1051, 1125, 13, 9651, 11187, 287, 29918, 24830, 353, 518, 17640, 287, 29918, 24830, 29962, 13, 4706, 363, 11187, 287, 29918, 3827, 297, 11187, 287, 29918, 24830, 29901, 13, 9651, 19281, 495, 29889, 1202, 29918, 5327, 29898, 13, 18884, 11187, 287, 29918, 3827, 29889, 5696, 29892, 11187, 287, 29918, 3827, 29889, 5327, 29892, 3806, 29918, 7529, 29922, 17640, 287, 29918, 3827, 29889, 9684, 29918, 7529, 13, 9651, 1723, 13, 4706, 19281, 495, 29889, 11236, 403, 580, 13, 13, 4706, 396, 3462, 19281, 495, 304, 278, 4333, 310, 11187, 287, 13154, 29889, 910, 6511, 304, 11187, 2999, 13154, 29889, 13, 4706, 396, 26297, 292, 8951, 278, 1021, 3132, 674, 5191, 278, 3517, 697, 29889, 13, 4706, 11187, 287, 29918, 11303, 1237, 29961, 5509, 29962, 353, 3132, 13, 4706, 736, 3132, 13, 13, 1678, 396, 7709, 6511, 304, 736, 278, 995, 322, 769, 6773, 278, 8225, 746, 278, 1243, 338, 975, 29889, 13, 1678, 396, 501, 8485, 363, 7788, 5941, 786, 29889, 13, 1678, 7709, 903, 29890, 3747, 29941, 29918, 303, 431, 495, 13, 13, 1678, 396, 16499, 393, 599, 11187, 287, 7274, 892, 11233, 287, 322, 316, 11236, 403, 599, 19281, 2596, 29889, 13, 1678, 363, 19281, 495, 297, 2825, 29918, 303, 431, 2596, 29901, 13, 4706, 19281, 495, 29889, 9294, 29918, 1217, 29918, 29886, 2548, 29918, 26679, 267, 580, 13, 4706, 19281, 495, 29889, 311, 11236, 403, 580, 13, 2 ]
examples/interconnector_constant_loss_percentage.py
dec-heim/nempy
24
77545
<reponame>dec-heim/nempy import pandas as pd from nempy import markets # The only generator is located in NSW. unit_info = pd.DataFrame({ 'unit': ['A'], 'region': ['NSW'] # MW }) # Create a market instance. market = markets.SpotMarket(unit_info=unit_info, market_regions=['NSW', 'VIC']) # Volume of each bids. volume_bids = pd.DataFrame({ 'unit': ['A'], '1': [100.0] # MW }) market.set_unit_volume_bids(volume_bids) # Price of each bid. price_bids = pd.DataFrame({ 'unit': ['A'], '1': [50.0] # $/MW }) market.set_unit_price_bids(price_bids) # NSW has no demand but VIC has 90 MW. demand = pd.DataFrame({ 'region': ['NSW', 'VIC'], 'demand': [0.0, 90.0] # MW }) market.set_demand_constraints(demand) # There is one interconnector between NSW and VIC. Its nominal direction is towards VIC. interconnectors = pd.DataFrame({ 'interconnector': ['little_link'], 'to_region': ['VIC'], 'from_region': ['NSW'], 'max': [100.0], 'min': [-120.0] }) market.set_interconnectors(interconnectors) # The interconnector loss function. In this case losses are always 5 % of line flow. def constant_losses(flow): return abs(flow) * 0.05 # The loss function on a per interconnector basis. Also details how the losses should be proportioned to the # connected regions. loss_functions = pd.DataFrame({ 'interconnector': ['little_link'], 'from_region_loss_share': [0.5], # losses are shared equally. 'loss_function': [constant_losses] }) # The points to linearly interpolate the loss function between. In this example the loss function is linear so only # three points are needed, but if a non linear loss function was used then more points would be better. interpolation_break_points = pd.DataFrame({ 'interconnector': ['little_link', 'little_link', 'little_link'], 'loss_segment': [1, 2, 3], 'break_point': [-120.0, 0.0, 100] }) market.set_interconnector_losses(loss_functions, interpolation_break_points) # Calculate dispatch. market.dispatch() # Return interconnector flow and losses. print(market.get_interconnector_flows()) # interconnector flow losses # 0 little_link 92.307692 4.615385 # Understanding the interconnector flows: Losses are modelled as extra demand # in the regions on either side of the interconnector, in this case the losses # are split evenly between the regions. All demand in VIC must be supplied # across the interconnector, and losses in VIC will add to the interconnector # flow required, so we can write the equation: # # flow = vic_demand + flow * loss_pct_vic # flow - flow * loss_pct_vic = vic_demand # flow * (1 - loss_pct_vic) = vic_demand # flow = vic_demand / (1 - loss_pct_vic) # # Since interconnector losses are 5% and half occur in VIC the # loss_pct_vic = 2.5%. Thus: # # flow = 90 / (1 - 0.025) = 92.31 # # Knowing the interconnector flow we can work out total losses # # losses = flow * loss_pct # losses = 92.31 * 0.05 = 4.62 # Return the total dispatch of each unit in MW. print(market.get_unit_dispatch()) # unit service dispatch # 0 A energy 94.615385 # Understanding dispatch results: Unit A must be dispatch to # meet supply in VIC plus all interconnector losses, therefore # dispatch is 90.0 + 4.62 = 94.62. # Return the price of energy in each region. print(market.get_energy_prices()) # region price # 0 NSW 50.000000 # 1 VIC 52.564103 # Understanding pricing results: The marginal cost of supply in NSW is simply # the cost of unit A's bid. However, the marginal cost of supply in VIC also # includes the cost of paying for interconnector losses.
[ 1, 529, 276, 1112, 420, 29958, 7099, 29899, 6391, 29914, 15344, 2272, 13, 5215, 11701, 408, 10518, 13, 3166, 6583, 2272, 1053, 2791, 1691, 13, 13, 29937, 450, 871, 15299, 338, 5982, 297, 3865, 29956, 29889, 13, 5441, 29918, 3888, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 5441, 2396, 6024, 29909, 7464, 13, 1678, 525, 12803, 2396, 6024, 3059, 29956, 2033, 29871, 396, 341, 29956, 13, 1800, 13, 13, 29937, 6204, 263, 9999, 2777, 29889, 13, 28549, 353, 2791, 1691, 29889, 5592, 327, 9802, 300, 29898, 5441, 29918, 3888, 29922, 5441, 29918, 3888, 29892, 9999, 29918, 1727, 1080, 29922, 1839, 3059, 29956, 742, 525, 29963, 2965, 11287, 13, 13, 29937, 16934, 310, 1269, 289, 4841, 29889, 13, 24623, 29918, 29890, 4841, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 5441, 2396, 6024, 29909, 7464, 13, 1678, 525, 29896, 2396, 518, 29896, 29900, 29900, 29889, 29900, 29962, 29871, 396, 341, 29956, 13, 1800, 13, 13, 28549, 29889, 842, 29918, 5441, 29918, 24623, 29918, 29890, 4841, 29898, 24623, 29918, 29890, 4841, 29897, 13, 13, 29937, 20743, 310, 1269, 21000, 29889, 13, 9175, 29918, 29890, 4841, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 5441, 2396, 6024, 29909, 7464, 13, 1678, 525, 29896, 2396, 518, 29945, 29900, 29889, 29900, 29962, 29871, 396, 395, 29914, 25365, 13, 1800, 13, 13, 28549, 29889, 842, 29918, 5441, 29918, 9175, 29918, 29890, 4841, 29898, 9175, 29918, 29890, 4841, 29897, 13, 13, 29937, 3865, 29956, 756, 694, 9667, 541, 478, 2965, 756, 29871, 29929, 29900, 341, 29956, 29889, 13, 2310, 392, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 12803, 2396, 6024, 3059, 29956, 742, 525, 29963, 2965, 7464, 13, 1678, 525, 2310, 392, 2396, 518, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29962, 29871, 396, 341, 29956, 13, 1800, 13, 13, 28549, 29889, 842, 29918, 2310, 392, 29918, 13646, 29879, 29898, 2310, 392, 29897, 13, 13, 29937, 1670, 338, 697, 1006, 11958, 2801, 1546, 3865, 29956, 322, 478, 2965, 29889, 8011, 2245, 979, 5305, 338, 7113, 478, 2965, 29889, 13, 1639, 6915, 943, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 1639, 11958, 2801, 2396, 6024, 29880, 1992, 29918, 2324, 7464, 13, 1678, 525, 517, 29918, 12803, 2396, 6024, 29963, 2965, 7464, 13, 1678, 525, 3166, 29918, 12803, 2396, 6024, 3059, 29956, 7464, 13, 1678, 525, 3317, 2396, 518, 29896, 29900, 29900, 29889, 29900, 1402, 13, 1678, 525, 1195, 2396, 21069, 29896, 29906, 29900, 29889, 29900, 29962, 13, 1800, 13, 13, 28549, 29889, 842, 29918, 1639, 6915, 943, 29898, 1639, 6915, 943, 29897, 13, 13, 13, 29937, 450, 1006, 11958, 2801, 6410, 740, 29889, 512, 445, 1206, 28495, 526, 2337, 29871, 29945, 1273, 310, 1196, 4972, 29889, 13, 1753, 4868, 29918, 6758, 267, 29898, 1731, 1125, 13, 1678, 736, 6425, 29898, 1731, 29897, 334, 29871, 29900, 29889, 29900, 29945, 13, 13, 13, 29937, 450, 6410, 740, 373, 263, 639, 1006, 11958, 2801, 8405, 29889, 3115, 4902, 920, 278, 28495, 881, 367, 18618, 287, 304, 278, 13, 29937, 6631, 12786, 29889, 13, 6758, 29918, 12171, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 1639, 11958, 2801, 2396, 6024, 29880, 1992, 29918, 2324, 7464, 13, 1678, 525, 3166, 29918, 12803, 29918, 6758, 29918, 13653, 2396, 518, 29900, 29889, 29945, 1402, 29871, 396, 28495, 526, 7258, 18018, 29889, 13, 1678, 525, 6758, 29918, 2220, 2396, 518, 23362, 29918, 6758, 267, 29962, 13, 1800, 13, 13, 29937, 450, 3291, 304, 5608, 368, 20064, 403, 278, 6410, 740, 1546, 29889, 512, 445, 1342, 278, 6410, 740, 338, 5608, 577, 871, 13, 29937, 2211, 3291, 526, 4312, 29892, 541, 565, 263, 1661, 5608, 6410, 740, 471, 1304, 769, 901, 3291, 723, 367, 2253, 29889, 13, 1639, 3733, 362, 29918, 8690, 29918, 9748, 353, 10518, 29889, 17271, 3319, 13, 1678, 525, 1639, 11958, 2801, 2396, 6024, 29880, 1992, 29918, 2324, 742, 525, 29880, 1992, 29918, 2324, 742, 525, 29880, 1992, 29918, 2324, 7464, 13, 1678, 525, 6758, 29918, 28192, 2396, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 1402, 13, 1678, 525, 8690, 29918, 3149, 2396, 21069, 29896, 29906, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29896, 29900, 29900, 29962, 13, 1800, 13, 13, 28549, 29889, 842, 29918, 1639, 11958, 2801, 29918, 6758, 267, 29898, 6758, 29918, 12171, 29892, 29694, 29918, 8690, 29918, 9748, 29897, 13, 13, 29937, 20535, 403, 13916, 29889, 13, 28549, 29889, 13369, 580, 13, 13, 29937, 7106, 1006, 11958, 2801, 4972, 322, 28495, 29889, 13, 2158, 29898, 28549, 29889, 657, 29918, 1639, 11958, 2801, 29918, 1731, 29879, 3101, 13, 29937, 259, 1006, 11958, 2801, 539, 4972, 1678, 28495, 13, 29937, 29871, 29900, 1678, 2217, 29918, 2324, 259, 29929, 29906, 29889, 29941, 29900, 29955, 29953, 29929, 29906, 259, 29946, 29889, 29953, 29896, 29945, 29941, 29947, 29945, 13, 13, 29937, 7634, 11235, 278, 1006, 11958, 2801, 24536, 29901, 365, 2209, 267, 526, 1904, 839, 408, 4805, 9667, 13, 29937, 297, 278, 12786, 373, 2845, 2625, 310, 278, 1006, 11958, 2801, 29892, 297, 445, 1206, 278, 28495, 13, 29937, 526, 6219, 1584, 368, 1546, 278, 12786, 29889, 2178, 9667, 297, 478, 2965, 1818, 367, 19056, 13, 29937, 4822, 278, 1006, 11958, 2801, 29892, 322, 28495, 297, 478, 2965, 674, 788, 304, 278, 1006, 11958, 2801, 13, 29937, 4972, 3734, 29892, 577, 591, 508, 2436, 278, 6306, 29901, 13, 29937, 13, 29937, 4972, 353, 9467, 29918, 2310, 392, 718, 4972, 334, 6410, 29918, 29886, 312, 29918, 26311, 13, 29937, 4972, 448, 4972, 334, 6410, 29918, 29886, 312, 29918, 26311, 353, 9467, 29918, 2310, 392, 13, 29937, 4972, 334, 313, 29896, 448, 6410, 29918, 29886, 312, 29918, 26311, 29897, 353, 9467, 29918, 2310, 392, 13, 29937, 4972, 353, 9467, 29918, 2310, 392, 847, 313, 29896, 448, 6410, 29918, 29886, 312, 29918, 26311, 29897, 13, 29937, 13, 29937, 4001, 1006, 11958, 2801, 28495, 526, 29871, 29945, 29995, 322, 4203, 6403, 297, 478, 2965, 278, 13, 29937, 6410, 29918, 29886, 312, 29918, 26311, 353, 29871, 29906, 29889, 29945, 15543, 6549, 29901, 13, 29937, 13, 29937, 4972, 353, 29871, 29929, 29900, 847, 313, 29896, 448, 29871, 29900, 29889, 29900, 29906, 29945, 29897, 353, 29871, 29929, 29906, 29889, 29941, 29896, 13, 29937, 13, 29937, 19320, 292, 278, 1006, 11958, 2801, 4972, 591, 508, 664, 714, 3001, 28495, 13, 29937, 13, 29937, 28495, 353, 4972, 334, 6410, 29918, 29886, 312, 13, 29937, 28495, 353, 29871, 29929, 29906, 29889, 29941, 29896, 334, 29871, 29900, 29889, 29900, 29945, 353, 29871, 29946, 29889, 29953, 29906, 13, 13, 29937, 7106, 278, 3001, 13916, 310, 1269, 5190, 297, 341, 29956, 29889, 13, 2158, 29898, 28549, 29889, 657, 29918, 5441, 29918, 13369, 3101, 13, 29937, 259, 5190, 2669, 259, 13916, 13, 29937, 29871, 29900, 1678, 319, 29871, 5864, 259, 29929, 29946, 29889, 29953, 29896, 29945, 29941, 29947, 29945, 13, 13, 29937, 7634, 11235, 13916, 2582, 29901, 13223, 319, 1818, 367, 13916, 304, 13, 29937, 5870, 11421, 297, 478, 2965, 2298, 599, 1006, 11958, 2801, 28495, 29892, 5480, 13, 29937, 13916, 338, 29871, 29929, 29900, 29889, 29900, 718, 29871, 29946, 29889, 29953, 29906, 353, 29871, 29929, 29946, 29889, 29953, 29906, 29889, 13, 13, 29937, 7106, 278, 8666, 310, 5864, 297, 1269, 5120, 29889, 13, 2158, 29898, 28549, 29889, 657, 29918, 27548, 29918, 558, 1575, 3101, 13, 29937, 259, 5120, 418, 8666, 13, 29937, 29871, 29900, 1678, 3865, 29956, 259, 29945, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 13, 29937, 29871, 29896, 1678, 478, 2965, 259, 29945, 29906, 29889, 29945, 29953, 29946, 29896, 29900, 29941, 13, 13, 29937, 7634, 11235, 544, 18499, 2582, 29901, 450, 15276, 979, 3438, 310, 11421, 297, 3865, 29956, 338, 3763, 13, 29937, 278, 3438, 310, 5190, 319, 29915, 29879, 21000, 29889, 2398, 29892, 278, 15276, 979, 3438, 310, 11421, 297, 478, 2965, 884, 13, 29937, 7805, 278, 3438, 310, 5146, 292, 363, 1006, 11958, 2801, 28495, 29889, 13, 2 ]
src/coolbeans/utils.py
runarp/coolbeans
5
150850
<reponame>runarp/coolbeans import typing import pathlib import logging import importlib import pprint import yaml logger = logging.getLogger(__name__) def get_project_root() -> pathlib.Path: """Returns project root folder.""" return pathlib.Path(__file__).parent def logging_config(config_file=None, level=logging.INFO): if not config_file: local_file = pathlib.Path('logging.yaml') if local_file.exists(): config_file = local_file # Fall back to our internal format if not config_file: config_file = pathlib.Path(__file__).parent.joinpath("logging.yaml") config_file = pathlib.Path(config_file) assert config_file.exists(), f"Unable to find {config_file}" with config_file.open("r") as fil: config = yaml.full_load(fil) config.setdefault( 'loggers', {'coolbeans': {}})['coolbeans']['level'] = level import logging.config logging.config.dictConfig(config) def safe_plugin(func: typing.Callable) -> typing.Callable: # We might want to pull the logger out of the func module? DEBUG_CONTEXT = {} try: DEBUG_CONTEXT = getattr(importlib.import_module(func.__module__), 'DEBUG_CONTEXT', {}) log = importlib.import_module(func.__module__).logger except AttributeError: log = logger def do_work(*args): log.info(f"Loading Plugin {func.__name__}") try: return func(*args) except Exception as e: log.exception(f"{func.__name__} {pprint.pformat(DEBUG_CONTEXT)}") raise return do_work def get_setting(key, settings): """Returns the first item from the setting list if only one item""" if key in settings: value = settings[key] if isinstance(value, list): if len(value) == 1: return value[0] else: return value return value
[ 1, 529, 276, 1112, 420, 29958, 3389, 6834, 29914, 1111, 324, 11700, 13, 5215, 19229, 13, 5215, 2224, 1982, 13, 5215, 12183, 13, 5215, 1053, 1982, 13, 5215, 282, 2158, 13, 5215, 343, 8807, 13, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 679, 29918, 4836, 29918, 4632, 580, 1599, 2224, 1982, 29889, 2605, 29901, 13, 1678, 9995, 11609, 29879, 2060, 3876, 4138, 1213, 15945, 13, 1678, 736, 2224, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 13, 13, 13, 1753, 12183, 29918, 2917, 29898, 2917, 29918, 1445, 29922, 8516, 29892, 3233, 29922, 21027, 29889, 11690, 1125, 13, 13, 1678, 565, 451, 2295, 29918, 1445, 29901, 13, 4706, 1887, 29918, 1445, 353, 2224, 1982, 29889, 2605, 877, 21027, 29889, 25162, 1495, 13, 4706, 565, 1887, 29918, 1445, 29889, 9933, 7295, 13, 9651, 2295, 29918, 1445, 353, 1887, 29918, 1445, 13, 13, 1678, 396, 14053, 1250, 304, 1749, 7463, 3402, 13, 1678, 565, 451, 2295, 29918, 1445, 29901, 13, 4706, 2295, 29918, 1445, 353, 2224, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 29889, 7122, 2084, 703, 21027, 29889, 25162, 1159, 13, 13, 1678, 2295, 29918, 1445, 353, 2224, 1982, 29889, 2605, 29898, 2917, 29918, 1445, 29897, 13, 1678, 4974, 2295, 29918, 1445, 29889, 9933, 3285, 285, 29908, 2525, 519, 304, 1284, 426, 2917, 29918, 1445, 5038, 13, 13, 1678, 411, 2295, 29918, 1445, 29889, 3150, 703, 29878, 1159, 408, 977, 29901, 13, 4706, 2295, 353, 343, 8807, 29889, 8159, 29918, 1359, 29898, 1777, 29897, 13, 13, 4706, 2295, 29889, 842, 4381, 29898, 13, 9651, 525, 1188, 5743, 742, 13, 9651, 11117, 1111, 324, 11700, 2396, 426, 24289, 1839, 1111, 324, 11700, 16215, 5563, 2033, 353, 3233, 13, 13, 4706, 1053, 12183, 29889, 2917, 13, 4706, 12183, 29889, 2917, 29889, 8977, 3991, 29898, 2917, 29897, 13, 13, 13, 1753, 9109, 29918, 8582, 29898, 9891, 29901, 19229, 29889, 5594, 519, 29897, 1599, 19229, 29889, 5594, 519, 29901, 13, 1678, 396, 1334, 1795, 864, 304, 8206, 278, 17927, 714, 310, 278, 3653, 3883, 29973, 13, 1678, 21681, 29918, 6007, 16975, 353, 6571, 13, 1678, 1018, 29901, 13, 4706, 21681, 29918, 6007, 16975, 353, 679, 5552, 29898, 5215, 1982, 29889, 5215, 29918, 5453, 29898, 9891, 17255, 5453, 1649, 511, 525, 18525, 29918, 6007, 16975, 742, 426, 1800, 13, 4706, 1480, 353, 1053, 1982, 29889, 5215, 29918, 5453, 29898, 9891, 17255, 5453, 1649, 467, 21707, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 1480, 353, 17927, 13, 13, 1678, 822, 437, 29918, 1287, 10456, 5085, 1125, 13, 4706, 1480, 29889, 3888, 29898, 29888, 29908, 23456, 1858, 3851, 426, 9891, 17255, 978, 1649, 27195, 13, 4706, 1018, 29901, 13, 9651, 736, 3653, 10456, 5085, 29897, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1480, 29889, 11739, 29898, 29888, 29908, 29912, 9891, 17255, 978, 1649, 29913, 426, 407, 29878, 524, 29889, 29886, 4830, 29898, 18525, 29918, 6007, 16975, 2915, 1159, 13, 9651, 12020, 13, 13, 1678, 736, 437, 29918, 1287, 13, 13, 13, 1753, 679, 29918, 26740, 29898, 1989, 29892, 6055, 1125, 13, 1678, 9995, 11609, 29879, 278, 937, 2944, 515, 278, 4444, 1051, 565, 871, 697, 2944, 15945, 29908, 13, 1678, 565, 1820, 297, 6055, 29901, 13, 4706, 995, 353, 6055, 29961, 1989, 29962, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 1051, 1125, 13, 9651, 565, 7431, 29898, 1767, 29897, 1275, 29871, 29896, 29901, 13, 18884, 736, 995, 29961, 29900, 29962, 13, 9651, 1683, 29901, 13, 18884, 736, 995, 13, 4706, 736, 995, 13, 2 ]
benchmarkt/AlgoConvolv20.py
zwakrim/mastethesis
0
70806
<filename>benchmarkt/AlgoConvolv20.py import cv2 import sys import time import numpy as np import jsonlines import datetime import platform def convolvimg(width , heigh, fpsArray): video_capture = cv2.VideoCapture(camera) video_capture.set(3,width) video_capture.set(4,heigh) font = cv2.FONT_HERSHEY_SIMPLEX color = (0, 255, 0) frames = 0 tick = 0 fps =0 i=0 global totalCalcTime totalCalcTime=0 start = time.time() while (time.time() - start <= timeout): ret, frame = video_capture.read() frames = frames +1 end = time.time() seconds = end- start #print(frame.shape) if seconds-tick >= 1: tick = tick + 1 fps = frames fpsArray.append(fps) #fpsArray[i]=fps i=i+1 frames = 0 #hsv hue sat value #hsv = cv2.cvtColor(frame,cv2.COLOR_BGR2HSV) #convert to hsv color #lower_color= np.array([150,150,50]) #upper_color= np.array([180,255,255]) #mask = cv2.inRange(hsv,lower_color,upper_color) #result = cv2.bitwise_and(frame,frame,mask=mask) #blur= cv2.medianBlur(frame,5,0) #median = cv2.medianBlur(result,15) beginCalcTime = time.time() kernel = np.ones((20,20),np.float32)/400 filter = cv2.filter2D(frame,-1,kernel) endCalcTime = time.time() - beginCalcTime totalCalcTime = totalCalcTime + endCalcTime cv2.putText(frame, "FPS: {}" .format(fps), (15,80) ,font,1,color) cv2.putText(filter, "FPS: {}" .format(fps), (15,80) ,font,1,color) cv2.imshow('original',frame) cv2.imshow('filtered',filter) if cv2.waitKey(1) & 0xFF == ord('q'): break cv2.destroyAllWindows() video_capture.release() cascPath = sys.argv[1] faceCascade = cv2.CascadeClassifier(cascPath) camera= int(sys.argv[2]) timeout = int(sys.argv[3]) width= int(sys.argv[4]) height = int(sys.argv[5]) fpsArrayshared2 = [] if __name__ == '__main__': beginTime = time.time() convolvimg(width,height,fpsArrayshared2) endTime = time.time() - beginTime #print("fps,"+",".join(str(x) for x in fpsArrayshared2)+ ",") timesnow = datetime.datetime.now().strftime('_%Y_%m_%d_%H_%M_%S') filename = 'result/'+ "AlgoConvolution20_python_"+str(width) + str(timesnow)+ '.json' with jsonlines.open(filename,mode='w') as outputfile: counter =1 for item in fpsArrayshared2: result ={} result["algoritme"]= "Convolution20_python" result["fps"] = item result["Type"] = "Python" result["Second"] = counter result["resolution"] = width result["ratioCalTime"] = totalCalcTime/endTime * 100 result["node"] = platform.node () counter = counter +1 outputfile.write(result)
[ 1, 529, 9507, 29958, 1785, 305, 16325, 29914, 2499, 1484, 1168, 1555, 29894, 29906, 29900, 29889, 2272, 13, 5215, 13850, 29906, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 12655, 408, 7442, 13, 5215, 4390, 9012, 13, 5215, 12865, 13, 5215, 7481, 13, 13, 1753, 378, 1555, 29894, 2492, 29898, 2103, 1919, 540, 1141, 29892, 285, 567, 2588, 1125, 13, 1678, 4863, 29918, 17885, 545, 353, 13850, 29906, 29889, 15167, 21133, 545, 29898, 26065, 29897, 13, 1678, 4863, 29918, 17885, 545, 29889, 842, 29898, 29941, 29892, 2103, 29897, 13, 1678, 4863, 29918, 17885, 545, 29889, 842, 29898, 29946, 29892, 354, 1141, 29897, 13, 13, 1678, 4079, 353, 13850, 29906, 29889, 29943, 1164, 29911, 29918, 4448, 7068, 13282, 29918, 5425, 3580, 1307, 29990, 13, 1678, 2927, 353, 313, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29900, 29897, 13, 13, 1678, 16608, 353, 29871, 29900, 13, 1678, 16892, 353, 29871, 29900, 13, 1678, 285, 567, 353, 29900, 13, 1678, 474, 29922, 29900, 13, 13, 1678, 5534, 3001, 7856, 29883, 2481, 13, 1678, 3001, 7856, 29883, 2481, 29922, 29900, 13, 1678, 1369, 353, 931, 29889, 2230, 580, 13, 1678, 1550, 313, 2230, 29889, 2230, 580, 448, 1369, 5277, 11815, 1125, 13, 4706, 3240, 29892, 3515, 353, 4863, 29918, 17885, 545, 29889, 949, 580, 13, 4706, 16608, 353, 16608, 718, 29896, 13, 4706, 1095, 353, 931, 29889, 2230, 580, 13, 4706, 6923, 353, 1095, 29899, 1369, 13, 12, 29937, 2158, 29898, 2557, 29889, 12181, 29897, 13, 4706, 565, 6923, 29899, 24667, 6736, 29871, 29896, 29901, 13, 9651, 16892, 353, 16892, 718, 29871, 29896, 13, 9651, 285, 567, 353, 16608, 13, 9651, 285, 567, 2588, 29889, 4397, 29898, 29888, 567, 29897, 13, 9651, 396, 29888, 567, 2588, 29961, 29875, 13192, 29888, 567, 13, 9651, 474, 29922, 29875, 29974, 29896, 13, 9651, 16608, 353, 29871, 29900, 13, 13, 4706, 396, 29882, 4501, 298, 434, 3290, 995, 13, 4706, 396, 29882, 4501, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2557, 29892, 11023, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29950, 7597, 29897, 396, 13441, 304, 298, 4501, 2927, 13, 13, 4706, 396, 13609, 29918, 2780, 29922, 7442, 29889, 2378, 4197, 29896, 29945, 29900, 29892, 29896, 29945, 29900, 29892, 29945, 29900, 2314, 13, 4706, 396, 21064, 29918, 2780, 29922, 7442, 29889, 2378, 4197, 29896, 29947, 29900, 29892, 29906, 29945, 29945, 29892, 29906, 29945, 29945, 2314, 13, 13, 4706, 396, 13168, 353, 13850, 29906, 29889, 262, 6069, 29898, 29882, 4501, 29892, 13609, 29918, 2780, 29892, 21064, 29918, 2780, 29897, 13, 4706, 396, 2914, 353, 13850, 29906, 29889, 2966, 3538, 29918, 392, 29898, 2557, 29892, 2557, 29892, 13168, 29922, 13168, 29897, 13, 13, 4706, 396, 2204, 332, 29922, 13850, 29906, 29889, 2168, 713, 10358, 332, 29898, 2557, 29892, 29945, 29892, 29900, 29897, 13, 4706, 396, 2168, 713, 353, 13850, 29906, 29889, 2168, 713, 10358, 332, 29898, 2914, 29892, 29896, 29945, 29897, 13, 4706, 3380, 7856, 29883, 2481, 353, 931, 29889, 2230, 580, 13, 13, 4706, 8466, 353, 7442, 29889, 2873, 3552, 29906, 29900, 29892, 29906, 29900, 511, 9302, 29889, 7411, 29941, 29906, 6802, 29946, 29900, 29900, 13, 4706, 4175, 353, 13850, 29906, 29889, 4572, 29906, 29928, 29898, 2557, 6653, 29896, 29892, 17460, 29897, 13, 13, 4706, 1095, 7856, 29883, 2481, 353, 931, 29889, 2230, 580, 448, 3380, 7856, 29883, 2481, 13, 4706, 3001, 7856, 29883, 2481, 353, 3001, 7856, 29883, 2481, 718, 1095, 7856, 29883, 2481, 13, 13, 4706, 13850, 29906, 29889, 649, 1626, 29898, 2557, 29892, 376, 29943, 7024, 29901, 426, 5038, 869, 4830, 29898, 29888, 567, 511, 313, 29896, 29945, 29892, 29947, 29900, 29897, 1919, 5657, 29892, 29896, 29892, 2780, 29897, 13, 4706, 13850, 29906, 29889, 649, 1626, 29898, 4572, 29892, 376, 29943, 7024, 29901, 426, 5038, 869, 4830, 29898, 29888, 567, 511, 313, 29896, 29945, 29892, 29947, 29900, 29897, 1919, 5657, 29892, 29896, 29892, 2780, 29897, 13, 13, 4706, 13850, 29906, 29889, 326, 4294, 877, 13492, 742, 2557, 29897, 13, 13, 4706, 13850, 29906, 29889, 326, 4294, 877, 4572, 287, 742, 4572, 29897, 13, 13, 4706, 565, 13850, 29906, 29889, 10685, 2558, 29898, 29896, 29897, 669, 29871, 29900, 29916, 4198, 1275, 4356, 877, 29939, 29374, 13, 9651, 2867, 13, 1678, 13850, 29906, 29889, 20524, 3596, 7685, 580, 13, 1678, 4863, 29918, 17885, 545, 29889, 14096, 580, 13, 13, 13, 29883, 6151, 2605, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 2161, 29907, 294, 6332, 353, 13850, 29906, 29889, 29907, 294, 6332, 2385, 3709, 29898, 29883, 6151, 2605, 29897, 13, 26065, 29922, 938, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 13, 15619, 353, 938, 29898, 9675, 29889, 19218, 29961, 29941, 2314, 13, 2103, 29922, 938, 29898, 9675, 29889, 19218, 29961, 29946, 2314, 13, 3545, 353, 938, 29898, 9675, 29889, 19218, 29961, 29945, 2314, 13, 29888, 567, 2588, 12366, 29906, 353, 5159, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 3380, 2481, 353, 931, 29889, 2230, 580, 13, 1678, 378, 1555, 29894, 2492, 29898, 2103, 29892, 3545, 29892, 29888, 567, 2588, 12366, 29906, 29897, 13, 1678, 1095, 2481, 353, 931, 29889, 2230, 580, 448, 3380, 2481, 13, 1678, 396, 2158, 703, 29888, 567, 1699, 29974, 613, 1642, 7122, 29898, 710, 29898, 29916, 29897, 363, 921, 297, 285, 567, 2588, 12366, 29906, 7240, 9162, 1159, 13, 1678, 3064, 3707, 353, 12865, 29889, 12673, 29889, 3707, 2141, 710, 615, 603, 877, 29918, 29995, 29979, 29918, 29995, 29885, 29918, 29995, 29881, 29918, 29995, 29950, 29918, 29995, 29924, 29918, 29995, 29903, 1495, 13, 13, 1678, 10422, 353, 29871, 525, 2914, 29914, 18717, 376, 2499, 1484, 1168, 4068, 29906, 29900, 29918, 4691, 29918, 17969, 710, 29898, 2103, 29897, 718, 851, 29898, 3706, 3707, 7240, 15300, 3126, 29915, 13, 1678, 411, 4390, 9012, 29889, 3150, 29898, 9507, 29892, 8513, 2433, 29893, 1495, 408, 1962, 1445, 29901, 13, 4706, 6795, 353, 29896, 13, 4706, 363, 2944, 297, 285, 567, 2588, 12366, 29906, 29901, 13, 9651, 1121, 353, 8875, 13, 9651, 1121, 3366, 9564, 272, 277, 1004, 3108, 29922, 376, 1168, 4068, 29906, 29900, 29918, 4691, 29908, 13, 9651, 1121, 3366, 29888, 567, 3108, 353, 2944, 13, 9651, 1121, 3366, 1542, 3108, 353, 376, 11980, 29908, 13, 9651, 1121, 3366, 11863, 3108, 353, 6795, 13, 9651, 1121, 3366, 9778, 918, 3108, 353, 2920, 13, 9651, 1121, 3366, 3605, 601, 7856, 2481, 3108, 353, 3001, 7856, 29883, 2481, 29914, 355, 2481, 334, 29871, 29896, 29900, 29900, 13, 9651, 1121, 3366, 3177, 3108, 353, 7481, 29889, 3177, 3861, 13, 9651, 6795, 353, 6795, 718, 29896, 13, 9651, 1962, 1445, 29889, 3539, 29898, 2914, 29897, 13, 13, 2 ]
py/liberliber_download.py
DavidGigli/gender-literature-ita
1
173075
import time from selenium import webdriver in_autori=open("/home/masterbd/progetto/autori+wiki_finito.txt","r").readlines() in_url=open("/home/masterbd/progetto/autori_a_z.txt","r").readlines() lista_url=[] autori=[x.split("|") for x in in_autori] url=[x.split("|") for x in in_url] #join=[x+y for x in in_autori for y in in_url if (x.split("|")[1]==y.split("|")[0] and (int(x.split("|")[3].strip())>1799 and (x.split("|")[3].strip()=="italiano" or x.split("|")[3].strip()=="italiana")))] join=[x.rstrip()+" | "+y.split("|")[1] for x in in_autori for y in in_url if (x.split("|")[1].strip()==y.split("|")[0].strip())] italian=[x for x in join if (x.split("|")[4].strip()=="italiano" or x.split("|")[4].strip()=="italiana")] print(italian[1]) epoc=[] for item in italian: if item.split("|")[3].strip()=="": print(item) elif int(item.split("|")[3].strip())>1799: epoc.append(item) print(epoc) out_aut=open("/home/masterbd/progetto/elenco_autori.txt","w") for item in epoc: out_aut.write(item) out_aut.close() #for item in join #join=[x.split("|")[0].strip() for x in in_autori if (int(x.split("|")[3].strip())>1799 and (x.split("|")[3].strip()=="italiano" or x.split("|")[3].strip()=="italiana"))]
[ 1, 1053, 931, 13, 3166, 18866, 1053, 1856, 9465, 13, 13, 13, 262, 29918, 1300, 4170, 29922, 3150, 11974, 5184, 29914, 6207, 6448, 29914, 771, 657, 517, 29914, 1300, 4170, 29974, 4594, 29918, 4951, 2049, 29889, 3945, 3284, 29878, 2564, 949, 9012, 580, 13, 262, 29918, 2271, 29922, 3150, 11974, 5184, 29914, 6207, 6448, 29914, 771, 657, 517, 29914, 1300, 4170, 29918, 29874, 29918, 29920, 29889, 3945, 3284, 29878, 2564, 949, 9012, 580, 13, 13, 19641, 29918, 2271, 29922, 2636, 13, 1300, 4170, 11759, 29916, 29889, 5451, 703, 29989, 1159, 363, 921, 297, 297, 29918, 1300, 4170, 29962, 13, 2271, 11759, 29916, 29889, 5451, 703, 29989, 1159, 363, 921, 297, 297, 29918, 2271, 29962, 13, 29937, 7122, 11759, 29916, 29974, 29891, 363, 921, 297, 297, 29918, 1300, 4170, 363, 343, 297, 297, 29918, 2271, 565, 313, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29896, 29962, 1360, 29891, 29889, 5451, 703, 29989, 1159, 29961, 29900, 29962, 322, 313, 524, 29898, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 3101, 29958, 29896, 29955, 29929, 29929, 322, 313, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 580, 26359, 2410, 3328, 29908, 470, 921, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 580, 26359, 2410, 3857, 5783, 4638, 13, 13, 7122, 11759, 29916, 29889, 29878, 17010, 580, 13578, 891, 15691, 29891, 29889, 5451, 703, 29989, 1159, 29961, 29896, 29962, 363, 921, 297, 297, 29918, 1300, 4170, 363, 343, 297, 297, 29918, 2271, 565, 313, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29896, 1822, 17010, 580, 1360, 29891, 29889, 5451, 703, 29989, 1159, 29961, 29900, 1822, 17010, 3101, 29962, 13, 2410, 713, 11759, 29916, 363, 921, 297, 5988, 565, 313, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29946, 1822, 17010, 580, 26359, 2410, 3328, 29908, 470, 921, 29889, 5451, 703, 29989, 1159, 29961, 29946, 1822, 17010, 580, 26359, 2410, 3857, 13531, 13, 13, 2158, 29898, 2410, 713, 29961, 29896, 2314, 13, 1022, 542, 29922, 2636, 13, 1454, 2944, 297, 4698, 713, 29901, 13, 12, 361, 2944, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 580, 26359, 1115, 13, 12, 12, 2158, 29898, 667, 29897, 13, 12, 23681, 938, 29898, 667, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 3101, 29958, 29896, 29955, 29929, 29929, 29901, 13, 12, 12, 1022, 542, 29889, 4397, 29898, 667, 29897, 13, 2158, 29898, 1022, 542, 29897, 13, 13, 449, 29918, 1300, 29922, 3150, 11974, 5184, 29914, 6207, 6448, 29914, 771, 657, 517, 29914, 4498, 1111, 29918, 1300, 4170, 29889, 3945, 3284, 29893, 1159, 13, 1454, 2944, 297, 9358, 542, 29901, 13, 12, 449, 29918, 1300, 29889, 3539, 29898, 667, 29897, 13, 449, 29918, 1300, 29889, 5358, 580, 13, 29937, 1454, 2944, 297, 5988, 13, 29937, 7122, 11759, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29900, 1822, 17010, 580, 363, 921, 297, 297, 29918, 1300, 4170, 565, 313, 524, 29898, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 3101, 29958, 29896, 29955, 29929, 29929, 322, 313, 29916, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 580, 26359, 2410, 3328, 29908, 470, 921, 29889, 5451, 703, 29989, 1159, 29961, 29941, 1822, 17010, 580, 26359, 2410, 3857, 5783, 29962, 13, 2 ]
scarypi.py
0x24elk/ScaryPi
0
1604700
<gh_stars>0 #!/usr/bin/python """Shows animated 'eyes' on two 8x8 LED matrices. Matrices are driven by a MAX7219 or similar. We interface with them through the luma.led_matrix library. For local development without hardware try something like: ./scarypi.py -d pygame --transform=led_matx --width 16 --height 8 For actual deployment with hardware (controlled through GPIO): ./scarypi.py -d max7219 --width 16 --height 8 \ --interface spi --block-orientation=90 """ import sys import datetime import random import time from PIL import Image from luma.core import cmdline from luma.core.interface.serial import spi, noop from luma.core.render import canvas from luma.core.virtual import viewport class Point(object): """A point, because a tuple is soo yesterday.""" def __init__(self, x, y): self.x = x self.y = y def __str__(self): return "(%s, %s)" % (self.x, self.y) class Animation(object): """Interface for an animation.""" def __init__(self): """Creates a new animation.""" self.start = None # The start time, once begun. self.done = False def begin(self, now): """Starts the animation at now milliseconds.""" self.start = now def tick(self, now): """Performs a step of the animation based on the current time.""" class LinearAnimation(Animation): """Based class for linear animations.""" def __init__(self, duration_ms): """Creates a new animation of length duration_ms milliseconds.""" Animation.__init__(self) self.duration_ms = duration_ms def tick(self, now): """Performs a step of the animation based on the current time.""" Animation.tick(self, now) dt_timedelta = (now - self.start) dt = dt_timedelta.total_seconds() * 1000 if dt <= 0: return # Bail if we're called too fast or going back in time. if dt <= self.duration_ms: self._animate(dt / self.duration_ms) else: self._animate(1.0) self.done = True def _animate(self, pct): """Overwrite in subclasses to performs a step, based on a percentage completion.""" class AnimationGroup(Animation): """Plays a group of Animations in parallel until all are done.""" def __init__(self, *args): """Initializes the animation with a list of animations.""" Animation.__init__(self) self.animations = args self.done = False def begin(self, now): Animation.begin(self, now) for a in self.animations: a.begin(now) def tick(self, now): Animation.tick(self, now) all_done = True for a in self.animations: a.tick(now) if not a.done: all_done = False self.done = all_done class AnimationSequence(Animation): """Plays a set of Animations in sequence.""" def __init__(self, *args): Animation.__init__(self) self.animations = list(args) self.active = None def tick(self, now): """Advances the head animation in the queue, removing done ones.""" Animation.tick(self, now) # End current animation, if done. if self.active and self.active.done: self.active = None # Pop next animation from queue and start, if none. if not self.active: if self.animations: self.active = self.animations.pop(0) self.active.begin(now) return # No more animations => done. if not self.active: self.done = True return self.active.tick(now) class Look(LinearAnimation): """An animation moving the pupil of an Eye.""" def __init__(self, eye, where, duration_ms=200): """Moves the eyeball to a given Point where.""" LinearAnimation.__init__(self, duration_ms) self.eye = eye self.origin = eye.pupil self.dest = where self.dx = self.dest.x - self.origin.x self.dy = self.dest.y - self.origin.y if self.dx == 0 and self.dy == 0: self.done = True def _animate(self, pct): if self.done: return curr = Point(int(self.origin.x + (self.dx * pct)), int(self.origin.y + (self.dy * pct))) self.eye._look(curr) class Blink(LinearAnimation): """An animation blinking an Eye.""" def __init__(self, eye, duration_ms=500): """Blinks the eye in duration_ms""" LinearAnimation.__init__(self, duration_ms) self.eye = eye self.eyelid = 0 # Offset of the eyelids, 0=open, 3=closed def _animate(self, pct): if self.done: return # Close eyelids 0->4 in first half of animation, then re-open. if (pct < 0.5): offset = 4 * (pct / 0.49) + 0.5 self.eye._eyelids(int(offset)) else: offset = 4 - (4 * ((pct - 0.5) / 0.49) + 0.5) self.eye._eyelids(int(offset)) # Ensure eyes fully open again at end of animation. if pct >= 1.0: self.eye._eyelids(-1) return class CrossEyes(AnimationSequence): """Crosses the eyes.""" def __init__(self, left, right, duration_ms=3000): ms = duration_ms / 3 AnimationSequence.__init__(self, AnimationGroup(left.look(Point(6, 4), ms), right.look(Point(2, 4), ms)), Wait(ms), AnimationGroup(left.look(Point(4, 4), ms), right.look(Point(4, 4), ms)) ) class MethEyes(AnimationSequence): """Inverse 'cross eyes', looking out.""" def __init__(self, left, right, duration_ms=3000): ms = duration_ms / 3 AnimationSequence.__init__(self, AnimationGroup(left.look(Point(2, 4), ms), right.look(Point(6, 4), ms)), Wait(ms), AnimationGroup(left.look(Point(4, 4), ms), right.look(Point(4, 4), ms)) ) class CrazyBlink(AnimationSequence): """Blinks left eye, then right.""" def __init__(self, left, right, duration_ms=1500): ms = duration_ms / 2 AnimationSequence.__init__(self, left.blink(ms), right.blink(ms) ) class LazyEye(AnimationSequence): """Lowers pupil of a single eye only.""" def __init__(self, eye, duration_ms=2000): ms = duration_ms / 3 AnimationSequence.__init__(self, eye.look(Point(4, 6), ms * 2), # Lower slowly eye.look(Point(4, 4), ms), # Raise quickly ) class CrazySpin(AnimationSequence): """'Spins' pupil horizontally with wraparound.""" def __init__(self, left, right, duration_ms=400): times = 2 ms = duration_ms / (times*8) a = [] # Just keep moving to the left, as the Eye class handles wrapping. for i in range(0, times*8): x = 4 - i a.append(AnimationGroup(left.look(Point(x, 4), ms), right.look(Point(x, 4), ms))) AnimationSequence.__init__(self, *a) class RoundSpin(AnimationSequence): """Spins the eyeballs of both eyes in circles.""" def __init__(self, left, right, duration_ms=400): times = 2 ms = duration_ms / (times*13 + 1) a = [AnimationGroup(left.look(Point(6, 4), ms), right.look(Point(2, 4), ms))] for i in range(times): a = a + [ AnimationGroup(left.look(Point(6, 4), ms), right.look(Point(2, 4), ms)), AnimationGroup(left.look(Point(6, 3), ms), right.look(Point(2, 3), ms)), AnimationGroup(left.look(Point(5, 2), ms), right.look(Point(3, 2), ms)), AnimationGroup(left.look(Point(4, 2), ms), right.look(Point(4, 2), ms)), AnimationGroup(left.look(Point(3, 2), ms), right.look(Point(5, 2), ms)), AnimationGroup(left.look(Point(2, 3), ms), right.look(Point(6, 3), ms)), AnimationGroup(left.look(Point(2, 4), ms), right.look(Point(6, 4), ms)), AnimationGroup(left.look(Point(2, 5), ms), right.look(Point(6, 5), ms)), AnimationGroup(left.look(Point(3, 6), ms), right.look(Point(5, 6), ms)), AnimationGroup(left.look(Point(4, 6), ms), right.look(Point(4, 6), ms)), AnimationGroup(left.look(Point(5, 6), ms), right.look(Point(3, 6), ms)), AnimationGroup(left.look(Point(6, 5), ms), right.look(Point(2, 5), ms)), AnimationGroup(left.look(Point(6, 4), ms), right.look(Point(2, 4), ms)) ] AnimationSequence.__init__(self, *a) class GlowEyes(LinearAnimation): """Glows the eyes; well, rather the device.""" def __init__(self, device, duration_ms=300): """Blinks the eye in duration_ms""" LinearAnimation.__init__(self, duration_ms) self.device = device def _animate(self, pct): if self.done: return # Increase contrast 30->150 in first half of animation, then bring down again. if (pct < 0.5): c = int(30 + 120 * (pct / 0.49)) self.device.contrast(c) else: c = int(150 - 120 * ((pct - 0.5) / 0.49)) self.device.contrast(c) # Ensure eyes fully open again at end of animation. if pct >= 1.0: self.device.contrast(30) class Wait(LinearAnimation): """An animation doing nothing.""" def __init__(self, eye, duration_ms=300): """Waits for duration_ms""" LinearAnimation.__init__(self, duration_ms) class Eye(object): """A single 8x8 eye we animate and draw on our LED matrix.""" # Basic eyeball template (without a pupil). eye_ball = [ 0b00111100, 0b01111110, 0b11111111, 0b11111111, 0b11111111, 0b11111111, 0b01111110, 0b00111100 ] def __init__(self): """Initializes the eye.""" self.pixels = bytearray(Eye.eye_ball) # The center of the pupil, so 4,4 is looking straight ahead. self.pupil = Point(4,4) # The offset of the eyelid(s) from the top/bottom. < 0 for fully open. self.eyelids = -1 def _on(self, x, y): """Flips the pixel at x,y on. Wraps if x/y out of bounds.""" y = y % 8 x = x % 8 self.pixels[y] = self.pixels[y] | (0b00000001 << (7 - x)) def _off(self, x, y): """Flips the pixel at x,y off. Wraps if x/y out of bounds.""" y = y % 8 x = x % 8 self.pixels[y] = self.pixels[y] & ~(0b00000001 << (7 - x)) def _row_on(self, y): """Flips the whole row at y on. Wraps if y out of bounds.""" y = y % len(self.pixels) self.pixels[y] = 0b11111111 def _row_off(self, y): """Flips the whole row at y off. Wraps if y out of bounds.""" y = y % len(self.pixels) self.pixels[y] = 0b00000000 def _look(self, pos): """Immediately moves the pupil of the eyeball to pos.""" self.pupil = pos self.pupil.x = self.pupil.x % 8 self.pupil.y = self.pupil.y % 8 def _eyelids(self, offset): """Moves the eyelids to the given offset, -1=open, 3=closed.""" self.eyelids = max(-1, min(offset, 3)) def look(self, pos, duration_ms=300): """Returns an animation, moving the puil to pos in duration_ms.""" return Look(self, pos, duration_ms) def blink(self, duration_ms=500): """Returns an animation, blinking the eye in duration_ms.""" return Blink(self, duration_ms) def image(self): """Renders the current state of the eye into an 8x8 monochrome image.""" self.pixels = bytearray(Eye.eye_ball) # Draw pupil self._off(self.pupil.x-1,self.pupil.y-1) self._off(self.pupil.x,self.pupil.y-1) self._off(self.pupil.x-1,self.pupil.y) self._off(self.pupil.x,self.pupil.y) # Draw eyelids, if requested. if self.eyelids >= 0: for i in xrange(0, self.eyelids + 1): self._row_off(i) self._row_off(7-i) return Image.frombytes('1', (8, 8), bytes(self.pixels)) def get_device(actual_args): parser = cmdline.create_parser(description='luma.examples arguments') args = parser.parse_args(actual_args) if args.config: # load config from file config = cmdline.load_config(args.config) args = parser.parse_args(config + actual_args) # create device device = cmdline.create_device(args) return device # General animation tick TICK_SECONDS = 0.1 def render(left, right, device): """Renders the current state of the eyes on device.""" with canvas(device) as draw: draw.bitmap((0, 0), left.image(), fill="white") draw.bitmap((8, 0), right.image(), fill="white") def pick_effect(device, left, right): i = random.randint(0, 6) if i == 0: return CrossEyes(left, right) if i == 1: return CrazySpin(left, right) if i == 2: return MethEyes(left, right) if i == 3: return CrazyBlink(left, right) if i == 4: return LazyEye(left) if i == 5: return RoundSpin(left, right) return GlowEyes(device) def animation_loop(device): left = Eye() right = Eye() main_sequence = AnimationSequence() while(True): start = datetime.datetime.now() # Insert the next round of animations, if queue empty. if main_sequence.done: animations = [] # Look to a random point p = Point(random.randint(2,5), random.randint(2,5)) animations.append( AnimationGroup(left.look(p), right.look(p))) # Wait 2.5 - 3.5s animations.append(Wait(random.randint(5,7) * 500)) # Maybe blink if random.randint(0, 3) == 0: animations.append( AnimationGroup(left.blink(), right.blink())) # Play an effect, if desired. if random.randint(0, 6) == 0: animations.append(pick_effect(device, left, right)) main_sequence = AnimationSequence(*animations) # Animate main_sequence.tick(start) render(left, right, device) # Sleep if we're going too fast. elapsed = datetime.datetime.now() - start sleeptime = max(TICK_SECONDS - elapsed.total_seconds(), 0) time.sleep(sleeptime) def main(): device = get_device(sys.argv[1:]) device.contrast(30) animation_loop(device) if __name__ == "__main__": try: main() except KeyboardInterrupt: pass
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 13, 15945, 29908, 2713, 1242, 17524, 525, 1032, 267, 29915, 373, 1023, 29871, 29947, 29916, 29947, 25023, 13516, 29889, 13, 13, 29924, 8141, 1575, 526, 18225, 491, 263, 18134, 29955, 29906, 29896, 29929, 470, 2788, 29889, 1334, 5067, 13, 2541, 963, 1549, 278, 301, 10859, 29889, 839, 29918, 5344, 3489, 29889, 13, 13, 2831, 1887, 5849, 1728, 12837, 1018, 1554, 763, 29901, 13, 6904, 1557, 653, 1631, 29889, 2272, 448, 29881, 22028, 1192, 9067, 29922, 839, 29918, 2922, 29916, 1192, 2103, 29871, 29896, 29953, 1192, 3545, 29871, 29947, 13, 13, 2831, 3935, 18209, 411, 12837, 313, 6451, 839, 1549, 402, 2227, 29949, 1125, 13, 6904, 1557, 653, 1631, 29889, 2272, 448, 29881, 4236, 29955, 29906, 29896, 29929, 1192, 2103, 29871, 29896, 29953, 1192, 3545, 29871, 29947, 320, 13, 29871, 1192, 13248, 805, 29875, 1192, 1271, 29899, 20659, 29922, 29929, 29900, 13, 15945, 29908, 13, 13, 5215, 10876, 13, 5215, 12865, 13, 5215, 4036, 13, 5215, 931, 13, 13, 3166, 349, 6227, 1053, 7084, 13, 13, 3166, 301, 10859, 29889, 3221, 1053, 9920, 1220, 13, 3166, 301, 10859, 29889, 3221, 29889, 13248, 29889, 15550, 1053, 805, 29875, 29892, 694, 459, 13, 3166, 301, 10859, 29889, 3221, 29889, 9482, 1053, 10508, 13, 3166, 301, 10859, 29889, 3221, 29889, 18714, 1053, 1776, 637, 13, 13, 1990, 8984, 29898, 3318, 1125, 13, 29871, 9995, 29909, 1298, 29892, 1363, 263, 18761, 338, 577, 29877, 22600, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 921, 29892, 343, 1125, 13, 1678, 1583, 29889, 29916, 353, 921, 13, 1678, 1583, 29889, 29891, 353, 343, 13, 13, 29871, 822, 4770, 710, 12035, 1311, 1125, 13, 1678, 736, 18227, 29995, 29879, 29892, 1273, 29879, 5513, 1273, 313, 1311, 29889, 29916, 29892, 1583, 29889, 29891, 29897, 13, 13, 13, 1990, 530, 7715, 29898, 3318, 1125, 13, 29871, 9995, 10448, 363, 385, 9612, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 9995, 9832, 1078, 263, 716, 9612, 1213, 15945, 13, 1678, 1583, 29889, 2962, 353, 6213, 29871, 396, 450, 1369, 931, 29892, 2748, 23580, 29889, 13, 1678, 1583, 29889, 15091, 353, 7700, 13, 13, 29871, 822, 3380, 29898, 1311, 29892, 1286, 1125, 13, 1678, 9995, 4763, 29879, 278, 9612, 472, 1286, 3533, 21462, 1213, 15945, 13, 1678, 1583, 29889, 2962, 353, 1286, 13, 13, 29871, 822, 16892, 29898, 1311, 29892, 1286, 1125, 13, 1678, 9995, 5894, 9514, 263, 4331, 310, 278, 9612, 2729, 373, 278, 1857, 931, 1213, 15945, 13, 13, 13, 1990, 22985, 13579, 29898, 13579, 1125, 13, 29871, 9995, 29933, 1463, 770, 363, 5608, 3778, 800, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 14385, 29918, 1516, 1125, 13, 1678, 9995, 9832, 1078, 263, 716, 9612, 310, 3309, 14385, 29918, 1516, 3533, 21462, 1213, 15945, 13, 1678, 530, 7715, 17255, 2344, 12035, 1311, 29897, 13, 1678, 1583, 29889, 19708, 29918, 1516, 353, 14385, 29918, 1516, 13, 13, 29871, 822, 16892, 29898, 1311, 29892, 1286, 1125, 13, 1678, 9995, 5894, 9514, 263, 4331, 310, 278, 9612, 2729, 373, 278, 1857, 931, 1213, 15945, 13, 1678, 530, 7715, 29889, 24667, 29898, 1311, 29892, 1286, 29897, 13, 1678, 11636, 29918, 9346, 287, 2554, 353, 313, 3707, 448, 1583, 29889, 2962, 29897, 13, 1678, 11636, 353, 11636, 29918, 9346, 287, 2554, 29889, 7827, 29918, 23128, 580, 334, 29871, 29896, 29900, 29900, 29900, 13, 1678, 565, 11636, 5277, 29871, 29900, 29901, 13, 418, 736, 29871, 396, 350, 737, 565, 591, 29915, 276, 2000, 2086, 5172, 470, 2675, 1250, 297, 931, 29889, 13, 1678, 565, 11636, 5277, 1583, 29889, 19708, 29918, 1516, 29901, 13, 418, 1583, 3032, 20131, 29898, 6008, 847, 1583, 29889, 19708, 29918, 1516, 29897, 13, 1678, 1683, 29901, 13, 418, 1583, 3032, 20131, 29898, 29896, 29889, 29900, 29897, 13, 418, 1583, 29889, 15091, 353, 5852, 13, 13, 29871, 822, 903, 20131, 29898, 1311, 29892, 282, 312, 1125, 13, 1678, 9995, 3563, 3539, 297, 1014, 13203, 304, 23233, 263, 4331, 29892, 2729, 373, 263, 19649, 13285, 1213, 15945, 268, 13, 13, 13, 1990, 530, 7715, 4782, 29898, 13579, 1125, 13, 29871, 9995, 3247, 1036, 263, 2318, 310, 24980, 800, 297, 8943, 2745, 599, 526, 2309, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 1125, 13, 1678, 9995, 15514, 7093, 278, 9612, 411, 263, 1051, 310, 3778, 800, 1213, 15945, 13, 1678, 530, 7715, 17255, 2344, 12035, 1311, 29897, 13, 1678, 1583, 29889, 11576, 800, 353, 6389, 13, 1678, 1583, 29889, 15091, 353, 7700, 13, 13, 29871, 822, 3380, 29898, 1311, 29892, 1286, 1125, 13, 1678, 530, 7715, 29889, 463, 29898, 1311, 29892, 1286, 29897, 13, 1678, 363, 263, 297, 1583, 29889, 11576, 800, 29901, 13, 418, 263, 29889, 463, 29898, 3707, 29897, 13, 13, 29871, 822, 16892, 29898, 1311, 29892, 1286, 1125, 13, 1678, 530, 7715, 29889, 24667, 29898, 1311, 29892, 1286, 29897, 13, 1678, 599, 29918, 15091, 353, 5852, 13, 1678, 363, 263, 297, 1583, 29889, 11576, 800, 29901, 13, 418, 263, 29889, 24667, 29898, 3707, 29897, 13, 418, 565, 451, 263, 29889, 15091, 29901, 13, 4706, 599, 29918, 15091, 353, 7700, 13, 1678, 1583, 29889, 15091, 353, 599, 29918, 15091, 13, 13, 13, 1990, 530, 7715, 20529, 29898, 13579, 1125, 13, 29871, 9995, 3247, 1036, 263, 731, 310, 24980, 800, 297, 5665, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 1125, 13, 1678, 530, 7715, 17255, 2344, 12035, 1311, 29897, 13, 1678, 1583, 29889, 11576, 800, 353, 1051, 29898, 5085, 29897, 13, 1678, 1583, 29889, 4925, 353, 6213, 13, 13, 29871, 822, 16892, 29898, 1311, 29892, 1286, 1125, 13, 1678, 9995, 3253, 29894, 2925, 278, 2343, 9612, 297, 278, 9521, 29892, 11077, 2309, 6743, 1213, 15945, 13, 1678, 530, 7715, 29889, 24667, 29898, 1311, 29892, 1286, 29897, 13, 1678, 396, 2796, 1857, 9612, 29892, 565, 2309, 29889, 13, 1678, 565, 1583, 29889, 4925, 322, 1583, 29889, 4925, 29889, 15091, 29901, 13, 418, 1583, 29889, 4925, 353, 6213, 13, 13, 1678, 396, 6977, 2446, 9612, 515, 9521, 322, 1369, 29892, 565, 5642, 29889, 13, 1678, 565, 451, 1583, 29889, 4925, 29901, 13, 418, 565, 1583, 29889, 11576, 800, 29901, 13, 4706, 1583, 29889, 4925, 353, 1583, 29889, 11576, 800, 29889, 7323, 29898, 29900, 29897, 13, 4706, 1583, 29889, 4925, 29889, 463, 29898, 3707, 29897, 13, 4706, 736, 13, 13, 1678, 396, 1939, 901, 3778, 800, 1149, 2309, 29889, 13, 1678, 565, 451, 1583, 29889, 4925, 29901, 13, 418, 1583, 29889, 15091, 353, 5852, 13, 418, 736, 13, 13, 1678, 1583, 29889, 4925, 29889, 24667, 29898, 3707, 29897, 13, 13, 13, 1990, 7419, 29898, 12697, 13579, 1125, 13, 29871, 9995, 2744, 9612, 8401, 278, 23449, 309, 310, 385, 382, 4099, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 10977, 29892, 988, 29892, 14385, 29918, 1516, 29922, 29906, 29900, 29900, 1125, 13, 268, 9995, 29924, 586, 267, 278, 321, 29891, 774, 497, 304, 263, 2183, 8984, 988, 1213, 15945, 13, 268, 22985, 13579, 17255, 2344, 12035, 1311, 29892, 14385, 29918, 1516, 29897, 13, 268, 1583, 29889, 1032, 29872, 353, 10977, 13, 268, 1583, 29889, 12574, 353, 10977, 29889, 29886, 786, 309, 13, 268, 1583, 29889, 7854, 353, 988, 13, 268, 1583, 29889, 8235, 353, 1583, 29889, 7854, 29889, 29916, 448, 1583, 29889, 12574, 29889, 29916, 13, 268, 1583, 29889, 4518, 353, 1583, 29889, 7854, 29889, 29891, 448, 1583, 29889, 12574, 29889, 29891, 13, 268, 565, 1583, 29889, 8235, 1275, 29871, 29900, 322, 1583, 29889, 4518, 1275, 29871, 29900, 29901, 13, 539, 1583, 29889, 15091, 353, 5852, 13, 13, 29871, 822, 903, 20131, 29898, 1311, 29892, 282, 312, 1125, 13, 1678, 565, 1583, 29889, 15091, 29901, 13, 418, 736, 13, 1678, 16256, 353, 8984, 29898, 524, 29898, 1311, 29889, 12574, 29889, 29916, 718, 313, 1311, 29889, 8235, 334, 282, 312, 8243, 29871, 938, 29898, 1311, 29889, 12574, 29889, 29891, 718, 313, 1311, 29889, 4518, 334, 282, 312, 4961, 13, 1678, 1583, 29889, 1032, 29872, 3032, 6914, 29898, 21962, 29897, 13, 13, 13, 1990, 350, 2324, 29898, 12697, 13579, 1125, 13, 29871, 9995, 2744, 9612, 1999, 18159, 385, 382, 4099, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 10977, 29892, 14385, 29918, 1516, 29922, 29945, 29900, 29900, 1125, 13, 268, 9995, 29933, 4965, 278, 10977, 297, 14385, 29918, 1516, 15945, 29908, 13, 268, 22985, 13579, 17255, 2344, 12035, 1311, 29892, 14385, 29918, 1516, 29897, 13, 268, 1583, 29889, 1032, 29872, 353, 10977, 13, 268, 1583, 29889, 1032, 295, 333, 353, 29871, 29900, 29871, 396, 5947, 842, 310, 278, 321, 29891, 295, 4841, 29892, 29871, 29900, 29922, 3150, 29892, 29871, 29941, 29922, 15603, 13, 13, 29871, 822, 903, 20131, 29898, 1311, 29892, 282, 312, 1125, 13, 1678, 565, 1583, 29889, 15091, 29901, 13, 418, 736, 13, 1678, 396, 23186, 321, 29891, 295, 4841, 29871, 29900, 976, 29946, 297, 937, 4203, 310, 9612, 29892, 769, 337, 29899, 3150, 29889, 13, 1678, 565, 313, 29886, 312, 529, 29871, 29900, 29889, 29945, 1125, 13, 418, 9210, 353, 29871, 29946, 334, 313, 29886, 312, 847, 29871, 29900, 29889, 29946, 29929, 29897, 718, 29871, 29900, 29889, 29945, 13, 418, 1583, 29889, 1032, 29872, 3032, 1032, 295, 4841, 29898, 524, 29898, 10289, 876, 13, 1678, 1683, 29901, 13, 418, 9210, 353, 29871, 29946, 448, 313, 29946, 334, 5135, 29886, 312, 448, 29871, 29900, 29889, 29945, 29897, 847, 29871, 29900, 29889, 29946, 29929, 29897, 718, 29871, 29900, 29889, 29945, 29897, 13, 418, 1583, 29889, 1032, 29872, 3032, 1032, 295, 4841, 29898, 524, 29898, 10289, 876, 13, 1678, 396, 22521, 545, 5076, 8072, 1722, 1449, 472, 1095, 310, 9612, 29889, 13, 1678, 565, 282, 312, 6736, 29871, 29896, 29889, 29900, 29901, 13, 418, 1583, 29889, 1032, 29872, 3032, 1032, 295, 4841, 6278, 29896, 29897, 13, 418, 736, 13, 13, 13, 1990, 11189, 29923, 3582, 29898, 13579, 20529, 1125, 13, 29871, 9995, 29907, 2124, 267, 278, 5076, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 2175, 29892, 1492, 29892, 14385, 29918, 1516, 29922, 29941, 29900, 29900, 29900, 1125, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 29871, 29941, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 13, 418, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 8243, 13, 418, 20340, 29898, 1516, 511, 13, 418, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29946, 511, 10887, 876, 13, 1678, 1723, 13, 13, 13, 1990, 341, 621, 29923, 3582, 29898, 13579, 20529, 1125, 13, 29871, 9995, 797, 3901, 525, 19128, 5076, 742, 3063, 714, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 2175, 29892, 1492, 29892, 14385, 29918, 1516, 29922, 29941, 29900, 29900, 29900, 1125, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 29871, 29941, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 13, 418, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 8243, 13, 418, 20340, 29898, 1516, 511, 13, 418, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29946, 511, 10887, 876, 13, 1678, 1723, 13, 13, 13, 1990, 14279, 1537, 29933, 2324, 29898, 13579, 20529, 1125, 13, 29871, 9995, 29933, 4965, 2175, 10977, 29892, 769, 1492, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 2175, 29892, 1492, 29892, 14385, 29918, 1516, 29922, 29896, 29945, 29900, 29900, 1125, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 29871, 29906, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 13, 418, 2175, 29889, 2204, 682, 29898, 1516, 511, 13, 418, 1492, 29889, 2204, 682, 29898, 1516, 29897, 13, 1678, 1723, 13, 13, 13, 1990, 19575, 29891, 29923, 4099, 29898, 13579, 20529, 1125, 13, 29871, 9995, 29931, 340, 414, 23449, 309, 310, 263, 2323, 10977, 871, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 10977, 29892, 14385, 29918, 1516, 29922, 29906, 29900, 29900, 29900, 1125, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 29871, 29941, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 13, 418, 10977, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29953, 511, 10887, 334, 29871, 29906, 511, 29871, 396, 27723, 14205, 13, 418, 10977, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29946, 511, 10887, 511, 418, 396, 6981, 895, 9098, 13, 1678, 1723, 13, 13, 13, 1990, 14279, 1537, 5592, 262, 29898, 13579, 20529, 1125, 13, 29871, 9995, 29915, 5592, 1144, 29915, 23449, 309, 4029, 6753, 635, 411, 11463, 862, 618, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 2175, 29892, 1492, 29892, 14385, 29918, 1516, 29922, 29946, 29900, 29900, 1125, 13, 1678, 3064, 353, 29871, 29906, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 313, 3706, 29930, 29947, 29897, 13, 1678, 263, 353, 5159, 13, 1678, 396, 3387, 3013, 8401, 304, 278, 2175, 29892, 408, 278, 382, 4099, 770, 17766, 28489, 29889, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 3064, 29930, 29947, 1125, 13, 418, 921, 353, 29871, 29946, 448, 474, 13, 418, 263, 29889, 4397, 29898, 13579, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29916, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29916, 29892, 29871, 29946, 511, 10887, 4961, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 334, 29874, 29897, 13, 13, 13, 1990, 21595, 5592, 262, 29898, 13579, 20529, 1125, 13, 29871, 9995, 5592, 1144, 278, 321, 29891, 774, 4293, 310, 1716, 5076, 297, 22558, 1213, 15945, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 2175, 29892, 1492, 29892, 14385, 29918, 1516, 29922, 29946, 29900, 29900, 1125, 13, 1678, 3064, 353, 29871, 29906, 13, 1678, 10887, 353, 14385, 29918, 1516, 847, 313, 3706, 29930, 29896, 29941, 718, 29871, 29896, 29897, 13, 1678, 263, 353, 518, 13579, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 28166, 13, 1678, 363, 474, 297, 3464, 29898, 3706, 1125, 13, 418, 263, 353, 263, 718, 518, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29941, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29941, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29945, 29892, 29871, 29906, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29941, 29892, 29871, 29906, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29906, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29906, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29941, 29892, 29871, 29906, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29945, 29892, 29871, 29906, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29941, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29941, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29945, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29945, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29941, 29892, 29871, 29953, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29945, 29892, 29871, 29953, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29953, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29946, 29892, 29871, 29953, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29945, 29892, 29871, 29953, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29941, 29892, 29871, 29953, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29945, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29945, 511, 10887, 8243, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 5228, 29898, 29953, 29892, 29871, 29946, 511, 10887, 511, 1492, 29889, 6914, 29898, 5228, 29898, 29906, 29892, 29871, 29946, 511, 10887, 876, 13, 418, 4514, 13, 1678, 530, 7715, 20529, 17255, 2344, 12035, 1311, 29892, 334, 29874, 29897, 13, 13, 13, 1990, 402, 677, 29923, 3582, 29898, 12697, 13579, 1125, 13, 29871, 9995, 29954, 677, 29879, 278, 5076, 29936, 1532, 29892, 3265, 278, 4742, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 4742, 29892, 14385, 29918, 1516, 29922, 29941, 29900, 29900, 1125, 13, 268, 9995, 29933, 4965, 278, 10977, 297, 14385, 29918, 1516, 15945, 29908, 13, 268, 22985, 13579, 17255, 2344, 12035, 1311, 29892, 14385, 29918, 1516, 29897, 13, 268, 1583, 29889, 10141, 353, 4742, 13, 13, 29871, 822, 903, 20131, 29898, 1311, 29892, 282, 312, 1125, 13, 1678, 565, 1583, 29889, 15091, 29901, 13, 418, 736, 13, 1678, 396, 512, 1037, 559, 12814, 29871, 29941, 29900, 976, 29896, 29945, 29900, 297, 937, 4203, 310, 9612, 29892, 769, 6963, 1623, 1449, 29889, 13, 1678, 565, 313, 29886, 312, 529, 29871, 29900, 29889, 29945, 1125, 13, 418, 274, 353, 938, 29898, 29941, 29900, 718, 29871, 29896, 29906, 29900, 334, 313, 29886, 312, 847, 29871, 29900, 29889, 29946, 29929, 876, 13, 418, 1583, 29889, 10141, 29889, 9996, 579, 29898, 29883, 29897, 13, 1678, 1683, 29901, 13, 418, 274, 353, 938, 29898, 29896, 29945, 29900, 448, 29871, 29896, 29906, 29900, 334, 5135, 29886, 312, 448, 29871, 29900, 29889, 29945, 29897, 847, 29871, 29900, 29889, 29946, 29929, 876, 13, 418, 1583, 29889, 10141, 29889, 9996, 579, 29898, 29883, 29897, 13, 1678, 396, 22521, 545, 5076, 8072, 1722, 1449, 472, 1095, 310, 9612, 29889, 13, 1678, 565, 282, 312, 6736, 29871, 29896, 29889, 29900, 29901, 13, 418, 1583, 29889, 10141, 29889, 9996, 579, 29898, 29941, 29900, 29897, 13, 13, 13, 1990, 20340, 29898, 12697, 13579, 1125, 13, 29871, 9995, 2744, 9612, 2599, 3078, 1213, 15945, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 10977, 29892, 14385, 29918, 1516, 29922, 29941, 29900, 29900, 1125, 13, 268, 9995, 29956, 29874, 1169, 363, 14385, 29918, 1516, 15945, 29908, 13, 268, 22985, 13579, 17255, 2344, 12035, 1311, 29892, 14385, 29918, 1516, 29897, 13, 13, 13, 1990, 382, 4099, 29898, 3318, 1125, 13, 29871, 9995, 29909, 2323, 29871, 29947, 29916, 29947, 10977, 591, 26015, 322, 4216, 373, 1749, 25023, 4636, 1213, 15945, 13, 13, 29871, 396, 19219, 321, 29891, 774, 497, 4472, 313, 14037, 263, 23449, 309, 467, 13, 29871, 10977, 29918, 2135, 353, 518, 13, 268, 29900, 29890, 29900, 29900, 29896, 29896, 29896, 29896, 29900, 29900, 29892, 13, 268, 29900, 29890, 29900, 29896, 29896, 29896, 29896, 29896, 29896, 29900, 29892, 13, 268, 29900, 29890, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29892, 13, 268, 29900, 29890, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29892, 13, 268, 29900, 29890, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29892, 13, 268, 29900, 29890, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29892, 13, 268, 29900, 29890, 29900, 29896, 29896, 29896, 29896, 29896, 29896, 29900, 29892, 13, 268, 29900, 29890, 29900, 29900, 29896, 29896, 29896, 29896, 29900, 29900, 13, 29871, 4514, 13, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 9995, 15514, 7093, 278, 10977, 1213, 15945, 13, 1678, 1583, 29889, 29886, 861, 1379, 353, 7023, 2378, 29898, 29923, 4099, 29889, 1032, 29872, 29918, 2135, 29897, 13, 1678, 396, 450, 4818, 310, 278, 23449, 309, 29892, 577, 29871, 29946, 29892, 29946, 338, 3063, 7812, 14432, 29889, 13, 1678, 1583, 29889, 29886, 786, 309, 353, 8984, 29898, 29946, 29892, 29946, 29897, 13, 1678, 396, 450, 9210, 310, 278, 321, 29891, 295, 333, 29898, 29879, 29897, 515, 278, 2246, 29914, 8968, 29889, 529, 29871, 29900, 363, 8072, 1722, 29889, 13, 1678, 1583, 29889, 1032, 295, 4841, 353, 448, 29896, 13, 13, 29871, 822, 903, 265, 29898, 1311, 29892, 921, 29892, 343, 1125, 13, 1678, 9995, 29943, 492, 567, 278, 15526, 472, 921, 29892, 29891, 373, 29889, 399, 336, 567, 565, 921, 29914, 29891, 714, 310, 13451, 1213, 15945, 13, 1678, 343, 353, 343, 1273, 29871, 29947, 13, 1678, 921, 353, 921, 1273, 29871, 29947, 13, 1678, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 353, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 891, 313, 29900, 29890, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 3532, 313, 29955, 448, 921, 876, 13, 13, 29871, 822, 903, 2696, 29898, 1311, 29892, 921, 29892, 343, 1125, 13, 1678, 9995, 29943, 492, 567, 278, 15526, 472, 921, 29892, 29891, 1283, 29889, 399, 336, 567, 565, 921, 29914, 29891, 714, 310, 13451, 1213, 15945, 13, 1678, 343, 353, 343, 1273, 29871, 29947, 13, 1678, 921, 353, 921, 1273, 29871, 29947, 13, 1678, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 29871, 353, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 669, 3695, 29898, 29900, 29890, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 3532, 313, 29955, 448, 921, 876, 13, 13, 29871, 822, 903, 798, 29918, 265, 29898, 1311, 29892, 343, 1125, 13, 1678, 9995, 29943, 492, 567, 278, 3353, 1948, 472, 343, 373, 29889, 399, 336, 567, 565, 343, 714, 310, 13451, 1213, 15945, 13, 1678, 343, 353, 343, 1273, 7431, 29898, 1311, 29889, 29886, 861, 1379, 29897, 13, 1678, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 353, 29871, 29900, 29890, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 29896, 13, 13, 29871, 822, 903, 798, 29918, 2696, 29898, 1311, 29892, 343, 1125, 13, 1678, 9995, 29943, 492, 567, 278, 3353, 1948, 472, 343, 1283, 29889, 399, 336, 567, 565, 343, 714, 310, 13451, 1213, 15945, 13, 1678, 343, 353, 343, 1273, 7431, 29898, 1311, 29889, 29886, 861, 1379, 29897, 13, 1678, 1583, 29889, 29886, 861, 1379, 29961, 29891, 29962, 353, 29871, 29900, 29890, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 29871, 822, 903, 6914, 29898, 1311, 29892, 926, 1125, 13, 1678, 9995, 1888, 4210, 2486, 16229, 278, 23449, 309, 310, 278, 321, 29891, 774, 497, 304, 926, 1213, 15945, 13, 1678, 1583, 29889, 29886, 786, 309, 353, 926, 13, 1678, 1583, 29889, 29886, 786, 309, 29889, 29916, 353, 1583, 29889, 29886, 786, 309, 29889, 29916, 1273, 29871, 29947, 13, 1678, 1583, 29889, 29886, 786, 309, 29889, 29891, 353, 1583, 29889, 29886, 786, 309, 29889, 29891, 1273, 29871, 29947, 13, 13, 29871, 822, 903, 1032, 295, 4841, 29898, 1311, 29892, 9210, 1125, 13, 1678, 9995, 29924, 586, 267, 278, 321, 29891, 295, 4841, 304, 278, 2183, 9210, 29892, 448, 29896, 29922, 3150, 29892, 29871, 29941, 29922, 15603, 1213, 15945, 13, 1678, 1583, 29889, 1032, 295, 4841, 353, 4236, 6278, 29896, 29892, 1375, 29898, 10289, 29892, 29871, 29941, 876, 13, 13, 29871, 822, 1106, 29898, 1311, 29892, 926, 29892, 14385, 29918, 1516, 29922, 29941, 29900, 29900, 1125, 13, 1678, 9995, 11609, 29879, 385, 9612, 29892, 8401, 278, 2653, 309, 304, 926, 297, 14385, 29918, 1516, 1213, 15945, 13, 1678, 736, 7419, 29898, 1311, 29892, 926, 29892, 14385, 29918, 1516, 29897, 13, 13, 29871, 822, 1999, 682, 29898, 1311, 29892, 14385, 29918, 1516, 29922, 29945, 29900, 29900, 1125, 13, 1678, 9995, 11609, 29879, 385, 9612, 29892, 1999, 18159, 278, 10977, 297, 14385, 29918, 1516, 1213, 15945, 13, 1678, 736, 350, 2324, 29898, 1311, 29892, 14385, 29918, 1516, 29897, 13, 13, 29871, 822, 1967, 29898, 1311, 1125, 13, 1678, 9995, 29934, 21043, 278, 1857, 2106, 310, 278, 10977, 964, 385, 29871, 29947, 29916, 29947, 1601, 2878, 4871, 1967, 1213, 15945, 13, 1678, 1583, 29889, 29886, 861, 1379, 353, 7023, 2378, 29898, 29923, 4099, 29889, 1032, 29872, 29918, 2135, 29897, 13, 1678, 396, 18492, 23449, 309, 13, 1678, 1583, 3032, 2696, 29898, 1311, 29889, 29886, 786, 309, 29889, 29916, 29899, 29896, 29892, 1311, 29889, 29886, 786, 309, 29889, 29891, 29899, 29896, 29897, 13, 1678, 1583, 3032, 2696, 29898, 1311, 29889, 29886, 786, 309, 29889, 29916, 29892, 1311, 29889, 29886, 786, 309, 29889, 29891, 29899, 29896, 29897, 13, 1678, 1583, 3032, 2696, 29898, 1311, 29889, 29886, 786, 309, 29889, 29916, 29899, 29896, 29892, 1311, 29889, 29886, 786, 309, 29889, 29891, 29897, 13, 1678, 1583, 3032, 2696, 29898, 1311, 29889, 29886, 786, 309, 29889, 29916, 29892, 1311, 29889, 29886, 786, 309, 29889, 29891, 29897, 13, 1678, 396, 18492, 321, 29891, 295, 4841, 29892, 565, 13877, 29889, 13, 1678, 565, 1583, 29889, 1032, 295, 4841, 6736, 29871, 29900, 29901, 13, 418, 363, 474, 297, 921, 3881, 29898, 29900, 29892, 1583, 29889, 1032, 295, 4841, 718, 29871, 29896, 1125, 13, 4706, 1583, 3032, 798, 29918, 2696, 29898, 29875, 29897, 13, 4706, 1583, 3032, 798, 29918, 2696, 29898, 29955, 29899, 29875, 29897, 13, 1678, 736, 7084, 29889, 3166, 13193, 877, 29896, 742, 313, 29947, 29892, 29871, 29947, 511, 6262, 29898, 1311, 29889, 29886, 861, 1379, 876, 13, 13, 13, 1753, 679, 29918, 10141, 29898, 19304, 29918, 5085, 1125, 13, 29871, 13812, 353, 9920, 1220, 29889, 3258, 29918, 16680, 29898, 8216, 2433, 29880, 10859, 29889, 19057, 6273, 1495, 13, 29871, 6389, 353, 13812, 29889, 5510, 29918, 5085, 29898, 19304, 29918, 5085, 29897, 13, 29871, 565, 6389, 29889, 2917, 29901, 13, 1678, 396, 2254, 2295, 515, 934, 13, 1678, 2295, 353, 9920, 1220, 29889, 1359, 29918, 2917, 29898, 5085, 29889, 2917, 29897, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 29898, 2917, 718, 3935, 29918, 5085, 29897, 13, 29871, 396, 1653, 4742, 13, 29871, 4742, 353, 9920, 1220, 29889, 3258, 29918, 10141, 29898, 5085, 29897, 13, 29871, 736, 4742, 13, 13, 29937, 4593, 9612, 16892, 13, 29911, 2965, 29968, 29918, 1660, 6007, 8452, 353, 29871, 29900, 29889, 29896, 13, 13, 1753, 4050, 29898, 1563, 29892, 1492, 29892, 4742, 1125, 13, 29871, 9995, 29934, 21043, 278, 1857, 2106, 310, 278, 5076, 373, 4742, 1213, 15945, 13, 29871, 411, 10508, 29898, 10141, 29897, 408, 4216, 29901, 13, 1678, 4216, 29889, 2966, 1958, 3552, 29900, 29892, 29871, 29900, 511, 2175, 29889, 3027, 3285, 5445, 543, 10921, 1159, 13, 1678, 4216, 29889, 2966, 1958, 3552, 29947, 29892, 29871, 29900, 511, 1492, 29889, 3027, 3285, 5445, 543, 10921, 1159, 13, 13, 1753, 5839, 29918, 15987, 29898, 10141, 29892, 2175, 29892, 1492, 1125, 13, 29871, 474, 353, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29953, 29897, 13, 29871, 565, 474, 1275, 29871, 29900, 29901, 13, 1678, 736, 11189, 29923, 3582, 29898, 1563, 29892, 1492, 29897, 13, 29871, 565, 474, 1275, 29871, 29896, 29901, 13, 1678, 736, 14279, 1537, 5592, 262, 29898, 1563, 29892, 1492, 29897, 13, 29871, 565, 474, 1275, 29871, 29906, 29901, 13, 1678, 736, 341, 621, 29923, 3582, 29898, 1563, 29892, 1492, 29897, 13, 29871, 565, 474, 1275, 29871, 29941, 29901, 13, 1678, 736, 14279, 1537, 29933, 2324, 29898, 1563, 29892, 1492, 29897, 13, 29871, 565, 474, 1275, 29871, 29946, 29901, 13, 418, 736, 19575, 29891, 29923, 4099, 29898, 1563, 29897, 13, 29871, 565, 474, 1275, 29871, 29945, 29901, 13, 418, 736, 21595, 5592, 262, 29898, 1563, 29892, 1492, 29897, 13, 29871, 736, 402, 677, 29923, 3582, 29898, 10141, 29897, 13, 13, 1753, 9612, 29918, 7888, 29898, 10141, 1125, 13, 29871, 2175, 353, 382, 4099, 580, 13, 29871, 1492, 353, 382, 4099, 580, 13, 29871, 1667, 29918, 16506, 353, 530, 7715, 20529, 580, 13, 29871, 1550, 29898, 5574, 1125, 13, 1678, 1369, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 13, 1678, 396, 24505, 278, 2446, 4513, 310, 3778, 800, 29892, 565, 9521, 4069, 29889, 13, 1678, 565, 1667, 29918, 16506, 29889, 15091, 29901, 13, 418, 3778, 800, 353, 5159, 13, 418, 396, 7419, 304, 263, 4036, 1298, 13, 418, 282, 353, 8984, 29898, 8172, 29889, 9502, 524, 29898, 29906, 29892, 29945, 511, 4036, 29889, 9502, 524, 29898, 29906, 29892, 29945, 876, 13, 418, 3778, 800, 29889, 4397, 29898, 13, 4706, 530, 7715, 4782, 29898, 1563, 29889, 6914, 29898, 29886, 511, 1492, 29889, 6914, 29898, 29886, 4961, 13, 418, 396, 20340, 29871, 29906, 29889, 29945, 448, 29871, 29941, 29889, 29945, 29879, 13, 418, 3778, 800, 29889, 4397, 29898, 15716, 29898, 8172, 29889, 9502, 524, 29898, 29945, 29892, 29955, 29897, 334, 29871, 29945, 29900, 29900, 876, 13, 418, 396, 7198, 1999, 682, 13, 418, 565, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29941, 29897, 1275, 29871, 29900, 29901, 13, 4706, 3778, 800, 29889, 4397, 29898, 13, 3986, 530, 7715, 4782, 29898, 1563, 29889, 2204, 682, 3285, 1492, 29889, 2204, 682, 22130, 13, 418, 396, 7412, 385, 2779, 29892, 565, 7429, 29889, 13, 418, 565, 4036, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29953, 29897, 1275, 29871, 29900, 29901, 13, 4706, 3778, 800, 29889, 4397, 29898, 23945, 29918, 15987, 29898, 10141, 29892, 2175, 29892, 1492, 876, 13, 418, 1667, 29918, 16506, 353, 530, 7715, 20529, 10456, 11576, 800, 29897, 13, 13, 1678, 396, 530, 6490, 13, 1678, 1667, 29918, 16506, 29889, 24667, 29898, 2962, 29897, 13, 13, 1678, 4050, 29898, 1563, 29892, 1492, 29892, 4742, 29897, 13, 13, 1678, 396, 317, 5436, 565, 591, 29915, 276, 2675, 2086, 5172, 29889, 13, 1678, 560, 28170, 353, 12865, 29889, 12673, 29889, 3707, 580, 448, 1369, 13, 1678, 12844, 29872, 415, 603, 353, 4236, 29898, 29911, 2965, 29968, 29918, 1660, 6007, 8452, 448, 560, 28170, 29889, 7827, 29918, 23128, 3285, 29871, 29900, 29897, 13, 1678, 931, 29889, 17059, 29898, 29879, 17179, 415, 603, 29897, 13, 13, 13, 1753, 1667, 7295, 13, 29871, 4742, 353, 679, 29918, 10141, 29898, 9675, 29889, 19218, 29961, 29896, 29901, 2314, 13, 29871, 4742, 29889, 9996, 579, 29898, 29941, 29900, 29897, 13, 29871, 9612, 29918, 7888, 29898, 10141, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 1018, 29901, 13, 1678, 1667, 580, 13, 29871, 5174, 7670, 3377, 4074, 6685, 29901, 13, 1678, 1209, 13, 2 ]
data_structures/disjoint_set/disjoint_set.py
egagraha/python-algorithm
0
2233
<gh_stars>0 """ Disjoint set. Reference: https://en.wikipedia.org/wiki/Disjoint-set_data_structure """ class Node: def __init__(self, data: int) -> None: self.data = data self.rank: int self.parent: Node def make_set(x: Node) -> None: """ Make x as a set. """ # rank is the distance from x to its' parent # root's rank is 0 x.rank = 0 x.parent = x def union_set(x: Node, y: Node) -> None: """ Union of two sets. set with bigger rank should be parent, so that the disjoint set tree will be more flat. """ x, y = find_set(x), find_set(y) if x == y: return elif x.rank > y.rank: y.parent = x else: x.parent = y if x.rank == y.rank: y.rank += 1 def find_set(x: Node) -> Node: """ Return the parent of x """ if x != x.parent: x.parent = find_set(x.parent) return x.parent def find_python_set(node: Node) -> set: """ Return a Python Standard Library set that contains i. """ sets = ({0, 1, 2}, {3, 4, 5}) for s in sets: if node.data in s: return s raise ValueError(f"{node.data} is not in {sets}") def test_disjoint_set() -> None: """ >>> test_disjoint_set() """ vertex = [Node(i) for i in range(6)] for v in vertex: make_set(v) union_set(vertex[0], vertex[1]) union_set(vertex[1], vertex[2]) union_set(vertex[3], vertex[4]) union_set(vertex[3], vertex[5]) for node0 in vertex: for node1 in vertex: if find_python_set(node0).isdisjoint(find_python_set(node1)): assert find_set(node0) != find_set(node1) else: assert find_set(node0) == find_set(node1) if __name__ == "__main__": test_disjoint_set()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 13, 1678, 3295, 12090, 731, 29889, 13, 1678, 12105, 29901, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 4205, 12090, 29899, 842, 29918, 1272, 29918, 23905, 13, 15945, 29908, 13, 13, 13, 1990, 9071, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 29901, 938, 29897, 1599, 6213, 29901, 13, 4706, 1583, 29889, 1272, 353, 848, 13, 4706, 1583, 29889, 10003, 29901, 938, 13, 4706, 1583, 29889, 3560, 29901, 9071, 13, 13, 13, 1753, 1207, 29918, 842, 29898, 29916, 29901, 9071, 29897, 1599, 6213, 29901, 13, 1678, 9995, 13, 1678, 8561, 921, 408, 263, 731, 29889, 13, 1678, 9995, 13, 1678, 396, 7115, 338, 278, 5418, 515, 921, 304, 967, 29915, 3847, 13, 1678, 396, 3876, 29915, 29879, 7115, 338, 29871, 29900, 13, 1678, 921, 29889, 10003, 353, 29871, 29900, 13, 1678, 921, 29889, 3560, 353, 921, 13, 13, 13, 1753, 9833, 29918, 842, 29898, 29916, 29901, 9071, 29892, 343, 29901, 9071, 29897, 1599, 6213, 29901, 13, 1678, 9995, 13, 1678, 7761, 310, 1023, 6166, 29889, 13, 1678, 731, 411, 16600, 7115, 881, 367, 3847, 29892, 577, 393, 278, 13, 1678, 766, 12090, 731, 5447, 674, 367, 901, 12151, 29889, 13, 1678, 9995, 13, 1678, 921, 29892, 343, 353, 1284, 29918, 842, 29898, 29916, 511, 1284, 29918, 842, 29898, 29891, 29897, 13, 1678, 565, 921, 1275, 343, 29901, 13, 4706, 736, 13, 13, 1678, 25342, 921, 29889, 10003, 1405, 343, 29889, 10003, 29901, 13, 4706, 343, 29889, 3560, 353, 921, 13, 1678, 1683, 29901, 13, 4706, 921, 29889, 3560, 353, 343, 13, 4706, 565, 921, 29889, 10003, 1275, 343, 29889, 10003, 29901, 13, 9651, 343, 29889, 10003, 4619, 29871, 29896, 13, 13, 13, 1753, 1284, 29918, 842, 29898, 29916, 29901, 9071, 29897, 1599, 9071, 29901, 13, 1678, 9995, 13, 1678, 7106, 278, 3847, 310, 921, 13, 1678, 9995, 13, 1678, 565, 921, 2804, 921, 29889, 3560, 29901, 13, 4706, 921, 29889, 3560, 353, 1284, 29918, 842, 29898, 29916, 29889, 3560, 29897, 13, 1678, 736, 921, 29889, 3560, 13, 13, 13, 1753, 1284, 29918, 4691, 29918, 842, 29898, 3177, 29901, 9071, 29897, 1599, 731, 29901, 13, 1678, 9995, 13, 1678, 7106, 263, 5132, 10117, 9538, 731, 393, 3743, 474, 29889, 13, 1678, 9995, 13, 1678, 6166, 353, 21313, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 1118, 426, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 1800, 13, 1678, 363, 269, 297, 6166, 29901, 13, 4706, 565, 2943, 29889, 1272, 297, 269, 29901, 13, 9651, 736, 269, 13, 1678, 12020, 7865, 2392, 29898, 29888, 29908, 29912, 3177, 29889, 1272, 29913, 338, 451, 297, 426, 7224, 27195, 13, 13, 13, 1753, 1243, 29918, 2218, 12090, 29918, 842, 580, 1599, 6213, 29901, 13, 1678, 9995, 13, 1678, 8653, 1243, 29918, 2218, 12090, 29918, 842, 580, 13, 1678, 9995, 13, 1678, 12688, 353, 518, 4247, 29898, 29875, 29897, 363, 474, 297, 3464, 29898, 29953, 4638, 13, 1678, 363, 325, 297, 12688, 29901, 13, 4706, 1207, 29918, 842, 29898, 29894, 29897, 13, 13, 1678, 9833, 29918, 842, 29898, 369, 4776, 29961, 29900, 1402, 12688, 29961, 29896, 2314, 13, 1678, 9833, 29918, 842, 29898, 369, 4776, 29961, 29896, 1402, 12688, 29961, 29906, 2314, 13, 1678, 9833, 29918, 842, 29898, 369, 4776, 29961, 29941, 1402, 12688, 29961, 29946, 2314, 13, 1678, 9833, 29918, 842, 29898, 369, 4776, 29961, 29941, 1402, 12688, 29961, 29945, 2314, 13, 13, 1678, 363, 2943, 29900, 297, 12688, 29901, 13, 4706, 363, 2943, 29896, 297, 12688, 29901, 13, 9651, 565, 1284, 29918, 4691, 29918, 842, 29898, 3177, 29900, 467, 275, 2218, 12090, 29898, 2886, 29918, 4691, 29918, 842, 29898, 3177, 29896, 22164, 13, 18884, 4974, 1284, 29918, 842, 29898, 3177, 29900, 29897, 2804, 1284, 29918, 842, 29898, 3177, 29896, 29897, 13, 9651, 1683, 29901, 13, 18884, 4974, 1284, 29918, 842, 29898, 3177, 29900, 29897, 1275, 1284, 29918, 842, 29898, 3177, 29896, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1243, 29918, 2218, 12090, 29918, 842, 580, 13, 2 ]
uap/post/forms.py
Tyromancer/UAP-Application-Platform-Django
0
42387
from django import forms from django.forms import ModelForm, CharField from ckeditor.widgets import CKEditorWidget from .models import URP, Application class URPCreateForm(ModelForm): """Form for URP creation""" description = CharField(widget=CKEditorWidget()) class Meta: model = URP fields = ['title', 'summary', 'description'] class URPUpdateForm(ModelForm): """Form for updating/editing URPs""" description = CharField(widget=CKEditorWidget()) class Meta: model = URP fields = ['summary', 'description'] class ApplicationCreateForm(ModelForm): """Form for Application creation""" class Meta: model = Application fields = ['description'] description = CharField() class ApplicationManageForm(forms.Form): """Form for updating application status: Accept or Reject""" ACTIONS = ( ('A', "Accept"), ('R', "Reject"), ) action = forms.ChoiceField(widget=forms.Select, choices=ACTIONS)
[ 1, 515, 9557, 1053, 7190, 13, 3166, 9557, 29889, 9514, 1053, 8125, 2500, 29892, 2896, 3073, 13, 3166, 274, 29895, 15204, 29889, 8030, 29879, 1053, 315, 29968, 15280, 8801, 13, 3166, 869, 9794, 1053, 501, 29934, 29925, 29892, 8427, 13, 13, 13, 1990, 501, 29934, 29925, 4391, 2500, 29898, 3195, 2500, 1125, 13, 1678, 9995, 2500, 363, 501, 29934, 29925, 11265, 15945, 29908, 13, 13, 1678, 6139, 353, 2896, 3073, 29898, 8030, 29922, 7077, 15280, 8801, 3101, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 501, 29934, 29925, 13, 4706, 4235, 353, 6024, 3257, 742, 525, 7727, 742, 525, 8216, 2033, 13, 13, 13, 1990, 501, 29934, 29925, 6422, 2500, 29898, 3195, 2500, 1125, 13, 1678, 9995, 2500, 363, 13271, 29914, 5628, 292, 501, 29934, 29925, 29879, 15945, 29908, 13, 13, 1678, 6139, 353, 2896, 3073, 29898, 8030, 29922, 7077, 15280, 8801, 3101, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 501, 29934, 29925, 13, 4706, 4235, 353, 6024, 7727, 742, 525, 8216, 2033, 13, 13, 13, 1990, 8427, 4391, 2500, 29898, 3195, 2500, 1125, 13, 1678, 9995, 2500, 363, 8427, 11265, 15945, 29908, 13, 1678, 770, 20553, 29901, 13, 4706, 1904, 353, 8427, 13, 4706, 4235, 353, 6024, 8216, 2033, 13, 13, 1678, 6139, 353, 2896, 3073, 580, 13, 13, 13, 1990, 8427, 2517, 482, 2500, 29898, 9514, 29889, 2500, 1125, 13, 1678, 9995, 2500, 363, 13271, 2280, 4660, 29901, 29848, 470, 830, 622, 15945, 29908, 13, 1678, 319, 9838, 29903, 353, 313, 13, 4706, 6702, 29909, 742, 376, 23965, 4968, 13, 4706, 6702, 29934, 742, 376, 1123, 622, 4968, 13, 1678, 1723, 13, 13, 1678, 3158, 353, 7190, 29889, 29620, 3073, 29898, 8030, 29922, 9514, 29889, 3549, 29892, 19995, 29922, 24705, 29903, 29897, 13, 2 ]
build/env/lib/python2.7/site-packages/ipython-0.10-py2.7.egg/IPython/platutils_dummy.py
lumanjiao/XLS_BigData
11
87918
# -*- coding: utf-8 -*- """ Platform specific utility functions, dummy version This has empty implementation of the platutils functions, used for unsupported operating systems. Authors ------- - <NAME> <<EMAIL>> """ #***************************************************************************** # Copyright (C) 2008-2009 The IPython Development Team # Copyright (C) 2001-2007 <NAME> <<EMAIL>> # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #***************************************************************************** # This variable is part of the expected API of the module: ignore_termtitle = True def set_term_title(*args,**kw): """Dummy no-op.""" pass def find_cmd(cmd): """Find the full path to a command using which.""" return os.popen('which %s' % cmd).read().strip() def get_long_path_name(path): """Dummy no-op.""" return path
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 28096, 2702, 19725, 3168, 29892, 20254, 1873, 29871, 13, 13, 4013, 756, 4069, 5314, 310, 278, 18870, 13239, 3168, 29892, 1304, 363, 29871, 13, 348, 23765, 13598, 6757, 29889, 13, 13, 6444, 943, 13, 26589, 13, 29899, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 15945, 29908, 13, 13, 29937, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 13, 29937, 539, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29947, 29899, 29906, 29900, 29900, 29929, 450, 5641, 1656, 14650, 8583, 13, 29937, 539, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29896, 29899, 29906, 29900, 29900, 29955, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 13, 29937, 29871, 6652, 7541, 1090, 278, 4958, 310, 278, 350, 7230, 19245, 29889, 29871, 450, 2989, 19405, 338, 297, 13, 29937, 29871, 278, 934, 315, 4590, 29979, 4214, 29892, 13235, 408, 760, 310, 445, 7047, 29889, 13, 29937, 7775, 7775, 7775, 7775, 4189, 2328, 29930, 13, 13, 29937, 910, 2286, 338, 760, 310, 278, 3806, 3450, 310, 278, 3883, 29901, 13, 17281, 29918, 8489, 3257, 353, 5852, 13, 13, 1753, 731, 29918, 8489, 29918, 3257, 10456, 5085, 29892, 1068, 11022, 1125, 13, 1678, 9995, 29928, 11770, 694, 29899, 459, 1213, 15945, 13, 1678, 1209, 13, 13, 1753, 1284, 29918, 9006, 29898, 9006, 1125, 13, 1678, 9995, 12542, 278, 2989, 2224, 304, 263, 1899, 773, 607, 1213, 15945, 13, 1678, 736, 2897, 29889, 29886, 3150, 877, 4716, 1273, 29879, 29915, 1273, 9920, 467, 949, 2141, 17010, 580, 13, 13, 1753, 679, 29918, 5426, 29918, 2084, 29918, 978, 29898, 2084, 1125, 13, 1678, 9995, 29928, 11770, 694, 29899, 459, 1213, 15945, 13, 1678, 736, 2224, 13, 2 ]
gcn/etc/dbconfig.py
kalon33/divine
11
103502
# # COPYRIGHT (C) 2002-2011 <NAME> # """ .. module:: dbconfig :platform: Unix, Windows, MacOSX :synopsis: Configuration for Database connections .. moduleauthor:: <NAME> (<EMAIL>); modified by <EMAIL> The module defines a dictionary *DBCONFIG* that provides the parameters needed to connect to various databases that are used in the Genome Commons Navigator. The dictionary has as key the name of the resource for which a db connection exist (e.g resources are REFGENE, REFMRNA). The value for each key is also a dictionary with the following keys - db: The database type (sqlite3, postgres, mysql, ...) - name: Name of the database. For sqlite3 this the fully qualified filename of the database - host: The name (or IP Number) of the host on which the database is deployed - port: The port through which the database connection is available - user: The login name for the database - password: The password corresponding to the `user` login. The parameters `host`, `port`, `user` and `password` may all be ignored for sqlite3 and similar databases """ import os from gcn.config import lib_config _LOCALDIR = '/opt/db' def set_localdir(): """Set the local database directory from the enviornmental variable GCN_DB_DIR""" local = lib_config.gcn_path('GCN_DB_DIR') if local is not None: global _LOCALDIR _LOCALDIR = local set_localdir() DBCONFIG = { 'REFMRNA': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'refmrna'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'REFGENE': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'refgene'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'GENEONTOLOGY': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'geneontology'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'MIRNA': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'mirna'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'UTRDB': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'utrdb'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'REGULOME': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'regulomedb'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'KGDB': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'kgdb'), 'tables':[], 'port': None, 'host': None, 'user': None, 'password': None, }, 'DBSNP': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'dbsnp'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'ESP': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'esp'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'EXAC': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'exac'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'HGMDDB': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'hgmd'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'CLINVITAE': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR,'clinvitae'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'COSMIC': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR,'cosmic'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'CLINVARDB': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'clinvardb'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'CLNPHESNP': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'clnphesnpdb'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'OMIM': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'mimdb'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'NSFP': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'nsfpdb'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'SPLICE': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'splicedb'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'GENCODE': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'gencode'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'GENCODEMRNA': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'gencodemrna'), 'port': None, 'host': None, 'user': None, 'password': None, }, 'INTERPRO': {'db': 'sqlite3', 'name': os.path.join(_LOCALDIR, 'interpro'), 'port': None, 'host': None, 'user': None, 'password': None, }, } def configure_db(resource, db, name, port=None, host=None, user=None, password=None): """Configure a database connection. Args: resource (str): Name of the resource (e.g REFMRNA) for which the database information is being configured name (str): Name/Filename of the database host (str): Name of the host on which the database is deployed port (integer): Port through which the database is to be accessed user (str): Login id to connect to the database password (str): Password for the `<PASSWORD>` to <PASSWORD> the database Returns: None. Configures the database connection for the resource. This method is useful when individual users want to use custom resources instead of the system defaults. """ DBCONFIG[resource] = {'db': db, 'name': name, 'port': port, 'host': host, 'user': user, 'password': password}
[ 1, 396, 13, 29937, 315, 4590, 29979, 22789, 3912, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29906, 29899, 29906, 29900, 29896, 29896, 529, 5813, 29958, 13, 29937, 13, 15945, 29908, 13, 636, 3883, 1057, 4833, 2917, 13, 1678, 584, 12120, 29901, 26663, 29892, 3852, 29892, 4326, 3267, 29990, 13, 1678, 584, 19274, 15368, 29901, 20999, 363, 5470, 12368, 13, 13, 636, 3883, 8921, 1057, 529, 5813, 29958, 313, 29966, 26862, 6227, 29958, 416, 9120, 491, 529, 26862, 6227, 29958, 13, 13, 1576, 3883, 17645, 263, 8600, 334, 4051, 25903, 29930, 393, 8128, 278, 4128, 4312, 13, 517, 4511, 304, 5164, 21218, 393, 526, 1304, 297, 278, 5739, 608, 3468, 405, 25521, 29889, 13, 13, 1576, 8600, 756, 408, 1820, 278, 1024, 310, 278, 6503, 363, 607, 263, 4833, 3957, 13, 28997, 313, 29872, 29889, 29887, 7788, 526, 5195, 29943, 24647, 29923, 29892, 5195, 29943, 21055, 3521, 467, 450, 995, 363, 1269, 1820, 338, 884, 13, 29874, 8600, 411, 278, 1494, 6611, 13, 13, 1678, 448, 4833, 29901, 450, 2566, 1134, 313, 22793, 29941, 29892, 1400, 7201, 29892, 5749, 29892, 29757, 13, 13, 1678, 448, 1024, 29901, 4408, 310, 278, 2566, 29889, 1152, 21120, 29941, 445, 278, 8072, 18698, 13, 9651, 10422, 310, 278, 2566, 13, 13, 1678, 448, 3495, 29901, 450, 1024, 313, 272, 5641, 9681, 29897, 310, 278, 3495, 373, 607, 278, 2566, 338, 13, 9651, 21168, 13, 1678, 448, 2011, 29901, 450, 2011, 1549, 607, 278, 2566, 3957, 338, 3625, 13, 13, 1678, 448, 1404, 29901, 450, 6464, 1024, 363, 278, 2566, 13, 13, 1678, 448, 4800, 29901, 450, 4800, 6590, 304, 278, 421, 1792, 29952, 6464, 29889, 13, 13, 1576, 4128, 421, 3069, 1673, 421, 637, 1673, 421, 1792, 29952, 322, 421, 5630, 29952, 1122, 599, 367, 17262, 363, 13, 22793, 29941, 322, 2788, 21218, 13, 15945, 29908, 13, 5215, 2897, 13, 3166, 330, 18038, 29889, 2917, 1053, 4303, 29918, 2917, 13, 13, 29918, 16652, 1964, 9464, 353, 8207, 3670, 29914, 2585, 29915, 13, 13, 13, 1753, 731, 29918, 2997, 3972, 7295, 13, 1678, 9995, 2697, 278, 1887, 2566, 3884, 515, 278, 21061, 1398, 358, 284, 2286, 13, 1678, 402, 13778, 29918, 4051, 29918, 9464, 15945, 29908, 13, 1678, 1887, 353, 4303, 29918, 2917, 29889, 29887, 18038, 29918, 2084, 877, 8766, 29940, 29918, 4051, 29918, 9464, 1495, 13, 1678, 565, 1887, 338, 451, 6213, 29901, 13, 4706, 5534, 903, 16652, 1964, 9464, 13, 4706, 903, 16652, 1964, 9464, 353, 1887, 13, 13, 842, 29918, 2997, 3972, 580, 13, 13, 4051, 25903, 353, 426, 13, 1678, 525, 25866, 21055, 3521, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 18884, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 999, 29885, 29878, 1056, 5477, 13, 18884, 525, 24051, 2396, 29961, 1402, 13, 18884, 525, 637, 2396, 6213, 29892, 13, 18884, 525, 3069, 2396, 6213, 29892, 13, 18884, 525, 1792, 2396, 6213, 29892, 13, 18884, 525, 5630, 2396, 6213, 29892, 13, 18884, 2981, 13, 1678, 525, 25866, 24647, 29923, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 18884, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 999, 29887, 1600, 5477, 13, 18884, 525, 24051, 2396, 29961, 1402, 13, 18884, 525, 637, 2396, 6213, 29892, 13, 18884, 525, 3069, 2396, 6213, 29892, 13, 18884, 525, 1792, 2396, 6213, 29892, 13, 18884, 525, 5630, 2396, 6213, 29892, 13, 18884, 2981, 13, 1678, 525, 24647, 29923, 1164, 4986, 14480, 29979, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 18884, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 29887, 1600, 609, 3002, 5477, 13, 18884, 525, 24051, 2396, 29961, 1402, 13, 18884, 525, 637, 2396, 6213, 29892, 13, 18884, 525, 3069, 2396, 6213, 29892, 13, 18884, 525, 1792, 2396, 6213, 29892, 13, 18884, 525, 5630, 2396, 6213, 29892, 13, 18884, 2981, 13, 1678, 525, 29924, 8193, 3521, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 795, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 11038, 1056, 5477, 13, 795, 525, 24051, 2396, 29961, 1402, 13, 795, 525, 637, 2396, 6213, 29892, 13, 795, 525, 3069, 2396, 6213, 29892, 13, 795, 525, 1792, 2396, 6213, 29892, 13, 795, 525, 5630, 2396, 6213, 29892, 13, 795, 2981, 13, 1678, 525, 2692, 29934, 4051, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 795, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 329, 29878, 2585, 5477, 13, 795, 525, 24051, 2396, 29961, 1402, 13, 795, 525, 637, 2396, 6213, 29892, 13, 795, 525, 3069, 2396, 6213, 29892, 13, 795, 525, 1792, 2396, 6213, 29892, 13, 795, 525, 5630, 2396, 6213, 29892, 13, 795, 2981, 13, 1678, 525, 18166, 29965, 3927, 2303, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 795, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1727, 352, 27067, 29890, 5477, 13, 795, 525, 24051, 2396, 29961, 1402, 13, 795, 525, 637, 2396, 6213, 29892, 13, 795, 525, 3069, 2396, 6213, 29892, 13, 795, 525, 1792, 2396, 6213, 29892, 13, 795, 525, 5630, 2396, 6213, 29892, 13, 795, 2981, 13, 1678, 525, 29968, 29954, 4051, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 9415, 2585, 5477, 13, 632, 525, 24051, 2396, 29961, 1402, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 632, 525, 5630, 2396, 6213, 29892, 13, 632, 2981, 13, 1678, 525, 4051, 19296, 29925, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 2585, 29879, 9302, 5477, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 632, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 2890, 29925, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 9983, 5477, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 632, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 5746, 2477, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 735, 562, 5477, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 632, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 29950, 29954, 5773, 4051, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 29882, 29887, 3487, 5477, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 632, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 6154, 1177, 29963, 1806, 16036, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 795, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 5501, 695, 11569, 2028, 29872, 5477, 13, 795, 525, 637, 2396, 6213, 29892, 13, 795, 525, 3069, 2396, 6213, 29892, 13, 795, 525, 1792, 2396, 6213, 29892, 13, 795, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 3217, 17061, 2965, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 795, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 5501, 3944, 13076, 5477, 13, 795, 525, 637, 2396, 6213, 29892, 13, 795, 525, 3069, 2396, 6213, 29892, 13, 795, 525, 1792, 2396, 6213, 29892, 13, 795, 525, 5630, 2396, 6213, 29892, 13, 308, 2981, 13, 1678, 525, 6154, 1177, 26865, 4051, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 462, 29871, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 695, 11569, 538, 29890, 5477, 13, 462, 29871, 525, 637, 2396, 6213, 29892, 13, 462, 29871, 525, 3069, 2396, 6213, 29892, 13, 462, 29871, 525, 1792, 2396, 6213, 29892, 13, 462, 29871, 525, 5630, 2396, 6213, 29892, 13, 462, 29871, 2981, 13, 1678, 525, 6154, 29940, 19689, 2890, 25500, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 18884, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 695, 29876, 561, 267, 9302, 2585, 5477, 13, 18884, 525, 637, 2396, 6213, 29892, 13, 18884, 525, 3069, 2396, 6213, 29892, 13, 18884, 525, 1792, 2396, 6213, 29892, 13, 18884, 525, 5630, 2396, 6213, 29892, 13, 462, 2981, 13, 1678, 525, 6488, 7833, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 9651, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 29885, 326, 2585, 5477, 13, 9651, 525, 637, 2396, 6213, 29892, 13, 9651, 525, 3069, 2396, 6213, 29892, 13, 9651, 525, 1792, 2396, 6213, 29892, 13, 9651, 525, 5630, 2396, 6213, 29892, 13, 9651, 2981, 13, 1678, 525, 3059, 26353, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 9651, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1983, 18091, 2585, 5477, 13, 9651, 525, 637, 2396, 6213, 29892, 13, 9651, 525, 3069, 2396, 6213, 29892, 13, 9651, 525, 1792, 2396, 6213, 29892, 13, 9651, 525, 5630, 2396, 6213, 29892, 13, 9651, 2981, 13, 1678, 525, 5550, 29931, 12107, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 1669, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1028, 506, 287, 29890, 5477, 13, 1669, 525, 637, 2396, 6213, 29892, 13, 1669, 525, 3069, 2396, 6213, 29892, 13, 1669, 525, 1792, 2396, 6213, 29892, 13, 1669, 525, 5630, 2396, 6213, 29892, 13, 1669, 2981, 13, 1678, 525, 24647, 16524, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 18884, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1885, 401, 5477, 13, 18884, 525, 637, 2396, 6213, 29892, 13, 18884, 525, 3069, 2396, 6213, 29892, 13, 18884, 525, 1792, 2396, 6213, 29892, 13, 18884, 525, 5630, 2396, 6213, 29892, 13, 18884, 2981, 13, 1678, 525, 24647, 16524, 21055, 3521, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 462, 1678, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1885, 401, 29885, 29878, 1056, 5477, 13, 462, 1678, 525, 637, 2396, 6213, 29892, 13, 462, 1678, 525, 3069, 2396, 6213, 29892, 13, 462, 1678, 525, 1792, 2396, 6213, 29892, 13, 462, 1678, 525, 5630, 2396, 6213, 29892, 13, 462, 1678, 2981, 13, 1678, 525, 23845, 8618, 2396, 11117, 2585, 2396, 525, 22793, 29941, 742, 13, 632, 525, 978, 2396, 2897, 29889, 2084, 29889, 7122, 7373, 16652, 1964, 9464, 29892, 525, 1639, 771, 5477, 13, 632, 525, 637, 2396, 6213, 29892, 13, 632, 525, 3069, 2396, 6213, 29892, 13, 632, 525, 1792, 2396, 6213, 29892, 13, 9651, 525, 5630, 2396, 6213, 29892, 13, 9651, 2981, 13, 29913, 13, 13, 13, 1753, 10822, 29918, 2585, 29898, 10314, 29892, 4833, 29892, 1024, 29892, 2011, 29922, 8516, 29892, 3495, 29922, 8516, 29892, 1404, 29922, 8516, 29892, 13, 462, 4800, 29922, 8516, 1125, 13, 1678, 9995, 3991, 545, 263, 2566, 3957, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 6503, 313, 710, 1125, 4408, 310, 278, 6503, 313, 29872, 29889, 29887, 5195, 29943, 21055, 3521, 29897, 363, 607, 278, 13, 462, 4706, 2566, 2472, 338, 1641, 13252, 13, 4706, 1024, 313, 710, 1125, 268, 4408, 29914, 3434, 3871, 310, 278, 2566, 13, 4706, 3495, 313, 710, 1125, 268, 4408, 310, 278, 3495, 373, 607, 278, 2566, 338, 21168, 13, 4706, 2011, 313, 16031, 1125, 3371, 1549, 607, 278, 2566, 338, 304, 367, 20592, 13, 4706, 1404, 313, 710, 1125, 268, 19130, 1178, 304, 4511, 304, 278, 2566, 13, 4706, 4800, 313, 710, 1125, 25280, 363, 278, 14935, 25711, 17013, 13885, 304, 529, 25711, 17013, 29958, 278, 2566, 13, 13, 1678, 16969, 29901, 13, 4706, 6213, 29889, 12782, 1973, 278, 2566, 3957, 363, 278, 6503, 29889, 13, 13, 1678, 910, 1158, 338, 5407, 746, 5375, 4160, 864, 304, 671, 2888, 7788, 13, 1678, 2012, 310, 278, 1788, 21274, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 360, 5371, 1164, 18667, 29961, 10314, 29962, 353, 11117, 2585, 2396, 4833, 29892, 525, 978, 2396, 1024, 29892, 525, 637, 2396, 2011, 29892, 13, 462, 3986, 525, 3069, 2396, 3495, 29892, 525, 1792, 2396, 1404, 29892, 525, 5630, 2396, 4800, 29913, 13, 13, 2 ]
covid19/segmentation/crop_bbox.py
salvacarrion/mltests
0
166493
<filename>covid19/segmentation/crop_bbox.py import glob import json import os from pathlib import Path import cv2 import numpy as np import pandas as pd import tqdm from matplotlib import pyplot as plt def read_img(filename): img = cv2.imread(filename, 0) img = img.astype(np.uint8) return img def show_img(img, cmap="gray", title=""): plt.imshow(img, cmap=cmap) plt.title(title) plt.show() def binarize(img): thr_val, img = cv2.threshold(img, 0, 255, cv2.THRESH_OTSU) return img def get_bounding_boxes(img, threshold_area=1, scaling=1.0): # Find contours ctrs, _ = cv2.findContours(img, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) # Clean areas cleaned_ctrs = [] for ctr in ctrs: area = cv2.contourArea(ctr) if area > threshold_area: cleaned_ctrs.append(ctr) # Bboxes bboxes = [] ctrs = cleaned_ctrs for ctr in ctrs: x, y, w, h = cv2.boundingRect(ctr) values = [v / scaling for v in [x, y, w, h]] bboxes.append(values) # Concat bboxes ctrs = np.concatenate(ctrs) x, y, w, h = cv2.boundingRect(ctrs) concat_bboxes = [[v / scaling for v in [x, y, w, h]]] return bboxes, concat_bboxes def draw_bounding_boxes(img, boxes, scaling=1.0, width=2): # 256=>w=2; 512=>w=5; large=>w=10 new_img = np.array(img) new_img = cv2.cvtColor(new_img, cv2.COLOR_GRAY2RGB) # Draw bounding boxes for box in boxes: top_left = (int(box[0] * scaling), int(box[1] * scaling)) bottom_right = (int(box[0] * scaling + box[2] * scaling), int(box[1] * scaling + box[3] * scaling)) cv2.rectangle(new_img, top_left, bottom_right, (0, 255, 0), width) return new_img def pad_img(img): max_side = max(*img.shape) img_padded = np.zeros((max_side, max_side), np.uint8) ax, ay = (max_side - img.shape[1]) // 2, (max_side - img.shape[0]) // 2 img_padded[ay:img.shape[0] + ay, ax:ax + img.shape[1]] = img return img_padded def expand_bboxes(bboxes, margin_factor): new_bboxes = [] for (x, y, w, h) in bboxes: x, y = x * (1.0 - margin_factor), y * (1.0 - margin_factor) w, h = w * (1.0 + margin_factor), h * (1.0 + margin_factor) new_bboxes.append([x, y, w, h]) return new_bboxes def get_all_masks_files(masks_dir, pred_masks_dir): masks_files = [file for file in glob.glob(os.path.join(masks_dir, "*.png"))] pred_masks_files = [file for file in glob.glob(os.path.join(pred_masks_dir, "*.png"))] return masks_files, pred_masks_files def main(base_path=".", target_size=512, margin_factor=0.05): # path = os.path.join(base_path, "masks256_pred", "sub-S10880_ses-E18932_run-1.png") # Testing # Create output not exists images_output_path = os.path.join(base_path, f"images{target_size}_crop") Path(images_output_path).mkdir(parents=True, exist_ok=True) # Get files raw_images_dir = os.path.join(base_path, "images_raw") df = pd.read_csv(os.path.join(base_path, "bboxes.csv")) # Process masks for i, row in tqdm.tqdm(df.iterrows(), total=len(df)): bboxes, interest_region = json.loads(row["bboxes"]), json.loads(row["interest_region"]) file = row["filepath"] fname = os.path.split(file)[1] # Read image img = read_img(os.path.join(raw_images_dir, file)) # show_img(img) # Pad image max_side = max(*img.shape) img = pad_img(img) # show_img(img) # Expand bboxes bboxes = expand_bboxes(bboxes, margin_factor=margin_factor) interest_region = expand_bboxes(interest_region, margin_factor=margin_factor) # # Draw bboxes # img_bboxes = draw_bounding_boxes(img, bboxes, scaling=max_side) # show_img(img_bboxes) # Crop x, y, w, h = [int(v * max_side) for v in interest_region[0]] img = img[y:y + h, x:x + w] # show_img(img) # Pad image (again) img = pad_img(img) # show_img(img) # Resize img = cv2.resize(img, (target_size, target_size), interpolation=cv2.INTER_LANCZOS4) # show_img(img) # Save image cv2.imwrite(os.path.join(images_output_path, fname), img) asdasd = 3 print("Done!") if __name__ == "__main__": BASE_PATH = "/home/scarrion/datasets/covid19/front" # Run script main(base_path=BASE_PATH)
[ 1, 529, 9507, 29958, 24542, 333, 29896, 29929, 29914, 28192, 362, 29914, 29883, 1336, 29918, 29890, 1884, 29889, 2272, 13, 5215, 13149, 13, 5215, 4390, 13, 5215, 2897, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 5215, 13850, 29906, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 260, 29939, 18933, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 13, 13, 1753, 1303, 29918, 2492, 29898, 9507, 1125, 13, 1678, 10153, 353, 13850, 29906, 29889, 326, 949, 29898, 9507, 29892, 29871, 29900, 29897, 13, 1678, 10153, 353, 10153, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 1678, 736, 10153, 13, 13, 13, 1753, 1510, 29918, 2492, 29898, 2492, 29892, 274, 1958, 543, 21012, 613, 3611, 13776, 1125, 13, 1678, 14770, 29889, 326, 4294, 29898, 2492, 29892, 274, 1958, 29922, 29883, 1958, 29897, 13, 1678, 14770, 29889, 3257, 29898, 3257, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 9016, 279, 675, 29898, 2492, 1125, 13, 1678, 1468, 29918, 791, 29892, 10153, 353, 13850, 29906, 29889, 386, 12268, 29898, 2492, 29892, 29871, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 13850, 29906, 29889, 4690, 1525, 7068, 29918, 2891, 14605, 29897, 13, 1678, 736, 10153, 13, 13, 13, 1753, 679, 29918, 9917, 292, 29918, 1884, 267, 29898, 2492, 29892, 16897, 29918, 6203, 29922, 29896, 29892, 21640, 29922, 29896, 29889, 29900, 1125, 13, 1678, 396, 10987, 640, 2470, 13, 1678, 274, 509, 29879, 29892, 903, 353, 13850, 29906, 29889, 2886, 1323, 2470, 29898, 2492, 29892, 13850, 29906, 29889, 1525, 5659, 29918, 5746, 4945, 29940, 1964, 29892, 13850, 29906, 29889, 3210, 29909, 1177, 29918, 3301, 8618, 29990, 29918, 5425, 3580, 1307, 29897, 13, 13, 1678, 396, 315, 14044, 10161, 13, 1678, 5941, 287, 29918, 312, 2288, 353, 5159, 13, 1678, 363, 274, 509, 297, 274, 509, 29879, 29901, 13, 4706, 4038, 353, 13850, 29906, 29889, 1285, 473, 13799, 29898, 9988, 29897, 13, 4706, 565, 4038, 1405, 16897, 29918, 6203, 29901, 13, 9651, 5941, 287, 29918, 312, 2288, 29889, 4397, 29898, 9988, 29897, 13, 13, 1678, 396, 350, 1884, 267, 13, 1678, 289, 1884, 267, 353, 5159, 13, 1678, 274, 509, 29879, 353, 5941, 287, 29918, 312, 2288, 13, 1678, 363, 274, 509, 297, 274, 509, 29879, 29901, 13, 4706, 921, 29892, 343, 29892, 281, 29892, 298, 353, 13850, 29906, 29889, 9917, 292, 7364, 29898, 9988, 29897, 13, 4706, 1819, 353, 518, 29894, 847, 21640, 363, 325, 297, 518, 29916, 29892, 343, 29892, 281, 29892, 298, 5262, 13, 4706, 289, 1884, 267, 29889, 4397, 29898, 5975, 29897, 13, 13, 1678, 396, 1281, 4117, 289, 1884, 267, 13, 1678, 274, 509, 29879, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 312, 2288, 29897, 13, 1678, 921, 29892, 343, 29892, 281, 29892, 298, 353, 13850, 29906, 29889, 9917, 292, 7364, 29898, 312, 2288, 29897, 13, 1678, 3022, 271, 29918, 29890, 1884, 267, 353, 5519, 29894, 847, 21640, 363, 325, 297, 518, 29916, 29892, 343, 29892, 281, 29892, 298, 5262, 29962, 13, 13, 1678, 736, 289, 1884, 267, 29892, 3022, 271, 29918, 29890, 1884, 267, 13, 13, 13, 1753, 4216, 29918, 9917, 292, 29918, 1884, 267, 29898, 2492, 29892, 16273, 29892, 21640, 29922, 29896, 29889, 29900, 29892, 2920, 29922, 29906, 1125, 29871, 396, 29871, 29906, 29945, 29953, 4261, 29893, 29922, 29906, 29936, 29871, 29945, 29896, 29906, 4261, 29893, 29922, 29945, 29936, 2919, 4261, 29893, 29922, 29896, 29900, 13, 1678, 716, 29918, 2492, 353, 7442, 29889, 2378, 29898, 2492, 29897, 13, 1678, 716, 29918, 2492, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 1482, 29918, 2492, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29954, 22800, 29906, 28212, 29897, 13, 13, 1678, 396, 18492, 3216, 292, 16273, 13, 1678, 363, 3800, 297, 16273, 29901, 13, 4706, 2246, 29918, 1563, 353, 313, 524, 29898, 1884, 29961, 29900, 29962, 334, 21640, 511, 938, 29898, 1884, 29961, 29896, 29962, 334, 21640, 876, 13, 4706, 5970, 29918, 1266, 353, 313, 524, 29898, 1884, 29961, 29900, 29962, 334, 21640, 718, 3800, 29961, 29906, 29962, 334, 21640, 511, 938, 29898, 1884, 29961, 29896, 29962, 334, 21640, 718, 3800, 29961, 29941, 29962, 334, 21640, 876, 13, 4706, 13850, 29906, 29889, 1621, 2521, 29898, 1482, 29918, 2492, 29892, 2246, 29918, 1563, 29892, 5970, 29918, 1266, 29892, 313, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29900, 511, 2920, 29897, 13, 13, 1678, 736, 716, 29918, 2492, 13, 13, 13, 1753, 17132, 29918, 2492, 29898, 2492, 1125, 13, 1678, 4236, 29918, 2975, 353, 4236, 10456, 2492, 29889, 12181, 29897, 13, 1678, 10153, 29918, 29886, 23959, 353, 7442, 29889, 3298, 359, 3552, 3317, 29918, 2975, 29892, 4236, 29918, 2975, 511, 7442, 29889, 13470, 29947, 29897, 13, 1678, 4853, 29892, 10156, 353, 313, 3317, 29918, 2975, 448, 10153, 29889, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 313, 3317, 29918, 2975, 448, 10153, 29889, 12181, 29961, 29900, 2314, 849, 29871, 29906, 13, 1678, 10153, 29918, 29886, 23959, 29961, 388, 29901, 2492, 29889, 12181, 29961, 29900, 29962, 718, 10156, 29892, 4853, 29901, 1165, 718, 10153, 29889, 12181, 29961, 29896, 5262, 353, 10153, 13, 1678, 736, 10153, 29918, 29886, 23959, 13, 13, 13, 1753, 7985, 29918, 29890, 1884, 267, 29898, 29890, 1884, 267, 29892, 5906, 29918, 19790, 1125, 13, 1678, 716, 29918, 29890, 1884, 267, 353, 5159, 13, 1678, 363, 313, 29916, 29892, 343, 29892, 281, 29892, 298, 29897, 297, 289, 1884, 267, 29901, 13, 4706, 921, 29892, 343, 353, 921, 334, 313, 29896, 29889, 29900, 448, 5906, 29918, 19790, 511, 343, 334, 313, 29896, 29889, 29900, 448, 5906, 29918, 19790, 29897, 13, 4706, 281, 29892, 298, 353, 281, 334, 313, 29896, 29889, 29900, 718, 5906, 29918, 19790, 511, 298, 334, 313, 29896, 29889, 29900, 718, 5906, 29918, 19790, 29897, 13, 4706, 716, 29918, 29890, 1884, 267, 29889, 4397, 4197, 29916, 29892, 343, 29892, 281, 29892, 298, 2314, 13, 1678, 736, 716, 29918, 29890, 1884, 267, 13, 13, 13, 1753, 679, 29918, 497, 29918, 13168, 29879, 29918, 5325, 29898, 13168, 29879, 29918, 3972, 29892, 4450, 29918, 13168, 29879, 29918, 3972, 1125, 13, 1678, 11105, 29879, 29918, 5325, 353, 518, 1445, 363, 934, 297, 13, 462, 259, 13149, 29889, 23705, 29898, 359, 29889, 2084, 29889, 7122, 29898, 13168, 29879, 29918, 3972, 29892, 376, 10521, 2732, 5783, 29962, 13, 1678, 4450, 29918, 13168, 29879, 29918, 5325, 353, 518, 1445, 363, 934, 297, 13, 462, 4706, 13149, 29889, 23705, 29898, 359, 29889, 2084, 29889, 7122, 29898, 11965, 29918, 13168, 29879, 29918, 3972, 29892, 376, 10521, 2732, 5783, 29962, 13, 1678, 736, 11105, 29879, 29918, 5325, 29892, 4450, 29918, 13168, 29879, 29918, 5325, 13, 13, 13, 1753, 1667, 29898, 3188, 29918, 2084, 543, 19602, 3646, 29918, 2311, 29922, 29945, 29896, 29906, 29892, 5906, 29918, 19790, 29922, 29900, 29889, 29900, 29945, 1125, 13, 1678, 396, 2224, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 2084, 29892, 376, 13168, 29879, 29906, 29945, 29953, 29918, 11965, 613, 376, 1491, 29899, 29903, 29896, 29900, 29947, 29947, 29900, 29918, 29879, 267, 29899, 29923, 29896, 29947, 29929, 29941, 29906, 29918, 3389, 29899, 29896, 29889, 2732, 1159, 29871, 396, 4321, 292, 13, 13, 1678, 396, 6204, 1962, 451, 4864, 13, 1678, 4558, 29918, 4905, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 2084, 29892, 285, 29908, 8346, 29912, 5182, 29918, 2311, 2403, 29883, 1336, 1159, 13, 1678, 10802, 29898, 8346, 29918, 4905, 29918, 2084, 467, 11256, 3972, 29898, 862, 1237, 29922, 5574, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 13, 1678, 396, 3617, 2066, 13, 1678, 10650, 29918, 8346, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 2084, 29892, 376, 8346, 29918, 1610, 1159, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 2084, 29892, 376, 29890, 1884, 267, 29889, 7638, 5783, 13, 13, 1678, 396, 10554, 11105, 29879, 13, 1678, 363, 474, 29892, 1948, 297, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 2176, 29889, 1524, 5727, 3285, 3001, 29922, 2435, 29898, 2176, 22164, 13, 4706, 289, 1884, 267, 29892, 4066, 29918, 12803, 353, 4390, 29889, 18132, 29898, 798, 3366, 29890, 1884, 267, 3108, 511, 4390, 29889, 18132, 29898, 798, 3366, 1639, 342, 29918, 12803, 20068, 13, 4706, 934, 353, 1948, 3366, 1445, 2084, 3108, 13, 4706, 285, 978, 353, 2897, 29889, 2084, 29889, 5451, 29898, 1445, 9601, 29896, 29962, 13, 13, 4706, 396, 7523, 1967, 13, 4706, 10153, 353, 1303, 29918, 2492, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1610, 29918, 8346, 29918, 3972, 29892, 934, 876, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29897, 13, 13, 4706, 396, 18011, 1967, 13, 4706, 4236, 29918, 2975, 353, 4236, 10456, 2492, 29889, 12181, 29897, 13, 4706, 10153, 353, 17132, 29918, 2492, 29898, 2492, 29897, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29897, 13, 13, 4706, 396, 12027, 392, 289, 1884, 267, 13, 4706, 289, 1884, 267, 353, 7985, 29918, 29890, 1884, 267, 29898, 29890, 1884, 267, 29892, 5906, 29918, 19790, 29922, 9264, 29918, 19790, 29897, 13, 4706, 4066, 29918, 12803, 353, 7985, 29918, 29890, 1884, 267, 29898, 1639, 342, 29918, 12803, 29892, 5906, 29918, 19790, 29922, 9264, 29918, 19790, 29897, 13, 13, 4706, 396, 396, 18492, 289, 1884, 267, 13, 4706, 396, 10153, 29918, 29890, 1884, 267, 353, 4216, 29918, 9917, 292, 29918, 1884, 267, 29898, 2492, 29892, 289, 1884, 267, 29892, 21640, 29922, 3317, 29918, 2975, 29897, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29918, 29890, 1884, 267, 29897, 13, 13, 4706, 396, 315, 1336, 13, 4706, 921, 29892, 343, 29892, 281, 29892, 298, 353, 518, 524, 29898, 29894, 334, 4236, 29918, 2975, 29897, 363, 325, 297, 4066, 29918, 12803, 29961, 29900, 5262, 13, 4706, 10153, 353, 10153, 29961, 29891, 29901, 29891, 718, 298, 29892, 921, 29901, 29916, 718, 281, 29962, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29897, 13, 13, 4706, 396, 18011, 1967, 313, 351, 475, 29897, 13, 4706, 10153, 353, 17132, 29918, 2492, 29898, 2492, 29897, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29897, 13, 13, 4706, 396, 2538, 675, 13, 4706, 10153, 353, 13850, 29906, 29889, 21476, 29898, 2492, 29892, 313, 5182, 29918, 2311, 29892, 3646, 29918, 2311, 511, 29694, 29922, 11023, 29906, 29889, 23845, 29918, 29931, 2190, 29907, 29999, 3267, 29946, 29897, 13, 4706, 396, 1510, 29918, 2492, 29898, 2492, 29897, 13, 13, 4706, 396, 16913, 1967, 13, 4706, 13850, 29906, 29889, 326, 3539, 29898, 359, 29889, 2084, 29889, 7122, 29898, 8346, 29918, 4905, 29918, 2084, 29892, 285, 978, 511, 10153, 29897, 13, 4706, 408, 17370, 29881, 353, 29871, 29941, 13, 13, 1678, 1596, 703, 25632, 29991, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 350, 8127, 29918, 10145, 353, 5591, 5184, 29914, 1557, 2749, 291, 29914, 14538, 1691, 29914, 24542, 333, 29896, 29929, 29914, 8862, 29908, 13, 13, 1678, 396, 7525, 2471, 13, 1678, 1667, 29898, 3188, 29918, 2084, 29922, 25416, 29918, 10145, 29897, 13, 2 ]
migrations/versions/1d7903bb7029_.py
fitoskalante/wetribe-backend
0
189272
"""empty message Revision ID: 1d7903bb<PASSWORD>9 Revises: Create Date: 2019-12-16 11:35:50.692153 """ from alembic import op import sqlalchemy as sa, sqlalchemy_utils # revision identifiers, used by Alembic. revision = '<PASSWORD>' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('categories', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=False), sa.PrimaryKeyConstraint('id') ) op.create_table('interests', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('users', sa.Column('id', sa.Integer(), nullable=False), sa.Column('name', sa.String(), nullable=False), sa.Column('last_name', sa.String(), nullable=True), sa.Column('description', sa.Text(), nullable=True), sa.Column('email', sa.String(), nullable=True), sa.Column('city', sa.String(), nullable=True), sa.Column('country', sa.String(), nullable=True), sa.Column('password', sa.String(), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_table('events', sa.Column('id', sa.Integer(), nullable=False), sa.Column('creator_id', sa.Integer(), nullable=True), sa.Column('title', sa.String(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('image_url', sa.String(), nullable=True), sa.Column('address', sa.String(), nullable=True), sa.Column('city', sa.String(), nullable=True), sa.Column('country', sa.String(), nullable=True), sa.Column('time', sa.DateTime(), nullable=True), sa.Column('date', sa.DateTime(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('lat', sa.Float(), nullable=True), sa.Column('lng', sa.Float(), nullable=True), sa.ForeignKeyConstraint(['creator_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('flask_dance_oauth', sa.Column('id', sa.Integer(), nullable=False), sa.Column('provider', sa.String(length=50), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=False), sa.Column('token', sqlalchemy_utils.types.json.JSONType(), nullable=False), sa.Column('provider_user_id', sa.String(length=256), nullable=False), sa.Column('user_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('provider_user_id') ) op.create_table('token', sa.Column('id', sa.Integer(), nullable=False), sa.Column('uuid', sa.String(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id'), sa.UniqueConstraint('uuid') ) op.create_table('userinterests', sa.Column('id', sa.Integer(), nullable=False), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('interest_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['interest_id'], ['interests.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('attendances', sa.Column('id', sa.Integer(), nullable=False), sa.Column('event_id', sa.Integer(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('comments', sa.Column('id', sa.Integer(), nullable=False), sa.Column('body', sa.Text(), nullable=False), sa.Column('event_id', sa.Integer(), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), server_default=sa.text('now()'), nullable=True), sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), sa.ForeignKeyConstraint(['user_id'], ['users.id'], ), sa.PrimaryKeyConstraint('id') ) op.create_table('eventcategories', sa.Column('id', sa.Integer(), nullable=False), sa.Column('event_id', sa.Integer(), nullable=True), sa.Column('category_id', sa.Integer(), nullable=True), sa.ForeignKeyConstraint(['category_id'], ['categories.id'], ), sa.ForeignKeyConstraint(['event_id'], ['events.id'], ), sa.PrimaryKeyConstraint('id') ) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_table('eventcategories') op.drop_table('comments') op.drop_table('attendances') op.drop_table('userinterests') op.drop_table('token') op.drop_table('flask_dance_oauth') op.drop_table('events') op.drop_table('users') op.drop_table('interests') op.drop_table('categories') # ### end Alembic commands ###
[ 1, 9995, 6310, 2643, 13, 13, 1123, 4924, 3553, 29901, 29871, 29896, 29881, 29955, 29929, 29900, 29941, 1327, 29966, 25711, 17013, 29958, 29929, 13, 1123, 1730, 267, 29901, 29871, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29906, 29899, 29896, 29953, 29871, 29896, 29896, 29901, 29941, 29945, 29901, 29945, 29900, 29889, 29953, 29929, 29906, 29896, 29945, 29941, 13, 13, 15945, 29908, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 29892, 4576, 284, 305, 6764, 29918, 13239, 13, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 12801, 25711, 17013, 16299, 13, 3204, 29918, 276, 4924, 353, 6213, 13, 17519, 29918, 21134, 353, 6213, 13, 2716, 1975, 29918, 265, 353, 6213, 13, 13, 13, 1753, 14955, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 20683, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 1639, 9197, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 7193, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 978, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 4230, 29918, 978, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 5269, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12690, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 13509, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 5630, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 13604, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 1037, 1061, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 3257, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 3027, 29918, 2271, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 7328, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12690, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 13509, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 2230, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1256, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 11600, 29918, 271, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 5066, 742, 872, 29889, 11031, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 29880, 865, 742, 872, 29889, 11031, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1037, 1061, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 1579, 1278, 29918, 29881, 749, 29918, 23106, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 18121, 742, 872, 29889, 1231, 29898, 2848, 29922, 29945, 29900, 511, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 11600, 29918, 271, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 6979, 742, 4576, 284, 305, 6764, 29918, 13239, 29889, 8768, 29889, 3126, 29889, 7249, 1542, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 18121, 29918, 1792, 29918, 333, 742, 872, 29889, 1231, 29898, 2848, 29922, 29906, 29945, 29953, 511, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 5477, 13, 1678, 872, 29889, 8110, 802, 21529, 877, 18121, 29918, 1792, 29918, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 6979, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 25118, 742, 872, 29889, 1231, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 5477, 13, 1678, 872, 29889, 8110, 802, 21529, 877, 25118, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 1792, 1639, 9197, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1639, 342, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1639, 342, 29918, 333, 7464, 6024, 1639, 9197, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 27601, 2925, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 3696, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 3696, 29918, 333, 7464, 6024, 13604, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 21032, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 2587, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 3696, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 11600, 29918, 271, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 21402, 29918, 271, 742, 872, 29889, 11384, 3285, 1923, 29918, 4381, 29922, 4977, 29889, 726, 877, 3707, 580, 5477, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 3696, 29918, 333, 7464, 6024, 13604, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 7193, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 3696, 20683, 742, 13, 1678, 872, 29889, 4409, 877, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 3696, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 7320, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 7320, 29918, 333, 7464, 6024, 20683, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 3696, 29918, 333, 7464, 6024, 13604, 29889, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 333, 1495, 13, 1678, 1723, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 1623, 8228, 7295, 13, 1678, 396, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 3696, 20683, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 21032, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 27601, 2925, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 1792, 1639, 9197, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 6979, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 1579, 1278, 29918, 29881, 749, 29918, 23106, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 13604, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 7193, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 1639, 9197, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 20683, 1495, 13, 1678, 396, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 2 ]
python全栈/day05/乘法表.py
Ringo-li/python_exercise_100
0
77801
i = 1 while i <= 9: j = 1 while j <= i: print("{}x{}={}\t".format(j, i, i * j), end='') j += 1 print() i += 1
[ 1, 474, 353, 29871, 29896, 13, 8000, 474, 5277, 29871, 29929, 29901, 29871, 13, 1678, 432, 353, 29871, 29896, 13, 1678, 1550, 432, 5277, 474, 29901, 308, 13, 4706, 1596, 703, 8875, 29916, 8875, 3790, 1012, 29873, 1642, 4830, 29898, 29926, 29892, 474, 29892, 474, 334, 432, 511, 29871, 1095, 2433, 1495, 13, 4706, 432, 4619, 29871, 29896, 13, 1678, 1596, 580, 13, 1678, 474, 4619, 29871, 29896, 2 ]
source/Bornholdt.py
StxGuy/Econophysics
13
171921
# -*- coding: utf-8 -*- #!/usr/bin/env python __author__ = """Prof. <NAME>, Ph.D. <<EMAIL>>""" import os os.system('clear') print('.-------------------------------.') print('| |#') print('| By.: Prof. <NAME> |#') print('| |#') print('| 2021 |#') print('\'-------------------------------\'#') print(' ################################') print('') print('Importing Libraries:') import numpy as np import random as rd import matplotlib.pyplot as pl from math import isnan def neig(i,j,N): z = [] if (i > 0): z.append([i-1,j]) if (i < N-1): z.append([i+1,j]) if (j > 0): z.append([i,j-1]) if (j < N-1): z.append([i,j+1]) return np.array(z) N = 32 J = 1.0 beta = 1.0/1.5 alpha = 4.0 S = np.array([rd.choices([1,-1],k=N) for i in range(N)]) C = np.array([rd.choices([1,-1],k=N) for i in range(N)]) Sn = np.zeros((N,N)) Cn = np.zeros((N,N)) r = [] cauda = [] M = 1 Steps = 100 for it in range(Steps): Ml = M M = np.average(S) for i in range(N): for j in range(N): sm = 0 for x in neig(i,j,N): sm = sm + S[x[0],x[1]] h = J*sm - alpha*C[i,j]*M p = 1.0/(1+np.exp(-2*beta*h)) if (rd.random() < p): Sn[i,j] = 1 else: Sn[i,j] = -1 if (alpha*S[i,j]*C[i,j]*sm < 0): Cn[i,j] = -C[i,j] else: Cn[i,j] = C[i,j] S = Sn C = Cn rt = np.log10(abs(M))-np.log10(abs(Ml)) if (abs(rt) < 100): r = np.append(r,rt) if (rt > 0): cauda.append(rt) mi = min(r) ma = max(r) #pl.figure(1) #pl.plot(r) #pl.axis([0,Steps,-0.1,0.1]) #pl.savefig('../chapters/Chapter_8/figs/src/Bornts.svg') x = np.linspace(mi,ma,100) y = [] for ex in x: y.append(1.0-float(sum(cauda<ex))/len(cauda)) #pl.figure(2) #pl.loglog(x,y,'.') #pl.savefig('../chapters/Chapter_8/figs/src/Bornts.svg') #pl.show() pl.imshow(S,cmap='gray') pl.show() #pl.savefig('../chapters/Chapter_8/figs/src/Born1.svg') #pl.plot(r) #pl.axis([0,200,-0.04,0.04]) #pl.savefig('../chapters/Chapter_8/figs/src/Bornts.svg') #pl.hist(r) #pl.savefig('../chapters/Chapter_8/figs/src/Bornh.svg') #pl.show()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 1649, 8921, 1649, 353, 9995, 1184, 29888, 29889, 529, 5813, 10202, 1963, 29889, 29928, 29889, 3532, 26862, 6227, 6778, 15945, 29908, 13, 13, 5215, 2897, 13, 13, 359, 29889, 5205, 877, 8551, 1495, 13, 2158, 12839, 2683, 9072, 5634, 29889, 1495, 13, 2158, 877, 29989, 462, 1669, 891, 29937, 1495, 13, 2158, 877, 29989, 2648, 4898, 6175, 29889, 529, 5813, 29958, 29871, 891, 29937, 1495, 13, 2158, 877, 29989, 462, 1669, 891, 29937, 1495, 13, 2158, 877, 29989, 462, 3986, 29906, 29900, 29906, 29896, 29871, 891, 29937, 1495, 13, 2158, 877, 20333, 2683, 9072, 489, 2612, 29915, 29937, 1495, 13, 2158, 877, 29871, 835, 13383, 7346, 4136, 29937, 1495, 13, 2158, 877, 1495, 13, 2158, 877, 17518, 292, 365, 4626, 4314, 29901, 1495, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4036, 408, 364, 29881, 13, 5215, 22889, 29889, 2272, 5317, 408, 715, 13, 3166, 5844, 1053, 3508, 273, 13, 13, 1753, 452, 335, 29898, 29875, 29892, 29926, 29892, 29940, 1125, 13, 1678, 503, 353, 5159, 13, 1678, 565, 313, 29875, 1405, 29871, 29900, 1125, 13, 4706, 503, 29889, 4397, 4197, 29875, 29899, 29896, 29892, 29926, 2314, 13, 1678, 565, 313, 29875, 529, 405, 29899, 29896, 1125, 13, 4706, 503, 29889, 4397, 4197, 29875, 29974, 29896, 29892, 29926, 2314, 13, 1678, 565, 313, 29926, 1405, 29871, 29900, 1125, 13, 4706, 503, 29889, 4397, 4197, 29875, 29892, 29926, 29899, 29896, 2314, 13, 1678, 565, 313, 29926, 529, 405, 29899, 29896, 1125, 13, 4706, 503, 29889, 4397, 4197, 29875, 29892, 29926, 29974, 29896, 2314, 13, 308, 13, 1678, 736, 7442, 29889, 2378, 29898, 29920, 29897, 13, 13, 268, 13, 13, 29940, 353, 29871, 29941, 29906, 13, 29967, 353, 29871, 29896, 29889, 29900, 13, 3571, 353, 29871, 29896, 29889, 29900, 29914, 29896, 29889, 29945, 13, 2312, 353, 29871, 29946, 29889, 29900, 13, 13, 29903, 353, 7442, 29889, 2378, 4197, 5499, 29889, 1859, 1575, 4197, 29896, 6653, 29896, 1402, 29895, 29922, 29940, 29897, 363, 474, 297, 3464, 29898, 29940, 29897, 2314, 13, 29907, 353, 7442, 29889, 2378, 4197, 5499, 29889, 1859, 1575, 4197, 29896, 6653, 29896, 1402, 29895, 29922, 29940, 29897, 363, 474, 297, 3464, 29898, 29940, 29897, 2314, 13, 29903, 29876, 353, 7442, 29889, 3298, 359, 3552, 29940, 29892, 29940, 876, 13, 29907, 29876, 353, 7442, 29889, 3298, 359, 3552, 29940, 29892, 29940, 876, 13, 13, 29878, 353, 5159, 13, 1113, 6191, 353, 5159, 13, 29924, 353, 29871, 29896, 13, 7789, 567, 353, 29871, 29896, 29900, 29900, 13, 1454, 372, 297, 3464, 29898, 7789, 567, 1125, 13, 1678, 341, 29880, 353, 341, 13, 1678, 341, 353, 7442, 29889, 12483, 482, 29898, 29903, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29940, 1125, 13, 4706, 363, 432, 297, 3464, 29898, 29940, 1125, 13, 9651, 1560, 353, 29871, 29900, 13, 9651, 363, 921, 297, 452, 335, 29898, 29875, 29892, 29926, 29892, 29940, 1125, 13, 18884, 1560, 353, 1560, 718, 317, 29961, 29916, 29961, 29900, 1402, 29916, 29961, 29896, 5262, 13, 462, 13, 9651, 298, 353, 435, 29930, 3844, 448, 15595, 29930, 29907, 29961, 29875, 29892, 29926, 14178, 29924, 13, 9651, 282, 353, 29871, 29896, 29889, 29900, 14571, 29896, 29974, 9302, 29889, 4548, 6278, 29906, 29930, 3571, 29930, 29882, 876, 13, 632, 13, 9651, 565, 313, 5499, 29889, 8172, 580, 529, 282, 1125, 13, 18884, 22639, 29961, 29875, 29892, 29926, 29962, 353, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 22639, 29961, 29875, 29892, 29926, 29962, 353, 448, 29896, 13, 462, 13, 9651, 565, 313, 2312, 29930, 29903, 29961, 29875, 29892, 29926, 14178, 29907, 29961, 29875, 29892, 29926, 14178, 3844, 529, 29871, 29900, 1125, 13, 18884, 315, 29876, 29961, 29875, 29892, 29926, 29962, 353, 448, 29907, 29961, 29875, 29892, 29926, 29962, 13, 9651, 1683, 29901, 13, 18884, 315, 29876, 29961, 29875, 29892, 29926, 29962, 353, 315, 29961, 29875, 29892, 29926, 29962, 13, 13, 1678, 317, 353, 22639, 13, 1678, 315, 353, 315, 29876, 13, 1678, 364, 29873, 353, 7442, 29889, 1188, 29896, 29900, 29898, 6897, 29898, 29924, 876, 29899, 9302, 29889, 1188, 29896, 29900, 29898, 6897, 29898, 29924, 29880, 876, 13, 1678, 565, 313, 6897, 29898, 2273, 29897, 529, 29871, 29896, 29900, 29900, 1125, 13, 4706, 364, 353, 7442, 29889, 4397, 29898, 29878, 29892, 2273, 29897, 13, 4706, 565, 313, 2273, 1405, 29871, 29900, 1125, 13, 9651, 5777, 6191, 29889, 4397, 29898, 2273, 29897, 13, 13, 2460, 353, 1375, 29898, 29878, 29897, 13, 655, 353, 4236, 29898, 29878, 29897, 13, 29937, 572, 29889, 4532, 29898, 29896, 29897, 13, 29937, 572, 29889, 5317, 29898, 29878, 29897, 13, 29937, 572, 29889, 8990, 4197, 29900, 29892, 7789, 567, 6653, 29900, 29889, 29896, 29892, 29900, 29889, 29896, 2314, 13, 29937, 572, 29889, 7620, 1003, 877, 6995, 305, 481, 2153, 29914, 1451, 3314, 29918, 29947, 29914, 1003, 29879, 29914, 4351, 29914, 29933, 272, 593, 29879, 29889, 15120, 1495, 13, 13, 13, 29916, 353, 7442, 29889, 1915, 3493, 29898, 2460, 29892, 655, 29892, 29896, 29900, 29900, 29897, 13, 29891, 353, 5159, 13, 1454, 429, 297, 921, 29901, 13, 1678, 343, 29889, 4397, 29898, 29896, 29889, 29900, 29899, 7411, 29898, 2083, 29898, 1113, 6191, 29966, 735, 876, 29914, 2435, 29898, 1113, 6191, 876, 13, 13, 29937, 572, 29889, 4532, 29898, 29906, 29897, 268, 13, 29937, 572, 29889, 1188, 1188, 29898, 29916, 29892, 29891, 29892, 4286, 1495, 13, 29937, 572, 29889, 7620, 1003, 877, 6995, 305, 481, 2153, 29914, 1451, 3314, 29918, 29947, 29914, 1003, 29879, 29914, 4351, 29914, 29933, 272, 593, 29879, 29889, 15120, 1495, 13, 29937, 572, 29889, 4294, 580, 13, 13, 13, 572, 29889, 326, 4294, 29898, 29903, 29892, 29883, 1958, 2433, 21012, 1495, 13, 572, 29889, 4294, 580, 13, 29937, 572, 29889, 7620, 1003, 877, 6995, 305, 481, 2153, 29914, 1451, 3314, 29918, 29947, 29914, 1003, 29879, 29914, 4351, 29914, 29933, 1398, 29896, 29889, 15120, 1495, 13, 13, 29937, 572, 29889, 5317, 29898, 29878, 29897, 13, 29937, 572, 29889, 8990, 4197, 29900, 29892, 29906, 29900, 29900, 6653, 29900, 29889, 29900, 29946, 29892, 29900, 29889, 29900, 29946, 2314, 13, 29937, 572, 29889, 7620, 1003, 877, 6995, 305, 481, 2153, 29914, 1451, 3314, 29918, 29947, 29914, 1003, 29879, 29914, 4351, 29914, 29933, 272, 593, 29879, 29889, 15120, 1495, 13, 13, 13, 29937, 572, 29889, 29882, 391, 29898, 29878, 29897, 13, 29937, 572, 29889, 7620, 1003, 877, 6995, 305, 481, 2153, 29914, 1451, 3314, 29918, 29947, 29914, 1003, 29879, 29914, 4351, 29914, 29933, 1398, 29882, 29889, 15120, 1495, 13, 13, 13, 29937, 572, 29889, 4294, 580, 13, 2 ]
venv/Lib/site-packages/psychopy/demos/coder/stimuli/colorPalette.py
mintzer/pupillometry-rf-back
0
107570
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division from psychopy import locale_setup, visual, core import numpy as np from psychopy.hardware import keyboard from psychopy import misc def createPalette(size): """ Creates the color palette array in HSV and returns as RGB """ # Create array hsv = np.ones([size,size,3], dtype=float) # Set hue hsv[:,:,0] = np.linspace(0,360, size, endpoint=False) # Set saturation for i in range(size): hsv[:,i, 1] = np.linspace(0, 1, size, endpoint=False) # Convert to RGB rgb = misc.hsv2rgb(hsv) # Make in range 0:1 for image stim rgb[:][:][:] = (rgb[:][:][:] + 1) / 2 return rgb def createValue(size): """ Creates the value palette array in HSV and returns as RGB """ # Create array hsv = np.zeros([20,size,3], dtype=float) # Set value hsv[:,:,2] = np.linspace(0,1, size, endpoint=False) # Convert to RGB rgb = misc.hsv2rgb(hsv) # Make in range 0:1 for image stim rgb[:][:][:] = (rgb[:][:][:] + 1) / 2 return rgb # Setup the Window win = visual.Window(size=[1920, 1080], fullscr=False, units='height') colorPalette = visual.ImageStim(win=win,name='colorPalette', units='pix', image=None, mask=None, texRes=64, depth=0.0) valuePalette = visual.ImageStim(win=win, name='valuePalette', units='pix', pos=(0, -250), depth=-1.0) hueSlider = visual.Slider(win=win, name='hueSlider', size=(.37, .02), pos=(0, 0.2), labels=None, ticks=(0, 360), style=['rating']) satSlider = visual.Slider(win=win, name='satSlider', size=(.02, .37), pos=(0.2, 0), labels=None, ticks=(0, 1), style=['rating']) valSlider = visual.Slider(win=win, name='valSlider', size=(.37, .02), pos=(0, -0.25), labels=None, ticks=(0,1), style=['rating']) visualFeedback = visual.Rect(win=win, name='visualFeedback', width=(0.15, 0.15)[0], height=(0.15, 0.15)[1], pos=(0, 0.35),fillColor=[0,0,0], fillColorSpace='hsv', depth=-6.0) hsvText = visual.TextStim(win=win, name='hsvText', text=None, font='Arial', pos=(.4, 0), height=0.03) instText = visual.TextStim(win=win, name='instText', text=("Use the sliders to change:\n---hue (top)\n---" "saturation (right)\n---value (bottom)"), font='Arial', pos=(-.3, 0), height=0.03, wrapWidth=.4, alignText='left', anchorHoriz='right') quitText = visual.TextStim(win=win, name='quitText', text='Press escape to quit to continue', font='Arial', pos=(0, -.35), height=0.025, depth=-8.0, wrapWidth=.4) paletteSize = 400 # in pixels valRGB = createValue(paletteSize) colPalRGB = createPalette(paletteSize) hueSlider.reset() satSlider.reset() valSlider.reset() colorPalette.setSize([paletteSize,paletteSize]) colorPalette.setImage(colPalRGB) valuePalette.setSize((paletteSize, 20)) valuePalette.setImage(valRGB) key_resp = keyboard.Keyboard() while True: h = hueSlider.getRating() or 0 s = satSlider.getRating() or 0 v = valSlider.getRating() or 0.5 visualFeedback.fillColor = [h,s,v] hsvText.text = "Hue: {h:.0f}\nSat: {s:.2f}\nVal: {v:.2f}".format(h=h, s=s, v=v) colorPalette.draw() valuePalette.draw() hueSlider.draw() satSlider.draw() valSlider.draw() visualFeedback.draw() instText.draw() hsvText.draw() quitText.draw() theseKeys = key_resp.getKeys(keyList=['escape'], waitRelease=False) if len(theseKeys): theseKeys = theseKeys[0] # at least one key was pressed # check for quit: if "escape" == theseKeys: win.close() core.quit() win.flip()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 13, 3166, 11643, 2270, 1053, 15068, 29918, 14669, 29892, 7604, 29892, 7136, 13, 5215, 12655, 408, 7442, 13, 3166, 11643, 2270, 29889, 6800, 2519, 1053, 12247, 13, 3166, 11643, 2270, 1053, 3984, 29883, 13, 13, 13, 1753, 1653, 29925, 26456, 29898, 2311, 1125, 13, 1678, 9995, 13, 1678, 6760, 1078, 278, 2927, 282, 26456, 1409, 297, 379, 7597, 322, 3639, 408, 390, 7210, 13, 1678, 9995, 13, 1678, 396, 6204, 1409, 29871, 13, 1678, 298, 4501, 353, 7442, 29889, 2873, 4197, 2311, 29892, 2311, 29892, 29941, 1402, 26688, 29922, 7411, 29897, 13, 268, 13, 1678, 396, 3789, 298, 434, 13, 1678, 298, 4501, 7503, 29892, 29901, 29892, 29900, 29962, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29941, 29953, 29900, 29892, 2159, 29892, 16248, 29922, 8824, 29897, 13, 268, 13, 1678, 396, 3789, 269, 1337, 362, 13, 1678, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 4706, 298, 4501, 7503, 29892, 29875, 29892, 29871, 29896, 29962, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29871, 29896, 29892, 2159, 29892, 16248, 29922, 8824, 29897, 13, 268, 13, 1678, 396, 14806, 304, 390, 7210, 13, 1678, 15552, 29890, 353, 3984, 29883, 29889, 29882, 4501, 29906, 23973, 29898, 29882, 4501, 29897, 13, 13, 1678, 396, 8561, 297, 3464, 29871, 29900, 29901, 29896, 363, 1967, 20436, 13, 1678, 15552, 29890, 7503, 3816, 29901, 3816, 17531, 353, 313, 23973, 7503, 3816, 29901, 3816, 17531, 718, 29871, 29896, 29897, 847, 29871, 29906, 13, 1678, 736, 15552, 29890, 13, 29871, 13, 1753, 1653, 1917, 29898, 2311, 1125, 13, 1678, 9995, 13, 1678, 6760, 1078, 278, 995, 282, 26456, 1409, 297, 379, 7597, 322, 3639, 408, 390, 7210, 13, 1678, 9995, 13, 1678, 396, 6204, 1409, 29871, 13, 1678, 298, 4501, 353, 7442, 29889, 3298, 359, 4197, 29906, 29900, 29892, 2311, 29892, 29941, 1402, 26688, 29922, 7411, 29897, 13, 1678, 396, 3789, 995, 13, 1678, 298, 4501, 7503, 29892, 29901, 29892, 29906, 29962, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29896, 29892, 2159, 29892, 16248, 29922, 8824, 29897, 13, 1678, 396, 14806, 304, 390, 7210, 13, 1678, 15552, 29890, 353, 3984, 29883, 29889, 29882, 4501, 29906, 23973, 29898, 29882, 4501, 29897, 13, 13, 1678, 396, 8561, 297, 3464, 29871, 29900, 29901, 29896, 363, 1967, 20436, 13, 1678, 15552, 29890, 7503, 3816, 29901, 3816, 17531, 353, 29871, 313, 23973, 7503, 3816, 29901, 3816, 17531, 718, 29871, 29896, 29897, 847, 29871, 29906, 13, 1678, 736, 15552, 29890, 13, 268, 13, 13, 29937, 3789, 786, 278, 18379, 13, 5080, 353, 7604, 29889, 5907, 29898, 2311, 11759, 29896, 29929, 29906, 29900, 29892, 29871, 29896, 29900, 29947, 29900, 1402, 2989, 10526, 29922, 8824, 29892, 10340, 2433, 3545, 1495, 13, 13, 2780, 29925, 26456, 353, 7604, 29889, 2940, 855, 326, 29898, 5080, 29922, 5080, 29892, 978, 2433, 2780, 29925, 26456, 742, 10340, 2433, 29886, 861, 742, 29871, 13, 462, 18884, 1967, 29922, 8516, 29892, 11105, 29922, 8516, 29892, 13, 462, 18884, 19696, 1666, 29922, 29953, 29946, 29892, 10809, 29922, 29900, 29889, 29900, 29897, 13, 268, 13, 1767, 29925, 26456, 353, 7604, 29889, 2940, 855, 326, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 1767, 29925, 26456, 742, 10340, 2433, 29886, 861, 742, 29871, 13, 462, 18884, 926, 7607, 29900, 29892, 448, 29906, 29945, 29900, 511, 10809, 10457, 29896, 29889, 29900, 29897, 13, 268, 13, 29882, 434, 16973, 1241, 353, 7604, 29889, 16973, 1241, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 29882, 434, 16973, 1241, 742, 13, 462, 3986, 2159, 7607, 29889, 29941, 29955, 29892, 869, 29900, 29906, 511, 926, 7607, 29900, 29892, 29871, 29900, 29889, 29906, 511, 13, 462, 3986, 11073, 29922, 8516, 29892, 260, 7358, 7607, 29900, 29892, 29871, 29941, 29953, 29900, 511, 3114, 29922, 1839, 29741, 11287, 13, 268, 13, 29879, 271, 16973, 1241, 353, 7604, 29889, 16973, 1241, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 29879, 271, 16973, 1241, 742, 13, 462, 3986, 2159, 7607, 29889, 29900, 29906, 29892, 869, 29941, 29955, 511, 926, 7607, 29900, 29889, 29906, 29892, 29871, 29900, 511, 13, 462, 3986, 11073, 29922, 8516, 29892, 260, 7358, 7607, 29900, 29892, 29871, 29896, 511, 3114, 29922, 1839, 29741, 11287, 13, 268, 13, 791, 16973, 1241, 353, 7604, 29889, 16973, 1241, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 791, 16973, 1241, 742, 13, 462, 3986, 2159, 7607, 29889, 29941, 29955, 29892, 869, 29900, 29906, 511, 926, 7607, 29900, 29892, 448, 29900, 29889, 29906, 29945, 511, 13, 462, 3986, 11073, 29922, 8516, 29892, 260, 7358, 7607, 29900, 29892, 29896, 511, 3114, 29922, 1839, 29741, 11287, 13, 268, 13, 20119, 29737, 1627, 353, 7604, 29889, 7364, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 20119, 29737, 1627, 742, 13, 462, 632, 2920, 7607, 29900, 29889, 29896, 29945, 29892, 29871, 29900, 29889, 29896, 29945, 9601, 29900, 1402, 3171, 7607, 29900, 29889, 29896, 29945, 29892, 29871, 29900, 29889, 29896, 29945, 9601, 29896, 1402, 13, 462, 632, 926, 7607, 29900, 29892, 29871, 29900, 29889, 29941, 29945, 511, 5589, 3306, 11759, 29900, 29892, 29900, 29892, 29900, 1402, 5445, 3306, 14936, 2433, 29882, 4501, 742, 13, 462, 632, 10809, 10457, 29953, 29889, 29900, 29897, 13, 13, 29882, 4501, 1626, 353, 7604, 29889, 1626, 855, 326, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 29882, 4501, 1626, 742, 13, 462, 3986, 1426, 29922, 8516, 29892, 4079, 2433, 29909, 9315, 742, 13, 462, 3986, 926, 7607, 29889, 29946, 29892, 29871, 29900, 511, 3171, 29922, 29900, 29889, 29900, 29941, 29897, 13, 13, 2611, 1626, 353, 7604, 29889, 1626, 855, 326, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 2611, 1626, 742, 13, 462, 965, 1426, 29922, 703, 11403, 278, 2243, 11376, 304, 1735, 3583, 29876, 5634, 29882, 434, 313, 3332, 2144, 29876, 5634, 29908, 13, 462, 18884, 376, 29879, 1337, 362, 313, 1266, 2144, 29876, 5634, 1767, 313, 8968, 29897, 4968, 13, 462, 965, 4079, 2433, 29909, 9315, 742, 13, 462, 965, 926, 29922, 6278, 29889, 29941, 29892, 29871, 29900, 511, 3171, 29922, 29900, 29889, 29900, 29941, 29892, 12244, 6110, 21098, 29946, 29892, 13, 462, 965, 7595, 1626, 2433, 1563, 742, 17360, 17241, 466, 2433, 1266, 1495, 13, 13, 28358, 1626, 353, 7604, 29889, 1626, 855, 326, 29898, 5080, 29922, 5080, 29892, 1024, 2433, 28358, 1626, 742, 13, 462, 965, 1426, 2433, 10923, 10169, 304, 23283, 304, 6773, 742, 13, 462, 965, 4079, 2433, 29909, 9315, 742, 13, 462, 965, 926, 7607, 29900, 29892, 448, 29889, 29941, 29945, 511, 3171, 29922, 29900, 29889, 29900, 29906, 29945, 29892, 10809, 10457, 29947, 29889, 29900, 29892, 13, 462, 965, 12244, 6110, 21098, 29946, 29897, 13, 13, 13, 29886, 26456, 3505, 353, 29871, 29946, 29900, 29900, 29871, 396, 297, 17036, 13, 791, 28212, 353, 1653, 1917, 29898, 29886, 26456, 3505, 29897, 29871, 13, 1054, 18210, 28212, 353, 1653, 29925, 26456, 29898, 29886, 26456, 3505, 29897, 13, 13, 29882, 434, 16973, 1241, 29889, 12071, 580, 13, 29879, 271, 16973, 1241, 29889, 12071, 580, 13, 791, 16973, 1241, 29889, 12071, 580, 13, 13, 2780, 29925, 26456, 29889, 842, 3505, 4197, 29886, 26456, 3505, 29892, 29886, 26456, 3505, 2314, 13, 2780, 29925, 26456, 29889, 842, 2940, 29898, 1054, 18210, 28212, 29897, 13, 1767, 29925, 26456, 29889, 842, 3505, 3552, 29886, 26456, 3505, 29892, 29871, 29906, 29900, 876, 13, 1767, 29925, 26456, 29889, 842, 2940, 29898, 791, 28212, 29897, 13, 13, 1989, 29918, 13713, 353, 12247, 29889, 2558, 3377, 580, 13, 13, 8000, 5852, 29901, 13, 268, 13, 1678, 298, 353, 298, 434, 16973, 1241, 29889, 657, 29934, 1218, 580, 470, 29871, 29900, 13, 1678, 269, 353, 3290, 16973, 1241, 29889, 657, 29934, 1218, 580, 470, 29871, 29900, 13, 1678, 325, 353, 659, 16973, 1241, 29889, 657, 29934, 1218, 580, 470, 29871, 29900, 29889, 29945, 13, 1678, 7604, 29737, 1627, 29889, 5589, 3306, 353, 518, 29882, 29892, 29879, 29892, 29894, 29962, 13, 1678, 298, 4501, 1626, 29889, 726, 353, 376, 29950, 434, 29901, 426, 29882, 29901, 29889, 29900, 29888, 1012, 29876, 29903, 271, 29901, 426, 29879, 29901, 29889, 29906, 29888, 1012, 29876, 1440, 29901, 426, 29894, 29901, 29889, 29906, 29888, 29913, 1642, 4830, 29898, 29882, 29922, 29882, 29892, 269, 29922, 29879, 29892, 325, 29922, 29894, 29897, 13, 13, 1678, 2927, 29925, 26456, 29889, 4012, 580, 13, 1678, 995, 29925, 26456, 29889, 4012, 580, 29871, 13, 1678, 298, 434, 16973, 1241, 29889, 4012, 580, 13, 1678, 3290, 16973, 1241, 29889, 4012, 580, 13, 1678, 659, 16973, 1241, 29889, 4012, 580, 13, 1678, 7604, 29737, 1627, 29889, 4012, 580, 13, 1678, 832, 1626, 29889, 4012, 580, 13, 1678, 298, 4501, 1626, 29889, 4012, 580, 13, 1678, 23283, 1626, 29889, 4012, 580, 13, 268, 13, 1678, 1438, 15506, 353, 1820, 29918, 13713, 29889, 657, 15506, 29898, 1989, 1293, 29922, 1839, 21587, 7464, 4480, 19729, 29922, 8824, 29897, 13, 1678, 565, 7431, 29898, 386, 968, 15506, 1125, 13, 4706, 1438, 15506, 353, 1438, 15506, 29961, 29900, 29962, 29871, 396, 472, 3203, 697, 1820, 471, 15385, 13, 308, 13, 4706, 396, 1423, 363, 23283, 29901, 13, 4706, 565, 376, 21587, 29908, 1275, 1438, 15506, 29901, 13, 9651, 5401, 29889, 5358, 580, 13, 9651, 7136, 29889, 28358, 580, 13, 632, 13, 1678, 5401, 29889, 29888, 3466, 580, 2 ]
train_ids.py
Huanzhuo/IA-Net
2
57912
import os import torch import argparse import datetime import numpy as np import torch.optim as optim from models.resnet import resnet50, Model, resnet50_1d from losses.loss import ContrastiveLoss_ from torch.optim import lr_scheduler from torch.utils.data import DataLoader from dataset.industry_dataset_identify import IndustryDatasetIdentifyDiff, IndustryDatasetIdentify from sklearn.model_selection import train_test_split from torch.cuda.amp.grad_scaler import GradScaler from torch.cuda.amp import autocast nowTime = datetime.datetime.now().strftime('%Y-%m-%d-%H') result_dir = './results/pump_slider_fan_valve/all_ids/{}'.format(nowTime) if not os.path.exists(result_dir): os.makedirs(result_dir) def save_model(model, optimizer, step, path): if len(os.path.dirname(path)) > 0 and not os.path.exists(os.path.dirname(path)): os.makedirs(os.path.dirname(path)) torch.save({ 'model': model, 'model_state_dict': model.state_dict(), 'optimizer_state_dict': optimizer.state_dict(), 'step': step, # 'amp': amp.state_dict(), }, path) def load_model(model, optimizer, path): checkpoint = torch.load(path) model.load_state_dict(checkpoint['model_state_dict']) if optimizer is not None: checkpoint['optimizer_state_dict']['param_groups'][0]['lr'] = 0.001 optimizer.load_state_dict(checkpoint['optimizer_state_dict']) step = checkpoint['step'] return step def valiadate(model, criterion, val_loader): model.eval() with torch.no_grad(): total_loss = 0.0 for i, (mix, mix_, status) in enumerate(val_loader): mix = mix.cuda() mix_ = mix_.cuda() status = status.cuda() features, features_ = model(mix, mix_) loss = criterion(features, features_, status) total_loss += loss.item() return total_loss def get_files(path): wav_files = [] for _, _, files in os.walk(path): for f in files: if f.split('.')[-1] == 'wav': wav_files.append(f) return wav_files def get_ids(total_path): train_normal_ids_files = [] val_normal_ids_files = [] for dir in os.listdir(total_path): if dir.split('_')[0] != "id": continue normal_path = total_path + dir + '/normal' normal_files = get_files(normal_path) train_normals, val_normal = train_test_split(normal_files, random_state=42, test_size=0.2) train_normal_ids_files.append(train_normals) val_normal_ids_files.append(val_normal) return train_normal_ids_files, val_normal_ids_files def main(args): print(args) # dataset and dataloader s1_path = '../MIMII/pump/' s2_path = '../MIMII/slider/' s3_path = '../MIMII/fan/' s4_path = '../MIMII/valve/' sources_path = [s1_path, s2_path, s3_path, s4_path] train_s1_normal_ids_files, val_s1_normal_ids_files = get_ids(s1_path) train_s2_normal_ids_files, val_s2_normal_ids_files = get_ids(s2_path) train_s3_normal_ids_files, val_s3_normal_ids_files = get_ids(s3_path) train_s4_normal_ids_files, val_s4_normal_ids_files = get_ids(s4_path) train_normals = [train_s1_normal_ids_files, train_s2_normal_ids_files, train_s3_normal_ids_files, train_s4_normal_ids_files] val_normals = [val_s1_normal_ids_files, val_s2_normal_ids_files, val_s3_normal_ids_files, val_s4_normal_ids_files] train_dataset = IndustryDatasetIdentifyDiff(sources_path, train_normals) val_dataset = IndustryDatasetIdentifyDiff(sources_path, val_normals, n=320) train_loader = DataLoader(train_dataset, batch_size=args.batch_size, shuffle=True) val_loader = DataLoader(val_dataset, batch_size=args.batch_size, shuffle=False) # generate the model if args.load: print("Continuing training full model from checkpoint " + str(args.load_model)) model = torch.load('./result_identify/pump_fan_valve/all_ids/model_best.pt')['model'] # model = torch.load('./result/2020-08-20-01/model_best.pt')['model'] else: model = resnet50_1d(n_spk=4) model = model.cuda() # generate optimizer and learning rate scheduler optimizer = optim.Adam(model.parameters(), lr=args.lr, betas=(0.9, 0.999), weight_decay=5e-4) clr = lr_scheduler.CosineAnnealingLR(optimizer, 5, eta_min=1e-5) # use mix precision training, may reduce the accuracy but increase the training speed # model, optimizer = amp.initialize(model, optimizer, opt_level="O1") criterion = ContrastiveLoss_() scaler = GradScaler() # criterion = CosLoss() # Set up training state dict that will also be saved into checkpoints state = {"worse_epochs": 0, "epochs": 0, "best_loss": np.Inf, 'step': 0} print('Start training...') for i in range(args.epochs): print("Training one epoch from iteration " + str(state["epochs"])) model.train() train_loss = 0.0 for i, (mix, mix_, status) in enumerate(train_loader): mix = mix.cuda() mix_ = mix_.cuda() status = status.cuda() cur_lr = optimizer.state_dict()['param_groups'][0]['lr'] optimizer.zero_grad() with autocast(): features, features_ = model(mix, mix_) loss = criterion(features, features_, status) train_loss += loss.item() scaler.scale(loss).backward() scaler.step(optimizer) scaler.update() state['step'] += 1 if i % 20 == 0: print("{:4d}/{:4d} --- Loss: {:.6f} with learnig rate {:.6f}".format(i, len(train_dataset) // args.batch_size, loss.item(), cur_lr)) clr.step() val_loss = valiadate(model, criterion, val_loader) train_loss = train_loss val_loss = val_loss print("Validation loss" + str(val_loss)) # EARLY STOPPING CHECK checkpoint_path = args.model_path + str(state['epochs']) + '.pth' print("Saving model...") if val_loss >= state["best_loss"]: state["worse_epochs"] += 1 else: print("MODEL IMPROVED ON VALIDATION SET!") state["worse_epochs"] = 0 state["best_loss"] = val_loss state["best_checkpoint"] = checkpoint_path best_checkpoint_path = args.model_path + 'best.pt' best_state_dict_path = args.model_path + 'best_state_dict.pt' save_model(model, optimizer, state, best_checkpoint_path) torch.save(model.state_dict(), best_state_dict_path) print(state) state["epochs"] += 1 if state["worse_epochs"] > args.hold_step: break last_model = args.model_path + 'last_model.pt' save_model(model, optimizer, state, last_model) print("Training finished") if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--model_path', type=str, default='{}/model_'.format(result_dir), help='Path to save model') parser.add_argument('--lr', type=float, default=1e-4, help='initial learning rate') parser.add_argument('--batch_size', type=int, default=16) parser.add_argument('--output_size', type=float, default=2.0, help='Output duration') parser.add_argument('--sr', type=int, default=16000, help='Sampling rate') parser.add_argument('--channels', type=int, default=1, help="Input channel, mono or sterno, default mono") parser.add_argument('--load_model', type=str, default='', help="Path of hdf5 file") parser.add_argument("--load", type=bool, default=False) parser.add_argument("--epochs", type=int, default=200, help="Epochs of half lr") parser.add_argument("--hold_step", type=int, default=20, help="Epochs of hold step") args = parser.parse_args() main(args)
[ 1, 1053, 2897, 13, 5215, 4842, 305, 13, 5215, 1852, 5510, 13, 5215, 12865, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 29889, 20640, 408, 5994, 13, 3166, 4733, 29889, 690, 1212, 1053, 620, 1212, 29945, 29900, 29892, 8125, 29892, 620, 1212, 29945, 29900, 29918, 29896, 29881, 13, 3166, 28495, 29889, 6758, 1053, 1281, 509, 579, 573, 29931, 2209, 29918, 13, 3166, 4842, 305, 29889, 20640, 1053, 301, 29878, 29918, 816, 14952, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 13, 3166, 8783, 29889, 20041, 719, 29918, 24713, 29918, 1693, 1598, 1053, 12157, 719, 16390, 24541, 7648, 1598, 26023, 29892, 12157, 719, 16390, 24541, 7648, 1598, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 3166, 4842, 305, 29889, 29883, 6191, 29889, 1160, 29889, 5105, 29918, 19529, 261, 1053, 19295, 29636, 261, 13, 3166, 4842, 305, 29889, 29883, 6191, 29889, 1160, 1053, 1120, 542, 579, 13, 13, 13, 3707, 2481, 353, 12865, 29889, 12673, 29889, 3707, 2141, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 19222, 29950, 1495, 13, 2914, 29918, 3972, 353, 19283, 9902, 29914, 29886, 3427, 29918, 23165, 29918, 12963, 29918, 791, 345, 29914, 497, 29918, 4841, 29914, 8875, 4286, 4830, 29898, 3707, 2481, 29897, 13, 361, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2914, 29918, 3972, 1125, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 2914, 29918, 3972, 29897, 13, 13, 13, 1753, 4078, 29918, 4299, 29898, 4299, 29892, 5994, 3950, 29892, 4331, 29892, 2224, 1125, 13, 1678, 565, 7431, 29898, 359, 29889, 2084, 29889, 25721, 29898, 2084, 876, 1405, 29871, 29900, 322, 451, 2897, 29889, 2084, 29889, 9933, 29898, 359, 29889, 2084, 29889, 25721, 29898, 2084, 22164, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 359, 29889, 2084, 29889, 25721, 29898, 2084, 876, 13, 1678, 4842, 305, 29889, 7620, 3319, 13, 4706, 525, 4299, 2396, 1904, 29892, 13, 4706, 525, 4299, 29918, 3859, 29918, 8977, 2396, 1904, 29889, 3859, 29918, 8977, 3285, 13, 4706, 525, 20640, 3950, 29918, 3859, 29918, 8977, 2396, 5994, 3950, 29889, 3859, 29918, 8977, 3285, 13, 4706, 525, 10568, 2396, 4331, 29892, 13, 4706, 396, 525, 1160, 2396, 21332, 29889, 3859, 29918, 8977, 3285, 13, 1678, 2981, 2224, 29897, 13, 13, 13, 1753, 2254, 29918, 4299, 29898, 4299, 29892, 5994, 3950, 29892, 2224, 1125, 13, 1678, 1423, 3149, 353, 4842, 305, 29889, 1359, 29898, 2084, 29897, 13, 1678, 1904, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 1839, 4299, 29918, 3859, 29918, 8977, 11287, 13, 1678, 565, 5994, 3950, 338, 451, 6213, 29901, 13, 4706, 1423, 3149, 1839, 20640, 3950, 29918, 3859, 29918, 8977, 16215, 3207, 29918, 13155, 2033, 29961, 29900, 22322, 29212, 2033, 353, 29871, 29900, 29889, 29900, 29900, 29896, 13, 4706, 5994, 3950, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 1839, 20640, 3950, 29918, 3859, 29918, 8977, 11287, 13, 1678, 4331, 353, 1423, 3149, 1839, 10568, 2033, 13, 1678, 736, 4331, 13, 13, 13, 1753, 659, 29875, 328, 403, 29898, 4299, 29892, 28770, 291, 29892, 659, 29918, 12657, 1125, 13, 1678, 1904, 29889, 14513, 580, 13, 1678, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 4706, 3001, 29918, 6758, 353, 29871, 29900, 29889, 29900, 13, 4706, 363, 474, 29892, 313, 28084, 29892, 6837, 3383, 4660, 29897, 297, 26985, 29898, 791, 29918, 12657, 1125, 13, 9651, 6837, 353, 6837, 29889, 29883, 6191, 580, 13, 9651, 6837, 29918, 353, 6837, 5396, 29883, 6191, 580, 13, 9651, 4660, 353, 4660, 29889, 29883, 6191, 580, 13, 9651, 5680, 29892, 5680, 29918, 353, 1904, 29898, 28084, 29892, 6837, 19925, 13, 9651, 6410, 353, 28770, 291, 29898, 22100, 29892, 5680, 3383, 4660, 29897, 13, 9651, 3001, 29918, 6758, 4619, 6410, 29889, 667, 580, 13, 1678, 736, 3001, 29918, 6758, 13, 13, 13, 1753, 679, 29918, 5325, 29898, 2084, 1125, 13, 1678, 281, 485, 29918, 5325, 353, 5159, 13, 1678, 363, 17117, 17117, 2066, 297, 2897, 29889, 20919, 29898, 2084, 1125, 13, 4706, 363, 285, 297, 2066, 29901, 13, 9651, 565, 285, 29889, 5451, 12839, 1495, 14352, 29896, 29962, 1275, 525, 29893, 485, 2396, 13, 18884, 281, 485, 29918, 5325, 29889, 4397, 29898, 29888, 29897, 13, 1678, 736, 281, 485, 29918, 5325, 13, 13, 13, 1753, 679, 29918, 4841, 29898, 7827, 29918, 2084, 1125, 13, 1678, 7945, 29918, 8945, 29918, 4841, 29918, 5325, 353, 5159, 13, 1678, 659, 29918, 8945, 29918, 4841, 29918, 5325, 353, 5159, 13, 1678, 363, 4516, 297, 2897, 29889, 1761, 3972, 29898, 7827, 29918, 2084, 1125, 13, 4706, 565, 4516, 29889, 5451, 877, 29918, 29861, 29900, 29962, 2804, 376, 333, 1115, 13, 9651, 6773, 13, 4706, 4226, 29918, 2084, 353, 3001, 29918, 2084, 718, 4516, 718, 8207, 8945, 29915, 13, 4706, 4226, 29918, 5325, 353, 679, 29918, 5325, 29898, 8945, 29918, 2084, 29897, 13, 4706, 7945, 29918, 12324, 1338, 29892, 659, 29918, 8945, 353, 7945, 29918, 1688, 29918, 5451, 29898, 8945, 29918, 5325, 29892, 4036, 29918, 3859, 29922, 29946, 29906, 29892, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29897, 13, 4706, 7945, 29918, 8945, 29918, 4841, 29918, 5325, 29889, 4397, 29898, 14968, 29918, 12324, 1338, 29897, 13, 4706, 659, 29918, 8945, 29918, 4841, 29918, 5325, 29889, 4397, 29898, 791, 29918, 8945, 29897, 13, 1678, 736, 7945, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 8945, 29918, 4841, 29918, 5325, 13, 13, 13, 1753, 1667, 29898, 5085, 1125, 13, 1678, 1596, 29898, 5085, 29897, 13, 13, 1678, 396, 8783, 322, 1418, 7003, 1664, 13, 1678, 269, 29896, 29918, 2084, 353, 525, 6995, 29924, 7833, 2687, 29914, 29886, 3427, 22208, 13, 1678, 269, 29906, 29918, 2084, 353, 525, 6995, 29924, 7833, 2687, 29914, 23165, 22208, 13, 1678, 269, 29941, 29918, 2084, 353, 525, 6995, 29924, 7833, 2687, 29914, 12963, 22208, 13, 1678, 269, 29946, 29918, 2084, 353, 525, 6995, 29924, 7833, 2687, 29914, 791, 345, 22208, 13, 1678, 8974, 29918, 2084, 353, 518, 29879, 29896, 29918, 2084, 29892, 269, 29906, 29918, 2084, 29892, 269, 29941, 29918, 2084, 29892, 269, 29946, 29918, 2084, 29962, 13, 1678, 7945, 29918, 29879, 29896, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29896, 29918, 8945, 29918, 4841, 29918, 5325, 353, 679, 29918, 4841, 29898, 29879, 29896, 29918, 2084, 29897, 13, 1678, 7945, 29918, 29879, 29906, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29906, 29918, 8945, 29918, 4841, 29918, 5325, 353, 679, 29918, 4841, 29898, 29879, 29906, 29918, 2084, 29897, 13, 1678, 7945, 29918, 29879, 29941, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29941, 29918, 8945, 29918, 4841, 29918, 5325, 353, 679, 29918, 4841, 29898, 29879, 29941, 29918, 2084, 29897, 13, 1678, 7945, 29918, 29879, 29946, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29946, 29918, 8945, 29918, 4841, 29918, 5325, 353, 679, 29918, 4841, 29898, 29879, 29946, 29918, 2084, 29897, 13, 13, 1678, 7945, 29918, 12324, 1338, 353, 518, 14968, 29918, 29879, 29896, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 7945, 29918, 29879, 29906, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 7945, 29918, 29879, 29941, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 7945, 29918, 29879, 29946, 29918, 8945, 29918, 4841, 29918, 5325, 29962, 13, 1678, 659, 29918, 12324, 1338, 353, 518, 791, 29918, 29879, 29896, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29906, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29941, 29918, 8945, 29918, 4841, 29918, 5325, 29892, 659, 29918, 29879, 29946, 29918, 8945, 29918, 4841, 29918, 5325, 29962, 13, 13, 1678, 7945, 29918, 24713, 353, 12157, 719, 16390, 24541, 7648, 1598, 26023, 29898, 29879, 2863, 29918, 2084, 29892, 7945, 29918, 12324, 1338, 29897, 13, 1678, 659, 29918, 24713, 353, 12157, 719, 16390, 24541, 7648, 1598, 26023, 29898, 29879, 2863, 29918, 2084, 29892, 659, 29918, 12324, 1338, 29892, 302, 29922, 29941, 29906, 29900, 29897, 13, 13, 1678, 7945, 29918, 12657, 353, 3630, 10036, 29898, 14968, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 528, 21897, 29922, 5574, 29897, 13, 1678, 659, 29918, 12657, 353, 3630, 10036, 29898, 791, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 528, 21897, 29922, 8824, 29897, 13, 13, 1678, 396, 5706, 278, 1904, 13, 1678, 565, 6389, 29889, 1359, 29901, 13, 4706, 1596, 703, 1323, 8675, 292, 6694, 2989, 1904, 515, 1423, 3149, 376, 718, 851, 29898, 5085, 29889, 1359, 29918, 4299, 876, 13, 4706, 1904, 353, 4842, 305, 29889, 1359, 877, 6904, 2914, 29918, 1693, 1598, 29914, 29886, 3427, 29918, 12963, 29918, 791, 345, 29914, 497, 29918, 4841, 29914, 4299, 29918, 13318, 29889, 415, 1495, 1839, 4299, 2033, 13, 4706, 396, 1904, 353, 4842, 305, 29889, 1359, 877, 6904, 2914, 29914, 29906, 29900, 29906, 29900, 29899, 29900, 29947, 29899, 29906, 29900, 29899, 29900, 29896, 29914, 4299, 29918, 13318, 29889, 415, 1495, 1839, 4299, 2033, 13, 1678, 1683, 29901, 13, 4706, 1904, 353, 620, 1212, 29945, 29900, 29918, 29896, 29881, 29898, 29876, 29918, 1028, 29895, 29922, 29946, 29897, 13, 4706, 1904, 353, 1904, 29889, 29883, 6191, 580, 13, 1678, 396, 5706, 5994, 3950, 322, 6509, 6554, 1364, 14952, 13, 1678, 5994, 3950, 353, 5994, 29889, 3253, 314, 29898, 4299, 29889, 16744, 3285, 301, 29878, 29922, 5085, 29889, 29212, 29892, 1010, 294, 7607, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 511, 7688, 29918, 7099, 388, 29922, 29945, 29872, 29899, 29946, 29897, 13, 1678, 1067, 29878, 353, 301, 29878, 29918, 816, 14952, 29889, 29907, 359, 457, 2744, 484, 12818, 29519, 29898, 20640, 3950, 29892, 29871, 29945, 29892, 634, 29874, 29918, 1195, 29922, 29896, 29872, 29899, 29945, 29897, 13, 1678, 396, 671, 6837, 16716, 6694, 29892, 1122, 10032, 278, 13600, 541, 7910, 278, 6694, 6210, 13, 1678, 396, 1904, 29892, 5994, 3950, 353, 21332, 29889, 24926, 29898, 4299, 29892, 5994, 3950, 29892, 3523, 29918, 5563, 543, 29949, 29896, 1159, 13, 13, 1678, 28770, 291, 353, 1281, 509, 579, 573, 29931, 2209, 29918, 580, 13, 1678, 8716, 261, 353, 19295, 29636, 261, 580, 13, 1678, 396, 28770, 291, 353, 13526, 29931, 2209, 580, 13, 13, 1678, 396, 3789, 701, 6694, 2106, 9657, 393, 674, 884, 367, 7160, 964, 1423, 9748, 13, 1678, 2106, 353, 8853, 13762, 344, 29918, 1022, 2878, 29879, 1115, 29871, 29900, 29892, 13, 632, 376, 1022, 2878, 29879, 1115, 29871, 29900, 29892, 13, 632, 376, 13318, 29918, 6758, 1115, 7442, 29889, 25433, 29892, 13, 632, 525, 10568, 2396, 29871, 29900, 29913, 13, 13, 1678, 1596, 877, 4763, 6694, 856, 1495, 13, 1678, 363, 474, 297, 3464, 29898, 5085, 29889, 1022, 2878, 29879, 1125, 13, 4706, 1596, 703, 5323, 2827, 697, 21502, 305, 515, 12541, 376, 718, 851, 29898, 3859, 3366, 1022, 2878, 29879, 3108, 876, 13, 4706, 1904, 29889, 14968, 580, 13, 4706, 7945, 29918, 6758, 353, 29871, 29900, 29889, 29900, 13, 4706, 363, 474, 29892, 313, 28084, 29892, 6837, 3383, 4660, 29897, 297, 26985, 29898, 14968, 29918, 12657, 1125, 13, 9651, 6837, 353, 6837, 29889, 29883, 6191, 580, 13, 9651, 6837, 29918, 353, 6837, 5396, 29883, 6191, 580, 13, 9651, 4660, 353, 4660, 29889, 29883, 6191, 580, 13, 9651, 3151, 29918, 29212, 353, 5994, 3950, 29889, 3859, 29918, 8977, 580, 1839, 3207, 29918, 13155, 2033, 29961, 29900, 22322, 29212, 2033, 13, 9651, 5994, 3950, 29889, 9171, 29918, 5105, 580, 13, 9651, 411, 1120, 542, 579, 7295, 13, 18884, 5680, 29892, 5680, 29918, 353, 1904, 29898, 28084, 29892, 6837, 19925, 13, 18884, 6410, 353, 28770, 291, 29898, 22100, 29892, 5680, 3383, 4660, 29897, 13, 9651, 7945, 29918, 6758, 4619, 6410, 29889, 667, 580, 13, 9651, 8716, 261, 29889, 7052, 29898, 6758, 467, 1627, 1328, 580, 13, 9651, 8716, 261, 29889, 10568, 29898, 20640, 3950, 29897, 13, 9651, 8716, 261, 29889, 5504, 580, 13, 9651, 2106, 1839, 10568, 2033, 4619, 29871, 29896, 13, 13, 9651, 565, 474, 1273, 29871, 29906, 29900, 1275, 29871, 29900, 29901, 13, 18884, 1596, 703, 25641, 29946, 29881, 6822, 25641, 29946, 29881, 29913, 11474, 365, 2209, 29901, 12365, 29889, 29953, 29888, 29913, 411, 5110, 335, 6554, 12365, 29889, 29953, 29888, 29913, 1642, 4830, 29898, 29875, 29892, 7431, 29898, 14968, 29918, 24713, 29897, 849, 6389, 29889, 16175, 29918, 2311, 29892, 6410, 29889, 667, 3285, 3151, 29918, 29212, 876, 13, 13, 4706, 1067, 29878, 29889, 10568, 580, 13, 4706, 659, 29918, 6758, 353, 659, 29875, 328, 403, 29898, 4299, 29892, 28770, 291, 29892, 659, 29918, 12657, 29897, 13, 4706, 7945, 29918, 6758, 353, 7945, 29918, 6758, 13, 4706, 659, 29918, 6758, 353, 659, 29918, 6758, 13, 13, 4706, 1596, 703, 19448, 6410, 29908, 718, 851, 29898, 791, 29918, 6758, 876, 13, 13, 4706, 396, 382, 1718, 16786, 6850, 4590, 29925, 4214, 23557, 13, 4706, 1423, 3149, 29918, 2084, 353, 6389, 29889, 4299, 29918, 2084, 718, 851, 29898, 3859, 1839, 1022, 2878, 29879, 11287, 718, 15300, 29886, 386, 29915, 13, 4706, 1596, 703, 29903, 5555, 1904, 856, 1159, 13, 4706, 565, 659, 29918, 6758, 6736, 2106, 3366, 13318, 29918, 6758, 3108, 29901, 13, 9651, 2106, 3366, 13762, 344, 29918, 1022, 2878, 29879, 3108, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 20387, 29931, 306, 3580, 1672, 29963, 3352, 6732, 12599, 1367, 8098, 11368, 29991, 1159, 13, 9651, 2106, 3366, 13762, 344, 29918, 1022, 2878, 29879, 3108, 353, 29871, 29900, 13, 9651, 2106, 3366, 13318, 29918, 6758, 3108, 353, 659, 29918, 6758, 13, 9651, 2106, 3366, 13318, 29918, 3198, 3149, 3108, 353, 1423, 3149, 29918, 2084, 13, 9651, 1900, 29918, 3198, 3149, 29918, 2084, 353, 6389, 29889, 4299, 29918, 2084, 718, 525, 13318, 29889, 415, 29915, 13, 9651, 1900, 29918, 3859, 29918, 8977, 29918, 2084, 353, 6389, 29889, 4299, 29918, 2084, 718, 525, 13318, 29918, 3859, 29918, 8977, 29889, 415, 29915, 13, 9651, 4078, 29918, 4299, 29898, 4299, 29892, 5994, 3950, 29892, 2106, 29892, 1900, 29918, 3198, 3149, 29918, 2084, 29897, 13, 9651, 4842, 305, 29889, 7620, 29898, 4299, 29889, 3859, 29918, 8977, 3285, 1900, 29918, 3859, 29918, 8977, 29918, 2084, 29897, 13, 4706, 1596, 29898, 3859, 29897, 13, 4706, 2106, 3366, 1022, 2878, 29879, 3108, 4619, 29871, 29896, 13, 4706, 565, 2106, 3366, 13762, 344, 29918, 1022, 2878, 29879, 3108, 1405, 6389, 29889, 8948, 29918, 10568, 29901, 13, 9651, 2867, 13, 1678, 1833, 29918, 4299, 353, 6389, 29889, 4299, 29918, 2084, 718, 525, 4230, 29918, 4299, 29889, 415, 29915, 13, 1678, 4078, 29918, 4299, 29898, 4299, 29892, 5994, 3950, 29892, 2106, 29892, 1833, 29918, 4299, 29897, 13, 1678, 1596, 703, 5323, 2827, 7743, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4299, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 29912, 6822, 4299, 29918, 4286, 4830, 29898, 2914, 29918, 3972, 511, 13, 462, 4706, 1371, 2433, 2605, 304, 4078, 1904, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29212, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29896, 29872, 29899, 29946, 29892, 13, 462, 4706, 1371, 2433, 11228, 6509, 6554, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16175, 29918, 2311, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29953, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4905, 29918, 2311, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29906, 29889, 29900, 29892, 13, 462, 4706, 1371, 2433, 6466, 14385, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 21935, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29953, 29900, 29900, 29900, 29892, 13, 462, 4706, 1371, 2433, 22966, 10335, 6554, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 305, 12629, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29892, 13, 462, 4706, 1371, 543, 4290, 8242, 29892, 1601, 29877, 470, 27784, 29877, 29892, 2322, 1601, 29877, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1359, 29918, 4299, 742, 1134, 29922, 710, 29892, 2322, 2433, 742, 13, 462, 4706, 1371, 543, 2605, 310, 298, 2176, 29945, 934, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 1359, 613, 1134, 29922, 11227, 29892, 2322, 29922, 8824, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 1022, 2878, 29879, 613, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29900, 29900, 29892, 13, 462, 4706, 1371, 543, 29923, 1129, 12168, 310, 4203, 301, 29878, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 8948, 29918, 10568, 613, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29900, 29892, 13, 462, 4706, 1371, 543, 29923, 1129, 12168, 310, 4808, 4331, 1159, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 1667, 29898, 5085, 29897, 13, 2 ]
vkontakte_photos/parser.py
Andertaker/django-vkontakte-photos
0
148200
# -*- coding: utf-8 -*- from datetime import datetime from vkontakte_api.parser import VkontakteParser, VkontakteParseError import re class VkontaktePhotosParser(VkontakteParser): pass # def parse_container_date(self, container): # # text = container.find('span', {'class': re.compile('^rel_date')}) # if text: # text = text.text # else: # raise VkontakteParseError("Impossible to find date container in %s" % container) # return datetime(1970,1,1) # # return self.parse_date(text) # def parse_comment(self, content, wall_owner=None): # from models import Comment # from vkontakte_users.models import User # # remote_id = content['id'][4:] # try: # instance = Comment.objects.get(remote_id=remote_id) # except Comment.DoesNotExist: # instance = Comment(remote_id=remote_id) # # comment_text = content.find('div', {'class': 'fw_reply_text'}) # if comment_text: # instance.text = comment_text.text # # # date # instance.date = self.parse_container_date(content) # # likes # instance.likes = self.parse_container_likes(content, 'like_count fl_l') # # # author # users = content.findAll('a', {'class': 'fw_reply_author'}) # slug = users[0]['href'][1:] # if wall_owner and wall_owner.screen_name == slug: # instance.author = wall_owner # else: # avatar = content.find('a', {'class': 'fw_reply_thumb'}).find('img')['src'] # name_parts = users[0].text.split(' ') # # user = User.remote.get_by_slug(slug) # if user: # user.first_name = name_parts[0] # if len(name_parts) > 1: # user.last_name = name_parts[1] # user.photo = avatar # user.save() # instance.author = user # # if len(users) == 2: # # this comment is answer # slug = users[1]['href'][1:] # if wall_owner and wall_owner.screen_name == slug: # instance.reply_for = wall_owner # else: # instance.reply_for = User.remote.get_by_slug(slug) # # имя в падеже, аватара нет # # чтобы получть текст и ID родительского коммента нужно отправить: # #http://vk.com/al_wall.php # #act:post_tt # #al:1 # #post:-16297716_126263 # #reply:1 # # instance.fetched = datetime.now() # return instance
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 12865, 1053, 12865, 13, 3166, 325, 29895, 609, 17230, 29918, 2754, 29889, 16680, 1053, 478, 29895, 609, 17230, 11726, 29892, 478, 29895, 609, 17230, 12914, 2392, 13, 5215, 337, 13, 13, 1990, 478, 29895, 609, 17230, 4819, 15788, 11726, 29898, 29963, 29895, 609, 17230, 11726, 1125, 13, 1678, 1209, 13, 29937, 1678, 822, 6088, 29918, 7611, 29918, 1256, 29898, 1311, 29892, 5639, 1125, 13, 29937, 13, 29937, 4706, 1426, 353, 5639, 29889, 2886, 877, 9653, 742, 11117, 1990, 2396, 337, 29889, 12198, 877, 29985, 2674, 29918, 1256, 1495, 1800, 13, 29937, 4706, 565, 1426, 29901, 13, 29937, 9651, 1426, 353, 1426, 29889, 726, 13, 29937, 4706, 1683, 29901, 13, 29937, 9651, 12020, 478, 29895, 609, 17230, 12914, 2392, 703, 1888, 27338, 304, 1284, 2635, 5639, 297, 1273, 29879, 29908, 1273, 5639, 29897, 13, 29937, 9651, 736, 12865, 29898, 29896, 29929, 29955, 29900, 29892, 29896, 29892, 29896, 29897, 13, 29937, 13, 29937, 4706, 736, 1583, 29889, 5510, 29918, 1256, 29898, 726, 29897, 13, 13, 29937, 1678, 822, 6088, 29918, 9342, 29898, 1311, 29892, 2793, 29892, 10090, 29918, 20348, 29922, 8516, 1125, 13, 29937, 4706, 515, 4733, 1053, 461, 13, 29937, 4706, 515, 325, 29895, 609, 17230, 29918, 7193, 29889, 9794, 1053, 4911, 13, 29937, 13, 29937, 4706, 7592, 29918, 333, 353, 2793, 1839, 333, 2033, 29961, 29946, 17531, 13, 29937, 4706, 1018, 29901, 13, 29937, 9651, 2777, 353, 461, 29889, 12650, 29889, 657, 29898, 16674, 29918, 333, 29922, 16674, 29918, 333, 29897, 13, 29937, 4706, 5174, 461, 29889, 25125, 3664, 1252, 391, 29901, 13, 29937, 9651, 2777, 353, 461, 29898, 16674, 29918, 333, 29922, 16674, 29918, 333, 29897, 13, 29937, 13, 29937, 4706, 3440, 29918, 726, 353, 2793, 29889, 2886, 877, 4563, 742, 11117, 1990, 2396, 525, 25051, 29918, 3445, 368, 29918, 726, 29915, 1800, 13, 29937, 4706, 565, 3440, 29918, 726, 29901, 13, 29937, 9651, 2777, 29889, 726, 353, 3440, 29918, 726, 29889, 726, 13, 29937, 13, 29937, 4706, 396, 2635, 13, 29937, 4706, 2777, 29889, 1256, 353, 1583, 29889, 5510, 29918, 7611, 29918, 1256, 29898, 3051, 29897, 13, 29937, 4706, 396, 4188, 267, 13, 29937, 4706, 2777, 29889, 5081, 267, 353, 1583, 29889, 5510, 29918, 7611, 29918, 5081, 267, 29898, 3051, 29892, 525, 4561, 29918, 2798, 1652, 29918, 29880, 1495, 13, 29937, 13, 29937, 4706, 396, 4148, 13, 29937, 4706, 4160, 353, 2793, 29889, 2886, 3596, 877, 29874, 742, 11117, 1990, 2396, 525, 25051, 29918, 3445, 368, 29918, 8921, 29915, 1800, 13, 29937, 4706, 2243, 688, 353, 4160, 29961, 29900, 22322, 12653, 2033, 29961, 29896, 17531, 13, 29937, 4706, 565, 10090, 29918, 20348, 322, 10090, 29918, 20348, 29889, 10525, 29918, 978, 1275, 2243, 688, 29901, 13, 29937, 9651, 2777, 29889, 8921, 353, 10090, 29918, 20348, 13, 29937, 4706, 1683, 29901, 13, 29937, 9651, 1029, 14873, 353, 2793, 29889, 2886, 877, 29874, 742, 11117, 1990, 2396, 525, 25051, 29918, 3445, 368, 29918, 386, 3774, 29915, 7690, 2886, 877, 2492, 1495, 1839, 4351, 2033, 13, 29937, 9651, 1024, 29918, 20895, 353, 4160, 29961, 29900, 1822, 726, 29889, 5451, 877, 25710, 13, 29937, 13, 29937, 9651, 1404, 353, 4911, 29889, 16674, 29889, 657, 29918, 1609, 29918, 29517, 29898, 29517, 29897, 13, 29937, 9651, 565, 1404, 29901, 13, 29937, 18884, 1404, 29889, 4102, 29918, 978, 353, 1024, 29918, 20895, 29961, 29900, 29962, 13, 29937, 18884, 565, 7431, 29898, 978, 29918, 20895, 29897, 1405, 29871, 29896, 29901, 13, 29937, 462, 1678, 1404, 29889, 4230, 29918, 978, 353, 1024, 29918, 20895, 29961, 29896, 29962, 13, 29937, 18884, 1404, 29889, 21596, 353, 1029, 14873, 13, 29937, 18884, 1404, 29889, 7620, 580, 13, 29937, 18884, 2777, 29889, 8921, 353, 1404, 13, 29937, 13, 29937, 4706, 565, 7431, 29898, 7193, 29897, 1275, 29871, 29906, 29901, 13, 29937, 9651, 396, 445, 3440, 338, 1234, 13, 29937, 9651, 2243, 688, 353, 4160, 29961, 29896, 22322, 12653, 2033, 29961, 29896, 17531, 13, 29937, 9651, 565, 10090, 29918, 20348, 322, 10090, 29918, 20348, 29889, 10525, 29918, 978, 1275, 2243, 688, 29901, 13, 29937, 18884, 2777, 29889, 3445, 368, 29918, 1454, 353, 10090, 29918, 20348, 13, 29937, 9651, 1683, 29901, 13, 29937, 18884, 2777, 29889, 3445, 368, 29918, 1454, 353, 4911, 29889, 16674, 29889, 657, 29918, 1609, 29918, 29517, 29898, 29517, 29897, 13, 29937, 18884, 396, 606, 5010, 490, 4554, 1216, 1498, 29892, 1097, 846, 28799, 1538, 29932, 13, 29937, 18884, 396, 18421, 6961, 29981, 1413, 23567, 464, 606, 3553, 14887, 2584, 2717, 5294, 19900, 26367, 9907, 1685, 19524, 1413, 29901, 13, 29937, 18884, 396, 1124, 597, 29894, 29895, 29889, 510, 29914, 284, 29918, 11358, 29889, 1961, 13, 29937, 18884, 396, 627, 29901, 2490, 29918, 698, 13, 29937, 18884, 396, 284, 29901, 29896, 13, 29937, 18884, 396, 2490, 13018, 29896, 29953, 29906, 29929, 29955, 29955, 29896, 29953, 29918, 29896, 29906, 29953, 29906, 29953, 29941, 13, 29937, 18884, 396, 3445, 368, 29901, 29896, 13, 29937, 13, 29937, 4706, 2777, 29889, 9155, 287, 353, 12865, 29889, 3707, 580, 13, 29937, 4706, 736, 2777, 2 ]
Python2/Modulo_3_exe_pratico.py
Belaschich/SoulON
0
54623
<filename>Python2/Modulo_3_exe_pratico.py """ 1. Crie uma base de dados chamada sistema_escolar_soul_on 2. Crie uma tabela alunos com os campos id, nome, matricula, turma. 3. Alimente a tabela com os seguintes dados: """ import mysql.connector db = mysql.connector.connect( host = "localhost", user = "root", password = "", database = "sistema_escolar_soul_on" ) mycursor = db.cursor() #mycursor.execute("CREATE DATABASE sistema_escolar_soul_on") #print("Database criada com sucesso!") #mycursor.execute("CREATE TABLE alunos(id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255), matricula VARCHAR(255), turma VARCHAR(255))") #print("Tabela criada com sucesso!") #adicionar = "INSERT INTO alunos (name, matricula, turma) VALUES(%s, %s, %s)" #val = [ # ("<NAME>", "MAT90551", "BCW22"), # ("<NAME>", "MAT90552", "BCW22"), # ("<NAME>", "MAT90553", "BCW22"), # ("<NAME>", "MAT90554", "BCW23"), # ("<NAME>", "MAT90555", "BCW23"), # ("<NAME>", "MAT90556", "BCW24"), # ("<NAME>", "MAT90557", "BCW25") #] #mycursor.executemany(adicionar, val) #print(mycursor.rowcount, "linha(s) alterada(s)!") #db.commit() """4. Faça as seguintes consultas: • Liste todos os registros de sua tabela. • Liste apenas nome e matrícula dos alunos do BCW23. • Liste apenas o nome dos alunos que tiverem o sobrenome Lima. """ #mycursor.execute("SELECT * FROM alunos") #mycursor.execute("SELECT name FROM alunos WHERE turma = 'BCW23' ") #adicionar = "SELECT name FROM alunos WHERE name LIKE '%Lima%'" #mycursor.execute(adicionar) #myresult = mycursor.fetchall() #for x in myresult: # print(x) ''' 5. O aluno <NAME> está na turma errada. Matricule o mesmo no BCW25. 6. O aluno <NAME> desistiu do curso, ele deve ser excluído do sistema. ''' #adicionar = "UPDATE alunos SET turma = 'BCW25' WHERE name = '<NAME>'" adicionar = "DELETE FROM alunos WHERE name = '<NAME>'" mycursor.execute(adicionar) #db.commit() print(mycursor.rowcount, "Linha(s) afetada(s)")
[ 1, 529, 9507, 29958, 11980, 29906, 29914, 2111, 7207, 29918, 29941, 29918, 8097, 29918, 558, 271, 1417, 29889, 2272, 13, 15945, 29908, 13, 29896, 29889, 12, 29907, 2546, 3672, 2967, 316, 270, 2255, 11179, 1114, 10502, 29918, 267, 1054, 279, 29918, 29879, 5059, 29918, 265, 13, 29906, 29889, 12, 29907, 2546, 3672, 260, 1107, 29874, 394, 12609, 419, 2897, 3949, 1066, 1178, 29892, 9235, 29892, 1775, 2200, 2497, 29892, 7013, 655, 29889, 13, 29941, 29889, 12, 2499, 326, 2016, 263, 260, 1107, 29874, 419, 2897, 7025, 524, 267, 270, 2255, 29901, 13, 15945, 29908, 13, 5215, 5749, 29889, 11958, 2801, 13, 13, 2585, 353, 5749, 29889, 11958, 2801, 29889, 6915, 29898, 13, 1678, 3495, 353, 376, 7640, 613, 13, 1678, 1404, 353, 376, 4632, 613, 13, 1678, 4800, 353, 12633, 13, 1678, 2566, 353, 376, 29879, 28474, 29918, 267, 1054, 279, 29918, 29879, 5059, 29918, 265, 29908, 13, 29897, 13, 13, 1357, 18127, 353, 4833, 29889, 18127, 580, 13, 29937, 1357, 18127, 29889, 7978, 703, 27045, 27640, 27982, 10502, 29918, 267, 1054, 279, 29918, 29879, 5059, 29918, 265, 1159, 13, 29937, 2158, 703, 9112, 14783, 1114, 419, 480, 985, 29877, 29991, 1159, 13, 13, 29937, 1357, 18127, 29889, 7978, 703, 27045, 10911, 394, 12609, 29898, 333, 19578, 26524, 29949, 29918, 1177, 22245, 13780, 29778, 14636, 29892, 1024, 21748, 29898, 29906, 29945, 29945, 511, 1775, 2200, 2497, 21748, 29898, 29906, 29945, 29945, 511, 7013, 655, 21748, 29898, 29906, 29945, 29945, 876, 1159, 13, 29937, 2158, 703, 29911, 1107, 29874, 14783, 1114, 419, 480, 985, 29877, 29991, 1159, 13, 13, 29937, 328, 15353, 279, 353, 376, 19460, 11646, 394, 12609, 313, 978, 29892, 1775, 2200, 2497, 29892, 7013, 655, 29897, 15673, 29414, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 5513, 13, 29937, 791, 353, 518, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29896, 613, 376, 5371, 29956, 29906, 29906, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29906, 613, 376, 5371, 29956, 29906, 29906, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29941, 613, 376, 5371, 29956, 29906, 29906, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29946, 613, 376, 5371, 29956, 29906, 29941, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29945, 613, 376, 5371, 29956, 29906, 29941, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29953, 613, 376, 5371, 29956, 29906, 29946, 4968, 13, 29937, 1678, 4852, 29966, 5813, 28341, 376, 29924, 1299, 29929, 29900, 29945, 29945, 29955, 613, 376, 5371, 29956, 29906, 29945, 1159, 13, 29937, 29962, 13, 29937, 1357, 18127, 29889, 4258, 329, 331, 1384, 29898, 328, 15353, 279, 29892, 29871, 659, 29897, 13, 29937, 2158, 29898, 1357, 18127, 29889, 798, 2798, 29892, 376, 1915, 2350, 29898, 29879, 29897, 10551, 1114, 29898, 29879, 20198, 1159, 13, 29937, 2585, 29889, 15060, 580, 13, 13, 15945, 29908, 29946, 29889, 12, 14206, 4277, 408, 7025, 524, 267, 8799, 294, 29901, 13, 30119, 12, 29931, 2488, 10843, 2897, 1072, 391, 1883, 316, 4171, 260, 1107, 29874, 29889, 13, 30119, 12, 29931, 2488, 22321, 9235, 321, 1775, 29878, 13984, 3248, 394, 12609, 437, 17403, 29956, 29906, 29941, 29889, 13, 30119, 12, 29931, 2488, 22321, 288, 9235, 3248, 394, 12609, 712, 260, 2147, 331, 288, 577, 1182, 264, 608, 27832, 29889, 13, 15945, 29908, 13, 29937, 1357, 18127, 29889, 7978, 703, 6404, 334, 3895, 394, 12609, 1159, 13, 29937, 1357, 18127, 29889, 7978, 703, 6404, 1024, 3895, 394, 12609, 5754, 7013, 655, 353, 525, 5371, 29956, 29906, 29941, 29915, 16521, 13, 29937, 328, 15353, 279, 353, 376, 6404, 1024, 3895, 394, 12609, 5754, 1024, 22962, 14210, 29931, 2946, 29995, 11838, 13, 29937, 1357, 18127, 29889, 7978, 29898, 328, 15353, 279, 29897, 13, 13, 29937, 1357, 2914, 353, 590, 18127, 29889, 9155, 497, 580, 13, 29937, 1454, 921, 297, 590, 2914, 29901, 13, 29937, 1678, 1596, 29898, 29916, 29897, 13, 13, 12008, 13, 29945, 29889, 12, 29949, 394, 9447, 529, 5813, 29958, 7919, 1055, 7013, 655, 4589, 1114, 29889, 5345, 2200, 1297, 288, 20661, 694, 17403, 29956, 29906, 29945, 29889, 13, 29953, 29889, 12, 29949, 394, 9447, 529, 5813, 29958, 553, 391, 5871, 437, 3151, 578, 29892, 4552, 28542, 724, 429, 695, 29884, 27806, 437, 10502, 29889, 13, 12008, 13, 13, 29937, 328, 15353, 279, 353, 376, 14474, 394, 12609, 11368, 7013, 655, 353, 525, 5371, 29956, 29906, 29945, 29915, 5754, 29871, 1024, 353, 12801, 5813, 29958, 11838, 13, 328, 15353, 279, 353, 376, 2287, 18476, 3895, 394, 12609, 5754, 29871, 1024, 353, 12801, 5813, 29958, 11838, 13, 1357, 18127, 29889, 7978, 29898, 328, 15353, 279, 29897, 13, 29937, 2585, 29889, 15060, 580, 13, 2158, 29898, 1357, 18127, 29889, 798, 2798, 29892, 376, 11667, 2350, 29898, 29879, 29897, 2511, 300, 1114, 29898, 29879, 25760, 13, 2 ]
jupyterlab2pymolpysnips/Selection/duplicateObject.py
MooersLab/pymolpysnips
0
162429
""" cmd.do('create ${1:t4l}, ${2:1lw9};') """ cmd.do('create t4l, 1lw9;') # Description: Duplicate object. # Source: placeHolder
[ 1, 9995, 13, 9006, 29889, 1867, 877, 3258, 6435, 29896, 29901, 29873, 29946, 29880, 1118, 6435, 29906, 29901, 29896, 29880, 29893, 29929, 3400, 1495, 13, 15945, 29908, 13, 9006, 29889, 1867, 877, 3258, 260, 29946, 29880, 29892, 29871, 29896, 29880, 29893, 29929, 29936, 1495, 13, 13, 29937, 12953, 29901, 29871, 18733, 5926, 1203, 29889, 13, 29937, 7562, 29901, 29871, 2058, 11439, 13, 13, 2 ]
molecool/io/__init__.py
aatishpr/molecool
0
166691
""" IO sub-package """ from .pdb import open_pdb from .xyz import open_xyz, write_xyz
[ 1, 9995, 13, 5971, 1014, 29899, 5113, 13, 15945, 29908, 13, 13, 3166, 869, 29886, 2585, 1053, 1722, 29918, 29886, 2585, 13, 3166, 869, 20230, 1053, 1722, 29918, 20230, 29892, 2436, 29918, 20230, 13, 2 ]
ppq/IR/quantize.py
openppl-public/ppq
100
90660
<reponame>openppl-public/ppq from typing import Any, List, Tuple from ppq.core import (OperationQuantizationConfig, QuantizationStates, TargetPlatform, TensorQuantizationConfig, convert_any_to_torch_tensor) from ppq.quantization.qfunction import BaseQuantFunction from .base.command import (GraphCommand, GraphCommandType, QuantizeOperationCommand, ReplaceOperationCommand, ReplaceVariableCommand) from .base.graph import Operation, Variable from .processer import GraphCommandProcessor class QuantableOperation(Operation): def __init__( self, convert_from: Operation, quantize_config: OperationQuantizationConfig, platform: TargetPlatform ): # Simply copy all attributes from fp32 operation # inputs, outputs will be created by QuantableGraph super().__init__( op_type = convert_from.type, inputs = convert_from.inputs.copy(), outputs = convert_from.outputs.copy(), attributes = convert_from.attributes, name = convert_from.name, platform = platform ) self._config = quantize_config # meta data is a crucial attribute for quantization self._meta = convert_from.meta_data self._dequantized = False @ property def config(self) -> OperationQuantizationConfig: return self._config @ config.setter def set_config(self, config): """we will update variable's during this function. Args: config ([type]): [description] Raises: TypeError: [description] ExecError: [description] Returns: [type]: [description] """ if not isinstance(config, OperationQuantizationConfig): raise TypeError(f'object {str(config)}({type(config)}) is not a acceptable config for operation {self.name}') self._config = config def baking_parameters(self, quant_func: BaseQuantFunction): for config, var in self.config_with_variable: if var.is_parameter and config.state in {QuantizationStates.ACTIVATED, QuantizationStates.PASSIVE}: assert isinstance(var, QuantableVariable) assert len(var.dest_ops) == 1, f', Parameter {var.name} has {len(var.dest_ops)} destinations, '\ 'Baking parameter that has more than 1 destinations will incur unexpected problems, '\ 'PPQ does not support parameters with more than 1 related operation, reform your graph first.' var.value = quant_func(var.value, config) if config.state == QuantizationStates.ACTIVATED: config.state = QuantizationStates.BAKED if config.state == QuantizationStates.PASSIVE: config.state = QuantizationStates.PASSIVE_BAKED return self def store_parameter_value(self): for var, _ in zip(self.inputs + self.outputs, self.config.input_quantization_config + self.config.output_quantization_config): if var.is_parameter: assert isinstance(var, QuantableVariable), 'Unexpected error.' # convert var.value to torch.Tensor # notice here we set device = None, this conversion will not change var.value.device anyway. # so that we can use var.value.device as a deploy device for stored_value var.stored_value = convert_any_to_torch_tensor(var.value, device='cpu') return self def dequantize(self, parameter_only: bool = False, expire_device: str = 'cpu'): if self._dequantized: return self for var, quant_config in zip(self.inputs + self.outputs, self.config.input_quantization_config + self.config.output_quantization_config): if parameter_only and not var.is_parameter: continue quant_config.detail['Stored State'] = quant_config.state assert isinstance(var, QuantableVariable), f'Unexpected error with variable {var.name}.' if var.is_parameter: # convert var.value to torch.Tensor # notice here we set device = None, this conversion will not change var.value.device anyway. # so that we can use var.value.device as a deploy device for stored_value stored_value = convert_any_to_torch_tensor(var.value, device=expire_device) var.value = convert_any_to_torch_tensor(var.value, device=None) var.value = convert_any_to_torch_tensor(var.stored_value, device=var.value.device) var.stored_value = stored_value quant_config.state = QuantizationStates.DEQUANTIZED self._dequantized = True return self def restore_quantize_state(self, expire_device: str = 'cpu'): if not self._dequantized: return self for var, quant_config in zip(self.inputs + self.outputs, self.config.input_quantization_config + self.config.output_quantization_config): if 'Stored State' in quant_config.detail: quant_config.state = quant_config.detail['Stored State'] quant_config.detail.pop('Stored State') if var.is_parameter: assert isinstance(var, QuantableVariable), 'Unexpected error.' # convert var.value to torch.Tensor # notice here we set device = None, this conversion will not change var.value.device anyway. # so that we can use var.value.device as a deploy device for stored_value stored_value = convert_any_to_torch_tensor(var.value, device=expire_device) var.value = convert_any_to_torch_tensor(var.value, device=None) var.value = convert_any_to_torch_tensor(var.stored_value, device=var.value.device) var.stored_value = stored_value self._dequantized = False return self @ property def config_with_variable(self) -> List[Tuple[TensorQuantizationConfig, Variable]]: """Just a helper function, This function will list all related config and variable with current operation. Returns: List[Tuple[TensorQuantizationConfig, Variable]]: [description] """ ret = [] for cfg, var in zip(self.config.input_quantization_config, self.inputs): ret.append((cfg, var)) for cfg, var in zip(self.config.output_quantization_config, self.outputs): ret.append((cfg, var)) return ret class QuantableVariable(Variable): def __init__(self, convert_from: Variable) -> None: super().__init__( name = convert_from.name, dest_ops = convert_from.dest_ops.copy(), source_op = convert_from.source_op, value = convert_from.value, is_parameter = convert_from.is_parameter) self._fp32_value = None if convert_from.value is not None: self._fp32_value = convert_any_to_torch_tensor(convert_from.value, device='cpu') @ property def stored_value(self) -> Any: return self._fp32_value @ stored_value.setter def stored_value(self, value: Any): self._fp32_value = value @ property def dest_op_configs(self) -> List[TensorQuantizationConfig]: _dest_op_configs, _dest_idx = [], self.dest_idx for idx, op in enumerate(self.dest_ops): if isinstance(op, QuantableOperation): _dest_op_configs.append(op.config.input_quantization_config[_dest_idx[idx]]) else: _dest_op_configs.append(None) return _dest_op_configs @ property def dest_op_platfroms(self) -> List[TargetPlatform]: _dest_op_platforms = [] for op in self.dest_ops: if op is not None: _dest_op_platforms.append(op.platform) else: _dest_op_platforms.append(TargetPlatform.FP32) return _dest_op_platforms @ property def source_op_config(self) -> TensorQuantizationConfig: if self.source_op is not None: if isinstance(self.source_op, QuantableOperation): return self.source_op.config.output_quantization_config[self.src_idx] else: return None return None @ property def source_op_platform(self) -> TargetPlatform: if self.source_op is None: return TargetPlatform.FP32 else: return self.source_op.platform class DeviceSwitchOP(Operation): """DeviceSwitch is a PPQ internal operation. This operation is inserted at platfrom's boundary for transferring data between devices. Args: Operation ([type]): [description] """ def __init__(self, name: str, inputs: List[Variable] = None, outputs: List[Variable] = None) -> None: super().__init__( attributes={}, name=name, op_type='PPQDeviceSwitch', platform=TargetPlatform.UNSPECIFIED, inputs=inputs, outputs=outputs) class QuantableGraph(GraphCommandProcessor): def process(self, command: GraphCommand) -> Any: if command.command_type == GraphCommandType.QUANTIZE_OPERATION: assert isinstance(command, QuantizeOperationCommand) return self.quantize_operation( command.op_name, command.target_platform, command.config) def _acceptable_command_types(self) -> List[GraphCommandType]: return [ GraphCommandType.QUANTIZE_OPERATION, ] def quantize_operation( self, operation_name: str, target_platform: TargetPlatform, quantization_config: OperationQuantizationConfig ) -> QuantableOperation: if operation_name not in self.graph.operations: raise KeyError(f'Operation {operation_name} is not in your graph, Please check your input.') if not TargetPlatform.is_quantized_platform(target_platform): raise ValueError( f'You are trying to quantize a operation({operation_name})'\ f' to target platform {target_platform}, however it is an non-quantized platform.') operation = self._graph.operations[operation_name] quantized_operation = QuantableOperation( convert_from=operation, quantize_config=quantization_config, platform=target_platform, ) # calling other chain responder to replace operation with quantized one. if self._next_command_processor is None: raise RuntimeError( 'To replace a operation, your processor chain must have a GraphMorpher Processor.') self._next_command_processor(ReplaceOperationCommand(operation_name, quantized_operation)) # replace all related variable with quantable one. for var in quantized_operation.inputs + quantized_operation.outputs: if isinstance(var, QuantableVariable): continue self._next_command_processor( ReplaceVariableCommand( var_name=var.name, replace_to=QuantableVariable(convert_from=var) ) ) quantized_operation.store_parameter_value() def dequantize_operation( self, operation_name: str ) -> Operation: if operation_name not in self.graph.operations: raise KeyError(f'Operation {operation_name} is not in your graph, Please check your input.') operation = self._graph.operations[operation_name] if not isinstance(operation, QuantableOperation): return operation else: return operation.dequantize() def dequantize_graph(self): """一个方便懒人的函数.""" for operation in self.graph.operations.values(): if isinstance(operation, QuantableOperation): operation.dequantize() def restore_quantize_state(self): """一个方便懒人的函数.""" for operation in self.graph.operations.values(): if isinstance(operation, QuantableOperation): operation.restore_quantize_state()
[ 1, 529, 276, 1112, 420, 29958, 3150, 407, 29880, 29899, 3597, 29914, 407, 29939, 13, 3166, 19229, 1053, 3139, 29892, 2391, 29892, 12603, 552, 13, 13, 3166, 6499, 29939, 29889, 3221, 1053, 313, 10925, 22930, 2133, 3991, 29892, 22746, 2133, 855, 1078, 29892, 13, 462, 418, 17157, 21889, 29892, 323, 6073, 22930, 2133, 3991, 29892, 13, 462, 418, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29897, 13, 3166, 6499, 29939, 29889, 12150, 2133, 29889, 29939, 2220, 1053, 7399, 22930, 6678, 13, 13, 3166, 869, 3188, 29889, 6519, 1053, 313, 9527, 6255, 29892, 12367, 6255, 1542, 29892, 13, 462, 965, 22746, 675, 10925, 6255, 29892, 22108, 10925, 6255, 29892, 13, 462, 965, 22108, 16174, 6255, 29897, 13, 3166, 869, 3188, 29889, 4262, 1053, 20462, 29892, 28736, 13, 3166, 869, 5014, 261, 1053, 12367, 6255, 18689, 13, 13, 13, 1990, 22746, 519, 10925, 29898, 10925, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 3588, 29918, 3166, 29901, 20462, 29892, 13, 4706, 4323, 675, 29918, 2917, 29901, 20462, 22930, 2133, 3991, 29892, 13, 4706, 7481, 29901, 17157, 21889, 13, 268, 1125, 13, 13, 4706, 396, 3439, 17632, 3509, 599, 8393, 515, 285, 29886, 29941, 29906, 5858, 13, 4706, 396, 10970, 29892, 14391, 674, 367, 2825, 491, 22746, 519, 9527, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1015, 29918, 1853, 418, 353, 3588, 29918, 3166, 29889, 1853, 29892, 13, 9651, 10970, 539, 353, 3588, 29918, 3166, 29889, 2080, 29879, 29889, 8552, 3285, 13, 9651, 14391, 418, 353, 3588, 29918, 3166, 29889, 4905, 29879, 29889, 8552, 3285, 13, 9651, 8393, 259, 353, 3588, 29918, 3166, 29889, 15697, 29892, 13, 9651, 1024, 308, 353, 3588, 29918, 3166, 29889, 978, 29892, 13, 9651, 7481, 268, 353, 7481, 13, 4706, 1723, 13, 13, 4706, 1583, 3032, 2917, 9651, 353, 4323, 675, 29918, 2917, 13, 4706, 396, 12700, 848, 338, 263, 7618, 1455, 5352, 363, 4323, 2133, 13, 4706, 1583, 3032, 7299, 795, 353, 3588, 29918, 3166, 29889, 7299, 29918, 1272, 13, 4706, 1583, 3032, 311, 12150, 1891, 539, 353, 7700, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2295, 29898, 1311, 29897, 1599, 20462, 22930, 2133, 3991, 29901, 13, 4706, 736, 1583, 3032, 2917, 13, 13, 1678, 732, 2295, 29889, 842, 357, 13, 1678, 822, 731, 29918, 2917, 29898, 1311, 29892, 2295, 1125, 13, 4706, 9995, 705, 674, 2767, 2286, 29915, 29879, 2645, 445, 740, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2295, 9310, 1853, 29962, 1125, 518, 8216, 29962, 13, 13, 4706, 390, 1759, 267, 29901, 13, 9651, 20948, 29901, 518, 8216, 29962, 13, 9651, 11080, 2392, 29901, 518, 8216, 29962, 13, 13, 4706, 16969, 29901, 13, 9651, 518, 1853, 5387, 518, 8216, 29962, 13, 4706, 9995, 13, 4706, 565, 451, 338, 8758, 29898, 2917, 29892, 20462, 22930, 2133, 3991, 1125, 13, 9651, 12020, 20948, 29898, 29888, 29915, 3318, 426, 710, 29898, 2917, 22302, 29912, 1853, 29898, 2917, 26972, 338, 451, 263, 22691, 2295, 363, 5858, 426, 1311, 29889, 978, 29913, 1495, 13, 4706, 1583, 3032, 2917, 353, 2295, 13, 13, 1678, 822, 289, 5086, 29918, 16744, 29898, 1311, 29892, 4323, 29918, 9891, 29901, 7399, 22930, 6678, 1125, 13, 4706, 363, 2295, 29892, 722, 297, 1583, 29889, 2917, 29918, 2541, 29918, 11918, 29901, 13, 9651, 565, 722, 29889, 275, 29918, 15501, 322, 2295, 29889, 3859, 297, 426, 22930, 2133, 855, 1078, 29889, 17923, 5667, 3040, 29928, 29892, 22746, 2133, 855, 1078, 29889, 25711, 18474, 6177, 13, 18884, 4974, 338, 8758, 29898, 1707, 29892, 22746, 519, 16174, 29897, 13, 18884, 4974, 7431, 29898, 1707, 29889, 7854, 29918, 3554, 29897, 1275, 29871, 29896, 29892, 285, 742, 24953, 426, 1707, 29889, 978, 29913, 756, 426, 2435, 29898, 1707, 29889, 7854, 29918, 3554, 2915, 15422, 800, 29892, 11297, 13, 462, 1678, 525, 29933, 5086, 3443, 393, 756, 901, 1135, 29871, 29896, 15422, 800, 674, 297, 2764, 15668, 4828, 29892, 11297, 13, 462, 1678, 525, 18009, 29984, 947, 451, 2304, 4128, 411, 901, 1135, 29871, 29896, 4475, 5858, 29892, 11736, 596, 3983, 937, 6169, 13, 18884, 722, 29889, 1767, 353, 4323, 29918, 9891, 29898, 1707, 29889, 1767, 29892, 2295, 29897, 13, 13, 18884, 565, 2295, 29889, 3859, 1275, 22746, 2133, 855, 1078, 29889, 17923, 5667, 3040, 29928, 29901, 13, 462, 1678, 2295, 29889, 3859, 353, 22746, 2133, 855, 1078, 29889, 5688, 29968, 3352, 13, 18884, 565, 2295, 29889, 3859, 1275, 22746, 2133, 855, 1078, 29889, 25711, 18474, 29901, 13, 462, 1678, 2295, 29889, 3859, 353, 22746, 2133, 855, 1078, 29889, 25711, 18474, 29918, 5688, 29968, 3352, 13, 4706, 736, 1583, 13, 13, 1678, 822, 3787, 29918, 15501, 29918, 1767, 29898, 1311, 1125, 13, 4706, 363, 722, 29892, 903, 297, 14319, 29898, 1311, 29889, 2080, 29879, 718, 1583, 29889, 4905, 29879, 29892, 13, 9651, 1583, 29889, 2917, 29889, 2080, 29918, 12150, 2133, 29918, 2917, 718, 1583, 29889, 2917, 29889, 4905, 29918, 12150, 2133, 29918, 2917, 1125, 13, 9651, 565, 722, 29889, 275, 29918, 15501, 29901, 13, 18884, 4974, 338, 8758, 29898, 1707, 29892, 22746, 519, 16174, 511, 525, 29965, 13996, 6021, 1059, 6169, 13, 18884, 396, 3588, 722, 29889, 1767, 304, 4842, 305, 29889, 29911, 6073, 13, 18884, 396, 8369, 1244, 591, 731, 4742, 353, 6213, 29892, 445, 11301, 674, 451, 1735, 722, 29889, 1767, 29889, 10141, 8763, 29889, 13, 18884, 396, 577, 393, 591, 508, 671, 722, 29889, 1767, 29889, 10141, 408, 263, 7246, 4742, 363, 6087, 29918, 1767, 13, 18884, 722, 29889, 303, 4395, 29918, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 1767, 29892, 4742, 2433, 21970, 1495, 13, 4706, 736, 1583, 13, 13, 1678, 822, 316, 12150, 675, 29898, 1311, 29892, 3443, 29918, 6194, 29901, 6120, 353, 7700, 29892, 1518, 533, 29918, 10141, 29901, 851, 353, 525, 21970, 29374, 13, 4706, 565, 1583, 3032, 311, 12150, 1891, 29901, 736, 1583, 13, 4706, 363, 722, 29892, 4323, 29918, 2917, 297, 14319, 29898, 1311, 29889, 2080, 29879, 718, 1583, 29889, 4905, 29879, 29892, 13, 9651, 1583, 29889, 2917, 29889, 2080, 29918, 12150, 2133, 29918, 2917, 718, 1583, 29889, 2917, 29889, 4905, 29918, 12150, 2133, 29918, 2917, 1125, 13, 9651, 565, 3443, 29918, 6194, 322, 451, 722, 29889, 275, 29918, 15501, 29901, 6773, 13, 9651, 4323, 29918, 2917, 29889, 16432, 1839, 855, 4395, 4306, 2033, 353, 4323, 29918, 2917, 29889, 3859, 13, 9651, 4974, 338, 8758, 29898, 1707, 29892, 22746, 519, 16174, 511, 285, 29915, 29965, 13996, 6021, 1059, 411, 2286, 426, 1707, 29889, 978, 1836, 29915, 13, 9651, 565, 722, 29889, 275, 29918, 15501, 29901, 13, 18884, 396, 3588, 722, 29889, 1767, 304, 4842, 305, 29889, 29911, 6073, 13, 18884, 396, 8369, 1244, 591, 731, 4742, 353, 6213, 29892, 445, 11301, 674, 451, 1735, 722, 29889, 1767, 29889, 10141, 8763, 29889, 13, 18884, 396, 577, 393, 591, 508, 671, 722, 29889, 1767, 29889, 10141, 408, 263, 7246, 4742, 363, 6087, 29918, 1767, 13, 18884, 6087, 29918, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 1767, 29892, 4742, 29922, 4548, 533, 29918, 10141, 29897, 13, 18884, 722, 29889, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 1767, 29892, 4742, 29922, 8516, 29897, 13, 18884, 722, 29889, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 303, 4395, 29918, 1767, 29892, 4742, 29922, 1707, 29889, 1767, 29889, 10141, 29897, 13, 18884, 722, 29889, 303, 4395, 29918, 1767, 353, 6087, 29918, 1767, 13, 9651, 4323, 29918, 2917, 29889, 3859, 353, 22746, 2133, 855, 1078, 29889, 2287, 13356, 13566, 26664, 3352, 13, 4706, 1583, 3032, 311, 12150, 1891, 353, 5852, 13, 4706, 736, 1583, 13, 13, 1678, 822, 17749, 29918, 12150, 675, 29918, 3859, 29898, 1311, 29892, 1518, 533, 29918, 10141, 29901, 851, 353, 525, 21970, 29374, 13, 4706, 565, 451, 1583, 3032, 311, 12150, 1891, 29901, 736, 1583, 13, 4706, 363, 722, 29892, 4323, 29918, 2917, 297, 14319, 29898, 1311, 29889, 2080, 29879, 718, 1583, 29889, 4905, 29879, 29892, 13, 9651, 1583, 29889, 2917, 29889, 2080, 29918, 12150, 2133, 29918, 2917, 718, 1583, 29889, 2917, 29889, 4905, 29918, 12150, 2133, 29918, 2917, 1125, 13, 9651, 565, 525, 855, 4395, 4306, 29915, 297, 4323, 29918, 2917, 29889, 16432, 29901, 13, 18884, 4323, 29918, 2917, 29889, 3859, 353, 4323, 29918, 2917, 29889, 16432, 1839, 855, 4395, 4306, 2033, 13, 18884, 4323, 29918, 2917, 29889, 16432, 29889, 7323, 877, 855, 4395, 4306, 1495, 13, 18884, 565, 722, 29889, 275, 29918, 15501, 29901, 13, 462, 1678, 4974, 338, 8758, 29898, 1707, 29892, 22746, 519, 16174, 511, 525, 29965, 13996, 6021, 1059, 6169, 13, 462, 1678, 396, 3588, 722, 29889, 1767, 304, 4842, 305, 29889, 29911, 6073, 13, 462, 1678, 396, 8369, 1244, 591, 731, 4742, 353, 6213, 29892, 445, 11301, 674, 451, 1735, 722, 29889, 1767, 29889, 10141, 8763, 29889, 13, 462, 1678, 396, 577, 393, 591, 508, 671, 722, 29889, 1767, 29889, 10141, 408, 263, 7246, 4742, 363, 6087, 29918, 1767, 13, 462, 1678, 6087, 29918, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 1767, 29892, 4742, 29922, 4548, 533, 29918, 10141, 29897, 13, 462, 1678, 722, 29889, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 1767, 29892, 4742, 29922, 8516, 29897, 13, 462, 1678, 722, 29889, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 1707, 29889, 303, 4395, 29918, 1767, 29892, 4742, 29922, 1707, 29889, 1767, 29889, 10141, 29897, 13, 462, 1678, 722, 29889, 303, 4395, 29918, 1767, 353, 6087, 29918, 1767, 13, 4706, 1583, 3032, 311, 12150, 1891, 353, 7700, 13, 4706, 736, 1583, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2295, 29918, 2541, 29918, 11918, 29898, 1311, 29897, 1599, 2391, 29961, 23215, 552, 29961, 29911, 6073, 22930, 2133, 3991, 29892, 28736, 5262, 29901, 13, 4706, 9995, 14084, 263, 16876, 740, 29892, 910, 740, 674, 1051, 599, 4475, 2295, 13, 4706, 322, 2286, 411, 1857, 5858, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 2391, 29961, 23215, 552, 29961, 29911, 6073, 22930, 2133, 3991, 29892, 28736, 5262, 29901, 518, 8216, 29962, 13, 4706, 9995, 13, 4706, 3240, 353, 5159, 13, 4706, 363, 274, 16434, 29892, 722, 297, 14319, 29898, 1311, 29889, 2917, 29889, 2080, 29918, 12150, 2133, 29918, 2917, 29892, 1583, 29889, 2080, 29879, 1125, 13, 9651, 3240, 29889, 4397, 3552, 16859, 29892, 722, 876, 13, 4706, 363, 274, 16434, 29892, 722, 297, 14319, 29898, 1311, 29889, 2917, 29889, 4905, 29918, 12150, 2133, 29918, 2917, 29892, 1583, 29889, 4905, 29879, 1125, 13, 9651, 3240, 29889, 4397, 3552, 16859, 29892, 722, 876, 13, 4706, 736, 3240, 13, 13, 13, 1990, 22746, 519, 16174, 29898, 16174, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3588, 29918, 3166, 29901, 28736, 29897, 1599, 6213, 29901, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 1024, 418, 353, 3588, 29918, 3166, 29889, 978, 29892, 13, 9651, 2731, 29918, 3554, 29871, 353, 3588, 29918, 3166, 29889, 7854, 29918, 3554, 29889, 8552, 3285, 13, 9651, 2752, 29918, 459, 353, 3588, 29918, 3166, 29889, 4993, 29918, 459, 29892, 13, 9651, 995, 268, 353, 3588, 29918, 3166, 29889, 1767, 29892, 13, 9651, 338, 29918, 15501, 353, 3588, 29918, 3166, 29889, 275, 29918, 15501, 29897, 13, 4706, 1583, 3032, 18091, 29941, 29906, 29918, 1767, 353, 6213, 13, 4706, 565, 3588, 29918, 3166, 29889, 1767, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 18091, 29941, 29906, 29918, 1767, 353, 3588, 29918, 1384, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 13441, 29918, 3166, 29889, 1767, 29892, 4742, 2433, 21970, 1495, 13, 13, 1678, 732, 2875, 13, 1678, 822, 6087, 29918, 1767, 29898, 1311, 29897, 1599, 3139, 29901, 13, 4706, 736, 1583, 3032, 18091, 29941, 29906, 29918, 1767, 13, 13, 1678, 732, 6087, 29918, 1767, 29889, 842, 357, 13, 1678, 822, 6087, 29918, 1767, 29898, 1311, 29892, 995, 29901, 3139, 1125, 13, 4706, 1583, 3032, 18091, 29941, 29906, 29918, 1767, 353, 995, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2731, 29918, 459, 29918, 2917, 29879, 29898, 1311, 29897, 1599, 2391, 29961, 29911, 6073, 22930, 2133, 3991, 5387, 13, 4706, 903, 7854, 29918, 459, 29918, 2917, 29879, 29892, 903, 7854, 29918, 13140, 353, 19997, 1583, 29889, 7854, 29918, 13140, 13, 4706, 363, 22645, 29892, 1015, 297, 26985, 29898, 1311, 29889, 7854, 29918, 3554, 1125, 13, 9651, 565, 338, 8758, 29898, 459, 29892, 22746, 519, 10925, 1125, 13, 18884, 903, 7854, 29918, 459, 29918, 2917, 29879, 29889, 4397, 29898, 459, 29889, 2917, 29889, 2080, 29918, 12150, 2133, 29918, 2917, 28513, 7854, 29918, 13140, 29961, 13140, 24960, 13, 9651, 1683, 29901, 903, 7854, 29918, 459, 29918, 2917, 29879, 29889, 4397, 29898, 8516, 29897, 13, 4706, 736, 903, 7854, 29918, 459, 29918, 2917, 29879, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2731, 29918, 459, 29918, 572, 271, 3166, 29879, 29898, 1311, 29897, 1599, 2391, 29961, 8667, 21889, 5387, 13, 4706, 903, 7854, 29918, 459, 29918, 12120, 29879, 353, 5159, 13, 4706, 363, 1015, 297, 1583, 29889, 7854, 29918, 3554, 29901, 13, 9651, 565, 1015, 338, 451, 6213, 29901, 13, 18884, 903, 7854, 29918, 459, 29918, 12120, 29879, 29889, 4397, 29898, 459, 29889, 12120, 29897, 13, 9651, 1683, 29901, 903, 7854, 29918, 459, 29918, 12120, 29879, 29889, 4397, 29898, 8667, 21889, 29889, 26353, 29941, 29906, 29897, 13, 4706, 736, 903, 7854, 29918, 459, 29918, 12120, 29879, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2752, 29918, 459, 29918, 2917, 29898, 1311, 29897, 1599, 323, 6073, 22930, 2133, 3991, 29901, 13, 4706, 565, 1583, 29889, 4993, 29918, 459, 338, 451, 6213, 29901, 13, 9651, 565, 338, 8758, 29898, 1311, 29889, 4993, 29918, 459, 29892, 22746, 519, 10925, 1125, 13, 18884, 736, 1583, 29889, 4993, 29918, 459, 29889, 2917, 29889, 4905, 29918, 12150, 2133, 29918, 2917, 29961, 1311, 29889, 4351, 29918, 13140, 29962, 13, 9651, 1683, 29901, 736, 6213, 13, 4706, 736, 6213, 13, 13, 1678, 732, 2875, 13, 1678, 822, 2752, 29918, 459, 29918, 12120, 29898, 1311, 29897, 1599, 17157, 21889, 29901, 13, 4706, 565, 1583, 29889, 4993, 29918, 459, 338, 6213, 29901, 13, 9651, 736, 17157, 21889, 29889, 26353, 29941, 29906, 13, 4706, 1683, 29901, 736, 1583, 29889, 4993, 29918, 459, 29889, 12120, 13, 13, 13, 1990, 21830, 24995, 4590, 29898, 10925, 1125, 13, 1678, 9995, 11501, 24995, 338, 263, 349, 29925, 29984, 7463, 5858, 29889, 910, 5858, 338, 15478, 472, 13, 1678, 18870, 3166, 29915, 29879, 10452, 363, 6782, 5393, 848, 1546, 9224, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 20462, 9310, 1853, 29962, 1125, 518, 8216, 29962, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29901, 851, 29892, 13, 462, 10970, 29901, 2391, 29961, 16174, 29962, 353, 6213, 29892, 13, 462, 14391, 29901, 2391, 29961, 16174, 29962, 353, 6213, 29897, 1599, 6213, 29901, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 8393, 3790, 1118, 13, 9651, 1024, 29922, 978, 29892, 1015, 29918, 1853, 2433, 18009, 29984, 11501, 24995, 742, 13, 9651, 7481, 29922, 8667, 21889, 29889, 29965, 3059, 4162, 8426, 3738, 3352, 29892, 13, 9651, 10970, 29922, 2080, 29879, 29892, 14391, 29922, 4905, 29879, 29897, 13, 13, 13, 1990, 22746, 519, 9527, 29898, 9527, 6255, 18689, 1125, 13, 1678, 822, 1889, 29898, 1311, 29892, 1899, 29901, 12367, 6255, 29897, 1599, 3139, 29901, 13, 4706, 565, 1899, 29889, 6519, 29918, 1853, 1275, 12367, 6255, 1542, 29889, 13356, 13566, 29902, 10721, 29918, 4590, 1001, 8098, 29901, 13, 9651, 4974, 338, 8758, 29898, 6519, 29892, 22746, 675, 10925, 6255, 29897, 13, 9651, 736, 1583, 29889, 12150, 675, 29918, 16453, 29898, 13, 18884, 1899, 29889, 459, 29918, 978, 29892, 1899, 29889, 5182, 29918, 12120, 29892, 1899, 29889, 2917, 29897, 13, 13, 1678, 822, 903, 16044, 519, 29918, 6519, 29918, 8768, 29898, 1311, 29897, 1599, 2391, 29961, 9527, 6255, 1542, 5387, 13, 4706, 736, 518, 13, 9651, 12367, 6255, 1542, 29889, 13356, 13566, 29902, 10721, 29918, 4590, 1001, 8098, 29892, 13, 4706, 4514, 13, 13, 1678, 822, 4323, 675, 29918, 16453, 29898, 13, 4706, 1583, 29892, 13, 4706, 5858, 29918, 978, 29901, 851, 29892, 13, 4706, 3646, 29918, 12120, 29901, 17157, 21889, 29892, 13, 4706, 4323, 2133, 29918, 2917, 29901, 20462, 22930, 2133, 3991, 13, 1678, 1723, 1599, 22746, 519, 10925, 29901, 13, 4706, 565, 5858, 29918, 978, 451, 297, 1583, 29889, 4262, 29889, 3372, 800, 29901, 13, 9651, 12020, 7670, 2392, 29898, 29888, 29915, 10925, 426, 16453, 29918, 978, 29913, 338, 451, 297, 596, 3983, 29892, 3529, 1423, 596, 1881, 29889, 1495, 13, 13, 4706, 565, 451, 17157, 21889, 29889, 275, 29918, 12150, 1891, 29918, 12120, 29898, 5182, 29918, 12120, 1125, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 285, 29915, 3492, 526, 1811, 304, 4323, 675, 263, 5858, 3319, 16453, 29918, 978, 1800, 12764, 13, 18884, 285, 29915, 304, 3646, 7481, 426, 5182, 29918, 12120, 1118, 3138, 372, 338, 385, 1661, 29899, 12150, 1891, 7481, 29889, 1495, 13, 13, 4706, 5858, 353, 1583, 3032, 4262, 29889, 3372, 800, 29961, 16453, 29918, 978, 29962, 13, 13, 4706, 4323, 1891, 29918, 16453, 353, 22746, 519, 10925, 29898, 13, 9651, 3588, 29918, 3166, 29922, 16453, 29892, 13, 9651, 4323, 675, 29918, 2917, 29922, 12150, 2133, 29918, 2917, 29892, 13, 9651, 7481, 29922, 5182, 29918, 12120, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 5432, 916, 9704, 620, 27582, 304, 5191, 5858, 411, 4323, 1891, 697, 29889, 13, 4706, 565, 1583, 3032, 4622, 29918, 6519, 29918, 26482, 338, 6213, 29901, 13, 9651, 12020, 24875, 2392, 29898, 13, 18884, 525, 1762, 5191, 263, 5858, 29892, 596, 21433, 9704, 1818, 505, 263, 12367, 29924, 5676, 261, 10554, 272, 29889, 1495, 13, 4706, 1583, 3032, 4622, 29918, 6519, 29918, 26482, 29898, 20083, 10925, 6255, 29898, 16453, 29918, 978, 29892, 4323, 1891, 29918, 16453, 876, 13, 13, 4706, 396, 5191, 599, 4475, 2286, 411, 4323, 519, 697, 29889, 13, 4706, 363, 722, 297, 4323, 1891, 29918, 16453, 29889, 2080, 29879, 718, 4323, 1891, 29918, 16453, 29889, 4905, 29879, 29901, 13, 9651, 565, 338, 8758, 29898, 1707, 29892, 22746, 519, 16174, 1125, 6773, 13, 9651, 1583, 3032, 4622, 29918, 6519, 29918, 26482, 29898, 13, 18884, 22108, 16174, 6255, 29898, 13, 462, 1678, 722, 29918, 978, 29922, 1707, 29889, 978, 29892, 13, 462, 1678, 5191, 29918, 517, 29922, 22930, 519, 16174, 29898, 13441, 29918, 3166, 29922, 1707, 29897, 13, 18884, 1723, 13, 9651, 1723, 13, 4706, 4323, 1891, 29918, 16453, 29889, 8899, 29918, 15501, 29918, 1767, 580, 13, 13, 1678, 822, 316, 12150, 675, 29918, 16453, 29898, 13, 4706, 1583, 29892, 13, 4706, 5858, 29918, 978, 29901, 851, 13, 1678, 1723, 1599, 20462, 29901, 13, 4706, 565, 5858, 29918, 978, 451, 297, 1583, 29889, 4262, 29889, 3372, 800, 29901, 13, 9651, 12020, 7670, 2392, 29898, 29888, 29915, 10925, 426, 16453, 29918, 978, 29913, 338, 451, 297, 596, 3983, 29892, 3529, 1423, 596, 1881, 29889, 1495, 13, 4706, 5858, 353, 1583, 3032, 4262, 29889, 3372, 800, 29961, 16453, 29918, 978, 29962, 13, 4706, 565, 451, 338, 8758, 29898, 16453, 29892, 22746, 519, 10925, 1125, 736, 5858, 13, 4706, 1683, 29901, 736, 5858, 29889, 311, 12150, 675, 580, 13, 13, 1678, 822, 316, 12150, 675, 29918, 4262, 29898, 1311, 1125, 13, 4706, 9995, 30287, 30502, 30525, 231, 193, 194, 233, 138, 149, 30313, 30210, 31629, 30354, 1213, 15945, 13, 4706, 363, 5858, 297, 1583, 29889, 4262, 29889, 3372, 800, 29889, 5975, 7295, 13, 9651, 565, 338, 8758, 29898, 16453, 29892, 22746, 519, 10925, 1125, 13, 18884, 5858, 29889, 311, 12150, 675, 580, 13, 13, 1678, 822, 17749, 29918, 12150, 675, 29918, 3859, 29898, 1311, 1125, 13, 4706, 9995, 30287, 30502, 30525, 231, 193, 194, 233, 138, 149, 30313, 30210, 31629, 30354, 1213, 15945, 13, 4706, 363, 5858, 297, 1583, 29889, 4262, 29889, 3372, 800, 29889, 5975, 7295, 13, 9651, 565, 338, 8758, 29898, 16453, 29892, 22746, 519, 10925, 1125, 13, 18884, 5858, 29889, 5060, 487, 29918, 12150, 675, 29918, 3859, 580, 13, 2 ]
src/access.py
zimingd/packer-rstudio
0
37398
#!/usr/bin/env python3 import jwt import requests import base64 import json import boto3 import time import functools import os from mod_python import apache region = json.loads(requests.get('http://169.254.169.254/latest/dynamic/instance-identity/document').text)['region'] ssm_parameter_name_env_var = 'SYNAPSE_TOKEN_AWS_SSM_PARAMETER_NAME' kms_alias_env_var = 'KMS_KEY_ALIAS' def headerparserhandler(req): jwt_str = req.headers_in['x-amzn-oidc-data'] #proxy.conf ensures this header exists try: payload = jwt_payload(jwt_str) if payload['userid'] == approved_user() and payload['exp'] > time.time(): store_to_ssm(req.headers_in['x-amzn-oidc-accesstoken']) return apache.OK else: return apache.HTTP_UNAUTHORIZED #the userid claim does not match the userid tag except Exception: # if the JWT playload is invalid return apache.HTTP_UNAUTHORIZED def approved_user(): instance_id = requests.get('http://169.254.169.254/latest/meta-data/instance-id').text ec2 = boto3.resource('ec2',region) vm = ec2.Instance(instance_id) #TODO handle exception on multiple tags in this list for tags in vm.tags: if tags["Key"] == 'Protected/AccessApprovedCaller': approved_caller = tags["Value"] return approved_caller.split(':')[1] #return userid portion of tag # taking advantage of lru cache to avoid re-putting the same access token to # SSM Parameter Store. # According to functools source code, arguments (i.e. the access token) are hashed, # not stored as-is in memory @functools.lru_cache(maxsize=1) def store_to_ssm(access_token): parameter_name = os.environ.get(ssm_parameter_name_env_var) kms_key_alias = os.environ.get(kms_alias_env_var) if not (parameter_name): # just exit early if the parameter name to store in SSM is not found return ssm_client = boto3.client('ssm', region) kms_client = boto3.client('kms', region) key_id = kms_client.describe_key(KeyId=kms_key_alias)['KeyMetadata']['KeyId'] ssm_client.put_parameter( Name=parameter_name, Type='SecureString', Value=access_token, KeyId=key_id, Overwrite=True ) def jwt_payload(encoded_jwt): # The x-amzn-oid-data header is a base64-encoded JWT signed by the ALB # validating the signature of the JWT means the payload is authentic # per http://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html # Step 1: Get the key id from JWT headers (the kid field) #encoded_jwt = headers.dict['x-amzn-oidc-data'] jwt_headers = encoded_jwt.split('.')[0] decoded_jwt_headers = base64.b64decode(jwt_headers).decode("utf-8") decoded_json = json.loads(decoded_jwt_headers) kid = decoded_json['kid'] # Step 2: Get the public key from regional endpoint pub_key = get_aws_elb_public_key(region, kid) # Step 3: Get the payload return jwt.decode(encoded_jwt, pub_key, algorithms=['ES256']) @functools.lru_cache() def get_aws_elb_public_key(region, key_id): url = f'https://public-keys.auth.elb.{region}.amazonaws.com/{key_id}' return requests.get(url).text
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 432, 14554, 13, 5215, 7274, 13, 5215, 2967, 29953, 29946, 13, 5215, 4390, 13, 5215, 289, 3747, 29941, 13, 5215, 931, 13, 5215, 2090, 312, 8789, 13, 5215, 2897, 13, 13, 3166, 878, 29918, 4691, 1053, 12641, 13, 13, 12803, 353, 4390, 29889, 18132, 29898, 24830, 29889, 657, 877, 1124, 597, 29896, 29953, 29929, 29889, 29906, 29945, 29946, 29889, 29896, 29953, 29929, 29889, 29906, 29945, 29946, 29914, 12333, 29914, 16626, 29914, 8758, 29899, 22350, 29914, 3225, 2824, 726, 29897, 1839, 12803, 2033, 13, 893, 29885, 29918, 15501, 29918, 978, 29918, 6272, 29918, 1707, 353, 525, 14816, 29940, 3301, 1660, 29918, 4986, 29968, 1430, 29918, 29909, 7811, 29918, 1799, 29924, 29918, 16320, 25797, 4945, 29918, 5813, 29915, 13, 29895, 1516, 29918, 19973, 29918, 6272, 29918, 1707, 353, 525, 29968, 4345, 29918, 10818, 29918, 1964, 29902, 3289, 29915, 13, 13, 1753, 4839, 16680, 13789, 29898, 7971, 1125, 13, 29871, 432, 14554, 29918, 710, 353, 12428, 29889, 13662, 29918, 262, 1839, 29916, 29899, 314, 3749, 29899, 3398, 29883, 29899, 1272, 2033, 396, 14701, 29889, 5527, 5662, 1973, 445, 4839, 4864, 13, 13, 29871, 1018, 29901, 13, 1678, 20092, 353, 432, 14554, 29918, 23813, 29898, 29926, 14554, 29918, 710, 29897, 13, 13, 1678, 565, 20092, 1839, 1792, 333, 2033, 1275, 23454, 29918, 1792, 580, 322, 20092, 1839, 4548, 2033, 1405, 931, 29889, 2230, 7295, 13, 418, 3787, 29918, 517, 29918, 893, 29885, 29898, 7971, 29889, 13662, 29918, 262, 1839, 29916, 29899, 314, 3749, 29899, 3398, 29883, 29899, 562, 778, 303, 4476, 11287, 13, 418, 736, 12641, 29889, 8949, 13, 1678, 1683, 29901, 13, 418, 736, 12641, 29889, 10493, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 396, 1552, 1404, 333, 5995, 947, 451, 1993, 278, 1404, 333, 4055, 13, 29871, 5174, 8960, 29901, 13, 1678, 396, 565, 278, 435, 17755, 1708, 1359, 338, 8340, 13, 1678, 736, 12641, 29889, 10493, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 13, 1753, 23454, 29918, 1792, 7295, 13, 29871, 2777, 29918, 333, 353, 7274, 29889, 657, 877, 1124, 597, 29896, 29953, 29929, 29889, 29906, 29945, 29946, 29889, 29896, 29953, 29929, 29889, 29906, 29945, 29946, 29914, 12333, 29914, 7299, 29899, 1272, 29914, 8758, 29899, 333, 2824, 726, 13, 13, 29871, 21226, 29906, 353, 289, 3747, 29941, 29889, 10314, 877, 687, 29906, 742, 12803, 29897, 13, 29871, 22419, 353, 21226, 29906, 29889, 4998, 29898, 8758, 29918, 333, 29897, 13, 13, 29871, 396, 4986, 3970, 4386, 3682, 373, 2999, 8282, 297, 445, 1051, 13, 29871, 363, 8282, 297, 22419, 29889, 11338, 29901, 13, 1678, 565, 8282, 3366, 2558, 3108, 1275, 525, 1184, 371, 2954, 29914, 6638, 2052, 307, 1490, 5594, 261, 2396, 13, 418, 23454, 29918, 4804, 261, 353, 8282, 3366, 1917, 3108, 13, 13, 29871, 736, 23454, 29918, 4804, 261, 29889, 5451, 877, 29901, 29861, 29896, 29962, 396, 2457, 1404, 333, 11910, 310, 4055, 13, 13, 29937, 5622, 10631, 310, 301, 582, 7090, 304, 4772, 337, 29899, 649, 1259, 278, 1021, 2130, 5993, 304, 13, 29937, 5886, 29924, 24953, 14491, 29889, 13, 29937, 7579, 304, 2090, 312, 8789, 2752, 775, 29892, 6273, 313, 29875, 29889, 29872, 29889, 278, 2130, 5993, 29897, 526, 6608, 287, 29892, 13, 29937, 451, 6087, 408, 29899, 275, 297, 3370, 13, 29992, 7692, 312, 8789, 29889, 29880, 582, 29918, 8173, 29898, 3317, 2311, 29922, 29896, 29897, 13, 1753, 3787, 29918, 517, 29918, 893, 29885, 29898, 5943, 29918, 6979, 1125, 13, 29871, 3443, 29918, 978, 353, 2897, 29889, 21813, 29889, 657, 29898, 893, 29885, 29918, 15501, 29918, 978, 29918, 6272, 29918, 1707, 29897, 13, 29871, 413, 1516, 29918, 1989, 29918, 19973, 353, 2897, 29889, 21813, 29889, 657, 29898, 29895, 1516, 29918, 19973, 29918, 6272, 29918, 1707, 29897, 13, 29871, 565, 451, 313, 15501, 29918, 978, 1125, 13, 1678, 396, 925, 6876, 4688, 565, 278, 3443, 1024, 304, 3787, 297, 5886, 29924, 338, 451, 1476, 13, 1678, 736, 13, 13, 29871, 269, 3844, 29918, 4645, 353, 289, 3747, 29941, 29889, 4645, 877, 893, 29885, 742, 5120, 29897, 13, 29871, 413, 1516, 29918, 4645, 353, 289, 3747, 29941, 29889, 4645, 877, 29895, 1516, 742, 5120, 29897, 13, 29871, 1820, 29918, 333, 353, 413, 1516, 29918, 4645, 29889, 2783, 29581, 29918, 1989, 29898, 2558, 1204, 29922, 29895, 1516, 29918, 1989, 29918, 19973, 29897, 1839, 2558, 18417, 16215, 2558, 1204, 2033, 13, 13, 29871, 269, 3844, 29918, 4645, 29889, 649, 29918, 15501, 29898, 13, 1678, 4408, 29922, 15501, 29918, 978, 29892, 13, 1678, 5167, 2433, 7898, 545, 1231, 742, 13, 1678, 7865, 29922, 5943, 29918, 6979, 29892, 13, 1678, 7670, 1204, 29922, 1989, 29918, 333, 29892, 13, 1678, 6811, 3539, 29922, 5574, 13, 29871, 1723, 13, 13, 1753, 432, 14554, 29918, 23813, 29898, 26716, 29918, 29926, 14554, 1125, 13, 13, 29871, 396, 450, 921, 29899, 314, 3749, 29899, 3398, 29899, 1272, 4839, 338, 263, 2967, 29953, 29946, 29899, 26716, 435, 17755, 8794, 491, 278, 14445, 29933, 13, 29871, 396, 2854, 1218, 278, 12608, 310, 278, 435, 17755, 2794, 278, 20092, 338, 15585, 13, 29871, 396, 639, 1732, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 295, 6288, 1359, 5521, 19985, 29914, 12333, 29914, 6214, 29914, 25894, 29899, 27218, 403, 29899, 7193, 29889, 1420, 13, 29871, 396, 16696, 29871, 29896, 29901, 3617, 278, 1820, 1178, 515, 435, 17755, 9066, 313, 1552, 26397, 1746, 29897, 13, 29871, 396, 26716, 29918, 29926, 14554, 353, 9066, 29889, 8977, 1839, 29916, 29899, 314, 3749, 29899, 3398, 29883, 29899, 1272, 2033, 13, 29871, 432, 14554, 29918, 13662, 353, 18511, 29918, 29926, 14554, 29889, 5451, 12839, 29861, 29900, 29962, 13, 13, 29871, 1602, 6797, 29918, 29926, 14554, 29918, 13662, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 29926, 14554, 29918, 13662, 467, 13808, 703, 9420, 29899, 29947, 1159, 13, 29871, 1602, 6797, 29918, 3126, 353, 4390, 29889, 18132, 29898, 7099, 6797, 29918, 29926, 14554, 29918, 13662, 29897, 13, 29871, 26397, 353, 1602, 6797, 29918, 3126, 1839, 29895, 333, 2033, 13, 13, 29871, 396, 16696, 29871, 29906, 29901, 3617, 278, 970, 1820, 515, 14014, 16248, 13, 29871, 2529, 29918, 1989, 353, 679, 29918, 10467, 29918, 295, 29890, 29918, 3597, 29918, 1989, 29898, 12803, 29892, 26397, 29897, 13, 13, 29871, 396, 16696, 29871, 29941, 29901, 3617, 278, 20092, 13, 29871, 736, 432, 14554, 29889, 13808, 29898, 26716, 29918, 29926, 14554, 29892, 2529, 29918, 1989, 29892, 14009, 29922, 1839, 2890, 29906, 29945, 29953, 11287, 13, 13, 29992, 7692, 312, 8789, 29889, 29880, 582, 29918, 8173, 580, 13, 1753, 679, 29918, 10467, 29918, 295, 29890, 29918, 3597, 29918, 1989, 29898, 12803, 29892, 1820, 29918, 333, 1125, 13, 29871, 3142, 353, 285, 29915, 991, 597, 3597, 29899, 8149, 29889, 5150, 29889, 295, 29890, 29889, 29912, 12803, 1836, 17260, 10467, 29889, 510, 19248, 1989, 29918, 333, 10162, 13, 29871, 736, 7274, 29889, 657, 29898, 2271, 467, 726, 13, 2 ]
src/eos/transaction.py
Remmeauth/gimmeremmetokensbot
3
71172
""" Provide implementation of transaction. """ import os from eosiopy.eosioparams import EosioParams from eosiopy.nodenetwork import NodeNetwork from eosiopy.rawinputparams import RawinputParams from eosiopy import eosio_config MASTER_WALLET_PRIVATE_KEY = os.environ.get('MASTER_WALLET_PRIVATE_KEY') NODEOS_HOST = os.environ.get('NODEOS_HOST') NODEOS_PORT = os.environ.get('NODEOS_PORT') eosio_config.url = f'https://{NODEOS_HOST}' eosio_config.port = int(NODEOS_PORT) class Transaction: """ Transaction implementation. """ def send(self, account_from_name, account_to_name, amount, symbol) -> str: """ Send transaction. """ raw_input_params = RawinputParams('transfer', { 'from': account_from_name, 'memo': 'Remme Protocol transaction.', 'quantity': f'{amount}.0000 {symbol}', 'to': account_to_name, }, 'eosio.token', f'{account_from_name}@active') eosio_params = EosioParams(raw_input_params.params_actions_list, MASTER_WALLET_PRIVATE_KEY) transaction = NodeNetwork.push_transaction(eosio_params.trx_json) return transaction.get('transaction_id')
[ 1, 9995, 13, 1184, 29894, 680, 5314, 310, 10804, 29889, 13, 15945, 29908, 13, 5215, 2897, 13, 13, 3166, 321, 8156, 2270, 29889, 29872, 8156, 459, 279, 2232, 1053, 382, 359, 601, 9629, 13, 3166, 321, 8156, 2270, 29889, 29876, 13183, 2647, 1053, 9071, 13724, 13, 3166, 321, 8156, 2270, 29889, 1610, 2080, 7529, 1053, 22038, 2080, 9629, 13, 3166, 321, 8156, 2270, 1053, 321, 359, 601, 29918, 2917, 13, 13, 1529, 1254, 1001, 29918, 29956, 1964, 1307, 29911, 29918, 29829, 29963, 3040, 29918, 10818, 353, 2897, 29889, 21813, 29889, 657, 877, 1529, 1254, 1001, 29918, 29956, 1964, 1307, 29911, 29918, 29829, 29963, 3040, 29918, 10818, 1495, 13, 6632, 2287, 3267, 29918, 20832, 353, 2897, 29889, 21813, 29889, 657, 877, 6632, 2287, 3267, 29918, 20832, 1495, 13, 6632, 2287, 3267, 29918, 15082, 353, 2897, 29889, 21813, 29889, 657, 877, 6632, 2287, 3267, 29918, 15082, 1495, 13, 13, 29872, 359, 601, 29918, 2917, 29889, 2271, 353, 285, 29915, 991, 597, 29912, 6632, 2287, 3267, 29918, 20832, 10162, 13, 29872, 359, 601, 29918, 2917, 29889, 637, 353, 938, 29898, 6632, 2287, 3267, 29918, 15082, 29897, 13, 13, 13, 1990, 4103, 2467, 29901, 13, 1678, 9995, 13, 1678, 4103, 2467, 5314, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 3638, 29898, 1311, 29892, 3633, 29918, 3166, 29918, 978, 29892, 3633, 29918, 517, 29918, 978, 29892, 5253, 29892, 5829, 29897, 1599, 851, 29901, 13, 4706, 9995, 13, 4706, 15076, 10804, 29889, 13, 4706, 9995, 13, 4706, 10650, 29918, 2080, 29918, 7529, 353, 22038, 2080, 9629, 877, 3286, 571, 742, 426, 13, 9651, 525, 3166, 2396, 3633, 29918, 3166, 29918, 978, 29892, 13, 9651, 525, 6954, 29877, 2396, 525, 7301, 1004, 1019, 5770, 10804, 29889, 742, 13, 9651, 525, 22640, 2396, 285, 29915, 29912, 14506, 1836, 29900, 29900, 29900, 29900, 426, 18098, 29913, 742, 13, 9651, 525, 517, 2396, 3633, 29918, 517, 29918, 978, 29892, 13, 4706, 2981, 525, 29872, 359, 601, 29889, 6979, 742, 285, 29915, 29912, 10149, 29918, 3166, 29918, 978, 29913, 29992, 4925, 1495, 13, 13, 4706, 321, 359, 601, 29918, 7529, 353, 382, 359, 601, 9629, 29898, 1610, 29918, 2080, 29918, 7529, 29889, 7529, 29918, 7387, 29918, 1761, 29892, 14861, 1254, 1001, 29918, 29956, 1964, 1307, 29911, 29918, 29829, 29963, 3040, 29918, 10818, 29897, 13, 13, 4706, 10804, 353, 9071, 13724, 29889, 5910, 29918, 20736, 29898, 29872, 359, 601, 29918, 7529, 29889, 509, 29916, 29918, 3126, 29897, 13, 4706, 736, 10804, 29889, 657, 877, 20736, 29918, 333, 1495, 13, 2 ]
tests/test_adapters.py
ScreenPyHQ/screenpy
8
52230
<filename>tests/test_adapters.py import logging from screenpy.narration.adapters.stdout_adapter import StdOutAdapter, StdOutManager def prop(): """The revolver in the foyer!""" pass class TestStdOutManager: def test__outdent(self): manager = StdOutManager() manager.depth = [] manager._outdent() manager._outdent() manager._outdent() assert len(manager.depth) == 0 def test__indent(self): manager = StdOutManager() with manager._indent(): assert len(manager.depth) == 1 # context persists until manager._outdent is called assert len(manager.depth) == 1 def test_step(self, caplog): manager = StdOutManager() test_message = "Wow. I’m Mr. Manager." with caplog.at_level(logging.INFO): with manager.log_context(test_message): assert len(caplog.records) == 1 assert caplog.records[0].message == test_message class TestStdOutAdapter: def test_act(self, caplog): adapter = StdOutAdapter() act_name = "test act" test_func = adapter.act(prop, act_name, None) with caplog.at_level(logging.INFO): next(test_func)() assert len(caplog.records) == 1 assert caplog.records[0].message == f"ACT {act_name.upper()}" def test_scene(self, caplog): adapter = StdOutAdapter() scene_name = "test scene" test_func = adapter.scene(prop, scene_name, None) with caplog.at_level(logging.INFO): next(test_func)() assert len(caplog.records) == 1 assert caplog.records[0].message == f"Scene: {scene_name.title()}" def test_beat(self, caplog): adapter = StdOutAdapter() beat_line = "test beat" test_func = adapter.beat(prop, beat_line) with caplog.at_level(logging.INFO): next(test_func)() assert len(caplog.records) == 1 assert caplog.records[0].message == beat_line def test_indentation(self, caplog): adapter = StdOutAdapter() with caplog.at_level(logging.INFO): for func1 in adapter.beat(prop, "1"): for func2 in adapter.beat(func1, "2"): for func3 in adapter.beat(func2, "3"): func3() assert len(caplog.records) == 3 assert caplog.records[0].message == "1" assert caplog.records[1].message == " 2" assert caplog.records[2].message == " 3" def test_aside(self, caplog): adapter = StdOutAdapter() aside_line = "test aside" test_func = adapter.aside(prop, aside_line) with caplog.at_level(logging.INFO): next(test_func)() assert len(caplog.records) == 1 assert caplog.records[0].message == aside_line def test_aside_in_a_beat(self, caplog): adapter = StdOutAdapter() with caplog.at_level(logging.INFO): for func1 in adapter.aside(prop, "beat"): for func2 in adapter.beat(func1, "aside"): func2() assert len(caplog.records) == 2 assert caplog.records[0].message == "beat" assert caplog.records[1].message == " aside" def test_error(self, caplog): adapter = StdOutAdapter() expected_exception = ValueError("Snakes. Why is it always snakes?") with caplog.at_level(logging.INFO): adapter.error(expected_exception) assert len(caplog.records) == 1 assert expected_exception.__class__.__name__ in caplog.records[0].message assert str(expected_exception) in caplog.records[0].message def test_attach(self, caplog): test_filepath = "freakazoid/documents/freak_in.png" adapter = StdOutAdapter() with caplog.at_level(logging.INFO): adapter.attach(test_filepath) assert len(caplog.records) == 1 assert test_filepath in caplog.records[0].message
[ 1, 529, 9507, 29958, 21150, 29914, 1688, 29918, 328, 481, 2153, 29889, 2272, 13, 5215, 12183, 13, 13, 3166, 4315, 2272, 29889, 29876, 2749, 362, 29889, 328, 481, 2153, 29889, 25393, 29918, 21412, 1053, 624, 29881, 3744, 6168, 29892, 624, 29881, 3744, 3260, 13, 13, 13, 1753, 3107, 7295, 13, 1678, 9995, 1576, 13819, 369, 297, 278, 1701, 7598, 3850, 15945, 13, 1678, 1209, 13, 13, 13, 1990, 4321, 855, 29881, 3744, 3260, 29901, 13, 1678, 822, 1243, 1649, 449, 25873, 29898, 1311, 1125, 13, 4706, 8455, 353, 624, 29881, 3744, 3260, 580, 13, 4706, 8455, 29889, 19488, 353, 5159, 13, 13, 4706, 8455, 3032, 449, 25873, 580, 13, 4706, 8455, 3032, 449, 25873, 580, 13, 4706, 8455, 3032, 449, 25873, 580, 13, 13, 4706, 4974, 7431, 29898, 12847, 29889, 19488, 29897, 1275, 29871, 29900, 13, 13, 1678, 822, 1243, 1649, 12860, 29898, 1311, 1125, 13, 4706, 8455, 353, 624, 29881, 3744, 3260, 580, 13, 13, 4706, 411, 8455, 3032, 12860, 7295, 13, 9651, 4974, 7431, 29898, 12847, 29889, 19488, 29897, 1275, 29871, 29896, 13, 4706, 396, 3030, 3736, 2879, 2745, 8455, 3032, 449, 25873, 338, 2000, 13, 4706, 4974, 7431, 29898, 12847, 29889, 19488, 29897, 1275, 29871, 29896, 13, 13, 1678, 822, 1243, 29918, 10568, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 8455, 353, 624, 29881, 3744, 3260, 580, 13, 4706, 1243, 29918, 4906, 353, 376, 29956, 340, 29889, 306, 30010, 29885, 3237, 29889, 15629, 1213, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 411, 8455, 29889, 1188, 29918, 4703, 29898, 1688, 29918, 4906, 1125, 13, 18884, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 18884, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 1243, 29918, 4906, 13, 13, 13, 1990, 4321, 855, 29881, 3744, 6168, 29901, 13, 1678, 822, 1243, 29918, 627, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 4706, 1044, 29918, 978, 353, 376, 1688, 1044, 29908, 13, 4706, 1243, 29918, 9891, 353, 13304, 29889, 627, 29898, 7728, 29892, 1044, 29918, 978, 29892, 6213, 29897, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 2446, 29898, 1688, 29918, 9891, 29897, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 285, 29908, 17923, 426, 627, 29918, 978, 29889, 21064, 580, 5038, 13, 13, 1678, 822, 1243, 29918, 24645, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 4706, 9088, 29918, 978, 353, 376, 1688, 9088, 29908, 13, 4706, 1243, 29918, 9891, 353, 13304, 29889, 24645, 29898, 7728, 29892, 9088, 29918, 978, 29892, 6213, 29897, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 2446, 29898, 1688, 29918, 9891, 29897, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 285, 29908, 23472, 29901, 426, 24645, 29918, 978, 29889, 3257, 580, 5038, 13, 13, 1678, 822, 1243, 29918, 915, 271, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 4706, 16646, 29918, 1220, 353, 376, 1688, 16646, 29908, 13, 4706, 1243, 29918, 9891, 353, 13304, 29889, 915, 271, 29898, 7728, 29892, 16646, 29918, 1220, 29897, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 2446, 29898, 1688, 29918, 9891, 29897, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 16646, 29918, 1220, 13, 13, 1678, 822, 1243, 29918, 513, 9233, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 363, 3653, 29896, 297, 13304, 29889, 915, 271, 29898, 7728, 29892, 376, 29896, 29908, 1125, 13, 18884, 363, 3653, 29906, 297, 13304, 29889, 915, 271, 29898, 9891, 29896, 29892, 376, 29906, 29908, 1125, 13, 462, 1678, 363, 3653, 29941, 297, 13304, 29889, 915, 271, 29898, 9891, 29906, 29892, 376, 29941, 29908, 1125, 13, 462, 4706, 3653, 29941, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29941, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 376, 29896, 29908, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29896, 1822, 4906, 1275, 376, 268, 29906, 29908, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29906, 1822, 4906, 1275, 376, 308, 29941, 29908, 13, 13, 1678, 822, 1243, 29918, 294, 680, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 4706, 17786, 29918, 1220, 353, 376, 1688, 17786, 29908, 13, 4706, 1243, 29918, 9891, 353, 13304, 29889, 294, 680, 29898, 7728, 29892, 17786, 29918, 1220, 29897, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 2446, 29898, 1688, 29918, 9891, 29897, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 17786, 29918, 1220, 13, 13, 1678, 822, 1243, 29918, 294, 680, 29918, 262, 29918, 29874, 29918, 915, 271, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 363, 3653, 29896, 297, 13304, 29889, 294, 680, 29898, 7728, 29892, 376, 915, 271, 29908, 1125, 13, 18884, 363, 3653, 29906, 297, 13304, 29889, 915, 271, 29898, 9891, 29896, 29892, 376, 294, 680, 29908, 1125, 13, 462, 1678, 3653, 29906, 580, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29906, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 1275, 376, 915, 271, 29908, 13, 4706, 4974, 2117, 1188, 29889, 3757, 4339, 29961, 29896, 1822, 4906, 1275, 376, 1678, 17786, 29908, 13, 13, 1678, 822, 1243, 29918, 2704, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 4706, 3806, 29918, 11739, 353, 7865, 2392, 703, 29903, 29876, 6926, 29889, 3750, 338, 372, 2337, 5807, 6926, 29973, 1159, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 13304, 29889, 2704, 29898, 9684, 29918, 11739, 29897, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 3806, 29918, 11739, 17255, 1990, 1649, 17255, 978, 1649, 297, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 13, 4706, 4974, 851, 29898, 9684, 29918, 11739, 29897, 297, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 13, 13, 1678, 822, 1243, 29918, 14930, 29898, 1311, 29892, 2117, 1188, 1125, 13, 4706, 1243, 29918, 1445, 2084, 353, 376, 10745, 557, 834, 3398, 29914, 3225, 29879, 29914, 10745, 557, 29918, 262, 29889, 2732, 29908, 13, 4706, 13304, 353, 624, 29881, 3744, 6168, 580, 13, 13, 4706, 411, 2117, 1188, 29889, 271, 29918, 5563, 29898, 21027, 29889, 11690, 1125, 13, 9651, 13304, 29889, 14930, 29898, 1688, 29918, 1445, 2084, 29897, 13, 13, 4706, 4974, 7431, 29898, 5030, 1188, 29889, 3757, 4339, 29897, 1275, 29871, 29896, 13, 4706, 4974, 1243, 29918, 1445, 2084, 297, 2117, 1188, 29889, 3757, 4339, 29961, 29900, 1822, 4906, 13, 2 ]
src/main/python/tokenizeExtended.py
DFKI-MLT/TransIns
3
132918
import re from six import text_type from sacremoses import MosesTokenizer, MosesDetokenizer class MosesTokenizerExtended(MosesTokenizer): """ Extended Moses tokenizer with Catalan support """ CA_MIDDLE_DOT = r"([^{}\s\.'\`\,\-·])".format(MosesTokenizer.IsAlnum), r" \1 " CA_MIDDLE_DOT_NO_LOWER_FOLLOW = r"(·)([^a-z])", r"\1 · \2" def tokenize( self, text, aggressive_dash_splits=False, return_str=False, escape=True, protected_patterns=None, ): """ Python port of the Moses tokenizer. :param tokens: A single string, i.e. sentence text. :type tokens: str :param aggressive_dash_splits: Option to trigger dash split rules . :type aggressive_dash_splits: bool """ # Converts input string into unicode. text = text_type(text) # De-duplicate spaces and clean ASCII junk for regexp, substitution in [self.DEDUPLICATE_SPACE, self.ASCII_JUNK]: text = re.sub(regexp, substitution, text) if protected_patterns: # Find the tokens that needs to be protected. protected_tokens = [ match.group() for protected_pattern in protected_patterns for match in re.finditer(protected_pattern, text, re.IGNORECASE) ] # Apply the protected_patterns. for i, token in enumerate(protected_tokens): substituition = "THISISPROTECTED" + str(i).zfill(3) text = text.replace(token, substituition) # Strips heading and trailing spaces. text = text.strip() # FIXME!!! ''' # For Finnish and Swedish, seperate out all "other" special characters. if self.lang in ["fi", "sv"]: # In Finnish and Swedish, the colon can be used inside words # as an apostrophe-like character: # USA:n, 20:een, EU:ssa, USA:s, S:t regexp, substitution = self.FI_SV_COLON_APOSTROPHE text = re.sub(regexp, substitution, text) # If a colon is not immediately followed by lower-case characters, # separate it out anyway. regexp, substitution = self.FI_SV_COLON_NO_LOWER_FOLLOW text = re.sub(regexp, substitution, text) else: ''' if self.lang in ["ca"]: # In Catalan, the middle dot can be used inside words: # il·lusio regexp, substitution = self.CA_MIDDLE_DOT text = re.sub(regexp, substitution, text) # If a middle dot is not immediately followed by lower-case characters, # separate it out anyway. regexp, substitution = self.CA_MIDDLE_DOT_NO_LOWER_FOLLOW text = re.sub(regexp, substitution, text) else: # Separate special characters outside of IsAlnum character set. regexp, substitution = self.PAD_NOT_ISALNUM text = re.sub(regexp, substitution, text) # Aggressively splits dashes if aggressive_dash_splits: regexp, substitution = self.AGGRESSIVE_HYPHEN_SPLIT text = re.sub(regexp, substitution, text) # Replaces multidots with "DOTDOTMULTI" literal strings. text = self.replace_multidots(text) # Separate out "," except if within numbers e.g. 5,300 for regexp, substitution in [ self.COMMA_SEPARATE_1, self.COMMA_SEPARATE_2, self.COMMA_SEPARATE_3, ]: text = re.sub(regexp, substitution, text) # (Language-specific) apostrophe tokenization. if self.lang == "en": for regexp, substitution in self.ENGLISH_SPECIFIC_APOSTROPHE: text = re.sub(regexp, substitution, text) elif self.lang in ["fr", "it", "ca"]: for regexp, substitution in self.FR_IT_SPECIFIC_APOSTROPHE: text = re.sub(regexp, substitution, text) # FIXME!!! ##elif self.lang == "so": ## for regexp, substitution in self.SO_SPECIFIC_APOSTROPHE: ## text = re.sub(regexp, substitution, text) else: regexp, substitution = self.NON_SPECIFIC_APOSTROPHE text = re.sub(regexp, substitution, text) # Handles nonbreaking prefixes. text = self.handles_nonbreaking_prefixes(text) # Cleans up extraneous spaces. regexp, substitution = self.DEDUPLICATE_SPACE text = re.sub(regexp, substitution, text).strip() # Split trailing ".'". regexp, substituition = self.TRAILING_DOT_APOSTROPHE text = re.sub(regexp, substituition, text) # Restore the protected tokens. if protected_patterns: for i, token in enumerate(protected_tokens): substituition = "THISISPROTECTED" + str(i).zfill(3) text = text.replace(substituition, token) # Restore multidots. text = self.restore_multidots(text) if escape: # Escape XML symbols. text = self.escape_xml(text) return text if return_str else text.split() class MosesDetokenizerExtended(MosesDetokenizer): """ Extended Moses detokenizer with Catalan support """ def detokenize(self, tokens, return_str=True, unescape=True): if self.lang == 'ca': # simulate Catalan detokenization by first applying the French detokenizer # and then the Spanish detokenizer self.lang = 'fr' detokenized_text = self.tokenize(tokens, return_str, unescape) tokens = detokenized_text.split(" ") self.lang = 'es' detokenized_text = self.tokenize(tokens, return_str, unescape) self.lang = 'ca' return detokenized_text else: return self.tokenize(tokens, return_str, unescape)
[ 1, 1053, 337, 13, 13, 3166, 4832, 1053, 1426, 29918, 1853, 13, 13, 3166, 7067, 1745, 15806, 1053, 6630, 267, 6066, 3950, 29892, 6630, 267, 6362, 4476, 3950, 13, 13, 13, 1990, 6630, 267, 6066, 3950, 5647, 2760, 29898, 29924, 15806, 6066, 3950, 1125, 13, 1678, 9995, 13, 1678, 7338, 2760, 6630, 267, 5993, 3950, 411, 11732, 273, 2304, 13, 1678, 9995, 13, 13, 1678, 12766, 29918, 29924, 1367, 29928, 1307, 29918, 29928, 2891, 353, 364, 29908, 4197, 998, 1012, 29879, 29905, 6169, 29905, 29952, 15013, 29899, 30064, 2314, 1642, 4830, 29898, 29924, 15806, 6066, 3950, 29889, 3624, 2499, 1949, 511, 364, 29908, 320, 29896, 376, 13, 1678, 12766, 29918, 29924, 1367, 29928, 1307, 29918, 29928, 2891, 29918, 6632, 29918, 27998, 1001, 29918, 5800, 2208, 9806, 353, 364, 29908, 29898, 30064, 29897, 4197, 29985, 29874, 29899, 29920, 2314, 613, 364, 26732, 29896, 2880, 320, 29906, 29908, 13, 13, 1678, 822, 5993, 675, 29898, 13, 9651, 1583, 29892, 13, 9651, 1426, 29892, 13, 9651, 946, 3663, 573, 29918, 14592, 29918, 23579, 1169, 29922, 8824, 29892, 13, 9651, 736, 29918, 710, 29922, 8824, 29892, 13, 9651, 10169, 29922, 5574, 29892, 13, 9651, 6364, 29918, 11037, 29879, 29922, 8516, 29892, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 5132, 2011, 310, 278, 6630, 267, 5993, 3950, 29889, 13, 13, 9651, 584, 3207, 18897, 29901, 319, 2323, 1347, 29892, 474, 29889, 29872, 29889, 10541, 1426, 29889, 13, 9651, 584, 1853, 18897, 29901, 851, 13, 9651, 584, 3207, 946, 3663, 573, 29918, 14592, 29918, 23579, 1169, 29901, 10831, 304, 7135, 12569, 6219, 6865, 869, 13, 9651, 584, 1853, 946, 3663, 573, 29918, 14592, 29918, 23579, 1169, 29901, 6120, 13, 4706, 9995, 13, 13, 4706, 396, 1281, 369, 1372, 1881, 1347, 964, 29104, 29889, 13, 4706, 1426, 353, 1426, 29918, 1853, 29898, 726, 29897, 13, 4706, 396, 897, 29899, 20908, 5926, 8162, 322, 5941, 27196, 432, 2960, 13, 4706, 363, 6528, 29886, 29892, 23697, 297, 518, 1311, 29889, 2287, 29928, 4897, 27888, 3040, 29918, 5550, 11538, 29892, 1583, 29889, 28599, 2687, 29918, 29967, 3904, 29968, 5387, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 13, 4706, 565, 6364, 29918, 11037, 29879, 29901, 13, 9651, 396, 10987, 278, 18897, 393, 4225, 304, 367, 6364, 29889, 13, 9651, 6364, 29918, 517, 12360, 353, 518, 13, 18884, 1993, 29889, 2972, 580, 13, 18884, 363, 6364, 29918, 11037, 297, 6364, 29918, 11037, 29879, 13, 18884, 363, 1993, 297, 337, 29889, 2886, 1524, 29898, 24681, 29918, 11037, 29892, 1426, 29892, 337, 29889, 6259, 6632, 1525, 23487, 29897, 13, 9651, 4514, 13, 9651, 396, 2401, 368, 278, 6364, 29918, 11037, 29879, 29889, 13, 9651, 363, 474, 29892, 5993, 297, 26985, 29898, 24681, 29918, 517, 12360, 1125, 13, 18884, 5960, 1981, 654, 353, 376, 4690, 3235, 3235, 8618, 4330, 1783, 3352, 29908, 718, 851, 29898, 29875, 467, 29920, 5589, 29898, 29941, 29897, 13, 18884, 1426, 353, 1426, 29889, 6506, 29898, 6979, 29892, 5960, 1981, 654, 29897, 13, 13, 4706, 396, 624, 374, 567, 28435, 322, 25053, 8162, 29889, 13, 4706, 1426, 353, 1426, 29889, 17010, 580, 13, 13, 4706, 396, 383, 6415, 2303, 21004, 13, 4706, 14550, 13, 4706, 396, 1152, 21189, 728, 322, 21892, 29892, 409, 21194, 714, 599, 376, 1228, 29908, 4266, 4890, 29889, 13, 4706, 565, 1583, 29889, 3893, 297, 6796, 7241, 613, 376, 4501, 3108, 29901, 13, 9651, 396, 512, 21189, 728, 322, 21892, 29892, 278, 8104, 508, 367, 1304, 2768, 3838, 13, 9651, 396, 408, 385, 18115, 1336, 354, 29899, 4561, 2931, 29901, 13, 9651, 396, 8278, 29901, 29876, 29892, 29871, 29906, 29900, 29901, 27294, 29892, 19007, 29901, 893, 29874, 29892, 8278, 29901, 29879, 29892, 317, 29901, 29873, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 3738, 29918, 7597, 29918, 15032, 1164, 29918, 3301, 3718, 29366, 9606, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 9651, 396, 960, 263, 8104, 338, 451, 7389, 5643, 491, 5224, 29899, 4878, 4890, 29892, 13, 9651, 396, 5004, 372, 714, 8763, 29889, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 3738, 29918, 7597, 29918, 15032, 1164, 29918, 6632, 29918, 27998, 1001, 29918, 5800, 2208, 9806, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 4706, 1683, 29901, 13, 4706, 14550, 13, 4706, 565, 1583, 29889, 3893, 297, 6796, 1113, 3108, 29901, 13, 9651, 396, 512, 11732, 273, 29892, 278, 7256, 8329, 508, 367, 1304, 2768, 3838, 29901, 13, 9651, 396, 980, 30064, 12160, 601, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 5454, 29918, 29924, 1367, 29928, 1307, 29918, 29928, 2891, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 9651, 396, 960, 263, 7256, 8329, 338, 451, 7389, 5643, 491, 5224, 29899, 4878, 4890, 29892, 13, 9651, 396, 5004, 372, 714, 8763, 29889, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 5454, 29918, 29924, 1367, 29928, 1307, 29918, 29928, 2891, 29918, 6632, 29918, 27998, 1001, 29918, 5800, 2208, 9806, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 922, 862, 403, 4266, 4890, 5377, 310, 1317, 2499, 1949, 2931, 731, 29889, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 29925, 3035, 29918, 12256, 29918, 3235, 1964, 13967, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 13, 4706, 396, 4059, 3663, 3598, 8536, 1169, 12569, 267, 13, 4706, 565, 946, 3663, 573, 29918, 14592, 29918, 23579, 1169, 29901, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 10051, 29954, 26785, 18474, 29918, 29950, 29979, 19689, 1430, 29918, 5550, 29931, 1806, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 13, 4706, 396, 10088, 6048, 1773, 333, 1862, 411, 376, 29928, 2891, 29928, 2891, 29924, 8647, 29902, 29908, 16333, 6031, 29889, 13, 4706, 1426, 353, 1583, 29889, 6506, 29918, 4713, 333, 1862, 29898, 726, 29897, 13, 13, 4706, 396, 922, 862, 403, 714, 28796, 5174, 565, 2629, 3694, 321, 29889, 29887, 29889, 29871, 29945, 29892, 29941, 29900, 29900, 13, 4706, 363, 6528, 29886, 29892, 23697, 297, 518, 13, 9651, 1583, 29889, 19795, 1529, 29918, 1660, 16320, 3040, 29918, 29896, 29892, 13, 9651, 1583, 29889, 19795, 1529, 29918, 1660, 16320, 3040, 29918, 29906, 29892, 13, 9651, 1583, 29889, 19795, 1529, 29918, 1660, 16320, 3040, 29918, 29941, 29892, 13, 4706, 4514, 29901, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 13, 4706, 396, 313, 21233, 29899, 14940, 29897, 18115, 1336, 354, 5993, 2133, 29889, 13, 4706, 565, 1583, 29889, 3893, 1275, 376, 264, 1115, 13, 9651, 363, 6528, 29886, 29892, 23697, 297, 1583, 29889, 1430, 7239, 3235, 29950, 29918, 29903, 4162, 29907, 6545, 2965, 29918, 3301, 3718, 29366, 9606, 29901, 13, 18884, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 4706, 25342, 1583, 29889, 3893, 297, 6796, 1341, 613, 376, 277, 613, 376, 1113, 3108, 29901, 13, 9651, 363, 6528, 29886, 29892, 23697, 297, 1583, 29889, 15860, 29918, 1806, 29918, 29903, 4162, 29907, 6545, 2965, 29918, 3301, 3718, 29366, 9606, 29901, 13, 18884, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 4706, 396, 383, 6415, 2303, 21004, 13, 4706, 444, 23681, 1583, 29889, 3893, 1275, 376, 578, 1115, 13, 4706, 444, 1678, 363, 6528, 29886, 29892, 23697, 297, 1583, 29889, 6156, 29918, 29903, 4162, 29907, 6545, 2965, 29918, 3301, 3718, 29366, 9606, 29901, 13, 4706, 444, 4706, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 4706, 1683, 29901, 13, 9651, 6528, 29886, 29892, 23697, 353, 1583, 29889, 29940, 1164, 29918, 29903, 4162, 29907, 6545, 2965, 29918, 3301, 3718, 29366, 9606, 13, 9651, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 29897, 13, 13, 4706, 396, 5166, 793, 1661, 1030, 5086, 10944, 267, 29889, 13, 4706, 1426, 353, 1583, 29889, 3179, 793, 29918, 5464, 1030, 5086, 29918, 13506, 267, 29898, 726, 29897, 13, 4706, 396, 21386, 550, 701, 17541, 23584, 8162, 29889, 13, 4706, 6528, 29886, 29892, 23697, 353, 1583, 29889, 2287, 29928, 4897, 27888, 3040, 29918, 5550, 11538, 13, 4706, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 23697, 29892, 1426, 467, 17010, 580, 13, 4706, 396, 26178, 25053, 376, 6169, 1642, 13, 4706, 6528, 29886, 29892, 5960, 1981, 654, 353, 1583, 29889, 29911, 4717, 6227, 4214, 29918, 29928, 2891, 29918, 3301, 3718, 29366, 9606, 13, 4706, 1426, 353, 337, 29889, 1491, 29898, 13087, 29886, 29892, 5960, 1981, 654, 29892, 1426, 29897, 13, 13, 4706, 396, 11654, 487, 278, 6364, 18897, 29889, 13, 4706, 565, 6364, 29918, 11037, 29879, 29901, 13, 9651, 363, 474, 29892, 5993, 297, 26985, 29898, 24681, 29918, 517, 12360, 1125, 13, 18884, 5960, 1981, 654, 353, 376, 4690, 3235, 3235, 8618, 4330, 1783, 3352, 29908, 718, 851, 29898, 29875, 467, 29920, 5589, 29898, 29941, 29897, 13, 18884, 1426, 353, 1426, 29889, 6506, 29898, 22492, 1981, 654, 29892, 5993, 29897, 13, 13, 4706, 396, 11654, 487, 1773, 333, 1862, 29889, 13, 4706, 1426, 353, 1583, 29889, 5060, 487, 29918, 4713, 333, 1862, 29898, 726, 29897, 13, 4706, 565, 10169, 29901, 13, 9651, 396, 3423, 5738, 6560, 15072, 29889, 13, 9651, 1426, 353, 1583, 29889, 21587, 29918, 3134, 29898, 726, 29897, 13, 13, 4706, 736, 1426, 565, 736, 29918, 710, 1683, 1426, 29889, 5451, 580, 13, 13, 13, 1990, 6630, 267, 6362, 4476, 3950, 5647, 2760, 29898, 29924, 15806, 6362, 4476, 3950, 1125, 13, 1678, 9995, 13, 1678, 7338, 2760, 6630, 267, 1439, 4476, 3950, 411, 11732, 273, 2304, 13, 1678, 9995, 13, 13, 1678, 822, 1439, 4476, 675, 29898, 1311, 29892, 18897, 29892, 736, 29918, 710, 29922, 5574, 29892, 443, 21587, 29922, 5574, 1125, 13, 13, 4706, 565, 1583, 29889, 3893, 1275, 525, 1113, 2396, 13, 9651, 396, 29611, 11732, 273, 1439, 4476, 2133, 491, 937, 15399, 278, 5176, 1439, 4476, 3950, 13, 9651, 396, 322, 769, 278, 10432, 1439, 4476, 3950, 13, 9651, 1583, 29889, 3893, 353, 525, 1341, 29915, 13, 9651, 1439, 4476, 1891, 29918, 726, 353, 1583, 29889, 6979, 675, 29898, 517, 12360, 29892, 736, 29918, 710, 29892, 443, 21587, 29897, 13, 9651, 18897, 353, 1439, 4476, 1891, 29918, 726, 29889, 5451, 703, 16521, 13, 9651, 1583, 29889, 3893, 353, 525, 267, 29915, 13, 9651, 1439, 4476, 1891, 29918, 726, 353, 1583, 29889, 6979, 675, 29898, 517, 12360, 29892, 736, 29918, 710, 29892, 443, 21587, 29897, 13, 9651, 1583, 29889, 3893, 353, 525, 1113, 29915, 13, 9651, 736, 1439, 4476, 1891, 29918, 726, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 6979, 675, 29898, 517, 12360, 29892, 736, 29918, 710, 29892, 443, 21587, 29897, 13, 2 ]
app/components/OpenLogger/open_logger.py
Eksno/DevOps_Flask_Login
1
147015
import os import errno import logging from datetime import datetime from logging.handlers import TimedRotatingFileHandler def make_sure_path_exists(path): try: os.makedirs(path) except OSError as exception: if exception.errno != errno.EEXIST: raise def create_handlers(log_fname=None, c_level=logging.INFO, f_level=logging.DEBUG): f_handler = None if log_fname is not None: # Create handlers f_handler = TimedRotatingFileHandler(log_fname) f_handler.setLevel(f_level) # Create formatters and add it to handlers f_format = logging.Formatter( "[%(asctime)s] {%(pathname)s:%(lineno)d} %(name)s - %(levelname)s - %(message)s" ) # Apply formatter f_handler.setFormatter(f_format) # Create handler c_handler = logging.StreamHandler() c_handler.setLevel(c_level) # Create formatter and add it to handler c_format = logging.Formatter("%(name)s - %(levelname)s - %(message)s") # Apply formatter c_handler.setFormatter(c_format) return c_handler, f_handler def configure_logger( logger, log_to_file=False, console_level=logging.INFO, file_level=logging.DEBUG ): # Create log dir root_dir = os.path.normpath(os.getcwd() + os.sep) root_log_dir = root_dir make_sure_path_exists(os.path.join(root_log_dir, "logs")) log_dir = os.path.join(root_log_dir, "logs") now = datetime.now() logger.setLevel(logging.DEBUG) if log_to_file: # Create path make_sure_path_exists(os.path.join(log_dir, now.strftime("%Y"))) log_year_dir = os.path.join(log_dir, now.strftime("%Y")) make_sure_path_exists(os.path.join(log_year_dir, now.strftime("%B"))) log_month_dir = os.path.join(log_year_dir, now.strftime("%B")) make_sure_path_exists(os.path.join(log_month_dir, now.strftime("%d"))) log_day_dir = os.path.join(log_month_dir, now.strftime("%d")) log_fname = os.path.join( log_day_dir, "{}.log".format(now.strftime("%b-%d-%Y_%H-%M-%S")) ) # Create Handlers c_handler, f_handler = create_handlers(log_fname) logger.addHandler(c_handler) logger.addHandler(f_handler) else: c_handler, _ = create_handlers() logger.addHandler(c_handler) logging.info("logging configured") def configure_loggers( loggers, log_to_file=False, console_level=logging.INFO, file_level=logging.DEBUG ): for logger in loggers: configure_logger(logger, log_to_file, console_level, file_level) if __name__ == "__main__": logger = logging.getLogger() configure_logger(logger) logging.debug( "Debug Test Log - Detailed information, typically of interest only when diagnosing problems." ) logging.info("Info Test Log - Confirmation that things are working as expected.") logging.warning( "Warining Test Log - An indication that something unexpected happened, or indicative of some problem in the near future (e.g. ‘disk space low’). The software is still working as expected." ) logging.error( "Error Test Log - Due to a more serious problem, the software has not been able to perform some function." ) logging.critical( "Critical Test Log - A serious error, indicating that the program itself may be unable to continue running." )
[ 1, 1053, 2897, 13, 5215, 4589, 1217, 13, 5215, 12183, 13, 13, 3166, 12865, 1053, 12865, 13, 3166, 12183, 29889, 3179, 9306, 1053, 7870, 287, 21281, 1218, 2283, 4598, 13, 13, 13, 1753, 1207, 29918, 29879, 545, 29918, 2084, 29918, 9933, 29898, 2084, 1125, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 2084, 29897, 13, 1678, 5174, 438, 29173, 408, 3682, 29901, 13, 4706, 565, 3682, 29889, 3127, 1217, 2804, 4589, 1217, 29889, 29923, 5746, 9047, 29901, 13, 9651, 12020, 13, 13, 13, 1753, 1653, 29918, 3179, 9306, 29898, 1188, 29918, 29888, 978, 29922, 8516, 29892, 274, 29918, 5563, 29922, 21027, 29889, 11690, 29892, 285, 29918, 5563, 29922, 21027, 29889, 18525, 1125, 13, 13, 1678, 285, 29918, 13789, 353, 6213, 13, 13, 1678, 565, 1480, 29918, 29888, 978, 338, 451, 6213, 29901, 13, 4706, 396, 6204, 25795, 13, 4706, 285, 29918, 13789, 353, 7870, 287, 21281, 1218, 2283, 4598, 29898, 1188, 29918, 29888, 978, 29897, 13, 4706, 285, 29918, 13789, 29889, 842, 10108, 29898, 29888, 29918, 5563, 29897, 13, 13, 4706, 396, 6204, 3402, 2153, 322, 788, 372, 304, 25795, 13, 4706, 285, 29918, 4830, 353, 12183, 29889, 18522, 29898, 13, 9651, 14704, 29995, 29898, 294, 312, 603, 29897, 29879, 29962, 18674, 29898, 2084, 978, 29897, 29879, 16664, 29898, 1915, 8154, 29897, 29881, 29913, 1273, 29898, 978, 29897, 29879, 448, 1273, 29898, 5563, 978, 29897, 29879, 448, 1273, 29898, 4906, 29897, 29879, 29908, 13, 4706, 1723, 13, 13, 4706, 396, 2401, 368, 883, 2620, 13, 4706, 285, 29918, 13789, 29889, 842, 18522, 29898, 29888, 29918, 4830, 29897, 13, 13, 1678, 396, 6204, 7834, 13, 1678, 274, 29918, 13789, 353, 12183, 29889, 3835, 4598, 580, 13, 1678, 274, 29918, 13789, 29889, 842, 10108, 29898, 29883, 29918, 5563, 29897, 13, 13, 1678, 396, 6204, 883, 2620, 322, 788, 372, 304, 7834, 13, 1678, 274, 29918, 4830, 353, 12183, 29889, 18522, 11702, 29898, 978, 29897, 29879, 448, 1273, 29898, 5563, 978, 29897, 29879, 448, 1273, 29898, 4906, 29897, 29879, 1159, 13, 13, 1678, 396, 2401, 368, 883, 2620, 13, 1678, 274, 29918, 13789, 29889, 842, 18522, 29898, 29883, 29918, 4830, 29897, 13, 13, 1678, 736, 274, 29918, 13789, 29892, 285, 29918, 13789, 13, 13, 13, 1753, 10822, 29918, 21707, 29898, 13, 1678, 17927, 29892, 1480, 29918, 517, 29918, 1445, 29922, 8824, 29892, 2991, 29918, 5563, 29922, 21027, 29889, 11690, 29892, 934, 29918, 5563, 29922, 21027, 29889, 18525, 13, 1125, 13, 13, 1678, 396, 6204, 1480, 4516, 13, 1678, 3876, 29918, 3972, 353, 2897, 29889, 2084, 29889, 12324, 2084, 29898, 359, 29889, 657, 29883, 9970, 580, 718, 2897, 29889, 19570, 29897, 13, 1678, 3876, 29918, 1188, 29918, 3972, 353, 3876, 29918, 3972, 13, 1678, 1207, 29918, 29879, 545, 29918, 2084, 29918, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4632, 29918, 1188, 29918, 3972, 29892, 376, 20756, 5783, 13, 1678, 1480, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29918, 1188, 29918, 3972, 29892, 376, 20756, 1159, 13, 13, 1678, 1286, 353, 12865, 29889, 3707, 580, 13, 13, 1678, 17927, 29889, 842, 10108, 29898, 21027, 29889, 18525, 29897, 13, 13, 1678, 565, 1480, 29918, 517, 29918, 1445, 29901, 13, 4706, 396, 6204, 2224, 13, 4706, 1207, 29918, 29879, 545, 29918, 2084, 29918, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29979, 29908, 4961, 13, 4706, 1480, 29918, 6360, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29979, 5783, 13, 4706, 1207, 29918, 29879, 545, 29918, 2084, 29918, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 6360, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29933, 29908, 4961, 13, 4706, 1480, 29918, 10874, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 6360, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29933, 5783, 13, 4706, 1207, 29918, 29879, 545, 29918, 2084, 29918, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 10874, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29881, 29908, 4961, 13, 4706, 1480, 29918, 3250, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1188, 29918, 10874, 29918, 3972, 29892, 1286, 29889, 710, 615, 603, 11702, 29881, 5783, 13, 13, 4706, 1480, 29918, 29888, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 9651, 1480, 29918, 3250, 29918, 3972, 29892, 29850, 1836, 1188, 1642, 4830, 29898, 3707, 29889, 710, 615, 603, 11702, 29890, 19222, 29881, 19222, 29979, 29918, 29995, 29950, 19222, 29924, 19222, 29903, 5783, 13, 4706, 1723, 13, 13, 4706, 396, 6204, 5166, 9306, 13, 4706, 274, 29918, 13789, 29892, 285, 29918, 13789, 353, 1653, 29918, 3179, 9306, 29898, 1188, 29918, 29888, 978, 29897, 13, 4706, 17927, 29889, 1202, 4598, 29898, 29883, 29918, 13789, 29897, 13, 4706, 17927, 29889, 1202, 4598, 29898, 29888, 29918, 13789, 29897, 13, 1678, 1683, 29901, 13, 4706, 274, 29918, 13789, 29892, 903, 353, 1653, 29918, 3179, 9306, 580, 13, 4706, 17927, 29889, 1202, 4598, 29898, 29883, 29918, 13789, 29897, 13, 13, 1678, 12183, 29889, 3888, 703, 21027, 13252, 1159, 13, 13, 13, 1753, 10822, 29918, 1188, 5743, 29898, 13, 1678, 1480, 5743, 29892, 1480, 29918, 517, 29918, 1445, 29922, 8824, 29892, 2991, 29918, 5563, 29922, 21027, 29889, 11690, 29892, 934, 29918, 5563, 29922, 21027, 29889, 18525, 13, 1125, 13, 1678, 363, 17927, 297, 1480, 5743, 29901, 13, 4706, 10822, 29918, 21707, 29898, 21707, 29892, 1480, 29918, 517, 29918, 1445, 29892, 2991, 29918, 5563, 29892, 934, 29918, 5563, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 17927, 353, 12183, 29889, 657, 16363, 580, 13, 13, 1678, 10822, 29918, 21707, 29898, 21707, 29897, 13, 13, 1678, 12183, 29889, 8382, 29898, 13, 4706, 376, 11862, 4321, 4522, 448, 360, 11881, 2472, 29892, 12234, 310, 4066, 871, 746, 24876, 14556, 4828, 1213, 13, 1678, 1723, 13, 1678, 12183, 29889, 3888, 703, 3401, 4321, 4522, 448, 10811, 3568, 362, 393, 2712, 526, 1985, 408, 3806, 23157, 13, 1678, 12183, 29889, 27392, 29898, 13, 4706, 376, 29956, 279, 2827, 4321, 4522, 448, 530, 4221, 362, 393, 1554, 15668, 9559, 29892, 470, 4221, 1230, 310, 777, 1108, 297, 278, 2978, 5434, 313, 29872, 29889, 29887, 29889, 5129, 20960, 2913, 4482, 30010, 467, 450, 7047, 338, 1603, 1985, 408, 3806, 1213, 13, 1678, 1723, 13, 1678, 12183, 29889, 2704, 29898, 13, 4706, 376, 2392, 4321, 4522, 448, 16809, 304, 263, 901, 10676, 1108, 29892, 278, 7047, 756, 451, 1063, 2221, 304, 2189, 777, 740, 1213, 13, 1678, 1723, 13, 1678, 12183, 29889, 9695, 936, 29898, 13, 4706, 376, 29907, 768, 936, 4321, 4522, 448, 319, 10676, 1059, 29892, 23941, 393, 278, 1824, 3528, 1122, 367, 9368, 304, 6773, 2734, 1213, 13, 1678, 1723, 13, 2 ]
SelfPractice&Tutorial/12_Histogram.py
Omer-sync/ComputerVision_Studies
0
1617079
<filename>SelfPractice&Tutorial/12_Histogram.py import cv2 as cv import numpy as np import matplotlib.pyplot as plt img = cv.imread("D:/Programming/Python_Projects/Computer_Vision/ROV/FishSize/Source/" + "samplefromvideo_1.png") cv.imshow('Park',img) # Grayscale Histogram gray = cv.cvtColor(img,cv.COLOR_BGR2GRAY) gray_hist = cv.calcHist([gray],[0],None,[256],[0,256]) plt.figure() plt.title("GrayScale Histogram") plt.xlabel('Bins') plt.ylabel('# of pixels') plt.plot(gray_hist) plt.xlim([0,256]) plt.show() # Masked Grayscale Histogram # blank = np.zeros(img.shape[0:2],dtype='uint8') # gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY) # cv.imshow('Gray', gray) # # mask = cv.circle(blank, (img.shape[1]//2,img.shape[0]//2), 100, 255, -1) # # masked = cv.bitwise_and(gray,gray,mask=mask) # cv.imshow('Mask', masked) # gray_hist = cv.calcHist([gray], [0], mask, [256], [0,256] ) # plt.figure() # plt.title("GrayScale Histogram") # plt.xlabel('Bins') # plt.ylabel('# of pixels') # plt.plot(gray_hist) # plt.xlim([0,256]) # plt.show() # Colorful Histogram blank = np.zeros(img.shape[0:2],dtype='uint8') mask = cv.circle(blank, (img.shape[1]//2,img.shape[0]//2), 100, 255, -1) masked = cv.bitwise_and(img,img,mask=mask) cv.imshow('Mask', masked) plt.figure() plt.title('Colour Histogram') plt.xlabel('Bins') plt.ylabel('# of pixels') colors = ('b', 'g', 'r') for i,col in enumerate(colors): hist = cv.calcHist([img], [i], mask, [256], [0,256]) plt.plot(hist, color=col) plt.xlim([0,256]) plt.show() cv.waitKey(0)
[ 1, 529, 9507, 29958, 24313, 29925, 1461, 625, 29987, 29911, 6072, 29914, 29896, 29906, 29918, 29950, 391, 13342, 29889, 2272, 13, 5215, 13850, 29906, 408, 13850, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 30004, 13, 2492, 353, 13850, 29889, 326, 949, 703, 29928, 8419, 9283, 4056, 29914, 11980, 29918, 25119, 29914, 20606, 261, 29918, 29963, 2459, 29914, 1672, 29963, 29914, 29943, 728, 3505, 29914, 4435, 12975, 718, 376, 11249, 3166, 9641, 29918, 29896, 29889, 2732, 1159, 30004, 13, 30004, 13, 11023, 29889, 326, 4294, 877, 29925, 935, 742, 2492, 8443, 13, 30004, 13, 29937, 18956, 7052, 15179, 13342, 30004, 13, 30004, 13, 21012, 353, 13850, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 11023, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 8443, 13, 30004, 13, 21012, 29918, 29882, 391, 353, 13850, 29889, 28667, 29950, 391, 4197, 21012, 16272, 29900, 1402, 8516, 17094, 29906, 29945, 29953, 16272, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 30004, 13, 572, 29873, 29889, 4532, 26471, 13, 572, 29873, 29889, 3257, 703, 29954, 764, 17185, 15179, 13342, 1159, 30004, 13, 572, 29873, 29889, 29916, 1643, 877, 29933, 1144, 1495, 30004, 13, 572, 29873, 29889, 29891, 1643, 14237, 310, 17036, 1495, 30004, 13, 572, 29873, 29889, 5317, 29898, 21012, 29918, 29882, 391, 8443, 13, 572, 29873, 29889, 29916, 2576, 4197, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 572, 29873, 29889, 4294, 26471, 13, 30004, 13, 29937, 341, 1278, 287, 18956, 7052, 15179, 13342, 30004, 13, 30004, 13, 29937, 9654, 353, 7442, 29889, 3298, 359, 29898, 2492, 29889, 12181, 29961, 29900, 29901, 29906, 1402, 29881, 1853, 2433, 13470, 29947, 1495, 30004, 13, 29937, 16749, 353, 13850, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 13850, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 8443, 13, 29937, 13850, 29889, 326, 4294, 877, 29954, 764, 742, 16749, 8443, 13, 29937, 30004, 13, 29937, 11105, 353, 13850, 29889, 16622, 29898, 19465, 29892, 313, 2492, 29889, 12181, 29961, 29896, 29962, 458, 29906, 29892, 2492, 29889, 12181, 29961, 29900, 29962, 458, 29906, 511, 29871, 29896, 29900, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 448, 29896, 8443, 13, 29937, 30004, 13, 29937, 11105, 287, 353, 13850, 29889, 2966, 3538, 29918, 392, 29898, 21012, 29892, 21012, 29892, 13168, 29922, 13168, 8443, 13, 29937, 13850, 29889, 326, 4294, 877, 19832, 742, 11105, 287, 8443, 13, 29937, 16749, 29918, 29882, 391, 353, 13850, 29889, 28667, 29950, 391, 4197, 21012, 1402, 518, 29900, 1402, 11105, 29892, 518, 29906, 29945, 29953, 1402, 518, 29900, 29892, 29906, 29945, 29953, 29962, 1723, 30004, 13, 29937, 14770, 29889, 4532, 26471, 13, 29937, 14770, 29889, 3257, 703, 29954, 764, 17185, 15179, 13342, 1159, 30004, 13, 29937, 14770, 29889, 29916, 1643, 877, 29933, 1144, 1495, 30004, 13, 29937, 14770, 29889, 29891, 1643, 14237, 310, 17036, 1495, 30004, 13, 29937, 14770, 29889, 5317, 29898, 21012, 29918, 29882, 391, 8443, 13, 29937, 14770, 29889, 29916, 2576, 4197, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 29937, 14770, 29889, 4294, 26471, 13, 30004, 13, 29937, 9159, 1319, 15179, 13342, 30004, 13, 30004, 13, 19465, 353, 7442, 29889, 3298, 359, 29898, 2492, 29889, 12181, 29961, 29900, 29901, 29906, 1402, 29881, 1853, 2433, 13470, 29947, 1495, 30004, 13, 13168, 353, 13850, 29889, 16622, 29898, 19465, 29892, 313, 2492, 29889, 12181, 29961, 29896, 29962, 458, 29906, 29892, 2492, 29889, 12181, 29961, 29900, 29962, 458, 29906, 511, 29871, 29896, 29900, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 448, 29896, 8443, 13, 30004, 13, 13168, 287, 353, 13850, 29889, 2966, 3538, 29918, 392, 29898, 2492, 29892, 2492, 29892, 13168, 29922, 13168, 8443, 13, 11023, 29889, 326, 4294, 877, 19832, 742, 11105, 287, 8443, 13, 30004, 13, 572, 29873, 29889, 4532, 26471, 13, 572, 29873, 29889, 3257, 877, 1625, 473, 15179, 13342, 1495, 30004, 13, 572, 29873, 29889, 29916, 1643, 877, 29933, 1144, 1495, 30004, 13, 572, 29873, 29889, 29891, 1643, 14237, 310, 17036, 1495, 30004, 13, 27703, 353, 6702, 29890, 742, 525, 29887, 742, 525, 29878, 1495, 30004, 13, 1454, 474, 29892, 1054, 297, 26985, 29898, 27703, 1125, 30004, 13, 1678, 9825, 353, 13850, 29889, 28667, 29950, 391, 4197, 2492, 1402, 518, 29875, 1402, 11105, 29892, 518, 29906, 29945, 29953, 1402, 518, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 1678, 14770, 29889, 5317, 29898, 29882, 391, 29892, 2927, 29922, 1054, 8443, 13, 1678, 14770, 29889, 29916, 2576, 4197, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 30004, 13, 572, 29873, 29889, 4294, 26471, 13, 11023, 29889, 10685, 2558, 29898, 29900, 29897, 2 ]
connect4/Connect4Tree.py
dl4184/alpha-zero-general
0
169703
import numpy as np from numba import njit, b1, i1, int64, float64 @njit(b1(i1[:, :], i1, i1)) def was_winning_move(board, row, col): if col == -1: return False player = board[row, col] player_pieces = board == player win_len = 4 row_win = player_pieces[row, :] for i in range(row_win.size - win_len + 1): if row_win[i: i + win_len].all(): return True diag_win1 = np.diag(player_pieces, col - row) for i in range(diag_win1.size - win_len + 1): if diag_win1[i: i + win_len].all(): return True new_col = 6 - col diag_win2 = np.diag(player_pieces[:, ::-1], new_col - row) for i in range(diag_win2.size - win_len + 1): if diag_win2[i: i + win_len].all(): return True if row < 3: col_win = player_pieces[row:, col] for i in range(col_win.size - win_len + 1): if col_win[i: i + win_len].all(): return True return False """ @njit(i1[:, :](i1[:, :], i1, i1, i1)) def add_stone(board, row, col, player): # available_idx = np.argmin(board[:, column] == 0) - 1 #new_board = board.copy() board[row][col] = player return board @njit(b1[:](i1[:, :])) def valid_moves(board): return board[0] == 0 @njit(i1(i1[:, :], i1)) def playable_row(board, col): return np.where(board[:, col] == 0)[0][-1] """ @njit(float64(i1[:, :], int64, int64, int64, float64, float64, int64, float64[:, :])) def minimax(board, move_row, move_col, depth, alpha, beta, player, result): if was_winning_move(board, move_row, move_col): return -player moves = np.where(board[0] == 0)[0] # we get columns (moves) we can play if depth == 0 or moves.size == 0: return 0 if player == 1: best_val = -np.inf else: best_val = np.inf for i in range(moves.size): col = moves[i] row = np.where(board[:, col] == 0)[0][-1] # np.argmin(board[:, col] == 0) - 1 board[row][col] = player # we play the move # child_node = Node(new_board, row, col) value = minimax(board, row, col, depth - 1, alpha, beta, -player, result) board[row][col] = 0 # undo the move this way is faster than just copying board if move_row == -1 and move_col == -1: # if we are in root "node" we want best child and the move we played result[col, 0] = 1 # we played this move result[col, 1] = value # value we obtained # move/col is an index of result if player == 1: best_val = max(best_val, value) alpha = max(alpha, best_val) else: best_val = min(best_val, value) alpha = min(alpha, best_val) if beta <= alpha: break return best_val # @njit(int64(i1[:, :], int64)) def best_move_alpha_beta(board, depth): board = board.astype(np.int8) # root = Node(board, -1, -1) result = np.zeros((7, 2)) v = minimax(board, -1, -1, depth, -np.inf, np.inf, 1, result) # board is in canonical form moves = [] for move in range(7): searched, value = result[move, :] if searched and value == v: moves.append(move) return np.random.choice(moves) if __name__ == "__main__": import time b = np.zeros((6, 7)) b[5][3] = 1 b[5][2] = 1 # b[5][1] = 1 b[4][3] = -1 b = np.array([ [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, -1, 0, 0, 0, 0], [0, 0, 1, 1, 0, 0, 0]]) b = b.astype(np.int8) b = b * -1 # b[4][2] = -1 # b[4][1] = -1 # print(was_winning_move(b, 2,1)) print(b) t = time.time() print(best_move_alpha_beta(b, 9)) print(time.time() - t)
[ 1, 1053, 12655, 408, 7442, 13, 3166, 954, 2291, 1053, 20199, 277, 29892, 289, 29896, 29892, 474, 29896, 29892, 938, 29953, 29946, 29892, 5785, 29953, 29946, 13, 13, 13, 29992, 29876, 29926, 277, 29898, 29890, 29896, 29898, 29875, 29896, 7503, 29892, 584, 1402, 474, 29896, 29892, 474, 29896, 876, 13, 1753, 471, 29918, 5080, 1076, 29918, 11631, 29898, 3377, 29892, 1948, 29892, 784, 1125, 13, 1678, 565, 784, 1275, 448, 29896, 29901, 13, 4706, 736, 7700, 13, 13, 1678, 4847, 353, 7613, 29961, 798, 29892, 784, 29962, 13, 1678, 4847, 29918, 12343, 778, 353, 7613, 1275, 4847, 13, 1678, 5401, 29918, 2435, 353, 29871, 29946, 13, 1678, 1948, 29918, 5080, 353, 4847, 29918, 12343, 778, 29961, 798, 29892, 584, 29962, 13, 1678, 363, 474, 297, 3464, 29898, 798, 29918, 5080, 29889, 2311, 448, 5401, 29918, 2435, 718, 29871, 29896, 1125, 13, 4706, 565, 1948, 29918, 5080, 29961, 29875, 29901, 474, 718, 5401, 29918, 2435, 1822, 497, 7295, 13, 9651, 736, 5852, 13, 13, 1678, 7936, 29918, 5080, 29896, 353, 7442, 29889, 6051, 351, 29898, 9106, 29918, 12343, 778, 29892, 784, 448, 1948, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 6051, 351, 29918, 5080, 29896, 29889, 2311, 448, 5401, 29918, 2435, 718, 29871, 29896, 1125, 13, 4706, 565, 7936, 29918, 5080, 29896, 29961, 29875, 29901, 474, 718, 5401, 29918, 2435, 1822, 497, 7295, 13, 9651, 736, 5852, 13, 1678, 716, 29918, 1054, 353, 29871, 29953, 448, 784, 13, 1678, 7936, 29918, 5080, 29906, 353, 7442, 29889, 6051, 351, 29898, 9106, 29918, 12343, 778, 7503, 29892, 4761, 29899, 29896, 1402, 716, 29918, 1054, 448, 1948, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 6051, 351, 29918, 5080, 29906, 29889, 2311, 448, 5401, 29918, 2435, 718, 29871, 29896, 1125, 13, 4706, 565, 7936, 29918, 5080, 29906, 29961, 29875, 29901, 474, 718, 5401, 29918, 2435, 1822, 497, 7295, 13, 9651, 736, 5852, 13, 13, 1678, 565, 1948, 529, 29871, 29941, 29901, 13, 4706, 784, 29918, 5080, 353, 4847, 29918, 12343, 778, 29961, 798, 29901, 29892, 784, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 1054, 29918, 5080, 29889, 2311, 448, 5401, 29918, 2435, 718, 29871, 29896, 1125, 13, 9651, 565, 784, 29918, 5080, 29961, 29875, 29901, 474, 718, 5401, 29918, 2435, 1822, 497, 7295, 13, 18884, 736, 5852, 13, 13, 1678, 736, 7700, 13, 13, 15945, 29908, 13, 29992, 29876, 29926, 277, 29898, 29875, 29896, 7503, 29892, 584, 850, 29875, 29896, 7503, 29892, 584, 1402, 474, 29896, 29892, 474, 29896, 29892, 474, 29896, 876, 13, 1753, 788, 29918, 12734, 29898, 3377, 29892, 1948, 29892, 784, 29892, 4847, 1125, 13, 1678, 396, 3625, 29918, 13140, 353, 7442, 29889, 1191, 1195, 29898, 3377, 7503, 29892, 1897, 29962, 1275, 29871, 29900, 29897, 448, 29871, 29896, 13, 1678, 396, 1482, 29918, 3377, 353, 7613, 29889, 8552, 580, 13, 1678, 7613, 29961, 798, 3816, 1054, 29962, 353, 4847, 13, 13, 1678, 736, 7613, 13, 13, 13, 29992, 29876, 29926, 277, 29898, 29890, 29896, 7503, 850, 29875, 29896, 7503, 29892, 584, 12622, 13, 1753, 2854, 29918, 13529, 267, 29898, 3377, 1125, 13, 1678, 736, 7613, 29961, 29900, 29962, 1275, 29871, 29900, 13, 13, 13, 29992, 29876, 29926, 277, 29898, 29875, 29896, 29898, 29875, 29896, 7503, 29892, 584, 1402, 474, 29896, 876, 13, 1753, 1708, 519, 29918, 798, 29898, 3377, 29892, 784, 1125, 13, 1678, 736, 7442, 29889, 3062, 29898, 3377, 7503, 29892, 784, 29962, 1275, 29871, 29900, 9601, 29900, 3816, 29899, 29896, 29962, 13, 15945, 29908, 13, 13, 13, 29992, 29876, 29926, 277, 29898, 7411, 29953, 29946, 29898, 29875, 29896, 7503, 29892, 584, 1402, 938, 29953, 29946, 29892, 938, 29953, 29946, 29892, 938, 29953, 29946, 29892, 5785, 29953, 29946, 29892, 5785, 29953, 29946, 29892, 938, 29953, 29946, 29892, 5785, 29953, 29946, 7503, 29892, 584, 12622, 13, 1753, 6260, 1165, 29898, 3377, 29892, 4337, 29918, 798, 29892, 4337, 29918, 1054, 29892, 10809, 29892, 15595, 29892, 21762, 29892, 4847, 29892, 1121, 1125, 13, 1678, 565, 471, 29918, 5080, 1076, 29918, 11631, 29898, 3377, 29892, 4337, 29918, 798, 29892, 4337, 29918, 1054, 1125, 13, 4706, 736, 448, 9106, 13, 13, 1678, 16229, 353, 7442, 29889, 3062, 29898, 3377, 29961, 29900, 29962, 1275, 29871, 29900, 9601, 29900, 29962, 29871, 396, 591, 679, 4341, 313, 13529, 267, 29897, 591, 508, 1708, 13, 1678, 565, 10809, 1275, 29871, 29900, 470, 16229, 29889, 2311, 1275, 29871, 29900, 29901, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 565, 4847, 1275, 29871, 29896, 29901, 13, 4706, 1900, 29918, 791, 353, 448, 9302, 29889, 7192, 13, 1678, 1683, 29901, 13, 4706, 1900, 29918, 791, 353, 7442, 29889, 7192, 13, 13, 1678, 363, 474, 297, 3464, 29898, 13529, 267, 29889, 2311, 1125, 13, 4706, 784, 353, 16229, 29961, 29875, 29962, 13, 4706, 1948, 353, 7442, 29889, 3062, 29898, 3377, 7503, 29892, 784, 29962, 1275, 29871, 29900, 9601, 29900, 3816, 29899, 29896, 29962, 29871, 396, 7442, 29889, 1191, 1195, 29898, 3377, 7503, 29892, 784, 29962, 1275, 29871, 29900, 29897, 448, 29871, 29896, 13, 4706, 7613, 29961, 798, 3816, 1054, 29962, 353, 4847, 396, 591, 1708, 278, 4337, 13, 4706, 396, 2278, 29918, 3177, 353, 9071, 29898, 1482, 29918, 3377, 29892, 1948, 29892, 784, 29897, 13, 13, 4706, 995, 353, 6260, 1165, 29898, 3377, 29892, 1948, 29892, 784, 29892, 10809, 448, 29871, 29896, 29892, 15595, 29892, 21762, 29892, 448, 9106, 29892, 1121, 29897, 13, 4706, 7613, 29961, 798, 3816, 1054, 29962, 353, 29871, 29900, 29871, 396, 563, 29877, 278, 4337, 445, 982, 338, 8473, 1135, 925, 17596, 7613, 13, 4706, 565, 4337, 29918, 798, 1275, 448, 29896, 322, 4337, 29918, 1054, 1275, 448, 29896, 29901, 29871, 396, 565, 591, 526, 297, 3876, 376, 3177, 29908, 591, 864, 1900, 2278, 322, 278, 4337, 591, 5318, 13, 9651, 1121, 29961, 1054, 29892, 29871, 29900, 29962, 353, 29871, 29896, 29871, 396, 591, 5318, 445, 4337, 13, 9651, 1121, 29961, 1054, 29892, 29871, 29896, 29962, 353, 995, 29871, 396, 995, 591, 7625, 13, 9651, 396, 4337, 29914, 1054, 338, 385, 2380, 310, 1121, 13, 13, 4706, 565, 4847, 1275, 29871, 29896, 29901, 13, 9651, 1900, 29918, 791, 353, 4236, 29898, 13318, 29918, 791, 29892, 995, 29897, 13, 9651, 15595, 353, 4236, 29898, 2312, 29892, 1900, 29918, 791, 29897, 13, 4706, 1683, 29901, 13, 9651, 1900, 29918, 791, 353, 1375, 29898, 13318, 29918, 791, 29892, 995, 29897, 13, 9651, 15595, 353, 1375, 29898, 2312, 29892, 1900, 29918, 791, 29897, 13, 13, 4706, 565, 21762, 5277, 15595, 29901, 13, 9651, 2867, 13, 1678, 736, 1900, 29918, 791, 13, 13, 13, 29937, 732, 29876, 29926, 277, 29898, 524, 29953, 29946, 29898, 29875, 29896, 7503, 29892, 584, 1402, 938, 29953, 29946, 876, 13, 1753, 1900, 29918, 11631, 29918, 2312, 29918, 3571, 29898, 3377, 29892, 10809, 1125, 13, 1678, 7613, 353, 7613, 29889, 579, 668, 29898, 9302, 29889, 524, 29947, 29897, 13, 1678, 396, 3876, 353, 9071, 29898, 3377, 29892, 448, 29896, 29892, 448, 29896, 29897, 13, 1678, 1121, 353, 7442, 29889, 3298, 359, 3552, 29955, 29892, 29871, 29906, 876, 13, 1678, 325, 353, 6260, 1165, 29898, 3377, 29892, 448, 29896, 29892, 448, 29896, 29892, 10809, 29892, 448, 9302, 29889, 7192, 29892, 7442, 29889, 7192, 29892, 29871, 29896, 29892, 1121, 29897, 29871, 396, 7613, 338, 297, 24420, 883, 13, 1678, 16229, 353, 5159, 13, 13, 1678, 363, 4337, 297, 3464, 29898, 29955, 1125, 13, 4706, 17371, 29892, 995, 353, 1121, 29961, 11631, 29892, 584, 29962, 13, 4706, 565, 17371, 322, 995, 1275, 325, 29901, 13, 9651, 16229, 29889, 4397, 29898, 11631, 29897, 13, 13, 1678, 736, 7442, 29889, 8172, 29889, 16957, 29898, 13529, 267, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 931, 13, 13, 1678, 289, 353, 7442, 29889, 3298, 359, 3552, 29953, 29892, 29871, 29955, 876, 13, 1678, 289, 29961, 29945, 3816, 29941, 29962, 353, 29871, 29896, 13, 1678, 289, 29961, 29945, 3816, 29906, 29962, 353, 29871, 29896, 13, 1678, 396, 289, 29961, 29945, 3816, 29896, 29962, 353, 29871, 29896, 13, 1678, 289, 29961, 29946, 3816, 29941, 29962, 353, 448, 29896, 13, 13, 1678, 289, 353, 7442, 29889, 2378, 4197, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 448, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 1402, 13, 4706, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 24960, 13, 1678, 289, 353, 289, 29889, 579, 668, 29898, 9302, 29889, 524, 29947, 29897, 13, 1678, 289, 353, 289, 334, 448, 29896, 13, 13, 1678, 396, 289, 29961, 29946, 3816, 29906, 29962, 353, 448, 29896, 13, 1678, 396, 289, 29961, 29946, 3816, 29896, 29962, 353, 448, 29896, 13, 1678, 396, 1596, 29898, 11102, 29918, 5080, 1076, 29918, 11631, 29898, 29890, 29892, 29871, 29906, 29892, 29896, 876, 13, 13, 1678, 1596, 29898, 29890, 29897, 13, 1678, 260, 353, 931, 29889, 2230, 580, 13, 1678, 1596, 29898, 13318, 29918, 11631, 29918, 2312, 29918, 3571, 29898, 29890, 29892, 29871, 29929, 876, 13, 1678, 1596, 29898, 2230, 29889, 2230, 580, 448, 260, 29897, 13, 2 ]
src/restfuls/apps/v1/apis/auth.py
Qinnnnnn/Watero_DataCenter
0
115300
#!/usr/bin/python # -*- coding: utf-8 -*- """ File : certify.py Author : <NAME> CreateDate : 2018-12-16 10:00:00 LastModifiedDate : 2018-12-16 10:00:00 Note : Agent认证接口,GET """ from flask_restful import Resource from flask_restful import fields from flask_restful import marshal_with from flask_restful import reqparse from src.restfuls.apps.db_model import AgentRegisterLogs from src.restfuls.apps.db_model import db from src.restfuls.utils import abort from src.restfuls.utils.certify import Certify class AgentAuth(Resource): """ Agent认证接口 """ get_resp_template = { 'status': fields.Integer, 'state': fields.String, 'message': fields.Nested( {'access_token': fields.String} ) } def __init__(self): """ 初始化 """ self.get_parser = reqparse.RequestParser() self.get_parser.add_argument('mac_addr', required=True, type=str, help='mac_addr required') @marshal_with(get_resp_template) def get(self): """ GET方法 :return: """ # 参数验证 args = self.get_parser.parse_args() mac_addr = args.get('mac_addr') rt = db.session.query(AgentRegisterLogs).filter(AgentRegisterLogs.mac_addr == mac_addr).first() if rt and rt.status == 1: rt.access_token = Certify.generate_token(mac_addr) db.session.commit() return {'status': 1, 'state': 'success', 'message': rt} else: msg = 'Access denied' abort.abort_with_msg(403, -1, 'error', msg)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 2283, 584, 2284, 1598, 29889, 2272, 13, 13720, 584, 529, 5813, 29958, 13, 4391, 2539, 584, 29871, 29906, 29900, 29896, 29947, 29899, 29896, 29906, 29899, 29896, 29953, 29871, 29896, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 13, 8897, 2111, 2164, 2539, 584, 29871, 29906, 29900, 29896, 29947, 29899, 29896, 29906, 29899, 29896, 29953, 29871, 29896, 29900, 29901, 29900, 29900, 29901, 29900, 29900, 13, 9842, 584, 28330, 31439, 235, 178, 132, 31092, 30856, 30214, 7194, 13, 15945, 29908, 13, 13, 3166, 29784, 29918, 5060, 1319, 1053, 18981, 13, 3166, 29784, 29918, 5060, 1319, 1053, 4235, 13, 3166, 29784, 29918, 5060, 1319, 1053, 1766, 23258, 29918, 2541, 13, 3166, 29784, 29918, 5060, 1319, 1053, 12428, 5510, 13, 13, 3166, 4765, 29889, 5060, 1319, 29879, 29889, 13371, 29889, 2585, 29918, 4299, 1053, 28330, 15213, 3403, 29879, 13, 3166, 4765, 29889, 5060, 1319, 29879, 29889, 13371, 29889, 2585, 29918, 4299, 1053, 4833, 13, 3166, 4765, 29889, 5060, 1319, 29879, 29889, 13239, 1053, 27450, 13, 3166, 4765, 29889, 5060, 1319, 29879, 29889, 13239, 29889, 6327, 1598, 1053, 18410, 1598, 13, 13, 13, 1990, 28330, 6444, 29898, 6848, 1125, 13, 1678, 9995, 13, 1678, 28330, 31439, 235, 178, 132, 31092, 30856, 13, 1678, 9995, 13, 1678, 679, 29918, 13713, 29918, 6886, 353, 426, 13, 4706, 525, 4882, 2396, 4235, 29889, 7798, 29892, 13, 4706, 525, 3859, 2396, 4235, 29889, 1231, 29892, 13, 4706, 525, 4906, 2396, 4235, 29889, 29940, 2868, 29898, 13, 9651, 11117, 5943, 29918, 6979, 2396, 4235, 29889, 1231, 29913, 13, 4706, 1723, 13, 1678, 500, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9995, 13, 308, 31120, 31020, 30705, 13, 4706, 9995, 13, 4706, 1583, 29889, 657, 29918, 16680, 353, 12428, 5510, 29889, 3089, 11726, 580, 13, 4706, 1583, 29889, 657, 29918, 16680, 29889, 1202, 29918, 23516, 877, 8628, 29918, 10030, 742, 3734, 29922, 5574, 29892, 1134, 29922, 710, 29892, 1371, 2433, 8628, 29918, 10030, 3734, 1495, 13, 13, 1678, 732, 3034, 23258, 29918, 2541, 29898, 657, 29918, 13713, 29918, 6886, 29897, 13, 1678, 822, 679, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 12354, 30525, 30545, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 396, 29871, 31125, 30354, 236, 173, 143, 235, 178, 132, 13, 4706, 6389, 353, 1583, 29889, 657, 29918, 16680, 29889, 5510, 29918, 5085, 580, 13, 4706, 5825, 29918, 10030, 353, 6389, 29889, 657, 877, 8628, 29918, 10030, 1495, 13, 13, 4706, 364, 29873, 353, 4833, 29889, 7924, 29889, 1972, 29898, 19661, 15213, 3403, 29879, 467, 4572, 29898, 19661, 15213, 3403, 29879, 29889, 8628, 29918, 10030, 1275, 5825, 29918, 10030, 467, 4102, 580, 13, 4706, 565, 364, 29873, 322, 364, 29873, 29889, 4882, 1275, 29871, 29896, 29901, 13, 9651, 364, 29873, 29889, 5943, 29918, 6979, 353, 18410, 1598, 29889, 17158, 29918, 6979, 29898, 8628, 29918, 10030, 29897, 13, 9651, 4833, 29889, 7924, 29889, 15060, 580, 13, 9651, 736, 11117, 4882, 2396, 29871, 29896, 29892, 525, 3859, 2396, 525, 8698, 742, 525, 4906, 2396, 364, 29873, 29913, 13, 4706, 1683, 29901, 13, 9651, 10191, 353, 525, 6638, 17935, 29915, 13, 9651, 27450, 29889, 370, 441, 29918, 2541, 29918, 7645, 29898, 29946, 29900, 29941, 29892, 448, 29896, 29892, 525, 2704, 742, 10191, 29897, 13, 2 ]
test/functional/omni_graceperiod.py
fiscalobject/uniasset
39
38814
<filename>test/functional/omni_graceperiod.py #!/usr/bin/env python3 # Copyright (c) 2017-2018 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """Test grace period.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.util import assert_equal class OmniGracePeriod(BitcoinTestFramework): def set_test_params(self): self.num_nodes = 1 self.setup_clean_chain = True self.extra_args = [['-omniactivationallowsender=any']] def sendactivation(self, address, coinbase_address, heights, expected): # Min client version for feature activation minClientVersion = 0 for height in heights: activation_block = self.nodes[0].getblockcount() + height + 1 txid = self.nodes[0].omni_sendactivation(address, 3, activation_block, minClientVersion) self.nodes[0].generatetoaddress(1, coinbase_address) # Checking the transaction was valid... result = self.nodes[0].omni_gettransaction(txid) assert_equal(result['valid'], expected) def run_test(self): self.log.info("test grace period") # Preparing some mature Bitcoins coinbase_address = self.nodes[0].getnewaddress() self.nodes[0].generatetoaddress(101, coinbase_address) # Obtaining a master address to work with address = self.nodes[0].getnewaddress() # Funding the address with some testnet BTC for fees self.nodes[0].sendtoaddress(address, 0.1) self.nodes[0].generatetoaddress(1, coinbase_address) # A relative activation height of blocks is smaller than the grace period and not allowed self.sendactivation(address, coinbase_address, [-100, 0, 1, 2, 4], False) # A relative activation height of blocks is too far in the future and not allowed self.sendactivation(address, coinbase_address, [11, 288, 12289, 999999], False) # A relative activation height of blocks is within the grace period and accepted activationMinBlocks = 5 activationMaxBlocks = 10 self.sendactivation(address, coinbase_address, [activationMinBlocks, activationMinBlocks + 1, activationMaxBlocks - 1, activationMaxBlocks], True) if __name__ == '__main__': OmniGracePeriod().main()
[ 1, 529, 9507, 29958, 1688, 29914, 2220, 284, 29914, 290, 1240, 29918, 3874, 346, 19145, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 29899, 29906, 29900, 29896, 29947, 450, 18531, 1111, 262, 10239, 18777, 13, 29937, 6652, 7541, 1090, 278, 341, 1806, 7047, 19405, 29892, 1074, 278, 10259, 1384, 292, 13, 29937, 934, 315, 4590, 29979, 4214, 470, 1732, 597, 1636, 29889, 22156, 1167, 29889, 990, 29914, 506, 11259, 29914, 2415, 29899, 506, 1947, 29889, 1961, 29889, 13, 15945, 29908, 3057, 17659, 3785, 1213, 15945, 13, 13, 3166, 1243, 29918, 4468, 29889, 1688, 29918, 4468, 1053, 18531, 1111, 262, 3057, 16660, 13, 3166, 1243, 29918, 4468, 29889, 4422, 1053, 4974, 29918, 11745, 13, 13, 1990, 13352, 1240, 29954, 25525, 29853, 29898, 21591, 1111, 262, 3057, 16660, 1125, 13, 1678, 822, 731, 29918, 1688, 29918, 7529, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1949, 29918, 18010, 353, 29871, 29896, 13, 4706, 1583, 29889, 14669, 29918, 14941, 29918, 14153, 353, 5852, 13, 4706, 1583, 29889, 17833, 29918, 5085, 353, 518, 1839, 29899, 290, 3915, 312, 440, 362, 497, 1242, 1581, 29922, 1384, 2033, 29962, 13, 13, 1678, 822, 3638, 11236, 362, 29898, 1311, 29892, 3211, 29892, 19480, 3188, 29918, 7328, 29892, 3171, 29879, 29892, 3806, 1125, 13, 308, 396, 3080, 3132, 1873, 363, 4682, 26229, 13, 4706, 1375, 4032, 6594, 353, 29871, 29900, 13, 13, 4706, 363, 3171, 297, 3171, 29879, 29901, 13, 9651, 26229, 29918, 1271, 353, 1583, 29889, 18010, 29961, 29900, 1822, 657, 1271, 2798, 580, 718, 3171, 718, 29871, 29896, 13, 9651, 25568, 333, 353, 1583, 29889, 18010, 29961, 29900, 1822, 290, 1240, 29918, 6717, 11236, 362, 29898, 7328, 29892, 29871, 29941, 29892, 26229, 29918, 1271, 29892, 1375, 4032, 6594, 29897, 13, 9651, 1583, 29889, 18010, 29961, 29900, 1822, 4738, 271, 10896, 7328, 29898, 29896, 29892, 19480, 3188, 29918, 7328, 29897, 13, 13, 9651, 396, 5399, 292, 278, 10804, 471, 2854, 856, 13, 9651, 1121, 353, 1583, 29889, 18010, 29961, 29900, 1822, 290, 1240, 29918, 657, 20736, 29898, 7508, 333, 29897, 13, 9651, 4974, 29918, 11745, 29898, 2914, 1839, 3084, 7464, 3806, 29897, 13, 13, 1678, 822, 1065, 29918, 1688, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1188, 29889, 3888, 703, 1688, 17659, 3785, 1159, 13, 13, 4706, 396, 4721, 862, 292, 777, 286, 1535, 18531, 1111, 1144, 13, 4706, 19480, 3188, 29918, 7328, 353, 1583, 29889, 18010, 29961, 29900, 1822, 657, 1482, 7328, 580, 13, 4706, 1583, 29889, 18010, 29961, 29900, 1822, 4738, 271, 10896, 7328, 29898, 29896, 29900, 29896, 29892, 19480, 3188, 29918, 7328, 29897, 13, 13, 4706, 396, 4250, 2408, 292, 263, 5835, 3211, 304, 664, 411, 13, 4706, 3211, 353, 1583, 29889, 18010, 29961, 29900, 1822, 657, 1482, 7328, 580, 13, 13, 4706, 396, 13249, 292, 278, 3211, 411, 777, 1243, 1212, 350, 9472, 363, 1238, 267, 13, 4706, 1583, 29889, 18010, 29961, 29900, 1822, 6717, 517, 7328, 29898, 7328, 29892, 29871, 29900, 29889, 29896, 29897, 13, 4706, 1583, 29889, 18010, 29961, 29900, 1822, 4738, 271, 10896, 7328, 29898, 29896, 29892, 19480, 3188, 29918, 7328, 29897, 13, 13, 4706, 396, 319, 6198, 26229, 3171, 310, 10930, 338, 7968, 1135, 278, 17659, 3785, 322, 451, 6068, 13, 4706, 1583, 29889, 6717, 11236, 362, 29898, 7328, 29892, 19480, 3188, 29918, 7328, 29892, 21069, 29896, 29900, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29946, 1402, 7700, 29897, 13, 13, 4706, 396, 319, 6198, 26229, 3171, 310, 10930, 338, 2086, 2215, 297, 278, 5434, 322, 451, 6068, 13, 4706, 1583, 29889, 6717, 11236, 362, 29898, 7328, 29892, 19480, 3188, 29918, 7328, 29892, 518, 29896, 29896, 29892, 29871, 29906, 29947, 29947, 29892, 29871, 29896, 29906, 29906, 29947, 29929, 29892, 29871, 29929, 29929, 29929, 29929, 29929, 29929, 1402, 7700, 29897, 13, 13, 4706, 396, 319, 6198, 26229, 3171, 310, 10930, 338, 2629, 278, 17659, 3785, 322, 9259, 13, 4706, 26229, 8140, 7445, 29879, 353, 29871, 29945, 13, 4706, 26229, 7976, 7445, 29879, 353, 29871, 29896, 29900, 13, 4706, 1583, 29889, 6717, 11236, 362, 29898, 7328, 29892, 19480, 3188, 29918, 7328, 29892, 518, 11236, 362, 8140, 7445, 29879, 29892, 26229, 8140, 7445, 29879, 718, 29871, 29896, 29892, 26229, 7976, 7445, 29879, 448, 29871, 29896, 29892, 26229, 7976, 7445, 29879, 1402, 5852, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13352, 1240, 29954, 25525, 29853, 2141, 3396, 580, 13, 2 ]
repl/repl.py
JesterOrNot/MathLang
2
91447
import sys import tty import re import os def syntax_highlight(input, keywords: dict): i = 0 splitted = input.split(" ") for f in splitted: for keyword in keywords.keys(): if re.match(keyword, f): splitted[i] = keywords.get( keyword) + re.findall(keyword, f)[0] + u"\u001b[0m" i += 1 return " ".join(splitted) def command_line(keywords: dict): tty.setraw(sys.stdin) input = "" index = 0 sys.stdout.write("\n") sys.stdout.write(u"\u001b[1000D") sys.stdout.write(u"\u001b[0K") do_print = True while True: if do_print: sys.stdout.write(">>> ") do_print = False sys.stdout.flush() char = sys.stdin.read(1) if char == ":": sys.stdout.write("\n") sys.stdout.write(u"\u001b[1000D") sys.stdout.write(u"\u001b[0K") return "" if 32 <= ord(char) <= 126: input += char if ord(char) == 127: input = input[:index-1] if ord(char) in {10, 13}: sys.stdout.write("\n") sys.stdout.write(u"\u001b[1000D") sys.stdout.write(u"\u001b[0K") sys.stdout.flush() with open("/tmp/.mlangrepl.temp", "w+") as f: f.write(input) os.system("mathlang /tmp/.mlangrepl.temp") input = "" sys.stdout.write("\n") sys.stdout.write(u"\u001b[1000D") sys.stdout.write(u"\u001b[0K") sys.stdout.flush() do_print = True continue sys.stdout.write(u"\u001b[1000D") sys.stdout.write(u"\u001b[4C") sys.stdout.write(u"\u001b[0K") sys.stdout.write(syntax_highlight(input, keywords)) if index > 0: sys.stdout.write(u"\u001b[" + str(index) + "C") sys.stdout.flush() return input command_line({"sqrt": "\u001b[38;5;198m", "log": "\u001b[38;5;198m", "say": "\u001b[38;5;198m", "sin": "\u001b[38;5;198m", "cos": "\u001b[38;5;198m", "tan": "\u001b[38;5;198m", "cbrt": "\u001b[38;5;198m", "asin": "\u001b[38;5;198m", "acos": "\u001b[38;5;198m", "atan": "\u001b[38;5;198m", "\d+": "\u001b[38;2;214;119;119m", "\+": "\u001b[38;2;112;112;112m", "-": "\u001b[38;2;112;112;112m", "\*\*?": "\u001b[38;2;112;112;112m", "/": "\u001b[38;2;112;112;112m", "%": "\u001b[38;2;112;112;112m", "\".*\"": "\u001b[38;2;26;166;228m", })
[ 1, 1053, 10876, 13, 5215, 260, 1017, 13, 5215, 337, 13, 5215, 2897, 13, 13, 13, 1753, 5877, 29918, 28970, 29898, 2080, 29892, 29361, 29901, 9657, 1125, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 8536, 4430, 353, 1881, 29889, 5451, 703, 16521, 13, 1678, 363, 285, 297, 8536, 4430, 29901, 13, 4706, 363, 13553, 297, 29361, 29889, 8149, 7295, 13, 9651, 565, 337, 29889, 4352, 29898, 26766, 29892, 285, 1125, 13, 18884, 8536, 4430, 29961, 29875, 29962, 353, 29361, 29889, 657, 29898, 13, 462, 1678, 13553, 29897, 718, 337, 29889, 2886, 497, 29898, 26766, 29892, 285, 9601, 29900, 29962, 718, 318, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29885, 29908, 13, 4706, 474, 4619, 29871, 29896, 13, 1678, 736, 376, 11393, 7122, 29898, 23579, 4430, 29897, 13, 13, 13, 1753, 1899, 29918, 1220, 29898, 1989, 9303, 29901, 9657, 1125, 13, 1678, 260, 1017, 29889, 842, 1610, 29898, 9675, 29889, 4172, 262, 29897, 13, 1678, 1881, 353, 5124, 13, 1678, 2380, 353, 29871, 29900, 13, 1678, 10876, 29889, 25393, 29889, 3539, 14182, 29876, 1159, 13, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29900, 29900, 29900, 29928, 1159, 13, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29968, 1159, 13, 1678, 437, 29918, 2158, 353, 5852, 13, 1678, 1550, 5852, 29901, 13, 4706, 565, 437, 29918, 2158, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 703, 6778, 29958, 16521, 13, 9651, 437, 29918, 2158, 353, 7700, 13, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 4706, 1373, 353, 10876, 29889, 4172, 262, 29889, 949, 29898, 29896, 29897, 13, 4706, 565, 1373, 1275, 29242, 1115, 13, 9651, 10876, 29889, 25393, 29889, 3539, 14182, 29876, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29900, 29900, 29900, 29928, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29968, 1159, 13, 9651, 736, 5124, 13, 4706, 565, 29871, 29941, 29906, 5277, 4356, 29898, 3090, 29897, 5277, 29871, 29896, 29906, 29953, 29901, 13, 9651, 1881, 4619, 1373, 13, 4706, 565, 4356, 29898, 3090, 29897, 1275, 29871, 29896, 29906, 29955, 29901, 13, 9651, 1881, 353, 1881, 7503, 2248, 29899, 29896, 29962, 13, 4706, 565, 4356, 29898, 3090, 29897, 297, 426, 29896, 29900, 29892, 29871, 29896, 29941, 6177, 13, 9651, 10876, 29889, 25393, 29889, 3539, 14182, 29876, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29900, 29900, 29900, 29928, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29968, 1159, 13, 9651, 10876, 29889, 25393, 29889, 23126, 580, 13, 9651, 411, 1722, 11974, 7050, 6294, 828, 574, 276, 572, 29889, 7382, 613, 376, 29893, 29974, 1159, 408, 285, 29901, 13, 18884, 285, 29889, 3539, 29898, 2080, 29897, 13, 9651, 2897, 29889, 5205, 703, 755, 3893, 847, 7050, 6294, 828, 574, 276, 572, 29889, 7382, 1159, 13, 9651, 1881, 353, 5124, 13, 9651, 10876, 29889, 25393, 29889, 3539, 14182, 29876, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29900, 29900, 29900, 29928, 1159, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29968, 1159, 13, 9651, 10876, 29889, 25393, 29889, 23126, 580, 13, 9651, 437, 29918, 2158, 353, 5852, 13, 9651, 6773, 13, 4706, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29896, 29900, 29900, 29900, 29928, 1159, 13, 4706, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29946, 29907, 1159, 13, 4706, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 29961, 29900, 29968, 1159, 13, 4706, 10876, 29889, 25393, 29889, 3539, 29898, 29562, 29918, 28970, 29898, 2080, 29892, 29361, 876, 13, 4706, 565, 2380, 1405, 29871, 29900, 29901, 13, 9651, 10876, 29889, 25393, 29889, 3539, 29898, 29884, 26732, 29884, 29900, 29900, 29896, 29890, 3366, 718, 851, 29898, 2248, 29897, 718, 376, 29907, 1159, 13, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 1678, 736, 1881, 13, 13, 13, 6519, 29918, 1220, 3319, 29908, 3676, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 1188, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 20834, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 5223, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 3944, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 13161, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 29883, 1182, 29873, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 294, 262, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 562, 359, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 376, 23402, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29945, 29936, 29896, 29929, 29947, 29885, 613, 13, 795, 6634, 29881, 29974, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29906, 29896, 29946, 29936, 29896, 29896, 29929, 29936, 29896, 29896, 29929, 29885, 613, 13, 795, 6634, 29974, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29885, 613, 13, 795, 11663, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29885, 613, 13, 795, 6634, 17710, 29930, 29973, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29885, 613, 13, 795, 5591, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29885, 613, 13, 795, 11860, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29936, 29896, 29896, 29906, 29885, 613, 13, 795, 6634, 1642, 29930, 5931, 1115, 6634, 29884, 29900, 29900, 29896, 29890, 29961, 29941, 29947, 29936, 29906, 29936, 29906, 29953, 29936, 29896, 29953, 29953, 29936, 29906, 29906, 29947, 29885, 613, 13, 795, 5615, 13, 2 ]
projects/projects/__init__.py
fgoettel/knx
0
155995
<gh_stars>0 """Import, export, compare different project exports.""" __author__ = """<NAME>""" __email__ = "<EMAIL>" __version__ = "0.3.0"
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 17518, 29892, 5609, 29892, 7252, 1422, 2060, 29586, 1213, 15945, 13, 13, 1649, 8921, 1649, 353, 9995, 29966, 5813, 11903, 15945, 13, 1649, 5269, 1649, 353, 9872, 26862, 6227, 11903, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29941, 29889, 29900, 29908, 13, 2 ]
digitalocean/Tags.py
SuleAlOthman/digitalocean
2
1604992
from .reqmethods import Req, Arrange class Tags(Req, Arrange): slug = 'tags' def __init__(self, token): self.setToken(token) def storeTags(self, tag): body = {"name":f'{tag}'} data = self.post(self.slug, body) return data def getTag(self, tag): data = self.get(f'{self.slug}/{tag}') return self.arrangeData(data) def getAllTags(self): data = self.get(self.slug) return self.arrangeData(data) def deleteTag(self, tag): body = {"name":f'{tag}'} data = self.delete(f'{self.slug}/{tag}') return data
[ 1, 515, 869, 7971, 23515, 1053, 830, 29939, 29892, 826, 3881, 13, 13, 13, 1990, 917, 29898, 1123, 29939, 29892, 826, 3881, 1125, 13, 12, 29517, 353, 525, 11338, 29915, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 5993, 1125, 13, 12, 12, 1311, 29889, 842, 6066, 29898, 6979, 29897, 13, 13, 12, 1753, 3787, 28089, 29898, 1311, 29892, 4055, 1125, 13, 12, 12, 2587, 353, 8853, 978, 1115, 29888, 29915, 29912, 4039, 10162, 29913, 13, 12, 12, 1272, 353, 1583, 29889, 2490, 29898, 1311, 29889, 29517, 29892, 3573, 29897, 13, 12, 12, 2457, 848, 13, 13, 12, 1753, 679, 8176, 29898, 1311, 29892, 4055, 1125, 13, 12, 12, 1272, 353, 1583, 29889, 657, 29898, 29888, 29915, 29912, 1311, 29889, 29517, 6822, 29912, 4039, 29913, 1495, 13, 12, 12, 2457, 1583, 29889, 279, 3881, 1469, 29898, 1272, 29897, 13, 13, 12, 1753, 679, 3596, 28089, 29898, 1311, 1125, 13, 12, 12, 1272, 353, 1583, 29889, 657, 29898, 1311, 29889, 29517, 29897, 13, 12, 12, 2457, 1583, 29889, 279, 3881, 1469, 29898, 1272, 29897, 13, 13, 12, 1753, 5217, 8176, 29898, 1311, 29892, 4055, 1125, 13, 12, 12, 2587, 353, 8853, 978, 1115, 29888, 29915, 29912, 4039, 10162, 29913, 13, 12, 12, 1272, 353, 1583, 29889, 8143, 29898, 29888, 29915, 29912, 1311, 29889, 29517, 6822, 29912, 4039, 29913, 1495, 13, 12, 12, 2457, 848, 2 ]
CPAC/AWS/aws_utils.py
danlurie/C-PAC
0
105674
# CPAC/AWS/aws_utils.py # # Contributing authors: # <NAME> ''' This module contains functions which assist in interacting with AWS services, including uploading/downloading data and file checking. ''' # Build and download a subject list def build_download_sublist(bucket, bucket_prefix, local_prefix, sub_list): ''' Function to build and download a subject list from S3 Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from bucket_prefix : string the bucket prefix where all of the file keys are located local_prefix : string the local disk prefix where all of the files should be downloaded to sub_list : list (dict) the C-PAC subject list that has inputs in local_prefix Returns ------- None this function does not return a value, it downloads the subjects from the C-PAC subject list to disk from S3 ''' # Import packages import os # Init variables local_list = [] for sub_dict in sub_list: local_list.append(sub_dict['anat']) local_list.extend([v for v in sub_dict['rest'].values()]) # Substitute the prefixes to build S3 list to download from s3_list = [l.replace(local_prefix, bucket_prefix) for l in local_list] # Check already-existing files and remove from download lists local_rm = [] s3_rm = [] # Build remove-lists for i in range(len(local_list)): l = local_list[i] s = s3_list[i] if os.path.exists(l): local_rm.append(l) s3_rm.append(s) # Go through remove lists and remove files for l, s in zip(local_rm, s3_rm): local_list.remove(l) s3_list.remove(s) # Download the data to the local prefix s3_download(bucket, s3_list, local_prefix, bucket_prefix=bucket_prefix) # Check to see they all downloaded successfully for l in local_list: l_path = os.path.abspath(l) if not os.path.exists(l_path): raise IOError('S3 files were not all downloaded.\n'\ 'Could not find: %s' % l_path) # Collect all files in directory as the source list def collect_subject_files(prefix_star, sub_id): ''' Function to collect all of the files in a directory into a list of full paths Parameters ---------- prefix_star : string filepath to the folder, in which, all of the sub-files are collected; this filepath should have a wildcard character of '*' so that glob can collect the files via the pattern given sub_id : string the subject id to look for in the output folder Returns ------- src_list : list [str] a list of filepaths (as strings) ''' # Import packages import glob import os # Init variables bases = glob.glob(prefix_star) src_list = [] # For each pipeline for base in bases: # Iterate through directory for root, dirs, files in os.walk(base): # If it's in the subject's folder and there are files if sub_id in root and files: src_list.extend([os.path.join(root, f) for f in files]) # Return the list return src_list # Get the MD5 sums of files on S3 def md5_sum(bucket, prefix='', filt_str=''): ''' Function to get the filenames and MD5 checksums of files stored in an S3 bucket and return this as a dictionary. Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from prefix : string (optional), default='' the bucket prefix where all of the file keys are located filt_str : string (optional), defualt='' a string to filter the filekeys of interest; e.g. 'matrix_data' will only return filekeys with the string 'matrix_data' in their filepath name Returns ------- md5_dict : dictionary {str : str} a dictionary where the keys are the S3 filename and the values are the MD5 checksum values ''' # Init variables blist = bucket.list(prefix) md5_dict = {} # And iterate over keys to copy over new ones for fkey in blist: filename = str(fkey.key) if filt_str in filename: md5_sum = str(fkey.etag).strip('"') md5_dict[filename] = md5_sum print 'filename: %s' % filename print 'md5_sum: %s' % md5_sum # Return the dictionary return md5_dict # Rename s3 keys from src_list to dst_list def s3_rename(bucket, src_list, dst_list, keep_old=False, overwrite=False, make_public=False): ''' Function to rename files from an AWS S3 bucket via a copy and delete process. Uses all keys in src_list as the original names and renames the them to the corresponding keys in the dst_list. (e.g. src_list[9] --> dst_list[9]) Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from src_list : list (str) a list of relative paths of the files to delete from the bucket dst_list : list (str) a list of relative paths of the files to delete from the bucket keep_old : boolean (optional), default=False flag indicating whether to keep the src_list files overwrite : boolean (optional), default=False flag indicated whether to overwrite the files in dst_list make_public : boolean (optional), default=False set to True if files should be publically available on S3 Returns ------- None The function doesn't return any value, it deletes data from S3 and prints its progress and a 'done' message upon completion ''' # Check list lengths are equal if len(src_list) != len(dst_list): raise ValueError('src_list and dst_list are different lengths!') # Init variables i = 0 no_files = len(src_list) # And iterate over keys to copy over new ones for f in src_list: src_key = bucket.get_key(f) if not src_key: print 'source file %s doesnt exist, skipping...' % f continue dst_key = dst_list[i] dst_exists = bucket.get_key(dst_key) if not dst_exists or overwrite: print 'copying source: ', str(src_key.key) print 'to destination: ', dst_key src_key.copy(bucket.name, dst_key) if make_public: print 'making public...' dk = bucket.get_key(dst_key) dk.make_public() if not keep_old: src_key.delete() else: print '%s exists and not overwriting' % dst_key i += 1 per = 100*(float(i)/no_files) print 'Done renaming %d/%d\n%f%% complete' % (i, no_files, per) # Delete s3 keys based on input list def s3_delete(bucket, in_list): ''' Method to delete files from an AWS S3 bucket that have the same names as those of an input list to a local directory. Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from in_list : list (str) a list of relative paths of the files to delete from the bucket Returns ------- None The function doesn't return any value, it deletes data from S3 and prints its progress and a 'done' message upon completion ''' # Init variables no_files = len(in_list) i = 0 # Iterate over list and delete S3 items for f in in_list: i += 1 try: print 'attempting to delete %s from %s...' % (f, bucket.name) k = bucket.get_key(f) k.delete() per = 100*(float(i)/no_files) print 'Done deleting %d/%d\n%f%% complete' % (i, no_files, per) except AttributeError: print 'No key found for %s on bucket %s' % (f, bucket.name) # Done iterating through list print 'done!' # Download files from AWS S3 to local machine def s3_download(bucket, in_list, local_prefix, bucket_prefix=''): ''' Method to download files from an AWS S3 bucket that have the same names as those of an input list to a local directory. Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from in_list : list (str) a list of relative paths of the files to download from the bucket local_prefix : string local directory prefix to store the downloaded data bucket_prefix : string (optional) bucket_prefix, if specified, will be substituted with local_prefix; otherwise, the local_prefix will only prepend the downloaded files Returns ------- None The function doesn't return any value, it downloads data from S3 and prints its progress and a 'done' message upon completion ''' # Impor packages import os # Init variables no_files = len(in_list) i = 0 # Check for trailing '/' if not local_prefix.endswith('/'): local_prefix = local_prefix + '/' if bucket_prefix and not bucket_prefix.endswith('/'): bucket_prefix = bucket_prefix + '/' # For each item in the list, try to download it for f in in_list: i += 1 remote_filename = bucket.name + ': ' + f if bucket_prefix: local_filename = f.replace(bucket_prefix, local_prefix) else: local_filename = os.path.join(local_prefix, f) # Check to see if the local folder setup exists or not local_folders = os.path.dirname(local_filename) if not os.path.isdir(local_folders): print 'creating %s on local machine' % local_folders os.makedirs(local_folders) # Attempt to download the file print 'attempting to download %s to %s...' % (remote_filename, local_filename) try: if not os.path.exists(local_filename): k = bucket.get_key(f) k.get_contents_to_filename(local_filename) per = 100*(float(i)/no_files) print 'Done downloading %d/%d\n%f%% complete' % (i, no_files, per) else: print 'File %s already exists, skipping...' % local_filename except AttributeError: print 'No key found for %s on bucket %s' % (f, bucket.name) # Done iterating through list print 'done!' # Upload files to AWS S3 def s3_upload(bucket, src_list, dst_list, make_public=False, overwrite=False): ''' Function to upload a list of data to an S3 bucket Parameters ---------- bucket : boto.s3.bucket.Bucket instance an instance of the boto S3 bucket class to download from src_list : list (str) list of filepaths as strings to upload to S3 dst_list : list (str) list of filepaths as strings coinciding with src_list, such that src_list[1] gets uploaded to S3 with the S3 path given in dst_list[1] make_public : boolean (optional), default=False set to True if files should be publically available on S3 overwrite : boolean (optional), default=False set to True if the uploaded files should overwrite what is already there Returns ------- None The function doesn't return any value, it uploads data to S3 and prints its progress and a 'done' message upon completion ''' # Callback function for upload progress update def callback(complete, total): ''' Method to illustrate file uploading and progress updates ''' # Import packages import sys # Write ...'s to the output for loading progress sys.stdout.write('.') sys.stdout.flush() # Init variables no_files = len(src_list) i = 0 # Check if the list lengths match if no_files != len(dst_list): raise RuntimeError, 'src_list and dst_list must be the same length!' # For each source file, upload for src_file in src_list: # Get destination path dst_file = dst_list[i] # Print status print 'Uploading %s to S3 bucket %s as %s' % \ (src_file, bucket.name, dst_file) # Create a new key from the bucket and set its contents k = bucket.new_key(dst_file) if k.exists() and not overwrite: print 'key %s already exists, skipping...' % dst_file else: k.set_contents_from_filename(src_file, cb=callback, replace=True) # Make file public if set to True if make_public: print 'make public()' k.make_public() i += 1 per = 100*(float(i)/no_files) print 'finished file %d/%d\n%f%% complete\n' % \ (i, no_files, per) # Print when finished print 'Done!'
[ 1, 396, 28505, 2477, 29914, 29909, 7811, 29914, 10467, 29918, 13239, 29889, 2272, 13, 29937, 13, 29937, 2866, 1091, 17068, 15717, 29901, 13, 29937, 529, 5813, 29958, 13, 13, 12008, 13, 4013, 3883, 3743, 3168, 607, 6985, 297, 16254, 292, 411, 15540, 13, 9916, 29892, 3704, 6441, 292, 29914, 10382, 292, 848, 322, 934, 8454, 29889, 13, 12008, 13, 13, 29937, 8878, 322, 5142, 263, 4967, 1051, 13, 1753, 2048, 29918, 10382, 29918, 1491, 1761, 29898, 21454, 29892, 20968, 29918, 13506, 29892, 1887, 29918, 13506, 29892, 1014, 29918, 1761, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 2048, 322, 5142, 263, 4967, 1051, 515, 317, 29941, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 20968, 29918, 13506, 584, 1347, 13, 4706, 278, 20968, 10944, 988, 599, 310, 278, 934, 6611, 526, 5982, 13, 1678, 1887, 29918, 13506, 584, 1347, 13, 4706, 278, 1887, 8086, 10944, 988, 599, 310, 278, 2066, 881, 367, 16532, 304, 13, 1678, 1014, 29918, 1761, 584, 1051, 313, 8977, 29897, 13, 4706, 278, 315, 29899, 29925, 2477, 4967, 1051, 393, 756, 10970, 297, 1887, 29918, 13506, 13, 268, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 6213, 13, 4706, 445, 740, 947, 451, 736, 263, 995, 29892, 372, 5142, 29879, 278, 17800, 515, 13, 4706, 278, 315, 29899, 29925, 2477, 4967, 1051, 304, 8086, 515, 317, 29941, 13, 1678, 14550, 13, 268, 13, 1678, 396, 16032, 9741, 13, 1678, 1053, 2897, 13, 268, 13, 1678, 396, 10886, 3651, 13, 1678, 1887, 29918, 1761, 353, 5159, 13, 1678, 363, 1014, 29918, 8977, 297, 1014, 29918, 1761, 29901, 13, 4706, 1887, 29918, 1761, 29889, 4397, 29898, 1491, 29918, 8977, 1839, 273, 271, 11287, 13, 4706, 1887, 29918, 1761, 29889, 21843, 4197, 29894, 363, 325, 297, 1014, 29918, 8977, 1839, 5060, 13359, 5975, 580, 2314, 13, 13, 1678, 396, 3323, 303, 12356, 278, 10944, 267, 304, 2048, 317, 29941, 1051, 304, 5142, 515, 13, 1678, 269, 29941, 29918, 1761, 353, 518, 29880, 29889, 6506, 29898, 2997, 29918, 13506, 29892, 20968, 29918, 13506, 29897, 363, 301, 297, 1887, 29918, 1761, 29962, 13, 13, 1678, 396, 5399, 2307, 29899, 735, 15423, 2066, 322, 3349, 515, 5142, 8857, 13, 1678, 1887, 29918, 1758, 353, 5159, 13, 1678, 269, 29941, 29918, 1758, 353, 5159, 13, 1678, 396, 8878, 3349, 29899, 21513, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 2997, 29918, 1761, 22164, 13, 4706, 301, 353, 1887, 29918, 1761, 29961, 29875, 29962, 13, 4706, 269, 353, 269, 29941, 29918, 1761, 29961, 29875, 29962, 13, 4706, 565, 2897, 29889, 2084, 29889, 9933, 29898, 29880, 1125, 13, 9651, 1887, 29918, 1758, 29889, 4397, 29898, 29880, 29897, 13, 9651, 269, 29941, 29918, 1758, 29889, 4397, 29898, 29879, 29897, 13, 1678, 396, 2921, 1549, 3349, 8857, 322, 3349, 2066, 13, 1678, 363, 301, 29892, 269, 297, 14319, 29898, 2997, 29918, 1758, 29892, 269, 29941, 29918, 1758, 1125, 13, 4706, 1887, 29918, 1761, 29889, 5992, 29898, 29880, 29897, 13, 4706, 269, 29941, 29918, 1761, 29889, 5992, 29898, 29879, 29897, 13, 13, 1678, 396, 25553, 278, 848, 304, 278, 1887, 10944, 13, 1678, 269, 29941, 29918, 10382, 29898, 21454, 29892, 269, 29941, 29918, 1761, 29892, 1887, 29918, 13506, 29892, 20968, 29918, 13506, 29922, 21454, 29918, 13506, 29897, 13, 268, 13, 1678, 396, 5399, 304, 1074, 896, 599, 16532, 8472, 13, 1678, 363, 301, 297, 1887, 29918, 1761, 29901, 13, 4706, 301, 29918, 2084, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 29880, 29897, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 29880, 29918, 2084, 1125, 13, 9651, 12020, 10663, 2392, 877, 29903, 29941, 2066, 892, 451, 599, 16532, 7790, 29876, 12764, 13, 462, 3986, 525, 23323, 451, 1284, 29901, 1273, 29879, 29915, 1273, 301, 29918, 2084, 29897, 13, 13, 13, 29937, 24930, 599, 2066, 297, 3884, 408, 278, 2752, 1051, 13, 1753, 6314, 29918, 16009, 29918, 5325, 29898, 13506, 29918, 8508, 29892, 1014, 29918, 333, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 6314, 599, 310, 278, 2066, 297, 263, 3884, 964, 263, 1051, 310, 13, 1678, 2989, 10898, 13, 268, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 10944, 29918, 8508, 584, 1347, 13, 4706, 934, 2084, 304, 278, 4138, 29892, 297, 607, 29892, 599, 310, 278, 1014, 29899, 5325, 526, 13, 4706, 16531, 29936, 445, 934, 2084, 881, 505, 263, 8775, 7543, 2931, 310, 13, 4706, 525, 29930, 29915, 577, 393, 13149, 508, 6314, 278, 2066, 3025, 278, 4766, 2183, 13, 1678, 1014, 29918, 333, 584, 1347, 13, 4706, 278, 4967, 1178, 304, 1106, 363, 297, 278, 1962, 4138, 13, 268, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 4765, 29918, 1761, 584, 1051, 518, 710, 29962, 13, 4706, 263, 1051, 310, 934, 24772, 313, 294, 6031, 29897, 13, 1678, 14550, 13, 13, 1678, 396, 16032, 9741, 13, 1678, 1053, 13149, 13, 1678, 1053, 2897, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 22561, 353, 13149, 29889, 23705, 29898, 13506, 29918, 8508, 29897, 13, 1678, 4765, 29918, 1761, 353, 5159, 13, 268, 13, 1678, 396, 1152, 1269, 16439, 13, 1678, 363, 2967, 297, 22561, 29901, 13, 4706, 396, 20504, 403, 1549, 3884, 13, 4706, 363, 3876, 29892, 4516, 29879, 29892, 2066, 297, 2897, 29889, 20919, 29898, 3188, 1125, 13, 9651, 396, 960, 372, 29915, 29879, 297, 278, 4967, 29915, 29879, 4138, 322, 727, 526, 2066, 13, 9651, 565, 1014, 29918, 333, 297, 3876, 322, 2066, 29901, 13, 18884, 4765, 29918, 1761, 29889, 21843, 4197, 359, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 285, 29897, 363, 285, 297, 2066, 2314, 13, 13, 1678, 396, 7106, 278, 1051, 13, 1678, 736, 4765, 29918, 1761, 13, 13, 13, 29937, 3617, 278, 20672, 29945, 25470, 310, 2066, 373, 317, 29941, 13, 1753, 22821, 29945, 29918, 2083, 29898, 21454, 29892, 10944, 2433, 742, 977, 29873, 29918, 710, 2433, 29374, 13, 1678, 14550, 13, 1678, 6680, 304, 679, 278, 977, 264, 1280, 322, 20672, 29945, 1423, 2083, 29879, 310, 2066, 6087, 297, 13, 1678, 385, 317, 29941, 20968, 322, 736, 445, 408, 263, 8600, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 10944, 584, 1347, 313, 25253, 511, 2322, 2433, 29915, 13, 4706, 278, 20968, 10944, 988, 599, 310, 278, 934, 6611, 526, 5982, 13, 1678, 977, 29873, 29918, 710, 584, 1347, 313, 25253, 511, 822, 950, 29873, 2433, 29915, 13, 4706, 263, 1347, 304, 4175, 278, 934, 8149, 310, 4066, 29936, 13, 4706, 321, 29889, 29887, 29889, 525, 5344, 29918, 1272, 29915, 674, 871, 736, 934, 8149, 411, 278, 1347, 13, 4706, 525, 5344, 29918, 1272, 29915, 297, 1009, 934, 2084, 1024, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 22821, 29945, 29918, 8977, 584, 8600, 426, 710, 584, 851, 29913, 13, 4706, 263, 8600, 988, 278, 6611, 526, 278, 317, 29941, 10422, 322, 278, 1819, 13, 4706, 526, 278, 20672, 29945, 1423, 2083, 1819, 13, 1678, 14550, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 289, 1761, 353, 20968, 29889, 1761, 29898, 13506, 29897, 13, 1678, 22821, 29945, 29918, 8977, 353, 6571, 13, 13, 1678, 396, 1126, 13649, 975, 6611, 304, 3509, 975, 716, 6743, 13, 1678, 363, 285, 1989, 297, 289, 1761, 29901, 13, 4706, 10422, 353, 851, 29898, 29888, 1989, 29889, 1989, 29897, 13, 4706, 565, 977, 29873, 29918, 710, 297, 10422, 29901, 13, 9651, 22821, 29945, 29918, 2083, 353, 851, 29898, 29888, 1989, 29889, 300, 351, 467, 17010, 877, 29908, 1495, 13, 9651, 22821, 29945, 29918, 8977, 29961, 9507, 29962, 353, 22821, 29945, 29918, 2083, 13, 9651, 1596, 525, 9507, 29901, 1273, 29879, 29915, 1273, 10422, 13, 9651, 1596, 525, 3487, 29945, 29918, 2083, 29901, 1273, 29879, 29915, 1273, 22821, 29945, 29918, 2083, 13, 13, 1678, 396, 7106, 278, 8600, 13, 1678, 736, 22821, 29945, 29918, 8977, 13, 13, 13, 29937, 390, 3871, 269, 29941, 6611, 515, 4765, 29918, 1761, 304, 29743, 29918, 1761, 13, 1753, 269, 29941, 29918, 1267, 420, 29898, 21454, 29892, 4765, 29918, 1761, 29892, 29743, 29918, 1761, 29892, 13, 795, 3013, 29918, 1025, 29922, 8824, 29892, 26556, 29922, 8824, 29892, 1207, 29918, 3597, 29922, 8824, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 19508, 2066, 515, 385, 15540, 317, 29941, 20968, 3025, 263, 3509, 322, 5217, 13, 1678, 1889, 29889, 10783, 267, 599, 6611, 297, 4765, 29918, 1761, 408, 278, 2441, 2983, 322, 4325, 1280, 13, 1678, 278, 963, 304, 278, 6590, 6611, 297, 278, 29743, 29918, 1761, 29889, 13, 1678, 313, 29872, 29889, 29887, 29889, 4765, 29918, 1761, 29961, 29929, 29962, 6660, 29743, 29918, 1761, 29961, 29929, 2314, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 4765, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 263, 1051, 310, 6198, 10898, 310, 278, 2066, 304, 5217, 515, 278, 20968, 13, 1678, 29743, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 263, 1051, 310, 6198, 10898, 310, 278, 2066, 304, 5217, 515, 278, 20968, 13, 1678, 3013, 29918, 1025, 584, 7223, 313, 25253, 511, 2322, 29922, 8824, 13, 4706, 7353, 23941, 3692, 304, 3013, 278, 4765, 29918, 1761, 2066, 13, 1678, 26556, 584, 7223, 313, 25253, 511, 2322, 29922, 8824, 13, 4706, 7353, 18694, 3692, 304, 26556, 278, 2066, 297, 29743, 29918, 1761, 13, 1678, 1207, 29918, 3597, 584, 7223, 313, 25253, 511, 2322, 29922, 8824, 13, 4706, 731, 304, 5852, 565, 2066, 881, 367, 970, 635, 3625, 373, 317, 29941, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 6213, 13, 4706, 450, 740, 1838, 29915, 29873, 736, 738, 995, 29892, 372, 7374, 267, 848, 515, 13, 4706, 317, 29941, 322, 14677, 967, 6728, 322, 263, 525, 15091, 29915, 2643, 2501, 13285, 13, 1678, 14550, 13, 13, 1678, 396, 5399, 1051, 27497, 526, 5186, 13, 1678, 565, 7431, 29898, 4351, 29918, 1761, 29897, 2804, 7431, 29898, 22992, 29918, 1761, 1125, 13, 4706, 12020, 7865, 2392, 877, 4351, 29918, 1761, 322, 29743, 29918, 1761, 526, 1422, 27497, 29991, 1495, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 694, 29918, 5325, 353, 7431, 29898, 4351, 29918, 1761, 29897, 13, 13, 1678, 396, 1126, 13649, 975, 6611, 304, 3509, 975, 716, 6743, 13, 1678, 363, 285, 297, 4765, 29918, 1761, 29901, 13, 4706, 4765, 29918, 1989, 353, 20968, 29889, 657, 29918, 1989, 29898, 29888, 29897, 13, 4706, 565, 451, 4765, 29918, 1989, 29901, 13, 9651, 1596, 525, 4993, 934, 1273, 29879, 19403, 1863, 29892, 14993, 3262, 856, 29915, 1273, 285, 13, 9651, 6773, 13, 4706, 29743, 29918, 1989, 353, 29743, 29918, 1761, 29961, 29875, 29962, 13, 4706, 29743, 29918, 9933, 353, 20968, 29889, 657, 29918, 1989, 29898, 22992, 29918, 1989, 29897, 13, 4706, 565, 451, 29743, 29918, 9933, 470, 26556, 29901, 13, 9651, 1596, 525, 8552, 292, 2752, 29901, 13420, 851, 29898, 4351, 29918, 1989, 29889, 1989, 29897, 13, 9651, 1596, 525, 517, 12551, 29901, 13420, 29743, 29918, 1989, 13, 9651, 4765, 29918, 1989, 29889, 8552, 29898, 21454, 29889, 978, 29892, 29743, 29918, 1989, 29897, 13, 9651, 565, 1207, 29918, 3597, 29901, 13, 18884, 1596, 525, 28990, 970, 856, 29915, 13, 18884, 270, 29895, 353, 20968, 29889, 657, 29918, 1989, 29898, 22992, 29918, 1989, 29897, 13, 18884, 270, 29895, 29889, 5675, 29918, 3597, 580, 13, 9651, 565, 451, 3013, 29918, 1025, 29901, 13, 18884, 4765, 29918, 1989, 29889, 8143, 580, 13, 4706, 1683, 29901, 13, 9651, 1596, 14210, 29879, 4864, 322, 451, 975, 16554, 29915, 1273, 29743, 29918, 1989, 13, 4706, 474, 4619, 29871, 29896, 13, 4706, 639, 353, 29871, 29896, 29900, 29900, 16395, 7411, 29898, 29875, 6802, 1217, 29918, 5325, 29897, 13, 4706, 1596, 525, 25632, 4325, 11500, 1273, 29881, 22584, 29881, 29905, 29876, 29995, 29888, 7686, 4866, 29915, 1273, 313, 29875, 29892, 694, 29918, 5325, 29892, 639, 29897, 13, 13, 13, 29937, 21267, 269, 29941, 6611, 2729, 373, 1881, 1051, 13, 1753, 269, 29941, 29918, 8143, 29898, 21454, 29892, 297, 29918, 1761, 1125, 13, 1678, 14550, 13, 1678, 8108, 304, 5217, 2066, 515, 385, 15540, 317, 29941, 20968, 393, 505, 278, 1021, 13, 1678, 2983, 408, 1906, 310, 385, 1881, 1051, 304, 263, 1887, 3884, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 297, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 263, 1051, 310, 6198, 10898, 310, 278, 2066, 304, 5217, 515, 278, 20968, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 6213, 13, 4706, 450, 740, 1838, 29915, 29873, 736, 738, 995, 29892, 372, 7374, 267, 848, 515, 13, 4706, 317, 29941, 322, 14677, 967, 6728, 322, 263, 525, 15091, 29915, 2643, 2501, 13285, 13, 1678, 14550, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 694, 29918, 5325, 353, 7431, 29898, 262, 29918, 1761, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 396, 20504, 403, 975, 1051, 322, 5217, 317, 29941, 4452, 13, 1678, 363, 285, 297, 297, 29918, 1761, 29901, 13, 4706, 474, 4619, 29871, 29896, 13, 4706, 1018, 29901, 13, 9651, 1596, 525, 1131, 3456, 292, 304, 5217, 1273, 29879, 515, 1273, 29879, 856, 29915, 1273, 313, 29888, 29892, 20968, 29889, 978, 29897, 13, 9651, 413, 353, 20968, 29889, 657, 29918, 1989, 29898, 29888, 29897, 13, 9651, 413, 29889, 8143, 580, 13, 9651, 639, 353, 29871, 29896, 29900, 29900, 16395, 7411, 29898, 29875, 6802, 1217, 29918, 5325, 29897, 13, 9651, 1596, 525, 25632, 21228, 1273, 29881, 22584, 29881, 29905, 29876, 29995, 29888, 7686, 4866, 29915, 1273, 313, 29875, 29892, 694, 29918, 5325, 29892, 639, 29897, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 1596, 525, 3782, 1820, 1476, 363, 1273, 29879, 373, 20968, 1273, 29879, 29915, 1273, 313, 29888, 29892, 20968, 29889, 978, 29897, 13, 13, 4706, 396, 25679, 4256, 1218, 1549, 1051, 13, 4706, 1596, 525, 15091, 20714, 13, 13, 13, 29937, 25553, 2066, 515, 15540, 317, 29941, 304, 1887, 4933, 13, 1753, 269, 29941, 29918, 10382, 29898, 21454, 29892, 297, 29918, 1761, 29892, 1887, 29918, 13506, 29892, 20968, 29918, 13506, 2433, 29374, 13, 1678, 14550, 13, 1678, 8108, 304, 5142, 2066, 515, 385, 15540, 317, 29941, 20968, 393, 505, 278, 1021, 13, 1678, 2983, 408, 1906, 310, 385, 1881, 1051, 304, 263, 1887, 3884, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 297, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 263, 1051, 310, 6198, 10898, 310, 278, 2066, 304, 5142, 515, 278, 20968, 13, 1678, 1887, 29918, 13506, 584, 1347, 13, 4706, 1887, 3884, 10944, 304, 3787, 278, 16532, 848, 13, 1678, 20968, 29918, 13506, 584, 1347, 313, 25253, 29897, 13, 4706, 20968, 29918, 13506, 29892, 565, 6790, 29892, 674, 367, 5960, 277, 3860, 411, 13, 4706, 1887, 29918, 13506, 29936, 6467, 29892, 278, 1887, 29918, 13506, 674, 871, 8273, 355, 278, 13, 4706, 16532, 2066, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 6213, 13, 4706, 450, 740, 1838, 29915, 29873, 736, 738, 995, 29892, 372, 5142, 29879, 848, 515, 13, 4706, 317, 29941, 322, 14677, 967, 6728, 322, 263, 525, 15091, 29915, 2643, 2501, 13285, 13, 1678, 14550, 13, 13, 1678, 396, 14305, 272, 9741, 13, 1678, 1053, 2897, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 694, 29918, 5325, 353, 7431, 29898, 262, 29918, 1761, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 396, 5399, 363, 25053, 8207, 29915, 13, 1678, 565, 451, 1887, 29918, 13506, 29889, 1975, 2541, 11219, 29374, 13, 4706, 1887, 29918, 13506, 353, 1887, 29918, 13506, 718, 8207, 29915, 13, 1678, 565, 20968, 29918, 13506, 322, 451, 20968, 29918, 13506, 29889, 1975, 2541, 11219, 29374, 13, 4706, 20968, 29918, 13506, 353, 20968, 29918, 13506, 718, 8207, 29915, 13, 1678, 396, 1152, 1269, 2944, 297, 278, 1051, 29892, 1018, 304, 5142, 372, 13, 1678, 363, 285, 297, 297, 29918, 1761, 29901, 13, 4706, 474, 4619, 29871, 29896, 13, 4706, 7592, 29918, 9507, 353, 20968, 29889, 978, 718, 525, 29901, 525, 718, 285, 13, 4706, 565, 20968, 29918, 13506, 29901, 13, 9651, 1887, 29918, 9507, 353, 285, 29889, 6506, 29898, 21454, 29918, 13506, 29892, 1887, 29918, 13506, 29897, 13, 4706, 1683, 29901, 13, 9651, 1887, 29918, 9507, 353, 2897, 29889, 2084, 29889, 7122, 29898, 2997, 29918, 13506, 29892, 285, 29897, 13, 4706, 396, 5399, 304, 1074, 565, 278, 1887, 4138, 6230, 4864, 470, 451, 13, 4706, 1887, 29918, 8771, 414, 353, 2897, 29889, 2084, 29889, 25721, 29898, 2997, 29918, 9507, 29897, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 2997, 29918, 8771, 414, 1125, 13, 9651, 1596, 525, 1037, 1218, 1273, 29879, 373, 1887, 4933, 29915, 1273, 1887, 29918, 8771, 414, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 2997, 29918, 8771, 414, 29897, 13, 4706, 396, 6212, 3456, 304, 5142, 278, 934, 13, 4706, 1596, 525, 1131, 3456, 292, 304, 5142, 1273, 29879, 304, 1273, 29879, 856, 29915, 1273, 313, 16674, 29918, 9507, 29892, 13, 462, 462, 462, 418, 1887, 29918, 9507, 29897, 13, 4706, 1018, 29901, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2997, 29918, 9507, 1125, 13, 18884, 413, 353, 20968, 29889, 657, 29918, 1989, 29898, 29888, 29897, 13, 18884, 413, 29889, 657, 29918, 10853, 29918, 517, 29918, 9507, 29898, 2997, 29918, 9507, 29897, 13, 18884, 639, 353, 29871, 29896, 29900, 29900, 16395, 7411, 29898, 29875, 6802, 1217, 29918, 5325, 29897, 13, 18884, 1596, 525, 25632, 28536, 1273, 29881, 22584, 29881, 29905, 29876, 29995, 29888, 7686, 4866, 29915, 1273, 313, 29875, 29892, 694, 29918, 5325, 29892, 639, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 525, 2283, 1273, 29879, 2307, 4864, 29892, 14993, 3262, 856, 29915, 1273, 1887, 29918, 9507, 13, 4706, 5174, 23833, 2392, 29901, 13, 9651, 1596, 525, 3782, 1820, 1476, 363, 1273, 29879, 373, 20968, 1273, 29879, 29915, 1273, 313, 29888, 29892, 20968, 29889, 978, 29897, 13, 13, 1678, 396, 25679, 4256, 1218, 1549, 1051, 13, 1678, 1596, 525, 15091, 20714, 13, 13, 13, 29937, 5020, 1359, 2066, 304, 15540, 317, 29941, 13, 1753, 269, 29941, 29918, 9009, 29898, 21454, 29892, 4765, 29918, 1761, 29892, 29743, 29918, 1761, 29892, 1207, 29918, 3597, 29922, 8824, 29892, 26556, 29922, 8824, 1125, 13, 1678, 14550, 13, 1678, 6680, 304, 6441, 263, 1051, 310, 848, 304, 385, 317, 29941, 20968, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 20968, 584, 289, 3747, 29889, 29879, 29941, 29889, 21454, 29889, 29933, 2707, 300, 2777, 13, 4706, 385, 2777, 310, 278, 289, 3747, 317, 29941, 20968, 770, 304, 5142, 515, 13, 1678, 4765, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 1051, 310, 934, 24772, 408, 6031, 304, 6441, 304, 317, 29941, 13, 1678, 29743, 29918, 1761, 584, 1051, 313, 710, 29897, 13, 4706, 1051, 310, 934, 24772, 408, 6031, 22819, 4821, 411, 4765, 29918, 1761, 29892, 1316, 13, 4706, 393, 4765, 29918, 1761, 29961, 29896, 29962, 4947, 20373, 304, 317, 29941, 411, 278, 317, 29941, 2224, 2183, 297, 13, 4706, 29743, 29918, 1761, 29961, 29896, 29962, 13, 1678, 1207, 29918, 3597, 584, 7223, 313, 25253, 511, 2322, 29922, 8824, 13, 4706, 731, 304, 5852, 565, 2066, 881, 367, 970, 635, 3625, 373, 317, 29941, 13, 1678, 26556, 584, 7223, 313, 25253, 511, 2322, 29922, 8824, 13, 4706, 731, 304, 5852, 565, 278, 20373, 2066, 881, 26556, 825, 338, 13, 4706, 2307, 727, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 6213, 13, 4706, 450, 740, 1838, 29915, 29873, 736, 738, 995, 29892, 372, 6441, 29879, 848, 304, 317, 29941, 13, 4706, 322, 14677, 967, 6728, 322, 263, 525, 15091, 29915, 2643, 2501, 13285, 13, 1678, 14550, 13, 13, 1678, 396, 8251, 1627, 740, 363, 6441, 6728, 2767, 13, 1678, 822, 6939, 29898, 8835, 29892, 3001, 1125, 13, 4706, 14550, 13, 4706, 8108, 304, 28475, 934, 6441, 292, 322, 6728, 11217, 13, 4706, 14550, 13, 13, 4706, 396, 16032, 9741, 13, 4706, 1053, 10876, 13, 13, 4706, 396, 14350, 2023, 29915, 29879, 304, 278, 1962, 363, 8363, 6728, 13, 4706, 10876, 29889, 25393, 29889, 3539, 12839, 1495, 13, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 1678, 396, 10886, 3651, 13, 1678, 694, 29918, 5325, 353, 7431, 29898, 4351, 29918, 1761, 29897, 13, 1678, 474, 353, 29871, 29900, 13, 13, 1678, 396, 5399, 565, 278, 1051, 27497, 1993, 29871, 13, 1678, 565, 694, 29918, 5325, 2804, 7431, 29898, 22992, 29918, 1761, 1125, 13, 4706, 12020, 24875, 2392, 29892, 525, 4351, 29918, 1761, 322, 29743, 29918, 1761, 1818, 367, 278, 1021, 3309, 20714, 13, 13, 1678, 396, 1152, 1269, 2752, 934, 29892, 6441, 13, 1678, 363, 4765, 29918, 1445, 297, 4765, 29918, 1761, 29901, 13, 4706, 396, 3617, 12551, 2224, 13, 4706, 29743, 29918, 1445, 353, 29743, 29918, 1761, 29961, 29875, 29962, 13, 4706, 396, 13905, 4660, 13, 4706, 1596, 525, 3373, 13234, 1273, 29879, 304, 317, 29941, 20968, 1273, 29879, 408, 1273, 29879, 29915, 1273, 320, 13, 4706, 313, 4351, 29918, 1445, 29892, 20968, 29889, 978, 29892, 29743, 29918, 1445, 29897, 13, 13, 4706, 396, 6204, 263, 716, 1820, 515, 278, 20968, 322, 731, 967, 8118, 13, 4706, 413, 353, 20968, 29889, 1482, 29918, 1989, 29898, 22992, 29918, 1445, 29897, 13, 4706, 565, 413, 29889, 9933, 580, 322, 451, 26556, 29901, 13, 9651, 1596, 525, 1989, 1273, 29879, 2307, 4864, 29892, 14993, 3262, 856, 29915, 1273, 29743, 29918, 1445, 13, 4706, 1683, 29901, 13, 9651, 413, 29889, 842, 29918, 10853, 29918, 3166, 29918, 9507, 29898, 4351, 29918, 1445, 29892, 26324, 29922, 14035, 29892, 5191, 29922, 5574, 29897, 13, 4706, 396, 8561, 934, 970, 565, 731, 304, 5852, 13, 4706, 565, 1207, 29918, 3597, 29901, 13, 9651, 1596, 525, 5675, 970, 580, 29915, 13, 9651, 413, 29889, 5675, 29918, 3597, 580, 13, 4706, 474, 4619, 29871, 29896, 13, 4706, 639, 353, 29871, 29896, 29900, 29900, 16395, 7411, 29898, 29875, 6802, 1217, 29918, 5325, 29897, 13, 4706, 1596, 525, 4951, 3276, 934, 1273, 29881, 22584, 29881, 29905, 29876, 29995, 29888, 7686, 4866, 29905, 29876, 29915, 1273, 320, 13, 4706, 313, 29875, 29892, 694, 29918, 5325, 29892, 639, 29897, 13, 13, 1678, 396, 13905, 746, 7743, 13, 1678, 1596, 525, 25632, 20714, 13, 2 ]
src/coniql/plugin.py
thomascobb/coniql
3
151771
<reponame>thomascobb/coniql import os from pathlib import Path from typing import AsyncIterator, Dict, List, Tuple, Union import numpy as np from coniql.device_config import ChannelConfig, DeviceConfig, DeviceInstance, walk from coniql.types import Channel PutValue = Union[bool, int, float, str, List[str], np.ndarray] class Plugin: transport: str async def get_channel( self, pv: str, timeout: float, config: ChannelConfig ) -> Channel: """Get the current structure of a Channel""" raise NotImplementedError(self) async def put_channels( self, pvs: List[str], values: List[PutValue], timeout: float ): """Put a value to a channel, returning the structure after put""" raise NotImplementedError(self) async def subscribe_channel( self, pv: str, config: ChannelConfig ) -> AsyncIterator[Channel]: """Subscribe to the structure of the Channel, yielding structures where only changing top level fields are filled in""" raise NotImplementedError(self) yield class PluginStore: def __init__(self): # {transport: plugin} self.plugins: Dict[str, Plugin] = {} # {device_id: device_config} self.devices: Dict[str, DeviceConfig] = {} # {fully_qualified_channel_id: channel_config} self.channels: Dict[str, ChannelConfig] = {} def add_plugin(self, transport: str, plugin: Plugin, set_default=False): self.plugins[transport] = plugin plugin.transport = transport if set_default: self.plugins[""] = plugin def transport_pv(self, channel_id: str) -> Tuple[str, str]: """Take a channel_id with an optional transport prefix and return the transport and pv components""" split = channel_id.split("://", 1) if len(split) == 1: transport, pv = self.plugins[""].transport, channel_id else: transport, pv = split return transport, pv def add_device_config(self, path: Path, device_id="", macros=None): """Load a top level .coniql.yaml file with devices in it""" device_config = DeviceConfig.from_yaml(path, macros) if device_id: self.devices[device_id] = device_config # Relative paths are relative to the path being loaded, so go there cwd = Path.cwd() os.chdir(path.resolve().parent) try: for child in walk(device_config.children): if isinstance(child, ChannelConfig): # TODO: selectively update channel if already exists transport, pv = self.transport_pv(child.write_pv or child.read_pv) self.channels[f"{transport}://{pv}"] = child elif isinstance(child, DeviceInstance): # recursively load child devices if child.id is None: if device_id: child.id = device_id + "." + child.name else: child.id = child.name self.add_device_config(child.file, child.id, child.macros) finally: os.chdir(cwd) return device_config def plugin_config_id(self, channel_id: str) -> Tuple[Plugin, ChannelConfig, str]: transport, pv = self.transport_pv(channel_id) channel_id = f"{transport}://{pv}" plugin = self.plugins[transport] config = self.channels.get(channel_id, None) if config is None: # None exists, make a RW config config = ChannelConfig(name="", read_pv=channel_id, write_pv=channel_id) return plugin, config, channel_id
[ 1, 529, 276, 1112, 420, 29958, 386, 290, 6151, 20838, 29914, 535, 29875, 1519, 13, 5215, 2897, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 19229, 1053, 20688, 20277, 29892, 360, 919, 29892, 2391, 29892, 12603, 552, 29892, 7761, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 378, 29875, 1519, 29889, 10141, 29918, 2917, 1053, 17368, 3991, 29892, 21830, 3991, 29892, 21830, 4998, 29892, 6686, 13, 3166, 378, 29875, 1519, 29889, 8768, 1053, 17368, 13, 13, 22908, 1917, 353, 7761, 29961, 11227, 29892, 938, 29892, 5785, 29892, 851, 29892, 2391, 29961, 710, 1402, 7442, 29889, 299, 2378, 29962, 13, 13, 13, 1990, 1858, 3851, 29901, 13, 1678, 8608, 29901, 851, 13, 13, 1678, 7465, 822, 679, 29918, 12719, 29898, 13, 4706, 1583, 29892, 282, 29894, 29901, 851, 29892, 11815, 29901, 5785, 29892, 2295, 29901, 17368, 3991, 13, 1678, 1723, 1599, 17368, 29901, 13, 4706, 9995, 2577, 278, 1857, 3829, 310, 263, 17368, 15945, 29908, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 1311, 29897, 13, 13, 1678, 7465, 822, 1925, 29918, 305, 12629, 29898, 13, 4706, 1583, 29892, 282, 4270, 29901, 2391, 29961, 710, 1402, 1819, 29901, 2391, 29961, 22908, 1917, 1402, 11815, 29901, 5785, 13, 268, 1125, 13, 4706, 9995, 22908, 263, 995, 304, 263, 8242, 29892, 7863, 278, 3829, 1156, 1925, 15945, 29908, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 1311, 29897, 13, 13, 1678, 7465, 822, 1014, 13086, 29918, 12719, 29898, 13, 4706, 1583, 29892, 282, 29894, 29901, 851, 29892, 2295, 29901, 17368, 3991, 13, 1678, 1723, 1599, 20688, 20277, 29961, 13599, 5387, 13, 4706, 9995, 4035, 13086, 304, 278, 3829, 310, 278, 17368, 29892, 7709, 292, 12286, 13, 4706, 988, 871, 6480, 2246, 3233, 4235, 526, 10423, 297, 15945, 29908, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 1311, 29897, 13, 4706, 7709, 13, 13, 13, 1990, 1858, 3851, 9044, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 396, 426, 27882, 29901, 7079, 29913, 13, 4706, 1583, 29889, 12800, 29901, 360, 919, 29961, 710, 29892, 1858, 3851, 29962, 353, 6571, 13, 4706, 396, 426, 10141, 29918, 333, 29901, 4742, 29918, 2917, 29913, 13, 4706, 1583, 29889, 3359, 1575, 29901, 360, 919, 29961, 710, 29892, 21830, 3991, 29962, 353, 6571, 13, 4706, 396, 426, 3730, 29918, 15380, 2164, 29918, 12719, 29918, 333, 29901, 8242, 29918, 2917, 29913, 13, 4706, 1583, 29889, 305, 12629, 29901, 360, 919, 29961, 710, 29892, 17368, 3991, 29962, 353, 6571, 13, 13, 1678, 822, 788, 29918, 8582, 29898, 1311, 29892, 8608, 29901, 851, 29892, 7079, 29901, 1858, 3851, 29892, 731, 29918, 4381, 29922, 8824, 1125, 13, 4706, 1583, 29889, 12800, 29961, 27882, 29962, 353, 7079, 13, 4706, 7079, 29889, 27882, 353, 8608, 13, 4706, 565, 731, 29918, 4381, 29901, 13, 9651, 1583, 29889, 12800, 3366, 3108, 353, 7079, 13, 13, 1678, 822, 8608, 29918, 29886, 29894, 29898, 1311, 29892, 8242, 29918, 333, 29901, 851, 29897, 1599, 12603, 552, 29961, 710, 29892, 851, 5387, 13, 4706, 9995, 26772, 263, 8242, 29918, 333, 411, 385, 13136, 8608, 10944, 322, 13, 4706, 736, 278, 8608, 322, 282, 29894, 7117, 15945, 29908, 13, 4706, 6219, 353, 8242, 29918, 333, 29889, 5451, 703, 597, 613, 29871, 29896, 29897, 13, 4706, 565, 7431, 29898, 5451, 29897, 1275, 29871, 29896, 29901, 13, 9651, 8608, 29892, 282, 29894, 353, 1583, 29889, 12800, 3366, 16862, 27882, 29892, 8242, 29918, 333, 13, 4706, 1683, 29901, 13, 9651, 8608, 29892, 282, 29894, 353, 6219, 13, 4706, 736, 8608, 29892, 282, 29894, 13, 13, 1678, 822, 788, 29918, 10141, 29918, 2917, 29898, 1311, 29892, 2224, 29901, 10802, 29892, 4742, 29918, 333, 543, 613, 5825, 1883, 29922, 8516, 1125, 13, 4706, 9995, 5896, 263, 2246, 3233, 869, 535, 29875, 1519, 29889, 25162, 934, 411, 9224, 297, 372, 15945, 29908, 13, 4706, 4742, 29918, 2917, 353, 21830, 3991, 29889, 3166, 29918, 25162, 29898, 2084, 29892, 5825, 1883, 29897, 13, 4706, 565, 4742, 29918, 333, 29901, 13, 9651, 1583, 29889, 3359, 1575, 29961, 10141, 29918, 333, 29962, 353, 4742, 29918, 2917, 13, 4706, 396, 6376, 1230, 10898, 526, 6198, 304, 278, 2224, 1641, 7500, 29892, 577, 748, 727, 13, 4706, 274, 9970, 353, 10802, 29889, 29883, 9970, 580, 13, 4706, 2897, 29889, 305, 3972, 29898, 2084, 29889, 17863, 2141, 3560, 29897, 13, 4706, 1018, 29901, 13, 9651, 363, 2278, 297, 6686, 29898, 10141, 29918, 2917, 29889, 11991, 1125, 13, 18884, 565, 338, 8758, 29898, 5145, 29892, 17368, 3991, 1125, 13, 462, 1678, 396, 14402, 29901, 1831, 3598, 2767, 8242, 565, 2307, 4864, 13, 462, 1678, 8608, 29892, 282, 29894, 353, 1583, 29889, 27882, 29918, 29886, 29894, 29898, 5145, 29889, 3539, 29918, 29886, 29894, 470, 2278, 29889, 949, 29918, 29886, 29894, 29897, 13, 462, 1678, 1583, 29889, 305, 12629, 29961, 29888, 29908, 29912, 27882, 29913, 597, 29912, 29886, 29894, 29913, 3108, 353, 2278, 13, 18884, 25342, 338, 8758, 29898, 5145, 29892, 21830, 4998, 1125, 13, 462, 1678, 396, 8304, 3598, 2254, 2278, 9224, 13, 462, 1678, 565, 2278, 29889, 333, 338, 6213, 29901, 13, 462, 4706, 565, 4742, 29918, 333, 29901, 13, 462, 9651, 2278, 29889, 333, 353, 4742, 29918, 333, 718, 376, 1213, 718, 2278, 29889, 978, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 2278, 29889, 333, 353, 2278, 29889, 978, 13, 462, 1678, 1583, 29889, 1202, 29918, 10141, 29918, 2917, 29898, 5145, 29889, 1445, 29892, 2278, 29889, 333, 29892, 2278, 29889, 8628, 1883, 29897, 13, 4706, 7146, 29901, 13, 9651, 2897, 29889, 305, 3972, 29898, 29883, 9970, 29897, 13, 4706, 736, 4742, 29918, 2917, 13, 13, 1678, 822, 7079, 29918, 2917, 29918, 333, 29898, 1311, 29892, 8242, 29918, 333, 29901, 851, 29897, 1599, 12603, 552, 29961, 16288, 29892, 17368, 3991, 29892, 851, 5387, 13, 4706, 8608, 29892, 282, 29894, 353, 1583, 29889, 27882, 29918, 29886, 29894, 29898, 12719, 29918, 333, 29897, 13, 4706, 8242, 29918, 333, 353, 285, 29908, 29912, 27882, 29913, 597, 29912, 29886, 29894, 5038, 13, 4706, 7079, 353, 1583, 29889, 12800, 29961, 27882, 29962, 13, 4706, 2295, 353, 1583, 29889, 305, 12629, 29889, 657, 29898, 12719, 29918, 333, 29892, 6213, 29897, 13, 4706, 565, 2295, 338, 6213, 29901, 13, 9651, 396, 6213, 4864, 29892, 1207, 263, 390, 29956, 2295, 13, 9651, 2295, 353, 17368, 3991, 29898, 978, 543, 613, 1303, 29918, 29886, 29894, 29922, 12719, 29918, 333, 29892, 2436, 29918, 29886, 29894, 29922, 12719, 29918, 333, 29897, 13, 4706, 736, 7079, 29892, 2295, 29892, 8242, 29918, 333, 13, 2 ]
vows/transformer_test_data.py
wking/thumbor
0
1612999
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com <EMAIL> from thumbor.point import FocalPoint as fp from thumbor.context import Context, RequestParameters from thumbor.config import Config from thumbor.importer import Importer from thumbor.detectors import BaseDetector from thumbor.storages.no_storage import Storage as NoStorage class MockEngine(object): def __init__(self, size): self.size = size self.calls = { 'resize': [], 'crop': [], 'vertical_flip': 0, 'horizontal_flip': 0, 'cover': 0, } self.focal_points = None def resize(self, width, height): self.calls['resize'].append({ 'width': width, 'height': height }) def crop(self, left, top, right, bottom): self.calls['crop'].append({ 'left': left, 'top': top, 'right': right, 'bottom': bottom }) def flip_horizontally(self): self.calls['horizontal_flip'] += 1 def flip_vertically(self): self.calls['vertical_flip'] += 1 def get_proportional_width(self, new_height): width, height = self.size return float(new_height) * width / height def get_proportional_height(self, new_width): width, height = self.size return float(new_width) * height / width def focus(self, focal_points): self.focal_points = focal_points def extract_cover(self): self.calls['cover'] += 1 class MockSyncDetector(BaseDetector): def detect(self, callback): callback([]) class MockErrorSyncDetector(BaseDetector): def detect(self, callback): raise Exception('x') class TestData(object): def __init__( self, source_width, source_height, target_width, target_height, halign, valign, focal_points, crop_left, crop_top, crop_right, crop_bottom, fit_in=False, adaptive=False, full=False, meta=False): self.source_width = source_width self.source_height = source_height self.target_width = target_width self.target_height = target_height self.halign = halign self.valign = valign self.focal_points = focal_points self.crop_left = crop_left self.crop_top = crop_top self.crop_right = crop_right self.crop_bottom = crop_bottom self.fit_in = fit_in self.adaptive = adaptive self.full = full self.meta = meta def __repr__(self): return self.__str__() def __unicode__(self): return self.__str__() def __str__(self): crop_message = "" if self.crop_left is not None: crop_message = "it should crop %dx%d-%dx%d and " % ( self.crop_left, self.crop_top, self.crop_right, self.crop_bottom ) return "For an image of %dx%d resizing to %sx%s, %sit should resize to %sx%s" % ( self.source_width, self.source_height, self.target_width, self.target_height, crop_message, self.target_width, self.target_height ) def to_context(self, detectors=[], ignore_detector_error=False): self.engine = MockEngine((self.source_width, self.source_height)) flip_horizontally = self.target_width < 0 flip_vertically = self.target_height < 0 self.target_width = self.target_width == "orig" and "orig" or abs(self.target_width) self.target_height = self.target_height == "orig" and "orig" or abs(self.target_height) importer = Importer(None) importer.detectors = detectors importer.storage = NoStorage config = Config() config.IGNORE_SMART_ERRORS = ignore_detector_error ctx = Context(server=None, config=config, importer=importer) ctx.modules.engine = self.engine ctx.request = RequestParameters( buffer=None, debug=False, meta=self.meta, crop={ 'left': self.crop_left, 'top': self.crop_top, 'right': self.crop_right, 'bottom': self.crop_bottom }, adaptive=self.adaptive, full=self.full, fit_in=self.fit_in, horizontal_flip=flip_horizontally, vertical_flip=flip_vertically, width=self.target_width, height=self.target_height, halign=self.halign, valign=self.valign, focal_points=self.focal_points, smart=True, extension="JPEG", filters=[], quality=80, image="some.jpeg" ) ctx.request.engine = self.engine ctx.request.engine.extension = ".jpeg" return ctx @property def resize_error_message(self): message = "The engine resize should have been called with %sx%s" % (self.target_width, self.target_height) if not self.engine.calls['resize']: return "%s, but was never called" % message else: last_resize = self.engine.calls['resize'][0] return "%s, but was called with %sx%s" % (message, last_resize['width'], last_resize['height']) def has_resized_properly(self): if not self.target_width and not self.target_height: return True if (self.target_width == self.source_width and self.target_height == self.source_height) or \ (self.target_width == self.source_width and self.target_height == "orig") or \ (self.target_width == "orig" and self.target_height == self.source_height) or \ (self.target_width == "orig" and self.target_height == "orig"): return True assert self.engine.calls['resize'], self.resize_error_message if not self.target_width: assert \ self.engine.calls['resize'][0]['width'] == float(self.source_width) * self.target_height / self.source_height, \ self.resize_error_message assert self.engine.calls['resize'][0]['height'] == self.target_height, self.resize_error_message return True if not self.target_height: assert self.engine.calls['resize'][0]['width'] == self.target_width, self.resize_error_message assert \ self.engine.calls['resize'][0]['height'] == float(self.source_height) * self.target_width / self.source_width, \ self.resize_error_message return True assert self.engine.calls['resize'][0]['width'] == \ (self.target_width == "orig" and self.source_width or self.target_width), self.resize_error_message assert self.engine.calls['resize'][0]['height'] == \ (self.target_height == "orig" and self.source_height or self.target_height), self.resize_error_message return True @property def crop_error_message(self): message = "The engine crop should have been called with %dx%d %dx%d" % ( self.crop_left, self.crop_top, self.crop_right, self.crop_bottom ) if not self.engine.calls['crop']: return "%s, but was never called" % message else: last_crop = self.engine.calls['crop'][0] return "%s, but was called with %dx%d %dx%d" % ( message, last_crop['left'], last_crop['top'], last_crop['right'], last_crop['bottom'] ) def has_cropped_properly(self): if self.crop_left is None: assert not self.engine.calls['crop'], \ 'The engine crop should NOT have been called but was with %(left)dx%(top)d %(right)dx%(bottom)d' % ( self.engine.calls['crop'][0] ) return True assert self.engine.calls['crop'], self.crop_error_message assert self.engine.calls['crop'][0]['left'] == self.crop_left, self.crop_error_message assert self.engine.calls['crop'][0]['top'] == self.crop_top, self.crop_error_message assert self.engine.calls['crop'][0]['right'] == self.crop_right, self.crop_error_message assert self.engine.calls['crop'][0]['bottom'] == self.crop_bottom, self.crop_error_message return True TESTITEMS = [ TestData( source_width=800, source_height=600, target_width=400, target_height=150, halign="center", valign="middle", focal_points=[], crop_left=0, crop_top=75, crop_right=800, crop_bottom=375 ), TestData( source_width=600, source_height=800, target_width=150, target_height=400, halign="center", valign="middle", focal_points=[], crop_left=150, crop_top=0, crop_right=450, crop_bottom=800 ), TestData( source_width=600, source_height=800, target_width=300, target_height=400, halign="center", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=0, target_height=0, halign="center", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=400, target_height=0, halign="center", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=140, target_width=180, target_height=100, halign="center", valign="middle", focal_points=[], crop_left=0, crop_top=3, crop_right=200, crop_bottom=114 ), # tests with focal points TestData( source_width=200, source_height=200, target_width=100, target_height=100, halign="center", valign="middle", focal_points=[fp(100, 100, 1)], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=400, source_height=200, target_width=100, target_height=100, halign="center", valign="middle", focal_points=[fp(100, 100, 1)], crop_left=50.0, crop_top=0, crop_right=250.0, crop_bottom=200 ), TestData( source_width=400, source_height=200, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 50, 1), fp(300, 50, 1)], crop_left=150.0, crop_top=0, crop_right=250.0, crop_bottom=200 ), TestData( source_width=400, source_height=200, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 150, 1), fp(300, 150, 1)], crop_left=150.0, crop_top=0, crop_right=250.0, crop_bottom=200 ), TestData( source_width=400, source_height=200, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 50, 1), fp(100, 150, 1)], crop_left=75.0, crop_top=0, crop_right=175.0, crop_bottom=200 ), TestData( source_width=400, source_height=200, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(300, 50, 1), fp(300, 150, 1)], crop_left=225.0, crop_top=0, crop_right=325.0, crop_bottom=200 ), TestData( source_width=200, source_height=400, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 50, 1), fp(300, 50, 1)], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=400, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 150, 1), fp(300, 150, 1)], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=400, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(100, 50, 1), fp(100, 150, 1)], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=400, target_width=100, target_height=200, halign="center", valign="middle", focal_points=[fp(300, 50, 1), fp(300, 150, 1)], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=400, source_height=200, target_width=100, target_height=100, halign="center", valign="middle", focal_points=[fp(50, 100, 1), fp(50, 300, 1), fp(150, 100, 1), fp(150, 300, 1)], crop_left=50.0, crop_top=0, crop_right=250.0, crop_bottom=200 ), # Larger Width TestData( source_width=800, source_height=600, target_width=400, target_height=300, halign="center", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="center", valign="bottom", focal_points=[], crop_left=275, crop_top=0, crop_right=425, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=300, target_height=150, halign="right", valign="bottom", focal_points=[], crop_left=100, crop_top=0, crop_right=700, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=300, target_height=150, halign="left", valign="bottom", focal_points=[], crop_left=0, crop_top=0, crop_right=600, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="center", valign="bottom", focal_points=[], crop_left=275, crop_top=0, crop_right=425, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="left", valign="bottom", focal_points=[], crop_left=0, crop_top=0, crop_right=150, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="right", valign="bottom", focal_points=[], crop_left=550, crop_top=0, crop_right=700, crop_bottom=300 ), # Larger Height TestData( source_width=300, source_height=800, target_width=200, target_height=300, halign="center", valign="bottom", focal_points=[], crop_left=0, crop_top=251, crop_right=300, crop_bottom=701 ), TestData( source_width=300, source_height=800, target_width=200, target_height=300, halign="left", valign="bottom", focal_points=[], crop_left=0, crop_top=251, crop_right=300, crop_bottom=701 ), TestData( source_width=300, source_height=800, target_width=200, target_height=300, halign="right", valign="bottom", focal_points=[], crop_left=0, crop_top=251, crop_right=300, crop_bottom=701 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="center", valign="bottom", focal_points=[], crop_left=0, crop_top=119, crop_right=500, crop_bottom=536 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="left", valign="bottom", focal_points=[], crop_left=0, crop_top=119, crop_right=500, crop_bottom=536 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="right", valign="bottom", focal_points=[], crop_left=0, crop_top=119, crop_right=500, crop_bottom=536 ), # Proportional Height TestData( source_width=600, source_height=800, target_width=300, target_height=0, halign="right", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=300, target_height=0, halign="center", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=300, target_height=0, halign="left", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=250, target_height=0, halign="left", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=250, target_height=0, halign="right", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=250, target_height=0, halign="center", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), # Proportional Width TestData( source_width=600, source_height=800, target_width=0, target_height=400, halign="right", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=0, target_height=400, halign="left", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=0, target_height=400, halign="center", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=0, target_height=350, halign="center", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=0, target_height=350, halign="left", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=600, source_height=800, target_width=0, target_height=350, halign="right", valign="bottom", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=400, target_height=150, halign="center", valign="middle", focal_points=[], crop_left=0, crop_top=75, crop_right=800, crop_bottom=375 ), TestData( source_width=800, source_height=300, target_width=400, target_height=150, halign="center", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=300, target_width=400, target_height=150, halign="right", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=300, target_width=400, target_height=150, halign="left", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=700, source_height=300, target_width=300, target_height=150, halign="center", valign="middle", focal_points=[], crop_left=50, crop_top=0, crop_right=650, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=300, target_height=150, halign="left", valign="middle", focal_points=[], crop_left=0, crop_top=0, crop_right=600, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=300, target_height=150, halign="right", valign="middle", focal_points=[], crop_left=100, crop_top=0, crop_right=700, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="center", valign="middle", focal_points=[], crop_left=275, crop_top=0, crop_right=425, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="left", valign="middle", focal_points=[], crop_left=0, crop_top=0, crop_right=150, crop_bottom=300 ), TestData( source_width=700, source_height=300, target_width=150, target_height=300, halign="right", valign="middle", focal_points=[], crop_left=550, crop_top=0, crop_right=700, crop_bottom=300 ), TestData( source_width=350, source_height=700, target_width=200, target_height=600, halign="left", valign="middle", focal_points=[], crop_left=0, crop_top=0, crop_right=234, crop_bottom=700 ), TestData( source_width=350, source_height=700, target_width=200, target_height=600, halign="center", valign="middle", focal_points=[], crop_left=58, crop_top=0, crop_right=292, crop_bottom=700 ), TestData( source_width=350, source_height=700, target_width=200, target_height=600, halign="right", valign="middle", focal_points=[], crop_left=116, crop_top=0, crop_right=350, crop_bottom=700 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="left", valign="middle", focal_points=[], crop_left=0, crop_top=27, crop_right=500, crop_bottom=444 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="center", valign="middle", focal_points=[], crop_left=0, crop_top=27, crop_right=500, crop_bottom=444 ), TestData( source_width=500, source_height=600, target_width=300, target_height=250, halign="right", valign="middle", focal_points=[], crop_left=0, crop_top=27, crop_right=500, crop_bottom=444 ), TestData( source_width=1, source_height=1, target_width=0, target_height=0, halign="left", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=1, source_height=1, target_width=0, target_height=0, halign="center", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=1, source_height=1, target_width=0, target_height=0, halign="right", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=400, target_width=0, target_height=1, halign="left", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=200, source_height=200, target_width=16, target_height=16, halign="left", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), # Regular TestData( source_width=800, source_height=600, target_width=400, target_height=150, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=300 ), TestData( source_width=800, source_height=600, target_width=400, target_height=150, halign="center", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=300 ), TestData( source_width=800, source_height=600, target_width=400, target_height=150, halign="right", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=300 ), # Inverted TestData( source_width=600, source_height=800, target_width=150, target_height=400, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=300, crop_bottom=800 ), TestData( source_width=600, source_height=800, target_width=150, target_height=400, halign="center", valign="top", focal_points=[], crop_left=150, crop_top=0, crop_right=450, crop_bottom=800 ), TestData( source_width=600, source_height=800, target_width=150, target_height=400, halign="right", valign="top", focal_points=[], crop_left=300, crop_top=0, crop_right=600, crop_bottom=800 ), # Wide and Small Height TestData( source_width=800, source_height=60, target_width=400, target_height=15, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=30 ), TestData( source_width=800, source_height=60, target_width=400, target_height=15, halign="center", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=30 ), TestData( source_width=800, source_height=60, target_width=400, target_height=15, halign="right", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=800, crop_bottom=30 ), # Tall and Small Width TestData( source_width=60, source_height=800, target_width=15, target_height=400, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=30, crop_bottom=800 ), TestData( source_width=60, source_height=800, target_width=15, target_height=400, halign="center", valign="top", focal_points=[], crop_left=15, crop_top=0, crop_right=45, crop_bottom=800 ), TestData( source_width=60, source_height=800, target_width=15, target_height=400, halign="right", valign="top", focal_points=[], crop_left=30, crop_top=0, crop_right=60, crop_bottom=800 ), # Small Values TestData( source_width=8, source_height=6, target_width=4, target_height=2, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=8, crop_bottom=4 ), TestData( source_width=8, source_height=6, target_width=4, target_height=2, halign="center", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=8, crop_bottom=4 ), TestData( source_width=8, source_height=6, target_width=4, target_height=2, halign="right", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=8, crop_bottom=4 ), # Inverted Small Values TestData( source_width=6, source_height=8, target_width=2, target_height=4, halign="left", valign="top", focal_points=[], crop_left=0, crop_top=0, crop_right=4, crop_bottom=8 ), TestData( source_width=6, source_height=8, target_width=2, target_height=4, halign="center", valign="top", focal_points=[], crop_left=1, crop_top=0, crop_right=5, crop_bottom=8 ), TestData( source_width=6, source_height=8, target_width=2, target_height=4, halign="right", valign="top", focal_points=[], crop_left=2, crop_top=0, crop_right=6, crop_bottom=8 ), # Proportional Values TestData( source_width=800, source_height=600, target_width=400, target_height=300, halign="left", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=400, target_height=300, halign="center", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=400, target_height=300, halign="right", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), # Equal Values TestData( source_width=800, source_height=600, target_width=800, target_height=600, halign="left", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=800, target_height=600, halign="center", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=600, target_width=800, target_height=600, halign="right", valign="top", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None ), TestData( source_width=800, source_height=400, target_width=400, target_height="orig", halign="middle", valign="middle", focal_points=[], crop_left=200, crop_top=0, crop_right=600, crop_bottom=400 ), TestData( source_width=800, source_height=400, target_width="orig", target_height=100, halign="middle", valign="middle", focal_points=[], crop_left=200, crop_top=0, crop_right=600, crop_bottom=400 ), TestData( source_width=800, source_height=400, target_width="orig", target_height="orig", halign="middle", valign="middle", focal_points=[], crop_left=200, crop_top=0, crop_right=600, crop_bottom=400 ) ] FIT_IN_CROP_DATA = [ (TestData( source_width=800, source_height=400, target_width=400, target_height=100, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True ), (200, 100, 1)), (TestData( source_width=1000, source_height=250, target_width=500, target_height=200, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True ), (500, 125, 1)), (TestData( source_width=200, source_height=250, target_width=500, target_height=400, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True ), (200, 250, 0)), (TestData( source_width=800, source_height=400, target_width=100, target_height=400, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True, adaptive=True ), (200, 100, 1)), (TestData( source_width=800, source_height=400, target_width=400, target_height=100, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True, full=True ), (400, 200, 1)), (TestData( source_width=200, source_height=250, target_width=500, target_height=400, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True, full=True ), (500, 625, 1)), (TestData( source_width=800, source_height=400, target_width=100, target_height=400, halign="middle", valign="middle", focal_points=[], crop_left=None, crop_top=None, crop_right=None, crop_bottom=None, fit_in=True, adaptive=True, full=True ), (400, 200, 1)) ]
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 28968, 272, 6382, 292, 2669, 13, 29937, 2045, 597, 3292, 29889, 510, 29914, 386, 3774, 272, 29914, 386, 3774, 272, 29914, 4594, 13, 13, 29937, 10413, 21144, 1090, 278, 341, 1806, 19405, 29901, 13, 29937, 1732, 597, 1636, 29889, 22156, 1167, 29889, 990, 29914, 506, 11259, 29914, 2415, 29899, 506, 1947, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29896, 15482, 833, 29889, 510, 529, 26862, 6227, 29958, 13, 13, 3166, 28968, 272, 29889, 3149, 1053, 383, 18642, 5228, 408, 285, 29886, 13, 3166, 28968, 272, 29889, 4703, 1053, 15228, 29892, 10729, 11507, 13, 3166, 28968, 272, 29889, 2917, 1053, 12782, 13, 3166, 28968, 272, 29889, 326, 18505, 1053, 14305, 9555, 13, 3166, 28968, 272, 29889, 4801, 11142, 1053, 7399, 6362, 3019, 13, 3166, 28968, 272, 29889, 28957, 1179, 29889, 1217, 29918, 12925, 1053, 26162, 408, 1939, 10486, 13, 13, 13, 1990, 26297, 12412, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2159, 1125, 13, 4706, 1583, 29889, 2311, 353, 2159, 13, 4706, 1583, 29889, 29883, 4293, 353, 426, 13, 9651, 525, 21476, 2396, 19997, 13, 9651, 525, 29883, 1336, 2396, 19997, 13, 9651, 525, 18575, 29918, 29888, 3466, 2396, 29871, 29900, 29892, 13, 9651, 525, 22672, 29918, 29888, 3466, 2396, 29871, 29900, 29892, 13, 9651, 525, 11911, 2396, 29871, 29900, 29892, 13, 4706, 500, 13, 4706, 1583, 29889, 29888, 18642, 29918, 9748, 353, 6213, 13, 13, 1678, 822, 19490, 29898, 1311, 29892, 2920, 29892, 3171, 1125, 13, 4706, 1583, 29889, 29883, 4293, 1839, 21476, 13359, 4397, 3319, 13, 9651, 525, 2103, 2396, 2920, 29892, 13, 9651, 525, 3545, 2396, 3171, 13, 4706, 5615, 13, 13, 1678, 822, 274, 1336, 29898, 1311, 29892, 2175, 29892, 2246, 29892, 1492, 29892, 5970, 1125, 13, 4706, 1583, 29889, 29883, 4293, 1839, 29883, 1336, 13359, 4397, 3319, 13, 9651, 525, 1563, 2396, 2175, 29892, 13, 9651, 525, 3332, 2396, 2246, 29892, 13, 9651, 525, 1266, 2396, 1492, 29892, 13, 9651, 525, 8968, 2396, 5970, 13, 4706, 5615, 13, 13, 1678, 822, 285, 3466, 29918, 2015, 6753, 635, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29883, 4293, 1839, 22672, 29918, 29888, 3466, 2033, 4619, 29871, 29896, 13, 13, 1678, 822, 285, 3466, 29918, 1765, 1711, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29883, 4293, 1839, 18575, 29918, 29888, 3466, 2033, 4619, 29871, 29896, 13, 13, 1678, 822, 679, 29918, 771, 637, 1848, 29918, 2103, 29898, 1311, 29892, 716, 29918, 3545, 1125, 13, 4706, 2920, 29892, 3171, 353, 1583, 29889, 2311, 13, 4706, 736, 5785, 29898, 1482, 29918, 3545, 29897, 334, 2920, 847, 3171, 13, 13, 1678, 822, 679, 29918, 771, 637, 1848, 29918, 3545, 29898, 1311, 29892, 716, 29918, 2103, 1125, 13, 4706, 2920, 29892, 3171, 353, 1583, 29889, 2311, 13, 4706, 736, 5785, 29898, 1482, 29918, 2103, 29897, 334, 3171, 847, 2920, 13, 13, 1678, 822, 8569, 29898, 1311, 29892, 12789, 284, 29918, 9748, 1125, 13, 4706, 1583, 29889, 29888, 18642, 29918, 9748, 353, 12789, 284, 29918, 9748, 13, 13, 1678, 822, 6597, 29918, 11911, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29883, 4293, 1839, 11911, 2033, 4619, 29871, 29896, 13, 13, 13, 1990, 26297, 21077, 6362, 3019, 29898, 5160, 6362, 3019, 1125, 13, 1678, 822, 6459, 29898, 1311, 29892, 6939, 1125, 13, 4706, 6939, 4197, 2314, 13, 13, 13, 1990, 26297, 2392, 21077, 6362, 3019, 29898, 5160, 6362, 3019, 1125, 13, 1678, 822, 6459, 29898, 1311, 29892, 6939, 1125, 13, 4706, 12020, 8960, 877, 29916, 1495, 13, 13, 13, 1990, 4321, 1469, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 2752, 29918, 2103, 29892, 2752, 29918, 3545, 29892, 13, 9651, 3646, 29918, 2103, 29892, 3646, 29918, 3545, 29892, 13, 9651, 298, 2520, 29892, 659, 647, 29892, 12789, 284, 29918, 9748, 29892, 13, 9651, 274, 1336, 29918, 1563, 29892, 274, 1336, 29918, 3332, 29892, 274, 1336, 29918, 1266, 29892, 274, 1336, 29918, 8968, 29892, 13, 9651, 6216, 29918, 262, 29922, 8824, 29892, 7744, 573, 29922, 8824, 29892, 2989, 29922, 8824, 29892, 12700, 29922, 8824, 1125, 13, 13, 4706, 1583, 29889, 4993, 29918, 2103, 353, 2752, 29918, 2103, 13, 4706, 1583, 29889, 4993, 29918, 3545, 353, 2752, 29918, 3545, 13, 4706, 1583, 29889, 5182, 29918, 2103, 353, 3646, 29918, 2103, 13, 4706, 1583, 29889, 5182, 29918, 3545, 353, 3646, 29918, 3545, 13, 4706, 1583, 29889, 29882, 2520, 353, 298, 2520, 13, 4706, 1583, 29889, 791, 647, 353, 659, 647, 13, 4706, 1583, 29889, 29888, 18642, 29918, 9748, 353, 12789, 284, 29918, 9748, 13, 4706, 1583, 29889, 29883, 1336, 29918, 1563, 353, 274, 1336, 29918, 1563, 13, 4706, 1583, 29889, 29883, 1336, 29918, 3332, 353, 274, 1336, 29918, 3332, 13, 4706, 1583, 29889, 29883, 1336, 29918, 1266, 353, 274, 1336, 29918, 1266, 13, 4706, 1583, 29889, 29883, 1336, 29918, 8968, 353, 274, 1336, 29918, 8968, 13, 4706, 1583, 29889, 9202, 29918, 262, 353, 6216, 29918, 262, 13, 4706, 1583, 29889, 1114, 415, 573, 353, 7744, 573, 13, 4706, 1583, 29889, 8159, 353, 2989, 13, 4706, 1583, 29889, 7299, 353, 12700, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 1583, 17255, 710, 1649, 580, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 736, 1583, 17255, 710, 1649, 580, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 274, 1336, 29918, 4906, 353, 5124, 13, 4706, 565, 1583, 29889, 29883, 1336, 29918, 1563, 338, 451, 6213, 29901, 13, 9651, 274, 1336, 29918, 4906, 353, 376, 277, 881, 274, 1336, 1273, 8235, 29995, 29881, 19222, 8235, 29995, 29881, 322, 376, 1273, 313, 13, 18884, 1583, 29889, 29883, 1336, 29918, 1563, 29892, 1583, 29889, 29883, 1336, 29918, 3332, 29892, 13, 18884, 1583, 29889, 29883, 1336, 29918, 1266, 29892, 1583, 29889, 29883, 1336, 29918, 8968, 13, 9651, 1723, 13, 4706, 736, 376, 2831, 385, 1967, 310, 1273, 8235, 29995, 29881, 620, 5281, 304, 1273, 29879, 29916, 29995, 29879, 29892, 1273, 29879, 277, 881, 19490, 304, 1273, 29879, 29916, 29995, 29879, 29908, 1273, 313, 13, 9651, 1583, 29889, 4993, 29918, 2103, 29892, 1583, 29889, 4993, 29918, 3545, 29892, 13, 9651, 1583, 29889, 5182, 29918, 2103, 29892, 1583, 29889, 5182, 29918, 3545, 29892, 13, 9651, 274, 1336, 29918, 4906, 29892, 13, 9651, 1583, 29889, 5182, 29918, 2103, 29892, 1583, 29889, 5182, 29918, 3545, 13, 4706, 1723, 13, 13, 1678, 822, 304, 29918, 4703, 29898, 1311, 29892, 6459, 943, 11759, 1402, 11455, 29918, 4801, 3019, 29918, 2704, 29922, 8824, 1125, 13, 4706, 1583, 29889, 10599, 353, 26297, 12412, 3552, 1311, 29889, 4993, 29918, 2103, 29892, 1583, 29889, 4993, 29918, 3545, 876, 13, 13, 4706, 285, 3466, 29918, 2015, 6753, 635, 353, 1583, 29889, 5182, 29918, 2103, 529, 29871, 29900, 13, 4706, 285, 3466, 29918, 1765, 1711, 353, 1583, 29889, 5182, 29918, 3545, 529, 29871, 29900, 13, 4706, 1583, 29889, 5182, 29918, 2103, 353, 1583, 29889, 5182, 29918, 2103, 1275, 376, 12683, 29908, 322, 376, 12683, 29908, 470, 6425, 29898, 1311, 29889, 5182, 29918, 2103, 29897, 13, 4706, 1583, 29889, 5182, 29918, 3545, 353, 1583, 29889, 5182, 29918, 3545, 1275, 376, 12683, 29908, 322, 376, 12683, 29908, 470, 6425, 29898, 1311, 29889, 5182, 29918, 3545, 29897, 13, 13, 4706, 527, 18505, 353, 14305, 9555, 29898, 8516, 29897, 13, 4706, 527, 18505, 29889, 4801, 11142, 353, 6459, 943, 13, 4706, 527, 18505, 29889, 12925, 353, 1939, 10486, 13, 4706, 2295, 353, 12782, 580, 13, 4706, 2295, 29889, 6259, 6632, 1525, 29918, 29903, 1529, 13079, 29918, 11432, 29903, 353, 11455, 29918, 4801, 3019, 29918, 2704, 13, 4706, 12893, 353, 15228, 29898, 2974, 29922, 8516, 29892, 2295, 29922, 2917, 29892, 527, 18505, 29922, 326, 18505, 29897, 13, 4706, 12893, 29889, 7576, 29889, 10599, 353, 1583, 29889, 10599, 13, 13, 4706, 12893, 29889, 3827, 353, 10729, 11507, 29898, 13, 9651, 6835, 29922, 8516, 29892, 13, 9651, 4744, 29922, 8824, 29892, 13, 9651, 12700, 29922, 1311, 29889, 7299, 29892, 13, 9651, 274, 1336, 3790, 13, 18884, 525, 1563, 2396, 1583, 29889, 29883, 1336, 29918, 1563, 29892, 13, 18884, 525, 3332, 2396, 1583, 29889, 29883, 1336, 29918, 3332, 29892, 13, 18884, 525, 1266, 2396, 1583, 29889, 29883, 1336, 29918, 1266, 29892, 13, 18884, 525, 8968, 2396, 1583, 29889, 29883, 1336, 29918, 8968, 13, 9651, 2981, 13, 9651, 7744, 573, 29922, 1311, 29889, 1114, 415, 573, 29892, 13, 9651, 2989, 29922, 1311, 29889, 8159, 29892, 13, 9651, 6216, 29918, 262, 29922, 1311, 29889, 9202, 29918, 262, 29892, 13, 9651, 14698, 29918, 29888, 3466, 29922, 29888, 3466, 29918, 2015, 6753, 635, 29892, 13, 9651, 11408, 29918, 29888, 3466, 29922, 29888, 3466, 29918, 1765, 1711, 29892, 13, 9651, 2920, 29922, 1311, 29889, 5182, 29918, 2103, 29892, 13, 9651, 3171, 29922, 1311, 29889, 5182, 29918, 3545, 29892, 13, 9651, 298, 2520, 29922, 1311, 29889, 29882, 2520, 29892, 13, 9651, 659, 647, 29922, 1311, 29889, 791, 647, 29892, 13, 9651, 12789, 284, 29918, 9748, 29922, 1311, 29889, 29888, 18642, 29918, 9748, 29892, 13, 9651, 15040, 29922, 5574, 29892, 13, 9651, 6081, 543, 29967, 4162, 29954, 613, 13, 9651, 18094, 11759, 1402, 13, 9651, 11029, 29922, 29947, 29900, 29892, 13, 9651, 1967, 543, 5372, 29889, 26568, 29908, 13, 4706, 1723, 13, 4706, 12893, 29889, 3827, 29889, 10599, 353, 1583, 29889, 10599, 13, 4706, 12893, 29889, 3827, 29889, 10599, 29889, 17588, 353, 11393, 26568, 29908, 13, 13, 4706, 736, 12893, 13, 13, 1678, 732, 6799, 13, 1678, 822, 19490, 29918, 2704, 29918, 4906, 29898, 1311, 1125, 13, 4706, 2643, 353, 376, 1576, 6012, 19490, 881, 505, 1063, 2000, 411, 1273, 29879, 29916, 29995, 29879, 29908, 1273, 313, 1311, 29889, 5182, 29918, 2103, 29892, 1583, 29889, 5182, 29918, 3545, 29897, 13, 4706, 565, 451, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29901, 13, 9651, 736, 11860, 29879, 29892, 541, 471, 2360, 2000, 29908, 1273, 2643, 13, 4706, 1683, 29901, 13, 9651, 1833, 29918, 21476, 353, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 29962, 13, 9651, 736, 11860, 29879, 29892, 541, 471, 2000, 411, 1273, 29879, 29916, 29995, 29879, 29908, 1273, 313, 4906, 29892, 1833, 29918, 21476, 1839, 2103, 7464, 1833, 29918, 21476, 1839, 3545, 11287, 13, 13, 1678, 822, 756, 29918, 690, 1891, 29918, 771, 546, 368, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 29889, 5182, 29918, 2103, 322, 451, 1583, 29889, 5182, 29918, 3545, 29901, 13, 9651, 736, 5852, 13, 13, 4706, 565, 313, 1311, 29889, 5182, 29918, 2103, 1275, 1583, 29889, 4993, 29918, 2103, 322, 1583, 29889, 5182, 29918, 3545, 1275, 1583, 29889, 4993, 29918, 3545, 29897, 470, 320, 13, 965, 313, 1311, 29889, 5182, 29918, 2103, 1275, 1583, 29889, 4993, 29918, 2103, 322, 1583, 29889, 5182, 29918, 3545, 1275, 376, 12683, 1159, 470, 320, 13, 965, 313, 1311, 29889, 5182, 29918, 2103, 1275, 376, 12683, 29908, 322, 1583, 29889, 5182, 29918, 3545, 1275, 1583, 29889, 4993, 29918, 3545, 29897, 470, 320, 13, 965, 313, 1311, 29889, 5182, 29918, 2103, 1275, 376, 12683, 29908, 322, 1583, 29889, 5182, 29918, 3545, 1275, 376, 12683, 29908, 1125, 13, 9651, 736, 5852, 13, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 7464, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 13, 4706, 565, 451, 1583, 29889, 5182, 29918, 2103, 29901, 13, 9651, 4974, 320, 13, 18884, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 2103, 2033, 1275, 5785, 29898, 1311, 29889, 4993, 29918, 2103, 29897, 334, 1583, 29889, 5182, 29918, 3545, 847, 1583, 29889, 4993, 29918, 3545, 29892, 320, 13, 18884, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 9651, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 3545, 2033, 1275, 1583, 29889, 5182, 29918, 3545, 29892, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 9651, 736, 5852, 13, 13, 4706, 565, 451, 1583, 29889, 5182, 29918, 3545, 29901, 13, 9651, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 2103, 2033, 1275, 1583, 29889, 5182, 29918, 2103, 29892, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 9651, 4974, 320, 13, 18884, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 3545, 2033, 1275, 5785, 29898, 1311, 29889, 4993, 29918, 3545, 29897, 334, 1583, 29889, 5182, 29918, 2103, 847, 1583, 29889, 4993, 29918, 2103, 29892, 320, 13, 18884, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 9651, 736, 5852, 13, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 2103, 2033, 1275, 320, 13, 9651, 313, 1311, 29889, 5182, 29918, 2103, 1275, 376, 12683, 29908, 322, 1583, 29889, 4993, 29918, 2103, 470, 1583, 29889, 5182, 29918, 2103, 511, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 21476, 2033, 29961, 29900, 22322, 3545, 2033, 1275, 320, 13, 9651, 313, 1311, 29889, 5182, 29918, 3545, 1275, 376, 12683, 29908, 322, 1583, 29889, 4993, 29918, 3545, 470, 1583, 29889, 5182, 29918, 3545, 511, 1583, 29889, 21476, 29918, 2704, 29918, 4906, 13, 4706, 736, 5852, 13, 13, 1678, 732, 6799, 13, 1678, 822, 274, 1336, 29918, 2704, 29918, 4906, 29898, 1311, 1125, 13, 4706, 2643, 353, 376, 1576, 6012, 274, 1336, 881, 505, 1063, 2000, 411, 1273, 8235, 29995, 29881, 1273, 8235, 29995, 29881, 29908, 1273, 313, 13, 9651, 1583, 29889, 29883, 1336, 29918, 1563, 29892, 1583, 29889, 29883, 1336, 29918, 3332, 29892, 1583, 29889, 29883, 1336, 29918, 1266, 29892, 1583, 29889, 29883, 1336, 29918, 8968, 13, 4706, 1723, 13, 4706, 565, 451, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29901, 13, 9651, 736, 11860, 29879, 29892, 541, 471, 2360, 2000, 29908, 1273, 2643, 13, 4706, 1683, 29901, 13, 9651, 1833, 29918, 29883, 1336, 353, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 29962, 13, 9651, 736, 11860, 29879, 29892, 541, 471, 2000, 411, 1273, 8235, 29995, 29881, 1273, 8235, 29995, 29881, 29908, 1273, 313, 13, 18884, 2643, 29892, 1833, 29918, 29883, 1336, 1839, 1563, 7464, 1833, 29918, 29883, 1336, 1839, 3332, 7464, 1833, 29918, 29883, 1336, 1839, 1266, 7464, 1833, 29918, 29883, 1336, 1839, 8968, 2033, 13, 9651, 1723, 13, 13, 1678, 822, 756, 29918, 24077, 2986, 29918, 771, 546, 368, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 29883, 1336, 29918, 1563, 338, 6213, 29901, 13, 9651, 4974, 451, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 7464, 320, 13, 18884, 525, 1576, 6012, 274, 1336, 881, 6058, 505, 1063, 2000, 541, 471, 411, 1273, 29898, 1563, 29897, 8235, 29995, 29898, 3332, 29897, 29881, 1273, 29898, 1266, 29897, 8235, 29995, 29898, 8968, 29897, 29881, 29915, 1273, 313, 13, 462, 1678, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 29962, 13, 18884, 1723, 13, 9651, 736, 5852, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 7464, 1583, 29889, 29883, 1336, 29918, 2704, 29918, 4906, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 22322, 1563, 2033, 1275, 1583, 29889, 29883, 1336, 29918, 1563, 29892, 1583, 29889, 29883, 1336, 29918, 2704, 29918, 4906, 13, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 22322, 3332, 2033, 1275, 1583, 29889, 29883, 1336, 29918, 3332, 29892, 1583, 29889, 29883, 1336, 29918, 2704, 29918, 4906, 13, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 22322, 1266, 2033, 1275, 1583, 29889, 29883, 1336, 29918, 1266, 29892, 1583, 29889, 29883, 1336, 29918, 2704, 29918, 4906, 13, 13, 4706, 4974, 1583, 29889, 10599, 29889, 29883, 4293, 1839, 29883, 1336, 2033, 29961, 29900, 22322, 8968, 2033, 1275, 1583, 29889, 29883, 1336, 29918, 8968, 29892, 1583, 29889, 29883, 1336, 29918, 2704, 29918, 4906, 13, 13, 4706, 736, 5852, 13, 13, 18267, 9094, 4345, 353, 518, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29955, 29945, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29955, 29945, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29945, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29896, 29946, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29947, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29941, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29896, 29896, 29946, 13, 1678, 10353, 13, 13, 1678, 396, 6987, 411, 12789, 284, 3291, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29955, 29945, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29896, 29955, 29945, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29941, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29906, 29945, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29906, 29945, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29896, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29941, 29900, 29900, 29892, 29871, 29945, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29941, 29900, 29900, 29892, 29871, 29896, 29945, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 18091, 29898, 29945, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29945, 29900, 29892, 29871, 29941, 29900, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29896, 29945, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 511, 285, 29886, 29898, 29896, 29945, 29900, 29892, 29871, 29941, 29900, 29900, 29892, 29871, 29896, 29897, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29945, 29900, 29889, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29906, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 396, 8218, 914, 21485, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29955, 29945, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29906, 29945, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29955, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29955, 29945, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29906, 29945, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29896, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29945, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29955, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 396, 8218, 914, 22907, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29945, 29896, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29896, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29945, 29896, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29896, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29945, 29896, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29896, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29896, 29896, 29929, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29945, 29941, 29953, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29896, 29896, 29929, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29945, 29941, 29953, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29896, 29896, 29929, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29945, 29941, 29953, 13, 1678, 10353, 13, 13, 1678, 396, 1019, 637, 1848, 22907, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 396, 1019, 637, 1848, 21485, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 8968, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29955, 29945, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29955, 29945, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29955, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29955, 29945, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29906, 29945, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29896, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29955, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29945, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29955, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29945, 29900, 29892, 2752, 29918, 3545, 29922, 29955, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29941, 29946, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29945, 29900, 29892, 2752, 29918, 3545, 29922, 29955, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29945, 29947, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29906, 29929, 29906, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29941, 29945, 29900, 29892, 2752, 29918, 3545, 29922, 29955, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29896, 29953, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29955, 29900, 29900, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29955, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29946, 29946, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29955, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29946, 29946, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29941, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29906, 29955, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29946, 29946, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29896, 29892, 2752, 29918, 3545, 29922, 29896, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29896, 29892, 2752, 29918, 3545, 29922, 29896, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29896, 29892, 2752, 29918, 3545, 29922, 29896, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29953, 29892, 3646, 29918, 3545, 29922, 29896, 29953, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 13, 1678, 396, 2169, 1070, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 29900, 13, 1678, 10353, 13, 1678, 396, 512, 1765, 287, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29945, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29945, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29941, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 396, 399, 680, 322, 18285, 22907, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29945, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29941, 29900, 13, 1678, 10353, 13, 1678, 396, 323, 497, 322, 18285, 21485, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29941, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29945, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29945, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29900, 29892, 2752, 29918, 3545, 29922, 29947, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29945, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29941, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29947, 29900, 29900, 13, 1678, 10353, 13, 1678, 396, 18285, 2630, 1041, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29892, 2752, 29918, 3545, 29922, 29953, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29892, 3646, 29918, 3545, 29922, 29906, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29892, 274, 1336, 29918, 8968, 29922, 29946, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29892, 2752, 29918, 3545, 29922, 29953, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29892, 3646, 29918, 3545, 29922, 29906, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29892, 274, 1336, 29918, 8968, 29922, 29946, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29892, 2752, 29918, 3545, 29922, 29953, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29892, 3646, 29918, 3545, 29922, 29906, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29947, 29892, 274, 1336, 29918, 8968, 29922, 29946, 13, 1678, 10353, 13, 1678, 396, 512, 1765, 287, 18285, 2630, 1041, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29892, 2752, 29918, 3545, 29922, 29947, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29892, 3646, 29918, 3545, 29922, 29946, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29946, 29892, 274, 1336, 29918, 8968, 29922, 29947, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29892, 2752, 29918, 3545, 29922, 29947, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29892, 3646, 29918, 3545, 29922, 29946, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29896, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29945, 29892, 274, 1336, 29918, 8968, 29922, 29947, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29953, 29892, 2752, 29918, 3545, 29922, 29947, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29906, 29892, 3646, 29918, 3545, 29922, 29946, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29892, 274, 1336, 29918, 8968, 29922, 29947, 13, 1678, 10353, 13, 1678, 396, 1019, 637, 1848, 2630, 1041, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29941, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 396, 11243, 284, 2630, 1041, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1563, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 5064, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29953, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 1266, 613, 659, 647, 543, 3332, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 543, 12683, 613, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 543, 12683, 613, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29900, 29900, 13, 1678, 10353, 13, 1678, 4321, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 543, 12683, 613, 3646, 29918, 3545, 543, 12683, 613, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 29906, 29900, 29900, 29892, 274, 1336, 29918, 3332, 29922, 29900, 29892, 274, 1336, 29918, 1266, 29922, 29953, 29900, 29900, 29892, 274, 1336, 29918, 8968, 29922, 29946, 29900, 29900, 13, 1678, 1723, 13, 29962, 13, 13, 29943, 1806, 29918, 1177, 29918, 29907, 29366, 29918, 14573, 353, 518, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 13, 1678, 10353, 313, 29906, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29896, 29900, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29906, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 13, 1678, 10353, 313, 29945, 29900, 29900, 29892, 29871, 29896, 29906, 29945, 29892, 29871, 29896, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 13, 1678, 10353, 313, 29906, 29900, 29900, 29892, 29871, 29906, 29945, 29900, 29892, 29871, 29900, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 29892, 7744, 573, 29922, 5574, 13, 1678, 10353, 313, 29906, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29946, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29896, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 29892, 2989, 29922, 5574, 13, 1678, 10353, 313, 29946, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29896, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29906, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29906, 29945, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29945, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 29892, 2989, 29922, 5574, 13, 4706, 10353, 313, 29945, 29900, 29900, 29892, 29871, 29953, 29906, 29945, 29892, 29871, 29896, 8243, 13, 13, 1678, 313, 3057, 1469, 29898, 13, 4706, 2752, 29918, 2103, 29922, 29947, 29900, 29900, 29892, 2752, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 3646, 29918, 2103, 29922, 29896, 29900, 29900, 29892, 3646, 29918, 3545, 29922, 29946, 29900, 29900, 29892, 13, 4706, 298, 2520, 543, 17662, 613, 659, 647, 543, 17662, 613, 13, 4706, 12789, 284, 29918, 9748, 11759, 1402, 13, 4706, 274, 1336, 29918, 1563, 29922, 8516, 29892, 274, 1336, 29918, 3332, 29922, 8516, 29892, 274, 1336, 29918, 1266, 29922, 8516, 29892, 274, 1336, 29918, 8968, 29922, 8516, 29892, 13, 4706, 6216, 29918, 262, 29922, 5574, 29892, 7744, 573, 29922, 5574, 29892, 2989, 29922, 5574, 13, 4706, 10353, 313, 29946, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29896, 876, 13, 29962, 13, 2 ]
tests/test_library.py
movermeyer/mopidy-oe1
9
46572
from __future__ import unicode_literals import unittest from mock import Mock from mopidy.models import Ref from mopidy_oe1.library import OE1LibraryProvider, OE1LibraryUri, OE1UriType class OE1LibraryUriTest(unittest.TestCase): def test_parse_root_uri(self): uri = 'oe1:directory' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.ROOT) def test_parse_live_uri(self): uri = 'oe1:live' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.LIVE) def test_parse_campus_uri(self): uri = 'oe1:campus' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.CAMPUS) def test_parse_archive_uri(self): uri = 'oe1:archive' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.ARCHIVE) def test_parse_day_uri(self): uri = 'oe1:archive:20140914' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.ARCHIVE_DAY) self.assertEqual(result.day_id, '20140914') def test_parse_invalid_uri(self): uri = 'foo:bar' self.assertRaises(TypeError, OE1LibraryUri.parse, uri) def test_parse_item_uri(self): uri = 'oe1:archive:20140914:382176' result = OE1LibraryUri.parse(uri) self.assertEqual(result.uri_type, OE1UriType.ARCHIVE_ITEM) self.assertEqual(result.day_id, '20140914') self.assertEqual(result.item_id, '382176') def test_create_root_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.ROOT) self.assertEqual(str(parsed_uri), 'oe1:directory') def test_create_live_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.LIVE) self.assertEqual(str(parsed_uri), 'oe1:live') def test_create_campus_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.CAMPUS) self.assertEqual(str(parsed_uri), 'oe1:campus') def test_create_archive_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.ARCHIVE) self.assertEqual(str(parsed_uri), 'oe1:archive') def test_create_day_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.ARCHIVE_DAY, '20140914') self.assertEqual(str(parsed_uri), 'oe1:archive:20140914') def test_create_item_uri(self): parsed_uri = OE1LibraryUri(OE1UriType.ARCHIVE_ITEM, '20140914', '382176') self.assertEqual(str(parsed_uri), 'oe1:archive:20140914:382176') class OE1LibraryProviderTest(unittest.TestCase): def setUp(self): self.client_mock = Mock() self.client_mock.get_days = Mock( return_value=[ {'id': '1', 'label': 'Day1'}, {'id': '2', 'label': 'Day2'} ] ) self.client_mock.get_day = Mock( return_value={ 'items': [ {'id': '1', 'time': '01:00', 'title': 'Item1'}, {'id': '2', 'time': '02:00', 'title': 'Item2'}, {'id': '3', 'time': '03:00', 'title': 'Item3'} ] } ) self.client_mock.get_item = Mock( return_value={'id': '1', 'time': '01:00', 'title': 'Item1'} ) self.library = OE1LibraryProvider(None, client=self.client_mock) def test_browse_invalid_uri(self): uri = 'foo:bar' result = self.library.browse(uri) self.assertEqual(result, []) def test_browse_unbrowsable_uri(self): uri = str(OE1LibraryUri(OE1UriType.LIVE)) result = self.library.browse(uri) self.assertEqual(result, []) def test_browse_root(self): uri = str(OE1LibraryUri(OE1UriType.ROOT)) result = self.library.browse(uri) self.assertEqual(len(result), 3) def test_browse_archive(self): uri = str(OE1LibraryUri(OE1UriType.ARCHIVE)) result = self.library.browse(uri) self.assertEqual(len(result), 2) self.assertEqual(result[0].type, Ref.DIRECTORY) self.assertEqual(result[0].uri, 'oe1:archive:1') self.assertEqual(result[0].name, 'Day1') def test_browse_archive_day(self): uri = str(OE1LibraryUri(OE1UriType.ARCHIVE_DAY, '20140914')) result = self.library.browse(uri) self.client_mock.get_day.assert_called_once_with('20140914') self.assertEqual(len(result), 3) self.assertEqual(result[0].type, Ref.TRACK) self.assertEqual(result[0].uri, 'oe1:archive:20140914:1') self.assertEqual(result[0].name, '01:00: Item1') def test_lookup_invalid_uri(self): uri = 'foo:bar' result = self.library.lookup(uri) self.assertEqual(result, []) def test_browse_unlookable_uri(self): uri = str(OE1LibraryUri(OE1UriType.ROOT)) result = self.library.lookup(uri) self.assertEqual(result, []) def test_lookup_live(self): uri = str(OE1LibraryUri(OE1UriType.LIVE)) result = self.library.lookup(uri) self.assertEqual(len(result), 1) self.assertEqual(result[0].uri, uri) self.assertEqual(result[0].name, 'Live') def test_lookup_campus(self): uri = str(OE1LibraryUri(OE1UriType.CAMPUS)) result = self.library.lookup(uri) self.assertEqual(len(result), 1) self.assertEqual(result[0].uri, uri) self.assertEqual(result[0].name, 'Campus') def test_lookup_archive_day(self): uri = str(OE1LibraryUri(OE1UriType.ARCHIVE_DAY, '20140914')) result = self.library.lookup(uri) self.client_mock.get_day.assert_called_once_with('20140914') self.assertEqual(len(result), 3) self.assertEqual(result[0].type, Ref.TRACK) self.assertEqual(result[0].uri, 'oe1:archive:20140914:1') self.assertEqual(result[0].name, '01:00: Item1') def test_lookup_archive_item(self): uri = str(OE1LibraryUri(OE1UriType.ARCHIVE_ITEM, '20140914', '1234567')) result = self.library.lookup(uri) self.client_mock.get_item.assert_called_once_with( '20140914', '1234567') self.assertEqual(len(result), 1) self.assertEqual(result[0].uri, 'oe1:archive:20140914:1') self.assertEqual(result[0].name, '01:00: Item1')
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 443, 27958, 13, 13, 3166, 11187, 1053, 26297, 13, 13, 3166, 286, 459, 333, 29891, 29889, 9794, 1053, 9897, 13, 13, 3166, 286, 459, 333, 29891, 29918, 7297, 29896, 29889, 5258, 1053, 438, 29923, 29896, 12284, 6980, 29892, 438, 29923, 29896, 12284, 14702, 29892, 438, 29923, 29896, 14702, 1542, 13, 13, 13, 1990, 438, 29923, 29896, 12284, 14702, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 5510, 29918, 4632, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 12322, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 21289, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 9258, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 9258, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 5265, 12064, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 24821, 375, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 24821, 375, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 5454, 3580, 3308, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 10867, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 10867, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 3250, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 28658, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 3250, 29918, 333, 29892, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 20965, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 5431, 29901, 1646, 29915, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1542, 2392, 29892, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29892, 21333, 29897, 13, 13, 1678, 822, 1243, 29918, 5510, 29918, 667, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29901, 29941, 29947, 29906, 29896, 29955, 29953, 29915, 13, 4706, 1121, 353, 438, 29923, 29896, 12284, 14702, 29889, 5510, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 5338, 29918, 1853, 29892, 438, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 9094, 29924, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 3250, 29918, 333, 29892, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29889, 667, 29918, 333, 29892, 525, 29941, 29947, 29906, 29896, 29955, 29953, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 4632, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 21289, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 12322, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 9258, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 5265, 12064, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 9258, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 24821, 375, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 5454, 3580, 3308, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 24821, 375, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 10867, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 10867, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 3250, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 28658, 29892, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 667, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21213, 29918, 5338, 353, 438, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 9094, 29924, 29892, 13, 462, 462, 259, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 742, 525, 29941, 29947, 29906, 29896, 29955, 29953, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 862, 8485, 29918, 5338, 511, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29901, 29941, 29947, 29906, 29896, 29955, 29953, 1495, 13, 13, 13, 1990, 438, 29923, 29896, 12284, 6980, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4645, 29918, 17640, 353, 26297, 580, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 16700, 353, 26297, 29898, 13, 9651, 736, 29918, 1767, 11759, 13, 18884, 11117, 333, 2396, 525, 29896, 742, 525, 1643, 2396, 525, 12742, 29896, 16675, 13, 18884, 11117, 333, 2396, 525, 29906, 742, 525, 1643, 2396, 525, 12742, 29906, 10827, 13, 9651, 4514, 13, 4706, 1723, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 3250, 353, 26297, 29898, 13, 9651, 736, 29918, 1767, 3790, 13, 18884, 525, 7076, 2396, 518, 13, 462, 1678, 11117, 333, 2396, 525, 29896, 742, 525, 2230, 2396, 525, 29900, 29896, 29901, 29900, 29900, 742, 525, 3257, 2396, 525, 2001, 29896, 16675, 13, 462, 1678, 11117, 333, 2396, 525, 29906, 742, 525, 2230, 2396, 525, 29900, 29906, 29901, 29900, 29900, 742, 525, 3257, 2396, 525, 2001, 29906, 16675, 13, 462, 1678, 11117, 333, 2396, 525, 29941, 742, 525, 2230, 2396, 525, 29900, 29941, 29901, 29900, 29900, 742, 525, 3257, 2396, 525, 2001, 29941, 10827, 13, 18884, 4514, 13, 9651, 500, 13, 4706, 1723, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 667, 353, 26297, 29898, 13, 9651, 736, 29918, 1767, 3790, 29915, 333, 2396, 525, 29896, 742, 525, 2230, 2396, 525, 29900, 29896, 29901, 29900, 29900, 742, 525, 3257, 2396, 525, 2001, 29896, 10827, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 5258, 353, 438, 29923, 29896, 12284, 6980, 29898, 8516, 29892, 3132, 29922, 1311, 29889, 4645, 29918, 17640, 29897, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 20965, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 5431, 29901, 1646, 29915, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 23721, 344, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 518, 2314, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 348, 29890, 5727, 519, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 5265, 12064, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 23721, 344, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 518, 2314, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 4632, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 21289, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 23721, 344, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29941, 29897, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 10867, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 23721, 344, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 1853, 29892, 9897, 29889, 4571, 26282, 18929, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 525, 7297, 29896, 29901, 10867, 29901, 29896, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 12742, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 10867, 29918, 3250, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 28658, 29892, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 8785, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 23721, 344, 29898, 5338, 29897, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 3250, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 877, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29941, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 1853, 29892, 9897, 29889, 5659, 11375, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29901, 29896, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 29900, 29896, 29901, 29900, 29900, 29901, 10976, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 20401, 29918, 20965, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 525, 5431, 29901, 1646, 29915, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 518, 2314, 13, 13, 1678, 822, 1243, 29918, 23721, 344, 29918, 348, 6914, 519, 29918, 5338, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 21289, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29892, 518, 2314, 13, 13, 1678, 822, 1243, 29918, 20401, 29918, 9258, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 5265, 12064, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 21333, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 23859, 1495, 13, 13, 1678, 822, 1243, 29918, 20401, 29918, 24821, 375, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 5454, 3580, 3308, 876, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 21333, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 29907, 1160, 375, 1495, 13, 13, 1678, 822, 1243, 29918, 20401, 29918, 10867, 29918, 3250, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 28658, 29892, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 8785, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 3250, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 877, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29941, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 1853, 29892, 9897, 29889, 5659, 11375, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29901, 29896, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 29900, 29896, 29901, 29900, 29900, 29901, 10976, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 20401, 29918, 10867, 29918, 667, 29898, 1311, 1125, 13, 4706, 21333, 353, 851, 29898, 29949, 29923, 29896, 12284, 14702, 29898, 29949, 29923, 29896, 14702, 1542, 29889, 1718, 3210, 18474, 29918, 9094, 29924, 29892, 13, 462, 18884, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 742, 525, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 8785, 13, 4706, 1121, 353, 1583, 29889, 5258, 29889, 20401, 29898, 5338, 29897, 13, 4706, 1583, 29889, 4645, 29918, 17640, 29889, 657, 29918, 667, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 9651, 525, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 742, 525, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 2914, 511, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 5338, 29892, 525, 7297, 29896, 29901, 10867, 29901, 29906, 29900, 29896, 29946, 29900, 29929, 29896, 29946, 29901, 29896, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2914, 29961, 29900, 1822, 978, 29892, 525, 29900, 29896, 29901, 29900, 29900, 29901, 10976, 29896, 1495, 13, 2 ]
Cursoemvideo/desafios/desafio008.py
gentildf/Python
1
9161
#Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros. n = float(input('\033[32mDigite o numero:\033[m')) print('O número digitado é \033[33m{0:.0f}m\033[m.\n' 'Ele apresentado em centimetros fica \033[33m{0:.2f}cm\033[m.\n' 'Apresentado em milímetros fica \033[33m{0:.3f}mm\033[m' .format(n)) #print('O número em metros é {0}.\n # O número em convertido para centimetros é {1}.\n # O número convertido para milimetros é {2}' # .format(n, n/100, n/1000))
[ 1, 396, 14190, 1037, 1564, 1922, 16914, 712, 454, 423, 1922, 16497, 953, 24086, 321, 288, 429, 16912, 3588, 1941, 953, 1644, 17528, 1883, 321, 2316, 17528, 1883, 29889, 13, 29876, 353, 5785, 29898, 2080, 28909, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 14991, 568, 288, 17910, 3583, 29900, 29941, 29941, 29961, 29885, 8785, 13, 2158, 877, 29949, 13831, 13615, 912, 904, 320, 29900, 29941, 29941, 29961, 29941, 29941, 29885, 29912, 29900, 29901, 29889, 29900, 29888, 29913, 29885, 29905, 29900, 29941, 29941, 29961, 29885, 7790, 29876, 29915, 13, 418, 525, 29923, 280, 24677, 912, 953, 1644, 17528, 1883, 285, 983, 320, 29900, 29941, 29941, 29961, 29941, 29941, 29885, 29912, 29900, 29901, 29889, 29906, 29888, 29913, 4912, 29905, 29900, 29941, 29941, 29961, 29885, 7790, 29876, 29915, 13, 418, 525, 29909, 6338, 912, 953, 2316, 29983, 28204, 285, 983, 320, 29900, 29941, 29941, 29961, 29941, 29941, 29885, 29912, 29900, 29901, 29889, 29941, 29888, 29913, 4317, 29905, 29900, 29941, 29941, 29961, 29885, 29915, 13, 418, 869, 4830, 29898, 29876, 876, 13, 29937, 2158, 877, 29949, 13831, 953, 24086, 904, 426, 29900, 1836, 29905, 29876, 13, 29937, 438, 13831, 953, 3588, 1941, 1702, 1644, 17528, 1883, 904, 426, 29896, 1836, 29905, 29876, 13, 29937, 438, 13831, 3588, 1941, 1702, 2316, 17528, 1883, 904, 426, 29906, 10162, 13, 29937, 869, 4830, 29898, 29876, 29892, 302, 29914, 29896, 29900, 29900, 29892, 302, 29914, 29896, 29900, 29900, 29900, 876, 13, 2 ]
versions/3.0/karma/python/uri_manipulation.py
Lituta/dig-alignment
5
161364
from urllib import quote import re import uuid class UM(object): def __init__(self): self.name = "Uri Manipulation" @staticmethod def uuid_uri(prefix): """Construct a URI using a UUID""" return prefix + str(uuid.uuid1()) @staticmethod def uuid_uri_or_empty(prefix, value): """Construct a URI using a UUID, but return empty if value is empty""" if value is None or value == '': return '' else: return prefix + str(uuid.uuid1()) @staticmethod def phone_uri(x): """Return the uri for a phone as countrycode-phone Use 'x-' as country code if not present in the number """ x = PM.clean_phone(x) if len(x) > 0: dash_idx = x.find('-') if dash_idx != -1: return "phonenumber/" + x[1:] return "phonenumber/x-" + x return '' @staticmethod def email_uri(email): c = SM.clean_email(email) if len(c) > 0: qc = quote(c, safe='') return "email/" + qc return '' @staticmethod def uri_from_fields(prefix, *fields): """Construct a URI out of the fields, concatenating them after removing offensive characters. When all the fields are empty, return empty""" string = '_'.join(SM.alpha_numeric(f.strip().lower(), '') for f in fields) if len(string) == len(fields)-1: return '' return prefix + string @staticmethod def country_uri(x): """Return a URI for a country given its name.""" x = re.sub('[^A-Za-z0-9]+', '', x) return x.lower() @staticmethod def person_name_uri(x): """Return a URI for a person name.""" x = re.sub('[^A-Za-z0-9]+', '', x.strip()) return x.lower()
[ 1, 515, 3142, 1982, 1053, 14978, 13, 5215, 337, 13, 5215, 318, 5416, 13, 13, 1990, 501, 29924, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 978, 353, 376, 14702, 2315, 666, 2785, 29908, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 318, 5416, 29918, 5338, 29898, 13506, 1125, 13, 4706, 9995, 1168, 4984, 263, 23539, 773, 263, 501, 11150, 15945, 29908, 13, 4706, 736, 10944, 718, 851, 29898, 25118, 29889, 25118, 29896, 3101, 13, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 318, 5416, 29918, 5338, 29918, 272, 29918, 6310, 29898, 13506, 29892, 995, 1125, 13, 4706, 9995, 1168, 4984, 263, 23539, 773, 263, 501, 11150, 29892, 541, 736, 4069, 565, 995, 338, 4069, 15945, 29908, 13, 4706, 565, 995, 338, 6213, 470, 995, 1275, 525, 2396, 13, 9651, 736, 6629, 13, 4706, 1683, 29901, 13, 9651, 736, 10944, 718, 851, 29898, 25118, 29889, 25118, 29896, 3101, 13, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 9008, 29918, 5338, 29898, 29916, 1125, 13, 4706, 9995, 11609, 278, 21333, 363, 263, 9008, 13, 4706, 408, 4234, 401, 29899, 6710, 13, 4706, 4803, 525, 29916, 29899, 29915, 408, 4234, 775, 565, 451, 2198, 297, 278, 1353, 13, 4706, 9995, 13, 4706, 921, 353, 11278, 29889, 14941, 29918, 6710, 29898, 29916, 29897, 13, 4706, 565, 7431, 29898, 29916, 29897, 1405, 29871, 29900, 29901, 13, 9651, 12569, 29918, 13140, 353, 921, 29889, 2886, 877, 29899, 1495, 13, 9651, 565, 12569, 29918, 13140, 2804, 448, 29896, 29901, 13, 18884, 736, 376, 17607, 264, 2807, 12975, 718, 921, 29961, 29896, 17531, 13, 9651, 736, 376, 17607, 264, 2807, 29914, 29916, 29899, 29908, 718, 921, 13, 4706, 736, 6629, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 4876, 29918, 5338, 29898, 5269, 1125, 13, 4706, 274, 353, 13766, 29889, 14941, 29918, 5269, 29898, 5269, 29897, 13, 4706, 565, 7431, 29898, 29883, 29897, 1405, 29871, 29900, 29901, 13, 9651, 3855, 29883, 353, 14978, 29898, 29883, 29892, 9109, 2433, 1495, 13, 9651, 736, 376, 5269, 12975, 718, 3855, 29883, 13, 4706, 736, 6629, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 21333, 29918, 3166, 29918, 9621, 29898, 13506, 29892, 334, 9621, 1125, 13, 4706, 9995, 1168, 4984, 263, 23539, 714, 310, 278, 4235, 29892, 16125, 1218, 963, 1156, 11077, 1283, 6270, 4890, 29889, 13, 4706, 1932, 599, 278, 4235, 526, 4069, 29892, 736, 4069, 15945, 29908, 13, 4706, 1347, 353, 22868, 4286, 7122, 29898, 17061, 29889, 2312, 29918, 21574, 29898, 29888, 29889, 17010, 2141, 13609, 3285, 27255, 363, 285, 297, 4235, 29897, 13, 13, 4706, 565, 7431, 29898, 1807, 29897, 1275, 7431, 29898, 9621, 6817, 29896, 29901, 13, 9651, 736, 6629, 13, 13, 4706, 736, 10944, 718, 1347, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 4234, 29918, 5338, 29898, 29916, 1125, 13, 4706, 9995, 11609, 263, 23539, 363, 263, 4234, 2183, 967, 1024, 1213, 15945, 13, 4706, 921, 353, 337, 29889, 1491, 877, 22896, 29909, 29899, 29999, 29874, 29899, 29920, 29900, 29899, 29929, 10062, 742, 15516, 921, 29897, 13, 4706, 736, 921, 29889, 13609, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 2022, 29918, 978, 29918, 5338, 29898, 29916, 1125, 13, 4706, 9995, 11609, 263, 23539, 363, 263, 2022, 1024, 1213, 15945, 13, 4706, 921, 353, 337, 29889, 1491, 877, 22896, 29909, 29899, 29999, 29874, 29899, 29920, 29900, 29899, 29929, 10062, 742, 15516, 921, 29889, 17010, 3101, 13, 4706, 736, 921, 29889, 13609, 580, 13, 2 ]
syncgateway/__init__.py
ecordell/syncgateway-admin-client
0
16952
__author__ = '<NAME>' __copyright__ = 'Copyright 2012-2015 Localmed, Inc.' __version__ = "0.1.6" __version_info__ = tuple(__version__.split('.')) __short_version__ = __version__
[ 1, 4770, 8921, 1649, 353, 12801, 5813, 16299, 13, 1649, 8552, 1266, 1649, 353, 525, 11882, 1266, 29871, 29906, 29900, 29896, 29906, 29899, 29906, 29900, 29896, 29945, 9959, 2168, 29892, 9266, 6169, 13, 13, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29896, 29889, 29953, 29908, 13, 1649, 3259, 29918, 3888, 1649, 353, 18761, 22168, 3259, 26914, 5451, 877, 6169, 876, 13, 1649, 12759, 29918, 3259, 1649, 353, 4770, 3259, 1649, 13, 2 ]
setup.py
cedwards036/JHUHandshakeDataTools
0
59524
<reponame>cedwards036/JHUHandshakeDataTools import pathlib from setuptools import setup, find_packages from jhu_handshake_data_tools import __version__, __author__, __email__ HERE = pathlib.Path(__file__).parent README = (HERE / "README.md").read_text() setup( name="jhu_handshake_data_tools", version=__version__, description="A library for cleaning and working with majors from JHU's Handshake environment", long_description=README, url="https://github.com/cedwards036/JHUHandshakeDataTools", author=__author__, author_email=__email__, license="MIT", classifiers=[ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", ], packages=find_packages(), include_package_data=True )
[ 1, 529, 276, 1112, 420, 29958, 1133, 2935, 29900, 29941, 29953, 29914, 29967, 29950, 29965, 3481, 845, 1296, 1469, 24183, 13, 5215, 2224, 1982, 13, 13, 3166, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 13, 3166, 432, 6905, 29918, 3179, 845, 1296, 29918, 1272, 29918, 8504, 1053, 4770, 3259, 1649, 29892, 4770, 8921, 1649, 29892, 4770, 5269, 1649, 13, 13, 5006, 353, 2224, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 13, 13, 16310, 2303, 353, 313, 5006, 847, 376, 16310, 2303, 29889, 3487, 2564, 949, 29918, 726, 580, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 29926, 6905, 29918, 3179, 845, 1296, 29918, 1272, 29918, 8504, 613, 13, 1678, 1873, 29922, 1649, 3259, 1649, 29892, 13, 1678, 6139, 543, 29909, 3489, 363, 5941, 292, 322, 1985, 411, 10067, 943, 515, 435, 29950, 29965, 29915, 29879, 5166, 845, 1296, 5177, 613, 13, 1678, 1472, 29918, 8216, 29922, 16310, 2303, 29892, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 1133, 2935, 29900, 29941, 29953, 29914, 29967, 29950, 29965, 3481, 845, 1296, 1469, 24183, 613, 13, 1678, 4148, 29922, 1649, 8921, 1649, 29892, 13, 1678, 4148, 29918, 5269, 29922, 1649, 5269, 1649, 29892, 13, 1678, 19405, 543, 26349, 613, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29955, 613, 13, 1678, 21251, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 13, 29897, 13, 2 ]
abstract_models/bisim/pick_puck.py
ondrejba/discrete_abstractions
6
58894
<filename>abstract_models/bisim/pick_puck.py import numpy as np class BisimPickPuckModel: @classmethod def get_state_block(cls, hand, layers, action_grid): num_positions = action_grid.shape[0] * action_grid.shape[1] action_grid = np.reshape(action_grid, (-1, 2)) if hand is not None: return num_positions else: puck = layers[0][0] index = cls.get_coords(action_grid, puck.x, puck.y) return index @staticmethod def get_coords(action_grid, x, y): return np.where(np.sum(action_grid == [x, y], axis=1) == 2)[0][0]
[ 1, 529, 9507, 29958, 16595, 29918, 9794, 29914, 18809, 326, 29914, 23945, 29918, 29886, 2707, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1990, 16818, 326, 29925, 860, 29925, 2707, 3195, 29901, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 679, 29918, 3859, 29918, 1271, 29898, 25932, 29892, 1361, 29892, 15359, 29892, 3158, 29918, 7720, 1125, 13, 13, 4706, 954, 29918, 1066, 2187, 353, 3158, 29918, 7720, 29889, 12181, 29961, 29900, 29962, 334, 3158, 29918, 7720, 29889, 12181, 29961, 29896, 29962, 13, 4706, 3158, 29918, 7720, 353, 7442, 29889, 690, 14443, 29898, 2467, 29918, 7720, 29892, 8521, 29896, 29892, 29871, 29906, 876, 13, 13, 4706, 565, 1361, 338, 451, 6213, 29901, 13, 13, 9651, 736, 954, 29918, 1066, 2187, 13, 13, 4706, 1683, 29901, 13, 13, 9651, 2653, 384, 353, 15359, 29961, 29900, 3816, 29900, 29962, 13, 9651, 2380, 353, 1067, 29879, 29889, 657, 29918, 1111, 4339, 29898, 2467, 29918, 7720, 29892, 2653, 384, 29889, 29916, 29892, 2653, 384, 29889, 29891, 29897, 13, 13, 9651, 736, 2380, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1111, 4339, 29898, 2467, 29918, 7720, 29892, 921, 29892, 343, 1125, 13, 13, 4706, 736, 7442, 29889, 3062, 29898, 9302, 29889, 2083, 29898, 2467, 29918, 7720, 1275, 518, 29916, 29892, 343, 1402, 9685, 29922, 29896, 29897, 1275, 29871, 29906, 9601, 29900, 3816, 29900, 29962, 13, 2 ]