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
27 Improve Performance with Algorithm Tuning/grid_search.py
IshmaelAsabere/Machine_Learning-Various-Topics
0
1600201
<gh_stars>0 # Grid Search for Algorithm Tuning import numpy from pandas import read_csv from sklearn.linear_model import RidgeClassifier from sklearn.model_selection import GridSearchCV filename = 'pima-indians-diabetes.data.csv' names = ['preg', 'plas', 'pres', 'skin', 'test', 'mass', 'pedi', 'age', 'class'] dataframe = read_csv(filename, names=names) array = dataframe.values X = array[:,0:8] Y = array[:,8] alphas = numpy.array([1,0.1,0.01,0.001,0.0001,0]) param_grid = dict(alpha=alphas) model = RidgeClassifier() grid = GridSearchCV(estimator=model, param_grid=param_grid, cv=3) grid.fit(X, Y) print(grid.best_score_) print(grid.best_estimator_.alpha)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 11657, 11856, 363, 29068, 21072, 292, 13, 5215, 12655, 13, 3166, 11701, 1053, 1303, 29918, 7638, 13, 3166, 2071, 19668, 29889, 10660, 29918, 4299, 1053, 390, 5525, 2385, 3709, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 11657, 7974, 15633, 13, 9507, 353, 525, 29886, 2946, 29899, 513, 5834, 29899, 6051, 370, 10778, 29889, 1272, 29889, 7638, 29915, 13, 7039, 353, 6024, 1457, 29887, 742, 525, 572, 294, 742, 525, 4569, 742, 525, 808, 262, 742, 525, 1688, 742, 525, 25379, 742, 525, 9795, 29875, 742, 525, 482, 742, 525, 1990, 2033, 13, 1272, 2557, 353, 1303, 29918, 7638, 29898, 9507, 29892, 2983, 29922, 7039, 29897, 13, 2378, 353, 12205, 29889, 5975, 13, 29990, 353, 1409, 7503, 29892, 29900, 29901, 29947, 29962, 13, 29979, 353, 1409, 7503, 29892, 29947, 29962, 13, 284, 16130, 353, 12655, 29889, 2378, 4197, 29896, 29892, 29900, 29889, 29896, 29892, 29900, 29889, 29900, 29896, 29892, 29900, 29889, 29900, 29900, 29896, 29892, 29900, 29889, 29900, 29900, 29900, 29896, 29892, 29900, 2314, 13, 3207, 29918, 7720, 353, 9657, 29898, 2312, 29922, 284, 16130, 29897, 13, 4299, 353, 390, 5525, 2385, 3709, 580, 13, 7720, 353, 11657, 7974, 15633, 29898, 342, 326, 1061, 29922, 4299, 29892, 1828, 29918, 7720, 29922, 3207, 29918, 7720, 29892, 13850, 29922, 29941, 29897, 13, 7720, 29889, 9202, 29898, 29990, 29892, 612, 29897, 13, 2158, 29898, 7720, 29889, 13318, 29918, 13628, 19925, 13, 2158, 29898, 7720, 29889, 13318, 29918, 342, 326, 1061, 5396, 2312, 29897, 13, 2 ]
yank/interface_database_mixin.py
khunspoonzi/yank
1
107465
<reponame>khunspoonzi/yank # ┌────────────────────────────────────────────────────────────────────────────────────┐ # │ GENERAL IMPORTS │ # └────────────────────────────────────────────────────────────────────────────────────┘ from datetime import datetime # ┌────────────────────────────────────────────────────────────────────────────────────┐ # │ SQLALCHEMY IMPORTS │ # └────────────────────────────────────────────────────────────────────────────────────┘ from sqlalchemy import Boolean, DateTime, exists, Float, func, Integer, String # ┌────────────────────────────────────────────────────────────────────────────────────┐ # │ PROJECT IMPORTS │ # └────────────────────────────────────────────────────────────────────────────────────┘ import yank.constants as _c # ┌────────────────────────────────────────────────────────────────────────────────────┐ # │ INTERFACE DATABASE MIXIN │ # └────────────────────────────────────────────────────────────────────────────────────┘ class InterfaceDatabaseMixin: """ Interface Database Mixin """ # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ CONSTANTS │ # └────────────────────────────────────────────────────────────────────────────────┘ # Type Map TYPE_MAP = { str: String, int: Integer, float: Float, bool: Boolean, datetime: DateTime, } # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ CLASS ATTRIBUTES │ # └────────────────────────────────────────────────────────────────────────────────┘ # Initialize database session db_session = None # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ NEW │ # └────────────────────────────────────────────────────────────────────────────────┘ def new(self, **kwargs): """ A creates a new Item using the SQLAlchemy ORM Item class """ # Get rid of all kwargs not in field map kwargs = {k: v for k, v in kwargs.items() if k in self.field_map} # Cast the item fields spplied as kawrgs and return an initialized Item object return self.Item(**self.cast_fields(kwargs)) # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ GET │ # └────────────────────────────────────────────────────────────────────────────────┘ def get(self, queryset=None, **kwargs): """ Gets an item from the database based in the supplied kwargs """ # Get queryset queryset = queryset or self.db_session.query(self.Item) # Return filtered queryset return queryset.filter_by(**kwargs).one() # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ COUNT │ # └────────────────────────────────────────────────────────────────────────────────┘ def count(self): """ Returns a count of items in the database """ # Return count return self.db_session.query(func.count(self.Item.id)).scalar() """ For more info on counting with SQL Alchemy: https://stackoverflow.com/questions/10822635/get-the-number-of-rows-in-table- using-sqlalchemy https://stackoverflow.com/questions/14754994/why-is-sqlalchemy-count-much-slower -than-the-raw-query """ # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ EXISTS │ # └────────────────────────────────────────────────────────────────────────────────┘ def exists(self, **kwargs): """ Returns a boolean of whether an item by the filter kwargs exists in the database """ # Get Item Item = self.Item # Convert field names to field objects kwargs = {getattr(Item, field, None): value for field, value in kwargs.items()} # Remove null fields kwargs = {k: v for k, v in kwargs.items() if k} # Return boolean of whether or not the object exists return self.db_session.query( exists().where(*[k == v for k, v in kwargs.items()]) ).scalar() # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ ALL │ # └────────────────────────────────────────────────────────────────────────────────┘ def all(self): """ Returns a queryset of all items in the database """ # Return a queryset of all items return self.db_session.query(self.Item).all() # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ FILTER │ # └────────────────────────────────────────────────────────────────────────────────┘ def filter(self, queryset=None, display_map=None, tuples=None, **kwargs): """ Returns a filtered queryset of items in the database by the provided kwargs """ # ┌────────────────────────────────────────────────────────────────────────────┐ # │ TUPLES │ # └────────────────────────────────────────────────────────────────────────────┘ # NOTE: A list of tuples can be used instead of kwargs for more complex logic # e.g. author__contains=a && author__contains=b # Using kwargs, there can only be one author__contains argument as it is a dict # Check if tuples if tuples: # Iterate over tuples for field, value in tuples: # Get queryset queryset = self.filter( queryset=queryset, display_map=display_map, **{field: value} ) # Return queryset return queryset # ┌────────────────────────────────────────────────────────────────────────────┐ # │ KWARGS │ # └────────────────────────────────────────────────────────────────────────────┘ # Get Item Item = self.Item # Get field map field_map = self.field_map # Initialize display map display_map = ( {k.lower(): v for k, v in display_map.items()} if display_map else {} ) # Get queryset queryset = queryset or self.db_session.query(Item) # Initialize field cache field_cache = {} # ┌────────────────────────────────────────────────────────────────────────────┐ # │ ITERATE OVER KWARGS │ # └────────────────────────────────────────────────────────────────────────────┘ # Iterate over kwargs for field, value in kwargs.items(): # Initialize should negate should_negate = False # Check if filed starts with tilde if field.startswith("~"): # Set should negate to True should_negate = True # Replace tilde field = field.replace("~", "", 1).strip() # Split field by modifier field_split = field.split("__") # Separate field from modifier field, modifier = ( field_split if len(field_split) == 2 else (field_split[0], None) ) # Set modifier modifier = modifier.lower() if modifier else "" # Check if field not in field map if field not in field_map: # Get field as display field = display_map.get(field.lower(), field) # Continue if field not in field map if field not in field_map: continue # Get field cast field_cast = field_map[field][_c.CAST] # Define field is string boolean field_is_str = field_cast is str # Add field object to field cache field_cache[field] = field_cache.get(field, getattr(Item, field)) # Get field object field_obj = field_cache[field] # ┌────────────────────────────────────────────────────────────────────────┐ # │ CAST VALUE │ # └────────────────────────────────────────────────────────────────────────┘ # Check if modifier is not a multiple value operator if modifier not in (_c.IN, _c.IIN): # Cast value value = self.cast_field(field, value) # ┌────────────────────────────────────────────────────────────────────────┐ # │ SUBSTRING │ # └────────────────────────────────────────────────────────────────────────┘ # Handle case of substring if ( modifier in ( _c.CONTAINS, _c.ICONTAINS, _c.STARTSWITH, _c.ISTARTSWITH, _c.ENDSWITH, _c.IENDSWITH, ) and field_is_str ): # ┌────────────────────────────────────────────────────────────────────┐ # │ ARGUMENT STRING │ # └────────────────────────────────────────────────────────────────────┘ # Handle case of contains if modifier in (_c.CONTAINS, _c.ICONTAINS): # Wrap argument string in % signs arg_string = f"%{value}%" # Otherwise handle case of starts with elif modifier in (_c.STARTSWITH, _c.ISTARTSWITH): # Add % sign to end of argument string arg_string = f"{value}%" # Otherwise handle case of ends with elif modifier in (_c.ENDSWITH, _c.IENDSWITH): # Add % sign to start of argument string arg_string = f"%{value}" # ┌────────────────────────────────────────────────────────────────────┐ # │ QUERY │ # └────────────────────────────────────────────────────────────────────┘ # Handle case of case-sensitive if modifier in (_c.CONTAINS, _c.STARTSWITH, _c.ENDSWITH): # Set query using like query = field_obj.like(arg_string) # Otherwise handle case of case-insensitive elif modifier in (_c.ICONTAINS, _c.ISTARTSWITH, _c.IENDSWITH): # Set query using ilike query = field_obj.ilike(arg_string) # ┌────────────────────────────────────────────────────────────────────────┐ # │ REGEX │ # └────────────────────────────────────────────────────────────────────────┘ # Otherwise handle case of regex elif modifier == _c.REGEX and field_is_str: # Define query query = field_obj.op("regexp")(value) # ┌────────────────────────────────────────────────────────────────────────┐ # │ IN │ # └────────────────────────────────────────────────────────────────────────┘ # Otherwise handle case of in elif modifier in (_c.IN, _c.IIN): # Convert and cast to a list of values values = [self.cast_field(field, i.strip()) for i in value.split(",")] # Handle case of iin if modifier == _c.IIN and field_is_str: # Define query query = func.lower(field_obj).in_([i.lower() for i in values]) # Otherwise handle normal case else: # Define query query = field_obj.in_(values) # ┌────────────────────────────────────────────────────────────────────────┐ # │ EXACT │ # └────────────────────────────────────────────────────────────────────────┘ # Otherwise handle exact case else: # Check if modifier is iexact if modifier == _c.IEXACT and field_is_str: # Define query query = func.lower(field_obj) == value.lower() # Otherwise handle standard exact case else: # Define query query = field_obj == value # ┌────────────────────────────────────────────────────────────────────────┐ # │ NEGATE │ # └────────────────────────────────────────────────────────────────────────┘ # Check if should negate if should_negate: # Negagte query query = ~query # ┌────────────────────────────────────────────────────────────────────────┐ # │ FILTER │ # └────────────────────────────────────────────────────────────────────────┘ # Filter with query queryset = queryset.filter(query) # Return filtered queryset return queryset # ┌────────────────────────────────────────────────────────────────────────────────┐ # │ SORT │ # └────────────────────────────────────────────────────────────────────────────────┘ def sort(self, *fields, queryset=None, display_map=None): """ Returns a queryset of items sorted by the provided fields """ # Get Item Item = self.Item # Initialize display map display_map = ( {k.lower(): v for k, v in display_map.items()} if display_map else {} ) # Initialize new fields list _fields = [] # Iterate over fields for field in fields: # Initialize ascending boolean ascending = True # Check if field begins with negative sign if field.startswith("-"): # Set ascending to False ascending = False # Remove negative sign from string field = field[1:] # Get SQL Alchemy field object by field name or display field = getattr( Item, field, getattr(Item, display_map[field.lower()], None) if field in display_map else None, ) # Continue if field is None if field is None: continue # Apply sort direction to field object field = field.asc() if ascending is True else field.desc() # Add field to fields list _fields.append(field) # Get queryset queryset = queryset or self.db_session.query(Item) # Return sorted queryset return queryset.order_by(*_fields)
[ 1, 529, 276, 1112, 420, 29958, 15339, 348, 1028, 6150, 2526, 29914, 29891, 804, 13, 29937, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 29937, 11879, 402, 1430, 1001, 1964, 306, 3580, 8476, 29903, 462, 462, 462, 462, 1678, 11879, 13, 29937, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 3166, 12865, 1053, 12865, 13, 13, 29937, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 29937, 11879, 3758, 1964, 3210, 12665, 29979, 306, 3580, 8476, 29903, 462, 462, 462, 462, 11879, 13, 29937, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 3166, 4576, 284, 305, 6764, 1053, 11185, 29892, 12315, 29892, 4864, 29892, 27842, 29892, 3653, 29892, 8102, 29892, 1714, 13, 13, 29937, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 29937, 11879, 13756, 17637, 306, 3580, 8476, 29903, 462, 462, 462, 462, 1678, 11879, 13, 29937, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 5215, 343, 804, 29889, 3075, 1934, 408, 903, 29883, 13, 13, 13, 29937, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 29937, 11879, 2672, 4945, 29943, 11538, 27640, 27982, 341, 6415, 1177, 462, 462, 462, 965, 11879, 13, 29937, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 13, 1990, 25796, 9112, 29924, 861, 262, 29901, 13, 1678, 9995, 25796, 5470, 23478, 262, 9995, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 8707, 1254, 2190, 9375, 462, 462, 462, 462, 418, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 396, 5167, 7315, 13, 1678, 323, 6959, 29918, 23827, 353, 426, 13, 4706, 851, 29901, 1714, 29892, 13, 4706, 938, 29901, 8102, 29892, 13, 4706, 5785, 29901, 27842, 29892, 13, 4706, 6120, 29901, 11185, 29892, 13, 4706, 12865, 29901, 12315, 29892, 13, 1678, 500, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 315, 4375, 1799, 15531, 29911, 3960, 29933, 2692, 2890, 462, 462, 462, 1669, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 396, 25455, 2566, 4867, 13, 1678, 4833, 29918, 7924, 353, 6213, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 29091, 462, 462, 462, 462, 9651, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 716, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 9995, 319, 10017, 263, 716, 10976, 773, 278, 3758, 2499, 305, 6764, 6323, 29924, 10976, 770, 9995, 13, 13, 4706, 396, 3617, 8177, 310, 599, 9049, 5085, 451, 297, 1746, 2910, 13, 4706, 9049, 5085, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 9049, 5085, 29889, 7076, 580, 565, 413, 297, 1583, 29889, 2671, 29918, 1958, 29913, 13, 13, 4706, 396, 4834, 278, 2944, 4235, 269, 407, 2957, 408, 413, 1450, 29878, 3174, 322, 736, 385, 16601, 10976, 1203, 13, 4706, 736, 1583, 29889, 2001, 29898, 1068, 1311, 29889, 4384, 29918, 9621, 29898, 19290, 876, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 12354, 462, 462, 462, 462, 9651, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 2346, 842, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 9995, 402, 1691, 385, 2944, 515, 278, 2566, 2729, 297, 278, 19056, 9049, 5085, 9995, 13, 13, 4706, 396, 3617, 2346, 842, 13, 4706, 2346, 842, 353, 2346, 842, 470, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 1311, 29889, 2001, 29897, 13, 13, 4706, 396, 7106, 22289, 2346, 842, 13, 4706, 736, 2346, 842, 29889, 4572, 29918, 1609, 29898, 1068, 19290, 467, 650, 580, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 21122, 462, 462, 462, 462, 3986, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 2302, 29898, 1311, 1125, 13, 4706, 9995, 16969, 263, 2302, 310, 4452, 297, 278, 2566, 9995, 13, 13, 4706, 396, 7106, 2302, 13, 4706, 736, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 9891, 29889, 2798, 29898, 1311, 29889, 2001, 29889, 333, 8106, 19529, 279, 580, 13, 13, 4706, 9995, 13, 4706, 1152, 901, 5235, 373, 21248, 411, 3758, 838, 305, 6764, 29901, 13, 13, 4706, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29896, 29900, 29947, 29906, 29906, 29953, 29941, 29945, 29914, 657, 29899, 1552, 29899, 4537, 29899, 974, 29899, 5727, 29899, 262, 29899, 2371, 29899, 13, 4706, 773, 29899, 2850, 284, 305, 6764, 13, 13, 4706, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29896, 29946, 29955, 29945, 29946, 29929, 29929, 29946, 29914, 14606, 29899, 275, 29899, 2850, 284, 305, 6764, 29899, 2798, 29899, 29885, 987, 29899, 29879, 13609, 13, 4706, 448, 27603, 29899, 1552, 29899, 1610, 29899, 1972, 13, 4706, 9995, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 28731, 462, 462, 462, 462, 308, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 4864, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 7223, 310, 3692, 385, 2944, 491, 278, 4175, 9049, 5085, 4864, 297, 278, 2566, 13, 4706, 9995, 13, 13, 4706, 396, 3617, 10976, 13, 4706, 10976, 353, 1583, 29889, 2001, 13, 13, 4706, 396, 14806, 1746, 2983, 304, 1746, 3618, 13, 4706, 9049, 5085, 353, 426, 657, 5552, 29898, 2001, 29892, 1746, 29892, 6213, 1125, 995, 363, 1746, 29892, 995, 297, 9049, 5085, 29889, 7076, 28296, 13, 13, 4706, 396, 15154, 1870, 4235, 13, 4706, 9049, 5085, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 9049, 5085, 29889, 7076, 580, 565, 413, 29913, 13, 13, 4706, 396, 7106, 7223, 310, 3692, 470, 451, 278, 1203, 4864, 13, 4706, 736, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 13, 9651, 4864, 2141, 3062, 10456, 29961, 29895, 1275, 325, 363, 413, 29892, 325, 297, 9049, 5085, 29889, 7076, 580, 2314, 13, 4706, 13742, 19529, 279, 580, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 15149, 462, 462, 462, 462, 9651, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 599, 29898, 1311, 1125, 13, 4706, 9995, 16969, 263, 2346, 842, 310, 599, 4452, 297, 278, 2566, 9995, 13, 13, 4706, 396, 7106, 263, 2346, 842, 310, 599, 4452, 13, 4706, 736, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 1311, 29889, 2001, 467, 497, 580, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 383, 6227, 4945, 462, 462, 462, 462, 308, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 4175, 29898, 1311, 29892, 2346, 842, 29922, 8516, 29892, 2479, 29918, 1958, 29922, 8516, 29892, 5291, 2701, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 16969, 263, 22289, 2346, 842, 310, 4452, 297, 278, 2566, 491, 278, 4944, 9049, 5085, 13, 4706, 9995, 13, 13, 4706, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 4706, 396, 11879, 323, 4897, 17101, 462, 462, 462, 462, 268, 11879, 13, 4706, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 4706, 396, 6058, 29923, 29901, 319, 1051, 310, 5291, 2701, 508, 367, 1304, 2012, 310, 9049, 5085, 363, 901, 4280, 5900, 13, 4706, 396, 321, 29889, 29887, 29889, 4148, 1649, 11516, 29922, 29874, 2607, 4148, 1649, 11516, 29922, 29890, 13, 4706, 396, 5293, 9049, 5085, 29892, 727, 508, 871, 367, 697, 4148, 1649, 11516, 2980, 408, 372, 338, 263, 9657, 13, 13, 4706, 396, 5399, 565, 5291, 2701, 13, 4706, 565, 5291, 2701, 29901, 13, 13, 9651, 396, 20504, 403, 975, 5291, 2701, 13, 9651, 363, 1746, 29892, 995, 297, 5291, 2701, 29901, 13, 13, 18884, 396, 3617, 2346, 842, 13, 18884, 2346, 842, 353, 1583, 29889, 4572, 29898, 13, 462, 1678, 2346, 842, 29922, 1972, 842, 29892, 2479, 29918, 1958, 29922, 4990, 29918, 1958, 29892, 3579, 29912, 2671, 29901, 995, 29913, 13, 18884, 1723, 13, 13, 9651, 396, 7106, 2346, 842, 13, 9651, 736, 2346, 842, 13, 13, 4706, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 4706, 396, 11879, 476, 29956, 1718, 10749, 462, 462, 462, 462, 268, 11879, 13, 4706, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 4706, 396, 3617, 10976, 13, 4706, 10976, 353, 1583, 29889, 2001, 13, 13, 4706, 396, 3617, 1746, 2910, 13, 4706, 1746, 29918, 1958, 353, 1583, 29889, 2671, 29918, 1958, 13, 13, 4706, 396, 25455, 2479, 2910, 13, 4706, 2479, 29918, 1958, 353, 313, 13, 9651, 426, 29895, 29889, 13609, 7295, 325, 363, 413, 29892, 325, 297, 2479, 29918, 1958, 29889, 7076, 28296, 565, 2479, 29918, 1958, 1683, 6571, 13, 4706, 1723, 13, 13, 4706, 396, 3617, 2346, 842, 13, 4706, 2346, 842, 353, 2346, 842, 470, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 2001, 29897, 13, 13, 4706, 396, 25455, 1746, 7090, 13, 4706, 1746, 29918, 8173, 353, 6571, 13, 13, 4706, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 4706, 396, 11879, 306, 4945, 3040, 438, 5348, 476, 29956, 1718, 10749, 462, 462, 462, 4706, 11879, 13, 4706, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 4706, 396, 20504, 403, 975, 9049, 5085, 13, 4706, 363, 1746, 29892, 995, 297, 9049, 5085, 29889, 7076, 7295, 13, 13, 9651, 396, 25455, 881, 3480, 403, 13, 9651, 881, 29918, 10052, 403, 353, 7700, 13, 13, 9651, 396, 5399, 565, 934, 29881, 8665, 411, 6928, 311, 13, 9651, 565, 1746, 29889, 27382, 2541, 703, 30022, 29908, 1125, 13, 13, 18884, 396, 3789, 881, 3480, 403, 304, 5852, 13, 18884, 881, 29918, 10052, 403, 353, 5852, 13, 13, 18884, 396, 22108, 6928, 311, 13, 18884, 1746, 353, 1746, 29889, 6506, 703, 30022, 613, 12633, 29871, 29896, 467, 17010, 580, 13, 13, 9651, 396, 26178, 1746, 491, 878, 3709, 13, 9651, 1746, 29918, 5451, 353, 1746, 29889, 5451, 703, 1649, 1159, 13, 13, 9651, 396, 922, 862, 403, 1746, 515, 878, 3709, 13, 9651, 1746, 29892, 878, 3709, 353, 313, 13, 18884, 1746, 29918, 5451, 565, 7431, 29898, 2671, 29918, 5451, 29897, 1275, 29871, 29906, 1683, 313, 2671, 29918, 5451, 29961, 29900, 1402, 6213, 29897, 13, 9651, 1723, 13, 13, 9651, 396, 3789, 878, 3709, 13, 9651, 878, 3709, 353, 878, 3709, 29889, 13609, 580, 565, 878, 3709, 1683, 5124, 13, 13, 9651, 396, 5399, 565, 1746, 451, 297, 1746, 2910, 13, 9651, 565, 1746, 451, 297, 1746, 29918, 1958, 29901, 13, 13, 18884, 396, 3617, 1746, 408, 2479, 13, 18884, 1746, 353, 2479, 29918, 1958, 29889, 657, 29898, 2671, 29889, 13609, 3285, 1746, 29897, 13, 13, 9651, 396, 2866, 14150, 565, 1746, 451, 297, 1746, 2910, 13, 9651, 565, 1746, 451, 297, 1746, 29918, 1958, 29901, 13, 18884, 6773, 13, 13, 9651, 396, 3617, 1746, 4320, 13, 9651, 1746, 29918, 4384, 353, 1746, 29918, 1958, 29961, 2671, 3816, 29918, 29883, 29889, 5454, 1254, 29962, 13, 13, 9651, 396, 22402, 1746, 338, 1347, 7223, 13, 9651, 1746, 29918, 275, 29918, 710, 353, 1746, 29918, 4384, 338, 851, 13, 13, 9651, 396, 3462, 1746, 1203, 304, 1746, 7090, 13, 9651, 1746, 29918, 8173, 29961, 2671, 29962, 353, 1746, 29918, 8173, 29889, 657, 29898, 2671, 29892, 679, 5552, 29898, 2001, 29892, 1746, 876, 13, 13, 9651, 396, 3617, 1746, 1203, 13, 9651, 1746, 29918, 5415, 353, 1746, 29918, 8173, 29961, 2671, 29962, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 12766, 1254, 12599, 4462, 462, 462, 462, 632, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 5399, 565, 878, 3709, 338, 451, 263, 2999, 995, 5455, 13, 9651, 565, 878, 3709, 451, 297, 9423, 29883, 29889, 1177, 29892, 903, 29883, 29889, 29902, 1177, 1125, 13, 13, 18884, 396, 4834, 995, 13, 18884, 995, 353, 1583, 29889, 4384, 29918, 2671, 29898, 2671, 29892, 995, 29897, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 27092, 20785, 462, 462, 462, 795, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 29273, 1206, 310, 28228, 13, 9651, 565, 313, 13, 18884, 878, 3709, 13, 18884, 297, 313, 13, 462, 1678, 903, 29883, 29889, 6007, 6040, 1177, 29903, 29892, 13, 462, 1678, 903, 29883, 29889, 2965, 1164, 6040, 1177, 29903, 29892, 13, 462, 1678, 903, 29883, 29889, 25826, 23066, 13054, 29892, 13, 462, 1678, 903, 29883, 29889, 9047, 8322, 23066, 13054, 29892, 13, 462, 1678, 903, 29883, 29889, 1430, 8452, 29956, 13054, 29892, 13, 462, 1678, 903, 29883, 29889, 29902, 1430, 8452, 29956, 13054, 29892, 13, 18884, 1723, 13, 18884, 322, 1746, 29918, 275, 29918, 710, 13, 632, 1125, 13, 13, 18884, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 18884, 396, 11879, 9033, 29954, 5005, 3919, 29486, 4214, 462, 462, 462, 1678, 11879, 13, 18884, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 18884, 396, 29273, 1206, 310, 3743, 13, 18884, 565, 878, 3709, 297, 9423, 29883, 29889, 6007, 6040, 1177, 29903, 29892, 903, 29883, 29889, 2965, 1164, 6040, 1177, 29903, 1125, 13, 13, 462, 1678, 396, 399, 2390, 2980, 1347, 297, 1273, 18906, 13, 462, 1678, 1852, 29918, 1807, 353, 285, 29908, 29995, 29912, 1767, 10560, 29908, 13, 13, 18884, 396, 13466, 4386, 1206, 310, 8665, 411, 13, 18884, 25342, 878, 3709, 297, 9423, 29883, 29889, 25826, 23066, 13054, 29892, 903, 29883, 29889, 9047, 8322, 23066, 13054, 1125, 13, 13, 462, 1678, 396, 3462, 1273, 1804, 304, 1095, 310, 2980, 1347, 13, 462, 1678, 1852, 29918, 1807, 353, 285, 29908, 29912, 1767, 10560, 29908, 13, 13, 18884, 396, 13466, 4386, 1206, 310, 10614, 411, 13, 18884, 25342, 878, 3709, 297, 9423, 29883, 29889, 1430, 8452, 29956, 13054, 29892, 903, 29883, 29889, 29902, 1430, 8452, 29956, 13054, 1125, 13, 13, 462, 1678, 396, 3462, 1273, 1804, 304, 1369, 310, 2980, 1347, 13, 462, 1678, 1852, 29918, 1807, 353, 285, 29908, 29995, 29912, 1767, 5038, 13, 13, 18884, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 18884, 396, 11879, 660, 29965, 24422, 462, 462, 462, 795, 11879, 13, 18884, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 18884, 396, 29273, 1206, 310, 1206, 29899, 23149, 3321, 13, 18884, 565, 878, 3709, 297, 9423, 29883, 29889, 6007, 6040, 1177, 29903, 29892, 903, 29883, 29889, 25826, 23066, 13054, 29892, 903, 29883, 29889, 1430, 8452, 29956, 13054, 1125, 13, 13, 462, 1678, 396, 3789, 2346, 773, 763, 13, 462, 1678, 2346, 353, 1746, 29918, 5415, 29889, 4561, 29898, 1191, 29918, 1807, 29897, 13, 13, 18884, 396, 13466, 4386, 1206, 310, 1206, 29899, 1144, 575, 3321, 13, 18884, 25342, 878, 3709, 297, 9423, 29883, 29889, 2965, 1164, 6040, 1177, 29903, 29892, 903, 29883, 29889, 9047, 8322, 23066, 13054, 29892, 903, 29883, 29889, 29902, 1430, 8452, 29956, 13054, 1125, 13, 13, 462, 1678, 396, 3789, 2346, 773, 980, 9345, 13, 462, 1678, 2346, 353, 1746, 29918, 5415, 29889, 2638, 446, 29898, 1191, 29918, 1807, 29897, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 5195, 1692, 29990, 462, 462, 462, 462, 29871, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 13466, 4386, 1206, 310, 6528, 13, 9651, 25342, 878, 3709, 1275, 903, 29883, 29889, 1525, 1692, 29990, 322, 1746, 29918, 275, 29918, 710, 29901, 13, 13, 18884, 396, 22402, 2346, 13, 18884, 2346, 353, 1746, 29918, 5415, 29889, 459, 703, 13087, 29886, 1159, 29898, 1767, 29897, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 2672, 462, 462, 462, 462, 268, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 13466, 4386, 1206, 310, 297, 13, 9651, 25342, 878, 3709, 297, 9423, 29883, 29889, 1177, 29892, 903, 29883, 29889, 29902, 1177, 1125, 13, 13, 18884, 396, 14806, 322, 4320, 304, 263, 1051, 310, 1819, 13, 18884, 1819, 353, 518, 1311, 29889, 4384, 29918, 2671, 29898, 2671, 29892, 474, 29889, 17010, 3101, 363, 474, 297, 995, 29889, 5451, 28165, 13531, 13, 13, 18884, 396, 29273, 1206, 310, 474, 262, 13, 18884, 565, 878, 3709, 1275, 903, 29883, 29889, 29902, 1177, 322, 1746, 29918, 275, 29918, 710, 29901, 13, 13, 462, 1678, 396, 22402, 2346, 13, 462, 1678, 2346, 353, 3653, 29889, 13609, 29898, 2671, 29918, 5415, 467, 262, 29918, 4197, 29875, 29889, 13609, 580, 363, 474, 297, 1819, 2314, 13, 13, 18884, 396, 13466, 4386, 4226, 1206, 13, 18884, 1683, 29901, 13, 13, 462, 1678, 396, 22402, 2346, 13, 462, 1678, 2346, 353, 1746, 29918, 5415, 29889, 262, 23538, 5975, 29897, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 8528, 17923, 462, 462, 462, 462, 29871, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 13466, 4386, 2684, 1206, 13, 9651, 1683, 29901, 13, 13, 18884, 396, 5399, 565, 878, 3709, 338, 19282, 29916, 627, 13, 18884, 565, 878, 3709, 1275, 903, 29883, 29889, 29902, 5746, 17923, 322, 1746, 29918, 275, 29918, 710, 29901, 13, 13, 462, 1678, 396, 22402, 2346, 13, 462, 1678, 2346, 353, 3653, 29889, 13609, 29898, 2671, 29918, 5415, 29897, 1275, 995, 29889, 13609, 580, 13, 13, 18884, 396, 13466, 4386, 3918, 2684, 1206, 13, 18884, 1683, 29901, 13, 13, 462, 1678, 396, 22402, 2346, 13, 462, 1678, 2346, 353, 1746, 29918, 5415, 1275, 995, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 405, 11787, 3040, 462, 462, 462, 462, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 5399, 565, 881, 3480, 403, 13, 9651, 565, 881, 29918, 10052, 403, 29901, 13, 13, 18884, 396, 12610, 351, 371, 2346, 13, 18884, 2346, 353, 3695, 1972, 13, 13, 9651, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 9651, 396, 11879, 383, 6227, 4945, 462, 462, 462, 462, 11879, 13, 9651, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 9651, 396, 19916, 411, 2346, 13, 9651, 2346, 842, 353, 2346, 842, 29889, 4572, 29898, 1972, 29897, 13, 13, 4706, 396, 7106, 22289, 2346, 842, 13, 4706, 736, 2346, 842, 13, 13, 1678, 396, 29871, 31002, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31082, 13, 1678, 396, 11879, 317, 8476, 462, 462, 462, 462, 965, 11879, 13, 1678, 396, 29871, 30227, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 19820, 31119, 13, 13, 1678, 822, 2656, 29898, 1311, 29892, 334, 9621, 29892, 2346, 842, 29922, 8516, 29892, 2479, 29918, 1958, 29922, 8516, 1125, 13, 4706, 9995, 16969, 263, 2346, 842, 310, 4452, 12705, 491, 278, 4944, 4235, 9995, 13, 13, 4706, 396, 3617, 10976, 13, 4706, 10976, 353, 1583, 29889, 2001, 13, 13, 4706, 396, 25455, 2479, 2910, 13, 4706, 2479, 29918, 1958, 353, 313, 13, 9651, 426, 29895, 29889, 13609, 7295, 325, 363, 413, 29892, 325, 297, 2479, 29918, 1958, 29889, 7076, 28296, 565, 2479, 29918, 1958, 1683, 6571, 13, 4706, 1723, 13, 13, 4706, 396, 25455, 716, 4235, 1051, 13, 4706, 903, 9621, 353, 5159, 13, 13, 4706, 396, 20504, 403, 975, 4235, 13, 4706, 363, 1746, 297, 4235, 29901, 13, 13, 9651, 396, 25455, 12066, 2548, 7223, 13, 9651, 12066, 2548, 353, 5852, 13, 13, 9651, 396, 5399, 565, 1746, 16410, 411, 8178, 1804, 13, 9651, 565, 1746, 29889, 27382, 2541, 703, 29899, 29908, 1125, 13, 13, 18884, 396, 3789, 12066, 2548, 304, 7700, 13, 18884, 12066, 2548, 353, 7700, 13, 13, 18884, 396, 15154, 8178, 1804, 515, 1347, 13, 18884, 1746, 353, 1746, 29961, 29896, 17531, 13, 13, 9651, 396, 3617, 3758, 838, 305, 6764, 1746, 1203, 491, 1746, 1024, 470, 2479, 13, 9651, 1746, 353, 679, 5552, 29898, 13, 18884, 10976, 29892, 13, 18884, 1746, 29892, 13, 18884, 679, 5552, 29898, 2001, 29892, 2479, 29918, 1958, 29961, 2671, 29889, 13609, 580, 1402, 6213, 29897, 13, 18884, 565, 1746, 297, 2479, 29918, 1958, 13, 18884, 1683, 6213, 29892, 13, 9651, 1723, 13, 13, 9651, 396, 2866, 14150, 565, 1746, 338, 6213, 13, 9651, 565, 1746, 338, 6213, 29901, 13, 18884, 6773, 13, 13, 9651, 396, 2401, 368, 2656, 5305, 304, 1746, 1203, 13, 9651, 1746, 353, 1746, 29889, 6151, 580, 565, 12066, 2548, 338, 5852, 1683, 1746, 29889, 14273, 580, 13, 13, 9651, 396, 3462, 1746, 304, 4235, 1051, 13, 9651, 903, 9621, 29889, 4397, 29898, 2671, 29897, 13, 13, 4706, 396, 3617, 2346, 842, 13, 4706, 2346, 842, 353, 2346, 842, 470, 1583, 29889, 2585, 29918, 7924, 29889, 1972, 29898, 2001, 29897, 13, 13, 4706, 396, 7106, 12705, 2346, 842, 13, 4706, 736, 2346, 842, 29889, 2098, 29918, 1609, 10456, 29918, 9621, 29897, 13, 2 ]
exe041 - classificando Atletas.py
carlosbandelli/Exercicios_em_Python
0
194174
from datetime import date atual = date.today().year nascimento = int(input('Ano de nascimento: ')) idade = atual - nascimento print(f'O atleta tem {idade} anos.') if idade <= 9: print('Classificação: MIRIM') elif idade <= 14: print ('Classificação: INFANTIL') elif idade <= 19: print('Classificação: JUNIOR') elif idade <=25: print('Classificação: SENIOR') else: print('Classisficação: MASTER')
[ 1, 515, 12865, 1053, 2635, 13, 271, 950, 353, 2635, 29889, 27765, 2141, 6360, 13, 29876, 6151, 6174, 353, 938, 29898, 2080, 877, 29909, 1217, 316, 29229, 6174, 29901, 525, 876, 13, 5558, 353, 472, 950, 448, 29229, 6174, 13, 2158, 29898, 29888, 29915, 29949, 472, 280, 941, 1350, 426, 5558, 29913, 14110, 29889, 1495, 13, 361, 1178, 1943, 5277, 29871, 29929, 29901, 13, 1678, 1596, 877, 2385, 928, 8298, 29901, 341, 29902, 3960, 29924, 1495, 13, 23681, 1178, 1943, 5277, 29871, 29896, 29946, 29901, 13, 1678, 1596, 6702, 2385, 928, 8298, 29901, 2672, 29943, 13566, 6227, 1495, 13, 23681, 1178, 1943, 5277, 29871, 29896, 29929, 29901, 13, 1678, 1596, 877, 2385, 928, 8298, 29901, 435, 3904, 29902, 1955, 1495, 13, 23681, 1178, 1943, 5277, 29906, 29945, 29901, 13, 1678, 1596, 877, 2385, 928, 8298, 29901, 317, 1430, 29902, 1955, 1495, 13, 2870, 29901, 13, 1678, 1596, 877, 2385, 4492, 983, 2340, 29901, 14861, 1254, 1001, 1495, 13, 2 ]
chrome/common/extensions/docs/server2/app_yaml_helper_test.py
iplo/Chain
231
46368
#!/usr/bin/env python # Copyright 2013 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from app_yaml_helper import AppYamlHelper from extensions_paths import SERVER2 from host_file_system_provider import HostFileSystemProvider from mock_file_system import MockFileSystem from object_store_creator import ObjectStoreCreator from test_file_system import MoveTo, TestFileSystem from test_util import DisableLogging _ExtractVersion, _IsGreater, _GenerateAppYaml = ( AppYamlHelper.ExtractVersion, AppYamlHelper.IsGreater, AppYamlHelper.GenerateAppYaml) class AppYamlHelperTest(unittest.TestCase): def testExtractVersion(self): def run_test(version): self.assertEqual(version, _ExtractVersion(_GenerateAppYaml(version))) run_test('0') run_test('0-0') run_test('0-0-0') run_test('1') run_test('1-0') run_test('1-0-0') run_test('1-0-1') run_test('1-1-0') run_test('1-1-1') run_test('2-0-9') run_test('2-0-12') run_test('2-1') run_test('2-1-0') run_test('2-11-0') run_test('3-1-0') run_test('3-1-3') run_test('3-12-0') def testIsGreater(self): def assert_is_greater(lhs, rhs): self.assertTrue(_IsGreater(lhs, rhs), '%s is not > %s' % (lhs, rhs)) self.assertFalse(_IsGreater(rhs, lhs), '%s should not be > %s' % (rhs, lhs)) assert_is_greater('0-0', '0') assert_is_greater('0-0-0', '0') assert_is_greater('0-0-0', '0-0') assert_is_greater('1', '0') assert_is_greater('1', '0-0') assert_is_greater('1', '0-0-0') assert_is_greater('1-0', '0-0') assert_is_greater('1-0-0-0', '0-0-0') assert_is_greater('2-0-12', '2-0-9') assert_is_greater('2-0-12', '2-0-9-0') assert_is_greater('2-0-12-0', '2-0-9') assert_is_greater('2-0-12-0', '2-0-9-0') assert_is_greater('2-1', '2-0-9') assert_is_greater('2-1', '2-0-12') assert_is_greater('2-1-0', '2-0-9') assert_is_greater('2-1-0', '2-0-12') assert_is_greater('3-1-0', '2-1') assert_is_greater('3-1-0', '2-1-0') assert_is_greater('3-1-0', '2-11-0') assert_is_greater('3-1-3', '3-1-0') assert_is_greater('3-12-0', '3-1-0') assert_is_greater('3-12-0', '3-1-3') assert_is_greater('3-12-0', '3-1-3-0') @DisableLogging('warning') def testInstanceMethods(self): test_data = { 'app.yaml': _GenerateAppYaml('1-0'), 'app_yaml_helper.py': 'Copyright notice etc' } updates = [] # Pass a specific file system at head to the HostFileSystemProvider so that # we know it's always going to be backed by a MockFileSystem. The Provider # may decide to wrap it in caching etc. file_system_at_head = MockFileSystem( TestFileSystem(test_data, relative_to=SERVER2)) def apply_update(update): update = MoveTo(SERVER2, update) file_system_at_head.Update(update) updates.append(update) def host_file_system_constructor(branch, revision=None): self.assertEqual('trunk', branch) self.assertTrue(revision is not None) return MockFileSystem.Create( TestFileSystem(test_data, relative_to=SERVER2), updates[:revision]) object_store_creator = ObjectStoreCreator.ForTest() host_file_system_provider = HostFileSystemProvider( object_store_creator, default_trunk_instance=file_system_at_head, constructor_for_test=host_file_system_constructor) helper = AppYamlHelper(object_store_creator, host_file_system_provider) def assert_is_up_to_date(version): self.assertTrue(helper.IsUpToDate(version), '%s is not up to date' % version) self.assertRaises(ValueError, helper.GetFirstRevisionGreaterThan, version) self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) assert_is_up_to_date('1-0-0') assert_is_up_to_date('1-5-0') # Revision 1. apply_update({ 'app.yaml': _GenerateAppYaml('1-5-0') }) self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) self.assertEqual(1, helper.GetFirstRevisionGreaterThan('1-0-0')) assert_is_up_to_date('1-5-0') assert_is_up_to_date('2-5-0') # Revision 2. apply_update({ 'app_yaml_helper.py': 'fixed a bug' }) self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) self.assertEqual(1, helper.GetFirstRevisionGreaterThan('1-0-0')) assert_is_up_to_date('1-5-0') assert_is_up_to_date('2-5-0') # Revision 3. apply_update({ 'app.yaml': _GenerateAppYaml('1-6-0') }) self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) self.assertEqual(1, helper.GetFirstRevisionGreaterThan('1-0-0')) self.assertEqual(3, helper.GetFirstRevisionGreaterThan('1-5-0')) assert_is_up_to_date('2-5-0') # Revision 4. apply_update({ 'app.yaml': _GenerateAppYaml('1-8-0') }) # Revision 5. apply_update({ 'app.yaml': _GenerateAppYaml('2-0-0') }) # Revision 6. apply_update({ 'app.yaml': _GenerateAppYaml('2-2-0') }) # Revision 7. apply_update({ 'app.yaml': _GenerateAppYaml('2-4-0') }) # Revision 8. apply_update({ 'app.yaml': _GenerateAppYaml('2-6-0') }) self.assertEqual(0, helper.GetFirstRevisionGreaterThan('0-5-0')) self.assertEqual(1, helper.GetFirstRevisionGreaterThan('1-0-0')) self.assertEqual(3, helper.GetFirstRevisionGreaterThan('1-5-0')) self.assertEqual(5, helper.GetFirstRevisionGreaterThan('1-8-0')) self.assertEqual(6, helper.GetFirstRevisionGreaterThan('2-0-0')) self.assertEqual(6, helper.GetFirstRevisionGreaterThan('2-1-0')) self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-2-0')) self.assertEqual(7, helper.GetFirstRevisionGreaterThan('2-3-0')) self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-4-0')) self.assertEqual(8, helper.GetFirstRevisionGreaterThan('2-5-0')) assert_is_up_to_date('2-6-0') assert_is_up_to_date('2-7-0') if __name__ == '__main__': unittest.main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29941, 450, 678, 456, 1974, 13189, 943, 29889, 2178, 10462, 21676, 29889, 13, 29937, 4803, 310, 445, 2752, 775, 338, 4095, 287, 491, 263, 350, 7230, 29899, 3293, 19405, 393, 508, 367, 13, 29937, 1476, 297, 278, 365, 2965, 1430, 1660, 934, 29889, 13, 13, 5215, 443, 27958, 13, 13, 3166, 623, 29918, 25162, 29918, 20907, 1053, 2401, 29979, 8807, 10739, 13, 3166, 17752, 29918, 24772, 1053, 26996, 5348, 29906, 13, 3166, 3495, 29918, 1445, 29918, 5205, 29918, 18121, 1053, 16956, 2283, 3924, 6980, 13, 3166, 11187, 29918, 1445, 29918, 5205, 1053, 26297, 2283, 3924, 13, 3166, 1203, 29918, 8899, 29918, 1037, 1061, 1053, 4669, 9044, 9832, 1061, 13, 3166, 1243, 29918, 1445, 29918, 5205, 1053, 25249, 1762, 29892, 4321, 2283, 3924, 13, 3166, 1243, 29918, 4422, 1053, 3295, 519, 3403, 3460, 13, 13, 29918, 5647, 1461, 6594, 29892, 903, 3624, 25120, 1008, 29892, 903, 5631, 403, 2052, 29979, 8807, 353, 313, 13, 1678, 2401, 29979, 8807, 10739, 29889, 5647, 1461, 6594, 29892, 13, 1678, 2401, 29979, 8807, 10739, 29889, 3624, 25120, 1008, 29892, 13, 1678, 2401, 29979, 8807, 10739, 29889, 5631, 403, 2052, 29979, 8807, 29897, 13, 13, 1990, 2401, 29979, 8807, 10739, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 29871, 822, 1243, 5647, 1461, 6594, 29898, 1311, 1125, 13, 1678, 822, 1065, 29918, 1688, 29898, 3259, 1125, 13, 418, 1583, 29889, 9294, 9843, 29898, 3259, 29892, 903, 5647, 1461, 6594, 7373, 5631, 403, 2052, 29979, 8807, 29898, 3259, 4961, 13, 1678, 1065, 29918, 1688, 877, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29900, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29900, 29899, 29900, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 29899, 29900, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 29899, 29900, 29899, 29896, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 29899, 29896, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29896, 29899, 29896, 29899, 29896, 1495, 13, 1678, 1065, 29918, 1688, 877, 29906, 29899, 29900, 29899, 29929, 1495, 13, 1678, 1065, 29918, 1688, 877, 29906, 29899, 29900, 29899, 29896, 29906, 1495, 13, 1678, 1065, 29918, 1688, 877, 29906, 29899, 29896, 1495, 13, 1678, 1065, 29918, 1688, 877, 29906, 29899, 29896, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29906, 29899, 29896, 29896, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29941, 29899, 29896, 29899, 29900, 1495, 13, 1678, 1065, 29918, 1688, 877, 29941, 29899, 29896, 29899, 29941, 1495, 13, 1678, 1065, 29918, 1688, 877, 29941, 29899, 29896, 29906, 29899, 29900, 1495, 13, 13, 29871, 822, 1243, 3624, 25120, 1008, 29898, 1311, 1125, 13, 1678, 822, 4974, 29918, 275, 29918, 7979, 1008, 29898, 29880, 9499, 29892, 29365, 1125, 13, 418, 1583, 29889, 9294, 5574, 7373, 3624, 25120, 1008, 29898, 29880, 9499, 29892, 29365, 511, 14210, 29879, 338, 451, 1405, 1273, 29879, 29915, 1273, 313, 29880, 9499, 29892, 29365, 876, 13, 418, 1583, 29889, 9294, 8824, 7373, 3624, 25120, 1008, 29898, 29878, 9499, 29892, 301, 9499, 511, 13, 462, 539, 14210, 29879, 881, 451, 367, 1405, 1273, 29879, 29915, 1273, 313, 29878, 9499, 29892, 301, 9499, 876, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29900, 29899, 29900, 742, 525, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29900, 29899, 29900, 29899, 29900, 742, 525, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29900, 29899, 29900, 29899, 29900, 742, 525, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29896, 742, 525, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29896, 742, 525, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29896, 742, 525, 29900, 29899, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29896, 29899, 29900, 742, 525, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29896, 29899, 29900, 29899, 29900, 29899, 29900, 742, 525, 29900, 29899, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29900, 29899, 29896, 29906, 742, 525, 29906, 29899, 29900, 29899, 29929, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29900, 29899, 29896, 29906, 742, 525, 29906, 29899, 29900, 29899, 29929, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29900, 29899, 29896, 29906, 29899, 29900, 742, 525, 29906, 29899, 29900, 29899, 29929, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29900, 29899, 29896, 29906, 29899, 29900, 742, 525, 29906, 29899, 29900, 29899, 29929, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29896, 742, 525, 29906, 29899, 29900, 29899, 29929, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29896, 742, 525, 29906, 29899, 29900, 29899, 29896, 29906, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29896, 29899, 29900, 742, 525, 29906, 29899, 29900, 29899, 29929, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29906, 29899, 29896, 29899, 29900, 742, 525, 29906, 29899, 29900, 29899, 29896, 29906, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29899, 29900, 742, 525, 29906, 29899, 29896, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29899, 29900, 742, 525, 29906, 29899, 29896, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29899, 29900, 742, 525, 29906, 29899, 29896, 29896, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29899, 29941, 742, 525, 29941, 29899, 29896, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29906, 29899, 29900, 742, 525, 29941, 29899, 29896, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29906, 29899, 29900, 742, 525, 29941, 29899, 29896, 29899, 29941, 1495, 13, 1678, 4974, 29918, 275, 29918, 7979, 1008, 877, 29941, 29899, 29896, 29906, 29899, 29900, 742, 525, 29941, 29899, 29896, 29899, 29941, 29899, 29900, 1495, 13, 13, 29871, 732, 4205, 519, 3403, 3460, 877, 27392, 1495, 13, 29871, 822, 1243, 4998, 26112, 29898, 1311, 1125, 13, 1678, 1243, 29918, 1272, 353, 426, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29896, 29899, 29900, 5477, 13, 418, 525, 932, 29918, 25162, 29918, 20907, 29889, 2272, 2396, 525, 11882, 1266, 8369, 2992, 29915, 13, 1678, 500, 13, 13, 1678, 11217, 353, 5159, 13, 1678, 396, 6978, 263, 2702, 934, 1788, 472, 2343, 304, 278, 16956, 2283, 3924, 6980, 577, 393, 13, 1678, 396, 591, 1073, 372, 29915, 29879, 2337, 2675, 304, 367, 1250, 287, 491, 263, 26297, 2283, 3924, 29889, 450, 1019, 5489, 13, 1678, 396, 1122, 11097, 304, 12244, 372, 297, 22488, 2992, 29889, 13, 1678, 934, 29918, 5205, 29918, 271, 29918, 2813, 353, 26297, 2283, 3924, 29898, 13, 4706, 4321, 2283, 3924, 29898, 1688, 29918, 1272, 29892, 6198, 29918, 517, 29922, 18603, 29906, 876, 13, 13, 1678, 822, 3394, 29918, 5504, 29898, 5504, 1125, 13, 418, 2767, 353, 25249, 1762, 29898, 18603, 29906, 29892, 2767, 29897, 13, 418, 934, 29918, 5205, 29918, 271, 29918, 2813, 29889, 6422, 29898, 5504, 29897, 13, 418, 11217, 29889, 4397, 29898, 5504, 29897, 13, 13, 1678, 822, 3495, 29918, 1445, 29918, 5205, 29918, 27821, 29898, 17519, 29892, 26554, 29922, 8516, 1125, 13, 418, 1583, 29889, 9294, 9843, 877, 509, 2960, 742, 5443, 29897, 13, 418, 1583, 29889, 9294, 5574, 29898, 276, 4924, 338, 451, 6213, 29897, 13, 418, 736, 26297, 2283, 3924, 29889, 4391, 29898, 13, 3986, 4321, 2283, 3924, 29898, 1688, 29918, 1272, 29892, 6198, 29918, 517, 29922, 18603, 29906, 511, 11217, 7503, 276, 4924, 2314, 13, 13, 1678, 1203, 29918, 8899, 29918, 1037, 1061, 353, 4669, 9044, 9832, 1061, 29889, 2831, 3057, 580, 13, 1678, 3495, 29918, 1445, 29918, 5205, 29918, 18121, 353, 16956, 2283, 3924, 6980, 29898, 13, 4706, 1203, 29918, 8899, 29918, 1037, 1061, 29892, 13, 4706, 2322, 29918, 509, 2960, 29918, 8758, 29922, 1445, 29918, 5205, 29918, 271, 29918, 2813, 29892, 13, 4706, 5823, 29918, 1454, 29918, 1688, 29922, 3069, 29918, 1445, 29918, 5205, 29918, 27821, 29897, 13, 1678, 16876, 353, 2401, 29979, 8807, 10739, 29898, 3318, 29918, 8899, 29918, 1037, 1061, 29892, 3495, 29918, 1445, 29918, 5205, 29918, 18121, 29897, 13, 13, 1678, 822, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 29898, 3259, 1125, 13, 418, 1583, 29889, 9294, 5574, 29898, 20907, 29889, 3624, 3373, 1762, 2539, 29898, 3259, 511, 13, 462, 418, 14210, 29879, 338, 451, 701, 304, 2635, 29915, 1273, 1873, 29897, 13, 418, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 29892, 13, 462, 4706, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 29892, 1873, 29897, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29900, 29899, 29945, 29899, 29900, 8785, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29896, 29899, 29900, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29896, 29899, 29945, 29899, 29900, 1495, 13, 13, 1678, 396, 830, 4924, 29871, 29896, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29896, 29899, 29945, 29899, 29900, 1495, 13, 1678, 5615, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29900, 29899, 29945, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29900, 29899, 29900, 8785, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29896, 29899, 29945, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29906, 29899, 29945, 29899, 29900, 1495, 13, 13, 1678, 396, 830, 4924, 29871, 29906, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29918, 25162, 29918, 20907, 29889, 2272, 2396, 525, 20227, 263, 6494, 29915, 13, 1678, 5615, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29900, 29899, 29945, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29900, 29899, 29900, 8785, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29896, 29899, 29945, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29906, 29899, 29945, 29899, 29900, 1495, 13, 13, 1678, 396, 830, 4924, 29871, 29941, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29896, 29899, 29953, 29899, 29900, 1495, 13, 1678, 5615, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29900, 29899, 29945, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29900, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29941, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29945, 29899, 29900, 8785, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29906, 29899, 29945, 29899, 29900, 1495, 13, 13, 1678, 396, 830, 4924, 29871, 29946, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29896, 29899, 29947, 29899, 29900, 1495, 13, 1678, 5615, 13, 1678, 396, 830, 4924, 29871, 29945, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29906, 29899, 29900, 29899, 29900, 1495, 13, 1678, 5615, 13, 1678, 396, 830, 4924, 29871, 29953, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29906, 29899, 29906, 29899, 29900, 1495, 13, 1678, 5615, 13, 1678, 396, 830, 4924, 29871, 29955, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29906, 29899, 29946, 29899, 29900, 1495, 13, 1678, 5615, 13, 1678, 396, 830, 4924, 29871, 29947, 29889, 13, 1678, 3394, 29918, 5504, 3319, 13, 418, 525, 932, 29889, 25162, 2396, 903, 5631, 403, 2052, 29979, 8807, 877, 29906, 29899, 29953, 29899, 29900, 1495, 13, 1678, 5615, 13, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29900, 29899, 29945, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29900, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29941, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29945, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29945, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29896, 29899, 29947, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29953, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29900, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29953, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29896, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29955, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29906, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29955, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29941, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29947, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29946, 29899, 29900, 8785, 13, 1678, 1583, 29889, 9294, 9843, 29898, 29947, 29892, 16876, 29889, 2577, 6730, 1123, 4924, 25120, 1008, 1349, 273, 877, 29906, 29899, 29945, 29899, 29900, 8785, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29906, 29899, 29953, 29899, 29900, 1495, 13, 1678, 4974, 29918, 275, 29918, 786, 29918, 517, 29918, 1256, 877, 29906, 29899, 29955, 29899, 29900, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 443, 27958, 29889, 3396, 580, 13, 2 ]
moving_average_example.py
channolanp/QtScript
0
190399
import sys from QtScript import QtScript from PyQt5.QtWidgets import * from PyQt5.QtCore import Qt import moving_average_script if __name__ == '__main__': #First start off by starting the QApplication for PyQt5 app = QApplication(sys.argv) ''' Use the QtScript class as the application window There's a simple file selecting dialog widget that is added as the first widget when with_file is True ''' window = QtScript(with_file = True) #Set the script that will trigger when "Run Script" is clicked. #Note that this must have 1 arugment, as your config dict or throw away var window.SetScript(moving_average_script.main) #Here we build a bunch of UI elements and limit them however we like filter_window = QSpinBox() filter_window.setSingleStep(5) filter_window.setMinimum(0) filter_window.setMaximum(1000) filter_window.setValue(20) with_debounce = QCheckBox() debounce_trigger = QDoubleSpinBox() debounce_trigger.setSingleStep(0.5) debounce_trigger.setMinimum(0) debounce_trigger.setMaximum(100) debounce_trigger.setValue(1) debounce_window = QSpinBox() debounce_window.setSingleStep(5) debounce_window.setMinimum(0) debounce_window.setMaximum(500) debounce_window.setValue(50) ''' Here we start adding the above widgets to the QtScript widget Note that the first argument is the string name to be used for everything. This name is used for all the JSON stuff, as well as the config dict that is passed to your script ''' window.AddWidget('Filter Window', filter_window) window.AddWidget('Debounce Signal', with_debounce) window.AddWidget('Debounce Value', debounce_trigger) window.AddWidget('Debounce Window', debounce_window) ''' Show the widget, and lock us into the event loop ''' window.show() app.exec_()
[ 1, 1053, 10876, 13, 3166, 14705, 4081, 1053, 14705, 4081, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 14705, 13, 5215, 8401, 29918, 12483, 482, 29918, 2154, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 6730, 1369, 1283, 491, 6257, 278, 660, 4873, 363, 10772, 17303, 29945, 13, 1678, 623, 353, 660, 4873, 29898, 9675, 29889, 19218, 29897, 13, 13, 1678, 14550, 13, 1678, 4803, 278, 14705, 4081, 770, 408, 278, 2280, 3474, 13, 1678, 1670, 29915, 29879, 263, 2560, 934, 18851, 7928, 11109, 393, 338, 2715, 408, 278, 937, 13, 1678, 11109, 746, 411, 29918, 1445, 338, 5852, 13, 1678, 14550, 13, 1678, 3474, 353, 14705, 4081, 29898, 2541, 29918, 1445, 353, 5852, 29897, 13, 13, 1678, 396, 2697, 278, 2471, 393, 674, 7135, 746, 376, 6558, 14415, 29908, 338, 11484, 29889, 13, 1678, 396, 9842, 393, 445, 1818, 505, 29871, 29896, 564, 688, 358, 29892, 408, 596, 2295, 9657, 470, 3183, 3448, 722, 13, 1678, 3474, 29889, 2697, 4081, 29898, 13529, 292, 29918, 12483, 482, 29918, 2154, 29889, 3396, 29897, 13, 13, 1678, 396, 10605, 591, 2048, 263, 14928, 310, 3740, 3161, 322, 4046, 963, 3138, 591, 763, 13, 1678, 4175, 29918, 7165, 353, 660, 5592, 262, 3313, 580, 13, 1678, 4175, 29918, 7165, 29889, 842, 15771, 14448, 29898, 29945, 29897, 13, 1678, 4175, 29918, 7165, 29889, 842, 8140, 12539, 29898, 29900, 29897, 13, 1678, 4175, 29918, 7165, 29889, 842, 7976, 12539, 29898, 29896, 29900, 29900, 29900, 29897, 13, 1678, 4175, 29918, 7165, 29889, 842, 1917, 29898, 29906, 29900, 29897, 13, 13, 1678, 411, 29918, 16529, 21543, 353, 660, 28360, 580, 13, 13, 1678, 2553, 21543, 29918, 21001, 353, 660, 11843, 5592, 262, 3313, 580, 13, 1678, 2553, 21543, 29918, 21001, 29889, 842, 15771, 14448, 29898, 29900, 29889, 29945, 29897, 13, 1678, 2553, 21543, 29918, 21001, 29889, 842, 8140, 12539, 29898, 29900, 29897, 13, 1678, 2553, 21543, 29918, 21001, 29889, 842, 7976, 12539, 29898, 29896, 29900, 29900, 29897, 13, 1678, 2553, 21543, 29918, 21001, 29889, 842, 1917, 29898, 29896, 29897, 13, 13, 1678, 2553, 21543, 29918, 7165, 353, 660, 5592, 262, 3313, 580, 13, 1678, 2553, 21543, 29918, 7165, 29889, 842, 15771, 14448, 29898, 29945, 29897, 13, 1678, 2553, 21543, 29918, 7165, 29889, 842, 8140, 12539, 29898, 29900, 29897, 13, 1678, 2553, 21543, 29918, 7165, 29889, 842, 7976, 12539, 29898, 29945, 29900, 29900, 29897, 13, 1678, 2553, 21543, 29918, 7165, 29889, 842, 1917, 29898, 29945, 29900, 29897, 13, 13, 1678, 14550, 13, 1678, 2266, 591, 1369, 4417, 278, 2038, 11109, 29879, 304, 278, 14705, 4081, 11109, 13, 1678, 3940, 393, 278, 937, 2980, 338, 278, 1347, 1024, 304, 367, 1304, 363, 4129, 29889, 13, 1678, 910, 1024, 338, 1304, 363, 599, 278, 4663, 6433, 29892, 408, 1532, 408, 278, 2295, 9657, 393, 13, 1678, 338, 4502, 304, 596, 2471, 13, 1678, 14550, 13, 1678, 3474, 29889, 2528, 8801, 877, 5072, 18379, 742, 4175, 29918, 7165, 29897, 13, 1678, 3474, 29889, 2528, 8801, 877, 10251, 21543, 9954, 284, 742, 411, 29918, 16529, 21543, 29897, 13, 1678, 3474, 29889, 2528, 8801, 877, 10251, 21543, 7865, 742, 2553, 21543, 29918, 21001, 29897, 13, 1678, 3474, 29889, 2528, 8801, 877, 10251, 21543, 18379, 742, 2553, 21543, 29918, 7165, 29897, 13, 13, 1678, 14550, 13, 1678, 7704, 278, 11109, 29892, 322, 7714, 502, 964, 278, 1741, 2425, 13, 1678, 14550, 13, 1678, 3474, 29889, 4294, 580, 13, 1678, 623, 29889, 4258, 29918, 580, 13, 2 ]
infrastructure/app.py
akozd/web-service
0
1606862
<gh_stars>0 #!/usr/bin/env python3 from aws_cdk import core from infrastructure.infrastructure_stack import InfrastructureStack app = core.App() InfrastructureStack(app, 'InfrastructureStack') app.synth()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 3166, 25879, 29918, 2252, 29895, 1053, 7136, 13, 13, 3166, 22035, 12425, 29889, 262, 14867, 12425, 29918, 1429, 1053, 512, 14867, 12425, 7264, 13, 13, 932, 353, 7136, 29889, 2052, 580, 13, 797, 14867, 12425, 7264, 29898, 932, 29892, 525, 797, 14867, 12425, 7264, 1495, 13, 932, 29889, 19274, 386, 580, 13, 2 ]
geojson_rewind/rewind.py
chris48s/geojson-rewind
15
34126
<gh_stars>10-100 import argparse import copy import json import logging import math import sys RADIUS = 6378137 def rewind(geojson, rfc7946=True): gj = copy.deepcopy(geojson) _check_crs(geojson) if isinstance(gj, str): return json.dumps(_rewind(json.loads(gj), rfc7946)) else: return _rewind(gj, rfc7946) def _check_crs(geojson): if ( "crs" in geojson and "properties" in geojson["crs"] and "name" in geojson["crs"]["properties"] and geojson["crs"]["properties"]["name"] != "urn:ogc:def:crs:OGC:1.3:CRS84" ): logging.warning( "Co-ordinates in the input data are assumed to be WGS84 with " "(lon, lat) ordering, as per RFC 7946. Input with co-ordinates " "using any other CRS may lead to unexpected results." ) def _rewind(gj, rfc7946): if gj["type"] == "FeatureCollection": gj["features"] = list(map(lambda obj: _rewind(obj, rfc7946), gj["features"])) return gj if gj["type"] == "GeometryCollection": gj["geometries"] = list( map(lambda obj: _rewind(obj, rfc7946), gj["geometries"]) ) return gj if gj["type"] == "Feature": gj["geometry"] = _rewind(gj["geometry"], rfc7946) if gj["type"] in ["Polygon", "MultiPolygon"]: return correct(gj, rfc7946) return gj def correct(feature, rfc7946): if feature["type"] == "Polygon": feature["coordinates"] = correctRings(feature["coordinates"], rfc7946) if feature["type"] == "MultiPolygon": feature["coordinates"] = list( map(lambda obj: correctRings(obj, rfc7946), feature["coordinates"]) ) return feature def correctRings(rings, rfc7946): # change from rfc7946: True/False to clockwise: True/False here # RFC 7946 ordering determines how we deal with an entire polygon # but at this point we are switching to deal with individual rings # (which in isolation are just clockwise or anti-clockwise) clockwise = not (bool(rfc7946)) rings[0] = wind(rings[0], clockwise) for i in range(1, len(rings)): rings[i] = wind(rings[i], not (clockwise)) return rings def wind(ring, clockwise): if is_clockwise(ring) == clockwise: return ring return ring[::-1] def is_clockwise(ring): return ringArea(ring) >= 0 def ringArea(coords): area = 0 coordsLength = len(coords) if coordsLength > 2: for i in range(0, coordsLength): if i == coordsLength - 2: lowerIndex = coordsLength - 2 middleIndex = coordsLength - 1 upperIndex = 0 elif i == coordsLength - 1: lowerIndex = coordsLength - 1 middleIndex = 0 upperIndex = 1 else: lowerIndex = i middleIndex = i + 1 upperIndex = i + 2 p1 = coords[lowerIndex] p2 = coords[middleIndex] p3 = coords[upperIndex] area = area + (rad(p3[0]) - rad(p1[0])) * math.sin(rad(p2[1])) area = area * RADIUS * RADIUS / 2 return area def rad(coord): return coord * math.pi / 180 def main(): parser = argparse.ArgumentParser( description="Enforce RFC 7946 ring winding order on a GeoJSON file" ) parser.add_argument( "file", nargs="?", help="Input file, if empty stdin is used", type=argparse.FileType("r"), default=sys.stdin, ) args = parser.parse_args() if args.file.isatty(): parser.print_help() return 0 sys.stdout.write(rewind(args.file.read())) return 0 if __name__ == "__main__": sys.exit(main())
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 1852, 5510, 13, 5215, 3509, 13, 5215, 4390, 13, 5215, 12183, 13, 5215, 5844, 13, 5215, 10876, 13, 13, 29934, 3035, 29902, 3308, 353, 29871, 29953, 29941, 29955, 29947, 29896, 29941, 29955, 13, 13, 13, 1753, 337, 14800, 29898, 24756, 3126, 29892, 364, 13801, 29955, 29929, 29946, 29953, 29922, 5574, 1125, 13, 1678, 330, 29926, 353, 3509, 29889, 24535, 8552, 29898, 24756, 3126, 29897, 13, 1678, 903, 3198, 29918, 29883, 2288, 29898, 24756, 3126, 29897, 13, 1678, 565, 338, 8758, 29898, 29887, 29926, 29892, 851, 1125, 13, 4706, 736, 4390, 29889, 29881, 17204, 7373, 3973, 513, 29898, 3126, 29889, 18132, 29898, 29887, 29926, 511, 364, 13801, 29955, 29929, 29946, 29953, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 903, 3973, 513, 29898, 29887, 29926, 29892, 364, 13801, 29955, 29929, 29946, 29953, 29897, 13, 13, 13, 1753, 903, 3198, 29918, 29883, 2288, 29898, 24756, 3126, 1125, 13, 1678, 565, 313, 13, 4706, 376, 29883, 2288, 29908, 297, 1737, 29877, 3126, 13, 4706, 322, 376, 11330, 29908, 297, 1737, 29877, 3126, 3366, 29883, 2288, 3108, 13, 4706, 322, 376, 978, 29908, 297, 1737, 29877, 3126, 3366, 29883, 2288, 3108, 3366, 11330, 3108, 13, 4706, 322, 1737, 29877, 3126, 3366, 29883, 2288, 3108, 3366, 11330, 3108, 3366, 978, 3108, 2804, 376, 595, 29901, 468, 29883, 29901, 1753, 29901, 29883, 2288, 29901, 29949, 8766, 29901, 29896, 29889, 29941, 29901, 11341, 29903, 29947, 29946, 29908, 13, 268, 1125, 13, 4706, 12183, 29889, 27392, 29898, 13, 9651, 376, 7967, 29899, 24266, 297, 278, 1881, 848, 526, 12023, 304, 367, 399, 10749, 29947, 29946, 411, 376, 13, 9651, 18227, 12957, 29892, 3405, 29897, 20520, 29892, 408, 639, 390, 8610, 29871, 29955, 29929, 29946, 29953, 29889, 10567, 411, 1302, 29899, 24266, 376, 13, 9651, 376, 4746, 738, 916, 315, 12445, 1122, 3275, 304, 15668, 2582, 1213, 13, 4706, 1723, 13, 13, 13, 1753, 903, 3973, 513, 29898, 29887, 29926, 29892, 364, 13801, 29955, 29929, 29946, 29953, 1125, 13, 1678, 565, 330, 29926, 3366, 1853, 3108, 1275, 376, 19132, 7196, 1115, 13, 4706, 330, 29926, 3366, 22100, 3108, 353, 1051, 29898, 1958, 29898, 2892, 5446, 29901, 903, 3973, 513, 29898, 5415, 29892, 364, 13801, 29955, 29929, 29946, 29953, 511, 330, 29926, 3366, 22100, 3108, 876, 13, 4706, 736, 330, 29926, 13, 1678, 565, 330, 29926, 3366, 1853, 3108, 1275, 376, 7999, 7843, 7196, 1115, 13, 4706, 330, 29926, 3366, 479, 3297, 2722, 3108, 353, 1051, 29898, 13, 9651, 2910, 29898, 2892, 5446, 29901, 903, 3973, 513, 29898, 5415, 29892, 364, 13801, 29955, 29929, 29946, 29953, 511, 330, 29926, 3366, 479, 3297, 2722, 20068, 13, 4706, 1723, 13, 4706, 736, 330, 29926, 13, 1678, 565, 330, 29926, 3366, 1853, 3108, 1275, 376, 19132, 1115, 13, 4706, 330, 29926, 3366, 19156, 3108, 353, 903, 3973, 513, 29898, 29887, 29926, 3366, 19156, 12436, 364, 13801, 29955, 29929, 29946, 29953, 29897, 13, 1678, 565, 330, 29926, 3366, 1853, 3108, 297, 6796, 7713, 17125, 613, 376, 15329, 7713, 17125, 3108, 29901, 13, 4706, 736, 1959, 29898, 29887, 29926, 29892, 364, 13801, 29955, 29929, 29946, 29953, 29897, 13, 1678, 736, 330, 29926, 13, 13, 13, 1753, 1959, 29898, 14394, 29892, 364, 13801, 29955, 29929, 29946, 29953, 1125, 13, 1678, 565, 4682, 3366, 1853, 3108, 1275, 376, 7713, 17125, 1115, 13, 4706, 4682, 3366, 1111, 24266, 3108, 353, 1959, 29934, 886, 29898, 14394, 3366, 1111, 24266, 12436, 364, 13801, 29955, 29929, 29946, 29953, 29897, 13, 1678, 565, 4682, 3366, 1853, 3108, 1275, 376, 15329, 7713, 17125, 1115, 13, 4706, 4682, 3366, 1111, 24266, 3108, 353, 1051, 29898, 13, 9651, 2910, 29898, 2892, 5446, 29901, 1959, 29934, 886, 29898, 5415, 29892, 364, 13801, 29955, 29929, 29946, 29953, 511, 4682, 3366, 1111, 24266, 20068, 13, 4706, 1723, 13, 1678, 736, 4682, 13, 13, 13, 1753, 1959, 29934, 886, 29898, 29878, 886, 29892, 364, 13801, 29955, 29929, 29946, 29953, 1125, 13, 1678, 396, 1735, 515, 364, 13801, 29955, 29929, 29946, 29953, 29901, 5852, 29914, 8824, 304, 12006, 3538, 29901, 5852, 29914, 8824, 1244, 13, 1678, 396, 390, 8610, 29871, 29955, 29929, 29946, 29953, 20520, 3683, 1475, 920, 591, 5376, 411, 385, 4152, 29807, 13, 1678, 396, 541, 472, 445, 1298, 591, 526, 21293, 304, 5376, 411, 5375, 28774, 13, 1678, 396, 313, 4716, 297, 11695, 362, 526, 925, 12006, 3538, 470, 9418, 29899, 13058, 3538, 29897, 13, 1678, 12006, 3538, 353, 451, 313, 11227, 29898, 9600, 29883, 29955, 29929, 29946, 29953, 876, 13, 1678, 28774, 29961, 29900, 29962, 353, 8805, 29898, 29878, 886, 29961, 29900, 1402, 12006, 3538, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 7431, 29898, 29878, 886, 22164, 13, 4706, 28774, 29961, 29875, 29962, 353, 8805, 29898, 29878, 886, 29961, 29875, 1402, 451, 313, 13058, 3538, 876, 13, 1678, 736, 28774, 13, 13, 13, 1753, 8805, 29898, 5393, 29892, 12006, 3538, 1125, 13, 1678, 565, 338, 29918, 13058, 3538, 29898, 5393, 29897, 1275, 12006, 3538, 29901, 13, 4706, 736, 9228, 13, 1678, 736, 9228, 29961, 1057, 29899, 29896, 29962, 13, 13, 13, 1753, 338, 29918, 13058, 3538, 29898, 5393, 1125, 13, 1678, 736, 9228, 13799, 29898, 5393, 29897, 6736, 29871, 29900, 13, 13, 13, 1753, 9228, 13799, 29898, 1111, 4339, 1125, 13, 1678, 4038, 353, 29871, 29900, 13, 1678, 1302, 4339, 6513, 353, 7431, 29898, 1111, 4339, 29897, 13, 13, 1678, 565, 1302, 4339, 6513, 1405, 29871, 29906, 29901, 13, 4706, 363, 474, 297, 3464, 29898, 29900, 29892, 1302, 4339, 6513, 1125, 13, 9651, 565, 474, 1275, 1302, 4339, 6513, 448, 29871, 29906, 29901, 13, 18884, 5224, 3220, 353, 1302, 4339, 6513, 448, 29871, 29906, 13, 18884, 7256, 3220, 353, 1302, 4339, 6513, 448, 29871, 29896, 13, 18884, 7568, 3220, 353, 29871, 29900, 13, 9651, 25342, 474, 1275, 1302, 4339, 6513, 448, 29871, 29896, 29901, 13, 18884, 5224, 3220, 353, 1302, 4339, 6513, 448, 29871, 29896, 13, 18884, 7256, 3220, 353, 29871, 29900, 13, 18884, 7568, 3220, 353, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 5224, 3220, 353, 474, 13, 18884, 7256, 3220, 353, 474, 718, 29871, 29896, 13, 18884, 7568, 3220, 353, 474, 718, 29871, 29906, 13, 9651, 282, 29896, 353, 1302, 4339, 29961, 13609, 3220, 29962, 13, 9651, 282, 29906, 353, 1302, 4339, 29961, 17662, 3220, 29962, 13, 9651, 282, 29941, 353, 1302, 4339, 29961, 21064, 3220, 29962, 13, 9651, 4038, 353, 4038, 718, 313, 3665, 29898, 29886, 29941, 29961, 29900, 2314, 448, 2971, 29898, 29886, 29896, 29961, 29900, 12622, 334, 5844, 29889, 5223, 29898, 3665, 29898, 29886, 29906, 29961, 29896, 12622, 13, 13, 4706, 4038, 353, 4038, 334, 390, 3035, 29902, 3308, 334, 390, 3035, 29902, 3308, 847, 29871, 29906, 13, 13, 1678, 736, 4038, 13, 13, 13, 1753, 2971, 29898, 1111, 536, 1125, 13, 1678, 736, 29311, 334, 5844, 29889, 1631, 847, 29871, 29896, 29947, 29900, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 6139, 543, 2369, 10118, 390, 8610, 29871, 29955, 29929, 29946, 29953, 9228, 281, 4015, 1797, 373, 263, 1879, 29877, 7249, 934, 29908, 13, 1678, 1723, 13, 1678, 13812, 29889, 1202, 29918, 23516, 29898, 13, 4706, 376, 1445, 613, 13, 4706, 302, 5085, 543, 29973, 613, 13, 4706, 1371, 543, 4290, 934, 29892, 565, 4069, 3659, 262, 338, 1304, 613, 13, 4706, 1134, 29922, 1191, 5510, 29889, 2283, 1542, 703, 29878, 4968, 13, 4706, 2322, 29922, 9675, 29889, 4172, 262, 29892, 13, 1678, 1723, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 1445, 29889, 24766, 1017, 7295, 13, 4706, 13812, 29889, 2158, 29918, 8477, 580, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 3973, 513, 29898, 5085, 29889, 1445, 29889, 949, 22130, 13, 1678, 736, 29871, 29900, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 10876, 29889, 13322, 29898, 3396, 3101, 13, 2 ]
python/django/app/views.py
mattiapenati/web-frameworks
5,710
87665
from django.http import HttpResponse from django.views.decorators.csrf import csrf_exempt def index(request): return HttpResponse(status=200) def get_user(request, id): return HttpResponse(id) @csrf_exempt def create_user(request): return HttpResponse(status=200)
[ 1, 515, 9557, 29889, 1124, 1053, 9056, 5103, 13, 3166, 9557, 29889, 7406, 29889, 19557, 4097, 29889, 2395, 9600, 1053, 5939, 9600, 29918, 735, 3456, 13, 13, 13, 1753, 2380, 29898, 3827, 1125, 13, 1678, 736, 9056, 5103, 29898, 4882, 29922, 29906, 29900, 29900, 29897, 13, 13, 13, 1753, 679, 29918, 1792, 29898, 3827, 29892, 1178, 1125, 13, 1678, 736, 9056, 5103, 29898, 333, 29897, 13, 13, 13, 29992, 2395, 9600, 29918, 735, 3456, 13, 1753, 1653, 29918, 1792, 29898, 3827, 1125, 13, 1678, 736, 9056, 5103, 29898, 4882, 29922, 29906, 29900, 29900, 29897, 13, 2 ]
tests/btjanaka_test.py
btjanaka/btjanaka-pypi
1
107647
<gh_stars>1-10 """Tests for btjanaka.""" import btjanaka def test_calls(): """Try calling every method.""" for name, method in btjanaka.__dict__.items(): if not name.startswith("_") and callable(method): method() def test_counting(): """Test counting - copy this to README.""" nums = [ len(btjanaka.name()) - len(btjanaka.yell()), # 0 len(btjanaka.name()) // len(btjanaka.yell()), # 1 btjanaka.firstname().count("o") + len(btjanaka.name()[0]), # 2 btjanaka.lastname().count("a"), # 3 btjanaka.website().count("/") + btjanaka.website().count("n"), # 4 len(btjanaka.firstname()), # 5 btjanaka.name().count("n") * btjanaka.email().count("n"), # 6 len(btjanaka.lastname()), # 7 btjanaka.canadian().index("y")**len(btjanaka.chinese()), # 8 len(btjanaka.british()), # 9 len(btjanaka.email().replace(".", "").split("@")[1]), # 10 ] for i, n in enumerate(nums): assert i == n
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 24376, 363, 289, 29873, 8931, 8245, 1213, 15945, 13, 5215, 289, 29873, 8931, 8245, 13, 13, 13, 1753, 1243, 29918, 29883, 4293, 7295, 13, 1678, 9995, 15870, 5432, 1432, 1158, 1213, 15945, 13, 1678, 363, 1024, 29892, 1158, 297, 289, 29873, 8931, 8245, 17255, 8977, 26914, 7076, 7295, 13, 4706, 565, 451, 1024, 29889, 27382, 2541, 703, 29918, 1159, 322, 1246, 519, 29898, 5696, 1125, 13, 9651, 1158, 580, 13, 13, 13, 1753, 1243, 29918, 2798, 292, 7295, 13, 1678, 9995, 3057, 21248, 448, 3509, 445, 304, 5195, 3035, 2303, 1213, 15945, 13, 1678, 954, 29879, 353, 518, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 978, 3101, 448, 7431, 29898, 3116, 8931, 8245, 29889, 29891, 514, 25739, 29871, 396, 29871, 29900, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 978, 3101, 849, 7431, 29898, 3116, 8931, 8245, 29889, 29891, 514, 25739, 29871, 396, 29871, 29896, 13, 4706, 289, 29873, 8931, 8245, 29889, 4102, 978, 2141, 2798, 703, 29877, 1159, 718, 7431, 29898, 3116, 8931, 8245, 29889, 978, 580, 29961, 29900, 11724, 29871, 396, 29871, 29906, 13, 4706, 289, 29873, 8931, 8245, 29889, 4230, 978, 2141, 2798, 703, 29874, 4968, 29871, 396, 29871, 29941, 13, 4706, 289, 29873, 8931, 8245, 29889, 22942, 2141, 2798, 11974, 1159, 718, 289, 29873, 8931, 8245, 29889, 22942, 2141, 2798, 703, 29876, 4968, 29871, 396, 29871, 29946, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 4102, 978, 25739, 29871, 396, 29871, 29945, 13, 4706, 289, 29873, 8931, 8245, 29889, 978, 2141, 2798, 703, 29876, 1159, 334, 289, 29873, 8931, 8245, 29889, 5269, 2141, 2798, 703, 29876, 4968, 29871, 396, 29871, 29953, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 4230, 978, 25739, 29871, 396, 29871, 29955, 13, 4706, 289, 29873, 8931, 8245, 29889, 3068, 328, 713, 2141, 2248, 703, 29891, 1159, 1068, 2435, 29898, 3116, 8931, 8245, 29889, 305, 8233, 25739, 29871, 396, 29871, 29947, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 26549, 728, 25739, 29871, 396, 29871, 29929, 13, 4706, 7431, 29898, 3116, 8931, 8245, 29889, 5269, 2141, 6506, 17350, 613, 376, 2564, 5451, 29475, 1159, 29961, 29896, 11724, 29871, 396, 29871, 29896, 29900, 13, 1678, 4514, 13, 13, 1678, 363, 474, 29892, 302, 297, 26985, 29898, 1949, 29879, 1125, 13, 4706, 4974, 474, 1275, 302, 13, 2 ]
Udemy_PythonBootcamp/Sec15_WebScraping.py
gonzalosc2/LearningPython
0
11858
#################################### # author: <NAME> # course: 2020 Complete Python Bootcamps: From Zero to Hero in Python # purpose: lecture notes # description: Section 15 - Web Scraping # other: N/A #################################### # RULES # 1. always try to get permission before scraping, otherwise I might be blocked # 2. check the laws of whatever country we are operating in (for legal issues) # LIMITATIONS # each website is unique -> so for each website there must exist a Python script # an update to a website might brake my script import requests import bs4 # Grabbing a title result = requests.get("http://example.com") type(result) result.text # bs with lxml tranforms the previous raw html into the following soup = bs4.BeautifulSoup(result.text,'lxml') soup # returns the tag we specified as a list (i.e., there might be more than one) soup.select('title') soup.select('title')[0].getText() soup.select('p') site_paragraphs = soup.select('p') type(site_paragraphs[0]) # not a string, instead is a specialized bs object, # which is why we can do something like call .getText() # Grabbing a class (from CSS) using soup.select() # 'div' : all elements with 'div' tag # '#some_id' : elements containing id='some_id' # '.some_class' : elements containing class='some_class' # 'div span' : any element named span within a div element # 'div > span' : any element named span directly within a div element, with # nothing in between res = requests.get("https://en.wikipedia.org/wiki/Jonas_Salk") soup = bs4.BeautifulSoup(res.text,'lxml') soup.select('.toctext')[0].text soup.select('.toctext')[0].getText() for item in soup.select('.toctext'): print(item.text) # Grabbing an image #soup.select('img') # can return more than what is needeed (it will depend on # the website) soup.select('.thumbimage') jonas_salk = soup.select('.thumbimage')[0] jonas_salk['src'] # we can treat it as a dictionary image_link = requests.get('http://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Roosevelt_OConnor.jpg/220px-Roosevelt_OConnor.jpg') #image_link.content # raw content of the image which is a binary file #make sure to use the same format that the image has f = open('my_image_image.jpg','wb') # wb means write binary f.write(image_link.content) f.close() # Multiple elements across multiple pages # GOAL: get title of every book with a 2 star rating #Check that this also work with page 1 #http://books.toscrape.com/catalogue/page-2.html base_url = 'http://books.toscrape.com/catalogue/page-{}.html' req = requests.get(base_url.format(1)) soup = bs4.BeautifulSoup(req.text,'lxml') products = soup.select(".product_pod") # always check the length, in this case should be 20 example = products[0] # one way (not useful everytime) 'star-rating Two' in str(example) # another way (checking for the presence of a class) example.select('.star-rating.Three') # if there is a space in a class we should add a dot example.select('.star-rating.Two') # nothing example.select('a')[1]['title'] two_star_titles = [] for n in range(1,51): scrape_url = base_url.format(n) req = requests.get(base_url.format(1)) soup = bs4.BeautifulSoup(req.text,'lxml') books = soup.select(".product_pod") for book in books: if len(book.select('.star-rating.Two')) != 0: two_star_titles.append(book.select('a')[1]['title']) two_star_titles
[ 1, 835, 13383, 13383, 29937, 13, 29937, 4148, 29901, 529, 5813, 29958, 13, 29937, 3236, 29901, 29871, 29906, 29900, 29906, 29900, 25034, 5132, 13760, 11108, 567, 29901, 3645, 28933, 304, 22167, 297, 5132, 13, 29937, 6437, 29901, 29197, 11486, 13, 29937, 6139, 29901, 9779, 29871, 29896, 29945, 448, 2563, 2522, 2390, 292, 13, 29937, 916, 29901, 405, 29914, 29909, 13, 13383, 13383, 4136, 13, 13, 29937, 390, 29965, 17101, 13, 29937, 29871, 29896, 29889, 2337, 1018, 304, 679, 10751, 1434, 885, 2390, 292, 29892, 6467, 306, 1795, 367, 24370, 13, 29937, 29871, 29906, 29889, 1423, 278, 14243, 310, 6514, 4234, 591, 526, 13598, 297, 313, 1454, 11706, 5626, 29897, 13, 13, 29937, 27848, 8098, 29903, 13, 29937, 1269, 4700, 338, 5412, 1599, 577, 363, 1269, 4700, 727, 1818, 1863, 263, 5132, 2471, 13, 29937, 385, 2767, 304, 263, 4700, 1795, 4105, 446, 590, 2471, 13, 13, 5215, 7274, 13, 5215, 24512, 29946, 13, 13, 29937, 4989, 1327, 292, 263, 3611, 13, 2914, 353, 7274, 29889, 657, 703, 1124, 597, 4773, 29889, 510, 1159, 13, 13, 1853, 29898, 2914, 29897, 13, 2914, 29889, 726, 13, 13, 29937, 24512, 411, 301, 3134, 22024, 9514, 278, 3517, 10650, 3472, 964, 278, 1494, 13, 29879, 1132, 353, 24512, 29946, 29889, 3629, 1300, 6845, 29903, 1132, 29898, 2914, 29889, 726, 5501, 29880, 3134, 1495, 13, 29879, 1132, 13, 13, 29937, 3639, 278, 4055, 591, 6790, 408, 263, 1051, 313, 29875, 29889, 29872, 1696, 727, 1795, 367, 901, 1135, 697, 29897, 13, 29879, 1132, 29889, 2622, 877, 3257, 1495, 13, 29879, 1132, 29889, 2622, 877, 3257, 29861, 29900, 1822, 18516, 580, 13, 29879, 1132, 29889, 2622, 877, 29886, 1495, 13, 2746, 29918, 26956, 29879, 353, 22300, 29889, 2622, 877, 29886, 1495, 13, 1853, 29898, 2746, 29918, 26956, 29879, 29961, 29900, 2314, 29871, 396, 451, 263, 1347, 29892, 2012, 338, 263, 4266, 1891, 24512, 1203, 29892, 13, 462, 3986, 396, 607, 338, 2020, 591, 508, 437, 1554, 763, 1246, 869, 18516, 580, 13, 13, 29937, 4989, 1327, 292, 263, 770, 313, 3166, 6783, 29897, 773, 22300, 29889, 2622, 580, 13, 29937, 525, 4563, 29915, 308, 584, 599, 3161, 411, 525, 4563, 29915, 4055, 13, 29937, 16321, 5372, 29918, 333, 29915, 1678, 584, 3161, 6943, 1178, 2433, 5372, 29918, 333, 29915, 13, 29937, 15300, 5372, 29918, 1990, 29915, 584, 3161, 6943, 770, 2433, 5372, 29918, 1990, 29915, 13, 29937, 525, 4563, 10638, 29915, 1678, 584, 738, 1543, 4257, 10638, 2629, 263, 1933, 1543, 13, 29937, 525, 4563, 1405, 10638, 29915, 29871, 584, 738, 1543, 4257, 10638, 4153, 2629, 263, 1933, 1543, 29892, 411, 13, 29937, 462, 3078, 297, 1546, 13, 13, 690, 353, 7274, 29889, 657, 703, 991, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 29967, 27835, 29918, 29903, 2235, 1159, 13, 29879, 1132, 353, 24512, 29946, 29889, 3629, 1300, 6845, 29903, 1132, 29898, 690, 29889, 726, 5501, 29880, 3134, 1495, 13, 13, 29879, 1132, 29889, 2622, 12839, 517, 312, 1062, 29861, 29900, 1822, 726, 13, 29879, 1132, 29889, 2622, 12839, 517, 312, 1062, 29861, 29900, 1822, 18516, 580, 13, 13, 1454, 2944, 297, 22300, 29889, 2622, 12839, 517, 312, 1062, 29374, 13, 1678, 1596, 29898, 667, 29889, 726, 29897, 13, 13, 29937, 4989, 1327, 292, 385, 1967, 13, 29937, 29879, 1132, 29889, 2622, 877, 2492, 1495, 29871, 396, 508, 736, 901, 1135, 825, 338, 817, 12613, 313, 277, 674, 8839, 373, 13, 29937, 462, 418, 278, 4700, 29897, 13, 29879, 1132, 29889, 2622, 12839, 386, 3774, 3027, 1495, 13, 13022, 294, 29918, 29879, 2235, 353, 22300, 29889, 2622, 12839, 386, 3774, 3027, 29861, 29900, 29962, 13, 13022, 294, 29918, 29879, 2235, 1839, 4351, 2033, 29871, 396, 591, 508, 7539, 372, 408, 263, 8600, 13, 13, 3027, 29918, 2324, 353, 7274, 29889, 657, 877, 1124, 597, 9009, 29889, 2851, 3393, 29889, 990, 29914, 6011, 29914, 22382, 29914, 386, 3774, 29914, 29941, 29914, 29941, 29883, 29914, 9588, 852, 955, 29873, 29918, 29949, 1168, 15459, 29889, 6173, 29914, 29906, 29906, 29900, 1756, 29899, 9588, 852, 955, 29873, 29918, 29949, 1168, 15459, 29889, 6173, 1495, 13, 29937, 3027, 29918, 2324, 29889, 3051, 29871, 396, 10650, 2793, 310, 278, 1967, 607, 338, 263, 7581, 934, 13, 13, 29937, 5675, 1854, 304, 671, 278, 1021, 3402, 393, 278, 1967, 756, 13, 29888, 353, 1722, 877, 1357, 29918, 3027, 29918, 3027, 29889, 6173, 3788, 29893, 29890, 1495, 29871, 396, 281, 29890, 2794, 2436, 7581, 13, 29888, 29889, 3539, 29898, 3027, 29918, 2324, 29889, 3051, 29897, 13, 29888, 29889, 5358, 580, 13, 13, 29937, 26905, 3161, 4822, 2999, 6515, 13, 29937, 21947, 1964, 29901, 679, 3611, 310, 1432, 3143, 411, 263, 29871, 29906, 5810, 21700, 13, 13, 29937, 5596, 393, 445, 884, 664, 411, 1813, 29871, 29896, 13, 29937, 1124, 597, 12733, 29889, 29873, 14174, 336, 412, 29889, 510, 29914, 28045, 434, 29914, 3488, 29899, 29906, 29889, 1420, 13, 13, 3188, 29918, 2271, 353, 525, 1124, 597, 12733, 29889, 29873, 14174, 336, 412, 29889, 510, 29914, 28045, 434, 29914, 3488, 29899, 29912, 1836, 1420, 29915, 13, 13, 7971, 353, 7274, 29889, 657, 29898, 3188, 29918, 2271, 29889, 4830, 29898, 29896, 876, 13, 13, 29879, 1132, 353, 24512, 29946, 29889, 3629, 1300, 6845, 29903, 1132, 29898, 7971, 29889, 726, 5501, 29880, 3134, 1495, 13, 13, 14456, 353, 22300, 29889, 2622, 17350, 4704, 29918, 15334, 1159, 29871, 396, 2337, 1423, 278, 3309, 29892, 297, 445, 1206, 881, 367, 29871, 29906, 29900, 13, 13, 4773, 353, 9316, 29961, 29900, 29962, 13, 13, 29937, 697, 982, 313, 1333, 5407, 1432, 2230, 29897, 13, 29915, 8508, 29899, 29741, 7803, 29915, 297, 851, 29898, 4773, 29897, 13, 13, 29937, 1790, 982, 313, 3198, 292, 363, 278, 10122, 310, 263, 770, 29897, 13, 4773, 29889, 2622, 12839, 8508, 29899, 29741, 29889, 28575, 1495, 29871, 396, 565, 727, 338, 263, 2913, 297, 263, 770, 591, 881, 788, 263, 8329, 13, 4773, 29889, 2622, 12839, 8508, 29899, 29741, 29889, 13985, 1495, 29871, 396, 3078, 13, 4773, 29889, 2622, 877, 29874, 29861, 29896, 22322, 3257, 2033, 13, 13, 10184, 29918, 8508, 29918, 23545, 793, 353, 5159, 13, 13, 1454, 302, 297, 3464, 29898, 29896, 29892, 29945, 29896, 1125, 13, 13, 1678, 24559, 412, 29918, 2271, 353, 2967, 29918, 2271, 29889, 4830, 29898, 29876, 29897, 13, 1678, 12428, 353, 7274, 29889, 657, 29898, 3188, 29918, 2271, 29889, 4830, 29898, 29896, 876, 13, 1678, 22300, 353, 24512, 29946, 29889, 3629, 1300, 6845, 29903, 1132, 29898, 7971, 29889, 726, 5501, 29880, 3134, 1495, 13, 1678, 8277, 353, 22300, 29889, 2622, 17350, 4704, 29918, 15334, 1159, 13, 13, 1678, 363, 3143, 297, 8277, 29901, 13, 4706, 565, 7431, 29898, 2909, 29889, 2622, 12839, 8508, 29899, 29741, 29889, 13985, 8785, 2804, 29871, 29900, 29901, 13, 9651, 1023, 29918, 8508, 29918, 23545, 793, 29889, 4397, 29898, 2909, 29889, 2622, 877, 29874, 29861, 29896, 22322, 3257, 11287, 13, 13, 10184, 29918, 8508, 29918, 23545, 793, 13, 2 ]
01/01_g_swap_numbers.py
srinijadharani/DataStructuresLab
0
1617682
<reponame>srinijadharani/DataStructuresLab # 1g. Program to swap two numbers num1 = int(input("Enter the first number: ")) num2 = int(input("Enter the second number: ")) print("The numbers before swapping are - num1: {} and num2: {}." .format(num1, num2)) # logic for swapping two numbers num1, num2 = num2, num1 print("The numbers after swapping are - num1: {} and num2: {}." .format(num1, num2))
[ 1, 529, 276, 1112, 420, 29958, 29879, 17056, 823, 328, 8222, 3270, 29914, 1469, 19560, 1973, 28632, 13, 29937, 29871, 29896, 29887, 29889, 7835, 304, 17945, 1023, 3694, 30004, 13, 30004, 13, 1949, 29896, 353, 938, 29898, 2080, 703, 10399, 278, 937, 1353, 29901, 376, 876, 30004, 13, 1949, 29906, 353, 938, 29898, 2080, 703, 10399, 278, 1473, 1353, 29901, 376, 876, 30004, 13, 2158, 703, 1576, 3694, 1434, 2381, 20304, 526, 448, 954, 29896, 29901, 6571, 322, 954, 29906, 29901, 6571, 1213, 869, 4830, 29898, 1949, 29896, 29892, 954, 29906, 876, 30004, 13, 30004, 13, 29937, 5900, 363, 2381, 20304, 1023, 3694, 6756, 13, 1949, 29896, 29892, 954, 29906, 353, 954, 29906, 29892, 954, 29896, 30004, 13, 30004, 13, 2158, 703, 1576, 3694, 1156, 2381, 20304, 526, 448, 954, 29896, 29901, 6571, 322, 954, 29906, 29901, 6571, 1213, 869, 4830, 29898, 1949, 29896, 29892, 954, 29906, 876, 2 ]
seqtag/model.py
fedelopez77/seqtag
1
1603458
from torch import nn from seqtag.embedding_model import get_embedding_model class SequenceTaggingModel(nn.Module): def __init__(self, args): super().__init__() self.embedding_model = get_embedding_model(args.language_model) embed_size = self.embedding_model.config.hidden_size self.dropout = nn.Dropout(args.dropout) self.linear = nn.Linear(embed_size, args.num_labels) def forward(self, tokens, masks): """ :param tokens: tensor of b, seq_len :param masks: tensor of b, seq_len :return: logits: b, seq_len, num_labels """ embeddings = self.embedding_model(tokens, attention_mask=masks)[0] # b, seq_len, emb_size logits = self.linear(self.dropout(embeddings)) # b, seq_len, num_labels return logits
[ 1, 29871, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 3166, 19359, 4039, 29889, 17987, 8497, 29918, 4299, 1053, 679, 29918, 17987, 8497, 29918, 4299, 13, 13, 13, 1990, 922, 3910, 8176, 3460, 3195, 29898, 15755, 29889, 7355, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6389, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 17987, 8497, 29918, 4299, 353, 679, 29918, 17987, 8497, 29918, 4299, 29898, 5085, 29889, 11675, 29918, 4299, 29897, 13, 4706, 8297, 29918, 2311, 353, 1583, 29889, 17987, 8497, 29918, 4299, 29889, 2917, 29889, 10892, 29918, 2311, 13, 13, 4706, 1583, 29889, 8865, 449, 353, 302, 29876, 29889, 15063, 449, 29898, 5085, 29889, 8865, 449, 29897, 13, 4706, 1583, 29889, 10660, 353, 302, 29876, 29889, 12697, 29898, 17987, 29918, 2311, 29892, 6389, 29889, 1949, 29918, 21134, 29897, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 18897, 29892, 11105, 29879, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 18897, 29901, 12489, 310, 289, 29892, 19359, 29918, 2435, 13, 4706, 584, 3207, 11105, 29879, 29901, 12489, 310, 289, 29892, 19359, 29918, 2435, 13, 4706, 584, 2457, 29901, 1480, 1169, 29901, 289, 29892, 19359, 29918, 2435, 29892, 954, 29918, 21134, 13, 4706, 9995, 13, 4706, 8297, 29881, 886, 353, 1583, 29889, 17987, 8497, 29918, 4299, 29898, 517, 12360, 29892, 8570, 29918, 13168, 29922, 13168, 29879, 9601, 29900, 29962, 418, 396, 289, 29892, 19359, 29918, 2435, 29892, 7232, 29918, 2311, 13, 4706, 1480, 1169, 353, 1583, 29889, 10660, 29898, 1311, 29889, 8865, 449, 29898, 17987, 29881, 886, 876, 462, 3986, 396, 289, 29892, 19359, 29918, 2435, 29892, 954, 29918, 21134, 13, 4706, 736, 1480, 1169, 13, 2 ]
tests/logic/test_instruments.py
nilsholle/sampledb
5
1616913
<reponame>nilsholle/sampledb<gh_stars>1-10 # coding: utf-8 """ """ import pytest import sampledb from sampledb.models import User, UserType from sampledb.logic import instruments, errors def test_create_instrument(): assert len(instruments.get_instruments()) == 0 instrument = instruments.create_instrument() assert len(instruments.get_instruments()) == 1 assert instrument == instruments.get_instrument(instrument_id=instrument.id) assert len(instrument.responsible_users) == 0 def test_update_instrument(): instrument = instruments.create_instrument( description_is_markdown=False, users_can_create_log_entries=False, users_can_view_log_entries=False, notes_is_markdown=False, create_log_entry_default=False, is_hidden=False, short_description_is_markdown=False ) instruments.update_instrument( instrument_id=instrument.id, description_is_markdown=False, users_can_create_log_entries=True, users_can_view_log_entries=False, notes_is_markdown=False, create_log_entry_default=False, is_hidden=True, short_description_is_markdown=False ) instrument = instruments.get_instrument(instrument_id=instrument.id) assert instrument.description_is_markdown is False assert instrument.users_can_create_log_entries is True assert instrument.users_can_view_log_entries is False assert instrument.notes_is_markdown is False assert instrument.create_log_entry_default is False assert instrument.is_hidden is True assert instrument.short_description_is_markdown is False assert len(instrument.responsible_users) == 0 def test_instrument_responsible_users(): user = User(name="Testuser", email="<EMAIL>", type=UserType.PERSON) sampledb.db.session.add(user) sampledb.db.session.commit() instrument = instruments.create_instrument() assert len(instrument.responsible_users) == 0 instruments.add_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id) assert len(instrument.responsible_users) == 1 with pytest.raises(errors.UserAlreadyResponsibleForInstrumentError): instruments.add_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id) instruments.remove_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id) assert len(instrument.responsible_users) == 0 with pytest.raises(errors.UserNotResponsibleForInstrumentError): instruments.remove_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id) with pytest.raises(errors.InstrumentDoesNotExistError): instruments.add_instrument_responsible_user(instrument_id=instrument.id+1, user_id=user.id) with pytest.raises(errors.UserDoesNotExistError): instruments.add_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id+1) with pytest.raises(errors.InstrumentDoesNotExistError): instruments.remove_instrument_responsible_user(instrument_id=instrument.id+1, user_id=user.id) with pytest.raises(errors.UserDoesNotExistError): instruments.remove_instrument_responsible_user(instrument_id=instrument.id, user_id=user.id+1) def test_get_missing_instrument(): instrument = instruments.create_instrument() with pytest.raises(errors.InstrumentDoesNotExistError): instruments.get_instrument(instrument_id=instrument.id+1) def test_update_missing_instrument(): instrument = instruments.create_instrument() with pytest.raises(errors.InstrumentDoesNotExistError): instruments.update_instrument( instrument_id=instrument.id+1 ) def test_set_instrument_responsible_users(): user1 = User(name="Testuser", email="<EMAIL>", type=UserType.PERSON) user2 = User(name="Testuser", email="<EMAIL>", type=UserType.PERSON) sampledb.db.session.add(user1) sampledb.db.session.add(user2) sampledb.db.session.commit() instrument = instruments.create_instrument() assert len(instrument.responsible_users) == 0 instruments.set_instrument_responsible_users(instrument.id, [user1.id]) assert len(instrument.responsible_users) == 1 assert user1 in instrument.responsible_users instruments.set_instrument_responsible_users(instrument.id, [user2.id]) assert len(instrument.responsible_users) == 1 assert user2 in instrument.responsible_users instruments.set_instrument_responsible_users(instrument.id, [user1.id, user2.id]) assert len(instrument.responsible_users) == 2 assert user1 in instrument.responsible_users assert user2 in instrument.responsible_users instruments.set_instrument_responsible_users(instrument.id, []) assert len(instrument.responsible_users) == 0
[ 1, 529, 276, 1112, 420, 29958, 8834, 845, 324, 280, 29914, 11249, 2585, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 15945, 29908, 13, 13, 15945, 29908, 13, 13, 5215, 11451, 1688, 13, 5215, 4559, 2585, 13, 3166, 4559, 2585, 29889, 9794, 1053, 4911, 29892, 4911, 1542, 13, 3166, 4559, 2585, 29889, 19227, 1053, 23643, 29892, 4436, 13, 13, 13, 1753, 1243, 29918, 3258, 29918, 2611, 15461, 7295, 13, 1678, 4974, 7431, 29898, 2611, 582, 1860, 29889, 657, 29918, 2611, 582, 1860, 3101, 1275, 29871, 29900, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 580, 13, 1678, 4974, 7431, 29898, 2611, 582, 1860, 29889, 657, 29918, 2611, 582, 1860, 3101, 1275, 29871, 29896, 13, 1678, 4974, 11395, 1275, 23643, 29889, 657, 29918, 2611, 15461, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29897, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 13, 13, 1753, 1243, 29918, 5504, 29918, 2611, 15461, 7295, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 29898, 13, 4706, 6139, 29918, 275, 29918, 3502, 3204, 29922, 8824, 29892, 13, 4706, 4160, 29918, 3068, 29918, 3258, 29918, 1188, 29918, 26586, 29922, 8824, 29892, 13, 4706, 4160, 29918, 3068, 29918, 1493, 29918, 1188, 29918, 26586, 29922, 8824, 29892, 13, 4706, 11486, 29918, 275, 29918, 3502, 3204, 29922, 8824, 29892, 13, 4706, 1653, 29918, 1188, 29918, 8269, 29918, 4381, 29922, 8824, 29892, 13, 4706, 338, 29918, 10892, 29922, 8824, 29892, 13, 4706, 3273, 29918, 8216, 29918, 275, 29918, 3502, 3204, 29922, 8824, 13, 1678, 1723, 13, 1678, 23643, 29889, 5504, 29918, 2611, 15461, 29898, 13, 4706, 11395, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 13, 4706, 6139, 29918, 275, 29918, 3502, 3204, 29922, 8824, 29892, 13, 4706, 4160, 29918, 3068, 29918, 3258, 29918, 1188, 29918, 26586, 29922, 5574, 29892, 13, 4706, 4160, 29918, 3068, 29918, 1493, 29918, 1188, 29918, 26586, 29922, 8824, 29892, 13, 4706, 11486, 29918, 275, 29918, 3502, 3204, 29922, 8824, 29892, 13, 4706, 1653, 29918, 1188, 29918, 8269, 29918, 4381, 29922, 8824, 29892, 13, 4706, 338, 29918, 10892, 29922, 5574, 29892, 13, 4706, 3273, 29918, 8216, 29918, 275, 29918, 3502, 3204, 29922, 8824, 13, 1678, 1723, 13, 1678, 11395, 353, 23643, 29889, 657, 29918, 2611, 15461, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29897, 13, 1678, 4974, 11395, 29889, 8216, 29918, 275, 29918, 3502, 3204, 338, 7700, 13, 1678, 4974, 11395, 29889, 7193, 29918, 3068, 29918, 3258, 29918, 1188, 29918, 26586, 338, 5852, 13, 1678, 4974, 11395, 29889, 7193, 29918, 3068, 29918, 1493, 29918, 1188, 29918, 26586, 338, 7700, 13, 1678, 4974, 11395, 29889, 16953, 29918, 275, 29918, 3502, 3204, 338, 7700, 13, 1678, 4974, 11395, 29889, 3258, 29918, 1188, 29918, 8269, 29918, 4381, 338, 7700, 13, 1678, 4974, 11395, 29889, 275, 29918, 10892, 338, 5852, 13, 1678, 4974, 11395, 29889, 12759, 29918, 8216, 29918, 275, 29918, 3502, 3204, 338, 7700, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 13, 13, 1753, 1243, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 7295, 13, 1678, 1404, 353, 4911, 29898, 978, 543, 3057, 1792, 613, 4876, 543, 29966, 26862, 6227, 28341, 1134, 29922, 2659, 1542, 29889, 13171, 3094, 29897, 13, 1678, 4559, 2585, 29889, 2585, 29889, 7924, 29889, 1202, 29898, 1792, 29897, 13, 1678, 4559, 2585, 29889, 2585, 29889, 7924, 29889, 15060, 580, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 580, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 1678, 23643, 29889, 1202, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29896, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 2659, 2499, 2040, 1666, 29886, 787, 1821, 2831, 3379, 15461, 2392, 1125, 13, 4706, 23643, 29889, 1202, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 23643, 29889, 5992, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 2659, 3664, 1666, 29886, 787, 1821, 2831, 3379, 15461, 2392, 1125, 13, 4706, 23643, 29889, 5992, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 3379, 15461, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 1202, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29974, 29896, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 2659, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 1202, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29974, 29896, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 3379, 15461, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 5992, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29974, 29896, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29897, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 2659, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 5992, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 1792, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29892, 1404, 29918, 333, 29922, 1792, 29889, 333, 29974, 29896, 29897, 13, 13, 13, 1753, 1243, 29918, 657, 29918, 27259, 29918, 2611, 15461, 7295, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 3379, 15461, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 657, 29918, 2611, 15461, 29898, 2611, 15461, 29918, 333, 29922, 2611, 15461, 29889, 333, 29974, 29896, 29897, 13, 13, 13, 1753, 1243, 29918, 5504, 29918, 27259, 29918, 2611, 15461, 7295, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 12523, 29889, 3379, 15461, 25125, 3664, 1252, 391, 2392, 1125, 13, 4706, 23643, 29889, 5504, 29918, 2611, 15461, 29898, 13, 9651, 11395, 29918, 333, 29922, 2611, 15461, 29889, 333, 29974, 29896, 13, 4706, 1723, 13, 13, 13, 1753, 1243, 29918, 842, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 7295, 13, 1678, 1404, 29896, 353, 4911, 29898, 978, 543, 3057, 1792, 613, 4876, 543, 29966, 26862, 6227, 28341, 1134, 29922, 2659, 1542, 29889, 13171, 3094, 29897, 13, 1678, 1404, 29906, 353, 4911, 29898, 978, 543, 3057, 1792, 613, 4876, 543, 29966, 26862, 6227, 28341, 1134, 29922, 2659, 1542, 29889, 13171, 3094, 29897, 13, 1678, 4559, 2585, 29889, 2585, 29889, 7924, 29889, 1202, 29898, 1792, 29896, 29897, 13, 1678, 4559, 2585, 29889, 2585, 29889, 7924, 29889, 1202, 29898, 1792, 29906, 29897, 13, 1678, 4559, 2585, 29889, 2585, 29889, 7924, 29889, 15060, 580, 13, 1678, 11395, 353, 23643, 29889, 3258, 29918, 2611, 15461, 580, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 1678, 23643, 29889, 842, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 29898, 2611, 15461, 29889, 333, 29892, 518, 1792, 29896, 29889, 333, 2314, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29896, 13, 1678, 4974, 1404, 29896, 297, 11395, 29889, 26679, 1821, 29918, 7193, 13, 1678, 23643, 29889, 842, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 29898, 2611, 15461, 29889, 333, 29892, 518, 1792, 29906, 29889, 333, 2314, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29896, 13, 1678, 4974, 1404, 29906, 297, 11395, 29889, 26679, 1821, 29918, 7193, 13, 1678, 23643, 29889, 842, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 29898, 2611, 15461, 29889, 333, 29892, 518, 1792, 29896, 29889, 333, 29892, 1404, 29906, 29889, 333, 2314, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29906, 13, 1678, 4974, 1404, 29896, 297, 11395, 29889, 26679, 1821, 29918, 7193, 13, 1678, 4974, 1404, 29906, 297, 11395, 29889, 26679, 1821, 29918, 7193, 13, 1678, 23643, 29889, 842, 29918, 2611, 15461, 29918, 26679, 1821, 29918, 7193, 29898, 2611, 15461, 29889, 333, 29892, 518, 2314, 13, 1678, 4974, 7431, 29898, 2611, 15461, 29889, 26679, 1821, 29918, 7193, 29897, 1275, 29871, 29900, 13, 2 ]
appendix/introduction.to.programming.with.turtle/5-5-1.fill.curve.py
royqh1979/programming_with_python
5
151654
<reponame>royqh1979/programming_with_python from easygraphics.turtle import * def Fill(size, level): if level == 0: fd(size) return Fill(size / 3, level - 1) lt(90) Fill(size / 3, level - 1) for i in range(3): rt(90) Fill(size / 3, level - 1) for i in range(3): lt(90) Fill(size / 3, level - 1) rt(90) Fill(size / 3, level - 1) def main(): create_world(800, 600) set_speed(500) setxy(0, -200) Fill(400, 4); pause() close_world() easy_run(main)
[ 1, 529, 276, 1112, 420, 29958, 4727, 29939, 29882, 29896, 29929, 29955, 29929, 29914, 28426, 29918, 2541, 29918, 4691, 13, 3166, 4780, 6420, 29889, 29873, 4227, 280, 1053, 334, 13, 13, 13, 1753, 383, 453, 29898, 2311, 29892, 3233, 1125, 13, 1678, 565, 3233, 1275, 29871, 29900, 29901, 13, 4706, 285, 29881, 29898, 2311, 29897, 13, 4706, 736, 13, 1678, 383, 453, 29898, 2311, 847, 29871, 29941, 29892, 3233, 448, 29871, 29896, 29897, 13, 1678, 301, 29873, 29898, 29929, 29900, 29897, 13, 1678, 383, 453, 29898, 2311, 847, 29871, 29941, 29892, 3233, 448, 29871, 29896, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 4706, 364, 29873, 29898, 29929, 29900, 29897, 13, 4706, 383, 453, 29898, 2311, 847, 29871, 29941, 29892, 3233, 448, 29871, 29896, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 4706, 301, 29873, 29898, 29929, 29900, 29897, 13, 4706, 383, 453, 29898, 2311, 847, 29871, 29941, 29892, 3233, 448, 29871, 29896, 29897, 13, 1678, 364, 29873, 29898, 29929, 29900, 29897, 13, 1678, 383, 453, 29898, 2311, 847, 29871, 29941, 29892, 3233, 448, 29871, 29896, 29897, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 1653, 29918, 11526, 29898, 29947, 29900, 29900, 29892, 29871, 29953, 29900, 29900, 29897, 13, 1678, 731, 29918, 19322, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 731, 3594, 29898, 29900, 29892, 448, 29906, 29900, 29900, 29897, 13, 13, 1678, 383, 453, 29898, 29946, 29900, 29900, 29892, 29871, 29946, 416, 13, 13, 1678, 19957, 580, 13, 1678, 3802, 29918, 11526, 580, 13, 13, 29872, 8995, 29918, 3389, 29898, 3396, 29897, 2 ]
InterviewBit/Trees/min_depth_binary_tree.py
codervikash/online-courses
0
129075
<filename>InterviewBit/Trees/min_depth_binary_tree.py<gh_stars>0 """ Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node. NOTE : The path has to end on a leaf node. Example : 1 / 2 min depth = 2. """ # Definition for a binary tree node # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None import sys class Solution: # @param A : root node of tree # @return an integer def minDepth(self, A): if A is None: return 0 if A.left is None and A.right is None: return 1 if A.left is None: return self.minDepth(A.right) + 1 if A.right is None: return self.minDepth(A.left) + 1 ldepth = self.minDepth(A.left) rdepth = self.minDepth(A.right) return min(ldepth, rdepth) + 1
[ 1, 529, 9507, 29958, 4074, 1493, 21591, 29914, 29911, 11003, 29914, 1195, 29918, 19488, 29918, 19541, 29918, 8336, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 13, 29954, 5428, 263, 7581, 5447, 29892, 1284, 967, 9212, 10809, 29889, 13, 13, 1576, 9212, 10809, 338, 278, 1353, 310, 7573, 3412, 278, 3273, 342, 2224, 515, 278, 3876, 2943, 1623, 304, 278, 20471, 20447, 2943, 29889, 13, 13, 6058, 29923, 584, 450, 2224, 756, 304, 1095, 373, 263, 20447, 2943, 29889, 13, 14023, 584, 13, 13, 3986, 29896, 13, 4706, 847, 13, 4706, 29906, 13, 1195, 10809, 353, 29871, 29906, 29889, 13, 15945, 29908, 13, 13, 29937, 21940, 363, 263, 29871, 7581, 5447, 2943, 13, 29937, 770, 15472, 4247, 29901, 13, 29937, 268, 822, 4770, 2344, 12035, 1311, 29892, 921, 1125, 13, 29937, 308, 1583, 29889, 791, 353, 921, 13, 29937, 308, 1583, 29889, 1563, 353, 6213, 13, 29937, 308, 1583, 29889, 1266, 353, 6213, 13, 5215, 10876, 13, 13, 1990, 24380, 29901, 13, 1678, 396, 732, 3207, 319, 584, 3876, 2943, 310, 5447, 13, 1678, 396, 732, 2457, 385, 6043, 13, 1678, 822, 1375, 8498, 386, 29898, 1311, 29892, 319, 1125, 13, 4706, 565, 319, 338, 6213, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 565, 319, 29889, 1563, 338, 6213, 322, 319, 29889, 1266, 338, 6213, 29901, 13, 9651, 736, 29871, 29896, 13, 13, 4706, 565, 319, 29889, 1563, 338, 6213, 29901, 13, 9651, 736, 1583, 29889, 1195, 8498, 386, 29898, 29909, 29889, 1266, 29897, 718, 29871, 29896, 13, 4706, 565, 319, 29889, 1266, 338, 6213, 29901, 13, 9651, 736, 1583, 29889, 1195, 8498, 386, 29898, 29909, 29889, 1563, 29897, 718, 29871, 29896, 13, 13, 4706, 301, 19488, 353, 1583, 29889, 1195, 8498, 386, 29898, 29909, 29889, 1563, 29897, 13, 4706, 364, 19488, 353, 1583, 29889, 1195, 8498, 386, 29898, 29909, 29889, 1266, 29897, 13, 13, 4706, 736, 1375, 29898, 29880, 19488, 29892, 364, 19488, 29897, 718, 29871, 29896, 13, 2 ]
test-suite/generated-src/python/dh__set_interface_Conflict.py
ubook-editora/finn
3
193405
# AUTOGENERATED FILE - DO NOT MODIFY! # This file generated by Djinni from test.djinni from djinni.support import MultiSet # default imported in all files from djinni.exception import CPyException # default imported in all files from djinni.pycffi_marshal import CPyObject, CPyObjectProxy from Conflict import ConflictHelper from PyCFFIlib_cffi import ffi, lib from djinni import exception # this forces run of __init__.py which gives cpp option to call back into py to create exception class SetInterfaceConflictHelper: c_data_set = MultiSet() @staticmethod def check_c_data_set_empty(): assert len(SetInterfaceConflictHelper.c_data_set) == 0 Conflict.check_c_data_set_empty() @ffi.callback("size_t(struct DjinniObjectHandle *)") def __get_size(cself): return len(CPyObjectProxy.toPyObj(None, cself)) @ffi.callback("struct DjinniObjectHandle *()") def __python_create(): c_ptr = ffi.new_handle(SetInterfaceConflictProxy(set())) SetInterfaceConflictHelper.c_data_set.add(c_ptr) return ffi.cast("struct DjinniObjectHandle *", c_ptr) @ffi.callback("void(struct DjinniObjectHandle *, struct DjinniWrapperConflict *)") def __python_add(cself, el): CPyObjectProxy.toPyObj(None, cself).add(ConflictHelper.toPy(el)) @ffi.callback("void(struct DjinniObjectHandle * )") def __delete(c_ptr): assert c_ptr in SetInterfaceConflictHelper.c_data_set SetInterfaceConflictHelper.c_data_set.remove(c_ptr) @ffi.callback("struct DjinniWrapperConflict *(struct DjinniObjectHandle *)") def __python_next(cself): try: _ret = ConflictHelper.fromPy(next(CPyObjectProxy.toPyIter(cself))) assert _ret != ffi.NULL return _ret except Exception as _djinni_py_e: CPyException.setExceptionFromPy(_djinni_py_e) return ffi.NULL @staticmethod def _add_callbacks(): lib.set_interface_Conflict_add_callback___delete(SetInterfaceConflictHelper.__delete) lib.set_interface_Conflict_add_callback__get_size(SetInterfaceConflictHelper.__get_size) lib.set_interface_Conflict_add_callback__python_create(SetInterfaceConflictHelper.__python_create) lib.set_interface_Conflict_add_callback__python_add(SetInterfaceConflictHelper.__python_add) lib.set_interface_Conflict_add_callback__python_next(SetInterfaceConflictHelper.__python_next) SetInterfaceConflictHelper._add_callbacks() class SetInterfaceConflictProxy: def iter(d): for k in d: yield k def __init__(self, py_obj): self._py_obj = py_obj if py_obj is not None: self._py_iter = iter(py_obj) else: self._py_iter = None
[ 1, 396, 26524, 29949, 24647, 1001, 3040, 29928, 24080, 448, 11662, 6058, 16999, 4571, 29943, 29979, 29991, 13, 29937, 910, 934, 5759, 491, 27467, 262, 1240, 515, 1243, 29889, 19776, 262, 1240, 13, 13, 3166, 270, 28789, 1240, 29889, 5924, 1053, 14974, 2697, 396, 2322, 19673, 297, 599, 2066, 13, 3166, 270, 28789, 1240, 29889, 11739, 1053, 315, 19737, 2451, 396, 2322, 19673, 297, 599, 2066, 13, 3166, 270, 28789, 1240, 29889, 2272, 29883, 600, 29875, 29918, 3034, 23258, 1053, 315, 19737, 2061, 29892, 315, 19737, 2061, 14048, 13, 13, 3166, 10811, 29176, 1053, 10811, 29176, 10739, 13, 3166, 10772, 9207, 3738, 1982, 29918, 29883, 600, 29875, 1053, 285, 7241, 29892, 4303, 13, 13, 3166, 270, 28789, 1240, 1053, 3682, 396, 445, 8249, 1065, 310, 4770, 2344, 26914, 2272, 607, 4076, 274, 407, 2984, 304, 1246, 1250, 964, 11451, 304, 1653, 3682, 13, 13, 1990, 3789, 10448, 16376, 29176, 10739, 29901, 13, 1678, 274, 29918, 1272, 29918, 842, 353, 14974, 2697, 580, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1423, 29918, 29883, 29918, 1272, 29918, 842, 29918, 6310, 7295, 13, 4706, 4974, 7431, 29898, 2697, 10448, 16376, 29176, 10739, 29889, 29883, 29918, 1272, 29918, 842, 29897, 1275, 29871, 29900, 13, 4706, 10811, 29176, 29889, 3198, 29918, 29883, 29918, 1272, 29918, 842, 29918, 6310, 580, 13, 13, 1678, 732, 600, 29875, 29889, 14035, 703, 2311, 29918, 29873, 29898, 4984, 27467, 262, 1240, 2061, 13554, 4748, 1159, 13, 1678, 822, 4770, 657, 29918, 2311, 29898, 29883, 1311, 1125, 13, 4706, 736, 7431, 29898, 6271, 29891, 2061, 14048, 29889, 517, 19737, 9930, 29898, 8516, 29892, 274, 1311, 876, 13, 13, 1678, 732, 600, 29875, 29889, 14035, 703, 4984, 27467, 262, 1240, 2061, 13554, 334, 580, 1159, 13, 1678, 822, 4770, 4691, 29918, 3258, 7295, 13, 4706, 274, 29918, 7414, 353, 285, 7241, 29889, 1482, 29918, 8411, 29898, 2697, 10448, 16376, 29176, 14048, 29898, 842, 22130, 13, 4706, 3789, 10448, 16376, 29176, 10739, 29889, 29883, 29918, 1272, 29918, 842, 29889, 1202, 29898, 29883, 29918, 7414, 29897, 13, 4706, 736, 285, 7241, 29889, 4384, 703, 4984, 27467, 262, 1240, 2061, 13554, 334, 613, 274, 29918, 7414, 29897, 13, 13, 1678, 732, 600, 29875, 29889, 14035, 703, 5405, 29898, 4984, 27467, 262, 1240, 2061, 13554, 334, 29892, 2281, 27467, 262, 1240, 15646, 16376, 29176, 4748, 1159, 13, 1678, 822, 4770, 4691, 29918, 1202, 29898, 29883, 1311, 29892, 560, 1125, 13, 4706, 315, 19737, 2061, 14048, 29889, 517, 19737, 9930, 29898, 8516, 29892, 274, 1311, 467, 1202, 29898, 16376, 29176, 10739, 29889, 517, 19737, 29898, 295, 876, 13, 13, 1678, 732, 600, 29875, 29889, 14035, 703, 5405, 29898, 4984, 27467, 262, 1240, 2061, 13554, 334, 1723, 1159, 13, 1678, 822, 4770, 8143, 29898, 29883, 29918, 7414, 1125, 13, 4706, 4974, 274, 29918, 7414, 297, 3789, 10448, 16376, 29176, 10739, 29889, 29883, 29918, 1272, 29918, 842, 13, 4706, 3789, 10448, 16376, 29176, 10739, 29889, 29883, 29918, 1272, 29918, 842, 29889, 5992, 29898, 29883, 29918, 7414, 29897, 13, 13, 1678, 732, 600, 29875, 29889, 14035, 703, 4984, 27467, 262, 1240, 15646, 16376, 29176, 334, 29898, 4984, 27467, 262, 1240, 2061, 13554, 4748, 1159, 13, 1678, 822, 4770, 4691, 29918, 4622, 29898, 29883, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 903, 2267, 353, 10811, 29176, 10739, 29889, 3166, 19737, 29898, 4622, 29898, 6271, 29891, 2061, 14048, 29889, 517, 19737, 13463, 29898, 29883, 1311, 4961, 13, 9651, 4974, 903, 2267, 2804, 285, 7241, 29889, 10074, 13, 9651, 736, 903, 2267, 13, 4706, 5174, 8960, 408, 903, 19776, 262, 1240, 29918, 2272, 29918, 29872, 29901, 13, 9651, 315, 19737, 2451, 29889, 842, 2451, 4591, 19737, 7373, 19776, 262, 1240, 29918, 2272, 29918, 29872, 29897, 13, 9651, 736, 285, 7241, 29889, 10074, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 1202, 29918, 14035, 29879, 7295, 13, 4706, 4303, 29889, 842, 29918, 13248, 29918, 16376, 29176, 29918, 1202, 29918, 14035, 22359, 8143, 29898, 2697, 10448, 16376, 29176, 10739, 17255, 8143, 29897, 13, 4706, 4303, 29889, 842, 29918, 13248, 29918, 16376, 29176, 29918, 1202, 29918, 14035, 1649, 657, 29918, 2311, 29898, 2697, 10448, 16376, 29176, 10739, 17255, 657, 29918, 2311, 29897, 13, 4706, 4303, 29889, 842, 29918, 13248, 29918, 16376, 29176, 29918, 1202, 29918, 14035, 1649, 4691, 29918, 3258, 29898, 2697, 10448, 16376, 29176, 10739, 17255, 4691, 29918, 3258, 29897, 13, 4706, 4303, 29889, 842, 29918, 13248, 29918, 16376, 29176, 29918, 1202, 29918, 14035, 1649, 4691, 29918, 1202, 29898, 2697, 10448, 16376, 29176, 10739, 17255, 4691, 29918, 1202, 29897, 13, 4706, 4303, 29889, 842, 29918, 13248, 29918, 16376, 29176, 29918, 1202, 29918, 14035, 1649, 4691, 29918, 4622, 29898, 2697, 10448, 16376, 29176, 10739, 17255, 4691, 29918, 4622, 29897, 13, 13, 2697, 10448, 16376, 29176, 10739, 3032, 1202, 29918, 14035, 29879, 580, 13, 13, 1990, 3789, 10448, 16376, 29176, 14048, 29901, 13, 1678, 822, 4256, 29898, 29881, 1125, 13, 4706, 363, 413, 297, 270, 29901, 13, 9651, 7709, 413, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 11451, 29918, 5415, 1125, 13, 4706, 1583, 3032, 2272, 29918, 5415, 353, 11451, 29918, 5415, 13, 4706, 565, 11451, 29918, 5415, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 2272, 29918, 1524, 353, 4256, 29898, 2272, 29918, 5415, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 2272, 29918, 1524, 353, 6213, 13, 2 ]
scripts/deposit_test.py
shiqinfeng1/alphahomora-bsc
11
120778
from brownie import accounts, interface, Contract from brownie import (Bank, SimpleBankConfig, SimplePriceOracle, PancakeswapPool1Goblin, StrategyAllBNBOnly, StrategyLiquidate, StrategyWithdrawMinimizeTrading, StrategyAddTwoSidesOptimal, PancakeswapGoblinConfig, TripleSlopeModel, ConfigurableInterestBankConfig, ProxyAdminImpl, TransparentUpgradeableProxyImpl) from .utils import * import eth_abi def main(): admin = accounts[0] alice = accounts[1] triple_slope_model = TripleSlopeModel.deploy({'from': admin}) # min debt 0.2 BNB at 10 gwei gas price (killBps 5% -> at least 0.01BNB bonus) # reserve pool bps 1000 (10%) # kill bps 500 (5%) bank_config = ConfigurableInterestBankConfig.deploy( 2 * 10**17, 1000, 500, triple_slope_model, {'from': admin}) proxy_admin = ProxyAdminImpl.deploy({'from': admin}) bank_impl = Bank.deploy({'from': admin}) bank = TransparentUpgradeableProxyImpl.deploy( bank_impl, proxy_admin, bank_impl.initialize.encode_input(bank_config), {'from': admin}) bank = interface.IAny(bank) ################################################################### # deposit & withdraw deposit_amt = 10**18 prevBNBBal = alice.balance() prevIbBNBBal = bank.balanceOf(alice) bank.deposit({'from': alice, 'value': deposit_amt}) curBNBBal = alice.balance() curIbBNBBal = bank.balanceOf(alice) print('∆ bnb alice', curBNBBal - prevBNBBal) print('∆ ibBNB alice', curIbBNBBal - prevIbBNBBal) assert curBNBBal - prevBNBBal == -(curIbBNBBal - prevIbBNBBal), 'first depositor should get 1:1' assert curBNBBal - prevBNBBal == -deposit_amt # withdraw 1/3 prevBNBBal = alice.balance() prevIbBNBBal = bank.balanceOf(alice) bank.withdraw(curIbBNBBal // 3, {'from': alice}) curBNBBal = alice.balance() curIbBNBBal = bank.balanceOf(alice) print('∆ bnb alice', curBNBBal - prevBNBBal) print('∆ ibBNB alice', curIbBNBBal - prevIbBNBBal) assert curBNBBal - prevBNBBal == -(curIbBNBBal - prevIbBNBBal), 'first depositor should get 1:1' assert curBNBBal - prevBNBBal == deposit_amt // 3 # withdraw remaining prevBNBBal = alice.balance() prevIbBNBBal = bank.balanceOf(alice) bank.withdraw(curIbBNBBal, {'from': alice}) curBNBBal = alice.balance() curIbBNBBal = bank.balanceOf(alice) print('∆ bnb alice', curBNBBal - prevBNBBal) print('∆ ibBNB alice', curIbBNBBal - prevIbBNBBal) assert curBNBBal - prevBNBBal == -(curIbBNBBal - prevIbBNBBal), 'first depositor should get 1:1' assert curBNBBal - prevBNBBal == deposit_amt - deposit_amt // 3
[ 1, 515, 3347, 2786, 1053, 15303, 29892, 5067, 29892, 2866, 1461, 13, 3166, 3347, 2786, 1053, 313, 29933, 804, 29892, 12545, 29933, 804, 3991, 29892, 12545, 13026, 29949, 10792, 29892, 349, 4564, 6926, 29893, 481, 11426, 29896, 29954, 711, 1915, 29892, 13, 462, 268, 3767, 8963, 3596, 29933, 23189, 11730, 29892, 3767, 8963, 29931, 8105, 333, 403, 29892, 3767, 8963, 3047, 4012, 8140, 326, 675, 2308, 9382, 29892, 3767, 8963, 2528, 13985, 29903, 2247, 20624, 3039, 29892, 349, 4564, 6926, 29893, 481, 29954, 711, 1915, 3991, 29892, 8602, 552, 29903, 417, 412, 3195, 29892, 12782, 21115, 4074, 342, 29933, 804, 3991, 29892, 1019, 3594, 12754, 6647, 29892, 4103, 3560, 3373, 8228, 519, 14048, 6647, 29897, 13, 3166, 869, 13239, 1053, 334, 13, 5215, 11314, 29918, 19266, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 4113, 353, 15303, 29961, 29900, 29962, 13, 1678, 394, 625, 353, 15303, 29961, 29896, 29962, 13, 13, 1678, 21954, 29918, 29879, 417, 412, 29918, 4299, 353, 8602, 552, 29903, 417, 412, 3195, 29889, 16519, 3319, 29915, 3166, 2396, 4113, 1800, 13, 13, 1678, 396, 1375, 2553, 29873, 29871, 29900, 29889, 29906, 350, 23189, 472, 29871, 29896, 29900, 330, 26599, 10489, 8666, 313, 21174, 29933, 567, 29871, 29945, 29995, 1599, 472, 3203, 29871, 29900, 29889, 29900, 29896, 29933, 23189, 28920, 29897, 13, 1678, 396, 23986, 11565, 289, 567, 29871, 29896, 29900, 29900, 29900, 313, 29896, 29900, 10997, 13, 1678, 396, 12088, 289, 567, 29871, 29945, 29900, 29900, 313, 29945, 10997, 13, 1678, 9124, 29918, 2917, 353, 12782, 21115, 4074, 342, 29933, 804, 3991, 29889, 16519, 29898, 13, 308, 29906, 334, 29871, 29896, 29900, 1068, 29896, 29955, 29892, 29871, 29896, 29900, 29900, 29900, 29892, 29871, 29945, 29900, 29900, 29892, 21954, 29918, 29879, 417, 412, 29918, 4299, 29892, 11117, 3166, 2396, 4113, 1800, 13, 13, 1678, 10166, 29918, 6406, 353, 1019, 3594, 12754, 6647, 29889, 16519, 3319, 29915, 3166, 2396, 4113, 1800, 13, 1678, 9124, 29918, 13699, 353, 10253, 29889, 16519, 3319, 29915, 3166, 2396, 4113, 1800, 13, 1678, 9124, 353, 4103, 3560, 3373, 8228, 519, 14048, 6647, 29889, 16519, 29898, 13, 4706, 9124, 29918, 13699, 29892, 10166, 29918, 6406, 29892, 9124, 29918, 13699, 29889, 24926, 29889, 12508, 29918, 2080, 29898, 9157, 29918, 2917, 511, 11117, 3166, 2396, 4113, 1800, 13, 1678, 9124, 353, 5067, 29889, 10764, 1460, 29898, 9157, 29897, 13, 13, 1678, 835, 13383, 13383, 13383, 13383, 13, 1678, 396, 19754, 277, 669, 28679, 13, 13, 1678, 19754, 277, 29918, 8035, 353, 29871, 29896, 29900, 1068, 29896, 29947, 13, 13, 1678, 12379, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 12379, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 9124, 29889, 311, 1066, 277, 3319, 29915, 3166, 2396, 394, 625, 29892, 525, 1767, 2396, 19754, 277, 29918, 8035, 1800, 13, 13, 1678, 3151, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 3151, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 1596, 877, 31576, 289, 9877, 394, 625, 742, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 29897, 13, 1678, 1596, 877, 31576, 474, 29890, 29933, 23189, 394, 625, 742, 3151, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 29897, 13, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 19691, 2764, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 511, 525, 4102, 19754, 2105, 881, 679, 29871, 29896, 29901, 29896, 29915, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 448, 311, 1066, 277, 29918, 8035, 13, 13, 1678, 396, 28679, 29871, 29896, 29914, 29941, 13, 1678, 12379, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 12379, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 9124, 29889, 2541, 4012, 29898, 2764, 29902, 29890, 29933, 29940, 14388, 284, 849, 29871, 29941, 29892, 11117, 3166, 2396, 394, 625, 1800, 13, 13, 1678, 3151, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 3151, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 1596, 877, 31576, 289, 9877, 394, 625, 742, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 29897, 13, 1678, 1596, 877, 31576, 474, 29890, 29933, 23189, 394, 625, 742, 3151, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 29897, 13, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 19691, 2764, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 511, 525, 4102, 19754, 2105, 881, 679, 29871, 29896, 29901, 29896, 29915, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 19754, 277, 29918, 8035, 849, 29871, 29941, 13, 13, 1678, 396, 28679, 9886, 13, 1678, 12379, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 12379, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 9124, 29889, 2541, 4012, 29898, 2764, 29902, 29890, 29933, 29940, 14388, 284, 29892, 11117, 3166, 2396, 394, 625, 1800, 13, 13, 1678, 3151, 29933, 29940, 14388, 284, 353, 394, 625, 29889, 5521, 749, 580, 13, 1678, 3151, 29902, 29890, 29933, 29940, 14388, 284, 353, 9124, 29889, 5521, 749, 2776, 29898, 284, 625, 29897, 13, 13, 1678, 1596, 877, 31576, 289, 9877, 394, 625, 742, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 29897, 13, 1678, 1596, 877, 31576, 474, 29890, 29933, 23189, 394, 625, 742, 3151, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 29897, 13, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 19691, 2764, 29902, 29890, 29933, 29940, 14388, 284, 448, 12379, 29902, 29890, 29933, 29940, 14388, 284, 511, 525, 4102, 19754, 2105, 881, 679, 29871, 29896, 29901, 29896, 29915, 13, 1678, 4974, 3151, 29933, 29940, 14388, 284, 448, 12379, 29933, 29940, 14388, 284, 1275, 19754, 277, 29918, 8035, 448, 19754, 277, 29918, 8035, 849, 29871, 29941, 13, 2 ]
test/test_topology_handler.py
atlanticwave-sdx/datamodel
0
115119
<filename>test/test_topology_handler.py<gh_stars>0 import unittest import sdxdatamodel.parsing from sdxdatamodel.parsing.topologyhandler import TopologyHandler from sdxdatamodel.parsing.exceptions import DataModelException TOPOLOGY_AMLIGHT = './test/data/amlight.json' class TestTopologyHandler(unittest.TestCase): def setUp(self): self.handler = TopologyHandler(TOPOLOGY_AMLIGHT) # noqa: E501 self.handler.import_topology() def tearDown(self): pass def testImportTopology(self): try: print("Test Topology") print(self.handler.topology) except DataModelException as e: print(e) return False return True def testImportTopologyNodes(self): print("Test Nodes: at least one:") nodes=self.handler.topology.nodes if nodes==None or len(nodes)==0: print("Nodes are empty") return False print(nodes[0]) return True def testImportTopologyLinks(self): print("Test Links: at least one") links=self.handler.topology.links if links==None or len(links)==0: print("Links are empty") return False print(links[0]) return True if __name__ == '__main__': unittest.main()
[ 1, 529, 9507, 29958, 1688, 29914, 1688, 29918, 3332, 3002, 29918, 13789, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 443, 27958, 13, 13, 5215, 269, 8235, 4130, 314, 27224, 29889, 862, 2976, 13, 13, 3166, 269, 8235, 4130, 314, 27224, 29889, 862, 2976, 29889, 3332, 3002, 13789, 1053, 7488, 3002, 4598, 13, 3166, 269, 8235, 4130, 314, 27224, 29889, 862, 2976, 29889, 11739, 29879, 1053, 3630, 3195, 2451, 13, 13, 29911, 4590, 29949, 14480, 29979, 29918, 23956, 22530, 353, 19283, 1688, 29914, 1272, 29914, 314, 4366, 29889, 3126, 29915, 13, 13, 1990, 4321, 7031, 3002, 4598, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 13789, 353, 7488, 3002, 4598, 29898, 29911, 4590, 29949, 14480, 29979, 29918, 23956, 22530, 29897, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 1583, 29889, 13789, 29889, 5215, 29918, 3332, 3002, 580, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 1243, 17518, 7031, 3002, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 1596, 703, 3057, 7488, 3002, 1159, 13, 9651, 1596, 29898, 1311, 29889, 13789, 29889, 3332, 3002, 29897, 13, 4706, 5174, 3630, 3195, 2451, 408, 321, 29901, 13, 9651, 1596, 29898, 29872, 29897, 13, 9651, 736, 7700, 539, 13, 4706, 736, 5852, 13, 13, 1678, 822, 1243, 17518, 7031, 3002, 20284, 29898, 1311, 1125, 13, 4706, 1596, 703, 3057, 405, 2631, 29901, 472, 3203, 697, 29901, 1159, 13, 4706, 7573, 29922, 1311, 29889, 13789, 29889, 3332, 3002, 29889, 18010, 13, 4706, 565, 7573, 1360, 8516, 470, 7431, 29898, 18010, 29897, 1360, 29900, 29901, 13, 9651, 1596, 703, 20284, 526, 4069, 1159, 13, 9651, 736, 7700, 13, 4706, 1596, 29898, 18010, 29961, 29900, 2314, 259, 13, 4706, 736, 5852, 13, 13, 1678, 822, 1243, 17518, 7031, 3002, 6595, 29879, 29898, 1311, 1125, 13, 4706, 1596, 703, 3057, 6645, 29879, 29901, 472, 3203, 697, 1159, 13, 4706, 2988, 29922, 1311, 29889, 13789, 29889, 3332, 3002, 29889, 4965, 13, 4706, 565, 2988, 1360, 8516, 470, 7431, 29898, 4965, 29897, 1360, 29900, 29901, 13, 9651, 1596, 703, 6595, 29879, 526, 4069, 1159, 13, 9651, 736, 7700, 13, 4706, 1596, 29898, 4965, 29961, 29900, 2314, 259, 13, 4706, 736, 5852, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 2 ]
setup.py
lucgiffon/propol
0
179187
<filename>setup.py from setuptools import find_packages, setup setup( name='src', packages=find_packages(), version='0.1.0', description='Try to make projection of political parties or people in avector space in order to enable visualisation.', author='<NAME>', license='MIT', entry_points={ 'console_scripts': [ 'vizualize=src.visualization.visualize:run', ], }, )
[ 1, 529, 9507, 29958, 14669, 29889, 2272, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 29892, 6230, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 4351, 742, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 1873, 2433, 29900, 29889, 29896, 29889, 29900, 742, 13, 1678, 6139, 2433, 15870, 304, 1207, 18246, 310, 8604, 13973, 470, 2305, 297, 263, 8111, 2913, 297, 1797, 304, 9025, 7604, 4371, 29889, 742, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 1678, 19405, 2433, 26349, 742, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 525, 11058, 29918, 16713, 2396, 518, 13, 9651, 525, 29894, 466, 950, 675, 29922, 4351, 29889, 20119, 2133, 29889, 20119, 675, 29901, 3389, 742, 13, 4706, 21251, 13, 1678, 2981, 13, 29897, 13, 2 ]
MergeSortedLinkLists/MergeKsortedlinkedlists00.py
tnkteja/notthisagain
0
112387
<gh_stars>0 from heapq import heappushpop def solution(A):
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 16947, 29939, 1053, 540, 932, 1878, 7323, 13, 13, 1753, 1650, 29898, 29909, 1125, 2 ]
mt/mvae/models/ffnn_vae.py
macio232/mvae
53
84152
# Copyright 2019 <NAME>. # # 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 # # http://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. # ============================================================================== from typing import List import torch import torch.nn as nn from torch import Tensor from .vae import ModelVAE from ...data import VaeDataset from ..components import Component class FeedForwardVAE(ModelVAE): def __init__(self, h_dim: int, components: List[Component], dataset: VaeDataset, scalar_parametrization: bool) -> None: super().__init__(h_dim, components, dataset, scalar_parametrization) self.in_dim = dataset.in_dim # 1 hidden layer encoder self.fc_e0 = nn.Linear(dataset.in_dim, h_dim) # 1 hidden layer decoder self.fc_d0 = nn.Linear(self.total_z_dim, h_dim) self.fc_logits = nn.Linear(h_dim, dataset.in_dim) def encode(self, x: Tensor) -> Tensor: assert len(x.shape) == 2 bs, dim = x.shape assert dim == self.in_dim x = x.view(bs, self.in_dim) x = torch.relu(self.fc_e0(x)) return x.view(bs, -1) def decode(self, concat_z: Tensor) -> Tensor: assert len(concat_z.shape) >= 2 bs = concat_z.size(-2) x = torch.relu(self.fc_d0(concat_z)) x = self.fc_logits(x) x = x.view(-1, bs, self.in_dim) # flatten return x.squeeze(dim=0) # in case we're not doing LL estimation
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 529, 5813, 15513, 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, 1678, 1732, 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, 29937, 1275, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 3166, 19229, 1053, 2391, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 3166, 4842, 305, 1053, 323, 6073, 13, 13, 3166, 869, 1564, 29872, 1053, 8125, 29963, 16036, 13, 3166, 2023, 1272, 1053, 478, 3660, 16390, 24541, 13, 3166, 6317, 14036, 1053, 15924, 13, 13, 13, 1990, 5169, 287, 2831, 1328, 29963, 16036, 29898, 3195, 29963, 16036, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 298, 29918, 6229, 29901, 938, 29892, 7117, 29901, 2391, 29961, 5308, 1402, 8783, 29901, 478, 3660, 16390, 24541, 29892, 13, 462, 17336, 29918, 3207, 300, 7485, 362, 29901, 6120, 29897, 1599, 6213, 29901, 13, 4706, 2428, 2141, 1649, 2344, 12035, 29882, 29918, 6229, 29892, 7117, 29892, 8783, 29892, 17336, 29918, 3207, 300, 7485, 362, 29897, 13, 13, 4706, 1583, 29889, 262, 29918, 6229, 353, 8783, 29889, 262, 29918, 6229, 13, 13, 4706, 396, 29871, 29896, 7934, 7546, 2094, 6119, 13, 4706, 1583, 29889, 13801, 29918, 29872, 29900, 353, 302, 29876, 29889, 12697, 29898, 24713, 29889, 262, 29918, 6229, 29892, 298, 29918, 6229, 29897, 13, 13, 4706, 396, 29871, 29896, 7934, 7546, 1602, 6119, 13, 4706, 1583, 29889, 13801, 29918, 29881, 29900, 353, 302, 29876, 29889, 12697, 29898, 1311, 29889, 7827, 29918, 29920, 29918, 6229, 29892, 298, 29918, 6229, 29897, 13, 4706, 1583, 29889, 13801, 29918, 1188, 1169, 353, 302, 29876, 29889, 12697, 29898, 29882, 29918, 6229, 29892, 8783, 29889, 262, 29918, 6229, 29897, 13, 13, 1678, 822, 19750, 29898, 1311, 29892, 921, 29901, 323, 6073, 29897, 1599, 323, 6073, 29901, 13, 4706, 4974, 7431, 29898, 29916, 29889, 12181, 29897, 1275, 29871, 29906, 13, 4706, 24512, 29892, 3964, 353, 921, 29889, 12181, 13, 4706, 4974, 3964, 1275, 1583, 29889, 262, 29918, 6229, 13, 4706, 921, 353, 921, 29889, 1493, 29898, 5824, 29892, 1583, 29889, 262, 29918, 6229, 29897, 13, 13, 4706, 921, 353, 4842, 305, 29889, 2674, 29884, 29898, 1311, 29889, 13801, 29918, 29872, 29900, 29898, 29916, 876, 13, 13, 4706, 736, 921, 29889, 1493, 29898, 5824, 29892, 448, 29896, 29897, 13, 13, 1678, 822, 21822, 29898, 1311, 29892, 3022, 271, 29918, 29920, 29901, 323, 6073, 29897, 1599, 323, 6073, 29901, 13, 4706, 4974, 7431, 29898, 17685, 29918, 29920, 29889, 12181, 29897, 6736, 29871, 29906, 13, 4706, 24512, 353, 3022, 271, 29918, 29920, 29889, 2311, 6278, 29906, 29897, 13, 13, 4706, 921, 353, 4842, 305, 29889, 2674, 29884, 29898, 1311, 29889, 13801, 29918, 29881, 29900, 29898, 17685, 29918, 29920, 876, 13, 4706, 921, 353, 1583, 29889, 13801, 29918, 1188, 1169, 29898, 29916, 29897, 13, 13, 4706, 921, 353, 921, 29889, 1493, 6278, 29896, 29892, 24512, 29892, 1583, 29889, 262, 29918, 6229, 29897, 29871, 396, 1652, 8606, 13, 4706, 736, 921, 29889, 29879, 802, 29872, 911, 29898, 6229, 29922, 29900, 29897, 29871, 396, 297, 1206, 591, 29915, 276, 451, 2599, 27624, 23248, 13, 2 ]
sample-viewer-api/src/api/elisa_parser.py
cvisb/cvisb_data
2
118224
from pyparsing import (CaselessKeyword, Optional, Forward, Regex, operatorPrecedence, opAssoc, ParserElement) from biothings.utils.common import is_str import re ParserElement.enablePackrat() and_ = CaselessKeyword("AND") or_ = CaselessKeyword("OR") not_ = CaselessKeyword("NOT") keyword = and_ | or_ | not_ expression = Forward() valid_word = Regex(r'\[\[.*?\]\]').setName("word") valid_word.setParseAction( lambda t : t[0].replace('\\\\',chr(127)).replace('\\','').replace(chr(127),'\\') ) term = Forward() word_expr = valid_word term << word_expr expression << operatorPrecedence(term, [ ((not_ | '!').setParseAction(lambda:"NOT"), 1, opAssoc.RIGHT), ((and_ | '&&').setParseAction(lambda:"AND"), 2, opAssoc.LEFT), (Optional(or_ | '||').setParseAction(lambda:"OR"), 2, opAssoc.LEFT), ]) def parseElisaString(elisa): def buildSubQuery(l): if isinstance(l, list) and len(l) == 1 and isinstance(l[0], list): return buildSubQuery(l[0]) if is_str(l) or (isinstance(l, list) and len(l) == 1 and is_str(l[0])): if is_str(l): _l = l else: _l = l[0] match = re.fullmatch(r'\[\[\s*(?P<clause>.*)\s*\]\]', _l) clause = _l if match: clause = match.groupdict()['clause'] return { "nested": { "path": "elisa", "query": { "query_string": { "query": clause } } } } # unary operator if isinstance(l[0], str) and l[0].lower() == 'not': # check unary operations return { "bool": { "must_not": [buildSubQuery(l[1])] } } if len(l) >= 3: # assume operations are never mixed in one stage... if l[1].lower() == 'and': return { "bool": { "must": [buildSubQuery(x) for x in l[::2]] } } elif l[1].lower() == 'or': return { "bool": { "should": [buildSubQuery(x) for x in l[::2]] } } return None parsed_expression = expression.parseString(elisa, parseAll=True) try: query = buildSubQuery(parsed_expression.asList()) except Exception: query = None #query = buildSubQuery(parsed_expression.asList()) if query: return {"query": query} else: return {"query": {"nested": {"path": "elisa", "query": {"query_string": {"query": elisa}}}}}
[ 1, 515, 11451, 862, 2976, 1053, 313, 29907, 294, 6393, 2558, 1742, 29892, 28379, 29892, 1152, 1328, 29892, 25326, 29892, 5455, 6572, 1133, 663, 29892, 1015, 7900, 542, 29892, 1459, 643, 2642, 29897, 13, 3166, 4768, 720, 886, 29889, 13239, 29889, 9435, 1053, 338, 29918, 710, 13, 5215, 337, 13, 13, 11726, 2642, 29889, 12007, 16638, 3605, 580, 13, 13, 392, 29918, 353, 6960, 6393, 2558, 1742, 703, 9468, 1159, 13, 272, 29918, 353, 6960, 6393, 2558, 1742, 703, 1955, 1159, 13, 1333, 29918, 353, 6960, 6393, 2558, 1742, 703, 12256, 1159, 13, 26766, 353, 322, 29918, 891, 470, 29918, 891, 451, 29918, 13, 13, 17471, 353, 1152, 1328, 580, 13, 13, 3084, 29918, 1742, 353, 25326, 29898, 29878, 12764, 7110, 29961, 5575, 29973, 29905, 10725, 29962, 2824, 842, 1170, 703, 1742, 1159, 13, 3084, 29918, 1742, 29889, 842, 12914, 4276, 29898, 13, 1678, 14013, 260, 584, 260, 29961, 29900, 1822, 6506, 877, 1966, 1966, 742, 22495, 29898, 29896, 29906, 29955, 8106, 6506, 877, 1966, 3788, 2824, 6506, 29898, 22495, 29898, 29896, 29906, 29955, 511, 29915, 1966, 1495, 13, 1678, 1723, 13, 13, 8489, 353, 1152, 1328, 580, 13, 13, 1742, 29918, 13338, 353, 29871, 2854, 29918, 1742, 13, 8489, 3532, 29871, 1734, 29918, 13338, 13, 268, 13, 17471, 3532, 5455, 6572, 1133, 663, 29898, 8489, 29892, 13, 1678, 518, 13, 1678, 5135, 1333, 29918, 891, 525, 29991, 2824, 842, 12914, 4276, 29898, 2892, 6160, 12256, 4968, 29871, 29896, 29892, 1015, 7900, 542, 29889, 22789, 3912, 511, 13, 1678, 5135, 392, 29918, 891, 525, 12774, 2824, 842, 12914, 4276, 29898, 2892, 6160, 9468, 4968, 29871, 29906, 29892, 1015, 7900, 542, 29889, 28024, 511, 13, 1678, 313, 27636, 29898, 272, 29918, 891, 525, 8876, 2824, 842, 12914, 4276, 29898, 2892, 6160, 1955, 4968, 29871, 29906, 29892, 1015, 7900, 542, 29889, 28024, 511, 13, 268, 2314, 13, 13, 1753, 6088, 6489, 8069, 1231, 29898, 295, 8069, 1125, 13, 1678, 822, 2048, 4035, 3010, 29898, 29880, 1125, 13, 4706, 565, 338, 8758, 29898, 29880, 29892, 1051, 29897, 322, 7431, 29898, 29880, 29897, 1275, 29871, 29896, 322, 338, 8758, 29898, 29880, 29961, 29900, 1402, 1051, 1125, 13, 9651, 736, 2048, 4035, 3010, 29898, 29880, 29961, 29900, 2314, 13, 13, 4706, 565, 338, 29918, 710, 29898, 29880, 29897, 470, 313, 275, 8758, 29898, 29880, 29892, 1051, 29897, 322, 7431, 29898, 29880, 29897, 1275, 29871, 29896, 322, 338, 29918, 710, 29898, 29880, 29961, 29900, 12622, 29901, 13, 9651, 565, 338, 29918, 710, 29898, 29880, 1125, 13, 18884, 903, 29880, 353, 301, 13, 9651, 1683, 29901, 13, 18884, 903, 29880, 353, 301, 29961, 29900, 29962, 13, 9651, 1993, 353, 337, 29889, 8159, 4352, 29898, 29878, 12764, 7110, 7110, 29879, 29930, 10780, 29925, 29966, 16398, 1509, 29958, 5575, 2144, 29879, 17710, 10725, 29962, 742, 903, 29880, 29897, 13, 9651, 11845, 353, 903, 29880, 13, 9651, 565, 1993, 29901, 13, 18884, 11845, 353, 1993, 29889, 2972, 8977, 580, 1839, 16398, 1509, 2033, 13, 9651, 736, 426, 13, 18884, 376, 27420, 1115, 426, 13, 462, 1678, 376, 2084, 1115, 376, 295, 8069, 613, 13, 462, 1678, 376, 1972, 1115, 426, 13, 462, 4706, 376, 1972, 29918, 1807, 1115, 426, 13, 462, 9651, 376, 1972, 1115, 11845, 13, 462, 308, 500, 13, 462, 1678, 500, 13, 1669, 500, 13, 9651, 500, 13, 308, 13, 4706, 396, 443, 653, 5455, 13, 4706, 565, 338, 8758, 29898, 29880, 29961, 29900, 1402, 851, 29897, 322, 301, 29961, 29900, 1822, 13609, 580, 1275, 525, 1333, 2396, 13, 9651, 396, 1423, 443, 653, 6931, 13, 9651, 736, 426, 13, 18884, 376, 11227, 1115, 426, 13, 462, 1678, 376, 21969, 29918, 1333, 1115, 518, 4282, 4035, 3010, 29898, 29880, 29961, 29896, 2314, 29962, 13, 18884, 500, 13, 9651, 500, 13, 4706, 565, 7431, 29898, 29880, 29897, 6736, 29871, 29941, 29901, 13, 9651, 396, 5251, 6931, 526, 2360, 12849, 297, 697, 7408, 856, 13, 9651, 565, 301, 29961, 29896, 1822, 13609, 580, 1275, 525, 392, 2396, 13, 18884, 736, 426, 13, 462, 1678, 376, 11227, 1115, 426, 13, 462, 4706, 376, 21969, 1115, 518, 4282, 4035, 3010, 29898, 29916, 29897, 363, 921, 297, 301, 29961, 1057, 29906, 5262, 13, 462, 1678, 500, 13, 18884, 500, 13, 9651, 25342, 301, 29961, 29896, 1822, 13609, 580, 1275, 525, 272, 2396, 13, 18884, 736, 426, 13, 462, 1678, 376, 11227, 1115, 426, 13, 462, 4706, 376, 9344, 1115, 518, 4282, 4035, 3010, 29898, 29916, 29897, 363, 921, 297, 301, 29961, 1057, 29906, 5262, 13, 462, 1678, 500, 13, 18884, 500, 13, 4706, 736, 6213, 13, 13, 1678, 21213, 29918, 17471, 353, 4603, 29889, 5510, 1231, 29898, 295, 8069, 29892, 6088, 3596, 29922, 5574, 29897, 13, 268, 13, 1678, 1018, 29901, 13, 4706, 2346, 353, 2048, 4035, 3010, 29898, 862, 8485, 29918, 17471, 29889, 294, 1293, 3101, 13, 1678, 5174, 8960, 29901, 13, 4706, 2346, 353, 6213, 13, 268, 13, 1678, 396, 1972, 353, 2048, 4035, 3010, 29898, 862, 8485, 29918, 17471, 29889, 294, 1293, 3101, 13, 268, 13, 1678, 565, 2346, 29901, 13, 4706, 736, 8853, 1972, 1115, 2346, 29913, 13, 1678, 1683, 29901, 13, 4706, 736, 8853, 1972, 1115, 8853, 27420, 1115, 8853, 2084, 1115, 376, 295, 8069, 613, 376, 1972, 1115, 8853, 1972, 29918, 1807, 1115, 8853, 1972, 1115, 560, 8069, 930, 12499, 13, 2 ]
lightconfig/lightconfig.py
daassh/LightConfig
2
32525
<reponame>daassh/LightConfig #!/usr/bin/env python # coding=utf-8 # get a easy way to edit config file """ >>> from lightconfig import LightConfig >>> cfg = LightConfig("config.ini") >>> cfg.section1.option1 = "value1" >>> print(cfg.section1.option1) value1 >>> "section1" in cfg True >>> "option1" in cfg.section1 True """ import os import codecs import locale try: from ConfigParser import RawConfigParser as ConfigParser except ImportError: from configparser import RawConfigParser as ConfigParser class ConfigParserOptionCaseSensitive(ConfigParser): """ add case sensitve to ConfigParser """ def __init__(self, defaults=None): ConfigParser.__init__(self, defaults) def optionxform(self, option_str): return option_str class LightConfig(object): def __init__(self, config_path, try_encoding={'utf-8', 'utf-8-sig', locale.getpreferredencoding().lower()}, try_convert_digit = False): self.__dict__['_config_path'] = config_path self.__dict__['_try_encoding'] = try_encoding if isinstance(try_encoding, (list, tuple, set)) else [try_encoding] self.__dict__['_try_convert_digit'] = try_convert_digit self.__dict__['_config'] = ConfigParserOptionCaseSensitive() if not os.path.exists(config_path): dir_path = os.path.dirname(os.path.abspath(config_path)) if not os.path.exists(dir_path): os.makedirs(dir_path) open(config_path, 'a').close() LightConfig._read(self) self.__dict__['_cached_stamp'] = LightConfig._stamp(self) def __str__(self): return str(LightConfig._as_dict(self)) def __repr__(self): return repr(LightConfig._as_dict(self)) def __iter__(self): return iter(LightConfig._as_dict(self).items()) def __getattribute__(self, item): if item in ('keys', '__dict__'): return super(LightConfig, self).__getattribute__(item) else: return LightConfig.__getattr__(self, item) def __getattr__(self, item): return LightConfig.Section(self, item, self.__dict__['_try_convert_digit']) __getitem__ = __getattr__ def __setattr__(self, name, value): try: value = dict(value) except: raise ValueError('"{}" is not dictable'.format(value)) else: LightConfig.__dict__['__delattr__'](self, name) section = LightConfig.Section(self, name, self.__dict__['_try_convert_digit']) for k, v in value.items(): LightConfig.Section.__setattr__(section, k, v) __setitem__ = __setattr__ def __delattr__(self, item): if item in self: self.__dict__['_config'].remove_section(item) LightConfig._save(self) __delitem__ = __delattr__ def __contains__(self, item): return self.__dict__['_config'].has_section(item) def _as_dict(self): res = {} for section in self.keys(): res[section] = self[section] return res def keys(self): return self.__dict__['_config'].sections() def _read(self): for encoding in self.__dict__['_try_encoding']: fp = codecs.open(self.__dict__['_config_path'], encoding=encoding) try: if 'read_file' in dir(self.__dict__['_config']): self.__dict__['_config'].read_file(fp) else: self.__dict__['_config'].readfp(fp) except: err = True else: err = False self.__dict__['_encoding'] = encoding break if err: raise UnicodeError("\"{}\" codec can't decode this config file".format(', '.join(self.__dict__['_try_encoding']))) def _save(self): self.__dict__['_config'].write(codecs.open(self.__dict__['_config_path'], "w", encoding=self.__dict__['_encoding'])) self.__dict__['_cached_stamp'] = LightConfig._stamp(self) def _stamp(self): return os.stat(self.__dict__['_config_path']).st_mtime class Section(object): def __init__(self, conf, section, try_convert_digit): self.__dict__['_section'] = section self.__dict__['_conf'] = conf self.__dict__['_try_convert_digit'] = try_convert_digit def __str__(self): return str(LightConfig.Section._as_dict(self)) def __repr__(self): return repr(LightConfig.Section._as_dict(self)) def __iter__(self): return iter(LightConfig.Section._as_dict(self).items()) def __getattribute__(self, item): if item in ('keys', '__dict__'): return super(LightConfig.Section, self).__getattribute__(item) else: return LightConfig.Section.__getattr__(self, item) def __getattr__(self, option): current_stamp = LightConfig._stamp(self.__dict__['_conf']) if current_stamp != self.__dict__['_conf'].__dict__['_cached_stamp']: LightConfig._read(self.__dict__['_conf']) self.__dict__['_conf'].__dict__['_cached_stamp'] = current_stamp value = self.__dict__['_conf'].__dict__['_config'].get(self.__dict__['_section'], option) if self.__dict__['_try_convert_digit']: try: value = eval(value) except: pass return value __getitem__ = __getattr__ def __setattr__(self, key, value): if not self.__dict__['_section'] in self.__dict__['_conf']: self.__dict__['_conf'].__dict__['_config'].add_section(self.__dict__['_section']) self.__dict__['_conf'].__dict__['_config'].set(self.__dict__['_section'], key, str(value)) LightConfig._save(self.__dict__['_conf']) __setitem__ = __setattr__ def __delattr__(self, item): if item in self: self.__dict__['_conf'].__dict__['_config'].remove_option(self.__dict__['_section'], item) LightConfig._save(self.__dict__['_conf']) __delitem__ = __delattr__ def __contains__(self, item): return self.__dict__['_conf'].__dict__['_config'].has_option(self.__dict__['_section'], item) def _as_dict(self): return dict(self.__dict__['_conf'].__dict__['_config'].items(self.__dict__['_section'])) def keys(self): return self.__dict__['_conf'].__dict__['_config'].options(self.__dict__['_section'])
[ 1, 529, 276, 1112, 420, 29958, 1388, 465, 29882, 29914, 20769, 3991, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 29937, 679, 263, 4780, 982, 304, 3863, 2295, 934, 13, 15945, 29908, 13, 6778, 29958, 515, 3578, 2917, 1053, 12790, 3991, 13, 6778, 29958, 274, 16434, 353, 12790, 3991, 703, 2917, 29889, 2172, 1159, 13, 6778, 29958, 274, 16434, 29889, 2042, 29896, 29889, 3385, 29896, 353, 376, 1767, 29896, 29908, 13, 6778, 29958, 1596, 29898, 16859, 29889, 2042, 29896, 29889, 3385, 29896, 29897, 13, 1767, 29896, 13, 6778, 29958, 376, 2042, 29896, 29908, 297, 274, 16434, 13, 5574, 13, 6778, 29958, 376, 3385, 29896, 29908, 297, 274, 16434, 29889, 2042, 29896, 13, 5574, 13, 15945, 29908, 13, 5215, 2897, 13, 5215, 775, 2395, 13, 5215, 15068, 13, 2202, 29901, 13, 1678, 515, 12782, 11726, 1053, 22038, 3991, 11726, 408, 12782, 11726, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 2295, 16680, 1053, 22038, 3991, 11726, 408, 12782, 11726, 13, 13, 13, 1990, 12782, 11726, 8375, 8259, 29903, 575, 3321, 29898, 3991, 11726, 1125, 13, 1678, 9995, 13, 1678, 788, 1206, 4771, 277, 345, 304, 12782, 11726, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 21274, 29922, 8516, 1125, 13, 4706, 12782, 11726, 17255, 2344, 12035, 1311, 29892, 21274, 29897, 13, 1678, 822, 2984, 29916, 689, 29898, 1311, 29892, 2984, 29918, 710, 1125, 13, 4706, 736, 2984, 29918, 710, 13, 13, 13, 1990, 12790, 3991, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 29918, 2084, 29892, 1018, 29918, 22331, 3790, 29915, 9420, 29899, 29947, 742, 525, 9420, 29899, 29947, 29899, 18816, 742, 15068, 29889, 657, 1457, 14373, 22331, 2141, 13609, 580, 1118, 1018, 29918, 13441, 29918, 26204, 353, 7700, 1125, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 29918, 2084, 2033, 353, 2295, 29918, 2084, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 22331, 2033, 353, 1018, 29918, 22331, 565, 338, 8758, 29898, 2202, 29918, 22331, 29892, 313, 1761, 29892, 18761, 29892, 731, 876, 1683, 518, 2202, 29918, 22331, 29962, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 13441, 29918, 26204, 2033, 353, 1018, 29918, 13441, 29918, 26204, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 2033, 353, 12782, 11726, 8375, 8259, 29903, 575, 3321, 580, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 2917, 29918, 2084, 1125, 13, 9651, 4516, 29918, 2084, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 2917, 29918, 2084, 876, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 3972, 29918, 2084, 1125, 13, 18884, 2897, 29889, 29885, 12535, 12935, 29898, 3972, 29918, 2084, 29897, 13, 9651, 1722, 29898, 2917, 29918, 2084, 29892, 525, 29874, 2824, 5358, 580, 13, 4706, 12790, 3991, 3032, 949, 29898, 1311, 29897, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 29883, 3791, 29918, 303, 1160, 2033, 353, 12790, 3991, 3032, 303, 1160, 29898, 1311, 29897, 13, 268, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 20769, 3991, 3032, 294, 29918, 8977, 29898, 1311, 876, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 2062, 29898, 20769, 3991, 3032, 294, 29918, 8977, 29898, 1311, 876, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 4256, 29898, 20769, 3991, 3032, 294, 29918, 8977, 29898, 1311, 467, 7076, 3101, 13, 13, 1678, 822, 4770, 657, 12715, 12035, 1311, 29892, 2944, 1125, 13, 4706, 565, 2944, 297, 6702, 8149, 742, 525, 1649, 8977, 1649, 29374, 13, 9651, 736, 2428, 29898, 20769, 3991, 29892, 1583, 467, 1649, 657, 12715, 12035, 667, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 12790, 3991, 17255, 657, 5552, 12035, 1311, 29892, 2944, 29897, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 2944, 1125, 13, 4706, 736, 12790, 3991, 29889, 13438, 29898, 1311, 29892, 2944, 29892, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 13441, 29918, 26204, 11287, 13, 13, 1678, 4770, 657, 667, 1649, 353, 4770, 657, 5552, 1649, 13, 13, 1678, 822, 4770, 842, 5552, 12035, 1311, 29892, 1024, 29892, 995, 1125, 13, 4706, 1018, 29901, 13, 9651, 995, 353, 9657, 29898, 1767, 29897, 13, 4706, 5174, 29901, 13, 9651, 12020, 7865, 2392, 877, 29908, 29912, 5038, 338, 451, 9657, 519, 4286, 4830, 29898, 1767, 876, 13, 4706, 1683, 29901, 13, 9651, 12790, 3991, 17255, 8977, 1649, 1839, 1649, 6144, 5552, 1649, 29915, 850, 1311, 29892, 1024, 29897, 13, 9651, 4004, 353, 12790, 3991, 29889, 13438, 29898, 1311, 29892, 1024, 29892, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 13441, 29918, 26204, 11287, 13, 9651, 363, 413, 29892, 325, 297, 995, 29889, 7076, 7295, 13, 18884, 12790, 3991, 29889, 13438, 17255, 842, 5552, 12035, 2042, 29892, 413, 29892, 325, 29897, 13, 13, 1678, 4770, 842, 667, 1649, 353, 4770, 842, 5552, 1649, 13, 13, 1678, 822, 4770, 6144, 5552, 12035, 1311, 29892, 2944, 1125, 13, 4706, 565, 2944, 297, 1583, 29901, 13, 9651, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 5992, 29918, 2042, 29898, 667, 29897, 13, 9651, 12790, 3991, 3032, 7620, 29898, 1311, 29897, 13, 268, 13, 1678, 4770, 6144, 667, 1649, 353, 4770, 6144, 5552, 1649, 13, 1678, 13, 1678, 822, 4770, 11516, 12035, 1311, 29892, 2944, 1125, 13, 4706, 736, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 5349, 29918, 2042, 29898, 667, 29897, 13, 308, 13, 1678, 822, 903, 294, 29918, 8977, 29898, 1311, 1125, 13, 4706, 620, 353, 6571, 13, 4706, 363, 4004, 297, 1583, 29889, 8149, 7295, 13, 9651, 620, 29961, 2042, 29962, 353, 1583, 29961, 2042, 29962, 13, 4706, 736, 620, 13, 13, 1678, 822, 6611, 29898, 1311, 1125, 13, 4706, 736, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 27117, 580, 13, 13, 1678, 822, 903, 949, 29898, 1311, 1125, 13, 4706, 363, 8025, 297, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 22331, 2033, 29901, 13, 9651, 285, 29886, 353, 775, 2395, 29889, 3150, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2917, 29918, 2084, 7464, 8025, 29922, 22331, 29897, 13, 9651, 1018, 29901, 13, 18884, 565, 525, 949, 29918, 1445, 29915, 297, 4516, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2917, 2033, 1125, 13, 462, 1678, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 949, 29918, 1445, 29898, 18091, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 949, 18091, 29898, 18091, 29897, 13, 9651, 5174, 29901, 13, 18884, 4589, 353, 5852, 13, 9651, 1683, 29901, 13, 18884, 4589, 353, 7700, 13, 18884, 1583, 17255, 8977, 1649, 1839, 29918, 22331, 2033, 353, 8025, 13, 18884, 2867, 13, 4706, 565, 4589, 29901, 13, 9651, 12020, 23862, 2392, 703, 5931, 29912, 1012, 29908, 775, 29883, 508, 29915, 29873, 21822, 445, 2295, 934, 1642, 4830, 29317, 15300, 7122, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 22331, 2033, 4961, 13, 308, 13, 1678, 822, 903, 7620, 29898, 1311, 1125, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 2917, 13359, 3539, 29898, 401, 2395, 29889, 3150, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2917, 29918, 2084, 7464, 376, 29893, 613, 8025, 29922, 1311, 17255, 8977, 1649, 1839, 29918, 22331, 25901, 13, 4706, 1583, 17255, 8977, 1649, 1839, 29918, 29883, 3791, 29918, 303, 1160, 2033, 353, 12790, 3991, 3032, 303, 1160, 29898, 1311, 29897, 13, 13, 1678, 822, 903, 303, 1160, 29898, 1311, 1125, 13, 4706, 736, 2897, 29889, 6112, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2917, 29918, 2084, 2033, 467, 303, 29918, 29885, 2230, 13, 308, 13, 1678, 770, 9779, 29898, 3318, 1125, 13, 4706, 822, 4770, 2344, 12035, 1311, 29892, 1970, 29892, 4004, 29892, 1018, 29918, 13441, 29918, 26204, 1125, 13, 9651, 1583, 17255, 8977, 1649, 1839, 29918, 2042, 2033, 353, 4004, 13, 9651, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 2033, 353, 1970, 13, 9651, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 13441, 29918, 26204, 2033, 353, 1018, 29918, 13441, 29918, 26204, 13, 13, 4706, 822, 4770, 710, 12035, 1311, 1125, 13, 9651, 736, 851, 29898, 20769, 3991, 29889, 13438, 3032, 294, 29918, 8977, 29898, 1311, 876, 13, 13, 4706, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 9651, 736, 2062, 29898, 20769, 3991, 29889, 13438, 3032, 294, 29918, 8977, 29898, 1311, 876, 13, 308, 13, 4706, 822, 4770, 1524, 12035, 1311, 1125, 13, 9651, 736, 4256, 29898, 20769, 3991, 29889, 13438, 3032, 294, 29918, 8977, 29898, 1311, 467, 7076, 3101, 13, 13, 4706, 822, 4770, 657, 12715, 12035, 1311, 29892, 2944, 1125, 13, 9651, 565, 2944, 297, 6702, 8149, 742, 525, 1649, 8977, 1649, 29374, 13, 18884, 736, 2428, 29898, 20769, 3991, 29889, 13438, 29892, 1583, 467, 1649, 657, 12715, 12035, 667, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 12790, 3991, 29889, 13438, 17255, 657, 5552, 12035, 1311, 29892, 2944, 29897, 13, 13, 4706, 822, 4770, 657, 5552, 12035, 1311, 29892, 2984, 1125, 13, 9651, 1857, 29918, 303, 1160, 353, 12790, 3991, 3032, 303, 1160, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 5527, 11287, 13, 9651, 565, 1857, 29918, 303, 1160, 2804, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 29883, 3791, 29918, 303, 1160, 2033, 29901, 13, 18884, 12790, 3991, 3032, 949, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 5527, 11287, 13, 18884, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 29883, 3791, 29918, 303, 1160, 2033, 353, 1857, 29918, 303, 1160, 13, 9651, 995, 353, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 657, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 7464, 2984, 29897, 13, 9651, 565, 1583, 17255, 8977, 1649, 1839, 29918, 2202, 29918, 13441, 29918, 26204, 2033, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 995, 353, 19745, 29898, 1767, 29897, 13, 18884, 5174, 29901, 13, 462, 1678, 1209, 13, 9651, 736, 995, 13, 13, 4706, 4770, 657, 667, 1649, 353, 4770, 657, 5552, 1649, 13, 308, 13, 4706, 822, 4770, 842, 5552, 12035, 1311, 29892, 1820, 29892, 995, 1125, 13, 9651, 565, 451, 1583, 17255, 8977, 1649, 1839, 29918, 2042, 2033, 297, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 2033, 29901, 13, 18884, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 1202, 29918, 2042, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 11287, 13, 9651, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 842, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 7464, 1820, 29892, 851, 29898, 1767, 876, 13, 9651, 12790, 3991, 3032, 7620, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 5527, 11287, 13, 13, 4706, 4770, 842, 667, 1649, 353, 4770, 842, 5552, 1649, 13, 308, 13, 4706, 822, 4770, 6144, 5552, 12035, 1311, 29892, 2944, 1125, 13, 9651, 565, 2944, 297, 1583, 29901, 13, 18884, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 5992, 29918, 3385, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 7464, 2944, 29897, 13, 18884, 12790, 3991, 3032, 7620, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 5527, 11287, 13, 632, 13, 4706, 4770, 6144, 667, 1649, 353, 4770, 6144, 5552, 1649, 13, 462, 13, 4706, 822, 4770, 11516, 12035, 1311, 29892, 2944, 1125, 13, 9651, 736, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 5349, 29918, 3385, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 7464, 2944, 29897, 13, 632, 13, 4706, 822, 903, 294, 29918, 8977, 29898, 1311, 1125, 13, 9651, 736, 9657, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 7076, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 25901, 13, 632, 13, 4706, 822, 6611, 29898, 1311, 1125, 13, 9651, 736, 1583, 17255, 8977, 1649, 1839, 29918, 5527, 13359, 1649, 8977, 1649, 1839, 29918, 2917, 13359, 6768, 29898, 1311, 17255, 8977, 1649, 1839, 29918, 2042, 11287, 13, 2 ]
run.py
1008siang/Razer_UserAgent
0
102233
#%% from user_agents import parse user_agent = "Mozilla/5.0 (Linux; Android 10; SM-N960F Build/QP1A.190711.020; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/78.0.3904.62 XWEB/2889 MMWEBSDK/20210902 Mobile Safari/537.36 MMWEBID/1696 MicroMessenger/8.0.15.2001(0x28000F41) Process/to" ua = parse(user_agent) print(ua.browser) print(ua.os) # %% import csv from user_agents import parse reader = csv.reader(open('uaList.csv', 'r',encoding='UTF-8',errors='ignore')) writer = csv.writer(open('uaOutput.csv', 'w')) headers = next(reader) headers.append("Browser") headers.append("OperatingSystem") writer.writerow(headers) for row in reader: temp = parse(row[0]) row.append(str(temp.browser)) row.append(str(temp.os)) writer.writerow(row) # os = next(next(reader)) # os.append("OperatingSystem") # writer.writerow(os) # for row in reader: # temp = parse(row[0]) # row.append(str(temp.os)) # writer.writerows(row) # print(row) # %%
[ 1, 396, 7686, 30004, 13, 3166, 1404, 29918, 351, 1237, 1053, 6088, 30004, 13, 1792, 29918, 14748, 353, 376, 29924, 2112, 2911, 29914, 29945, 29889, 29900, 313, 24085, 29936, 5669, 29871, 29896, 29900, 29936, 13766, 29899, 29940, 29929, 29953, 29900, 29943, 8878, 29914, 29984, 29925, 29896, 29909, 29889, 29896, 29929, 29900, 29955, 29896, 29896, 29889, 29900, 29906, 29900, 29936, 281, 29894, 29897, 12113, 3609, 13117, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 313, 29968, 7020, 29892, 763, 1879, 27604, 29897, 10079, 29914, 29946, 29889, 29900, 10228, 29914, 29955, 29947, 29889, 29900, 29889, 29941, 29929, 29900, 29946, 29889, 29953, 29906, 1060, 8851, 29933, 29914, 29906, 29947, 29947, 29929, 28880, 8851, 29933, 26912, 29914, 29906, 29900, 29906, 29896, 29900, 29929, 29900, 29906, 21600, 24544, 29914, 29945, 29941, 29955, 29889, 29941, 29953, 28880, 8851, 29933, 1367, 29914, 29896, 29953, 29929, 29953, 20140, 29924, 9957, 914, 29914, 29947, 29889, 29900, 29889, 29896, 29945, 29889, 29906, 29900, 29900, 29896, 29898, 29900, 29916, 29906, 29947, 29900, 29900, 29900, 29943, 29946, 29896, 29897, 10554, 29914, 517, 19451, 13, 3357, 353, 6088, 29898, 1792, 29918, 14748, 8443, 13, 30004, 13, 2158, 29898, 3357, 29889, 15965, 8443, 13, 2158, 29898, 3357, 29889, 359, 8443, 13, 30004, 13, 30004, 13, 30004, 13, 29937, 17806, 30004, 13, 5215, 11799, 30004, 13, 3166, 1404, 29918, 351, 1237, 1053, 6088, 30004, 13, 16950, 353, 11799, 29889, 16950, 29898, 3150, 877, 3357, 1293, 29889, 7638, 742, 525, 29878, 742, 22331, 2433, 10496, 29899, 29947, 742, 12523, 2433, 17281, 8785, 30004, 13, 13236, 353, 11799, 29889, 13236, 29898, 3150, 877, 3357, 6466, 29889, 7638, 742, 525, 29893, 8785, 30004, 13, 30004, 13, 13662, 353, 2446, 29898, 16950, 8443, 13, 13662, 29889, 4397, 703, 21537, 1159, 30004, 13, 13662, 29889, 4397, 703, 7094, 1218, 3924, 1159, 30004, 13, 13236, 29889, 13236, 340, 29898, 13662, 8443, 13, 1454, 1948, 297, 9591, 29901, 30004, 13, 1678, 5694, 353, 6088, 29898, 798, 29961, 29900, 2314, 30004, 13, 1678, 1948, 29889, 4397, 29898, 710, 29898, 7382, 29889, 15965, 876, 30004, 13, 1678, 1948, 29889, 4397, 29898, 710, 29898, 7382, 29889, 359, 876, 30004, 13, 1678, 9227, 29889, 13236, 340, 29898, 798, 8443, 13, 30004, 13, 29937, 2897, 353, 2446, 29898, 4622, 29898, 16950, 876, 30004, 13, 29937, 2897, 29889, 4397, 703, 7094, 1218, 3924, 1159, 30004, 13, 29937, 9227, 29889, 13236, 340, 29898, 359, 8443, 13, 29937, 363, 1948, 297, 9591, 29901, 30004, 13, 29937, 268, 5694, 353, 6088, 29898, 798, 29961, 29900, 2314, 30004, 13, 29937, 268, 1948, 29889, 4397, 29898, 710, 29898, 7382, 29889, 359, 876, 30004, 13, 29937, 268, 9227, 29889, 13236, 1242, 29898, 798, 8443, 13, 29937, 268, 1596, 29898, 798, 8443, 13, 396, 17806, 30004, 13, 2 ]
backend/utlis/crypt.py
shuttlesworthNEO/ClashHacks-methOD
0
125035
import numpy as np import pandas as pd import theano from keras.layers import Dense from keras.models import Model,load_model def crypto(x): encoder = load_model("/home/vasu/all_projects/Hackathons/ClashHacks-methOD/backend/utlis/encoder.h5") x = list(x) for ix in range(len(x)): x[ix] = int(x[ix], 16) y = np.array(tuple(x)) y = y.reshape(1,16) out = encoder.predict(y) out = out.reshape(32,1) cryto = [] for ix in range(out.shape[0]): if ix%2==1: cryto.append(str(int(out[ix]))) else: cryto.append(str(y[0][ix/2])) crypt_str = "" for ix in cryto: crypt_str += hex(int(ix)%16).split('x')[-1] print crypt_str return crypt_str
[ 1, 1053, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 278, 1562, 13, 3166, 13023, 294, 29889, 29277, 1053, 360, 1947, 13, 3166, 13023, 294, 29889, 9794, 1053, 8125, 29892, 1359, 29918, 4299, 13, 13, 1753, 274, 17929, 29898, 29916, 1125, 13, 12, 13, 12, 3977, 6119, 353, 2254, 29918, 4299, 11974, 5184, 29914, 4428, 29884, 29914, 497, 29918, 16418, 29914, 29950, 547, 493, 787, 29914, 6821, 1161, 29950, 26514, 29899, 29885, 621, 13668, 29914, 27852, 29914, 329, 23443, 29914, 3977, 6119, 29889, 29882, 29945, 1159, 13, 13, 12, 29916, 353, 1051, 29898, 29916, 29897, 13, 12, 13, 12, 1454, 474, 29916, 297, 3464, 29898, 2435, 29898, 29916, 22164, 13, 12, 12, 29916, 29961, 861, 29962, 353, 938, 29898, 29916, 29961, 861, 1402, 29871, 29896, 29953, 29897, 13, 13, 12, 29891, 353, 7442, 29889, 2378, 29898, 23583, 29898, 29916, 876, 13, 13, 12, 29891, 353, 343, 29889, 690, 14443, 29898, 29896, 29892, 29896, 29953, 29897, 13, 13, 12, 449, 353, 2094, 6119, 29889, 27711, 29898, 29891, 29897, 13, 12, 449, 353, 714, 29889, 690, 14443, 29898, 29941, 29906, 29892, 29896, 29897, 13, 13, 12, 29883, 719, 517, 353, 5159, 13, 13, 12, 1454, 474, 29916, 297, 3464, 29898, 449, 29889, 12181, 29961, 29900, 29962, 1125, 13, 12, 12, 361, 474, 29916, 29995, 29906, 1360, 29896, 29901, 13, 12, 12, 12, 29883, 719, 517, 29889, 4397, 29898, 710, 29898, 524, 29898, 449, 29961, 861, 29962, 4961, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 29883, 719, 517, 29889, 4397, 29898, 710, 29898, 29891, 29961, 29900, 3816, 861, 29914, 29906, 12622, 13, 13, 12, 29883, 4641, 29918, 710, 353, 5124, 13, 13, 12, 1454, 474, 29916, 297, 10901, 517, 29901, 13, 12, 12, 29883, 4641, 29918, 710, 4619, 15090, 29898, 524, 29898, 861, 29897, 29995, 29896, 29953, 467, 5451, 877, 29916, 1495, 14352, 29896, 29962, 13, 13, 12, 2158, 24941, 29918, 710, 13, 12, 2457, 24941, 29918, 710, 2 ]
Python_Exercise/py_exercise_twenty_five.py
kindyluv/My_Personal_Python_Exercises
0
101274
<reponame>kindyluv/My_Personal_Python_Exercises price = 1000000 good_credit = True high_income = True if good_credit and high_income: down_payment = 1.0 * price print(f"eligible for loan") else: down_payment = 2.0 * price print(f"ineligible for loan") print(f"down payment is {down_payment}")
[ 1, 529, 276, 1112, 420, 29958, 14380, 2904, 4090, 29914, 3421, 29918, 7435, 284, 29918, 11980, 29918, 1252, 261, 3476, 267, 13, 9175, 353, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 30004, 13, 16773, 29918, 11944, 277, 353, 5852, 30004, 13, 9812, 29918, 262, 2763, 353, 5852, 30004, 13, 361, 1781, 29918, 11944, 277, 322, 1880, 29918, 262, 2763, 29901, 30004, 13, 1678, 1623, 29918, 27825, 353, 29871, 29896, 29889, 29900, 334, 8666, 30004, 13, 1678, 1596, 29898, 29888, 29908, 295, 335, 1821, 363, 24806, 1159, 30004, 13, 2870, 29901, 30004, 13, 1678, 1623, 29918, 27825, 353, 29871, 29906, 29889, 29900, 334, 8666, 30004, 13, 1678, 1596, 29898, 29888, 29908, 262, 295, 335, 1821, 363, 24806, 1159, 30004, 13, 1678, 1596, 29898, 29888, 29908, 3204, 19179, 338, 426, 3204, 29918, 27825, 27195, 30004, 13, 2 ]
ch_14/tests/test_weather_threads.py
real-slim-chadi/Python-Object-Oriented-Programming---4th-edition
43
163635
<reponame>real-slim-chadi/Python-Object-Oriented-Programming---4th-edition """ Python 3 Object-Oriented Programming Chapter 14. Concurrency """ from pytest import * from unittest.mock import Mock, mock_open, call import weather_threads def test_station(): halifax = weather_threads.Station("NS", "s0000318") assert halifax.path == "/NS/s0000318_e.xml" assert halifax.url == "https://dd.weather.gc.ca/citypage_weather/xml/NS/s0000318_e.xml" @fixture def temp_getter(): return weather_threads.TempGetter("Halifax") @fixture def mock_urlopen(monkeypatch): urlopen = mock_open( read_data="""<?xml version='1.0'?><siteData><currentConditions><temperature unitType="metric" units="C">42</temperature></currentConditions></siteData>""" ) monkeypatch.setattr(weather_threads, 'urlopen', urlopen) return urlopen def test_temp_getter(temp_getter, mock_urlopen): temp_getter.run() assert temp_getter.temperature == "42" mock_urlopen.assert_called_once_with( 'https://dd.weather.gc.ca/citypage_weather/xml/NS/s0000318_e.xml' )
[ 1, 529, 276, 1112, 420, 29958, 6370, 29899, 2536, 326, 29899, 305, 10129, 29914, 11980, 29899, 2061, 29899, 15988, 14927, 29899, 9283, 4056, 5634, 29946, 386, 29899, 287, 654, 13, 15945, 29908, 13, 11980, 29871, 29941, 4669, 29899, 15988, 14927, 7835, 4056, 13, 13, 1451, 3314, 29871, 29896, 29946, 29889, 29871, 23924, 10880, 13, 15945, 29908, 13, 3166, 11451, 1688, 1053, 334, 13, 3166, 443, 27958, 29889, 17640, 1053, 26297, 29892, 11187, 29918, 3150, 29892, 1246, 13, 5215, 14826, 29918, 28993, 13, 13, 1753, 1243, 29918, 19569, 7295, 13, 1678, 8870, 361, 1165, 353, 14826, 29918, 28993, 29889, 22814, 703, 3059, 613, 376, 29879, 29900, 29900, 29900, 29900, 29941, 29896, 29947, 1159, 13, 1678, 4974, 8870, 361, 1165, 29889, 2084, 1275, 5591, 3059, 29914, 29879, 29900, 29900, 29900, 29900, 29941, 29896, 29947, 29918, 29872, 29889, 3134, 29908, 13, 1678, 4974, 8870, 361, 1165, 29889, 2271, 1275, 376, 991, 597, 1289, 29889, 705, 1624, 29889, 27354, 29889, 1113, 29914, 12690, 3488, 29918, 705, 1624, 29914, 3134, 29914, 3059, 29914, 29879, 29900, 29900, 29900, 29900, 29941, 29896, 29947, 29918, 29872, 29889, 3134, 29908, 13, 13, 29992, 7241, 15546, 13, 1753, 5694, 29918, 657, 357, 7295, 13, 1678, 736, 14826, 29918, 28993, 29889, 15637, 2577, 357, 703, 29950, 284, 361, 1165, 1159, 13, 13, 29992, 7241, 15546, 13, 1753, 11187, 29918, 332, 417, 2238, 29898, 3712, 446, 1478, 905, 1125, 13, 1678, 5065, 417, 2238, 353, 11187, 29918, 3150, 29898, 13, 4706, 1303, 29918, 1272, 13776, 29908, 8169, 3134, 1873, 2433, 29896, 29889, 29900, 29915, 29973, 5299, 2746, 1469, 5299, 3784, 10983, 2187, 5299, 12863, 1535, 5190, 1542, 543, 16414, 29908, 10340, 543, 29907, 1013, 29946, 29906, 829, 12863, 1535, 2565, 3784, 10983, 2187, 2565, 2746, 1469, 11903, 15945, 13, 1678, 1723, 13, 1678, 1601, 446, 1478, 905, 29889, 842, 5552, 29898, 705, 1624, 29918, 28993, 29892, 525, 332, 417, 2238, 742, 5065, 417, 2238, 29897, 13, 1678, 736, 5065, 417, 2238, 13, 13, 1753, 1243, 29918, 7382, 29918, 657, 357, 29898, 7382, 29918, 657, 357, 29892, 11187, 29918, 332, 417, 2238, 1125, 13, 1678, 5694, 29918, 657, 357, 29889, 3389, 580, 13, 1678, 4974, 5694, 29918, 657, 357, 29889, 12863, 1535, 1275, 376, 29946, 29906, 29908, 13, 1678, 11187, 29918, 332, 417, 2238, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 4706, 525, 991, 597, 1289, 29889, 705, 1624, 29889, 27354, 29889, 1113, 29914, 12690, 3488, 29918, 705, 1624, 29914, 3134, 29914, 3059, 29914, 29879, 29900, 29900, 29900, 29900, 29941, 29896, 29947, 29918, 29872, 29889, 3134, 29915, 13, 1678, 1723, 13, 2 ]
src/cogs/core/core.py
vcokltfre/Zeek
0
43052
<filename>src/cogs/core/core.py from datetime import datetime from os import getenv from discord import Message, RawMessageDeleteEvent from discord.ext import commands from src.internal.bot import Bot class Core(commands.Cog): """Core metric collection.""" def __init__(self, bot: Bot): self.bot = bot @staticmethod def is_staff(member) -> bool: return int(getenv("STAFF")) in member._roles @commands.Cog.listener() async def on_message(self, message: Message) -> None: if not message.guild: return QUERY = "INSERT INTO Messages Values ($1, $2, $3, $4, $5, $6, $7, $8);" await self.bot.db.execute( QUERY, message.id, message.channel.id, message.channel.category.id if message.channel.category else None, message.guild.id, message.author.id, self.is_staff(message.author), message.author.bot, message.created_at, ) @commands.Cog.listener() async def on_raw_message_delete(self, payload: RawMessageDeleteEvent) -> None: if not payload.guild_id: return QUERY = "INSERT INTO DeletedMessages VALUES ($1, $2);" await self.bot.db.execute( QUERY, payload.message_id, datetime.utcnow(), ) @commands.command(name="stats") @commands.is_owner() async def stats(self, ctx: commands.Context) -> None: M_QUERY = "SELECT COUNT(*) FROM Messages;" DM_QUERY = "SELECT COUNT(*) FROM DeletedMessages;" messages = await self.bot.db.fetchrow(M_QUERY) deleted = await self.bot.db.fetchrow(DM_QUERY) messages, deleted = messages[0], deleted[0] await ctx.send(f"Total messages: {messages}\nDeleted messages: {deleted}") def setup(bot: Bot): bot.add_cog(Core(bot))
[ 1, 529, 9507, 29958, 4351, 29914, 29883, 12099, 29914, 3221, 29914, 3221, 29889, 2272, 13, 3166, 12865, 1053, 12865, 13, 3166, 2897, 1053, 679, 6272, 13, 13, 3166, 2313, 536, 1053, 7777, 29892, 22038, 3728, 12498, 2624, 13, 3166, 2313, 536, 29889, 1062, 1053, 8260, 13, 13, 3166, 4765, 29889, 7564, 29889, 7451, 1053, 11273, 13, 13, 13, 1990, 10239, 29898, 26381, 29889, 29907, 468, 1125, 13, 1678, 9995, 9203, 12714, 4333, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 29901, 11273, 1125, 13, 4706, 1583, 29889, 7451, 353, 9225, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 338, 29918, 303, 3470, 29898, 14242, 29897, 1599, 6120, 29901, 13, 4706, 736, 938, 29898, 657, 6272, 703, 1254, 29909, 4198, 5783, 297, 4509, 3032, 307, 793, 13, 13, 1678, 732, 26381, 29889, 29907, 468, 29889, 25894, 580, 13, 1678, 7465, 822, 373, 29918, 4906, 29898, 1311, 29892, 2643, 29901, 7777, 29897, 1599, 6213, 29901, 13, 4706, 565, 451, 2643, 29889, 2543, 789, 29901, 736, 13, 13, 4706, 660, 29965, 24422, 353, 376, 19460, 11646, 11946, 1179, 2630, 1041, 3255, 29896, 29892, 395, 29906, 29892, 395, 29941, 29892, 395, 29946, 29892, 395, 29945, 29892, 395, 29953, 29892, 395, 29955, 29892, 395, 29947, 416, 29908, 13, 13, 4706, 7272, 1583, 29889, 7451, 29889, 2585, 29889, 7978, 29898, 13, 9651, 660, 29965, 24422, 29892, 13, 9651, 2643, 29889, 333, 29892, 13, 9651, 2643, 29889, 12719, 29889, 333, 29892, 13, 9651, 2643, 29889, 12719, 29889, 7320, 29889, 333, 565, 2643, 29889, 12719, 29889, 7320, 1683, 6213, 29892, 13, 9651, 2643, 29889, 2543, 789, 29889, 333, 29892, 13, 9651, 2643, 29889, 8921, 29889, 333, 29892, 13, 9651, 1583, 29889, 275, 29918, 303, 3470, 29898, 4906, 29889, 8921, 511, 13, 9651, 2643, 29889, 8921, 29889, 7451, 29892, 13, 9651, 2643, 29889, 11600, 29918, 271, 29892, 13, 4706, 1723, 13, 13, 1678, 732, 26381, 29889, 29907, 468, 29889, 25894, 580, 13, 1678, 7465, 822, 373, 29918, 1610, 29918, 4906, 29918, 8143, 29898, 1311, 29892, 20092, 29901, 22038, 3728, 12498, 2624, 29897, 1599, 6213, 29901, 13, 4706, 565, 451, 20092, 29889, 2543, 789, 29918, 333, 29901, 736, 13, 13, 4706, 660, 29965, 24422, 353, 376, 19460, 11646, 897, 22742, 25510, 15673, 3255, 29896, 29892, 395, 29906, 416, 29908, 13, 13, 4706, 7272, 1583, 29889, 7451, 29889, 2585, 29889, 7978, 29898, 13, 9651, 660, 29965, 24422, 29892, 13, 9651, 20092, 29889, 4906, 29918, 333, 29892, 13, 9651, 12865, 29889, 329, 29883, 3707, 3285, 13, 4706, 1723, 13, 13, 1678, 732, 26381, 29889, 6519, 29898, 978, 543, 16202, 1159, 13, 1678, 732, 26381, 29889, 275, 29918, 20348, 580, 13, 1678, 7465, 822, 22663, 29898, 1311, 29892, 12893, 29901, 8260, 29889, 2677, 29897, 1599, 6213, 29901, 13, 4706, 341, 29918, 13356, 24422, 353, 376, 6404, 21122, 22798, 3895, 11946, 1179, 15458, 13, 4706, 27692, 29918, 13356, 24422, 353, 376, 6404, 21122, 22798, 3895, 897, 22742, 25510, 15458, 13, 13, 4706, 7191, 353, 7272, 1583, 29889, 7451, 29889, 2585, 29889, 9155, 798, 29898, 29924, 29918, 13356, 24422, 29897, 13, 4706, 11132, 353, 7272, 1583, 29889, 7451, 29889, 2585, 29889, 9155, 798, 29898, 23560, 29918, 13356, 24422, 29897, 13, 13, 4706, 7191, 29892, 11132, 353, 7191, 29961, 29900, 1402, 11132, 29961, 29900, 29962, 13, 13, 4706, 7272, 12893, 29889, 6717, 29898, 29888, 29908, 11536, 7191, 29901, 426, 19158, 1012, 29876, 2772, 22742, 7191, 29901, 426, 311, 22742, 27195, 13, 13, 13, 1753, 6230, 29898, 7451, 29901, 11273, 1125, 13, 1678, 9225, 29889, 1202, 29918, 29883, 468, 29898, 9203, 29898, 7451, 876, 13, 2 ]
horizon/openstack_dashboard/dashboards/cdn/cdn_monitor_report/urls.py
yianjiajia/openstack_horizon
0
177678
<filename>horizon/openstack_dashboard/dashboards/cdn/cdn_monitor_report/urls.py<gh_stars>0 from django.conf.urls import patterns from django.conf.urls import url from .views import IndexView, ajax_view urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='index'), url(r'^\?tab=monitor_report__data_statistics$', IndexView.as_view(), name='data_statistics_tab'), url(r'^json$', ajax_view, kwargs={'tenant_id': '', 'domain_id': ''}), )
[ 1, 529, 9507, 29958, 2015, 18162, 29914, 3150, 1429, 29918, 14592, 3377, 29914, 14592, 24691, 29914, 13687, 29914, 13687, 29918, 3712, 2105, 29918, 12276, 29914, 26045, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 15038, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 3166, 869, 7406, 1053, 11374, 1043, 29892, 9349, 29918, 1493, 13, 13, 13, 2271, 11037, 29879, 353, 15038, 877, 742, 13, 1678, 3142, 29898, 29878, 29915, 29985, 29938, 742, 11374, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 2248, 5477, 13, 1678, 3142, 29898, 29878, 29915, 3823, 29973, 3891, 29922, 3712, 2105, 29918, 12276, 1649, 1272, 29918, 6112, 6765, 29938, 742, 11374, 1043, 29889, 294, 29918, 1493, 3285, 1024, 2433, 1272, 29918, 6112, 6765, 29918, 3891, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 3126, 29938, 742, 9349, 29918, 1493, 29892, 9049, 5085, 3790, 29915, 841, 424, 29918, 333, 2396, 15516, 525, 7247, 29918, 333, 2396, 6629, 9594, 13, 13, 29897, 13, 2 ]
formTest.py
faisalarkan21/mbti-test-qt
0
109282
<reponame>faisalarkan21/mbti-test-qt __author__ = 'faisal21' import sys from PyQt4 import QtGui from PyQt4.QtGui import QDialog from PyQt4 import QtCore from dialog import Ui_Dialog from Tkinter import * class Test(QtGui.QDialog,Toplevel): def __init__(self,parent): QtGui.QMainWindow.__init__(self,parent) self.ui = Ui_Dialog() self.ui.setupUi(self) self.ui.pushButton_2.setEnabled(False) self.backExstro() self.backFeel() self.backIntro() self.backIntusi() self.backJudg() self.backPercep() self.backSense() self.backThink() self.actTombol() self.act() ############################################## ################InstalasiVariable################### ############################################## def backIntusi(self): self.Intuisi = 0 self.subIntuisi1= 0 self.subIntuisi2 = 0 self.subIntuisi3 = 0 self.subIntuisi4 = 0 self.subIntuisi5 = 0 def backSense(self): self.Sense = 0 self.subSense1 = 0 self.subSense2 = 0 self.subSense3 = 0 self.subSense4 = 0 self.subSense5 = 0 def backExstro(self): self.Exstro = 0 self.subExstro1 = 0 self.subExstro2 = 0 self.subExstro3 = 0 self.subExstro4 = 0 self.subExstro5 = 0 def backIntro(self): self.Intro = 0 self.subIntro1 = 0 self.subIntro2 = 0 self.subIntro3 = 0 self.subIntro4 = 0 self.subIntro5 = 0 def backJudg(self): self.Judg = 0 self.subJudg1 = 0 self.subJudg2 = 0 self.subJudg3 = 0 self.subJudg4 = 0 self.subJudg5 = 0 def backPercep(self): self.Percep =0 self.subPercep1 = 0 self.subPercep2 = 0 self.subPercep3 = 0 self.subPercep4 = 0 self.subPercep5 = 0 def backThink(self): self.Think = 0 self.subThink1 = 0 self.subThink2 = 0 self.subThink3 = 0 self.subThink4 = 0 self.subThink5 = 0 def backFeel(self): self.Feel = 0 self.subFeel1 = 0 self.subFeel2 = 0 self.subFeel3 = 0 self.subFeel4 = 0 self.subFeel5 = 0 ############################################## ################Action################### ############################################## def actTombol (self): self.ui.pushButton.clicked.connect(self.jumTotal) self.ui.pushButton_2.clicked.connect(self.kalkulasi) def act(self): self.ui.radioButtonP1.clicked.connect(self.soal1) self.ui.radioButtonJ1.clicked.connect(self.soal1) self.ui.radioButtonI1.clicked.connect(self.soal2) self.ui.radioButtonE1.clicked.connect(self.soal2) self.ui.radioButtonT1.clicked.connect(self.soal3) self.ui.radioButtonF1.clicked.connect(self.soal3) self.ui.radioButtonN1.clicked.connect(self.soal4) self.ui.radioButtonS1.clicked.connect(self.soal4) self.ui.radioButtonJ1_2.clicked.connect(self.soal5) self.ui.radioButtonP1_2.clicked.connect(self.soal5) self.ui.radioButtonI1_2.clicked.connect(self.soal6) self.ui.radioButtonE1_2.clicked.connect(self.soal6) self.ui.radioButtonN2.clicked.connect(self.soal7) self.ui.radioButtonS2.clicked.connect(self.soal7) self.ui.radioButtonE2.clicked.connect(self.soal8) self.ui.radioButtonI2.clicked.connect(self.soal8) self.ui.radioButtonJ2.clicked.connect(self.soal9) self.ui.radioButtonP2.clicked.connect(self.soal9) self.ui.radioButtonF2.clicked.connect(self.soal10) self.ui.radioButtonT2.clicked.connect(self.soal10) self.ui.radioButtonS2_2.clicked.connect(self.soal11) self.ui.radioButtonN2_2.clicked.connect(self.soal11) self.ui.radioButtonT2_2.clicked.connect(self.soal12) self.ui.radioButtonF2_2.clicked.connect(self.soal12) self.ui.radioButtonS3.clicked.connect(self.soal13) self.ui.radioButtonN3.clicked.connect(self.soal13) self.ui.radioButtonJ3.clicked.connect(self.soal14) self.ui.radioButtonP3.clicked.connect(self.soal14) self.ui.radioButtonN3_3.clicked.connect(self.soal15) self.ui.radioButtonS3_3.clicked.connect(self.soal15) self.ui.radioButtonI3.clicked.connect(self.soal16) self.ui.radioButtonE3.clicked.connect(self.soal16) self.ui.radioButtonF3.clicked.connect(self.soal17) self.ui.radioButtonT3.clicked.connect(self.soal17) self.ui.radioButtonJ3_2.clicked.connect(self.soal18) self.ui.radioButtonP3_2.clicked.connect(self.soal18) self.ui.radioButtonE4.clicked.connect(self.soal19) self.ui.radioButtonI4.clicked.connect(self.soal19) self.ui.radioButtonT4.clicked.connect(self.soal20) self.ui.radioButtonF4.clicked.connect(self.soal20) ############################################## ################ Check Button Choice ################### ############################################## def soal1 (self): if (self.ui.radioButtonP1.isChecked()): self.jwb1 = 1 elif (self.ui.radioButtonJ1.isChecked()): self.jwb1 = 2 def soal2 (self): if (self.ui.radioButtonI1.isChecked()): self.jwb2 = 1 elif (self.ui.radioButtonE1.isChecked()): self.jwb2 = 2 def soal3 (self): if (self.ui.radioButtonT1.isChecked()): self.jwb3 = 1 elif (self.ui.radioButtonF1.isChecked()): self.jwb3 = 2 ################### def soal4 (self): if (self.ui.radioButtonN1.isChecked()): self.jwb4 = 1 elif (self.ui.radioButtonS1.isChecked()): self.jwb4 = 2 def soal5 (self): if (self.ui.radioButtonJ1_2.isChecked()): self.jwb5 = 1 elif (self.ui.radioButtonP1_2.isChecked()): self.jwb5 = 2 def soal6 (self): if (self.ui.radioButtonI1_2.isChecked()): self.jwb6 = 1 elif (self.ui.radioButtonE1_2.isChecked()): self.jwb6 = 2 ##################### def soal7 (self): if (self.ui.radioButtonN2.isChecked()): self.jwb7 = 1 elif (self.ui.radioButtonS2.isChecked()): self.jwb7 = 2 def soal8 (self): if (self.ui.radioButtonE2.isChecked()): self.jwb8 = 1 elif (self.ui.radioButtonI2.isChecked()): self.jwb8 = 2 def soal9 (self): if (self.ui.radioButtonJ2.isChecked()): self.jwb9 = 1 elif (self.ui.radioButtonP2.isChecked()): self.jwb9 = 2 def soal10 (self): if (self.ui.radioButtonF2.isChecked()): self.jwb10 = 1 elif (self.ui.radioButtonT2.isChecked()): self.jwb10 = 2 def soal11 (self): if (self.ui.radioButtonS2_2.isChecked()): self.jwb11 = 1 elif (self.ui.radioButtonN2_2.isChecked()): self.jwb11 = 2 def soal12 (self): if (self.ui.radioButtonT2_2.isChecked()): self.jwb12 = 1 elif (self.ui.radioButtonF2_2.isChecked()): self.jwb12 = 2 ################ def soal13 (self): if (self.ui.radioButtonS3.isChecked()): self.jwb13 = 1 elif (self.ui.radioButtonN3.isChecked()): self.jwb13 = 2 def soal14 (self): if (self.ui.radioButtonJ3.isChecked()): self.jwb14 = 1 elif (self.ui.radioButtonP3.isChecked()): self.jwb14 = 2 def soal15 (self): if (self.ui.radioButtonN3_3.isChecked()): self.jwb15 = 1 elif (self.ui.radioButtonS3_3.isChecked()): self.jwb15 = 2 ################### def soal16 (self): if (self.ui.radioButtonI3.isChecked()): self.jwb16 = 1 elif (self.ui.radioButtonE3.isChecked()): self.jwb16 = 2 def soal17 (self): if (self.ui.radioButtonF3.isChecked()): self.jwb17 = 1 elif (self.ui.radioButtonT3.isChecked()): self.jwb17 = 2 def soal18 (self): if (self.ui.radioButtonJ3_2.isChecked()): self.jwb18 = 1 elif (self.ui.radioButtonP3_2.isChecked()): self.jwb18 = 2 ##################### def soal19 (self): if (self.ui.radioButtonE4.isChecked()): self.jwb19 = 1 elif (self.ui.radioButtonI4.isChecked()): self.jwb19 = 2 def soal20 (self): if (self.ui.radioButtonT4.isChecked()): self.jwb20 = 1 elif (self.ui.radioButtonF4.isChecked()): self.jwb20 = 2 ############################################## ################subJumlah################### ############################################## def jumSoal1 (self): if (self.jwb1 == 1): self.subPercep1 =+1 else : self.subJudg1 = +1 def jumSoal2 (self): if (self.jwb2 == 1): self.subIntro1 =+1 else : self.subExstro1 = +1 def jumSoal3 (self): if (self.jwb3 == 1): self.subThink1 =+1 else : self.subFeel1 = +1 ############## def jumSoal4 (self): if (self.jwb4 == 1): self.subIntuisi1 =+1 else : self.subSense1 = +1 def jumSoal5 (self): if (self.jwb5 == 1): self.subJudg2 =+1 else : self.subPercep2 = +1 def jumSoal6 (self): if (self.jwb6 == 1): self.subIntro2 =+1 else : self.subExstro2 = +1 ######################### def jumSoal7 (self): if (self.jwb7 == 1): self.subIntuisi2 =+1 else : self.subSense2 = +1 def jumSoal8 (self): if (self.jwb8 == 1): self.subExstro3 =+1 else : self.subIntro3 = +1 def jumSoal9 (self): if (self.jwb9 == 1): self.subJudg3 =+1 else : self.subPercep3 = +1 def jumSoal10 (self): if (self.jwb10 == 1): self.subFeel2 =+1 else : self.subThink2 = +1 def jumSoal11 (self): if (self.jwb11 == 1): self.subSense3 =+1 else : self.subIntuisi3 = +1 def jumSoal12 (self): if (self.jwb12 == 1): self.subThink3 =+1 else : self.subFeel3 = +1 def jumSoal13 (self): if (self.jwb13 == 1): self.subSense4 =+1 else : self.subIntuisi4 = +1 def jumSoal14 (self): if (self.jwb14 == 1): self.subJudg4 =+1 else : self.subPercep4 = +1 def jumSoal15 (self): if (self.jwb15 == 1): self.subIntuisi5 =+1 else : self.subSense5 = +1 def jumSoal16 (self): if (self.jwb16 == 1): self.subIntro4 =+1 else : self.subExstro4 = +1 def jumSoal17 (self): if (self.jwb17 == 1): self.subFeel4 =+1 else : self.subThink4 = +1 def jumSoal18 (self): if (self.jwb18 == 1): self.subJudg5 =+1 else : self.subPercep5 = +1 def jumSoal19 (self): if (self.jwb19 == 1): self.subExstro5 =+1 else : self.subIntro5 = +1 def jumSoal20 (self): if (self.jwb20 == 1): self.subThink5 =+1 else : self.subFeel5 = +1 ############################################## ################jumlahTotal################### ############################################## def jumTotal(self): if ((self.ui.radioButtonP1.isChecked() or self.ui.radioButtonJ1.isChecked()) and (self.ui.radioButtonI1.isChecked() or self.ui.radioButtonE1.isChecked()) and (self.ui.radioButtonT1.isChecked() or self.ui.radioButtonF1.isChecked()) and (self.ui.radioButtonN1.isChecked() or self.ui.radioButtonS1.isChecked()) and (self.ui.radioButtonJ1_2.isChecked() or self.ui.radioButtonP1_2.isChecked()) and (self.ui.radioButtonI1_2.isChecked() or self.ui.radioButtonE1_2.isChecked()) and (self.ui.radioButtonN2.isChecked() or self.ui.radioButtonS2.isChecked()) and (self.ui.radioButtonE2.isChecked() or self.ui.radioButtonI2.isChecked()) and (self.ui.radioButtonJ2.isChecked() or self.ui.radioButtonP2.isChecked()) and (self.ui.radioButtonF2.isChecked() or self.ui.radioButtonT2.isChecked())and (self.ui.radioButtonS2_2.isChecked() or self.ui.radioButtonN2_2.isChecked()) and (self.ui.radioButtonT2_2.isChecked() or self.ui.radioButtonF2_2.isChecked()) and (self.ui.radioButtonS3.isChecked() or self.ui.radioButtonN3.isChecked()) and (self.ui.radioButtonJ3.isChecked() or self.ui.radioButtonP3.isChecked()) and (self.ui.radioButtonN3_3.isChecked() or self.ui.radioButtonS3_3.isChecked()) and (self.ui.radioButtonI3.isChecked() or self.ui.radioButtonE3.isChecked()) and (self.ui.radioButtonF3.isChecked() or self.ui.radioButtonT3.isChecked()) and (self.ui.radioButtonJ3_2.isChecked() or self.ui.radioButtonP3_2.isChecked()) and (self.ui.radioButtonE4.isChecked() or self.ui.radioButtonI4.isChecked()) and (self.ui.radioButtonT4.isChecked() or self.ui.radioButtonF4.isChecked())): self.jumSoal1() self.jumSoal2() self.jumSoal3() self.jumSoal4() self.jumSoal5() self.jumSoal6() self.jumSoal7() self.jumSoal8() self.jumSoal9() self.jumSoal10() self.jumSoal11() self.jumSoal12() self.jumSoal13() self.jumSoal14() self.jumSoal15() self.jumSoal16() self.jumSoal17() self.jumSoal18() self.jumSoal19() self.jumSoal20() self.ui.pushButton_2.setEnabled(True) QDialog.QMessageBox.information(self, "Pehatihan", "Silahkan tekan tombol Lihat hasil","Oke") else : QDialog.QMessageBox.information(self, "Pehatihan", "Tolong isi semua pilihan Terlebih dahulu","Oke") ############################################## ################KalkulasiTotal################### ############################################## def kalkulasi (self): self.ui.pushButton_2.setEnabled(False) self.Intro = self.subIntro1 + self.subIntro2 + self.subIntro3 +self.subIntro4+self.subIntro5 self.Exstro = self.subExstro1 + self.subExstro2 + self.subExstro3 +self.subExstro4 + self.subExstro5 self.Percep = self.subPercep1 + self.subPercep2 + self.subPercep3 +self.subPercep4 +self.subPercep5 self.Judg = self.subJudg1 + self.subJudg2 + self.subJudg3+ self.subJudg4+self.subJudg5 self.Feel = self.subFeel1 + self.subFeel2 + self.subFeel3 + self.subFeel4 + self.subFeel5 self.Think = self.subThink1 + self.subThink2+ self.subThink3 + self.subThink4 + self.subThink5 self.Sense = self.subSense1 + self.subSense2 +self.subSense3 +self.subSense4 +self.subSense5 self.Intuisi = self.subIntuisi1 + self.subIntuisi2 + self.subIntuisi3 +self.subIntuisi4 +self.subIntuisi5 if (self.Intro<self.Exstro): self.IorE = "E" elif (self.Intro>self.Exstro): self.IorE = "I" if (self.Sense < self.Intuisi): self.SorI = "N" else : self.SorI = "S" if (self.Think < self.Feel): self.TorF = "F" else : self.TorF = "T" if (self.Percep < self.Judg): self.PorJ = "J" else : self.PorJ = "P" self.ui.label_2.setText("Skor Inrovert anda adalah : %d" % self.Intro + "\n" + "Skor Extrovert anda adalah : %d" % self.Exstro +"\n" + "Skor Peception anda adalah : %d" % self.Percep + "\n" + "Skor Jugje anda adalah : %d" % self.Judg +"\n"+ "Skor Feel anda adalah : %d" % self.Feel + "\n" + "Skor Think anda adalah : %d" % self.Think + "\n" + "Skor Sense anda adalah : %d" % self.Sense + "\n" + "Skor Intuisi anda adalah : %d" % self.Intuisi + "\n" + "Anda Adalah : " + self.IorE+self.SorI+self.TorF+self.PorJ ) QDialog.QMessageBox.information(self, "Pehatihan", "Selamat anda adalah seorang %s%s%s%s" % (self.IorE,self.SorI,self.TorF,self.PorJ),"Terimakasih :)") print "nilai Inrovert anda adalah : %d" % self.Intro print "nilai Extrovert anda adalah : %d" % self.Exstro print "Nilai Peception anda adalah : %d" % self.Percep print "Nilai Jugje anda adalah : %d" % self.Judg print "Nilai Feel anda adalah : %d" % self.Feel print "Nilai Think anda adalah : %d" % self.Think print "Nilai Sense anda adalah : %d" % self.Sense print "Nilai Intuisi anda adalah : %d" % self.Intuisi ############################################## ################MainExcecution################### ############################################## if __name__ == '__main__': app = QtGui.QApplication(sys.argv) window = Test() window.show() sys.exit(app.exec_())
[ 1, 529, 276, 1112, 420, 29958, 29888, 1759, 284, 935, 273, 29906, 29896, 29914, 8337, 2034, 29899, 1688, 29899, 17915, 13, 1649, 8921, 1649, 353, 525, 29888, 1759, 284, 29906, 29896, 29915, 30004, 13, 30004, 13, 5215, 10876, 30004, 13, 3166, 10772, 17303, 29946, 1053, 14705, 28707, 30004, 13, 3166, 10772, 17303, 29946, 29889, 17303, 28707, 1053, 660, 7647, 30004, 13, 3166, 10772, 17303, 29946, 1053, 14705, 9203, 30004, 13, 3166, 7928, 1053, 29871, 501, 29875, 29918, 7647, 30004, 13, 3166, 323, 29895, 1639, 1053, 334, 30004, 13, 30004, 13, 1990, 4321, 29898, 17303, 28707, 29889, 29984, 7647, 29892, 29911, 1991, 955, 1125, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3560, 1125, 30004, 13, 4706, 14705, 28707, 29889, 29984, 6330, 5907, 17255, 2344, 12035, 1311, 29892, 3560, 8443, 13, 4706, 1583, 29889, 1481, 353, 501, 29875, 29918, 7647, 26471, 13, 4706, 1583, 29889, 1481, 29889, 14669, 29965, 29875, 29898, 1311, 8443, 13, 4706, 1583, 29889, 1481, 29889, 5910, 3125, 29918, 29906, 29889, 842, 10861, 29898, 8824, 8443, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 4706, 1583, 29889, 1627, 1252, 303, 307, 26471, 13, 4706, 1583, 29889, 1627, 8263, 295, 26471, 13, 4706, 1583, 29889, 1627, 2928, 307, 26471, 13, 4706, 1583, 29889, 1627, 2928, 375, 29875, 26471, 13, 4706, 1583, 29889, 1627, 29967, 566, 29887, 26471, 13, 4706, 1583, 29889, 1627, 5894, 13300, 26471, 13, 4706, 1583, 29889, 1627, 29903, 1947, 26471, 13, 4706, 1583, 29889, 1627, 1349, 682, 26471, 13, 4706, 1583, 29889, 627, 21599, 2095, 26471, 13, 4706, 1583, 29889, 627, 26471, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 3379, 284, 6840, 16174, 13383, 2277, 29937, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 1678, 822, 1250, 2928, 375, 29875, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 2928, 4664, 29875, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 4664, 29875, 29896, 29922, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 4664, 29875, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 4664, 29875, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 4664, 29875, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 4664, 29875, 29945, 353, 29871, 29900, 30004, 13, 30004, 13, 1678, 822, 1250, 29903, 1947, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 29903, 1947, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29903, 1947, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29903, 1947, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29903, 1947, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29903, 1947, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29903, 1947, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 1252, 303, 307, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1252, 303, 307, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1252, 303, 307, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1252, 303, 307, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1252, 303, 307, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1252, 303, 307, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1252, 303, 307, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 2928, 307, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 2928, 307, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 307, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 307, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 307, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 307, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 2928, 307, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 29967, 566, 29887, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 29967, 566, 29887, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29967, 566, 29887, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29967, 566, 29887, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29967, 566, 29887, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29967, 566, 29887, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 29967, 566, 29887, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 5894, 13300, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 5894, 13300, 353, 29900, 30004, 13, 4706, 1583, 29889, 1491, 5894, 13300, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 5894, 13300, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 5894, 13300, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 5894, 13300, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 5894, 13300, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 1349, 682, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1349, 682, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1349, 682, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1349, 682, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1349, 682, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1349, 682, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 1349, 682, 29945, 353, 29871, 29900, 30004, 13, 1678, 822, 1250, 8263, 295, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 8263, 295, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 8263, 295, 29896, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 8263, 295, 29906, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 8263, 295, 29941, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 8263, 295, 29946, 353, 29871, 29900, 30004, 13, 4706, 1583, 29889, 1491, 8263, 295, 29945, 353, 29871, 29900, 30004, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 4276, 13383, 2277, 29937, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 1678, 822, 1044, 21599, 2095, 313, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1481, 29889, 5910, 3125, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 29926, 398, 11536, 8443, 13, 4706, 1583, 29889, 1481, 29889, 5910, 3125, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 29895, 2235, 352, 6840, 8443, 13, 30004, 13, 1678, 822, 1044, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29906, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29906, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29941, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29941, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29946, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29896, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29946, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29945, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29945, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29953, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29953, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29955, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29955, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29947, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29947, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29929, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29929, 8443, 13, 30004, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29900, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29900, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29896, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29896, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29906, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29906, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29941, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29941, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29946, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29946, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29918, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29945, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29918, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29945, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29953, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29953, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29955, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29941, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29955, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29947, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29918, 29906, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29947, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29946, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29929, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29946, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29896, 29929, 8443, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29946, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29906, 29900, 8443, 13, 4706, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29946, 29889, 3808, 287, 29889, 6915, 29898, 1311, 29889, 578, 284, 29906, 29900, 8443, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 5399, 11025, 14542, 625, 835, 13383, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29906, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29906, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29906, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29941, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29941, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29941, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 835, 13383, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29946, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29946, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29896, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29946, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29945, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29945, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29945, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29953, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29953, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29953, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 835, 13383, 2277, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29955, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29955, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29955, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29947, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29947, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29947, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29929, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29929, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29929, 353, 29871, 29906, 30004, 13, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29900, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29900, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29900, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29896, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29896, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29896, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29906, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29906, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29906, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 835, 7346, 4136, 29937, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29941, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29941, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29941, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29946, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29946, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29946, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29945, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29918, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29945, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29918, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29945, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 835, 13383, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29953, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29953, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29953, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29955, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29955, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29941, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29955, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29947, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29947, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29918, 29906, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29947, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 835, 13383, 2277, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29896, 29929, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29946, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29929, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29946, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29896, 29929, 353, 29871, 29906, 30004, 13, 30004, 13, 1678, 822, 577, 284, 29906, 29900, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29946, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29906, 29900, 353, 29871, 29896, 30004, 13, 4706, 25342, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29946, 29889, 275, 17817, 580, 1125, 30004, 13, 9651, 1583, 29889, 29926, 29893, 29890, 29906, 29900, 353, 29871, 29906, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 1491, 29967, 398, 8083, 13383, 2277, 29937, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 5894, 13300, 29896, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 29967, 566, 29887, 29896, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29906, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29906, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 307, 29896, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 1252, 303, 307, 29896, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29941, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29941, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 1349, 682, 29896, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 8263, 295, 29896, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 835, 7346, 2277, 29937, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29946, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29946, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 4664, 29875, 29896, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 29903, 1947, 29896, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29945, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29945, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29967, 566, 29887, 29906, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 5894, 13300, 29906, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29953, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29953, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 307, 29906, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 1252, 303, 307, 29906, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 835, 13383, 4136, 2277, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29955, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29955, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 4664, 29875, 29906, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 29903, 1947, 29906, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29947, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29947, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 1252, 303, 307, 29941, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 2928, 307, 29941, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29929, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29929, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29967, 566, 29887, 29941, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 5894, 13300, 29941, 353, 718, 29896, 30004, 13, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29900, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29900, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 8263, 295, 29906, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 1349, 682, 29906, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29896, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29896, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29903, 1947, 29941, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 2928, 4664, 29875, 29941, 353, 718, 29896, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29906, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29906, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 1349, 682, 29941, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 8263, 295, 29941, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29941, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29941, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29903, 1947, 29946, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 2928, 4664, 29875, 29946, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29946, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29946, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29967, 566, 29887, 29946, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 5894, 13300, 29946, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29945, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29945, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 4664, 29875, 29945, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 29903, 1947, 29945, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29953, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29953, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 2928, 307, 29946, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 1252, 303, 307, 29946, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29955, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29955, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 8263, 295, 29946, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 1349, 682, 29946, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29947, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29947, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 29967, 566, 29887, 29945, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 5894, 13300, 29945, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29896, 29929, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29896, 29929, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 1252, 303, 307, 29945, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 2928, 307, 29945, 353, 718, 29896, 30004, 13, 30004, 13, 1678, 822, 432, 398, 6295, 284, 29906, 29900, 313, 1311, 1125, 30004, 13, 4706, 565, 313, 1311, 29889, 29926, 29893, 29890, 29906, 29900, 1275, 29871, 29896, 1125, 30004, 13, 9651, 1583, 29889, 1491, 1349, 682, 29945, 353, 29974, 29896, 30004, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 1491, 8263, 295, 29945, 353, 718, 29896, 30004, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 29926, 398, 8083, 11536, 13383, 2277, 29937, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 30004, 13, 1678, 822, 432, 398, 11536, 29898, 1311, 1125, 30004, 13, 30004, 13, 4706, 565, 5135, 1311, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29896, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29896, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29896, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29896, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29896, 29918, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29896, 29918, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29896, 29918, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29896, 29918, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29889, 275, 17817, 3101, 392, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29906, 29918, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29906, 29918, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29906, 29918, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29906, 29918, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29940, 29941, 29918, 29941, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29903, 29941, 29918, 29941, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29902, 29941, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29923, 29941, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29943, 29941, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29911, 29941, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29967, 29941, 29918, 29906, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29925, 29941, 29918, 29906, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29923, 29946, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29902, 29946, 29889, 275, 17817, 3101, 322, 30004, 13, 18884, 313, 1311, 29889, 1481, 29889, 13399, 3125, 29911, 29946, 29889, 275, 17817, 580, 470, 1583, 29889, 1481, 29889, 13399, 3125, 29943, 29946, 29889, 275, 17817, 22130, 29901, 30004, 13, 30004, 13, 30004, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29906, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29941, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29946, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29945, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29953, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29955, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29947, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29929, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29900, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29896, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29906, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29941, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29946, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29945, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29953, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29955, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29947, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29896, 29929, 26471, 13, 9651, 1583, 29889, 29926, 398, 6295, 284, 29906, 29900, 26471, 13, 9651, 1583, 29889, 1481, 29889, 5910, 3125, 29918, 29906, 29889, 842, 10861, 29898, 5574, 8443, 13, 9651, 660, 7647, 29889, 29984, 3728, 3313, 29889, 19678, 29898, 1311, 29892, 376, 29925, 14797, 2219, 5403, 613, 376, 26729, 801, 11052, 734, 11052, 6454, 2095, 2718, 2455, 756, 309, 3284, 29949, 446, 1159, 30004, 13, 4706, 1683, 584, 30004, 13, 3986, 660, 7647, 29889, 29984, 3728, 3313, 29889, 19678, 29898, 1311, 29892, 376, 29925, 14797, 2219, 5403, 613, 376, 29911, 324, 549, 338, 29875, 3031, 3357, 282, 2638, 5403, 5061, 19982, 4861, 20694, 21528, 3284, 29949, 446, 1159, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 1678, 835, 7346, 4136, 29937, 29968, 2235, 352, 6840, 11536, 13383, 2277, 29937, 30004, 13, 1678, 835, 13383, 13383, 7346, 2277, 29937, 30004, 13, 30004, 13, 30004, 13, 1678, 822, 413, 2235, 352, 6840, 313, 1311, 1125, 30004, 13, 4706, 1583, 29889, 1481, 29889, 5910, 3125, 29918, 29906, 29889, 842, 10861, 29898, 8824, 8443, 13, 4706, 1583, 29889, 2928, 307, 353, 29871, 1583, 29889, 1491, 2928, 307, 29896, 718, 1583, 29889, 1491, 2928, 307, 29906, 718, 1583, 29889, 1491, 2928, 307, 29941, 718, 1311, 29889, 1491, 2928, 307, 29946, 29974, 1311, 29889, 1491, 2928, 307, 29945, 30004, 13, 4706, 1583, 29889, 1252, 303, 307, 353, 29871, 1583, 29889, 1491, 1252, 303, 307, 29896, 718, 1583, 29889, 1491, 1252, 303, 307, 29906, 718, 1583, 29889, 1491, 1252, 303, 307, 29941, 718, 1311, 29889, 1491, 1252, 303, 307, 29946, 718, 1583, 29889, 1491, 1252, 303, 307, 29945, 30004, 13, 4706, 1583, 29889, 5894, 13300, 353, 1583, 29889, 1491, 5894, 13300, 29896, 718, 1583, 29889, 1491, 5894, 13300, 29906, 718, 1583, 29889, 1491, 5894, 13300, 29941, 718, 1311, 29889, 1491, 5894, 13300, 29946, 718, 1311, 29889, 1491, 5894, 13300, 29945, 30004, 13, 4706, 1583, 29889, 29967, 566, 29887, 353, 1583, 29889, 1491, 29967, 566, 29887, 29896, 718, 1583, 29889, 1491, 29967, 566, 29887, 29906, 718, 1583, 29889, 1491, 29967, 566, 29887, 29941, 29974, 1583, 29889, 1491, 29967, 566, 29887, 29946, 29974, 1311, 29889, 1491, 29967, 566, 29887, 29945, 30004, 13, 4706, 1583, 29889, 8263, 295, 353, 1583, 29889, 1491, 8263, 295, 29896, 718, 1583, 29889, 1491, 8263, 295, 29906, 718, 1583, 29889, 1491, 8263, 295, 29941, 718, 1583, 29889, 1491, 8263, 295, 29946, 718, 1583, 29889, 1491, 8263, 295, 29945, 30004, 13, 4706, 1583, 29889, 1349, 682, 353, 1583, 29889, 1491, 1349, 682, 29896, 718, 1583, 29889, 1491, 1349, 682, 29906, 29974, 1583, 29889, 1491, 1349, 682, 29941, 718, 1583, 29889, 1491, 1349, 682, 29946, 718, 1583, 29889, 1491, 1349, 682, 29945, 30004, 13, 4706, 1583, 29889, 29903, 1947, 353, 1583, 29889, 1491, 29903, 1947, 29896, 718, 1583, 29889, 1491, 29903, 1947, 29906, 718, 1311, 29889, 1491, 29903, 1947, 29941, 718, 1311, 29889, 1491, 29903, 1947, 29946, 718, 1311, 29889, 1491, 29903, 1947, 29945, 30004, 13, 4706, 1583, 29889, 2928, 4664, 29875, 353, 1583, 29889, 1491, 2928, 4664, 29875, 29896, 718, 1583, 29889, 1491, 2928, 4664, 29875, 29906, 718, 1583, 29889, 1491, 2928, 4664, 29875, 29941, 718, 1311, 29889, 1491, 2928, 4664, 29875, 29946, 718, 1311, 29889, 1491, 2928, 4664, 29875, 29945, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 4706, 565, 313, 1311, 29889, 2928, 307, 29966, 1311, 29889, 1252, 303, 307, 1125, 30004, 13, 9651, 1583, 29889, 29902, 272, 29923, 353, 376, 29923, 19451, 13, 4706, 25342, 313, 1311, 29889, 2928, 307, 29958, 1311, 29889, 1252, 303, 307, 1125, 30004, 13, 632, 1583, 29889, 29902, 272, 29923, 353, 376, 29902, 19451, 13, 30004, 13, 4706, 565, 313, 1311, 29889, 29903, 1947, 529, 1583, 29889, 2928, 4664, 29875, 1125, 30004, 13, 632, 1583, 29889, 29903, 272, 29902, 353, 376, 29940, 19451, 13, 4706, 1683, 584, 30004, 13, 632, 1583, 29889, 29903, 272, 29902, 353, 376, 29903, 19451, 13, 30004, 13, 4706, 565, 313, 1311, 29889, 1349, 682, 529, 1583, 29889, 8263, 295, 1125, 30004, 13, 632, 1583, 29889, 29911, 272, 29943, 353, 376, 29943, 19451, 13, 4706, 1683, 584, 30004, 13, 632, 1583, 29889, 29911, 272, 29943, 353, 376, 29911, 19451, 13, 30004, 13, 4706, 565, 313, 1311, 29889, 5894, 13300, 529, 1583, 29889, 29967, 566, 29887, 1125, 30004, 13, 9651, 1583, 29889, 29925, 272, 29967, 353, 376, 29967, 19451, 13, 4706, 1683, 584, 30004, 13, 9651, 1583, 29889, 29925, 272, 29967, 353, 376, 29925, 19451, 13, 30004, 13, 30004, 13, 30004, 13, 4706, 1583, 29889, 1481, 29889, 1643, 29918, 29906, 29889, 12038, 703, 29903, 13123, 512, 307, 1765, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 2928, 307, 718, 6634, 29876, 29908, 718, 376, 29903, 13123, 7338, 307, 1765, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 1252, 303, 307, 718, 26732, 29876, 19451, 13, 462, 18884, 718, 376, 29903, 13123, 3938, 1441, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 5894, 13300, 718, 6634, 29876, 29908, 718, 376, 29903, 13123, 12028, 1324, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 29967, 566, 29887, 718, 26732, 29876, 17969, 30004, 13, 462, 18884, 376, 29903, 13123, 5169, 295, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 8263, 295, 718, 6634, 29876, 29908, 718, 376, 29903, 13123, 25086, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 1349, 682, 718, 6634, 29876, 29908, 718, 30004, 13, 462, 18884, 376, 29903, 13123, 317, 1947, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 29903, 1947, 718, 6634, 29876, 29908, 718, 376, 29903, 13123, 3159, 4664, 29875, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 2928, 4664, 29875, 718, 6634, 29876, 29908, 718, 376, 2855, 29874, 2087, 284, 801, 584, 376, 718, 1583, 29889, 29902, 272, 29923, 29974, 1311, 29889, 29903, 272, 29902, 29974, 1311, 29889, 29911, 272, 29943, 29974, 1311, 29889, 29925, 272, 29967, 1723, 30004, 13, 30004, 13, 4706, 660, 7647, 29889, 29984, 3728, 3313, 29889, 19678, 29898, 1311, 29892, 376, 29925, 14797, 2219, 5403, 613, 376, 29903, 295, 314, 271, 322, 29874, 594, 284, 801, 409, 272, 574, 29871, 1273, 29879, 29995, 29879, 29995, 29879, 29995, 29879, 29908, 1273, 313, 1311, 29889, 29902, 272, 29923, 29892, 1311, 29889, 29903, 272, 29902, 29892, 1311, 29889, 29911, 272, 29943, 29892, 1311, 29889, 29925, 272, 29967, 511, 29908, 29911, 261, 326, 557, 294, 4861, 4248, 1159, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 4706, 1596, 376, 8834, 1794, 512, 307, 1765, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 2928, 307, 30004, 13, 4706, 1596, 376, 8834, 1794, 7338, 307, 1765, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 1252, 303, 307, 30004, 13, 4706, 1596, 376, 27823, 1794, 3938, 1441, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 5894, 13300, 30004, 13, 4706, 1596, 376, 27823, 1794, 12028, 1324, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 29967, 566, 29887, 30004, 13, 4706, 1596, 376, 27823, 1794, 5169, 295, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 8263, 295, 30004, 13, 4706, 1596, 376, 27823, 1794, 25086, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 1349, 682, 30004, 13, 4706, 1596, 376, 27823, 1794, 317, 1947, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 29903, 1947, 30004, 13, 4706, 1596, 376, 27823, 1794, 3159, 4664, 29875, 322, 29874, 594, 284, 801, 584, 1273, 29881, 29908, 1273, 1583, 29889, 2928, 4664, 29875, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 13383, 13383, 7346, 4136, 2277, 30004, 13, 13383, 6330, 1252, 346, 29883, 918, 13383, 2277, 29937, 30004, 13, 13383, 13383, 7346, 4136, 2277, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 1678, 623, 353, 14705, 28707, 29889, 29984, 4873, 29898, 9675, 29889, 19218, 8443, 13, 1678, 3474, 353, 4321, 26471, 13, 1678, 3474, 29889, 4294, 26471, 13, 1678, 10876, 29889, 13322, 29898, 932, 29889, 4258, 29918, 3101, 30004, 13, 30004, 13, 2 ]
entity/Server.py
FAWC-bupt/Hotel-Air-Conditioning-Dispatching-System
1
154862
import threading from enum import IntEnum class Mode(IntEnum): Cold = 0 Hot = 1 class WindLevel(IntEnum): NoWind = 0 Level_1 = 1 Level_2 = 2 Level_3 = 3 class Algorithm(IntEnum): Priority = 0 RR = 1 class Server(object): """ 服务器,是单例模式 """ _instance_lock = threading.Lock() AirCondition_num = -1 default_temp = -1 default_mode = -1 default_highest_temp = -1 default_lowest_temp = -1 default_wind_level = -1 SystemTimer = None time_slot = -1 scheduling_algorithm = -1 tariff = -1 airCondition_list = [] user_list = [] administrator_list = [] waiter_list = [] manager_list = [] request_queue = [] request_lock = threading.Lock() @classmethod def instance(cls, *args, **kwargs): with cls._instance_lock: if not hasattr(Server, '_instance'): Server._instance = Server() return Server._instance return Server._instance def __init__(self): self.is_on = False
[ 1, 1053, 3244, 292, 13, 13, 3166, 14115, 1053, 3159, 16854, 13, 13, 13, 1990, 21864, 29898, 2928, 16854, 1125, 13, 1678, 26731, 353, 29871, 29900, 13, 1678, 8843, 353, 29871, 29896, 13, 13, 13, 1990, 17311, 10108, 29898, 2928, 16854, 1125, 13, 1678, 1939, 29956, 513, 353, 29871, 29900, 13, 1678, 21597, 29918, 29896, 353, 29871, 29896, 13, 1678, 21597, 29918, 29906, 353, 29871, 29906, 13, 1678, 21597, 29918, 29941, 353, 29871, 29941, 13, 13, 13, 1990, 29068, 29898, 2928, 16854, 1125, 13, 1678, 22096, 537, 353, 29871, 29900, 13, 1678, 390, 29934, 353, 29871, 29896, 13, 13, 13, 1990, 5656, 29898, 3318, 1125, 13, 1678, 9995, 13, 268, 31520, 31358, 30943, 30214, 30392, 31166, 31507, 31382, 30607, 13, 1678, 9995, 13, 1678, 903, 8758, 29918, 908, 353, 3244, 292, 29889, 16542, 580, 13, 13, 1678, 5593, 25255, 29918, 1949, 353, 448, 29896, 13, 1678, 2322, 29918, 7382, 353, 448, 29896, 13, 1678, 2322, 29918, 8513, 353, 448, 29896, 13, 1678, 2322, 29918, 9812, 342, 29918, 7382, 353, 448, 29896, 13, 1678, 2322, 29918, 677, 342, 29918, 7382, 353, 448, 29896, 13, 1678, 2322, 29918, 14800, 29918, 5563, 353, 448, 29896, 13, 1678, 2184, 14745, 353, 6213, 13, 1678, 931, 29918, 2536, 327, 353, 448, 29896, 13, 1678, 28598, 19478, 29918, 20567, 353, 448, 29896, 13, 1678, 9913, 2593, 353, 448, 29896, 13, 13, 1678, 4799, 25255, 29918, 1761, 353, 5159, 13, 1678, 1404, 29918, 1761, 353, 5159, 13, 1678, 27443, 29918, 1761, 353, 5159, 13, 1678, 4480, 261, 29918, 1761, 353, 5159, 13, 1678, 8455, 29918, 1761, 353, 5159, 13, 1678, 2009, 29918, 9990, 353, 5159, 13, 1678, 2009, 29918, 908, 353, 3244, 292, 29889, 16542, 580, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2777, 29898, 25932, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 411, 1067, 29879, 3032, 8758, 29918, 908, 29901, 13, 9651, 565, 451, 756, 5552, 29898, 6004, 29892, 22868, 8758, 29374, 13, 18884, 5656, 3032, 8758, 353, 5656, 580, 13, 18884, 736, 5656, 3032, 8758, 13, 9651, 736, 5656, 3032, 8758, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 275, 29918, 265, 353, 7700, 13, 2 ]
oompa/tracking/github/GitHubTracker.py
sjtsp2008/oompa
2
123550
<gh_stars>1-10 # # GitHubTracker.py # """ package oompa.tracking.github """ import os import sys import time from datetime import datetime from oompa.tracking.github import github_utils from oompa.tracking.github.GitHub3Helper import GitHub3Helper from oompa.tracking.TagManager import TagManager from oompa.tracking.UpdateLogger import UpdateLogger # xxx temp, during a specific problem - all projects claimed to be forked from github3.empty.Empty import github3 class _Wrapper(dict): pass class GitHubTracker: """ support for tracking users, organizations, fork trees, etc. """ def __init__(self, config): """ XXX what is config? (a dictionary? a real config object?) TODO: need a log """ self.config = config self.githubHelper = GitHub3Helper(config) # sometimes we want to turn this off, for testing from-scratch self.use_etag = True # self.use_etag = False # self.use_etag = None self._updateLogger = None return def _getUpdateLogger(self): if self._updateLogger is not None: return self._updateLogger self._updateLogger = UpdateLogger(self.config) return self._updateLogger def getGithubURL(self, tail): """ return the tail could be "<entity>" (user or org), or "<entity>/<repo>" """ return "https://github.com/%s" % tail def getHTMLAnchorText(self, name): url = self.getGithubURL(name) return '<a href="%s" target="_blank">%s</a>' % ( url, name ) def _showEntityTags(self, entityMetadata): """report tags and description for the given entity in to the report output stream """ self.out_stream.write("\n") entity_url = entityMetadata.getGithubURL() tagInfo = self._tag_mgr.getTags(entity_url) if tagInfo is not None: tags, description = tagInfo # same output whether html or text (for now) # self.out_stream.write(" tags: %s\n" % ( " ".join(tags), )) # self.out_stream.write(" desc: %s\n" % ( description, )) self.out_stream.write(" tags: %s desc: %s\n" % ( " ".join(tags), description )) else: self.out_stream.write(" no tag info yet\n") self.out_stream.write("\n") return def showEntity(self, entityMetadata): """ entityMetadata is an oompa.tracking.github.EntityMetadata """ if self._showed_entity: return if self._format == "html": self.out_stream.write("GitHub entity: %s - %s\n" % ( entityMetadata.kind, self.getHTMLAnchorText(entityMetadata.name), )) else: print("GitHub entity: %-25s (%s)" % ( entityMetadata.name, entityMetadata.kind )) self._showEntityTags(entityMetadata) self._showed_entity = True return def reportListUpdates(self, field, github_obj, entityMetadata, valueAttr): """fetch the list named field for the specified github_obj, and compare with previous results (reporting new, and no-longer) github_obj is a User or Organization """ # depending on field, newValue will be a list of Repository or User objects # TODO: how do we check return code newValue = self.githubHelper.list(field, github_obj, use_etag = self.use_etag) # print("reportListUpdates: %s - %s" % ( entityMetadata.name, field, )) # print(" new: %r" % newValue) if newValue == "no-change": # print (" no change since last check: %s - %s" % ( entityMetadata.name, field, )) return # if not newValue: # print (" no new value: %s - %s" % ( entityMetadata.name, field, )) # return prevValue = entityMetadata.setdefault(field, []) # # note that a lot of "changes" seem to involve empty values # # print (" changed since last check: %s - %s" % ( entityMetadata.name, field, )) # note: i think that newalue is a list of Repository and # prevValue is a list of strings if valueAttr is not None: # XXX hack - if it's a starred repo, need to access value.repository.attr maybe support introspection? if field == "starred_repositories" and valueAttr == "full_name": newValue = [ getattr(value.repository, valueAttr) for value in newValue ] else: newValue = [ getattr(value, valueAttr) for value in newValue ] if "" in newValue: print(" XXX EntityMetadata.reportListUpdates - empty strings in newValue - %s - %s" % ( field, newValue )) print(" not updating local cache") # XXX i think that a list of all empties is a sign # that the rpc failed (but didn't fail well) # we should bail out and try again # newValue = [ value for value in newValue if value != '' ] return pass # ( addedValues, removedValues ) # both are sets if "" in prevValue: print(" reportListUpdates - empty in prevValue %s (i.e., they were stored in db): %r\n" % ( field, prevValue )) # prevValue = [ value for value in prevValue if value != '' ] pass # XXX the lack of writer framework hurts here if self._format == "html": format_link = self.getHTMLAnchorText else: format_link = self.getGithubURL diffs = entityMetadata.getListDiffs(newValue, prevValue) # note that we don't yet render the sets. it just to determine if we want to # show the section header if diffs[0] or diffs[1]: self.showEntity(entityMetadata) if diffs[0] or diffs[1]: entityMetadata.diffLists(field, newValue, prevValue, out_stream = self.out_stream, format_link = format_link) # just because i'm impatient self.out_stream.flush() self._getUpdateLogger().logListUpdates(entityMetadata, field, "added", diffs[0]) self._getUpdateLogger().logListUpdates(entityMetadata, field, "removed", diffs[1]) pass entityMetadata.updateList(field, newValue) return def filterMetadatas(self, entityMetadatas, patterns): """ only yield entities that string-match lower-case TODO: get more clever - globbing """ patterns = [ pattern.lower() for pattern in patterns ] for entityMetadata in entityMetadatas: entityNameLower = entityMetadata.name.lower() for pattern in patterns: if entityNameLower.find(pattern) != -1: yield entityMetadata break pass pass return def listTracking(self, patterns = None): """ yield some or all github entities (users, orgs) currenty being tracked if patterns specified, only yield entities that string-match lower-case """ entityMetadatas = self.githubHelper.getEntityMetadatas(mustExist = False) if patterns: entityMetadatas = self.filterMetadatas(entityMetadatas, patterns) pass for entityMetadata in entityMetadatas: yield "%s/%s" % ( entityMetadata.kind, entityMetadata.name ) pass return def getGithubObject(self, entityMetadata): return self.githubHelper.getGithubObject(entityMetadata.name, entityMetadata.kind) def printRatePointsLeft(self, message): """sugar """ self.githubHelper.printRatePointsLeft(message) return def logAllUpdates(self, *args): # this one will capture the updates, but not render anything xxx # ??? did python 2.7 actually break this? def discoverHtmlFormat(self, *args, verbose = False): """ TODO: use logging package, vs print to stdout """ # TODO: config reportMemberChanges_b = False self._tag_mgr = TagManager(self.config, tags_filename = "entity-tags.tsv") today_yyyymmdd = datetime.today().strftime("%Y%m%d") # XXX allow caller to override defaults dest_folder = os.path.join(os.environ["HOME"], "oompa", "discover") out_path = os.path.join(dest_folder, "%s.discover.html" % today_yyyymmdd) # TODO: make sure folder exists # set this to False if you want to be able to re-run discover from last snapshot # XXX get from config update_metadata = True # update_metadata = False if not update_metadata: print(" *not* flushing entity meta updates yet") print("writing to: %s" % out_path) self.out_stream = open(out_path, "w", encoding = 'utf8') out_stream = self.out_stream out_stream.write('<!DOCTYPE html>\n') out_stream.write('<meta charset="utf-8">\n') out_stream.write('<html>\n') out_stream.write('<head>\n') out_stream.write('<title>Tracker Discover Report - %s</title>\n' % ( today_yyyymmdd, )) out_stream.write('</head>\n') out_stream.write('<body>\n') # XXX temp - should be full html out_stream.write('<pre>\n') helper = self.githubHelper # TODO: pass in an option, maybe a threshold based on number # of repos? this is about rate limit problems for # certain entities if args: print("# not showing initial repos - stil trying to figure out rate limit problem for some entities") showRepos = False else: showRepos = True for entityMetadata in helper.getEntityMetadatas(*args, mustExist = False): # # there are several places which may show the entity the # first time. we only want to show once # self._showed_entity = False if verbose: print("# %-40s (%s)" % ( entityMetadata.name, entityMetadata.kind )) # self.printRatePointsLeft(" rate points before checking entity") github_obj = self.getGithubObject(entityMetadata) if github_obj is None: print("XXX no github_obj: %s %s" % ( entityMetadata.name, entityMetadata.kind )) continue repos = helper.getRepos(github_obj, sort = "time-newest-first") # TODO: switch to generic listing # TODO: support for filtering *anything* through already-known knownRepos = entityMetadata.setdefault("repoNames", []) newRepos = [ repo for repo in repos if repo.full_name not in knownRepos ] if newRepos: self.showEntity(entityMetadata) out_stream.write(" %d new repos\n" % len(newRepos)) if showRepos: out_stream.write("\n") helper.printRepos(repos = newRepos, out_stream = out_stream, format_link = self.getHTMLAnchorText) pass for repo in newRepos: entityMetadata.append("repoNames", repo.full_name) pass # note: this should be the *only* action in recordUpdates, # but helper.printRepos has side-effects of # pulling in extra info about the project (parent and source) self._getUpdateLogger().logUpdates(entityMetadata, "repoNames", newRepos) pass # XXX organizations have followers_count and following_count, but no # followers() or following() if github_obj.type == "User": self.reportListUpdates("followers", github_obj, entityMetadata, "login") self.reportListUpdates("following", github_obj, entityMetadata, "login") self.reportListUpdates("starred_repositories", github_obj, entityMetadata, "full_name") self.reportListUpdates("subscriptions", github_obj, entityMetadata, "full_name") elif github_obj.type == "Organization": if reportMemberChanges_b: self.reportListUpdates("public_members", github_obj, entityMetadata, "login") pass pass if update_metadata: entityMetadata.flush() if self._showed_entity: out_stream.write("\n") pass out_stream.write('</pre>\n') out_stream.write('</body>\n') out_stream.write('</html>\n') if out_stream != sys.stdout: out_stream.close() pass return def _discoverListUpdates(self, field, github_obj, entityMetadata, valueAttr): # depending on field, newValue will be a list of Repository or User objects # TODO: how do we check return code? newValue = self.githubHelper.list(field, github_obj, use_etag = self.use_etag) if newValue == "no-change": # print (" no change since last check: %s - %s" % ( entityMetadata.name, field, )) return prevValue = entityMetadata.setdefault(field, []) # # note that a lot of "changes" seem to involve empty values # # typically, prevValue is list of strings. extract comparable strings # from a list of github things if valueAttr is not None: # TODO: unroll this, to report which objects have the empty value newValue = [ getattr(value, valueAttr) for value in newValue ] # note: some objects have/had empty names. work around that if "" in newValue: print(" XXX EntityMetadata.reportListUpdates - empty strings in newValue - %s - %s" % ( field, newValue )) print(" not updating local cache") # XXX i think that a list of all empties is a sign # that the rpc failed (but didn't fail well) # we should bail out and try again # newValue = [ value for value in newValue if value != '' ] return pass # ( addedValues, removedValues ) # both are sets if "" in prevValue: print(" reportListUpdates - empty in prevValue %s (i.e., they were stored in db): %r\n" % ( field, prevValue )) # prevValue = [ value for value in prevValue if value != '' ] pass diffs = entityMetadata.getListDiffs(newValue, prevValue) if diffs[0] or diffs[1]: for added in diffs[0]: self._getUpdateLogger().logListUpdates(entityMetadata, field, "added", added) pass for removed in diffs[1]: self._getUpdateLogger().logListUpdates(entityMetadata, field, "removed", removed) pass pass entityMetadata.updateList(field, newValue) return def _discoverUpdates(self, *args): """ baby step toward separating update-harvesting from reporting """ updateLogger = self._getUpdateLogger() helper = self.githubHelper # temp, while this is still just a test helper._etags._updateEtags = False update_metadata = True # update_metadata = False for entityMetadata in helper.getEntityMetadatas(*args, mustExist = False): print("# %-40s (%s)" % ( entityMetadata.name, entityMetadata.kind )) # repos is a special kind of list - has an api, vs just a field to query # TODO: switch to generic listing. (is that possible?) # TODO: we should also record "gone" repos github_obj = self.getGithubObject(entityMetadata) # repos = helper.getRepos(github_obj, sort = "time-newest-first") repos = helper.getRepos(github_obj) # TODO: support for filtering *anything* through already-known knownRepos = entityMetadata.setdefault("repoNames", []) newRepos = [ repo for repo in repos if repo.full_name not in knownRepos ] if newRepos: for repo in newRepos: # actually update, so that we don't re-alert entityMetadata.append("repoNames", repo.full_name) # need to do this to pull in proper "pedigree" (forked from, (parent, source) ...) # XXX we don't have a good place to put that data right now repo.refresh() extra_d = {} extra_d["full_name"] = repo.full_name if repo.parent is not None: extra_d["parent"] = repo.parent.full_name if repo.source != repo.parent: extra_d["source"] = repo.source.full_name pass pass updateLogger.logListUpdate(entityMetadata, "repoNames", "added", **extra_d) pass pass # XXX organizations have followers_count and following_count, but no # followers() or following() if github_obj.type == "User": self._discoverListUpdates("followers", github_obj, entityMetadata, "login") self._discoverListUpdates("following", github_obj, entityMetadata, "login") self._discoverListUpdates("starred_repositories", github_obj, entityMetadata, "full_name") self._discoverListUpdates("subscriptions", github_obj, entityMetadata, "full_name") elif github_obj.type == "Organization": self._discoverListUpdates("public_members", github_obj, entityMetadata, "login") # are these not part of organization? # self._discoverListUpdates("followers", github_obj, entityMetadata, "login") # self._discoverListUpdates("following", github_obj, entityMetadata, "login") # self._discoverListUpdates("starred_repositories", github_obj, entityMetadata, "full_name") # self._discoverListUpdates("subscriptions", github_obj, entityMetadata, "full_name") pass if update_metadata: entityMetadata.flush() pass pass self.githubHelper._etags._updateEtags = True return def discover(self, *args, format = None, verbose = False): """either add new github entities (users/groups) to the set you are tracking (if you specify args), or get an update on the entities you are already tracking """ # XXX should use a Writer framework, but i don't expect this to live long - will # go to a db and web server soon # XXX cheating self._format = format if format == "html": self.discoverHtmlFormat(*args, verbose = verbose) return # XXX temp # self.out_stream = sys helper = self.githubHelper # TODO: pass in an option, maybe a threshold based on number # of repos? this is about rate limit problems for # certain entities if args: print("# not showing initial repos - stil trying to figure out rate limit problem for some entities") showRepos = False else: showRepos = True for entityMetadata in helper.getEntityMetadatas(*args, mustExist = False): # XXX self._showed_entity = False if verbose: self.showEntity(entityMetadata) self.printRatePointsLeft(" rate points before checking entity") pass github_obj = self.getGithubObject(entityMetadata) repos = helper.getRepos(github_obj, sort = "time-newest-first") # TODO: switch to generic listing # TODO: support for filtering *anything* through already-known knownRepos = entityMetadata.setdefault("repoNames", []) newRepos = [ repo for repo in repos if repo.full_name not in knownRepos ] if newRepos: self.showEntity(entityMetadata) print(" %d new repos" % len(newRepos)) if showRepos: helper.printRepos(repos = newRepos) pass if newRepos: for repo in newRepos: entityMetadata.append("repoNames", repo.full_name) pass pass # XXX organizations have followers_count and following_count, but no # followers() or following() if github_obj.type == "User": self.reportListUpdates("followers", github_obj, entityMetadata, "login") self.reportListUpdates("following", github_obj, entityMetadata, "login") self.reportListUpdates("starred_repositories", github_obj, entityMetadata, "full_name") elif github_obj.type == "Organization": self.reportListUpdates("public_members", github_obj, entityMetadata, "login") pass entityMetadata.flush() pass return def reportUpdateHTML(self, *args, start_date = None, end_date = None): """ generate html discovery report over some date range from update logs """ from oompa.tracking.github.EntityMetadata import EntityMetadata # XXX cheating self._format = format # TODO: config reportMemberChanges_b = False self._tag_mgr = TagManager(self.config, tags_filename = "entity-tags.tsv") updateLogger = self._getUpdateLogger() helper = self.githubHelper # TODO: use real dateteimes (assuming strings) if start_date == end_date: date_range_str = start_date else: date_range_str = "%s-%s" % ( start_date, end_date ) # XXX allow caller to override defaults dest_folder = os.path.join(os.environ["HOME"], "oompa", "discover") out_path = os.path.join(dest_folder, "%s.discover.html" % date_range_str) if not os.path.exists(dest_folder): os.mkdir(dest_folder) print("writing to: %s" % out_path) # format_link = helper.getGithubURL format_link = self.getHTMLAnchorText self.out_stream = open(out_path, "w", encoding = 'utf8') out_stream = self.out_stream out_stream.write('<!DOCTYPE html>\n') out_stream.write('<meta charset="utf-8">\n') out_stream.write('<html>\n') out_stream.write('<head>\n') out_stream.write('<title>Tracker Discover Report - %s</title>\n' % ( date_range_str, )) out_stream.write('</head>\n') out_stream.write('<body>\n') # XXX temp out_stream.write('<pre>\n') # TODO: if args, pass in a filter updates = updateLogger.getUpdates(start_date = start_date, end_date = end_date) by_entity = updateLogger.organizeUpdatesByEntity(updates) for entity_info in sorted(by_entity.keys()): kind, name = entity_info entityMetadata = EntityMetadata(kind, name, None) # print("# %-40s (%s)" % ( entityMetadata.name, entityMetadata.kind )) self.out_stream.write("%s - %s\n" % ( entityMetadata.kind, self.getHTMLAnchorText(entityMetadata.name), )) self._showEntityTags(entityMetadata) updates_for_entity = by_entity[entity_info] # i'm not sure if i need kind and field, or just field by_field = updateLogger.organizeUpdatesByField(updates_for_entity) fields = sorted(by_field.keys()) for field in fields: out_stream.write(" %s\n" % field) out_stream.write("\n") updates_for_field = by_field[field] if field == "repoNames": for update in updates_for_field: repo_url = format_link(update["full_name"]) out_stream.write(" repo: %s\n" % repo_url) if update.get("parent"): out_stream.write(" forked: %s\n" % format_link(update["parent"])) if update.get("source") != update.get("parent"): out_stream.write(" source: %s\n" % format_link(update["source"])) pass pass out_stream.write("\n") # TODO: README pass pass else: for update in updates_for_field: out_stream.write(" %-8s %s\n" % ( update["action"], format_link(update["full_name"]) )) pass out_stream.write("\n") pass pass out_stream.write("\n") pass out_stream.write('</pre>\n') out_stream.write('</body>\n') out_stream.write('</html>\n') if out_stream != sys.stdout: out_stream.close() pass return def removeEntities(self, entities): """entities is list of entity specs - user/..., org[anization]/..., or un-qualified entity name """ return self.githubHelper.removeEntities(entities) def close(self): self.githubHelper.close() if self._updateLogger is not None: self._updateLogger.close() return pass
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 13, 29937, 25492, 5323, 4937, 29889, 2272, 13, 29937, 13, 13, 15945, 29908, 13, 5113, 288, 290, 3274, 29889, 11294, 292, 29889, 3292, 13, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 931, 13, 13, 3166, 12865, 1053, 12865, 13, 13, 3166, 288, 290, 3274, 29889, 11294, 292, 29889, 3292, 1669, 1053, 18546, 29918, 13239, 13, 3166, 288, 290, 3274, 29889, 11294, 292, 29889, 3292, 29889, 28712, 16046, 29941, 10739, 1053, 25492, 29941, 10739, 13, 13, 3166, 288, 290, 3274, 29889, 11294, 292, 29889, 8176, 3260, 965, 1053, 10522, 3260, 13, 3166, 288, 290, 3274, 29889, 11294, 292, 29889, 6422, 16363, 308, 1053, 10318, 16363, 13, 13, 29937, 921, 4419, 5694, 29892, 2645, 263, 2702, 1108, 448, 599, 9279, 17049, 304, 367, 363, 17713, 515, 18546, 29941, 29889, 6310, 29889, 8915, 13, 5215, 18546, 29941, 13, 13, 13, 1990, 903, 15646, 29898, 8977, 1125, 13, 13, 268, 13, 1678, 1209, 13, 13, 13, 1990, 25492, 5323, 4937, 29901, 13, 1678, 9995, 13, 1678, 2304, 363, 23110, 4160, 29892, 25700, 29892, 27350, 10697, 29892, 2992, 29889, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 9995, 13, 4706, 22615, 825, 338, 2295, 29973, 29871, 313, 29874, 8600, 29973, 29871, 263, 1855, 2295, 1203, 7897, 13, 4706, 14402, 29901, 817, 263, 1480, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 2917, 308, 353, 2295, 13, 4706, 1583, 29889, 3292, 10739, 259, 353, 25492, 29941, 10739, 29898, 2917, 29897, 13, 13, 4706, 396, 6041, 591, 864, 304, 2507, 445, 1283, 29892, 363, 6724, 515, 29899, 10526, 905, 13, 4706, 1583, 29889, 1509, 29918, 300, 351, 353, 5852, 13, 4706, 396, 1583, 29889, 1509, 29918, 300, 351, 353, 7700, 13, 4706, 396, 1583, 29889, 1509, 29918, 300, 351, 353, 6213, 13, 13, 4706, 1583, 3032, 5504, 16363, 29871, 353, 6213, 13, 308, 13, 4706, 736, 13, 13, 13, 1678, 822, 903, 657, 6422, 16363, 29898, 1311, 1125, 13, 13, 4706, 565, 1583, 3032, 5504, 16363, 338, 451, 6213, 29901, 13, 9651, 736, 1583, 3032, 5504, 16363, 13, 13, 4706, 1583, 3032, 5504, 16363, 353, 10318, 16363, 29898, 1311, 29889, 2917, 29897, 13, 308, 13, 4706, 736, 1583, 3032, 5504, 16363, 13, 13, 268, 13, 1678, 822, 679, 29954, 2985, 4219, 29898, 1311, 29892, 12464, 1125, 13, 4706, 9995, 13, 4706, 736, 278, 29871, 13, 13, 4706, 12464, 1033, 367, 9872, 10041, 11903, 313, 1792, 470, 1638, 511, 470, 9872, 10041, 20690, 29966, 20095, 11903, 13, 4706, 9995, 13, 4706, 736, 376, 991, 597, 3292, 29889, 510, 22584, 29879, 29908, 1273, 12464, 13, 13, 268, 13, 1678, 822, 679, 7020, 24458, 1626, 29898, 1311, 29892, 1024, 1125, 13, 13, 4706, 3142, 29871, 353, 1583, 29889, 657, 29954, 2985, 4219, 29898, 978, 29897, 13, 13, 4706, 736, 12801, 29874, 2822, 543, 29995, 29879, 29908, 3646, 543, 29918, 19465, 1013, 29995, 29879, 829, 29874, 16299, 1273, 313, 3142, 29892, 1024, 1723, 13, 13, 13, 1678, 822, 903, 4294, 6691, 28089, 29898, 1311, 29892, 7855, 18417, 1125, 13, 4706, 9995, 12276, 8282, 322, 6139, 363, 278, 2183, 7855, 297, 304, 278, 3461, 13, 4706, 1962, 4840, 13, 13, 4706, 9995, 13, 308, 13, 4706, 1583, 29889, 449, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 13, 4706, 7855, 29918, 2271, 353, 7855, 18417, 29889, 657, 29954, 2985, 4219, 580, 13, 4706, 4055, 3401, 1678, 353, 1583, 3032, 4039, 29918, 29885, 629, 29889, 657, 28089, 29898, 10041, 29918, 2271, 29897, 13, 13, 4706, 565, 4055, 3401, 338, 451, 6213, 29901, 13, 13, 9651, 8282, 29892, 6139, 353, 4055, 3401, 13, 13, 9651, 396, 1021, 1962, 3692, 3472, 470, 1426, 313, 1454, 1286, 29897, 13, 9651, 396, 1583, 29889, 449, 29918, 5461, 29889, 3539, 703, 29871, 8282, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 313, 376, 11393, 7122, 29898, 11338, 511, 29871, 876, 13, 9651, 396, 1583, 29889, 449, 29918, 5461, 29889, 3539, 703, 29871, 5153, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 313, 6139, 29892, 29871, 876, 13, 13, 9651, 1583, 29889, 449, 29918, 5461, 29889, 3539, 703, 29871, 8282, 29901, 1273, 29879, 259, 5153, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 313, 376, 11393, 7122, 29898, 11338, 511, 6139, 29871, 876, 13, 632, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 449, 29918, 5461, 29889, 3539, 703, 29871, 694, 4055, 5235, 3447, 29905, 29876, 1159, 13, 13, 4706, 1583, 29889, 449, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 4706, 736, 13, 268, 13, 268, 13, 1678, 822, 1510, 6691, 29898, 1311, 29892, 7855, 18417, 1125, 13, 4706, 9995, 13, 4706, 7855, 18417, 338, 385, 288, 290, 3274, 29889, 11294, 292, 29889, 3292, 29889, 6691, 18417, 13, 4706, 9995, 13, 308, 13, 4706, 565, 1583, 3032, 4294, 287, 29918, 10041, 29901, 13, 9651, 736, 13, 308, 13, 4706, 565, 1583, 3032, 4830, 1275, 376, 1420, 1115, 13, 9651, 1583, 29889, 449, 29918, 5461, 29889, 3539, 703, 28712, 16046, 7855, 29901, 1273, 29879, 448, 1273, 29879, 29905, 29876, 29908, 1273, 313, 13, 18884, 7855, 18417, 29889, 14380, 29892, 1583, 29889, 657, 7020, 24458, 1626, 29898, 10041, 18417, 29889, 978, 511, 29871, 876, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 28712, 16046, 7855, 29901, 1273, 29899, 29906, 29945, 29879, 313, 29995, 29879, 5513, 1273, 313, 7855, 18417, 29889, 978, 29892, 7855, 18417, 29889, 14380, 29871, 876, 13, 13, 4706, 1583, 3032, 4294, 6691, 28089, 29898, 10041, 18417, 29897, 13, 308, 13, 4706, 1583, 3032, 4294, 287, 29918, 10041, 353, 5852, 13, 632, 13, 4706, 736, 13, 268, 13, 13, 268, 13, 1678, 822, 3461, 1293, 3373, 15190, 29898, 1311, 29892, 1746, 29892, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 995, 25098, 1125, 13, 4706, 9995, 9155, 278, 1051, 4257, 1746, 363, 278, 6790, 18546, 29918, 5415, 29892, 322, 13, 4706, 7252, 411, 3517, 2582, 313, 12276, 292, 716, 29892, 322, 694, 29899, 5426, 261, 29897, 13, 308, 13, 4706, 18546, 29918, 5415, 338, 263, 4911, 470, 9205, 2133, 13, 4706, 9995, 13, 13, 4706, 396, 8679, 373, 1746, 29892, 716, 1917, 674, 367, 263, 1051, 310, 830, 7036, 470, 4911, 3618, 13, 4706, 396, 259, 14402, 29901, 920, 437, 591, 1423, 736, 775, 13, 4706, 716, 1917, 353, 1583, 29889, 3292, 10739, 29889, 1761, 29898, 2671, 29892, 13, 462, 462, 3986, 18546, 29918, 5415, 29892, 13, 462, 462, 3986, 671, 29918, 300, 351, 353, 1583, 29889, 1509, 29918, 300, 351, 29897, 13, 13, 4706, 396, 1596, 703, 12276, 1293, 3373, 15190, 29901, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 1746, 29892, 29871, 876, 13, 4706, 396, 1596, 703, 259, 716, 29901, 1273, 29878, 29908, 1273, 716, 1917, 29897, 13, 13, 4706, 565, 716, 1917, 1275, 376, 1217, 29899, 3167, 1115, 13, 9651, 396, 1596, 4852, 259, 694, 1735, 1951, 1833, 1423, 29901, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 1746, 29892, 29871, 876, 13, 9651, 736, 13, 308, 13, 4706, 396, 565, 451, 716, 1917, 29901, 13, 4706, 396, 1678, 1596, 4852, 259, 694, 716, 995, 29901, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 1746, 29892, 29871, 876, 13, 4706, 396, 1678, 736, 13, 13, 4706, 12379, 1917, 353, 7855, 18417, 29889, 842, 4381, 29898, 2671, 29892, 518, 2314, 13, 13, 4706, 396, 13, 4706, 396, 4443, 393, 263, 3287, 310, 376, 25990, 29908, 2833, 304, 25135, 4069, 1819, 13, 4706, 396, 13, 4706, 396, 1596, 4852, 418, 3939, 1951, 1833, 1423, 29901, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 1746, 29892, 29871, 876, 13, 308, 13, 4706, 396, 4443, 29901, 474, 1348, 393, 716, 284, 434, 338, 263, 1051, 310, 830, 7036, 322, 13, 4706, 396, 12379, 1917, 338, 263, 1051, 310, 6031, 13, 13, 4706, 565, 995, 25098, 338, 451, 6213, 29901, 13, 13, 9651, 396, 22615, 15833, 448, 565, 372, 29915, 29879, 263, 5810, 1127, 13761, 29892, 817, 304, 2130, 995, 29889, 19033, 29889, 5552, 5505, 2304, 25956, 27988, 29973, 13, 9651, 565, 1746, 1275, 376, 8508, 1127, 29918, 276, 1066, 20106, 29908, 322, 995, 25098, 1275, 376, 8159, 29918, 978, 1115, 13, 18884, 716, 1917, 353, 518, 679, 5552, 29898, 1767, 29889, 19033, 29892, 995, 25098, 29897, 363, 995, 297, 716, 1917, 4514, 13, 9651, 1683, 29901, 13, 18884, 716, 1917, 353, 518, 679, 5552, 29898, 1767, 29892, 995, 25098, 29897, 363, 995, 297, 716, 1917, 4514, 13, 13, 9651, 565, 5124, 297, 716, 1917, 29901, 13, 18884, 1596, 703, 29871, 22615, 14945, 18417, 29889, 12276, 1293, 3373, 15190, 448, 4069, 6031, 297, 716, 1917, 448, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 1746, 29892, 716, 1917, 29871, 876, 13, 18884, 1596, 703, 4706, 451, 13271, 1887, 7090, 1159, 13, 18884, 396, 22615, 474, 1348, 393, 263, 1051, 310, 599, 953, 415, 583, 338, 263, 1804, 13, 18884, 396, 268, 393, 278, 364, 6739, 5229, 313, 4187, 3282, 29915, 29873, 4418, 1532, 29897, 13, 18884, 396, 268, 591, 881, 289, 737, 714, 322, 1018, 1449, 13, 18884, 396, 716, 1917, 353, 518, 995, 363, 995, 297, 716, 1917, 565, 995, 2804, 6629, 4514, 13, 18884, 736, 13, 13, 9651, 1209, 13, 13, 4706, 396, 313, 2715, 9065, 29892, 6206, 9065, 1723, 13, 4706, 396, 1678, 1716, 526, 6166, 13, 13, 4706, 565, 5124, 297, 12379, 1917, 29901, 13, 9651, 1596, 703, 29871, 3461, 1293, 3373, 15190, 448, 4069, 297, 12379, 1917, 1273, 29879, 313, 29875, 29889, 29872, 1696, 896, 892, 6087, 297, 4833, 1125, 1273, 29878, 29905, 29876, 29908, 1273, 313, 1746, 29892, 12379, 1917, 29871, 876, 13, 9651, 396, 12379, 1917, 353, 518, 995, 363, 995, 297, 12379, 1917, 565, 995, 2804, 6629, 4514, 13, 9651, 1209, 13, 308, 13, 4706, 396, 22615, 278, 10225, 310, 9227, 6890, 12166, 1372, 1244, 13, 4706, 565, 1583, 3032, 4830, 1275, 376, 1420, 1115, 13, 9651, 3402, 29918, 2324, 353, 1583, 29889, 657, 7020, 24458, 1626, 13, 4706, 1683, 29901, 13, 9651, 3402, 29918, 2324, 353, 1583, 29889, 657, 29954, 2985, 4219, 13, 13, 4706, 2923, 29879, 353, 7855, 18417, 29889, 657, 1293, 26023, 29879, 29898, 1482, 1917, 29892, 13, 462, 462, 9651, 12379, 1917, 29897, 13, 13, 4706, 396, 4443, 393, 591, 1016, 29915, 29873, 3447, 4050, 278, 6166, 29889, 29871, 372, 925, 304, 8161, 565, 591, 864, 304, 13, 4706, 396, 1510, 278, 4004, 4839, 13, 308, 13, 4706, 565, 2923, 29879, 29961, 29900, 29962, 470, 2923, 29879, 29961, 29896, 5387, 13, 9651, 1583, 29889, 4294, 6691, 29898, 10041, 18417, 29897, 13, 13, 4706, 565, 2923, 29879, 29961, 29900, 29962, 470, 2923, 29879, 29961, 29896, 5387, 13, 9651, 7855, 18417, 29889, 12765, 1293, 29879, 29898, 2671, 29892, 13, 462, 462, 268, 716, 1917, 29892, 13, 462, 462, 268, 12379, 1917, 29892, 13, 462, 462, 268, 714, 29918, 5461, 29871, 353, 1583, 29889, 449, 29918, 5461, 29892, 13, 462, 462, 268, 3402, 29918, 2324, 353, 3402, 29918, 2324, 29897, 13, 9651, 396, 925, 1363, 474, 29915, 29885, 2411, 271, 993, 13, 9651, 1583, 29889, 449, 29918, 5461, 29889, 23126, 580, 13, 13, 9651, 1583, 3032, 657, 6422, 16363, 2141, 1188, 1293, 3373, 15190, 29898, 10041, 18417, 29892, 1746, 29892, 376, 23959, 613, 259, 2923, 29879, 29961, 29900, 2314, 13, 9651, 1583, 3032, 657, 6422, 16363, 2141, 1188, 1293, 3373, 15190, 29898, 10041, 18417, 29892, 1746, 29892, 376, 1745, 8238, 613, 2923, 29879, 29961, 29896, 2314, 13, 13, 9651, 1209, 13, 632, 13, 4706, 7855, 18417, 29889, 5504, 1293, 29898, 2671, 29892, 716, 1917, 29897, 13, 13, 4706, 736, 13, 462, 13, 13, 13, 1678, 822, 4175, 10095, 328, 271, 294, 29898, 1311, 29892, 7855, 10095, 328, 271, 294, 29892, 15038, 1125, 13, 4706, 9995, 13, 4706, 871, 7709, 16212, 393, 1347, 29899, 4352, 5224, 29899, 4878, 13, 4706, 14402, 29901, 679, 901, 23455, 448, 15482, 1327, 292, 13, 13, 4706, 9995, 13, 13, 4706, 15038, 353, 518, 4766, 29889, 13609, 580, 363, 4766, 297, 15038, 4514, 13, 13, 4706, 363, 7855, 18417, 297, 7855, 10095, 328, 271, 294, 29901, 13, 9651, 7855, 1170, 19357, 353, 7855, 18417, 29889, 978, 29889, 13609, 580, 13, 9651, 363, 4766, 297, 15038, 29901, 13, 18884, 565, 7855, 1170, 19357, 29889, 2886, 29898, 11037, 29897, 2804, 448, 29896, 29901, 13, 462, 1678, 7709, 7855, 18417, 13, 462, 1678, 2867, 13, 18884, 1209, 13, 9651, 1209, 13, 13, 4706, 736, 13, 308, 13, 308, 13, 1678, 822, 1051, 17936, 292, 29898, 1311, 29892, 15038, 353, 6213, 1125, 13, 4706, 9995, 13, 4706, 7709, 777, 470, 599, 18546, 16212, 313, 7193, 29892, 1638, 29879, 29897, 1857, 29891, 1641, 5702, 287, 13, 13, 4706, 565, 15038, 6790, 29892, 871, 7709, 16212, 393, 1347, 29899, 4352, 5224, 29899, 4878, 13, 13, 4706, 9995, 13, 13, 4706, 7855, 10095, 328, 271, 294, 353, 1583, 29889, 3292, 10739, 29889, 657, 6691, 10095, 328, 271, 294, 29898, 21969, 1252, 391, 353, 7700, 29897, 13, 632, 13, 4706, 565, 15038, 29901, 13, 9651, 7855, 10095, 328, 271, 294, 353, 1583, 29889, 4572, 10095, 328, 271, 294, 29898, 10041, 10095, 328, 271, 294, 29892, 15038, 29897, 13, 9651, 1209, 13, 13, 4706, 363, 7855, 18417, 297, 7855, 10095, 328, 271, 294, 29901, 13, 9651, 7709, 11860, 29879, 22584, 29879, 29908, 1273, 313, 7855, 18417, 29889, 14380, 29892, 7855, 18417, 29889, 978, 1723, 13, 9651, 1209, 13, 13, 4706, 736, 13, 13, 13, 1678, 822, 679, 29954, 2985, 2061, 29898, 1311, 29892, 7855, 18417, 1125, 13, 13, 4706, 736, 1583, 29889, 3292, 10739, 29889, 657, 29954, 2985, 2061, 29898, 10041, 18417, 29889, 978, 29892, 13, 462, 462, 462, 7855, 18417, 29889, 14380, 29897, 13, 268, 13, 13, 1678, 822, 1596, 19907, 20325, 8091, 29898, 1311, 29892, 2643, 1125, 13, 4706, 9995, 29879, 688, 279, 13, 4706, 9995, 13, 4706, 1583, 29889, 3292, 10739, 29889, 2158, 19907, 20325, 8091, 29898, 4906, 29897, 13, 4706, 736, 13, 13, 13, 1678, 822, 1480, 3596, 3373, 15190, 29898, 1311, 29892, 334, 5085, 1125, 13, 13, 4706, 396, 445, 697, 674, 10446, 278, 11217, 29892, 541, 451, 4050, 3099, 13, 4706, 921, 4419, 13, 13, 13, 1678, 396, 1577, 8773, 1258, 3017, 29871, 29906, 29889, 29955, 2869, 2867, 445, 29973, 13, 1678, 822, 6523, 10922, 5809, 29898, 1311, 29892, 334, 5085, 29892, 26952, 353, 7700, 1125, 13, 4706, 9995, 13, 13, 4706, 14402, 29901, 671, 12183, 3577, 29892, 7186, 1596, 304, 27591, 13, 4706, 9995, 13, 13, 4706, 396, 14402, 29901, 2295, 13, 4706, 3461, 13404, 21459, 29918, 29890, 353, 7700, 13, 308, 13, 4706, 1583, 3032, 4039, 29918, 29885, 629, 29871, 353, 10522, 3260, 29898, 1311, 29889, 2917, 29892, 13, 462, 462, 1678, 8282, 29918, 9507, 353, 376, 10041, 29899, 11338, 29889, 1372, 29894, 1159, 13, 13, 4706, 9826, 29918, 8071, 29891, 962, 29885, 1289, 353, 12865, 29889, 27765, 2141, 710, 615, 603, 11702, 29979, 29995, 29885, 29995, 29881, 1159, 13, 308, 13, 4706, 396, 22615, 2758, 24959, 304, 5712, 21274, 13, 4706, 2731, 29918, 12083, 1678, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 21813, 3366, 17353, 12436, 376, 29667, 3274, 613, 376, 2218, 11911, 1159, 13, 4706, 714, 29918, 2084, 539, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7854, 29918, 12083, 29892, 11860, 29879, 29889, 2218, 11911, 29889, 1420, 29908, 1273, 9826, 29918, 8071, 29891, 962, 29885, 1289, 29897, 13, 13, 4706, 396, 14402, 29901, 1207, 1854, 4138, 4864, 13, 308, 13, 4706, 396, 731, 445, 304, 7700, 565, 366, 864, 304, 367, 2221, 304, 337, 29899, 3389, 6523, 515, 1833, 22395, 13, 4706, 396, 22615, 679, 515, 2295, 13, 308, 13, 4706, 2767, 29918, 19635, 353, 5852, 13, 4706, 396, 2767, 29918, 19635, 353, 7700, 13, 13, 4706, 565, 451, 2767, 29918, 19635, 29901, 13, 9651, 1596, 703, 29871, 334, 1333, 29930, 1652, 21616, 7855, 12700, 11217, 3447, 1159, 13, 13, 4706, 1596, 703, 16554, 304, 29901, 1273, 29879, 29908, 1273, 714, 29918, 2084, 29897, 13, 13, 4706, 1583, 29889, 449, 29918, 5461, 353, 1722, 29898, 449, 29918, 2084, 29892, 376, 29893, 613, 8025, 353, 525, 9420, 29947, 1495, 13, 13, 4706, 714, 29918, 5461, 353, 1583, 29889, 449, 29918, 5461, 13, 308, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 29991, 21300, 3472, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 7299, 17425, 543, 9420, 29899, 29947, 1013, 29905, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 1420, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 2813, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 3257, 29958, 5323, 4937, 8565, 957, 13969, 448, 1273, 29879, 829, 3257, 14247, 29876, 29915, 1273, 313, 9826, 29918, 8071, 29891, 962, 29885, 1289, 29892, 29871, 876, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 2813, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 2587, 14247, 29876, 1495, 13, 13, 4706, 396, 22615, 5694, 448, 881, 367, 2989, 3472, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 1457, 14247, 29876, 1495, 13, 308, 13, 4706, 16876, 353, 1583, 29889, 3292, 10739, 13, 13, 4706, 396, 14402, 29901, 1209, 297, 385, 2984, 29892, 5505, 263, 16897, 2729, 373, 1353, 13, 4706, 396, 539, 310, 17573, 29973, 29871, 445, 338, 1048, 6554, 4046, 4828, 363, 13, 4706, 396, 539, 3058, 16212, 13, 13, 4706, 565, 6389, 29901, 13, 9651, 1596, 14822, 451, 6445, 2847, 17573, 448, 380, 309, 1811, 304, 4377, 714, 6554, 4046, 1108, 363, 777, 16212, 1159, 13, 9651, 1510, 10913, 353, 7700, 13, 4706, 1683, 29901, 13, 9651, 1510, 10913, 353, 5852, 13, 13, 4706, 363, 7855, 18417, 297, 16876, 29889, 657, 6691, 10095, 328, 271, 294, 10456, 5085, 29892, 1818, 1252, 391, 353, 7700, 1125, 13, 632, 13, 9651, 396, 13, 9651, 396, 727, 526, 3196, 7600, 607, 1122, 1510, 278, 7855, 278, 13, 9651, 396, 937, 931, 29889, 29871, 591, 871, 864, 304, 1510, 2748, 13, 9651, 396, 13, 9651, 1583, 3032, 4294, 287, 29918, 10041, 353, 7700, 13, 13, 9651, 565, 26952, 29901, 13, 18884, 1596, 14822, 1273, 29899, 29946, 29900, 29879, 313, 29995, 29879, 5513, 1273, 313, 7855, 18417, 29889, 978, 29892, 7855, 18417, 29889, 14380, 29871, 876, 13, 13, 18884, 396, 1583, 29889, 2158, 19907, 20325, 8091, 703, 29871, 6554, 3291, 1434, 8454, 7855, 1159, 13, 13, 9651, 18546, 29918, 5415, 29871, 353, 1583, 29889, 657, 29954, 2985, 2061, 29898, 10041, 18417, 29897, 13, 13, 9651, 565, 18546, 29918, 5415, 338, 6213, 29901, 13, 18884, 1596, 703, 22791, 694, 18546, 29918, 5415, 29901, 1273, 29879, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 7855, 18417, 29889, 14380, 29871, 876, 13, 18884, 6773, 13, 9651, 17573, 539, 353, 16876, 29889, 657, 10913, 29898, 3292, 29918, 5415, 29892, 2656, 353, 376, 2230, 29899, 1482, 342, 29899, 4102, 1159, 13, 13, 9651, 396, 14402, 29901, 4607, 304, 10035, 18028, 13, 9651, 396, 14402, 29901, 2304, 363, 21166, 334, 1384, 1918, 29930, 1549, 2307, 29899, 5203, 13, 9651, 2998, 10913, 29871, 353, 7855, 18417, 29889, 842, 4381, 703, 20095, 8659, 613, 518, 2314, 13, 9651, 716, 10913, 1678, 353, 518, 13761, 363, 13761, 297, 17573, 565, 13761, 29889, 8159, 29918, 978, 451, 297, 2998, 10913, 4514, 13, 13, 9651, 565, 716, 10913, 29901, 13, 18884, 1583, 29889, 4294, 6691, 29898, 10041, 18417, 29897, 13, 18884, 714, 29918, 5461, 29889, 3539, 703, 29871, 1273, 29881, 716, 17573, 29905, 29876, 29908, 1273, 7431, 29898, 1482, 10913, 876, 13, 13, 18884, 565, 1510, 10913, 29901, 13, 462, 1678, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 462, 1678, 16876, 29889, 2158, 10913, 29898, 276, 1066, 539, 353, 716, 10913, 29892, 13, 462, 462, 418, 714, 29918, 5461, 29871, 353, 714, 29918, 5461, 29892, 13, 462, 462, 418, 3402, 29918, 2324, 353, 1583, 29889, 657, 7020, 24458, 1626, 29897, 13, 462, 1678, 1209, 13, 13, 18884, 363, 13761, 297, 716, 10913, 29901, 13, 462, 1678, 7855, 18417, 29889, 4397, 703, 20095, 8659, 613, 13761, 29889, 8159, 29918, 978, 29897, 13, 462, 1678, 1209, 13, 13, 18884, 396, 4443, 29901, 445, 881, 367, 278, 334, 6194, 29930, 3158, 297, 2407, 3373, 15190, 29892, 13, 18884, 396, 539, 541, 16876, 29889, 2158, 10913, 756, 2625, 29899, 15987, 29879, 310, 13, 18884, 396, 539, 28420, 297, 4805, 5235, 1048, 278, 2060, 313, 3560, 322, 2752, 29897, 13, 18884, 1583, 3032, 657, 6422, 16363, 2141, 1188, 3373, 15190, 29898, 10041, 18417, 29892, 376, 20095, 8659, 613, 716, 10913, 29897, 13, 18884, 1209, 13, 13, 9651, 396, 22615, 25700, 505, 1101, 414, 29918, 2798, 322, 1494, 29918, 2798, 29892, 541, 694, 13, 9651, 396, 268, 1101, 414, 580, 470, 1494, 580, 13, 13, 9651, 565, 18546, 29918, 5415, 29889, 1853, 1275, 376, 2659, 1115, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 23031, 414, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 23031, 292, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 8508, 1127, 29918, 276, 1066, 20106, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 1491, 7588, 1980, 613, 4706, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 9651, 25342, 18546, 29918, 5415, 29889, 1853, 1275, 376, 27356, 2133, 1115, 13, 13, 18884, 565, 3461, 13404, 21459, 29918, 29890, 29901, 13, 462, 1678, 1583, 29889, 12276, 1293, 3373, 15190, 703, 3597, 29918, 28109, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 462, 1678, 1209, 13, 18884, 1209, 13, 13, 9651, 565, 2767, 29918, 19635, 29901, 13, 18884, 7855, 18417, 29889, 23126, 580, 13, 13, 9651, 565, 1583, 3032, 4294, 287, 29918, 10041, 29901, 13, 18884, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 462, 13, 9651, 1209, 13, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 1457, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 2587, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 1420, 14247, 29876, 1495, 13, 13, 4706, 565, 714, 29918, 5461, 2804, 10876, 29889, 25393, 29901, 13, 9651, 714, 29918, 5461, 29889, 5358, 580, 13, 9651, 1209, 13, 308, 13, 4706, 736, 13, 13, 13, 1678, 822, 903, 2218, 11911, 1293, 3373, 15190, 29898, 1311, 29892, 1746, 29892, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 995, 25098, 1125, 13, 13, 4706, 396, 8679, 373, 1746, 29892, 716, 1917, 674, 367, 263, 1051, 310, 830, 7036, 470, 4911, 3618, 13, 4706, 396, 259, 14402, 29901, 920, 437, 591, 1423, 736, 775, 29973, 13, 4706, 716, 1917, 353, 1583, 29889, 3292, 10739, 29889, 1761, 29898, 2671, 29892, 13, 462, 462, 3986, 18546, 29918, 5415, 29892, 13, 462, 462, 3986, 671, 29918, 300, 351, 353, 1583, 29889, 1509, 29918, 300, 351, 29897, 13, 13, 4706, 565, 716, 1917, 1275, 376, 1217, 29899, 3167, 1115, 13, 9651, 396, 1596, 4852, 259, 694, 1735, 1951, 1833, 1423, 29901, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 7855, 18417, 29889, 978, 29892, 1746, 29892, 29871, 876, 13, 9651, 736, 13, 308, 13, 4706, 12379, 1917, 353, 7855, 18417, 29889, 842, 4381, 29898, 2671, 29892, 518, 2314, 13, 13, 4706, 396, 13, 4706, 396, 4443, 393, 263, 3287, 310, 376, 25990, 29908, 2833, 304, 25135, 4069, 1819, 13, 4706, 396, 13, 13, 4706, 396, 12234, 29892, 12379, 1917, 338, 1051, 310, 6031, 29889, 29871, 6597, 5734, 519, 6031, 13, 4706, 396, 515, 263, 1051, 310, 18546, 2712, 13, 13, 4706, 565, 995, 25098, 338, 451, 6213, 29901, 13, 13, 9651, 396, 14402, 29901, 443, 1245, 445, 29892, 304, 3461, 607, 3618, 505, 278, 4069, 995, 13, 9651, 716, 1917, 353, 518, 679, 5552, 29898, 1767, 29892, 995, 25098, 29897, 363, 995, 297, 716, 1917, 4514, 13, 13, 9651, 396, 4443, 29901, 777, 3618, 505, 29914, 21312, 4069, 2983, 29889, 29871, 664, 2820, 393, 13, 13, 9651, 565, 5124, 297, 716, 1917, 29901, 13, 18884, 1596, 703, 29871, 22615, 14945, 18417, 29889, 12276, 1293, 3373, 15190, 448, 4069, 6031, 297, 716, 1917, 448, 1273, 29879, 448, 1273, 29879, 29908, 1273, 313, 1746, 29892, 716, 1917, 29871, 876, 13, 18884, 1596, 703, 4706, 451, 13271, 1887, 7090, 1159, 13, 18884, 396, 22615, 474, 1348, 393, 263, 1051, 310, 599, 953, 415, 583, 338, 263, 1804, 13, 18884, 396, 268, 393, 278, 364, 6739, 5229, 313, 4187, 3282, 29915, 29873, 4418, 1532, 29897, 13, 18884, 396, 268, 591, 881, 289, 737, 714, 322, 1018, 1449, 13, 18884, 396, 716, 1917, 353, 518, 995, 363, 995, 297, 716, 1917, 565, 995, 2804, 6629, 4514, 13, 18884, 736, 13, 13, 9651, 1209, 13, 13, 4706, 396, 313, 2715, 9065, 29892, 6206, 9065, 1723, 13, 4706, 396, 1678, 1716, 526, 6166, 13, 13, 4706, 565, 5124, 297, 12379, 1917, 29901, 13, 9651, 1596, 703, 29871, 3461, 1293, 3373, 15190, 448, 4069, 297, 12379, 1917, 1273, 29879, 313, 29875, 29889, 29872, 1696, 896, 892, 6087, 297, 4833, 1125, 1273, 29878, 29905, 29876, 29908, 1273, 313, 1746, 29892, 12379, 1917, 29871, 876, 13, 9651, 396, 12379, 1917, 353, 518, 995, 363, 995, 297, 12379, 1917, 565, 995, 2804, 6629, 4514, 13, 9651, 1209, 13, 13, 4706, 2923, 29879, 353, 7855, 18417, 29889, 657, 1293, 26023, 29879, 29898, 1482, 1917, 29892, 13, 462, 462, 9651, 12379, 1917, 29897, 13, 13, 4706, 565, 2923, 29879, 29961, 29900, 29962, 470, 2923, 29879, 29961, 29896, 5387, 13, 13, 9651, 363, 2715, 297, 2923, 29879, 29961, 29900, 5387, 13, 18884, 1583, 3032, 657, 6422, 16363, 2141, 1188, 1293, 3373, 15190, 29898, 10041, 18417, 29892, 1746, 29892, 376, 23959, 613, 259, 2715, 29897, 13, 18884, 1209, 13, 632, 13, 9651, 363, 6206, 297, 2923, 29879, 29961, 29896, 5387, 13, 18884, 1583, 3032, 657, 6422, 16363, 2141, 1188, 1293, 3373, 15190, 29898, 10041, 18417, 29892, 1746, 29892, 376, 1745, 8238, 613, 6206, 29897, 13, 18884, 1209, 13, 9651, 1209, 13, 632, 13, 4706, 7855, 18417, 29889, 5504, 1293, 29898, 2671, 29892, 716, 1917, 29897, 13, 13, 4706, 736, 13, 13, 268, 13, 1678, 822, 903, 2218, 11911, 3373, 15190, 29898, 1311, 29892, 334, 5085, 1125, 13, 4706, 9995, 13, 4706, 24354, 4331, 11183, 2903, 1218, 2767, 29899, 8222, 10147, 292, 515, 23415, 13, 4706, 9995, 13, 13, 4706, 2767, 16363, 353, 1583, 3032, 657, 6422, 16363, 580, 13, 4706, 16876, 539, 353, 1583, 29889, 3292, 10739, 13, 13, 4706, 396, 5694, 29892, 1550, 445, 338, 1603, 925, 263, 1243, 13, 4706, 16876, 3032, 300, 810, 3032, 5504, 29923, 11338, 353, 7700, 13, 13, 4706, 2767, 29918, 19635, 353, 5852, 13, 4706, 396, 2767, 29918, 19635, 353, 7700, 13, 13, 4706, 363, 7855, 18417, 297, 16876, 29889, 657, 6691, 10095, 328, 271, 294, 10456, 5085, 29892, 1818, 1252, 391, 353, 7700, 1125, 13, 632, 13, 9651, 1596, 14822, 1273, 29899, 29946, 29900, 29879, 313, 29995, 29879, 5513, 1273, 313, 7855, 18417, 29889, 978, 29892, 7855, 18417, 29889, 14380, 29871, 876, 13, 13, 9651, 396, 17573, 338, 263, 4266, 2924, 310, 1051, 448, 756, 385, 7882, 29892, 7186, 925, 263, 1746, 304, 2346, 13, 9651, 396, 14402, 29901, 4607, 304, 10035, 18028, 29889, 29871, 313, 275, 393, 1950, 7897, 13, 9651, 396, 14402, 29901, 591, 881, 884, 2407, 376, 29887, 650, 29908, 17573, 13, 13, 9651, 18546, 29918, 5415, 29871, 353, 1583, 29889, 657, 29954, 2985, 2061, 29898, 10041, 18417, 29897, 13, 9651, 396, 17573, 539, 353, 16876, 29889, 657, 10913, 29898, 3292, 29918, 5415, 29892, 2656, 353, 376, 2230, 29899, 1482, 342, 29899, 4102, 1159, 13, 9651, 17573, 539, 353, 16876, 29889, 657, 10913, 29898, 3292, 29918, 5415, 29897, 13, 13, 9651, 396, 14402, 29901, 2304, 363, 21166, 334, 1384, 1918, 29930, 1549, 2307, 29899, 5203, 13, 9651, 2998, 10913, 29871, 353, 7855, 18417, 29889, 842, 4381, 703, 20095, 8659, 613, 518, 2314, 13, 9651, 716, 10913, 1678, 353, 518, 13761, 363, 13761, 297, 17573, 565, 13761, 29889, 8159, 29918, 978, 451, 297, 2998, 10913, 4514, 13, 13, 9651, 565, 716, 10913, 29901, 13, 13, 18884, 363, 13761, 297, 716, 10913, 29901, 13, 13, 462, 1678, 396, 2869, 2767, 29892, 577, 393, 591, 1016, 29915, 29873, 337, 29899, 12888, 13, 462, 1678, 7855, 18417, 29889, 4397, 703, 20095, 8659, 613, 13761, 29889, 8159, 29918, 978, 29897, 13, 13, 462, 1678, 396, 817, 304, 437, 445, 304, 8206, 297, 1571, 376, 9795, 335, 929, 29908, 313, 29888, 548, 287, 515, 29892, 313, 3560, 29892, 2752, 29897, 29757, 13, 462, 1678, 396, 22615, 591, 1016, 29915, 29873, 505, 263, 1781, 2058, 304, 1925, 393, 848, 1492, 1286, 13, 462, 1678, 13761, 29889, 22379, 580, 13, 13, 462, 1678, 4805, 29918, 29881, 353, 6571, 13, 13, 462, 1678, 4805, 29918, 29881, 3366, 8159, 29918, 978, 3108, 353, 13761, 29889, 8159, 29918, 978, 13, 13, 462, 1678, 565, 13761, 29889, 3560, 338, 451, 6213, 29901, 13, 462, 4706, 4805, 29918, 29881, 3366, 3560, 3108, 353, 13761, 29889, 3560, 29889, 8159, 29918, 978, 13, 462, 4706, 565, 13761, 29889, 4993, 2804, 13761, 29889, 3560, 29901, 13, 462, 9651, 4805, 29918, 29881, 3366, 4993, 3108, 353, 13761, 29889, 4993, 29889, 8159, 29918, 978, 13, 462, 9651, 1209, 13, 462, 4706, 1209, 13, 462, 268, 13, 462, 1678, 2767, 16363, 29889, 1188, 1293, 6422, 29898, 10041, 18417, 29892, 13, 462, 462, 1669, 376, 20095, 8659, 613, 13, 462, 462, 1669, 376, 23959, 613, 13, 462, 462, 1669, 3579, 17833, 29918, 29881, 29897, 13, 462, 1678, 1209, 13, 18884, 1209, 13, 13, 9651, 396, 22615, 25700, 505, 1101, 414, 29918, 2798, 322, 1494, 29918, 2798, 29892, 541, 694, 13, 9651, 396, 268, 1101, 414, 580, 470, 1494, 580, 13, 13, 9651, 565, 18546, 29918, 5415, 29889, 1853, 1275, 376, 2659, 1115, 13, 18884, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 23031, 414, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 23031, 292, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 8508, 1127, 29918, 276, 1066, 20106, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 18884, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 1491, 7588, 1980, 613, 4706, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 9651, 25342, 18546, 29918, 5415, 29889, 1853, 1275, 376, 27356, 2133, 1115, 13, 18884, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 3597, 29918, 28109, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 13, 18884, 396, 526, 1438, 451, 760, 310, 13013, 29973, 13, 18884, 396, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 23031, 414, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 396, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 23031, 292, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 396, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 8508, 1127, 29918, 276, 1066, 20106, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 18884, 396, 1583, 3032, 2218, 11911, 1293, 3373, 15190, 703, 1491, 7588, 1980, 613, 4706, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 18884, 1209, 13, 13, 9651, 565, 2767, 29918, 19635, 29901, 13, 18884, 7855, 18417, 29889, 23126, 580, 13, 18884, 1209, 13, 9651, 1209, 13, 308, 13, 4706, 1583, 29889, 3292, 10739, 3032, 300, 810, 3032, 5504, 29923, 11338, 353, 5852, 13, 13, 4706, 736, 13, 308, 13, 13, 13, 268, 13, 1678, 822, 6523, 29898, 1311, 29892, 334, 5085, 29892, 3402, 353, 6213, 29892, 26952, 353, 7700, 1125, 13, 4706, 9995, 29872, 2121, 788, 716, 18546, 16212, 313, 7193, 29914, 13155, 29897, 304, 278, 731, 366, 13, 4706, 526, 23110, 313, 361, 366, 6084, 6389, 511, 470, 679, 385, 2767, 373, 278, 13, 4706, 16212, 366, 526, 2307, 23110, 13, 13, 4706, 9995, 13, 13, 4706, 396, 22615, 881, 671, 263, 399, 5385, 6890, 29892, 541, 474, 1016, 29915, 29873, 2149, 445, 304, 5735, 1472, 448, 674, 13, 4706, 396, 268, 748, 304, 263, 4833, 322, 1856, 1923, 4720, 13, 13, 4706, 396, 22615, 923, 1218, 13, 4706, 1583, 3032, 4830, 353, 3402, 13, 308, 13, 4706, 565, 3402, 1275, 376, 1420, 1115, 13, 9651, 1583, 29889, 2218, 11911, 10922, 5809, 10456, 5085, 29892, 26952, 353, 26952, 29897, 13, 9651, 736, 13, 13, 4706, 396, 22615, 5694, 13, 4706, 396, 1583, 29889, 449, 29918, 5461, 353, 10876, 13, 308, 13, 4706, 16876, 353, 1583, 29889, 3292, 10739, 13, 13, 4706, 396, 14402, 29901, 1209, 297, 385, 2984, 29892, 5505, 263, 16897, 2729, 373, 1353, 13, 4706, 396, 539, 310, 17573, 29973, 29871, 445, 338, 1048, 6554, 4046, 4828, 363, 13, 4706, 396, 539, 3058, 16212, 13, 13, 4706, 565, 6389, 29901, 13, 9651, 1596, 14822, 451, 6445, 2847, 17573, 448, 380, 309, 1811, 304, 4377, 714, 6554, 4046, 1108, 363, 777, 16212, 1159, 13, 9651, 1510, 10913, 353, 7700, 13, 4706, 1683, 29901, 13, 9651, 1510, 10913, 353, 5852, 13, 13, 4706, 363, 7855, 18417, 297, 16876, 29889, 657, 6691, 10095, 328, 271, 294, 10456, 5085, 29892, 1818, 1252, 391, 353, 7700, 1125, 13, 13, 9651, 396, 22615, 13, 9651, 1583, 3032, 4294, 287, 29918, 10041, 353, 7700, 13, 13, 9651, 565, 26952, 29901, 13, 18884, 1583, 29889, 4294, 6691, 29898, 10041, 18417, 29897, 13, 18884, 1583, 29889, 2158, 19907, 20325, 8091, 703, 29871, 6554, 3291, 1434, 8454, 7855, 1159, 13, 18884, 1209, 13, 13, 9651, 18546, 29918, 5415, 29871, 353, 1583, 29889, 657, 29954, 2985, 2061, 29898, 10041, 18417, 29897, 13, 9651, 17573, 539, 353, 16876, 29889, 657, 10913, 29898, 3292, 29918, 5415, 29892, 2656, 353, 376, 2230, 29899, 1482, 342, 29899, 4102, 1159, 13, 13, 9651, 396, 14402, 29901, 4607, 304, 10035, 18028, 13, 9651, 396, 14402, 29901, 2304, 363, 21166, 334, 1384, 1918, 29930, 1549, 2307, 29899, 5203, 13, 9651, 2998, 10913, 29871, 353, 7855, 18417, 29889, 842, 4381, 703, 20095, 8659, 613, 518, 2314, 13, 9651, 716, 10913, 1678, 353, 518, 13761, 363, 13761, 297, 17573, 565, 13761, 29889, 8159, 29918, 978, 451, 297, 2998, 10913, 4514, 13, 13, 9651, 565, 716, 10913, 29901, 13, 13, 18884, 1583, 29889, 4294, 6691, 29898, 10041, 18417, 29897, 13, 13, 18884, 1596, 703, 29871, 1273, 29881, 716, 17573, 29908, 1273, 7431, 29898, 1482, 10913, 876, 13, 13, 18884, 565, 1510, 10913, 29901, 13, 462, 1678, 16876, 29889, 2158, 10913, 29898, 276, 1066, 353, 716, 10913, 29897, 13, 462, 268, 13, 18884, 1209, 13, 13, 9651, 565, 716, 10913, 29901, 13, 18884, 363, 13761, 297, 716, 10913, 29901, 13, 462, 1678, 7855, 18417, 29889, 4397, 703, 20095, 8659, 613, 13761, 29889, 8159, 29918, 978, 29897, 13, 462, 1678, 1209, 13, 18884, 1209, 13, 13, 9651, 396, 22615, 25700, 505, 1101, 414, 29918, 2798, 322, 1494, 29918, 2798, 29892, 541, 694, 13, 9651, 396, 268, 1101, 414, 580, 470, 1494, 580, 13, 13, 9651, 565, 18546, 29918, 5415, 29889, 1853, 1275, 376, 2659, 1115, 13, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 23031, 414, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 23031, 292, 613, 9651, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 8508, 1127, 29918, 276, 1066, 20106, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 8159, 29918, 978, 1159, 13, 462, 13, 9651, 25342, 18546, 29918, 5415, 29889, 1853, 1275, 376, 27356, 2133, 1115, 13, 13, 18884, 1583, 29889, 12276, 1293, 3373, 15190, 703, 3597, 29918, 28109, 613, 18546, 29918, 5415, 29892, 7855, 18417, 29892, 376, 7507, 1159, 13, 13, 18884, 1209, 13, 13, 9651, 7855, 18417, 29889, 23126, 580, 13, 9651, 1209, 13, 308, 13, 4706, 736, 13, 13, 13, 1678, 822, 3461, 6422, 7020, 29898, 1311, 29892, 334, 5085, 29892, 1369, 29918, 1256, 353, 6213, 29892, 1095, 29918, 1256, 353, 6213, 1125, 13, 4706, 9995, 13, 4706, 5706, 3472, 20699, 3461, 975, 777, 2635, 3464, 515, 2767, 10748, 13, 4706, 9995, 13, 13, 4706, 515, 288, 290, 3274, 29889, 11294, 292, 29889, 3292, 29889, 6691, 18417, 1053, 14945, 18417, 13, 13, 4706, 396, 22615, 923, 1218, 13, 4706, 1583, 3032, 4830, 353, 3402, 13, 13, 4706, 396, 14402, 29901, 2295, 13, 4706, 3461, 13404, 21459, 29918, 29890, 353, 7700, 13, 308, 13, 4706, 1583, 3032, 4039, 29918, 29885, 629, 353, 10522, 3260, 29898, 1311, 29889, 2917, 29892, 13, 462, 462, 259, 8282, 29918, 9507, 353, 376, 10041, 29899, 11338, 29889, 1372, 29894, 1159, 13, 13, 4706, 2767, 16363, 353, 1583, 3032, 657, 6422, 16363, 580, 13, 4706, 16876, 539, 353, 1583, 29889, 3292, 10739, 13, 13, 4706, 396, 14402, 29901, 671, 1855, 1418, 2650, 1355, 313, 465, 9929, 6031, 29897, 13, 4706, 565, 1369, 29918, 1256, 1275, 1095, 29918, 1256, 29901, 13, 9651, 2635, 29918, 3881, 29918, 710, 353, 1369, 29918, 1256, 13, 4706, 1683, 29901, 13, 9651, 2635, 29918, 3881, 29918, 710, 353, 11860, 29879, 19222, 29879, 29908, 1273, 313, 1369, 29918, 1256, 29892, 1095, 29918, 1256, 1723, 13, 632, 13, 4706, 396, 22615, 2758, 24959, 304, 5712, 21274, 13, 4706, 2731, 29918, 12083, 1678, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 21813, 3366, 17353, 12436, 376, 29667, 3274, 613, 376, 2218, 11911, 1159, 13, 4706, 714, 29918, 2084, 539, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7854, 29918, 12083, 29892, 11860, 29879, 29889, 2218, 11911, 29889, 1420, 29908, 1273, 2635, 29918, 3881, 29918, 710, 29897, 13, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 7854, 29918, 12083, 1125, 13, 9651, 2897, 29889, 11256, 3972, 29898, 7854, 29918, 12083, 29897, 13, 13, 4706, 1596, 703, 16554, 304, 29901, 1273, 29879, 29908, 1273, 714, 29918, 2084, 29897, 13, 13, 4706, 396, 3402, 29918, 2324, 353, 16876, 29889, 657, 29954, 2985, 4219, 13, 4706, 3402, 29918, 2324, 353, 1583, 29889, 657, 7020, 24458, 1626, 13, 308, 13, 4706, 1583, 29889, 449, 29918, 5461, 353, 1722, 29898, 449, 29918, 2084, 29892, 376, 29893, 613, 8025, 353, 525, 9420, 29947, 1495, 13, 13, 4706, 714, 29918, 5461, 353, 1583, 29889, 449, 29918, 5461, 13, 308, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 29991, 21300, 3472, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 7299, 17425, 543, 9420, 29899, 29947, 1013, 29905, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 1420, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 2813, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 3257, 29958, 5323, 4937, 8565, 957, 13969, 448, 1273, 29879, 829, 3257, 14247, 29876, 29915, 1273, 313, 2635, 29918, 3881, 29918, 710, 29892, 29871, 876, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 2813, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 2587, 14247, 29876, 1495, 13, 13, 4706, 396, 22615, 5694, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 29966, 1457, 14247, 29876, 1495, 13, 308, 13, 4706, 396, 14402, 29901, 565, 6389, 29892, 1209, 297, 263, 4175, 13, 4706, 11217, 418, 353, 2767, 16363, 29889, 657, 3373, 15190, 29898, 2962, 29918, 1256, 353, 1369, 29918, 1256, 29892, 13, 462, 462, 1669, 1095, 29918, 1256, 259, 353, 1095, 29918, 1256, 29897, 13, 4706, 491, 29918, 10041, 1678, 353, 2767, 16363, 29889, 6388, 675, 3373, 15190, 2059, 6691, 29898, 786, 15190, 29897, 13, 13, 4706, 363, 7855, 29918, 3888, 297, 12705, 29898, 1609, 29918, 10041, 29889, 8149, 580, 1125, 13, 13, 9651, 2924, 29892, 1024, 268, 353, 7855, 29918, 3888, 13, 9651, 7855, 18417, 353, 14945, 18417, 29898, 14380, 29892, 1024, 29892, 6213, 29897, 13, 13, 9651, 396, 1596, 14822, 1273, 29899, 29946, 29900, 29879, 313, 29995, 29879, 5513, 1273, 313, 7855, 18417, 29889, 978, 29892, 7855, 18417, 29889, 14380, 29871, 876, 13, 9651, 1583, 29889, 449, 29918, 5461, 29889, 3539, 11702, 29879, 448, 1273, 29879, 29905, 29876, 29908, 1273, 313, 29871, 7855, 18417, 29889, 14380, 29892, 1583, 29889, 657, 7020, 24458, 1626, 29898, 10041, 18417, 29889, 978, 511, 29871, 876, 13, 9651, 1583, 3032, 4294, 6691, 28089, 29898, 10041, 18417, 29897, 13, 13, 9651, 11217, 29918, 1454, 29918, 10041, 29871, 353, 491, 29918, 10041, 29961, 10041, 29918, 3888, 29962, 13, 13, 9651, 396, 474, 29915, 29885, 451, 1854, 565, 474, 817, 2924, 322, 1746, 29892, 470, 925, 1746, 13, 9651, 491, 29918, 2671, 353, 2767, 16363, 29889, 6388, 675, 3373, 15190, 2059, 3073, 29898, 786, 15190, 29918, 1454, 29918, 10041, 29897, 13, 9651, 4235, 259, 353, 12705, 29898, 1609, 29918, 2671, 29889, 8149, 3101, 13, 13, 9651, 363, 1746, 297, 4235, 29901, 13, 462, 13, 18884, 714, 29918, 5461, 29889, 3539, 703, 29871, 1273, 29879, 29905, 29876, 29908, 1273, 1746, 29897, 13, 18884, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 13, 18884, 11217, 29918, 1454, 29918, 2671, 353, 491, 29918, 2671, 29961, 2671, 29962, 13, 462, 13, 18884, 565, 1746, 1275, 376, 20095, 8659, 1115, 13, 13, 462, 1678, 363, 2767, 297, 11217, 29918, 1454, 29918, 2671, 29901, 13, 13, 462, 4706, 13761, 29918, 2271, 353, 3402, 29918, 2324, 29898, 5504, 3366, 8159, 29918, 978, 20068, 13, 13, 462, 4706, 714, 29918, 5461, 29889, 3539, 703, 1678, 13761, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 13761, 29918, 2271, 29897, 13, 13, 462, 4706, 565, 2767, 29889, 657, 703, 3560, 29908, 1125, 13, 462, 632, 13, 462, 9651, 714, 29918, 5461, 29889, 3539, 703, 418, 363, 17713, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 3402, 29918, 2324, 29898, 5504, 3366, 3560, 3108, 876, 13, 462, 632, 13, 462, 9651, 565, 2767, 29889, 657, 703, 4993, 1159, 2804, 2767, 29889, 657, 703, 3560, 29908, 1125, 13, 462, 18884, 714, 29918, 5461, 29889, 3539, 703, 418, 2752, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 3402, 29918, 2324, 29898, 5504, 3366, 4993, 3108, 876, 13, 462, 18884, 1209, 13, 462, 9651, 1209, 13, 462, 4706, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 462, 308, 13, 462, 4706, 396, 14402, 29901, 5195, 3035, 2303, 13, 462, 308, 13, 462, 4706, 1209, 13, 462, 1678, 1209, 13, 18884, 1683, 29901, 13, 13, 462, 1678, 363, 2767, 297, 11217, 29918, 1454, 29918, 2671, 29901, 13, 462, 4706, 714, 29918, 5461, 29889, 3539, 703, 1678, 1273, 29899, 29947, 29879, 29871, 1273, 29879, 29905, 29876, 29908, 1273, 313, 2767, 3366, 2467, 12436, 3402, 29918, 2324, 29898, 5504, 3366, 8159, 29918, 978, 20068, 29871, 876, 13, 462, 4706, 1209, 13, 462, 1678, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 462, 1678, 1209, 13, 18884, 1209, 13, 9651, 714, 29918, 5461, 29889, 3539, 14182, 29876, 1159, 13, 9651, 1209, 13, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 1457, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 2587, 14247, 29876, 1495, 13, 4706, 714, 29918, 5461, 29889, 3539, 877, 829, 1420, 14247, 29876, 1495, 13, 13, 4706, 565, 714, 29918, 5461, 2804, 10876, 29889, 25393, 29901, 13, 9651, 714, 29918, 5461, 29889, 5358, 580, 13, 9651, 1209, 13, 13, 4706, 736, 13, 13, 13, 268, 13, 13, 1678, 822, 3349, 5292, 1907, 29898, 1311, 29892, 16212, 1125, 13, 4706, 9995, 296, 1907, 338, 1051, 310, 7855, 1580, 29879, 448, 1404, 29914, 16361, 13, 4706, 1638, 29961, 273, 2133, 16261, 16361, 470, 443, 29899, 15380, 2164, 7855, 1024, 13, 13, 4706, 9995, 13, 13, 4706, 736, 1583, 29889, 3292, 10739, 29889, 5992, 5292, 1907, 29898, 296, 1907, 29897, 13, 13, 13, 1678, 822, 3802, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 3292, 10739, 29889, 5358, 580, 13, 308, 13, 4706, 565, 1583, 3032, 5504, 16363, 338, 451, 6213, 29901, 13, 9651, 1583, 3032, 5504, 16363, 29889, 5358, 580, 13, 13, 4706, 736, 13, 268, 13, 1678, 1209, 13, 2 ]
gwv/validators/illegal.py
kurgm/gwv
1
55743
<gh_stars>1-10 from gwv.dump import Dump import gwv.filters as filters from gwv.helper import isKanji from gwv.helper import isYoko from gwv.kagedata import KageData from gwv.validators import Validator from gwv.validators import ErrorCodes error_codes = ErrorCodes( UNKNOWN_STROKE_TYPE="0", # 未定義の筆画 TOO_FEW_COLUMNS="1", # 列不足 TOO_MANY_NONZERO_COLUMNS="2", # 列余分(非ゼロ) TOO_MANY_ZERO_COLUMNS="3", # 列余分(ゼロ値) WRONG_NUMBER_OF_COLUMNS="4", # 列数異常(99) INVALID_DATA_0="5", # 不正なデータ(0) UNKNOWN_STROKE_FORM="6", # 未定義の形状の組み合わせ ALIAS_11_COLUMNS="7", # エイリアスに11列 VERTCONN_IN_HORI_LINE="10", # 横画に接続(縦)型 HORICONN_IN_VERT_LINE="11", # 縦画に接続(横)型 HORIZONTAL_ORE_FIRST="30", # 折れの前半が横 VERTICAL_ORE_LAST="31", # 折れの後半が縦 HORIZONTAL_OTSU_FIRST="40", # 乙の前半が横 LEFTWARD_OTSU_LAST="41", # 乙の後半が左向き BUHIN_ICHI="9", # 部品位置 ) keijoKumiawase = { tuple([int(x) for x in keijoStr.split(":")]) for keijoStr in ( "0:0:0,0:-1:-1,0:99:1,0:99:2,0:99:3,0:98:0,0:97:0," "1:0:0,1:0:13,1:0:2,1:0:23,1:0:24,1:0:313,1:0:32,1:0:4,1:12:0,1:12:13," "1:12:23,1:12:24,1:12:313,1:12:32,1:12:413,1:2:0,1:2:2,1:22:0,1:22:13," "1:22:23,1:22:24,1:22:313,1:22:32,1:22:4,1:22:413,1:32:0,1:32:13," "1:32:23,1:32:24,1:32:313,1:32:32,1:32:4,1:32:413," "2:0:5,2:0:7,2:12:7,2:22:4,2:22:5,2:22:7,2:32:4,2:32:5,2:32:7,2:7:0," "2:7:4,2:7:8," "3:0:0,3:0:5,3:12:0,3:12:5,3:22:5,3:32:0,3:32:5," "4:0:0,4:0:5,4:22:0,4:22:5," "6:0:5,6:0:7,6:12:7,6:22:4,6:22:5,6:22:7,6:32:4,6:32:5,6:32:7,6:7:0," "6:7:4,6:7:8," "7:0:7,7:12:7,7:32:7," "9:0:0" ",7:22:7,3:22:0,1:0:413" # グリフエディタではエラーになるが…… ",2:27:0,6:27:0" # 屋根付き細入り ).split(",") } hikanjiKeijoKumiawase = { tuple([int(x) for x in keijoStr.split(":")]) for keijoStr in [ "2:32:0", # 曲線、接続→右払い "6:32:0", # 複曲線、接続→右払い "2:32:8", # 曲線、接続→止め "6:32:8" # 複曲線、接続→止め ] } # {筆画タイプ: データ列数} datalens = { 1: 7, 2: 9, 3: 9, 4: 9, 6: 11, 7: 11, 9: 7 } class IllegalValidator(Validator): name = "illegal" @filters.check_only(-filters.is_of_category({"user-owned"})) def is_invalid(self, name: str, related: str, kage: KageData, gdata: str, dump: Dump): isKanjiGlyph = isKanji(name) for line in kage.lines: lendata = len(line.data) stype = line.stroke_type try: sttType = line.head_type except IndexError: sttType = 0 try: endType = line.tail_type except IndexError: endType = 0 coords = line.coords if not isKanjiGlyph: stype = stype % 100 if stype >= 0 else stype sttType = sttType % 100 if sttType >= 0 else sttType endType = endType % 100 if endType >= 0 else endType if stype == 99: if lendata not in (8, 11): # 列数異常(99) return [ error_codes.WRONG_NUMBER_OF_COLUMNS, [line.line_number, line.strdata]] if lendata == 11 and kage.is_alias: # エイリアスに11列 return [ error_codes.ALIAS_11_COLUMNS, [line.line_number, line.strdata]] elif stype == 0: if lendata not in (4, 7): # 列数異常(0) return [ error_codes.WRONG_NUMBER_OF_COLUMNS, [line.line_number, line.strdata]] else: if stype not in datalens: # 未定義の筆画 return [ error_codes.UNKNOWN_STROKE_TYPE, [line.line_number, line.strdata]] l = datalens[stype] if lendata < l: # 列不足 return [ error_codes.TOO_FEW_COLUMNS, [line.line_number, line.strdata]] if lendata > l: if any(n != 0 for n in line.data[l:]): # 列余分(非ゼロ) return [ error_codes.TOO_MANY_NONZERO_COLUMNS, [line.line_number, line.strdata]] # 列余分(ゼロ値) return [ error_codes.TOO_MANY_ZERO_COLUMNS, [line.line_number, line.strdata]] if stype == 0: if (line.data[1] == 0 and line.data[3] != 0) or \ (line.data[1] == -1 and line.data[3] != -1): # 不正なデータ(0) return [ error_codes.INVALID_DATA_0, [line.line_number, line.strdata]] elif stype == 1: if sttType in (2, 12, 22, 32) or \ endType in (2, 32, 13, 23, 24, 313, 413): if isYoko(*coords[0], *coords[1]): if sttType > 2 or endType > 2: # not in (0, 2) # 横画に接続(縦)型 return [ error_codes.VERTCONN_IN_HORI_LINE, [line.line_number, line.strdata]] elif sttType == 2 or endType == 2: # 縦画に接続(横)型 return [ error_codes.HORICONN_IN_VERT_LINE, [line.line_number, line.strdata]] elif stype == 9: # 部品位置 return [ error_codes.BUHIN_ICHI, [line.line_number, line.strdata]] elif stype == 2: pass elif stype == 3: if isYoko(*coords[0], *coords[1]): # 折れの前半が横 return [ error_codes.HORIZONTAL_ORE_FIRST, [line.line_number, line.strdata]] if line.tail_type == 5 and coords[2][0] - coords[1][0] == 0: # 折れの後半が縦 return [ error_codes.VERTICAL_ORE_LAST, [line.line_number, line.strdata]] elif stype == 4: if isYoko(*coords[0], *coords[1]): # 乙の前半が横 return [ error_codes.HORIZONTAL_OTSU_FIRST, [line.line_number, line.strdata]] if line.tail_type == 5 and coords[2][0] - coords[1][0] <= 0: # 乙の後半が左向き return [ error_codes.LEFTWARD_OTSU_LAST, [line.line_number, line.strdata]] if stype != 99: strokeKeijo = (stype, sttType, endType) if strokeKeijo not in keijoKumiawase and ( isKanjiGlyph or strokeKeijo not in hikanjiKeijoKumiawase): # 未定義の形状の組み合わせ return [ error_codes.UNKNOWN_STROKE_FORM, [line.line_number, line.strdata]] return False def record(self, glyphname, error): key = error[0] if key not in self.results: self.results[key] = [] self.results[key].append([glyphname, ":".join( error[1][1].split(":", 3)[:3])] + error[1:]) def get_result(self): for val in self.results.values(): val.sort(key=lambda r: r[1]) return super(IllegalValidator, self).get_result()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 330, 29893, 29894, 29889, 15070, 1053, 360, 3427, 13, 5215, 330, 29893, 29894, 29889, 26705, 408, 18094, 13, 3166, 330, 29893, 29894, 29889, 20907, 1053, 338, 29968, 273, 2397, 13, 3166, 330, 29893, 29894, 29889, 20907, 1053, 338, 29979, 15218, 13, 3166, 330, 29893, 29894, 29889, 29895, 4063, 532, 1053, 476, 482, 1469, 13, 3166, 330, 29893, 29894, 29889, 3084, 4097, 1053, 15758, 1061, 13, 3166, 330, 29893, 29894, 29889, 3084, 4097, 1053, 4829, 29907, 2631, 13, 13, 13, 2704, 29918, 18137, 353, 4829, 29907, 2631, 29898, 13, 1678, 8291, 29968, 6632, 16048, 29918, 1254, 1672, 6059, 29918, 11116, 543, 29900, 613, 29871, 396, 29871, 31295, 30495, 31131, 30199, 234, 176, 137, 31046, 13, 1678, 7495, 29949, 29918, 16359, 29956, 29918, 15032, 5005, 3059, 543, 29896, 613, 29871, 396, 29871, 31025, 30413, 31722, 13, 1678, 7495, 29949, 29918, 27616, 29979, 29918, 29940, 1164, 29999, 1001, 29949, 29918, 15032, 5005, 3059, 543, 29906, 613, 29871, 396, 29871, 31025, 231, 192, 156, 30748, 30419, 31838, 31718, 30378, 30409, 13, 1678, 7495, 29949, 29918, 27616, 29979, 29918, 29999, 1001, 29949, 29918, 15032, 5005, 3059, 543, 29941, 613, 29871, 396, 29871, 31025, 231, 192, 156, 30748, 30419, 31718, 30378, 232, 131, 167, 30409, 13, 1678, 399, 29934, 20614, 29918, 23207, 29918, 9800, 29918, 15032, 5005, 3059, 543, 29946, 613, 29871, 396, 29871, 31025, 30354, 234, 152, 179, 31190, 30419, 29929, 29929, 30409, 13, 1678, 2672, 26707, 29918, 14573, 29918, 29900, 543, 29945, 613, 29871, 396, 29871, 30413, 30724, 30371, 30597, 30185, 30369, 30419, 29900, 30409, 13, 1678, 8291, 29968, 6632, 16048, 29918, 1254, 1672, 6059, 29918, 19094, 543, 29953, 613, 29871, 396, 29871, 31295, 30495, 31131, 30199, 31305, 31531, 30199, 234, 184, 135, 30735, 30733, 31068, 31095, 13, 1678, 319, 5265, 3289, 29918, 29896, 29896, 29918, 15032, 5005, 3059, 543, 29955, 613, 29871, 396, 29871, 30600, 30260, 30303, 30310, 30255, 30353, 29896, 29896, 31025, 13, 13, 1678, 478, 20161, 6007, 29940, 29918, 1177, 29918, 29950, 1955, 29902, 29918, 18521, 543, 29896, 29900, 613, 29871, 396, 29871, 233, 171, 173, 31046, 30353, 31092, 234, 185, 157, 29898, 234, 187, 169, 29897, 30883, 13, 1678, 379, 1955, 2965, 1164, 29940, 29918, 1177, 29918, 5348, 29911, 29918, 18521, 543, 29896, 29896, 613, 29871, 396, 29871, 234, 187, 169, 31046, 30353, 31092, 234, 185, 157, 29898, 233, 171, 173, 29897, 30883, 13, 1678, 379, 1955, 26664, 1164, 29911, 1964, 29918, 29949, 1525, 29918, 3738, 29934, 1254, 543, 29941, 29900, 613, 29871, 396, 29871, 233, 141, 155, 30553, 30199, 30658, 232, 144, 141, 30458, 233, 171, 173, 13, 1678, 478, 20161, 2965, 1964, 29918, 29949, 1525, 29918, 4375, 1254, 543, 29941, 29896, 613, 29871, 396, 29871, 233, 141, 155, 30553, 30199, 31220, 232, 144, 141, 30458, 234, 187, 169, 13, 1678, 379, 1955, 26664, 1164, 29911, 1964, 29918, 2891, 14605, 29918, 3738, 29934, 1254, 543, 29946, 29900, 613, 29871, 396, 29871, 231, 188, 156, 30199, 30658, 232, 144, 141, 30458, 233, 171, 173, 13, 1678, 19246, 29956, 17011, 29918, 2891, 14605, 29918, 4375, 1254, 543, 29946, 29896, 613, 29871, 396, 29871, 231, 188, 156, 30199, 31220, 232, 144, 141, 30458, 31651, 31331, 30538, 13, 1678, 350, 29965, 29950, 1177, 29918, 2965, 17628, 543, 29929, 613, 29871, 396, 29871, 30636, 31399, 30956, 30669, 13, 29897, 13, 13, 13, 446, 19550, 29968, 398, 423, 29893, 559, 353, 426, 13, 1678, 18761, 4197, 524, 29898, 29916, 29897, 363, 921, 297, 1589, 19550, 5015, 29889, 5451, 703, 29901, 1159, 2314, 13, 1678, 363, 1589, 19550, 5015, 297, 313, 13, 4706, 376, 29900, 29901, 29900, 29901, 29900, 29892, 29900, 13018, 29896, 13018, 29896, 29892, 29900, 29901, 29929, 29929, 29901, 29896, 29892, 29900, 29901, 29929, 29929, 29901, 29906, 29892, 29900, 29901, 29929, 29929, 29901, 29941, 29892, 29900, 29901, 29929, 29947, 29901, 29900, 29892, 29900, 29901, 29929, 29955, 29901, 29900, 1699, 13, 13, 4706, 376, 29896, 29901, 29900, 29901, 29900, 29892, 29896, 29901, 29900, 29901, 29896, 29941, 29892, 29896, 29901, 29900, 29901, 29906, 29892, 29896, 29901, 29900, 29901, 29906, 29941, 29892, 29896, 29901, 29900, 29901, 29906, 29946, 29892, 29896, 29901, 29900, 29901, 29941, 29896, 29941, 29892, 29896, 29901, 29900, 29901, 29941, 29906, 29892, 29896, 29901, 29900, 29901, 29946, 29892, 29896, 29901, 29896, 29906, 29901, 29900, 29892, 29896, 29901, 29896, 29906, 29901, 29896, 29941, 1699, 13, 4706, 376, 29896, 29901, 29896, 29906, 29901, 29906, 29941, 29892, 29896, 29901, 29896, 29906, 29901, 29906, 29946, 29892, 29896, 29901, 29896, 29906, 29901, 29941, 29896, 29941, 29892, 29896, 29901, 29896, 29906, 29901, 29941, 29906, 29892, 29896, 29901, 29896, 29906, 29901, 29946, 29896, 29941, 29892, 29896, 29901, 29906, 29901, 29900, 29892, 29896, 29901, 29906, 29901, 29906, 29892, 29896, 29901, 29906, 29906, 29901, 29900, 29892, 29896, 29901, 29906, 29906, 29901, 29896, 29941, 1699, 13, 4706, 376, 29896, 29901, 29906, 29906, 29901, 29906, 29941, 29892, 29896, 29901, 29906, 29906, 29901, 29906, 29946, 29892, 29896, 29901, 29906, 29906, 29901, 29941, 29896, 29941, 29892, 29896, 29901, 29906, 29906, 29901, 29941, 29906, 29892, 29896, 29901, 29906, 29906, 29901, 29946, 29892, 29896, 29901, 29906, 29906, 29901, 29946, 29896, 29941, 29892, 29896, 29901, 29941, 29906, 29901, 29900, 29892, 29896, 29901, 29941, 29906, 29901, 29896, 29941, 1699, 13, 4706, 376, 29896, 29901, 29941, 29906, 29901, 29906, 29941, 29892, 29896, 29901, 29941, 29906, 29901, 29906, 29946, 29892, 29896, 29901, 29941, 29906, 29901, 29941, 29896, 29941, 29892, 29896, 29901, 29941, 29906, 29901, 29941, 29906, 29892, 29896, 29901, 29941, 29906, 29901, 29946, 29892, 29896, 29901, 29941, 29906, 29901, 29946, 29896, 29941, 1699, 13, 13, 4706, 376, 29906, 29901, 29900, 29901, 29945, 29892, 29906, 29901, 29900, 29901, 29955, 29892, 29906, 29901, 29896, 29906, 29901, 29955, 29892, 29906, 29901, 29906, 29906, 29901, 29946, 29892, 29906, 29901, 29906, 29906, 29901, 29945, 29892, 29906, 29901, 29906, 29906, 29901, 29955, 29892, 29906, 29901, 29941, 29906, 29901, 29946, 29892, 29906, 29901, 29941, 29906, 29901, 29945, 29892, 29906, 29901, 29941, 29906, 29901, 29955, 29892, 29906, 29901, 29955, 29901, 29900, 1699, 13, 4706, 376, 29906, 29901, 29955, 29901, 29946, 29892, 29906, 29901, 29955, 29901, 29947, 1699, 13, 13, 4706, 376, 29941, 29901, 29900, 29901, 29900, 29892, 29941, 29901, 29900, 29901, 29945, 29892, 29941, 29901, 29896, 29906, 29901, 29900, 29892, 29941, 29901, 29896, 29906, 29901, 29945, 29892, 29941, 29901, 29906, 29906, 29901, 29945, 29892, 29941, 29901, 29941, 29906, 29901, 29900, 29892, 29941, 29901, 29941, 29906, 29901, 29945, 1699, 13, 13, 4706, 376, 29946, 29901, 29900, 29901, 29900, 29892, 29946, 29901, 29900, 29901, 29945, 29892, 29946, 29901, 29906, 29906, 29901, 29900, 29892, 29946, 29901, 29906, 29906, 29901, 29945, 1699, 13, 13, 4706, 376, 29953, 29901, 29900, 29901, 29945, 29892, 29953, 29901, 29900, 29901, 29955, 29892, 29953, 29901, 29896, 29906, 29901, 29955, 29892, 29953, 29901, 29906, 29906, 29901, 29946, 29892, 29953, 29901, 29906, 29906, 29901, 29945, 29892, 29953, 29901, 29906, 29906, 29901, 29955, 29892, 29953, 29901, 29941, 29906, 29901, 29946, 29892, 29953, 29901, 29941, 29906, 29901, 29945, 29892, 29953, 29901, 29941, 29906, 29901, 29955, 29892, 29953, 29901, 29955, 29901, 29900, 1699, 13, 4706, 376, 29953, 29901, 29955, 29901, 29946, 29892, 29953, 29901, 29955, 29901, 29947, 1699, 13, 13, 4706, 376, 29955, 29901, 29900, 29901, 29955, 29892, 29955, 29901, 29896, 29906, 29901, 29955, 29892, 29955, 29901, 29941, 29906, 29901, 29955, 1699, 13, 13, 4706, 376, 29929, 29901, 29900, 29901, 29900, 29908, 13, 13, 4706, 9162, 29955, 29901, 29906, 29906, 29901, 29955, 29892, 29941, 29901, 29906, 29906, 29901, 29900, 29892, 29896, 29901, 29900, 29901, 29946, 29896, 29941, 29908, 29871, 396, 29871, 30521, 30303, 30423, 30600, 30597, 30532, 30369, 30499, 30449, 30600, 30281, 30185, 30353, 30371, 30332, 30458, 30098, 30098, 13, 4706, 9162, 29906, 29901, 29906, 29955, 29901, 29900, 29892, 29953, 29901, 29906, 29955, 29901, 29900, 29908, 29871, 396, 29871, 31654, 31393, 31689, 30538, 234, 183, 179, 30752, 30453, 13, 1678, 13742, 5451, 28165, 1159, 13, 29913, 13, 13, 29882, 7941, 2397, 9598, 19550, 29968, 398, 423, 29893, 559, 353, 426, 13, 1678, 18761, 4197, 524, 29898, 29916, 29897, 363, 921, 297, 1589, 19550, 5015, 29889, 5451, 703, 29901, 1159, 2314, 13, 1678, 363, 1589, 19550, 5015, 297, 518, 13, 4706, 376, 29906, 29901, 29941, 29906, 29901, 29900, 613, 29871, 396, 29871, 31467, 31357, 30330, 31092, 234, 185, 157, 30121, 31803, 233, 140, 152, 30298, 13, 4706, 376, 29953, 29901, 29941, 29906, 29901, 29900, 613, 29871, 396, 29871, 235, 167, 138, 31467, 31357, 30330, 31092, 234, 185, 157, 30121, 31803, 233, 140, 152, 30298, 13, 4706, 376, 29906, 29901, 29941, 29906, 29901, 29947, 613, 29871, 396, 29871, 31467, 31357, 30330, 31092, 234, 185, 157, 30121, 31981, 30954, 13, 4706, 376, 29953, 29901, 29941, 29906, 29901, 29947, 29908, 259, 396, 29871, 235, 167, 138, 31467, 31357, 30330, 31092, 234, 185, 157, 30121, 31981, 30954, 13, 1678, 4514, 13, 29913, 13, 13, 29937, 426, 234, 176, 137, 31046, 30369, 30260, 30605, 29901, 29871, 30597, 30185, 30369, 31025, 30354, 29913, 13, 29881, 2075, 575, 353, 426, 13, 268, 29896, 29901, 29871, 29955, 29892, 13, 268, 29906, 29901, 29871, 29929, 29892, 13, 268, 29941, 29901, 29871, 29929, 29892, 13, 268, 29946, 29901, 29871, 29929, 29892, 13, 268, 29953, 29901, 29871, 29896, 29896, 29892, 13, 268, 29955, 29901, 29871, 29896, 29896, 29892, 13, 268, 29929, 29901, 29871, 29955, 13, 29913, 13, 13, 13, 1990, 1720, 12018, 24204, 29898, 24204, 1125, 13, 13, 1678, 1024, 353, 376, 309, 12018, 29908, 13, 13, 1678, 732, 26705, 29889, 3198, 29918, 6194, 6278, 26705, 29889, 275, 29918, 974, 29918, 7320, 3319, 29908, 1792, 29899, 26689, 9092, 876, 13, 1678, 822, 338, 29918, 20965, 29898, 1311, 29892, 1024, 29901, 851, 29892, 4475, 29901, 851, 29892, 413, 482, 29901, 476, 482, 1469, 29892, 330, 1272, 29901, 851, 29892, 13, 462, 259, 16766, 29901, 360, 3427, 1125, 13, 4706, 338, 29968, 273, 2397, 29954, 27026, 353, 338, 29968, 273, 2397, 29898, 978, 29897, 13, 4706, 363, 1196, 297, 413, 482, 29889, 9012, 29901, 13, 9651, 301, 355, 532, 353, 7431, 29898, 1220, 29889, 1272, 29897, 13, 9651, 380, 668, 353, 1196, 29889, 25893, 29918, 1853, 13, 9651, 1018, 29901, 13, 18884, 380, 29873, 1542, 353, 1196, 29889, 2813, 29918, 1853, 13, 9651, 5174, 11374, 2392, 29901, 13, 18884, 380, 29873, 1542, 353, 29871, 29900, 13, 9651, 1018, 29901, 13, 18884, 1095, 1542, 353, 1196, 29889, 18237, 29918, 1853, 13, 9651, 5174, 11374, 2392, 29901, 13, 18884, 1095, 1542, 353, 29871, 29900, 13, 9651, 1302, 4339, 353, 1196, 29889, 1111, 4339, 13, 13, 9651, 565, 451, 338, 29968, 273, 2397, 29954, 27026, 29901, 13, 18884, 380, 668, 353, 380, 668, 1273, 29871, 29896, 29900, 29900, 565, 380, 668, 6736, 29871, 29900, 1683, 380, 668, 13, 18884, 380, 29873, 1542, 353, 380, 29873, 1542, 1273, 29871, 29896, 29900, 29900, 565, 380, 29873, 1542, 6736, 29871, 29900, 1683, 380, 29873, 1542, 13, 18884, 1095, 1542, 353, 1095, 1542, 1273, 29871, 29896, 29900, 29900, 565, 1095, 1542, 6736, 29871, 29900, 1683, 1095, 1542, 13, 13, 9651, 565, 380, 668, 1275, 29871, 29929, 29929, 29901, 13, 18884, 565, 301, 355, 532, 451, 297, 313, 29947, 29892, 29871, 29896, 29896, 1125, 13, 462, 1678, 396, 29871, 31025, 30354, 234, 152, 179, 31190, 30419, 29929, 29929, 30409, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 9980, 20614, 29918, 23207, 29918, 9800, 29918, 15032, 5005, 3059, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 18884, 565, 301, 355, 532, 1275, 29871, 29896, 29896, 322, 413, 482, 29889, 275, 29918, 19973, 29901, 13, 462, 1678, 396, 29871, 30600, 30260, 30303, 30310, 30255, 30353, 29896, 29896, 31025, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 1964, 29902, 3289, 29918, 29896, 29896, 29918, 15032, 5005, 3059, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 25342, 380, 668, 1275, 29871, 29900, 29901, 13, 18884, 565, 301, 355, 532, 451, 297, 313, 29946, 29892, 29871, 29955, 1125, 13, 462, 1678, 396, 29871, 31025, 30354, 234, 152, 179, 31190, 30419, 29900, 30409, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 9980, 20614, 29918, 23207, 29918, 9800, 29918, 15032, 5005, 3059, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 1683, 29901, 13, 18884, 565, 380, 668, 451, 297, 1418, 284, 575, 29901, 13, 462, 1678, 396, 29871, 31295, 30495, 31131, 30199, 234, 176, 137, 31046, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 3904, 29968, 6632, 16048, 29918, 1254, 1672, 6059, 29918, 11116, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 18884, 301, 353, 1418, 284, 575, 29961, 303, 668, 29962, 13, 18884, 565, 301, 355, 532, 529, 301, 29901, 13, 462, 1678, 396, 29871, 31025, 30413, 31722, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 4986, 29949, 29918, 16359, 29956, 29918, 15032, 5005, 3059, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 18884, 565, 301, 355, 532, 1405, 301, 29901, 13, 462, 1678, 565, 738, 29898, 29876, 2804, 29871, 29900, 363, 302, 297, 1196, 29889, 1272, 29961, 29880, 17531, 1125, 13, 462, 4706, 396, 29871, 31025, 231, 192, 156, 30748, 30419, 31838, 31718, 30378, 30409, 13, 462, 4706, 736, 518, 13, 462, 9651, 1059, 29918, 18137, 29889, 4986, 29949, 29918, 27616, 29979, 29918, 29940, 1164, 29999, 1001, 29949, 29918, 15032, 5005, 3059, 29892, 13, 462, 9651, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 462, 1678, 396, 29871, 31025, 231, 192, 156, 30748, 30419, 31718, 30378, 232, 131, 167, 30409, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 4986, 29949, 29918, 27616, 29979, 29918, 29999, 1001, 29949, 29918, 15032, 5005, 3059, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 565, 380, 668, 1275, 29871, 29900, 29901, 13, 18884, 565, 313, 1220, 29889, 1272, 29961, 29896, 29962, 1275, 29871, 29900, 322, 1196, 29889, 1272, 29961, 29941, 29962, 2804, 29871, 29900, 29897, 470, 320, 13, 462, 259, 313, 1220, 29889, 1272, 29961, 29896, 29962, 1275, 448, 29896, 322, 1196, 29889, 1272, 29961, 29941, 29962, 2804, 448, 29896, 1125, 13, 462, 1678, 396, 29871, 30413, 30724, 30371, 30597, 30185, 30369, 30419, 29900, 30409, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 1177, 26707, 29918, 14573, 29918, 29900, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 25342, 380, 668, 1275, 29871, 29896, 29901, 13, 18884, 565, 380, 29873, 1542, 297, 313, 29906, 29892, 29871, 29896, 29906, 29892, 29871, 29906, 29906, 29892, 29871, 29941, 29906, 29897, 470, 320, 13, 462, 4706, 1095, 1542, 297, 313, 29906, 29892, 29871, 29941, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29946, 29892, 29871, 29941, 29896, 29941, 29892, 29871, 29946, 29896, 29941, 1125, 13, 462, 1678, 565, 338, 29979, 15218, 10456, 1111, 4339, 29961, 29900, 1402, 334, 1111, 4339, 29961, 29896, 29962, 1125, 13, 462, 4706, 565, 380, 29873, 1542, 1405, 29871, 29906, 470, 1095, 1542, 1405, 29871, 29906, 29901, 29871, 396, 451, 297, 313, 29900, 29892, 29871, 29906, 29897, 13, 462, 9651, 396, 29871, 233, 171, 173, 31046, 30353, 31092, 234, 185, 157, 29898, 234, 187, 169, 29897, 30883, 13, 462, 9651, 736, 518, 13, 462, 18884, 1059, 29918, 18137, 29889, 5348, 29911, 6007, 29940, 29918, 1177, 29918, 29950, 1955, 29902, 29918, 18521, 29892, 13, 462, 18884, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 462, 1678, 25342, 380, 29873, 1542, 1275, 29871, 29906, 470, 1095, 1542, 1275, 29871, 29906, 29901, 13, 462, 4706, 396, 29871, 234, 187, 169, 31046, 30353, 31092, 234, 185, 157, 29898, 233, 171, 173, 29897, 30883, 13, 462, 4706, 736, 518, 13, 462, 9651, 1059, 29918, 18137, 29889, 29950, 1955, 2965, 1164, 29940, 29918, 1177, 29918, 5348, 29911, 29918, 18521, 29892, 13, 462, 9651, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 25342, 380, 668, 1275, 29871, 29929, 29901, 13, 18884, 396, 29871, 30636, 31399, 30956, 30669, 13, 18884, 736, 518, 13, 462, 1678, 1059, 29918, 18137, 29889, 7838, 29950, 1177, 29918, 2965, 17628, 29892, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 25342, 380, 668, 1275, 29871, 29906, 29901, 13, 18884, 1209, 13, 9651, 25342, 380, 668, 1275, 29871, 29941, 29901, 13, 18884, 565, 338, 29979, 15218, 10456, 1111, 4339, 29961, 29900, 1402, 334, 1111, 4339, 29961, 29896, 29962, 1125, 13, 462, 1678, 396, 29871, 233, 141, 155, 30553, 30199, 30658, 232, 144, 141, 30458, 233, 171, 173, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 29950, 1955, 26664, 1164, 29911, 1964, 29918, 29949, 1525, 29918, 3738, 29934, 1254, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 18884, 565, 1196, 29889, 18237, 29918, 1853, 1275, 29871, 29945, 322, 1302, 4339, 29961, 29906, 3816, 29900, 29962, 448, 1302, 4339, 29961, 29896, 3816, 29900, 29962, 1275, 29871, 29900, 29901, 13, 462, 1678, 396, 29871, 233, 141, 155, 30553, 30199, 31220, 232, 144, 141, 30458, 234, 187, 169, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 5348, 29911, 2965, 1964, 29918, 29949, 1525, 29918, 4375, 1254, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 25342, 380, 668, 1275, 29871, 29946, 29901, 13, 18884, 565, 338, 29979, 15218, 10456, 1111, 4339, 29961, 29900, 1402, 334, 1111, 4339, 29961, 29896, 29962, 1125, 13, 462, 1678, 396, 29871, 231, 188, 156, 30199, 30658, 232, 144, 141, 30458, 233, 171, 173, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 29950, 1955, 26664, 1164, 29911, 1964, 29918, 2891, 14605, 29918, 3738, 29934, 1254, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 18884, 565, 1196, 29889, 18237, 29918, 1853, 1275, 29871, 29945, 322, 1302, 4339, 29961, 29906, 3816, 29900, 29962, 448, 1302, 4339, 29961, 29896, 3816, 29900, 29962, 5277, 29871, 29900, 29901, 13, 462, 1678, 396, 29871, 231, 188, 156, 30199, 31220, 232, 144, 141, 30458, 31651, 31331, 30538, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 28024, 29956, 17011, 29918, 2891, 14605, 29918, 4375, 1254, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 9651, 565, 380, 668, 2804, 29871, 29929, 29929, 29901, 13, 18884, 19782, 9598, 19550, 353, 313, 303, 668, 29892, 380, 29873, 1542, 29892, 1095, 1542, 29897, 13, 13, 18884, 565, 19782, 9598, 19550, 451, 297, 1589, 19550, 29968, 398, 423, 29893, 559, 322, 313, 13, 462, 4706, 338, 29968, 273, 2397, 29954, 27026, 470, 13, 462, 4706, 19782, 9598, 19550, 451, 297, 298, 7941, 2397, 9598, 19550, 29968, 398, 423, 29893, 559, 1125, 13, 462, 1678, 396, 29871, 31295, 30495, 31131, 30199, 31305, 31531, 30199, 234, 184, 135, 30735, 30733, 31068, 31095, 13, 462, 1678, 736, 518, 13, 462, 4706, 1059, 29918, 18137, 29889, 3904, 29968, 6632, 16048, 29918, 1254, 1672, 6059, 29918, 19094, 29892, 13, 462, 4706, 518, 1220, 29889, 1220, 29918, 4537, 29892, 1196, 29889, 710, 1272, 5262, 13, 4706, 736, 7700, 13, 13, 1678, 822, 2407, 29898, 1311, 29892, 330, 27026, 978, 29892, 1059, 1125, 13, 4706, 1820, 353, 1059, 29961, 29900, 29962, 13, 4706, 565, 1820, 451, 297, 1583, 29889, 9902, 29901, 13, 9651, 1583, 29889, 9902, 29961, 1989, 29962, 353, 5159, 13, 4706, 1583, 29889, 9902, 29961, 1989, 1822, 4397, 4197, 16808, 561, 978, 29892, 29242, 1642, 7122, 29898, 13, 9651, 1059, 29961, 29896, 3816, 29896, 1822, 5451, 703, 29901, 613, 29871, 29941, 29897, 7503, 29941, 2314, 29962, 718, 1059, 29961, 29896, 29901, 2314, 13, 13, 1678, 822, 679, 29918, 2914, 29898, 1311, 1125, 13, 4706, 363, 659, 297, 1583, 29889, 9902, 29889, 5975, 7295, 13, 9651, 659, 29889, 6605, 29898, 1989, 29922, 2892, 364, 29901, 364, 29961, 29896, 2314, 13, 4706, 736, 2428, 29898, 14126, 12018, 24204, 29892, 1583, 467, 657, 29918, 2914, 580, 13, 2 ]
cubi_tk/snappy/itransfer_common.py
LaborBerlin/cubi-tk
0
145728
<filename>cubi_tk/snappy/itransfer_common.py """Common code for ``cubi-tk snappy itransfer-*`` commands.""" import argparse import datetime import glob import os import typing from ctypes import c_ulonglong from multiprocessing import Value from multiprocessing.pool import ThreadPool from subprocess import check_output, SubprocessError, check_call, STDOUT import sys import attr from biomedsheets import io_tsv, shortcuts from biomedsheets.naming import NAMING_ONLY_SECONDARY_ID from logzero import logger from retrying import retry import tqdm from ..exceptions import MissingFileException from ..common import check_irods_icommands, sizeof_fmt #: Default number of parallel transfers. DEFAULT_NUM_TRANSFERS = 8 @attr.s(frozen=True, auto_attribs=True) class TransferJob: """Encodes a transfer job from the local file system to the remote iRODS collection.""" #: Source path. path_src: str #: Destination path. path_dest: str #: Number of bytes to transfer. bytes: int command: typing.Optional[str] = None def to_oneline(self): return "%s -> %s (%s) [%s]" % (self.path_src, self.path_dest, self.bytes, self.command) @retry(wait_fixed=1000, stop_max_attempt_number=5) def _wait_until_ils_succeeds(path): check_output(["ils", path], stderr=STDOUT) @retry(wait_fixed=1000, stop_max_attempt_number=5) def irsync_transfer(job: TransferJob, counter: Value, t: tqdm.tqdm): """Perform one piece of work and update the global counter.""" mkdir_argv = ["imkdir", "-p", os.path.dirname(job.path_dest)] logger.debug("Creating directory when necessary: %s", " ".join(mkdir_argv)) try: check_output(mkdir_argv) except SubprocessError as e: # pragma: nocover logger.error("Problem executing imkdir: %s (probably retrying)", e) raise _wait_until_ils_succeeds(os.path.dirname(job.path_dest)) irsync_argv = ["irsync", "-a", "-K", job.path_src, "i:%s" % job.path_dest] logger.debug("Transferring file: %s", " ".join(irsync_argv)) try: check_output(irsync_argv) except SubprocessError as e: # pragma: nocover logger.error("Problem executing irsync: %s (probably retrying)", e) raise with counter.get_lock(): counter.value += job.bytes t.update(counter.value) def check_args(args): """Argument checks that can be checked at program startup but that cannot be sensibly checked with ``argparse``.""" def load_sheet_tsv(args): """Load sample sheet.""" logger.info( "Loading %s sample sheet from %s.", args.tsv_shortcut, getattr(args.biomedsheet_tsv, "name", "stdin"), ) load_tsv = getattr(io_tsv, "read_%s_tsv_sheet" % args.tsv_shortcut) return load_tsv(args.biomedsheet_tsv, naming_scheme=NAMING_ONLY_SECONDARY_ID) def load_sheets_tsv(args): """Load multiple sample sheets.""" result = [] for path in args.biomedsheet_tsv: logger.info( "Loading %s sample sheet from %s.", args.tsv_shortcut, getattr(args.biomedsheet_tsv, "name", "stdin"), ) load_tsv = getattr(io_tsv, "read_%s_tsv_sheet" % args.tsv_shortcut) result.append(load_tsv(path, naming_scheme=NAMING_ONLY_SECONDARY_ID)) return result class SnappyItransferCommandBase: """Base class for itransfer commands.""" #: The command name. command_name: typing.Optional[str] = None #: The step folder name to create. step_name: typing.Optional[str] = None #: Whether or not to fix .md5 files on the fly. fix_md5_files: bool = False #: Whether to look into largest start batch in family. start_batch_in_family: bool = False def __init__(self, args): #: Command line arguments. self.args = args @classmethod def setup_argparse(cls, parser: argparse.ArgumentParser) -> None: """Setup common arguments for itransfer commands.""" parser.add_argument( "--hidden-cmd", dest="snappy_cmd", default=cls.run, help=argparse.SUPPRESS ) parser.add_argument( "--num-parallel-transfers", type=int, default=DEFAULT_NUM_TRANSFERS, help="Number of parallel transfers, defaults to %s" % DEFAULT_NUM_TRANSFERS, ) parser.add_argument( "--tsv-shortcut", default="germline", choices=("germline", "cancer"), help="The shortcut TSV schema to use.", ) parser.add_argument( "--start-batch", default=0, type=int, help="Batch to start the transfer at, defaults to 0.", ) parser.add_argument( "--base-path", default=os.getcwd(), required=False, help="Base path of project (contains 'ngs_mapping/' etc.), defaults to current path.", ) parser.add_argument( "--remote-dir-date", default=datetime.date.today().strftime("%Y-%m-%d"), help="Date to use in remote directory, defaults to YYYY-MM-DD of today.", ) parser.add_argument( "--remote-dir-pattern", default="{library_name}/%s/{date}" % cls.step_name, help="Pattern to use for constructing remote pattern", ) parser.add_argument( "biomedsheet_tsv", type=argparse.FileType("rt"), help="Path to biomedsheets TSV file to load.", ) parser.add_argument("irods_dest", help="path to iRODS collection to write to.") @classmethod def run( cls, args, _parser: argparse.ArgumentParser, _subparser: argparse.ArgumentParser ) -> typing.Optional[int]: """Entry point into the command.""" return cls(args).execute() def check_args(self, args): """Called for checking arguments, override to change behaviour.""" # Check presence of icommands when not testing. if "pytest" not in sys.modules: # pragma: nocover check_irods_icommands(warn_only=False) res = 0 if not os.path.exists(args.base_path): # pragma: nocover logger.error("Base path %s does not exist", args.base_path) res = 1 return res def _build_family_max_batch(self, sheet, batch_key, family_key): family_max_batch = {} for donor in sheet.bio_entities.values(): if batch_key in donor.extra_infos and family_key in donor.extra_infos: family_id = donor.extra_infos[family_key] batch_no = donor.extra_infos[batch_key] family_max_batch[family_id] = max(family_max_batch.get(family_id, 0), batch_no) return family_max_batch def _batch_of(self, donor, family_max_batch, batch_key, family_key): if batch_key in donor.extra_infos: batch = donor.extra_infos[batch_key] else: batch = 0 if self.start_batch_in_family and family_key in donor.extra_infos: family_id = donor.extra_infos[family_key] batch = max(batch, family_max_batch[family_id]) return batch def yield_ngs_library_names( self, sheet, min_batch=None, batch_key="batchNo", family_key="familyId" ): """Yield all NGS library names from sheet. When ``min_batch`` is given then only the donors for which the ``extra_infos[batch_key]`` is greater than ``min_batch`` will be used. This function can be overloaded, for example to only consider the indexes. """ family_max_batch = self._build_family_max_batch(sheet, batch_key, family_key) # Process all libraries and filter by family batch ID. for donor in sheet.bio_entities.values(): if min_batch is not None: batch = self._batch_of(donor, family_max_batch, batch_key, family_key) if batch < min_batch: logger.debug( "Skipping donor %s because %s = %d < min_batch = %d", donor.name, batch_key, batch, min_batch, ) continue for bio_sample in donor.bio_samples.values(): for test_sample in bio_sample.test_samples.values(): for library in test_sample.ngs_libraries.values(): yield library.name def build_base_dir_glob_pattern( self, library_name: str ) -> typing.Tuple[str, str]: # pragma: nocover """Build base dir and glob pattern to append.""" raise NotImplementedError("Abstract method called!") def build_jobs(self, library_names) -> typing.Tuple[TransferJob, ...]: """Build file transfer jobs.""" transfer_jobs = [] for library_name in library_names: base_dir, glob_pattern = self.build_base_dir_glob_pattern(library_name) glob_pattern = os.path.join(base_dir, glob_pattern) logger.debug("Glob pattern for library %s is %s", library_name, glob_pattern) for glob_result in glob.glob(glob_pattern, recursive=True): rel_result = os.path.relpath(glob_result, base_dir) real_result = os.path.realpath(glob_result) if real_result.endswith(".md5"): continue # skip, will be added automatically elif not os.path.isfile(real_result): continue # skip if did not resolve to file remote_dir = os.path.join( self.args.irods_dest, self.args.remote_dir_pattern.format( library_name=library_name, date=self.args.remote_dir_date ), ) if not os.path.exists(real_result): # pragma: nocover raise MissingFileException("Missing file %s" % real_result) if ( not os.path.exists(real_result + ".md5") and not self.fix_md5_files ): # pragma: nocover raise MissingFileException("Missing file %s" % (real_result + ".md5")) for ext in ("", ".md5"): try: size = os.path.getsize(real_result + ext) except OSError: # pragma: nocover size = 0 transfer_jobs.append( TransferJob( path_src=real_result + ext, path_dest=os.path.join(remote_dir, rel_result + ext), bytes=size, ) ) return tuple(sorted(transfer_jobs)) def _execute_md5_files_fix( self, transfer_jobs: typing.Tuple[TransferJob, ...] ) -> typing.Tuple[TransferJob, ...]: """Create missing MD5 files.""" ok_jobs = [] todo_jobs = [] for job in transfer_jobs: if not os.path.exists(job.path_src): todo_jobs.append(job) else: ok_jobs.append(job) total_bytes = sum([os.path.getsize(j.path_src[: -len(".md5")]) for j in todo_jobs]) logger.info( "Computing MD5 sums for %s files of %s with up to %d processes", len(todo_jobs), sizeof_fmt(total_bytes), self.args.num_parallel_transfers, ) logger.info("Missing MD5 files:\n%s", "\n".join(map(lambda j: j.path_src, todo_jobs))) counter = Value(c_ulonglong, 0) with tqdm.tqdm(total=total_bytes, unit="B", unit_scale=True) as t: if self.args.num_parallel_transfers == 0: # pragma: nocover for job in todo_jobs: compute_md5sum(job, counter, t) else: pool = ThreadPool(processes=self.args.num_parallel_transfers) for job in todo_jobs: pool.apply_async(compute_md5sum, args=(job, counter, t)) pool.close() pool.join() # Finally, determine file sizes after done. done_jobs = [ TransferJob( path_src=j.path_src, path_dest=j.path_dest, bytes=os.path.getsize(j.path_src), command=j.command, ) for j in todo_jobs ] return tuple(sorted(done_jobs + ok_jobs)) def execute(self) -> typing.Optional[int]: """Execute the transfer.""" res = self.check_args(self.args) if res: # pragma: nocover return res logger.info("Starting cubi-tk snappy %s", self.command_name) logger.info(" args: %s", self.args) sheet = load_sheet_tsv(self.args) library_names = list(self.yield_ngs_library_names(sheet, min_batch=self.args.start_batch)) logger.info("Libraries in sheet:\n%s", "\n".join(sorted(library_names))) transfer_jobs = self.build_jobs(library_names) logger.debug("Transfer jobs:\n%s", "\n".join(map(lambda x: x.to_oneline(), transfer_jobs))) if self.fix_md5_files: transfer_jobs = self._execute_md5_files_fix(transfer_jobs) total_bytes = sum([job.bytes for job in transfer_jobs]) logger.info( "Transferring %d files with a total size of %s", len(transfer_jobs), sizeof_fmt(total_bytes), ) counter = Value(c_ulonglong, 0) with tqdm.tqdm(total=total_bytes, unit="B", unit_scale=True) as t: if self.args.num_parallel_transfers == 0: # pragma: nocover for job in transfer_jobs: irsync_transfer(job, counter, t) else: pool = ThreadPool(processes=self.args.num_parallel_transfers) for job in transfer_jobs: pool.apply_async(irsync_transfer, args=(job, counter, t)) pool.close() pool.join() logger.info("All done") return None class IndexLibrariesOnlyMixin: """Mixin for ``SnappyItransferCommandBase`` that only considers libraries of indexes.""" def yield_ngs_library_names( self, sheet, min_batch=None, batch_key="batchNo", family_key="familyId" ): family_max_batch = self._build_family_max_batch(sheet, batch_key, family_key) shortcut_sheet = shortcuts.GermlineCaseSheet(sheet) for pedigree in shortcut_sheet.cohort.pedigrees: donor = pedigree.index if min_batch is not None: batch = self._batch_of(donor, family_max_batch, batch_key, family_key) if batch < min_batch: logger.debug( "Skipping donor %s because %s = %d < min_batch = %d", donor.name, batch_key, donor.extra_infos[batch_key], min_batch, ) continue yield donor.dna_ngs_library.name @attr.s(frozen=True, auto_attribs=True) class FileWithSize: """Pair of path with size.""" #: Path to file. path: str #: File size. bytes: int def compute_md5sum(job: TransferJob, counter: Value, t: tqdm.tqdm) -> None: """Compute MD5 sum with ``md5sum`` command.""" dirname = os.path.dirname(job.path_src) filename = os.path.basename(job.path_src)[: -len(".md5")] path_md5 = job.path_src md5sum_argv = ["md5sum", filename] logger.debug("Computing MD5sum %s > %s", " ".join(md5sum_argv), filename + ".md5") try: with open(path_md5, "wt") as md5f: check_call(md5sum_argv, cwd=dirname, stdout=md5f) except SubprocessError as e: # pragma: nocover logger.error("Problem executing md5sum: %s", e) logger.info("Removing file after error: %s", path_md5) try: os.remove(path_md5) except OSError as e_rm: # pragma: nocover logger.error("Could not remove file: %s", e_rm) raise e with counter.get_lock(): counter.value += os.path.getsize(job.path_src[: -len(".md5")]) t.update(counter.value)
[ 1, 529, 9507, 29958, 29883, 431, 29875, 29918, 11178, 29914, 16586, 14862, 29914, 277, 29878, 550, 571, 29918, 9435, 29889, 2272, 13, 15945, 29908, 18877, 775, 363, 4954, 29883, 431, 29875, 29899, 11178, 5807, 14862, 372, 29878, 550, 571, 29899, 29930, 16159, 8260, 1213, 15945, 13, 13, 5215, 1852, 5510, 13, 5215, 12865, 13, 5215, 13149, 13, 5215, 2897, 13, 5215, 19229, 13, 3166, 274, 8768, 1053, 274, 29918, 352, 549, 5426, 13, 3166, 6674, 307, 985, 292, 1053, 7865, 13, 3166, 6674, 307, 985, 292, 29889, 10109, 1053, 10480, 11426, 13, 3166, 1014, 5014, 1053, 1423, 29918, 4905, 29892, 3323, 5014, 2392, 29892, 1423, 29918, 4804, 29892, 6850, 3970, 2692, 13, 5215, 10876, 13, 13, 5215, 12421, 13, 3166, 4768, 290, 5779, 354, 1691, 1053, 12013, 29918, 1372, 29894, 29892, 21697, 29879, 13, 3166, 4768, 290, 5779, 354, 1691, 29889, 8588, 292, 1053, 405, 5194, 4214, 29918, 1164, 16786, 29918, 1660, 6007, 29928, 19926, 29918, 1367, 13, 3166, 1480, 9171, 1053, 17927, 13, 3166, 337, 2202, 292, 1053, 337, 2202, 13, 5215, 260, 29939, 18933, 13, 13, 3166, 6317, 11739, 29879, 1053, 4750, 292, 2283, 2451, 13, 3166, 6317, 9435, 1053, 1423, 29918, 3350, 6289, 29918, 293, 3011, 4167, 29892, 13810, 29918, 23479, 13, 13, 13, 29937, 29901, 13109, 1353, 310, 8943, 1301, 25534, 29889, 13, 23397, 29918, 13967, 29918, 26813, 20322, 23598, 353, 29871, 29947, 13, 13, 13, 29992, 5552, 29889, 29879, 29898, 29888, 307, 2256, 29922, 5574, 29892, 4469, 29918, 1131, 1091, 29879, 29922, 5574, 29897, 13, 1990, 17934, 11947, 29901, 13, 1678, 9995, 8566, 2631, 263, 6782, 4982, 515, 278, 1887, 934, 1788, 304, 278, 7592, 474, 1672, 8452, 4333, 1213, 15945, 13, 13, 1678, 396, 29901, 7562, 2224, 29889, 13, 1678, 2224, 29918, 4351, 29901, 851, 13, 13, 1678, 396, 29901, 15435, 3381, 2224, 29889, 13, 1678, 2224, 29918, 7854, 29901, 851, 13, 13, 1678, 396, 29901, 9681, 310, 6262, 304, 6782, 29889, 13, 1678, 6262, 29901, 938, 13, 13, 1678, 1899, 29901, 19229, 29889, 27636, 29961, 710, 29962, 353, 6213, 13, 13, 1678, 822, 304, 29918, 265, 5570, 29898, 1311, 1125, 13, 4706, 736, 11860, 29879, 1599, 1273, 29879, 313, 29995, 29879, 29897, 518, 29995, 29879, 18017, 1273, 313, 1311, 29889, 2084, 29918, 4351, 29892, 1583, 29889, 2084, 29918, 7854, 29892, 1583, 29889, 13193, 29892, 1583, 29889, 6519, 29897, 13, 13, 13, 29992, 276, 2202, 29898, 10685, 29918, 20227, 29922, 29896, 29900, 29900, 29900, 29892, 5040, 29918, 3317, 29918, 1131, 3456, 29918, 4537, 29922, 29945, 29897, 13, 1753, 903, 10685, 29918, 29305, 29918, 2719, 29918, 29879, 1682, 3947, 29879, 29898, 2084, 1125, 13, 1678, 1423, 29918, 4905, 29898, 3366, 2719, 613, 2224, 1402, 380, 20405, 29922, 1254, 3970, 2692, 29897, 13, 13, 13, 29992, 276, 2202, 29898, 10685, 29918, 20227, 29922, 29896, 29900, 29900, 29900, 29892, 5040, 29918, 3317, 29918, 1131, 3456, 29918, 4537, 29922, 29945, 29897, 13, 1753, 3805, 16593, 29918, 3286, 571, 29898, 9057, 29901, 17934, 11947, 29892, 6795, 29901, 7865, 29892, 260, 29901, 260, 29939, 18933, 29889, 29873, 29939, 18933, 1125, 13, 1678, 9995, 5894, 689, 697, 8424, 310, 664, 322, 2767, 278, 5534, 6795, 1213, 15945, 13, 1678, 29356, 29918, 19218, 353, 6796, 326, 29895, 3972, 613, 11663, 29886, 613, 2897, 29889, 2084, 29889, 25721, 29898, 9057, 29889, 2084, 29918, 7854, 4638, 13, 1678, 17927, 29889, 8382, 703, 9832, 1218, 3884, 746, 5181, 29901, 1273, 29879, 613, 376, 11393, 7122, 29898, 11256, 3972, 29918, 19218, 876, 13, 1678, 1018, 29901, 13, 4706, 1423, 29918, 4905, 29898, 11256, 3972, 29918, 19218, 29897, 13, 1678, 5174, 3323, 5014, 2392, 408, 321, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 4706, 17927, 29889, 2704, 703, 26604, 14012, 527, 29895, 3972, 29901, 1273, 29879, 313, 771, 14815, 337, 2202, 292, 19123, 321, 29897, 13, 4706, 12020, 13, 13, 1678, 903, 10685, 29918, 29305, 29918, 2719, 29918, 29879, 1682, 3947, 29879, 29898, 359, 29889, 2084, 29889, 25721, 29898, 9057, 29889, 2084, 29918, 7854, 876, 13, 13, 1678, 3805, 16593, 29918, 19218, 353, 6796, 12935, 2720, 613, 11663, 29874, 613, 11663, 29968, 613, 4982, 29889, 2084, 29918, 4351, 29892, 376, 29875, 16664, 29879, 29908, 1273, 4982, 29889, 2084, 29918, 7854, 29962, 13, 1678, 17927, 29889, 8382, 703, 4300, 571, 5393, 934, 29901, 1273, 29879, 613, 376, 11393, 7122, 29898, 12935, 2720, 29918, 19218, 876, 13, 1678, 1018, 29901, 13, 4706, 1423, 29918, 4905, 29898, 12935, 2720, 29918, 19218, 29897, 13, 1678, 5174, 3323, 5014, 2392, 408, 321, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 4706, 17927, 29889, 2704, 703, 26604, 14012, 3805, 16593, 29901, 1273, 29879, 313, 771, 14815, 337, 2202, 292, 19123, 321, 29897, 13, 4706, 12020, 13, 13, 1678, 411, 6795, 29889, 657, 29918, 908, 7295, 13, 4706, 6795, 29889, 1767, 4619, 4982, 29889, 13193, 13, 4706, 260, 29889, 5504, 29898, 11808, 29889, 1767, 29897, 13, 13, 13, 1753, 1423, 29918, 5085, 29898, 5085, 1125, 13, 1678, 9995, 15730, 12747, 393, 508, 367, 7120, 472, 1824, 20234, 541, 393, 2609, 367, 4771, 14981, 7120, 411, 4954, 1191, 5510, 16159, 1213, 15945, 13, 13, 13, 1753, 2254, 29918, 9855, 29918, 1372, 29894, 29898, 5085, 1125, 13, 1678, 9995, 5896, 4559, 9869, 1213, 15945, 13, 1678, 17927, 29889, 3888, 29898, 13, 4706, 376, 23456, 1273, 29879, 4559, 9869, 515, 1273, 29879, 19602, 13, 4706, 6389, 29889, 1372, 29894, 29918, 12759, 7582, 29892, 13, 4706, 679, 5552, 29898, 5085, 29889, 5365, 290, 5779, 4155, 29918, 1372, 29894, 29892, 376, 978, 613, 376, 4172, 262, 4968, 13, 1678, 1723, 13, 1678, 2254, 29918, 1372, 29894, 353, 679, 5552, 29898, 601, 29918, 1372, 29894, 29892, 376, 949, 29918, 29995, 29879, 29918, 1372, 29894, 29918, 9855, 29908, 1273, 6389, 29889, 1372, 29894, 29918, 12759, 7582, 29897, 13, 1678, 736, 2254, 29918, 1372, 29894, 29898, 5085, 29889, 5365, 290, 5779, 4155, 29918, 1372, 29894, 29892, 22006, 29918, 816, 2004, 29922, 3521, 29924, 4214, 29918, 1164, 16786, 29918, 1660, 6007, 29928, 19926, 29918, 1367, 29897, 13, 13, 13, 1753, 2254, 29918, 19360, 29918, 1372, 29894, 29898, 5085, 1125, 13, 1678, 9995, 5896, 2999, 4559, 26718, 1213, 15945, 13, 1678, 1121, 353, 5159, 13, 13, 1678, 363, 2224, 297, 6389, 29889, 5365, 290, 5779, 4155, 29918, 1372, 29894, 29901, 13, 4706, 17927, 29889, 3888, 29898, 13, 9651, 376, 23456, 1273, 29879, 4559, 9869, 515, 1273, 29879, 19602, 13, 9651, 6389, 29889, 1372, 29894, 29918, 12759, 7582, 29892, 13, 9651, 679, 5552, 29898, 5085, 29889, 5365, 290, 5779, 4155, 29918, 1372, 29894, 29892, 376, 978, 613, 376, 4172, 262, 4968, 13, 4706, 1723, 13, 4706, 2254, 29918, 1372, 29894, 353, 679, 5552, 29898, 601, 29918, 1372, 29894, 29892, 376, 949, 29918, 29995, 29879, 29918, 1372, 29894, 29918, 9855, 29908, 1273, 6389, 29889, 1372, 29894, 29918, 12759, 7582, 29897, 13, 4706, 1121, 29889, 4397, 29898, 1359, 29918, 1372, 29894, 29898, 2084, 29892, 22006, 29918, 816, 2004, 29922, 3521, 29924, 4214, 29918, 1164, 16786, 29918, 1660, 6007, 29928, 19926, 29918, 1367, 876, 13, 13, 1678, 736, 1121, 13, 13, 13, 1990, 22639, 14862, 29902, 3286, 571, 6255, 5160, 29901, 13, 1678, 9995, 5160, 770, 363, 372, 29878, 550, 571, 8260, 1213, 15945, 13, 13, 1678, 396, 29901, 450, 1899, 1024, 29889, 13, 1678, 1899, 29918, 978, 29901, 19229, 29889, 27636, 29961, 710, 29962, 353, 6213, 13, 1678, 396, 29901, 450, 4331, 4138, 1024, 304, 1653, 29889, 13, 1678, 4331, 29918, 978, 29901, 19229, 29889, 27636, 29961, 710, 29962, 353, 6213, 13, 1678, 396, 29901, 26460, 470, 451, 304, 2329, 869, 3487, 29945, 2066, 373, 278, 11340, 29889, 13, 1678, 2329, 29918, 3487, 29945, 29918, 5325, 29901, 6120, 353, 7700, 13, 1678, 396, 29901, 26460, 304, 1106, 964, 10150, 1369, 9853, 297, 3942, 29889, 13, 1678, 1369, 29918, 16175, 29918, 262, 29918, 11922, 29901, 6120, 353, 7700, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6389, 1125, 13, 4706, 396, 29901, 10516, 1196, 6273, 29889, 13, 4706, 1583, 29889, 5085, 353, 6389, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 6230, 29918, 1191, 5510, 29898, 25932, 29892, 13812, 29901, 1852, 5510, 29889, 15730, 11726, 29897, 1599, 6213, 29901, 13, 4706, 9995, 26947, 3619, 6273, 363, 372, 29878, 550, 571, 8260, 1213, 15945, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 10892, 29899, 9006, 613, 2731, 543, 16586, 14862, 29918, 9006, 613, 2322, 29922, 25932, 29889, 3389, 29892, 1371, 29922, 1191, 5510, 29889, 29903, 4897, 15094, 1799, 13, 4706, 1723, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1949, 29899, 23482, 29899, 3286, 25534, 613, 13, 9651, 1134, 29922, 524, 29892, 13, 9651, 2322, 29922, 23397, 29918, 13967, 29918, 26813, 20322, 23598, 29892, 13, 9651, 1371, 543, 4557, 310, 8943, 1301, 25534, 29892, 21274, 304, 1273, 29879, 29908, 1273, 22236, 29918, 13967, 29918, 26813, 20322, 23598, 29892, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1372, 29894, 29899, 12759, 7582, 613, 13, 9651, 2322, 543, 914, 828, 457, 613, 13, 9651, 19995, 29922, 703, 914, 828, 457, 613, 376, 3068, 2265, 4968, 13, 9651, 1371, 543, 1576, 21697, 323, 7597, 10938, 304, 671, 19602, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 2962, 29899, 16175, 613, 13, 9651, 2322, 29922, 29900, 29892, 13, 9651, 1134, 29922, 524, 29892, 13, 9651, 1371, 543, 23145, 304, 1369, 278, 6782, 472, 29892, 21274, 304, 29871, 29900, 19602, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 3188, 29899, 2084, 613, 13, 9651, 2322, 29922, 359, 29889, 657, 29883, 9970, 3285, 13, 9651, 3734, 29922, 8824, 29892, 13, 9651, 1371, 543, 5160, 2224, 310, 2060, 313, 11516, 525, 865, 29879, 29918, 20698, 22208, 2992, 9774, 21274, 304, 1857, 2224, 19602, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 16674, 29899, 3972, 29899, 1256, 613, 13, 9651, 2322, 29922, 12673, 29889, 1256, 29889, 27765, 2141, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 4968, 13, 9651, 1371, 543, 2539, 304, 671, 297, 7592, 3884, 29892, 21274, 304, 612, 14995, 29979, 29899, 7428, 29899, 7858, 310, 9826, 19602, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 16674, 29899, 3972, 29899, 11037, 613, 13, 9651, 2322, 10724, 5258, 29918, 978, 6822, 29995, 29879, 19248, 1256, 5038, 1273, 1067, 29879, 29889, 10568, 29918, 978, 29892, 13, 9651, 1371, 543, 17144, 304, 671, 363, 3386, 292, 7592, 4766, 613, 13, 4706, 1723, 13, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 5365, 290, 5779, 4155, 29918, 1372, 29894, 613, 13, 9651, 1134, 29922, 1191, 5510, 29889, 2283, 1542, 703, 2273, 4968, 13, 9651, 1371, 543, 2605, 304, 4768, 290, 5779, 354, 1691, 323, 7597, 934, 304, 2254, 19602, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 703, 3350, 6289, 29918, 7854, 613, 1371, 543, 2084, 304, 474, 1672, 8452, 4333, 304, 2436, 304, 23157, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1065, 29898, 13, 4706, 1067, 29879, 29892, 6389, 29892, 903, 16680, 29901, 1852, 5510, 29889, 15730, 11726, 29892, 903, 1491, 16680, 29901, 1852, 5510, 29889, 15730, 11726, 13, 1678, 1723, 1599, 19229, 29889, 27636, 29961, 524, 5387, 13, 4706, 9995, 9634, 1298, 964, 278, 1899, 1213, 15945, 13, 4706, 736, 1067, 29879, 29898, 5085, 467, 7978, 580, 13, 13, 1678, 822, 1423, 29918, 5085, 29898, 1311, 29892, 6389, 1125, 13, 4706, 9995, 29907, 4212, 363, 8454, 6273, 29892, 5712, 304, 1735, 10468, 1213, 15945, 13, 4706, 396, 5399, 10122, 310, 16077, 3011, 4167, 746, 451, 6724, 29889, 13, 4706, 565, 376, 2272, 1688, 29908, 451, 297, 10876, 29889, 7576, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 9651, 1423, 29918, 3350, 6289, 29918, 293, 3011, 4167, 29898, 25442, 29918, 6194, 29922, 8824, 29897, 13, 13, 4706, 620, 353, 29871, 29900, 13, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 5085, 29889, 3188, 29918, 2084, 1125, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 9651, 17927, 29889, 2704, 703, 5160, 2224, 1273, 29879, 947, 451, 1863, 613, 6389, 29889, 3188, 29918, 2084, 29897, 13, 9651, 620, 353, 29871, 29896, 13, 13, 4706, 736, 620, 13, 13, 1678, 822, 903, 4282, 29918, 11922, 29918, 3317, 29918, 16175, 29898, 1311, 29892, 9869, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 1125, 13, 4706, 3942, 29918, 3317, 29918, 16175, 353, 6571, 13, 4706, 363, 1016, 272, 297, 9869, 29889, 24840, 29918, 296, 1907, 29889, 5975, 7295, 13, 9651, 565, 9853, 29918, 1989, 297, 1016, 272, 29889, 17833, 29918, 7192, 359, 322, 3942, 29918, 1989, 297, 1016, 272, 29889, 17833, 29918, 7192, 359, 29901, 13, 18884, 3942, 29918, 333, 353, 1016, 272, 29889, 17833, 29918, 7192, 359, 29961, 11922, 29918, 1989, 29962, 13, 18884, 9853, 29918, 1217, 353, 1016, 272, 29889, 17833, 29918, 7192, 359, 29961, 16175, 29918, 1989, 29962, 13, 18884, 3942, 29918, 3317, 29918, 16175, 29961, 11922, 29918, 333, 29962, 353, 4236, 29898, 11922, 29918, 3317, 29918, 16175, 29889, 657, 29898, 11922, 29918, 333, 29892, 29871, 29900, 511, 9853, 29918, 1217, 29897, 13, 4706, 736, 3942, 29918, 3317, 29918, 16175, 13, 13, 1678, 822, 903, 16175, 29918, 974, 29898, 1311, 29892, 1016, 272, 29892, 3942, 29918, 3317, 29918, 16175, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 1125, 13, 4706, 565, 9853, 29918, 1989, 297, 1016, 272, 29889, 17833, 29918, 7192, 359, 29901, 13, 9651, 9853, 353, 1016, 272, 29889, 17833, 29918, 7192, 359, 29961, 16175, 29918, 1989, 29962, 13, 4706, 1683, 29901, 13, 9651, 9853, 353, 29871, 29900, 13, 4706, 565, 1583, 29889, 2962, 29918, 16175, 29918, 262, 29918, 11922, 322, 3942, 29918, 1989, 297, 1016, 272, 29889, 17833, 29918, 7192, 359, 29901, 13, 9651, 3942, 29918, 333, 353, 1016, 272, 29889, 17833, 29918, 7192, 359, 29961, 11922, 29918, 1989, 29962, 13, 9651, 9853, 353, 4236, 29898, 16175, 29892, 3942, 29918, 3317, 29918, 16175, 29961, 11922, 29918, 333, 2314, 13, 4706, 736, 9853, 13, 13, 1678, 822, 7709, 29918, 865, 29879, 29918, 5258, 29918, 7039, 29898, 13, 4706, 1583, 29892, 9869, 29892, 1375, 29918, 16175, 29922, 8516, 29892, 9853, 29918, 1989, 543, 16175, 3782, 613, 3942, 29918, 1989, 543, 11922, 1204, 29908, 13, 268, 1125, 13, 4706, 9995, 29979, 969, 599, 405, 10749, 3489, 2983, 515, 9869, 29889, 13, 13, 4706, 1932, 4954, 1195, 29918, 16175, 16159, 338, 2183, 769, 871, 278, 1016, 943, 363, 607, 278, 4954, 17833, 29918, 7192, 359, 29961, 16175, 29918, 1989, 7961, 29952, 338, 7621, 1135, 13, 4706, 4954, 1195, 29918, 16175, 16159, 674, 367, 1304, 29889, 13, 13, 4706, 910, 740, 508, 367, 975, 15638, 29892, 363, 1342, 304, 871, 2050, 278, 18111, 29889, 13, 4706, 9995, 13, 4706, 3942, 29918, 3317, 29918, 16175, 353, 1583, 3032, 4282, 29918, 11922, 29918, 3317, 29918, 16175, 29898, 9855, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 29897, 13, 13, 4706, 396, 10554, 599, 9562, 322, 4175, 491, 3942, 9853, 3553, 29889, 13, 4706, 363, 1016, 272, 297, 9869, 29889, 24840, 29918, 296, 1907, 29889, 5975, 7295, 13, 9651, 565, 1375, 29918, 16175, 338, 451, 6213, 29901, 13, 18884, 9853, 353, 1583, 3032, 16175, 29918, 974, 29898, 9176, 272, 29892, 3942, 29918, 3317, 29918, 16175, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 29897, 13, 18884, 565, 9853, 529, 1375, 29918, 16175, 29901, 13, 462, 1678, 17927, 29889, 8382, 29898, 13, 462, 4706, 376, 29903, 1984, 3262, 1016, 272, 1273, 29879, 1363, 1273, 29879, 353, 1273, 29881, 529, 1375, 29918, 16175, 353, 1273, 29881, 613, 13, 462, 4706, 1016, 272, 29889, 978, 29892, 13, 462, 4706, 9853, 29918, 1989, 29892, 13, 462, 4706, 9853, 29892, 13, 462, 4706, 1375, 29918, 16175, 29892, 13, 462, 1678, 1723, 13, 462, 1678, 6773, 13, 9651, 363, 17799, 29918, 11249, 297, 1016, 272, 29889, 24840, 29918, 27736, 29889, 5975, 7295, 13, 18884, 363, 1243, 29918, 11249, 297, 17799, 29918, 11249, 29889, 1688, 29918, 27736, 29889, 5975, 7295, 13, 462, 1678, 363, 3489, 297, 1243, 29918, 11249, 29889, 865, 29879, 29918, 492, 8464, 29889, 5975, 7295, 13, 462, 4706, 7709, 3489, 29889, 978, 13, 13, 1678, 822, 2048, 29918, 3188, 29918, 3972, 29918, 23705, 29918, 11037, 29898, 13, 4706, 1583, 29892, 3489, 29918, 978, 29901, 851, 13, 1678, 1723, 1599, 19229, 29889, 23215, 552, 29961, 710, 29892, 851, 5387, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 4706, 9995, 8893, 2967, 4516, 322, 13149, 4766, 304, 9773, 1213, 15945, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 9118, 1158, 2000, 29991, 1159, 13, 13, 1678, 822, 2048, 29918, 9057, 29879, 29898, 1311, 29892, 3489, 29918, 7039, 29897, 1599, 19229, 29889, 23215, 552, 29961, 4300, 571, 11947, 29892, 2023, 5387, 13, 4706, 9995, 8893, 934, 6782, 17643, 1213, 15945, 13, 4706, 6782, 29918, 9057, 29879, 353, 5159, 13, 4706, 363, 3489, 29918, 978, 297, 3489, 29918, 7039, 29901, 13, 9651, 2967, 29918, 3972, 29892, 13149, 29918, 11037, 353, 1583, 29889, 4282, 29918, 3188, 29918, 3972, 29918, 23705, 29918, 11037, 29898, 5258, 29918, 978, 29897, 13, 9651, 13149, 29918, 11037, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 3972, 29892, 13149, 29918, 11037, 29897, 13, 9651, 17927, 29889, 8382, 703, 29954, 2127, 4766, 363, 3489, 1273, 29879, 338, 1273, 29879, 613, 3489, 29918, 978, 29892, 13149, 29918, 11037, 29897, 13, 9651, 363, 13149, 29918, 2914, 297, 13149, 29889, 23705, 29898, 23705, 29918, 11037, 29892, 16732, 29922, 5574, 1125, 13, 18884, 1104, 29918, 2914, 353, 2897, 29889, 2084, 29889, 2674, 2084, 29898, 23705, 29918, 2914, 29892, 2967, 29918, 3972, 29897, 13, 18884, 1855, 29918, 2914, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 23705, 29918, 2914, 29897, 13, 18884, 565, 1855, 29918, 2914, 29889, 1975, 2541, 17350, 3487, 29945, 29908, 1125, 13, 462, 1678, 6773, 29871, 396, 14383, 29892, 674, 367, 2715, 6336, 13, 18884, 25342, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 6370, 29918, 2914, 1125, 13, 462, 1678, 6773, 29871, 396, 14383, 565, 1258, 451, 8814, 304, 934, 13, 18884, 7592, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 462, 1678, 1583, 29889, 5085, 29889, 3350, 6289, 29918, 7854, 29892, 13, 462, 1678, 1583, 29889, 5085, 29889, 16674, 29918, 3972, 29918, 11037, 29889, 4830, 29898, 13, 462, 4706, 3489, 29918, 978, 29922, 5258, 29918, 978, 29892, 2635, 29922, 1311, 29889, 5085, 29889, 16674, 29918, 3972, 29918, 1256, 13, 462, 1678, 10353, 13, 18884, 1723, 13, 18884, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 6370, 29918, 2914, 1125, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 462, 1678, 12020, 4750, 292, 2283, 2451, 703, 18552, 292, 934, 1273, 29879, 29908, 1273, 1855, 29918, 2914, 29897, 13, 18884, 565, 313, 13, 462, 1678, 451, 2897, 29889, 2084, 29889, 9933, 29898, 6370, 29918, 2914, 718, 11393, 3487, 29945, 1159, 322, 451, 1583, 29889, 5878, 29918, 3487, 29945, 29918, 5325, 13, 462, 1125, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 462, 1678, 12020, 4750, 292, 2283, 2451, 703, 18552, 292, 934, 1273, 29879, 29908, 1273, 313, 6370, 29918, 2914, 718, 11393, 3487, 29945, 5783, 13, 18884, 363, 1294, 297, 4852, 613, 11393, 3487, 29945, 29908, 1125, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 2159, 353, 2897, 29889, 2084, 29889, 657, 2311, 29898, 6370, 29918, 2914, 718, 1294, 29897, 13, 462, 1678, 5174, 438, 29173, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 462, 4706, 2159, 353, 29871, 29900, 13, 462, 1678, 6782, 29918, 9057, 29879, 29889, 4397, 29898, 13, 462, 4706, 17934, 11947, 29898, 13, 462, 9651, 2224, 29918, 4351, 29922, 6370, 29918, 2914, 718, 1294, 29892, 13, 462, 9651, 2224, 29918, 7854, 29922, 359, 29889, 2084, 29889, 7122, 29898, 16674, 29918, 3972, 29892, 1104, 29918, 2914, 718, 1294, 511, 13, 462, 9651, 6262, 29922, 2311, 29892, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 4706, 736, 18761, 29898, 24582, 29898, 3286, 571, 29918, 9057, 29879, 876, 13, 13, 1678, 822, 903, 7978, 29918, 3487, 29945, 29918, 5325, 29918, 5878, 29898, 13, 4706, 1583, 29892, 6782, 29918, 9057, 29879, 29901, 19229, 29889, 23215, 552, 29961, 4300, 571, 11947, 29892, 2023, 29962, 13, 1678, 1723, 1599, 19229, 29889, 23215, 552, 29961, 4300, 571, 11947, 29892, 2023, 5387, 13, 4706, 9995, 4391, 4567, 20672, 29945, 2066, 1213, 15945, 13, 4706, 3431, 29918, 9057, 29879, 353, 5159, 13, 4706, 10481, 29918, 9057, 29879, 353, 5159, 13, 4706, 363, 4982, 297, 6782, 29918, 9057, 29879, 29901, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 9057, 29889, 2084, 29918, 4351, 1125, 13, 18884, 10481, 29918, 9057, 29879, 29889, 4397, 29898, 9057, 29897, 13, 9651, 1683, 29901, 13, 18884, 3431, 29918, 9057, 29879, 29889, 4397, 29898, 9057, 29897, 13, 13, 4706, 3001, 29918, 13193, 353, 2533, 4197, 359, 29889, 2084, 29889, 657, 2311, 29898, 29926, 29889, 2084, 29918, 4351, 7503, 448, 2435, 17350, 3487, 29945, 1159, 2314, 363, 432, 297, 10481, 29918, 9057, 29879, 2314, 13, 4706, 17927, 29889, 3888, 29898, 13, 9651, 376, 20606, 292, 20672, 29945, 25470, 363, 1273, 29879, 2066, 310, 1273, 29879, 411, 701, 304, 1273, 29881, 10174, 613, 13, 9651, 7431, 29898, 29873, 8144, 29918, 9057, 29879, 511, 13, 9651, 13810, 29918, 23479, 29898, 7827, 29918, 13193, 511, 13, 9651, 1583, 29889, 5085, 29889, 1949, 29918, 23482, 29918, 3286, 25534, 29892, 13, 4706, 1723, 13, 4706, 17927, 29889, 3888, 703, 18552, 292, 20672, 29945, 2066, 3583, 29876, 29995, 29879, 613, 6634, 29876, 1642, 7122, 29898, 1958, 29898, 2892, 432, 29901, 432, 29889, 2084, 29918, 4351, 29892, 10481, 29918, 9057, 29879, 4961, 13, 4706, 6795, 353, 7865, 29898, 29883, 29918, 352, 549, 5426, 29892, 29871, 29900, 29897, 13, 4706, 411, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 7827, 29922, 7827, 29918, 13193, 29892, 5190, 543, 29933, 613, 5190, 29918, 7052, 29922, 5574, 29897, 408, 260, 29901, 13, 9651, 565, 1583, 29889, 5085, 29889, 1949, 29918, 23482, 29918, 3286, 25534, 1275, 29871, 29900, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 18884, 363, 4982, 297, 10481, 29918, 9057, 29879, 29901, 13, 462, 1678, 10272, 29918, 3487, 29945, 2083, 29898, 9057, 29892, 6795, 29892, 260, 29897, 13, 9651, 1683, 29901, 13, 18884, 11565, 353, 10480, 11426, 29898, 5014, 267, 29922, 1311, 29889, 5085, 29889, 1949, 29918, 23482, 29918, 3286, 25534, 29897, 13, 18884, 363, 4982, 297, 10481, 29918, 9057, 29879, 29901, 13, 462, 1678, 11565, 29889, 7302, 29918, 12674, 29898, 26017, 29918, 3487, 29945, 2083, 29892, 6389, 7607, 9057, 29892, 6795, 29892, 260, 876, 13, 18884, 11565, 29889, 5358, 580, 13, 18884, 11565, 29889, 7122, 580, 13, 13, 4706, 396, 9788, 29892, 8161, 934, 15786, 1156, 2309, 29889, 13, 4706, 2309, 29918, 9057, 29879, 353, 518, 13, 9651, 17934, 11947, 29898, 13, 18884, 2224, 29918, 4351, 29922, 29926, 29889, 2084, 29918, 4351, 29892, 13, 18884, 2224, 29918, 7854, 29922, 29926, 29889, 2084, 29918, 7854, 29892, 13, 18884, 6262, 29922, 359, 29889, 2084, 29889, 657, 2311, 29898, 29926, 29889, 2084, 29918, 4351, 511, 13, 18884, 1899, 29922, 29926, 29889, 6519, 29892, 13, 9651, 1723, 13, 9651, 363, 432, 297, 10481, 29918, 9057, 29879, 13, 4706, 4514, 13, 4706, 736, 18761, 29898, 24582, 29898, 15091, 29918, 9057, 29879, 718, 3431, 29918, 9057, 29879, 876, 13, 13, 1678, 822, 6222, 29898, 1311, 29897, 1599, 19229, 29889, 27636, 29961, 524, 5387, 13, 4706, 9995, 12296, 278, 6782, 1213, 15945, 13, 4706, 620, 353, 1583, 29889, 3198, 29918, 5085, 29898, 1311, 29889, 5085, 29897, 13, 4706, 565, 620, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 9651, 736, 620, 13, 13, 4706, 17927, 29889, 3888, 703, 4763, 292, 13630, 29875, 29899, 11178, 5807, 14862, 1273, 29879, 613, 1583, 29889, 6519, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 703, 29871, 6389, 29901, 1273, 29879, 613, 1583, 29889, 5085, 29897, 13, 13, 4706, 9869, 353, 2254, 29918, 9855, 29918, 1372, 29894, 29898, 1311, 29889, 5085, 29897, 13, 4706, 3489, 29918, 7039, 353, 1051, 29898, 1311, 29889, 29891, 969, 29918, 865, 29879, 29918, 5258, 29918, 7039, 29898, 9855, 29892, 1375, 29918, 16175, 29922, 1311, 29889, 5085, 29889, 2962, 29918, 16175, 876, 13, 4706, 17927, 29889, 3888, 703, 29931, 4626, 4314, 297, 9869, 3583, 29876, 29995, 29879, 613, 6634, 29876, 1642, 7122, 29898, 24582, 29898, 5258, 29918, 7039, 4961, 13, 13, 4706, 6782, 29918, 9057, 29879, 353, 1583, 29889, 4282, 29918, 9057, 29879, 29898, 5258, 29918, 7039, 29897, 13, 4706, 17927, 29889, 8382, 703, 4300, 571, 17643, 3583, 29876, 29995, 29879, 613, 6634, 29876, 1642, 7122, 29898, 1958, 29898, 2892, 921, 29901, 921, 29889, 517, 29918, 265, 5570, 3285, 6782, 29918, 9057, 29879, 4961, 13, 13, 4706, 565, 1583, 29889, 5878, 29918, 3487, 29945, 29918, 5325, 29901, 13, 9651, 6782, 29918, 9057, 29879, 353, 1583, 3032, 7978, 29918, 3487, 29945, 29918, 5325, 29918, 5878, 29898, 3286, 571, 29918, 9057, 29879, 29897, 13, 13, 4706, 3001, 29918, 13193, 353, 2533, 4197, 9057, 29889, 13193, 363, 4982, 297, 6782, 29918, 9057, 29879, 2314, 13, 4706, 17927, 29889, 3888, 29898, 13, 9651, 376, 4300, 571, 5393, 1273, 29881, 2066, 411, 263, 3001, 2159, 310, 1273, 29879, 613, 13, 9651, 7431, 29898, 3286, 571, 29918, 9057, 29879, 511, 13, 9651, 13810, 29918, 23479, 29898, 7827, 29918, 13193, 511, 13, 4706, 1723, 13, 4706, 6795, 353, 7865, 29898, 29883, 29918, 352, 549, 5426, 29892, 29871, 29900, 29897, 13, 4706, 411, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29898, 7827, 29922, 7827, 29918, 13193, 29892, 5190, 543, 29933, 613, 5190, 29918, 7052, 29922, 5574, 29897, 408, 260, 29901, 13, 9651, 565, 1583, 29889, 5085, 29889, 1949, 29918, 23482, 29918, 3286, 25534, 1275, 29871, 29900, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 18884, 363, 4982, 297, 6782, 29918, 9057, 29879, 29901, 13, 462, 1678, 3805, 16593, 29918, 3286, 571, 29898, 9057, 29892, 6795, 29892, 260, 29897, 13, 9651, 1683, 29901, 13, 18884, 11565, 353, 10480, 11426, 29898, 5014, 267, 29922, 1311, 29889, 5085, 29889, 1949, 29918, 23482, 29918, 3286, 25534, 29897, 13, 18884, 363, 4982, 297, 6782, 29918, 9057, 29879, 29901, 13, 462, 1678, 11565, 29889, 7302, 29918, 12674, 29898, 12935, 2720, 29918, 3286, 571, 29892, 6389, 7607, 9057, 29892, 6795, 29892, 260, 876, 13, 18884, 11565, 29889, 5358, 580, 13, 18884, 11565, 29889, 7122, 580, 13, 13, 4706, 17927, 29889, 3888, 703, 3596, 2309, 1159, 13, 4706, 736, 6213, 13, 13, 13, 1990, 11374, 29931, 4626, 4314, 11730, 29924, 861, 262, 29901, 13, 1678, 9995, 29924, 861, 262, 363, 4954, 29903, 29876, 14862, 29902, 3286, 571, 6255, 5160, 16159, 393, 871, 1136, 11376, 9562, 310, 18111, 1213, 15945, 13, 13, 1678, 822, 7709, 29918, 865, 29879, 29918, 5258, 29918, 7039, 29898, 13, 4706, 1583, 29892, 9869, 29892, 1375, 29918, 16175, 29922, 8516, 29892, 9853, 29918, 1989, 543, 16175, 3782, 613, 3942, 29918, 1989, 543, 11922, 1204, 29908, 13, 268, 1125, 13, 4706, 3942, 29918, 3317, 29918, 16175, 353, 1583, 3032, 4282, 29918, 11922, 29918, 3317, 29918, 16175, 29898, 9855, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 29897, 13, 13, 4706, 21697, 29918, 9855, 353, 21697, 29879, 29889, 29954, 261, 828, 457, 8259, 10654, 29898, 9855, 29897, 13, 4706, 363, 25922, 929, 297, 21697, 29918, 9855, 29889, 1111, 29882, 441, 29889, 9795, 335, 11003, 29901, 13, 9651, 1016, 272, 353, 25922, 929, 29889, 2248, 13, 9651, 565, 1375, 29918, 16175, 338, 451, 6213, 29901, 13, 18884, 9853, 353, 1583, 3032, 16175, 29918, 974, 29898, 9176, 272, 29892, 3942, 29918, 3317, 29918, 16175, 29892, 9853, 29918, 1989, 29892, 3942, 29918, 1989, 29897, 13, 18884, 565, 9853, 529, 1375, 29918, 16175, 29901, 13, 462, 1678, 17927, 29889, 8382, 29898, 13, 462, 4706, 376, 29903, 1984, 3262, 1016, 272, 1273, 29879, 1363, 1273, 29879, 353, 1273, 29881, 529, 1375, 29918, 16175, 353, 1273, 29881, 613, 13, 462, 4706, 1016, 272, 29889, 978, 29892, 13, 462, 4706, 9853, 29918, 1989, 29892, 13, 462, 4706, 1016, 272, 29889, 17833, 29918, 7192, 359, 29961, 16175, 29918, 1989, 1402, 13, 462, 4706, 1375, 29918, 16175, 29892, 13, 462, 1678, 1723, 13, 462, 1678, 6773, 13, 9651, 7709, 1016, 272, 29889, 29881, 1056, 29918, 865, 29879, 29918, 5258, 29889, 978, 13, 13, 13, 29992, 5552, 29889, 29879, 29898, 29888, 307, 2256, 29922, 5574, 29892, 4469, 29918, 1131, 1091, 29879, 29922, 5574, 29897, 13, 1990, 3497, 3047, 3505, 29901, 13, 1678, 9995, 20547, 310, 2224, 411, 2159, 1213, 15945, 13, 13, 1678, 396, 29901, 10802, 304, 934, 29889, 13, 1678, 2224, 29901, 851, 13, 1678, 396, 29901, 3497, 2159, 29889, 13, 1678, 6262, 29901, 938, 13, 13, 13, 1753, 10272, 29918, 3487, 29945, 2083, 29898, 9057, 29901, 17934, 11947, 29892, 6795, 29901, 7865, 29892, 260, 29901, 260, 29939, 18933, 29889, 29873, 29939, 18933, 29897, 1599, 6213, 29901, 13, 1678, 9995, 20606, 29872, 20672, 29945, 2533, 411, 4954, 3487, 29945, 2083, 16159, 1899, 1213, 15945, 13, 1678, 4516, 978, 353, 2897, 29889, 2084, 29889, 25721, 29898, 9057, 29889, 2084, 29918, 4351, 29897, 13, 1678, 10422, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 9057, 29889, 2084, 29918, 4351, 29897, 7503, 448, 2435, 17350, 3487, 29945, 13531, 13, 1678, 2224, 29918, 3487, 29945, 353, 4982, 29889, 2084, 29918, 4351, 13, 13, 1678, 22821, 29945, 2083, 29918, 19218, 353, 6796, 3487, 29945, 2083, 613, 10422, 29962, 13, 1678, 17927, 29889, 8382, 703, 20606, 292, 20672, 29945, 2083, 1273, 29879, 1405, 1273, 29879, 613, 376, 11393, 7122, 29898, 3487, 29945, 2083, 29918, 19218, 511, 10422, 718, 11393, 3487, 29945, 1159, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 2084, 29918, 3487, 29945, 29892, 376, 14554, 1159, 408, 22821, 29945, 29888, 29901, 13, 9651, 1423, 29918, 4804, 29898, 3487, 29945, 2083, 29918, 19218, 29892, 274, 9970, 29922, 25721, 29892, 27591, 29922, 3487, 29945, 29888, 29897, 13, 1678, 5174, 3323, 5014, 2392, 408, 321, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 4706, 17927, 29889, 2704, 703, 26604, 14012, 22821, 29945, 2083, 29901, 1273, 29879, 613, 321, 29897, 13, 4706, 17927, 29889, 3888, 703, 7301, 21081, 934, 1156, 1059, 29901, 1273, 29879, 613, 2224, 29918, 3487, 29945, 29897, 13, 4706, 1018, 29901, 13, 9651, 2897, 29889, 5992, 29898, 2084, 29918, 3487, 29945, 29897, 13, 4706, 5174, 438, 29173, 408, 321, 29918, 1758, 29901, 29871, 396, 282, 23929, 29901, 302, 542, 957, 13, 9651, 17927, 29889, 2704, 703, 23323, 451, 3349, 934, 29901, 1273, 29879, 613, 321, 29918, 1758, 29897, 13, 4706, 12020, 321, 13, 13, 1678, 411, 6795, 29889, 657, 29918, 908, 7295, 13, 4706, 6795, 29889, 1767, 4619, 2897, 29889, 2084, 29889, 657, 2311, 29898, 9057, 29889, 2084, 29918, 4351, 7503, 448, 2435, 17350, 3487, 29945, 1159, 2314, 13, 4706, 260, 29889, 5504, 29898, 11808, 29889, 1767, 29897, 13, 2 ]
faro/utils.py
cgiraldo/FARO
0
27904
import re import gensim.utils as gensim_utils def normalize_text_proximity(message): """ Clean text of dots between words Keyword arguments: message -- a plain sentence or paragraph """ sent = message.lower() sent = sent.replace("á", "a") sent = sent.replace("é", "e") sent = sent.replace("í", "i") sent = sent.replace("ó", "o") sent = sent.replace("ú", "u") sent = re.sub(r'(?i)(?<=[a-z])\.(?=[a-z])', "", sent) return sent def clean_text(message): """ Delete extra characters from text before validation Keyword arguments: message -- a plain sentence or paragraph """ sent = re.sub(r'[\-_*+,\(\).:]{1,}', "", message) sent = re.sub(r'[ ]{1,}', "", sent) sent = re.sub(r'(?i)\bnº', "", sent) return sent def preprocess_text(message): """ Delete some artifacts from text Keyword arguments: message -- a plain sentence or paragraph """ uni_message = gensim_utils.to_unicode(message) uni_message = uni_message.replace("\t", " ") uni_message = uni_message.replace("\r\n", " ") uni_message = uni_message.replace("\r", " ") uni_message = uni_message.replace("\n", " ") return uni_message def word2features(sent, i): """ Extract features of a node in the "sent" list for a CRF Keyword arguments: sent -- a list of triples <word, PoS tag, label> i -- index of the node to extract the featues """ word = sent[i][0] postag = sent[i][1] features = { 'bias': 1.0, 'word': word, 'word.lower()': word.lower(), 'word.istitle()': word.istitle(), 'word[-3:]': word[-3:], 'word[:3]': word[:3], 'word.isdigit()': word.isdigit(), 'postag': postag, } if i > 0: word1 = sent[i-1][0] postag1 = sent[i-1][1] features.update({ '-1:word': word1, '-1:word.lower()': word1.lower(), '-1:word.istitle': word1.istitle(), '-1:postag': postag1, }) else: features['BOS'] = True # EXTRA if i > 2: word1 = sent[i-2][0] postag1 = sent[i-2][1] features.update({ '-2:word': word1, '-2:word.lower()': word1.lower(), '-2:word.istitle': word1.istitle(), '-2:word.postag': postag1, }) if i > 3: word1 = sent[i-3][0] postag1 = sent[i-3][1] features.update({ '-3:word': word1, '-3:word.lower()': word1.lower(), '-3:word.istitle': word1.istitle(), '-3:word.postag': postag1, }) if i > 2: word0 = sent[i][0] postag0 = sent[i][1] word1 = sent[i-1][0] postag1 = sent[i-1][1] features.update({ '-01:word': word1 + word0, '-01:word.lower()': (word1 + " " + word0).lower(), '-01:word0_postag1': postag1 + word0, '-01:word1_postag0': postag0 + word1, }) if i > 3: word0 = sent[i][0] word1 = sent[i-2][0] postag0 = sent[i][1] postag1 = sent[i-2][1] features.update({ '-02:word': word1 + word0, '-02:word.lower()': (word1 + " " + word0).lower(), '-02:word0_postag1': postag1 + word0, '-02:word1_postag0': postag0 + word1, }) if i < len(sent) - 2: word1 = sent[i+2][0] postag1 = sent[i+2][1] features.update({ '+2:word': word1, '+2:word.lower()': word1.lower(), '+2:word.istitle': word1.istitle(), '+2:word.postag': postag1, }) if i < len(sent)-1: word1 = sent[i+1][0] postag1 = sent[i+1][1] features.update({ '+1:word': word1, '+1:word.lower()': word1.lower(), '+1:word.istitle()': word1.istitle(), '+1:postag': postag1, }) else: features['EOS'] = True return features def char2features_mail(sent, i): """ Extract features of a node (for the mail CRF) Keyword arguments: sent -- a list of pairs <word, label> i -- index of the node to extract the featues """ word = sent[i][0] features = { 'bias': 1.0, 'char.lower()': word.lower(), } if i > 0: word1 = sent[i-1][0] features.update({ '-1:char.lower()': word1.lower(), }) else: features['BOS'] = True if i < len(sent)-1: word1 = sent[i+1][0] features.update({ '+1:char.lower()': word1.lower(), }) else: features['EOS'] = True # EXTRA if i > 2: word1 = sent[i-2][0] features.update({ '-2:char.lower()': word1.lower(), }) if i > 3: word1 = sent[i-3][0] features.update({ '-3:char.lower()': word1.lower(), }) if i > 4: word1 = sent[i-4][0] features.update({ '-4:char.lower()': word1.lower(), }) if i > 5: word1 = sent[i-5][0] features.update({ '-5:char.lower()': word1.lower(), }) if i > 6: word1 = sent[i-6][0] features.update({ '-6:char.lower()': word1.lower(), }) if i > 7: word1 = sent[i-7][0] features.update({ '-7:char.lower()': word1.lower(), }) if i > 8: word1 = sent[i-8][0] features.update({ '-8:char.lower()': word1.lower(), }) if i < len(sent) - 2: word1 = sent[i+2][0] features.update({ '+2:char.lower()': word1.lower(), }) if i < len(sent) - 3: word1 = sent[i+3][0] features.update({ '+3:char.lower()': word1.lower(), }) if i < len(sent) - 4: word1 = sent[i+4][0] features.update({ '+4:char.lower()': word1.lower(), }) if i < len(sent) - 5: word1 = sent[i+5][0] features.update({ '+5:char.lower()': word1.lower(), }) if i < len(sent) - 6: word1 = sent[i+6][0] features.update({ '+6:char.lower()': word1.lower(), }) if i < len(sent) - 7: word1 = sent[i+7][0] features.update({ '+7:char.lower()': word1.lower(), }) if i < len(sent) - 8: word1 = sent[i+8][0] features.update({ '+8:char.lower()': word1.lower(), }) return features def char2features_space(sent, i): """ Extract features of a node (for the whitespace-CRF detector) Keyword arguments: sent -- a list of pairs <word, label> i -- index of the node to extract the featues """ word = sent[i][0] features = { 'bias': 1.0, 'char': word, 'char.lower()': word.lower(), } if i > 0: word1 = sent[i-1][0] features.update({ '-1:char': word1, '-1:char.lower()': word1.lower(), '-1:char.isdigit()': word1.isdigit(), }) else: features['BOS'] = True if i < len(sent)-1: word1 = sent[i+1][0] features.update({ '+1:char': word1, '+1:char.lower()': word1.lower(), '+1:char.isdigit()': word1.isdigit(), }) else: features['EOS'] = True # EXTRA if i > 2: word1 = sent[i-2][0] features.update({ '-2:char': word1, '-2:char.lower()': word1.lower(), '-2:char.isdigit()': word1.isdigit(), }) if i > 2: word1 = sent[i-2][0] word2 = sent[i-1][0] features.update({ '-21:char.lower()': word1.lower() + word2.lower(), '-21:char.isdigit()': word1.isdigit() and word2.isdigit(), }) if i > 3: word1 = sent[i-3][0] features.update({ '-3:char': word1, '-3:char.lower()': word1.lower(), '-3:char.isdigit()': word1.isdigit(), }) if i > 3: word1 = sent[i-3][0] word2 = sent[i-2][0] features.update({ '-32:char.lower()': word1.lower() + word2.lower(), '-32:char.isdigit()': word1.isdigit() and word2.isdigit(), }) if i < len(sent) - 2: word1 = sent[i+2][0] features.update({ '+2:char': word1, '+2:char.lower()': word1.lower(), '+2:char.isdigit()': word1.isdigit(), }) if i < len(sent) - 2: word1 = sent[i+1][0] word2 = sent[i+2][0] features.update({ '+21:char.lower()': word1.lower() + word2.lower(), '+21:char.isdigit()': word1.isdigit() and word2.isdigit(), }) if i < len(sent) - 3: word1 = sent[i+3][0] features.update({ '+3:char': word1, '+3:char.lower()': word1.lower(), '+3:char.isdigit()': word1.isdigit(), }) if i < len(sent) - 3: word1 = sent[i+2][0] word2 = sent[i+3][0] features.update({ '+32:char.lower()': word1.lower() + word2.lower(), '+32:char.isdigit()': word1.isdigit() and word2.isdigit(), }) if i < len(sent) - 3: word0 = sent[i][0] word1 = sent[i+1][0] word2 = sent[i+2][0] features.update({ '+02:lower()': (word0 + word1 + word2).lower(), '+02:isdigit()': (word0 + word1 + word2).isdigit(), }) return features
[ 1, 1053, 337, 13, 5215, 26943, 326, 29889, 13239, 408, 26943, 326, 29918, 13239, 13, 13, 13, 1753, 4226, 675, 29918, 726, 29918, 771, 2657, 537, 29898, 4906, 1125, 13, 1678, 9995, 315, 14044, 1426, 310, 270, 1862, 1546, 3838, 13, 268, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2643, 1192, 263, 8656, 10541, 470, 14880, 13, 13, 1678, 9995, 13, 13, 1678, 2665, 353, 2643, 29889, 13609, 580, 13, 1678, 2665, 353, 2665, 29889, 6506, 703, 29976, 613, 376, 29874, 1159, 13, 1678, 2665, 353, 2665, 29889, 6506, 703, 29948, 613, 376, 29872, 1159, 13, 1678, 2665, 353, 2665, 29889, 6506, 703, 29983, 613, 376, 29875, 1159, 13, 1678, 2665, 353, 2665, 29889, 6506, 703, 29980, 613, 376, 29877, 1159, 13, 1678, 2665, 353, 2665, 29889, 6506, 703, 30030, 613, 376, 29884, 1159, 13, 1678, 2665, 353, 337, 29889, 1491, 29898, 29878, 29915, 10780, 29875, 5033, 29973, 29966, 11759, 29874, 29899, 29920, 29962, 2144, 29889, 10780, 11759, 29874, 29899, 29920, 2314, 742, 12633, 2665, 29897, 13, 13, 1678, 736, 2665, 13, 13, 13, 1753, 5941, 29918, 726, 29898, 4906, 1125, 13, 1678, 9995, 21267, 4805, 4890, 515, 1426, 1434, 8845, 13, 268, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2643, 1192, 263, 8656, 10541, 470, 14880, 13, 13, 1678, 9995, 13, 13, 1678, 2665, 353, 337, 29889, 1491, 29898, 29878, 29915, 7110, 29899, 24563, 29974, 2053, 1194, 467, 29901, 3199, 29896, 29892, 29913, 742, 12633, 2643, 29897, 13, 1678, 2665, 353, 337, 29889, 1491, 29898, 29878, 29915, 29961, 29871, 3199, 29896, 29892, 29913, 742, 12633, 2665, 29897, 13, 1678, 2665, 353, 337, 29889, 1491, 29898, 29878, 29915, 10780, 29875, 2144, 11197, 30105, 742, 12633, 2665, 29897, 13, 13, 1678, 736, 2665, 13, 13, 13, 1753, 758, 5014, 29918, 726, 29898, 4906, 1125, 13, 1678, 9995, 21267, 777, 24238, 29879, 515, 1426, 13, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2643, 1192, 263, 8656, 10541, 470, 14880, 13, 13, 1678, 9995, 13, 13, 1678, 443, 29875, 29918, 4906, 353, 26943, 326, 29918, 13239, 29889, 517, 29918, 2523, 356, 29898, 4906, 29897, 13, 1678, 443, 29875, 29918, 4906, 353, 443, 29875, 29918, 4906, 29889, 6506, 14182, 29873, 613, 376, 16521, 13, 1678, 443, 29875, 29918, 4906, 353, 443, 29875, 29918, 4906, 29889, 6506, 14182, 29878, 29905, 29876, 613, 376, 16521, 13, 1678, 443, 29875, 29918, 4906, 353, 443, 29875, 29918, 4906, 29889, 6506, 14182, 29878, 613, 376, 16521, 13, 1678, 443, 29875, 29918, 4906, 353, 443, 29875, 29918, 4906, 29889, 6506, 14182, 29876, 613, 376, 16521, 13, 13, 1678, 736, 443, 29875, 29918, 4906, 13, 13, 13, 1753, 1734, 29906, 22100, 29898, 18616, 29892, 474, 1125, 13, 1678, 9995, 7338, 1461, 5680, 310, 263, 2943, 297, 278, 376, 18616, 29908, 1051, 363, 263, 15600, 29943, 13, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2665, 1192, 263, 1051, 310, 3367, 2701, 529, 1742, 29892, 3929, 29903, 4055, 29892, 3858, 29958, 13, 1678, 474, 1192, 2380, 310, 278, 2943, 304, 6597, 278, 1238, 271, 1041, 13, 13, 1678, 9995, 13, 13, 1678, 1734, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 1678, 1400, 351, 353, 2665, 29961, 29875, 3816, 29896, 29962, 13, 13, 1678, 5680, 353, 426, 13, 4706, 525, 29890, 3173, 2396, 29871, 29896, 29889, 29900, 29892, 13, 4706, 525, 1742, 2396, 1734, 29892, 13, 4706, 525, 1742, 29889, 13609, 580, 2396, 1734, 29889, 13609, 3285, 13, 4706, 525, 1742, 29889, 391, 1740, 580, 2396, 1734, 29889, 391, 1740, 3285, 13, 4706, 525, 1742, 14352, 29941, 17531, 2396, 1734, 14352, 29941, 29901, 1402, 13, 4706, 525, 1742, 7503, 29941, 29962, 2396, 1734, 7503, 29941, 1402, 13, 4706, 525, 1742, 29889, 275, 26204, 580, 2396, 1734, 29889, 275, 26204, 3285, 13, 4706, 525, 2490, 351, 2396, 1400, 351, 29892, 13, 13, 1678, 500, 13, 13, 1678, 565, 474, 1405, 29871, 29900, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29896, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29896, 29901, 1742, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29896, 29901, 1742, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29896, 29901, 1742, 29889, 391, 1740, 2396, 1734, 29896, 29889, 391, 1740, 3285, 13, 9651, 17411, 29896, 29901, 2490, 351, 2396, 1400, 351, 29896, 29892, 13, 4706, 5615, 13, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29933, 3267, 2033, 353, 5852, 13, 13, 1678, 396, 8528, 29911, 4717, 13, 13, 1678, 565, 474, 1405, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29896, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29906, 29901, 1742, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29906, 29901, 1742, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29906, 29901, 1742, 29889, 391, 1740, 2396, 1734, 29896, 29889, 391, 1740, 3285, 13, 9651, 17411, 29906, 29901, 1742, 29889, 2490, 351, 2396, 1400, 351, 29896, 29892, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29941, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29899, 29941, 3816, 29896, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29941, 29901, 1742, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29941, 29901, 1742, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29941, 29901, 1742, 29889, 391, 1740, 2396, 1734, 29896, 29889, 391, 1740, 3285, 13, 9651, 17411, 29941, 29901, 1742, 29889, 2490, 351, 2396, 1400, 351, 29896, 29892, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29906, 29901, 13, 4706, 1734, 29900, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 4706, 1400, 351, 29900, 353, 2665, 29961, 29875, 3816, 29896, 29962, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29896, 29962, 13, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29900, 29896, 29901, 1742, 2396, 1734, 29896, 718, 1734, 29900, 29892, 13, 9651, 17411, 29900, 29896, 29901, 1742, 29889, 13609, 580, 2396, 313, 1742, 29896, 718, 376, 376, 718, 1734, 29900, 467, 13609, 3285, 13, 9651, 17411, 29900, 29896, 29901, 1742, 29900, 29918, 2490, 351, 29896, 2396, 1400, 351, 29896, 718, 1734, 29900, 29892, 13, 9651, 17411, 29900, 29896, 29901, 1742, 29896, 29918, 2490, 351, 29900, 2396, 1400, 351, 29900, 718, 1734, 29896, 29892, 13, 9651, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29941, 29901, 13, 4706, 1734, 29900, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 1400, 351, 29900, 353, 2665, 29961, 29875, 3816, 29896, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29896, 29962, 13, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29900, 29906, 29901, 1742, 2396, 1734, 29896, 718, 1734, 29900, 29892, 13, 9651, 17411, 29900, 29906, 29901, 1742, 29889, 13609, 580, 2396, 313, 1742, 29896, 718, 376, 376, 718, 1734, 29900, 467, 13609, 3285, 13, 9651, 17411, 29900, 29906, 29901, 1742, 29900, 29918, 2490, 351, 29896, 2396, 1400, 351, 29896, 718, 1734, 29900, 29892, 13, 9651, 17411, 29900, 29906, 29901, 1742, 29896, 29918, 2490, 351, 29900, 2396, 1400, 351, 29900, 718, 1734, 29896, 29892, 13, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29896, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29906, 29901, 1742, 2396, 1734, 29896, 29892, 13, 9651, 525, 29974, 29906, 29901, 1742, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 525, 29974, 29906, 29901, 1742, 29889, 391, 1740, 2396, 1734, 29896, 29889, 391, 1740, 3285, 13, 9651, 525, 29974, 29906, 29901, 1742, 29889, 2490, 351, 2396, 1400, 351, 29896, 29892, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 6817, 29896, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29900, 29962, 13, 4706, 1400, 351, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29896, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29896, 29901, 1742, 2396, 1734, 29896, 29892, 13, 9651, 525, 29974, 29896, 29901, 1742, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 525, 29974, 29896, 29901, 1742, 29889, 391, 1740, 580, 2396, 1734, 29896, 29889, 391, 1740, 3285, 13, 9651, 525, 29974, 29896, 29901, 2490, 351, 2396, 1400, 351, 29896, 29892, 13, 4706, 5615, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29923, 3267, 2033, 353, 5852, 13, 13, 1678, 736, 5680, 13, 13, 13, 1753, 1373, 29906, 22100, 29918, 2549, 29898, 18616, 29892, 474, 1125, 13, 1678, 9995, 7338, 1461, 5680, 310, 263, 2943, 313, 1454, 278, 10524, 15600, 29943, 29897, 13, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2665, 1192, 263, 1051, 310, 11000, 529, 1742, 29892, 3858, 29958, 13, 1678, 474, 1192, 2380, 310, 278, 2943, 304, 6597, 278, 1238, 271, 1041, 13, 13, 1678, 9995, 13, 13, 1678, 1734, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 13, 1678, 5680, 353, 426, 13, 4706, 525, 29890, 3173, 2396, 29871, 29896, 29889, 29900, 29892, 13, 4706, 525, 3090, 29889, 13609, 580, 2396, 1734, 29889, 13609, 3285, 13, 1678, 500, 13, 13, 1678, 565, 474, 1405, 29871, 29900, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29933, 3267, 2033, 353, 5852, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 6817, 29896, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29923, 3267, 2033, 353, 5852, 13, 13, 1678, 396, 8528, 29911, 4717, 13, 13, 1678, 565, 474, 1405, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29941, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29941, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29946, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29946, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29946, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29945, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29945, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29945, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29953, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29953, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29953, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29955, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29955, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29955, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29947, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29947, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29947, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29941, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29941, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29946, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29946, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29946, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29945, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29945, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29945, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29953, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29953, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29953, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29955, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29955, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29955, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29947, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29947, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29947, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 4706, 5615, 13, 13, 1678, 736, 5680, 13, 13, 13, 1753, 1373, 29906, 22100, 29918, 3493, 29898, 18616, 29892, 474, 1125, 13, 1678, 9995, 7338, 1461, 5680, 310, 263, 2943, 313, 1454, 278, 24358, 29899, 11341, 29943, 1439, 3019, 29897, 13, 13, 1678, 7670, 1742, 6273, 29901, 13, 1678, 2665, 1192, 263, 1051, 310, 11000, 529, 1742, 29892, 3858, 29958, 13, 1678, 474, 1192, 2380, 310, 278, 2943, 304, 6597, 278, 1238, 271, 1041, 13, 13, 1678, 9995, 13, 13, 1678, 1734, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 13, 1678, 5680, 353, 426, 13, 4706, 525, 29890, 3173, 2396, 29871, 29896, 29889, 29900, 29892, 13, 4706, 525, 3090, 2396, 1734, 29892, 13, 4706, 525, 3090, 29889, 13609, 580, 2396, 1734, 29889, 13609, 3285, 13, 1678, 500, 13, 13, 1678, 565, 474, 1405, 29871, 29900, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29896, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29896, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29933, 3267, 2033, 353, 5852, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 6817, 29896, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29896, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 525, 29974, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 525, 29974, 29896, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 1678, 1683, 29901, 13, 4706, 5680, 1839, 29923, 3267, 2033, 353, 5852, 13, 13, 1678, 396, 8528, 29911, 4717, 13, 1678, 565, 474, 1405, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29906, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29906, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 1734, 29906, 353, 2665, 29961, 29875, 29899, 29896, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29906, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 580, 718, 1734, 29906, 29889, 13609, 3285, 13, 9651, 17411, 29906, 29896, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 580, 322, 1734, 29906, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29941, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29941, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 17411, 29941, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 17411, 29941, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 1405, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29899, 29941, 3816, 29900, 29962, 13, 4706, 1734, 29906, 353, 2665, 29961, 29875, 29899, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 17411, 29941, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 580, 718, 1734, 29906, 29889, 13609, 3285, 13, 9651, 17411, 29941, 29906, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 580, 322, 1734, 29906, 29889, 275, 26204, 3285, 13, 4706, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29906, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 525, 29974, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 525, 29974, 29906, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29906, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29900, 29962, 13, 4706, 1734, 29906, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29906, 29896, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 580, 718, 1734, 29906, 29889, 13609, 3285, 13, 9651, 525, 29974, 29906, 29896, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 580, 322, 1734, 29906, 29889, 275, 26204, 3285, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29941, 3816, 29900, 29962, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29941, 29901, 3090, 2396, 1734, 29896, 29892, 13, 9651, 525, 29974, 29941, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 3285, 13, 9651, 525, 29974, 29941, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 3285, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29941, 29901, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 4706, 1734, 29906, 353, 2665, 29961, 29875, 29974, 29941, 3816, 29900, 29962, 13, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29941, 29906, 29901, 3090, 29889, 13609, 580, 2396, 1734, 29896, 29889, 13609, 580, 718, 1734, 29906, 29889, 13609, 3285, 13, 9651, 525, 29974, 29941, 29906, 29901, 3090, 29889, 275, 26204, 580, 2396, 1734, 29896, 29889, 275, 26204, 580, 322, 1734, 29906, 29889, 275, 26204, 3285, 13, 9651, 5615, 13, 13, 1678, 565, 474, 529, 7431, 29898, 18616, 29897, 448, 29871, 29941, 29901, 13, 4706, 1734, 29900, 353, 2665, 29961, 29875, 3816, 29900, 29962, 13, 4706, 1734, 29896, 353, 2665, 29961, 29875, 29974, 29896, 3816, 29900, 29962, 13, 4706, 1734, 29906, 353, 2665, 29961, 29875, 29974, 29906, 3816, 29900, 29962, 13, 13, 4706, 5680, 29889, 5504, 3319, 13, 9651, 525, 29974, 29900, 29906, 29901, 13609, 580, 2396, 313, 1742, 29900, 718, 1734, 29896, 718, 1734, 29906, 467, 13609, 3285, 13, 9651, 525, 29974, 29900, 29906, 29901, 275, 26204, 580, 2396, 313, 1742, 29900, 718, 1734, 29896, 718, 1734, 29906, 467, 275, 26204, 3285, 13, 9651, 5615, 13, 13, 1678, 736, 5680, 13, 2 ]
htvlearn/plots/base_plot.py
joaquimcampos/HTV-Learn
1
1611972
<gh_stars>1-10 import os import copy import numpy as np import plotly.graph_objects as go import plotly.io as pio import matplotlib.cm as cm from htvlearn.data import Data class BasePlot(): colorscale = 'coolwarm' # default colorscale def __init__(self, data_obj=None, log_dir=None, **kwargs): """ Args: data_obj (Data): None (if not plotting data samples) or object of class Data (see htvlearn.data). log_dir (str): Log directory for html images. If None, the images are only shown but not saved in html format. """ self.data = data_obj self.log_dir = log_dir if self.log_dir is not None and not os.path.isdir(self.log_dir): raise NotADirectoryError( f'log_dir "{self.log_dir}" is not a valid directory') def verify_data_obj(self): """Verify that a data object exists and is valid""" if self.data is None: raise ValueError('A data object does not exist.') elif not isinstance(self.data, Data): raise ValueError(f'data_obj is of type {type(self.data)}.') @classmethod def map_val2color(cls, val, vmin, vmax, colorscale=None): """ Map a value to a color in the colormap. Args: val (float): value in [vmin, vmax] to map to color. vmin, vmax (float): min and max ranges for val. colorscale (str): matplotlib colorscale or None (use default). Returns: rgb color. """ colorsc = colorscale if colorscale is not None else cls.colorscale cmap = cm.get_cmap(colorsc) if vmin > vmax: raise ValueError('incorrect relation between vmin and vmax') t = 0. if not np.allclose(vmin, vmax): t = (val - vmin) / float((vmax - vmin)) # normalize val R, G, B, alpha = cmap(t) return 'rgb(' + '{:d}'.format(int(R * 255 + 0.5)) + ',' + '{:d}'\ .format(int(G * 255 + 0.5)) +\ ',' + '{:d}'.format(int(B * 255 + 0.5)) + ')' @classmethod def map_val2color2d(cls, val, vmin, vmax): """ Map a 2D value to an rgb color. The R and G channels have an independent and direct correspondence to each element in the 2D value. The B channel is kept fixed. Args: val (float): value s.t. val[i] in [vmin[i], vmax[i]], i=1,2, to be mapped to an rgb color. The R, G channels are set by val. vmin, vmax (2d array): min and max ranges for each element in val. Returns: rgb color. """ if vmin[0] > vmax[0] or vmin[1] > vmax[1]: raise ValueError('incorrect relation between vmin and vmax') t = np.zeros(2) # normalize val if not np.allclose(vmin[0], vmax[0]): t[0] = (val[0] - vmin[0]) / float((vmax[0] - vmin[0])) if not np.allclose(vmin[1], vmax[1]): t[1] = (val[1] - vmin[1]) / float((vmax[1] - vmin[1])) R, G = t[1], t[0] B = 0.4 return 'rgb(' + '{:d}'.format(int(R * 255 + 0.5)) + ',' + '{:d}'\ .format(int(G * 255 + 0.5)) +\ ',' + '{:d}'.format(int(B * 255 + 0.5)) + ')' @classmethod def map_array2color(cls, array, min=None, max=None): """ Map an array of values to colors. Args: array (1d array): array of values to map to colors. size: (N,) min, max (float): If not None, set the ranges for the values in array. Returns: 1d array of rgb colors. size: (N,) """ if min is None: min = array.min() if max is None: max = array.max() return np.array([cls.map_val2color(val, min, max) for val in array]) @classmethod def map_array2color2d(cls, array, min=None, max=None): """ Map a 2D array of values to colors. Args: array (2d array): array of values to map to colors. size: (N x 2). min, max (2d array): If not None, sets the ranges for the values in array. Returns: 1d array of rgb colors. size: (N,) """ if array.shape[1] != 2: raise ValueError(f"array has shape {array.shape}.") if min is None: if min.shape != (2, ): raise ValueError(f'min has shape {min.shape}') min = array.amin(axis=0) if max is None: if max.shape != (2, ): raise ValueError(f'max has shape {max.shape}') max = array.amax(axis=0) return np.array([cls.map_val2color2d(val, min, max) for val in array]) @classmethod def get_normal_facecolor(cls, affine_coeff, max=None): """ Get facecolor of simplices according to their normals. Args: affine_coeff (array): affine coefficients of the simplices. size: (number of simplices, 3). max (2d array): If not None, sets the max ranges for the values in affine_coeff[:, 0:2]. Returns: facecolor (1d array): 1d array of rgb colors whose size is the number of simplices. """ if not affine_coeff.shape[1] == 3: raise ValueError(f"affine_coeff has shape {affine_coeff.shape}.") if max is None: max = np.array([1.75, 1.75]) facecolor = \ cls.map_array2color2d(-affine_coeff[:, 0:2], min=-max, max=max) return facecolor @staticmethod def get_scatter3d(x, y, z, marker_size=2): r""" Get a scatter 3D plot (f: \R^2 \to \R) Args: x, y (1d array): positions of the samples. z (1d array): values of the samples. Returns: A plotly.graph_objects.Scatter3D object. """ data = go.Scatter3d(x=x, y=y, z=z, mode='markers', marker=dict(size=marker_size, color='black'), opacity=0.8) return data def plot_fig(self, fig, filename=None, num_subplots=1, view=None, **kwargs): """ Plot figure. Args: fig: instance of plotly.graph_objects.Figure to plot. filename (str): Figure filename. num_subplots (int): Number of figure subplots. view (str): If None, a default view is used. Otherwise can be set to "up" "side". """ assert isinstance(fig, go.Figure), f'fig is of type {type(fig)}.' assert view in [None, 'up', 'side'], f'view "{view}" is invalid.' ax_dict = dict(linecolor='#000000', linewidth=4, showgrid=False, showticklabels=False, tickfont=dict(size=15), gridcolor='#000000', gridwidth=0.3, title='', showbackground=True) fig_dict = dict( scene_aspectmode='data', scene=dict(xaxis=copy.deepcopy(ax_dict), yaxis=copy.deepcopy(ax_dict), zaxis=copy.deepcopy(ax_dict), camera=dict(up=dict(x=0, y=0, z=1), center=dict(x=0, y=0, z=0))), font=dict(size=20), ) fig_dict['scene']['xaxis']['title'] = 'x' fig_dict['scene']['yaxis']['title'] = 'y' fig_dict['scene']['zaxis']['title'] = 'z' if view == 'up': fig_dict['scene']['zaxis']['visible'] = False fig_dict['scene']['camera']['eye'] = dict(x=0, y=0, z=3) fig_dict['scene']['camera']['up'] = dict(x=0, y=1, z=0) elif view == 'side': fig_dict['scene']['camera']['eye'] = dict(x=1.2, y=0.3, z=0.4) else: # default fig_dict['scene']['camera']['eye'] = dict(x=1.5, y=1.9, z=1.7) for i in range(2, num_subplots + 1): fig_dict['scene' + str(i)] = fig_dict['scene'].copy() fig.update_layout(**fig_dict) if self.log_dir is None: fig.show() else: self.export_fig(fig, filename, self.log_dir) @staticmethod def export_fig(fig, filename, log_dir): """ Plot html figure and export to log_dir. Args: fig: instance of plotly.graph_objects.Figure to plot. filename (str): Figure filename. log_dir (str): Log directory where figure is exported to. """ assert isinstance(fig, go.Figure), f'fig is of type {type(fig)}.' if not os.path.isdir(log_dir): raise NotADirectoryError( f'log_dir "{log_dir}" is not a valid directory') file_path = os.path.join(f'{log_dir}', f'{filename}') pio.write_html(fig, file=f'{file_path}.html', auto_open=True)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 3509, 13, 5215, 12655, 408, 7442, 13, 5215, 6492, 368, 29889, 4262, 29918, 12650, 408, 748, 13, 5215, 6492, 368, 29889, 601, 408, 282, 601, 13, 5215, 22889, 29889, 4912, 408, 7477, 13, 13, 3166, 298, 12427, 19668, 29889, 1272, 1053, 3630, 13, 13, 13, 1990, 7399, 20867, 7295, 13, 13, 1678, 11955, 29883, 744, 353, 525, 1111, 324, 29893, 2817, 29915, 29871, 396, 2322, 11955, 29883, 744, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 848, 29918, 5415, 29922, 8516, 29892, 13, 462, 1480, 29918, 3972, 29922, 8516, 29892, 13, 462, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 826, 3174, 29901, 13, 9651, 848, 29918, 5415, 313, 1469, 1125, 13, 18884, 6213, 313, 361, 451, 6492, 1259, 848, 11916, 29897, 470, 13, 18884, 1203, 310, 770, 3630, 313, 4149, 298, 12427, 19668, 29889, 1272, 467, 13, 9651, 1480, 29918, 3972, 313, 710, 1125, 13, 18884, 4522, 3884, 363, 3472, 4558, 29889, 960, 6213, 29892, 278, 4558, 526, 871, 13, 18884, 4318, 541, 451, 7160, 297, 3472, 3402, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 1272, 353, 848, 29918, 5415, 13, 4706, 1583, 29889, 1188, 29918, 3972, 353, 1480, 29918, 3972, 13, 13, 4706, 565, 1583, 29889, 1188, 29918, 3972, 338, 451, 6213, 322, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 1311, 29889, 1188, 29918, 3972, 1125, 13, 9651, 12020, 2216, 3035, 5554, 2392, 29898, 13, 18884, 285, 29915, 1188, 29918, 3972, 29850, 1311, 29889, 1188, 29918, 3972, 5038, 338, 451, 263, 2854, 3884, 1495, 13, 13, 1678, 822, 11539, 29918, 1272, 29918, 5415, 29898, 1311, 1125, 13, 4706, 9995, 6565, 1598, 393, 263, 848, 1203, 4864, 322, 338, 2854, 15945, 29908, 13, 4706, 565, 1583, 29889, 1272, 338, 6213, 29901, 13, 9651, 12020, 7865, 2392, 877, 29909, 848, 1203, 947, 451, 1863, 29889, 1495, 13, 4706, 25342, 451, 338, 8758, 29898, 1311, 29889, 1272, 29892, 3630, 1125, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29915, 1272, 29918, 5415, 338, 310, 1134, 426, 1853, 29898, 1311, 29889, 1272, 29512, 1495, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2910, 29918, 791, 29906, 2780, 29898, 25932, 29892, 659, 29892, 325, 1195, 29892, 325, 3317, 29892, 11955, 29883, 744, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 7315, 263, 995, 304, 263, 2927, 297, 278, 784, 555, 481, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 659, 313, 7411, 1125, 13, 18884, 995, 297, 518, 29894, 1195, 29892, 325, 3317, 29962, 304, 2910, 304, 2927, 29889, 13, 9651, 325, 1195, 29892, 325, 3317, 313, 7411, 1125, 13, 18884, 1375, 322, 4236, 20238, 363, 659, 29889, 13, 9651, 11955, 29883, 744, 313, 710, 1125, 13, 18884, 22889, 11955, 29883, 744, 470, 6213, 313, 1509, 2322, 467, 13, 13, 4706, 16969, 29901, 13, 9651, 15552, 29890, 2927, 29889, 13, 4706, 9995, 13, 4706, 11955, 29883, 353, 11955, 29883, 744, 565, 11955, 29883, 744, 338, 451, 6213, 1683, 1067, 29879, 29889, 27703, 29883, 744, 13, 4706, 274, 1958, 353, 7477, 29889, 657, 29918, 29883, 1958, 29898, 27703, 29883, 29897, 13, 4706, 565, 325, 1195, 1405, 325, 3317, 29901, 13, 9651, 12020, 7865, 2392, 877, 262, 15728, 8220, 1546, 325, 1195, 322, 325, 3317, 1495, 13, 13, 4706, 260, 353, 29871, 29900, 29889, 13, 4706, 565, 451, 7442, 29889, 497, 5358, 29898, 29894, 1195, 29892, 325, 3317, 1125, 13, 9651, 260, 353, 313, 791, 448, 325, 1195, 29897, 847, 5785, 3552, 29894, 3317, 448, 325, 1195, 876, 29871, 396, 4226, 675, 659, 13, 4706, 390, 29892, 402, 29892, 350, 29892, 15595, 353, 274, 1958, 29898, 29873, 29897, 13, 4706, 736, 525, 23973, 877, 718, 22372, 29901, 29881, 29913, 4286, 4830, 29898, 524, 29898, 29934, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 718, 525, 5501, 718, 22372, 29901, 29881, 10162, 29905, 13, 9651, 869, 4830, 29898, 524, 29898, 29954, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 17501, 13, 9651, 525, 5501, 718, 22372, 29901, 29881, 29913, 4286, 4830, 29898, 524, 29898, 29933, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 718, 525, 16029, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2910, 29918, 791, 29906, 2780, 29906, 29881, 29898, 25932, 29892, 659, 29892, 325, 1195, 29892, 325, 3317, 1125, 13, 4706, 9995, 13, 4706, 7315, 263, 29871, 29906, 29928, 995, 304, 385, 15552, 29890, 2927, 29889, 450, 390, 322, 402, 18196, 505, 13, 4706, 385, 7417, 322, 1513, 3928, 663, 304, 1269, 1543, 297, 13, 4706, 278, 29871, 29906, 29928, 995, 29889, 450, 350, 8242, 338, 8126, 4343, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 659, 313, 7411, 1125, 13, 18884, 995, 269, 29889, 29873, 29889, 659, 29961, 29875, 29962, 297, 518, 29894, 1195, 29961, 29875, 1402, 325, 3317, 29961, 29875, 20526, 474, 29922, 29896, 29892, 29906, 29892, 13, 18884, 304, 367, 20545, 304, 385, 15552, 29890, 2927, 29889, 450, 390, 29892, 402, 18196, 526, 731, 13, 18884, 491, 659, 29889, 13, 9651, 325, 1195, 29892, 325, 3317, 313, 29906, 29881, 1409, 1125, 13, 18884, 1375, 322, 4236, 20238, 363, 1269, 1543, 297, 659, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 15552, 29890, 2927, 29889, 13, 4706, 9995, 13, 4706, 565, 325, 1195, 29961, 29900, 29962, 1405, 325, 3317, 29961, 29900, 29962, 470, 325, 1195, 29961, 29896, 29962, 1405, 325, 3317, 29961, 29896, 5387, 13, 9651, 12020, 7865, 2392, 877, 262, 15728, 8220, 1546, 325, 1195, 322, 325, 3317, 1495, 13, 13, 4706, 260, 353, 7442, 29889, 3298, 359, 29898, 29906, 29897, 13, 4706, 396, 4226, 675, 659, 13, 4706, 565, 451, 7442, 29889, 497, 5358, 29898, 29894, 1195, 29961, 29900, 1402, 325, 3317, 29961, 29900, 29962, 1125, 13, 9651, 260, 29961, 29900, 29962, 353, 313, 791, 29961, 29900, 29962, 448, 325, 1195, 29961, 29900, 2314, 847, 5785, 3552, 29894, 3317, 29961, 29900, 29962, 448, 325, 1195, 29961, 29900, 12622, 13, 4706, 565, 451, 7442, 29889, 497, 5358, 29898, 29894, 1195, 29961, 29896, 1402, 325, 3317, 29961, 29896, 29962, 1125, 13, 9651, 260, 29961, 29896, 29962, 353, 313, 791, 29961, 29896, 29962, 448, 325, 1195, 29961, 29896, 2314, 847, 5785, 3552, 29894, 3317, 29961, 29896, 29962, 448, 325, 1195, 29961, 29896, 12622, 13, 13, 4706, 390, 29892, 402, 353, 260, 29961, 29896, 1402, 260, 29961, 29900, 29962, 13, 4706, 350, 353, 29871, 29900, 29889, 29946, 13, 4706, 736, 525, 23973, 877, 718, 22372, 29901, 29881, 29913, 4286, 4830, 29898, 524, 29898, 29934, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 718, 525, 5501, 718, 22372, 29901, 29881, 10162, 29905, 13, 9651, 869, 4830, 29898, 524, 29898, 29954, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 17501, 13, 9651, 525, 5501, 718, 22372, 29901, 29881, 29913, 4286, 4830, 29898, 524, 29898, 29933, 334, 29871, 29906, 29945, 29945, 718, 29871, 29900, 29889, 29945, 876, 718, 525, 16029, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2910, 29918, 2378, 29906, 2780, 29898, 25932, 29892, 1409, 29892, 1375, 29922, 8516, 29892, 4236, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 7315, 385, 1409, 310, 1819, 304, 11955, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1409, 313, 29896, 29881, 1409, 1125, 13, 18884, 1409, 310, 1819, 304, 2910, 304, 11955, 29889, 2159, 29901, 313, 29940, 29892, 29897, 13, 9651, 1375, 29892, 4236, 313, 7411, 1125, 13, 18884, 960, 451, 6213, 29892, 731, 278, 20238, 363, 278, 1819, 297, 1409, 29889, 13, 13, 4706, 16969, 29901, 13, 632, 29896, 29881, 1409, 310, 15552, 29890, 11955, 29889, 2159, 29901, 313, 29940, 29892, 29897, 13, 4706, 9995, 13, 4706, 565, 1375, 338, 6213, 29901, 13, 9651, 1375, 353, 1409, 29889, 1195, 580, 13, 4706, 565, 4236, 338, 6213, 29901, 13, 9651, 4236, 353, 1409, 29889, 3317, 580, 13, 13, 4706, 736, 7442, 29889, 2378, 4197, 25932, 29889, 1958, 29918, 791, 29906, 2780, 29898, 791, 29892, 1375, 29892, 4236, 29897, 363, 659, 297, 1409, 2314, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2910, 29918, 2378, 29906, 2780, 29906, 29881, 29898, 25932, 29892, 1409, 29892, 1375, 29922, 8516, 29892, 4236, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 7315, 263, 29871, 29906, 29928, 1409, 310, 1819, 304, 11955, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1409, 313, 29906, 29881, 1409, 1125, 13, 18884, 1409, 310, 1819, 304, 2910, 304, 11955, 29889, 2159, 29901, 313, 29940, 921, 29871, 29906, 467, 13, 9651, 1375, 29892, 4236, 313, 29906, 29881, 1409, 1125, 13, 18884, 960, 451, 6213, 29892, 6166, 278, 20238, 363, 278, 1819, 297, 1409, 29889, 13, 13, 4706, 16969, 29901, 13, 632, 29896, 29881, 1409, 310, 15552, 29890, 11955, 29889, 2159, 29901, 313, 29940, 29892, 29897, 13, 4706, 9995, 13, 4706, 565, 1409, 29889, 12181, 29961, 29896, 29962, 2804, 29871, 29906, 29901, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29908, 2378, 756, 8267, 426, 2378, 29889, 12181, 1836, 1159, 13, 4706, 565, 1375, 338, 6213, 29901, 13, 9651, 565, 1375, 29889, 12181, 2804, 313, 29906, 29892, 29871, 1125, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29915, 1195, 756, 8267, 426, 1195, 29889, 12181, 29913, 1495, 13, 9651, 1375, 353, 1409, 29889, 9103, 29898, 8990, 29922, 29900, 29897, 13, 4706, 565, 4236, 338, 6213, 29901, 13, 9651, 565, 4236, 29889, 12181, 2804, 313, 29906, 29892, 29871, 1125, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29915, 3317, 756, 8267, 426, 3317, 29889, 12181, 29913, 1495, 13, 9651, 4236, 353, 1409, 29889, 314, 1165, 29898, 8990, 29922, 29900, 29897, 13, 13, 4706, 736, 7442, 29889, 2378, 4197, 25932, 29889, 1958, 29918, 791, 29906, 2780, 29906, 29881, 29898, 791, 29892, 1375, 29892, 4236, 29897, 363, 659, 297, 1409, 2314, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 679, 29918, 8945, 29918, 2161, 2780, 29898, 25932, 29892, 2756, 457, 29918, 1111, 12352, 29892, 4236, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 3617, 3700, 2780, 310, 3053, 29399, 5034, 304, 1009, 6056, 1338, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2756, 457, 29918, 1111, 12352, 313, 2378, 1125, 13, 18884, 2756, 457, 16127, 310, 278, 3053, 29399, 29889, 13, 18884, 2159, 29901, 313, 4537, 310, 3053, 29399, 29892, 29871, 29941, 467, 13, 9651, 4236, 313, 29906, 29881, 1409, 1125, 13, 18884, 960, 451, 6213, 29892, 6166, 278, 4236, 20238, 363, 278, 1819, 297, 13, 18884, 2756, 457, 29918, 1111, 12352, 7503, 29892, 29871, 29900, 29901, 29906, 1822, 13, 13, 4706, 16969, 29901, 13, 9651, 3700, 2780, 313, 29896, 29881, 1409, 1125, 13, 462, 29896, 29881, 1409, 310, 15552, 29890, 11955, 5069, 2159, 338, 278, 1353, 310, 3053, 29399, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 2756, 457, 29918, 1111, 12352, 29889, 12181, 29961, 29896, 29962, 1275, 29871, 29941, 29901, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29908, 3470, 457, 29918, 1111, 12352, 756, 8267, 426, 3470, 457, 29918, 1111, 12352, 29889, 12181, 1836, 1159, 13, 4706, 565, 4236, 338, 6213, 29901, 13, 9651, 4236, 353, 7442, 29889, 2378, 4197, 29896, 29889, 29955, 29945, 29892, 29871, 29896, 29889, 29955, 29945, 2314, 13, 4706, 3700, 2780, 353, 320, 13, 9651, 1067, 29879, 29889, 1958, 29918, 2378, 29906, 2780, 29906, 29881, 6278, 3470, 457, 29918, 1111, 12352, 7503, 29892, 29871, 29900, 29901, 29906, 1402, 1375, 10457, 3317, 29892, 4236, 29922, 3317, 29897, 13, 13, 4706, 736, 3700, 2780, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 1557, 2620, 29941, 29881, 29898, 29916, 29892, 343, 29892, 503, 29892, 17456, 29918, 2311, 29922, 29906, 1125, 13, 4706, 364, 15945, 29908, 13, 4706, 3617, 263, 14801, 29871, 29941, 29928, 6492, 313, 29888, 29901, 320, 29934, 29985, 29906, 320, 517, 320, 29934, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 921, 29892, 343, 313, 29896, 29881, 1409, 1125, 13, 18884, 11909, 310, 278, 11916, 29889, 13, 9651, 503, 313, 29896, 29881, 1409, 1125, 13, 18884, 1819, 310, 278, 11916, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 319, 6492, 368, 29889, 4262, 29918, 12650, 29889, 4421, 2620, 29941, 29928, 1203, 29889, 13, 4706, 9995, 13, 4706, 848, 353, 748, 29889, 4421, 2620, 29941, 29881, 29898, 29916, 29922, 29916, 29892, 13, 462, 9651, 343, 29922, 29891, 29892, 13, 462, 9651, 503, 29922, 29920, 29892, 13, 462, 9651, 4464, 2433, 3502, 414, 742, 13, 462, 9651, 17456, 29922, 8977, 29898, 2311, 29922, 22976, 29918, 2311, 29892, 13, 462, 462, 4706, 2927, 2433, 8517, 5477, 13, 462, 9651, 17012, 29922, 29900, 29889, 29947, 29897, 13, 13, 4706, 736, 848, 13, 13, 1678, 822, 6492, 29918, 1003, 29898, 1311, 29892, 13, 462, 2537, 29892, 13, 462, 10422, 29922, 8516, 29892, 13, 462, 954, 29918, 1491, 26762, 29922, 29896, 29892, 13, 462, 1776, 29922, 8516, 29892, 13, 462, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 18399, 4377, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2537, 29901, 13, 18884, 2777, 310, 6492, 368, 29889, 4262, 29918, 12650, 29889, 13080, 545, 304, 6492, 29889, 13, 9651, 10422, 313, 710, 1125, 13, 18884, 11479, 10422, 29889, 13, 9651, 954, 29918, 1491, 26762, 313, 524, 1125, 13, 18884, 9681, 310, 4377, 1014, 26762, 29889, 13, 9651, 1776, 313, 710, 1125, 13, 18884, 960, 6213, 29892, 263, 2322, 1776, 338, 1304, 29889, 13, 18884, 13466, 508, 367, 731, 304, 376, 786, 29908, 376, 2975, 1642, 13, 4706, 9995, 13, 4706, 4974, 338, 8758, 29898, 1003, 29892, 748, 29889, 13080, 545, 511, 285, 29915, 1003, 338, 310, 1134, 426, 1853, 29898, 1003, 29512, 29915, 13, 4706, 4974, 1776, 297, 518, 8516, 29892, 525, 786, 742, 525, 2975, 7464, 285, 29915, 1493, 29850, 1493, 5038, 338, 8340, 6169, 13, 13, 4706, 4853, 29918, 8977, 353, 9657, 29898, 1220, 2780, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 13, 462, 539, 1196, 2103, 29922, 29946, 29892, 13, 462, 539, 1510, 7720, 29922, 8824, 29892, 13, 462, 539, 1510, 24667, 21134, 29922, 8824, 29892, 13, 462, 539, 16892, 5657, 29922, 8977, 29898, 2311, 29922, 29896, 29945, 511, 13, 462, 539, 6856, 2780, 2433, 29937, 29900, 29900, 29900, 29900, 29900, 29900, 742, 13, 462, 539, 6856, 2103, 29922, 29900, 29889, 29941, 29892, 13, 462, 539, 3611, 2433, 742, 13, 462, 539, 1510, 7042, 29922, 5574, 29897, 13, 13, 4706, 2537, 29918, 8977, 353, 9657, 29898, 13, 9651, 9088, 29918, 294, 1103, 8513, 2433, 1272, 742, 13, 9651, 9088, 29922, 8977, 29898, 29916, 8990, 29922, 8552, 29889, 24535, 8552, 29898, 1165, 29918, 8977, 511, 13, 462, 539, 343, 8990, 29922, 8552, 29889, 24535, 8552, 29898, 1165, 29918, 8977, 511, 13, 462, 539, 503, 8990, 29922, 8552, 29889, 24535, 8552, 29898, 1165, 29918, 8977, 511, 13, 462, 539, 10656, 29922, 8977, 29898, 786, 29922, 8977, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29900, 29892, 503, 29922, 29896, 511, 13, 462, 462, 259, 4818, 29922, 8977, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29900, 29892, 503, 29922, 29900, 876, 511, 13, 9651, 4079, 29922, 8977, 29898, 2311, 29922, 29906, 29900, 511, 13, 4706, 1723, 13, 13, 4706, 2537, 29918, 8977, 1839, 24645, 16215, 29916, 8990, 16215, 3257, 2033, 353, 525, 29916, 29915, 13, 4706, 2537, 29918, 8977, 1839, 24645, 16215, 29891, 8990, 16215, 3257, 2033, 353, 525, 29891, 29915, 13, 4706, 2537, 29918, 8977, 1839, 24645, 16215, 29920, 8990, 16215, 3257, 2033, 353, 525, 29920, 29915, 13, 13, 4706, 565, 1776, 1275, 525, 786, 2396, 13, 9651, 2537, 29918, 8977, 1839, 24645, 16215, 29920, 8990, 16215, 12872, 2033, 353, 7700, 13, 9651, 2537, 29918, 8977, 1839, 24645, 16215, 26065, 16215, 1032, 29872, 2033, 353, 9657, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29900, 29892, 503, 29922, 29941, 29897, 13, 9651, 2537, 29918, 8977, 1839, 24645, 16215, 26065, 16215, 786, 2033, 353, 9657, 29898, 29916, 29922, 29900, 29892, 343, 29922, 29896, 29892, 503, 29922, 29900, 29897, 13, 4706, 25342, 1776, 1275, 525, 2975, 2396, 13, 9651, 2537, 29918, 8977, 1839, 24645, 16215, 26065, 16215, 1032, 29872, 2033, 353, 9657, 29898, 29916, 29922, 29896, 29889, 29906, 29892, 343, 29922, 29900, 29889, 29941, 29892, 503, 29922, 29900, 29889, 29946, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 2322, 13, 9651, 2537, 29918, 8977, 1839, 24645, 16215, 26065, 16215, 1032, 29872, 2033, 353, 9657, 29898, 29916, 29922, 29896, 29889, 29945, 29892, 343, 29922, 29896, 29889, 29929, 29892, 503, 29922, 29896, 29889, 29955, 29897, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29906, 29892, 954, 29918, 1491, 26762, 718, 29871, 29896, 1125, 13, 9651, 2537, 29918, 8977, 1839, 24645, 29915, 718, 851, 29898, 29875, 4638, 353, 2537, 29918, 8977, 1839, 24645, 13359, 8552, 580, 13, 13, 4706, 2537, 29889, 5504, 29918, 2680, 29898, 1068, 1003, 29918, 8977, 29897, 13, 4706, 565, 1583, 29889, 1188, 29918, 3972, 338, 6213, 29901, 13, 9651, 2537, 29889, 4294, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 15843, 29918, 1003, 29898, 1003, 29892, 10422, 29892, 1583, 29889, 1188, 29918, 3972, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 5609, 29918, 1003, 29898, 1003, 29892, 10422, 29892, 1480, 29918, 3972, 1125, 13, 4706, 9995, 13, 4706, 18399, 3472, 4377, 322, 5609, 304, 1480, 29918, 3972, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2537, 29901, 13, 18884, 2777, 310, 6492, 368, 29889, 4262, 29918, 12650, 29889, 13080, 545, 304, 6492, 29889, 13, 9651, 10422, 313, 710, 1125, 13, 18884, 11479, 10422, 29889, 13, 9651, 1480, 29918, 3972, 313, 710, 1125, 13, 18884, 4522, 3884, 988, 4377, 338, 5609, 287, 304, 29889, 13, 4706, 9995, 13, 4706, 4974, 338, 8758, 29898, 1003, 29892, 748, 29889, 13080, 545, 511, 285, 29915, 1003, 338, 310, 1134, 426, 1853, 29898, 1003, 29512, 29915, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 1188, 29918, 3972, 1125, 13, 9651, 12020, 2216, 3035, 5554, 2392, 29898, 13, 18884, 285, 29915, 1188, 29918, 3972, 29850, 1188, 29918, 3972, 5038, 338, 451, 263, 2854, 3884, 1495, 13, 13, 4706, 934, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 29888, 29915, 29912, 1188, 29918, 3972, 29913, 742, 285, 29915, 29912, 9507, 29913, 1495, 13, 4706, 282, 601, 29889, 3539, 29918, 1420, 29898, 1003, 29892, 934, 29922, 29888, 29915, 29912, 1445, 29918, 2084, 1836, 1420, 742, 4469, 29918, 3150, 29922, 5574, 29897, 13, 2 ]
examples/color_example.py
plezmo/python-sdk-examples
0
132051
# Copyright (c) 2019 Gunakar Pvt Ltd # All rights reserved. # Redistribution and use in source and binary forms, with or without # modification, are permitted (subject to the limitations in the disclaimer # below) provided that the following conditions are met: # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. # * 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. # * Neither the name of the Gunakar Pvt Ltd/Plezmo 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 must only be used with Plezmo elements manufactured by # Gunakar Pvt Ltd. # * Any software provided in binary or object form under this license must not be # reverse engineered, decompiled, modified and/or disassembled. # NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY # THIS LICENSE. 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. # Tests functionality of light element import time import traceback from plezmo import * from plezmo.utils.logger import Logger from plezmo.elements.element_types import PlezmoElementType from plezmo.elements.plezmo_color import * import utils logger = Logger() def globalExceptionHandler(e): logger.info("###### Got exception {}".format(e)) # Init bluetooth communication def init(color_name): # Register global exception handler registerExceptionHandler(globalExceptionHandler) # Elements to connect elementList = [{"name" : color_name, "type": PlezmoElementType.COLOR}] connectedElements = [] try: # connect to elements one by one for e in elementList: plezmoApi.connect(e["name"], e["type"]) # keep track of connected elements connectedElements.append(e["name"]) return True except Exception as e: # Disconnect and stop program if connection to element fails logger.error("Failed to connect to element, ex {}".format(e)) #traceback.print_exc() # Disconnect already connected elements for e in connectedElements: plezmoApi.disconnect(e["name"]) return False # Main logic of the program def main(color_name): # Init bluetooth communication success = init(color_name) if success != True: # Bluetooth communication cannobe enabled, quit. plezmoApi.close() logger.error("Could not connect to all the required elements") return # Register event handlers try: # Event handler to call when color sensor detects GREEN color Color.onColorChange(color_name, green_handler, ColorSensorColor.GREEN) # Event handler to call when color sensor detects RED color Color.onColorChange(color_name, red_handler, ColorSensorColor.RED) logger.info("Event handlers for color detection registered. Take the Color sensor in front of RED/GREEN color to see the event handlers working.") time.sleep(10) # Event handler to call when color sensor detects darkness Color.onLightEvent(color_name, darkness_handler, ColorSensorLightState.DARK) # Event handler to call when color sensor detects brightness Color.onLightEvent(color_name, brightness_handler, ColorSensorLightState.BRIGHT) logger.info("Event handlers darkness/brightness detection registered. Take the Color sensor to dark/bright locations to see the event handlers working.") time.sleep(10) comp = Color.getLightValueLux(color_name) logger.info("Light lux value is {}".format(comp)) comp = Color.getLightComponentValueInLux(color_name, LightComponent.GREEN) logger.info("Green component is {}".format(comp)) light = Color.getLightValuePercent(color_name) logger.info("Detected light value in percent is {}".format(light)) logger.info("Checking getColor() functionality. Keep the color sensor facing any basic color") time.sleep(5) color = Color.getColor(color_name) logger.info("Detected color is {}".format(color)) logger.info("Waiting for color change, change color in front of color element to different colors") Color.waitForColorChange(color_name) logger.info("Color changed") logger.info("Waiting for color to change to RED. Bring RED color in front of color element.") Color.waitForColorToChangeTo(color_name, ColorSensorColor.RED) logger.info("Color changed to RED") time.sleep(5) logger.info("Waiting for DARK. Take color element to dark location.") Color.waitForLightEvent(color_name, ColorSensorLightState.DARK) logger.info("It is dark") time.sleep(2) except Exception as e: logger.error("Failed to run Color commands {}, ex {}".format(color_name, e)) #traceback.print_exc() finally: # Program completed, disconnect elements and quit plezmoApi.disconnect(color_name) time.sleep(1) plezmoApi.close() # Event handler whenever color sensor detects GREEN color @PlezmoEventHandler def green_handler(): logger.info("Got green color change event") # Event handler whenever color sensor detects RED color @PlezmoEventHandler def red_handler(): logger.info("Got red color change event") # Event handler whenever color sensor detects darkness @PlezmoEventHandler def darkness_handler(): logger.info("Got darkness event") # Event handler whenever color sensor detects brightness @PlezmoEventHandler def brightness_handler(): logger.info("Got brightness event") # Program starts here if __name__ == "__main__": color_name = utils.extract_element_name() if color_name == None: logger.error("Color element name is mandatory, e.g. # python color_example.py Color") else: main(color_name)
[ 1, 396, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29929, 21429, 557, 279, 349, 21908, 19806, 13, 29937, 2178, 10462, 21676, 29889, 13, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 313, 16009, 304, 278, 27028, 297, 278, 2313, 433, 4193, 13, 29937, 2400, 29897, 4944, 393, 278, 1494, 5855, 526, 1539, 29901, 13, 13, 29937, 418, 334, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 8369, 29892, 13, 29937, 418, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 13, 29937, 418, 334, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 13, 29937, 418, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 13, 29937, 418, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 13, 29937, 418, 334, 2448, 2121, 278, 1024, 310, 278, 21429, 557, 279, 349, 21908, 19806, 29914, 29925, 11867, 4346, 3643, 278, 2983, 310, 967, 13, 29937, 418, 17737, 29560, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 10723, 515, 445, 13, 29937, 418, 7047, 1728, 2702, 7536, 3971, 10751, 29889, 13, 13, 29937, 418, 334, 910, 7047, 1818, 871, 367, 1304, 411, 349, 11867, 4346, 3161, 12012, 2955, 491, 13, 29937, 418, 21429, 557, 279, 349, 21908, 19806, 29889, 13, 13, 29937, 418, 334, 3139, 7047, 4944, 297, 7581, 470, 1203, 883, 1090, 445, 19405, 1818, 451, 367, 13, 29937, 418, 11837, 6012, 14561, 29892, 316, 2388, 2356, 29892, 9120, 322, 29914, 272, 766, 465, 6967, 29881, 29889, 13, 13, 29937, 11698, 8528, 15094, 1799, 6323, 306, 3580, 5265, 3352, 365, 2965, 1430, 1660, 29903, 7495, 13764, 29979, 349, 8322, 29979, 29915, 29903, 349, 1299, 3919, 390, 22530, 29903, 319, 1525, 18016, 13566, 3352, 6770, 13, 29937, 3446, 3235, 365, 2965, 1430, 1660, 29889, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 13, 29937, 8707, 29911, 3960, 29933, 2692, 24125, 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, 319, 13, 29937, 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, 379, 5607, 8032, 6323, 13, 29937, 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, 317, 4162, 8426, 1964, 29892, 13, 29937, 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, 27848, 3352, 7495, 29892, 13, 29937, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 29892, 6323, 13756, 29943, 1806, 29903, 29936, 6323, 13, 29937, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 12766, 17171, 29928, 5300, 6732, 13764, 29979, 6093, 18929, 8079, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 13, 29937, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 313, 1177, 6154, 15789, 4214, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 13, 29937, 9033, 3235, 4214, 2672, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 8079, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 13, 29937, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 13, 29937, 4321, 29879, 9863, 310, 3578, 1543, 13, 5215, 931, 13, 5215, 9637, 1627, 13, 13, 3166, 5644, 29920, 4346, 1053, 334, 13, 3166, 5644, 29920, 4346, 29889, 13239, 29889, 21707, 1053, 28468, 13, 3166, 5644, 29920, 4346, 29889, 17664, 29889, 5029, 29918, 8768, 1053, 349, 11867, 4346, 2642, 1542, 13, 3166, 5644, 29920, 4346, 29889, 17664, 29889, 552, 29920, 4346, 29918, 2780, 1053, 334, 13, 13, 5215, 3667, 29879, 13, 13, 21707, 353, 28468, 580, 13, 13, 1753, 5534, 2451, 4598, 29898, 29872, 1125, 13, 1678, 17927, 29889, 3888, 703, 4136, 2277, 15992, 3682, 6571, 1642, 4830, 29898, 29872, 876, 13, 13, 29937, 10886, 1999, 20930, 12084, 13, 1753, 2069, 29898, 2780, 29918, 978, 1125, 13, 1678, 396, 12577, 5534, 3682, 7834, 13, 1678, 6036, 2451, 4598, 29898, 10945, 2451, 4598, 29897, 13, 1678, 396, 10619, 29879, 304, 4511, 13, 1678, 1543, 1293, 353, 518, 6377, 978, 29908, 584, 2927, 29918, 978, 29892, 376, 1853, 1115, 349, 11867, 4346, 2642, 1542, 29889, 15032, 1955, 6525, 13, 1678, 6631, 18868, 353, 5159, 13, 1678, 1018, 29901, 13, 4706, 396, 4511, 304, 3161, 697, 491, 697, 13, 4706, 363, 321, 297, 1543, 1293, 29901, 13, 9651, 5644, 29920, 4346, 11713, 29889, 6915, 29898, 29872, 3366, 978, 12436, 321, 3366, 1853, 20068, 13, 9651, 396, 3013, 5702, 310, 6631, 3161, 13, 9651, 6631, 18868, 29889, 4397, 29898, 29872, 3366, 978, 20068, 13, 4706, 736, 5852, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 396, 3295, 6915, 322, 5040, 1824, 565, 3957, 304, 1543, 8465, 13, 4706, 17927, 29889, 2704, 703, 17776, 304, 4511, 304, 1543, 29892, 429, 6571, 1642, 4830, 29898, 29872, 876, 13, 4706, 396, 15003, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 4706, 396, 3295, 6915, 2307, 6631, 3161, 13, 4706, 363, 321, 297, 6631, 18868, 29901, 13, 9651, 5644, 29920, 4346, 11713, 29889, 2218, 6915, 29898, 29872, 3366, 978, 20068, 13, 4706, 736, 7700, 13, 13, 29937, 4241, 5900, 310, 278, 1824, 13, 1753, 1667, 29898, 2780, 29918, 978, 1125, 13, 1678, 396, 10886, 1999, 20930, 12084, 13, 1678, 2551, 353, 2069, 29898, 2780, 29918, 978, 29897, 13, 1678, 565, 2551, 2804, 5852, 29901, 13, 4706, 396, 3164, 20930, 12084, 508, 29876, 16945, 9615, 29892, 23283, 29889, 13, 4706, 5644, 29920, 4346, 11713, 29889, 5358, 580, 13, 4706, 17927, 29889, 2704, 703, 23323, 451, 4511, 304, 599, 278, 3734, 3161, 1159, 13, 4706, 736, 13, 13, 1678, 396, 12577, 1741, 25795, 13, 1678, 1018, 29901, 13, 4706, 396, 6864, 7834, 304, 1246, 746, 2927, 23530, 6459, 29879, 402, 1525, 1430, 2927, 13, 4706, 9159, 29889, 265, 3306, 7277, 29898, 2780, 29918, 978, 29892, 7933, 29918, 13789, 29892, 9159, 29903, 6073, 3306, 29889, 29954, 1525, 1430, 29897, 13, 4706, 396, 6864, 7834, 304, 1246, 746, 2927, 23530, 6459, 29879, 390, 3352, 2927, 13, 4706, 9159, 29889, 265, 3306, 7277, 29898, 2780, 29918, 978, 29892, 2654, 29918, 13789, 29892, 9159, 29903, 6073, 3306, 29889, 19386, 29897, 13, 4706, 17927, 29889, 3888, 703, 2624, 25795, 363, 2927, 15326, 15443, 29889, 11190, 278, 9159, 23530, 297, 4565, 310, 390, 3352, 29914, 29954, 1525, 1430, 2927, 304, 1074, 278, 1741, 25795, 1985, 23157, 13, 4706, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 4706, 396, 6864, 7834, 304, 1246, 746, 2927, 23530, 6459, 29879, 23490, 13, 4706, 9159, 29889, 265, 20769, 2624, 29898, 2780, 29918, 978, 29892, 23490, 29918, 13789, 29892, 9159, 29903, 6073, 20769, 2792, 29889, 29928, 1718, 29968, 29897, 13, 4706, 396, 6864, 7834, 304, 1246, 746, 2927, 23530, 6459, 29879, 11785, 2264, 13, 4706, 9159, 29889, 265, 20769, 2624, 29898, 2780, 29918, 978, 29892, 11785, 2264, 29918, 13789, 29892, 9159, 29903, 6073, 20769, 2792, 29889, 29933, 22789, 3912, 29897, 13, 4706, 17927, 29889, 3888, 703, 2624, 25795, 23490, 29914, 1182, 523, 2264, 15326, 15443, 29889, 11190, 278, 9159, 23530, 304, 6501, 29914, 1182, 523, 14354, 304, 1074, 278, 1741, 25795, 1985, 23157, 13, 4706, 931, 29889, 17059, 29898, 29896, 29900, 29897, 13, 13, 4706, 752, 353, 9159, 29889, 657, 20769, 1917, 29931, 1314, 29898, 2780, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 703, 20769, 21684, 995, 338, 6571, 1642, 4830, 29898, 2388, 876, 13, 4706, 752, 353, 9159, 29889, 657, 20769, 5308, 1917, 797, 29931, 1314, 29898, 2780, 29918, 978, 29892, 12790, 5308, 29889, 29954, 1525, 1430, 29897, 13, 4706, 17927, 29889, 3888, 703, 24599, 4163, 338, 6571, 1642, 4830, 29898, 2388, 876, 13, 4706, 3578, 353, 9159, 29889, 657, 20769, 1917, 27933, 29898, 2780, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 703, 6362, 26458, 3578, 995, 297, 10151, 338, 6571, 1642, 4830, 29898, 4366, 876, 13, 4706, 17927, 29889, 3888, 703, 5596, 292, 679, 3306, 580, 9863, 29889, 19152, 278, 2927, 23530, 14870, 738, 6996, 2927, 1159, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 2927, 353, 9159, 29889, 657, 3306, 29898, 2780, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 703, 6362, 26458, 2927, 338, 6571, 1642, 4830, 29898, 2780, 876, 13, 308, 13, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 2927, 1735, 29892, 1735, 2927, 297, 4565, 310, 2927, 1543, 304, 1422, 11955, 1159, 13, 4706, 9159, 29889, 10685, 2831, 3306, 7277, 29898, 2780, 29918, 978, 29897, 13, 4706, 17927, 29889, 3888, 703, 3306, 3939, 1159, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 2927, 304, 1735, 304, 390, 3352, 29889, 1771, 292, 390, 3352, 2927, 297, 4565, 310, 2927, 1543, 23157, 13, 4706, 9159, 29889, 10685, 2831, 3306, 1762, 7277, 1762, 29898, 2780, 29918, 978, 29892, 9159, 29903, 6073, 3306, 29889, 19386, 29897, 13, 4706, 17927, 29889, 3888, 703, 3306, 3939, 304, 390, 3352, 1159, 13, 4706, 931, 29889, 17059, 29898, 29945, 29897, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 360, 1718, 29968, 29889, 11190, 2927, 1543, 304, 6501, 4423, 23157, 13, 4706, 9159, 29889, 10685, 2831, 20769, 2624, 29898, 2780, 29918, 978, 29892, 9159, 29903, 6073, 20769, 2792, 29889, 29928, 1718, 29968, 29897, 13, 4706, 17927, 29889, 3888, 703, 3112, 338, 6501, 1159, 13, 4706, 931, 29889, 17059, 29898, 29906, 29897, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 17927, 29889, 2704, 703, 17776, 304, 1065, 9159, 8260, 24335, 429, 6571, 1642, 4830, 29898, 2780, 29918, 978, 29892, 321, 876, 13, 4706, 396, 15003, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 1678, 7146, 29901, 13, 4706, 396, 7835, 8676, 29892, 766, 6915, 3161, 322, 23283, 13, 4706, 5644, 29920, 4346, 11713, 29889, 2218, 6915, 29898, 2780, 29918, 978, 29897, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 4706, 5644, 29920, 4346, 11713, 29889, 5358, 580, 13, 13, 29937, 6864, 7834, 10940, 2927, 23530, 6459, 29879, 402, 1525, 1430, 2927, 13, 29992, 29925, 11867, 4346, 2624, 4598, 13, 1753, 7933, 29918, 13789, 7295, 13, 1678, 17927, 29889, 3888, 703, 29954, 327, 7933, 2927, 1735, 1741, 1159, 13, 13, 29937, 6864, 7834, 10940, 2927, 23530, 6459, 29879, 390, 3352, 2927, 13, 29992, 29925, 11867, 4346, 2624, 4598, 13, 1753, 2654, 29918, 13789, 7295, 13, 1678, 17927, 29889, 3888, 703, 29954, 327, 2654, 2927, 1735, 1741, 1159, 13, 13, 29937, 6864, 7834, 10940, 2927, 23530, 6459, 29879, 23490, 13, 29992, 29925, 11867, 4346, 2624, 4598, 13, 1753, 23490, 29918, 13789, 7295, 13, 1678, 17927, 29889, 3888, 703, 29954, 327, 23490, 1741, 1159, 13, 13, 29937, 6864, 7834, 10940, 2927, 23530, 6459, 29879, 11785, 2264, 13, 29992, 29925, 11867, 4346, 2624, 4598, 13, 1753, 11785, 2264, 29918, 13789, 7295, 13, 1678, 17927, 29889, 3888, 703, 29954, 327, 11785, 2264, 1741, 1159, 13, 13, 29937, 7835, 8665, 1244, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 2927, 29918, 978, 353, 3667, 29879, 29889, 21111, 29918, 5029, 29918, 978, 580, 13, 1678, 565, 2927, 29918, 978, 1275, 6213, 29901, 13, 4706, 17927, 29889, 2704, 703, 3306, 1543, 1024, 338, 9619, 7606, 29892, 321, 29889, 29887, 29889, 396, 3017, 2927, 29918, 4773, 29889, 2272, 9159, 1159, 13, 1678, 1683, 29901, 13, 4706, 1667, 29898, 2780, 29918, 978, 29897, 2 ]
codeferm/observer.py
Kulanx/sleeping_quality_evaluator
64
1605629
<reponame>Kulanx/sleeping_quality_evaluator<filename>codeferm/observer.py<gh_stars>10-100 """ Created on Apr 14, 2017 @author: sgoldsmith Copyright (c) <NAME> All rights reserved. """ class observer(object): """A class of thing that observes an Observable. The Observable will call the Observer"s observeEvent() method. """ def observeEvent(self, **kwargs): raise NotImplementedError("Please override in the derived class")
[ 1, 529, 276, 1112, 420, 29958, 29968, 352, 273, 29916, 29914, 17059, 292, 29918, 29567, 29918, 24219, 1061, 29966, 9507, 29958, 401, 571, 29885, 29914, 711, 2974, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 15945, 29908, 13, 20399, 373, 319, 558, 29871, 29896, 29946, 29892, 29871, 29906, 29900, 29896, 29955, 13, 13, 29992, 8921, 29901, 269, 29887, 3361, 29885, 389, 13, 13, 11882, 1266, 313, 29883, 29897, 529, 5813, 29958, 13, 13, 3596, 10462, 21676, 29889, 13, 15945, 29908, 13, 13, 13, 1990, 22944, 29898, 3318, 1125, 13, 1678, 9995, 29909, 770, 310, 2655, 393, 5366, 1960, 385, 20215, 29889, 13, 268, 13, 1678, 450, 20215, 674, 1246, 278, 4250, 2974, 29908, 29879, 14111, 2624, 580, 1158, 29889, 13, 268, 13, 1678, 9995, 13, 13, 1678, 822, 14111, 2624, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 12148, 5712, 297, 278, 10723, 770, 1159, 13, 2 ]
snn_lib/optimizers.py
zhongyuchen/snn-iir
5
85796
<reponame>zhongyuchen/snn-iir<gh_stars>1-10 # -*- coding: utf-8 -*- """ # File Name : optimizers.py # Author: <NAME> # Email: <EMAIL> # Description: optimizers. """ import torch import omegaconf from omegaconf import OmegaConf def get_optimizer(params, conf): optimizer_conf = conf['optimizer'] optimizer_choice = optimizer_conf['optimizer_choice'] if optimizer_choice == 'Adam': lr = optimizer_conf['Adam']['lr'] print('optimizer:', optimizer_conf['optimizer_choice'], 'lr:', lr) return torch.optim.Adam(params, lr) elif optimizer_choice == 'AdamW': lr = optimizer_conf['AdamW']['lr'] print('optimizer:', optimizer_conf['optimizer_choice'], 'lr:', lr) return torch.optim.AdamW(params, lr) elif optimizer_choice == 'SGD': lr = lr = optimizer_conf['SGD']['lr'] print('optimizer:', optimizer_conf['optimizer_choice'], 'lr:', lr) return torch.optim.SGD(params, lr) else: raise Exception('optimizer', optimizer_conf['optimizer_choice'] ,'not implemented.')
[ 1, 529, 276, 1112, 420, 29958, 17599, 549, 29891, 987, 264, 29914, 29879, 15755, 29899, 29875, 381, 29966, 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, 29937, 3497, 4408, 584, 5994, 19427, 29889, 2272, 13, 29937, 13361, 29901, 529, 5813, 29958, 13, 29937, 22608, 29901, 529, 26862, 6227, 29958, 13, 29937, 12953, 29901, 5994, 19427, 29889, 13, 15945, 29908, 13, 13, 5215, 4842, 305, 13, 5215, 2703, 2442, 5527, 13, 3166, 2703, 2442, 5527, 1053, 13352, 2442, 16376, 13, 13, 1753, 679, 29918, 20640, 3950, 29898, 7529, 29892, 1970, 1125, 13, 1678, 5994, 3950, 29918, 5527, 353, 1970, 1839, 20640, 3950, 2033, 13, 13, 1678, 5994, 3950, 29918, 16957, 353, 5994, 3950, 29918, 5527, 1839, 20640, 3950, 29918, 16957, 2033, 13, 13, 1678, 565, 5994, 3950, 29918, 16957, 1275, 525, 3253, 314, 2396, 13, 4706, 301, 29878, 353, 5994, 3950, 29918, 5527, 1839, 3253, 314, 16215, 29212, 2033, 13, 4706, 1596, 877, 20640, 3950, 29901, 742, 5994, 3950, 29918, 5527, 1839, 20640, 3950, 29918, 16957, 7464, 525, 29212, 29901, 742, 301, 29878, 29897, 13, 4706, 736, 4842, 305, 29889, 20640, 29889, 3253, 314, 29898, 7529, 29892, 301, 29878, 29897, 13, 1678, 25342, 5994, 3950, 29918, 16957, 1275, 525, 3253, 314, 29956, 2396, 13, 4706, 301, 29878, 353, 5994, 3950, 29918, 5527, 1839, 3253, 314, 29956, 16215, 29212, 2033, 13, 4706, 1596, 877, 20640, 3950, 29901, 742, 5994, 3950, 29918, 5527, 1839, 20640, 3950, 29918, 16957, 7464, 525, 29212, 29901, 742, 301, 29878, 29897, 13, 4706, 736, 4842, 305, 29889, 20640, 29889, 3253, 314, 29956, 29898, 7529, 29892, 301, 29878, 29897, 13, 1678, 25342, 5994, 3950, 29918, 16957, 1275, 525, 26016, 29928, 2396, 13, 4706, 301, 29878, 353, 301, 29878, 353, 5994, 3950, 29918, 5527, 1839, 26016, 29928, 16215, 29212, 2033, 13, 4706, 1596, 877, 20640, 3950, 29901, 742, 5994, 3950, 29918, 5527, 1839, 20640, 3950, 29918, 16957, 7464, 525, 29212, 29901, 742, 301, 29878, 29897, 13, 4706, 736, 4842, 305, 29889, 20640, 29889, 26016, 29928, 29898, 7529, 29892, 301, 29878, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 8960, 877, 20640, 3950, 742, 5994, 3950, 29918, 5527, 1839, 20640, 3950, 29918, 16957, 2033, 1919, 29915, 1333, 8762, 29889, 1495, 13, 268, 13, 268, 2 ]
essentials_kit_management/tests/interactors/test_get_pay_through_details_interactor.py
RajeshKumar1490/iB_hubs_mini_project
0
187132
<gh_stars>0 from mock import create_autospec from essentials_kit_management.interactors.\ get_pay_through_details_interactor import GetPayThroughDetailsInteractor from essentials_kit_management.interactors.storages.storage_interface \ import StorageInterface from essentials_kit_management.interactors.presenters.presenter_interface \ import PresenterInterface def test_get_pay_through_details_interactor_returns_upi_id(): #Arrange storage = create_autospec(StorageInterface) presenter = create_autospec(PresenterInterface) interactor = GetPayThroughDetailsInteractor( storage=storage, presenter=presenter ) mock_upi_id = "8247088772@SBI" mock_presenter_response = {'upi_id': mock_upi_id} storage.get_upi_id.return_value = mock_upi_id presenter.get_pay_through_details_response.return_value = \ mock_presenter_response #Act upi_id_response = interactor.get_pay_through_details() #Assert assert upi_id_response == mock_presenter_response storage.get_upi_id.assert_called_once() presenter.get_pay_through_details_response.assert_called_once_with( upi_id=mock_upi_id )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 11187, 1053, 1653, 29918, 1300, 359, 3135, 13, 3166, 3686, 9409, 29918, 7354, 29918, 21895, 29889, 1639, 627, 943, 7790, 13, 1678, 679, 29918, 10472, 29918, 20678, 29918, 14144, 29918, 1639, 7168, 1053, 3617, 15467, 29911, 1092, 820, 10602, 4074, 7168, 13, 3166, 3686, 9409, 29918, 7354, 29918, 21895, 29889, 1639, 627, 943, 29889, 28957, 1179, 29889, 12925, 29918, 13248, 320, 13, 1678, 1053, 26162, 10448, 13, 3166, 3686, 9409, 29918, 7354, 29918, 21895, 29889, 1639, 627, 943, 29889, 6338, 414, 29889, 6338, 261, 29918, 13248, 320, 13, 1678, 1053, 4360, 5893, 10448, 13, 13, 13, 1753, 1243, 29918, 657, 29918, 10472, 29918, 20678, 29918, 14144, 29918, 1639, 7168, 29918, 18280, 29918, 786, 29875, 29918, 333, 7295, 13, 1678, 396, 1433, 3881, 13, 1678, 8635, 353, 1653, 29918, 1300, 359, 3135, 29898, 10486, 10448, 29897, 13, 1678, 2198, 261, 353, 1653, 29918, 1300, 359, 3135, 29898, 13504, 5893, 10448, 29897, 13, 1678, 1006, 7168, 353, 3617, 15467, 29911, 1092, 820, 10602, 4074, 7168, 29898, 13, 4706, 8635, 29922, 12925, 29892, 2198, 261, 29922, 6338, 261, 13, 1678, 1723, 13, 13, 1678, 11187, 29918, 786, 29875, 29918, 333, 353, 376, 29947, 29906, 29946, 29955, 29900, 29947, 29947, 29955, 29955, 29906, 29992, 1744, 29902, 29908, 13, 1678, 11187, 29918, 6338, 261, 29918, 5327, 353, 11117, 786, 29875, 29918, 333, 2396, 11187, 29918, 786, 29875, 29918, 333, 29913, 13, 13, 1678, 8635, 29889, 657, 29918, 786, 29875, 29918, 333, 29889, 2457, 29918, 1767, 353, 11187, 29918, 786, 29875, 29918, 333, 13, 1678, 2198, 261, 29889, 657, 29918, 10472, 29918, 20678, 29918, 14144, 29918, 5327, 29889, 2457, 29918, 1767, 353, 320, 13, 4706, 11187, 29918, 6338, 261, 29918, 5327, 13, 13, 1678, 396, 2865, 13, 1678, 701, 29875, 29918, 333, 29918, 5327, 353, 1006, 7168, 29889, 657, 29918, 10472, 29918, 20678, 29918, 14144, 580, 13, 13, 1678, 396, 14697, 13, 1678, 4974, 701, 29875, 29918, 333, 29918, 5327, 1275, 11187, 29918, 6338, 261, 29918, 5327, 13, 1678, 8635, 29889, 657, 29918, 786, 29875, 29918, 333, 29889, 9294, 29918, 13998, 29918, 10646, 580, 13, 1678, 2198, 261, 29889, 657, 29918, 10472, 29918, 20678, 29918, 14144, 29918, 5327, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 13, 4706, 701, 29875, 29918, 333, 29922, 17640, 29918, 786, 29875, 29918, 333, 13, 1678, 1723, 13, 2 ]
l3ns/swarm/subnet.py
rukmarr/l3ns
3
72336
from .. import ldc from .node import SwarmNode class SwarmSubnet(ldc.DockerSubnet): def __init__(self, *args, size: int = 510, **kwargs): self._cluster_hosts = {} self._offset = size super().__init__(*args, size=size*2, **kwargs) def add_node(self, node: 'SwarmNode'): ip_address = self._get_host_ip() # docker swarm overlay requires additional ip address for lode balancer each cluster node (cluster_host in l3ns) if not isinstance(node, ldc.DockerNode) and node.cluster_host.address not in self._hosts: self._cluster_hosts[node.cluster_host.address] = self._hosts.pop(0) self._nodes_dict[ip_address] = node if node not in self._network: self._network.add_node(node) node.add_interface(ip_address, self) def _get_host_ip(self): # Since we don't have control over ip management for lode balancers, first free ip of the docker network # ip range will be used for each swarm node. Since it's not possible to control starting order of the nodes, # it's easier to just make network twice as large and give out addresses only from the second half return str(self._hosts.pop(self._offset+1)) def start(self): if self.started: return self.docker_network self.docker_network = self._client.networks.create( self.name, driver='overlay', attachable=True, ipam=self._make_ipam_config()) if not self.docker_network.attrs['Driver']: raise Exception('Error: IPAM customisation failed for swarm network {}, check if other networks overlap ip pool'.format(self.name)) self.started = True self.loaded = True print('[swarm] subnet', self.name, 'started') return self.docker_network
[ 1, 515, 6317, 1053, 301, 13891, 13, 3166, 869, 3177, 1053, 3925, 2817, 4247, 13, 13, 13, 1990, 3925, 2817, 4035, 1212, 29898, 430, 29883, 29889, 29928, 8658, 4035, 1212, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 2159, 29901, 938, 353, 29871, 29945, 29896, 29900, 29892, 3579, 19290, 1125, 13, 4706, 1583, 3032, 19594, 29918, 23525, 353, 6571, 13, 4706, 1583, 3032, 10289, 353, 2159, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 2159, 29922, 2311, 29930, 29906, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 788, 29918, 3177, 29898, 1311, 29892, 2943, 29901, 525, 10840, 2817, 4247, 29374, 13, 13, 4706, 10377, 29918, 7328, 353, 1583, 3032, 657, 29918, 3069, 29918, 666, 580, 13, 13, 4706, 396, 10346, 2381, 2817, 27292, 6858, 5684, 10377, 3211, 363, 301, 356, 6411, 25856, 1269, 9867, 2943, 313, 19594, 29918, 3069, 297, 301, 29941, 1983, 29897, 13, 4706, 565, 451, 338, 8758, 29898, 3177, 29892, 301, 13891, 29889, 29928, 8658, 4247, 29897, 322, 2943, 29889, 19594, 29918, 3069, 29889, 7328, 451, 297, 1583, 3032, 23525, 29901, 13, 9651, 1583, 3032, 19594, 29918, 23525, 29961, 3177, 29889, 19594, 29918, 3069, 29889, 7328, 29962, 353, 1583, 3032, 23525, 29889, 7323, 29898, 29900, 29897, 13, 13, 4706, 1583, 3032, 18010, 29918, 8977, 29961, 666, 29918, 7328, 29962, 353, 2943, 13, 4706, 565, 2943, 451, 297, 1583, 3032, 11618, 29901, 13, 9651, 1583, 3032, 11618, 29889, 1202, 29918, 3177, 29898, 3177, 29897, 13, 4706, 2943, 29889, 1202, 29918, 13248, 29898, 666, 29918, 7328, 29892, 1583, 29897, 13, 13, 1678, 822, 903, 657, 29918, 3069, 29918, 666, 29898, 1311, 1125, 13, 4706, 396, 4001, 591, 1016, 29915, 29873, 505, 2761, 975, 10377, 10643, 363, 301, 356, 6411, 4564, 414, 29892, 937, 3889, 10377, 310, 278, 10346, 3564, 13, 4706, 396, 10377, 3464, 674, 367, 1304, 363, 1269, 2381, 2817, 2943, 29889, 4001, 372, 29915, 29879, 451, 1950, 304, 2761, 6257, 1797, 310, 278, 7573, 29892, 13, 4706, 396, 372, 29915, 29879, 6775, 304, 925, 1207, 3564, 8951, 408, 2919, 322, 2367, 714, 14157, 871, 515, 278, 1473, 4203, 13, 4706, 736, 851, 29898, 1311, 3032, 23525, 29889, 7323, 29898, 1311, 3032, 10289, 29974, 29896, 876, 13, 13, 1678, 822, 1369, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 2962, 287, 29901, 13, 9651, 736, 1583, 29889, 14695, 29918, 11618, 13, 13, 4706, 1583, 29889, 14695, 29918, 11618, 353, 1583, 3032, 4645, 29889, 11618, 29879, 29889, 3258, 29898, 13, 9651, 1583, 29889, 978, 29892, 13, 9651, 7156, 2433, 957, 8387, 742, 13, 9651, 10641, 519, 29922, 5574, 29892, 13, 9651, 10377, 314, 29922, 1311, 3032, 5675, 29918, 666, 314, 29918, 2917, 3101, 13, 13, 4706, 565, 451, 1583, 29889, 14695, 29918, 11618, 29889, 5552, 29879, 1839, 12376, 2033, 29901, 13, 9651, 12020, 8960, 877, 2392, 29901, 5641, 5194, 2888, 4371, 5229, 363, 2381, 2817, 3564, 24335, 1423, 565, 916, 14379, 25457, 10377, 11565, 4286, 4830, 29898, 1311, 29889, 978, 876, 13, 13, 4706, 1583, 29889, 2962, 287, 353, 5852, 13, 4706, 1583, 29889, 15638, 353, 5852, 13, 13, 4706, 1596, 877, 29961, 2774, 2817, 29962, 1014, 1212, 742, 1583, 29889, 978, 29892, 525, 2962, 287, 1495, 13, 13, 4706, 736, 1583, 29889, 14695, 29918, 11618, 13, 2 ]
ABC/206/a_1.py
fumiyanll23/AtCoder
0
100195
def main(): # input N = int(input()) # compute N = int(1.08*N) # output if N < 206: print('Yay!') elif N == 206: print('so-so') else: print(':(') if __name__ == '__main__': main()
[ 1, 822, 1667, 7295, 13, 1678, 396, 1881, 13, 1678, 405, 353, 938, 29898, 2080, 3101, 13, 13, 1678, 396, 10272, 13, 1678, 405, 353, 938, 29898, 29896, 29889, 29900, 29947, 29930, 29940, 29897, 13, 13, 1678, 396, 1962, 13, 1678, 565, 405, 529, 29871, 29906, 29900, 29953, 29901, 13, 4706, 1596, 877, 29979, 388, 29991, 1495, 13, 1678, 25342, 405, 1275, 29871, 29906, 29900, 29953, 29901, 13, 4706, 1596, 877, 578, 29899, 578, 1495, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 29901, 877, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
OpenCV/Histogramas/h6.py
matewszz/Python
0
31235
<reponame>matewszz/Python import dlib import cv2 image = cv2.imread("../testeOpenCV.jpg") gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) hogFaceDetector = dlib.get_frontal_face_detector() faces = hogFaceDetector(gray, 1) for (i, rect) in enumerate(faces): x = rect.left() y = rect.top() w = rect.right() - x h = rect.bottom() - y cv2.rectangle(image, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.imshow("Image", image) k = cv2.waitKey()
[ 1, 529, 276, 1112, 420, 29958, 25046, 29893, 3616, 29920, 29914, 11980, 13, 5215, 270, 1982, 13, 5215, 13850, 29906, 13, 13, 3027, 353, 13850, 29906, 29889, 326, 949, 703, 6995, 1688, 29872, 6585, 15633, 29889, 6173, 1159, 13, 21012, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 3027, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 29897, 13, 29882, 468, 23360, 6362, 3019, 353, 270, 1982, 29889, 657, 29918, 8862, 284, 29918, 2161, 29918, 4801, 3019, 580, 13, 8726, 353, 298, 468, 23360, 6362, 3019, 29898, 21012, 29892, 29871, 29896, 29897, 13, 13, 1454, 313, 29875, 29892, 7705, 29897, 297, 26985, 29898, 8726, 1125, 13, 1678, 921, 353, 7705, 29889, 1563, 580, 13, 1678, 343, 353, 7705, 29889, 3332, 580, 13, 1678, 281, 353, 7705, 29889, 1266, 580, 448, 921, 13, 1678, 298, 353, 7705, 29889, 8968, 580, 448, 343, 13, 1678, 13850, 29906, 29889, 1621, 2521, 29898, 3027, 29892, 313, 29916, 29892, 343, 511, 313, 29916, 718, 281, 29892, 343, 718, 298, 511, 313, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 29871, 29900, 511, 29871, 29906, 29897, 13, 13, 11023, 29906, 29889, 326, 4294, 703, 2940, 613, 1967, 29897, 13, 29895, 353, 13850, 29906, 29889, 10685, 2558, 580, 2 ]
dash_docs/chapters/dash_vtk/click_hover/index.py
wesleyacheng/dash-docs
379
103544
import dash_html_components as html import dash_vtk from dash_docs import tools from dash_docs import styles from dash_docs import reusable_components as rc examples = tools.load_examples(__file__) layout = html.Div([ rc.Markdown(''' # Click and Hover Callbacks It's possible to create callbacks based on user clicks and hovering. First, you need to specify the `pickingModes` prop in `dash_vtk.View` to be a list of modes you want to capture. The following values are accepted: * `"click"` * `"hover"` Afterwards, you need to create callbacks where the inputs and states include one of the following read-only properties of `dash_vtk.View`. * `clickInfo`: Called when the user clicks on an object. * `hoverInfo`: Called when the user hovers over an object. > The full documentation for `dash_vtk.View` can be found in the [API reference](/vtk/reference). ## Callback structure You can notice that the `clickInfo` or `hoverInfo` data will be a dictionary with various keys describing the picked object. The keys include: * `displayPosition`: The x,y,z coordinate with on the user's screen. * `ray`: A line between two points in 3D space (xyz1, xyz2) that represent the mouse position. It covers the full space under the 2D mouse position. * `representationId`: The ID assigned to the `dash_vtk.GeometryRepresentation` containing your object. * `worldPosition`: The x, y, z coordinates in the 3D environment that you are rendering where the ray hit the object. It corresponds to the 3D coordinate on the surface of the object under your mouse. '''), rc.Markdown(''' ## Output `clickInfo` to `html.Pre` The following example shows you how to concisely display the output of `clickInfo` inside an `html.Pre`: '''), html.Details(open=False, children=[ html.Summary('View full code'), rc.Markdown( examples['t07_click_info.py'][0], style=styles.code_container ), ]), html.Div( examples['t07_click_info.py'][1], className='example-container' ), rc.Markdown(''' ## Update representation state with `hoverInfo` You can also construct more complex hover callbacks, which would affect the `actor` and `state` of your geometry representations. In the [terrain mesh demo](https://dash-gallery.plotly.host/dash-vtk-explorer/pyvista-terrain-following-mesh), whenever you hover over the surface, a callback is fired and the output is displayed on your screen: ![terrain-following-mesh-hover](/assets/images/vtk/hoverInfoMesh.jpg) The full code can be found [here](https://github.com/plotly/dash-vtk/tree/master/demos/pyvista-terrain-following-mesh), but the following snippet summarizes what is needed to capture hover events in the image above: ```py # ... vtk_view = dash_vtk.View( id="vtk-view", pickingModes=["hover"], children=[ dash_vtk.GeometryRepresentation(id="vtk-representation", ...), dash_vtk.GeometryRepresentation( id="pick-rep", children=[ dash_vtk.Algorithm(id="pick-sphere", ...) ], # ... ), ], ) app.layout = html.Div([ # ..., vtk_view, # ... ]) @app.callback( [ Output("tooltip", "children"), Output("pick-sphere", "state"), Output("pick-rep", "actor"), ], [Input("vtk-view", "clickInfo"), Input("vtk-view", "hoverInfo")], ) def onInfo(clickData, hoverData): info = hoverData if hoverData else clickData if info: if ( "representationId" in info and info["representationId"] == "vtk-representation" ): return ( [json.dumps(info, indent=2)], {"center": info["worldPosition"]}, {"visibility": True}, ) return dash.no_update, dash.no_update, dash.no_update return [""], {}, {"visibility": False} ``` You can also use `hoverInfo` to update the state of another geometry representation. The image below shows how to update a cone position, orientation and size in order to probe the race car object: ![terrain-following-mesh-hover](/assets/images/vtk/hoverInfoConeState.jpg) Learn more by reading the [source code](https://github.com/plotly/dash-sample-apps/tree/master/apps/dash-vehicle-geometry) or trying out the [Vehicle Geometry app](https://dash-gallery.plotly.host/dash-vehicle-geometry/). '''), ])
[ 1, 1053, 12569, 29918, 1420, 29918, 14036, 408, 3472, 13, 5215, 12569, 29918, 29894, 11178, 13, 3166, 12569, 29918, 2640, 1053, 8492, 13, 3166, 12569, 29918, 2640, 1053, 11949, 13, 3166, 12569, 29918, 2640, 1053, 337, 27979, 29918, 14036, 408, 364, 29883, 13, 13, 19057, 353, 8492, 29889, 1359, 29918, 19057, 22168, 1445, 1649, 29897, 13, 13, 2680, 353, 3472, 29889, 12596, 4197, 13, 1678, 364, 29883, 29889, 9802, 3204, 877, 4907, 13, 1678, 396, 16297, 322, 379, 957, 8251, 1627, 29879, 13, 13, 1678, 739, 29915, 29879, 1950, 304, 1653, 6939, 29879, 2729, 373, 1404, 19367, 322, 16758, 292, 29889, 3824, 29892, 366, 817, 304, 6084, 278, 421, 23945, 292, 2111, 267, 29952, 3107, 297, 29871, 13, 1678, 421, 14592, 29918, 29894, 11178, 29889, 1043, 29952, 304, 367, 263, 1051, 310, 18893, 366, 864, 304, 10446, 29889, 450, 1494, 1819, 526, 9259, 29901, 13, 1678, 334, 10248, 3808, 6937, 13, 1678, 334, 10248, 13194, 6937, 13, 268, 13, 1678, 2860, 2935, 29892, 366, 817, 304, 1653, 6939, 29879, 988, 278, 10970, 322, 5922, 3160, 697, 310, 278, 1494, 1303, 29899, 6194, 4426, 310, 421, 14592, 29918, 29894, 11178, 29889, 1043, 1412, 13, 1678, 334, 421, 3808, 3401, 6998, 3037, 839, 746, 278, 1404, 19367, 373, 385, 1203, 29889, 13, 1678, 334, 421, 13194, 3401, 6998, 3037, 839, 746, 278, 1404, 5089, 874, 975, 385, 1203, 29889, 13, 13, 1678, 1405, 450, 2989, 5106, 363, 421, 14592, 29918, 29894, 11178, 29889, 1043, 29952, 508, 367, 1476, 297, 278, 518, 8787, 3407, 26909, 29894, 11178, 29914, 5679, 467, 13, 13, 268, 13, 1678, 444, 8251, 1627, 3829, 13, 13, 1678, 887, 508, 8369, 393, 278, 421, 3808, 3401, 29952, 470, 421, 13194, 3401, 29952, 848, 674, 367, 263, 8600, 411, 5164, 6611, 20766, 278, 18691, 1203, 29889, 450, 6611, 3160, 29901, 13, 1678, 334, 421, 4990, 8003, 6998, 450, 921, 29892, 29891, 29892, 29920, 14821, 411, 373, 278, 1404, 29915, 29879, 4315, 29889, 13, 1678, 334, 421, 764, 6998, 319, 1196, 1546, 1023, 3291, 297, 29871, 29941, 29928, 2913, 313, 20230, 29896, 29892, 921, 12339, 29906, 29897, 393, 2755, 278, 9495, 2602, 29889, 739, 18469, 278, 2989, 2913, 1090, 278, 29871, 29906, 29928, 9495, 2602, 29889, 13, 1678, 334, 421, 276, 26081, 1204, 6998, 450, 3553, 9859, 304, 278, 421, 14592, 29918, 29894, 11178, 29889, 7999, 7843, 1123, 26081, 29952, 6943, 596, 1203, 29889, 13, 1678, 334, 421, 11526, 8003, 6998, 29871, 450, 921, 29892, 343, 29892, 503, 10350, 297, 278, 29871, 29941, 29928, 5177, 393, 366, 526, 15061, 988, 278, 15570, 7124, 278, 1203, 29889, 739, 16161, 304, 278, 29871, 29941, 29928, 14821, 373, 278, 7101, 310, 278, 1203, 1090, 596, 9495, 29889, 13, 13, 1678, 14550, 511, 13, 268, 13, 1678, 364, 29883, 29889, 9802, 3204, 877, 4907, 13, 1678, 444, 10604, 421, 3808, 3401, 29952, 304, 421, 1420, 29889, 6572, 29952, 13, 13, 1678, 450, 1494, 1342, 3697, 366, 920, 304, 3022, 275, 873, 2479, 278, 1962, 310, 421, 3808, 3401, 29952, 2768, 385, 421, 1420, 29889, 6572, 6998, 13, 1678, 14550, 511, 13, 1678, 3472, 29889, 10602, 29898, 3150, 29922, 8824, 29892, 4344, 11759, 13, 4706, 3472, 29889, 26289, 877, 1043, 2989, 775, 5477, 539, 13, 4706, 364, 29883, 29889, 9802, 3204, 29898, 13, 9651, 6455, 1839, 29873, 29900, 29955, 29918, 3808, 29918, 3888, 29889, 2272, 2033, 29961, 29900, 1402, 29871, 13, 9651, 3114, 29922, 9783, 29889, 401, 29918, 7611, 13, 4706, 10353, 13, 1678, 4514, 511, 13, 13, 1678, 3472, 29889, 12596, 29898, 13, 4706, 6455, 1839, 29873, 29900, 29955, 29918, 3808, 29918, 3888, 29889, 2272, 2033, 29961, 29896, 1402, 29871, 13, 4706, 22030, 2433, 4773, 29899, 7611, 29915, 13, 1678, 10353, 13, 13, 1678, 364, 29883, 29889, 9802, 3204, 877, 4907, 13, 13, 1678, 444, 10318, 8954, 2106, 411, 421, 13194, 3401, 29952, 13, 13, 1678, 887, 508, 884, 3386, 901, 4280, 16758, 6939, 29879, 29892, 607, 723, 6602, 278, 421, 7168, 29952, 322, 421, 3859, 29952, 310, 596, 16303, 22540, 29889, 29871, 13, 1678, 512, 278, 518, 357, 6038, 27716, 13455, 850, 991, 597, 14592, 29899, 29887, 23365, 29889, 5317, 368, 29889, 3069, 29914, 14592, 29899, 29894, 11178, 29899, 735, 14716, 29914, 2272, 29894, 2079, 29899, 357, 6038, 29899, 23031, 292, 29899, 4467, 29882, 511, 10940, 366, 16758, 13, 1678, 975, 278, 7101, 29892, 263, 6939, 338, 17285, 322, 278, 1962, 338, 8833, 373, 596, 4315, 29901, 13, 13, 1678, 1738, 29961, 357, 6038, 29899, 23031, 292, 29899, 4467, 29882, 29899, 13194, 26909, 16596, 29914, 8346, 29914, 29894, 11178, 29914, 13194, 3401, 29924, 12094, 29889, 6173, 29897, 13, 13, 1678, 450, 2989, 775, 508, 367, 1476, 518, 4150, 850, 991, 597, 3292, 29889, 510, 29914, 5317, 368, 29914, 14592, 29899, 29894, 11178, 29914, 8336, 29914, 6207, 29914, 2310, 359, 29914, 2272, 29894, 2079, 29899, 357, 6038, 29899, 23031, 292, 29899, 4467, 29882, 511, 541, 278, 29871, 13, 1678, 1494, 11534, 19138, 7093, 825, 338, 4312, 304, 10446, 16758, 4959, 297, 278, 1967, 2038, 29901, 13, 13, 1678, 7521, 2272, 13, 1678, 396, 2023, 13, 13, 1678, 325, 11178, 29918, 1493, 353, 12569, 29918, 29894, 11178, 29889, 1043, 29898, 13, 4706, 1178, 543, 29894, 11178, 29899, 1493, 613, 13, 4706, 5839, 292, 2111, 267, 29922, 3366, 13194, 12436, 13, 4706, 4344, 11759, 13, 9651, 12569, 29918, 29894, 11178, 29889, 7999, 7843, 1123, 26081, 29898, 333, 543, 29894, 11178, 29899, 276, 26081, 613, 2023, 511, 13, 9651, 12569, 29918, 29894, 11178, 29889, 7999, 7843, 1123, 26081, 29898, 13, 18884, 1178, 543, 23945, 29899, 3445, 613, 13, 18884, 4344, 11759, 13, 462, 1678, 12569, 29918, 29894, 11178, 29889, 22461, 4540, 29898, 333, 543, 23945, 29899, 29879, 9085, 613, 29757, 13, 18884, 21251, 13, 18884, 396, 2023, 13, 9651, 10353, 13, 4706, 21251, 13, 1678, 1723, 13, 13, 1678, 623, 29889, 2680, 353, 3472, 29889, 12596, 4197, 13, 418, 396, 2023, 29892, 13, 418, 325, 11178, 29918, 1493, 29892, 13, 418, 396, 2023, 13, 268, 2314, 13, 13, 1678, 732, 932, 29889, 14035, 29898, 13, 4706, 518, 13, 9651, 10604, 703, 10154, 12632, 613, 376, 11991, 4968, 13, 9651, 10604, 703, 23945, 29899, 29879, 9085, 613, 376, 3859, 4968, 13, 9651, 10604, 703, 23945, 29899, 3445, 613, 376, 7168, 4968, 13, 4706, 21251, 13, 4706, 518, 4290, 703, 29894, 11178, 29899, 1493, 613, 376, 3808, 3401, 4968, 10567, 703, 29894, 11178, 29899, 1493, 613, 376, 13194, 3401, 1159, 1402, 13, 1678, 1723, 13, 1678, 822, 373, 3401, 29898, 3808, 1469, 29892, 16758, 1469, 1125, 13, 4706, 5235, 353, 16758, 1469, 565, 16758, 1469, 1683, 2828, 1469, 13, 4706, 565, 5235, 29901, 13, 9651, 565, 313, 13, 18884, 376, 276, 26081, 1204, 29908, 297, 5235, 13, 18884, 322, 5235, 3366, 276, 26081, 1204, 3108, 1275, 376, 29894, 11178, 29899, 276, 26081, 29908, 13, 632, 1125, 13, 18884, 736, 313, 13, 462, 1678, 518, 3126, 29889, 29881, 17204, 29898, 3888, 29892, 29536, 29922, 29906, 29897, 1402, 13, 462, 1678, 8853, 5064, 1115, 5235, 3366, 11526, 8003, 3108, 1118, 13, 462, 1678, 8853, 28814, 1115, 5852, 1118, 13, 18884, 1723, 13, 9651, 736, 12569, 29889, 1217, 29918, 5504, 29892, 12569, 29889, 1217, 29918, 5504, 29892, 12569, 29889, 1217, 29918, 5504, 13, 4706, 736, 6796, 12436, 24335, 8853, 28814, 1115, 7700, 29913, 13, 1678, 7521, 13, 13, 1678, 887, 508, 884, 671, 421, 13194, 3401, 29952, 304, 2767, 278, 2106, 310, 1790, 16303, 8954, 29889, 450, 1967, 2400, 3697, 920, 304, 2767, 263, 27843, 2602, 29892, 19843, 322, 2159, 297, 1797, 304, 410, 915, 278, 8175, 1559, 1203, 29901, 13, 13, 1678, 1738, 29961, 357, 6038, 29899, 23031, 292, 29899, 4467, 29882, 29899, 13194, 26909, 16596, 29914, 8346, 29914, 29894, 11178, 29914, 13194, 3401, 29907, 650, 2792, 29889, 6173, 29897, 13, 13, 1678, 19530, 29876, 901, 491, 5183, 278, 518, 4993, 775, 850, 991, 597, 3292, 29889, 510, 29914, 5317, 368, 29914, 14592, 29899, 11249, 29899, 13371, 29914, 8336, 29914, 6207, 29914, 13371, 29914, 14592, 29899, 345, 29882, 2512, 29899, 19156, 29897, 470, 1811, 714, 278, 518, 29963, 14797, 2512, 1879, 7843, 623, 850, 991, 597, 14592, 29899, 29887, 23365, 29889, 5317, 368, 29889, 3069, 29914, 14592, 29899, 345, 29882, 2512, 29899, 19156, 12495, 13, 13, 1678, 14550, 511, 13, 13, 2314, 13, 2 ]
braistow method.py
pramotharun/Numerical-Methods-with-Python
0
161634
<gh_stars>0 #Bairstow Method import numpy as np n = int(input("Degree of polynomial")) p = float(input("P value")) q = float(input("q value")) no_iterations = int(input("number of iterations")) a = np.zeros((n+2,1)) b = np.zeros((n+2,1)) c = np.zeros((n+2,1)) j = n+1 for i in range(n+1): a[i] = float(input("Enter coefficients of a:")) for x in range(no_iterations): #setting initial values for b: b[0]= 0 b[1]=a[0] for k in range(n+2): if k==0 or k==1: pass else: b[k]=a[k-1]-(p*b[k-1])-(q*b[k-2]) #setting initial values for c: c[0]= 0 c[1]=b[1] for m in range(n+2): if m==0 or m==1: pass else: c[m]=b[m]-(p*c[m-1])-(q*c[m-2]) print("a:\n") print(np.transpose(a) ) print("\n") print("-p*b\n") print(-p*np.transpose(b)) print("\n") print("-q*b\n") print(-q*np.transpose(b) ) print("\n") print("b:\n") print(np.transpose(b) ) print("\n") print("-p*c\n") print(-p*np.transpose(c) ) print("\n") print("-q*c\n") print(-q*np.transpose(c) ) print("\n") print("c:\n") print(np.transpose(c) ) print("\n") print("dp=") dp = ((b[j-1]*c[j-2])-b[j]*c[j-3])/((c[j-2]*c[j-2])-c[j-3]*(c[j-1]-b[j-1])) print(dp ) print("\n") print("dq=") dq = ((b[j]*c[j-2])-b[j-1]*(c[j-1]-b[j-1]))/((c[j-2]*c[j-2])-c[j-3]*(c[j-1]-b[j-1])) print(dq ) print("\n") p = p + dp q = q + dq print("newp=") print(p ) print("\n") print("newq=") print(q ) print("\n") print("____________next iteration__________________") print("\n")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 29937, 29933, 29874, 765, 340, 8108, 13, 13, 5215, 12655, 408, 7442, 13, 29876, 353, 938, 29898, 2080, 703, 29928, 387, 929, 310, 10159, 5783, 13, 29886, 353, 5785, 29898, 2080, 703, 29925, 995, 5783, 13, 29939, 353, 5785, 29898, 2080, 703, 29939, 995, 5783, 13, 1217, 29918, 1524, 800, 353, 938, 29898, 2080, 703, 4537, 310, 24372, 5783, 13, 13, 13, 29874, 353, 7442, 29889, 3298, 359, 3552, 29876, 29974, 29906, 29892, 29896, 876, 13, 29890, 353, 7442, 29889, 3298, 359, 3552, 29876, 29974, 29906, 29892, 29896, 876, 13, 29883, 353, 7442, 29889, 3298, 359, 3552, 29876, 29974, 29906, 29892, 29896, 876, 13, 29926, 353, 302, 29974, 29896, 13, 13, 13, 1454, 474, 297, 3464, 29898, 29876, 29974, 29896, 1125, 13, 1678, 263, 29961, 29875, 29962, 353, 5785, 29898, 2080, 703, 10399, 16127, 310, 263, 29901, 5783, 13, 13, 1454, 921, 297, 3464, 29898, 1217, 29918, 1524, 800, 1125, 13, 1678, 396, 26740, 2847, 1819, 363, 289, 29901, 13, 1678, 289, 29961, 29900, 13192, 29871, 29900, 13, 1678, 289, 29961, 29896, 13192, 29874, 29961, 29900, 29962, 13, 13, 1678, 363, 413, 297, 3464, 29898, 29876, 29974, 29906, 1125, 13, 4706, 565, 413, 1360, 29900, 470, 413, 1360, 29896, 29901, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 289, 29961, 29895, 13192, 29874, 29961, 29895, 29899, 29896, 29962, 17722, 29886, 29930, 29890, 29961, 29895, 29899, 29896, 2314, 17722, 29939, 29930, 29890, 29961, 29895, 29899, 29906, 2314, 13, 13, 1678, 396, 26740, 2847, 1819, 363, 274, 29901, 13, 1678, 274, 29961, 29900, 13192, 29871, 29900, 13, 1678, 274, 29961, 29896, 13192, 29890, 29961, 29896, 29962, 13, 13, 1678, 363, 286, 297, 3464, 29898, 29876, 29974, 29906, 1125, 13, 4706, 565, 286, 1360, 29900, 470, 286, 1360, 29896, 29901, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 274, 29961, 29885, 13192, 29890, 29961, 29885, 29962, 17722, 29886, 29930, 29883, 29961, 29885, 29899, 29896, 2314, 17722, 29939, 29930, 29883, 29961, 29885, 29899, 29906, 2314, 13, 13, 13, 1678, 1596, 703, 29874, 3583, 29876, 1159, 13, 1678, 1596, 29898, 9302, 29889, 3286, 4220, 29898, 29874, 29897, 1723, 29871, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 29899, 29886, 29930, 29890, 29905, 29876, 1159, 13, 1678, 1596, 6278, 29886, 29930, 9302, 29889, 3286, 4220, 29898, 29890, 876, 29871, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 29899, 29939, 29930, 29890, 29905, 29876, 1159, 13, 1678, 1596, 6278, 29939, 29930, 9302, 29889, 3286, 4220, 29898, 29890, 29897, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 13, 1678, 1596, 703, 29890, 3583, 29876, 1159, 13, 1678, 1596, 29898, 9302, 29889, 3286, 4220, 29898, 29890, 29897, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 29899, 29886, 29930, 29883, 29905, 29876, 1159, 13, 1678, 1596, 6278, 29886, 29930, 9302, 29889, 3286, 4220, 29898, 29883, 29897, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 29899, 29939, 29930, 29883, 29905, 29876, 1159, 13, 1678, 1596, 6278, 29939, 29930, 9302, 29889, 3286, 4220, 29898, 29883, 29897, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 29883, 3583, 29876, 1159, 13, 1678, 1596, 29898, 9302, 29889, 3286, 4220, 29898, 29883, 29897, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 6099, 543, 29897, 13, 1678, 270, 29886, 353, 5135, 29890, 29961, 29926, 29899, 29896, 14178, 29883, 29961, 29926, 29899, 29906, 2314, 29899, 29890, 29961, 29926, 14178, 29883, 29961, 29926, 29899, 29941, 2314, 29914, 3552, 29883, 29961, 29926, 29899, 29906, 14178, 29883, 29961, 29926, 29899, 29906, 2314, 29899, 29883, 29961, 29926, 29899, 29941, 14178, 29898, 29883, 29961, 29926, 29899, 29896, 29962, 29899, 29890, 29961, 29926, 29899, 29896, 12622, 13, 1678, 1596, 29898, 6099, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 13, 1678, 1596, 703, 29881, 29939, 543, 29897, 13, 1678, 270, 29939, 353, 5135, 29890, 29961, 29926, 14178, 29883, 29961, 29926, 29899, 29906, 2314, 29899, 29890, 29961, 29926, 29899, 29896, 14178, 29898, 29883, 29961, 29926, 29899, 29896, 29962, 29899, 29890, 29961, 29926, 29899, 29896, 12622, 29914, 3552, 29883, 29961, 29926, 29899, 29906, 14178, 29883, 29961, 29926, 29899, 29906, 2314, 29899, 29883, 29961, 29926, 29899, 29941, 14178, 29898, 29883, 29961, 29926, 29899, 29896, 29962, 29899, 29890, 29961, 29926, 29899, 29896, 12622, 13, 1678, 1596, 29898, 29881, 29939, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 282, 353, 282, 718, 270, 29886, 13, 1678, 3855, 353, 3855, 718, 270, 29939, 13, 13, 1678, 1596, 703, 1482, 29886, 543, 29897, 13, 1678, 1596, 29898, 29886, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 1678, 1596, 703, 1482, 29939, 543, 29897, 13, 1678, 1596, 29898, 29939, 1723, 13, 1678, 1596, 14182, 29876, 1159, 13, 1678, 1596, 703, 14365, 7652, 4622, 12541, 27097, 1649, 1159, 13, 1678, 1596, 14182, 29876, 1159, 13, 13, 13, 2 ]
python_plot.py
prusinski/NU_REU_git_NZP
0
114202
<filename>python_plot.py %matplotlib inline import numpy as np import matplotlib.pyplot as plt #plot exponential curve from 0 to 2pi t = np.linspace(0,2*np.pi,100) plt.plot(t,np.exp(t),'m', label = 'Exponential Curve') plt.title('Plot of $e^x$') plt.xlabel('t (s)') plt.ylabel('$y(t)$') plt.legend() plt.grid() plt.text(2.5,0.25,'This is a \nExponential Curve!', fontsize = 16) plt.text(1,-0.5,'Cool!', fontsize = 16) plt.show()
[ 1, 529, 9507, 29958, 4691, 29918, 5317, 29889, 2272, 13, 29995, 2922, 17357, 10583, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 29937, 5317, 25658, 11672, 515, 29871, 29900, 304, 29871, 29906, 1631, 13, 13, 29873, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29906, 29930, 9302, 29889, 1631, 29892, 29896, 29900, 29900, 29897, 13, 572, 29873, 29889, 5317, 29898, 29873, 29892, 9302, 29889, 4548, 29898, 29873, 511, 29915, 29885, 742, 3858, 353, 525, 1252, 1112, 2556, 10837, 345, 1495, 13, 572, 29873, 29889, 3257, 877, 20867, 310, 395, 29872, 29985, 29916, 29938, 1495, 13, 572, 29873, 29889, 29916, 1643, 877, 29873, 313, 29879, 29897, 1495, 13, 572, 29873, 29889, 29891, 1643, 877, 29938, 29891, 29898, 29873, 1262, 1495, 13, 572, 29873, 29889, 26172, 580, 13, 572, 29873, 29889, 7720, 580, 13, 572, 29873, 29889, 726, 29898, 29906, 29889, 29945, 29892, 29900, 29889, 29906, 29945, 5501, 4013, 338, 263, 320, 29876, 1252, 1112, 2556, 10837, 345, 29991, 742, 4079, 2311, 353, 29871, 29896, 29953, 29897, 13, 572, 29873, 29889, 726, 29898, 29896, 6653, 29900, 29889, 29945, 5501, 29907, 1507, 29991, 742, 4079, 2311, 353, 29871, 29896, 29953, 29897, 13, 572, 29873, 29889, 4294, 580, 13, 2 ]
day 12/Martijn - Python/passage_pathing.py
AE-nv/aedvent-code-2021
1
175111
def append_node_to_dict(node1, node2, dict_connections): if not node1 in dict_connections: dict_connections[node1] = [node2] else: node_connections = dict_connections[node1] if not node2 in node_connections: node_connections.append(node2) dict_connections[node1] = node_connections return dict_connections def parse_connections(connection, dict_connections): splitted = connection.split('-') node1 = splitted[0] node2 = splitted[1] dict_connections = append_node_to_dict(node1, node2, dict_connections) dict_connections = append_node_to_dict(node2, node1, dict_connections) return dict_connections def find_paths(start, length, dict_connections, paths): for path in paths: last_node = path[-1] def can_visit(node, path): check = False if node.isupper(): check = True elif not node in path: check = True elif node.islower() and node != 'end' and node != 'start': lowercase_nodes = [node for node in path if node.islower()] set_lowercase_nodes = set(lowercase_nodes) if (len(lowercase_nodes) == len(set_lowercase_nodes)): check = True return check def find_paths(graph, start, end, path=[]): path = path + [start] if start == end: return [path] paths = [] for node in graph[start]: if can_visit(node, path): newpaths = find_paths(graph, node, end, path) for newpath in newpaths: paths.append(newpath) return paths if __name__ == '__main__': input = open('./day 12/Martijn - Python/input.txt').readlines() connections = [line.strip() for line in input] dict_connections = {} for x in range(0, len(connections)): dict_connections = parse_connections(connections[x], dict_connections) paths = find_paths(dict_connections, 'start', 'end') print(len(paths))
[ 1, 822, 9773, 29918, 3177, 29918, 517, 29918, 8977, 29898, 3177, 29896, 29892, 2943, 29906, 29892, 9657, 29918, 11958, 1953, 1125, 13, 1678, 565, 451, 2943, 29896, 297, 9657, 29918, 11958, 1953, 29901, 13, 4706, 9657, 29918, 11958, 1953, 29961, 3177, 29896, 29962, 353, 518, 3177, 29906, 29962, 13, 1678, 1683, 29901, 13, 4706, 2943, 29918, 11958, 1953, 353, 9657, 29918, 11958, 1953, 29961, 3177, 29896, 29962, 13, 4706, 565, 451, 2943, 29906, 297, 2943, 29918, 11958, 1953, 29901, 13, 9651, 2943, 29918, 11958, 1953, 29889, 4397, 29898, 3177, 29906, 29897, 13, 9651, 9657, 29918, 11958, 1953, 29961, 3177, 29896, 29962, 353, 2943, 29918, 11958, 1953, 13, 1678, 736, 9657, 29918, 11958, 1953, 13, 13, 1753, 6088, 29918, 11958, 1953, 29898, 9965, 29892, 9657, 29918, 11958, 1953, 1125, 13, 1678, 8536, 4430, 353, 3957, 29889, 5451, 877, 29899, 1495, 13, 1678, 2943, 29896, 353, 8536, 4430, 29961, 29900, 29962, 13, 1678, 2943, 29906, 353, 8536, 4430, 29961, 29896, 29962, 13, 1678, 9657, 29918, 11958, 1953, 353, 9773, 29918, 3177, 29918, 517, 29918, 8977, 29898, 3177, 29896, 29892, 2943, 29906, 29892, 9657, 29918, 11958, 1953, 29897, 13, 1678, 9657, 29918, 11958, 1953, 353, 9773, 29918, 3177, 29918, 517, 29918, 8977, 29898, 3177, 29906, 29892, 2943, 29896, 29892, 9657, 29918, 11958, 1953, 29897, 13, 1678, 736, 9657, 29918, 11958, 1953, 13, 13, 1753, 1284, 29918, 24772, 29898, 2962, 29892, 3309, 29892, 9657, 29918, 11958, 1953, 29892, 10898, 1125, 13, 1678, 363, 2224, 297, 10898, 29901, 13, 4706, 1833, 29918, 3177, 353, 2224, 14352, 29896, 29962, 13, 13, 1753, 508, 29918, 1730, 277, 29898, 3177, 29892, 2224, 1125, 13, 1678, 1423, 353, 7700, 13, 1678, 565, 2943, 29889, 275, 21064, 7295, 13, 4706, 1423, 353, 5852, 13, 1678, 25342, 451, 2943, 297, 2224, 29901, 13, 4706, 1423, 353, 5852, 13, 1678, 25342, 2943, 29889, 275, 13609, 580, 322, 2943, 2804, 525, 355, 29915, 322, 2943, 2804, 525, 2962, 2396, 13, 4706, 5224, 4878, 29918, 18010, 353, 518, 3177, 363, 2943, 297, 2224, 565, 2943, 29889, 275, 13609, 580, 29962, 13, 4706, 731, 29918, 13609, 4878, 29918, 18010, 353, 731, 29898, 13609, 4878, 29918, 18010, 29897, 13, 4706, 565, 313, 2435, 29898, 13609, 4878, 29918, 18010, 29897, 1275, 7431, 29898, 842, 29918, 13609, 4878, 29918, 18010, 22164, 13, 9651, 1423, 353, 5852, 13, 1678, 736, 1423, 13, 13, 1753, 1284, 29918, 24772, 29898, 4262, 29892, 1369, 29892, 1095, 29892, 2224, 29922, 2636, 1125, 13, 1678, 2224, 353, 2224, 718, 518, 2962, 29962, 13, 1678, 565, 1369, 1275, 1095, 29901, 13, 4706, 736, 518, 2084, 29962, 13, 1678, 10898, 353, 5159, 13, 1678, 363, 2943, 297, 3983, 29961, 2962, 5387, 13, 4706, 565, 508, 29918, 1730, 277, 29898, 3177, 29892, 2224, 1125, 13, 9651, 716, 24772, 353, 1284, 29918, 24772, 29898, 4262, 29892, 2943, 29892, 1095, 29892, 2224, 29897, 13, 9651, 363, 716, 2084, 297, 716, 24772, 29901, 13, 18884, 10898, 29889, 4397, 29898, 1482, 2084, 29897, 13, 1678, 736, 10898, 13, 268, 13, 268, 13, 308, 13, 13, 13, 268, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1881, 353, 1722, 877, 6904, 3250, 29871, 29896, 29906, 29914, 15838, 3263, 448, 5132, 29914, 2080, 29889, 3945, 2824, 949, 9012, 580, 13, 1678, 12368, 353, 518, 1220, 29889, 17010, 580, 363, 1196, 297, 1881, 29962, 13, 1678, 9657, 29918, 11958, 1953, 353, 6571, 13, 1678, 363, 921, 297, 3464, 29898, 29900, 29892, 7431, 29898, 11958, 1953, 22164, 13, 4706, 9657, 29918, 11958, 1953, 353, 6088, 29918, 11958, 1953, 29898, 11958, 1953, 29961, 29916, 1402, 9657, 29918, 11958, 1953, 29897, 13, 1678, 10898, 353, 1284, 29918, 24772, 29898, 8977, 29918, 11958, 1953, 29892, 525, 2962, 742, 525, 355, 1495, 13, 1678, 1596, 29898, 2435, 29898, 24772, 876, 2 ]
NasUnet/util/datasets/__init__.py
mlvc-lab/Segmentation-NAS
4
135180
<gh_stars>1-10 from torchvision.datasets import * from .base import * from .coco import COCOSegmentation from .ade20k import ADE20KSegmentation from .pascal_voc import VOCSegmentation from .pascal_aug import VOCAugSegmentation from .pcontext import ContextSegmentation from .minc import MINCDataset from .ultrasound_nerve import UltraNerve from .bladder import Bladder from .chaos import CHAOS from .promise12 import Promise12 from .camvid import CamVid datasets = { 'coco': COCOSegmentation, 'ade20k': ADE20KSegmentation, 'pascal_voc': VOCSegmentation, 'pascal_aug': VOCAugSegmentation, 'pcontext': ContextSegmentation, 'minc': MINCDataset, 'cifar10': CIFAR10, 'ultrasound_nerve': UltraNerve, 'bladder': Bladder, 'chaos' : CHAOS, 'promise12': Promise12, 'camvid': CamVid } acronyms = { 'coco': 'coco', 'pascal_voc': 'voc', 'pascal_aug': 'voc', 'pcontext': 'pcontext', 'ade20k': 'ade', 'citys': 'citys', 'minc': 'minc', 'cifar10': 'cifar10', 'ultrasound_nerve': 'ultrasound_nerve', 'bladder': 'bladder', 'chaos': 'chaos', 'promise12': 'promise12', 'camvid': 'camvid' } dir = '/train_tiny_data/imgseg/' #= #dir = '../../../training_data/imageSeg/' def get_dataset(name, path=dir, **kwargs): return datasets[name.lower()](root = path, **kwargs)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 4842, 305, 4924, 29889, 14538, 1691, 1053, 334, 13, 3166, 869, 3188, 1053, 334, 13, 3166, 869, 29883, 6235, 1053, 4810, 3217, 17669, 358, 362, 13, 3166, 869, 1943, 29906, 29900, 29895, 1053, 319, 2287, 29906, 29900, 17557, 387, 358, 362, 13, 3166, 869, 18182, 1052, 29918, 29894, 542, 1053, 478, 29949, 9295, 387, 358, 362, 13, 3166, 869, 18182, 1052, 29918, 2987, 1053, 478, 29949, 5454, 688, 17669, 358, 362, 13, 3166, 869, 29886, 4703, 1053, 15228, 17669, 358, 362, 13, 3166, 869, 1195, 29883, 1053, 341, 1177, 6530, 271, 24541, 13, 3166, 869, 499, 3417, 618, 29918, 1089, 345, 1053, 18514, 336, 29940, 7143, 13, 3166, 869, 2204, 328, 672, 1053, 3164, 328, 672, 13, 3166, 869, 5815, 359, 1053, 5868, 29909, 3267, 13, 3166, 869, 14032, 895, 29896, 29906, 1053, 21501, 29896, 29906, 13, 3166, 869, 11108, 8590, 1053, 29871, 5500, 29963, 333, 13, 13, 14538, 1691, 353, 426, 13, 1678, 525, 29883, 6235, 2396, 4810, 3217, 17669, 358, 362, 29892, 13, 1678, 525, 1943, 29906, 29900, 29895, 2396, 319, 2287, 29906, 29900, 17557, 387, 358, 362, 29892, 13, 1678, 525, 18182, 1052, 29918, 29894, 542, 2396, 478, 29949, 9295, 387, 358, 362, 29892, 13, 1678, 525, 18182, 1052, 29918, 2987, 2396, 478, 29949, 5454, 688, 17669, 358, 362, 29892, 13, 1678, 525, 29886, 4703, 2396, 15228, 17669, 358, 362, 29892, 13, 1678, 525, 1195, 29883, 2396, 341, 1177, 6530, 271, 24541, 29892, 13, 1678, 525, 29883, 361, 279, 29896, 29900, 2396, 315, 6545, 1718, 29896, 29900, 29892, 13, 1678, 525, 499, 3417, 618, 29918, 1089, 345, 2396, 18514, 336, 29940, 7143, 29892, 13, 1678, 525, 2204, 328, 672, 2396, 3164, 328, 672, 29892, 13, 1678, 525, 5815, 359, 29915, 584, 5868, 29909, 3267, 29892, 13, 1678, 525, 14032, 895, 29896, 29906, 2396, 21501, 29896, 29906, 29892, 13, 1678, 525, 11108, 8590, 2396, 5500, 29963, 333, 13, 29913, 13, 13, 562, 1617, 962, 29879, 353, 426, 13, 1678, 525, 29883, 6235, 2396, 525, 29883, 6235, 742, 13, 1678, 525, 18182, 1052, 29918, 29894, 542, 2396, 525, 29894, 542, 742, 13, 1678, 525, 18182, 1052, 29918, 2987, 2396, 525, 29894, 542, 742, 13, 1678, 525, 29886, 4703, 2396, 525, 29886, 4703, 742, 13, 1678, 525, 1943, 29906, 29900, 29895, 2396, 525, 1943, 742, 13, 1678, 525, 12690, 29879, 2396, 525, 12690, 29879, 742, 13, 1678, 525, 1195, 29883, 2396, 525, 1195, 29883, 742, 13, 1678, 525, 29883, 361, 279, 29896, 29900, 2396, 525, 29883, 361, 279, 29896, 29900, 742, 13, 1678, 525, 499, 3417, 618, 29918, 1089, 345, 2396, 525, 499, 3417, 618, 29918, 1089, 345, 742, 13, 1678, 525, 2204, 328, 672, 2396, 525, 2204, 328, 672, 742, 13, 1678, 525, 5815, 359, 2396, 525, 5815, 359, 742, 13, 1678, 525, 14032, 895, 29896, 29906, 2396, 525, 14032, 895, 29896, 29906, 742, 13, 1678, 525, 11108, 8590, 2396, 525, 11108, 8590, 29915, 13, 29913, 13, 13, 3972, 353, 8207, 14968, 29918, 25649, 29918, 1272, 29914, 2492, 10199, 22208, 13, 29937, 29922, 13, 29937, 3972, 353, 525, 21546, 6995, 26495, 29918, 1272, 29914, 3027, 17669, 22208, 13, 13, 1753, 679, 29918, 24713, 29898, 978, 29892, 2224, 29922, 3972, 29892, 3579, 19290, 1125, 13, 1678, 736, 20035, 29961, 978, 29889, 13609, 580, 850, 4632, 353, 2224, 29892, 3579, 19290, 29897, 13, 13, 2 ]
compare_mt/sign_utils.py
maks5507/compare-mt
401
1615077
######################################################################################## # Compare two systems using bootstrap resampling # # adapted from https://github.com/neubig/util-scripts/blob/master/paired-bootstrap.py # # # # See, e.g. the following paper for references # # # # Statistical Significance Tests for Machine Translation Evaluation # # <NAME> # # http://www.aclweb.org/anthology/W04-3250 # # # ######################################################################################## import numpy as np def eval_with_paired_bootstrap(ref, outs, src, scorer, compare_directions=[(0, 1)], num_samples=1000, sample_ratio=0.5, cache_stats=None): """ Evaluate with paired boostrap. This compares several systems, performing a signifiance tests with paired bootstrap resampling to compare the accuracy of the specified systems. Args: ref: The correct labels outs: The output of systems src: The source corpus scorer: The scorer compare_directions: A string specifying which two systems to compare num_samples: The number of bootstrap samples to take sample_ratio: The ratio of samples to take every time cache_stats: The precomputed statistics Returns: A tuple containing the win ratios, statistics for systems """ sys_scores = [[] for _ in outs] wins = [[0, 0, 0] for _ in compare_directions] if compare_directions is not None else None n = len(ref) ids = list(range(n)) if cache_stats is None: cache_stats = [scorer.cache_stats(ref, out, src=src) for out in outs] sample_size = int(n*sample_ratio) for _ in range(num_samples): # Subsample the gold and system outputs (with replacement) reduced_ids = np.random.choice(ids, size=sample_size, replace=True) # Calculate accuracy on the reduced sample and save stats if cache_stats[0]: sys_score, _ = zip(*[scorer.score_cached_corpus(reduced_ids, cache_stat) for cache_stat in cache_stats]) else: reduced_ref = [ref[i] for i in reduced_ids] reduced_outs = [[out[i] for i in reduced_ids] for out in outs] reduced_src = [src[i] for i in reduced_ids] sys_score, _ = zip(*[scorer.score_corpus(reduced_ref, reduced_out, reduced_src) for reduced_out in reduced_outs]) if wins is not None: for i, compare_direction in enumerate(compare_directions): left, right = compare_direction if sys_score[left] > sys_score[right]: wins[i][0] += 1 if sys_score[left] < sys_score[right]: wins[i][1] += 1 else: wins[i][2] += 1 for i in range(len(outs)): sys_scores[i].append(sys_score[i]) # Print win stats wins = [[x/float(num_samples) for x in win] for win in wins] if wins is not None else None # Print system stats sys_stats = [] for i in range(len(outs)): sys_scores[i].sort() sys_stats.append({ 'mean':np.mean(sys_scores[i]), 'median':np.median(sys_scores[i]), 'lower_bound':sys_scores[i][int(num_samples * 0.025)], 'upper_bound':sys_scores[i][int(num_samples * 0.975)] }) return wins, sys_stats
[ 1, 835, 13383, 13383, 13383, 13383, 13383, 4136, 29937, 13, 29937, 3831, 598, 1023, 6757, 773, 16087, 620, 314, 10335, 462, 462, 539, 396, 13, 29937, 29871, 23430, 515, 2045, 597, 3292, 29889, 510, 29914, 484, 431, 335, 29914, 4422, 29899, 16713, 29914, 10054, 29914, 6207, 29914, 3274, 2859, 29899, 8704, 29889, 2272, 396, 13, 29937, 462, 462, 462, 462, 462, 418, 396, 13, 29937, 2823, 29892, 321, 29889, 29887, 29889, 278, 1494, 5650, 363, 9282, 462, 462, 308, 396, 13, 29937, 462, 462, 462, 462, 462, 418, 396, 13, 29937, 13070, 936, 9954, 928, 749, 4321, 29879, 363, 6189, 4103, 18411, 382, 4387, 362, 462, 1678, 396, 13, 29937, 529, 5813, 29958, 462, 462, 462, 462, 4706, 396, 13, 29937, 1732, 597, 1636, 29889, 562, 29880, 2676, 29889, 990, 29914, 9716, 3002, 29914, 29956, 29900, 29946, 29899, 29941, 29906, 29945, 29900, 462, 462, 632, 396, 13, 29937, 462, 462, 462, 462, 462, 418, 396, 13, 13383, 13383, 13383, 13383, 13383, 7346, 13, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 19745, 29918, 2541, 29918, 3274, 2859, 29918, 8704, 29898, 999, 29892, 714, 29879, 29892, 4765, 29892, 13, 462, 1669, 885, 9386, 29892, 13, 462, 1669, 7252, 29918, 20146, 1953, 11759, 29898, 29900, 29892, 29871, 29896, 29897, 1402, 13, 462, 1669, 954, 29918, 27736, 29922, 29896, 29900, 29900, 29900, 29892, 4559, 29918, 3605, 601, 29922, 29900, 29889, 29945, 29892, 13, 462, 1669, 7090, 29918, 16202, 29922, 8516, 1125, 13, 29871, 9995, 13, 29871, 382, 4387, 403, 411, 3300, 2859, 14505, 2390, 29889, 13, 29871, 910, 752, 5114, 3196, 6757, 29892, 15859, 263, 1804, 361, 8837, 6987, 411, 13, 29871, 3300, 2859, 16087, 620, 314, 10335, 304, 7252, 278, 13600, 310, 278, 6790, 6757, 29889, 13, 13, 29871, 826, 3174, 29901, 13, 1678, 2143, 29901, 450, 1959, 11073, 13, 1678, 714, 29879, 29901, 450, 1962, 310, 6757, 13, 1678, 4765, 29901, 450, 2752, 1034, 13364, 13, 1678, 885, 9386, 29901, 450, 885, 9386, 13, 1678, 7252, 29918, 20146, 1953, 29901, 319, 1347, 22146, 607, 1023, 6757, 304, 7252, 13, 1678, 954, 29918, 27736, 29901, 450, 1353, 310, 16087, 11916, 304, 2125, 13, 1678, 4559, 29918, 3605, 601, 29901, 450, 11959, 310, 11916, 304, 2125, 1432, 931, 13, 1678, 7090, 29918, 16202, 29901, 450, 758, 12097, 287, 13964, 13, 13, 29871, 16969, 29901, 13, 1678, 319, 18761, 6943, 278, 5401, 364, 2219, 359, 29892, 13964, 363, 6757, 13, 29871, 9995, 13, 29871, 10876, 29918, 1557, 2361, 353, 518, 2636, 363, 903, 297, 714, 29879, 29962, 29871, 13, 29871, 21614, 353, 5519, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29962, 363, 903, 297, 7252, 29918, 20146, 1953, 29962, 565, 7252, 29918, 20146, 1953, 338, 451, 6213, 1683, 6213, 13, 29871, 302, 353, 7431, 29898, 999, 29897, 13, 29871, 18999, 353, 1051, 29898, 3881, 29898, 29876, 876, 13, 13, 29871, 565, 7090, 29918, 16202, 338, 6213, 29901, 13, 1678, 7090, 29918, 16202, 353, 518, 1557, 9386, 29889, 8173, 29918, 16202, 29898, 999, 29892, 714, 29892, 4765, 29922, 4351, 29897, 363, 714, 297, 714, 29879, 29962, 13, 29871, 4559, 29918, 2311, 353, 938, 29898, 29876, 29930, 11249, 29918, 3605, 601, 29897, 13, 29871, 363, 903, 297, 3464, 29898, 1949, 29918, 27736, 1125, 13, 1678, 396, 3323, 11249, 278, 7684, 322, 1788, 14391, 313, 2541, 16920, 29897, 13, 1678, 12212, 29918, 4841, 353, 7442, 29889, 8172, 29889, 16957, 29898, 4841, 29892, 2159, 29922, 11249, 29918, 2311, 29892, 5191, 29922, 5574, 29897, 13, 1678, 396, 20535, 403, 13600, 373, 278, 12212, 4559, 322, 4078, 22663, 13, 1678, 565, 7090, 29918, 16202, 29961, 29900, 5387, 13, 418, 10876, 29918, 13628, 29892, 903, 353, 14319, 10456, 29961, 1557, 9386, 29889, 13628, 29918, 29883, 3791, 29918, 2616, 13364, 29898, 9313, 1133, 29918, 4841, 29892, 7090, 29918, 6112, 29897, 363, 7090, 29918, 6112, 297, 7090, 29918, 16202, 2314, 13, 1678, 1683, 29901, 13, 418, 12212, 29918, 999, 353, 518, 999, 29961, 29875, 29962, 363, 474, 297, 12212, 29918, 4841, 29962, 13, 418, 12212, 29918, 17718, 353, 5519, 449, 29961, 29875, 29962, 363, 474, 297, 12212, 29918, 4841, 29962, 363, 714, 297, 714, 29879, 29962, 13, 418, 12212, 29918, 4351, 353, 518, 4351, 29961, 29875, 29962, 363, 474, 297, 12212, 29918, 4841, 29962, 13, 418, 10876, 29918, 13628, 29892, 903, 353, 14319, 10456, 29961, 1557, 9386, 29889, 13628, 29918, 2616, 13364, 29898, 9313, 1133, 29918, 999, 29892, 12212, 29918, 449, 29892, 12212, 29918, 4351, 29897, 363, 12212, 29918, 449, 297, 12212, 29918, 17718, 2314, 13, 13, 1678, 565, 21614, 338, 451, 6213, 29901, 13, 418, 363, 474, 29892, 7252, 29918, 20845, 297, 26985, 29898, 18307, 29918, 20146, 1953, 1125, 29871, 13, 4706, 2175, 29892, 1492, 353, 7252, 29918, 20845, 13, 4706, 565, 10876, 29918, 13628, 29961, 1563, 29962, 1405, 10876, 29918, 13628, 29961, 1266, 5387, 13, 3986, 21614, 29961, 29875, 3816, 29900, 29962, 4619, 29871, 29896, 13, 4706, 565, 10876, 29918, 13628, 29961, 1563, 29962, 529, 10876, 29918, 13628, 29961, 1266, 5387, 13, 3986, 21614, 29961, 29875, 3816, 29896, 29962, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 3986, 21614, 29961, 29875, 3816, 29906, 29962, 4619, 29871, 29896, 13, 268, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 17718, 22164, 29871, 13, 418, 10876, 29918, 1557, 2361, 29961, 29875, 1822, 4397, 29898, 9675, 29918, 13628, 29961, 29875, 2314, 13, 13, 29871, 396, 13905, 5401, 22663, 13, 29871, 21614, 353, 5519, 29916, 29914, 7411, 29898, 1949, 29918, 27736, 29897, 363, 921, 297, 5401, 29962, 363, 5401, 297, 21614, 29962, 565, 21614, 338, 451, 6213, 1683, 6213, 13, 13, 29871, 396, 13905, 1788, 22663, 13, 29871, 10876, 29918, 16202, 353, 5159, 13, 29871, 363, 474, 297, 3464, 29898, 2435, 29898, 17718, 22164, 29871, 13, 1678, 10876, 29918, 1557, 2361, 29961, 29875, 1822, 6605, 580, 13, 1678, 10876, 29918, 16202, 29889, 4397, 3319, 13, 418, 525, 12676, 2396, 9302, 29889, 12676, 29898, 9675, 29918, 1557, 2361, 29961, 29875, 11724, 13, 418, 525, 2168, 713, 2396, 9302, 29889, 2168, 713, 29898, 9675, 29918, 1557, 2361, 29961, 29875, 11724, 13, 418, 525, 13609, 29918, 9917, 2396, 9675, 29918, 1557, 2361, 29961, 29875, 3816, 524, 29898, 1949, 29918, 27736, 334, 29871, 29900, 29889, 29900, 29906, 29945, 29897, 1402, 13, 418, 525, 21064, 29918, 9917, 2396, 9675, 29918, 1557, 2361, 29961, 29875, 3816, 524, 29898, 1949, 29918, 27736, 334, 29871, 29900, 29889, 29929, 29955, 29945, 4638, 13, 1678, 5615, 13, 29871, 13, 29871, 736, 21614, 29892, 10876, 29918, 16202, 13, 2 ]
arxpy/differential/difference.py
hukaisdu/ArxPy
25
95392
"""Manipulate differences.""" import collections from arxpy.bitvector import core from arxpy.bitvector import operation from arxpy.bitvector import extraop def _tuplify(seq): if isinstance(seq, collections.abc.Sequence): return tuple(seq) else: return tuple([seq]) class Difference(object): """Represent differences. The *difference* between two `Term` :math:`x` and :math:`y` is defined as :math:`\\alpha = y - x`, where the *difference operation* :math:`-` is a bit-vector `Operation`. In other words, the pair :math:`(x, x + \\alpha)` has difference :math:`\\alpha`, where :math:`+` is the inverse of the difference operation. The most common difference used in differential cryptanalysis is the XOR difference `XorDiff` (where the difference operation is `BvXor`). Other examples are the additive difference (where the difference operation is `BvSub`) or the rotational-XOR difference `RXDiff`. Note that arithmetic with differences is not supported. For example, two `Difference` objects ``d1`` and ``d2`` cannot be XORed, i.e., ``d1 ^ d2``. This can be done instead by performing the arithmetic with the difference values and converting the resulting `Term` to a difference, that is, ``Difference(d1.val ^ d2.val)`` This class is not meant to be instantiated but to provide a base class for the different types of differences. Attributes: val: a `Term` representing the value of the difference. diff_op: the difference `Operation`. inv_diff_op: the inverse of the difference operation. """ diff_op = None inv_diff_op = None def __init__(self, value): assert isinstance(value, core.Term) self.val = value def __str__(self): """Return the non-verbose string representation.""" return "{}({})".format(type(self).__name__, str(self.val)) __repr__ = __str__ def __hash__(self): return hash(self.val) def __eq__(self, other): if isinstance(other, type(self)): return self.val == other.val else: return False def xreplace(self, rule): """Replace occurrences of differences within the expression. The argument ``rule`` is a dict-like object representing the replacement rule. This method is similar to SymPy `xreplace <https://docs.sympy.org/latest/modules/core.html?highlight=xreplace# sympy.core.basic.Basic.xreplace>`_ but with the restriction that only differences objects are allowed in ``rule``. """ for d in rule: assert isinstance(d, type(self)) and isinstance(rule[d], type(self)) rule = {d.val: rule[d].val for d in rule} return type(self)(self.val.xreplace(rule)) def vrepr(self): """Return a verbose string representation.""" return "{}({})".format(type(self).__name__, self.val.vrepr()) @classmethod def from_pair(cls, x, y): """Return the `Difference` :math:`\\alpha = y - x` given two `Term`.""" assert isinstance(x, core.Term) assert isinstance(y, core.Term) return cls(cls.diff_op(x, y)) # The order of the operands is important def get_pair_element(self, x): """Return the `Term` :math:`y` such that :math:`y = \\alpha + x`.""" assert isinstance(x, core.Term) return self.inv_diff_op(x, self.val) @classmethod def derivative(cls, op, input_diff): """Return the derivative of ``op`` at the point ``input_diff``. The derivative of an `Operation` :math:`f` at the point :math:`\\alpha` (also called the input difference) is defined as :math:`f_{\\alpha} (x) = f(x + \\alpha) - f(x)`. Note that :math:`f_{\\alpha} (x)` is the difference of :math:`(f(x), f(x + \\alpha))`. If :math:`f` has multiple operands, :math:`\\alpha` is a list containing the `Difference` of each operand and the computation :math:`x + \\alpha` is defined component-wise, that is, :math:`x = (x_1, \dots, x_n)`, :math:`\\alpha = (\\alpha_1, \dots, \\alpha_n)`, and :math:`x + \\alpha = (x_1 + \\alpha_1, \dots, x_n + \\alpha_n)`. For some operations, there is a unique output difference :math:`\\beta` for every input difference :math:`\\alpha`, that is, :math:`f_{\\alpha}(x) = \\beta` is a constant function. In this case, this method returns the `Difference` :math:`\\beta`. Otherwise, it returns a `Derivative` object representing :math:`f_{\\alpha}`. Operations with scalar operands are not supported, but these operands can be removed with `make_partial_operation` and the derivative of the resulting operator can then be computed. Args: op: a bit-vector operator input_diff: a list containing the difference of each operand """ raise NotImplementedError("subclasses need to override this method") class XorDiff(Difference): """Represent XOR differences. The XOR difference of two `Term` is given by the XOR of the terms. In other words, the *difference operation* of `XorDiff` is the `BvXor` (see `Difference`). >>> from arxpy.bitvector.core import Constant, Variable >>> from arxpy.differential.difference import XorDiff >>> x, y = Constant(0b000, 3), Constant(0b000, 3) >>> alpha = XorDiff.from_pair(x, y) >>> alpha XorDiff(0b000) >>> alpha.get_pair_element(x) 0b000 >>> x, y = Constant(0b010, 3), Constant(0b101, 3) >>> alpha = XorDiff.from_pair(x, y) >>> alpha XorDiff(0b111) >>> alpha.get_pair_element(x) 0b101 >>> k = Variable("k", 8) >>> alpha = XorDiff.from_pair(k, k) >>> alpha XorDiff(0x00) >>> alpha.get_pair_element(k) k """ diff_op = operation.BvXor inv_diff_op = operation.BvXor @classmethod def derivative(cls, op, input_diff): """Return the derivative of ``op`` at the point ``input_diff``. See `Difference.derivative` for more information. >>> from arxpy.bitvector.core import Variable, Constant >>> from arxpy.bitvector.operation import BvAdd, BvXor, RotateLeft, BvSub >>> from arxpy.bitvector.extraop import make_partial_operation >>> from arxpy.differential.difference import XorDiff >>> d1, d2 = XorDiff(Variable("d1", 8)), XorDiff(Variable("d2", 8)) >>> XorDiff.derivative(BvXor, [d1, d2]) XorDiff(d1 ^ d2) >>> Xor1 = make_partial_operation(BvXor, tuple([None, Constant(1, 8)])) >>> XorDiff.derivative(Xor1, d1) XorDiff(d1) >>> Rotate1 = make_partial_operation(RotateLeft, tuple([None, 1])) >>> XorDiff.derivative(Rotate1, d1) XorDiff(d1 <<< 1) >>> XorDiff.derivative(BvAdd, [d1, d2]) XDA(XorDiff(d1), XorDiff(d2)) >>> XorDiff.derivative(BvSub, [d1, d2]) XDS(XorDiff(d1), XorDiff(d2)) >>> CteAdd1 = make_partial_operation(BvAdd, tuple([None, Constant(1, 8)])) >>> XorDiff.derivative(CteAdd1, d1) XDCA_0x01(XorDiff(d1)) """ input_diff = _tuplify(input_diff) assert len(input_diff) == sum(op.arity) msg = "invalid arguments: op={}, input_diff={}".format( op.__name__, [d.vrepr() if isinstance(d, core.Term) else d for d in input_diff]) if not all(isinstance(diff, cls) for diff in input_diff): raise ValueError(msg) if op == operation.BvNot: return input_diff[0] if op == operation.BvXor: return cls(op(*[d.val for d in input_diff])) if op == operation.Concat: return cls(op(*[d.val for d in input_diff])) if op == operation.BvAdd: from arxpy.differential import derivative return derivative.XDA(input_diff) if op == operation.BvSub: from arxpy.differential import derivative return derivative.XDS(input_diff) if issubclass(op, extraop.PartialOperation): if op.base_op == operation.BvXor: assert len(input_diff) == 1 d1 = input_diff[0] val = op.fixed_args[0] if op.fixed_args[0] is not None else op.fixed_args[1] d2 = cls.from_pair(val, val) input_diff = [d1, d2] return cls(op.base_op(*[d.val for d in input_diff])) if op.base_op == operation.BvAnd: assert len(input_diff) == 1 d1 = input_diff[0] val = op.fixed_args[0] if op.fixed_args[0] is not None else op.fixed_args[1] if isinstance(val, core.Constant): return cls(op.base_op(d1.val, val)) if op.base_op in [operation.RotateLeft, operation.RotateRight]: if op.fixed_args[0] is None and op.fixed_args[1] is not None: assert len(input_diff) == 1 d = input_diff[0] return cls(op.base_op(d.val, op.fixed_args[1])) else: raise ValueError(msg) if op.base_op in [operation.BvShl, operation.BvLshr]: if op.fixed_args[0] is None and op.fixed_args[1] is not None: assert len(input_diff) == 1 d = input_diff[0] return cls(op.base_op(d.val, op.fixed_args[1])) else: raise ValueError(msg) if op.base_op == operation.Extract: if op.fixed_args[0] is None and op.fixed_args[1] is not None and op.fixed_args[2] is not None: assert len(input_diff) == 1 d = input_diff[0] return cls(op.base_op(d.val, op.fixed_args[1], op.fixed_args[2])) else: raise ValueError(msg) if op.base_op == operation.Concat: assert len(input_diff) == 1 d1 = input_diff[0] if op.fixed_args[0] is not None: val = op.fixed_args[0] input_diff = [cls.from_pair(val, val), d1] else: val = op.fixed_args[1] input_diff = [d1, cls.from_pair(val, val)] return cls(op.base_op(*[d.val for d in input_diff])) if op.base_op == operation.BvAdd: assert len(input_diff) == 1 d = input_diff[0] cte = op.fixed_args[0] if op.fixed_args[0] is not None else op.fixed_args[1] from arxpy.differential import derivative return derivative.XDCA(d, cte) else: raise ValueError(msg) if hasattr(op, "xor_derivative"): return op.xor_derivative(input_diff) raise ValueError(msg) class RXOp(operation.Operation): """The difference operation of `RXDiff`.""" arity = [2, 0] is_symmetric = False is_simple = True @classmethod def condition(cls, x, y): return x.width == y.width @classmethod def output_width(cls, x, y): return x.width @classmethod def eval(cls, x, y): return operation.RotateLeft(x, 1) ^ y class RXInvOp(operation.Operation): """The inverse of the difference operation of `RXDiff`.""" arity = [2, 0] is_symmetric = False is_simple = True @classmethod def condition(cls, x, d): return x.width == d.width @classmethod def output_width(cls, x, d): return x.width @classmethod def eval(cls, x, d): return operation.RotateLeft(x, 1) ^ d class RXDiff(Difference): """Represent rotational-XOR (RX) differences. The pair ``(x, (x <<< 1) ^ d)`` has RX difference ``d``. In other words, the RX difference of two `Term` ``x`` and ``y`` is defined as ``(x <<< 1) ^ y``. See `Difference` for more information. >>> from arxpy.bitvector.core import Constant, Variable >>> from arxpy.differential.difference import RXDiff >>> x, y = Constant(0b000, 3), Constant(0b000, 3) >>> alpha = RXDiff.from_pair(x, y) >>> alpha RXDiff(0b000) >>> alpha.get_pair_element(x) 0b000 >>> x, y = Constant(0b000, 3), Constant(0b001, 3) >>> alpha = RXDiff.from_pair(x, y) >>> alpha RXDiff(0b001) >>> alpha.get_pair_element(x) 0b001 >>> k = Variable("k", 8) >>> alpha = RXDiff.from_pair(k, k) >>> alpha RXDiff(k ^ (k <<< 1)) >>> alpha.get_pair_element(k) k """ diff_op = RXOp inv_diff_op = RXInvOp @classmethod def derivative(cls, op, input_diff): """Return the derivative of ``op`` at the point ``input_diff``. See `Difference.derivative` for more information. >>> from arxpy.bitvector.core import Variable, Constant >>> from arxpy.bitvector.operation import BvAdd, BvXor, RotateLeft >>> from arxpy.bitvector.extraop import make_partial_operation >>> from arxpy.differential.difference import RXDiff >>> d1, d2 = RXDiff(Variable("d1", 8)), RXDiff(Variable("d2", 8)) >>> RXDiff.derivative(BvXor, [d1, d2]) RXDiff(d1 ^ d2) >>> Xor1 = make_partial_operation(BvXor, tuple([None, Constant(1, 8)])) >>> RXDiff.derivative(Xor1, d1) RXDiff(0x03 ^ d1) >>> Rotate1 = make_partial_operation(RotateLeft, tuple([None, 1])) >>> RXDiff.derivative(Rotate1, d1) RXDiff(d1 <<< 1) >>> RXDiff.derivative(BvAdd, [d1, d2]) RXDA(RXDiff(d1), RXDiff(d2)) """ input_diff = _tuplify(input_diff) assert len(input_diff) == sum(op.arity) msg = "invalid arguments: op={}, input_diff={}".format( op.__name__, [d.vrepr() if isinstance(d, core.Term) else d for d in input_diff]) if not all(isinstance(diff, cls) for diff in input_diff): raise ValueError(msg) if op == operation.BvNot: return input_diff[0] if op == operation.BvXor: return cls(op(*[d.val for d in input_diff])) if op == operation.BvAdd: from arxpy.differential import derivative return derivative.RXDA(input_diff) # Concact, BvSub if issubclass(op, extraop.PartialOperation): if op.base_op == operation.BvXor: assert len(input_diff) == 1 d1 = input_diff[0] val = op.fixed_args[0] if op.fixed_args[0] is not None else op.fixed_args[1] d2 = cls.from_pair(val, val) input_diff = [d1, d2] return cls(op.base_op(*[d.val for d in input_diff])) if op.base_op in [operation.RotateLeft, operation.RotateRight]: if op.fixed_args[0] is None and op.fixed_args[1] is not None: assert len(input_diff) == 1 d = input_diff[0] return cls(op.base_op(d.val, op.fixed_args[1])) else: raise ValueError(msg) # BvShl, Extract if hasattr(op, "rx_derivative"): return op.rx_derivative(input_diff) raise ValueError(msg)
[ 1, 9995, 2517, 666, 5987, 12651, 1213, 15945, 13, 5215, 16250, 13, 13, 3166, 564, 29916, 2272, 29889, 2966, 8111, 1053, 7136, 13, 3166, 564, 29916, 2272, 29889, 2966, 8111, 1053, 5858, 13, 3166, 564, 29916, 2272, 29889, 2966, 8111, 1053, 4805, 459, 13, 13, 13, 1753, 903, 9161, 572, 1598, 29898, 11762, 1125, 13, 1678, 565, 338, 8758, 29898, 11762, 29892, 16250, 29889, 10736, 29889, 20529, 1125, 13, 4706, 736, 18761, 29898, 11762, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 18761, 4197, 11762, 2314, 13, 13, 13, 1990, 360, 17678, 29898, 3318, 1125, 13, 1678, 9995, 1123, 6338, 12651, 29889, 13, 13, 1678, 450, 334, 29881, 17678, 29930, 1546, 1023, 421, 14343, 29952, 584, 755, 18078, 29916, 29952, 322, 584, 755, 18078, 29891, 29952, 13, 1678, 338, 3342, 408, 584, 755, 18078, 1966, 2312, 353, 343, 448, 921, 1673, 13, 1678, 988, 278, 334, 29881, 17678, 5858, 29930, 584, 755, 18078, 29899, 29952, 13, 1678, 338, 263, 2586, 29899, 8111, 421, 10925, 1412, 512, 916, 3838, 29892, 278, 5101, 13, 1678, 584, 755, 18078, 29898, 29916, 29892, 921, 718, 2474, 2312, 3569, 756, 4328, 584, 755, 18078, 1966, 2312, 1673, 13, 1678, 988, 584, 755, 18078, 29974, 29952, 338, 278, 16402, 310, 278, 4328, 5858, 29889, 13, 13, 1678, 450, 1556, 3619, 4328, 1304, 297, 16712, 24941, 15916, 13, 1678, 338, 278, 1060, 1955, 4328, 421, 29990, 272, 26023, 29952, 313, 3062, 278, 4328, 5858, 13, 1678, 338, 421, 29933, 29894, 29990, 272, 12913, 5901, 6455, 526, 278, 788, 3321, 4328, 13, 1678, 313, 3062, 278, 4328, 5858, 338, 421, 29933, 29894, 4035, 6348, 470, 278, 5731, 1288, 29899, 29990, 1955, 13, 1678, 4328, 421, 29934, 29990, 26023, 1412, 13, 13, 1678, 3940, 393, 23342, 411, 12651, 338, 451, 6969, 29889, 13, 1678, 1152, 1342, 29892, 1023, 421, 29928, 17678, 29952, 3618, 4954, 29881, 29896, 16159, 322, 4954, 29881, 29906, 16159, 13, 1678, 2609, 367, 1060, 1955, 287, 29892, 474, 29889, 29872, 1696, 4954, 29881, 29896, 6228, 270, 29906, 29952, 1412, 13, 1678, 910, 508, 367, 2309, 2012, 491, 15859, 278, 23342, 411, 13, 1678, 278, 4328, 1819, 322, 17415, 278, 9819, 13, 1678, 421, 14343, 29952, 304, 263, 4328, 29892, 393, 338, 29892, 4954, 29928, 17678, 29898, 29881, 29896, 29889, 791, 6228, 270, 29906, 29889, 791, 3569, 29952, 13, 13, 1678, 910, 770, 338, 451, 6839, 304, 367, 13213, 630, 541, 304, 3867, 263, 2967, 13, 1678, 770, 363, 278, 1422, 4072, 310, 12651, 29889, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 659, 29901, 263, 421, 14343, 29952, 15783, 278, 995, 310, 278, 4328, 29889, 13, 4706, 2923, 29918, 459, 29901, 278, 4328, 421, 10925, 1412, 13, 4706, 2437, 29918, 12765, 29918, 459, 29901, 278, 16402, 310, 278, 4328, 5858, 29889, 13, 13, 1678, 9995, 13, 1678, 2923, 29918, 459, 353, 6213, 13, 1678, 2437, 29918, 12765, 29918, 459, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 995, 1125, 13, 4706, 4974, 338, 8758, 29898, 1767, 29892, 7136, 29889, 14343, 29897, 13, 4706, 1583, 29889, 791, 353, 995, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 9995, 11609, 278, 1661, 29899, 369, 15828, 1347, 8954, 1213, 15945, 13, 4706, 736, 29850, 2119, 29912, 1800, 1642, 4830, 29898, 1853, 29898, 1311, 467, 1649, 978, 1649, 29892, 851, 29898, 1311, 29889, 791, 876, 13, 13, 1678, 4770, 276, 558, 1649, 353, 4770, 710, 1649, 13, 13, 1678, 822, 4770, 8568, 12035, 1311, 1125, 13, 4706, 736, 6608, 29898, 1311, 29889, 791, 29897, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 565, 338, 8758, 29898, 1228, 29892, 1134, 29898, 1311, 22164, 13, 9651, 736, 1583, 29889, 791, 1275, 916, 29889, 791, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 822, 921, 6506, 29898, 1311, 29892, 5751, 1125, 13, 4706, 9995, 20083, 13920, 2063, 310, 12651, 2629, 278, 4603, 29889, 13, 13, 4706, 450, 2980, 4954, 7491, 16159, 338, 263, 9657, 29899, 4561, 1203, 15783, 13, 4706, 278, 16920, 5751, 29889, 13, 13, 4706, 910, 1158, 338, 2788, 304, 10667, 19737, 421, 29916, 6506, 13, 4706, 529, 991, 597, 2640, 29889, 11967, 2272, 29889, 990, 29914, 12333, 29914, 7576, 29914, 3221, 29889, 1420, 29973, 28970, 29922, 29916, 6506, 29937, 13, 4706, 5016, 2272, 29889, 3221, 29889, 16121, 29889, 16616, 29889, 29916, 6506, 13885, 29918, 541, 411, 278, 24345, 393, 13, 4706, 871, 12651, 3618, 526, 6068, 297, 4954, 7491, 29952, 1412, 13, 4706, 9995, 13, 4706, 363, 270, 297, 5751, 29901, 13, 9651, 4974, 338, 8758, 29898, 29881, 29892, 1134, 29898, 1311, 876, 322, 338, 8758, 29898, 7491, 29961, 29881, 1402, 1134, 29898, 1311, 876, 13, 13, 4706, 5751, 353, 426, 29881, 29889, 791, 29901, 5751, 29961, 29881, 1822, 791, 363, 270, 297, 5751, 29913, 13, 4706, 736, 1134, 29898, 1311, 5033, 1311, 29889, 791, 29889, 29916, 6506, 29898, 7491, 876, 13, 13, 1678, 822, 325, 276, 558, 29898, 1311, 1125, 13, 4706, 9995, 11609, 263, 26952, 1347, 8954, 1213, 15945, 13, 4706, 736, 29850, 2119, 29912, 1800, 1642, 4830, 29898, 1853, 29898, 1311, 467, 1649, 978, 1649, 29892, 1583, 29889, 791, 29889, 12675, 558, 3101, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 18784, 29898, 25932, 29892, 921, 29892, 343, 1125, 13, 4706, 9995, 11609, 278, 421, 29928, 17678, 29952, 584, 755, 18078, 1966, 2312, 353, 343, 448, 921, 29952, 2183, 1023, 421, 14343, 29952, 1213, 15945, 13, 4706, 4974, 338, 8758, 29898, 29916, 29892, 7136, 29889, 14343, 29897, 13, 4706, 4974, 338, 8758, 29898, 29891, 29892, 7136, 29889, 14343, 29897, 13, 4706, 736, 1067, 29879, 29898, 25932, 29889, 12765, 29918, 459, 29898, 29916, 29892, 343, 876, 29871, 396, 450, 1797, 310, 278, 1751, 4167, 338, 4100, 13, 13, 1678, 822, 679, 29918, 18784, 29918, 5029, 29898, 1311, 29892, 921, 1125, 13, 4706, 9995, 11609, 278, 421, 14343, 29952, 584, 755, 18078, 29891, 29952, 1316, 393, 584, 755, 18078, 29891, 353, 2474, 2312, 718, 921, 29952, 1213, 15945, 13, 4706, 4974, 338, 8758, 29898, 29916, 29892, 7136, 29889, 14343, 29897, 13, 4706, 736, 1583, 29889, 11569, 29918, 12765, 29918, 459, 29898, 29916, 29892, 1583, 29889, 791, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 16291, 29898, 25932, 29892, 1015, 29892, 1881, 29918, 12765, 1125, 13, 4706, 9995, 11609, 278, 16291, 310, 4954, 459, 16159, 472, 278, 1298, 4954, 2080, 29918, 12765, 29952, 1412, 13, 13, 4706, 450, 16291, 310, 385, 421, 10925, 29952, 584, 755, 18078, 29888, 29952, 13, 4706, 472, 278, 1298, 584, 755, 18078, 1966, 2312, 29952, 313, 15189, 2000, 278, 1881, 4328, 29897, 13, 4706, 338, 3342, 408, 584, 755, 18078, 29888, 1665, 29905, 2312, 29913, 313, 29916, 29897, 353, 285, 29898, 29916, 718, 2474, 2312, 29897, 448, 285, 29898, 29916, 14466, 13, 4706, 3940, 393, 584, 755, 18078, 29888, 1665, 29905, 2312, 29913, 313, 29916, 3569, 338, 278, 4328, 310, 13, 4706, 584, 755, 18078, 29898, 29888, 29898, 29916, 511, 285, 29898, 29916, 718, 2474, 2312, 876, 1412, 13, 13, 4706, 960, 584, 755, 18078, 29888, 29952, 756, 2999, 1751, 4167, 29892, 584, 755, 18078, 1966, 2312, 29952, 338, 263, 1051, 13, 4706, 6943, 278, 421, 29928, 17678, 29952, 310, 1269, 1751, 392, 322, 278, 13, 4706, 16287, 584, 755, 18078, 29916, 718, 2474, 2312, 29952, 338, 3342, 4163, 29899, 3538, 29892, 393, 338, 29892, 13, 4706, 584, 755, 18078, 29916, 353, 313, 29916, 29918, 29896, 29892, 320, 7778, 29892, 921, 29918, 29876, 20362, 584, 755, 18078, 1966, 2312, 353, 313, 1966, 2312, 29918, 29896, 29892, 320, 7778, 29892, 2474, 2312, 29918, 29876, 20362, 13, 4706, 322, 584, 755, 18078, 29916, 718, 2474, 2312, 353, 313, 29916, 29918, 29896, 718, 2474, 2312, 29918, 29896, 29892, 320, 7778, 29892, 921, 29918, 29876, 718, 2474, 2312, 29918, 29876, 14466, 13, 13, 4706, 1152, 777, 6931, 29892, 727, 338, 263, 5412, 1962, 4328, 584, 755, 18078, 1966, 3571, 29952, 13, 4706, 363, 1432, 1881, 4328, 584, 755, 18078, 1966, 2312, 1673, 393, 338, 29892, 584, 755, 18078, 29888, 1665, 29905, 2312, 2119, 29916, 29897, 353, 2474, 3571, 29952, 13, 4706, 338, 263, 4868, 740, 29889, 512, 445, 1206, 29892, 445, 1158, 3639, 278, 421, 29928, 17678, 29952, 13, 4706, 584, 755, 18078, 1966, 3571, 1412, 13466, 29892, 372, 3639, 263, 421, 15383, 440, 1230, 29952, 1203, 15783, 13, 4706, 584, 755, 18078, 29888, 1665, 29905, 2312, 29913, 1412, 13, 13, 4706, 6607, 800, 411, 17336, 1751, 4167, 526, 451, 6969, 29892, 541, 1438, 13, 4706, 1751, 4167, 508, 367, 6206, 411, 421, 5675, 29918, 3846, 29918, 16453, 29952, 322, 13, 4706, 278, 16291, 310, 278, 9819, 5455, 508, 769, 367, 15712, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1015, 29901, 29871, 263, 2586, 29899, 8111, 5455, 13, 9651, 1881, 29918, 12765, 29901, 263, 1051, 6943, 278, 4328, 310, 1269, 1751, 392, 13, 4706, 9995, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 703, 1491, 13203, 817, 304, 5712, 445, 1158, 1159, 13, 13, 13, 1990, 1060, 272, 26023, 29898, 29928, 17678, 1125, 13, 1678, 9995, 1123, 6338, 1060, 1955, 12651, 29889, 13, 13, 1678, 450, 1060, 1955, 4328, 310, 1023, 421, 14343, 29952, 338, 2183, 491, 278, 1060, 1955, 13, 1678, 310, 278, 4958, 29889, 512, 916, 3838, 29892, 278, 334, 29881, 17678, 5858, 29930, 13, 1678, 310, 421, 29990, 272, 26023, 29952, 338, 278, 421, 29933, 29894, 29990, 272, 29952, 313, 4149, 421, 29928, 17678, 12913, 13, 13, 4706, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 3221, 1053, 28601, 29892, 28736, 13, 4706, 8653, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 29889, 29881, 17678, 1053, 1060, 272, 26023, 13, 4706, 8653, 921, 29892, 343, 353, 28601, 29898, 29900, 29890, 29900, 29900, 29900, 29892, 29871, 29941, 511, 28601, 29898, 29900, 29890, 29900, 29900, 29900, 29892, 29871, 29941, 29897, 13, 4706, 8653, 15595, 353, 1060, 272, 26023, 29889, 3166, 29918, 18784, 29898, 29916, 29892, 343, 29897, 13, 4706, 8653, 15595, 13, 4706, 1060, 272, 26023, 29898, 29900, 29890, 29900, 29900, 29900, 29897, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29916, 29897, 13, 308, 29900, 29890, 29900, 29900, 29900, 13, 4706, 8653, 921, 29892, 343, 353, 28601, 29898, 29900, 29890, 29900, 29896, 29900, 29892, 29871, 29941, 511, 28601, 29898, 29900, 29890, 29896, 29900, 29896, 29892, 29871, 29941, 29897, 13, 4706, 8653, 15595, 353, 1060, 272, 26023, 29889, 3166, 29918, 18784, 29898, 29916, 29892, 343, 29897, 13, 4706, 8653, 15595, 13, 4706, 1060, 272, 26023, 29898, 29900, 29890, 29896, 29896, 29896, 29897, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29916, 29897, 13, 308, 29900, 29890, 29896, 29900, 29896, 13, 4706, 8653, 413, 353, 28736, 703, 29895, 613, 29871, 29947, 29897, 13, 4706, 8653, 15595, 353, 1060, 272, 26023, 29889, 3166, 29918, 18784, 29898, 29895, 29892, 413, 29897, 13, 4706, 8653, 15595, 13, 4706, 1060, 272, 26023, 29898, 29900, 29916, 29900, 29900, 29897, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29895, 29897, 13, 4706, 413, 13, 1678, 9995, 13, 13, 1678, 2923, 29918, 459, 353, 5858, 29889, 29933, 29894, 29990, 272, 13, 1678, 2437, 29918, 12765, 29918, 459, 353, 5858, 29889, 29933, 29894, 29990, 272, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 16291, 29898, 25932, 29892, 1015, 29892, 1881, 29918, 12765, 1125, 13, 4706, 9995, 11609, 278, 16291, 310, 4954, 459, 16159, 472, 278, 1298, 4954, 2080, 29918, 12765, 29952, 1412, 13, 13, 4706, 2823, 421, 29928, 17678, 29889, 672, 440, 1230, 29952, 363, 901, 2472, 29889, 13, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 3221, 1053, 28736, 29892, 28601, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 16453, 1053, 350, 29894, 2528, 29892, 350, 29894, 29990, 272, 29892, 9664, 403, 8091, 29892, 350, 29894, 4035, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 17833, 459, 1053, 1207, 29918, 3846, 29918, 16453, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 29889, 29881, 17678, 1053, 1060, 272, 26023, 13, 9651, 8653, 270, 29896, 29892, 270, 29906, 353, 1060, 272, 26023, 29898, 16174, 703, 29881, 29896, 613, 29871, 29947, 8243, 1060, 272, 26023, 29898, 16174, 703, 29881, 29906, 613, 29871, 29947, 876, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 29933, 29894, 29990, 272, 29892, 518, 29881, 29896, 29892, 270, 29906, 2314, 13, 9651, 1060, 272, 26023, 29898, 29881, 29896, 6228, 270, 29906, 29897, 13, 9651, 8653, 1060, 272, 29896, 353, 1207, 29918, 3846, 29918, 16453, 29898, 29933, 29894, 29990, 272, 29892, 18761, 4197, 8516, 29892, 28601, 29898, 29896, 29892, 29871, 29947, 4638, 876, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 29990, 272, 29896, 29892, 270, 29896, 29897, 13, 9651, 1060, 272, 26023, 29898, 29881, 29896, 29897, 13, 9651, 8653, 9664, 403, 29896, 353, 1207, 29918, 3846, 29918, 16453, 29898, 21281, 403, 8091, 29892, 18761, 4197, 8516, 29892, 29871, 29896, 12622, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 21281, 403, 29896, 29892, 270, 29896, 29897, 13, 9651, 1060, 272, 26023, 29898, 29881, 29896, 3532, 29966, 29871, 29896, 29897, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 29933, 29894, 2528, 29892, 518, 29881, 29896, 29892, 270, 29906, 2314, 13, 9651, 1060, 7698, 29898, 29990, 272, 26023, 29898, 29881, 29896, 511, 1060, 272, 26023, 29898, 29881, 29906, 876, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 29933, 29894, 4035, 29892, 518, 29881, 29896, 29892, 270, 29906, 2314, 13, 9651, 1060, 8452, 29898, 29990, 272, 26023, 29898, 29881, 29896, 511, 1060, 272, 26023, 29898, 29881, 29906, 876, 13, 9651, 8653, 315, 371, 2528, 29896, 353, 1207, 29918, 3846, 29918, 16453, 29898, 29933, 29894, 2528, 29892, 18761, 4197, 8516, 29892, 28601, 29898, 29896, 29892, 29871, 29947, 4638, 876, 13, 9651, 8653, 1060, 272, 26023, 29889, 672, 440, 1230, 29898, 29907, 371, 2528, 29896, 29892, 270, 29896, 29897, 13, 9651, 1060, 29928, 5454, 29918, 29900, 29916, 29900, 29896, 29898, 29990, 272, 26023, 29898, 29881, 29896, 876, 13, 13, 4706, 9995, 13, 4706, 1881, 29918, 12765, 353, 903, 9161, 572, 1598, 29898, 2080, 29918, 12765, 29897, 13, 4706, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 2533, 29898, 459, 29889, 279, 537, 29897, 13, 13, 4706, 10191, 353, 376, 20965, 6273, 29901, 1015, 3790, 1118, 1881, 29918, 12765, 3790, 29913, 1642, 4830, 29898, 13, 9651, 1015, 17255, 978, 1649, 29892, 13, 9651, 518, 29881, 29889, 12675, 558, 580, 565, 338, 8758, 29898, 29881, 29892, 7136, 29889, 14343, 29897, 1683, 270, 363, 270, 297, 1881, 29918, 12765, 2314, 13, 13, 4706, 565, 451, 599, 29898, 275, 8758, 29898, 12765, 29892, 1067, 29879, 29897, 363, 2923, 297, 1881, 29918, 12765, 1125, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 3664, 29901, 13, 9651, 736, 1881, 29918, 12765, 29961, 29900, 29962, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 29990, 272, 29901, 13, 9651, 736, 1067, 29879, 29898, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 1168, 4117, 29901, 13, 9651, 736, 1067, 29879, 29898, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 2528, 29901, 13, 9651, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 1053, 16291, 13, 9651, 736, 16291, 29889, 29990, 7698, 29898, 2080, 29918, 12765, 29897, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 4035, 29901, 13, 9651, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 1053, 16291, 13, 9651, 736, 16291, 29889, 29990, 8452, 29898, 2080, 29918, 12765, 29897, 13, 13, 4706, 565, 338, 1491, 1990, 29898, 459, 29892, 4805, 459, 29889, 7439, 616, 10925, 1125, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 29933, 29894, 29990, 272, 29901, 13, 18884, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 18884, 270, 29896, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 18884, 659, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 451, 6213, 1683, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 13, 18884, 270, 29906, 353, 1067, 29879, 29889, 3166, 29918, 18784, 29898, 791, 29892, 659, 29897, 13, 18884, 1881, 29918, 12765, 353, 518, 29881, 29896, 29892, 270, 29906, 29962, 13, 18884, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 29933, 29894, 2855, 29901, 13, 18884, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 18884, 270, 29896, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 18884, 659, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 451, 6213, 1683, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 13, 18884, 565, 338, 8758, 29898, 791, 29892, 7136, 29889, 12075, 424, 1125, 13, 462, 1678, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 29898, 29881, 29896, 29889, 791, 29892, 659, 876, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 297, 518, 16453, 29889, 21281, 403, 8091, 29892, 5858, 29889, 21281, 403, 7341, 5387, 13, 18884, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 6213, 322, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 462, 1678, 270, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 462, 1678, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 29898, 29881, 29889, 791, 29892, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 12622, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 297, 518, 16453, 29889, 29933, 29894, 2713, 29880, 29892, 5858, 29889, 29933, 29894, 29931, 845, 29878, 5387, 13, 18884, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 6213, 322, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 462, 1678, 270, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 462, 1678, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 29898, 29881, 29889, 791, 29892, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 12622, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 5647, 1461, 29901, 13, 18884, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 6213, 322, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 338, 451, 6213, 322, 1015, 29889, 20227, 29918, 5085, 29961, 29906, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 462, 1678, 270, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 462, 1678, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 29898, 29881, 29889, 791, 29892, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 1402, 1015, 29889, 20227, 29918, 5085, 29961, 29906, 12622, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 1168, 4117, 29901, 13, 18884, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 18884, 270, 29896, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 18884, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 659, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 13, 462, 1678, 1881, 29918, 12765, 353, 518, 25932, 29889, 3166, 29918, 18784, 29898, 791, 29892, 659, 511, 270, 29896, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 659, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 13, 462, 1678, 1881, 29918, 12765, 353, 518, 29881, 29896, 29892, 1067, 29879, 29889, 3166, 29918, 18784, 29898, 791, 29892, 659, 4638, 13, 18884, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 29933, 29894, 2528, 29901, 13, 18884, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 18884, 270, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 18884, 274, 371, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 451, 6213, 1683, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 13, 18884, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 1053, 16291, 13, 18884, 736, 16291, 29889, 29990, 29928, 5454, 29898, 29881, 29892, 274, 371, 29897, 13, 9651, 1683, 29901, 13, 18884, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 4706, 565, 756, 5552, 29898, 459, 29892, 376, 29916, 272, 29918, 672, 440, 1230, 29908, 1125, 13, 9651, 736, 1015, 29889, 29916, 272, 29918, 672, 440, 1230, 29898, 2080, 29918, 12765, 29897, 13, 13, 4706, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 13, 1990, 390, 29990, 11746, 29898, 16453, 29889, 10925, 1125, 13, 1678, 9995, 1576, 4328, 5858, 310, 421, 29934, 29990, 26023, 29952, 1213, 15945, 13, 13, 1678, 564, 537, 353, 518, 29906, 29892, 29871, 29900, 29962, 13, 1678, 338, 29918, 11967, 16414, 353, 7700, 13, 1678, 338, 29918, 12857, 353, 5852, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4195, 29898, 25932, 29892, 921, 29892, 343, 1125, 13, 4706, 736, 921, 29889, 2103, 1275, 343, 29889, 2103, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1962, 29918, 2103, 29898, 25932, 29892, 921, 29892, 343, 1125, 13, 4706, 736, 921, 29889, 2103, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 19745, 29898, 25932, 29892, 921, 29892, 343, 1125, 13, 4706, 736, 5858, 29889, 21281, 403, 8091, 29898, 29916, 29892, 29871, 29896, 29897, 6228, 343, 13, 13, 13, 1990, 390, 29990, 12165, 11746, 29898, 16453, 29889, 10925, 1125, 13, 1678, 9995, 1576, 16402, 310, 278, 29871, 4328, 5858, 310, 421, 29934, 29990, 26023, 29952, 1213, 15945, 13, 13, 1678, 564, 537, 353, 518, 29906, 29892, 29871, 29900, 29962, 13, 1678, 338, 29918, 11967, 16414, 353, 7700, 13, 1678, 338, 29918, 12857, 353, 5852, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4195, 29898, 25932, 29892, 921, 29892, 270, 1125, 13, 4706, 736, 921, 29889, 2103, 1275, 270, 29889, 2103, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1962, 29918, 2103, 29898, 25932, 29892, 921, 29892, 270, 1125, 13, 4706, 736, 921, 29889, 2103, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 19745, 29898, 25932, 29892, 921, 29892, 270, 1125, 13, 4706, 736, 5858, 29889, 21281, 403, 8091, 29898, 29916, 29892, 29871, 29896, 29897, 6228, 270, 13, 13, 13, 1990, 390, 29990, 26023, 29898, 29928, 17678, 1125, 13, 1678, 9995, 1123, 6338, 5731, 1288, 29899, 29990, 1955, 313, 29934, 29990, 29897, 12651, 29889, 13, 13, 1678, 450, 5101, 4954, 29898, 29916, 29892, 313, 29916, 3532, 29966, 29871, 29896, 29897, 6228, 270, 3569, 29952, 756, 390, 29990, 4328, 4954, 29881, 29952, 1412, 13, 1678, 512, 916, 3838, 29892, 29871, 278, 390, 29990, 4328, 310, 1023, 421, 14343, 29952, 4954, 29916, 16159, 322, 4954, 29891, 16159, 13, 1678, 338, 3342, 408, 4954, 29898, 29916, 3532, 29966, 29871, 29896, 29897, 6228, 343, 29952, 1412, 13, 13, 1678, 2823, 421, 29928, 17678, 29952, 363, 901, 2472, 29889, 13, 13, 4706, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 3221, 1053, 28601, 29892, 28736, 13, 4706, 8653, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 29889, 29881, 17678, 1053, 390, 29990, 26023, 13, 4706, 8653, 921, 29892, 343, 353, 28601, 29898, 29900, 29890, 29900, 29900, 29900, 29892, 29871, 29941, 511, 28601, 29898, 29900, 29890, 29900, 29900, 29900, 29892, 29871, 29941, 29897, 13, 4706, 8653, 15595, 353, 390, 29990, 26023, 29889, 3166, 29918, 18784, 29898, 29916, 29892, 343, 29897, 13, 4706, 8653, 15595, 13, 4706, 390, 29990, 26023, 29898, 29900, 29890, 29900, 29900, 29900, 29897, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29916, 29897, 13, 308, 29900, 29890, 29900, 29900, 29900, 13, 4706, 8653, 921, 29892, 343, 353, 28601, 29898, 29900, 29890, 29900, 29900, 29900, 29892, 29871, 29941, 511, 28601, 29898, 29900, 29890, 29900, 29900, 29896, 29892, 29871, 29941, 29897, 13, 4706, 8653, 15595, 353, 390, 29990, 26023, 29889, 3166, 29918, 18784, 29898, 29916, 29892, 343, 29897, 13, 4706, 8653, 15595, 13, 4706, 390, 29990, 26023, 29898, 29900, 29890, 29900, 29900, 29896, 29897, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29916, 29897, 13, 308, 29900, 29890, 29900, 29900, 29896, 13, 4706, 8653, 413, 353, 28736, 703, 29895, 613, 29871, 29947, 29897, 13, 4706, 8653, 15595, 353, 390, 29990, 26023, 29889, 3166, 29918, 18784, 29898, 29895, 29892, 413, 29897, 13, 4706, 8653, 15595, 13, 4706, 390, 29990, 26023, 29898, 29895, 6228, 313, 29895, 3532, 29966, 29871, 29896, 876, 13, 4706, 8653, 15595, 29889, 657, 29918, 18784, 29918, 5029, 29898, 29895, 29897, 13, 4706, 413, 13, 1678, 9995, 13, 13, 1678, 2923, 29918, 459, 353, 390, 29990, 11746, 13, 1678, 2437, 29918, 12765, 29918, 459, 353, 390, 29990, 12165, 11746, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 16291, 29898, 25932, 29892, 1015, 29892, 1881, 29918, 12765, 1125, 13, 4706, 9995, 11609, 278, 16291, 310, 4954, 459, 16159, 472, 278, 1298, 4954, 2080, 29918, 12765, 29952, 1412, 13, 13, 4706, 2823, 421, 29928, 17678, 29889, 672, 440, 1230, 29952, 363, 901, 2472, 29889, 13, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 3221, 1053, 28736, 29892, 28601, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 16453, 1053, 350, 29894, 2528, 29892, 350, 29894, 29990, 272, 29892, 9664, 403, 8091, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 2966, 8111, 29889, 17833, 459, 1053, 1207, 29918, 3846, 29918, 16453, 13, 9651, 8653, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 29889, 29881, 17678, 1053, 390, 29990, 26023, 13, 9651, 8653, 270, 29896, 29892, 270, 29906, 353, 390, 29990, 26023, 29898, 16174, 703, 29881, 29896, 613, 29871, 29947, 8243, 390, 29990, 26023, 29898, 16174, 703, 29881, 29906, 613, 29871, 29947, 876, 13, 9651, 8653, 390, 29990, 26023, 29889, 672, 440, 1230, 29898, 29933, 29894, 29990, 272, 29892, 518, 29881, 29896, 29892, 270, 29906, 2314, 13, 9651, 390, 29990, 26023, 29898, 29881, 29896, 6228, 270, 29906, 29897, 13, 9651, 8653, 1060, 272, 29896, 353, 1207, 29918, 3846, 29918, 16453, 29898, 29933, 29894, 29990, 272, 29892, 18761, 4197, 8516, 29892, 28601, 29898, 29896, 29892, 29871, 29947, 4638, 876, 13, 9651, 8653, 390, 29990, 26023, 29889, 672, 440, 1230, 29898, 29990, 272, 29896, 29892, 270, 29896, 29897, 13, 9651, 390, 29990, 26023, 29898, 29900, 29916, 29900, 29941, 6228, 270, 29896, 29897, 13, 9651, 8653, 9664, 403, 29896, 353, 1207, 29918, 3846, 29918, 16453, 29898, 21281, 403, 8091, 29892, 18761, 4197, 8516, 29892, 29871, 29896, 12622, 13, 9651, 8653, 390, 29990, 26023, 29889, 672, 440, 1230, 29898, 21281, 403, 29896, 29892, 270, 29896, 29897, 13, 9651, 390, 29990, 26023, 29898, 29881, 29896, 3532, 29966, 29871, 29896, 29897, 13, 9651, 8653, 390, 29990, 26023, 29889, 672, 440, 1230, 29898, 29933, 29894, 2528, 29892, 518, 29881, 29896, 29892, 270, 29906, 2314, 13, 9651, 390, 29990, 7698, 29898, 29934, 29990, 26023, 29898, 29881, 29896, 511, 390, 29990, 26023, 29898, 29881, 29906, 876, 13, 13, 4706, 9995, 13, 4706, 1881, 29918, 12765, 353, 903, 9161, 572, 1598, 29898, 2080, 29918, 12765, 29897, 13, 4706, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 2533, 29898, 459, 29889, 279, 537, 29897, 13, 13, 4706, 10191, 353, 376, 20965, 6273, 29901, 1015, 3790, 1118, 1881, 29918, 12765, 3790, 29913, 1642, 4830, 29898, 13, 9651, 1015, 17255, 978, 1649, 29892, 13, 9651, 518, 29881, 29889, 12675, 558, 580, 565, 338, 8758, 29898, 29881, 29892, 7136, 29889, 14343, 29897, 1683, 270, 363, 270, 297, 1881, 29918, 12765, 2314, 13, 13, 4706, 565, 451, 599, 29898, 275, 8758, 29898, 12765, 29892, 1067, 29879, 29897, 363, 2923, 297, 1881, 29918, 12765, 1125, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 3664, 29901, 13, 9651, 736, 1881, 29918, 12765, 29961, 29900, 29962, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 29990, 272, 29901, 13, 9651, 736, 1067, 29879, 29898, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 4706, 565, 1015, 1275, 5858, 29889, 29933, 29894, 2528, 29901, 13, 9651, 515, 564, 29916, 2272, 29889, 29881, 8349, 2556, 1053, 16291, 13, 9651, 736, 16291, 29889, 29934, 29990, 7698, 29898, 2080, 29918, 12765, 29897, 13, 13, 4706, 396, 23924, 627, 29892, 350, 29894, 4035, 13, 13, 4706, 565, 338, 1491, 1990, 29898, 459, 29892, 4805, 459, 29889, 7439, 616, 10925, 1125, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 1275, 5858, 29889, 29933, 29894, 29990, 272, 29901, 13, 18884, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 18884, 270, 29896, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 18884, 659, 353, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 451, 6213, 1683, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 13, 18884, 270, 29906, 353, 1067, 29879, 29889, 3166, 29918, 18784, 29898, 791, 29892, 659, 29897, 13, 18884, 1881, 29918, 12765, 353, 518, 29881, 29896, 29892, 270, 29906, 29962, 13, 18884, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 10456, 29961, 29881, 29889, 791, 363, 270, 297, 1881, 29918, 12765, 12622, 13, 13, 9651, 565, 1015, 29889, 3188, 29918, 459, 297, 518, 16453, 29889, 21281, 403, 8091, 29892, 5858, 29889, 21281, 403, 7341, 5387, 13, 18884, 565, 1015, 29889, 20227, 29918, 5085, 29961, 29900, 29962, 338, 6213, 322, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 29962, 338, 451, 6213, 29901, 13, 462, 1678, 4974, 7431, 29898, 2080, 29918, 12765, 29897, 1275, 29871, 29896, 13, 462, 1678, 270, 353, 1881, 29918, 12765, 29961, 29900, 29962, 13, 462, 1678, 736, 1067, 29879, 29898, 459, 29889, 3188, 29918, 459, 29898, 29881, 29889, 791, 29892, 1015, 29889, 20227, 29918, 5085, 29961, 29896, 12622, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 9651, 396, 350, 29894, 2713, 29880, 29892, 7338, 1461, 13, 13, 4706, 565, 756, 5552, 29898, 459, 29892, 376, 17697, 29918, 672, 440, 1230, 29908, 1125, 13, 9651, 736, 1015, 29889, 17697, 29918, 672, 440, 1230, 29898, 2080, 29918, 12765, 29897, 13, 13, 4706, 12020, 7865, 2392, 29898, 7645, 29897, 13, 13, 2 ]
research/object_detection/kshitij_inference.py
nikhalster/models
0
140830
<filename>research/object_detection/kshitij_inference.py import pathlib import cv2 import numpy as np import os import six.moves.urllib as urllib import sys import tarfile import tensorflow as tf import zipfile from collections import defaultdict from io import StringIO from matplotlib import pyplot as plt from PIL import Image from utils import ops as utils_ops from utils import label_map_util from utils import visualization_utils as vis_util PATH_TO_LABELS = '/home/nikhal/PycharmProjects/models/research/object_detection/data/mscoco_label_map.pbtxt' PATH_TO_TEST_IMAGES_DIR = pathlib.Path('/home/nikhal/Pictures') TEST_IMAGE_PATHS = sorted(list(PATH_TO_TEST_IMAGES_DIR.glob("*.jpg"))) category_index = label_map_util.create_category_index_from_labelmap(PATH_TO_LABELS, use_display_name=True) def load_model(): # base_url = 'http://download.tensorflow.org/models/object_detection/' # model_file = model_name + '.tar.gz' # model_dir = tf.keras.utils.get_file( # fname=model_name, # origin=base_url + model_file, # untar=True) # model_dir = pathlib.Path(model_dir)/"saved_model" model = tf.saved_model.load(str("/home/nikhal/Models/faster_rcnn_resnet50_coco_2018_01_28/saved_model")) model = model.signatures['serving_default'] return model def run_inference_for_single_image(model, image): image = np.asarray(image) # The input needs to be a tensor, convert it using `tf.convert_to_tensor`. input_tensor = tf.convert_to_tensor(image) # The model expects a batch of images, so add an axis with `tf.newaxis`. input_tensor = input_tensor[tf.newaxis, ...] # Run inference output_dict = model(input_tensor) # All outputs are batches tensors. # Convert to numpy arrays, and take index [0] to remove the batch dimension. # We're only interested in the first num_detections. num_detections = int(output_dict.pop('num_detections')) output_dict = {key: value[0, :num_detections].numpy() for key, value in output_dict.items()} output_dict['num_detections'] = num_detections # detection_classes should be ints. output_dict['detection_classes'] = output_dict['detection_classes'].astype(np.int64) # Handle models with masks: if 'detection_masks' in output_dict: # Reframe the the bbox mask to the image size. detection_masks_reframed = utils_ops.reframe_box_masks_to_image_masks( output_dict['detection_masks'], output_dict['detection_boxes'], image.shape[0], image.shape[1]) detection_masks_reframed = tf.cast(detection_masks_reframed > 0.5, tf.uint8) output_dict['detection_masks_reframed'] = detection_masks_reframed.numpy() return output_dict def show_inference(model, image_path, path): # the array based representation of the image will be used later in order to prepare the # result image with boxes and labels on it. image_np = image_path #np.array(Image.open(image_path)) # Actual detection. output_dict = run_inference_for_single_image(model, image_np) # Visualization of the results of a detection. vis_util.visualize_boxes_and_labels_on_image_array( image_np, output_dict['detection_boxes'], output_dict['detection_classes'], output_dict['detection_scores'], category_index, instance_masks=output_dict.get('detection_masks_reframed', None), use_normalized_coordinates=True, line_thickness=8, savepath=path) return Image.fromarray(image_np) def main(): path = "/home/nikhal/2018-03-07/" detection_model = load_model() for folder in os.listdir(path): for avifile in os.listdir(path + folder): if avifile[-3:] == "avi": print(avifile) os.makedirs(os.path.join(path,folder,avifile[:-4])) cap = cv2.VideoCapture(os.path.join(path , folder,avifile)) counter = 0 # with detection_model.as_default(): while (cap.isOpened()): save_path = os.path.join(path , folder , avifile[:-4] , str(counter)) print(counter) ret, frame = cap.read() if ret == True: frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) show_inference(detection_model, frame, save_path) counter += 1 else: break cap.release() main()
[ 1, 529, 9507, 29958, 690, 2842, 29914, 3318, 29918, 29881, 2650, 428, 29914, 29895, 845, 277, 823, 29918, 262, 1659, 29889, 2272, 13, 5215, 2224, 1982, 13, 13, 5215, 13850, 29906, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 5215, 4832, 29889, 13529, 267, 29889, 2271, 1982, 408, 3142, 1982, 13, 5215, 10876, 13, 5215, 9913, 1445, 13, 5215, 26110, 408, 15886, 13, 5215, 14319, 1445, 13, 13, 3166, 16250, 1053, 2322, 8977, 13, 3166, 12013, 1053, 1714, 5971, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 3166, 349, 6227, 1053, 7084, 13, 13, 3166, 3667, 29879, 1053, 288, 567, 408, 3667, 29879, 29918, 3554, 13, 3166, 3667, 29879, 1053, 3858, 29918, 1958, 29918, 4422, 13, 3166, 3667, 29879, 1053, 7604, 2133, 29918, 13239, 408, 1998, 29918, 4422, 13, 13, 10145, 29918, 4986, 29918, 24461, 6670, 29903, 353, 8207, 5184, 29914, 5585, 4077, 29914, 29925, 3376, 2817, 25119, 29914, 9794, 29914, 690, 2842, 29914, 3318, 29918, 29881, 2650, 428, 29914, 1272, 29914, 1516, 29883, 6235, 29918, 1643, 29918, 1958, 29889, 29886, 3116, 486, 29915, 13, 10145, 29918, 4986, 29918, 18267, 29918, 2382, 29903, 29918, 9464, 353, 2224, 1982, 29889, 2605, 11219, 5184, 29914, 5585, 4077, 29914, 29925, 10373, 1495, 13, 18267, 29918, 2382, 29918, 10145, 29903, 353, 12705, 29898, 1761, 29898, 10145, 29918, 4986, 29918, 18267, 29918, 2382, 29903, 29918, 9464, 29889, 23705, 703, 10521, 6173, 29908, 4961, 13, 7320, 29918, 2248, 353, 3858, 29918, 1958, 29918, 4422, 29889, 3258, 29918, 7320, 29918, 2248, 29918, 3166, 29918, 1643, 1958, 29898, 10145, 29918, 4986, 29918, 24461, 6670, 29903, 29892, 671, 29918, 4990, 29918, 978, 29922, 5574, 29897, 13, 13, 13, 1753, 2254, 29918, 4299, 7295, 13, 29871, 396, 2967, 29918, 2271, 353, 525, 1124, 597, 10382, 29889, 29056, 29889, 990, 29914, 9794, 29914, 3318, 29918, 29881, 2650, 428, 22208, 13, 29871, 396, 1904, 29918, 1445, 353, 1904, 29918, 978, 718, 15300, 12637, 29889, 18828, 29915, 13, 29871, 396, 1904, 29918, 3972, 353, 15886, 29889, 3946, 294, 29889, 13239, 29889, 657, 29918, 1445, 29898, 13, 29871, 396, 259, 285, 978, 29922, 4299, 29918, 978, 29892, 13, 29871, 396, 259, 3978, 29922, 3188, 29918, 2271, 718, 1904, 29918, 1445, 29892, 13, 29871, 396, 259, 443, 12637, 29922, 5574, 29897, 13, 13, 29871, 396, 1904, 29918, 3972, 353, 2224, 1982, 29889, 2605, 29898, 4299, 29918, 3972, 6802, 29908, 17314, 29918, 4299, 29908, 13, 13, 29871, 1904, 353, 15886, 29889, 17314, 29918, 4299, 29889, 1359, 29898, 710, 11974, 5184, 29914, 5585, 4077, 29914, 23785, 29914, 29888, 1901, 29918, 2214, 15755, 29918, 690, 1212, 29945, 29900, 29918, 29883, 6235, 29918, 29906, 29900, 29896, 29947, 29918, 29900, 29896, 29918, 29906, 29947, 29914, 17314, 29918, 4299, 5783, 13, 29871, 1904, 353, 1904, 29889, 4530, 3698, 1839, 643, 1747, 29918, 4381, 2033, 13, 13, 29871, 736, 1904, 13, 13, 13, 1753, 1065, 29918, 262, 1659, 29918, 1454, 29918, 14369, 29918, 3027, 29898, 4299, 29892, 1967, 1125, 13, 29871, 1967, 353, 7442, 29889, 294, 2378, 29898, 3027, 29897, 13, 29871, 396, 450, 1881, 4225, 304, 367, 263, 12489, 29892, 3588, 372, 773, 421, 13264, 29889, 13441, 29918, 517, 29918, 20158, 1412, 13, 29871, 1881, 29918, 20158, 353, 15886, 29889, 13441, 29918, 517, 29918, 20158, 29898, 3027, 29897, 13, 29871, 396, 450, 1904, 23347, 263, 9853, 310, 4558, 29892, 577, 788, 385, 9685, 411, 421, 13264, 29889, 1482, 8990, 1412, 13, 29871, 1881, 29918, 20158, 353, 1881, 29918, 20158, 29961, 13264, 29889, 1482, 8990, 29892, 2023, 29962, 13, 13, 29871, 396, 7525, 27262, 13, 29871, 1962, 29918, 8977, 353, 1904, 29898, 2080, 29918, 20158, 29897, 13, 13, 29871, 396, 2178, 14391, 526, 9853, 267, 25187, 943, 29889, 13, 29871, 396, 14806, 304, 12655, 7049, 29892, 322, 2125, 2380, 518, 29900, 29962, 304, 3349, 278, 9853, 9927, 29889, 13, 29871, 396, 1334, 29915, 276, 871, 8852, 297, 278, 937, 954, 29918, 29881, 2650, 1953, 29889, 13, 29871, 954, 29918, 29881, 2650, 1953, 353, 938, 29898, 4905, 29918, 8977, 29889, 7323, 877, 1949, 29918, 29881, 2650, 1953, 8785, 13, 29871, 1962, 29918, 8977, 353, 426, 1989, 29901, 995, 29961, 29900, 29892, 584, 1949, 29918, 29881, 2650, 1953, 1822, 23749, 580, 13, 462, 363, 1820, 29892, 995, 297, 1962, 29918, 8977, 29889, 7076, 28296, 13, 29871, 1962, 29918, 8977, 1839, 1949, 29918, 29881, 2650, 1953, 2033, 353, 954, 29918, 29881, 2650, 1953, 13, 13, 29871, 396, 15326, 29918, 13203, 881, 367, 938, 29879, 29889, 13, 29871, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 13203, 2033, 353, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 13203, 13359, 579, 668, 29898, 9302, 29889, 524, 29953, 29946, 29897, 13, 13, 29871, 396, 29273, 4733, 411, 11105, 29879, 29901, 13, 29871, 565, 525, 29881, 2650, 428, 29918, 13168, 29879, 29915, 297, 1962, 29918, 8977, 29901, 13, 1678, 396, 830, 2557, 278, 278, 289, 1884, 11105, 304, 278, 1967, 2159, 29889, 13, 1678, 15326, 29918, 13168, 29879, 29918, 999, 2572, 287, 353, 3667, 29879, 29918, 3554, 29889, 999, 3128, 29918, 1884, 29918, 13168, 29879, 29918, 517, 29918, 3027, 29918, 13168, 29879, 29898, 13, 418, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 13168, 29879, 7464, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 1884, 267, 7464, 13, 418, 1967, 29889, 12181, 29961, 29900, 1402, 1967, 29889, 12181, 29961, 29896, 2314, 13, 1678, 15326, 29918, 13168, 29879, 29918, 999, 2572, 287, 353, 15886, 29889, 4384, 29898, 29881, 2650, 428, 29918, 13168, 29879, 29918, 999, 2572, 287, 1405, 29871, 29900, 29889, 29945, 29892, 13, 462, 462, 539, 15886, 29889, 13470, 29947, 29897, 13, 1678, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 13168, 29879, 29918, 999, 2572, 287, 2033, 353, 15326, 29918, 13168, 29879, 29918, 999, 2572, 287, 29889, 23749, 580, 13, 13, 29871, 736, 1962, 29918, 8977, 13, 13, 1753, 1510, 29918, 262, 1659, 29898, 4299, 29892, 1967, 29918, 2084, 29892, 2224, 1125, 13, 29871, 396, 278, 1409, 2729, 8954, 310, 278, 1967, 674, 367, 1304, 2678, 297, 1797, 304, 19012, 278, 13, 29871, 396, 1121, 1967, 411, 16273, 322, 11073, 373, 372, 29889, 13, 29871, 1967, 29918, 9302, 353, 1967, 29918, 2084, 396, 9302, 29889, 2378, 29898, 2940, 29889, 3150, 29898, 3027, 29918, 2084, 876, 13, 29871, 396, 3185, 950, 15326, 29889, 13, 29871, 1962, 29918, 8977, 353, 1065, 29918, 262, 1659, 29918, 1454, 29918, 14369, 29918, 3027, 29898, 4299, 29892, 1967, 29918, 9302, 29897, 13, 29871, 396, 9249, 2133, 310, 278, 2582, 310, 263, 15326, 29889, 13, 29871, 1998, 29918, 4422, 29889, 20119, 675, 29918, 1884, 267, 29918, 392, 29918, 21134, 29918, 265, 29918, 3027, 29918, 2378, 29898, 13, 418, 1967, 29918, 9302, 29892, 13, 418, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 1884, 267, 7464, 13, 418, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 13203, 7464, 13, 418, 1962, 29918, 8977, 1839, 29881, 2650, 428, 29918, 1557, 2361, 7464, 13, 418, 7663, 29918, 2248, 29892, 13, 418, 2777, 29918, 13168, 29879, 29922, 4905, 29918, 8977, 29889, 657, 877, 29881, 2650, 428, 29918, 13168, 29879, 29918, 999, 2572, 287, 742, 6213, 511, 13, 418, 671, 29918, 8945, 1891, 29918, 1111, 24266, 29922, 5574, 29892, 13, 418, 1196, 29918, 27996, 2264, 29922, 29947, 29892, 13, 418, 4078, 2084, 29922, 2084, 29897, 13, 13, 29871, 736, 7084, 29889, 3166, 2378, 29898, 3027, 29918, 9302, 29897, 13, 13, 1753, 1667, 7295, 13, 1678, 2224, 353, 5591, 5184, 29914, 5585, 4077, 29914, 29906, 29900, 29896, 29947, 29899, 29900, 29941, 29899, 29900, 29955, 12975, 13, 1678, 15326, 29918, 4299, 353, 2254, 29918, 4299, 580, 13, 13, 1678, 363, 4138, 297, 2897, 29889, 1761, 3972, 29898, 2084, 1125, 13, 4706, 363, 1029, 361, 488, 297, 2897, 29889, 1761, 3972, 29898, 2084, 718, 4138, 1125, 13, 9651, 565, 1029, 361, 488, 14352, 29941, 17531, 1275, 376, 17345, 1115, 13, 18884, 1596, 29898, 485, 361, 488, 29897, 13, 13, 18884, 2897, 29889, 29885, 12535, 12935, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 12083, 29892, 485, 361, 488, 7503, 29899, 29946, 12622, 13, 13, 13, 18884, 2117, 353, 13850, 29906, 29889, 15167, 21133, 545, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 1919, 4138, 29892, 485, 361, 488, 876, 13, 18884, 6795, 353, 29871, 29900, 13, 18884, 396, 411, 15326, 29918, 4299, 29889, 294, 29918, 4381, 7295, 13, 18884, 1550, 313, 5030, 29889, 275, 6585, 287, 580, 1125, 13, 462, 1678, 4078, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 2084, 1919, 4138, 1919, 1029, 361, 488, 7503, 29899, 29946, 29962, 1919, 851, 29898, 11808, 876, 13, 462, 1678, 1596, 29898, 11808, 29897, 13, 462, 1678, 3240, 29892, 3515, 353, 2117, 29889, 949, 580, 13, 13, 462, 1678, 565, 3240, 1275, 5852, 29901, 13, 13, 462, 4706, 3515, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2557, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 28212, 29897, 13, 462, 4706, 1510, 29918, 262, 1659, 29898, 29881, 2650, 428, 29918, 4299, 29892, 3515, 29892, 4078, 29918, 2084, 29897, 13, 462, 4706, 6795, 4619, 29871, 29896, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 2867, 13, 18884, 2117, 29889, 14096, 580, 13, 13, 3396, 580, 13, 13, 2 ]
tests/test_load_spec.py
rai-project/scope_plot
0
179865
<gh_stars>0 import os from scope_plot.specification import Specification FIXTURES_DIR = os.path.join( os.path.dirname(os.path.realpath(__file__)), "..", "__fixtures") def test_bokeh_errorbar_spec(): figure_spec = Specification.load_yaml( os.path.join(FIXTURES_DIR, "bokeh_errorbar.yml")) assert figure_spec.ty() == "errorbar" def test_bokeh_bar_spec(): figure_spec = Specification.load_yaml( os.path.join(FIXTURES_DIR, "bokeh_bar.yml")) assert figure_spec.ty() == "bar" def test_bokeh_subplots_spec(): figure_spec = Specification.load_yaml( os.path.join(FIXTURES_DIR, "bokeh_subplots.yml")) assert figure_spec.subplots[0].ty() == "errorbar" def test_matplotlib_regplot_spec(): figure_spec = Specification.load_yaml( os.path.join(FIXTURES_DIR, "matplotlib_regplot.yml")) assert figure_spec.ty() == "regplot"
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 3166, 6874, 29918, 5317, 29889, 6550, 2450, 1053, 12048, 2450, 13, 13, 3738, 12188, 11499, 29903, 29918, 9464, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 1678, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 8243, 376, 636, 613, 376, 1649, 7241, 486, 1973, 1159, 13, 13, 13, 1753, 1243, 29918, 833, 446, 29882, 29918, 2704, 1646, 29918, 6550, 7295, 13, 1678, 4377, 29918, 6550, 353, 12048, 2450, 29889, 1359, 29918, 25162, 29898, 13, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 3738, 12188, 11499, 29903, 29918, 9464, 29892, 376, 833, 446, 29882, 29918, 2704, 1646, 29889, 21053, 5783, 13, 1678, 4974, 4377, 29918, 6550, 29889, 1017, 580, 1275, 376, 2704, 1646, 29908, 13, 13, 13, 1753, 1243, 29918, 833, 446, 29882, 29918, 1646, 29918, 6550, 7295, 13, 1678, 4377, 29918, 6550, 353, 12048, 2450, 29889, 1359, 29918, 25162, 29898, 13, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 3738, 12188, 11499, 29903, 29918, 9464, 29892, 376, 833, 446, 29882, 29918, 1646, 29889, 21053, 5783, 13, 1678, 4974, 4377, 29918, 6550, 29889, 1017, 580, 1275, 376, 1646, 29908, 13, 13, 13, 1753, 1243, 29918, 833, 446, 29882, 29918, 1491, 26762, 29918, 6550, 7295, 13, 1678, 4377, 29918, 6550, 353, 12048, 2450, 29889, 1359, 29918, 25162, 29898, 13, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 3738, 12188, 11499, 29903, 29918, 9464, 29892, 376, 833, 446, 29882, 29918, 1491, 26762, 29889, 21053, 5783, 13, 1678, 4974, 4377, 29918, 6550, 29889, 1491, 26762, 29961, 29900, 1822, 1017, 580, 1275, 376, 2704, 1646, 29908, 13, 13, 13, 1753, 1243, 29918, 2922, 17357, 29918, 1727, 5317, 29918, 6550, 7295, 13, 1678, 4377, 29918, 6550, 353, 12048, 2450, 29889, 1359, 29918, 25162, 29898, 13, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 3738, 12188, 11499, 29903, 29918, 9464, 29892, 376, 2922, 17357, 29918, 1727, 5317, 29889, 21053, 5783, 13, 1678, 4974, 4377, 29918, 6550, 29889, 1017, 580, 1275, 376, 1727, 5317, 29908, 13, 2 ]
algorithms/algorithms/searching/binary_search/problems/search_in_rotated_sorted_array.py
givek/algorithms
0
150802
<filename>algorithms/algorithms/searching/binary_search/problems/search_in_rotated_sorted_array.py # Link: https://leetcode.com/problems/search-in-rotated-sorted-array/ # Time: O(LogN) # Space: O(1) # As the given array is rotated sorted, binary search cannot be applied directly. def search(nums, target): start, end = 0, len(nums) - 1 while start <= end: mid = (start + end) // 2 if target == nums[mid]: return mid if nums[start] <= nums[mid]: # the array is sorted from start to mid. if nums[start] <= target < nums[mid]: # as the target lies between start and mid, reduce the search window. end = mid - 1 else: # if target does not lie between start and mid, search from (mid + 1) - end. start = mid + 1 else: # here the array is sorted from mid to end. if nums[mid] < target <= nums[end]: # as the target lies between mid and end, reduce the search window. start = mid + 1 else: # the target does not lie between mid and end, search from start - (mid - 1) end = mid - 1 return -1 def main(): nums = [3, 5, 1] target = 3 print(search(nums, target)) if __name__ == "__main__": main()
[ 1, 529, 9507, 29958, 9564, 12404, 29914, 9564, 12404, 29914, 4478, 292, 29914, 19541, 29918, 4478, 29914, 17199, 29879, 29914, 4478, 29918, 262, 29918, 5450, 630, 29918, 24582, 29918, 2378, 29889, 2272, 13, 29937, 6645, 29901, 2045, 597, 280, 300, 401, 29889, 510, 29914, 17199, 29879, 29914, 4478, 29899, 262, 29899, 5450, 630, 29899, 24582, 29899, 2378, 29914, 13, 29937, 5974, 29901, 438, 29898, 3403, 29940, 29897, 13, 29937, 14121, 29901, 438, 29898, 29896, 29897, 13, 13, 13, 29937, 1094, 278, 2183, 1409, 338, 5731, 630, 12705, 29892, 7581, 2740, 2609, 367, 7436, 4153, 29889, 13, 13, 13, 1753, 2740, 29898, 1949, 29879, 29892, 3646, 1125, 13, 1678, 1369, 29892, 1095, 353, 29871, 29900, 29892, 7431, 29898, 1949, 29879, 29897, 448, 29871, 29896, 13, 13, 1678, 1550, 1369, 5277, 1095, 29901, 13, 4706, 7145, 353, 313, 2962, 718, 1095, 29897, 849, 29871, 29906, 13, 13, 4706, 565, 3646, 1275, 954, 29879, 29961, 6563, 5387, 13, 9651, 736, 7145, 13, 13, 4706, 565, 954, 29879, 29961, 2962, 29962, 5277, 954, 29879, 29961, 6563, 5387, 29871, 396, 278, 1409, 338, 12705, 515, 1369, 304, 7145, 29889, 13, 9651, 565, 954, 29879, 29961, 2962, 29962, 5277, 3646, 529, 954, 29879, 29961, 6563, 5387, 13, 18884, 396, 408, 278, 3646, 12185, 1546, 1369, 322, 7145, 29892, 10032, 278, 2740, 3474, 29889, 13, 18884, 1095, 353, 7145, 448, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 396, 565, 3646, 947, 451, 3804, 1546, 1369, 322, 7145, 29892, 2740, 515, 313, 6563, 718, 29871, 29896, 29897, 448, 1095, 29889, 13, 18884, 1369, 353, 7145, 718, 29871, 29896, 13, 4706, 1683, 29901, 29871, 396, 1244, 278, 1409, 338, 12705, 515, 7145, 304, 1095, 29889, 13, 9651, 565, 954, 29879, 29961, 6563, 29962, 529, 3646, 5277, 954, 29879, 29961, 355, 5387, 13, 18884, 396, 408, 278, 3646, 12185, 1546, 7145, 322, 1095, 29892, 10032, 278, 2740, 3474, 29889, 13, 18884, 1369, 353, 7145, 718, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 396, 278, 3646, 947, 451, 3804, 1546, 7145, 322, 1095, 29892, 2740, 515, 1369, 448, 313, 6563, 448, 29871, 29896, 29897, 13, 18884, 1095, 353, 7145, 448, 29871, 29896, 13, 1678, 736, 448, 29896, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 954, 29879, 353, 518, 29941, 29892, 29871, 29945, 29892, 29871, 29896, 29962, 13, 1678, 3646, 353, 29871, 29941, 13, 1678, 1596, 29898, 4478, 29898, 1949, 29879, 29892, 3646, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
tests/grab_upload_file.py
alexey-v-paramonov/grab
0
195127
<gh_stars>0 # coding: utf-8 import os from grab import UploadContent, UploadFile from tests.util import build_grab, temp_file, BaseGrabTestCase class TestUploadContent(BaseGrabTestCase): def setUp(self): self.server.reset() def prepare_form_grab(self): url = self.server.get_url() html = ( '<form action="%s" method="post" enctype="multipart/form-data">' '<input type="file" name="image">' '</form>' % url ).encode('ascii') grab = build_grab(html, charset='utf-8') return grab # ******************* # UploadContent Tests # ******************* def test_upload_content_filename(self): grab = self.prepare_form_grab() data = b'foo' upload_data = UploadContent(data, filename='avatar.jpg') grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadContent)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) self.assertEqual('avatar.jpg', self.server.request['files']['image'][0]['filename']) self.assertEqual( 'image/jpeg', self.server.request['files']['image'][0]['content_type']) def test_upload_content_random_filename(self): grab = self.prepare_form_grab() data = b'foo' upload_data = UploadContent(data) grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadContent)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) self.assertEqual( 10, len(self.server.request['files']['image'][0]['filename'])) self.assertEqual( 'application/octet-stream', self.server.request['files']['image'][0]['content_type']) def test_upload_content_content_type(self): grab = self.prepare_form_grab() data = b'foo' upload_data = UploadContent(data, content_type='application/grab') grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadContent)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) self.assertEqual( 10, len(self.server.request['files']['image'][0]['filename'])) self.assertEqual( 'application/grab', self.server.request['files']['image'][0]['content_type']) # **************** # UploadFile Tests # **************** def test_upload_file(self): with temp_file() as file_path: grab = self.prepare_form_grab() data = b'foo' with open(file_path, 'wb') as out: out.write(data) upload_data = UploadFile(file_path) grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadFile)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) _, filename = os.path.split(file_path) self.assertEqual( filename, self.server.request['files']['image'][0]['filename'], ) self.assertEqual( 'application/octet-stream', self.server.request['files']['image'][0]['content_type']) def test_upload_file_custom_filename(self): with temp_file() as file_path: grab = self.prepare_form_grab() data = b'foo' with open(file_path, 'wb') as out: out.write(data) upload_data = UploadFile(file_path, filename='avatar.jpg') grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadFile)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) self.assertEqual( 'avatar.jpg', self.server.request['files']['image'][0]['filename'], ) self.assertEqual( 'image/jpeg', self.server.request['files']['image'][0]['content_type']) def test_upload_file_custom_content_type(self): with temp_file() as file_path: grab = self.prepare_form_grab() data = b'foo' with open(file_path, 'wb') as out: out.write(data) upload_data = UploadFile(file_path, filename='avatar.jpg', content_type='application/grab') grab.doc.set_input('image', upload_data) grab.doc.submit(make_request=False) post = dict(grab.config['multipart_post']) self.assertTrue(isinstance(post['image'], UploadFile)) grab.doc.submit() self.assertEqual(data, self.server.request['files']['image'][0]['body']) self.assertEqual( 'avatar.jpg', self.server.request['files']['image'][0]['filename'], ) self.assertEqual( 'application/grab', self.server.request['files']['image'][0]['content_type'])
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 5215, 2897, 13, 13, 3166, 17229, 1053, 5020, 1359, 3916, 29892, 5020, 1359, 2283, 13, 3166, 6987, 29889, 4422, 1053, 2048, 29918, 3874, 29890, 29892, 5694, 29918, 1445, 29892, 7399, 29954, 4201, 3057, 8259, 13, 13, 13, 1990, 4321, 17553, 3916, 29898, 5160, 29954, 4201, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 2974, 29889, 12071, 580, 13, 13, 1678, 822, 19012, 29918, 689, 29918, 3874, 29890, 29898, 1311, 1125, 13, 4706, 3142, 353, 1583, 29889, 2974, 29889, 657, 29918, 2271, 580, 13, 4706, 3472, 353, 313, 13, 9651, 12801, 689, 3158, 543, 29995, 29879, 29908, 1158, 543, 2490, 29908, 427, 312, 668, 543, 18056, 442, 29914, 689, 29899, 1272, 1013, 29915, 13, 9651, 12801, 2080, 1134, 543, 1445, 29908, 1024, 543, 3027, 1013, 29915, 13, 9651, 525, 829, 689, 16299, 1273, 3142, 13, 4706, 13742, 12508, 877, 294, 18869, 1495, 13, 4706, 17229, 353, 2048, 29918, 3874, 29890, 29898, 1420, 29892, 17425, 2433, 9420, 29899, 29947, 1495, 13, 4706, 736, 17229, 13, 13, 1678, 396, 334, 7775, 1068, 13, 1678, 396, 5020, 1359, 3916, 4321, 29879, 13, 1678, 396, 334, 7775, 1068, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 3051, 29918, 9507, 29898, 1311, 1125, 13, 4706, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 4706, 848, 353, 289, 29915, 5431, 29915, 13, 4706, 6441, 29918, 1272, 353, 5020, 1359, 3916, 29898, 1272, 29892, 10422, 2433, 485, 14873, 29889, 6173, 1495, 13, 4706, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 4706, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 4706, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 3916, 876, 13, 13, 4706, 17229, 29889, 1514, 29889, 7892, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 308, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 4706, 1583, 29889, 9294, 9843, 877, 485, 14873, 29889, 6173, 742, 13, 462, 308, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 525, 3027, 29914, 26568, 742, 13, 9651, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 3051, 29918, 8172, 29918, 9507, 29898, 1311, 1125, 13, 4706, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 4706, 848, 353, 289, 29915, 5431, 29915, 13, 4706, 6441, 29918, 1272, 353, 5020, 1359, 3916, 29898, 1272, 29897, 13, 4706, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 4706, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 4706, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 3916, 876, 13, 13, 4706, 17229, 29889, 1514, 29889, 7892, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 308, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 632, 29896, 29900, 29892, 7431, 29898, 1311, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 25901, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 525, 6214, 29914, 20082, 300, 29899, 5461, 742, 13, 9651, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 3051, 29918, 3051, 29918, 1853, 29898, 1311, 1125, 13, 4706, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 4706, 848, 353, 289, 29915, 5431, 29915, 13, 4706, 6441, 29918, 1272, 353, 5020, 1359, 3916, 29898, 1272, 29892, 13, 462, 462, 1678, 2793, 29918, 1853, 2433, 6214, 29914, 3874, 29890, 1495, 13, 4706, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 4706, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 4706, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 3916, 876, 13, 13, 4706, 17229, 29889, 1514, 29889, 7892, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 308, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 632, 29896, 29900, 29892, 7431, 29898, 1311, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 25901, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 525, 6214, 29914, 3874, 29890, 742, 13, 9651, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 13, 1678, 396, 334, 4189, 2328, 17435, 13, 1678, 396, 5020, 1359, 2283, 4321, 29879, 13, 1678, 396, 334, 4189, 2328, 17435, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 1445, 29898, 1311, 1125, 13, 4706, 411, 5694, 29918, 1445, 580, 408, 934, 29918, 2084, 29901, 13, 9651, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 9651, 848, 353, 289, 29915, 5431, 29915, 13, 9651, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29893, 29890, 1495, 408, 714, 29901, 13, 18884, 714, 29889, 3539, 29898, 1272, 29897, 13, 9651, 6441, 29918, 1272, 353, 5020, 1359, 2283, 29898, 1445, 29918, 2084, 29897, 13, 9651, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 9651, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 9651, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 9651, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 2283, 876, 13, 13, 9651, 17229, 29889, 1514, 29889, 7892, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 632, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 9651, 17117, 10422, 353, 2897, 29889, 2084, 29889, 5451, 29898, 1445, 29918, 2084, 29897, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 10422, 29892, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 7464, 13, 9651, 1723, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 6214, 29914, 20082, 300, 29899, 5461, 742, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 1445, 29918, 6341, 29918, 9507, 29898, 1311, 1125, 13, 4706, 411, 5694, 29918, 1445, 580, 408, 934, 29918, 2084, 29901, 13, 9651, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 9651, 848, 353, 289, 29915, 5431, 29915, 13, 9651, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29893, 29890, 1495, 408, 714, 29901, 13, 18884, 714, 29889, 3539, 29898, 1272, 29897, 13, 9651, 6441, 29918, 1272, 353, 5020, 1359, 2283, 29898, 1445, 29918, 2084, 29892, 10422, 2433, 485, 14873, 29889, 6173, 1495, 13, 9651, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 9651, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 9651, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 9651, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 2283, 876, 13, 13, 9651, 17229, 29889, 1514, 29889, 7892, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 632, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 485, 14873, 29889, 6173, 742, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 7464, 13, 9651, 1723, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 3027, 29914, 26568, 742, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 13, 1678, 822, 1243, 29918, 9009, 29918, 1445, 29918, 6341, 29918, 3051, 29918, 1853, 29898, 1311, 1125, 13, 4706, 411, 5694, 29918, 1445, 580, 408, 934, 29918, 2084, 29901, 13, 9651, 17229, 353, 1583, 29889, 19125, 29918, 689, 29918, 3874, 29890, 580, 13, 9651, 848, 353, 289, 29915, 5431, 29915, 13, 9651, 411, 1722, 29898, 1445, 29918, 2084, 29892, 525, 29893, 29890, 1495, 408, 714, 29901, 13, 18884, 714, 29889, 3539, 29898, 1272, 29897, 13, 9651, 6441, 29918, 1272, 353, 5020, 1359, 2283, 29898, 1445, 29918, 2084, 29892, 10422, 2433, 485, 14873, 29889, 6173, 742, 13, 462, 462, 268, 2793, 29918, 1853, 2433, 6214, 29914, 3874, 29890, 1495, 13, 9651, 17229, 29889, 1514, 29889, 842, 29918, 2080, 877, 3027, 742, 6441, 29918, 1272, 29897, 13, 9651, 17229, 29889, 1514, 29889, 7892, 29898, 5675, 29918, 3827, 29922, 8824, 29897, 13, 9651, 1400, 353, 9657, 29898, 3874, 29890, 29889, 2917, 1839, 18056, 442, 29918, 2490, 11287, 13, 9651, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 2490, 1839, 3027, 7464, 5020, 1359, 2283, 876, 13, 13, 9651, 17229, 29889, 1514, 29889, 7892, 580, 13, 9651, 1583, 29889, 9294, 9843, 29898, 1272, 29892, 13, 462, 632, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 2587, 11287, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 485, 14873, 29889, 6173, 742, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 9507, 7464, 13, 9651, 1723, 13, 9651, 1583, 29889, 9294, 9843, 29898, 13, 18884, 525, 6214, 29914, 3874, 29890, 742, 13, 18884, 1583, 29889, 2974, 29889, 3827, 1839, 5325, 16215, 3027, 2033, 29961, 29900, 22322, 3051, 29918, 1853, 11287, 13, 2 ]
test/unit/common/test_header_key_dict.py
OyTao/swift-learning
0
140227
<reponame>OyTao/swift-learning<gh_stars>0 # Copyright (c) 2012 OpenStack Foundation # # 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 # # http://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 unittest from swift.common.header_key_dict import HeaderKeyDict class TestHeaderKeyDict(unittest.TestCase): def test_case_insensitive(self): headers = HeaderKeyDict() headers['Content-Length'] = 0 headers['CONTENT-LENGTH'] = 10 headers['content-length'] = 20 self.assertEqual(headers['Content-Length'], '20') self.assertEqual(headers['content-length'], '20') self.assertEqual(headers['CONTENT-LENGTH'], '20') def test_setdefault(self): headers = HeaderKeyDict() # it gets set headers.setdefault('x-rubber-ducky', 'the one') self.assertEqual(headers['X-Rubber-Ducky'], 'the one') # it has the right return value ret = headers.setdefault('x-boat', 'dinghy') self.assertEqual(ret, 'dinghy') ret = headers.setdefault('x-boat', 'yacht') self.assertEqual(ret, 'dinghy') # shouldn't crash headers.setdefault('x-sir-not-appearing-in-this-request', None) def test_del_contains(self): headers = HeaderKeyDict() headers['Content-Length'] = 0 self.assertIn('Content-Length', headers) del headers['Content-Length'] self.assertNotIn('Content-Length', headers) def test_update(self): headers = HeaderKeyDict() headers.update({'Content-Length': '0'}) headers.update([('Content-Type', 'text/plain')]) self.assertEqual(headers['Content-Length'], '0') self.assertEqual(headers['Content-Type'], 'text/plain') def test_set_none(self): headers = HeaderKeyDict() headers['test'] = None self.assertNotIn('test', headers) headers['test'] = 'something' self.assertEqual('something', headers['test']) # sanity check headers['test'] = None self.assertNotIn('test', headers) def test_init_from_dict(self): headers = HeaderKeyDict({'Content-Length': 20, 'Content-Type': 'text/plain'}) self.assertEqual('20', headers['Content-Length']) self.assertEqual('text/plain', headers['Content-Type']) headers = HeaderKeyDict(headers) self.assertEqual('20', headers['Content-Length']) self.assertEqual('text/plain', headers['Content-Type']) def test_set(self): # mappings = ((<tuple of input vals>, <expected output val>), ...) mappings = (((1.618, '1.618', b'1.618', u'1.618'), '1.618'), ((20, '20', b'20', u'20'), '20'), ((True, 'True', b'True', u'True'), 'True'), ((False, 'False', b'False', u'False'), 'False')) for vals, expected in mappings: for val in vals: headers = HeaderKeyDict(test=val) actual = headers['test'] self.assertEqual(expected, actual, 'Expected %s but got %s for val %s' % (expected, actual, val)) self.assertIsInstance( actual, str, 'Expected type str but got %s for val %s of type %s' % (type(actual), val, type(val))) def test_get(self): headers = HeaderKeyDict() headers['content-length'] = 20 self.assertEqual(headers.get('CONTENT-LENGTH'), '20') self.assertEqual(headers.get('something-else'), None) self.assertEqual(headers.get('something-else', True), True) def test_keys(self): headers = HeaderKeyDict() headers['content-length'] = 20 headers['cOnTent-tYpe'] = 'text/plain' headers['SomeThing-eLse'] = 'somevalue' self.assertEqual( set(headers.keys()), set(('Content-Length', 'Content-Type', 'Something-Else'))) def test_pop(self): headers = HeaderKeyDict() headers['content-length'] = 20 headers['cOntent-tYpe'] = 'text/plain' self.assertEqual(headers.pop('content-Length'), '20') self.assertEqual(headers.pop('Content-type'), 'text/plain') self.assertEqual(headers.pop('Something-Else', 'somevalue'), 'somevalue')
[ 1, 529, 276, 1112, 420, 29958, 29949, 29891, 29911, 6241, 29914, 26792, 29899, 21891, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29906, 4673, 7264, 10606, 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, 1678, 1732, 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, 13, 29937, 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, 443, 27958, 13, 3166, 12086, 29889, 9435, 29889, 6672, 29918, 1989, 29918, 8977, 1053, 19345, 2558, 21533, 13, 13, 13, 1990, 4321, 7850, 2558, 21533, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 4878, 29918, 1144, 575, 3321, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 3916, 29899, 6513, 2033, 353, 29871, 29900, 13, 4706, 9066, 1839, 22412, 3919, 29899, 19433, 2033, 353, 29871, 29896, 29900, 13, 4706, 9066, 1839, 3051, 29899, 2848, 2033, 353, 29871, 29906, 29900, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 3916, 29899, 6513, 7464, 525, 29906, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 3051, 29899, 2848, 7464, 525, 29906, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 22412, 3919, 29899, 19433, 7464, 525, 29906, 29900, 1495, 13, 13, 1678, 822, 1243, 29918, 842, 4381, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 13, 4706, 396, 372, 4947, 731, 13, 4706, 9066, 29889, 842, 4381, 877, 29916, 29899, 29878, 431, 495, 29899, 700, 384, 29891, 742, 525, 1552, 697, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 29990, 29899, 29934, 431, 495, 29899, 29928, 14395, 7464, 525, 1552, 697, 1495, 13, 13, 4706, 396, 372, 756, 278, 1492, 736, 995, 13, 4706, 3240, 353, 9066, 29889, 842, 4381, 877, 29916, 29899, 833, 271, 742, 525, 8497, 5819, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2267, 29892, 525, 8497, 5819, 1495, 13, 13, 4706, 3240, 353, 9066, 29889, 842, 4381, 877, 29916, 29899, 833, 271, 742, 525, 29891, 5860, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2267, 29892, 525, 8497, 5819, 1495, 13, 13, 4706, 396, 9273, 29915, 29873, 8095, 13, 4706, 9066, 29889, 842, 4381, 877, 29916, 29899, 29879, 381, 29899, 1333, 29899, 932, 799, 292, 29899, 262, 29899, 1366, 29899, 3827, 742, 6213, 29897, 13, 13, 1678, 822, 1243, 29918, 6144, 29918, 11516, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 3916, 29899, 6513, 2033, 353, 29871, 29900, 13, 4706, 1583, 29889, 9294, 797, 877, 3916, 29899, 6513, 742, 9066, 29897, 13, 4706, 628, 9066, 1839, 3916, 29899, 6513, 2033, 13, 4706, 1583, 29889, 9294, 3664, 797, 877, 3916, 29899, 6513, 742, 9066, 29897, 13, 13, 1678, 822, 1243, 29918, 5504, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 29889, 5504, 3319, 29915, 3916, 29899, 6513, 2396, 525, 29900, 29915, 1800, 13, 4706, 9066, 29889, 5504, 4197, 877, 3916, 29899, 1542, 742, 525, 726, 29914, 24595, 1495, 2314, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 3916, 29899, 6513, 7464, 525, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 3916, 29899, 1542, 7464, 525, 726, 29914, 24595, 1495, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 9290, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 1688, 2033, 353, 6213, 13, 4706, 1583, 29889, 9294, 3664, 797, 877, 1688, 742, 9066, 29897, 13, 4706, 9066, 1839, 1688, 2033, 353, 525, 14481, 29915, 13, 4706, 1583, 29889, 9294, 9843, 877, 14481, 742, 9066, 1839, 1688, 11287, 29871, 396, 9753, 537, 1423, 13, 4706, 9066, 1839, 1688, 2033, 353, 6213, 13, 4706, 1583, 29889, 9294, 3664, 797, 877, 1688, 742, 9066, 29897, 13, 13, 1678, 822, 1243, 29918, 2344, 29918, 3166, 29918, 8977, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 3319, 29915, 3916, 29899, 6513, 2396, 29871, 29906, 29900, 29892, 13, 462, 462, 525, 3916, 29899, 1542, 2396, 525, 726, 29914, 24595, 29915, 1800, 13, 4706, 1583, 29889, 9294, 9843, 877, 29906, 29900, 742, 9066, 1839, 3916, 29899, 6513, 11287, 13, 4706, 1583, 29889, 9294, 9843, 877, 726, 29914, 24595, 742, 9066, 1839, 3916, 29899, 1542, 11287, 13, 4706, 9066, 353, 19345, 2558, 21533, 29898, 13662, 29897, 13, 4706, 1583, 29889, 9294, 9843, 877, 29906, 29900, 742, 9066, 1839, 3916, 29899, 6513, 11287, 13, 4706, 1583, 29889, 9294, 9843, 877, 726, 29914, 24595, 742, 9066, 1839, 3916, 29899, 1542, 11287, 13, 13, 1678, 822, 1243, 29918, 842, 29898, 1311, 1125, 13, 4706, 396, 611, 27775, 353, 5135, 29966, 23583, 310, 1881, 659, 29879, 10202, 529, 9684, 1962, 659, 29958, 511, 29757, 13, 4706, 611, 27775, 353, 313, 3552, 29896, 29889, 29953, 29896, 29947, 29892, 525, 29896, 29889, 29953, 29896, 29947, 742, 289, 29915, 29896, 29889, 29953, 29896, 29947, 742, 318, 29915, 29896, 29889, 29953, 29896, 29947, 5477, 525, 29896, 29889, 29953, 29896, 29947, 5477, 13, 462, 1678, 5135, 29906, 29900, 29892, 525, 29906, 29900, 742, 289, 29915, 29906, 29900, 742, 318, 29915, 29906, 29900, 5477, 525, 29906, 29900, 5477, 13, 462, 1678, 5135, 5574, 29892, 525, 5574, 742, 289, 29915, 5574, 742, 318, 29915, 5574, 5477, 525, 5574, 5477, 13, 462, 1678, 5135, 8824, 29892, 525, 8824, 742, 289, 29915, 8824, 742, 318, 29915, 8824, 5477, 525, 8824, 8785, 13, 4706, 363, 659, 29879, 29892, 3806, 297, 611, 27775, 29901, 13, 9651, 363, 659, 297, 659, 29879, 29901, 13, 18884, 9066, 353, 19345, 2558, 21533, 29898, 1688, 29922, 791, 29897, 13, 18884, 3935, 353, 9066, 1839, 1688, 2033, 13, 18884, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29892, 13, 462, 462, 525, 1252, 6021, 1273, 29879, 541, 2355, 1273, 29879, 363, 659, 1273, 29879, 29915, 1273, 13, 462, 462, 313, 9684, 29892, 3935, 29892, 659, 876, 13, 18884, 1583, 29889, 9294, 3624, 4998, 29898, 13, 462, 1678, 3935, 29892, 851, 29892, 13, 462, 1678, 525, 1252, 6021, 1134, 851, 541, 2355, 1273, 29879, 363, 659, 1273, 29879, 310, 1134, 1273, 29879, 29915, 1273, 13, 462, 1678, 313, 1853, 29898, 19304, 511, 659, 29892, 1134, 29898, 791, 4961, 13, 13, 1678, 822, 1243, 29918, 657, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 3051, 29899, 2848, 2033, 353, 29871, 29906, 29900, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 657, 877, 22412, 3919, 29899, 19433, 5477, 525, 29906, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 657, 877, 14481, 29899, 2870, 5477, 6213, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 657, 877, 14481, 29899, 2870, 742, 5852, 511, 5852, 29897, 13, 13, 1678, 822, 1243, 29918, 8149, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 3051, 29899, 2848, 2033, 353, 29871, 29906, 29900, 13, 4706, 9066, 1839, 29883, 2951, 29911, 296, 29899, 29873, 29979, 412, 2033, 353, 525, 726, 29914, 24595, 29915, 13, 4706, 9066, 1839, 9526, 1349, 292, 29899, 29872, 29931, 344, 2033, 353, 525, 5372, 1767, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 731, 29898, 13662, 29889, 8149, 25739, 13, 9651, 731, 29898, 877, 3916, 29899, 6513, 742, 525, 3916, 29899, 1542, 742, 525, 16804, 29899, 27406, 29915, 4961, 13, 13, 1678, 822, 1243, 29918, 7323, 29898, 1311, 1125, 13, 4706, 9066, 353, 19345, 2558, 21533, 580, 13, 4706, 9066, 1839, 3051, 29899, 2848, 2033, 353, 29871, 29906, 29900, 13, 4706, 9066, 1839, 29883, 29949, 593, 296, 29899, 29873, 29979, 412, 2033, 353, 525, 726, 29914, 24595, 29915, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 7323, 877, 3051, 29899, 6513, 5477, 525, 29906, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 7323, 877, 3916, 29899, 1853, 5477, 525, 726, 29914, 24595, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 29889, 7323, 877, 16804, 29899, 27406, 742, 525, 5372, 1767, 5477, 13, 462, 308, 525, 5372, 1767, 1495, 13, 2 ]
src/data/preprocessors/__init__.py
paulwarkentin/tf-ssd-vgg
5
20928
## ## /src/data/preprocessors/__init__.py ## ## Created by <NAME> <<EMAIL>> on 15/07/2018. ## Updated by <NAME> <<EMAIL>> on 15/07/2018. ## from .bbox_preprocessor import BBoxPreprocessor from .default_preprocessor import DefaultPreprocessor from .image_preprocessor import ImagePreprocessor
[ 1, 444, 13, 2277, 847, 4351, 29914, 1272, 29914, 1457, 5014, 943, 29914, 1649, 2344, 26914, 2272, 13, 2277, 13, 2277, 6760, 630, 491, 529, 5813, 29958, 3532, 26862, 6227, 6778, 373, 29871, 29896, 29945, 29914, 29900, 29955, 29914, 29906, 29900, 29896, 29947, 29889, 13, 2277, 25723, 491, 529, 5813, 29958, 3532, 26862, 6227, 6778, 373, 29871, 29896, 29945, 29914, 29900, 29955, 29914, 29906, 29900, 29896, 29947, 29889, 13, 2277, 13, 13, 3166, 869, 29890, 1884, 29918, 1457, 26482, 1053, 350, 3313, 6572, 26482, 13, 3166, 869, 4381, 29918, 1457, 26482, 1053, 13109, 6572, 26482, 13, 3166, 869, 3027, 29918, 1457, 26482, 1053, 7084, 6572, 26482, 13, 2 ]
store/templatetags/diffsize.py
Wikidata/editgroups
11
1610395
from django import template from django.utils.html import escape from django.utils.safestring import mark_safe register = template.Library() @register.filter(is_safe=True) def diffsize(edit): if type(edit) == int: diffsize = edit else: diffsize = edit['newlength'] - edit['oldlength'] diffstr = '+{:,}'.format(diffsize) if diffsize > 0 else '{:,}'.format(diffsize) if diffsize >= 500: span = '<strong class="mw-plusminus-pos">%s</strong>' % diffstr elif diffsize > 0: span = '<span class="mw-plusminus-pos">%s</span>' % diffstr elif diffsize == 0: span = '<span>%s</span>' % diffstr elif diffsize > -500: span = '<span class="mw-plusminus-neg">%s</span>' % diffstr else: span = '<strong class="mw-plusminus-neg">%s</strong>' % diffstr return mark_safe(span)
[ 1, 515, 9557, 1053, 4472, 13, 3166, 9557, 29889, 13239, 29889, 1420, 1053, 10169, 13, 3166, 9557, 29889, 13239, 29889, 29879, 2142, 342, 5393, 1053, 2791, 29918, 11177, 13, 13, 9573, 353, 4472, 29889, 12284, 580, 13, 13, 29992, 9573, 29889, 4572, 29898, 275, 29918, 11177, 29922, 5574, 29897, 13, 1753, 2923, 2311, 29898, 5628, 1125, 13, 1678, 565, 1134, 29898, 5628, 29897, 1275, 938, 29901, 13, 4706, 2923, 2311, 353, 3863, 13, 1678, 1683, 29901, 13, 4706, 2923, 2311, 353, 3863, 1839, 1482, 2848, 2033, 448, 3863, 1839, 1025, 2848, 2033, 13, 1678, 2923, 710, 353, 525, 29974, 25641, 29892, 29913, 4286, 4830, 29898, 12765, 2311, 29897, 565, 2923, 2311, 1405, 29871, 29900, 1683, 22372, 29901, 29892, 29913, 4286, 4830, 29898, 12765, 2311, 29897, 13, 1678, 565, 2923, 2311, 6736, 29871, 29945, 29900, 29900, 29901, 13, 4706, 10638, 353, 12801, 1110, 770, 543, 29885, 29893, 29899, 11242, 12254, 29899, 1066, 1013, 29995, 29879, 829, 1110, 16299, 1273, 2923, 710, 13, 1678, 25342, 2923, 2311, 1405, 29871, 29900, 29901, 13, 4706, 10638, 353, 12801, 9653, 770, 543, 29885, 29893, 29899, 11242, 12254, 29899, 1066, 1013, 29995, 29879, 829, 9653, 16299, 1273, 2923, 710, 13, 1678, 25342, 2923, 2311, 1275, 29871, 29900, 29901, 13, 4706, 10638, 353, 12801, 9653, 29958, 29995, 29879, 829, 9653, 16299, 1273, 2923, 710, 13, 1678, 25342, 2923, 2311, 1405, 448, 29945, 29900, 29900, 29901, 13, 4706, 10638, 353, 12801, 9653, 770, 543, 29885, 29893, 29899, 11242, 12254, 29899, 10052, 1013, 29995, 29879, 829, 9653, 16299, 1273, 2923, 710, 13, 1678, 1683, 29901, 13, 4706, 10638, 353, 12801, 1110, 770, 543, 29885, 29893, 29899, 11242, 12254, 29899, 10052, 1013, 29995, 29879, 829, 1110, 16299, 1273, 2923, 710, 13, 1678, 736, 2791, 29918, 11177, 29898, 9653, 29897, 13, 2 ]
python/testData/resolve/multiFile/reimportExported/ReimportExported.py
jnthn/intellij-community
2
106041
<filename>python/testData/resolve/multiFile/reimportExported/ReimportExported.py import mypackage.foo mypackage.bar.dostuff() # <ref>
[ 1, 529, 9507, 29958, 4691, 29914, 1688, 1469, 29914, 17863, 29914, 9910, 2283, 29914, 276, 5215, 26382, 287, 29914, 1123, 5215, 26382, 287, 29889, 2272, 13, 5215, 590, 5113, 29889, 5431, 13, 13, 1357, 5113, 29889, 1646, 29889, 29881, 520, 3096, 580, 13, 29937, 795, 529, 999, 29958, 13, 2 ]
pokemon_go_hunter/watch_twitter.py
juharris/pokemon-go-hunter
0
120350
<filename>pokemon_go_hunter/watch_twitter.py import logging import os import re import time import twitter import yaml from pushbullet import Pushbullet def get_config(): config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../config.yaml') with open(config_path) as f: return yaml.load(f) def get_twitter_api(config): api_config = config['API'] twitter_api_config = api_config['Twitter'] return twitter.Api(consumer_key=twitter_api_config['consumer key'], consumer_secret=twitter_api_config['consumer secret'], access_token_key=twitter_api_config['access token key'], access_token_secret=twitter_api_config['access token secret']) def get_pushbullet_api(config): api_config = config['API'] pushbullet_api_config = api_config['Pushbullet'] return Pushbullet(api_key=pushbullet_api_config['api key'], encryption_password=pushbullet_api_config['encryption password']) def get_pushbullet_device(pb, config): devices = pb.devices result = None for d in devices: if d.nickname == config['API']['Pushbullet']['device name']: result = d assert result is not None, "Couldn't find Pushbullet device." return result _config = get_config() _twitter_api = get_twitter_api(_config) _pb = get_pushbullet_api(_config) _device = get_pushbullet_device(_pb, _config) def main(screen_name: str, pattern, callback, period_s: int = 61): logging.info("Waiting for tweets.") since_id = None while True: try: statuses = _twitter_api.GetUserTimeline(screen_name=screen_name, since_id=since_id, trim_user=True) except: logging.exception("Error getting tweets.") time.sleep(period_s / 4) continue for status in statuses: if since_id is None: since_id = status.id else: since_id = max(since_id, status.id) text = status.text m = pattern.search(text) logging.debug(text) if m: try: callback(status) except: logging.exception("Callback failed.") time.sleep(period_s) def notify(status): text = status.text for url in status.urls: text = text.replace(url.url, url.expanded_url) logging.info("Sending: \"%s\".", text) _pb.push_sms(_device, 'TODO', text) if __name__ == '__main__': logging.basicConfig(format='%(asctime)s [%(levelname)s] - %(name)s:%(filename)s:%(funcName)s\n%(message)s', level=logging.INFO) # TODO Read from config. # Example. main(screen_name='montrealpokemap', pattern=re.compile(r'\b(Unown)\b', re.IGNORECASE), callback=notify)
[ 1, 529, 9507, 29958, 29886, 554, 9857, 29918, 1484, 29918, 29882, 8428, 29914, 12344, 29918, 24946, 29889, 2272, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 337, 13, 5215, 931, 13, 13, 5215, 23394, 13, 5215, 343, 8807, 13, 3166, 5503, 18850, 1053, 349, 1878, 18850, 13, 13, 13, 1753, 679, 29918, 2917, 7295, 13, 1678, 2295, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 22168, 1445, 1649, 8243, 525, 6995, 2917, 29889, 25162, 1495, 13, 1678, 411, 1722, 29898, 2917, 29918, 2084, 29897, 408, 285, 29901, 13, 4706, 736, 343, 8807, 29889, 1359, 29898, 29888, 29897, 13, 13, 13, 1753, 679, 29918, 24946, 29918, 2754, 29898, 2917, 1125, 13, 1678, 7882, 29918, 2917, 353, 2295, 1839, 8787, 2033, 13, 1678, 23394, 29918, 2754, 29918, 2917, 353, 7882, 29918, 2917, 1839, 27418, 5171, 2033, 13, 1678, 736, 23394, 29889, 11713, 29898, 25978, 261, 29918, 1989, 29922, 24946, 29918, 2754, 29918, 2917, 1839, 25978, 261, 1820, 7464, 13, 462, 539, 21691, 29918, 19024, 29922, 24946, 29918, 2754, 29918, 2917, 1839, 25978, 261, 7035, 7464, 13, 462, 539, 2130, 29918, 6979, 29918, 1989, 29922, 24946, 29918, 2754, 29918, 2917, 1839, 5943, 5993, 1820, 7464, 13, 462, 539, 2130, 29918, 6979, 29918, 19024, 29922, 24946, 29918, 2754, 29918, 2917, 1839, 5943, 5993, 7035, 11287, 13, 13, 13, 1753, 679, 29918, 5910, 18850, 29918, 2754, 29898, 2917, 1125, 13, 1678, 7882, 29918, 2917, 353, 2295, 1839, 8787, 2033, 13, 1678, 5503, 18850, 29918, 2754, 29918, 2917, 353, 7882, 29918, 2917, 1839, 27031, 18850, 2033, 13, 1678, 736, 349, 1878, 18850, 29898, 2754, 29918, 1989, 29922, 5910, 18850, 29918, 2754, 29918, 2917, 1839, 2754, 1820, 7464, 13, 462, 418, 20956, 29918, 5630, 29922, 5910, 18850, 29918, 2754, 29918, 2917, 1839, 3977, 14272, 4800, 11287, 13, 13, 13, 1753, 679, 29918, 5910, 18850, 29918, 10141, 29898, 24381, 29892, 2295, 1125, 13, 1678, 9224, 353, 282, 29890, 29889, 3359, 1575, 13, 1678, 1121, 353, 6213, 13, 1678, 363, 270, 297, 9224, 29901, 13, 4706, 565, 270, 29889, 19254, 978, 1275, 2295, 1839, 8787, 16215, 27031, 18850, 16215, 10141, 1024, 2033, 29901, 13, 9651, 1121, 353, 270, 13, 1678, 4974, 1121, 338, 451, 6213, 29892, 376, 23323, 29876, 29915, 29873, 1284, 349, 1878, 18850, 4742, 1213, 13, 1678, 736, 1121, 13, 13, 13, 29918, 2917, 353, 679, 29918, 2917, 580, 13, 29918, 24946, 29918, 2754, 353, 679, 29918, 24946, 29918, 2754, 7373, 2917, 29897, 13, 29918, 24381, 353, 679, 29918, 5910, 18850, 29918, 2754, 7373, 2917, 29897, 13, 29918, 10141, 353, 679, 29918, 5910, 18850, 29918, 10141, 7373, 24381, 29892, 903, 2917, 29897, 13, 13, 13, 1753, 1667, 29898, 10525, 29918, 978, 29901, 851, 29892, 13, 308, 4766, 29892, 13, 308, 6939, 29892, 13, 308, 3785, 29918, 29879, 29901, 938, 353, 29871, 29953, 29896, 1125, 13, 1678, 12183, 29889, 3888, 703, 15716, 292, 363, 7780, 1691, 23157, 13, 1678, 1951, 29918, 333, 353, 6213, 13, 1678, 1550, 5852, 29901, 13, 4706, 1018, 29901, 13, 9651, 4660, 267, 353, 903, 24946, 29918, 2754, 29889, 2577, 2659, 13711, 5570, 29898, 10525, 29918, 978, 29922, 10525, 29918, 978, 29892, 13, 462, 462, 462, 1678, 1951, 29918, 333, 29922, 16076, 29918, 333, 29892, 13, 462, 462, 462, 1678, 17151, 29918, 1792, 29922, 5574, 29897, 13, 4706, 5174, 29901, 13, 9651, 12183, 29889, 11739, 703, 2392, 2805, 7780, 1691, 23157, 13, 9651, 931, 29889, 17059, 29898, 19145, 29918, 29879, 847, 29871, 29946, 29897, 13, 9651, 6773, 13, 13, 4706, 363, 4660, 297, 4660, 267, 29901, 13, 9651, 565, 1951, 29918, 333, 338, 6213, 29901, 13, 18884, 1951, 29918, 333, 353, 4660, 29889, 333, 13, 9651, 1683, 29901, 13, 18884, 1951, 29918, 333, 353, 4236, 29898, 16076, 29918, 333, 29892, 4660, 29889, 333, 29897, 13, 13, 9651, 1426, 353, 4660, 29889, 726, 13, 9651, 286, 353, 4766, 29889, 4478, 29898, 726, 29897, 13, 9651, 12183, 29889, 8382, 29898, 726, 29897, 13, 9651, 565, 286, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 6939, 29898, 4882, 29897, 13, 18884, 5174, 29901, 13, 462, 1678, 12183, 29889, 11739, 703, 10717, 5229, 23157, 13, 13, 4706, 931, 29889, 17059, 29898, 19145, 29918, 29879, 29897, 13, 13, 13, 1753, 26051, 29898, 4882, 1125, 13, 1678, 1426, 353, 4660, 29889, 726, 13, 1678, 363, 3142, 297, 4660, 29889, 26045, 29901, 13, 4706, 1426, 353, 1426, 29889, 6506, 29898, 2271, 29889, 2271, 29892, 3142, 29889, 18837, 287, 29918, 2271, 29897, 13, 1678, 12183, 29889, 3888, 703, 29903, 2548, 29901, 13218, 29995, 29879, 29905, 1642, 613, 1426, 29897, 13, 1678, 903, 24381, 29889, 5910, 29918, 29879, 1516, 7373, 10141, 29892, 525, 4986, 3970, 742, 1426, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 12183, 29889, 16121, 3991, 29898, 4830, 2433, 29995, 29898, 294, 312, 603, 29897, 29879, 518, 29995, 29898, 5563, 978, 29897, 29879, 29962, 448, 1273, 29898, 978, 29897, 29879, 16664, 29898, 9507, 29897, 29879, 16664, 29898, 9891, 1170, 29897, 29879, 29905, 29876, 29995, 29898, 4906, 29897, 29879, 742, 13, 462, 4706, 3233, 29922, 21027, 29889, 11690, 29897, 13, 1678, 396, 14402, 7523, 515, 2295, 29889, 13, 1678, 396, 8741, 29889, 13, 1678, 1667, 29898, 10525, 29918, 978, 2433, 14132, 6370, 29886, 554, 331, 481, 742, 13, 308, 4766, 29922, 276, 29889, 12198, 29898, 29878, 12764, 29890, 29898, 2525, 776, 2144, 29890, 742, 337, 29889, 6259, 6632, 1525, 23487, 511, 13, 308, 6939, 29922, 25140, 29897, 13, 2 ]
scvelo/tools/utils.py
gokceneraslan/scvelo
0
137772
<filename>scvelo/tools/utils.py from scipy.sparse import csr_matrix, issparse import matplotlib.pyplot as pl import pandas as pd import numpy as np import warnings warnings.simplefilter("ignore") def round(k, dec=2, as_str=None): if isinstance(k, (list, tuple, np.record, np.ndarray)): return [round(ki, dec) for ki in k] if "e" in f"{k}": k_str = f"{k}".split("e") result = f"{np.round(np.float(k_str[0]), dec)}1e{k_str[1]}" return f"{result}" if as_str else np.float(result) result = np.round(np.float(k), dec) return f"{result}" if as_str else result def mean(x, axis=0): return x.mean(axis).A1 if issparse(x) else x.mean(axis) def make_dense(X): XA = X.A if issparse(X) and X.ndim == 2 else X.A1 if issparse(X) else X if XA.ndim == 2: XA = XA[0] if XA.shape[0] == 1 else XA[:, 0] if XA.shape[1] == 1 else XA return np.array(XA) def sum_obs(A): """summation over axis 0 (obs) equivalent to np.sum(A, 0)""" if issparse(A): return A.sum(0).A1 else: return np.einsum("ij -> j", A) if A.ndim > 1 else np.sum(A) def sum_var(A): """summation over axis 1 (var) equivalent to np.sum(A, 1)""" if issparse(A): return A.sum(1).A1 else: return np.sum(A, axis=1) if A.ndim > 1 else np.sum(A) def prod_sum_obs(A, B): """dot product and sum over axis 0 (obs) equivalent to np.sum(A * B, 0)""" if issparse(A): return A.multiply(B).sum(0).A1 else: return np.einsum("ij, ij -> j", A, B) if A.ndim > 1 else (A * B).sum() def prod_sum_var(A, B): """dot product and sum over axis 1 (var) equivalent to np.sum(A * B, 1)""" if issparse(A): return A.multiply(B).sum(1).A1 else: return np.einsum("ij, ij -> i", A, B) if A.ndim > 1 else (A * B).sum() def norm(A): """computes the L2-norm along axis 1 (e.g. genes or embedding dimensions) equivalent to np.linalg.norm(A, axis=1) """ if issparse(A): return np.sqrt(A.multiply(A).sum(1).A1) else: return np.sqrt(np.einsum("ij, ij -> i", A, A) if A.ndim > 1 else np.sum(A * A)) def vector_norm(x): """computes the L2-norm along axis 1 (e.g. genes or embedding dimensions) equivalent to np.linalg.norm(A, axis=1) """ return np.sqrt(np.einsum("i, i -> ", x, x)) def R_squared(residual, total): with warnings.catch_warnings(): warnings.simplefilter("ignore") r2 = np.ones(residual.shape[1]) - prod_sum_obs( residual, residual ) / prod_sum_obs(total, total) r2[np.isnan(r2)] = 0 return r2 def cosine_correlation(dX, Vi): dx = dX - dX.mean(-1)[:, None] Vi_norm = vector_norm(Vi) with warnings.catch_warnings(): warnings.simplefilter("ignore") if Vi_norm == 0: result = np.zeros(dx.shape[0]) else: result = np.einsum("ij, j", dx, Vi) / (norm(dx) * Vi_norm)[None, :] return result def normalize(X): with warnings.catch_warnings(): warnings.simplefilter("ignore") if issparse(X): return X.multiply(csr_matrix(1.0 / np.abs(X).sum(1))) else: return X / X.sum(1) def scale(X, min=0, max=1): idx = np.isfinite(X) if any(idx): X = X - X[idx].min() + min xmax = X[idx].max() X = X / xmax * max if xmax != 0 else X * max return X def get_indices(dist, n_neighbors=None, mode_neighbors="distances"): from ..preprocessing.neighbors import compute_connectivities_umap D = dist.copy() D.data += 1e-6 n_counts = sum_var(D > 0) n_neighbors = ( n_counts.min() if n_neighbors is None else min(n_counts.min(), n_neighbors) ) rows = np.where(n_counts > n_neighbors)[0] cumsum_neighs = np.insert(n_counts.cumsum(), 0, 0) dat = D.data for row in rows: n0, n1 = cumsum_neighs[row], cumsum_neighs[row + 1] rm_idx = n0 + dat[n0:n1].argsort()[n_neighbors:] dat[rm_idx] = 0 D.eliminate_zeros() D.data -= 1e-6 if mode_neighbors == "distances": indices = D.indices.reshape((-1, n_neighbors)) elif mode_neighbors == "connectivities": knn_indices = D.indices.reshape((-1, n_neighbors)) knn_distances = D.data.reshape((-1, n_neighbors)) _, conn = compute_connectivities_umap( knn_indices, knn_distances, D.shape[0], n_neighbors ) indices = get_indices_from_csr(conn) return indices, D def get_indices_from_csr(conn): # extracts indices from connectivity matrix, pads with nans ixs = np.ones((conn.shape[0], np.max((conn > 0).sum(1)))) * np.nan for i in range(ixs.shape[0]): cell_indices = conn[i, :].indices ixs[i, : len(cell_indices)] = cell_indices return ixs def get_iterative_indices( indices, index, n_recurse_neighbors=2, max_neighs=None, ): def iterate_indices(indices, index, n_recurse_neighbors): if n_recurse_neighbors > 1: index = iterate_indices(indices, index, n_recurse_neighbors - 1) ix = np.append(index, indices[index]) # direct and indirect neighbors if np.isnan(ix).any(): ix = ix[~np.isnan(ix)] return ix.astype(int) indices = np.unique(iterate_indices(indices, index, n_recurse_neighbors)) if max_neighs is not None and len(indices) > max_neighs: indices = np.random.choice(indices, max_neighs, replace=False) return indices def geometric_matrix_sum(C, n_power=2): # computes C + C^2 + C^3 + ... C_n = ( geometric_matrix_sum(C, n_power - 1) if n_power > 2 else C if n_power > 1 else 0 ) return C + C.dot(C_n) def groups_to_bool(adata, groups, groupby=None): groups = [groups] if isinstance(groups, str) else groups if isinstance(groups, (list, tuple, np.ndarray, np.record)): groupby = ( groupby if groupby in adata.obs.keys() else "clusters" if "clusters" in adata.obs.keys() else "louvain" if "louvain" in adata.obs.keys() else None ) if groupby is not None: groups = np.array([key in groups for key in adata.obs[groupby]]) else: raise ValueError("groupby attribute not valid.") return groups def most_common_in_list(lst): lst = [item for item in lst if item is not np.nan and item != "nan"] lst = list(lst) return max(set(lst), key=lst.count) def randomized_velocity(adata, vkey="velocity", add_key="velocity_random"): V_rnd = adata.layers[vkey].copy() for i in range(V_rnd.shape[1]): np.random.shuffle(V_rnd[:, i]) V_rnd[:, i] = V_rnd[:, i] * np.random.choice( np.array([+1, -1]), size=V_rnd.shape[0] ) adata.layers[add_key] = V_rnd from .velocity_graph import velocity_graph from .velocity_embedding import velocity_embedding velocity_graph(adata, vkey=add_key) velocity_embedding(adata, vkey=add_key, autoscale=False) def extract_int_from_str(array): def str_to_int(item): num = "".join(filter(str.isdigit, item)) num = int(num) if len(num) > 0 else -1 return num if isinstance(array, str): nums = str_to_int(array) elif len(array) > 1 and isinstance(array[0], str): nums = [] for item in array: nums.append(str_to_int(item)) else: nums = array nums = pd.Categorical(nums) if array.dtype == "category" else np.array(nums) return nums def strings_to_categoricals(adata): """Transform string annotations to categoricals.""" from pandas.api.types import is_string_dtype, is_integer_dtype, is_bool_dtype from pandas import Categorical def is_valid_dtype(values): return ( is_string_dtype(values) or is_integer_dtype(values) or is_bool_dtype(values) ) df = adata.obs df_keys = [key for key in df.columns if is_valid_dtype(df[key])] for key in df_keys: c = df[key] c = Categorical(c) if 1 < len(c.categories) < min(len(c), 100): df[key] = c df = adata.var df_keys = [key for key in df.columns if is_string_dtype(df[key])] for key in df_keys: c = df[key].astype("U") c = Categorical(c) if 1 < len(c.categories) < min(len(c), 100): df[key] = c def merge_groups(adata, key, map_groups, key_added=None, map_colors=None): strings_to_categoricals(adata) if len(map_groups) != len(adata.obs[key].cat.categories): map_coarse = {} for c in adata.obs[key].cat.categories: for group in map_groups: if any(cluster == c for cluster in map_groups[group]): map_coarse[c] = group if c not in map_coarse: map_coarse[c] = c map_groups = map_coarse if key_added is None: key_added = f"{key}_coarse" from pandas.api.types import CategoricalDtype adata.obs[key_added] = adata.obs[key].map(map_groups).astype(CategoricalDtype()) old_categories = adata.obs[key].cat.categories new_categories = adata.obs[key_added].cat.categories # map_colors is passed if map_colors is not None: old_colors = None if f"{key}_colors" in adata.uns: old_colors = adata.uns[f"{key}_colors"] new_colors = [] for group in adata.obs[key_added].cat.categories: if group in map_colors: new_colors.append(map_colors[group]) elif group in old_categories and old_colors is not None: new_colors.append(old_colors[old_categories.get_loc(group)]) else: raise ValueError(f"You didn't specify a color for {group}.") adata.uns[f"{key_added}_colors"] = new_colors # map_colors is not passed elif f"{key}_colors" in adata.uns: old_colors = adata.uns[f"{key}_colors"] inverse_map_groups = {g: [] for g in new_categories} for old_group in old_categories: inverse_map_groups[map_groups[old_group]].append(old_group) new_colors = [] for group in new_categories: # take the largest of the old groups old_group = ( adata.obs[key][adata.obs[key].isin(inverse_map_groups[group])] .value_counts() .index[0] ) new_colors.append(old_colors[old_categories.get_loc(old_group)]) adata.uns[f"{key_added}_colors"] = new_colors def cutoff_small_velocities( adata, vkey="velocity", key_added="velocity_cut", frac_of_max=0.5, use_raw=False ): x = adata.layers["spliced"] if use_raw else adata.layers["Ms"] y = adata.layers["unspliced"] if use_raw else adata.layers["Mu"] x_max = x.max(0).A[0] if issparse(x) else x.max(0) y_max = y.max(0).A[0] if issparse(y) else y.max(0) xy_norm = x / np.clip(x_max, 1e-3, None) + y / np.clip(y_max, 1e-3, None) W = xy_norm >= np.percentile(xy_norm, 98, axis=0) * frac_of_max adata.layers[key_added] = csr_matrix(W).multiply(adata.layers[vkey]).tocsr() from .velocity_graph import velocity_graph from .velocity_embedding import velocity_embedding velocity_graph(adata, vkey=key_added, approx=True) velocity_embedding(adata, vkey=key_added) def make_unique_list(key, allow_array=False): from pandas import unique, Index if isinstance(key, Index): key = key.tolist() is_list = ( isinstance(key, (list, tuple, np.record)) if allow_array else isinstance(key, (list, tuple, np.ndarray, np.record)) ) is_list_of_str = is_list and all(isinstance(item, str) for item in key) return ( unique(key) if is_list_of_str else key if is_list and len(key) < 20 else [key] ) def test_bimodality(x, bins=30, kde=True, plot=False): """Test for bimodal distribution.""" from scipy.stats import gaussian_kde, norm lb, ub = np.min(x), np.percentile(x, 99.9) grid = np.linspace(lb, ub if ub <= lb else np.max(x), bins) kde_grid = ( gaussian_kde(x)(grid) if kde else np.histogram(x, bins=grid, density=True)[0] ) idx = int(bins / 2) - 2 idx += np.argmin(kde_grid[idx : idx + 4]) peak_0 = kde_grid[:idx].argmax() peak_1 = kde_grid[idx:].argmax() kde_peak = kde_grid[idx:][ peak_1 ] # min(kde_grid[:idx][peak_0], kde_grid[idx:][peak_1]) kde_mid = kde_grid[idx:].mean() # kde_grid[idx] t_stat = (kde_peak - kde_mid) / np.clip(np.std(kde_grid) / np.sqrt(bins), 1, None) p_val = norm.sf(t_stat) grid_0 = grid[:idx] grid_1 = grid[idx:] means = [ (grid_0[peak_0] + grid_0[min(peak_0 + 1, len(grid_0) - 1)]) / 2, (grid_1[peak_1] + grid_1[min(peak_1 + 1, len(grid_1) - 1)]) / 2, ] if plot: color = "grey" if kde: pl.plot(grid, kde_grid, color=color) pl.fill_between(grid, 0, kde_grid, alpha=0.4, color=color) else: pl.hist(x, bins=grid, alpha=0.4, density=True, color=color) pl.axvline(means[0], color=color) pl.axvline(means[1], color=color) pl.axhline(kde_mid, alpha=0.2, linestyle="--", color=color) pl.show() return t_stat, p_val, means # ~ t_test (reject unimodality if t_stat > 3) def random_subsample(adata, fraction=0.1, return_subset=False, copy=False): adata_sub = adata.copy() if copy else adata p, size = fraction, adata.n_obs subset = np.random.choice([True, False], size=size, p=[p, 1 - p]) adata_sub._inplace_subset_obs(subset) return adata_sub if copy else subset if return_subset else None def get_duplicates(array): from collections import Counter return np.array([item for (item, count) in Counter(array).items() if count > 1]) def corrcoef(x, y, mode="pearsons"): from scipy.stats import pearsonr, spearmanr corr, _ = spearmanr(x, y) if mode == "spearmans" else pearsonr(x, y) return corr def vcorrcoef(X, y, mode="pearsons", axis=-1): """Pearsons/Spearmans correlation coefficients. Use Pearsons / Spearmans to test for linear / monotonic relationship. Arguments ---------- X: `np.ndarray` Data vector or matrix y: `np.ndarray` Data vector or matrix mode: 'pearsons' or 'spearmans' (default: `'pearsons'`) Which correlation metric to use. """ if issparse(X): X = np.array(X.A) if issparse(y): y = np.array(y.A) if axis == 0: if X.ndim > 1: X = np.array(X.T) if y.ndim > 1: y = np.array(y.T) if X.shape[axis] != y.shape[axis]: X = X.T if mode in {"spearmans", "spearman"}: from scipy.stats.stats import rankdata X = np.apply_along_axis(rankdata, axis=-1, arr=X) y = np.apply_along_axis(rankdata, axis=-1, arr=y) Xm = np.array(X - (np.nanmean(X, -1)[:, None] if X.ndim > 1 else np.nanmean(X, -1))) ym = np.array(y - (np.nanmean(y, -1)[:, None] if y.ndim > 1 else np.nanmean(y, -1))) corr = np.nansum(Xm * ym, -1) / np.sqrt( np.nansum(Xm ** 2, -1) * np.nansum(ym ** 2, -1) ) return corr def isin(x, y): return np.array(pd.DataFrame(x).isin(y)).flatten() def indices_to_bool(indices, n): return isin(np.arange(n), indices) def convolve(adata, x): from ..preprocessing.neighbors import get_connectivities conn = get_connectivities(adata) if isinstance(x, str) and x in adata.layers.keys(): x = adata.layers[x] if x.ndim == 1: return conn.dot(x) idx_valid = ~np.isnan(x.sum(0)) Y = np.ones(x.shape) * np.nan Y[:, idx_valid] = conn.dot(x[:, idx_valid]) return Y def get_extrapolated_state(adata, vkey="velocity", dt=1, use_raw=None, dropna=True): """Get extrapolated cell state.""" S = adata.layers["spliced" if use_raw else "Ms"] if dropna: St = S + dt * adata.layers[vkey] St = St[:, np.isfinite(np.sum(St, 0))] else: St = S + dt * np.nan_to_num(adata.layers[vkey]) return St def get_plasticity_score(adata): idx_top_genes = np.argsort(adata.var["gene_count_corr"].values)[::-1][:200] Ms = np.array(adata.layers["Ms"][:, idx_top_genes]) return scale(np.mean(Ms / np.max(Ms, axis=0), axis=1))
[ 1, 529, 9507, 29958, 1557, 955, 29877, 29914, 8504, 29914, 13239, 29889, 2272, 13, 3166, 4560, 2272, 29889, 29879, 5510, 1053, 5939, 29878, 29918, 5344, 29892, 1721, 5510, 13, 5215, 22889, 29889, 2272, 5317, 408, 715, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 18116, 13, 13, 25442, 886, 29889, 12857, 4572, 703, 17281, 1159, 13, 13, 13, 1753, 4513, 29898, 29895, 29892, 1602, 29922, 29906, 29892, 408, 29918, 710, 29922, 8516, 1125, 13, 1678, 565, 338, 8758, 29898, 29895, 29892, 313, 1761, 29892, 18761, 29892, 7442, 29889, 11651, 29892, 7442, 29889, 299, 2378, 22164, 13, 4706, 736, 518, 14486, 29898, 1984, 29892, 1602, 29897, 363, 8506, 297, 413, 29962, 13, 1678, 565, 376, 29872, 29908, 297, 285, 29908, 29912, 29895, 29913, 1115, 13, 4706, 413, 29918, 710, 353, 285, 29908, 29912, 29895, 29913, 1642, 5451, 703, 29872, 1159, 13, 4706, 1121, 353, 285, 29908, 29912, 9302, 29889, 14486, 29898, 9302, 29889, 7411, 29898, 29895, 29918, 710, 29961, 29900, 11724, 1602, 2915, 29896, 29872, 29912, 29895, 29918, 710, 29961, 29896, 29962, 5038, 13, 4706, 736, 285, 29908, 29912, 2914, 5038, 565, 408, 29918, 710, 1683, 7442, 29889, 7411, 29898, 2914, 29897, 13, 1678, 1121, 353, 7442, 29889, 14486, 29898, 9302, 29889, 7411, 29898, 29895, 511, 1602, 29897, 13, 1678, 736, 285, 29908, 29912, 2914, 5038, 565, 408, 29918, 710, 1683, 1121, 13, 13, 13, 1753, 2099, 29898, 29916, 29892, 9685, 29922, 29900, 1125, 13, 1678, 736, 921, 29889, 12676, 29898, 8990, 467, 29909, 29896, 565, 1721, 5510, 29898, 29916, 29897, 1683, 921, 29889, 12676, 29898, 8990, 29897, 13, 13, 13, 1753, 1207, 29918, 1145, 344, 29898, 29990, 1125, 13, 1678, 1060, 29909, 353, 1060, 29889, 29909, 565, 1721, 5510, 29898, 29990, 29897, 322, 1060, 29889, 299, 326, 1275, 29871, 29906, 1683, 1060, 29889, 29909, 29896, 565, 1721, 5510, 29898, 29990, 29897, 1683, 1060, 13, 1678, 565, 1060, 29909, 29889, 299, 326, 1275, 29871, 29906, 29901, 13, 4706, 1060, 29909, 353, 1060, 29909, 29961, 29900, 29962, 565, 1060, 29909, 29889, 12181, 29961, 29900, 29962, 1275, 29871, 29896, 1683, 1060, 29909, 7503, 29892, 29871, 29900, 29962, 565, 1060, 29909, 29889, 12181, 29961, 29896, 29962, 1275, 29871, 29896, 1683, 1060, 29909, 13, 1678, 736, 7442, 29889, 2378, 29898, 29990, 29909, 29897, 13, 13, 13, 1753, 2533, 29918, 26290, 29898, 29909, 1125, 13, 1678, 9995, 2083, 29885, 362, 975, 9685, 29871, 29900, 313, 26290, 29897, 7126, 304, 7442, 29889, 2083, 29898, 29909, 29892, 29871, 29900, 5513, 15945, 13, 1678, 565, 1721, 5510, 29898, 29909, 1125, 13, 4706, 736, 319, 29889, 2083, 29898, 29900, 467, 29909, 29896, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 29872, 1144, 398, 703, 823, 1599, 432, 613, 319, 29897, 565, 319, 29889, 299, 326, 1405, 29871, 29896, 1683, 7442, 29889, 2083, 29898, 29909, 29897, 13, 13, 13, 1753, 2533, 29918, 1707, 29898, 29909, 1125, 13, 1678, 9995, 2083, 29885, 362, 975, 9685, 29871, 29896, 313, 1707, 29897, 7126, 304, 7442, 29889, 2083, 29898, 29909, 29892, 29871, 29896, 5513, 15945, 13, 1678, 565, 1721, 5510, 29898, 29909, 1125, 13, 4706, 736, 319, 29889, 2083, 29898, 29896, 467, 29909, 29896, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 2083, 29898, 29909, 29892, 9685, 29922, 29896, 29897, 565, 319, 29889, 299, 326, 1405, 29871, 29896, 1683, 7442, 29889, 2083, 29898, 29909, 29897, 13, 13, 13, 1753, 11859, 29918, 2083, 29918, 26290, 29898, 29909, 29892, 350, 1125, 13, 1678, 9995, 6333, 3234, 322, 2533, 975, 9685, 29871, 29900, 313, 26290, 29897, 7126, 304, 7442, 29889, 2083, 29898, 29909, 334, 350, 29892, 29871, 29900, 5513, 15945, 13, 1678, 565, 1721, 5510, 29898, 29909, 1125, 13, 4706, 736, 319, 29889, 18056, 368, 29898, 29933, 467, 2083, 29898, 29900, 467, 29909, 29896, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 29872, 1144, 398, 703, 823, 29892, 474, 29926, 1599, 432, 613, 319, 29892, 350, 29897, 565, 319, 29889, 299, 326, 1405, 29871, 29896, 1683, 313, 29909, 334, 350, 467, 2083, 580, 13, 13, 13, 1753, 11859, 29918, 2083, 29918, 1707, 29898, 29909, 29892, 350, 1125, 13, 1678, 9995, 6333, 3234, 322, 2533, 975, 9685, 29871, 29896, 313, 1707, 29897, 7126, 304, 7442, 29889, 2083, 29898, 29909, 334, 350, 29892, 29871, 29896, 5513, 15945, 13, 1678, 565, 1721, 5510, 29898, 29909, 1125, 13, 4706, 736, 319, 29889, 18056, 368, 29898, 29933, 467, 2083, 29898, 29896, 467, 29909, 29896, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 29872, 1144, 398, 703, 823, 29892, 474, 29926, 1599, 474, 613, 319, 29892, 350, 29897, 565, 319, 29889, 299, 326, 1405, 29871, 29896, 1683, 313, 29909, 334, 350, 467, 2083, 580, 13, 13, 13, 1753, 6056, 29898, 29909, 1125, 13, 1678, 9995, 12097, 267, 278, 365, 29906, 29899, 12324, 3412, 9685, 29871, 29896, 13, 1678, 313, 29872, 29889, 29887, 29889, 2531, 267, 470, 23655, 13391, 29897, 7126, 304, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29909, 29892, 9685, 29922, 29896, 29897, 13, 1678, 9995, 13, 1678, 565, 1721, 5510, 29898, 29909, 1125, 13, 4706, 736, 7442, 29889, 3676, 29898, 29909, 29889, 18056, 368, 29898, 29909, 467, 2083, 29898, 29896, 467, 29909, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 7442, 29889, 3676, 29898, 9302, 29889, 29872, 1144, 398, 703, 823, 29892, 474, 29926, 1599, 474, 613, 319, 29892, 319, 29897, 565, 319, 29889, 299, 326, 1405, 29871, 29896, 1683, 7442, 29889, 2083, 29898, 29909, 334, 319, 876, 13, 13, 13, 1753, 4608, 29918, 12324, 29898, 29916, 1125, 13, 1678, 9995, 12097, 267, 278, 365, 29906, 29899, 12324, 3412, 9685, 29871, 29896, 13, 1678, 313, 29872, 29889, 29887, 29889, 2531, 267, 470, 23655, 13391, 29897, 7126, 304, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29909, 29892, 9685, 29922, 29896, 29897, 13, 1678, 9995, 13, 1678, 736, 7442, 29889, 3676, 29898, 9302, 29889, 29872, 1144, 398, 703, 29875, 29892, 474, 1599, 9162, 921, 29892, 921, 876, 13, 13, 13, 1753, 390, 29918, 26613, 1965, 29898, 690, 333, 950, 29892, 3001, 1125, 13, 1678, 411, 18116, 29889, 12510, 29918, 25442, 886, 7295, 13, 4706, 18116, 29889, 12857, 4572, 703, 17281, 1159, 13, 4706, 364, 29906, 353, 7442, 29889, 2873, 29898, 690, 333, 950, 29889, 12181, 29961, 29896, 2314, 448, 11859, 29918, 2083, 29918, 26290, 29898, 13, 9651, 10995, 950, 29892, 10995, 950, 13, 4706, 1723, 847, 11859, 29918, 2083, 29918, 26290, 29898, 7827, 29892, 3001, 29897, 13, 1678, 364, 29906, 29961, 9302, 29889, 275, 13707, 29898, 29878, 29906, 4638, 353, 29871, 29900, 13, 1678, 736, 364, 29906, 13, 13, 13, 1753, 6776, 457, 29918, 2616, 23445, 29898, 29881, 29990, 29892, 10630, 1125, 13, 1678, 15414, 353, 270, 29990, 448, 270, 29990, 29889, 12676, 6278, 29896, 29897, 7503, 29892, 6213, 29962, 13, 1678, 10630, 29918, 12324, 353, 4608, 29918, 12324, 29898, 29963, 29875, 29897, 13, 1678, 411, 18116, 29889, 12510, 29918, 25442, 886, 7295, 13, 4706, 18116, 29889, 12857, 4572, 703, 17281, 1159, 13, 4706, 565, 10630, 29918, 12324, 1275, 29871, 29900, 29901, 13, 9651, 1121, 353, 7442, 29889, 3298, 359, 29898, 8235, 29889, 12181, 29961, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 1121, 353, 7442, 29889, 29872, 1144, 398, 703, 823, 29892, 432, 613, 15414, 29892, 10630, 29897, 847, 313, 12324, 29898, 8235, 29897, 334, 10630, 29918, 12324, 9601, 8516, 29892, 584, 29962, 13, 1678, 736, 1121, 13, 13, 13, 1753, 4226, 675, 29898, 29990, 1125, 13, 1678, 411, 18116, 29889, 12510, 29918, 25442, 886, 7295, 13, 4706, 18116, 29889, 12857, 4572, 703, 17281, 1159, 13, 4706, 565, 1721, 5510, 29898, 29990, 1125, 13, 9651, 736, 1060, 29889, 18056, 368, 29898, 2395, 29878, 29918, 5344, 29898, 29896, 29889, 29900, 847, 7442, 29889, 6897, 29898, 29990, 467, 2083, 29898, 29896, 4961, 13, 4706, 1683, 29901, 13, 9651, 736, 1060, 847, 1060, 29889, 2083, 29898, 29896, 29897, 13, 13, 13, 1753, 6287, 29898, 29990, 29892, 1375, 29922, 29900, 29892, 4236, 29922, 29896, 1125, 13, 1678, 22645, 353, 7442, 29889, 4492, 262, 568, 29898, 29990, 29897, 13, 1678, 565, 738, 29898, 13140, 1125, 13, 4706, 1060, 353, 1060, 448, 1060, 29961, 13140, 1822, 1195, 580, 718, 1375, 13, 4706, 921, 3317, 353, 1060, 29961, 13140, 1822, 3317, 580, 13, 4706, 1060, 353, 1060, 847, 921, 3317, 334, 4236, 565, 921, 3317, 2804, 29871, 29900, 1683, 1060, 334, 4236, 13, 1678, 736, 1060, 13, 13, 13, 1753, 679, 29918, 513, 1575, 29898, 5721, 29892, 302, 29918, 484, 1141, 29890, 943, 29922, 8516, 29892, 4464, 29918, 484, 1141, 29890, 943, 543, 5721, 2925, 29908, 1125, 13, 1678, 515, 6317, 1457, 19170, 29889, 484, 1141, 29890, 943, 1053, 10272, 29918, 6915, 440, 1907, 29918, 398, 481, 13, 13, 1678, 360, 353, 1320, 29889, 8552, 580, 13, 1678, 360, 29889, 1272, 4619, 29871, 29896, 29872, 29899, 29953, 13, 13, 1678, 302, 29918, 2798, 29879, 353, 2533, 29918, 1707, 29898, 29928, 1405, 29871, 29900, 29897, 13, 1678, 302, 29918, 484, 1141, 29890, 943, 353, 313, 13, 4706, 302, 29918, 2798, 29879, 29889, 1195, 580, 565, 302, 29918, 484, 1141, 29890, 943, 338, 6213, 1683, 1375, 29898, 29876, 29918, 2798, 29879, 29889, 1195, 3285, 302, 29918, 484, 1141, 29890, 943, 29897, 13, 1678, 1723, 13, 1678, 4206, 353, 7442, 29889, 3062, 29898, 29876, 29918, 2798, 29879, 1405, 302, 29918, 484, 1141, 29890, 943, 9601, 29900, 29962, 13, 1678, 13299, 2083, 29918, 484, 1141, 29879, 353, 7442, 29889, 7851, 29898, 29876, 29918, 2798, 29879, 29889, 29883, 398, 2083, 3285, 29871, 29900, 29892, 29871, 29900, 29897, 13, 1678, 1418, 353, 360, 29889, 1272, 13, 13, 1678, 363, 1948, 297, 4206, 29901, 13, 4706, 302, 29900, 29892, 302, 29896, 353, 13299, 2083, 29918, 484, 1141, 29879, 29961, 798, 1402, 13299, 2083, 29918, 484, 1141, 29879, 29961, 798, 718, 29871, 29896, 29962, 13, 4706, 20241, 29918, 13140, 353, 302, 29900, 718, 1418, 29961, 29876, 29900, 29901, 29876, 29896, 1822, 5085, 441, 580, 29961, 29876, 29918, 484, 1141, 29890, 943, 17531, 13, 4706, 1418, 29961, 1758, 29918, 13140, 29962, 353, 29871, 29900, 13, 1678, 360, 29889, 295, 8332, 403, 29918, 3298, 359, 580, 13, 13, 1678, 360, 29889, 1272, 22361, 29871, 29896, 29872, 29899, 29953, 13, 1678, 565, 4464, 29918, 484, 1141, 29890, 943, 1275, 376, 5721, 2925, 1115, 13, 4706, 16285, 353, 360, 29889, 513, 1575, 29889, 690, 14443, 3552, 29899, 29896, 29892, 302, 29918, 484, 1141, 29890, 943, 876, 13, 1678, 25342, 4464, 29918, 484, 1141, 29890, 943, 1275, 376, 6915, 440, 1907, 1115, 13, 4706, 889, 29876, 29918, 513, 1575, 353, 360, 29889, 513, 1575, 29889, 690, 14443, 3552, 29899, 29896, 29892, 302, 29918, 484, 1141, 29890, 943, 876, 13, 4706, 889, 29876, 29918, 5721, 2925, 353, 360, 29889, 1272, 29889, 690, 14443, 3552, 29899, 29896, 29892, 302, 29918, 484, 1141, 29890, 943, 876, 13, 4706, 17117, 11009, 353, 10272, 29918, 6915, 440, 1907, 29918, 398, 481, 29898, 13, 9651, 889, 29876, 29918, 513, 1575, 29892, 889, 29876, 29918, 5721, 2925, 29892, 360, 29889, 12181, 29961, 29900, 1402, 302, 29918, 484, 1141, 29890, 943, 13, 4706, 1723, 13, 4706, 16285, 353, 679, 29918, 513, 1575, 29918, 3166, 29918, 2395, 29878, 29898, 13082, 29897, 13, 1678, 736, 16285, 29892, 360, 13, 13, 13, 1753, 679, 29918, 513, 1575, 29918, 3166, 29918, 2395, 29878, 29898, 13082, 1125, 13, 1678, 396, 6597, 29879, 16285, 515, 4511, 2068, 4636, 29892, 282, 7925, 411, 302, 550, 13, 1678, 474, 10351, 353, 7442, 29889, 2873, 3552, 13082, 29889, 12181, 29961, 29900, 1402, 7442, 29889, 3317, 3552, 13082, 1405, 29871, 29900, 467, 2083, 29898, 29896, 13697, 334, 7442, 29889, 13707, 13, 1678, 363, 474, 297, 3464, 29898, 861, 29879, 29889, 12181, 29961, 29900, 29962, 1125, 13, 4706, 3038, 29918, 513, 1575, 353, 11009, 29961, 29875, 29892, 584, 1822, 513, 1575, 13, 4706, 474, 10351, 29961, 29875, 29892, 584, 7431, 29898, 3729, 29918, 513, 1575, 4638, 353, 3038, 29918, 513, 1575, 13, 1678, 736, 474, 10351, 13, 13, 13, 1753, 679, 29918, 1524, 1230, 29918, 513, 1575, 29898, 13, 1678, 16285, 29892, 13, 1678, 2380, 29892, 13, 1678, 302, 29918, 276, 2764, 344, 29918, 484, 1141, 29890, 943, 29922, 29906, 29892, 13, 1678, 4236, 29918, 484, 1141, 29879, 29922, 8516, 29892, 13, 1125, 13, 1678, 822, 13649, 29918, 513, 1575, 29898, 513, 1575, 29892, 2380, 29892, 302, 29918, 276, 2764, 344, 29918, 484, 1141, 29890, 943, 1125, 13, 4706, 565, 302, 29918, 276, 2764, 344, 29918, 484, 1141, 29890, 943, 1405, 29871, 29896, 29901, 13, 9651, 2380, 353, 13649, 29918, 513, 1575, 29898, 513, 1575, 29892, 2380, 29892, 302, 29918, 276, 2764, 344, 29918, 484, 1141, 29890, 943, 448, 29871, 29896, 29897, 13, 4706, 474, 29916, 353, 7442, 29889, 4397, 29898, 2248, 29892, 16285, 29961, 2248, 2314, 29871, 396, 1513, 322, 26377, 22092, 943, 13, 4706, 565, 7442, 29889, 275, 13707, 29898, 861, 467, 1384, 7295, 13, 9651, 474, 29916, 353, 474, 29916, 29961, 30022, 9302, 29889, 275, 13707, 29898, 861, 4638, 13, 4706, 736, 474, 29916, 29889, 579, 668, 29898, 524, 29897, 13, 13, 1678, 16285, 353, 7442, 29889, 13092, 29898, 1524, 403, 29918, 513, 1575, 29898, 513, 1575, 29892, 2380, 29892, 302, 29918, 276, 2764, 344, 29918, 484, 1141, 29890, 943, 876, 13, 1678, 565, 4236, 29918, 484, 1141, 29879, 338, 451, 6213, 322, 7431, 29898, 513, 1575, 29897, 1405, 4236, 29918, 484, 1141, 29879, 29901, 13, 4706, 16285, 353, 7442, 29889, 8172, 29889, 16957, 29898, 513, 1575, 29892, 4236, 29918, 484, 1141, 29879, 29892, 5191, 29922, 8824, 29897, 13, 1678, 736, 16285, 13, 13, 13, 1753, 26224, 29918, 5344, 29918, 2083, 29898, 29907, 29892, 302, 29918, 13519, 29922, 29906, 1125, 29871, 396, 2912, 267, 315, 718, 315, 29985, 29906, 718, 315, 29985, 29941, 718, 2023, 13, 1678, 315, 29918, 29876, 353, 313, 13, 4706, 26224, 29918, 5344, 29918, 2083, 29898, 29907, 29892, 302, 29918, 13519, 448, 29871, 29896, 29897, 565, 302, 29918, 13519, 1405, 29871, 29906, 1683, 315, 565, 302, 29918, 13519, 1405, 29871, 29896, 1683, 29871, 29900, 13, 1678, 1723, 13, 1678, 736, 315, 718, 315, 29889, 6333, 29898, 29907, 29918, 29876, 29897, 13, 13, 13, 1753, 6471, 29918, 517, 29918, 11227, 29898, 7221, 29892, 6471, 29892, 2318, 1609, 29922, 8516, 1125, 13, 1678, 6471, 353, 518, 13155, 29962, 565, 338, 8758, 29898, 13155, 29892, 851, 29897, 1683, 6471, 13, 1678, 565, 338, 8758, 29898, 13155, 29892, 313, 1761, 29892, 18761, 29892, 7442, 29889, 299, 2378, 29892, 7442, 29889, 11651, 22164, 13, 4706, 2318, 1609, 353, 313, 13, 9651, 2318, 1609, 13, 9651, 565, 2318, 1609, 297, 594, 532, 29889, 26290, 29889, 8149, 580, 13, 9651, 1683, 376, 695, 504, 414, 29908, 13, 9651, 565, 376, 695, 504, 414, 29908, 297, 594, 532, 29889, 26290, 29889, 8149, 580, 13, 9651, 1683, 376, 29880, 5128, 475, 29908, 13, 9651, 565, 376, 29880, 5128, 475, 29908, 297, 594, 532, 29889, 26290, 29889, 8149, 580, 13, 9651, 1683, 6213, 13, 4706, 1723, 13, 4706, 565, 2318, 1609, 338, 451, 6213, 29901, 13, 9651, 6471, 353, 7442, 29889, 2378, 4197, 1989, 297, 6471, 363, 1820, 297, 594, 532, 29889, 26290, 29961, 27789, 24960, 13, 4706, 1683, 29901, 13, 9651, 12020, 7865, 2392, 703, 27789, 5352, 451, 2854, 23157, 13, 1678, 736, 6471, 13, 13, 13, 1753, 1556, 29918, 9435, 29918, 262, 29918, 1761, 29898, 20155, 1125, 13, 1678, 24471, 353, 518, 667, 363, 2944, 297, 24471, 565, 2944, 338, 451, 7442, 29889, 13707, 322, 2944, 2804, 376, 13707, 3108, 13, 1678, 24471, 353, 1051, 29898, 20155, 29897, 13, 1678, 736, 4236, 29898, 842, 29898, 20155, 511, 1820, 29922, 20155, 29889, 2798, 29897, 13, 13, 13, 1753, 4036, 1891, 29918, 955, 25245, 29898, 7221, 29892, 325, 1989, 543, 955, 25245, 613, 788, 29918, 1989, 543, 955, 25245, 29918, 8172, 29908, 1125, 13, 1678, 478, 29918, 29878, 299, 353, 594, 532, 29889, 29277, 29961, 29894, 1989, 1822, 8552, 580, 13, 1678, 363, 474, 297, 3464, 29898, 29963, 29918, 29878, 299, 29889, 12181, 29961, 29896, 29962, 1125, 13, 4706, 7442, 29889, 8172, 29889, 845, 21897, 29898, 29963, 29918, 29878, 299, 7503, 29892, 474, 2314, 13, 4706, 478, 29918, 29878, 299, 7503, 29892, 474, 29962, 353, 478, 29918, 29878, 299, 7503, 29892, 474, 29962, 334, 7442, 29889, 8172, 29889, 16957, 29898, 13, 9651, 7442, 29889, 2378, 4197, 29974, 29896, 29892, 448, 29896, 11724, 2159, 29922, 29963, 29918, 29878, 299, 29889, 12181, 29961, 29900, 29962, 13, 4706, 1723, 13, 1678, 594, 532, 29889, 29277, 29961, 1202, 29918, 1989, 29962, 353, 478, 29918, 29878, 299, 13, 13, 1678, 515, 869, 955, 25245, 29918, 4262, 1053, 12885, 29918, 4262, 13, 1678, 515, 869, 955, 25245, 29918, 17987, 8497, 1053, 12885, 29918, 17987, 8497, 13, 13, 1678, 12885, 29918, 4262, 29898, 7221, 29892, 325, 1989, 29922, 1202, 29918, 1989, 29897, 13, 1678, 12885, 29918, 17987, 8497, 29898, 7221, 29892, 325, 1989, 29922, 1202, 29918, 1989, 29892, 1120, 14174, 744, 29922, 8824, 29897, 13, 13, 13, 1753, 6597, 29918, 524, 29918, 3166, 29918, 710, 29898, 2378, 1125, 13, 1678, 822, 851, 29918, 517, 29918, 524, 29898, 667, 1125, 13, 4706, 954, 353, 376, 1642, 7122, 29898, 4572, 29898, 710, 29889, 275, 26204, 29892, 2944, 876, 13, 4706, 954, 353, 938, 29898, 1949, 29897, 565, 7431, 29898, 1949, 29897, 1405, 29871, 29900, 1683, 448, 29896, 13, 4706, 736, 954, 13, 13, 1678, 565, 338, 8758, 29898, 2378, 29892, 851, 1125, 13, 4706, 954, 29879, 353, 851, 29918, 517, 29918, 524, 29898, 2378, 29897, 13, 1678, 25342, 7431, 29898, 2378, 29897, 1405, 29871, 29896, 322, 338, 8758, 29898, 2378, 29961, 29900, 1402, 851, 1125, 13, 4706, 954, 29879, 353, 5159, 13, 4706, 363, 2944, 297, 1409, 29901, 13, 9651, 954, 29879, 29889, 4397, 29898, 710, 29918, 517, 29918, 524, 29898, 667, 876, 13, 1678, 1683, 29901, 13, 4706, 954, 29879, 353, 1409, 13, 1678, 954, 29879, 353, 10518, 29889, 29907, 20440, 936, 29898, 1949, 29879, 29897, 565, 1409, 29889, 29881, 1853, 1275, 376, 7320, 29908, 1683, 7442, 29889, 2378, 29898, 1949, 29879, 29897, 13, 1678, 736, 954, 29879, 13, 13, 13, 1753, 6031, 29918, 517, 29918, 29883, 20440, 936, 29879, 29898, 7221, 1125, 13, 1678, 9995, 13372, 1347, 25495, 304, 11608, 936, 29879, 1213, 15945, 13, 1678, 515, 11701, 29889, 2754, 29889, 8768, 1053, 338, 29918, 1807, 29918, 29881, 1853, 29892, 338, 29918, 16031, 29918, 29881, 1853, 29892, 338, 29918, 11227, 29918, 29881, 1853, 13, 1678, 515, 11701, 1053, 315, 20440, 936, 13, 13, 1678, 822, 338, 29918, 3084, 29918, 29881, 1853, 29898, 5975, 1125, 13, 4706, 736, 313, 13, 9651, 338, 29918, 1807, 29918, 29881, 1853, 29898, 5975, 29897, 470, 338, 29918, 16031, 29918, 29881, 1853, 29898, 5975, 29897, 470, 338, 29918, 11227, 29918, 29881, 1853, 29898, 5975, 29897, 13, 4706, 1723, 13, 13, 1678, 4489, 353, 594, 532, 29889, 26290, 13, 1678, 4489, 29918, 8149, 353, 518, 1989, 363, 1820, 297, 4489, 29889, 13099, 565, 338, 29918, 3084, 29918, 29881, 1853, 29898, 2176, 29961, 1989, 2314, 29962, 13, 1678, 363, 1820, 297, 4489, 29918, 8149, 29901, 13, 4706, 274, 353, 4489, 29961, 1989, 29962, 13, 4706, 274, 353, 315, 20440, 936, 29898, 29883, 29897, 13, 4706, 565, 29871, 29896, 529, 7431, 29898, 29883, 29889, 20683, 29897, 529, 1375, 29898, 2435, 29898, 29883, 511, 29871, 29896, 29900, 29900, 1125, 13, 9651, 4489, 29961, 1989, 29962, 353, 274, 13, 13, 1678, 4489, 353, 594, 532, 29889, 1707, 13, 1678, 4489, 29918, 8149, 353, 518, 1989, 363, 1820, 297, 4489, 29889, 13099, 565, 338, 29918, 1807, 29918, 29881, 1853, 29898, 2176, 29961, 1989, 2314, 29962, 13, 1678, 363, 1820, 297, 4489, 29918, 8149, 29901, 13, 4706, 274, 353, 4489, 29961, 1989, 1822, 579, 668, 703, 29965, 1159, 13, 4706, 274, 353, 315, 20440, 936, 29898, 29883, 29897, 13, 4706, 565, 29871, 29896, 529, 7431, 29898, 29883, 29889, 20683, 29897, 529, 1375, 29898, 2435, 29898, 29883, 511, 29871, 29896, 29900, 29900, 1125, 13, 9651, 4489, 29961, 1989, 29962, 353, 274, 13, 13, 13, 1753, 10366, 29918, 13155, 29898, 7221, 29892, 1820, 29892, 2910, 29918, 13155, 29892, 1820, 29918, 23959, 29922, 8516, 29892, 2910, 29918, 27703, 29922, 8516, 1125, 13, 1678, 6031, 29918, 517, 29918, 29883, 20440, 936, 29879, 29898, 7221, 29897, 13, 1678, 565, 7431, 29898, 1958, 29918, 13155, 29897, 2804, 7431, 29898, 7221, 29889, 26290, 29961, 1989, 1822, 4117, 29889, 20683, 1125, 13, 4706, 2910, 29918, 1111, 7989, 353, 6571, 13, 4706, 363, 274, 297, 594, 532, 29889, 26290, 29961, 1989, 1822, 4117, 29889, 20683, 29901, 13, 9651, 363, 2318, 297, 2910, 29918, 13155, 29901, 13, 18884, 565, 738, 29898, 19594, 1275, 274, 363, 9867, 297, 2910, 29918, 13155, 29961, 2972, 29962, 1125, 13, 462, 1678, 2910, 29918, 1111, 7989, 29961, 29883, 29962, 353, 2318, 13, 9651, 565, 274, 451, 297, 2910, 29918, 1111, 7989, 29901, 13, 18884, 2910, 29918, 1111, 7989, 29961, 29883, 29962, 353, 274, 13, 4706, 2910, 29918, 13155, 353, 2910, 29918, 1111, 7989, 13, 13, 1678, 565, 1820, 29918, 23959, 338, 6213, 29901, 13, 4706, 1820, 29918, 23959, 353, 285, 29908, 29912, 1989, 2403, 1111, 7989, 29908, 13, 13, 1678, 515, 11701, 29889, 2754, 29889, 8768, 1053, 315, 20440, 936, 29928, 1853, 13, 13, 1678, 594, 532, 29889, 26290, 29961, 1989, 29918, 23959, 29962, 353, 594, 532, 29889, 26290, 29961, 1989, 1822, 1958, 29898, 1958, 29918, 13155, 467, 579, 668, 29898, 29907, 20440, 936, 29928, 1853, 3101, 13, 1678, 2030, 29918, 20683, 353, 594, 532, 29889, 26290, 29961, 1989, 1822, 4117, 29889, 20683, 13, 1678, 716, 29918, 20683, 353, 594, 532, 29889, 26290, 29961, 1989, 29918, 23959, 1822, 4117, 29889, 20683, 13, 13, 1678, 396, 2910, 29918, 27703, 338, 4502, 13, 1678, 565, 2910, 29918, 27703, 338, 451, 6213, 29901, 13, 4706, 2030, 29918, 27703, 353, 6213, 13, 4706, 565, 285, 29908, 29912, 1989, 2403, 27703, 29908, 297, 594, 532, 29889, 6948, 29901, 13, 9651, 2030, 29918, 27703, 353, 594, 532, 29889, 6948, 29961, 29888, 29908, 29912, 1989, 2403, 27703, 3108, 13, 4706, 716, 29918, 27703, 353, 5159, 13, 4706, 363, 2318, 297, 594, 532, 29889, 26290, 29961, 1989, 29918, 23959, 1822, 4117, 29889, 20683, 29901, 13, 9651, 565, 2318, 297, 2910, 29918, 27703, 29901, 13, 18884, 716, 29918, 27703, 29889, 4397, 29898, 1958, 29918, 27703, 29961, 2972, 2314, 13, 9651, 25342, 2318, 297, 2030, 29918, 20683, 322, 2030, 29918, 27703, 338, 451, 6213, 29901, 13, 18884, 716, 29918, 27703, 29889, 4397, 29898, 1025, 29918, 27703, 29961, 1025, 29918, 20683, 29889, 657, 29918, 2029, 29898, 2972, 29897, 2314, 13, 9651, 1683, 29901, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29908, 3492, 3282, 29915, 29873, 6084, 263, 2927, 363, 426, 2972, 1836, 1159, 13, 4706, 594, 532, 29889, 6948, 29961, 29888, 29908, 29912, 1989, 29918, 23959, 2403, 27703, 3108, 353, 716, 29918, 27703, 13, 13, 1678, 396, 2910, 29918, 27703, 338, 451, 4502, 13, 1678, 25342, 285, 29908, 29912, 1989, 2403, 27703, 29908, 297, 594, 532, 29889, 6948, 29901, 13, 4706, 2030, 29918, 27703, 353, 594, 532, 29889, 6948, 29961, 29888, 29908, 29912, 1989, 2403, 27703, 3108, 13, 4706, 16402, 29918, 1958, 29918, 13155, 353, 426, 29887, 29901, 5159, 363, 330, 297, 716, 29918, 20683, 29913, 13, 4706, 363, 2030, 29918, 2972, 297, 2030, 29918, 20683, 29901, 13, 9651, 16402, 29918, 1958, 29918, 13155, 29961, 1958, 29918, 13155, 29961, 1025, 29918, 2972, 29962, 1822, 4397, 29898, 1025, 29918, 2972, 29897, 13, 4706, 716, 29918, 27703, 353, 5159, 13, 4706, 363, 2318, 297, 716, 29918, 20683, 29901, 13, 9651, 396, 2125, 278, 10150, 310, 278, 2030, 6471, 13, 9651, 2030, 29918, 2972, 353, 313, 13, 18884, 594, 532, 29889, 26290, 29961, 1989, 3816, 7221, 29889, 26290, 29961, 1989, 1822, 275, 262, 29898, 262, 3901, 29918, 1958, 29918, 13155, 29961, 2972, 2314, 29962, 13, 18884, 869, 1767, 29918, 2798, 29879, 580, 13, 18884, 869, 2248, 29961, 29900, 29962, 13, 9651, 1723, 13, 9651, 716, 29918, 27703, 29889, 4397, 29898, 1025, 29918, 27703, 29961, 1025, 29918, 20683, 29889, 657, 29918, 2029, 29898, 1025, 29918, 2972, 29897, 2314, 13, 4706, 594, 532, 29889, 6948, 29961, 29888, 29908, 29912, 1989, 29918, 23959, 2403, 27703, 3108, 353, 716, 29918, 27703, 13, 13, 13, 1753, 5700, 2696, 29918, 9278, 29918, 955, 542, 1907, 29898, 13, 1678, 594, 532, 29892, 325, 1989, 543, 955, 25245, 613, 1820, 29918, 23959, 543, 955, 25245, 29918, 7582, 613, 285, 945, 29918, 974, 29918, 3317, 29922, 29900, 29889, 29945, 29892, 671, 29918, 1610, 29922, 8824, 13, 1125, 13, 1678, 921, 353, 594, 532, 29889, 29277, 3366, 1028, 506, 287, 3108, 565, 671, 29918, 1610, 1683, 594, 532, 29889, 29277, 3366, 29924, 29879, 3108, 13, 1678, 343, 353, 594, 532, 29889, 29277, 3366, 348, 1028, 506, 287, 3108, 565, 671, 29918, 1610, 1683, 594, 532, 29889, 29277, 3366, 29924, 29884, 3108, 13, 13, 1678, 921, 29918, 3317, 353, 921, 29889, 3317, 29898, 29900, 467, 29909, 29961, 29900, 29962, 565, 1721, 5510, 29898, 29916, 29897, 1683, 921, 29889, 3317, 29898, 29900, 29897, 13, 1678, 343, 29918, 3317, 353, 343, 29889, 3317, 29898, 29900, 467, 29909, 29961, 29900, 29962, 565, 1721, 5510, 29898, 29891, 29897, 1683, 343, 29889, 3317, 29898, 29900, 29897, 13, 13, 1678, 921, 29891, 29918, 12324, 353, 921, 847, 7442, 29889, 24049, 29898, 29916, 29918, 3317, 29892, 29871, 29896, 29872, 29899, 29941, 29892, 6213, 29897, 718, 343, 847, 7442, 29889, 24049, 29898, 29891, 29918, 3317, 29892, 29871, 29896, 29872, 29899, 29941, 29892, 6213, 29897, 13, 1678, 399, 353, 921, 29891, 29918, 12324, 6736, 7442, 29889, 25376, 488, 29898, 3594, 29918, 12324, 29892, 29871, 29929, 29947, 29892, 9685, 29922, 29900, 29897, 334, 285, 945, 29918, 974, 29918, 3317, 13, 13, 1678, 594, 532, 29889, 29277, 29961, 1989, 29918, 23959, 29962, 353, 5939, 29878, 29918, 5344, 29898, 29956, 467, 18056, 368, 29898, 7221, 29889, 29277, 29961, 29894, 1989, 14664, 517, 2395, 29878, 580, 13, 13, 1678, 515, 869, 955, 25245, 29918, 4262, 1053, 12885, 29918, 4262, 13, 1678, 515, 869, 955, 25245, 29918, 17987, 8497, 1053, 12885, 29918, 17987, 8497, 13, 13, 1678, 12885, 29918, 4262, 29898, 7221, 29892, 325, 1989, 29922, 1989, 29918, 23959, 29892, 2134, 29916, 29922, 5574, 29897, 13, 1678, 12885, 29918, 17987, 8497, 29898, 7221, 29892, 325, 1989, 29922, 1989, 29918, 23959, 29897, 13, 13, 13, 1753, 1207, 29918, 13092, 29918, 1761, 29898, 1989, 29892, 2758, 29918, 2378, 29922, 8824, 1125, 13, 1678, 515, 11701, 1053, 5412, 29892, 11374, 13, 13, 1678, 565, 338, 8758, 29898, 1989, 29892, 11374, 1125, 13, 4706, 1820, 353, 1820, 29889, 25027, 391, 580, 13, 1678, 338, 29918, 1761, 353, 313, 13, 4706, 338, 8758, 29898, 1989, 29892, 313, 1761, 29892, 18761, 29892, 7442, 29889, 11651, 876, 13, 4706, 565, 2758, 29918, 2378, 13, 4706, 1683, 338, 8758, 29898, 1989, 29892, 313, 1761, 29892, 18761, 29892, 7442, 29889, 299, 2378, 29892, 7442, 29889, 11651, 876, 13, 1678, 1723, 13, 1678, 338, 29918, 1761, 29918, 974, 29918, 710, 353, 338, 29918, 1761, 322, 599, 29898, 275, 8758, 29898, 667, 29892, 851, 29897, 363, 2944, 297, 1820, 29897, 13, 1678, 736, 313, 13, 4706, 5412, 29898, 1989, 29897, 565, 338, 29918, 1761, 29918, 974, 29918, 710, 1683, 1820, 565, 338, 29918, 1761, 322, 7431, 29898, 1989, 29897, 529, 29871, 29906, 29900, 1683, 518, 1989, 29962, 13, 1678, 1723, 13, 13, 13, 1753, 1243, 29918, 29890, 326, 397, 2877, 29898, 29916, 29892, 289, 1144, 29922, 29941, 29900, 29892, 26109, 29922, 5574, 29892, 6492, 29922, 8824, 1125, 13, 1678, 9995, 3057, 363, 289, 326, 397, 284, 4978, 1213, 15945, 13, 1678, 515, 4560, 2272, 29889, 16202, 1053, 330, 17019, 29918, 29895, 311, 29892, 6056, 13, 13, 1678, 27981, 29892, 13069, 353, 7442, 29889, 1195, 29898, 29916, 511, 7442, 29889, 25376, 488, 29898, 29916, 29892, 29871, 29929, 29929, 29889, 29929, 29897, 13, 1678, 6856, 353, 7442, 29889, 1915, 3493, 29898, 27728, 29892, 13069, 565, 13069, 5277, 27981, 1683, 7442, 29889, 3317, 29898, 29916, 511, 289, 1144, 29897, 13, 1678, 26109, 29918, 7720, 353, 313, 13, 4706, 330, 17019, 29918, 29895, 311, 29898, 29916, 5033, 7720, 29897, 565, 26109, 1683, 7442, 29889, 29882, 391, 13342, 29898, 29916, 29892, 289, 1144, 29922, 7720, 29892, 9027, 29922, 5574, 9601, 29900, 29962, 13, 1678, 1723, 13, 13, 1678, 22645, 353, 938, 29898, 29890, 1144, 847, 29871, 29906, 29897, 448, 29871, 29906, 13, 1678, 22645, 4619, 7442, 29889, 1191, 1195, 29898, 29895, 311, 29918, 7720, 29961, 13140, 584, 22645, 718, 29871, 29946, 2314, 13, 13, 1678, 19224, 29918, 29900, 353, 26109, 29918, 7720, 7503, 13140, 1822, 1191, 3317, 580, 13, 1678, 19224, 29918, 29896, 353, 26109, 29918, 7720, 29961, 13140, 29901, 1822, 1191, 3317, 580, 13, 1678, 26109, 29918, 412, 557, 353, 26109, 29918, 7720, 29961, 13140, 29901, 3816, 13, 4706, 19224, 29918, 29896, 13, 1678, 4514, 29871, 396, 1375, 29898, 29895, 311, 29918, 7720, 7503, 13140, 3816, 412, 557, 29918, 29900, 1402, 26109, 29918, 7720, 29961, 13140, 29901, 3816, 412, 557, 29918, 29896, 2314, 13, 1678, 26109, 29918, 6563, 353, 26109, 29918, 7720, 29961, 13140, 29901, 1822, 12676, 580, 29871, 396, 26109, 29918, 7720, 29961, 13140, 29962, 13, 13, 1678, 260, 29918, 6112, 353, 313, 29895, 311, 29918, 412, 557, 448, 26109, 29918, 6563, 29897, 847, 7442, 29889, 24049, 29898, 9302, 29889, 4172, 29898, 29895, 311, 29918, 7720, 29897, 847, 7442, 29889, 3676, 29898, 29890, 1144, 511, 29871, 29896, 29892, 6213, 29897, 13, 1678, 282, 29918, 791, 353, 6056, 29889, 4668, 29898, 29873, 29918, 6112, 29897, 13, 13, 1678, 6856, 29918, 29900, 353, 6856, 7503, 13140, 29962, 13, 1678, 6856, 29918, 29896, 353, 6856, 29961, 13140, 17531, 13, 1678, 2794, 353, 518, 13, 4706, 313, 7720, 29918, 29900, 29961, 412, 557, 29918, 29900, 29962, 718, 6856, 29918, 29900, 29961, 1195, 29898, 412, 557, 29918, 29900, 718, 29871, 29896, 29892, 7431, 29898, 7720, 29918, 29900, 29897, 448, 29871, 29896, 29897, 2314, 847, 29871, 29906, 29892, 13, 4706, 313, 7720, 29918, 29896, 29961, 412, 557, 29918, 29896, 29962, 718, 6856, 29918, 29896, 29961, 1195, 29898, 412, 557, 29918, 29896, 718, 29871, 29896, 29892, 7431, 29898, 7720, 29918, 29896, 29897, 448, 29871, 29896, 29897, 2314, 847, 29871, 29906, 29892, 13, 1678, 4514, 13, 13, 1678, 565, 6492, 29901, 13, 4706, 2927, 353, 376, 7979, 29891, 29908, 13, 4706, 565, 26109, 29901, 13, 9651, 715, 29889, 5317, 29898, 7720, 29892, 26109, 29918, 7720, 29892, 2927, 29922, 2780, 29897, 13, 9651, 715, 29889, 5589, 29918, 14811, 29898, 7720, 29892, 29871, 29900, 29892, 26109, 29918, 7720, 29892, 15595, 29922, 29900, 29889, 29946, 29892, 2927, 29922, 2780, 29897, 13, 4706, 1683, 29901, 13, 9651, 715, 29889, 29882, 391, 29898, 29916, 29892, 289, 1144, 29922, 7720, 29892, 15595, 29922, 29900, 29889, 29946, 29892, 9027, 29922, 5574, 29892, 2927, 29922, 2780, 29897, 13, 4706, 715, 29889, 1165, 29894, 1220, 29898, 1004, 550, 29961, 29900, 1402, 2927, 29922, 2780, 29897, 13, 4706, 715, 29889, 1165, 29894, 1220, 29898, 1004, 550, 29961, 29896, 1402, 2927, 29922, 2780, 29897, 13, 4706, 715, 29889, 1165, 7760, 29898, 29895, 311, 29918, 6563, 29892, 15595, 29922, 29900, 29889, 29906, 29892, 6276, 342, 1508, 543, 489, 613, 2927, 29922, 2780, 29897, 13, 4706, 715, 29889, 4294, 580, 13, 13, 1678, 736, 260, 29918, 6112, 29892, 282, 29918, 791, 29892, 2794, 29871, 396, 3695, 260, 29918, 1688, 313, 276, 622, 443, 326, 397, 2877, 565, 260, 29918, 6112, 1405, 29871, 29941, 29897, 13, 13, 13, 1753, 4036, 29918, 1491, 11249, 29898, 7221, 29892, 15958, 29922, 29900, 29889, 29896, 29892, 736, 29918, 6484, 29922, 8824, 29892, 3509, 29922, 8824, 1125, 13, 1678, 594, 532, 29918, 1491, 353, 594, 532, 29889, 8552, 580, 565, 3509, 1683, 594, 532, 13, 1678, 282, 29892, 2159, 353, 15958, 29892, 594, 532, 29889, 29876, 29918, 26290, 13, 1678, 11306, 353, 7442, 29889, 8172, 29889, 16957, 4197, 5574, 29892, 7700, 1402, 2159, 29922, 2311, 29892, 282, 11759, 29886, 29892, 29871, 29896, 448, 282, 2314, 13, 1678, 594, 532, 29918, 1491, 3032, 262, 6689, 29918, 6484, 29918, 26290, 29898, 6484, 29897, 13, 1678, 736, 594, 532, 29918, 1491, 565, 3509, 1683, 11306, 565, 736, 29918, 6484, 1683, 6213, 13, 13, 13, 1753, 679, 29918, 20908, 15815, 29898, 2378, 1125, 13, 1678, 515, 16250, 1053, 315, 5336, 13, 13, 1678, 736, 7442, 29889, 2378, 4197, 667, 363, 313, 667, 29892, 2302, 29897, 297, 315, 5336, 29898, 2378, 467, 7076, 580, 565, 2302, 1405, 29871, 29896, 2314, 13, 13, 13, 1753, 27760, 1111, 1389, 29898, 29916, 29892, 343, 29892, 4464, 543, 412, 1503, 787, 29908, 1125, 13, 1678, 515, 4560, 2272, 29889, 16202, 1053, 282, 799, 1100, 29878, 29892, 961, 279, 1171, 29878, 13, 13, 1678, 27760, 29892, 903, 353, 961, 279, 1171, 29878, 29898, 29916, 29892, 343, 29897, 565, 4464, 1275, 376, 5965, 2817, 550, 29908, 1683, 282, 799, 1100, 29878, 29898, 29916, 29892, 343, 29897, 13, 1678, 736, 27760, 13, 13, 13, 1753, 325, 29725, 1111, 1389, 29898, 29990, 29892, 343, 29892, 4464, 543, 412, 1503, 787, 613, 9685, 10457, 29896, 1125, 13, 1678, 9995, 29925, 15451, 787, 29914, 10649, 2817, 550, 19869, 16127, 29889, 13, 13, 1678, 4803, 349, 15451, 787, 847, 5013, 2817, 550, 304, 1243, 363, 5608, 847, 21196, 8927, 9443, 29889, 13, 13, 1678, 11842, 9331, 13, 1678, 448, 1378, 29899, 13, 1678, 1060, 29901, 421, 9302, 29889, 299, 2378, 29952, 13, 4706, 3630, 4608, 470, 4636, 13, 1678, 343, 29901, 421, 9302, 29889, 299, 2378, 29952, 13, 4706, 3630, 4608, 470, 4636, 13, 1678, 4464, 29901, 525, 412, 1503, 787, 29915, 470, 525, 5965, 2817, 550, 29915, 313, 4381, 29901, 16218, 412, 1503, 787, 29915, 6348, 13, 4706, 8449, 19869, 12714, 304, 671, 29889, 13, 1678, 9995, 13, 1678, 565, 1721, 5510, 29898, 29990, 1125, 13, 4706, 1060, 353, 7442, 29889, 2378, 29898, 29990, 29889, 29909, 29897, 13, 1678, 565, 1721, 5510, 29898, 29891, 1125, 13, 4706, 343, 353, 7442, 29889, 2378, 29898, 29891, 29889, 29909, 29897, 13, 1678, 565, 9685, 1275, 29871, 29900, 29901, 13, 4706, 565, 1060, 29889, 299, 326, 1405, 29871, 29896, 29901, 13, 9651, 1060, 353, 7442, 29889, 2378, 29898, 29990, 29889, 29911, 29897, 13, 4706, 565, 343, 29889, 299, 326, 1405, 29871, 29896, 29901, 13, 9651, 343, 353, 7442, 29889, 2378, 29898, 29891, 29889, 29911, 29897, 13, 1678, 565, 1060, 29889, 12181, 29961, 8990, 29962, 2804, 343, 29889, 12181, 29961, 8990, 5387, 13, 4706, 1060, 353, 1060, 29889, 29911, 13, 1678, 565, 4464, 297, 8853, 5965, 2817, 550, 613, 376, 5965, 279, 1171, 29908, 6177, 13, 4706, 515, 4560, 2272, 29889, 16202, 29889, 16202, 1053, 7115, 1272, 13, 13, 4706, 1060, 353, 7442, 29889, 7302, 29918, 284, 549, 29918, 8990, 29898, 10003, 1272, 29892, 9685, 10457, 29896, 29892, 3948, 29922, 29990, 29897, 13, 4706, 343, 353, 7442, 29889, 7302, 29918, 284, 549, 29918, 8990, 29898, 10003, 1272, 29892, 9685, 10457, 29896, 29892, 3948, 29922, 29891, 29897, 13, 1678, 1060, 29885, 353, 7442, 29889, 2378, 29898, 29990, 448, 313, 9302, 29889, 13707, 12676, 29898, 29990, 29892, 448, 29896, 29897, 7503, 29892, 6213, 29962, 565, 1060, 29889, 299, 326, 1405, 29871, 29896, 1683, 7442, 29889, 13707, 12676, 29898, 29990, 29892, 448, 29896, 4961, 13, 1678, 343, 29885, 353, 7442, 29889, 2378, 29898, 29891, 448, 313, 9302, 29889, 13707, 12676, 29898, 29891, 29892, 448, 29896, 29897, 7503, 29892, 6213, 29962, 565, 343, 29889, 299, 326, 1405, 29871, 29896, 1683, 7442, 29889, 13707, 12676, 29898, 29891, 29892, 448, 29896, 4961, 13, 1678, 27760, 353, 7442, 29889, 29876, 550, 398, 29898, 29990, 29885, 334, 343, 29885, 29892, 448, 29896, 29897, 847, 7442, 29889, 3676, 29898, 13, 4706, 7442, 29889, 29876, 550, 398, 29898, 29990, 29885, 3579, 29871, 29906, 29892, 448, 29896, 29897, 334, 7442, 29889, 29876, 550, 398, 29898, 962, 3579, 29871, 29906, 29892, 448, 29896, 29897, 13, 1678, 1723, 13, 1678, 736, 27760, 13, 13, 13, 1753, 338, 262, 29898, 29916, 29892, 343, 1125, 13, 1678, 736, 7442, 29889, 2378, 29898, 15926, 29889, 17271, 29898, 29916, 467, 275, 262, 29898, 29891, 8106, 1579, 8606, 580, 13, 13, 13, 1753, 16285, 29918, 517, 29918, 11227, 29898, 513, 1575, 29892, 302, 1125, 13, 1678, 736, 338, 262, 29898, 9302, 29889, 279, 927, 29898, 29876, 511, 16285, 29897, 13, 13, 13, 1753, 378, 1555, 345, 29898, 7221, 29892, 921, 1125, 13, 1678, 515, 6317, 1457, 19170, 29889, 484, 1141, 29890, 943, 1053, 679, 29918, 6915, 440, 1907, 13, 13, 1678, 11009, 353, 679, 29918, 6915, 440, 1907, 29898, 7221, 29897, 13, 1678, 565, 338, 8758, 29898, 29916, 29892, 851, 29897, 322, 921, 297, 594, 532, 29889, 29277, 29889, 8149, 7295, 13, 4706, 921, 353, 594, 532, 29889, 29277, 29961, 29916, 29962, 13, 1678, 565, 921, 29889, 299, 326, 1275, 29871, 29896, 29901, 13, 4706, 736, 11009, 29889, 6333, 29898, 29916, 29897, 13, 1678, 22645, 29918, 3084, 353, 3695, 9302, 29889, 275, 13707, 29898, 29916, 29889, 2083, 29898, 29900, 876, 13, 1678, 612, 353, 7442, 29889, 2873, 29898, 29916, 29889, 12181, 29897, 334, 7442, 29889, 13707, 13, 1678, 612, 7503, 29892, 22645, 29918, 3084, 29962, 353, 11009, 29889, 6333, 29898, 29916, 7503, 29892, 22645, 29918, 3084, 2314, 13, 1678, 736, 612, 13, 13, 13, 1753, 679, 29918, 1062, 2390, 324, 630, 29918, 3859, 29898, 7221, 29892, 325, 1989, 543, 955, 25245, 613, 11636, 29922, 29896, 29892, 671, 29918, 1610, 29922, 8516, 29892, 5768, 1056, 29922, 5574, 1125, 13, 1678, 9995, 2577, 1294, 2390, 324, 630, 3038, 2106, 1213, 15945, 13, 1678, 317, 353, 594, 532, 29889, 29277, 3366, 1028, 506, 287, 29908, 565, 671, 29918, 1610, 1683, 376, 29924, 29879, 3108, 13, 1678, 565, 5768, 1056, 29901, 13, 4706, 624, 353, 317, 718, 11636, 334, 594, 532, 29889, 29277, 29961, 29894, 1989, 29962, 13, 4706, 624, 353, 624, 7503, 29892, 7442, 29889, 4492, 262, 568, 29898, 9302, 29889, 2083, 29898, 855, 29892, 29871, 29900, 28166, 13, 1678, 1683, 29901, 13, 4706, 624, 353, 317, 718, 11636, 334, 7442, 29889, 13707, 29918, 517, 29918, 1949, 29898, 7221, 29889, 29277, 29961, 29894, 1989, 2314, 13, 1678, 736, 624, 13, 13, 13, 1753, 679, 29918, 572, 6288, 537, 29918, 13628, 29898, 7221, 1125, 13, 1678, 22645, 29918, 3332, 29918, 1885, 267, 353, 7442, 29889, 5085, 441, 29898, 7221, 29889, 1707, 3366, 29887, 1600, 29918, 2798, 29918, 29725, 16862, 5975, 9601, 1057, 29899, 29896, 3816, 29901, 29906, 29900, 29900, 29962, 13, 1678, 341, 29879, 353, 7442, 29889, 2378, 29898, 7221, 29889, 29277, 3366, 29924, 29879, 3108, 7503, 29892, 22645, 29918, 3332, 29918, 1885, 267, 2314, 13, 1678, 736, 6287, 29898, 9302, 29889, 12676, 29898, 29924, 29879, 847, 7442, 29889, 3317, 29898, 29924, 29879, 29892, 9685, 29922, 29900, 511, 9685, 29922, 29896, 876, 13, 2 ]
ktaned/bomb.py
MartinHarding/ktaned
1
18282
<reponame>MartinHarding/ktaned import random class Bomb(object): """Represents the Bomb context that modules should compute against""" def __init__(self): super(Bomb, self).__init__() self.valid_battery_types = ['AA', 'D'] self.valid_ports = ['DVI-D', 'Parallel', 'PS/2', 'RJ-45', 'Serial', 'Stereo RCA'] self.valid_indicator_labels = ['SND', 'CLR', 'CAR', 'IND', 'FRQ', 'SIG', 'NSA', 'MSA', 'TRN', 'BOB', 'FRK'] self.reset() # Sets up defaults for bomb def add_battery_pack(self, battery_type, quantity): """Add battery pack to bomb (required for certain modules) Args: battery_type (string): type of battery in the pack quantity (int): number batteries in the pack """ if battery_type not in self.valid_battery_types: raise Exception('Battery type ({}) must be one of {}' .format(battery_type, self.valid_battery_types)) if quantity < 1: raise Exception('Battery packs must have at least one battery') self.battery_packs.append({'type': battery_type, 'quantity': quantity}) def set_battery_packs(self, battery_packs): """Set battery packs on the bomb (replaces existing battery packs) Args: battery_packs (list): list of dicts representing battery packs """ self.battery_packs = [] for battery_pack in battery_packs: self.add_battery_pack(battery_pack['type'], battery_pack['quantity']) self.batteries = self.get_battery_count() def get_battery_count(self): """Set battery packs on the bomb (replaces existing battery packs) Returns: battery_count (int): sum total of batteries accross all types """ return sum([d['quantity'] for d in self.battery_packs]) def add_port(self, port): """Add port to bomb (required for certain modules) Args: port (string): name of port """ if port not in self.valid_ports: raise Exception('Port ({}) must be one of {}' .format(port, self.valid_ports)) self.ports.append(port) def set_ports(self, ports): """Set ports on the bomb (replaces existing ports) Args: ports (list): list of ports """ self.ports = [] for port in ports: self.add_port(port) def add_indicator(self, label, lit): """Add indicator to bomb (required for certain modules) Args: label (string): label for the indicator lit (boolean): whether the indicator is lit (True) or not (False) """ if label not in self.valid_indicator_labels: raise ValueError('Indicator "label" property must be one of {}' .format(self.valid_indicator_labels)) if lit not in [True, False]: raise ValueError('Indicator "lit" property must be boolean') self.indicators.append({'label': label, 'lit': lit}) def set_indicators(self, indicators): """Set indicators on the bomb (replaces existing indicators) Args: indicators (list): list of dicts representing indicators """ self.indicators = [] for indicator in indicators: self.add_indicator(indicator['label'], indicator['lit']) def get_indicator_labels(self, lit=None): """Retrieve the label strings of the indicators on the bomb Args: indicators (list): list of indicator labels lit (mixed): optional bool that filters by lit or unlit indicators Returns: list: a list of strings representing indicator labels """ indicator_labels = [] for indicator in self.indicators: if lit is None or indicator['lit'] is lit: indicator_labels.append(indicator['label']) return indicator_labels def check_serial_for_vowel(self): """Check whether the serial set contains a vowel Returns: bool: True if contains a vowel """ if not hasattr(self, 'serial') or self.serial is None: raise Exception('Must set serial before checking for vowel') if set(self.serial) & set('aeiou'): return True else: return False def check_serial_ends_odd(self): """Check whether the serial ends in an odd or even number Returns: bool: True if ends in odd """ if not hasattr(self, 'serial') or self.serial is None: raise Exception('Must set serial before checking ends in odd') try: last_character_as_int = int(self.serial[-1]) except Exception as e: return False return bool(last_character_as_int % 2) def add_strikes(self, strikes=1): """Add one or more strikes (mistake) to the bomb context Args: strikes (int): number of strikes to add (defaults to 1) """ self.strikes += strikes if self.strikes > 2: self.explode() def set_strikes(self, strikes): """Add one or more strikes (mistake) to the bomb context Args: strikes (int): what number to set the strikes at """ self.strikes = strikes if self.strikes > 2: self.explode() def reset(self): """Reset bomb properties to their default values (called in __init__, but may be useful for starting over""" self.ports = [] self.indicators = [] self.battery_packs = [] self.strikes = 0 self.serial = None def explode(self): """Raise an error if the bomb explodes.""" raise Exception('Kaboom! You have exploded.')
[ 1, 529, 276, 1112, 420, 29958, 22628, 29950, 20272, 29914, 1193, 273, 287, 13, 5215, 4036, 13, 13, 13, 1990, 24347, 29898, 3318, 1125, 13, 1678, 9995, 1123, 4569, 1237, 278, 24347, 3030, 393, 10585, 881, 10272, 2750, 15945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 29933, 3424, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 3084, 29918, 29890, 2620, 29891, 29918, 8768, 353, 6024, 6344, 742, 525, 29928, 2033, 13, 4706, 1583, 29889, 3084, 29918, 4011, 353, 6024, 29928, 18118, 29899, 29928, 742, 525, 2177, 6553, 742, 525, 7024, 29914, 29906, 742, 13, 462, 9651, 525, 29934, 29967, 29899, 29946, 29945, 742, 525, 9125, 742, 525, 29903, 12358, 29877, 390, 5454, 2033, 13, 4706, 1583, 29889, 3084, 29918, 513, 20485, 29918, 21134, 353, 6024, 29903, 2797, 742, 525, 6154, 29934, 742, 525, 29907, 1718, 742, 13, 462, 462, 539, 525, 22255, 742, 525, 15860, 29984, 742, 525, 5425, 29954, 742, 13, 462, 462, 539, 525, 3059, 29909, 742, 525, 4345, 29909, 742, 525, 5659, 29940, 742, 13, 462, 462, 539, 525, 8456, 29933, 742, 525, 15860, 29968, 2033, 13, 13, 4706, 1583, 29889, 12071, 580, 29871, 396, 317, 1691, 701, 21274, 363, 13585, 13, 13, 1678, 822, 788, 29918, 29890, 2620, 29891, 29918, 4058, 29898, 1311, 29892, 16988, 29918, 1853, 29892, 14728, 1125, 13, 4706, 9995, 2528, 16988, 4870, 304, 13585, 313, 12403, 363, 3058, 10585, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 16988, 29918, 1853, 313, 1807, 1125, 1134, 310, 16988, 297, 278, 4870, 13, 9651, 14728, 313, 524, 1125, 1353, 10193, 583, 297, 278, 4870, 13, 4706, 9995, 13, 13, 4706, 565, 16988, 29918, 1853, 451, 297, 1583, 29889, 3084, 29918, 29890, 2620, 29891, 29918, 8768, 29901, 13, 9651, 12020, 8960, 877, 29933, 2620, 29891, 1134, 21313, 1800, 1818, 367, 697, 310, 6571, 29915, 13, 462, 9651, 869, 4830, 29898, 29890, 2620, 29891, 29918, 1853, 29892, 1583, 29889, 3084, 29918, 29890, 2620, 29891, 29918, 8768, 876, 13, 13, 4706, 565, 14728, 529, 29871, 29896, 29901, 13, 9651, 12020, 8960, 877, 29933, 2620, 29891, 4870, 29879, 1818, 505, 472, 3203, 697, 16988, 1495, 13, 13, 4706, 1583, 29889, 29890, 2620, 29891, 29918, 4058, 29879, 29889, 4397, 3319, 29915, 1853, 2396, 16988, 29918, 1853, 29892, 525, 22640, 2396, 14728, 1800, 13, 13, 1678, 822, 731, 29918, 29890, 2620, 29891, 29918, 4058, 29879, 29898, 1311, 29892, 16988, 29918, 4058, 29879, 1125, 13, 4706, 9995, 2697, 16988, 4870, 29879, 373, 278, 13585, 313, 3445, 6048, 5923, 16988, 4870, 29879, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 16988, 29918, 4058, 29879, 313, 1761, 1125, 1051, 310, 9657, 29879, 15783, 16988, 4870, 29879, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 29890, 2620, 29891, 29918, 4058, 29879, 353, 5159, 13, 4706, 363, 16988, 29918, 4058, 297, 16988, 29918, 4058, 29879, 29901, 13, 9651, 1583, 29889, 1202, 29918, 29890, 2620, 29891, 29918, 4058, 29898, 29890, 2620, 29891, 29918, 4058, 1839, 1853, 7464, 13, 462, 462, 29871, 16988, 29918, 4058, 1839, 22640, 11287, 13, 4706, 1583, 29889, 29890, 2620, 583, 353, 1583, 29889, 657, 29918, 29890, 2620, 29891, 29918, 2798, 580, 13, 13, 1678, 822, 679, 29918, 29890, 2620, 29891, 29918, 2798, 29898, 1311, 1125, 13, 4706, 9995, 2697, 16988, 4870, 29879, 373, 278, 13585, 313, 3445, 6048, 5923, 16988, 4870, 29879, 29897, 13, 13, 4706, 16969, 29901, 13, 9651, 16988, 29918, 2798, 313, 524, 1125, 2533, 3001, 310, 10193, 583, 1035, 2124, 599, 4072, 13, 4706, 9995, 13, 13, 4706, 736, 2533, 4197, 29881, 1839, 22640, 2033, 363, 270, 297, 1583, 29889, 29890, 2620, 29891, 29918, 4058, 29879, 2314, 13, 13, 1678, 822, 788, 29918, 637, 29898, 1311, 29892, 2011, 1125, 13, 4706, 9995, 2528, 2011, 304, 13585, 313, 12403, 363, 3058, 10585, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 2011, 313, 1807, 1125, 1024, 310, 2011, 13, 4706, 9995, 13, 13, 4706, 565, 2011, 451, 297, 1583, 29889, 3084, 29918, 4011, 29901, 13, 9651, 12020, 8960, 877, 2290, 21313, 1800, 1818, 367, 697, 310, 6571, 29915, 13, 462, 9651, 869, 4830, 29898, 637, 29892, 1583, 29889, 3084, 29918, 4011, 876, 13, 13, 4706, 1583, 29889, 4011, 29889, 4397, 29898, 637, 29897, 13, 13, 1678, 822, 731, 29918, 4011, 29898, 1311, 29892, 16169, 1125, 13, 4706, 9995, 2697, 16169, 373, 278, 13585, 313, 3445, 6048, 5923, 16169, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 16169, 313, 1761, 1125, 1051, 310, 16169, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 4011, 353, 5159, 13, 4706, 363, 2011, 297, 16169, 29901, 13, 9651, 1583, 29889, 1202, 29918, 637, 29898, 637, 29897, 13, 13, 1678, 822, 788, 29918, 513, 20485, 29898, 1311, 29892, 3858, 29892, 11872, 1125, 13, 4706, 9995, 2528, 27717, 304, 13585, 313, 12403, 363, 3058, 10585, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 3858, 313, 1807, 1125, 3858, 363, 278, 27717, 13, 9651, 11872, 313, 20054, 1125, 3692, 278, 27717, 338, 11872, 313, 5574, 29897, 470, 451, 313, 8824, 29897, 13, 4706, 9995, 13, 13, 4706, 565, 3858, 451, 297, 1583, 29889, 3084, 29918, 513, 20485, 29918, 21134, 29901, 13, 9651, 12020, 7865, 2392, 877, 28013, 376, 1643, 29908, 2875, 1818, 367, 697, 310, 6571, 29915, 13, 462, 632, 869, 4830, 29898, 1311, 29889, 3084, 29918, 513, 20485, 29918, 21134, 876, 13, 13, 4706, 565, 11872, 451, 297, 518, 5574, 29892, 7700, 5387, 13, 9651, 12020, 7865, 2392, 877, 28013, 376, 19411, 29908, 2875, 1818, 367, 7223, 1495, 13, 13, 4706, 1583, 29889, 513, 293, 4097, 29889, 4397, 3319, 29915, 1643, 2396, 3858, 29892, 525, 19411, 2396, 11872, 1800, 13, 13, 1678, 822, 731, 29918, 513, 293, 4097, 29898, 1311, 29892, 4221, 4097, 1125, 13, 4706, 9995, 2697, 4221, 4097, 373, 278, 13585, 313, 3445, 6048, 5923, 4221, 4097, 29897, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 4221, 4097, 313, 1761, 1125, 1051, 310, 9657, 29879, 15783, 4221, 4097, 13, 4706, 9995, 13, 13, 4706, 1583, 29889, 513, 293, 4097, 353, 5159, 13, 4706, 363, 27717, 297, 4221, 4097, 29901, 13, 9651, 1583, 29889, 1202, 29918, 513, 20485, 29898, 513, 20485, 1839, 1643, 7464, 27717, 1839, 19411, 11287, 13, 13, 1678, 822, 679, 29918, 513, 20485, 29918, 21134, 29898, 1311, 29892, 11872, 29922, 8516, 1125, 13, 4706, 9995, 8015, 29878, 2418, 278, 3858, 6031, 310, 278, 4221, 4097, 373, 278, 13585, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 4221, 4097, 313, 1761, 1125, 1051, 310, 27717, 11073, 13, 9651, 11872, 313, 29885, 11925, 1125, 13136, 6120, 393, 18094, 491, 11872, 470, 443, 19411, 4221, 4097, 13, 13, 4706, 16969, 29901, 13, 9651, 1051, 29901, 263, 1051, 310, 6031, 15783, 27717, 11073, 13, 4706, 9995, 13, 13, 4706, 27717, 29918, 21134, 353, 5159, 13, 4706, 363, 27717, 297, 1583, 29889, 513, 293, 4097, 29901, 13, 9651, 565, 11872, 338, 6213, 470, 27717, 1839, 19411, 2033, 338, 11872, 29901, 13, 18884, 27717, 29918, 21134, 29889, 4397, 29898, 513, 20485, 1839, 1643, 11287, 13, 4706, 736, 27717, 29918, 21134, 13, 13, 1678, 822, 1423, 29918, 15550, 29918, 1454, 29918, 29894, 27531, 29898, 1311, 1125, 13, 4706, 9995, 5596, 3692, 278, 7797, 731, 3743, 263, 325, 27531, 13, 13, 4706, 16969, 29901, 13, 9651, 6120, 29901, 5852, 565, 3743, 263, 325, 27531, 13, 4706, 9995, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 15550, 1495, 470, 1583, 29889, 15550, 338, 6213, 29901, 13, 9651, 12020, 8960, 877, 29924, 504, 731, 7797, 1434, 8454, 363, 325, 27531, 1495, 13, 13, 4706, 565, 731, 29898, 1311, 29889, 15550, 29897, 669, 731, 877, 3660, 29875, 283, 29374, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 13, 1678, 822, 1423, 29918, 15550, 29918, 1975, 29918, 22861, 29898, 1311, 1125, 13, 4706, 9995, 5596, 3692, 278, 7797, 10614, 297, 385, 7736, 470, 1584, 1353, 13, 13, 4706, 16969, 29901, 13, 9651, 6120, 29901, 5852, 565, 10614, 297, 7736, 13, 4706, 9995, 13, 13, 4706, 565, 451, 756, 5552, 29898, 1311, 29892, 525, 15550, 1495, 470, 1583, 29889, 15550, 338, 6213, 29901, 13, 9651, 12020, 8960, 877, 29924, 504, 731, 7797, 1434, 8454, 10614, 297, 7736, 1495, 13, 13, 4706, 1018, 29901, 13, 9651, 1833, 29918, 18609, 29918, 294, 29918, 524, 353, 938, 29898, 1311, 29889, 15550, 14352, 29896, 2314, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 736, 7700, 13, 4706, 736, 6120, 29898, 4230, 29918, 18609, 29918, 294, 29918, 524, 1273, 29871, 29906, 29897, 13, 13, 1678, 822, 788, 29918, 303, 5357, 267, 29898, 1311, 29892, 19492, 267, 29922, 29896, 1125, 13, 4706, 9995, 2528, 697, 470, 901, 19492, 267, 313, 29885, 391, 1296, 29897, 304, 278, 13585, 3030, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 19492, 267, 313, 524, 1125, 1353, 310, 19492, 267, 304, 788, 313, 4381, 29879, 304, 29871, 29896, 29897, 13, 4706, 9995, 13, 4706, 1583, 29889, 303, 5357, 267, 4619, 19492, 267, 13, 4706, 565, 1583, 29889, 303, 5357, 267, 1405, 29871, 29906, 29901, 13, 9651, 1583, 29889, 24516, 356, 580, 13, 13, 1678, 822, 731, 29918, 303, 5357, 267, 29898, 1311, 29892, 19492, 267, 1125, 13, 4706, 9995, 2528, 697, 470, 901, 19492, 267, 313, 29885, 391, 1296, 29897, 304, 278, 13585, 3030, 13, 4706, 826, 3174, 29901, 13, 9651, 19492, 267, 313, 524, 1125, 825, 1353, 304, 731, 278, 19492, 267, 472, 13, 4706, 9995, 13, 4706, 1583, 29889, 303, 5357, 267, 353, 19492, 267, 13, 4706, 565, 1583, 29889, 303, 5357, 267, 1405, 29871, 29906, 29901, 13, 9651, 1583, 29889, 24516, 356, 580, 13, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 9995, 27175, 13585, 4426, 304, 1009, 2322, 1819, 313, 13998, 297, 4770, 2344, 1649, 29892, 13, 4706, 541, 1122, 367, 5407, 363, 6257, 975, 15945, 29908, 13, 4706, 1583, 29889, 4011, 353, 5159, 13, 4706, 1583, 29889, 513, 293, 4097, 353, 5159, 13, 4706, 1583, 29889, 29890, 2620, 29891, 29918, 4058, 29879, 353, 5159, 13, 4706, 1583, 29889, 303, 5357, 267, 353, 29871, 29900, 13, 4706, 1583, 29889, 15550, 353, 6213, 13, 13, 1678, 822, 3902, 356, 29898, 1311, 1125, 13, 4706, 9995, 29934, 29874, 895, 385, 1059, 565, 278, 13585, 3902, 2631, 1213, 15945, 13, 4706, 12020, 8960, 877, 29968, 370, 29667, 29991, 887, 505, 3902, 6797, 29889, 1495, 13, 2 ]
src/repnano/models/training_loop.py
organic-chemistry/RepNano
5
78302
<gh_stars>1-10 import subprocess import argparse import os import json import pandas as pd import ast parser = argparse.ArgumentParser() parser.add_argument('--dataset', type=str) parser.add_argument('--training_info', type=str) parser.add_argument('--not_do', dest="do",action="store_false") parser.add_argument('--noerror', dest="error",action="store_false") parser.add_argument('--restart', dest="restart",action="store_true") parser.add_argument('--training_repertory',default=None) parser.add_argument('--root_training_dataset',default=None) args = parser.parse_args() with open(args.training_info,"r") as f: training = json.loads("".join(f.readlines())) training_repertory = training.get("training_repertory",args.training_repertory) if training_repertory == None: print("training repertory must be defined") raise if args.training_repertory != None and training_repertory != args.training_repertory: print("Two different rep defined (one in json, one in command line)") raise os.makedirs(training_repertory,exist_ok=True) dataset = pd.read_csv(args.dataset,sep=";") for i in range(training["nloop"]): if i == 0: input_folder = args.root_training_dataset else: input_folder = output_folder model_folder = f"{training_repertory}/model_from_initial_loop{i}/" output_folder = f"{training_repertory}/training_from_initial_network_{i}/" add="" if i == training["nloop"]-1: add = " --lstm" elif i == training["nloop"]-2: add = " --lstm " percent_training = " ".join(training["training_key"]) if type(training["validation_key"]) == float: percent_val = True percent_validation = training["validation_key"] else: percent_val = False percent_validation= " ".join(training["validation_key"]) mods = ast.literal_eval(dataset["mods"][0]) mods = ' '.join(mods) if training.get("transition_matrix","") != "": add += f" --transition_matrix {training['transition_matrix']}" if not os.path.exists(model_folder) or (args.restart and i==training["nloop"]-1): if "max_len" in training: m = training["max_len"] add += f" --max_len {m} " if i >= training["nloop"]-1 and args.error: add += " --error" if args.restart: add += f"--weights {model_folder}/weights.hdf5" if not percent_val: add += f" --percents_validation {percent_validation} " else: add += f" --validation {percent_validation} " cmd = f"python src/repnano/models/train_simple.py --root_data {input_folder} --root_save {model_folder} --percents_training {percent_training} --mods {mods}" + add #cmd = f"python src/repnano/models/train_simple.py --root_data {input_folder} --root_save {model_folder} --percents_training 0 --percents_validation 0 --error" print(cmd) if args.do: subprocess.run(cmd, shell=True, check=True) """ try: cmd = f"python3 preprocess_dataset.py --type dv --model {model_folder}/weights.hdf5 --output_dv {output_folder} --root_d /scratch/jarbona/data_Repnano/ --root_p data/preprocessed/ --ref /scratch/jarbona/repnanoV10/data/S288C_reference_sequence_R64-2-1_20150113.fa" print(cmd) subprocess.run(cmd, shell=True, check=True) except: """ if not os.path.exists(output_folder): add="" if "max_len" in training: m = training["max_len"] add += f" --max_len {m}" if training.get("transition_matrix", "") != "": add += f" --transition_matrix {training['transition_matrix']}" cmd = f"python3 misc/preprocess_dataset.py --minimum_percent_highsample {training.get('minimum_percent_highsample',0.5)} --type dv --model {model_folder}/weights.hdf5 --out {output_folder} --dataset {args.dataset} " + add print(cmd) if args.do: subprocess.run(cmd, shell=True, check=True)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 1014, 5014, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 11701, 408, 10518, 13, 5215, 8717, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 24713, 742, 1134, 29922, 710, 29897, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 26495, 29918, 3888, 742, 1134, 29922, 710, 29897, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1333, 29918, 1867, 742, 2731, 543, 1867, 613, 2467, 543, 8899, 29918, 4541, 1159, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1217, 2704, 742, 2731, 543, 2704, 613, 2467, 543, 8899, 29918, 4541, 1159, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 5060, 442, 742, 2731, 543, 5060, 442, 613, 2467, 543, 8899, 29918, 3009, 1159, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 26495, 29918, 276, 10700, 706, 742, 4381, 29922, 8516, 29897, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 4632, 29918, 26495, 29918, 24713, 742, 4381, 29922, 8516, 29897, 13, 13, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 13, 2541, 1722, 29898, 5085, 29889, 26495, 29918, 3888, 1699, 29878, 1159, 408, 285, 29901, 13, 1678, 6694, 353, 4390, 29889, 18132, 703, 1642, 7122, 29898, 29888, 29889, 949, 9012, 22130, 13, 13, 26495, 29918, 276, 10700, 706, 353, 6694, 29889, 657, 703, 26495, 29918, 276, 10700, 706, 613, 5085, 29889, 26495, 29918, 276, 10700, 706, 29897, 13, 361, 6694, 29918, 276, 10700, 706, 1275, 6213, 29901, 13, 1678, 1596, 703, 26495, 337, 10700, 706, 1818, 367, 3342, 1159, 13, 1678, 12020, 13, 361, 6389, 29889, 26495, 29918, 276, 10700, 706, 2804, 6213, 322, 6694, 29918, 276, 10700, 706, 2804, 6389, 29889, 26495, 29918, 276, 10700, 706, 29901, 13, 1678, 1596, 703, 13985, 1422, 1634, 3342, 313, 650, 297, 4390, 29892, 697, 297, 1899, 1196, 25760, 13, 1678, 12020, 13, 13, 359, 29889, 29885, 12535, 12935, 29898, 26495, 29918, 276, 10700, 706, 29892, 28997, 29918, 554, 29922, 5574, 29897, 13, 13, 24713, 353, 10518, 29889, 949, 29918, 7638, 29898, 5085, 29889, 24713, 29892, 19570, 543, 29936, 1159, 13, 13, 1454, 474, 297, 3464, 29898, 26495, 3366, 29876, 7888, 3108, 1125, 13, 1678, 565, 474, 1275, 29871, 29900, 29901, 13, 4706, 1881, 29918, 12083, 353, 6389, 29889, 4632, 29918, 26495, 29918, 24713, 13, 1678, 1683, 29901, 13, 4706, 1881, 29918, 12083, 353, 1962, 29918, 12083, 13, 13, 1678, 1904, 29918, 12083, 353, 285, 29908, 29912, 26495, 29918, 276, 10700, 706, 6822, 4299, 29918, 3166, 29918, 11228, 29918, 7888, 29912, 29875, 6822, 29908, 13, 1678, 1962, 29918, 12083, 353, 285, 29908, 29912, 26495, 29918, 276, 10700, 706, 6822, 26495, 29918, 3166, 29918, 11228, 29918, 11618, 648, 29875, 6822, 29908, 13, 1678, 788, 13776, 13, 1678, 565, 474, 1275, 6694, 3366, 29876, 7888, 3108, 29899, 29896, 29901, 13, 4706, 788, 353, 376, 1192, 20155, 29885, 29908, 13, 1678, 25342, 474, 1275, 6694, 3366, 29876, 7888, 3108, 29899, 29906, 29901, 13, 4706, 788, 353, 376, 1192, 20155, 29885, 376, 13, 13, 13, 1678, 10151, 29918, 26495, 353, 376, 11393, 7122, 29898, 26495, 3366, 26495, 29918, 1989, 20068, 13, 1678, 565, 1134, 29898, 26495, 3366, 18157, 29918, 1989, 20068, 1275, 5785, 29901, 13, 4706, 10151, 29918, 791, 353, 5852, 13, 4706, 10151, 29918, 18157, 353, 6694, 3366, 18157, 29918, 1989, 3108, 13, 1678, 1683, 29901, 13, 4706, 10151, 29918, 791, 353, 7700, 13, 4706, 10151, 29918, 18157, 29922, 376, 11393, 7122, 29898, 26495, 3366, 18157, 29918, 1989, 20068, 13, 1678, 878, 29879, 353, 8717, 29889, 20889, 284, 29918, 14513, 29898, 24713, 3366, 1545, 29879, 3108, 29961, 29900, 2314, 13, 1678, 878, 29879, 353, 525, 15300, 7122, 29898, 1545, 29879, 29897, 13, 13, 1678, 565, 6694, 29889, 657, 703, 20543, 29918, 5344, 3284, 1159, 2804, 376, 1115, 13, 4706, 788, 4619, 285, 29908, 1192, 20543, 29918, 5344, 426, 26495, 1839, 20543, 29918, 5344, 2033, 5038, 13, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 4299, 29918, 12083, 29897, 470, 313, 5085, 29889, 5060, 442, 322, 474, 1360, 26495, 3366, 29876, 7888, 3108, 29899, 29896, 1125, 13, 4706, 565, 376, 3317, 29918, 2435, 29908, 297, 6694, 29901, 13, 9651, 286, 353, 6694, 3366, 3317, 29918, 2435, 3108, 13, 9651, 788, 4619, 285, 29908, 1192, 3317, 29918, 2435, 426, 29885, 29913, 376, 13, 4706, 565, 474, 6736, 6694, 3366, 29876, 7888, 3108, 29899, 29896, 322, 6389, 29889, 2704, 29901, 13, 9651, 788, 4619, 376, 1192, 2704, 29908, 13, 4706, 565, 6389, 29889, 5060, 442, 29901, 13, 9651, 788, 4619, 285, 29908, 489, 705, 5861, 426, 4299, 29918, 12083, 6822, 705, 5861, 29889, 29882, 2176, 29945, 29908, 13, 4706, 565, 451, 10151, 29918, 791, 29901, 13, 9651, 788, 4619, 285, 29908, 1192, 546, 29883, 1237, 29918, 18157, 426, 25376, 29918, 18157, 29913, 376, 13, 4706, 1683, 29901, 13, 9651, 788, 4619, 285, 29908, 1192, 18157, 426, 25376, 29918, 18157, 29913, 376, 13, 4706, 9920, 353, 285, 29908, 4691, 4765, 29914, 3445, 29876, 1562, 29914, 9794, 29914, 14968, 29918, 12857, 29889, 2272, 1192, 4632, 29918, 1272, 29871, 426, 2080, 29918, 12083, 29913, 1192, 4632, 29918, 7620, 426, 4299, 29918, 12083, 29913, 1192, 546, 29883, 1237, 29918, 26495, 426, 25376, 29918, 26495, 29913, 29871, 1192, 1545, 29879, 426, 1545, 29879, 5038, 718, 788, 13, 4706, 396, 9006, 353, 285, 29908, 4691, 4765, 29914, 3445, 29876, 1562, 29914, 9794, 29914, 14968, 29918, 12857, 29889, 2272, 1192, 4632, 29918, 1272, 29871, 426, 2080, 29918, 12083, 29913, 1192, 4632, 29918, 7620, 426, 4299, 29918, 12083, 29913, 1192, 546, 29883, 1237, 29918, 26495, 29871, 29900, 29871, 1192, 546, 29883, 1237, 29918, 18157, 29871, 29900, 1192, 2704, 29908, 13, 4706, 1596, 29898, 9006, 29897, 13, 4706, 565, 6389, 29889, 1867, 29901, 13, 9651, 1014, 5014, 29889, 3389, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 1423, 29922, 5574, 29897, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 9920, 353, 285, 29908, 4691, 29941, 758, 5014, 29918, 24713, 29889, 2272, 29871, 1192, 1853, 14897, 1192, 4299, 426, 4299, 29918, 12083, 6822, 705, 5861, 29889, 29882, 2176, 29945, 1192, 4905, 29918, 29881, 29894, 426, 4905, 29918, 12083, 29913, 1192, 4632, 29918, 29881, 847, 10526, 905, 29914, 4758, 29890, 2681, 29914, 1272, 29918, 5612, 29876, 1562, 29914, 1192, 4632, 29918, 29886, 848, 29914, 1457, 5014, 287, 29914, 1192, 999, 847, 10526, 905, 29914, 4758, 29890, 2681, 29914, 3445, 29876, 1562, 29963, 29896, 29900, 29914, 1272, 29914, 29903, 29906, 29947, 29947, 29907, 29918, 5679, 29918, 16506, 29918, 29934, 29953, 29946, 29899, 29906, 29899, 29896, 29918, 29906, 29900, 29896, 29945, 29900, 29896, 29896, 29941, 29889, 5444, 29908, 13, 4706, 1596, 29898, 9006, 29897, 13, 4706, 1014, 5014, 29889, 3389, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 1423, 29922, 5574, 29897, 13, 1678, 5174, 29901, 13, 1678, 9995, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 4905, 29918, 12083, 1125, 13, 4706, 788, 13776, 13, 4706, 565, 376, 3317, 29918, 2435, 29908, 297, 6694, 29901, 13, 9651, 286, 353, 6694, 3366, 3317, 29918, 2435, 3108, 13, 9651, 788, 4619, 285, 29908, 1192, 3317, 29918, 2435, 426, 29885, 5038, 13, 4706, 565, 6694, 29889, 657, 703, 20543, 29918, 5344, 613, 20569, 2804, 376, 1115, 13, 9651, 788, 4619, 285, 29908, 1192, 20543, 29918, 5344, 426, 26495, 1839, 20543, 29918, 5344, 2033, 5038, 13, 4706, 9920, 353, 285, 29908, 4691, 29941, 3984, 29883, 29914, 1457, 5014, 29918, 24713, 29889, 2272, 1192, 1195, 12539, 29918, 25376, 29918, 9812, 11249, 426, 26495, 29889, 657, 877, 1195, 12539, 29918, 25376, 29918, 9812, 11249, 742, 29900, 29889, 29945, 2915, 1192, 1853, 14897, 1192, 4299, 426, 4299, 29918, 12083, 6822, 705, 5861, 29889, 29882, 2176, 29945, 1192, 449, 426, 4905, 29918, 12083, 29913, 1192, 24713, 426, 5085, 29889, 24713, 29913, 376, 718, 788, 13, 4706, 1596, 29898, 9006, 29897, 13, 4706, 565, 6389, 29889, 1867, 29901, 13, 9651, 1014, 5014, 29889, 3389, 29898, 9006, 29892, 6473, 29922, 5574, 29892, 1423, 29922, 5574, 29897, 13, 2 ]
flask_vises/__init__.py
rexzhang/flask-vises
4
97641
<reponame>rexzhang/flask-vises #!/usr/bin/env python # coding=utf-8 __version__ = "2.1.4"
[ 1, 529, 276, 1112, 420, 29958, 276, 29916, 29920, 11895, 29914, 1579, 1278, 29899, 1730, 267, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 13, 13, 1649, 3259, 1649, 353, 376, 29906, 29889, 29896, 29889, 29946, 29908, 13, 2 ]
LAMP4SSCtests/ssc_problem_test.py
osmanmusa/learned_iterative_algorithms
2
147791
<reponame>osmanmusa/learned_iterative_algorithms<filename>LAMP4SSCtests/ssc_problem_test.py<gh_stars>1-10 #!/usr/bin/python from __future__ import division from __future__ import print_function """ This file serves as an example of how to a) select a problem to be solved b) select a network type c) train the network to minimize recovery MSE """ import numpy as np import math import numpy.linalg as la import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # BE QUIET!!!! os.environ['KMP_DUPLICATE_LIB_OK']='True' import tensorflow as tf np.random.seed(1) # numpy is good about making repeatable output tf.set_random_seed(1) # on the other hand, this is basically useless (see issue 9171) # import our problems, networks and training modules from tools import problems,networks,train # Evaluating (fixed-)GAMP in TensorFlow # For debugging purposes I initialize a session here - Intialize the Session sess = tf.Session() # MC is the number of transmitted messages (Monte Carlo simulations) MC = 10 # L is the number of sections L = 4 bps = 4 # B is the size of the section B = np.power(2, bps) # R is the rate of the code, bits per channel use R = 1.0 n = int(L*bps / R) # N is the length of a uncoded SSC message N = B * L noise_var = 1. # Create the basic problem structure. prob = problems.ssc_problem(n = n, L=L, bps=bps, MC=MC, SNR_dB=8) r_ = prob.xgen_ + tf.random_normal((N, MC), stddev=math.sqrt(noise_var)) r_rs_ = tf.reshape(tf.transpose(r_ ), (-1,B)) messages_hat_ = tf.reshape(tf.arg_max(r_rs_, 1), (MC,L)) x_hat_ = tf.one_hot(messages_hat_, depth=B) x_hat_ = tf.transpose(tf.reshape(x_hat_, [MC, N])) # BLER_ = 1 - tf.reduce_mean(tf.dtypes.cast(prob.messages_ == messages_hat_, dtype = tf.uint8)) error_matrix_ = tf.dtypes.cast(tf.math.equal(prob.messages_, tf.dtypes.cast(messages_hat_, tf.int32)), dtype = tf.float64) BLER_ = 1 - tf.reduce_mean(error_matrix_) sess = tf.Session() messages, xgen, x_hat, messages_hat, BLER_tf, r, r_rs = sess.run([prob.messages_, prob.xgen_, x_hat_, messages_hat_, BLER_,r_, r_rs_]) BLER = 1 - np.mean((messages==messages_hat)) # print('xgen=\n',xgen) # print('x_hat=\n',x_hat) print('xgen.shape=\n',xgen.shape) print('x_hat.shape=\n',x_hat.shape) print('r.shape=\n',r.shape) print('r_rs.shape=\n',r_rs.shape) print('messages=\n',messages) print('messages_hat=\n',messages_hat) print('BLER=\n',BLER) print('BLER_tf=\n',BLER_tf) messages, xgen, ygen = sess.run([prob.messages_, prob.xgen_, prob.ygen_]) # print('messages=\n',messages) # print('xgen=\n',xgen) # print('ygen=\n',ygen) # print('xgen.shape=\n',xgen.shape) # print('ygen.shape=\n',ygen.shape) sess.close()
[ 1, 529, 276, 1112, 420, 29958, 359, 1171, 8366, 29874, 29914, 1945, 9571, 29918, 1524, 1230, 29918, 9564, 12404, 29966, 9507, 29958, 4375, 3580, 29946, 1799, 29907, 21150, 29914, 893, 29883, 29918, 17199, 29918, 1688, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 15945, 29908, 13, 4013, 934, 19700, 408, 385, 1342, 310, 920, 304, 29871, 13, 29874, 29897, 1831, 263, 1108, 304, 367, 7484, 29871, 13, 29890, 29897, 1831, 263, 3564, 1134, 13, 29883, 29897, 7945, 278, 3564, 304, 6260, 675, 24205, 341, 1660, 13, 13, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 5215, 5844, 13, 5215, 12655, 29889, 29880, 979, 29887, 408, 425, 13, 5215, 2897, 13, 13, 359, 29889, 21813, 1839, 8969, 29918, 6271, 29925, 29918, 16173, 29918, 14480, 29918, 1307, 29963, 6670, 2033, 353, 525, 29906, 29915, 396, 20700, 660, 3120, 2544, 6824, 6824, 13, 359, 29889, 21813, 1839, 29968, 3580, 29918, 29928, 4897, 27888, 3040, 29918, 5265, 29933, 29918, 8949, 2033, 2433, 5574, 29915, 13, 5215, 26110, 408, 15886, 13, 13, 13, 9302, 29889, 8172, 29889, 26776, 29898, 29896, 29897, 396, 12655, 338, 1781, 1048, 3907, 12312, 519, 1962, 13, 13264, 29889, 842, 29918, 8172, 29918, 26776, 29898, 29896, 29897, 396, 373, 278, 916, 1361, 29892, 445, 338, 8830, 19315, 313, 4149, 2228, 29871, 29929, 29896, 29955, 29896, 29897, 13, 13, 29937, 1053, 1749, 4828, 29892, 14379, 322, 6694, 10585, 13, 3166, 8492, 1053, 4828, 29892, 11618, 29879, 29892, 14968, 13, 13, 29937, 382, 4387, 1218, 313, 20227, 15805, 12739, 3580, 297, 323, 6073, 17907, 13, 29937, 1152, 13490, 11976, 306, 11905, 263, 4867, 1244, 448, 3159, 6646, 278, 16441, 13, 29879, 404, 353, 15886, 29889, 7317, 580, 13, 13, 29937, 21271, 338, 278, 1353, 310, 18750, 4430, 7191, 313, 7185, 371, 15021, 23876, 29897, 13, 12513, 353, 29871, 29896, 29900, 13, 29937, 365, 338, 278, 1353, 310, 13926, 13, 29931, 353, 29871, 29946, 13, 29890, 567, 353, 29871, 29946, 13, 29937, 350, 338, 278, 2159, 310, 278, 4004, 13, 29933, 353, 7442, 29889, 13519, 29898, 29906, 29892, 289, 567, 29897, 13, 29937, 390, 338, 278, 6554, 310, 278, 775, 29892, 9978, 639, 8242, 671, 13, 29934, 353, 29871, 29896, 29889, 29900, 13, 29876, 353, 938, 29898, 29931, 29930, 29890, 567, 847, 390, 29897, 13, 29937, 405, 338, 278, 3309, 310, 263, 443, 29659, 5886, 29907, 2643, 13, 29940, 353, 350, 334, 365, 13, 1217, 895, 29918, 1707, 353, 29871, 29896, 29889, 13, 13, 29937, 6204, 278, 6996, 1108, 3829, 29889, 13, 22795, 353, 4828, 29889, 893, 29883, 29918, 17199, 29898, 29876, 353, 302, 29892, 365, 29922, 29931, 29892, 289, 567, 29922, 29890, 567, 29892, 21271, 29922, 12513, 29892, 317, 16514, 29918, 29881, 29933, 29922, 29947, 29897, 13, 13, 13, 29878, 29918, 353, 2070, 29889, 29916, 1885, 29918, 718, 15886, 29889, 8172, 29918, 8945, 3552, 29940, 29892, 21271, 511, 3659, 3359, 29922, 755, 29889, 3676, 29898, 1217, 895, 29918, 1707, 876, 13, 13, 29878, 29918, 2288, 29918, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 3286, 4220, 29898, 29878, 29918, 10353, 8521, 29896, 29892, 29933, 876, 13, 19158, 29918, 2455, 29918, 353, 15886, 29889, 690, 14443, 29898, 13264, 29889, 1191, 29918, 3317, 29898, 29878, 29918, 2288, 3383, 29871, 29896, 511, 313, 12513, 29892, 29931, 876, 13, 29916, 29918, 2455, 29918, 353, 15886, 29889, 650, 29918, 8711, 29898, 19158, 29918, 2455, 3383, 10809, 29922, 29933, 29897, 13, 29916, 29918, 2455, 29918, 353, 15886, 29889, 3286, 4220, 29898, 13264, 29889, 690, 14443, 29898, 29916, 29918, 2455, 3383, 518, 12513, 29892, 405, 12622, 13, 13, 29937, 350, 29931, 1001, 29918, 353, 29871, 29896, 448, 15886, 29889, 17469, 29918, 12676, 29898, 13264, 29889, 29881, 8768, 29889, 4384, 29898, 22795, 29889, 19158, 29918, 1275, 7191, 29918, 2455, 3383, 26688, 353, 15886, 29889, 13470, 29947, 876, 13, 2704, 29918, 5344, 29918, 353, 15886, 29889, 29881, 8768, 29889, 4384, 29898, 13264, 29889, 755, 29889, 11745, 29898, 22795, 29889, 19158, 3383, 15886, 29889, 29881, 8768, 29889, 4384, 29898, 19158, 29918, 2455, 3383, 15886, 29889, 524, 29941, 29906, 8243, 26688, 353, 15886, 29889, 7411, 29953, 29946, 29897, 13, 13367, 1001, 29918, 353, 29871, 29896, 448, 15886, 29889, 17469, 29918, 12676, 29898, 2704, 29918, 5344, 19925, 13, 13, 29879, 404, 353, 15886, 29889, 7317, 580, 13, 13, 19158, 29892, 921, 1885, 29892, 921, 29918, 2455, 29892, 7191, 29918, 2455, 29892, 350, 29931, 1001, 29918, 13264, 29892, 364, 29892, 364, 29918, 2288, 353, 27937, 29889, 3389, 4197, 22795, 29889, 19158, 3383, 2070, 29889, 29916, 1885, 3383, 921, 29918, 2455, 3383, 7191, 29918, 2455, 3383, 350, 29931, 1001, 3383, 29878, 3383, 364, 29918, 2288, 29918, 2314, 13, 13, 13367, 1001, 353, 29871, 29896, 448, 7442, 29889, 12676, 3552, 19158, 1360, 19158, 29918, 2455, 876, 13, 13, 29937, 1596, 877, 29916, 1885, 2013, 29876, 742, 29916, 1885, 29897, 13, 29937, 1596, 877, 29916, 29918, 2455, 2013, 29876, 742, 29916, 29918, 2455, 29897, 13, 2158, 877, 29916, 1885, 29889, 12181, 2013, 29876, 742, 29916, 1885, 29889, 12181, 29897, 13, 2158, 877, 29916, 29918, 2455, 29889, 12181, 2013, 29876, 742, 29916, 29918, 2455, 29889, 12181, 29897, 13, 2158, 877, 29878, 29889, 12181, 2013, 29876, 742, 29878, 29889, 12181, 29897, 13, 2158, 877, 29878, 29918, 2288, 29889, 12181, 2013, 29876, 742, 29878, 29918, 2288, 29889, 12181, 29897, 13, 13, 2158, 877, 19158, 2013, 29876, 742, 19158, 29897, 13, 2158, 877, 19158, 29918, 2455, 2013, 29876, 742, 19158, 29918, 2455, 29897, 13, 2158, 877, 13367, 1001, 2013, 29876, 742, 13367, 1001, 29897, 13, 2158, 877, 13367, 1001, 29918, 13264, 2013, 29876, 742, 13367, 1001, 29918, 13264, 29897, 13, 13, 13, 19158, 29892, 921, 1885, 29892, 343, 1885, 353, 27937, 29889, 3389, 4197, 22795, 29889, 19158, 3383, 2070, 29889, 29916, 1885, 3383, 2070, 29889, 29891, 1885, 29918, 2314, 13, 13, 29937, 1596, 877, 19158, 2013, 29876, 742, 19158, 29897, 13, 29937, 1596, 877, 29916, 1885, 2013, 29876, 742, 29916, 1885, 29897, 13, 29937, 1596, 877, 29891, 1885, 2013, 29876, 742, 29891, 1885, 29897, 13, 13, 29937, 1596, 877, 29916, 1885, 29889, 12181, 2013, 29876, 742, 29916, 1885, 29889, 12181, 29897, 13, 29937, 1596, 877, 29891, 1885, 29889, 12181, 2013, 29876, 742, 29891, 1885, 29889, 12181, 29897, 13, 13, 29879, 404, 29889, 5358, 580, 2 ]
5-gui.py
theseana/pesteh
1
44977
<reponame>theseana/pesteh from tkinter import * root = Tk() root.config(bg='yellow') l1 = Label(root, text='Hello World!', bg='magenta') l1.pack(side=LEFT) b1 = Button(root, text='Click Me Please!', bg='cyan') b1.pack(side=LEFT) l2 = Label(root, text='Ta-Da!', bg='green') l2.pack(side=LEFT) root.mainloop()
[ 1, 529, 276, 1112, 420, 29958, 386, 968, 1648, 29914, 29886, 4196, 29882, 13, 3166, 18883, 1639, 1053, 334, 30004, 13, 30004, 13, 4632, 353, 323, 29895, 26471, 13, 4632, 29889, 2917, 29898, 16264, 2433, 29136, 1495, 30004, 13, 30004, 13, 29880, 29896, 353, 15796, 29898, 4632, 29892, 1426, 2433, 10994, 2787, 29991, 742, 25989, 2433, 11082, 6381, 1495, 30004, 13, 29880, 29896, 29889, 4058, 29898, 2975, 29922, 28024, 8443, 13, 30004, 13, 29890, 29896, 353, 11025, 29898, 4632, 29892, 1426, 2433, 4164, 2191, 3529, 29991, 742, 25989, 2433, 1270, 273, 1495, 30004, 13, 29890, 29896, 29889, 4058, 29898, 2975, 29922, 28024, 8443, 13, 30004, 13, 29880, 29906, 353, 15796, 29898, 4632, 29892, 1426, 2433, 29911, 29874, 29899, 27838, 29991, 742, 25989, 2433, 12692, 1495, 30004, 13, 29880, 29906, 29889, 4058, 29898, 2975, 29922, 28024, 8443, 13, 30004, 13, 4632, 29889, 3396, 7888, 26471, 13, 2 ]
unit_tests/test_actions_service.py
canonical/charm-ceph-osd
17
94928
# Copyright 2020 Canonical Ltd # # 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 # # http://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 mock from contextlib import contextmanager from actions import service from hooks import utils from test_utils import CharmTestCase class CompletedProcessMock: def __init__(self, stdout=b'', stderr=b''): self.stdout = stdout self.stderr = stderr class ServiceActionTests(CharmTestCase): _PRESENT_SERVICES = [ "[email protected]", "[email protected]", "[email protected]", ] _TARGET_ALL = 'ceph-osd.target' _CHECK_CALL_TIMEOUT = 300 def __init__(self, methodName='runTest'): super(ServiceActionTests, self).__init__(methodName) def setUp(self, obj=None, patches=None): super(ServiceActionTests, self).setUp( service, ['subprocess', 'function_fail', 'log', 'assess_status', 'shutil'] ) present_services = '\n'.join(self._PRESENT_SERVICES).encode('utf-8') self.shutil.which.return_value = '/bin/systemctl' self.subprocess.check_call.return_value = None self.subprocess.run.return_value = CompletedProcessMock( stdout=present_services) @contextmanager def func_call_arguments(self, osds=None): with mock.patch("utils.function_get") as mock_function_get: self._func_args = {'osds': osds} mock_function_get.side_effect = \ lambda arg: self._func_args.get(arg) yield def assert_action_start_fail(self, msg): self.assert_function_fail(service.START, msg) def assert_action_stop_fail(self, msg): self.assert_function_fail(service.STOP, msg) def assert_function_fail(self, action, msg): expected_error = "Action '{}' failed: {}".format(action, msg) self.function_fail.assert_called_with(expected_error) @staticmethod def call_action_start(): service.main(['start']) @staticmethod def call_action_stop(): service.main(['stop']) def test_systemctl_execute_all(self): action = 'start' services = utils.ALL expected_call = mock.call(['systemctl', action, self._TARGET_ALL], timeout=self._CHECK_CALL_TIMEOUT) service.systemctl_execute(action, services) self.subprocess.check_call.assert_has_calls([expected_call]) def systemctl_execute_specific(self): action = 'start' services = ['[email protected]', '[email protected]'] systemctl_call = ['systemctl', action] + services expected_call = mock.call(systemctl_call, timeout=self._CHECK_CALL_TIMEOUT) service.systemctl_execute(action, services) self.subprocess.check_call.assert_has_calls([expected_call]) def test_id_translation(self): service_ids = {1, utils.ALL, 2} expected_names = [ '[email protected]', utils.ALL, '[email protected]', ] service_names = service.osd_ids_to_service_names(service_ids) self.assertEqual(sorted(service_names), sorted(expected_names)) def test_skip_service_presence_check(self): service_list = [utils.ALL] service.check_service_is_present(service_list) self.subprocess.run.assert_not_called() def test_raise_all_missing_services(self): missing_service_id = '99,100' missing_list = [] for id_ in missing_service_id.split(','): missing_list.append("ceph-osd@{}.service".format(id_)) service_list_cmd = ['systemctl', 'list-units', '--full', '--all', '--no-pager', '-t', 'service'] err_msg = 'Some services are not present on this ' \ 'unit: {}'.format(missing_list) with self.assertRaises(RuntimeError, msg=err_msg): service.check_service_is_present(missing_list) self.subprocess.run.assert_called_with(service_list_cmd, stdout=self.subprocess.PIPE, timeout=30) def test_fail_execute_unknown_action(self): action = 'foo' err_msg = 'Unknown action "{}"'.format(action) with self.assertRaises(RuntimeError, msg=err_msg): service.execute_action(action) @mock.patch.object(service, 'systemctl_execute') def test_execute_action(self, _): with self.func_call_arguments(osds=utils.ALL): service.execute_action(service.START) service.systemctl_execute.assert_called_with(service.START, [utils.ALL]) service.execute_action(service.STOP) service.systemctl_execute.assert_called_with(service.STOP, [utils.ALL]) @mock.patch.object(service, 'execute_action') def test_action_stop(self, execute_action): self.call_action_stop() execute_action.assert_called_with(service.STOP) @mock.patch.object(service, 'execute_action') def test_action_start(self, execute_action): self.call_action_start() execute_action.assert_called_with(service.START) def test_actions_requires_systemd(self): """Actions will fail if systemd is not present on the system""" self.shutil.which.return_value = None expected_error = 'This action requires systemd' with self.func_call_arguments(osds='all'): self.call_action_start() self.assert_action_start_fail(expected_error) self.call_action_stop() self.assert_action_stop_fail(expected_error) self.subprocess.check_call.assert_not_called() def test_unknown_action(self): action = 'foo' err_msg = 'Action {} undefined'.format(action) service.main([action]) self.function_fail.assert_called_with(err_msg) @mock.patch.object(service, 'execute_action') def test_action_failure(self, start_function): err_msg = 'Test Error' service.execute_action.side_effect = RuntimeError(err_msg) self.call_action_start() self.assert_action_start_fail(err_msg)
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 1815, 265, 936, 19806, 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, 29871, 1732, 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, 11187, 13, 3166, 3030, 1982, 1053, 3030, 12847, 13, 13, 3166, 8820, 1053, 2669, 13, 3166, 12422, 29879, 1053, 3667, 29879, 13, 13, 3166, 1243, 29918, 13239, 1053, 678, 2817, 3057, 8259, 13, 13, 13, 1990, 15642, 9446, 7032, 18680, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 27591, 29922, 29890, 29915, 742, 380, 20405, 29922, 29890, 4907, 1125, 13, 4706, 1583, 29889, 25393, 353, 27591, 13, 4706, 1583, 29889, 303, 20405, 353, 380, 20405, 13, 13, 13, 1990, 6692, 4276, 24376, 29898, 1451, 2817, 3057, 8259, 1125, 13, 1678, 903, 15094, 29903, 3919, 29918, 6304, 29963, 2965, 2890, 353, 518, 13, 4706, 376, 346, 561, 29899, 359, 29881, 29992, 29900, 29889, 5509, 613, 13, 4706, 376, 346, 561, 29899, 359, 29881, 29992, 29896, 29889, 5509, 613, 13, 4706, 376, 346, 561, 29899, 359, 29881, 29992, 29906, 29889, 5509, 613, 13, 1678, 4514, 13, 13, 1678, 903, 29911, 1718, 7194, 29918, 9818, 353, 525, 346, 561, 29899, 359, 29881, 29889, 5182, 29915, 13, 13, 1678, 903, 3210, 16658, 29918, 29907, 9818, 29918, 15307, 12015, 353, 29871, 29941, 29900, 29900, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1158, 1170, 2433, 3389, 3057, 29374, 13, 4706, 2428, 29898, 3170, 4276, 24376, 29892, 1583, 467, 1649, 2344, 12035, 5696, 1170, 29897, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 29892, 5446, 29922, 8516, 29892, 13261, 267, 29922, 8516, 1125, 13, 4706, 2428, 29898, 3170, 4276, 24376, 29892, 1583, 467, 842, 3373, 29898, 13, 9651, 2669, 29892, 13, 9651, 6024, 1491, 5014, 742, 525, 2220, 29918, 14057, 742, 13, 632, 525, 1188, 742, 525, 465, 404, 29918, 4882, 742, 525, 845, 4422, 2033, 13, 4706, 1723, 13, 4706, 2198, 29918, 9916, 353, 11297, 29876, 4286, 7122, 29898, 1311, 3032, 15094, 29903, 3919, 29918, 6304, 29963, 2965, 2890, 467, 12508, 877, 9420, 29899, 29947, 1495, 13, 13, 4706, 1583, 29889, 845, 4422, 29889, 4716, 29889, 2457, 29918, 1767, 353, 8207, 2109, 29914, 5205, 16948, 29915, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3198, 29918, 4804, 29889, 2457, 29918, 1767, 353, 6213, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3389, 29889, 2457, 29918, 1767, 353, 15642, 9446, 7032, 18680, 29898, 13, 9651, 27591, 29922, 6338, 29918, 9916, 29897, 13, 13, 1678, 732, 4703, 12847, 13, 1678, 822, 3653, 29918, 4804, 29918, 25699, 29898, 1311, 29892, 2897, 6289, 29922, 8516, 1125, 13, 4706, 411, 11187, 29889, 5041, 703, 13239, 29889, 2220, 29918, 657, 1159, 408, 11187, 29918, 2220, 29918, 657, 29901, 13, 9651, 1583, 3032, 9891, 29918, 5085, 353, 11117, 359, 6289, 2396, 2897, 6289, 29913, 13, 9651, 11187, 29918, 2220, 29918, 657, 29889, 2975, 29918, 15987, 353, 320, 13, 18884, 14013, 1852, 29901, 1583, 3032, 9891, 29918, 5085, 29889, 657, 29898, 1191, 29897, 13, 9651, 7709, 13, 13, 1678, 822, 4974, 29918, 2467, 29918, 2962, 29918, 14057, 29898, 1311, 29892, 10191, 1125, 13, 4706, 1583, 29889, 9294, 29918, 2220, 29918, 14057, 29898, 5509, 29889, 25826, 29892, 10191, 29897, 13, 13, 1678, 822, 4974, 29918, 2467, 29918, 9847, 29918, 14057, 29898, 1311, 29892, 10191, 1125, 13, 4706, 1583, 29889, 9294, 29918, 2220, 29918, 14057, 29898, 5509, 29889, 1254, 4590, 29892, 10191, 29897, 13, 13, 1678, 822, 4974, 29918, 2220, 29918, 14057, 29898, 1311, 29892, 3158, 29892, 10191, 1125, 13, 4706, 3806, 29918, 2704, 353, 376, 4276, 525, 8875, 29915, 5229, 29901, 6571, 1642, 4830, 29898, 2467, 29892, 10191, 29897, 13, 4706, 1583, 29889, 2220, 29918, 14057, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 9684, 29918, 2704, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1246, 29918, 2467, 29918, 2962, 7295, 13, 4706, 2669, 29889, 3396, 18959, 2962, 11287, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1246, 29918, 2467, 29918, 9847, 7295, 13, 4706, 2669, 29889, 3396, 18959, 9847, 11287, 13, 13, 1678, 822, 1243, 29918, 5205, 16948, 29918, 7978, 29918, 497, 29898, 1311, 1125, 13, 4706, 3158, 353, 525, 2962, 29915, 13, 4706, 5786, 353, 3667, 29879, 29889, 9818, 13, 13, 4706, 3806, 29918, 4804, 353, 11187, 29889, 4804, 18959, 5205, 16948, 742, 3158, 29892, 1583, 3032, 29911, 1718, 7194, 29918, 9818, 1402, 13, 462, 462, 29871, 11815, 29922, 1311, 3032, 3210, 16658, 29918, 29907, 9818, 29918, 15307, 12015, 29897, 13, 13, 4706, 2669, 29889, 5205, 16948, 29918, 7978, 29898, 2467, 29892, 5786, 29897, 13, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3198, 29918, 4804, 29889, 9294, 29918, 5349, 29918, 29883, 4293, 4197, 9684, 29918, 4804, 2314, 13, 13, 1678, 822, 1788, 16948, 29918, 7978, 29918, 14940, 29898, 1311, 1125, 13, 4706, 3158, 353, 525, 2962, 29915, 13, 4706, 5786, 353, 6024, 346, 561, 29899, 359, 29881, 29992, 29896, 29889, 5509, 742, 525, 346, 561, 29899, 359, 29881, 29992, 29906, 29889, 5509, 2033, 13, 13, 4706, 1788, 16948, 29918, 4804, 353, 6024, 5205, 16948, 742, 3158, 29962, 718, 5786, 13, 4706, 3806, 29918, 4804, 353, 11187, 29889, 4804, 29898, 5205, 16948, 29918, 4804, 29892, 13, 462, 462, 29871, 11815, 29922, 1311, 3032, 3210, 16658, 29918, 29907, 9818, 29918, 15307, 12015, 29897, 13, 13, 4706, 2669, 29889, 5205, 16948, 29918, 7978, 29898, 2467, 29892, 5786, 29897, 13, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3198, 29918, 4804, 29889, 9294, 29918, 5349, 29918, 29883, 4293, 4197, 9684, 29918, 4804, 2314, 13, 13, 1678, 822, 1243, 29918, 333, 29918, 3286, 18411, 29898, 1311, 1125, 13, 4706, 2669, 29918, 4841, 353, 426, 29896, 29892, 3667, 29879, 29889, 9818, 29892, 29871, 29906, 29913, 13, 4706, 3806, 29918, 7039, 353, 518, 13, 9651, 525, 346, 561, 29899, 359, 29881, 29992, 29896, 29889, 5509, 742, 13, 9651, 3667, 29879, 29889, 9818, 29892, 13, 9651, 525, 346, 561, 29899, 359, 29881, 29992, 29906, 29889, 5509, 742, 13, 4706, 4514, 13, 4706, 2669, 29918, 7039, 353, 2669, 29889, 359, 29881, 29918, 4841, 29918, 517, 29918, 5509, 29918, 7039, 29898, 5509, 29918, 4841, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 24582, 29898, 5509, 29918, 7039, 511, 12705, 29898, 9684, 29918, 7039, 876, 13, 13, 1678, 822, 1243, 29918, 11014, 29918, 5509, 29918, 4569, 663, 29918, 3198, 29898, 1311, 1125, 13, 4706, 2669, 29918, 1761, 353, 518, 13239, 29889, 9818, 29962, 13, 13, 4706, 2669, 29889, 3198, 29918, 5509, 29918, 275, 29918, 6338, 29898, 5509, 29918, 1761, 29897, 13, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3389, 29889, 9294, 29918, 1333, 29918, 13998, 580, 13, 13, 1678, 822, 1243, 29918, 22692, 29918, 497, 29918, 27259, 29918, 9916, 29898, 1311, 1125, 13, 4706, 4567, 29918, 5509, 29918, 333, 353, 525, 29929, 29929, 29892, 29896, 29900, 29900, 29915, 13, 4706, 4567, 29918, 1761, 353, 5159, 13, 4706, 363, 1178, 29918, 297, 4567, 29918, 5509, 29918, 333, 29889, 5451, 29898, 3788, 1125, 13, 9651, 4567, 29918, 1761, 29889, 4397, 703, 346, 561, 29899, 359, 29881, 28312, 1836, 5509, 1642, 4830, 29898, 333, 29918, 876, 13, 13, 4706, 2669, 29918, 1761, 29918, 9006, 353, 6024, 5205, 16948, 742, 525, 1761, 29899, 348, 1169, 742, 525, 489, 8159, 742, 525, 489, 497, 742, 13, 462, 9651, 525, 489, 1217, 29899, 29886, 1875, 742, 17411, 29873, 742, 525, 5509, 2033, 13, 13, 4706, 4589, 29918, 7645, 353, 525, 9526, 5786, 526, 451, 2198, 373, 445, 525, 320, 13, 462, 29871, 525, 5441, 29901, 6571, 4286, 4830, 29898, 27259, 29918, 1761, 29897, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 7944, 2392, 29892, 10191, 29922, 3127, 29918, 7645, 1125, 13, 9651, 2669, 29889, 3198, 29918, 5509, 29918, 275, 29918, 6338, 29898, 27259, 29918, 1761, 29897, 13, 13, 4706, 1583, 29889, 1491, 5014, 29889, 3389, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 5509, 29918, 1761, 29918, 9006, 29892, 13, 462, 462, 1669, 27591, 29922, 1311, 29889, 1491, 5014, 29889, 2227, 4162, 29892, 13, 462, 462, 1669, 11815, 29922, 29941, 29900, 29897, 13, 13, 1678, 822, 1243, 29918, 14057, 29918, 7978, 29918, 26690, 29918, 2467, 29898, 1311, 1125, 13, 4706, 3158, 353, 525, 5431, 29915, 13, 4706, 4589, 29918, 7645, 353, 525, 14148, 3158, 29850, 5038, 4286, 4830, 29898, 2467, 29897, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 7944, 2392, 29892, 10191, 29922, 3127, 29918, 7645, 1125, 13, 9651, 2669, 29889, 7978, 29918, 2467, 29898, 2467, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 29889, 3318, 29898, 5509, 29892, 525, 5205, 16948, 29918, 7978, 1495, 13, 1678, 822, 1243, 29918, 7978, 29918, 2467, 29898, 1311, 29892, 903, 1125, 13, 4706, 411, 1583, 29889, 9891, 29918, 4804, 29918, 25699, 29898, 359, 6289, 29922, 13239, 29889, 9818, 1125, 13, 9651, 2669, 29889, 7978, 29918, 2467, 29898, 5509, 29889, 25826, 29897, 13, 9651, 2669, 29889, 5205, 16948, 29918, 7978, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 5509, 29889, 25826, 29892, 13, 462, 462, 462, 308, 518, 13239, 29889, 9818, 2314, 13, 13, 9651, 2669, 29889, 7978, 29918, 2467, 29898, 5509, 29889, 1254, 4590, 29897, 13, 9651, 2669, 29889, 5205, 16948, 29918, 7978, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 5509, 29889, 1254, 4590, 29892, 13, 462, 462, 462, 308, 518, 13239, 29889, 9818, 2314, 13, 13, 1678, 732, 17640, 29889, 5041, 29889, 3318, 29898, 5509, 29892, 525, 7978, 29918, 2467, 1495, 13, 1678, 822, 1243, 29918, 2467, 29918, 9847, 29898, 1311, 29892, 6222, 29918, 2467, 1125, 13, 4706, 1583, 29889, 4804, 29918, 2467, 29918, 9847, 580, 13, 4706, 6222, 29918, 2467, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 5509, 29889, 1254, 4590, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 29889, 3318, 29898, 5509, 29892, 525, 7978, 29918, 2467, 1495, 13, 1678, 822, 1243, 29918, 2467, 29918, 2962, 29898, 1311, 29892, 6222, 29918, 2467, 1125, 13, 4706, 1583, 29889, 4804, 29918, 2467, 29918, 2962, 580, 13, 4706, 6222, 29918, 2467, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 5509, 29889, 25826, 29897, 13, 13, 1678, 822, 1243, 29918, 7387, 29918, 276, 339, 2658, 29918, 5205, 29881, 29898, 1311, 1125, 13, 4706, 9995, 26525, 674, 4418, 565, 1788, 29881, 338, 451, 2198, 373, 278, 1788, 15945, 29908, 13, 4706, 1583, 29889, 845, 4422, 29889, 4716, 29889, 2457, 29918, 1767, 353, 6213, 13, 4706, 3806, 29918, 2704, 353, 525, 4013, 3158, 6858, 1788, 29881, 29915, 13, 4706, 411, 1583, 29889, 9891, 29918, 4804, 29918, 25699, 29898, 359, 6289, 2433, 497, 29374, 13, 9651, 1583, 29889, 4804, 29918, 2467, 29918, 2962, 580, 13, 9651, 1583, 29889, 9294, 29918, 2467, 29918, 2962, 29918, 14057, 29898, 9684, 29918, 2704, 29897, 13, 13, 9651, 1583, 29889, 4804, 29918, 2467, 29918, 9847, 580, 13, 9651, 1583, 29889, 9294, 29918, 2467, 29918, 9847, 29918, 14057, 29898, 9684, 29918, 2704, 29897, 13, 13, 9651, 1583, 29889, 1491, 5014, 29889, 3198, 29918, 4804, 29889, 9294, 29918, 1333, 29918, 13998, 580, 13, 13, 1678, 822, 1243, 29918, 26690, 29918, 2467, 29898, 1311, 1125, 13, 4706, 3158, 353, 525, 5431, 29915, 13, 4706, 4589, 29918, 7645, 353, 525, 4276, 6571, 7580, 4286, 4830, 29898, 2467, 29897, 13, 4706, 2669, 29889, 3396, 4197, 2467, 2314, 13, 4706, 1583, 29889, 2220, 29918, 14057, 29889, 9294, 29918, 13998, 29918, 2541, 29898, 3127, 29918, 7645, 29897, 13, 13, 1678, 732, 17640, 29889, 5041, 29889, 3318, 29898, 5509, 29892, 525, 7978, 29918, 2467, 1495, 13, 1678, 822, 1243, 29918, 2467, 29918, 14057, 545, 29898, 1311, 29892, 1369, 29918, 2220, 1125, 13, 4706, 4589, 29918, 7645, 353, 525, 3057, 4829, 29915, 13, 4706, 2669, 29889, 7978, 29918, 2467, 29889, 2975, 29918, 15987, 353, 24875, 2392, 29898, 3127, 29918, 7645, 29897, 13, 13, 4706, 1583, 29889, 4804, 29918, 2467, 29918, 2962, 580, 13, 13, 4706, 1583, 29889, 9294, 29918, 2467, 29918, 2962, 29918, 14057, 29898, 3127, 29918, 7645, 29897, 13, 2 ]
svc_tools/decorators.py
tylerwince/svc-tools
0
141978
"""Decorators that enable easy modifications to function behavior.""" import logging import time from functools import wraps from typing import Callable LOG = logging.getLogger("svc_tools") def timer(log_level: Callable): """Time a function and log the time it took to execute. If you want to know how long a function takes to execute ang log alongside your application logs, then decorate your function with this. :param log_level: logging method to use in call :returns: Whatever your original function returns Usage :: >>> from svc_tools import timer >>> from time import sleep >>> import logging >>> @timer(logging.warning) >>> def myFunc(sleep_time): ... # whatever you want to time ... sleep(sleep_time) >>> myFunc(10) WARNING:root:myFunc took 10.000502109527588 to run. """ def decorator(func): """Decorate the original function.""" @wraps(func) def new_timed_func(*args, **kwargs): """Do the timing.""" start_time = time.time() returned_value = func(*args, **kwargs) total_time = time.time() - start_time log_level(f"{func.__name__} took {total_time} to run.") return returned_value return new_timed_func return decorator
[ 1, 9995, 6185, 272, 4097, 393, 9025, 4780, 26278, 304, 740, 6030, 1213, 15945, 13, 5215, 12183, 13, 5215, 931, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 3166, 19229, 1053, 8251, 519, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 703, 4501, 29883, 29918, 8504, 1159, 13, 13, 13, 1753, 12237, 29898, 1188, 29918, 5563, 29901, 8251, 519, 1125, 13, 1678, 9995, 2481, 263, 740, 322, 1480, 278, 931, 372, 3614, 304, 6222, 29889, 13, 13, 1678, 960, 366, 864, 304, 1073, 920, 1472, 263, 740, 4893, 304, 6222, 13, 1678, 2614, 1480, 19963, 596, 2280, 10748, 29892, 769, 10200, 403, 13, 1678, 596, 740, 411, 445, 29889, 13, 13, 1678, 584, 3207, 1480, 29918, 5563, 29901, 12183, 1158, 304, 671, 297, 1246, 13, 1678, 584, 18280, 29901, 806, 5564, 596, 2441, 740, 3639, 13, 13, 1678, 10783, 482, 4761, 13, 418, 8653, 515, 3731, 29883, 29918, 8504, 1053, 12237, 13, 418, 8653, 515, 931, 1053, 8709, 13, 418, 8653, 1053, 12183, 13, 418, 8653, 732, 20404, 29898, 21027, 29889, 27392, 29897, 13, 418, 8653, 822, 590, 14400, 29898, 17059, 29918, 2230, 1125, 13, 418, 2023, 268, 396, 6514, 366, 864, 304, 931, 13, 418, 2023, 268, 8709, 29898, 17059, 29918, 2230, 29897, 13, 418, 8653, 590, 14400, 29898, 29896, 29900, 29897, 13, 418, 399, 25614, 29901, 4632, 29901, 1357, 14400, 3614, 29871, 29896, 29900, 29889, 29900, 29900, 29900, 29945, 29900, 29906, 29896, 29900, 29929, 29945, 29906, 29955, 29945, 29947, 29947, 304, 1065, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 10200, 1061, 29898, 9891, 1125, 13, 4706, 9995, 6185, 272, 403, 278, 2441, 740, 1213, 15945, 13, 13, 4706, 732, 29893, 336, 567, 29898, 9891, 29897, 13, 4706, 822, 716, 29918, 9346, 287, 29918, 9891, 10456, 5085, 29892, 3579, 19290, 1125, 13, 9651, 9995, 6132, 278, 28750, 1213, 15945, 13, 9651, 1369, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 9651, 4133, 29918, 1767, 353, 3653, 10456, 5085, 29892, 3579, 19290, 29897, 13, 9651, 3001, 29918, 2230, 353, 931, 29889, 2230, 580, 448, 1369, 29918, 2230, 13, 9651, 1480, 29918, 5563, 29898, 29888, 29908, 29912, 9891, 17255, 978, 1649, 29913, 3614, 426, 7827, 29918, 2230, 29913, 304, 1065, 23157, 13, 9651, 736, 4133, 29918, 1767, 13, 13, 4706, 736, 716, 29918, 9346, 287, 29918, 9891, 13, 13, 1678, 736, 10200, 1061, 13, 2 ]
datalad/customremotes/tests/test_archives.py
yarikoptic/datalad
0
1602593
<gh_stars>0 # emacs: -*- mode: python; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*- # ex: set sts=4 ts=4 sw=4 noet: # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## # # See COPYING file distributed along with the datalad package for the # copyright and license terms. # # ## ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ## """Tests for customremotes archives providing dl+archive URLs handling""" from ..archives import ArchiveAnnexCustomRemote from ..base import AnnexExchangeProtocol from ...support.annexrepo import AnnexRepo from ...consts import ARCHIVES_SPECIAL_REMOTE from ...tests.utils import * from ...cmd import Runner, GitRunner from ...utils import _path_ from . import _get_custom_runner # both files will have the same content # fn_inarchive_obscure = 'test.dat' # fn_extracted_obscure = 'test2.dat' fn_inarchive_obscure = get_most_obscure_supported_name() fn_archive_obscure = fn_inarchive_obscure.replace('a', 'b') + '.tar.gz' fn_extracted_obscure = fn_inarchive_obscure.replace('a', 'z') #import line_profiler #prof = line_profiler.LineProfiler() # TODO: with_tree ATM for archives creates this nested top directory # matching archive name, so it will be a/d/test.dat ... we don't want that probably @with_tree( tree=(('a.tar.gz', {'d': {fn_inarchive_obscure: '123'}}), ('simple.txt', '123'), (fn_archive_obscure, (('d', ((fn_inarchive_obscure, '123'),)),)), (fn_extracted_obscure, '123'))) @with_tempfile() def check_basic_scenario(fn_archive, fn_extracted, direct, d, d2): annex = AnnexRepo(d, runner=_get_custom_runner(d), direct=direct) annex.init_remote( ARCHIVES_SPECIAL_REMOTE, ['encryption=none', 'type=external', 'externaltype=%s' % ARCHIVES_SPECIAL_REMOTE, 'autoenable=true' ]) assert annex.is_special_annex_remote(ARCHIVES_SPECIAL_REMOTE) # We want two maximally obscure names, which are also different assert(fn_extracted != fn_inarchive_obscure) annex.add(fn_archive, commit=True, msg="Added tarball") annex.add(fn_extracted, commit=True, msg="Added the load file") # Operations with archive remote URL annexcr = ArchiveAnnexCustomRemote(path=d) # few quick tests for get_file_url eq_(annexcr.get_file_url(archive_key="xyz", file="a.dat"), "dl+archive:xyz#path=a.dat") eq_(annexcr.get_file_url(archive_key="xyz", file="a.dat", size=999), "dl+archive:xyz#path=a.dat&size=999") # see https://github.com/datalad/datalad/issues/441#issuecomment-223376906 # old style eq_(annexcr._parse_url("dl+archive:xyz/a.dat#size=999"), ("xyz", "a.dat", {'size': 999})) eq_(annexcr._parse_url("dl+archive:xyz/a.dat"), ("xyz", "a.dat", {})) # old format without size # new style eq_(annexcr._parse_url("dl+archive:xyz#path=a.dat&size=999"), ("xyz", "a.dat", {'size': 999})) eq_(annexcr._parse_url("dl+archive:xyz#path=a.dat"), ("xyz", "a.dat", {})) # old format without size file_url = annexcr.get_file_url( archive_file=fn_archive, file=fn_archive.replace('.tar.gz', '') + '/d/'+fn_inarchive_obscure) annex.add_url_to_file(fn_extracted, file_url, ['--relaxed']) annex.drop(fn_extracted) list_of_remotes = annex.whereis(fn_extracted, output='descriptions') in_('[%s]' % ARCHIVES_SPECIAL_REMOTE, list_of_remotes) assert_false(annex.file_has_content(fn_extracted)) annex.get(fn_extracted) assert_true(annex.file_has_content(fn_extracted)) annex.rm_url(fn_extracted, file_url) assert_false(annex.drop(fn_extracted)['success']) annex.add_url_to_file(fn_extracted, file_url) annex.drop(fn_extracted) annex.get(fn_extracted) annex.drop(fn_extracted) # so we don't get from this one next # Let's create a clone and verify chain of getting file through the tarball cloned_annex = AnnexRepo.clone(d, d2, runner=_get_custom_runner(d2), direct=direct) # we still need to enable manually atm that special remote for archives # cloned_annex.enable_remote('annexed-archives') assert_false(cloned_annex.file_has_content(fn_archive)) assert_false(cloned_annex.file_has_content(fn_extracted)) cloned_annex.get(fn_extracted) assert_true(cloned_annex.file_has_content(fn_extracted)) # as a result it would also fetch tarball assert_true(cloned_annex.file_has_content(fn_archive)) # Check if protocol was collected if os.environ.get('DATALAD_TESTS_PROTOCOLREMOTE'): assert_is_instance(annex.cmd_call_wrapper.protocol, AnnexExchangeProtocol) protocol_file = _path_(annex.path, '.git/bin/git-annex-remote-datalad-archive') ok_file_has_content(protocol_file, "VERSION 1", re_=True, match=False) ok_file_has_content(protocol_file, "GETAVAILABILITY", re_=True, match=False) ok_file_has_content(protocol_file, "#!/bin/bash", re_=True, match=False) else: assert_false(isinstance(annex.cmd_call_wrapper.protocol, AnnexExchangeProtocol)) # verify that we can drop if original archive gets dropped but available online: # -- done as part of the test_add_archive_content.py # verify that we can't drop a file if archive key was dropped and online archive was removed or changed size! ;) @with_tree( tree={'a.tar.gz': {'d': {fn_inarchive_obscure: '123'}}} ) def test_annex_get_from_subdir(topdir): from datalad.api import add_archive_content annex = AnnexRepo(topdir, init=True) annex.add('a.tar.gz', commit=True) add_archive_content('a.tar.gz', annex=annex, delete=True) fpath = opj(topdir, 'a', 'd', fn_inarchive_obscure) with chpwd(opj(topdir, 'a', 'd')): runner = Runner() runner(['git', 'annex', 'drop', fn_inarchive_obscure]) # run git annex drop assert_false(annex.file_has_content(fpath)) # and verify if file deleted from directory runner(['git', 'annex', 'get', fn_inarchive_obscure]) # run git annex get assert_true(annex.file_has_content(fpath)) # and verify if file got into directory def test_get_git_environ_adjusted(): gitrunner = GitRunner() env = {"GIT_DIR": "../../.git", "GIT_WORK_TREE": "../../", "TEST_VAR": "Exists"} # test conversion of relevant env vars from relative_path to correct absolute_path adj_env = gitrunner.get_git_environ_adjusted(env) assert_equal(adj_env["GIT_DIR"], abspath(env["GIT_DIR"])) assert_equal(adj_env["GIT_WORK_TREE"], abspath(env["GIT_WORK_TREE"])) # test if other environment variables passed to function returned unaltered assert_equal(adj_env["TEST_VAR"], env["TEST_VAR"]) # test import of sys_env if no environment passed to function sys_env = gitrunner.get_git_environ_adjusted() assert_equal(sys_env["PWD"], os.environ.get("PWD")) def test_basic_scenario(): yield check_basic_scenario, 'a.tar.gz', 'simple.txt', False if not on_windows: yield check_basic_scenario, 'a.tar.gz', 'simple.txt', True #yield check_basic_scenario, 'a.tar.gz', fn_extracted_obscure, False #yield check_basic_scenario, fn_archive_obscure, 'simple.txt', False yield check_basic_scenario, fn_archive_obscure, fn_extracted_obscure, False def test_no_rdflib_loaded(): # rely on rdflib polluting stdout to see that it is not loaded whenever we load this remote # since that adds 300ms delay for no immediate use from ...cmd import Runner runner = Runner() with swallow_outputs() as cmo: runner.run([sys.executable, '-c', 'import datalad.customremotes.archives, sys; print([k for k in sys.modules if k.startswith("rdflib")])'], log_stdout=False, log_stderr=False) # print cmo.out assert_not_in("rdflib", cmo.out) assert_not_in("rdflib", cmo.err)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 953, 16815, 29901, 448, 29930, 29899, 4464, 29901, 3017, 29936, 11451, 29899, 12860, 29899, 10289, 29901, 29871, 29946, 29936, 4434, 29899, 2103, 29901, 29871, 29946, 29936, 29536, 29899, 21175, 29899, 8513, 29901, 4263, 448, 29930, 29899, 13, 29937, 429, 29901, 731, 380, 29879, 29922, 29946, 18696, 29922, 29946, 2381, 29922, 29946, 694, 300, 29901, 13, 29937, 444, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 444, 13, 29937, 13, 29937, 259, 2823, 315, 4590, 29979, 4214, 934, 13235, 3412, 411, 278, 1418, 284, 328, 3577, 363, 278, 13, 29937, 259, 3509, 1266, 322, 19405, 4958, 29889, 13, 29937, 13, 29937, 444, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, 444, 13, 15945, 29908, 24376, 363, 2888, 1745, 4769, 3190, 3145, 13138, 270, 29880, 29974, 10867, 24295, 11415, 15945, 29908, 13, 13, 3166, 6317, 1279, 3145, 1053, 9000, 2744, 13996, 7281, 20224, 13, 3166, 6317, 3188, 1053, 10558, 29916, 1252, 3167, 17830, 13, 3166, 2023, 5924, 29889, 11276, 29916, 20095, 1053, 10558, 29916, 5612, 29877, 13, 3166, 2023, 3075, 29879, 1053, 9033, 3210, 5667, 2890, 29918, 29903, 4162, 8426, 1964, 29918, 1525, 29924, 2891, 29923, 13, 3166, 2023, 21150, 29889, 13239, 1053, 334, 13, 3166, 2023, 9006, 1053, 7525, 1089, 29892, 11786, 16802, 13, 3166, 2023, 13239, 1053, 903, 2084, 29918, 13, 13, 3166, 869, 1053, 903, 657, 29918, 6341, 29918, 27492, 13, 13, 29937, 1716, 2066, 674, 505, 278, 1021, 2793, 13, 29937, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 353, 525, 1688, 29889, 4130, 29915, 13, 29937, 7876, 29918, 21111, 287, 29918, 711, 1557, 545, 353, 525, 1688, 29906, 29889, 4130, 29915, 13, 9144, 29918, 262, 10867, 29918, 711, 1557, 545, 353, 679, 29918, 3242, 29918, 711, 1557, 545, 29918, 23765, 29918, 978, 580, 13, 9144, 29918, 10867, 29918, 711, 1557, 545, 353, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 29889, 6506, 877, 29874, 742, 525, 29890, 1495, 718, 15300, 12637, 29889, 18828, 29915, 13, 9144, 29918, 21111, 287, 29918, 711, 1557, 545, 353, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 29889, 6506, 877, 29874, 742, 525, 29920, 1495, 13, 13, 29937, 5215, 1196, 29918, 771, 1777, 261, 13, 29937, 23221, 353, 1196, 29918, 771, 1777, 261, 29889, 3542, 1184, 1777, 261, 580, 13, 13, 29937, 14402, 29901, 411, 29918, 8336, 15531, 29924, 363, 3190, 3145, 10017, 445, 9322, 2246, 3884, 13, 29937, 9686, 18871, 1024, 29892, 577, 372, 674, 367, 263, 29914, 29881, 29914, 1688, 29889, 4130, 2023, 591, 1016, 29915, 29873, 864, 393, 3117, 13, 29992, 2541, 29918, 8336, 29898, 13, 1678, 5447, 7607, 877, 29874, 29889, 12637, 29889, 18828, 742, 11117, 29881, 2396, 426, 9144, 29918, 262, 10867, 29918, 711, 1557, 545, 29901, 525, 29896, 29906, 29941, 29915, 930, 511, 13, 3986, 6702, 12857, 29889, 3945, 742, 525, 29896, 29906, 29941, 5477, 13, 3986, 313, 9144, 29918, 10867, 29918, 711, 1557, 545, 29892, 313, 877, 29881, 742, 5135, 9144, 29918, 262, 10867, 29918, 711, 1557, 545, 29892, 525, 29896, 29906, 29941, 5477, 8243, 8243, 13, 3986, 313, 9144, 29918, 21111, 287, 29918, 711, 1557, 545, 29892, 525, 29896, 29906, 29941, 29915, 4961, 13, 29992, 2541, 29918, 7382, 1445, 580, 13, 1753, 1423, 29918, 16121, 29918, 1557, 24893, 29898, 9144, 29918, 10867, 29892, 7876, 29918, 21111, 287, 29892, 1513, 29892, 270, 29892, 270, 29906, 1125, 13, 1678, 385, 13996, 353, 10558, 29916, 5612, 29877, 29898, 29881, 29892, 28877, 29922, 29918, 657, 29918, 6341, 29918, 27492, 29898, 29881, 511, 1513, 29922, 11851, 29897, 13, 1678, 385, 13996, 29889, 2344, 29918, 16674, 29898, 13, 4706, 9033, 3210, 5667, 2890, 29918, 29903, 4162, 8426, 1964, 29918, 1525, 29924, 2891, 29923, 29892, 13, 4706, 6024, 3977, 14272, 29922, 9290, 742, 525, 1853, 29922, 23176, 742, 525, 23176, 1853, 16328, 29879, 29915, 1273, 9033, 3210, 5667, 2890, 29918, 29903, 4162, 8426, 1964, 29918, 1525, 29924, 2891, 29923, 29892, 13, 308, 525, 6921, 12007, 29922, 3009, 29915, 13, 3986, 2314, 13, 1678, 4974, 385, 13996, 29889, 275, 29918, 18732, 29918, 11276, 29916, 29918, 16674, 29898, 1718, 3210, 5667, 2890, 29918, 29903, 4162, 8426, 1964, 29918, 1525, 29924, 2891, 29923, 29897, 13, 1678, 396, 1334, 864, 1023, 5256, 635, 19726, 545, 2983, 29892, 607, 526, 884, 1422, 13, 1678, 4974, 29898, 9144, 29918, 21111, 287, 2804, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 29897, 13, 1678, 385, 13996, 29889, 1202, 29898, 9144, 29918, 10867, 29892, 9063, 29922, 5574, 29892, 10191, 543, 2528, 287, 9913, 2135, 1159, 13, 1678, 385, 13996, 29889, 1202, 29898, 9144, 29918, 21111, 287, 29892, 9063, 29922, 5574, 29892, 10191, 543, 2528, 287, 278, 2254, 934, 1159, 13, 13, 1678, 396, 6607, 800, 411, 18871, 7592, 3988, 13, 1678, 385, 13996, 7283, 353, 9000, 2744, 13996, 7281, 20224, 29898, 2084, 29922, 29881, 29897, 13, 1678, 396, 2846, 4996, 6987, 363, 679, 29918, 1445, 29918, 2271, 13, 13, 1678, 11594, 23538, 11276, 29916, 7283, 29889, 657, 29918, 1445, 29918, 2271, 29898, 10867, 29918, 1989, 543, 20230, 613, 934, 543, 29874, 29889, 4130, 4968, 376, 11671, 29974, 10867, 29901, 20230, 29937, 2084, 29922, 29874, 29889, 4130, 1159, 13, 1678, 11594, 23538, 11276, 29916, 7283, 29889, 657, 29918, 1445, 29918, 2271, 29898, 10867, 29918, 1989, 543, 20230, 613, 934, 543, 29874, 29889, 4130, 613, 2159, 29922, 29929, 29929, 29929, 511, 376, 11671, 29974, 10867, 29901, 20230, 29937, 2084, 29922, 29874, 29889, 4130, 29987, 2311, 29922, 29929, 29929, 29929, 1159, 13, 13, 1678, 396, 1074, 2045, 597, 3292, 29889, 510, 29914, 29881, 2075, 328, 29914, 29881, 2075, 328, 29914, 12175, 29914, 29946, 29946, 29896, 29937, 15118, 9342, 29899, 29906, 29906, 29941, 29941, 29955, 29953, 29929, 29900, 29953, 13, 1678, 396, 2030, 3114, 13, 1678, 11594, 23538, 11276, 29916, 7283, 3032, 5510, 29918, 2271, 703, 11671, 29974, 10867, 29901, 20230, 29914, 29874, 29889, 4130, 29937, 2311, 29922, 29929, 29929, 29929, 4968, 4852, 20230, 613, 376, 29874, 29889, 4130, 613, 11117, 2311, 2396, 29871, 29929, 29929, 29929, 20073, 13, 1678, 11594, 23538, 11276, 29916, 7283, 3032, 5510, 29918, 2271, 703, 11671, 29974, 10867, 29901, 20230, 29914, 29874, 29889, 4130, 4968, 4852, 20230, 613, 376, 29874, 29889, 4130, 613, 6571, 876, 29871, 396, 2030, 3402, 1728, 2159, 13, 1678, 396, 716, 3114, 13, 1678, 11594, 23538, 11276, 29916, 7283, 3032, 5510, 29918, 2271, 703, 11671, 29974, 10867, 29901, 20230, 29937, 2084, 29922, 29874, 29889, 4130, 29987, 2311, 29922, 29929, 29929, 29929, 4968, 4852, 20230, 613, 376, 29874, 29889, 4130, 613, 11117, 2311, 2396, 29871, 29929, 29929, 29929, 20073, 13, 1678, 11594, 23538, 11276, 29916, 7283, 3032, 5510, 29918, 2271, 703, 11671, 29974, 10867, 29901, 20230, 29937, 2084, 29922, 29874, 29889, 4130, 4968, 4852, 20230, 613, 376, 29874, 29889, 4130, 613, 6571, 876, 29871, 396, 2030, 3402, 1728, 2159, 13, 13, 1678, 934, 29918, 2271, 353, 385, 13996, 7283, 29889, 657, 29918, 1445, 29918, 2271, 29898, 13, 4706, 18871, 29918, 1445, 29922, 9144, 29918, 10867, 29892, 13, 4706, 934, 29922, 9144, 29918, 10867, 29889, 6506, 12839, 12637, 29889, 18828, 742, 27255, 718, 8207, 29881, 29914, 18717, 9144, 29918, 262, 10867, 29918, 711, 1557, 545, 29897, 13, 13, 1678, 385, 13996, 29889, 1202, 29918, 2271, 29918, 517, 29918, 1445, 29898, 9144, 29918, 21111, 287, 29892, 934, 29918, 2271, 29892, 6024, 489, 27480, 287, 11287, 13, 1678, 385, 13996, 29889, 8865, 29898, 9144, 29918, 21111, 287, 29897, 13, 13, 1678, 1051, 29918, 974, 29918, 1745, 4769, 353, 385, 13996, 29889, 3062, 275, 29898, 9144, 29918, 21111, 287, 29892, 1962, 2433, 2783, 699, 1980, 1495, 13, 1678, 297, 29918, 877, 29961, 29995, 29879, 29962, 29915, 1273, 9033, 3210, 5667, 2890, 29918, 29903, 4162, 8426, 1964, 29918, 1525, 29924, 2891, 29923, 29892, 1051, 29918, 974, 29918, 1745, 4769, 29897, 13, 13, 1678, 4974, 29918, 4541, 29898, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 21111, 287, 876, 13, 1678, 385, 13996, 29889, 657, 29898, 9144, 29918, 21111, 287, 29897, 13, 1678, 4974, 29918, 3009, 29898, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 21111, 287, 876, 13, 13, 1678, 385, 13996, 29889, 1758, 29918, 2271, 29898, 9144, 29918, 21111, 287, 29892, 934, 29918, 2271, 29897, 13, 1678, 4974, 29918, 4541, 29898, 11276, 29916, 29889, 8865, 29898, 9144, 29918, 21111, 287, 29897, 1839, 8698, 11287, 13, 13, 1678, 385, 13996, 29889, 1202, 29918, 2271, 29918, 517, 29918, 1445, 29898, 9144, 29918, 21111, 287, 29892, 934, 29918, 2271, 29897, 13, 1678, 385, 13996, 29889, 8865, 29898, 9144, 29918, 21111, 287, 29897, 13, 1678, 385, 13996, 29889, 657, 29898, 9144, 29918, 21111, 287, 29897, 13, 1678, 385, 13996, 29889, 8865, 29898, 9144, 29918, 21111, 287, 29897, 29871, 396, 577, 591, 1016, 29915, 29873, 679, 515, 445, 697, 2446, 13, 13, 1678, 396, 2803, 29915, 29879, 1653, 263, 17432, 322, 11539, 9704, 310, 2805, 934, 1549, 278, 9913, 2135, 13, 1678, 1067, 22367, 29918, 11276, 29916, 353, 10558, 29916, 5612, 29877, 29889, 16513, 29898, 29881, 29892, 270, 29906, 29892, 13, 462, 462, 259, 28877, 29922, 29918, 657, 29918, 6341, 29918, 27492, 29898, 29881, 29906, 511, 13, 462, 462, 259, 1513, 29922, 11851, 29897, 13, 1678, 396, 591, 1603, 817, 304, 9025, 7522, 472, 29885, 393, 4266, 7592, 363, 3190, 3145, 13, 1678, 396, 1067, 22367, 29918, 11276, 29916, 29889, 12007, 29918, 16674, 877, 11276, 29916, 287, 29899, 1279, 3145, 1495, 13, 13, 1678, 4974, 29918, 4541, 29898, 695, 22367, 29918, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 10867, 876, 13, 1678, 4974, 29918, 4541, 29898, 695, 22367, 29918, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 21111, 287, 876, 13, 1678, 1067, 22367, 29918, 11276, 29916, 29889, 657, 29898, 9144, 29918, 21111, 287, 29897, 13, 1678, 4974, 29918, 3009, 29898, 695, 22367, 29918, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 21111, 287, 876, 13, 1678, 396, 408, 263, 1121, 372, 723, 884, 6699, 9913, 2135, 13, 1678, 4974, 29918, 3009, 29898, 695, 22367, 29918, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 9144, 29918, 10867, 876, 13, 13, 1678, 396, 5399, 565, 9608, 471, 16531, 13, 1678, 565, 2897, 29889, 21813, 29889, 657, 877, 25832, 1964, 3035, 29918, 18267, 29903, 29918, 8618, 4986, 15032, 1525, 29924, 2891, 29923, 29374, 13, 4706, 4974, 29918, 275, 29918, 8758, 29898, 11276, 29916, 29889, 9006, 29918, 4804, 29918, 17699, 29889, 20464, 29892, 10558, 29916, 1252, 3167, 17830, 29897, 13, 4706, 9608, 29918, 1445, 353, 903, 2084, 23538, 11276, 29916, 29889, 2084, 29892, 13, 462, 1669, 15300, 5559, 29914, 2109, 29914, 5559, 29899, 11276, 29916, 29899, 16674, 29899, 29881, 2075, 328, 29899, 10867, 1495, 13, 4706, 3431, 29918, 1445, 29918, 5349, 29918, 3051, 29898, 20464, 29918, 1445, 29892, 376, 16358, 29871, 29896, 613, 337, 29918, 29922, 5574, 29892, 1993, 29922, 8824, 29897, 13, 4706, 3431, 29918, 1445, 29918, 5349, 29918, 3051, 29898, 20464, 29918, 1445, 29892, 376, 1692, 6040, 20449, 6227, 2882, 6227, 11937, 613, 337, 29918, 29922, 5574, 29892, 1993, 29922, 8824, 29897, 13, 4706, 3431, 29918, 1445, 29918, 5349, 29918, 3051, 29898, 20464, 29918, 1445, 29892, 12305, 14708, 2109, 29914, 13067, 613, 337, 29918, 29922, 5574, 29892, 1993, 29922, 8824, 29897, 13, 1678, 1683, 29901, 13, 4706, 4974, 29918, 4541, 29898, 275, 8758, 29898, 11276, 29916, 29889, 9006, 29918, 4804, 29918, 17699, 29889, 20464, 29892, 10558, 29916, 1252, 3167, 17830, 876, 13, 13, 1678, 396, 11539, 393, 591, 508, 5768, 565, 2441, 18871, 4947, 13700, 541, 3625, 7395, 29901, 13, 1678, 396, 29871, 1192, 2309, 408, 760, 310, 278, 1243, 29918, 1202, 29918, 10867, 29918, 3051, 29889, 2272, 13, 1678, 396, 11539, 393, 591, 508, 29915, 29873, 5768, 263, 934, 565, 18871, 1820, 471, 13700, 322, 7395, 18871, 471, 6206, 470, 3939, 2159, 29991, 15718, 13, 13, 13, 29992, 2541, 29918, 8336, 29898, 13, 1678, 5447, 3790, 29915, 29874, 29889, 12637, 29889, 18828, 2396, 11117, 29881, 2396, 426, 9144, 29918, 262, 10867, 29918, 711, 1557, 545, 29901, 525, 29896, 29906, 29941, 29915, 12499, 13, 29897, 13, 1753, 1243, 29918, 11276, 29916, 29918, 657, 29918, 3166, 29918, 1491, 3972, 29898, 3332, 3972, 1125, 13, 1678, 515, 1418, 284, 328, 29889, 2754, 1053, 788, 29918, 10867, 29918, 3051, 13, 1678, 385, 13996, 353, 10558, 29916, 5612, 29877, 29898, 3332, 3972, 29892, 2069, 29922, 5574, 29897, 13, 1678, 385, 13996, 29889, 1202, 877, 29874, 29889, 12637, 29889, 18828, 742, 9063, 29922, 5574, 29897, 13, 1678, 788, 29918, 10867, 29918, 3051, 877, 29874, 29889, 12637, 29889, 18828, 742, 385, 13996, 29922, 11276, 29916, 29892, 5217, 29922, 5574, 29897, 13, 1678, 285, 2084, 353, 1015, 29926, 29898, 3332, 3972, 29892, 525, 29874, 742, 525, 29881, 742, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 29897, 13, 13, 1678, 411, 521, 29886, 9970, 29898, 459, 29926, 29898, 3332, 3972, 29892, 525, 29874, 742, 525, 29881, 8785, 29901, 13, 4706, 28877, 353, 7525, 1089, 580, 13, 4706, 28877, 18959, 5559, 742, 525, 11276, 29916, 742, 525, 8865, 742, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 2314, 29871, 396, 1065, 6315, 385, 13996, 5768, 13, 4706, 4974, 29918, 4541, 29898, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 29888, 2084, 876, 632, 396, 322, 11539, 565, 934, 11132, 515, 3884, 13, 4706, 28877, 18959, 5559, 742, 525, 11276, 29916, 742, 525, 657, 742, 7876, 29918, 262, 10867, 29918, 711, 1557, 545, 2314, 259, 396, 1065, 6315, 385, 13996, 679, 13, 4706, 4974, 29918, 3009, 29898, 11276, 29916, 29889, 1445, 29918, 5349, 29918, 3051, 29898, 29888, 2084, 876, 795, 396, 322, 11539, 565, 934, 2355, 964, 3884, 13, 13, 13, 1753, 1243, 29918, 657, 29918, 5559, 29918, 21813, 29918, 328, 5143, 287, 7295, 13, 1678, 6315, 27492, 353, 11786, 16802, 580, 13, 1678, 8829, 353, 8853, 29954, 1806, 29918, 9464, 1115, 376, 6995, 636, 6294, 5559, 613, 376, 29954, 1806, 29918, 11686, 29968, 29918, 29911, 21661, 1115, 376, 21546, 613, 376, 18267, 29918, 26865, 1115, 376, 24217, 9092, 13, 13, 1678, 396, 1243, 11301, 310, 8018, 8829, 24987, 515, 6198, 29918, 2084, 304, 1959, 8380, 29918, 2084, 13, 1678, 12109, 29918, 6272, 353, 6315, 27492, 29889, 657, 29918, 5559, 29918, 21813, 29918, 328, 5143, 287, 29898, 6272, 29897, 13, 1678, 4974, 29918, 11745, 29898, 26859, 29918, 6272, 3366, 29954, 1806, 29918, 9464, 12436, 633, 1028, 493, 29898, 6272, 3366, 29954, 1806, 29918, 9464, 3108, 876, 13, 1678, 4974, 29918, 11745, 29898, 26859, 29918, 6272, 3366, 29954, 1806, 29918, 11686, 29968, 29918, 29911, 21661, 12436, 633, 1028, 493, 29898, 6272, 3366, 29954, 1806, 29918, 11686, 29968, 29918, 29911, 21661, 3108, 876, 13, 13, 1678, 396, 1243, 565, 916, 5177, 3651, 4502, 304, 740, 4133, 443, 13794, 287, 13, 1678, 4974, 29918, 11745, 29898, 26859, 29918, 6272, 3366, 18267, 29918, 26865, 12436, 8829, 3366, 18267, 29918, 26865, 20068, 13, 13, 1678, 396, 1243, 1053, 310, 10876, 29918, 6272, 565, 694, 5177, 4502, 304, 740, 13, 1678, 10876, 29918, 6272, 353, 6315, 27492, 29889, 657, 29918, 5559, 29918, 21813, 29918, 328, 5143, 287, 580, 13, 1678, 4974, 29918, 11745, 29898, 9675, 29918, 6272, 3366, 29925, 24668, 12436, 2897, 29889, 21813, 29889, 657, 703, 29925, 24668, 5783, 13, 13, 13, 1753, 1243, 29918, 16121, 29918, 1557, 24893, 7295, 13, 1678, 7709, 1423, 29918, 16121, 29918, 1557, 24893, 29892, 525, 29874, 29889, 12637, 29889, 18828, 742, 525, 12857, 29889, 3945, 742, 7700, 13, 1678, 565, 451, 373, 29918, 10499, 29901, 13, 4706, 7709, 1423, 29918, 16121, 29918, 1557, 24893, 29892, 525, 29874, 29889, 12637, 29889, 18828, 742, 525, 12857, 29889, 3945, 742, 5852, 13, 1678, 396, 29891, 969, 1423, 29918, 16121, 29918, 1557, 24893, 29892, 525, 29874, 29889, 12637, 29889, 18828, 742, 7876, 29918, 21111, 287, 29918, 711, 1557, 545, 29892, 7700, 13, 1678, 396, 29891, 969, 1423, 29918, 16121, 29918, 1557, 24893, 29892, 7876, 29918, 10867, 29918, 711, 1557, 545, 29892, 525, 12857, 29889, 3945, 742, 7700, 13, 1678, 7709, 1423, 29918, 16121, 29918, 1557, 24893, 29892, 7876, 29918, 10867, 29918, 711, 1557, 545, 29892, 7876, 29918, 21111, 287, 29918, 711, 1557, 545, 29892, 7700, 13, 13, 13, 1753, 1243, 29918, 1217, 29918, 29878, 2176, 1982, 29918, 15638, 7295, 13, 1678, 396, 19104, 373, 364, 2176, 1982, 21180, 17068, 27591, 304, 1074, 393, 372, 338, 451, 7500, 10940, 591, 2254, 445, 7592, 13, 1678, 396, 1951, 393, 12778, 29871, 29941, 29900, 29900, 1516, 9055, 363, 694, 16800, 671, 13, 1678, 515, 2023, 9006, 1053, 7525, 1089, 13, 1678, 28877, 353, 7525, 1089, 580, 13, 1678, 411, 2381, 9536, 29918, 4905, 29879, 580, 408, 274, 4346, 29901, 13, 4706, 28877, 29889, 3389, 4197, 9675, 29889, 4258, 9246, 29892, 17411, 29883, 742, 525, 5215, 1418, 284, 328, 29889, 6341, 1745, 4769, 29889, 1279, 3145, 29892, 10876, 29936, 1596, 4197, 29895, 363, 413, 297, 10876, 29889, 7576, 565, 413, 29889, 27382, 2541, 703, 29878, 2176, 1982, 1159, 2314, 7464, 13, 1669, 1480, 29918, 25393, 29922, 8824, 29892, 1480, 29918, 303, 20405, 29922, 8824, 29897, 13, 4706, 396, 1596, 274, 4346, 29889, 449, 13, 4706, 4974, 29918, 1333, 29918, 262, 703, 29878, 2176, 1982, 613, 274, 4346, 29889, 449, 29897, 13, 4706, 4974, 29918, 1333, 29918, 262, 703, 29878, 2176, 1982, 613, 274, 4346, 29889, 3127, 29897, 13, 2 ]
house_prices_regression_model/predict.py
jmonsalverodilla/house_prices_regression_model
0
48650
import typing as t import numpy as np import pandas as pd from house_prices_regression_model import __version__ as VERSION from house_prices_regression_model.processing.data_manager import load_pipeline from house_prices_regression_model.config.core import load_config_file, SETTINGS_PATH from house_prices_regression_model.processing.data_validation import validate_inputs # Config files config = load_config_file(SETTINGS_PATH) PIPELINE_ARTIFACT_NAME = config["PIPELINE_ARTIFACT_NAME"] pipeline_file_name = f"{PIPELINE_ARTIFACT_NAME}_v{VERSION}.pkl" cb_pipe = load_pipeline(file_name=pipeline_file_name) #Function def make_prediction(*,input_data: t.Union[pd.DataFrame, dict],) -> list: """Make a prediction using a saved model pipeline.""" df = pd.DataFrame(input_data) validated_df, error_dict = validate_inputs(input_data=df) errors_list = list(error_dict.values()) results = {'model_output': None} if error_dict == {}: log_predictions = cb_pipe.predict(validated_df) predictions = [np.exp(pred) for pred in log_predictions] results['model_output'] = predictions else: results['model_output'] = 'Errors making prediction:' + ' '.join(map(str, errors_list)) return results
[ 1, 1053, 19229, 408, 260, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 13, 3166, 3699, 29918, 558, 1575, 29918, 276, 11476, 29918, 4299, 1053, 4770, 3259, 1649, 408, 478, 1001, 13381, 13, 3166, 3699, 29918, 558, 1575, 29918, 276, 11476, 29918, 4299, 29889, 19170, 29889, 1272, 29918, 12847, 1053, 2254, 29918, 13096, 5570, 13, 3166, 3699, 29918, 558, 1575, 29918, 276, 11476, 29918, 4299, 29889, 2917, 29889, 3221, 1053, 2254, 29918, 2917, 29918, 1445, 29892, 11368, 29911, 4214, 29903, 29918, 10145, 13, 3166, 3699, 29918, 558, 1575, 29918, 276, 11476, 29918, 4299, 29889, 19170, 29889, 1272, 29918, 18157, 1053, 12725, 29918, 2080, 29879, 13, 13, 29937, 12782, 2066, 13, 2917, 353, 2254, 29918, 2917, 29918, 1445, 29898, 10490, 29911, 4214, 29903, 29918, 10145, 29897, 13, 2227, 4162, 18521, 29918, 8322, 29902, 4519, 1783, 29918, 5813, 353, 2295, 3366, 2227, 4162, 18521, 29918, 8322, 29902, 4519, 1783, 29918, 5813, 3108, 13, 13096, 5570, 29918, 1445, 29918, 978, 353, 285, 29908, 29912, 2227, 4162, 18521, 29918, 8322, 29902, 4519, 1783, 29918, 5813, 2403, 29894, 29912, 16358, 1836, 29886, 6321, 29908, 13, 10702, 29918, 17760, 353, 2254, 29918, 13096, 5570, 29898, 1445, 29918, 978, 29922, 13096, 5570, 29918, 1445, 29918, 978, 29897, 13, 13, 13, 29937, 6678, 13, 1753, 1207, 29918, 11965, 2463, 10456, 29892, 2080, 29918, 1272, 29901, 260, 29889, 19986, 29961, 15926, 29889, 17271, 29892, 9657, 1402, 29897, 1599, 1051, 29901, 13, 1678, 9995, 9984, 263, 18988, 773, 263, 7160, 1904, 16439, 1213, 15945, 13, 1678, 4489, 353, 10518, 29889, 17271, 29898, 2080, 29918, 1272, 29897, 13, 1678, 2854, 630, 29918, 2176, 29892, 1059, 29918, 8977, 353, 12725, 29918, 2080, 29879, 29898, 2080, 29918, 1272, 29922, 2176, 29897, 13, 1678, 4436, 29918, 1761, 353, 1051, 29898, 2704, 29918, 8977, 29889, 5975, 3101, 13, 1678, 2582, 353, 11117, 4299, 29918, 4905, 2396, 6213, 29913, 13, 1678, 565, 1059, 29918, 8977, 1275, 426, 6177, 13, 4706, 1480, 29918, 27711, 1080, 353, 26324, 29918, 17760, 29889, 27711, 29898, 3084, 630, 29918, 2176, 29897, 13, 4706, 27303, 353, 518, 9302, 29889, 4548, 29898, 11965, 29897, 363, 4450, 297, 1480, 29918, 27711, 1080, 29962, 13, 4706, 2582, 1839, 4299, 29918, 4905, 2033, 353, 27303, 13, 1678, 1683, 29901, 13, 4706, 2582, 1839, 4299, 29918, 4905, 2033, 353, 525, 22463, 3907, 18988, 11283, 718, 525, 15300, 7122, 29898, 1958, 29898, 710, 29892, 4436, 29918, 1761, 876, 13, 1678, 736, 2582, 13, 2 ]
mmaction/models/tenons/backbones/__init__.py
arpanmangal/coinaction
1
123738
<reponame>arpanmangal/coinaction from .bninception import BNInception from .resnet import ResNet from .inception_v1_i3d import InceptionV1_I3D from .resnet_i3d import ResNet_I3D from .resnet_s3d import ResNet_S3D __all__ = [ 'BNInception', 'ResNet', 'InceptionV1_I3D', 'ResNet_I3D', 'ResNet_S3D', ]
[ 1, 529, 276, 1112, 420, 29958, 6834, 273, 29885, 574, 284, 29914, 1111, 1099, 428, 13, 3166, 869, 11197, 1239, 683, 1053, 350, 29940, 797, 1441, 13, 3166, 869, 690, 1212, 1053, 2538, 6779, 13, 13, 3166, 869, 1239, 683, 29918, 29894, 29896, 29918, 29875, 29941, 29881, 1053, 512, 1441, 29963, 29896, 29918, 29902, 29941, 29928, 13, 3166, 869, 690, 1212, 29918, 29875, 29941, 29881, 1053, 2538, 6779, 29918, 29902, 29941, 29928, 13, 3166, 869, 690, 1212, 29918, 29879, 29941, 29881, 1053, 2538, 6779, 29918, 29903, 29941, 29928, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 29933, 29940, 797, 1441, 742, 13, 1678, 525, 1666, 6779, 742, 13, 1678, 525, 797, 1441, 29963, 29896, 29918, 29902, 29941, 29928, 742, 13, 1678, 525, 1666, 6779, 29918, 29902, 29941, 29928, 742, 13, 1678, 525, 1666, 6779, 29918, 29903, 29941, 29928, 742, 13, 29962, 13, 2 ]
loss/sequence_elbo.py
Wu-Chenyang/SMC-POMDP
0
65767
<reponame>Wu-Chenyang/SMC-POMDP<filename>loss/sequence_elbo.py import torch import torch.nn as nn import torch.nn.functional as F import pyro.distributions as D from pyro.distributions.kl import kl_divergence from typing import NamedTuple import math def sequence_elbo(proposal: nn.Module, model: nn.Module, batched_data: NamedTuple): # Dimensionality Analysis # # Observations: [batch_size, sequence_length, obs_dim] # Weights: [num_particles, batch_size, num_timesteps, 1] # Final Weights: [num_particles, batch_size, 1] # LSTM State: [num_particles, batch_size, hidden_dim] # Current States: [num_particles, batch_size, state_dim] # Current Observations: [1, batch_size, obs_dim] # Proposal Log Probabilities: [num_particles, batch_size, num_timesteps, 1] # Log Likelihood: [batch_size, 1] # observations = model.encode(batched_data.observations) observations = batched_data.observations actions = batched_data.actions categories = batched_data.prior_mixtures batch_size, seq_len, _ = observations.shape batch_shape = (batch_size,) kld_loss = torch.tensor([0.0], device=observations.device) nll_loss = torch.tensor([0.0], device=observations.device) kwargs = proposal.reset(observations, actions, batch_shape) proposal_distribution, kwargs = proposal.prior_proposal(categories, batch_shape, **kwargs) # proposal_distribution, kwargs = proposal.prior_proposal(observations, batch_shape, **kwargs) current_states = proposal_distribution.rsample() prior_distribution, kwargs = model.prior(categories, batch_shape, **kwargs) kld_loss += torch.mean(kl_divergence(proposal_distribution, prior_distribution)) # observation_distribution, kwargs= model.observation(current_states, **kwargs) # nll_loss -= observation_distribution.log_prob(current_observations) for i in range(seq_len): current_observations = observations[None, :, i, :] current_actions = actions[None, :, i, :] previous_states = current_states proposal_distribution, kwargs = proposal.transition_proposal(current_states, current_actions, current_observations, i, **kwargs) current_states = proposal_distribution.rsample() transition_distribution, kwargs= model.transition(previous_states, current_actions, **kwargs) kld_loss += torch.mean(kl_divergence(proposal_distribution, transition_distribution)) observation_distribution, kwargs = model.observation(current_actions, current_states, **kwargs) nll_loss -= torch.mean(observation_distribution.log_prob(current_observations)) kld_loss /= seq_len nll_loss /= seq_len return kld_loss, nll_loss
[ 1, 529, 276, 1112, 420, 29958, 29956, 29884, 29899, 1451, 15274, 574, 29914, 29903, 12513, 29899, 13152, 5773, 29925, 29966, 9507, 29958, 6758, 29914, 16506, 29918, 295, 833, 29889, 2272, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 5215, 11451, 307, 29889, 27691, 29879, 408, 360, 13, 3166, 11451, 307, 29889, 27691, 29879, 29889, 6321, 1053, 9489, 29918, 29881, 2147, 10238, 13, 13, 3166, 19229, 1053, 405, 2795, 23215, 552, 13, 5215, 5844, 13, 13, 1753, 5665, 29918, 295, 833, 29898, 771, 1066, 284, 29901, 302, 29876, 29889, 7355, 29892, 1904, 29901, 302, 29876, 29889, 7355, 29892, 9853, 287, 29918, 1272, 29901, 405, 2795, 23215, 552, 1125, 13, 1678, 396, 4792, 8180, 537, 24352, 13, 1678, 396, 13, 1678, 396, 21651, 800, 29901, 518, 16175, 29918, 2311, 29892, 5665, 29918, 2848, 29892, 20881, 29918, 6229, 29962, 13, 1678, 396, 1334, 5861, 29901, 518, 1949, 29918, 1595, 4027, 29892, 9853, 29918, 2311, 29892, 954, 29918, 9346, 4196, 567, 29892, 29871, 29896, 29962, 13, 1678, 396, 9550, 1334, 5861, 29901, 518, 1949, 29918, 1595, 4027, 29892, 9853, 29918, 2311, 29892, 29871, 29896, 29962, 13, 1678, 396, 365, 1254, 29924, 4306, 29901, 518, 1949, 29918, 1595, 4027, 29892, 9853, 29918, 2311, 29892, 7934, 29918, 6229, 29962, 13, 1678, 396, 9626, 3900, 29901, 518, 1949, 29918, 1595, 4027, 29892, 9853, 29918, 2311, 29892, 2106, 29918, 6229, 29962, 13, 1678, 396, 9626, 21651, 800, 29901, 518, 29896, 29892, 9853, 29918, 2311, 29892, 20881, 29918, 6229, 29962, 13, 1678, 396, 1019, 1066, 284, 4522, 1019, 29890, 11614, 29901, 518, 1949, 29918, 1595, 4027, 29892, 9853, 29918, 2311, 29892, 954, 29918, 9346, 4196, 567, 29892, 29871, 29896, 29962, 13, 1678, 396, 4522, 365, 638, 22342, 29901, 518, 16175, 29918, 2311, 29892, 29871, 29896, 29962, 13, 13, 1678, 396, 13917, 353, 1904, 29889, 12508, 29898, 16175, 287, 29918, 1272, 29889, 26739, 800, 29897, 13, 1678, 13917, 353, 9853, 287, 29918, 1272, 29889, 26739, 800, 13, 1678, 8820, 353, 9853, 287, 29918, 1272, 29889, 7387, 13, 1678, 13997, 353, 9853, 287, 29918, 1272, 29889, 29886, 13479, 29918, 2460, 486, 1973, 13, 13, 13, 1678, 9853, 29918, 2311, 29892, 19359, 29918, 2435, 29892, 903, 353, 13917, 29889, 12181, 13, 1678, 9853, 29918, 12181, 353, 313, 16175, 29918, 2311, 29892, 29897, 13, 1678, 413, 430, 29918, 6758, 353, 4842, 305, 29889, 20158, 4197, 29900, 29889, 29900, 1402, 4742, 29922, 26739, 800, 29889, 10141, 29897, 13, 1678, 302, 645, 29918, 6758, 353, 4842, 305, 29889, 20158, 4197, 29900, 29889, 29900, 1402, 4742, 29922, 26739, 800, 29889, 10141, 29897, 13, 13, 1678, 9049, 5085, 353, 24963, 29889, 12071, 29898, 26739, 800, 29892, 8820, 29892, 9853, 29918, 12181, 29897, 13, 1678, 24963, 29918, 27691, 29892, 9049, 5085, 353, 24963, 29889, 29886, 13479, 29918, 771, 1066, 284, 29898, 20683, 29892, 9853, 29918, 12181, 29892, 3579, 19290, 29897, 13, 1678, 396, 24963, 29918, 27691, 29892, 9049, 5085, 353, 24963, 29889, 29886, 13479, 29918, 771, 1066, 284, 29898, 26739, 800, 29892, 9853, 29918, 12181, 29892, 3579, 19290, 29897, 13, 1678, 1857, 29918, 28631, 353, 24963, 29918, 27691, 29889, 2288, 981, 580, 13, 13, 1678, 7536, 29918, 27691, 29892, 9049, 5085, 353, 1904, 29889, 29886, 13479, 29898, 20683, 29892, 9853, 29918, 12181, 29892, 3579, 19290, 29897, 13, 1678, 413, 430, 29918, 6758, 4619, 4842, 305, 29889, 12676, 29898, 6321, 29918, 29881, 2147, 10238, 29898, 771, 1066, 284, 29918, 27691, 29892, 7536, 29918, 27691, 876, 13, 1678, 396, 15500, 29918, 27691, 29892, 9049, 5085, 29922, 1904, 29889, 26739, 362, 29898, 3784, 29918, 28631, 29892, 3579, 19290, 29897, 13, 1678, 396, 302, 645, 29918, 6758, 22361, 15500, 29918, 27691, 29889, 1188, 29918, 22795, 29898, 3784, 29918, 26739, 800, 29897, 13, 13, 1678, 363, 474, 297, 3464, 29898, 11762, 29918, 2435, 1125, 13, 4706, 1857, 29918, 26739, 800, 353, 13917, 29961, 8516, 29892, 584, 29892, 474, 29892, 584, 29962, 13, 4706, 1857, 29918, 7387, 353, 8820, 29961, 8516, 29892, 584, 29892, 474, 29892, 584, 29962, 13, 13, 4706, 3517, 29918, 28631, 353, 1857, 29918, 28631, 13, 4706, 24963, 29918, 27691, 29892, 9049, 5085, 353, 24963, 29889, 20543, 29918, 771, 1066, 284, 29898, 3784, 29918, 28631, 29892, 1857, 29918, 7387, 29892, 1857, 29918, 26739, 800, 29892, 474, 29892, 3579, 19290, 29897, 13, 4706, 1857, 29918, 28631, 353, 24963, 29918, 27691, 29889, 2288, 981, 580, 13, 13, 4706, 9558, 29918, 27691, 29892, 9049, 5085, 29922, 1904, 29889, 20543, 29898, 24957, 29918, 28631, 29892, 1857, 29918, 7387, 29892, 3579, 19290, 29897, 13, 4706, 413, 430, 29918, 6758, 4619, 4842, 305, 29889, 12676, 29898, 6321, 29918, 29881, 2147, 10238, 29898, 771, 1066, 284, 29918, 27691, 29892, 9558, 29918, 27691, 876, 13, 13, 4706, 15500, 29918, 27691, 29892, 9049, 5085, 353, 1904, 29889, 26739, 362, 29898, 3784, 29918, 7387, 29892, 1857, 29918, 28631, 29892, 3579, 19290, 29897, 13, 4706, 302, 645, 29918, 6758, 22361, 4842, 305, 29889, 12676, 29898, 26739, 362, 29918, 27691, 29889, 1188, 29918, 22795, 29898, 3784, 29918, 26739, 800, 876, 13, 13, 1678, 413, 430, 29918, 6758, 847, 29922, 19359, 29918, 2435, 13, 1678, 302, 645, 29918, 6758, 847, 29922, 19359, 29918, 2435, 13, 1678, 736, 413, 430, 29918, 6758, 29892, 302, 645, 29918, 6758, 2 ]
tests/migrations/0014_auto_20200327_1152.py
intellineers/django-bridger
2
53099
<filename>tests/migrations/0014_auto_20200327_1152.py # Generated by Django 2.2.11 on 2020-03-27 10:52 import django_fsm from django.db import migrations class Migration(migrations.Migration): dependencies = [ ("tests", "0013_auto_20200219_1324"), ] operations = [ migrations.AlterField( model_name="modeltest", name="status_field", field=django_fsm.FSMField( choices=[("status1", "Status1"), ("status2", "Status2"), ("status3", "Status3"),], default="status1", max_length=50, verbose_name="Status", ), ), ]
[ 1, 529, 9507, 29958, 21150, 29914, 26983, 800, 29914, 29900, 29900, 29896, 29946, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29900, 29941, 29906, 29955, 29918, 29896, 29896, 29945, 29906, 29889, 2272, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29896, 29896, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29941, 29899, 29906, 29955, 29871, 29896, 29900, 29901, 29945, 29906, 13, 5215, 9557, 29918, 29888, 3844, 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, 4852, 21150, 613, 376, 29900, 29900, 29896, 29941, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29900, 29906, 29896, 29929, 29918, 29896, 29941, 29906, 29946, 4968, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 543, 4299, 1688, 613, 13, 9651, 1024, 543, 4882, 29918, 2671, 613, 13, 9651, 1746, 29922, 14095, 29918, 29888, 3844, 29889, 9998, 29924, 3073, 29898, 13, 18884, 19995, 11759, 703, 4882, 29896, 613, 376, 5709, 29896, 4968, 4852, 4882, 29906, 613, 376, 5709, 29906, 4968, 4852, 4882, 29941, 613, 376, 5709, 29941, 4968, 1402, 13, 18884, 2322, 543, 4882, 29896, 613, 13, 18884, 4236, 29918, 2848, 29922, 29945, 29900, 29892, 13, 18884, 26952, 29918, 978, 543, 5709, 613, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
multiprobe/data/language.py
h324yang/multiprobe
0
199684
from dataclasses import dataclass from collections import defaultdict from functools import lru_cache from typing import Dict, List import json import warnings from scipy.spatial import distance as spd from torch.distributions.categorical import Categorical from tqdm import tqdm import joblib import langdetect import numpy as np import torch import yaml from multiprobe.utils import jsd_, chunk class LanguageFamilyData(object): def __init__(self, family_map): self.family_map = family_map self.code_family_map = defaultdict(lambda: 'none') for family, languages in family_map.items(): for lang, data in languages.items(): self.code_family_map[data['code']] = family @property def families(self): return list(self.family_map.keys()) def find_family(self, lang_code): return self.code_family_map[lang_code] @classmethod def from_yaml(cls, filename): with open(filename) as f: family_map = yaml.load(f) return cls(family_map) def safe_js(p, q): js_dist = spd.jensenshannon(p, q, 2.0) # SciPy has numerical issues if np.isnan(js_dist): js_dist = 0 return js_dist def sum_js(p_list, q_list, verbose=True): with warnings.catch_warnings(): warnings.filterwarnings('ignore') return sum(safe_js(p, q) for p, q in zip(p_list, q_list)) def sum_js_cuda(p_list, q_list): dist = 0 for p, q in tqdm(zip(p_list, q_list), position=1): js_dist = jsd_(torch.Tensor(p).cuda(), torch.Tensor(q).cuda()).cpu().item() dist += js_dist return dist @dataclass class TokenLanguageStatistics(object): data: Dict[str, Dict[str, int]] vocab: Dict[str, int] languages: List[str] @classmethod def from_file(cls, path): with open(path) as f: data = json.load(f) languages = sorted(data['languages']) return cls(data['statistics'], data['vocab'], languages) def compute_distribution(self, tokens, weights=None): probs = [] new_weights = [] for token, weight in zip(tokens, weights): token_probs = np.zeros(len(self.languages)) if token not in self.data: continue for language, count in self.data[token].items(): token_probs[self.languages.index(language)] += count if np.sum(token_probs) > 0: token_probs = token_probs / np.sum(token_probs) probs.append(token_probs) new_weights.append(weight) if len(probs) == 0: raise ValueError('No counts found for those tokens.') if weights is None: probs = np.mean(np.array(probs), 0) else: weights = np.array(new_weights) probs = np.array(probs) probs = np.sum(np.repeat(np.expand_dims(weights, 1), probs.shape[1], 1) * probs, 0) / np.sum(weights) return Categorical(probs=torch.Tensor(probs)) @lru_cache(maxsize=1000000) def detect_language(string): return langdetect.detect(string)
[ 1, 515, 848, 13203, 1053, 848, 1990, 13, 3166, 16250, 1053, 2322, 8977, 13, 3166, 2090, 312, 8789, 1053, 301, 582, 29918, 8173, 13, 3166, 19229, 1053, 360, 919, 29892, 2391, 13, 5215, 4390, 13, 5215, 18116, 13, 13, 3166, 4560, 2272, 29889, 1028, 15238, 1053, 5418, 408, 805, 29881, 13, 3166, 4842, 305, 29889, 27691, 29879, 29889, 29883, 20440, 936, 1053, 315, 20440, 936, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 5215, 4982, 1982, 13, 5215, 6361, 4801, 522, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 343, 8807, 13, 13, 3166, 6674, 307, 915, 29889, 13239, 1053, 432, 4928, 3383, 19875, 13, 13, 13, 1990, 17088, 27104, 1469, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3942, 29918, 1958, 1125, 13, 4706, 1583, 29889, 11922, 29918, 1958, 353, 3942, 29918, 1958, 13, 4706, 1583, 29889, 401, 29918, 11922, 29918, 1958, 353, 2322, 8977, 29898, 2892, 29901, 525, 9290, 1495, 13, 4706, 363, 3942, 29892, 10276, 297, 3942, 29918, 1958, 29889, 7076, 7295, 13, 9651, 363, 6361, 29892, 848, 297, 10276, 29889, 7076, 7295, 13, 18884, 1583, 29889, 401, 29918, 11922, 29918, 1958, 29961, 1272, 1839, 401, 2033, 29962, 353, 3942, 13, 13, 1678, 732, 6799, 13, 1678, 822, 13175, 29898, 1311, 1125, 13, 4706, 736, 1051, 29898, 1311, 29889, 11922, 29918, 1958, 29889, 8149, 3101, 13, 13, 1678, 822, 1284, 29918, 11922, 29898, 1311, 29892, 6361, 29918, 401, 1125, 13, 4706, 736, 1583, 29889, 401, 29918, 11922, 29918, 1958, 29961, 3893, 29918, 401, 29962, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 25162, 29898, 25932, 29892, 10422, 1125, 13, 4706, 411, 1722, 29898, 9507, 29897, 408, 285, 29901, 13, 9651, 3942, 29918, 1958, 353, 343, 8807, 29889, 1359, 29898, 29888, 29897, 13, 4706, 736, 1067, 29879, 29898, 11922, 29918, 1958, 29897, 13, 13, 13, 1753, 9109, 29918, 1315, 29898, 29886, 29892, 3855, 1125, 13, 1678, 6965, 29918, 5721, 353, 805, 29881, 29889, 29926, 575, 575, 29882, 23453, 29898, 29886, 29892, 3855, 29892, 29871, 29906, 29889, 29900, 29897, 13, 1678, 396, 5636, 19737, 756, 16259, 5626, 13, 1678, 565, 7442, 29889, 275, 13707, 29898, 1315, 29918, 5721, 1125, 13, 4706, 6965, 29918, 5721, 353, 29871, 29900, 13, 1678, 736, 6965, 29918, 5721, 13, 13, 13, 1753, 2533, 29918, 1315, 29898, 29886, 29918, 1761, 29892, 3855, 29918, 1761, 29892, 26952, 29922, 5574, 1125, 13, 1678, 411, 18116, 29889, 12510, 29918, 25442, 886, 7295, 13, 4706, 18116, 29889, 4572, 25442, 886, 877, 17281, 1495, 13, 4706, 736, 2533, 29898, 11177, 29918, 1315, 29898, 29886, 29892, 3855, 29897, 363, 282, 29892, 3855, 297, 14319, 29898, 29886, 29918, 1761, 29892, 3855, 29918, 1761, 876, 13, 13, 13, 1753, 2533, 29918, 1315, 29918, 29883, 6191, 29898, 29886, 29918, 1761, 29892, 3855, 29918, 1761, 1125, 13, 1678, 1320, 353, 29871, 29900, 13, 1678, 363, 282, 29892, 3855, 297, 260, 29939, 18933, 29898, 7554, 29898, 29886, 29918, 1761, 29892, 3855, 29918, 1761, 511, 2602, 29922, 29896, 1125, 13, 4706, 6965, 29918, 5721, 353, 432, 4928, 23538, 7345, 305, 29889, 29911, 6073, 29898, 29886, 467, 29883, 6191, 3285, 4842, 305, 29889, 29911, 6073, 29898, 29939, 467, 29883, 6191, 16655, 21970, 2141, 667, 580, 13, 4706, 1320, 4619, 6965, 29918, 5721, 13, 1678, 736, 1320, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 25159, 21233, 9513, 6765, 29898, 3318, 1125, 13, 1678, 848, 29901, 360, 919, 29961, 710, 29892, 360, 919, 29961, 710, 29892, 938, 5262, 13, 1678, 7931, 370, 29901, 360, 919, 29961, 710, 29892, 938, 29962, 13, 1678, 10276, 29901, 2391, 29961, 710, 29962, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 1445, 29898, 25932, 29892, 2224, 1125, 13, 4706, 411, 1722, 29898, 2084, 29897, 408, 285, 29901, 13, 9651, 848, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 4706, 10276, 353, 12705, 29898, 1272, 1839, 29880, 8737, 11287, 13, 4706, 736, 1067, 29879, 29898, 1272, 1839, 6112, 6765, 7464, 848, 1839, 29894, 542, 370, 7464, 10276, 29897, 13, 13, 1678, 822, 10272, 29918, 27691, 29898, 1311, 29892, 18897, 29892, 18177, 29922, 8516, 1125, 13, 4706, 2070, 29879, 353, 5159, 13, 4706, 716, 29918, 705, 5861, 353, 5159, 13, 4706, 363, 5993, 29892, 7688, 297, 14319, 29898, 517, 12360, 29892, 18177, 1125, 13, 9651, 5993, 29918, 771, 5824, 353, 7442, 29889, 3298, 359, 29898, 2435, 29898, 1311, 29889, 29880, 8737, 876, 13, 9651, 565, 5993, 451, 297, 1583, 29889, 1272, 29901, 13, 18884, 6773, 13, 9651, 363, 4086, 29892, 2302, 297, 1583, 29889, 1272, 29961, 6979, 1822, 7076, 7295, 13, 18884, 5993, 29918, 771, 5824, 29961, 1311, 29889, 29880, 8737, 29889, 2248, 29898, 11675, 4638, 4619, 2302, 13, 9651, 565, 7442, 29889, 2083, 29898, 6979, 29918, 771, 5824, 29897, 1405, 29871, 29900, 29901, 13, 18884, 5993, 29918, 771, 5824, 353, 5993, 29918, 771, 5824, 847, 7442, 29889, 2083, 29898, 6979, 29918, 771, 5824, 29897, 13, 18884, 2070, 29879, 29889, 4397, 29898, 6979, 29918, 771, 5824, 29897, 13, 18884, 716, 29918, 705, 5861, 29889, 4397, 29898, 7915, 29897, 13, 4706, 565, 7431, 29898, 771, 5824, 29897, 1275, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 877, 3782, 18139, 1476, 363, 1906, 18897, 29889, 1495, 13, 4706, 565, 18177, 338, 6213, 29901, 13, 9651, 2070, 29879, 353, 7442, 29889, 12676, 29898, 9302, 29889, 2378, 29898, 771, 5824, 511, 29871, 29900, 29897, 13, 4706, 1683, 29901, 13, 9651, 18177, 353, 7442, 29889, 2378, 29898, 1482, 29918, 705, 5861, 29897, 13, 9651, 2070, 29879, 353, 7442, 29889, 2378, 29898, 771, 5824, 29897, 13, 9651, 2070, 29879, 353, 7442, 29889, 2083, 29898, 9302, 29889, 14358, 29898, 9302, 29889, 18837, 29918, 6229, 29879, 29898, 705, 5861, 29892, 29871, 29896, 511, 2070, 29879, 29889, 12181, 29961, 29896, 1402, 29871, 29896, 29897, 334, 2070, 29879, 29892, 29871, 29900, 29897, 847, 7442, 29889, 2083, 29898, 705, 5861, 29897, 13, 4706, 736, 315, 20440, 936, 29898, 771, 5824, 29922, 7345, 305, 29889, 29911, 6073, 29898, 771, 5824, 876, 13, 13, 13, 29992, 29880, 582, 29918, 8173, 29898, 3317, 2311, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29897, 13, 1753, 6459, 29918, 11675, 29898, 1807, 1125, 13, 1678, 736, 6361, 4801, 522, 29889, 4801, 522, 29898, 1807, 29897, 13, 2 ]
examples/custom_detection_video.py
vickyvava/ImageAI
7,141
85187
<filename>examples/custom_detection_video.py from imageai.Detection.Custom import CustomVideoObjectDetection import os execution_path = os.getcwd() video_detector = CustomVideoObjectDetection() video_detector.setModelTypeAsYOLOv3() video_detector.setModelPath("hololens-ex-60--loss-2.76.h5") # download via https://github.com/OlafenwaMoses/ImageAI/releases/download/essential-v4/hololens-ex-60--loss-2.76.h5 video_detector.setJsonPath("detection_config.json") # download via https://github.com/OlafenwaMoses/ImageAI/releases/download/essential-v4/detection_config.json video_detector.loadModel() video_detector.detectObjectsFromVideo(input_file_path="holo1.mp4", output_file_path=os.path.join(execution_path, "holo1-detected3"), frames_per_second=20, minimum_percentage_probability=40, log_progress=True)
[ 1, 529, 9507, 29958, 19057, 29914, 6341, 29918, 29881, 2650, 428, 29918, 9641, 29889, 2272, 13, 3166, 1967, 1794, 29889, 29928, 2650, 428, 29889, 7281, 1053, 8701, 15167, 2061, 29928, 2650, 428, 13, 5215, 2897, 13, 13, 22256, 29918, 2084, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 13, 9641, 29918, 4801, 3019, 353, 8701, 15167, 2061, 29928, 2650, 428, 580, 13, 9641, 29918, 4801, 3019, 29889, 842, 3195, 1542, 2887, 29979, 29949, 3927, 29894, 29941, 580, 13, 9641, 29918, 4801, 3019, 29889, 842, 3195, 2605, 703, 5391, 324, 575, 29899, 735, 29899, 29953, 29900, 489, 6758, 29899, 29906, 29889, 29955, 29953, 29889, 29882, 29945, 1159, 396, 5142, 3025, 2045, 597, 3292, 29889, 510, 29914, 29949, 433, 11350, 2766, 29924, 15806, 29914, 2940, 23869, 29914, 276, 17836, 29914, 10382, 29914, 404, 2556, 29899, 29894, 29946, 29914, 5391, 324, 575, 29899, 735, 29899, 29953, 29900, 489, 6758, 29899, 29906, 29889, 29955, 29953, 29889, 29882, 29945, 13, 9641, 29918, 4801, 3019, 29889, 842, 8148, 2605, 703, 29881, 2650, 428, 29918, 2917, 29889, 3126, 1159, 396, 5142, 3025, 2045, 597, 3292, 29889, 510, 29914, 29949, 433, 11350, 2766, 29924, 15806, 29914, 2940, 23869, 29914, 276, 17836, 29914, 10382, 29914, 404, 2556, 29899, 29894, 29946, 29914, 29881, 2650, 428, 29918, 2917, 29889, 3126, 13, 9641, 29918, 4801, 3019, 29889, 1359, 3195, 580, 13, 13, 9641, 29918, 4801, 3019, 29889, 4801, 522, 12724, 4591, 15167, 29898, 2080, 29918, 1445, 29918, 2084, 543, 29882, 3543, 29896, 29889, 1526, 29946, 613, 13, 462, 462, 3986, 1962, 29918, 1445, 29918, 2084, 29922, 359, 29889, 2084, 29889, 7122, 29898, 22256, 29918, 2084, 29892, 376, 29882, 3543, 29896, 29899, 4801, 26458, 29941, 4968, 13, 462, 462, 3986, 16608, 29918, 546, 29918, 7496, 29922, 29906, 29900, 29892, 13, 462, 462, 3986, 9212, 29918, 25376, 482, 29918, 22795, 3097, 29922, 29946, 29900, 29892, 13, 462, 462, 3986, 1480, 29918, 18035, 29922, 5574, 29897, 2 ]
dsl/utils/filter_freq.py
juditacs/dsl
2
145204
<filename>dsl/utils/filter_freq.py from os import listdir, path from argparse import ArgumentParser from collections import defaultdict from dsl.features.featurize import Tokenizer, WordNgram def parse_args(): p = ArgumentParser() p.add_argument('--train', type=str) p.add_argument('--train-out', type=str) p.add_argument('--test', type=str) p.add_argument('--test-out', type=str) p.add_argument('--topn', type=int, default=100) p.add_argument('--N', type=int, default=1, help='N of wordngram counter') p.add_argument('--mode', choices=['keep', 'remove'], default='keep') return p.parse_args() def read_topn_in_dir(basedir, counters, topn=100): topwords = {} for fn in sorted(listdir(basedir)): with open(path.join(basedir, fn)) as f: counters[fn].count_words_in_stream(f) topwords[fn] = counters[fn].get_topn_words(topn) return topwords def filter_dir_to_top(indir, outdir, topwords, tokenizer): for fn in sorted(listdir(indir)): infile = open(path.join(indir, fn)) outfile = open(path.join(outdir, fn), 'w') for sentence in tokenizer.tokenize_stream(infile): outfile.write(' '.join(filter(lambda x: x in topwords[fn], sentence)).encode('utf8') + '\n') infile.close() outfile.close() def main(): args = parse_args() t = Tokenizer() counters = defaultdict(lambda: WordNgram(t, N=args.N)) topn = read_topn_in_dir(args.train, counters, args.topn) filter_dir_to_top(args.train, args.train_out, topn, t) filter_dir_to_top(args.test, args.test_out, topn, t) if __name__ == '__main__': main()
[ 1, 529, 9507, 29958, 29881, 2536, 29914, 13239, 29914, 4572, 29918, 29888, 7971, 29889, 2272, 13, 3166, 2897, 1053, 1051, 3972, 29892, 2224, 13, 3166, 1852, 5510, 1053, 23125, 11726, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 3166, 270, 2536, 29889, 22100, 29889, 1725, 1337, 675, 1053, 25159, 3950, 29892, 10803, 29940, 1393, 13, 13, 13, 1753, 6088, 29918, 5085, 7295, 13, 1678, 282, 353, 23125, 11726, 580, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 14968, 742, 1134, 29922, 710, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 14968, 29899, 449, 742, 1134, 29922, 710, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 1688, 742, 1134, 29922, 710, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 1688, 29899, 449, 742, 1134, 29922, 710, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 3332, 29876, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29900, 29900, 29897, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 29940, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29892, 1371, 2433, 29940, 310, 1734, 29876, 1393, 6795, 1495, 13, 1678, 282, 29889, 1202, 29918, 23516, 877, 489, 8513, 742, 19995, 29922, 1839, 17462, 742, 525, 5992, 7464, 2322, 2433, 17462, 1495, 13, 1678, 736, 282, 29889, 5510, 29918, 5085, 580, 13, 13, 13, 1753, 1303, 29918, 3332, 29876, 29918, 262, 29918, 3972, 29898, 6707, 381, 29892, 2613, 2153, 29892, 2246, 29876, 29922, 29896, 29900, 29900, 1125, 13, 1678, 2246, 9303, 353, 6571, 13, 1678, 363, 7876, 297, 12705, 29898, 1761, 3972, 29898, 6707, 381, 22164, 13, 4706, 411, 1722, 29898, 2084, 29889, 7122, 29898, 6707, 381, 29892, 7876, 876, 408, 285, 29901, 13, 9651, 2613, 2153, 29961, 9144, 1822, 2798, 29918, 9303, 29918, 262, 29918, 5461, 29898, 29888, 29897, 13, 9651, 2246, 9303, 29961, 9144, 29962, 353, 2613, 2153, 29961, 9144, 1822, 657, 29918, 3332, 29876, 29918, 9303, 29898, 3332, 29876, 29897, 13, 1678, 736, 2246, 9303, 13, 13, 13, 1753, 4175, 29918, 3972, 29918, 517, 29918, 3332, 29898, 513, 381, 29892, 714, 3972, 29892, 2246, 9303, 29892, 5993, 3950, 1125, 13, 1678, 363, 7876, 297, 12705, 29898, 1761, 3972, 29898, 513, 381, 22164, 13, 4706, 297, 1445, 353, 1722, 29898, 2084, 29889, 7122, 29898, 513, 381, 29892, 7876, 876, 13, 4706, 714, 1445, 353, 1722, 29898, 2084, 29889, 7122, 29898, 449, 3972, 29892, 7876, 511, 525, 29893, 1495, 13, 4706, 363, 10541, 297, 5993, 3950, 29889, 6979, 675, 29918, 5461, 29898, 262, 1445, 1125, 13, 9651, 714, 1445, 29889, 3539, 877, 15300, 7122, 29898, 4572, 29898, 2892, 921, 29901, 921, 297, 2246, 9303, 29961, 9144, 1402, 10541, 8106, 12508, 877, 9420, 29947, 1495, 718, 11297, 29876, 1495, 13, 4706, 297, 1445, 29889, 5358, 580, 13, 4706, 714, 1445, 29889, 5358, 580, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6389, 353, 6088, 29918, 5085, 580, 13, 1678, 260, 353, 25159, 3950, 580, 13, 1678, 2613, 2153, 353, 2322, 8977, 29898, 2892, 29901, 10803, 29940, 1393, 29898, 29873, 29892, 405, 29922, 5085, 29889, 29940, 876, 13, 1678, 2246, 29876, 353, 1303, 29918, 3332, 29876, 29918, 262, 29918, 3972, 29898, 5085, 29889, 14968, 29892, 2613, 2153, 29892, 6389, 29889, 3332, 29876, 29897, 13, 1678, 4175, 29918, 3972, 29918, 517, 29918, 3332, 29898, 5085, 29889, 14968, 29892, 6389, 29889, 14968, 29918, 449, 29892, 2246, 29876, 29892, 260, 29897, 13, 1678, 4175, 29918, 3972, 29918, 517, 29918, 3332, 29898, 5085, 29889, 1688, 29892, 6389, 29889, 1688, 29918, 449, 29892, 2246, 29876, 29892, 260, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
Taller Funciones/Untitled-2.py
SantiVillarreal/Taller_Estructuras
0
78523
""" Entradas: lista-->list-->lista elemento->str-->elemento Salidas lista-->lista """ frutas = open('frutas.txt', 'r') lista_frutas = [] for i in frutas: lista_frutas.append(i) def eliminar_un_caracter(lista: list, elemento: str): auxilar = [] for i in lista: a = i.replace(elemento, "") auxilar.append(a) return auxilar if __name__ == "__main__": nueva = eliminar_un_caracter(lista_frutas, ("a")) print(nueva)
[ 1, 29871, 13, 15945, 29908, 13, 2369, 509, 3922, 29901, 13, 19641, 15110, 1761, 15110, 19641, 13, 5029, 29877, 976, 710, 15110, 5029, 29877, 13, 20392, 8817, 13, 19641, 15110, 19641, 13, 15945, 29908, 13, 1341, 329, 294, 353, 1722, 877, 1341, 329, 294, 29889, 3945, 742, 525, 29878, 1495, 13, 19641, 29918, 1341, 329, 294, 353, 5159, 29871, 13, 1454, 474, 297, 1424, 329, 294, 29901, 13, 29871, 15023, 29918, 1341, 329, 294, 29889, 4397, 29898, 29875, 29897, 13, 1753, 10397, 279, 29918, 348, 29918, 4287, 5761, 29898, 19641, 29901, 1051, 29892, 1543, 29877, 29901, 851, 1125, 13, 29871, 3479, 2327, 353, 5159, 13, 29871, 363, 474, 297, 15023, 29901, 13, 1678, 263, 353, 474, 29889, 6506, 29898, 5029, 29877, 29892, 20569, 13, 1678, 3479, 2327, 29889, 4397, 29898, 29874, 29897, 13, 29871, 736, 3479, 2327, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 22288, 353, 10397, 279, 29918, 348, 29918, 4287, 5761, 29898, 19641, 29918, 1341, 329, 294, 29892, 4852, 29874, 5783, 13, 29871, 1596, 29898, 29876, 434, 1564, 29897, 2 ]
trac/trac/web/tests/wikisyntax.py
HelionDevPlatform/bloodhound
84
103686
<reponame>HelionDevPlatform/bloodhound import unittest from trac.wiki.tests import formatter TEST_CASES = """ ============================== htdocs: links resolver htdocs:release-1.0.tar.gz [htdocs:release-1.0.tar.gz Release 1.0] ------------------------------ <p> <a href="/chrome/site/release-1.0.tar.gz">htdocs:release-1.0.tar.gz</a> </p> <p> <a href="/chrome/site/release-1.0.tar.gz">Release 1.0</a> </p> ------------------------------ """ def suite(): return formatter.suite(TEST_CASES, file=__file__) if __name__ == '__main__': unittest.main(defaultTest='suite')
[ 1, 529, 276, 1112, 420, 29958, 7658, 291, 16618, 21889, 29914, 14073, 397, 29882, 618, 13, 5215, 443, 27958, 13, 13, 3166, 16703, 29889, 4594, 29889, 21150, 1053, 883, 2620, 13, 13, 18267, 29918, 23487, 29903, 353, 9995, 13, 9166, 4936, 2751, 1360, 298, 29873, 2640, 29901, 2988, 3770, 369, 13, 400, 2640, 29901, 14096, 29899, 29896, 29889, 29900, 29889, 12637, 29889, 18828, 13, 13, 29961, 400, 2640, 29901, 14096, 29899, 29896, 29889, 29900, 29889, 12637, 29889, 18828, 23708, 29871, 29896, 29889, 29900, 29962, 13, 2683, 9072, 489, 13, 29966, 29886, 29958, 13, 29966, 29874, 2822, 13802, 18114, 29914, 2746, 29914, 14096, 29899, 29896, 29889, 29900, 29889, 12637, 29889, 18828, 1013, 400, 2640, 29901, 14096, 29899, 29896, 29889, 29900, 29889, 12637, 29889, 18828, 829, 29874, 29958, 13, 829, 29886, 29958, 13, 29966, 29886, 29958, 13, 29966, 29874, 2822, 13802, 18114, 29914, 2746, 29914, 14096, 29899, 29896, 29889, 29900, 29889, 12637, 29889, 18828, 1013, 19729, 29871, 29896, 29889, 29900, 829, 29874, 29958, 13, 829, 29886, 29958, 13, 2683, 9072, 489, 13, 15945, 29908, 13, 13, 1753, 9460, 7295, 13, 1678, 736, 883, 2620, 29889, 13495, 29898, 18267, 29918, 23487, 29903, 29892, 934, 29922, 1649, 1445, 1649, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 29898, 4381, 3057, 2433, 13495, 1495, 13, 2 ]
src/main/python/fontspecs.py
sourcery-ai-bot/retcom
10
1600553
<filename>src/main/python/fontspecs.py from fontTools.ttLib import TTFont from fontTools.ttLib.tables._c_m_a_p import CmapSubtable def fetchFontSpec(path): font = TTFont(path) cmap = font['cmap'] t = cmap.getcmap(3,1).cmap s = font.getGlyphSet() unitsPerEm = font['head'].unitsPerEm return { 'font' : font, 't' : t, 's' : s, 'upm' : unitsPerEm } def getCharDimensions(char, ptSize, fontSpec): t = fontSpec['t'] s = fontSpec['s'] upm = fontSpec['upm'] oc = ord(char) if oc in t and t[oc] in s: w = s[t[oc]].width else: w = s['.notdef'].width return [w*ptSize/upm, ptSize] def getTextDimensions(text, ptSize, fontSpec, dim=[0,0]): lines = text.split('\n') if len(lines) == 1: w = 0 t = fontSpec['t'] s = fontSpec['s'] upm = fontSpec['upm'] for c in text: oc = ord(c) if oc in t and t[oc] in s: w += s[t[oc]].width else: w += s['.notdef'].width dim0_new = w*ptSize/upm if dim0_new > dim[0]: dim[0] = dim0_new dim[1] += ptSize else: for line in lines: dim = getTextDimensions(line, ptSize, fontSpec, dim) return dim HALF2FULLWIDTH = dict((i, i + 0xFEE0) for i in range(0x21, 0x7F)) FULL2HALFWIDTH = dict((i + 0xFEE0, i) for i in range(0x21, 0x7F)) def half2fullWidth(txt:str): return txt.translate(HALF2FULLWIDTH) def full2halfWidth(txt:str): return txt.translate(FULL2HALFWIDTH) class FontGeom(object): def __init__(self, path, ptSize=12): self.path = path self.fontSpec = fetchFontSpec(path) self.ptSize = ptSize def getTextDimensions(self, text, ptSize=None): if not ptSize: ptSize = self.ptSize return getTextDimensions(text, ptSize, self.fontSpec, [0,0]) def getTextWidth(self, text, ptSize=None): self.getTextDimensions(text, ptSize)[0] def getTextHeight(self, text, ptSize=None): self.getTextDimensions(text, ptSize)[1] def getTextAspectRatio(self, text, ptSize=None, order='w/h'): w, h = self.getTextDimensions(text, ptSize) return eval(order) def getCharDimensions(self, char, ptSize=None): if not ptSize: ptSize = self.ptSize return getCharDimensions(char, ptSize, self.fontSpec) def getCharAspectRatio(self, char, ptSize=None, order='w/h'): w, h = self.getTextDimensions(char, ptSize) return eval(order) if __name__ == "__main__": text = 'This is a test\nABCDEFGHIJKLMNOPQRSTUVW' fontSpec = fetchFontSpec('/Library/Fonts/Courier New.ttf') print(getTextDimensions(text, 12, fontSpec, [0,0])) fg = FontGeom('/Library/Fonts/Courier New.ttf', 12) print(fg.getTextDimensions(text))
[ 1, 529, 9507, 29958, 4351, 29914, 3396, 29914, 4691, 29914, 5657, 5965, 2395, 29889, 2272, 13, 3166, 4079, 24183, 29889, 698, 14868, 1053, 323, 8969, 609, 13, 3166, 4079, 24183, 29889, 698, 14868, 29889, 24051, 3032, 29883, 29918, 29885, 29918, 29874, 29918, 29886, 1053, 315, 1958, 4035, 2371, 13, 13, 1753, 6699, 9824, 10299, 29898, 2084, 1125, 13, 1678, 4079, 353, 323, 8969, 609, 29898, 2084, 29897, 13, 1678, 274, 1958, 353, 4079, 1839, 29883, 1958, 2033, 13, 1678, 260, 353, 274, 1958, 29889, 657, 29883, 1958, 29898, 29941, 29892, 29896, 467, 29883, 1958, 13, 1678, 269, 353, 4079, 29889, 657, 29954, 27026, 2697, 580, 13, 1678, 10340, 5894, 6026, 353, 4079, 1839, 2813, 13359, 348, 1169, 5894, 6026, 13, 13, 1678, 736, 426, 13, 4706, 525, 5657, 29915, 584, 4079, 29892, 13, 4706, 525, 29873, 29915, 584, 260, 29892, 13, 4706, 525, 29879, 29915, 584, 269, 29892, 13, 4706, 525, 786, 29885, 29915, 584, 10340, 5894, 6026, 13, 1678, 500, 13, 13, 1753, 679, 5914, 16142, 5580, 29898, 3090, 29892, 19592, 3505, 29892, 4079, 10299, 1125, 13, 1678, 260, 353, 4079, 10299, 1839, 29873, 2033, 13, 1678, 269, 353, 4079, 10299, 1839, 29879, 2033, 13, 1678, 701, 29885, 353, 4079, 10299, 1839, 786, 29885, 2033, 13, 13, 1678, 12954, 353, 4356, 29898, 3090, 29897, 13, 1678, 565, 12954, 297, 260, 322, 260, 29961, 542, 29962, 297, 269, 29901, 13, 4706, 281, 353, 269, 29961, 29873, 29961, 542, 29962, 1822, 2103, 13, 1678, 1683, 29901, 13, 4706, 281, 353, 269, 1839, 29889, 1333, 1753, 13359, 2103, 13, 13, 1678, 736, 518, 29893, 29930, 415, 3505, 29914, 786, 29885, 29892, 19592, 3505, 29962, 13, 13, 1753, 679, 1626, 16142, 5580, 29898, 726, 29892, 19592, 3505, 29892, 4079, 10299, 29892, 3964, 11759, 29900, 29892, 29900, 29962, 1125, 13, 1678, 3454, 353, 1426, 29889, 5451, 28909, 29876, 1495, 13, 13, 1678, 565, 7431, 29898, 9012, 29897, 1275, 29871, 29896, 29901, 13, 4706, 281, 353, 29871, 29900, 13, 13, 4706, 260, 353, 4079, 10299, 1839, 29873, 2033, 13, 4706, 269, 353, 4079, 10299, 1839, 29879, 2033, 13, 4706, 701, 29885, 353, 4079, 10299, 1839, 786, 29885, 2033, 13, 13, 4706, 363, 274, 297, 1426, 29901, 13, 9651, 12954, 353, 4356, 29898, 29883, 29897, 13, 9651, 565, 12954, 297, 260, 322, 260, 29961, 542, 29962, 297, 269, 29901, 13, 18884, 281, 4619, 269, 29961, 29873, 29961, 542, 29962, 1822, 2103, 13, 9651, 1683, 29901, 13, 18884, 281, 4619, 269, 1839, 29889, 1333, 1753, 13359, 2103, 13, 13, 4706, 3964, 29900, 29918, 1482, 353, 281, 29930, 415, 3505, 29914, 786, 29885, 13, 4706, 565, 3964, 29900, 29918, 1482, 1405, 3964, 29961, 29900, 5387, 13, 9651, 3964, 29961, 29900, 29962, 353, 3964, 29900, 29918, 1482, 13, 13, 4706, 3964, 29961, 29896, 29962, 4619, 19592, 3505, 13, 1678, 1683, 29901, 13, 4706, 363, 1196, 297, 3454, 29901, 13, 9651, 3964, 353, 679, 1626, 16142, 5580, 29898, 1220, 29892, 19592, 3505, 29892, 4079, 10299, 29892, 3964, 29897, 13, 308, 13, 1678, 736, 3964, 13, 13, 29950, 1964, 29943, 29906, 29943, 3299, 22574, 353, 9657, 3552, 29875, 29892, 474, 718, 29871, 29900, 29916, 16359, 29923, 29900, 29897, 363, 474, 297, 3464, 29898, 29900, 29916, 29906, 29896, 29892, 29871, 29900, 29916, 29955, 29943, 876, 13, 29943, 3299, 29906, 29950, 1964, 29943, 22574, 353, 9657, 3552, 29875, 718, 29871, 29900, 29916, 16359, 29923, 29900, 29892, 474, 29897, 363, 474, 297, 3464, 29898, 29900, 29916, 29906, 29896, 29892, 29871, 29900, 29916, 29955, 29943, 876, 13, 13, 1753, 4203, 29906, 8159, 6110, 29898, 3945, 29901, 710, 1125, 13, 1678, 736, 13872, 29889, 21652, 29898, 29950, 1964, 29943, 29906, 29943, 3299, 22574, 29897, 13, 13, 1753, 2989, 29906, 24498, 6110, 29898, 3945, 29901, 710, 1125, 13, 1678, 736, 13872, 29889, 21652, 29898, 29943, 3299, 29906, 29950, 1964, 29943, 22574, 29897, 13, 13, 1990, 10928, 7999, 290, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2224, 29892, 19592, 3505, 29922, 29896, 29906, 1125, 13, 4706, 1583, 29889, 2084, 353, 2224, 13, 4706, 1583, 29889, 5657, 10299, 353, 6699, 9824, 10299, 29898, 2084, 29897, 13, 4706, 1583, 29889, 415, 3505, 353, 19592, 3505, 13, 13, 1678, 822, 679, 1626, 16142, 5580, 29898, 1311, 29892, 1426, 29892, 19592, 3505, 29922, 8516, 1125, 13, 4706, 565, 451, 19592, 3505, 29901, 13, 9651, 19592, 3505, 353, 1583, 29889, 415, 3505, 13, 13, 4706, 736, 679, 1626, 16142, 5580, 29898, 726, 29892, 19592, 3505, 29892, 1583, 29889, 5657, 10299, 29892, 518, 29900, 29892, 29900, 2314, 13, 13, 1678, 822, 679, 1626, 6110, 29898, 1311, 29892, 1426, 29892, 19592, 3505, 29922, 8516, 1125, 13, 4706, 1583, 29889, 18516, 16142, 5580, 29898, 726, 29892, 19592, 3505, 9601, 29900, 29962, 13, 13, 1678, 822, 679, 1626, 7011, 29898, 1311, 29892, 1426, 29892, 19592, 3505, 29922, 8516, 1125, 13, 4706, 1583, 29889, 18516, 16142, 5580, 29898, 726, 29892, 19592, 3505, 9601, 29896, 29962, 13, 13, 1678, 822, 679, 1626, 2887, 1103, 29934, 20819, 29898, 1311, 29892, 1426, 29892, 19592, 3505, 29922, 8516, 29892, 1797, 2433, 29893, 29914, 29882, 29374, 13, 4706, 281, 29892, 298, 353, 1583, 29889, 18516, 16142, 5580, 29898, 726, 29892, 19592, 3505, 29897, 13, 4706, 736, 19745, 29898, 2098, 29897, 13, 13, 1678, 822, 679, 5914, 16142, 5580, 29898, 1311, 29892, 1373, 29892, 19592, 3505, 29922, 8516, 1125, 13, 4706, 565, 451, 19592, 3505, 29901, 13, 9651, 19592, 3505, 353, 1583, 29889, 415, 3505, 13, 13, 4706, 736, 679, 5914, 16142, 5580, 29898, 3090, 29892, 19592, 3505, 29892, 1583, 29889, 5657, 10299, 29897, 13, 13, 1678, 822, 679, 5914, 2887, 1103, 29934, 20819, 29898, 1311, 29892, 1373, 29892, 19592, 3505, 29922, 8516, 29892, 1797, 2433, 29893, 29914, 29882, 29374, 13, 4706, 281, 29892, 298, 353, 1583, 29889, 18516, 16142, 5580, 29898, 3090, 29892, 19592, 3505, 29897, 13, 4706, 736, 19745, 29898, 2098, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1426, 353, 525, 4013, 338, 263, 1243, 29905, 29876, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29984, 29934, 1254, 29965, 29963, 29956, 29915, 13, 1678, 4079, 10299, 353, 6699, 9824, 10299, 11219, 12284, 29914, 9824, 29879, 29914, 29907, 283, 4336, 1570, 29889, 698, 29888, 1495, 13, 1678, 1596, 29898, 18516, 16142, 5580, 29898, 726, 29892, 29871, 29896, 29906, 29892, 4079, 10299, 29892, 518, 29900, 29892, 29900, 12622, 13, 13, 1678, 285, 29887, 353, 10928, 7999, 290, 11219, 12284, 29914, 9824, 29879, 29914, 29907, 283, 4336, 1570, 29889, 698, 29888, 742, 29871, 29896, 29906, 29897, 13, 1678, 1596, 29898, 16434, 29889, 18516, 16142, 5580, 29898, 726, 876, 13, 13, 268, 2 ]
exe 6.py
LucasGabrielTheodoro/Lista-de-python
0
147658
<gh_stars>0 n1 = int(input('Digite o preço do primeiro produto: ')) n2 = int(input('Digite o preço do segundo número: ')) desconto1= ((n1 * 8) / 100) - n1 desconto2= ((n2 * 11) / 100) - n2 total = (desconto1 + desconto2) *-1 print ('Com o desconto no primeiro produto de 8% e de 11% no segundo produt, o total vai ser de {}'.format (total))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29876, 29896, 353, 938, 29898, 2080, 877, 14991, 568, 288, 758, 6102, 437, 19695, 11859, 3066, 29901, 525, 876, 30004, 13, 29876, 29906, 353, 938, 29898, 2080, 877, 14991, 568, 288, 758, 6102, 437, 14729, 13831, 29901, 525, 876, 30004, 13, 30004, 13, 2783, 535, 517, 29896, 29922, 5135, 29876, 29896, 334, 29871, 29947, 29897, 847, 29871, 29896, 29900, 29900, 29897, 448, 302, 29896, 30004, 13, 2783, 535, 517, 29906, 29922, 5135, 29876, 29906, 334, 29871, 29896, 29896, 29897, 847, 29871, 29896, 29900, 29900, 29897, 448, 302, 29906, 30004, 13, 7827, 353, 313, 2783, 535, 517, 29896, 718, 553, 535, 517, 29906, 29897, 334, 29899, 29896, 30004, 13, 30004, 13, 2158, 6702, 1523, 288, 553, 535, 517, 694, 19695, 11859, 3066, 316, 29871, 29947, 29995, 321, 316, 29871, 29896, 29896, 29995, 694, 14729, 11859, 329, 29892, 288, 3001, 325, 1794, 724, 316, 6571, 4286, 4830, 313, 7827, 876, 2 ]
ecs/docstash/tests/urls.py
programmierfabrik/ecs
9
1611155
import json from django.conf.urls import url from django.http import HttpResponse from ecs.docstash.decorators import with_docstash @with_docstash() def simple_post_view(request): if request.method == 'POST': request.docstash.value = request.POST.dict() request.docstash.save() return HttpResponse(json.dumps(request.docstash.value), content_type='text/json') urlpatterns = ( url(r'^simple_post/(?:(?P<docstash_key>.*)/)?$', simple_post_view), )
[ 1, 1053, 4390, 13, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 13, 3166, 321, 2395, 29889, 1514, 303, 1161, 29889, 19557, 4097, 1053, 411, 29918, 1514, 303, 1161, 13, 13, 13, 29992, 2541, 29918, 1514, 303, 1161, 580, 13, 1753, 2560, 29918, 2490, 29918, 1493, 29898, 3827, 1125, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 2009, 29889, 1514, 303, 1161, 29889, 1767, 353, 2009, 29889, 5438, 29889, 8977, 580, 13, 4706, 2009, 29889, 1514, 303, 1161, 29889, 7620, 580, 13, 1678, 736, 9056, 5103, 29898, 3126, 29889, 29881, 17204, 29898, 3827, 29889, 1514, 303, 1161, 29889, 1767, 511, 2793, 29918, 1853, 2433, 726, 29914, 3126, 1495, 13, 13, 2271, 11037, 29879, 353, 313, 13, 1678, 3142, 29898, 29878, 29915, 29985, 12857, 29918, 2490, 29914, 10780, 5919, 29973, 29925, 29966, 1514, 303, 1161, 29918, 1989, 29958, 5575, 29897, 4551, 29973, 29938, 742, 2560, 29918, 2490, 29918, 1493, 511, 13, 29897, 13, 2 ]
src/SparseSC/cli/scgrad.py
wofein/SparseSC
34
118344
#!/usr/bin/env python """ A service like daemon for calculating components of the gradient """ # pylint: disable=invalid-name, unused-import, multiple-imports import platform import numpy as np import uuid import sys, time, os, atexit, json from SparseSC.cli.daemon import Daemon from yaml import load, dump import tempfile try: from yaml import CLoader as Loader, CDumper as Dumper except ImportError: from yaml import Loader, Dumper # pluck = lambda d, *args: (d[arg] for arg in args) def pluck(d, *args): """ pluckr """ # print("hello pluckr"); sys.stdout.flush() out = [None] * len(args) for i, key in enumerate(args): # print("key: " + key); sys.stdout.flush() try: out[i] = d[key] except KeyError: raise RuntimeError("no such key '{}'".format(key)) return out def grad_part(common, part, k): """ Calculate a single component of the gradient """ N0, N1, in_controls, splits, w_pen, treated_units, Y_treated, Y_control, dA_dV_ki, dB_dV_ki = pluck( common, "N0", "N1", "in_controls", "splits", "w_pen", "treated_units", "Y_treated", "Y_control", "dA_dV_ki", "dB_dV_ki", ) in_controls2 = [np.ix_(i, i) for i in in_controls] A, weights, b_i = pluck(part, "A", "weights", "b_i") dA_dV_ki_k, dB_dV_ki_k = dA_dV_ki[k], dB_dV_ki[k] dPI_dV = np.zeros((N0, N1)) # stupid notation: PI = W.T try: for i, (_, (_, test)) in enumerate(zip(in_controls, splits)): dA = dA_dV_ki_k[i] dB = dB_dV_ki_k[i] try: b = np.linalg.solve(A[in_controls2[i]], dB - dA.dot(b_i[i])) except np.linalg.LinAlgError as exc: print("Unique weights not possible.") if w_pen == 0: print("Try specifying a very small w_pen rather than 0.") raise exc dPI_dV[np.ix_(in_controls[i], treated_units[test])] = b # einsum is faster than the equivalent (Ey * Y_control.T.dot(dPI_dV).T.getA()).sum() return 2 * np.einsum( "ij,kj,ki->", (weights.T.dot(Y_control) - Y_treated), Y_control, dPI_dV ) except Exception as err: print("{}: {}".format(err.__class__.__name__, getattr(err, "message", "<>"))) raise RuntimeError("bye from scgrad") DAEMON_FIFO = "/tmp/sc-daemon.fifo" DAEMON_PID = "/tmp/sc-gradient-daemon.pid" #-- print("DAEMON_FIFO: " + DAEMON_FIFO) #-- print("DAEMON_PID: " + DAEMON_PID) _CONTAINER_OUTPUT_FILE = "output.yaml" # Standard Output file _GRAD_COMMON_FILE = "common.yaml" _GRAD_PART_FILE = "part.yaml" _BASENAMES = [_GRAD_COMMON_FILE, _GRAD_PART_FILE, _CONTAINER_OUTPUT_FILE] class TestDaemon(Daemon): """ A daemon which calculates Sparse SC gradient components """ def run(self): print("run says hi: ") sys.stdout.flush() # pylint: disable=no-self-use while True: with open(DAEMON_FIFO, "r") as fifo: try: params = fifo.read() print("run says hi: " + params) sys.stdout.flush() tmpdirname, return_fifo, k = json.loads(params) common_file, part_file, out_file = [ os.join(tmpdirname, name) for name in _BASENAMES ] print([common_file, part_file, out_file, return_fifo, k]) sys.stdout.flush() except: # pylint: disable=bare-except # SOMETHING WENT WRONG, RESPOND WITH A NON-ZERO try: with open(return_fifo, "w") as rf: rf.write("1") except: # pylint: disable=bare-except pass else: print("daemon something went wrong: ") sys.stdout.flush() else: # SEND THE SUCCESS RESPONSE print("daemon all done: ") sys.stdout.flush() with open(return_fifo, "w") as rf: rf.write("0") class GradientDaemon(Daemon): """ A daemon which calculates Sparse SC gradient components """ def run(self): # pylint: disable=no-self-use while True: with open(DAEMON_FIFO, "r") as fifo: try: params = fifo.read() print("params: " + params) sys.stdout.flush() tmpdirname, return_fifo, k = json.loads(params) print(_BASENAMES) for file in os.listdir(tmpdirname): print(file) common_file, part_file, out_file = [ os.path.join(tmpdirname, name) for name in _BASENAMES ] print([common_file, part_file, out_file, return_fifo, k]) sys.stdout.flush() # LOAD IN THE INPUT FILES with open(common_file, "r") as fp: common = load(fp, Loader=Loader) with open(part_file, "r") as fp: part = load(fp, Loader=Loader) # DO THE WORK print("about to do work: ") sys.stdout.flush() grad = grad_part(common, part, int(k)) print("did work: ") sys.stdout.flush() # DUMP THE RESULT TO THE OUTPUT FILE with open(out_file, "w") as fp: fp.write(dump(grad, Dumper=Dumper)) except Exception as err: # pylint: disable=bare-except # SOMETHING WENT WRONG, RESPOND WITH A NON-ZERO try: with open(return_fifo, "w") as rf: rf.write("1") except: # pylint: disable=bare-except print("double failed...: ") sys.stdout.flush() else: print( "failed with {}: {}", err.__class__.__name__, getattr(err, "message", "<>"), ) sys.stdout.flush() else: # SEND THE SUCCESS RESPONSE print("success...: ") sys.stdout.flush() with open(return_fifo, "w") as rf: rf.write("0") print("and wrote about it...: ") sys.stdout.flush() def main(test=False): # pylint: disable=inconsistent-return-statements """ read in the contents of the inputs yaml file """ try: os.fork # pylint: disable=no-member except NameError: raise RuntimeError( "scgrad.py depends on os.fork, which is not available on this system." ) ARGS = sys.argv[1:] if ARGS[0] == "scgrad.py": ARGS.pop(0) WorkerDaemon = TestDaemon if test else GradientDaemon # -------------------------------------------------- # Daemon controllers # -------------------------------------------------- if ARGS[0] == "start": print("starting daemon") daemon = WorkerDaemon(DAEMON_PID, DAEMON_FIFO) daemon.start() return "0" if ARGS[0] == "status": if not os.path.exists(DAEMON_PID): print("Daemon not running") return '0' with open(DAEMON_PID,'w') as fh: _pid = fh.read() pids = [pid for pid in os.listdir('/proc') if pid.isdigit()] if _pid in pids: print("daemon process (pid {}) is running".format(_pid)) else: print("daemon process (pid {}) NOT is running".format(_pid)) return '0' if ARGS[0] == "stop": print("stopping daemon") daemon = WorkerDaemon(DAEMON_PID, DAEMON_FIFO) daemon.stop() return "0" if ARGS[0] == "restart": print("restaring daemon") daemon = WorkerDaemon(DAEMON_PID, DAEMON_FIFO) daemon.restart() return "0" # -------------------------------------------------- # Gradient job # -------------------------------------------------- try: with open(DAEMON_PID, "r") as pf: pid = int(pf.read().strip()) except IOError: pid = None if not pid: raise RuntimeError("please start the daemon") assert ( len(ARGS) == 4 ), "ssc.py expects 4 parameters, including a commonfile, partfile, outfile and the component index" try: int(ARGS[3]) except ValueError: raise ValueError("The args[3] must be an integer") # CREATE THE RESPONSE FIFO RETURN_FIFO = os.path.join("/tmp/sc-" + str(uuid.uuid4()) + ".fifo") os.mkfifo(RETURN_FIFO) # pylint: disable=no-member def cleanup(): os.remove(RETURN_FIFO) atexit.register(cleanup) # SEND THE ARGS TO THE DAEMON with open(DAEMON_FIFO, "w") as d_send: d_send.write(json.dumps(ARGS + [RETURN_FIFO])) # LISTEN FOR THE RESPONSE with open(RETURN_FIFO, "r") as d_return: response = d_return.read() print("daemon sent response: {}".format(response)) return response if __name__ == "__main__": print("hi from scgrad", sys.argv) condition_flag = main(test=False) if condition_flag == "0": print("Test Daemon worked!") else: print("Something went wrong: {}".format(condition_flag))
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 29909, 2669, 763, 1146, 9857, 363, 25202, 7117, 310, 278, 16030, 13, 15945, 29908, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 20965, 29899, 978, 29892, 443, 3880, 29899, 5215, 29892, 2999, 29899, 326, 4011, 13, 5215, 7481, 13, 5215, 12655, 408, 7442, 13, 5215, 318, 5416, 13, 5215, 10876, 29892, 931, 29892, 2897, 29892, 263, 4776, 277, 29892, 4390, 13, 3166, 317, 5510, 7187, 29889, 11303, 29889, 1388, 9857, 1053, 7266, 9857, 13, 3166, 343, 8807, 1053, 2254, 29892, 16766, 13, 5215, 5694, 1445, 13, 13, 13, 2202, 29901, 13, 1678, 515, 343, 8807, 1053, 315, 10036, 408, 4309, 1664, 29892, 7307, 398, 546, 408, 21139, 546, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 343, 8807, 1053, 4309, 1664, 29892, 21139, 546, 13, 13, 29937, 715, 2707, 353, 14013, 270, 29892, 334, 5085, 29901, 313, 29881, 29961, 1191, 29962, 363, 1852, 297, 6389, 29897, 13, 1753, 715, 2707, 29898, 29881, 29892, 334, 5085, 1125, 13, 1678, 9995, 13, 1678, 715, 2707, 29878, 13, 1678, 9995, 13, 1678, 396, 1596, 703, 12199, 715, 2707, 29878, 1496, 10876, 29889, 25393, 29889, 23126, 580, 13, 1678, 714, 353, 518, 8516, 29962, 334, 7431, 29898, 5085, 29897, 13, 1678, 363, 474, 29892, 1820, 297, 26985, 29898, 5085, 1125, 13, 4706, 396, 1596, 703, 1989, 29901, 376, 718, 1820, 416, 10876, 29889, 25393, 29889, 23126, 580, 13, 4706, 1018, 29901, 13, 9651, 714, 29961, 29875, 29962, 353, 270, 29961, 1989, 29962, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 12020, 24875, 2392, 703, 1217, 1316, 1820, 525, 8875, 29915, 1642, 4830, 29898, 1989, 876, 13, 1678, 736, 714, 13, 13, 13, 1753, 4656, 29918, 1595, 29898, 9435, 29892, 760, 29892, 413, 1125, 13, 1678, 9995, 13, 1678, 20535, 403, 263, 2323, 4163, 310, 278, 16030, 13, 1678, 9995, 13, 13, 1678, 405, 29900, 29892, 405, 29896, 29892, 297, 29918, 26255, 29892, 8536, 1169, 29892, 281, 29918, 2238, 29892, 14914, 29918, 348, 1169, 29892, 612, 29918, 2484, 630, 29892, 612, 29918, 6451, 29892, 270, 29909, 29918, 29881, 29963, 29918, 1984, 29892, 270, 29933, 29918, 29881, 29963, 29918, 1984, 353, 715, 2707, 29898, 13, 4706, 3619, 29892, 13, 4706, 376, 29940, 29900, 613, 13, 4706, 376, 29940, 29896, 613, 13, 4706, 376, 262, 29918, 26255, 613, 13, 4706, 376, 23579, 1169, 613, 13, 4706, 376, 29893, 29918, 2238, 613, 13, 4706, 376, 2484, 630, 29918, 348, 1169, 613, 13, 4706, 376, 29979, 29918, 2484, 630, 613, 13, 4706, 376, 29979, 29918, 6451, 613, 13, 4706, 376, 29881, 29909, 29918, 29881, 29963, 29918, 1984, 613, 13, 4706, 376, 29881, 29933, 29918, 29881, 29963, 29918, 1984, 613, 13, 1678, 1723, 13, 13, 1678, 297, 29918, 26255, 29906, 353, 518, 9302, 29889, 861, 23538, 29875, 29892, 474, 29897, 363, 474, 297, 297, 29918, 26255, 29962, 13, 13, 1678, 319, 29892, 18177, 29892, 289, 29918, 29875, 353, 715, 2707, 29898, 1595, 29892, 376, 29909, 613, 376, 705, 5861, 613, 376, 29890, 29918, 29875, 1159, 13, 1678, 270, 29909, 29918, 29881, 29963, 29918, 1984, 29918, 29895, 29892, 270, 29933, 29918, 29881, 29963, 29918, 1984, 29918, 29895, 353, 270, 29909, 29918, 29881, 29963, 29918, 1984, 29961, 29895, 1402, 270, 29933, 29918, 29881, 29963, 29918, 1984, 29961, 29895, 29962, 13, 13, 1678, 270, 2227, 29918, 29881, 29963, 353, 7442, 29889, 3298, 359, 3552, 29940, 29900, 29892, 405, 29896, 876, 29871, 396, 20239, 12640, 29901, 349, 29902, 353, 399, 29889, 29911, 13, 13, 1678, 1018, 29901, 13, 4706, 363, 474, 29892, 313, 3383, 313, 3383, 1243, 876, 297, 26985, 29898, 7554, 29898, 262, 29918, 26255, 29892, 8536, 1169, 22164, 13, 13, 9651, 270, 29909, 353, 270, 29909, 29918, 29881, 29963, 29918, 1984, 29918, 29895, 29961, 29875, 29962, 13, 9651, 270, 29933, 353, 270, 29933, 29918, 29881, 29963, 29918, 1984, 29918, 29895, 29961, 29875, 29962, 13, 9651, 1018, 29901, 13, 18884, 289, 353, 7442, 29889, 29880, 979, 29887, 29889, 2929, 345, 29898, 29909, 29961, 262, 29918, 26255, 29906, 29961, 29875, 20526, 270, 29933, 448, 270, 29909, 29889, 6333, 29898, 29890, 29918, 29875, 29961, 29875, 12622, 13, 9651, 5174, 7442, 29889, 29880, 979, 29887, 29889, 11667, 22461, 2392, 408, 5566, 29901, 13, 18884, 1596, 703, 8110, 802, 18177, 451, 1950, 23157, 13, 18884, 565, 281, 29918, 2238, 1275, 29871, 29900, 29901, 13, 462, 1678, 1596, 703, 15870, 22146, 263, 1407, 2319, 281, 29918, 2238, 3265, 1135, 29871, 29900, 23157, 13, 18884, 12020, 5566, 13, 9651, 270, 2227, 29918, 29881, 29963, 29961, 9302, 29889, 861, 23538, 262, 29918, 26255, 29961, 29875, 1402, 14914, 29918, 348, 1169, 29961, 1688, 2314, 29962, 353, 289, 13, 4706, 396, 1011, 2083, 338, 8473, 1135, 278, 7126, 313, 29923, 29891, 334, 612, 29918, 6451, 29889, 29911, 29889, 6333, 29898, 29881, 2227, 29918, 29881, 29963, 467, 29911, 29889, 657, 29909, 16655, 2083, 580, 13, 4706, 736, 29871, 29906, 334, 7442, 29889, 29872, 1144, 398, 29898, 13, 9651, 376, 823, 29892, 29895, 29926, 29892, 1984, 976, 613, 313, 705, 5861, 29889, 29911, 29889, 6333, 29898, 29979, 29918, 6451, 29897, 448, 612, 29918, 2484, 630, 511, 612, 29918, 6451, 29892, 270, 2227, 29918, 29881, 29963, 13, 4706, 1723, 13, 1678, 5174, 8960, 408, 4589, 29901, 13, 4706, 1596, 703, 29912, 6177, 6571, 1642, 4830, 29898, 3127, 17255, 1990, 1649, 17255, 978, 1649, 29892, 679, 5552, 29898, 3127, 29892, 376, 4906, 613, 9872, 11903, 4961, 13, 4706, 12020, 24875, 2392, 703, 26966, 515, 885, 5105, 1159, 13, 13, 13, 7698, 12665, 1164, 29918, 3738, 5800, 353, 5591, 7050, 29914, 1557, 29899, 1388, 9857, 29889, 28491, 29877, 29908, 13, 7698, 12665, 1164, 29918, 29925, 1367, 353, 5591, 7050, 29914, 1557, 29899, 24970, 29899, 1388, 9857, 29889, 5935, 29908, 13, 29937, 489, 1596, 703, 7698, 12665, 1164, 29918, 3738, 5800, 29901, 376, 718, 21330, 12665, 1164, 29918, 3738, 5800, 29897, 13, 29937, 489, 1596, 703, 7698, 12665, 1164, 29918, 29925, 1367, 29901, 376, 718, 21330, 12665, 1164, 29918, 29925, 1367, 29897, 13, 13, 29918, 6007, 6040, 1177, 1001, 29918, 12015, 12336, 29918, 7724, 353, 376, 4905, 29889, 25162, 29908, 29871, 396, 10117, 10604, 934, 13, 29918, 14345, 3035, 29918, 3217, 7428, 1164, 29918, 7724, 353, 376, 9435, 29889, 25162, 29908, 13, 29918, 14345, 3035, 29918, 26092, 29918, 7724, 353, 376, 1595, 29889, 25162, 29908, 13, 13, 29918, 29933, 3289, 1430, 25797, 29903, 353, 23160, 14345, 3035, 29918, 3217, 7428, 1164, 29918, 7724, 29892, 903, 14345, 3035, 29918, 26092, 29918, 7724, 29892, 903, 6007, 6040, 1177, 1001, 29918, 12015, 12336, 29918, 7724, 29962, 13, 13, 13, 1990, 4321, 27838, 9857, 29898, 27838, 9857, 1125, 13, 1678, 9995, 13, 1678, 319, 1146, 9857, 607, 3408, 1078, 317, 5510, 12314, 16030, 7117, 13, 1678, 9995, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 1596, 703, 3389, 4083, 7251, 29901, 16521, 13, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 4706, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 1509, 13, 4706, 1550, 5852, 29901, 13, 9651, 411, 1722, 29898, 7698, 12665, 1164, 29918, 3738, 5800, 29892, 376, 29878, 1159, 408, 8461, 29877, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 8636, 353, 8461, 29877, 29889, 949, 580, 13, 462, 1678, 1596, 703, 3389, 4083, 7251, 29901, 376, 718, 8636, 29897, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 13128, 25721, 29892, 736, 29918, 28491, 29877, 29892, 413, 353, 4390, 29889, 18132, 29898, 7529, 29897, 13, 462, 1678, 3619, 29918, 1445, 29892, 760, 29918, 1445, 29892, 714, 29918, 1445, 353, 518, 13, 462, 4706, 2897, 29889, 7122, 29898, 7050, 25721, 29892, 1024, 29897, 363, 1024, 297, 903, 29933, 3289, 1430, 25797, 29903, 13, 462, 1678, 4514, 13, 462, 1678, 1596, 4197, 9435, 29918, 1445, 29892, 760, 29918, 1445, 29892, 714, 29918, 1445, 29892, 736, 29918, 28491, 29877, 29892, 413, 2314, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 18884, 5174, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 18354, 29899, 19499, 13, 13, 462, 1678, 396, 7791, 2303, 4690, 4214, 399, 3919, 399, 29934, 20614, 29892, 390, 2890, 29925, 1164, 29928, 22659, 319, 405, 1164, 29899, 29999, 1001, 29949, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 411, 1722, 29898, 2457, 29918, 28491, 29877, 29892, 376, 29893, 1159, 408, 364, 29888, 29901, 13, 462, 9651, 364, 29888, 29889, 3539, 703, 29896, 1159, 13, 462, 1678, 5174, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 18354, 29899, 19499, 13, 462, 4706, 1209, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1596, 703, 1388, 9857, 1554, 3512, 2743, 29901, 16521, 13, 462, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 18884, 1683, 29901, 13, 13, 462, 1678, 396, 317, 11794, 6093, 20134, 26925, 390, 2890, 29925, 1164, 1660, 13, 462, 1678, 1596, 703, 1388, 9857, 599, 2309, 29901, 16521, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 411, 1722, 29898, 2457, 29918, 28491, 29877, 29892, 376, 29893, 1159, 408, 364, 29888, 29901, 13, 462, 4706, 364, 29888, 29889, 3539, 703, 29900, 1159, 13, 13, 13, 1990, 19295, 993, 27838, 9857, 29898, 27838, 9857, 1125, 13, 1678, 9995, 13, 1678, 319, 1146, 9857, 607, 3408, 1078, 317, 5510, 12314, 16030, 7117, 13, 1678, 9995, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 1509, 13, 4706, 1550, 5852, 29901, 13, 9651, 411, 1722, 29898, 7698, 12665, 1164, 29918, 3738, 5800, 29892, 376, 29878, 1159, 408, 8461, 29877, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 8636, 353, 8461, 29877, 29889, 949, 580, 13, 462, 1678, 1596, 703, 7529, 29901, 376, 718, 8636, 29897, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 13128, 25721, 29892, 736, 29918, 28491, 29877, 29892, 413, 353, 4390, 29889, 18132, 29898, 7529, 29897, 13, 462, 1678, 1596, 7373, 29933, 3289, 1430, 25797, 29903, 29897, 13, 462, 1678, 363, 934, 297, 2897, 29889, 1761, 3972, 29898, 7050, 25721, 1125, 13, 462, 4706, 1596, 29898, 1445, 29897, 13, 462, 1678, 3619, 29918, 1445, 29892, 760, 29918, 1445, 29892, 714, 29918, 1445, 353, 518, 13, 462, 4706, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 25721, 29892, 1024, 29897, 363, 1024, 297, 903, 29933, 3289, 1430, 25797, 29903, 13, 462, 1678, 4514, 13, 462, 1678, 1596, 4197, 9435, 29918, 1445, 29892, 760, 29918, 1445, 29892, 714, 29918, 1445, 29892, 736, 29918, 28491, 29877, 29892, 413, 2314, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 462, 1678, 396, 11247, 3035, 2672, 6093, 2672, 12336, 9338, 17101, 13, 462, 1678, 411, 1722, 29898, 9435, 29918, 1445, 29892, 376, 29878, 1159, 408, 285, 29886, 29901, 13, 462, 4706, 3619, 353, 2254, 29898, 18091, 29892, 4309, 1664, 29922, 10036, 29897, 13, 462, 1678, 411, 1722, 29898, 1595, 29918, 1445, 29892, 376, 29878, 1159, 408, 285, 29886, 29901, 13, 462, 4706, 760, 353, 2254, 29898, 18091, 29892, 4309, 1664, 29922, 10036, 29897, 13, 13, 462, 1678, 396, 11662, 6093, 399, 1955, 29968, 13, 462, 1678, 1596, 703, 12717, 304, 437, 664, 29901, 16521, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 4656, 353, 4656, 29918, 1595, 29898, 9435, 29892, 760, 29892, 938, 29898, 29895, 876, 13, 462, 1678, 1596, 703, 18361, 664, 29901, 16521, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 462, 1678, 396, 360, 29965, 3580, 6093, 390, 2890, 8647, 7495, 6093, 19474, 12336, 24080, 13, 462, 1678, 411, 1722, 29898, 449, 29918, 1445, 29892, 376, 29893, 1159, 408, 285, 29886, 29901, 13, 462, 4706, 285, 29886, 29889, 3539, 29898, 15070, 29898, 5105, 29892, 21139, 546, 29922, 29928, 398, 546, 876, 13, 13, 18884, 5174, 8960, 408, 4589, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 18354, 29899, 19499, 13, 13, 462, 1678, 396, 7791, 2303, 4690, 4214, 399, 3919, 399, 29934, 20614, 29892, 390, 2890, 29925, 1164, 29928, 22659, 319, 405, 1164, 29899, 29999, 1001, 29949, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 411, 1722, 29898, 2457, 29918, 28491, 29877, 29892, 376, 29893, 1159, 408, 364, 29888, 29901, 13, 462, 9651, 364, 29888, 29889, 3539, 703, 29896, 1159, 13, 462, 1678, 5174, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 18354, 29899, 19499, 13, 462, 4706, 1596, 703, 8896, 5229, 856, 29901, 16521, 13, 462, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1596, 29898, 13, 462, 9651, 376, 26061, 411, 426, 6177, 6571, 613, 13, 462, 9651, 4589, 17255, 1990, 1649, 17255, 978, 1649, 29892, 13, 462, 9651, 679, 5552, 29898, 3127, 29892, 376, 4906, 613, 9872, 29958, 4968, 13, 462, 4706, 1723, 13, 462, 4706, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 18884, 1683, 29901, 13, 13, 462, 1678, 396, 317, 11794, 6093, 20134, 26925, 390, 2890, 29925, 1164, 1660, 13, 462, 1678, 1596, 703, 8698, 856, 29901, 16521, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 462, 1678, 411, 1722, 29898, 2457, 29918, 28491, 29877, 29892, 376, 29893, 1159, 408, 364, 29888, 29901, 13, 462, 4706, 364, 29888, 29889, 3539, 703, 29900, 1159, 13, 13, 462, 1678, 1596, 703, 392, 5456, 1048, 372, 856, 29901, 16521, 13, 462, 1678, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 13, 1753, 1667, 29898, 1688, 29922, 8824, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 262, 3200, 9696, 29899, 2457, 29899, 6112, 4110, 13, 1678, 9995, 13, 1678, 1303, 297, 278, 8118, 310, 278, 10970, 343, 8807, 934, 13, 1678, 9995, 13, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 29888, 548, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 1678, 5174, 4408, 2392, 29901, 13, 4706, 12020, 24875, 2392, 29898, 13, 9651, 376, 1557, 5105, 29889, 2272, 7111, 373, 2897, 29889, 29888, 548, 29892, 607, 338, 451, 3625, 373, 445, 1788, 1213, 13, 4706, 1723, 13, 13, 1678, 9033, 10749, 353, 10876, 29889, 19218, 29961, 29896, 17531, 13, 1678, 565, 9033, 10749, 29961, 29900, 29962, 1275, 376, 1557, 5105, 29889, 2272, 1115, 13, 4706, 9033, 10749, 29889, 7323, 29898, 29900, 29897, 13, 13, 1678, 5244, 261, 27838, 9857, 353, 4321, 27838, 9857, 565, 1243, 1683, 19295, 993, 27838, 9857, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 29899, 13, 1678, 396, 7266, 9857, 21385, 13, 1678, 396, 448, 2683, 2683, 2683, 29899, 13, 1678, 565, 9033, 10749, 29961, 29900, 29962, 1275, 376, 2962, 1115, 13, 4706, 1596, 703, 2962, 292, 1146, 9857, 1159, 13, 4706, 1146, 9857, 353, 5244, 261, 27838, 9857, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 29892, 21330, 12665, 1164, 29918, 3738, 5800, 29897, 13, 4706, 1146, 9857, 29889, 2962, 580, 13, 4706, 736, 376, 29900, 29908, 13, 13, 1678, 565, 9033, 10749, 29961, 29900, 29962, 1275, 376, 4882, 1115, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 1125, 13, 9651, 1596, 703, 27838, 9857, 451, 2734, 1159, 13, 9651, 736, 525, 29900, 29915, 13, 13, 4706, 411, 1722, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 5501, 29893, 1495, 408, 285, 29882, 29901, 13, 9651, 903, 5935, 353, 285, 29882, 29889, 949, 580, 13, 4706, 282, 4841, 353, 518, 5935, 363, 23107, 297, 2897, 29889, 1761, 3972, 11219, 15439, 1495, 565, 23107, 29889, 275, 26204, 580, 29962, 13, 4706, 565, 903, 5935, 297, 282, 4841, 29901, 13, 9651, 1596, 703, 1388, 9857, 1889, 313, 5935, 426, 1800, 338, 2734, 1642, 4830, 7373, 5935, 876, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 1388, 9857, 1889, 313, 5935, 426, 1800, 6058, 338, 2734, 1642, 4830, 7373, 5935, 876, 13, 4706, 736, 525, 29900, 29915, 13, 13, 1678, 565, 9033, 10749, 29961, 29900, 29962, 1275, 376, 9847, 1115, 13, 4706, 1596, 703, 7864, 3262, 1146, 9857, 1159, 13, 4706, 1146, 9857, 353, 5244, 261, 27838, 9857, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 29892, 21330, 12665, 1164, 29918, 3738, 5800, 29897, 13, 4706, 1146, 9857, 29889, 9847, 580, 13, 4706, 736, 376, 29900, 29908, 13, 13, 1678, 565, 9033, 10749, 29961, 29900, 29962, 1275, 376, 5060, 442, 1115, 13, 4706, 1596, 703, 5060, 4362, 1146, 9857, 1159, 13, 4706, 1146, 9857, 353, 5244, 261, 27838, 9857, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 29892, 21330, 12665, 1164, 29918, 3738, 5800, 29897, 13, 4706, 1146, 9857, 29889, 5060, 442, 580, 13, 4706, 736, 376, 29900, 29908, 13, 13, 1678, 396, 448, 2683, 2683, 2683, 29899, 13, 1678, 396, 19295, 993, 4982, 13, 1678, 396, 448, 2683, 2683, 2683, 29899, 13, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 7698, 12665, 1164, 29918, 29925, 1367, 29892, 376, 29878, 1159, 408, 282, 29888, 29901, 13, 9651, 23107, 353, 938, 29898, 7810, 29889, 949, 2141, 17010, 3101, 13, 1678, 5174, 10663, 2392, 29901, 13, 4706, 23107, 353, 6213, 13, 13, 1678, 565, 451, 23107, 29901, 13, 4706, 12020, 24875, 2392, 703, 552, 559, 1369, 278, 1146, 9857, 1159, 13, 13, 1678, 4974, 313, 13, 4706, 7431, 29898, 1718, 10749, 29897, 1275, 29871, 29946, 13, 1678, 10353, 376, 893, 29883, 29889, 2272, 23347, 29871, 29946, 4128, 29892, 3704, 263, 3619, 1445, 29892, 760, 1445, 29892, 714, 1445, 322, 278, 4163, 2380, 29908, 13, 13, 1678, 1018, 29901, 13, 4706, 938, 29898, 1718, 10749, 29961, 29941, 2314, 13, 1678, 5174, 7865, 2392, 29901, 13, 4706, 12020, 7865, 2392, 703, 1576, 6389, 29961, 29941, 29962, 1818, 367, 385, 6043, 1159, 13, 13, 1678, 396, 14602, 6093, 390, 2890, 29925, 1164, 1660, 9338, 5800, 13, 1678, 28081, 24015, 29918, 3738, 5800, 353, 2897, 29889, 2084, 29889, 7122, 11974, 7050, 29914, 1557, 29899, 29908, 718, 851, 29898, 25118, 29889, 25118, 29946, 3101, 718, 11393, 28491, 29877, 1159, 13, 1678, 2897, 29889, 11256, 28491, 29877, 29898, 1525, 29911, 24015, 29918, 3738, 5800, 29897, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 13, 1678, 822, 5941, 786, 7295, 13, 4706, 2897, 29889, 5992, 29898, 1525, 29911, 24015, 29918, 3738, 5800, 29897, 13, 13, 1678, 263, 4776, 277, 29889, 9573, 29898, 14941, 786, 29897, 13, 13, 1678, 396, 317, 11794, 6093, 9033, 10749, 7495, 6093, 21330, 12665, 1164, 13, 1678, 411, 1722, 29898, 7698, 12665, 1164, 29918, 3738, 5800, 29892, 376, 29893, 1159, 408, 270, 29918, 6717, 29901, 13, 4706, 270, 29918, 6717, 29889, 3539, 29898, 3126, 29889, 29881, 17204, 29898, 1718, 10749, 718, 518, 1525, 29911, 24015, 29918, 3738, 5800, 12622, 13, 13, 1678, 396, 365, 9047, 1430, 15842, 6093, 390, 2890, 29925, 1164, 1660, 13, 1678, 411, 1722, 29898, 1525, 29911, 24015, 29918, 3738, 5800, 29892, 376, 29878, 1159, 408, 270, 29918, 2457, 29901, 13, 4706, 2933, 353, 270, 29918, 2457, 29889, 949, 580, 13, 4706, 1596, 703, 1388, 9857, 2665, 2933, 29901, 6571, 1642, 4830, 29898, 5327, 876, 13, 4706, 736, 2933, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1596, 703, 2918, 515, 885, 5105, 613, 10876, 29889, 19218, 29897, 13, 1678, 4195, 29918, 15581, 353, 1667, 29898, 1688, 29922, 8824, 29897, 13, 1678, 565, 4195, 29918, 15581, 1275, 376, 29900, 1115, 13, 4706, 1596, 703, 3057, 7266, 9857, 3796, 29991, 1159, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 16804, 3512, 2743, 29901, 6571, 1642, 4830, 29898, 16122, 29918, 15581, 876, 13, 2 ]
explainaboard/loaders/__init__.py
hwidjaja/ExplainaBoard
0
137344
<reponame>hwidjaja/ExplainaBoard from explainaboard.loaders import ( aspect_based_sentiment_classification, conditional_generation, extractive_qa, file_loader, kg_link_tail_prediction, language_modeling, loader, loader_registry, named_entity_recognition, qa_multiple_choice, text_classification, text_pair_classification, word_segmentation, ) get_datalab_loader = loader_registry.get_datalab_loader get_custom_dataset_loader = loader_registry.get_custom_dataset_loader DatalabLoaderOption = file_loader.DatalabLoaderOption __all__ = [ 'aspect_based_sentiment_classification', 'conditional_generation', 'extractive_qa', 'kg_link_tail_prediction', 'language_modeling', 'loader', 'named_entity_recognition', 'qa_multiple_choice', 'text_classification', 'text_pair_classification', 'word_segmentation', ]
[ 1, 529, 276, 1112, 420, 29958, 29882, 9163, 29926, 9919, 29914, 9544, 433, 1099, 28397, 13, 3166, 5649, 370, 29877, 538, 29889, 1359, 414, 1053, 313, 13, 1678, 9565, 29918, 6707, 29918, 18616, 2073, 29918, 1990, 2450, 29892, 13, 1678, 15047, 29918, 4738, 362, 29892, 13, 1678, 6597, 573, 29918, 25621, 29892, 13, 1678, 934, 29918, 12657, 29892, 13, 1678, 12118, 29918, 2324, 29918, 18237, 29918, 11965, 2463, 29892, 13, 1678, 4086, 29918, 4299, 292, 29892, 13, 1678, 23466, 29892, 13, 1678, 23466, 29918, 1727, 6020, 29892, 13, 1678, 4257, 29918, 10041, 29918, 29423, 654, 29892, 13, 1678, 3855, 29874, 29918, 20787, 29918, 16957, 29892, 13, 1678, 1426, 29918, 1990, 2450, 29892, 13, 1678, 1426, 29918, 18784, 29918, 1990, 2450, 29892, 13, 1678, 1734, 29918, 28192, 362, 29892, 13, 29897, 13, 13, 657, 29918, 29881, 2075, 370, 29918, 12657, 353, 23466, 29918, 1727, 6020, 29889, 657, 29918, 29881, 2075, 370, 29918, 12657, 13, 657, 29918, 6341, 29918, 24713, 29918, 12657, 353, 23466, 29918, 1727, 6020, 29889, 657, 29918, 6341, 29918, 24713, 29918, 12657, 13, 29928, 2075, 370, 10036, 8375, 353, 934, 29918, 12657, 29889, 29928, 2075, 370, 10036, 8375, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 294, 1103, 29918, 6707, 29918, 18616, 2073, 29918, 1990, 2450, 742, 13, 1678, 525, 1116, 3245, 29918, 4738, 362, 742, 13, 1678, 525, 21111, 573, 29918, 25621, 742, 13, 1678, 525, 9415, 29918, 2324, 29918, 18237, 29918, 11965, 2463, 742, 13, 1678, 525, 11675, 29918, 4299, 292, 742, 13, 1678, 525, 12657, 742, 13, 1678, 525, 17514, 29918, 10041, 29918, 29423, 654, 742, 13, 1678, 525, 25621, 29918, 20787, 29918, 16957, 742, 13, 1678, 525, 726, 29918, 1990, 2450, 742, 13, 1678, 525, 726, 29918, 18784, 29918, 1990, 2450, 742, 13, 1678, 525, 1742, 29918, 28192, 362, 742, 13, 29962, 13, 2 ]
apps/contrib/api/responses.py
jimialex/django-wise-template-mysql
2
126699
<reponame>jimialex/django-wise-template-mysql # -*- coding: utf-8 -*- from rest_framework import status as status_code from rest_framework.response import Response from django.utils.translation import ugettext_lazy as _ class DoneResponse(Response): # noqa: D107 """Base class for REST Exceptions based on CEH from @vicobits.""" def __init__(self, detail=None, code=None, status=None): # noqa: D107 response = { 'message': detail if detail else _('Successful operation!'), 'code': code if code else 'successful_action', } status = status or status_code.HTTP_200_OK super().__init__(data=response, status=status)
[ 1, 529, 276, 1112, 420, 29958, 29926, 326, 423, 2506, 29914, 14095, 29899, 3538, 29899, 6886, 29899, 7938, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 1791, 29918, 4468, 1053, 4660, 408, 4660, 29918, 401, 13, 3166, 1791, 29918, 4468, 29889, 5327, 1053, 13291, 13, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 29918, 433, 1537, 408, 903, 13, 13, 13, 1990, 25679, 5103, 29898, 5103, 1125, 29871, 396, 694, 25621, 29901, 360, 29896, 29900, 29955, 13, 1678, 9995, 5160, 770, 363, 16759, 8960, 29879, 2729, 373, 14645, 29950, 515, 732, 26311, 711, 1169, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9493, 29922, 8516, 29892, 775, 29922, 8516, 29892, 4660, 29922, 8516, 1125, 29871, 396, 694, 25621, 29901, 360, 29896, 29900, 29955, 13, 4706, 2933, 353, 426, 13, 9651, 525, 4906, 2396, 9493, 565, 9493, 1683, 903, 877, 14191, 1319, 5858, 29991, 5477, 13, 9651, 525, 401, 2396, 775, 565, 775, 1683, 525, 8698, 1319, 29918, 2467, 742, 13, 4706, 500, 13, 4706, 4660, 353, 4660, 470, 4660, 29918, 401, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1272, 29922, 5327, 29892, 4660, 29922, 4882, 29897, 13, 2 ]
config.py
julienc91/slasher
0
117510
<filename>config.py # -*- coding: utf-8 -*- # --- Slack configuration --- # get your own at https://api.slack.com/docs/oauth-test-tokens SLACK_TOKEN = "<PASSWORD>" # the channel Slasher will send its messages to SLACK_CHANNEL = "#random" # Slasher's username SLACK_USERNAME = "Slasher" # Slasher's icon SLACK_USER_EMOJI = ":robot_face:" # --- Giphy configuration --- GIPHY_TAGS = ["fireworks", "guitar"]
[ 1, 529, 9507, 29958, 2917, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 11474, 317, 2364, 5285, 11474, 13, 13, 29937, 679, 596, 1914, 472, 2045, 597, 2754, 29889, 29879, 2364, 29889, 510, 29914, 2640, 29914, 23106, 29899, 1688, 29899, 517, 12360, 13, 12750, 11375, 29918, 4986, 29968, 1430, 353, 9872, 25711, 17013, 11903, 13, 29937, 278, 8242, 14866, 1161, 261, 674, 3638, 967, 7191, 304, 13, 12750, 11375, 29918, 3210, 2190, 29940, 6670, 353, 12305, 8172, 29908, 13, 29937, 14866, 1161, 261, 29915, 29879, 8952, 13, 12750, 11375, 29918, 11889, 5813, 353, 376, 16973, 1161, 261, 29908, 13, 29937, 14866, 1161, 261, 29915, 29879, 9849, 13, 12750, 11375, 29918, 11889, 29918, 29923, 6720, 29967, 29902, 353, 29242, 307, 7451, 29918, 2161, 6160, 13, 13, 13, 29937, 11474, 4406, 11461, 5285, 11474, 13, 13, 29954, 5690, 29950, 29979, 29918, 6040, 10749, 353, 6796, 8696, 13129, 613, 376, 2543, 3673, 3108, 13, 13, 2 ]
atlasclient/client.py
LALAYANG/atlasclient
21
82743
# 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 # # http://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 copy import functools import io import json import logging import tarfile import requests from atlasclient import models, utils, base, exceptions from atlasclient.exceptions import handle_response LOG = logging.getLogger(__name__) LOG.addHandler(utils.NullHandler()) # this defines where the Atlas client delegates to for actual logic ENTRY_POINTS = {'entity_guid': models.EntityGuid, 'typedefs': models.TypeDef, 'entity_post': models.EntityPost, 'entity_bulk': models.EntityBulk, 'entity_bulk_classification': models.EntityBulkClassification, 'entity_unique_attribute': models.EntityUniqueAttribute, 'typedefs_headers': models.TypeDefHeader, 'classificationdef_guid': models.ClassificationDefGuid, 'classificationdef_name': models.ClassificationDefName, 'entitydef_guid': models.EntityDefGuid, 'entitydef_name': models.EntityDefName, 'enumdef_guid': models.EnumDefGuid, 'enumdef_name': models.EnumDefName, 'relationshipdef_guid': models.RelationshipDefGuid, 'relationshipdef_name': models.RelationshipDefName, 'structdef_guid': models.StructDefGuid, 'structdef_name': models.StructDefName, 'typedef_guid': models.TypeDefGuid, 'typedef_name': models.TypeDefName, 'lineage_guid': models.LineageGuid, 'search_attribute': models.SearchAttribute, 'search_basic': models.SearchBasic, 'search_dsl': models.SearchDsl, 'search_fulltext': models.SearchFulltext, 'relationship': models.Relationship, 'relationship_guid': models.RelationshipGuid, 'search_saved': models.SearchSaved, 'admin_metrics': models.AdminMetrics } class Atlas(object): """The Atlas client This is the entry point to the Atlas API. Create this client and then use one of the entry points to start hitting Atlas object collections. """ def __init__(self, host, port=None, username=None, password=<PASSWORD>, identifier=None, protocol=None, validate_ssl=True, timeout=10, max_retries=5, auth=None): self.base_url = utils.generate_base_url(host, port=port, protocol=protocol) if identifier is None: identifier = 'python-atlasclient' self.client = HttpClient(host=self.base_url, username=username, password=password, identifier=identifier, validate_ssl=validate_ssl, timeout=timeout, max_retries=max_retries, auth=auth) self._version = None def __dir__(self): d1 = {} d1.update(self.__dict__) d1.update(ENTRY_POINTS) return d1.keys() def check_version(self): if self.version < base.OLDEST_SUPPORTED_VERSION: raise exceptions.ClientError( "Version %s unsupported, must be %s or higher" % (utils.version_str(self.version), utils.version_str(base.OLDEST_SUPPORTED_VERSION))) return def __getattr__(self, attr): if attr in ENTRY_POINTS: rel_class = ENTRY_POINTS[attr] return rel_class.collection_class(self, rel_class) if getattr(requests, attr): # forward get/post/put/head/delete to the http client return getattr(self.client, attr) raise AttributeError(attr) class HttpClient(object): """Our HTTP based REST client. It handles some of the dirty work like automatic serialization/deserialization of JSON data, converting error responses to exceptions, etc. For the most part it should mimic a requests client. You can call methods like get, post, put, delete, and head and expect them to work the same way. But instead of a response object, you get a dictionary. A response of None means no response was supplied by the API. This should be uncommon except for error cases, but cases do exist either due to Atlas bugs or other mitigating circumstances. """ def __init__(self, host, username, password, identifier, validate_ssl=True, timeout=10, max_retries=5, auth=None): basic_token = utils.generate_http_basic_token(username=username, password=password) self.request_params = { 'headers': {'X-Requested-By': identifier, 'Authorization': 'Basic {}'.format(basic_token)}, #'auth': (username, password), 'verify': validate_ssl, 'timeout': timeout, } # automatically retry requests on connection errors self.session = requests.Session() self.session.auth = auth adapter = requests.adapters.HTTPAdapter(max_retries=max_retries) self.session.mount(host, adapter) def request(self, method, url, content_type=None, **kwargs): # doing it this way keeps the magic for following redirects intact requests_method = getattr(self.session, method) params = copy.deepcopy(self.request_params) params.update(kwargs) if content_type is not None: params['headers']['Content-type'] = content_type else: params['headers']['Content-type'] = 'application/json' LOG.debug("Request headers: %s", params['headers']) if 'data' in params and isinstance(params['data'], dict): params['data'] = json.dumps(params['data'], cls=AtlasJsonEncoder) LOG.debug("Request body: %s", params['data']) elif 'data' in params and isinstance(params['data'], str): params['data'] = json.dumps(params['data']) elif 'data' in params and isinstance(params['data'], list): params['data'] = json.dumps(params['data']) response = requests_method(url, **params) # any error responses will generate exceptions here handle_response(response) LOG.debug("Response headers: %s", response.headers) LOG.debug("Response: %s", response.text) if response.headers.get('content-length') is None: # Log bad methods so we can report them LOG.debug("Missing content-length for %s %s: %s", method, url, response.headers.get('content-type')) # there is no consistent way to determine response type # so assume json if it's not an empty string if response.text: if response.headers.get('content-type') == 'application/x-ustar': tarstream = io.BytesIO(response.content) tarstream.seek(0) return tarfile.open(fileobj=tarstream) elif 'application/json' not in response.headers.get('content-type'): # Log bad methods so we can report them LOG.debug("Wrong response content-type for %s %s: %s", method, url, response.headers.get('content-type')) return response.json() return {} def __getattr__(self, attr): if getattr(requests, attr): return functools.partial(self.request, attr) raise AttributeError(attr) class AtlasJsonEncoder(json.JSONEncoder): """Converts Atlas model objects into dictionaries that can be JSON-encoded This allows for passing in models and ModelCollections into related objects' create/update methods and having it handle the conversion automatically. """ def default(self, obj): # pylint: disable=method-hidden if isinstance(obj, base.ModelCollection): dicts = [] for model in obj: dicts.append(model.to_json_dict()) return dicts elif isinstance(obj, base.Model): return obj.to_json_dict() # Let the base class default method raise the TypeError return super(AtlasJsonEncoder, self).default(obj)
[ 1, 396, 1678, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 1678, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 1678, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 308, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 1678, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 1678, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 13, 29937, 1678, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 1678, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1678, 1090, 278, 19245, 29889, 13, 13, 5215, 3509, 13, 5215, 2090, 312, 8789, 13, 5215, 12013, 13, 5215, 4390, 13, 5215, 12183, 13, 5215, 9913, 1445, 13, 13, 5215, 7274, 13, 13, 3166, 472, 3333, 4645, 1053, 4733, 29892, 3667, 29879, 29892, 2967, 29892, 15283, 13, 3166, 472, 3333, 4645, 29889, 11739, 29879, 1053, 4386, 29918, 5327, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 14480, 29889, 1202, 4598, 29898, 13239, 29889, 7327, 4598, 3101, 13, 13, 29937, 445, 17645, 988, 278, 27076, 3132, 16000, 1078, 304, 363, 3935, 5900, 13, 3919, 13207, 29918, 29925, 6992, 9375, 353, 11117, 10041, 29918, 2543, 333, 2396, 4733, 29889, 6691, 29954, 5416, 29892, 13, 18884, 525, 1017, 9795, 1389, 29879, 2396, 4733, 29889, 1542, 3206, 29892, 13, 18884, 525, 10041, 29918, 2490, 2396, 4733, 29889, 6691, 6747, 29892, 13, 18884, 525, 10041, 29918, 8645, 29895, 2396, 4733, 29889, 6691, 29933, 24456, 29892, 13, 18884, 525, 10041, 29918, 8645, 29895, 29918, 1990, 2450, 2396, 4733, 29889, 6691, 29933, 24456, 2385, 2450, 29892, 13, 18884, 525, 10041, 29918, 13092, 29918, 12715, 2396, 4733, 29889, 6691, 8110, 802, 6708, 29892, 13, 18884, 525, 1017, 9795, 1389, 29879, 29918, 13662, 2396, 4733, 29889, 1542, 3206, 7850, 29892, 13, 18884, 525, 1990, 2450, 1753, 29918, 2543, 333, 2396, 4733, 29889, 2385, 2450, 3206, 29954, 5416, 29892, 13, 18884, 525, 1990, 2450, 1753, 29918, 978, 2396, 4733, 29889, 2385, 2450, 3206, 1170, 29892, 13, 18884, 525, 10041, 1753, 29918, 2543, 333, 2396, 4733, 29889, 6691, 3206, 29954, 5416, 29892, 13, 18884, 525, 10041, 1753, 29918, 978, 2396, 4733, 29889, 6691, 3206, 1170, 29892, 13, 18884, 525, 18605, 1753, 29918, 2543, 333, 2396, 4733, 29889, 16854, 3206, 29954, 5416, 29892, 13, 18884, 525, 18605, 1753, 29918, 978, 2396, 4733, 29889, 16854, 3206, 1170, 29892, 13, 18884, 525, 2674, 800, 4034, 1753, 29918, 2543, 333, 2396, 4733, 29889, 9662, 800, 4034, 3206, 29954, 5416, 29892, 13, 18884, 525, 2674, 800, 4034, 1753, 29918, 978, 2396, 4733, 29889, 9662, 800, 4034, 3206, 1170, 29892, 13, 18884, 525, 4984, 1753, 29918, 2543, 333, 2396, 4733, 29889, 19560, 3206, 29954, 5416, 29892, 13, 18884, 525, 4984, 1753, 29918, 978, 2396, 4733, 29889, 19560, 3206, 1170, 29892, 13, 18884, 525, 1017, 9795, 1389, 29918, 2543, 333, 2396, 4733, 29889, 1542, 3206, 29954, 5416, 29892, 13, 18884, 525, 1017, 9795, 1389, 29918, 978, 2396, 4733, 29889, 1542, 3206, 1170, 29892, 13, 18884, 525, 1220, 482, 29918, 2543, 333, 2396, 4733, 29889, 3542, 482, 29954, 5416, 29892, 13, 18884, 525, 4478, 29918, 12715, 2396, 4733, 29889, 7974, 6708, 29892, 13, 18884, 525, 4478, 29918, 16121, 2396, 4733, 29889, 7974, 16616, 29892, 13, 18884, 525, 4478, 29918, 29881, 2536, 2396, 4733, 29889, 7974, 29928, 2536, 29892, 13, 18884, 525, 4478, 29918, 8159, 726, 2396, 4733, 29889, 7974, 13658, 726, 29892, 13, 18884, 525, 2674, 800, 4034, 2396, 4733, 29889, 9662, 800, 4034, 29892, 13, 18884, 525, 2674, 800, 4034, 29918, 2543, 333, 2396, 4733, 29889, 9662, 800, 4034, 29954, 5416, 29892, 13, 18884, 525, 4478, 29918, 17314, 2396, 4733, 29889, 7974, 29903, 10511, 29892, 13, 18884, 525, 6406, 29918, 2527, 10817, 2396, 4733, 29889, 12754, 10095, 10817, 13, 1669, 500, 13, 13, 13, 1990, 27076, 29898, 3318, 1125, 13, 1678, 9995, 1576, 27076, 3132, 13, 13, 1678, 910, 338, 278, 6251, 1298, 304, 278, 27076, 3450, 29889, 6204, 445, 3132, 322, 769, 13, 1678, 671, 697, 310, 278, 6251, 3291, 304, 1369, 29425, 27076, 1203, 16250, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3495, 29892, 2011, 29922, 8516, 29892, 8952, 29922, 8516, 29892, 4800, 29922, 29966, 25711, 17013, 10202, 13, 462, 15882, 29922, 8516, 29892, 9608, 29922, 8516, 29892, 12725, 29918, 16265, 29922, 5574, 29892, 13, 462, 11815, 29922, 29896, 29900, 29892, 4236, 29918, 2267, 2722, 29922, 29945, 29892, 4817, 29922, 8516, 1125, 13, 13, 4706, 1583, 29889, 3188, 29918, 2271, 353, 3667, 29879, 29889, 17158, 29918, 3188, 29918, 2271, 29898, 3069, 29892, 2011, 29922, 637, 29892, 9608, 29922, 20464, 29897, 13, 13, 4706, 565, 15882, 338, 6213, 29901, 13, 9651, 15882, 353, 525, 4691, 29899, 271, 3333, 4645, 29915, 13, 13, 4706, 1583, 29889, 4645, 353, 9056, 4032, 29898, 3069, 29922, 1311, 29889, 3188, 29918, 2271, 29892, 8952, 29922, 6786, 29892, 13, 462, 462, 4800, 29922, 5630, 29892, 15882, 29922, 25378, 29892, 13, 462, 462, 12725, 29918, 16265, 29922, 15480, 29918, 16265, 29892, 11815, 29922, 15619, 29892, 13, 462, 462, 4236, 29918, 2267, 2722, 29922, 3317, 29918, 2267, 2722, 29892, 4817, 29922, 5150, 29897, 13, 4706, 1583, 3032, 3259, 353, 6213, 13, 13, 1678, 822, 4770, 3972, 12035, 1311, 1125, 13, 4706, 270, 29896, 353, 6571, 13, 4706, 270, 29896, 29889, 5504, 29898, 1311, 17255, 8977, 1649, 29897, 13, 4706, 270, 29896, 29889, 5504, 29898, 3919, 13207, 29918, 29925, 6992, 9375, 29897, 13, 4706, 736, 270, 29896, 29889, 8149, 580, 13, 13, 1678, 822, 1423, 29918, 3259, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 3259, 529, 2967, 29889, 5607, 2287, 1254, 29918, 29903, 4897, 15082, 3352, 29918, 16358, 29901, 13, 9651, 12020, 15283, 29889, 4032, 2392, 29898, 13, 18884, 376, 6594, 1273, 29879, 443, 23765, 29892, 1818, 367, 1273, 29879, 470, 6133, 29908, 13, 18884, 1273, 313, 13239, 29889, 3259, 29918, 710, 29898, 1311, 29889, 3259, 511, 13, 462, 259, 3667, 29879, 29889, 3259, 29918, 710, 29898, 3188, 29889, 5607, 2287, 1254, 29918, 29903, 4897, 15082, 3352, 29918, 16358, 4961, 13, 4706, 736, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 12421, 1125, 13, 4706, 565, 12421, 297, 12524, 5659, 29979, 29918, 29925, 6992, 9375, 29901, 13, 9651, 1104, 29918, 1990, 353, 12524, 5659, 29979, 29918, 29925, 6992, 9375, 29961, 5552, 29962, 13, 9651, 736, 1104, 29918, 1990, 29889, 10855, 29918, 1990, 29898, 1311, 29892, 1104, 29918, 1990, 29897, 13, 13, 4706, 565, 679, 5552, 29898, 24830, 29892, 12421, 1125, 13, 9651, 396, 6375, 679, 29914, 2490, 29914, 649, 29914, 2813, 29914, 8143, 304, 278, 1732, 3132, 13, 9651, 736, 679, 5552, 29898, 1311, 29889, 4645, 29892, 12421, 29897, 13, 13, 4706, 12020, 23833, 2392, 29898, 5552, 29897, 13, 13, 13, 1990, 9056, 4032, 29898, 3318, 1125, 13, 1678, 9995, 29949, 332, 7331, 2729, 16759, 3132, 29889, 13, 13, 1678, 739, 17766, 777, 310, 278, 26616, 664, 763, 18428, 7797, 2133, 29914, 2783, 261, 616, 2133, 13, 1678, 310, 4663, 848, 29892, 17415, 1059, 20890, 304, 15283, 29892, 2992, 29889, 29871, 1152, 278, 1556, 13, 1678, 760, 372, 881, 286, 326, 293, 263, 7274, 3132, 29889, 887, 508, 1246, 3519, 763, 679, 29892, 1400, 29892, 13, 1678, 1925, 29892, 5217, 29892, 322, 2343, 322, 2149, 963, 304, 664, 278, 1021, 982, 29889, 29871, 1205, 2012, 310, 13, 1678, 263, 2933, 1203, 29892, 366, 679, 263, 8600, 29889, 29871, 319, 2933, 310, 6213, 2794, 694, 2933, 13, 1678, 471, 19056, 491, 278, 3450, 29889, 29871, 910, 881, 367, 443, 9435, 5174, 363, 1059, 4251, 29892, 541, 13, 1678, 4251, 437, 1863, 2845, 2861, 304, 27076, 24557, 470, 916, 1380, 335, 1218, 14209, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3495, 29892, 8952, 29892, 4800, 29892, 15882, 29892, 12725, 29918, 16265, 29922, 5574, 29892, 13, 462, 11815, 29922, 29896, 29900, 29892, 4236, 29918, 2267, 2722, 29922, 29945, 29892, 4817, 29922, 8516, 1125, 13, 4706, 6996, 29918, 6979, 353, 3667, 29879, 29889, 17158, 29918, 1124, 29918, 16121, 29918, 6979, 29898, 6786, 29922, 6786, 29892, 4800, 29922, 5630, 29897, 13, 4706, 1583, 29889, 3827, 29918, 7529, 353, 426, 13, 9651, 525, 13662, 2396, 11117, 29990, 29899, 3089, 287, 29899, 2059, 2396, 15882, 29892, 13, 462, 4706, 525, 25471, 2396, 525, 16616, 6571, 4286, 4830, 29898, 16121, 29918, 6979, 19230, 13, 9651, 396, 29915, 5150, 2396, 313, 6786, 29892, 4800, 511, 13, 9651, 525, 27902, 2396, 12725, 29918, 16265, 29892, 13, 9651, 525, 15619, 2396, 11815, 29892, 13, 4706, 500, 13, 4706, 396, 6336, 337, 2202, 7274, 373, 3957, 4436, 13, 4706, 1583, 29889, 7924, 353, 7274, 29889, 7317, 580, 13, 4706, 1583, 29889, 7924, 29889, 5150, 353, 4817, 13, 4706, 13304, 353, 7274, 29889, 328, 481, 2153, 29889, 10493, 6168, 29898, 3317, 29918, 2267, 2722, 29922, 3317, 29918, 2267, 2722, 29897, 13, 4706, 1583, 29889, 7924, 29889, 16476, 29898, 3069, 29892, 13304, 29897, 13, 13, 1678, 822, 2009, 29898, 1311, 29892, 1158, 29892, 3142, 29892, 2793, 29918, 1853, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 396, 2599, 372, 445, 982, 14874, 278, 15709, 363, 1494, 28937, 938, 627, 13, 4706, 7274, 29918, 5696, 353, 679, 5552, 29898, 1311, 29889, 7924, 29892, 1158, 29897, 13, 4706, 8636, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 3827, 29918, 7529, 29897, 13, 4706, 8636, 29889, 5504, 29898, 19290, 29897, 13, 13, 4706, 565, 2793, 29918, 1853, 338, 451, 6213, 29901, 13, 9651, 8636, 1839, 13662, 16215, 3916, 29899, 1853, 2033, 353, 2793, 29918, 1853, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 13662, 16215, 3916, 29899, 1853, 2033, 353, 525, 6214, 29914, 3126, 29915, 13, 4706, 25401, 29889, 8382, 703, 3089, 9066, 29901, 1273, 29879, 613, 8636, 1839, 13662, 11287, 13, 13, 4706, 565, 525, 1272, 29915, 297, 8636, 322, 338, 8758, 29898, 7529, 1839, 1272, 7464, 9657, 1125, 13, 9651, 8636, 1839, 1272, 2033, 353, 4390, 29889, 29881, 17204, 29898, 7529, 1839, 1272, 7464, 1067, 29879, 29922, 27753, 8148, 8566, 6119, 29897, 13, 9651, 25401, 29889, 8382, 703, 3089, 3573, 29901, 1273, 29879, 613, 8636, 1839, 1272, 11287, 13, 4706, 25342, 525, 1272, 29915, 297, 8636, 322, 338, 8758, 29898, 7529, 1839, 1272, 7464, 851, 1125, 13, 9651, 8636, 1839, 1272, 2033, 353, 4390, 29889, 29881, 17204, 29898, 7529, 1839, 1272, 11287, 13, 4706, 25342, 525, 1272, 29915, 297, 8636, 322, 338, 8758, 29898, 7529, 1839, 1272, 7464, 1051, 1125, 13, 9651, 8636, 1839, 1272, 2033, 353, 4390, 29889, 29881, 17204, 29898, 7529, 1839, 1272, 11287, 13, 13, 4706, 2933, 353, 7274, 29918, 5696, 29898, 2271, 29892, 3579, 7529, 29897, 13, 13, 4706, 396, 738, 1059, 20890, 674, 5706, 15283, 1244, 13, 4706, 4386, 29918, 5327, 29898, 5327, 29897, 13, 13, 4706, 25401, 29889, 8382, 703, 5103, 9066, 29901, 1273, 29879, 613, 2933, 29889, 13662, 29897, 13, 4706, 25401, 29889, 8382, 703, 5103, 29901, 1273, 29879, 613, 2933, 29889, 726, 29897, 13, 13, 4706, 565, 2933, 29889, 13662, 29889, 657, 877, 3051, 29899, 2848, 1495, 338, 6213, 29901, 13, 9651, 396, 4522, 4319, 3519, 577, 591, 508, 3461, 963, 13, 9651, 25401, 29889, 8382, 703, 18552, 292, 2793, 29899, 2848, 363, 1273, 29879, 1273, 29879, 29901, 1273, 29879, 613, 1158, 29892, 13, 462, 418, 3142, 29892, 2933, 29889, 13662, 29889, 657, 877, 3051, 29899, 1853, 8785, 13, 13, 4706, 396, 727, 338, 694, 13747, 982, 304, 8161, 2933, 1134, 13, 4706, 396, 577, 5251, 4390, 565, 372, 29915, 29879, 451, 385, 4069, 1347, 13, 4706, 565, 2933, 29889, 726, 29901, 13, 9651, 565, 2933, 29889, 13662, 29889, 657, 877, 3051, 29899, 1853, 1495, 1275, 525, 6214, 29914, 29916, 29899, 504, 279, 2396, 13, 18884, 9913, 5461, 353, 12013, 29889, 11207, 5971, 29898, 5327, 29889, 3051, 29897, 13, 18884, 9913, 5461, 29889, 344, 1416, 29898, 29900, 29897, 13, 18884, 736, 9913, 1445, 29889, 3150, 29898, 1445, 5415, 29922, 12637, 5461, 29897, 13, 9651, 25342, 525, 6214, 29914, 3126, 29915, 451, 297, 2933, 29889, 13662, 29889, 657, 877, 3051, 29899, 1853, 29374, 13, 18884, 396, 4522, 4319, 3519, 577, 591, 508, 3461, 963, 13, 18884, 25401, 29889, 8382, 703, 29956, 29373, 2933, 2793, 29899, 1853, 363, 1273, 29879, 1273, 29879, 29901, 1273, 29879, 613, 1158, 29892, 13, 462, 3986, 3142, 29892, 2933, 29889, 13662, 29889, 657, 877, 3051, 29899, 1853, 8785, 13, 9651, 736, 2933, 29889, 3126, 580, 13, 13, 4706, 736, 6571, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 12421, 1125, 13, 4706, 565, 679, 5552, 29898, 24830, 29892, 12421, 1125, 13, 9651, 736, 2090, 312, 8789, 29889, 3846, 29898, 1311, 29889, 3827, 29892, 12421, 29897, 13, 4706, 12020, 23833, 2392, 29898, 5552, 29897, 13, 13, 13, 1990, 27076, 8148, 8566, 6119, 29898, 3126, 29889, 7249, 8566, 6119, 1125, 13, 1678, 9995, 1168, 369, 1372, 27076, 1904, 3618, 964, 21503, 4314, 393, 508, 367, 4663, 29899, 26716, 13, 13, 1678, 910, 6511, 363, 6819, 297, 4733, 322, 8125, 19466, 964, 4475, 3618, 29915, 13, 1678, 1653, 29914, 5504, 3519, 322, 2534, 372, 4386, 278, 11301, 6336, 29889, 13, 1678, 9995, 13, 1678, 822, 2322, 29898, 1311, 29892, 5446, 1125, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 5696, 29899, 10892, 13, 4706, 565, 338, 8758, 29898, 5415, 29892, 2967, 29889, 3195, 7196, 1125, 13, 9651, 9657, 29879, 353, 5159, 13, 9651, 363, 1904, 297, 5446, 29901, 13, 18884, 9657, 29879, 29889, 4397, 29898, 4299, 29889, 517, 29918, 3126, 29918, 8977, 3101, 13, 9651, 736, 9657, 29879, 13, 4706, 25342, 338, 8758, 29898, 5415, 29892, 2967, 29889, 3195, 1125, 13, 9651, 736, 5446, 29889, 517, 29918, 3126, 29918, 8977, 580, 13, 4706, 396, 2803, 278, 2967, 770, 2322, 1158, 12020, 278, 20948, 13, 4706, 736, 2428, 29898, 27753, 8148, 8566, 6119, 29892, 1583, 467, 4381, 29898, 5415, 29897, 13, 2 ]
games/HangMan/hangman.py
sudhanvalalit/python
0
1604145
<reponame>sudhanvalalit/python import random from words import words import string from hangman_visual import lives_visual_dict def get_valid_word(words): word = random.choice(words) while '-' in word or ' ' in word: word = random.choice(words) return word.upper() def hangman(): word = get_valid_word(words) word_letters = set(word) alphabet = set(string.ascii_uppercase) used_letters = set() lives = 6 # get user input while len(word_letters) > 0 and lives > 0: # print used letters print(f'You have {lives} lives left and you have used these letters: ', ' '.join( used_letters)) # what current word is word_list = [ letter if letter in used_letters else '-' for letter in word] print('Current word: ', ' '.join(word_list)) user_letter = input('Guess a letter: ').upper() if user_letter in alphabet - used_letters: used_letters.add(user_letter) if user_letter in word_letters: word_letters.remove(user_letter) else: lives -= 1 # takes away a life print("Letter is not in the word.") print(lives_visual_dict.get(lives)) elif user_letter in used_letters: print('You have already used that character. Please try again.') else: print('Invalid character. Please try again.') # gets here when word letters array is empty if lives == 0: print(f"You died. The word was {word}") else: print(f'You guessed the word {word} !!') if __name__ == '__main__': validation = True while validation: hangman() response = input("Do you want to play again? (yes/no) ").upper() if response == "NO": validation = False
[ 1, 529, 276, 1112, 420, 29958, 29879, 566, 5403, 791, 284, 277, 29914, 4691, 13, 5215, 4036, 13, 3166, 3838, 1053, 3838, 13, 5215, 1347, 13, 3166, 13958, 1171, 29918, 20119, 1053, 12080, 29918, 20119, 29918, 8977, 13, 13, 13, 1753, 679, 29918, 3084, 29918, 1742, 29898, 9303, 1125, 13, 1678, 1734, 353, 4036, 29889, 16957, 29898, 9303, 29897, 13, 1678, 1550, 17411, 29915, 297, 1734, 470, 525, 525, 297, 1734, 29901, 13, 4706, 1734, 353, 4036, 29889, 16957, 29898, 9303, 29897, 13, 1678, 736, 1734, 29889, 21064, 580, 13, 13, 13, 1753, 13958, 1171, 7295, 13, 1678, 1734, 353, 679, 29918, 3084, 29918, 1742, 29898, 9303, 29897, 13, 1678, 1734, 29918, 1026, 2153, 353, 731, 29898, 1742, 29897, 13, 1678, 22968, 353, 731, 29898, 1807, 29889, 294, 18869, 29918, 21064, 4878, 29897, 13, 1678, 1304, 29918, 1026, 2153, 353, 731, 580, 13, 13, 1678, 12080, 353, 29871, 29953, 13, 13, 1678, 396, 679, 1404, 1881, 13, 1678, 1550, 7431, 29898, 1742, 29918, 1026, 2153, 29897, 1405, 29871, 29900, 322, 12080, 1405, 29871, 29900, 29901, 13, 4706, 396, 1596, 1304, 8721, 13, 4706, 1596, 29898, 29888, 29915, 3492, 505, 426, 29880, 3145, 29913, 12080, 2175, 322, 366, 505, 1304, 1438, 8721, 29901, 13420, 525, 15300, 7122, 29898, 13, 9651, 1304, 29918, 1026, 2153, 876, 13, 4706, 396, 825, 1857, 1734, 338, 13, 4706, 1734, 29918, 1761, 353, 518, 13, 9651, 5497, 565, 5497, 297, 1304, 29918, 1026, 2153, 1683, 17411, 29915, 363, 5497, 297, 1734, 29962, 13, 4706, 1596, 877, 7583, 1734, 29901, 13420, 525, 15300, 7122, 29898, 1742, 29918, 1761, 876, 13, 4706, 1404, 29918, 15670, 353, 1881, 877, 9485, 404, 263, 5497, 29901, 525, 467, 21064, 580, 13, 4706, 565, 1404, 29918, 15670, 297, 22968, 448, 1304, 29918, 1026, 2153, 29901, 13, 9651, 1304, 29918, 1026, 2153, 29889, 1202, 29898, 1792, 29918, 15670, 29897, 13, 9651, 565, 1404, 29918, 15670, 297, 1734, 29918, 1026, 2153, 29901, 13, 18884, 1734, 29918, 1026, 2153, 29889, 5992, 29898, 1792, 29918, 15670, 29897, 13, 9651, 1683, 29901, 13, 18884, 12080, 22361, 29871, 29896, 29871, 396, 4893, 3448, 263, 2834, 13, 18884, 1596, 703, 12024, 357, 338, 451, 297, 278, 1734, 23157, 13, 18884, 1596, 29898, 29880, 3145, 29918, 20119, 29918, 8977, 29889, 657, 29898, 29880, 3145, 876, 13, 4706, 25342, 1404, 29918, 15670, 297, 1304, 29918, 1026, 2153, 29901, 13, 9651, 1596, 877, 3492, 505, 2307, 1304, 393, 2931, 29889, 3529, 1018, 1449, 29889, 1495, 13, 13, 4706, 1683, 29901, 13, 9651, 1596, 877, 13919, 2931, 29889, 3529, 1018, 1449, 29889, 1495, 13, 13, 1678, 396, 4947, 1244, 746, 1734, 8721, 1409, 338, 4069, 13, 1678, 565, 12080, 1275, 29871, 29900, 29901, 13, 4706, 1596, 29898, 29888, 29908, 3492, 6423, 29889, 450, 1734, 471, 426, 1742, 27195, 13, 1678, 1683, 29901, 13, 4706, 1596, 29898, 29888, 29915, 3492, 4140, 287, 278, 1734, 426, 1742, 29913, 21443, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 8845, 353, 5852, 13, 1678, 1550, 8845, 29901, 13, 4706, 13958, 1171, 580, 13, 4706, 2933, 353, 1881, 703, 6132, 366, 864, 304, 1708, 1449, 29973, 313, 3582, 29914, 1217, 29897, 376, 467, 21064, 580, 13, 4706, 565, 2933, 1275, 376, 6632, 1115, 13, 9651, 8845, 353, 7700, 13, 2 ]
cbcPaddingAttack.py
danielverd/crypto-projects
0
42969
from modesOfOperation import CBCCipher import sys BLOCK_SIZE = 16 def blocks(l, n): for i in range(0, len(l), n): yield l[i:i + n] def attack(cbc,ciphertext): message = bytearray(b'') blockGen = blocks(ciphertext,BLOCK_SIZE) ctextBlocks = [] for i in blockGen: ctextBlocks.append(i) padBlock = ctextBlocks[len(ctextBlocks)-2] for i in range(BLOCK_SIZE): padBlock[i] = 72 if cbc.decrypt(bytearray(b''.join(ctextBlocks))) is False: padlength = BLOCK_SIZE - i break ctextBlocks = [] blockGen = blocks(ciphertext,BLOCK_SIZE) for i in blockGen: ctextBlocks.append(i) probeBlocks = ctextBlocks.copy() delta1 = bytearray(BLOCK_SIZE) for j in range(padlength): delta1[BLOCK_SIZE - (1 + j)] = padlength for i in reversed(range(BLOCK_SIZE - padlength)): delta2 = bytearray(BLOCK_SIZE) for j in range(BLOCK_SIZE - i): delta2[BLOCK_SIZE - (1 + j)] = (BLOCK_SIZE - i) for j in range(256): cipherInter = probeBlocks.copy() delta2[i] = j delta = bytearray(bytes([a ^ b for (a,b) in zip(delta1, delta2)])) block = cipherInter[len(cipherInter) - 2] probe = bytearray(bytes([a ^ b for (a,b) in zip(block, delta)])) cipherInter[len(cipherInter) - 2] = probe if cbc.decrypt(bytearray(b''.join(cipherInter))) is not False: sol1 = (BLOCK_SIZE - i) sol2 = j sol = sol1 ^ sol2 delta1[i] = sol message = sol.to_bytes(1,'little') + message break probeBlocks = ctextBlocks.copy() while len(probeBlocks)>2: probeBlocks = probeBlocks.copy()[:-1] delta1 = bytearray(BLOCK_SIZE) for i in reversed(range(BLOCK_SIZE)): delta2 = bytearray(BLOCK_SIZE) for j in range(BLOCK_SIZE - (i+1)): delta2[BLOCK_SIZE - (1 + j)] = (BLOCK_SIZE - i) for j in range(256): cipherInter = probeBlocks.copy() delta2[i] = j delta = bytearray(bytes([a ^ b for (a,b) in zip(delta1, delta2)])) block = cipherInter[len(cipherInter)-2] probe = bytearray(bytes([a ^ b for (a,b) in zip(block, delta)])) cipherInter[len(cipherInter)-2] = probe if cbc.decrypt(bytearray(b''.join(cipherInter))) is not False: sol1 = BLOCK_SIZE - i sol2 = j sol = sol1 ^ sol2 delta1[i] = sol message = sol.to_bytes(1,'little') + message return message if __name__ == "__main__": key = <KEY>' text = bytearray('go canes','utf-8') cbc = CBCCipher(key) ciphertext = cbc.encrypt(text) #print(ciphertext) broken = attack(cbc,ciphertext) #print(broken) print('-----Equality between text and broken message-----') print(broken == text)
[ 1, 515, 18893, 2776, 10925, 1053, 315, 29933, 4174, 29875, 8096, 13, 5215, 10876, 13, 13, 29933, 21339, 29918, 14226, 353, 29871, 29896, 29953, 13, 13, 1753, 10930, 29898, 29880, 29892, 302, 1125, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 29880, 511, 302, 1125, 13, 4706, 7709, 301, 29961, 29875, 29901, 29875, 718, 302, 29962, 13, 13, 1753, 5337, 29898, 10702, 29883, 29892, 455, 8096, 726, 1125, 13, 1678, 2643, 353, 7023, 2378, 29898, 29890, 29915, 1495, 13, 13, 1678, 2908, 15462, 353, 10930, 29898, 455, 8096, 726, 29892, 29933, 21339, 29918, 14226, 29897, 13, 1678, 274, 726, 7445, 29879, 353, 5159, 13, 1678, 363, 474, 297, 2908, 15462, 29901, 13, 4706, 274, 726, 7445, 29879, 29889, 4397, 29898, 29875, 29897, 13, 268, 13, 1678, 17132, 7445, 353, 274, 726, 7445, 29879, 29961, 2435, 29898, 312, 1062, 7445, 29879, 6817, 29906, 29962, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29933, 21339, 29918, 14226, 1125, 13, 4706, 17132, 7445, 29961, 29875, 29962, 353, 29871, 29955, 29906, 13, 4706, 565, 274, 12328, 29889, 7099, 4641, 29898, 10389, 2378, 29898, 29890, 29915, 4286, 7122, 29898, 312, 1062, 7445, 29879, 4961, 338, 7700, 29901, 13, 9651, 17132, 2848, 353, 350, 21339, 29918, 14226, 448, 474, 13, 9651, 2867, 13, 13, 1678, 274, 726, 7445, 29879, 353, 5159, 13, 1678, 2908, 15462, 353, 10930, 29898, 455, 8096, 726, 29892, 29933, 21339, 29918, 14226, 29897, 13, 1678, 363, 474, 297, 2908, 15462, 29901, 13, 268, 12, 312, 1062, 7445, 29879, 29889, 4397, 29898, 29875, 29897, 13, 1678, 410, 915, 7445, 29879, 353, 274, 726, 7445, 29879, 29889, 8552, 580, 13, 13, 1678, 19471, 29896, 353, 7023, 2378, 29898, 29933, 21339, 29918, 14226, 29897, 13, 1678, 363, 432, 297, 3464, 29898, 8305, 2848, 1125, 13, 4706, 19471, 29896, 29961, 29933, 21339, 29918, 14226, 448, 313, 29896, 718, 432, 4638, 353, 17132, 2848, 13, 12, 13, 1678, 363, 474, 297, 18764, 287, 29898, 3881, 29898, 29933, 21339, 29918, 14226, 448, 17132, 2848, 22164, 13, 4706, 19471, 29906, 353, 7023, 2378, 29898, 29933, 21339, 29918, 14226, 29897, 13, 13, 4706, 363, 432, 297, 3464, 29898, 29933, 21339, 29918, 14226, 448, 474, 1125, 13, 9651, 19471, 29906, 29961, 29933, 21339, 29918, 14226, 448, 313, 29896, 718, 432, 4638, 353, 313, 29933, 21339, 29918, 14226, 448, 474, 29897, 13, 13, 4706, 363, 432, 297, 3464, 29898, 29906, 29945, 29953, 1125, 13, 9651, 4583, 8096, 4074, 353, 410, 915, 7445, 29879, 29889, 8552, 580, 13, 9651, 19471, 29906, 29961, 29875, 29962, 353, 432, 13, 9651, 19471, 353, 7023, 2378, 29898, 13193, 4197, 29874, 6228, 289, 363, 313, 29874, 29892, 29890, 29897, 297, 14319, 29898, 4181, 29896, 29892, 19471, 29906, 4638, 876, 13, 13, 9651, 2908, 353, 4583, 8096, 4074, 29961, 2435, 29898, 455, 8096, 4074, 29897, 448, 29871, 29906, 29962, 13, 9651, 410, 915, 353, 7023, 2378, 29898, 13193, 4197, 29874, 6228, 289, 363, 313, 29874, 29892, 29890, 29897, 297, 14319, 29898, 1271, 29892, 19471, 4638, 876, 13, 9651, 4583, 8096, 4074, 29961, 2435, 29898, 455, 8096, 4074, 29897, 448, 29871, 29906, 29962, 353, 410, 915, 13, 13, 9651, 565, 274, 12328, 29889, 7099, 4641, 29898, 10389, 2378, 29898, 29890, 29915, 4286, 7122, 29898, 455, 8096, 4074, 4961, 338, 451, 7700, 29901, 13, 18884, 899, 29896, 353, 313, 29933, 21339, 29918, 14226, 448, 474, 29897, 13, 18884, 899, 29906, 353, 432, 13, 18884, 899, 353, 899, 29896, 6228, 899, 29906, 13, 18884, 19471, 29896, 29961, 29875, 29962, 353, 899, 13, 18884, 2643, 353, 899, 29889, 517, 29918, 13193, 29898, 29896, 5501, 29880, 1992, 1495, 718, 2643, 13, 18884, 2867, 13, 13, 1678, 410, 915, 7445, 29879, 353, 274, 726, 7445, 29879, 29889, 8552, 580, 13, 13, 1678, 1550, 7431, 29898, 771, 915, 7445, 29879, 15410, 29906, 29901, 13, 4706, 410, 915, 7445, 29879, 353, 410, 915, 7445, 29879, 29889, 8552, 580, 7503, 29899, 29896, 29962, 13, 4706, 19471, 29896, 353, 7023, 2378, 29898, 29933, 21339, 29918, 14226, 29897, 13, 13, 4706, 363, 474, 297, 18764, 287, 29898, 3881, 29898, 29933, 21339, 29918, 14226, 22164, 13, 9651, 19471, 29906, 353, 7023, 2378, 29898, 29933, 21339, 29918, 14226, 29897, 13, 9651, 363, 432, 297, 3464, 29898, 29933, 21339, 29918, 14226, 448, 313, 29875, 29974, 29896, 22164, 13, 18884, 19471, 29906, 29961, 29933, 21339, 29918, 14226, 448, 313, 29896, 718, 432, 4638, 353, 313, 29933, 21339, 29918, 14226, 448, 474, 29897, 13, 632, 13, 9651, 363, 432, 297, 3464, 29898, 29906, 29945, 29953, 1125, 13, 18884, 4583, 8096, 4074, 353, 410, 915, 7445, 29879, 29889, 8552, 580, 13, 18884, 19471, 29906, 29961, 29875, 29962, 353, 432, 13, 18884, 19471, 353, 7023, 2378, 29898, 13193, 4197, 29874, 6228, 289, 363, 313, 29874, 29892, 29890, 29897, 297, 14319, 29898, 4181, 29896, 29892, 19471, 29906, 4638, 876, 13, 13, 18884, 2908, 353, 4583, 8096, 4074, 29961, 2435, 29898, 455, 8096, 4074, 6817, 29906, 29962, 13, 18884, 410, 915, 353, 7023, 2378, 29898, 13193, 4197, 29874, 6228, 289, 363, 313, 29874, 29892, 29890, 29897, 297, 14319, 29898, 1271, 29892, 19471, 4638, 876, 13, 18884, 4583, 8096, 4074, 29961, 2435, 29898, 455, 8096, 4074, 6817, 29906, 29962, 353, 410, 915, 13, 13, 9651, 565, 274, 12328, 29889, 7099, 4641, 29898, 10389, 2378, 29898, 29890, 29915, 4286, 7122, 29898, 455, 8096, 4074, 4961, 338, 451, 7700, 29901, 13, 18884, 899, 29896, 353, 350, 21339, 29918, 14226, 448, 474, 13, 18884, 899, 29906, 353, 432, 13, 18884, 899, 353, 899, 29896, 6228, 899, 29906, 13, 18884, 19471, 29896, 29961, 29875, 29962, 353, 899, 13, 18884, 2643, 353, 899, 29889, 517, 29918, 13193, 29898, 29896, 5501, 29880, 1992, 1495, 718, 2643, 13, 13, 1678, 736, 2643, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1820, 353, 529, 10818, 16299, 13, 1678, 1426, 353, 7023, 2378, 877, 1484, 508, 267, 3788, 9420, 29899, 29947, 1495, 13, 13, 1678, 274, 12328, 353, 315, 29933, 4174, 29875, 8096, 29898, 1989, 29897, 13, 1678, 4583, 8096, 726, 353, 274, 12328, 29889, 3977, 4641, 29898, 726, 29897, 13, 1678, 396, 2158, 29898, 455, 8096, 726, 29897, 13, 13, 1678, 9391, 353, 5337, 29898, 10702, 29883, 29892, 455, 8096, 726, 29897, 13, 1678, 396, 2158, 29898, 6729, 1717, 29897, 13, 13, 1678, 1596, 877, 23648, 6108, 2877, 1546, 1426, 322, 9391, 2643, 23648, 1495, 13, 1678, 1596, 29898, 6729, 1717, 1275, 1426, 29897, 13, 2 ]
topgun/__init__.py
muntumdwara/TopGun
0
60258
<reponame>muntumdwara/TopGun<gh_stars>0 #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ TopGun @author: Viper """ # Useful Medium post on Python importing within __init__.py # https://towardsdatascience.com/whats-init-for-me-d70a312da583 ### DON'T FORGET TO UPDATE SUB __INIT__.py files ### # General from .utilities import * from .reporting import Reporting # Models from .models import * # Charting from .charting import * # Optimisation from .optimiser import *
[ 1, 529, 276, 1112, 420, 29958, 29885, 1657, 398, 28012, 2518, 29914, 7031, 29954, 348, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 7031, 29954, 348, 13, 29992, 8921, 29901, 10630, 546, 13, 13, 15945, 29908, 13, 13, 29937, 4803, 1319, 3436, 1974, 1400, 373, 5132, 28348, 2629, 4770, 2344, 26914, 2272, 13, 29937, 2045, 597, 29873, 340, 3163, 14538, 15277, 29889, 510, 29914, 1332, 1446, 29899, 2344, 29899, 1454, 29899, 1004, 29899, 29881, 29955, 29900, 29874, 29941, 29896, 29906, 1388, 29945, 29947, 29941, 13, 13, 2277, 29937, 360, 1164, 29915, 29911, 15842, 7194, 7495, 16924, 27092, 4770, 26019, 26914, 2272, 2066, 835, 13, 13, 29937, 4593, 13, 3166, 869, 4422, 1907, 1053, 334, 13, 3166, 869, 12276, 292, 1053, 13969, 292, 13, 13, 29937, 3382, 1379, 13, 3166, 869, 9794, 1053, 334, 13, 13, 29937, 14477, 292, 13, 3166, 869, 15425, 292, 1053, 334, 13, 13, 29937, 20693, 326, 4371, 13, 3166, 869, 20640, 7608, 1053, 334, 2 ]
exercises/alphametics/alphametics.py
kishankj/python
1,177
104772
def solve(puzzle): pass
[ 1, 822, 4505, 29898, 29886, 18813, 280, 1125, 13, 1678, 1209, 13, 2 ]
Ene-Jun-2019/Luis Ornelas/Segundo Parcial/Ejercicio 3/Ejercicio3-Parcial2-DB.py
Arbupa/DAS_Sistemas
41
164623
import sqlite3 conexion = sqlite3.connect('RandUser.db') cursor = conexion.cursor() cursor.execute(''' CREATE TABLE Users( Gender TEXT NOT NULL, First TEXT NOT NULL, Last TEXT NOT NULL, Location TEXT NOT NULL, Email TEXT NOT NULL) ''') conexion.close()
[ 1, 1053, 21120, 29941, 13, 13, 535, 735, 291, 353, 21120, 29941, 29889, 6915, 877, 29934, 392, 2659, 29889, 2585, 1495, 13, 18127, 353, 378, 735, 291, 29889, 18127, 580, 13, 13, 18127, 29889, 7978, 877, 4907, 13, 1678, 14602, 10911, 23861, 29898, 13, 1678, 402, 1581, 323, 12194, 6058, 4265, 29892, 13, 1678, 3824, 323, 12194, 6058, 4265, 29892, 13, 1678, 9208, 323, 12194, 6058, 4265, 29892, 13, 1678, 17015, 323, 12194, 6058, 4265, 29892, 13, 1678, 22608, 323, 12194, 6058, 4265, 29897, 13, 1678, 6629, 1495, 13, 13, 535, 735, 291, 29889, 5358, 580, 13, 2 ]
authnz/tests.py
NERSC/newt-2.0
11
142683
from django.test import TestCase from django.conf import settings import json from newt.tests import MyTestClient, newt_base_url, login class AuthTests(TestCase): fixtures = ["test_fixture.json"] def setUp(self): self.client = MyTestClient() def test_login(self): # Should not be logged in r = self.client.get(newt_base_url + "/auth") self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], False) # Should be logged in r = self.client.post(newt_base_url + "/auth", data=login) self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], True) self.assertEquals(json_response['output']['username'], login['username']) # Loggen in self.client should return user info r = self.client.get(newt_base_url + "/auth") self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], True) self.assertEquals(json_response['output']['username'], login['username']) def test_logout(self): # Should be logged in r = self.client.post(newt_base_url + "/auth", data=login) self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], True) self.assertEquals(json_response['output']['username'], login['username']) r = self.client.delete(newt_base_url + "/auth") self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], False) r = self.client.get(newt_base_url + "/auth") self.assertEquals(r.status_code, 200) json_response = r.json() self.assertEquals(json_response['output']['auth'], False)
[ 1, 515, 9557, 29889, 1688, 1053, 4321, 8259, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 5215, 4390, 13, 3166, 716, 29873, 29889, 21150, 1053, 1619, 3057, 4032, 29892, 716, 29873, 29918, 3188, 29918, 2271, 29892, 6464, 13, 13, 13, 1990, 13189, 24376, 29898, 3057, 8259, 1125, 13, 1678, 5713, 486, 1973, 353, 6796, 1688, 29918, 7241, 15546, 29889, 3126, 3108, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 4645, 353, 1619, 3057, 4032, 580, 13, 13, 1678, 822, 1243, 29918, 7507, 29898, 1311, 1125, 13, 4706, 396, 10575, 451, 367, 13817, 297, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 657, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 7700, 29897, 13, 308, 13, 4706, 396, 10575, 367, 13817, 297, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 2490, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 613, 848, 29922, 7507, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 5852, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 6786, 7464, 6464, 1839, 6786, 11287, 13, 13, 4706, 396, 4522, 1885, 297, 1583, 29889, 4645, 881, 736, 1404, 5235, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 657, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 5852, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 6786, 7464, 6464, 1839, 6786, 11287, 13, 13, 13, 1678, 822, 1243, 29918, 1188, 449, 29898, 1311, 1125, 13, 4706, 396, 10575, 367, 13817, 297, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 2490, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 613, 848, 29922, 7507, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 5852, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 6786, 7464, 6464, 1839, 6786, 11287, 13, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 8143, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 7700, 29897, 13, 13, 4706, 364, 353, 1583, 29889, 4645, 29889, 657, 29898, 1482, 29873, 29918, 3188, 29918, 2271, 718, 5591, 5150, 1159, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 4706, 4390, 29918, 5327, 353, 364, 29889, 3126, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3126, 29918, 5327, 1839, 4905, 16215, 5150, 7464, 7700, 29897, 13, 2 ]
data/vctk.py
Jackson-Kang/VQVC-Pytorch
13
79939
from utils.path import * from utils.audio.tools import get_mel from tqdm import tqdm import numpy as np import glob, os, sys from multiprocessing import Pool from scipy.io.wavfile import write import librosa, ffmpeg from sklearn.preprocessing import StandardScaler def job(wav_filename): original_wav_filename, prepro_wav_dir, sampling_rate = wav_filename filename = original_wav_filename.split("/")[-1] new_wav_filename = get_path(prepro_wav_dir, filename) if not os.path.exists(new_wav_filename): try: out, err = (ffmpeg .input(original_wav_filename) .output(new_wav_filename, acodec='pcm_s16le', ac=1, ar=sampling_rate) .overwrite_output() .run(capture_stdout=True, capture_stderr=True)) except ffmpeg.Error as err: print(err.stderr, file=sys.stderr) raise def preprocess(data_path, prepro_wav_dir, prepro_path, mel_path, sampling_rate, n_workers=10, filter_length=1024, hop_length=256, trim_silence=True, top_db=60): p = Pool(n_workers) mel_scaler = StandardScaler(copy=False) prepro_wav_dir = create_dir(prepro_wav_dir) wav_paths=[[filename, prepro_wav_dir, sampling_rate] for filename in list(glob.glob(get_path(data_path, "wav48", "**", "*.wav")))] print("\t[LOG] converting wav format...") with tqdm(total=len(wav_paths)) as pbar: for _ in tqdm(p.imap_unordered(job, wav_paths)): pbar.update() print("\t[LOG] saving mel-spectrogram...") with tqdm(total=len(wav_paths)) as pbar: for wav_filename in tqdm(glob.glob(get_path(prepro_wav_dir, "*.wav"))): mel_filename = wav_filename.split("/")[-1].replace("wav", "npy") mel_savepath = get_path(mel_path, mel_filename) mel_spectrogram, _ = get_mel(wav_filename, trim_silence=trim_silence, frame_length=filter_length, hop_length=hop_length, top_db=top_db) mel_scaler.partial_fit(mel_spectrogram) np.save(mel_savepath, mel_spectrogram) np.save(get_path(prepro_path, "mel_stats.npy"), np.array([mel_scaler.mean_, mel_scaler.scale_])) print("Done!") def split_unseen_speakers(prepro_mel_dir): print("[LOG] 6 UNSEEN speakers: \n\t p226(Male, English, Surrey) \n\t p256(Male, English, Birmingham) \ \n\t p266(Female, Irish, Athlone) \n\t p297(Female, American, Newyork) \ \n\t p323 (Female, SouthAfrican, Pretoria)\n\t p376(Male, Indian)") unseen_speaker_list = ["p226", "p256", "p266", "p297", "p323", "p376"] seen_speaker_files, unseen_speaker_files = [], [] preprocessed_file_list = glob.glob(get_path(prepro_mel_dir, "*.npy")) for preprocessed_mel_file in preprocessed_file_list: speaker = preprocessed_mel_file.split("/")[-1].split("_")[0] if speaker in unseen_speaker_list: unseen_speaker_files.append(preprocessed_mel_file) else: seen_speaker_files.append(preprocessed_mel_file) return seen_speaker_files, unseen_speaker_files
[ 1, 515, 3667, 29879, 29889, 2084, 1053, 334, 13, 3166, 3667, 29879, 29889, 18494, 29889, 8504, 1053, 679, 29918, 12873, 13, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 5215, 12655, 408, 7442, 13, 5215, 13149, 29892, 2897, 29892, 10876, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 13, 13, 3166, 4560, 2272, 29889, 601, 29889, 29893, 485, 1445, 1053, 2436, 13, 5215, 4303, 1883, 29874, 29892, 14336, 20856, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 10117, 29636, 261, 13, 13, 1753, 4982, 29898, 29893, 485, 29918, 9507, 1125, 13, 13, 12, 13492, 29918, 29893, 485, 29918, 9507, 29892, 758, 771, 29918, 29893, 485, 29918, 3972, 29892, 23460, 29918, 10492, 353, 281, 485, 29918, 9507, 13, 12, 9507, 353, 2441, 29918, 29893, 485, 29918, 9507, 29889, 5451, 11974, 1159, 14352, 29896, 29962, 13, 12, 1482, 29918, 29893, 485, 29918, 9507, 353, 679, 29918, 2084, 29898, 1457, 771, 29918, 29893, 485, 29918, 3972, 29892, 10422, 29897, 13, 13, 12, 361, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1482, 29918, 29893, 485, 29918, 9507, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 449, 29892, 4589, 353, 313, 600, 20856, 13, 12, 12, 12, 12, 12, 29889, 2080, 29898, 13492, 29918, 29893, 485, 29918, 9507, 29897, 13, 12, 12, 12, 12, 12, 29889, 4905, 29898, 1482, 29918, 29893, 485, 29918, 9507, 29892, 263, 401, 29883, 2433, 29886, 4912, 29918, 29879, 29896, 29953, 280, 742, 1274, 29922, 29896, 29892, 564, 29922, 13445, 10335, 29918, 10492, 29897, 13, 12, 12, 12, 12, 12, 29889, 957, 3539, 29918, 4905, 580, 13, 12, 12, 12, 12, 12, 29889, 3389, 29898, 17885, 545, 29918, 25393, 29922, 5574, 29892, 10446, 29918, 303, 20405, 29922, 5574, 876, 13, 13, 12, 12, 19499, 14336, 20856, 29889, 2392, 408, 4589, 29901, 13, 12, 12, 12, 2158, 29898, 3127, 29889, 303, 20405, 29892, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 12, 12, 12, 22692, 13, 13, 13, 1753, 758, 5014, 29898, 1272, 29918, 2084, 29892, 758, 771, 29918, 29893, 485, 29918, 3972, 29892, 758, 771, 29918, 2084, 29892, 9232, 29918, 2084, 29892, 23460, 29918, 10492, 29892, 302, 29918, 1287, 414, 29922, 29896, 29900, 29892, 4175, 29918, 2848, 29922, 29896, 29900, 29906, 29946, 29892, 8171, 29918, 2848, 29922, 29906, 29945, 29953, 29892, 17151, 29918, 25590, 663, 29922, 5574, 29892, 2246, 29918, 2585, 29922, 29953, 29900, 1125, 13, 12, 29886, 353, 28625, 29898, 29876, 29918, 1287, 414, 29897, 13, 13, 12, 12873, 29918, 19529, 261, 353, 10117, 29636, 261, 29898, 8552, 29922, 8824, 29897, 13, 13, 12, 1457, 771, 29918, 29893, 485, 29918, 3972, 353, 1653, 29918, 3972, 29898, 1457, 771, 29918, 29893, 485, 29918, 3972, 29897, 13, 12, 29893, 485, 29918, 24772, 29922, 8999, 9507, 29892, 758, 771, 29918, 29893, 485, 29918, 3972, 29892, 23460, 29918, 10492, 29962, 363, 10422, 297, 1051, 29898, 23705, 29889, 23705, 29898, 657, 29918, 2084, 29898, 1272, 29918, 2084, 29892, 376, 29893, 485, 29946, 29947, 613, 376, 1068, 613, 376, 10521, 29893, 485, 5783, 4638, 13, 13, 12, 2158, 14182, 29873, 29961, 14480, 29962, 17415, 281, 485, 3402, 856, 1159, 13, 12, 2541, 260, 29939, 18933, 29898, 7827, 29922, 2435, 29898, 29893, 485, 29918, 24772, 876, 408, 282, 1646, 29901, 13, 12, 12, 1454, 903, 297, 260, 29939, 18933, 29898, 29886, 29889, 326, 481, 29918, 348, 21693, 29898, 9057, 29892, 281, 485, 29918, 24772, 22164, 13, 12, 12, 12, 29886, 1646, 29889, 5504, 580, 12, 13, 13, 12, 2158, 14182, 29873, 29961, 14480, 29962, 14238, 9232, 29899, 21494, 307, 1393, 856, 1159, 13, 12, 2541, 260, 29939, 18933, 29898, 7827, 29922, 2435, 29898, 29893, 485, 29918, 24772, 876, 408, 282, 1646, 29901, 13, 12, 12, 1454, 281, 485, 29918, 9507, 297, 260, 29939, 18933, 29898, 23705, 29889, 23705, 29898, 657, 29918, 2084, 29898, 1457, 771, 29918, 29893, 485, 29918, 3972, 29892, 376, 10521, 29893, 485, 5783, 1125, 13, 12, 12, 12, 12873, 29918, 9507, 353, 281, 485, 29918, 9507, 29889, 5451, 11974, 1159, 14352, 29896, 1822, 6506, 703, 29893, 485, 613, 376, 29876, 2272, 1159, 13, 12, 12, 12, 12873, 29918, 7620, 2084, 353, 679, 29918, 2084, 29898, 12873, 29918, 2084, 29892, 9232, 29918, 9507, 29897, 13, 12, 12, 12, 12873, 29918, 21494, 307, 1393, 29892, 903, 353, 679, 29918, 12873, 29898, 29893, 485, 29918, 9507, 29892, 17151, 29918, 25590, 663, 29922, 15450, 29918, 25590, 663, 29892, 3515, 29918, 2848, 29922, 4572, 29918, 2848, 29892, 8171, 29918, 2848, 29922, 29882, 459, 29918, 2848, 29892, 2246, 29918, 2585, 29922, 3332, 29918, 2585, 29897, 13, 13, 12, 12, 12, 12873, 29918, 19529, 261, 29889, 3846, 29918, 9202, 29898, 12873, 29918, 21494, 307, 1393, 29897, 13, 12, 12, 12, 9302, 29889, 7620, 29898, 12873, 29918, 7620, 2084, 29892, 9232, 29918, 21494, 307, 1393, 29897, 13, 13, 12, 9302, 29889, 7620, 29898, 657, 29918, 2084, 29898, 1457, 771, 29918, 2084, 29892, 376, 12873, 29918, 16202, 29889, 29876, 2272, 4968, 7442, 29889, 2378, 4197, 12873, 29918, 19529, 261, 29889, 12676, 3383, 9232, 29918, 19529, 261, 29889, 7052, 29918, 12622, 13, 13, 12, 2158, 703, 25632, 29991, 1159, 13, 13, 13, 13, 1753, 6219, 29918, 348, 28026, 29918, 5965, 21079, 29898, 1457, 771, 29918, 12873, 29918, 3972, 1125, 13, 13, 12, 2158, 703, 29961, 14480, 29962, 29871, 29953, 8291, 1660, 1430, 7726, 414, 29901, 29871, 320, 29876, 29905, 29873, 282, 29906, 29906, 29953, 29898, 29924, 744, 29892, 4223, 29892, 6298, 8903, 29897, 320, 29876, 29905, 29873, 282, 29906, 29945, 29953, 29898, 29924, 744, 29892, 4223, 29892, 350, 28836, 29897, 320, 13, 12, 12, 12, 12, 12, 320, 29876, 29905, 29873, 282, 29906, 29953, 29953, 29898, 29943, 331, 744, 29892, 12601, 29892, 9193, 29880, 650, 29897, 320, 29876, 29905, 29873, 282, 29906, 29929, 29955, 29898, 29943, 331, 744, 29892, 3082, 29892, 1570, 29891, 548, 29897, 320, 13, 12, 12, 12, 12, 12, 320, 29876, 29905, 29873, 282, 29941, 29906, 29941, 313, 29943, 331, 744, 29892, 4275, 29909, 1341, 2185, 29892, 349, 2267, 4108, 2144, 29876, 29905, 29873, 282, 29941, 29955, 29953, 29898, 29924, 744, 29892, 7560, 25760, 13, 13, 12, 348, 28026, 29918, 5965, 5790, 29918, 1761, 353, 6796, 29886, 29906, 29906, 29953, 613, 376, 29886, 29906, 29945, 29953, 613, 376, 29886, 29906, 29953, 29953, 613, 376, 29886, 29906, 29929, 29955, 613, 376, 29886, 29941, 29906, 29941, 613, 376, 29886, 29941, 29955, 29953, 3108, 13, 13, 12, 28026, 29918, 5965, 5790, 29918, 5325, 29892, 443, 28026, 29918, 5965, 5790, 29918, 5325, 353, 19997, 5159, 13, 13, 12, 1457, 5014, 287, 29918, 1445, 29918, 1761, 353, 13149, 29889, 23705, 29898, 657, 29918, 2084, 29898, 1457, 771, 29918, 12873, 29918, 3972, 29892, 376, 10521, 29876, 2272, 5783, 13, 12, 13, 12, 1454, 758, 5014, 287, 29918, 12873, 29918, 1445, 297, 758, 5014, 287, 29918, 1445, 29918, 1761, 29901, 13, 12, 12, 5965, 5790, 353, 758, 5014, 287, 29918, 12873, 29918, 1445, 29889, 5451, 11974, 1159, 14352, 29896, 1822, 5451, 703, 29918, 1159, 29961, 29900, 29962, 13, 12, 12, 361, 25657, 297, 443, 28026, 29918, 5965, 5790, 29918, 1761, 29901, 13, 12, 12, 12, 348, 28026, 29918, 5965, 5790, 29918, 5325, 29889, 4397, 29898, 1457, 5014, 287, 29918, 12873, 29918, 1445, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 28026, 29918, 5965, 5790, 29918, 5325, 29889, 4397, 29898, 1457, 5014, 287, 29918, 12873, 29918, 1445, 29897, 12, 13, 12, 13, 12, 2457, 3595, 29918, 5965, 5790, 29918, 5325, 29892, 443, 28026, 29918, 5965, 5790, 29918, 5325, 13, 13, 13, 13, 13, 2 ]
yt_dlp/extractor/archiveorg.py
mrBliss/yt-dlp
80
11346
<filename>yt_dlp/extractor/archiveorg.py # coding: utf-8 from __future__ import unicode_literals import re import json from .common import InfoExtractor from .youtube import YoutubeIE, YoutubeBaseInfoExtractor from ..compat import ( compat_urllib_parse_unquote, compat_urllib_parse_unquote_plus, compat_HTTPError ) from ..utils import ( bug_reports_message, clean_html, dict_get, extract_attributes, ExtractorError, get_element_by_id, HEADRequest, int_or_none, KNOWN_EXTENSIONS, merge_dicts, mimetype2ext, orderedSet, parse_duration, parse_qs, str_to_int, str_or_none, traverse_obj, try_get, unified_strdate, unified_timestamp, urlhandle_detect_ext, url_or_none ) class ArchiveOrgIE(InfoExtractor): IE_NAME = 'archive.org' IE_DESC = 'archive.org video and audio' _VALID_URL = r'https?://(?:www\.)?archive\.org/(?:details|embed)/(?P<id>[^?#]+)(?:[?].*)?$' _TESTS = [{ 'url': 'http://archive.org/details/XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'md5': '8af1d4cf447933ed3c7f4871162602db', 'info_dict': { 'id': 'XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'ext': 'ogv', 'title': '1968 Demo - FJCC Conference Presentation Reel #1', 'description': 'md5:da45c349df039f1cc8075268eb1b5c25', 'release_date': '19681210', 'timestamp': 1268695290, 'upload_date': '20100315', 'creator': 'SRI International', 'uploader': '<EMAIL>', }, }, { 'url': 'https://archive.org/details/Cops1922', 'md5': '0869000b4ce265e8ca62738b336b268a', 'info_dict': { 'id': 'Cops1922', 'ext': 'mp4', 'title': 'Buster Keaton\'s "Cops" (1922)', 'description': 'md5:43a603fd6c5b4b90d12a96b921212b9c', 'uploader': '<EMAIL>', 'timestamp': 1387699629, 'upload_date': "20131222", }, }, { 'url': 'http://archive.org/embed/XD300-23_68HighlightsAResearchCntAugHumanIntellect', 'only_matching': True, }, { 'url': 'https://archive.org/details/Election_Ads', 'md5': '284180e857160cf866358700bab668a3', 'info_dict': { 'id': 'Election_Ads/Commercial-JFK1960ElectionAdCampaignJingle.mpg', 'title': 'Commercial-JFK1960ElectionAdCampaignJingle.mpg', 'ext': 'mp4', }, }, { 'url': 'https://archive.org/details/Election_Ads/Commercial-Nixon1960ElectionAdToughonDefense.mpg', 'md5': '7915213ef02559b5501fe630e1a53f59', 'info_dict': { 'id': 'Election_Ads/Commercial-Nixon1960ElectionAdToughonDefense.mpg', 'title': 'Commercial-Nixon1960ElectionAdToughonDefense.mpg', 'ext': 'mp4', 'timestamp': 1205588045, 'uploader': '<EMAIL>', 'description': '1960 Presidential Campaign Election Commercials <NAME>, <NAME>', 'upload_date': '20080315', }, }, { 'url': 'https://archive.org/details/gd1977-05-08.shure57.stevenson.29303.flac16', 'md5': '7d07ffb42aba6537c28e053efa4b54c9', 'info_dict': { 'id': 'gd1977-05-08.shure57.stevenson.29303.flac16/gd1977-05-08d01t01.flac', 'title': 'Turning', 'ext': 'flac', }, }, { 'url': 'https://archive.org/details/gd1977-05-08.shure57.stevenson.29303.flac16/gd1977-05-08d01t07.flac', 'md5': 'a07cd8c6ab4ee1560f8a0021717130f3', 'info_dict': { 'id': 'gd1977-05-08.shure57.stevenson.29303.flac16/gd1977-05-08d01t07.flac', 'title': 'Deal', 'ext': 'flac', 'timestamp': 1205895624, 'uploader': '<EMAIL>', 'description': 'md5:6a31f1996db0aa0fc9da6d6e708a1bb0', 'upload_date': '20080319', 'location': 'Barton Hall - Cornell University', }, }, { 'url': 'https://archive.org/details/lp_the-music-of-russia_various-artists-a-askaryan-alexander-melik', 'md5': '7cb019baa9b332e82ea7c10403acd180', 'info_dict': { 'id': 'lp_the-music-of-russia_various-artists-a-askaryan-alexander-melik/disc1/01.01. Bells Of Rostov.mp3', 'title': 'Bells Of Rostov', 'ext': 'mp3', }, }, { 'url': 'https://archive.org/details/lp_the-music-of-russia_various-artists-a-askaryan-alexander-melik/disc1/02.02.+Song+And+Chorus+In+The+Polovetsian+Camp+From+%22Prince+Igor%22+(Act+2%2C+Scene+1).mp3', 'md5': '1d0aabe03edca83ca58d9ed3b493a3c3', 'info_dict': { 'id': 'lp_the-music-of-russia_various-artists-a-askaryan-alexander-melik/disc1/02.02. Song And Chorus In The Polovetsian Camp From "Prince Igor" (Act 2, Scene 1).mp3', 'title': 'Song And Chorus In The Polovetsian Camp From "Prince Igor" (Act 2, Scene 1)', 'ext': 'mp3', 'timestamp': 1569662587, 'uploader': '<EMAIL>', 'description': 'md5:012b2d668ae753be36896f343d12a236', 'upload_date': '20190928', }, }] @staticmethod def _playlist_data(webpage): element = re.findall(r'''(?xs) <input (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]*|="[^"]*"|='[^']*'|))*? \s+class=['"]?js-play8-playlist['"]? (?:\s+[a-zA-Z0-9:._-]+(?:=[a-zA-Z0-9:._-]*|="[^"]*"|='[^']*'|))*? \s*/> ''', webpage)[0] return json.loads(extract_attributes(element)['value']) def _real_extract(self, url): video_id = compat_urllib_parse_unquote_plus(self._match_id(url)) identifier, entry_id = (video_id.split('/', 1) + [None])[:2] # Archive.org metadata API doesn't clearly demarcate playlist entries # or subtitle tracks, so we get them from the embeddable player. embed_page = self._download_webpage( 'https://archive.org/embed/' + identifier, identifier) playlist = self._playlist_data(embed_page) entries = {} for p in playlist: # If the user specified a playlist entry in the URL, ignore the # rest of the playlist. if entry_id and p['orig'] != entry_id: continue entries[p['orig']] = { 'formats': [], 'thumbnails': [], 'artist': p.get('artist'), 'track': p.get('title'), 'subtitles': {}} for track in p.get('tracks', []): if track['kind'] != 'subtitles': continue entries[p['orig']][track['label']] = { 'url': 'https://archive.org/' + track['file'].lstrip('/')} metadata = self._download_json( 'http://archive.org/metadata/' + identifier, identifier) m = metadata['metadata'] identifier = m['identifier'] info = { 'id': identifier, 'title': m['title'], 'description': clean_html(m.get('description')), 'uploader': dict_get(m, ['uploader', 'adder']), 'creator': m.get('creator'), 'license': m.get('licenseurl'), 'release_date': unified_strdate(m.get('date')), 'timestamp': unified_timestamp(dict_get(m, ['publicdate', 'addeddate'])), 'webpage_url': 'https://archive.org/details/' + identifier, 'location': m.get('venue'), 'release_year': int_or_none(m.get('year'))} for f in metadata['files']: if f['name'] in entries: entries[f['name']] = merge_dicts(entries[f['name']], { 'id': identifier + '/' + f['name'], 'title': f.get('title') or f['name'], 'display_id': f['name'], 'description': clean_html(f.get('description')), 'creator': f.get('creator'), 'duration': parse_duration(f.get('length')), 'track_number': int_or_none(f.get('track')), 'album': f.get('album'), 'discnumber': int_or_none(f.get('disc')), 'release_year': int_or_none(f.get('year'))}) entry = entries[f['name']] elif f.get('original') in entries: entry = entries[f['original']] else: continue if f.get('format') == 'Thumbnail': entry['thumbnails'].append({ 'id': f['name'], 'url': 'https://archive.org/download/' + identifier + '/' + f['name'], 'width': int_or_none(f.get('width')), 'height': int_or_none(f.get('width')), 'filesize': int_or_none(f.get('size'))}) extension = (f['name'].rsplit('.', 1) + [None])[1] if extension in KNOWN_EXTENSIONS: entry['formats'].append({ 'url': 'https://archive.org/download/' + identifier + '/' + f['name'], 'format': f.get('format'), 'width': int_or_none(f.get('width')), 'height': int_or_none(f.get('height')), 'filesize': int_or_none(f.get('size')), 'protocol': 'https'}) # Sort available formats by filesize for entry in entries.values(): entry['formats'] = list(sorted(entry['formats'], key=lambda x: x.get('filesize', -1))) if len(entries) == 1: # If there's only one item, use it as the main info dict only_video = entries[list(entries.keys())[0]] if entry_id: info = merge_dicts(only_video, info) else: info = merge_dicts(info, only_video) else: # Otherwise, we have a playlist. info['_type'] = 'playlist' info['entries'] = list(entries.values()) if metadata.get('reviews'): info['comments'] = [] for review in metadata['reviews']: info['comments'].append({ 'id': review.get('review_id'), 'author': review.get('reviewer'), 'text': str_or_none(review.get('reviewtitle'), '') + '\n\n' + review.get('reviewbody'), 'timestamp': unified_timestamp(review.get('createdate')), 'parent': 'root'}) return info class YoutubeWebArchiveIE(InfoExtractor): IE_NAME = 'web.archive:youtube' IE_DESC = 'web.archive.org saved youtube videos' _VALID_URL = r"""(?x)^ (?:https?://)?web\.archive\.org/ (?:web/)? (?:(?P<date>[0-9]{14})?[0-9A-Za-z_*]*/)? # /web and the version index is optional (?:https?(?::|%3[Aa])//)? (?: (?:\w+\.)?youtube\.com(?::(?:80|443))?/watch(?:\.php)?(?:\?|%3[fF])(?:[^\#]+(?:&|%26))?v(?:=|%3[dD]) # Youtube URL |(?:wayback-fakeurl\.archive\.org/yt/) # Or the internal fake url ) (?P<id>[0-9A-Za-z_-]{11})(?:%26|\#|&|$) """ _TESTS = [ { 'url': 'https://web.archive.org/web/20150415002341/https://www.youtube.com/watch?v=aYAGB11YrSs', 'info_dict': { 'id': 'aYAGB11YrSs', 'ext': 'webm', 'title': 'Team Fortress 2 - Sandviches!', 'description': 'md5:4984c0f9a07f349fc5d8e82ab7af4eaf', 'upload_date': '20110926', 'uploader': 'Zeurel', 'channel_id': 'UCukCyHaD-bK3in_pKpfH9Eg', 'duration': 32, 'uploader_id': 'Zeurel', 'uploader_url': 'http://www.youtube.com/user/Zeurel' } }, { # Internal link 'url': 'https://web.archive.org/web/2oe/http://wayback-fakeurl.archive.org/yt/97t7Xj_iBv0', 'info_dict': { 'id': '97t7Xj_iBv0', 'ext': 'mp4', 'title': 'Why Machines That Bend Are Better', 'description': 'md5:00404df2c632d16a674ff8df1ecfbb6c', 'upload_date': '20190312', 'uploader': 'Veritasium', 'channel_id': 'UCHnyfMqiRRG1u-2MsSQLbXA', 'duration': 771, 'uploader_id': '1veritasium', 'uploader_url': 'http://www.youtube.com/user/1veritasium' } }, { # Video from 2012, webm format itag 45. Newest capture is deleted video, with an invalid description. # Should use the date in the link. Title ends with '- Youtube'. Capture has description in eow-description 'url': 'https://web.archive.org/web/20120712231619/http://www.youtube.com/watch?v=AkhihxRKcrs&gl=US&hl=en', 'info_dict': { 'id': 'AkhihxRKcrs', 'ext': 'webm', 'title': 'Limited Run: Mondo\'s Modern Classic 1 of 3 (SDCC 2012)', 'upload_date': '20120712', 'duration': 398, 'description': 'md5:ff4de6a7980cb65d951c2f6966a4f2f3', 'uploader_id': 'machinima', 'uploader_url': 'http://www.youtube.com/user/machinima' } }, { # FLV video. Video file URL does not provide itag information 'url': 'https://web.archive.org/web/20081211103536/http://www.youtube.com/watch?v=jNQXAC9IVRw', 'info_dict': { 'id': 'jNQXAC9IVRw', 'ext': 'flv', 'title': 'Me at the zoo', 'upload_date': '20050423', 'channel_id': 'UC4QobU6STFB0P71PMvOGN5A', 'duration': 19, 'description': 'md5:10436b12e07ac43ff8df65287a56efb4', 'uploader_id': 'jawed', 'uploader_url': 'http://www.youtube.com/user/jawed' } }, { 'url': 'https://web.archive.org/web/20110712231407/http://www.youtube.com/watch?v=lTx3G6h2xyA', 'info_dict': { 'id': 'lTx3G6h2xyA', 'ext': 'flv', 'title': 'Madeon - Pop Culture (live mashup)', 'upload_date': '20110711', 'uploader': 'Madeon', 'channel_id': 'UCqMDNf3Pn5L7pcNkuSEeO3w', 'duration': 204, 'description': 'md5:f7535343b6eda34a314eff8b85444680', 'uploader_id': 'itsmadeon', 'uploader_url': 'http://www.youtube.com/user/itsmadeon' } }, { # First capture is of dead video, second is the oldest from CDX response. 'url': 'https://web.archive.org/https://www.youtube.com/watch?v=1JYutPM8O6E', 'info_dict': { 'id': '1JYutPM8O6E', 'ext': 'mp4', 'title': 'Fake Teen Doctor Strikes AGAIN! - Weekly Weird News', 'upload_date': '20160218', 'channel_id': 'UCdIaNUarhzLSXGoItz7BHVA', 'duration': 1236, 'description': 'md5:21032bae736421e89c2edf36d1936947', 'uploader_id': 'MachinimaETC', 'uploader_url': 'http://www.youtube.com/user/MachinimaETC' } }, { # First capture of dead video, capture date in link links to dead capture. 'url': 'https://web.archive.org/web/20180803221945/https://www.youtube.com/watch?v=6FPhZJGvf4E', 'info_dict': { 'id': '6FPhZJGvf4E', 'ext': 'mp4', 'title': 'WTF: Video Games Still Launch BROKEN?! - T.U.G.S.', 'upload_date': '20160219', 'channel_id': 'UCdIaNUarhzLSXGoItz7BHVA', 'duration': 798, 'description': 'md5:a1dbf12d9a3bd7cb4c5e33b27d77ffe7', 'uploader_id': 'MachinimaETC', 'uploader_url': 'http://www.youtube.com/user/MachinimaETC' }, 'expected_warnings': [ r'unable to download capture webpage \(it may not be archived\)' ] }, { # Very old YouTube page, has - YouTube in title. 'url': 'http://web.archive.org/web/20070302011044/http://youtube.com/watch?v=-06-KB9XTzg', 'info_dict': { 'id': '-06-KB9XTzg', 'ext': 'flv', 'title': 'New Coin Hack!! 100% Safe!!' } }, { 'url': 'web.archive.org/https://www.youtube.com/watch?v=dWW7qP423y8', 'info_dict': { 'id': 'dWW7qP423y8', 'ext': 'mp4', 'title': 'It\'s Bootleg AirPods Time.', 'upload_date': '20211021', 'channel_id': 'UC7Jwj9fkrf1adN4fMmTkpug', 'channel_url': 'http://www.youtube.com/channel/UC7Jwj9fkrf1adN4fMmTkpug', 'duration': 810, 'description': 'md5:7b567f898d8237b256f36c1a07d6d7bc', 'uploader': 'DankPods', 'uploader_id': 'UC7Jwj9fkrf1adN4fMmTkpug', 'uploader_url': 'http://www.youtube.com/channel/UC7Jwj9fkrf1adN4fMmTkpug' } }, { # player response contains '};' See: https://github.com/ytdl-org/youtube-dl/issues/27093 'url': 'https://web.archive.org/web/20200827003909if_/http://www.youtube.com/watch?v=6Dh-RL__uN4', 'info_dict': { 'id': '6Dh-RL__uN4', 'ext': 'mp4', 'title': 'bitch lasagna', 'upload_date': '20181005', 'channel_id': 'UC-lHJZR3Gqxm24_Vd_AJ5Yw', 'channel_url': 'http://www.youtube.com/channel/UC-lHJZR3Gqxm24_Vd_AJ5Yw', 'duration': 135, 'description': 'md5:2dbe4051feeff2dab5f41f82bb6d11d0', 'uploader': 'PewDiePie', 'uploader_id': 'PewDiePie', 'uploader_url': 'http://www.youtube.com/user/PewDiePie' } }, { 'url': 'https://web.archive.org/web/http://www.youtube.com/watch?v=kH-G_aIBlFw', 'only_matching': True }, { 'url': 'https://web.archive.org/web/20050214000000_if/http://www.youtube.com/watch?v=0altSZ96U4M', 'only_matching': True }, { # Video not archived, only capture is unavailable video page 'url': 'https://web.archive.org/web/20210530071008/https://www.youtube.com/watch?v=lHJTf93HL1s&spfreload=10', 'only_matching': True }, { # Encoded url 'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fgl%3DUS%26v%3DAkhihxRKcrs%26hl%3Den', 'only_matching': True }, { 'url': 'https://web.archive.org/web/20120712231619/http%3A//www.youtube.com/watch%3Fv%3DAkhihxRKcrs%26gl%3DUS%26hl%3Den', 'only_matching': True }, { 'url': 'https://web.archive.org/web/20060527081937/http://www.youtube.com:80/watch.php?v=ELTFsLT73fA&amp;search=soccer', 'only_matching': True }, { 'url': 'https://web.archive.org/http://www.youtube.com:80/watch?v=-05VVye-ffg', 'only_matching': True } ] _YT_INITIAL_DATA_RE = r'(?:(?:(?:window\s*\[\s*["\']ytInitialData["\']\s*\]|ytInitialData)\s*=\s*({.+?})\s*;)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_DATA_RE _YT_INITIAL_PLAYER_RESPONSE_RE = r'(?:(?:(?:window\s*\[\s*["\']ytInitialPlayerResponse["\']\s*\]|ytInitialPlayerResponse)\s*=[(\s]*({.+?})[)\s]*;)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_PLAYER_RESPONSE_RE _YT_INITIAL_BOUNDARY_RE = r'(?:(?:var\s+meta|</script|\n)|%s)' % YoutubeBaseInfoExtractor._YT_INITIAL_BOUNDARY_RE _YT_DEFAULT_THUMB_SERVERS = ['i.ytimg.com'] # thumbnails most likely archived on these servers _YT_ALL_THUMB_SERVERS = orderedSet( _YT_DEFAULT_THUMB_SERVERS + ['img.youtube.com', *[f'{c}{n or ""}.ytimg.com' for c in ('i', 's') for n in (*range(0, 5), 9)]]) _WAYBACK_BASE_URL = 'https://web.archive.org/web/%sif_/' _OLDEST_CAPTURE_DATE = 20050214000000 _NEWEST_CAPTURE_DATE = 20500101000000 def _call_cdx_api(self, item_id, url, filters: list = None, collapse: list = None, query: dict = None, note='Downloading CDX API JSON'): # CDX docs: https://github.com/internetarchive/wayback/blob/master/wayback-cdx-server/README.md query = { 'url': url, 'output': 'json', 'fl': 'original,mimetype,length,timestamp', 'limit': 500, 'filter': ['statuscode:200'] + (filters or []), 'collapse': collapse or [], **(query or {}) } res = self._download_json('https://web.archive.org/cdx/search/cdx', item_id, note, query=query) if isinstance(res, list) and len(res) >= 2: # format response to make it easier to use return list(dict(zip(res[0], v)) for v in res[1:]) elif not isinstance(res, list) or len(res) != 0: self.report_warning('Error while parsing CDX API response' + bug_reports_message()) def _extract_yt_initial_variable(self, webpage, regex, video_id, name): return self._parse_json(self._search_regex( (r'%s\s*%s' % (regex, self._YT_INITIAL_BOUNDARY_RE), regex), webpage, name, default='{}'), video_id, fatal=False) def _extract_webpage_title(self, webpage): page_title = self._html_search_regex( r'<title>([^<]*)</title>', webpage, 'title', default='') # YouTube video pages appear to always have either 'YouTube -' as prefix or '- YouTube' as suffix. return self._html_search_regex( r'(?:YouTube\s*-\s*(.*)$)|(?:(.*)\s*-\s*YouTube$)', page_title, 'title', default='') def _extract_metadata(self, video_id, webpage): search_meta = ((lambda x: self._html_search_meta(x, webpage, default=None)) if webpage else (lambda x: None)) player_response = self._extract_yt_initial_variable( webpage, self._YT_INITIAL_PLAYER_RESPONSE_RE, video_id, 'initial player response') or {} initial_data = self._extract_yt_initial_variable( webpage, self._YT_INITIAL_DATA_RE, video_id, 'initial player response') or {} initial_data_video = traverse_obj( initial_data, ('contents', 'twoColumnWatchNextResults', 'results', 'results', 'contents', ..., 'videoPrimaryInfoRenderer'), expected_type=dict, get_all=False, default={}) video_details = traverse_obj( player_response, 'videoDetails', expected_type=dict, get_all=False, default={}) microformats = traverse_obj( player_response, ('microformat', 'playerMicroformatRenderer'), expected_type=dict, get_all=False, default={}) video_title = ( video_details.get('title') or YoutubeBaseInfoExtractor._get_text(microformats, 'title') or YoutubeBaseInfoExtractor._get_text(initial_data_video, 'title') or self._extract_webpage_title(webpage) or search_meta(['og:title', 'twitter:title', 'title'])) channel_id = str_or_none( video_details.get('channelId') or microformats.get('externalChannelId') or search_meta('channelId') or self._search_regex( r'data-channel-external-id=(["\'])(?P<id>(?:(?!\1).)+)\1', # @b45a9e6 webpage, 'channel id', default=None, group='id')) channel_url = f'http://www.youtube.com/channel/{channel_id}' if channel_id else None duration = int_or_none( video_details.get('lengthSeconds') or microformats.get('lengthSeconds') or parse_duration(search_meta('duration'))) description = ( video_details.get('shortDescription') or YoutubeBaseInfoExtractor._get_text(microformats, 'description') or clean_html(get_element_by_id('eow-description', webpage)) # @9e6dd23 or search_meta(['description', 'og:description', 'twitter:description'])) uploader = video_details.get('author') # Uploader ID and URL uploader_mobj = re.search( r'<link itemprop="url" href="(?P<uploader_url>https?://www\.youtube\.com/(?:user|channel)/(?P<uploader_id>[^"]+))">', # @fd05024 webpage) if uploader_mobj is not None: uploader_id, uploader_url = uploader_mobj.group('uploader_id'), uploader_mobj.group('uploader_url') else: # @a6211d2 uploader_url = url_or_none(microformats.get('ownerProfileUrl')) uploader_id = self._search_regex( r'(?:user|channel)/([^/]+)', uploader_url or '', 'uploader id', default=None) upload_date = unified_strdate( dict_get(microformats, ('uploadDate', 'publishDate')) or search_meta(['uploadDate', 'datePublished']) or self._search_regex( [r'(?s)id="eow-date.*?>(.*?)</span>', r'(?:id="watch-uploader-info".*?>.*?|["\']simpleText["\']\s*:\s*["\'])(?:Published|Uploaded|Streamed live|Started) on (.+?)[<"\']'], # @7998520 webpage, 'upload date', default=None)) return { 'title': video_title, 'description': description, 'upload_date': upload_date, 'uploader': uploader, 'channel_id': channel_id, 'channel_url': channel_url, 'duration': duration, 'uploader_url': uploader_url, 'uploader_id': uploader_id, } def _extract_thumbnails(self, video_id): try_all = 'thumbnails' in self._configuration_arg('check_all') thumbnail_base_urls = ['http://{server}/vi{webp}/{video_id}'.format( webp='_webp' if ext == 'webp' else '', video_id=video_id, server=server) for server in (self._YT_ALL_THUMB_SERVERS if try_all else self._YT_DEFAULT_THUMB_SERVERS) for ext in (('jpg', 'webp') if try_all else ('jpg',))] thumbnails = [] for url in thumbnail_base_urls: response = self._call_cdx_api( video_id, url, filters=['mimetype:image/(?:webp|jpeg)'], collapse=['urlkey'], query={'matchType': 'prefix'}) if not response: continue thumbnails.extend( { 'url': (self._WAYBACK_BASE_URL % (int_or_none(thumbnail_dict.get('timestamp')) or self._OLDEST_CAPTURE_DATE)) + thumbnail_dict.get('original'), 'filesize': int_or_none(thumbnail_dict.get('length')), 'preference': int_or_none(thumbnail_dict.get('length')) } for thumbnail_dict in response) if not try_all: break self._remove_duplicate_formats(thumbnails) return thumbnails def _get_capture_dates(self, video_id, url_date): capture_dates = [] # Note: CDX API will not find watch pages with extra params in the url. response = self._call_cdx_api( video_id, f'https://www.youtube.com/watch?v={video_id}', filters=['mimetype:text/html'], collapse=['timestamp:6', 'digest'], query={'matchType': 'prefix'}) or [] all_captures = sorted([int_or_none(r['timestamp']) for r in response if int_or_none(r['timestamp']) is not None]) # Prefer the new polymer UI captures as we support extracting more metadata from them # WBM captures seem to all switch to this layout ~July 2020 modern_captures = list(filter(lambda x: x >= 20200701000000, all_captures)) if modern_captures: capture_dates.append(modern_captures[0]) capture_dates.append(url_date) if all_captures: capture_dates.append(all_captures[0]) if 'captures' in self._configuration_arg('check_all'): capture_dates.extend(modern_captures + all_captures) # Fallbacks if any of the above fail capture_dates.extend([self._OLDEST_CAPTURE_DATE, self._NEWEST_CAPTURE_DATE]) return orderedSet(capture_dates) def _real_extract(self, url): url_date, video_id = self._match_valid_url(url).groups() urlh = None try: urlh = self._request_webpage( HEADRequest('https://web.archive.org/web/2oe_/http://wayback-fakeurl.archive.org/yt/%s' % video_id), video_id, note='Fetching archived video file url', expected_status=True) except ExtractorError as e: # HTTP Error 404 is expected if the video is not saved. if isinstance(e.cause, compat_HTTPError) and e.cause.code == 404: self.raise_no_formats( 'The requested video is not archived, indexed, or there is an issue with web.archive.org', expected=True) else: raise capture_dates = self._get_capture_dates(video_id, int_or_none(url_date)) self.write_debug('Captures to try: ' + ', '.join(str(i) for i in capture_dates if i is not None)) info = {'id': video_id} for capture in capture_dates: if not capture: continue webpage = self._download_webpage( (self._WAYBACK_BASE_URL + 'http://www.youtube.com/watch?v=%s') % (capture, video_id), video_id=video_id, fatal=False, errnote='unable to download capture webpage (it may not be archived)', note='Downloading capture webpage') current_info = self._extract_metadata(video_id, webpage or '') # Try avoid getting deleted video metadata if current_info.get('title'): info = merge_dicts(info, current_info) if 'captures' not in self._configuration_arg('check_all'): break info['thumbnails'] = self._extract_thumbnails(video_id) if urlh: url = compat_urllib_parse_unquote(urlh.url) video_file_url_qs = parse_qs(url) # Attempt to recover any ext & format info from playback url & response headers format = {'url': url, 'filesize': int_or_none(urlh.headers.get('x-archive-orig-content-length'))} itag = try_get(video_file_url_qs, lambda x: x['itag'][0]) if itag and itag in YoutubeIE._formats: format.update(YoutubeIE._formats[itag]) format.update({'format_id': itag}) else: mime = try_get(video_file_url_qs, lambda x: x['mime'][0]) ext = (mimetype2ext(mime) or urlhandle_detect_ext(urlh) or mimetype2ext(urlh.headers.get('x-archive-guessed-content-type'))) format.update({'ext': ext}) info['formats'] = [format] if not info.get('duration'): info['duration'] = str_to_int(try_get(video_file_url_qs, lambda x: x['dur'][0])) if not info.get('title'): info['title'] = video_id return info
[ 1, 529, 9507, 29958, 3637, 29918, 11671, 29886, 29914, 21111, 272, 29914, 10867, 990, 29889, 2272, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 337, 13, 5215, 4390, 13, 3166, 869, 9435, 1053, 22140, 5647, 28891, 13, 3166, 869, 19567, 1053, 612, 15907, 8673, 29892, 612, 15907, 5160, 3401, 5647, 28891, 13, 3166, 6317, 12667, 1053, 313, 13, 1678, 10007, 29918, 2271, 1982, 29918, 5510, 29918, 348, 1396, 29892, 13, 1678, 10007, 29918, 2271, 1982, 29918, 5510, 29918, 348, 1396, 29918, 11242, 29892, 13, 1678, 10007, 29918, 10493, 2392, 13, 29897, 13, 3166, 6317, 13239, 1053, 313, 13, 1678, 6494, 29918, 276, 4011, 29918, 4906, 29892, 13, 1678, 5941, 29918, 1420, 29892, 13, 1678, 9657, 29918, 657, 29892, 13, 1678, 6597, 29918, 15697, 29892, 13, 1678, 7338, 28891, 2392, 29892, 13, 1678, 679, 29918, 5029, 29918, 1609, 29918, 333, 29892, 13, 1678, 17714, 3035, 3089, 29892, 13, 1678, 938, 29918, 272, 29918, 9290, 29892, 13, 1678, 476, 6632, 16048, 29918, 12194, 1430, 13381, 29903, 29892, 13, 1678, 10366, 29918, 8977, 29879, 29892, 13, 1678, 286, 17528, 668, 29906, 1062, 29892, 13, 1678, 10372, 2697, 29892, 13, 1678, 6088, 29918, 19708, 29892, 13, 1678, 6088, 29918, 29939, 29879, 29892, 13, 1678, 851, 29918, 517, 29918, 524, 29892, 13, 1678, 851, 29918, 272, 29918, 9290, 29892, 13, 1678, 29370, 29918, 5415, 29892, 13, 1678, 1018, 29918, 657, 29892, 13, 1678, 443, 2164, 29918, 710, 1256, 29892, 13, 1678, 443, 2164, 29918, 16394, 29892, 13, 1678, 3142, 8411, 29918, 4801, 522, 29918, 1062, 29892, 13, 1678, 3142, 29918, 272, 29918, 9290, 13, 29897, 13, 13, 13, 1990, 9000, 2816, 29887, 8673, 29898, 3401, 5647, 28891, 1125, 13, 1678, 7159, 29918, 5813, 353, 525, 10867, 29889, 990, 29915, 13, 1678, 7159, 29918, 2287, 7187, 353, 525, 10867, 29889, 990, 4863, 322, 10348, 29915, 13, 1678, 903, 26707, 29918, 4219, 353, 364, 29915, 991, 29973, 597, 10780, 29901, 1636, 29905, 1846, 29973, 10867, 23301, 990, 29914, 10780, 29901, 14144, 29989, 17987, 6802, 10780, 29925, 29966, 333, 29958, 22896, 29973, 29937, 10062, 5033, 29973, 10834, 29973, 1822, 29930, 6877, 29938, 29915, 13, 1678, 903, 18267, 29903, 353, 15974, 13, 4706, 525, 2271, 2396, 525, 1124, 597, 10867, 29889, 990, 29914, 14144, 29914, 29990, 29928, 29941, 29900, 29900, 29899, 29906, 29941, 29918, 29953, 29947, 16382, 4366, 29879, 29909, 1666, 2842, 29907, 593, 29909, 688, 29950, 7889, 2928, 295, 781, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29947, 2142, 29896, 29881, 29946, 6854, 29946, 29946, 29955, 29929, 29941, 29941, 287, 29941, 29883, 29955, 29888, 29946, 29947, 29955, 29896, 29896, 29953, 29906, 29953, 29900, 29906, 2585, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29990, 29928, 29941, 29900, 29900, 29899, 29906, 29941, 29918, 29953, 29947, 16382, 4366, 29879, 29909, 1666, 2842, 29907, 593, 29909, 688, 29950, 7889, 2928, 295, 781, 742, 13, 9651, 525, 1062, 2396, 525, 468, 29894, 742, 13, 9651, 525, 3257, 2396, 525, 29896, 29929, 29953, 29947, 27819, 448, 383, 29967, 4174, 16377, 4360, 9233, 830, 295, 396, 29896, 742, 13, 9651, 525, 8216, 2396, 525, 3487, 29945, 29901, 1388, 29946, 29945, 29883, 29941, 29946, 29929, 2176, 29900, 29941, 29929, 29888, 29896, 617, 29947, 29900, 29955, 29945, 29906, 29953, 29947, 774, 29896, 29890, 29945, 29883, 29906, 29945, 742, 13, 9651, 525, 14096, 29918, 1256, 2396, 525, 29896, 29929, 29953, 29947, 29896, 29906, 29896, 29900, 742, 13, 9651, 525, 16394, 2396, 29871, 29896, 29906, 29953, 29947, 29953, 29929, 29945, 29906, 29929, 29900, 29892, 13, 9651, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29900, 29900, 29941, 29896, 29945, 742, 13, 9651, 525, 1037, 1061, 2396, 525, 29903, 3960, 4623, 742, 13, 9651, 525, 9009, 261, 2396, 12801, 26862, 6227, 29958, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 29907, 3554, 29896, 29929, 29906, 29906, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29900, 29947, 29953, 29929, 29900, 29900, 29900, 29890, 29946, 346, 29906, 29953, 29945, 29872, 29947, 1113, 29953, 29906, 29955, 29941, 29947, 29890, 29941, 29941, 29953, 29890, 29906, 29953, 29947, 29874, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29907, 3554, 29896, 29929, 29906, 29906, 742, 13, 9651, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 9651, 525, 3257, 2396, 525, 29933, 5402, 4813, 14114, 20333, 29879, 376, 29907, 3554, 29908, 313, 29896, 29929, 29906, 29906, 29897, 742, 13, 9651, 525, 8216, 2396, 525, 3487, 29945, 29901, 29946, 29941, 29874, 29953, 29900, 29941, 11512, 29953, 29883, 29945, 29890, 29946, 29890, 29929, 29900, 29881, 29896, 29906, 29874, 29929, 29953, 29890, 29929, 29906, 29896, 29906, 29896, 29906, 29890, 29929, 29883, 742, 13, 9651, 525, 9009, 261, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 16394, 2396, 29871, 29896, 29941, 29947, 29955, 29953, 29929, 29929, 29953, 29906, 29929, 29892, 13, 9651, 525, 9009, 29918, 1256, 2396, 376, 29906, 29900, 29896, 29941, 29896, 29906, 29906, 29906, 613, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 1124, 597, 10867, 29889, 990, 29914, 17987, 29914, 29990, 29928, 29941, 29900, 29900, 29899, 29906, 29941, 29918, 29953, 29947, 16382, 4366, 29879, 29909, 1666, 2842, 29907, 593, 29909, 688, 29950, 7889, 2928, 295, 781, 742, 13, 4706, 525, 6194, 29918, 4352, 292, 2396, 5852, 29892, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 29923, 1464, 29918, 3253, 29879, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29906, 29947, 29946, 29896, 29947, 29900, 29872, 29947, 29945, 29955, 29896, 29953, 29900, 6854, 29947, 29953, 29953, 29941, 29945, 29947, 29955, 29900, 29900, 29890, 370, 29953, 29953, 29947, 29874, 29941, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29923, 1464, 29918, 3253, 29879, 29914, 1523, 1050, 1455, 29899, 29967, 29943, 29968, 29896, 29929, 29953, 29900, 29923, 1464, 3253, 29907, 1160, 8729, 29967, 292, 280, 29889, 1526, 29887, 742, 13, 9651, 525, 3257, 2396, 525, 1523, 1050, 1455, 29899, 29967, 29943, 29968, 29896, 29929, 29953, 29900, 29923, 1464, 3253, 29907, 1160, 8729, 29967, 292, 280, 29889, 1526, 29887, 742, 13, 9651, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 29923, 1464, 29918, 3253, 29879, 29914, 1523, 1050, 1455, 29899, 29940, 28778, 29896, 29929, 29953, 29900, 29923, 1464, 3253, 29911, 820, 265, 3206, 1947, 29889, 1526, 29887, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29955, 29929, 29896, 29945, 29906, 29896, 29941, 1389, 29900, 29906, 29945, 29945, 29929, 29890, 29945, 29945, 29900, 29896, 1725, 29953, 29941, 29900, 29872, 29896, 29874, 29945, 29941, 29888, 29945, 29929, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29923, 1464, 29918, 3253, 29879, 29914, 1523, 1050, 1455, 29899, 29940, 28778, 29896, 29929, 29953, 29900, 29923, 1464, 3253, 29911, 820, 265, 3206, 1947, 29889, 1526, 29887, 742, 13, 9651, 525, 3257, 2396, 525, 1523, 1050, 1455, 29899, 29940, 28778, 29896, 29929, 29953, 29900, 29923, 1464, 3253, 29911, 820, 265, 3206, 1947, 29889, 1526, 29887, 742, 13, 9651, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 9651, 525, 16394, 2396, 29871, 29896, 29906, 29900, 29945, 29945, 29947, 29947, 29900, 29946, 29945, 29892, 13, 9651, 525, 9009, 261, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 8216, 2396, 525, 29896, 29929, 29953, 29900, 7178, 616, 7259, 8729, 382, 1464, 422, 1050, 455, 1338, 529, 5813, 10202, 529, 5813, 29958, 742, 13, 9651, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29900, 29947, 29900, 29941, 29896, 29945, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29889, 845, 545, 29945, 29955, 29889, 1655, 9852, 265, 29889, 29906, 29929, 29941, 29900, 29941, 29889, 29888, 4620, 29896, 29953, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29955, 29881, 29900, 29955, 600, 29890, 29946, 29906, 5363, 29953, 29945, 29941, 29955, 29883, 29906, 29947, 29872, 29900, 29945, 29941, 1389, 29874, 29946, 29890, 29945, 29946, 29883, 29929, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29889, 845, 545, 29945, 29955, 29889, 1655, 9852, 265, 29889, 29906, 29929, 29941, 29900, 29941, 29889, 29888, 4620, 29896, 29953, 29914, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29881, 29900, 29896, 29873, 29900, 29896, 29889, 29888, 4620, 742, 13, 9651, 525, 3257, 2396, 525, 27407, 292, 742, 13, 9651, 525, 1062, 2396, 525, 29888, 4620, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29889, 845, 545, 29945, 29955, 29889, 1655, 9852, 265, 29889, 29906, 29929, 29941, 29900, 29941, 29889, 29888, 4620, 29896, 29953, 29914, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29881, 29900, 29896, 29873, 29900, 29955, 29889, 29888, 4620, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29874, 29900, 29955, 2252, 29947, 29883, 29953, 370, 29946, 3905, 29896, 29945, 29953, 29900, 29888, 29947, 29874, 29900, 29900, 29906, 29896, 29955, 29896, 29955, 29896, 29941, 29900, 29888, 29941, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29889, 845, 545, 29945, 29955, 29889, 1655, 9852, 265, 29889, 29906, 29929, 29941, 29900, 29941, 29889, 29888, 4620, 29896, 29953, 29914, 29887, 29881, 29896, 29929, 29955, 29955, 29899, 29900, 29945, 29899, 29900, 29947, 29881, 29900, 29896, 29873, 29900, 29955, 29889, 29888, 4620, 742, 13, 9651, 525, 3257, 2396, 525, 2772, 284, 742, 13, 9651, 525, 1062, 2396, 525, 29888, 4620, 742, 13, 9651, 525, 16394, 2396, 29871, 29896, 29906, 29900, 29945, 29947, 29929, 29945, 29953, 29906, 29946, 29892, 13, 9651, 525, 9009, 261, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 8216, 2396, 525, 3487, 29945, 29901, 29953, 29874, 29941, 29896, 29888, 29896, 29929, 29929, 29953, 2585, 29900, 7340, 29900, 13801, 29929, 1388, 29953, 29881, 29953, 29872, 29955, 29900, 29947, 29874, 29896, 1327, 29900, 742, 13, 9651, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29900, 29947, 29900, 29941, 29896, 29929, 742, 13, 9651, 525, 5479, 2396, 525, 29933, 442, 265, 6573, 448, 11655, 514, 3014, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 22833, 29918, 1552, 29899, 23596, 29899, 974, 29899, 29878, 1558, 423, 29918, 5927, 681, 29899, 442, 2879, 29899, 29874, 29899, 1278, 653, 273, 29899, 744, 29916, 3825, 29899, 12873, 638, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29955, 10702, 29900, 29896, 29929, 2291, 29874, 29929, 29890, 29941, 29941, 29906, 29872, 29947, 29906, 11248, 29955, 29883, 29896, 29900, 29946, 29900, 29941, 562, 29881, 29896, 29947, 29900, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 22833, 29918, 1552, 29899, 23596, 29899, 974, 29899, 29878, 1558, 423, 29918, 5927, 681, 29899, 442, 2879, 29899, 29874, 29899, 1278, 653, 273, 29899, 744, 29916, 3825, 29899, 12873, 638, 29914, 2218, 29883, 29896, 29914, 29900, 29896, 29889, 29900, 29896, 29889, 350, 10071, 4587, 27411, 586, 29889, 1526, 29941, 742, 13, 9651, 525, 3257, 2396, 525, 29933, 10071, 4587, 27411, 586, 742, 13, 9651, 525, 1062, 2396, 525, 1526, 29941, 742, 13, 4706, 2981, 13, 1678, 2981, 426, 13, 4706, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 29914, 22833, 29918, 1552, 29899, 23596, 29899, 974, 29899, 29878, 1558, 423, 29918, 5927, 681, 29899, 442, 2879, 29899, 29874, 29899, 1278, 653, 273, 29899, 744, 29916, 3825, 29899, 12873, 638, 29914, 2218, 29883, 29896, 29914, 29900, 29906, 29889, 29900, 29906, 29889, 29974, 29903, 549, 29974, 2855, 29974, 1451, 16566, 29974, 797, 29974, 1576, 29974, 7713, 586, 1691, 713, 29974, 29907, 1160, 29974, 4591, 29974, 29995, 29906, 29906, 4040, 1239, 29974, 29902, 21208, 29995, 29906, 29906, 17108, 2865, 29974, 29906, 29995, 29906, 29907, 29974, 23472, 29974, 29896, 467, 1526, 29941, 742, 13, 4706, 525, 3487, 29945, 2396, 525, 29896, 29881, 29900, 29874, 4302, 29900, 29941, 287, 1113, 29947, 29941, 1113, 29945, 29947, 29881, 29929, 287, 29941, 29890, 29946, 29929, 29941, 29874, 29941, 29883, 29941, 742, 13, 4706, 525, 3888, 29918, 8977, 2396, 426, 13, 9651, 525, 333, 2396, 525, 22833, 29918, 1552, 29899, 23596, 29899, 974, 29899, 29878, 1558, 423, 29918, 5927, 681, 29899, 442, 2879, 29899, 29874, 29899, 1278, 653, 273, 29899, 744, 29916, 3825, 29899, 12873, 638, 29914, 2218, 29883, 29896, 29914, 29900, 29906, 29889, 29900, 29906, 29889, 9362, 1126, 678, 16566, 512, 450, 2043, 586, 1691, 713, 7259, 3645, 376, 4040, 1239, 12815, 272, 29908, 313, 2865, 29871, 29906, 29892, 2522, 1600, 29871, 29896, 467, 1526, 29941, 742, 13, 9651, 525, 3257, 2396, 525, 29903, 549, 1126, 678, 16566, 512, 450, 2043, 586, 1691, 713, 7259, 3645, 376, 4040, 1239, 12815, 272, 29908, 313, 2865, 29871, 29906, 29892, 2522, 1600, 29871, 29896, 29897, 742, 13, 9651, 525, 1062, 2396, 525, 1526, 29941, 742, 13, 9651, 525, 16394, 2396, 29871, 29896, 29945, 29953, 29929, 29953, 29953, 29906, 29945, 29947, 29955, 29892, 13, 9651, 525, 9009, 261, 2396, 12801, 26862, 6227, 29958, 742, 13, 9651, 525, 8216, 2396, 525, 3487, 29945, 29901, 29900, 29896, 29906, 29890, 29906, 29881, 29953, 29953, 29947, 3660, 29955, 29945, 29941, 915, 29941, 29953, 29947, 29929, 29953, 29888, 29941, 29946, 29941, 29881, 29896, 29906, 29874, 29906, 29941, 29953, 742, 13, 9651, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29929, 29900, 29929, 29906, 29947, 742, 13, 4706, 2981, 13, 1678, 500, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 1456, 1761, 29918, 1272, 29898, 2676, 3488, 1125, 13, 4706, 1543, 353, 337, 29889, 2886, 497, 29898, 29878, 12008, 10780, 10351, 29897, 13, 9651, 529, 2080, 13, 9651, 22308, 3583, 29879, 29974, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29901, 3032, 29899, 10062, 10780, 9361, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29901, 3032, 29899, 14178, 29989, 543, 22896, 3108, 20605, 29989, 2433, 22896, 2033, 29930, 29915, 29989, 876, 29930, 29973, 13, 9651, 320, 29879, 29974, 1990, 29922, 1839, 3108, 29973, 1315, 29899, 1456, 29947, 29899, 1456, 1761, 1839, 3108, 29973, 13, 9651, 22308, 3583, 29879, 29974, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29901, 3032, 29899, 10062, 10780, 9361, 29961, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 29901, 3032, 29899, 14178, 29989, 543, 22896, 3108, 20605, 29989, 2433, 22896, 2033, 29930, 29915, 29989, 876, 29930, 29973, 13, 9651, 320, 29879, 29930, 3779, 13, 4706, 6629, 742, 24499, 9601, 29900, 29962, 13, 13, 4706, 736, 4390, 29889, 18132, 29898, 21111, 29918, 15697, 29898, 5029, 29897, 1839, 1767, 11287, 13, 13, 1678, 822, 903, 6370, 29918, 21111, 29898, 1311, 29892, 3142, 1125, 13, 4706, 4863, 29918, 333, 353, 10007, 29918, 2271, 1982, 29918, 5510, 29918, 348, 1396, 29918, 11242, 29898, 1311, 3032, 4352, 29918, 333, 29898, 2271, 876, 13, 4706, 15882, 29892, 6251, 29918, 333, 353, 313, 9641, 29918, 333, 29889, 5451, 11219, 742, 29871, 29896, 29897, 718, 518, 8516, 2314, 7503, 29906, 29962, 13, 13, 4706, 396, 9000, 29889, 990, 15562, 3450, 1838, 29915, 29873, 9436, 1261, 5666, 403, 1708, 1761, 9976, 13, 4706, 396, 470, 1014, 3257, 16257, 29892, 577, 591, 679, 963, 515, 278, 8297, 29881, 519, 4847, 29889, 13, 4706, 8297, 29918, 3488, 353, 1583, 3032, 10382, 29918, 2676, 3488, 29898, 13, 9651, 525, 991, 597, 10867, 29889, 990, 29914, 17987, 22208, 718, 15882, 29892, 15882, 29897, 13, 4706, 1708, 1761, 353, 1583, 3032, 1456, 1761, 29918, 1272, 29898, 17987, 29918, 3488, 29897, 13, 13, 4706, 9976, 353, 6571, 13, 4706, 363, 282, 297, 1708, 1761, 29901, 13, 9651, 396, 960, 278, 1404, 6790, 263, 1708, 1761, 6251, 297, 278, 3988, 29892, 11455, 278, 13, 9651, 396, 1791, 310, 278, 1708, 1761, 29889, 13, 9651, 565, 6251, 29918, 333, 322, 282, 1839, 12683, 2033, 2804, 6251, 29918, 333, 29901, 13, 18884, 6773, 13, 13, 9651, 9976, 29961, 29886, 1839, 12683, 2033, 29962, 353, 426, 13, 18884, 525, 689, 1446, 2396, 19997, 13, 18884, 525, 386, 17771, 2234, 2396, 19997, 13, 18884, 525, 442, 391, 2396, 282, 29889, 657, 877, 442, 391, 5477, 13, 18884, 525, 11294, 2396, 282, 29889, 657, 877, 3257, 5477, 13, 18884, 525, 1491, 23545, 793, 2396, 426, 930, 13, 13, 9651, 363, 5702, 297, 282, 29889, 657, 877, 3018, 4684, 742, 5159, 1125, 13, 18884, 565, 5702, 1839, 14380, 2033, 2804, 525, 1491, 23545, 793, 2396, 13, 462, 1678, 6773, 13, 13, 18884, 9976, 29961, 29886, 1839, 12683, 2033, 3816, 11294, 1839, 1643, 2033, 29962, 353, 426, 13, 462, 1678, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 22208, 718, 5702, 1839, 1445, 13359, 29880, 17010, 11219, 1495, 29913, 13, 13, 4706, 15562, 353, 1583, 3032, 10382, 29918, 3126, 29898, 13, 9651, 525, 1124, 597, 10867, 29889, 990, 29914, 19635, 22208, 718, 15882, 29892, 15882, 29897, 13, 4706, 286, 353, 15562, 1839, 19635, 2033, 13, 4706, 15882, 353, 286, 1839, 25378, 2033, 13, 13, 4706, 5235, 353, 426, 13, 9651, 525, 333, 2396, 15882, 29892, 13, 9651, 525, 3257, 2396, 286, 1839, 3257, 7464, 13, 9651, 525, 8216, 2396, 5941, 29918, 1420, 29898, 29885, 29889, 657, 877, 8216, 1495, 511, 13, 9651, 525, 9009, 261, 2396, 9657, 29918, 657, 29898, 29885, 29892, 6024, 9009, 261, 742, 525, 328, 672, 2033, 511, 13, 9651, 525, 1037, 1061, 2396, 286, 29889, 657, 877, 1037, 1061, 5477, 13, 9651, 525, 506, 1947, 2396, 286, 29889, 657, 877, 506, 1947, 2271, 5477, 13, 9651, 525, 14096, 29918, 1256, 2396, 443, 2164, 29918, 710, 1256, 29898, 29885, 29889, 657, 877, 1256, 1495, 511, 13, 9651, 525, 16394, 2396, 443, 2164, 29918, 16394, 29898, 8977, 29918, 657, 29898, 29885, 29892, 6024, 3597, 1256, 742, 525, 23959, 1256, 2033, 8243, 13, 9651, 525, 2676, 3488, 29918, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 14144, 22208, 718, 15882, 29892, 13, 9651, 525, 5479, 2396, 286, 29889, 657, 877, 9947, 5477, 13, 9651, 525, 14096, 29918, 6360, 2396, 938, 29918, 272, 29918, 9290, 29898, 29885, 29889, 657, 877, 6360, 8785, 29913, 13, 13, 4706, 363, 285, 297, 15562, 1839, 5325, 2033, 29901, 13, 9651, 565, 285, 1839, 978, 2033, 297, 9976, 29901, 13, 18884, 9976, 29961, 29888, 1839, 978, 2033, 29962, 353, 10366, 29918, 8977, 29879, 29898, 26586, 29961, 29888, 1839, 978, 2033, 1402, 426, 13, 462, 1678, 525, 333, 2396, 15882, 718, 8207, 29915, 718, 285, 1839, 978, 7464, 13, 462, 1678, 525, 3257, 2396, 285, 29889, 657, 877, 3257, 1495, 470, 285, 1839, 978, 7464, 13, 462, 1678, 525, 4990, 29918, 333, 2396, 285, 1839, 978, 7464, 13, 462, 1678, 525, 8216, 2396, 5941, 29918, 1420, 29898, 29888, 29889, 657, 877, 8216, 1495, 511, 13, 462, 1678, 525, 1037, 1061, 2396, 285, 29889, 657, 877, 1037, 1061, 5477, 13, 462, 1678, 525, 19708, 2396, 6088, 29918, 19708, 29898, 29888, 29889, 657, 877, 2848, 1495, 511, 13, 462, 1678, 525, 11294, 29918, 4537, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 11294, 1495, 511, 13, 462, 1678, 525, 10336, 2396, 285, 29889, 657, 877, 10336, 5477, 13, 462, 1678, 525, 2218, 29883, 4537, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2218, 29883, 1495, 511, 13, 462, 1678, 525, 14096, 29918, 6360, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 6360, 8785, 1800, 13, 18884, 6251, 353, 9976, 29961, 29888, 1839, 978, 2033, 29962, 13, 9651, 25342, 285, 29889, 657, 877, 13492, 1495, 297, 9976, 29901, 13, 18884, 6251, 353, 9976, 29961, 29888, 1839, 13492, 2033, 29962, 13, 9651, 1683, 29901, 13, 18884, 6773, 13, 13, 9651, 565, 285, 29889, 657, 877, 4830, 1495, 1275, 525, 1349, 21145, 2396, 13, 18884, 6251, 1839, 386, 17771, 2234, 13359, 4397, 3319, 13, 462, 1678, 525, 333, 2396, 285, 1839, 978, 7464, 13, 462, 1678, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 10382, 22208, 718, 15882, 718, 8207, 29915, 718, 285, 1839, 978, 7464, 13, 462, 1678, 525, 2103, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2103, 1495, 511, 13, 462, 1678, 525, 3545, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2103, 1495, 511, 13, 462, 1678, 525, 5325, 675, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2311, 8785, 1800, 13, 13, 9651, 6081, 353, 313, 29888, 1839, 978, 13359, 2288, 2830, 12839, 742, 29871, 29896, 29897, 718, 518, 8516, 2314, 29961, 29896, 29962, 13, 9651, 565, 6081, 297, 476, 6632, 16048, 29918, 12194, 1430, 13381, 29903, 29901, 13, 18884, 6251, 1839, 689, 1446, 13359, 4397, 3319, 13, 462, 1678, 525, 2271, 2396, 525, 991, 597, 10867, 29889, 990, 29914, 10382, 22208, 718, 15882, 718, 8207, 29915, 718, 285, 1839, 978, 7464, 13, 462, 1678, 525, 4830, 2396, 285, 29889, 657, 877, 4830, 5477, 13, 462, 1678, 525, 2103, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2103, 1495, 511, 13, 462, 1678, 525, 3545, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 3545, 1495, 511, 13, 462, 1678, 525, 5325, 675, 2396, 938, 29918, 272, 29918, 9290, 29898, 29888, 29889, 657, 877, 2311, 1495, 511, 13, 462, 1678, 525, 20464, 2396, 525, 991, 29915, 1800, 13, 13, 4706, 396, 20025, 3625, 21971, 491, 2066, 675, 13, 4706, 363, 6251, 297, 9976, 29889, 5975, 7295, 13, 9651, 6251, 1839, 689, 1446, 2033, 353, 1051, 29898, 24582, 29898, 8269, 1839, 689, 1446, 7464, 1820, 29922, 2892, 921, 29901, 921, 29889, 657, 877, 5325, 675, 742, 448, 29896, 4961, 13, 13, 4706, 565, 7431, 29898, 26586, 29897, 1275, 29871, 29896, 29901, 13, 9651, 396, 960, 727, 29915, 29879, 871, 697, 2944, 29892, 671, 372, 408, 278, 1667, 5235, 9657, 13, 9651, 871, 29918, 9641, 353, 9976, 29961, 1761, 29898, 26586, 29889, 8149, 3101, 29961, 29900, 5262, 13, 9651, 565, 6251, 29918, 333, 29901, 13, 18884, 5235, 353, 10366, 29918, 8977, 29879, 29898, 6194, 29918, 9641, 29892, 5235, 29897, 13, 9651, 1683, 29901, 13, 18884, 5235, 353, 10366, 29918, 8977, 29879, 29898, 3888, 29892, 871, 29918, 9641, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 13466, 29892, 591, 505, 263, 1708, 1761, 29889, 13, 9651, 5235, 1839, 29918, 1853, 2033, 353, 525, 1456, 1761, 29915, 13, 9651, 5235, 1839, 26586, 2033, 353, 1051, 29898, 26586, 29889, 5975, 3101, 13, 13, 4706, 565, 15562, 29889, 657, 877, 276, 7406, 29374, 13, 9651, 5235, 1839, 21032, 2033, 353, 5159, 13, 9651, 363, 9076, 297, 15562, 1839, 276, 7406, 2033, 29901, 13, 18884, 5235, 1839, 21032, 13359, 4397, 3319, 13, 462, 1678, 525, 333, 2396, 9076, 29889, 657, 877, 27828, 29918, 333, 5477, 13, 462, 1678, 525, 8921, 2396, 9076, 29889, 657, 877, 13478, 15580, 5477, 13, 462, 1678, 525, 726, 2396, 851, 29918, 272, 29918, 9290, 29898, 27828, 29889, 657, 877, 27828, 3257, 5477, 27255, 718, 11297, 29876, 29905, 29876, 29915, 718, 9076, 29889, 657, 877, 27828, 2587, 5477, 13, 462, 1678, 525, 16394, 2396, 443, 2164, 29918, 16394, 29898, 27828, 29889, 657, 877, 11600, 403, 1495, 511, 13, 462, 1678, 525, 3560, 2396, 525, 4632, 29915, 1800, 13, 13, 4706, 736, 5235, 13, 13, 13, 1990, 612, 15907, 3609, 13197, 573, 8673, 29898, 3401, 5647, 28891, 1125, 13, 1678, 7159, 29918, 5813, 353, 525, 2676, 29889, 10867, 29901, 19567, 29915, 13, 1678, 7159, 29918, 2287, 7187, 353, 525, 2676, 29889, 10867, 29889, 990, 7160, 366, 29873, 4003, 19707, 29915, 13, 1678, 903, 26707, 29918, 4219, 353, 364, 15945, 29908, 10780, 29916, 4887, 13, 18884, 22308, 29901, 991, 29973, 597, 6877, 2676, 23301, 10867, 23301, 990, 29914, 13, 462, 1678, 22308, 29901, 2676, 4551, 29973, 13, 462, 1678, 22308, 5919, 29973, 29925, 29966, 1256, 24566, 29900, 29899, 29929, 3199, 29896, 29946, 1800, 29973, 29961, 29900, 29899, 29929, 29909, 29899, 29999, 29874, 29899, 29920, 24563, 29962, 3877, 6877, 29871, 396, 847, 2676, 322, 278, 1873, 2380, 338, 13136, 13, 13, 18884, 22308, 29901, 991, 29973, 10780, 1057, 29989, 29995, 29941, 29961, 29909, 29874, 2314, 458, 6877, 13, 18884, 22308, 29901, 13, 462, 1678, 22308, 3583, 29893, 3124, 1846, 29973, 19567, 23301, 510, 10780, 1057, 10780, 29901, 29947, 29900, 29989, 29946, 29946, 29941, 876, 29973, 29914, 12344, 10780, 3583, 29889, 1961, 6877, 10780, 3583, 29973, 29989, 29995, 29941, 29961, 29888, 29943, 2314, 10780, 10834, 3823, 29937, 10062, 10780, 29901, 29987, 29989, 29995, 29906, 29953, 876, 29973, 29894, 10780, 9361, 29989, 29995, 29941, 29961, 29881, 29928, 2314, 29871, 396, 612, 15907, 3988, 13, 462, 1678, 891, 10780, 29901, 1582, 1627, 29899, 29888, 1296, 2271, 23301, 10867, 23301, 990, 29914, 3637, 4551, 29871, 396, 1394, 278, 7463, 25713, 3142, 13, 18884, 1723, 13, 18884, 22308, 29925, 29966, 333, 24566, 29900, 29899, 29929, 29909, 29899, 29999, 29874, 29899, 29920, 29918, 29899, 3199, 29896, 29896, 1800, 10780, 16664, 29906, 29953, 4295, 29937, 29989, 29987, 29989, 10931, 13, 18884, 9995, 13, 13, 1678, 903, 18267, 29903, 353, 518, 13, 4706, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29945, 29900, 29946, 29896, 29945, 29900, 29900, 29906, 29941, 29946, 29896, 29914, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29874, 29979, 29909, 7210, 29896, 29896, 29979, 29878, 29903, 29879, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29874, 29979, 29909, 7210, 29896, 29896, 29979, 29878, 29903, 29879, 742, 13, 18884, 525, 1062, 2396, 525, 2676, 29885, 742, 13, 18884, 525, 3257, 2396, 525, 19409, 7236, 1253, 29871, 29906, 448, 8564, 29894, 436, 267, 29991, 742, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29946, 29929, 29947, 29946, 29883, 29900, 29888, 29929, 29874, 29900, 29955, 29888, 29941, 29946, 29929, 13801, 29945, 29881, 29947, 29872, 29947, 29906, 370, 29955, 2142, 29946, 29872, 2142, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29896, 29900, 29929, 29906, 29953, 742, 13, 18884, 525, 9009, 261, 2396, 525, 24625, 545, 29880, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 2679, 29733, 24704, 29928, 29899, 29890, 29968, 29941, 262, 29918, 29886, 29968, 7810, 29950, 29929, 29923, 29887, 742, 13, 18884, 525, 19708, 2396, 29871, 29941, 29906, 29892, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 24625, 545, 29880, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 24625, 545, 29880, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 512, 1890, 1544, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 7297, 29914, 1124, 597, 1582, 1627, 29899, 29888, 1296, 2271, 29889, 10867, 29889, 990, 29914, 3637, 29914, 29929, 29955, 29873, 29955, 29990, 29926, 29918, 29875, 29933, 29894, 29900, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29929, 29955, 29873, 29955, 29990, 29926, 29918, 29875, 29933, 29894, 29900, 742, 13, 18884, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 18884, 525, 3257, 2396, 525, 11008, 17197, 1475, 2193, 350, 355, 4683, 26965, 742, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29900, 29900, 29946, 29900, 29946, 2176, 29906, 29883, 29953, 29941, 29906, 29881, 29896, 29953, 29874, 29953, 29955, 29946, 600, 29947, 2176, 29896, 687, 29888, 1327, 29953, 29883, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29929, 29900, 29941, 29896, 29906, 742, 13, 18884, 525, 9009, 261, 2396, 525, 6565, 16628, 1974, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 29965, 3210, 1460, 29888, 29924, 26461, 29934, 29934, 29954, 29896, 29884, 29899, 29906, 29924, 29879, 4176, 29890, 29990, 29909, 742, 13, 18884, 525, 19708, 2396, 29871, 29955, 29955, 29896, 29892, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29896, 369, 16628, 1974, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29896, 369, 16628, 1974, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 13987, 515, 29871, 29906, 29900, 29896, 29906, 29892, 1856, 29885, 3402, 372, 351, 29871, 29946, 29945, 29889, 1570, 342, 10446, 338, 11132, 4863, 29892, 411, 385, 8340, 6139, 29889, 13, 9651, 396, 10575, 671, 278, 2635, 297, 278, 1544, 29889, 18527, 10614, 411, 17411, 612, 15907, 4286, 8868, 545, 756, 6139, 297, 321, 340, 29899, 8216, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29906, 29900, 29955, 29896, 29906, 29906, 29941, 29896, 29953, 29896, 29929, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29909, 29895, 2918, 29882, 29916, 29934, 29968, 29883, 2288, 29987, 3820, 29922, 3308, 29987, 4415, 29922, 264, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29909, 29895, 2918, 29882, 29916, 29934, 29968, 29883, 2288, 742, 13, 18884, 525, 1062, 2396, 525, 2676, 29885, 742, 13, 18884, 525, 3257, 2396, 525, 29931, 326, 1573, 7525, 29901, 12125, 29877, 20333, 29879, 14624, 24300, 29871, 29896, 310, 29871, 29941, 313, 7230, 4174, 29871, 29906, 29900, 29896, 29906, 29897, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29906, 29900, 29955, 29896, 29906, 742, 13, 18884, 525, 19708, 2396, 29871, 29941, 29929, 29947, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 600, 29946, 311, 29953, 29874, 29955, 29929, 29947, 29900, 10702, 29953, 29945, 29881, 29929, 29945, 29896, 29883, 29906, 29888, 29953, 29929, 29953, 29953, 29874, 29946, 29888, 29906, 29888, 29941, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29885, 496, 262, 2946, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29885, 496, 262, 2946, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 383, 29931, 29963, 4863, 29889, 13987, 934, 3988, 947, 451, 3867, 372, 351, 2472, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29900, 29947, 29896, 29906, 29896, 29896, 29896, 29900, 29941, 29945, 29941, 29953, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29926, 29940, 29984, 29990, 2477, 29929, 5667, 29934, 29893, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29926, 29940, 29984, 29990, 2477, 29929, 5667, 29934, 29893, 742, 13, 18884, 525, 1062, 2396, 525, 1579, 29894, 742, 13, 18884, 525, 3257, 2396, 525, 6816, 472, 278, 22424, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29900, 29945, 29900, 29946, 29906, 29941, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29946, 29984, 711, 29965, 29953, 1254, 18426, 29900, 29925, 29955, 29896, 13427, 29894, 29949, 20728, 29945, 29909, 742, 13, 18884, 525, 19708, 2396, 29871, 29896, 29929, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29896, 29900, 29946, 29941, 29953, 29890, 29896, 29906, 29872, 29900, 29955, 562, 29946, 29941, 600, 29947, 2176, 29953, 29945, 29906, 29947, 29955, 29874, 29945, 29953, 1389, 29890, 29946, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29926, 1450, 287, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29926, 1450, 287, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29896, 29900, 29955, 29896, 29906, 29906, 29941, 29896, 29946, 29900, 29955, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29880, 29911, 29916, 29941, 29954, 29953, 29882, 29906, 3594, 29909, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29880, 29911, 29916, 29941, 29954, 29953, 29882, 29906, 3594, 29909, 742, 13, 18884, 525, 1062, 2396, 525, 1579, 29894, 742, 13, 18884, 525, 3257, 2396, 525, 29924, 1943, 265, 448, 6977, 14062, 313, 9258, 286, 1161, 786, 29897, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29896, 29900, 29955, 29896, 29896, 742, 13, 18884, 525, 9009, 261, 2396, 525, 29924, 1943, 265, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29939, 5773, 29940, 29888, 29941, 29925, 29876, 29945, 29931, 29955, 6739, 29940, 2120, 1660, 29872, 29949, 29941, 29893, 742, 13, 18884, 525, 19708, 2396, 29871, 29906, 29900, 29946, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29888, 29955, 29945, 29941, 29945, 29941, 29946, 29941, 29890, 29953, 8710, 29941, 29946, 29874, 29941, 29896, 29946, 12352, 29947, 29890, 29947, 29945, 29946, 29946, 29946, 29953, 29947, 29900, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 1169, 26350, 265, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 1169, 26350, 265, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 3824, 10446, 338, 310, 7123, 4863, 29892, 1473, 338, 278, 23947, 515, 7307, 29990, 2933, 29889, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29896, 29967, 29979, 329, 13427, 29947, 29949, 29953, 29923, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29896, 29967, 29979, 329, 13427, 29947, 29949, 29953, 29923, 742, 13, 18884, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 18884, 525, 3257, 2396, 525, 29943, 1296, 1920, 264, 15460, 624, 5357, 267, 319, 12739, 1177, 29991, 448, 15511, 368, 1334, 1823, 10130, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29953, 29900, 29906, 29896, 29947, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29881, 29902, 29874, 11601, 279, 29882, 29920, 8547, 29990, 8120, 3112, 29920, 29955, 29933, 29950, 20449, 742, 13, 18884, 525, 19708, 2396, 29871, 29896, 29906, 29941, 29953, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29906, 29896, 29900, 29941, 29906, 2291, 29872, 29955, 29941, 29953, 29946, 29906, 29896, 29872, 29947, 29929, 29883, 29906, 287, 29888, 29941, 29953, 29881, 29896, 29929, 29941, 29953, 29929, 29946, 29955, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29924, 496, 262, 2946, 2544, 29907, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29924, 496, 262, 2946, 2544, 29907, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 3824, 10446, 310, 7123, 4863, 29892, 10446, 2635, 297, 1544, 2988, 304, 7123, 10446, 29889, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29947, 29900, 29947, 29900, 29941, 29906, 29906, 29896, 29929, 29946, 29945, 29914, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29953, 29943, 4819, 29999, 29967, 29954, 29894, 29888, 29946, 29923, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29953, 29943, 4819, 29999, 29967, 29954, 29894, 29888, 29946, 29923, 742, 13, 18884, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 18884, 525, 3257, 2396, 525, 29956, 8969, 29901, 13987, 12482, 12074, 997, 3322, 350, 1672, 29968, 1430, 29973, 29991, 448, 323, 29889, 29965, 29889, 29954, 29889, 29903, 29889, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29953, 29900, 29906, 29896, 29929, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29881, 29902, 29874, 11601, 279, 29882, 29920, 8547, 29990, 8120, 3112, 29920, 29955, 29933, 29950, 20449, 742, 13, 18884, 525, 19708, 2396, 29871, 29955, 29929, 29947, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29874, 29896, 29881, 1635, 29896, 29906, 29881, 29929, 29874, 29941, 6448, 29955, 10702, 29946, 29883, 29945, 29872, 29941, 29941, 29890, 29906, 29955, 29881, 29955, 29955, 17615, 29955, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29924, 496, 262, 2946, 2544, 29907, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29924, 496, 262, 2946, 2544, 29907, 29915, 13, 9651, 2981, 13, 9651, 525, 9684, 29918, 25442, 886, 2396, 518, 13, 18884, 364, 29915, 348, 519, 304, 5142, 10446, 24499, 4269, 277, 1122, 451, 367, 3190, 2347, 7244, 29915, 13, 9651, 4514, 13, 4706, 2981, 426, 259, 396, 18064, 2030, 14711, 1813, 29892, 756, 448, 14711, 297, 3611, 29889, 13, 9651, 525, 2271, 2396, 525, 1124, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29900, 29955, 29900, 29941, 29900, 29906, 29900, 29896, 29896, 29900, 29946, 29946, 29914, 1124, 597, 19567, 29889, 510, 29914, 12344, 29973, 29894, 10457, 29900, 29953, 29899, 26067, 29929, 12188, 29920, 29887, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 17411, 29900, 29953, 29899, 26067, 29929, 12188, 29920, 29887, 742, 13, 18884, 525, 1062, 2396, 525, 1579, 29894, 742, 13, 18884, 525, 3257, 2396, 525, 4373, 3189, 262, 379, 547, 6824, 29871, 29896, 29900, 29900, 29995, 5701, 1725, 6824, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 2676, 29889, 10867, 29889, 990, 29914, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29881, 29956, 29956, 29955, 29939, 29925, 29946, 29906, 29941, 29891, 29947, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29881, 29956, 29956, 29955, 29939, 29925, 29946, 29906, 29941, 29891, 29947, 742, 13, 18884, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 18884, 525, 3257, 2396, 525, 3112, 20333, 29879, 13760, 1397, 5593, 29925, 19653, 5974, 29889, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29906, 29896, 29896, 29900, 29906, 29896, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29955, 29967, 29893, 29926, 29929, 29888, 29895, 9600, 29896, 328, 29940, 29946, 29888, 29924, 29885, 29911, 29895, 29886, 688, 742, 13, 18884, 525, 12719, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12719, 29914, 23129, 29955, 29967, 29893, 29926, 29929, 29888, 29895, 9600, 29896, 328, 29940, 29946, 29888, 29924, 29885, 29911, 29895, 29886, 688, 742, 13, 18884, 525, 19708, 2396, 29871, 29947, 29896, 29900, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29955, 29890, 29945, 29953, 29955, 29888, 29947, 29929, 29947, 29881, 29947, 29906, 29941, 29955, 29890, 29906, 29945, 29953, 29888, 29941, 29953, 29883, 29896, 29874, 29900, 29955, 29881, 29953, 29881, 29955, 12328, 742, 13, 18884, 525, 9009, 261, 2396, 525, 29928, 804, 29925, 19653, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 23129, 29955, 29967, 29893, 29926, 29929, 29888, 29895, 9600, 29896, 328, 29940, 29946, 29888, 29924, 29885, 29911, 29895, 29886, 688, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12719, 29914, 23129, 29955, 29967, 29893, 29926, 29929, 29888, 29895, 9600, 29896, 328, 29940, 29946, 29888, 29924, 29885, 29911, 29895, 29886, 688, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 396, 4847, 2933, 3743, 525, 3400, 29915, 2823, 29901, 2045, 597, 3292, 29889, 510, 29914, 29891, 1594, 29880, 29899, 990, 29914, 19567, 29899, 11671, 29914, 12175, 29914, 29906, 29955, 29900, 29929, 29941, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29906, 29900, 29900, 29947, 29906, 29955, 29900, 29900, 29941, 29929, 29900, 29929, 361, 29918, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29953, 29928, 29882, 29899, 2241, 1649, 29884, 29940, 29946, 742, 13, 9651, 525, 3888, 29918, 8977, 2396, 426, 13, 18884, 525, 333, 2396, 525, 29953, 29928, 29882, 29899, 2241, 1649, 29884, 29940, 29946, 742, 13, 18884, 525, 1062, 2396, 525, 1526, 29946, 742, 13, 18884, 525, 3257, 2396, 525, 29890, 2335, 1869, 15713, 742, 13, 18884, 525, 9009, 29918, 1256, 2396, 525, 29906, 29900, 29896, 29947, 29896, 29900, 29900, 29945, 742, 13, 18884, 525, 12719, 29918, 333, 2396, 525, 23129, 29899, 29880, 29950, 29967, 29999, 29934, 29941, 29954, 29939, 29916, 29885, 29906, 29946, 29918, 29963, 29881, 29918, 29909, 29967, 29945, 29979, 29893, 742, 13, 18884, 525, 12719, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12719, 29914, 23129, 29899, 29880, 29950, 29967, 29999, 29934, 29941, 29954, 29939, 29916, 29885, 29906, 29946, 29918, 29963, 29881, 29918, 29909, 29967, 29945, 29979, 29893, 742, 13, 18884, 525, 19708, 2396, 29871, 29896, 29941, 29945, 29892, 13, 18884, 525, 8216, 2396, 525, 3487, 29945, 29901, 29906, 29881, 915, 29946, 29900, 29945, 29896, 1725, 12352, 29906, 29881, 370, 29945, 29888, 29946, 29896, 29888, 29947, 29906, 1327, 29953, 29881, 29896, 29896, 29881, 29900, 742, 13, 18884, 525, 9009, 261, 2396, 525, 29925, 809, 16334, 29925, 347, 742, 13, 18884, 525, 9009, 261, 29918, 333, 2396, 525, 29925, 809, 16334, 29925, 347, 742, 13, 18884, 525, 9009, 261, 29918, 2271, 2396, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 1792, 29914, 29925, 809, 16334, 29925, 347, 29915, 13, 9651, 500, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29895, 29950, 29899, 29954, 29918, 29874, 8979, 29880, 29943, 29893, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29900, 29945, 29900, 29906, 29896, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 29918, 361, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29900, 1997, 29903, 29999, 29929, 29953, 29965, 29946, 29924, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 13, 9651, 396, 13987, 451, 3190, 2347, 29892, 871, 10446, 338, 443, 16515, 4863, 1813, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29906, 29896, 29900, 29945, 29941, 29900, 29900, 29955, 29896, 29900, 29900, 29947, 29914, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 29922, 29880, 29950, 29967, 29911, 29888, 29929, 29941, 15444, 29896, 29879, 29987, 1028, 10745, 1359, 29922, 29896, 29900, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 259, 396, 11346, 6797, 3142, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29906, 29900, 29955, 29896, 29906, 29906, 29941, 29896, 29953, 29896, 29929, 29914, 1124, 29995, 29941, 29909, 458, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29995, 29941, 29943, 3820, 29995, 29941, 29928, 3308, 29995, 29906, 29953, 29894, 29995, 29941, 7698, 29895, 2918, 29882, 29916, 29934, 29968, 29883, 2288, 29995, 29906, 29953, 4415, 29995, 29941, 29315, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29896, 29906, 29900, 29955, 29896, 29906, 29906, 29941, 29896, 29953, 29896, 29929, 29914, 1124, 29995, 29941, 29909, 458, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29995, 29941, 29943, 29894, 29995, 29941, 7698, 29895, 2918, 29882, 29916, 29934, 29968, 29883, 2288, 29995, 29906, 29953, 3820, 29995, 29941, 29928, 3308, 29995, 29906, 29953, 4415, 29995, 29941, 29315, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 29900, 29900, 29953, 29900, 29945, 29906, 29955, 29900, 29947, 29896, 29929, 29941, 29955, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29901, 29947, 29900, 29914, 12344, 29889, 1961, 29973, 29894, 29922, 29923, 5850, 29943, 29879, 5850, 29955, 29941, 29888, 29909, 29987, 1160, 29936, 4478, 29922, 29879, 11953, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 2981, 426, 13, 9651, 525, 2271, 2396, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 1124, 597, 1636, 29889, 19567, 29889, 510, 29901, 29947, 29900, 29914, 12344, 29973, 29894, 10457, 29900, 29945, 29963, 29963, 4099, 29899, 600, 29887, 742, 13, 9651, 525, 6194, 29918, 4352, 292, 2396, 5852, 13, 4706, 500, 13, 1678, 4514, 13, 1678, 903, 29979, 29911, 29918, 26019, 25758, 29918, 14573, 29918, 1525, 353, 364, 29915, 10780, 5919, 29973, 5919, 25825, 7165, 29905, 29879, 17710, 7110, 29879, 29930, 3366, 29905, 2033, 3637, 15514, 1469, 3366, 29905, 2033, 29905, 29879, 17710, 29962, 29989, 3637, 15514, 1469, 2144, 29879, 29930, 2013, 29879, 29930, 3319, 29889, 29974, 29973, 11606, 29879, 29930, 29936, 10531, 29995, 29879, 16029, 1273, 612, 15907, 5160, 3401, 5647, 28891, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 14573, 29918, 1525, 13, 1678, 903, 29979, 29911, 29918, 26019, 25758, 29918, 29925, 18799, 1001, 29918, 1525, 5550, 1164, 1660, 29918, 1525, 353, 364, 29915, 10780, 5919, 29973, 5919, 25825, 7165, 29905, 29879, 17710, 7110, 29879, 29930, 3366, 29905, 2033, 3637, 15514, 9075, 5103, 3366, 29905, 2033, 29905, 29879, 17710, 29962, 29989, 3637, 15514, 9075, 5103, 2144, 29879, 29930, 11759, 1194, 29879, 14178, 3319, 29889, 29974, 29973, 1800, 29961, 2144, 29879, 14178, 29936, 10531, 29995, 29879, 16029, 1273, 612, 15907, 5160, 3401, 5647, 28891, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 29925, 18799, 1001, 29918, 1525, 5550, 1164, 1660, 29918, 1525, 13, 1678, 903, 29979, 29911, 29918, 26019, 25758, 29918, 8456, 18783, 19926, 29918, 1525, 353, 364, 29915, 10780, 5919, 25825, 1707, 29905, 29879, 29974, 7299, 29989, 829, 2154, 4295, 29876, 10531, 29995, 29879, 16029, 1273, 612, 15907, 5160, 3401, 5647, 28891, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 8456, 18783, 19926, 29918, 1525, 13, 13, 1678, 903, 29979, 29911, 29918, 23397, 29918, 4690, 5005, 29933, 29918, 18603, 29903, 353, 6024, 29875, 29889, 3637, 2492, 29889, 510, 2033, 29871, 396, 266, 17771, 2234, 1556, 5517, 3190, 2347, 373, 1438, 12424, 13, 1678, 903, 29979, 29911, 29918, 9818, 29918, 4690, 5005, 29933, 29918, 18603, 29903, 353, 10372, 2697, 29898, 13, 4706, 903, 29979, 29911, 29918, 23397, 29918, 4690, 5005, 29933, 29918, 18603, 29903, 718, 6024, 2492, 29889, 19567, 29889, 510, 742, 334, 29961, 29888, 29915, 29912, 29883, 1157, 29876, 470, 5124, 1836, 3637, 2492, 29889, 510, 29915, 363, 274, 297, 6702, 29875, 742, 525, 29879, 1495, 363, 302, 297, 3070, 3881, 29898, 29900, 29892, 29871, 29945, 511, 29871, 29929, 4638, 2314, 13, 13, 1678, 903, 12982, 29979, 29933, 11375, 29918, 25416, 29918, 4219, 353, 525, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 22584, 29879, 361, 29918, 22208, 13, 1678, 903, 5607, 2287, 1254, 29918, 29907, 3301, 29911, 11499, 29918, 6248, 353, 29871, 29906, 29900, 29900, 29945, 29900, 29906, 29896, 29946, 29900, 29900, 29900, 29900, 29900, 29900, 13, 1678, 903, 8186, 8851, 1254, 29918, 29907, 3301, 29911, 11499, 29918, 6248, 353, 29871, 29906, 29900, 29945, 29900, 29900, 29896, 29900, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 13, 13, 1678, 822, 903, 4804, 29918, 2252, 29916, 29918, 2754, 29898, 1311, 29892, 2944, 29918, 333, 29892, 3142, 29892, 18094, 29901, 1051, 353, 6213, 29892, 24382, 29901, 1051, 353, 6213, 29892, 2346, 29901, 9657, 353, 6213, 29892, 4443, 2433, 6767, 13234, 7307, 29990, 3450, 4663, 29374, 13, 4706, 396, 7307, 29990, 10561, 29901, 2045, 597, 3292, 29889, 510, 29914, 14168, 300, 10867, 29914, 1582, 1627, 29914, 10054, 29914, 6207, 29914, 1582, 1627, 29899, 2252, 29916, 29899, 2974, 29914, 16310, 2303, 29889, 3487, 13, 4706, 2346, 353, 426, 13, 9651, 525, 2271, 2396, 3142, 29892, 13, 9651, 525, 4905, 2396, 525, 3126, 742, 13, 9651, 525, 1579, 2396, 525, 13492, 29892, 29885, 17528, 668, 29892, 2848, 29892, 16394, 742, 13, 9651, 525, 13400, 2396, 29871, 29945, 29900, 29900, 29892, 13, 9651, 525, 4572, 2396, 6024, 4882, 401, 29901, 29906, 29900, 29900, 2033, 718, 313, 26705, 470, 5159, 511, 13, 9651, 525, 27756, 2396, 24382, 470, 19997, 13, 9651, 3579, 29898, 1972, 470, 426, 1800, 13, 4706, 500, 13, 4706, 620, 353, 1583, 3032, 10382, 29918, 3126, 877, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2252, 29916, 29914, 4478, 29914, 2252, 29916, 742, 2944, 29918, 333, 29892, 4443, 29892, 2346, 29922, 1972, 29897, 13, 4706, 565, 338, 8758, 29898, 690, 29892, 1051, 29897, 322, 7431, 29898, 690, 29897, 6736, 29871, 29906, 29901, 13, 9651, 396, 3402, 2933, 304, 1207, 372, 6775, 304, 671, 13, 9651, 736, 1051, 29898, 8977, 29898, 7554, 29898, 690, 29961, 29900, 1402, 325, 876, 363, 325, 297, 620, 29961, 29896, 29901, 2314, 13, 4706, 25342, 451, 338, 8758, 29898, 690, 29892, 1051, 29897, 470, 7431, 29898, 690, 29897, 2804, 29871, 29900, 29901, 13, 9651, 1583, 29889, 12276, 29918, 27392, 877, 2392, 1550, 13755, 7307, 29990, 3450, 2933, 29915, 718, 6494, 29918, 276, 4011, 29918, 4906, 3101, 13, 13, 1678, 822, 903, 21111, 29918, 3637, 29918, 11228, 29918, 11918, 29898, 1311, 29892, 24499, 29892, 6528, 29892, 4863, 29918, 333, 29892, 1024, 1125, 13, 4706, 736, 1583, 3032, 5510, 29918, 3126, 29898, 1311, 3032, 4478, 29918, 13087, 29898, 13, 9651, 313, 29878, 29915, 29995, 29879, 29905, 29879, 29930, 29995, 29879, 29915, 1273, 313, 13087, 29892, 1583, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 8456, 18783, 19926, 29918, 1525, 511, 13, 632, 6528, 511, 24499, 29892, 1024, 29892, 2322, 2433, 8875, 5477, 4863, 29918, 333, 29892, 18409, 29922, 8824, 29897, 13, 13, 1678, 822, 903, 21111, 29918, 2676, 3488, 29918, 3257, 29898, 1311, 29892, 24499, 1125, 13, 4706, 1813, 29918, 3257, 353, 1583, 3032, 1420, 29918, 4478, 29918, 13087, 29898, 13, 9651, 364, 29915, 29966, 3257, 29958, 4197, 29985, 29966, 29962, 7528, 829, 3257, 29958, 742, 24499, 29892, 525, 3257, 742, 2322, 2433, 1495, 13, 4706, 396, 14711, 4863, 6515, 2615, 304, 2337, 505, 2845, 525, 3492, 13425, 448, 29915, 408, 10944, 470, 17411, 14711, 29915, 408, 25557, 29889, 13, 4706, 736, 1583, 3032, 1420, 29918, 4478, 29918, 13087, 29898, 13, 9651, 364, 29915, 10780, 29901, 3492, 13425, 29905, 29879, 29930, 2612, 29879, 16395, 5575, 1262, 10531, 10780, 5919, 5575, 2144, 29879, 29930, 2612, 29879, 29930, 3492, 13425, 10931, 742, 13, 9651, 1813, 29918, 3257, 29892, 525, 3257, 742, 2322, 2433, 1495, 13, 13, 1678, 822, 903, 21111, 29918, 19635, 29898, 1311, 29892, 4863, 29918, 333, 29892, 24499, 1125, 13, 13, 4706, 2740, 29918, 7299, 353, 5135, 2892, 921, 29901, 1583, 3032, 1420, 29918, 4478, 29918, 7299, 29898, 29916, 29892, 24499, 29892, 2322, 29922, 8516, 876, 565, 24499, 1683, 313, 2892, 921, 29901, 6213, 876, 13, 4706, 4847, 29918, 5327, 353, 1583, 3032, 21111, 29918, 3637, 29918, 11228, 29918, 11918, 29898, 13, 9651, 24499, 29892, 1583, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 29925, 18799, 1001, 29918, 1525, 5550, 1164, 1660, 29918, 1525, 29892, 4863, 29918, 333, 29892, 525, 11228, 4847, 2933, 1495, 470, 6571, 13, 4706, 2847, 29918, 1272, 353, 1583, 3032, 21111, 29918, 3637, 29918, 11228, 29918, 11918, 29898, 13, 9651, 24499, 29892, 1583, 3032, 29979, 29911, 29918, 26019, 25758, 29918, 14573, 29918, 1525, 29892, 4863, 29918, 333, 29892, 525, 11228, 4847, 2933, 1495, 470, 6571, 13, 13, 4706, 2847, 29918, 1272, 29918, 9641, 353, 29370, 29918, 5415, 29898, 13, 9651, 2847, 29918, 1272, 29892, 6702, 10853, 742, 525, 10184, 4409, 24709, 9190, 12191, 742, 525, 9902, 742, 525, 9902, 742, 525, 10853, 742, 2023, 29892, 525, 9641, 26666, 3401, 21323, 5477, 13, 9651, 3806, 29918, 1853, 29922, 8977, 29892, 679, 29918, 497, 29922, 8824, 29892, 2322, 3790, 1800, 13, 13, 4706, 4863, 29918, 14144, 353, 29370, 29918, 5415, 29898, 13, 9651, 4847, 29918, 5327, 29892, 525, 9641, 10602, 742, 3806, 29918, 1853, 29922, 8977, 29892, 679, 29918, 497, 29922, 8824, 29892, 2322, 3790, 1800, 13, 13, 4706, 9200, 689, 1446, 353, 29370, 29918, 5415, 29898, 13, 9651, 4847, 29918, 5327, 29892, 6702, 29885, 2357, 4830, 742, 525, 9106, 29924, 2357, 4830, 21323, 5477, 3806, 29918, 1853, 29922, 8977, 29892, 679, 29918, 497, 29922, 8824, 29892, 2322, 3790, 1800, 13, 13, 4706, 4863, 29918, 3257, 353, 313, 13, 9651, 4863, 29918, 14144, 29889, 657, 877, 3257, 1495, 13, 9651, 470, 612, 15907, 5160, 3401, 5647, 28891, 3032, 657, 29918, 726, 29898, 29885, 2357, 689, 1446, 29892, 525, 3257, 1495, 13, 9651, 470, 612, 15907, 5160, 3401, 5647, 28891, 3032, 657, 29918, 726, 29898, 11228, 29918, 1272, 29918, 9641, 29892, 525, 3257, 1495, 13, 9651, 470, 1583, 3032, 21111, 29918, 2676, 3488, 29918, 3257, 29898, 2676, 3488, 29897, 13, 9651, 470, 2740, 29918, 7299, 18959, 468, 29901, 3257, 742, 525, 24946, 29901, 3257, 742, 525, 3257, 25901, 13, 13, 4706, 8242, 29918, 333, 353, 851, 29918, 272, 29918, 9290, 29898, 13, 9651, 4863, 29918, 14144, 29889, 657, 877, 12719, 1204, 1495, 13, 9651, 470, 9200, 689, 1446, 29889, 657, 877, 23176, 13599, 1204, 1495, 13, 9651, 470, 2740, 29918, 7299, 877, 12719, 1204, 1495, 13, 9651, 470, 1583, 3032, 4478, 29918, 13087, 29898, 13, 18884, 364, 29915, 1272, 29899, 12719, 29899, 23176, 29899, 333, 7607, 3366, 29905, 2033, 5033, 29973, 29925, 29966, 333, 5961, 29973, 5919, 29973, 9903, 29896, 467, 7240, 2144, 29896, 742, 29871, 396, 732, 29890, 29946, 29945, 29874, 29929, 29872, 29953, 13, 18884, 24499, 29892, 525, 12719, 1178, 742, 2322, 29922, 8516, 29892, 2318, 2433, 333, 8785, 13, 4706, 8242, 29918, 2271, 353, 285, 29915, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12719, 19248, 12719, 29918, 333, 10162, 565, 8242, 29918, 333, 1683, 6213, 13, 13, 4706, 14385, 353, 938, 29918, 272, 29918, 9290, 29898, 13, 9651, 4863, 29918, 14144, 29889, 657, 877, 2848, 27535, 1495, 13, 9651, 470, 9200, 689, 1446, 29889, 657, 877, 2848, 27535, 1495, 13, 9651, 470, 6088, 29918, 19708, 29898, 4478, 29918, 7299, 877, 19708, 29915, 4961, 13, 4706, 6139, 353, 313, 13, 9651, 4863, 29918, 14144, 29889, 657, 877, 12759, 9868, 1495, 13, 9651, 470, 612, 15907, 5160, 3401, 5647, 28891, 3032, 657, 29918, 726, 29898, 29885, 2357, 689, 1446, 29892, 525, 8216, 1495, 13, 9651, 470, 5941, 29918, 1420, 29898, 657, 29918, 5029, 29918, 1609, 29918, 333, 877, 29872, 340, 29899, 8216, 742, 24499, 876, 29871, 396, 732, 29929, 29872, 29953, 1289, 29906, 29941, 13, 9651, 470, 2740, 29918, 7299, 18959, 8216, 742, 525, 468, 29901, 8216, 742, 525, 24946, 29901, 8216, 25901, 13, 13, 4706, 6441, 261, 353, 4863, 29918, 14144, 29889, 657, 877, 8921, 1495, 13, 13, 4706, 396, 5020, 12657, 3553, 322, 3988, 13, 4706, 6441, 261, 29918, 29885, 5415, 353, 337, 29889, 4478, 29898, 13, 9651, 364, 29915, 29966, 2324, 2944, 7728, 543, 2271, 29908, 2822, 543, 10780, 29925, 29966, 9009, 261, 29918, 2271, 29958, 991, 29973, 597, 1636, 23301, 19567, 23301, 510, 29914, 10780, 29901, 1792, 29989, 12719, 6802, 10780, 29925, 29966, 9009, 261, 29918, 333, 29958, 22896, 3108, 29974, 876, 1013, 742, 29871, 396, 732, 11512, 29900, 29945, 29900, 29906, 29946, 13, 9651, 24499, 29897, 13, 4706, 565, 6441, 261, 29918, 29885, 5415, 338, 451, 6213, 29901, 13, 9651, 6441, 261, 29918, 333, 29892, 6441, 261, 29918, 2271, 353, 6441, 261, 29918, 29885, 5415, 29889, 2972, 877, 9009, 261, 29918, 333, 5477, 6441, 261, 29918, 29885, 5415, 29889, 2972, 877, 9009, 261, 29918, 2271, 1495, 13, 4706, 1683, 29901, 13, 9651, 396, 732, 29874, 29953, 29906, 29896, 29896, 29881, 29906, 13, 9651, 6441, 261, 29918, 2271, 353, 3142, 29918, 272, 29918, 9290, 29898, 29885, 2357, 689, 1446, 29889, 657, 877, 20348, 13909, 5983, 8785, 13, 9651, 6441, 261, 29918, 333, 353, 1583, 3032, 4478, 29918, 13087, 29898, 13, 18884, 364, 29915, 10780, 29901, 1792, 29989, 12719, 6802, 4197, 29985, 29914, 10062, 29897, 742, 6441, 261, 29918, 2271, 470, 15516, 525, 9009, 261, 1178, 742, 2322, 29922, 8516, 29897, 13, 13, 4706, 6441, 29918, 1256, 353, 443, 2164, 29918, 710, 1256, 29898, 13, 9651, 9657, 29918, 657, 29898, 29885, 2357, 689, 1446, 29892, 6702, 9009, 2539, 742, 525, 23679, 2539, 8785, 13, 9651, 470, 2740, 29918, 7299, 18959, 9009, 2539, 742, 525, 1256, 21076, 3726, 11287, 13, 9651, 470, 1583, 3032, 4478, 29918, 13087, 29898, 13, 18884, 518, 29878, 29915, 10780, 29879, 29897, 333, 543, 29872, 340, 29899, 1256, 5575, 29973, 5961, 5575, 7897, 829, 9653, 29958, 742, 13, 462, 364, 29915, 10780, 29901, 333, 543, 12344, 29899, 9009, 261, 29899, 3888, 1642, 29930, 17382, 5575, 29973, 29989, 3366, 29905, 2033, 12857, 1626, 3366, 29905, 2033, 29905, 29879, 29930, 3583, 29879, 29930, 3366, 29905, 2033, 5033, 25825, 21076, 3726, 29989, 3373, 15638, 29989, 3835, 287, 5735, 29989, 4763, 287, 29897, 373, 14544, 29974, 7897, 29961, 29966, 26732, 2033, 7464, 29871, 396, 732, 29955, 29929, 29929, 29947, 29945, 29906, 29900, 13, 18884, 24499, 29892, 525, 9009, 2635, 742, 2322, 29922, 8516, 876, 13, 13, 4706, 736, 426, 13, 9651, 525, 3257, 2396, 4863, 29918, 3257, 29892, 13, 9651, 525, 8216, 2396, 6139, 29892, 13, 9651, 525, 9009, 29918, 1256, 2396, 6441, 29918, 1256, 29892, 13, 9651, 525, 9009, 261, 2396, 6441, 261, 29892, 13, 9651, 525, 12719, 29918, 333, 2396, 8242, 29918, 333, 29892, 13, 9651, 525, 12719, 29918, 2271, 2396, 8242, 29918, 2271, 29892, 13, 9651, 525, 19708, 2396, 14385, 29892, 13, 9651, 525, 9009, 261, 29918, 2271, 2396, 6441, 261, 29918, 2271, 29892, 13, 9651, 525, 9009, 261, 29918, 333, 2396, 6441, 261, 29918, 333, 29892, 13, 4706, 500, 13, 13, 1678, 822, 903, 21111, 29918, 386, 17771, 2234, 29898, 1311, 29892, 4863, 29918, 333, 1125, 13, 4706, 1018, 29918, 497, 353, 525, 386, 17771, 2234, 29915, 297, 1583, 3032, 13305, 29918, 1191, 877, 3198, 29918, 497, 1495, 13, 4706, 266, 21145, 29918, 3188, 29918, 26045, 353, 6024, 1124, 597, 29912, 2974, 6822, 1403, 29912, 2676, 29886, 6822, 29912, 9641, 29918, 333, 29913, 4286, 4830, 29898, 13, 9651, 1856, 29886, 2433, 29918, 2676, 29886, 29915, 565, 1294, 1275, 525, 2676, 29886, 29915, 1683, 15516, 4863, 29918, 333, 29922, 9641, 29918, 333, 29892, 1923, 29922, 2974, 29897, 13, 9651, 363, 1923, 297, 313, 1311, 3032, 29979, 29911, 29918, 9818, 29918, 4690, 5005, 29933, 29918, 18603, 29903, 565, 1018, 29918, 497, 1683, 1583, 3032, 29979, 29911, 29918, 23397, 29918, 4690, 5005, 29933, 29918, 18603, 29903, 29897, 363, 1294, 297, 313, 877, 6173, 742, 525, 2676, 29886, 1495, 565, 1018, 29918, 497, 1683, 6702, 6173, 742, 28166, 13, 13, 4706, 266, 17771, 2234, 353, 5159, 13, 4706, 363, 3142, 297, 266, 21145, 29918, 3188, 29918, 26045, 29901, 13, 9651, 2933, 353, 1583, 3032, 4804, 29918, 2252, 29916, 29918, 2754, 29898, 13, 18884, 4863, 29918, 333, 29892, 3142, 29892, 18094, 29922, 1839, 29885, 17528, 668, 29901, 3027, 29914, 10780, 29901, 2676, 29886, 29989, 26568, 29897, 7464, 13, 18884, 24382, 29922, 1839, 2271, 1989, 7464, 2346, 3790, 29915, 4352, 1542, 2396, 525, 13506, 29915, 1800, 13, 9651, 565, 451, 2933, 29901, 13, 18884, 6773, 13, 9651, 266, 17771, 2234, 29889, 21843, 29898, 13, 18884, 426, 13, 462, 1678, 525, 2271, 2396, 313, 1311, 3032, 12982, 29979, 29933, 11375, 29918, 25416, 29918, 4219, 1273, 313, 524, 29918, 272, 29918, 9290, 29898, 386, 21145, 29918, 8977, 29889, 657, 877, 16394, 8785, 470, 1583, 3032, 5607, 2287, 1254, 29918, 29907, 3301, 29911, 11499, 29918, 6248, 876, 718, 266, 21145, 29918, 8977, 29889, 657, 877, 13492, 5477, 13, 462, 1678, 525, 5325, 675, 2396, 938, 29918, 272, 29918, 9290, 29898, 386, 21145, 29918, 8977, 29889, 657, 877, 2848, 1495, 511, 13, 462, 1678, 525, 1457, 1659, 2396, 938, 29918, 272, 29918, 9290, 29898, 386, 21145, 29918, 8977, 29889, 657, 877, 2848, 8785, 13, 18884, 500, 363, 266, 21145, 29918, 8977, 297, 2933, 29897, 13, 9651, 565, 451, 1018, 29918, 497, 29901, 13, 18884, 2867, 13, 13, 4706, 1583, 3032, 5992, 29918, 20908, 5926, 29918, 689, 1446, 29898, 386, 17771, 2234, 29897, 13, 4706, 736, 266, 17771, 2234, 13, 13, 1678, 822, 903, 657, 29918, 17885, 545, 29918, 15190, 29898, 1311, 29892, 4863, 29918, 333, 29892, 3142, 29918, 1256, 1125, 13, 4706, 10446, 29918, 15190, 353, 5159, 13, 4706, 396, 3940, 29901, 7307, 29990, 3450, 674, 451, 1284, 6505, 6515, 411, 4805, 8636, 297, 278, 3142, 29889, 13, 4706, 2933, 353, 1583, 3032, 4804, 29918, 2252, 29916, 29918, 2754, 29898, 13, 9651, 4863, 29918, 333, 29892, 285, 29915, 991, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 3790, 9641, 29918, 333, 29913, 742, 13, 9651, 18094, 29922, 1839, 29885, 17528, 668, 29901, 726, 29914, 1420, 7464, 24382, 29922, 1839, 16394, 29901, 29953, 742, 525, 7501, 342, 7464, 2346, 3790, 29915, 4352, 1542, 2396, 525, 13506, 29915, 1800, 470, 5159, 13, 4706, 599, 29918, 17885, 1973, 353, 12705, 4197, 524, 29918, 272, 29918, 9290, 29898, 29878, 1839, 16394, 11287, 363, 364, 297, 2933, 565, 938, 29918, 272, 29918, 9290, 29898, 29878, 1839, 16394, 11287, 338, 451, 6213, 2314, 13, 13, 4706, 396, 4721, 571, 278, 716, 24324, 261, 3740, 4332, 1973, 408, 591, 2304, 6597, 292, 901, 15562, 515, 963, 13, 4706, 396, 399, 29933, 29924, 4332, 1973, 2833, 304, 599, 4607, 304, 445, 5912, 3695, 29967, 11850, 29871, 29906, 29900, 29906, 29900, 13, 4706, 5400, 29918, 17885, 1973, 353, 1051, 29898, 4572, 29898, 2892, 921, 29901, 921, 6736, 29871, 29906, 29900, 29906, 29900, 29900, 29955, 29900, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29892, 599, 29918, 17885, 1973, 876, 13, 4706, 565, 5400, 29918, 17885, 1973, 29901, 13, 9651, 10446, 29918, 15190, 29889, 4397, 29898, 1545, 824, 29918, 17885, 1973, 29961, 29900, 2314, 13, 4706, 10446, 29918, 15190, 29889, 4397, 29898, 2271, 29918, 1256, 29897, 13, 4706, 565, 599, 29918, 17885, 1973, 29901, 13, 9651, 10446, 29918, 15190, 29889, 4397, 29898, 497, 29918, 17885, 1973, 29961, 29900, 2314, 13, 13, 4706, 565, 525, 17885, 1973, 29915, 297, 1583, 3032, 13305, 29918, 1191, 877, 3198, 29918, 497, 29374, 13, 9651, 10446, 29918, 15190, 29889, 21843, 29898, 1545, 824, 29918, 17885, 1973, 718, 599, 29918, 17885, 1973, 29897, 13, 13, 4706, 396, 14053, 1627, 29879, 565, 738, 310, 278, 2038, 4418, 13, 4706, 10446, 29918, 15190, 29889, 21843, 4197, 1311, 3032, 5607, 2287, 1254, 29918, 29907, 3301, 29911, 11499, 29918, 6248, 29892, 1583, 3032, 8186, 8851, 1254, 29918, 29907, 3301, 29911, 11499, 29918, 6248, 2314, 13, 4706, 736, 10372, 2697, 29898, 17885, 545, 29918, 15190, 29897, 13, 13, 1678, 822, 903, 6370, 29918, 21111, 29898, 1311, 29892, 3142, 1125, 13, 13, 4706, 3142, 29918, 1256, 29892, 4863, 29918, 333, 353, 1583, 3032, 4352, 29918, 3084, 29918, 2271, 29898, 2271, 467, 13155, 580, 13, 13, 4706, 3142, 29882, 353, 6213, 13, 4706, 1018, 29901, 13, 9651, 3142, 29882, 353, 1583, 3032, 3827, 29918, 2676, 3488, 29898, 13, 18884, 17714, 3035, 3089, 877, 991, 597, 2676, 29889, 10867, 29889, 990, 29914, 2676, 29914, 29906, 7297, 29918, 29914, 1124, 597, 1582, 1627, 29899, 29888, 1296, 2271, 29889, 10867, 29889, 990, 29914, 3637, 22584, 29879, 29915, 1273, 4863, 29918, 333, 511, 13, 18884, 4863, 29918, 333, 29892, 4443, 2433, 20927, 292, 3190, 2347, 4863, 934, 3142, 742, 3806, 29918, 4882, 29922, 5574, 29897, 13, 4706, 5174, 7338, 28891, 2392, 408, 321, 29901, 13, 9651, 396, 7331, 4829, 29871, 29946, 29900, 29946, 338, 3806, 565, 278, 4863, 338, 451, 7160, 29889, 13, 9651, 565, 338, 8758, 29898, 29872, 29889, 29883, 1071, 29892, 10007, 29918, 10493, 2392, 29897, 322, 321, 29889, 29883, 1071, 29889, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 18884, 1583, 29889, 22692, 29918, 1217, 29918, 689, 1446, 29898, 13, 462, 1678, 525, 1576, 13877, 4863, 338, 451, 3190, 2347, 29892, 27541, 29892, 470, 727, 338, 385, 2228, 411, 1856, 29889, 10867, 29889, 990, 742, 13, 462, 1678, 3806, 29922, 5574, 29897, 13, 9651, 1683, 29901, 13, 18884, 12020, 13, 13, 4706, 10446, 29918, 15190, 353, 1583, 3032, 657, 29918, 17885, 545, 29918, 15190, 29898, 9641, 29918, 333, 29892, 938, 29918, 272, 29918, 9290, 29898, 2271, 29918, 1256, 876, 13, 4706, 1583, 29889, 3539, 29918, 8382, 877, 21133, 1973, 304, 1018, 29901, 525, 718, 13420, 15300, 7122, 29898, 710, 29898, 29875, 29897, 363, 474, 297, 10446, 29918, 15190, 565, 474, 338, 451, 6213, 876, 13, 4706, 5235, 353, 11117, 333, 2396, 4863, 29918, 333, 29913, 13, 4706, 363, 10446, 297, 10446, 29918, 15190, 29901, 13, 9651, 565, 451, 10446, 29901, 13, 18884, 6773, 13, 9651, 24499, 353, 1583, 3032, 10382, 29918, 2676, 3488, 29898, 13, 18884, 313, 1311, 3032, 12982, 29979, 29933, 11375, 29918, 25416, 29918, 4219, 718, 525, 1124, 597, 1636, 29889, 19567, 29889, 510, 29914, 12344, 29973, 29894, 16328, 29879, 1495, 1273, 313, 17885, 545, 29892, 4863, 29918, 333, 511, 13, 18884, 4863, 29918, 333, 29922, 9641, 29918, 333, 29892, 18409, 29922, 8824, 29892, 4589, 6812, 2433, 348, 519, 304, 5142, 10446, 24499, 313, 277, 1122, 451, 367, 3190, 2347, 29897, 742, 13, 18884, 4443, 2433, 6767, 13234, 10446, 24499, 1495, 13, 9651, 1857, 29918, 3888, 353, 1583, 3032, 21111, 29918, 19635, 29898, 9641, 29918, 333, 29892, 24499, 470, 27255, 13, 9651, 396, 3967, 4772, 2805, 11132, 4863, 15562, 13, 9651, 565, 1857, 29918, 3888, 29889, 657, 877, 3257, 29374, 13, 18884, 5235, 353, 10366, 29918, 8977, 29879, 29898, 3888, 29892, 1857, 29918, 3888, 29897, 13, 18884, 565, 525, 17885, 1973, 29915, 451, 297, 1583, 3032, 13305, 29918, 1191, 877, 3198, 29918, 497, 29374, 13, 462, 1678, 2867, 13, 13, 4706, 5235, 1839, 386, 17771, 2234, 2033, 353, 1583, 3032, 21111, 29918, 386, 17771, 2234, 29898, 9641, 29918, 333, 29897, 13, 13, 4706, 565, 3142, 29882, 29901, 13, 9651, 3142, 353, 10007, 29918, 2271, 1982, 29918, 5510, 29918, 348, 1396, 29898, 2271, 29882, 29889, 2271, 29897, 13, 9651, 4863, 29918, 1445, 29918, 2271, 29918, 29939, 29879, 353, 6088, 29918, 29939, 29879, 29898, 2271, 29897, 13, 9651, 396, 6212, 3456, 304, 9792, 738, 1294, 669, 3402, 5235, 515, 1708, 1627, 3142, 669, 2933, 9066, 13, 9651, 3402, 353, 11117, 2271, 2396, 3142, 29892, 525, 5325, 675, 2396, 938, 29918, 272, 29918, 9290, 29898, 2271, 29882, 29889, 13662, 29889, 657, 877, 29916, 29899, 10867, 29899, 12683, 29899, 3051, 29899, 2848, 8785, 29913, 13, 9651, 372, 351, 353, 1018, 29918, 657, 29898, 9641, 29918, 1445, 29918, 2271, 29918, 29939, 29879, 29892, 14013, 921, 29901, 921, 1839, 277, 351, 2033, 29961, 29900, 2314, 13, 9651, 565, 372, 351, 322, 372, 351, 297, 612, 15907, 8673, 3032, 689, 1446, 29901, 13, 18884, 3402, 29889, 5504, 29898, 29979, 15907, 8673, 3032, 689, 1446, 29961, 277, 351, 2314, 13, 18884, 3402, 29889, 5504, 3319, 29915, 4830, 29918, 333, 2396, 372, 351, 1800, 13, 9651, 1683, 29901, 13, 18884, 286, 603, 353, 1018, 29918, 657, 29898, 9641, 29918, 1445, 29918, 2271, 29918, 29939, 29879, 29892, 14013, 921, 29901, 921, 1839, 29885, 603, 2033, 29961, 29900, 2314, 13, 18884, 1294, 353, 313, 29885, 17528, 668, 29906, 1062, 29898, 29885, 603, 29897, 13, 462, 539, 470, 3142, 8411, 29918, 4801, 522, 29918, 1062, 29898, 2271, 29882, 29897, 13, 462, 539, 470, 286, 17528, 668, 29906, 1062, 29898, 2271, 29882, 29889, 13662, 29889, 657, 877, 29916, 29899, 10867, 29899, 2543, 11517, 29899, 3051, 29899, 1853, 29915, 4961, 13, 18884, 3402, 29889, 5504, 3319, 29915, 1062, 2396, 1294, 1800, 13, 9651, 5235, 1839, 689, 1446, 2033, 353, 518, 4830, 29962, 13, 9651, 565, 451, 5235, 29889, 657, 877, 19708, 29374, 13, 18884, 5235, 1839, 19708, 2033, 353, 851, 29918, 517, 29918, 524, 29898, 2202, 29918, 657, 29898, 9641, 29918, 1445, 29918, 2271, 29918, 29939, 29879, 29892, 14013, 921, 29901, 921, 1839, 29881, 332, 2033, 29961, 29900, 12622, 13, 13, 4706, 565, 451, 5235, 29889, 657, 877, 3257, 29374, 13, 9651, 5235, 1839, 3257, 2033, 353, 4863, 29918, 333, 13, 4706, 736, 5235, 13, 2 ]
lib/crd.py
TierMobility/aws-auth-operator
8
175919
<filename>lib/crd.py from typing import List, Dict from lib.constants import CRD_GROUP, CRD_VERSION, CRD_KIND def build_aws_auth_mapping(mappings: List, name: str) -> Dict: return { "apiVersion": CRD_GROUP + "/" + CRD_VERSION, "kind": CRD_KIND, "metadata": {"annotations": {}, "labels": {}, "name": name,}, "spec": {"mappings": mappings}, }
[ 1, 529, 9507, 29958, 1982, 29914, 29883, 5499, 29889, 2272, 13, 3166, 19229, 1053, 2391, 29892, 360, 919, 13, 3166, 4303, 29889, 3075, 1934, 1053, 15600, 29928, 29918, 26284, 29892, 15600, 29928, 29918, 16358, 29892, 15600, 29928, 29918, 29968, 22255, 13, 13, 13, 1753, 2048, 29918, 10467, 29918, 5150, 29918, 20698, 29898, 655, 27775, 29901, 2391, 29892, 1024, 29901, 851, 29897, 1599, 360, 919, 29901, 13, 1678, 736, 426, 13, 4706, 376, 2754, 6594, 1115, 15600, 29928, 29918, 26284, 718, 5591, 29908, 718, 15600, 29928, 29918, 16358, 29892, 13, 4706, 376, 14380, 1115, 15600, 29928, 29918, 29968, 22255, 29892, 13, 4706, 376, 19635, 1115, 8853, 6735, 800, 1115, 24335, 376, 21134, 1115, 24335, 376, 978, 1115, 1024, 29892, 1118, 13, 4706, 376, 6550, 1115, 8853, 655, 27775, 1115, 611, 27775, 1118, 13, 1678, 500, 13, 2 ]
generate_images.py
gracecarrillo/github-readme-stats
0
156922
#!/usr/bin/python3 import asyncio import os import re import aiohttp from github_stats import Stats ################################################################################ # Helper Functions ################################################################################ def generate_output_folder() -> None: """ Create the output folder if it does not already exist """ if not os.path.isdir("generated"): os.mkdir("generated") ################################################################################ # Individual Image Generation Functions ################################################################################ async def generate_overview(s: Stats) -> None: """ Generate an SVG badge with summary statistics :param s: Represents user's GitHub statistics """ with open("templates/overview.svg", "r") as f: output = f.read() output = re.sub("{{ name }}", await s.name, output) output = re.sub("{{ stars }}", f"{await s.stargazers:,}", output) output = re.sub("{{ forks }}", f"{await s.forks:,}", output) output = re.sub("{{ contributions }}", f"{await s.total_contributions:,}", output) changed = (await s.lines_changed)[0] + (await s.lines_changed)[1] output = re.sub("{{ lines_changed }}", f"{changed:,}", output) output = re.sub("{{ views }}", f"{await s.views:,}", output) output = re.sub("{{ repos }}", f"{len(await s.repos):,}", output) generate_output_folder() with open("generated/overview.svg", "w") as f: f.write(output) async def generate_languages(s: Stats) -> None: """ Generate an SVG badge with summary languages used :param s: Represents user's GitHub statistics """ with open("templates/languages.svg", "r") as f: output = f.read() progress = "" lang_list = "" sorted_languages = sorted((await s.languages).items(), reverse=True, key=lambda t: t[1].get("size")) delay_between = 150 for i, (lang, data) in enumerate(sorted_languages): color = data.get("color") color = color if color is not None else "#000000" progress += (f'<span style="background-color: {color};' f'width: {data.get("prop", 0):0.3f}%;" ' f'class="progress-item"></span>') lang_list += f""" <li style="animation-delay: {i * delay_between}ms;"> <svg xmlns="http://www.w3.org/2000/svg" class="octicon" style="fill:{color};" viewBox="0 0 16 16" version="1.1" width="16" height="16"><path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8z"></path></svg> <span class="lang">{lang}</span> <span class="percent">{data.get("prop", 0):0.2f}%</span> </li> """ output = re.sub(r"{{ progress }}", progress, output) output = re.sub(r"{{ lang_list }}", lang_list, output) generate_output_folder() with open("generated/languages.svg", "w") as f: f.write(output) ################################################################################ # Main Function ################################################################################ async def main() -> None: """ Generate all badges """ access_token = os.getenv("ACCESS_TOKEN") if not access_token: # access_token = os.getenv("GITHUB_TOKEN") raise Exception("A personal access token is required to proceed!") user = os.getenv("GITHUB_ACTOR") exclude_repos = os.getenv("EXCLUDED") exclude_repos = ({x.strip() for x in exclude_repos.split(",")} if exclude_repos else None) exclude_langs = os.getenv("EXCLUDED_LANGS") exclude_langs = ({x.strip() for x in exclude_langs.split(",")} if exclude_langs else None) # Convert a truthy value to a Boolean ignore_forked_repos = os.getenv("EXCLUDE_FORKED_REPOS") ignore_forked_repos = (not not ignore_forked_repos and ignore_forked_repos.strip().lower() != "false") async with aiohttp.ClientSession() as session: s = Stats(user, access_token, session, exclude_repos=exclude_repos, exclude_langs=exclude_langs, ignore_forked_repos=ignore_forked_repos) await asyncio.gather(generate_languages(s), generate_overview(s)) if __name__ == "__main__": asyncio.run(main())
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 30004, 13, 30004, 13, 5215, 408, 948, 3934, 30004, 13, 5215, 2897, 30004, 13, 5215, 337, 30004, 13, 30004, 13, 5215, 263, 601, 1124, 30004, 13, 30004, 13, 3166, 18546, 29918, 16202, 1053, 624, 1446, 30004, 13, 30004, 13, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 29937, 6162, 546, 6680, 29879, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 30004, 13, 1753, 5706, 29918, 4905, 29918, 12083, 580, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 6204, 278, 1962, 4138, 565, 372, 947, 451, 2307, 1863, 30004, 13, 1678, 9995, 30004, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 703, 13525, 29908, 1125, 30004, 13, 4706, 2897, 29889, 11256, 3972, 703, 13525, 1159, 30004, 13, 30004, 13, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 29937, 1894, 23352, 7084, 28203, 6680, 29879, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 30004, 13, 12674, 822, 5706, 29918, 957, 1493, 29898, 29879, 29901, 624, 1446, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 3251, 403, 385, 13955, 29954, 4319, 479, 411, 15837, 13964, 30004, 13, 1678, 584, 3207, 269, 29901, 830, 4569, 1237, 1404, 29915, 29879, 25492, 13964, 30004, 13, 1678, 9995, 30004, 13, 1678, 411, 1722, 703, 20943, 29914, 957, 1493, 29889, 15120, 613, 376, 29878, 1159, 408, 285, 29901, 30004, 13, 4706, 1962, 353, 285, 29889, 949, 26471, 13, 30004, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 1024, 9156, 613, 7272, 269, 29889, 978, 29892, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 10819, 9156, 613, 285, 29908, 29912, 20675, 269, 29889, 303, 1191, 834, 414, 29901, 29892, 17671, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 363, 2039, 9156, 613, 285, 29908, 29912, 20675, 269, 29889, 29888, 548, 29879, 29901, 29892, 17671, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 20706, 9156, 613, 285, 29908, 29912, 20675, 269, 29889, 7827, 29918, 1285, 3224, 29879, 29901, 29892, 29913, 15231, 13, 462, 1678, 1962, 8443, 13, 1678, 3939, 353, 313, 20675, 269, 29889, 9012, 29918, 15033, 9601, 29900, 29962, 718, 313, 20675, 269, 29889, 9012, 29918, 15033, 9601, 29896, 29962, 30004, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 3454, 29918, 15033, 9156, 613, 285, 29908, 29912, 15033, 29901, 29892, 17671, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 8386, 9156, 613, 285, 29908, 29912, 20675, 269, 29889, 7406, 29901, 29892, 17671, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 703, 6224, 17573, 9156, 613, 285, 29908, 29912, 2435, 29898, 20675, 269, 29889, 276, 1066, 1125, 29892, 17671, 1962, 8443, 13, 30004, 13, 1678, 5706, 29918, 4905, 29918, 12083, 26471, 13, 1678, 411, 1722, 703, 13525, 29914, 957, 1493, 29889, 15120, 613, 376, 29893, 1159, 408, 285, 29901, 30004, 13, 4706, 285, 29889, 3539, 29898, 4905, 8443, 13, 30004, 13, 30004, 13, 12674, 822, 5706, 29918, 29880, 8737, 29898, 29879, 29901, 624, 1446, 29897, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 3251, 403, 385, 13955, 29954, 4319, 479, 411, 15837, 10276, 1304, 30004, 13, 1678, 584, 3207, 269, 29901, 830, 4569, 1237, 1404, 29915, 29879, 25492, 13964, 30004, 13, 1678, 9995, 30004, 13, 1678, 411, 1722, 703, 20943, 29914, 29880, 8737, 29889, 15120, 613, 376, 29878, 1159, 408, 285, 29901, 30004, 13, 4706, 1962, 353, 285, 29889, 949, 26471, 13, 30004, 13, 1678, 6728, 353, 5124, 30004, 13, 1678, 6361, 29918, 1761, 353, 5124, 30004, 13, 1678, 12705, 29918, 29880, 8737, 353, 12705, 3552, 20675, 269, 29889, 29880, 8737, 467, 7076, 3285, 11837, 29922, 5574, 11167, 13, 462, 795, 1820, 29922, 2892, 260, 29901, 260, 29961, 29896, 1822, 657, 703, 2311, 5783, 30004, 13, 1678, 9055, 29918, 14811, 353, 29871, 29896, 29945, 29900, 30004, 13, 1678, 363, 474, 29892, 313, 3893, 29892, 848, 29897, 297, 26985, 29898, 24582, 29918, 29880, 8737, 1125, 30004, 13, 4706, 2927, 353, 848, 29889, 657, 703, 2780, 1159, 30004, 13, 4706, 2927, 353, 2927, 565, 2927, 338, 451, 6213, 1683, 12305, 29900, 29900, 29900, 29900, 29900, 29900, 19451, 13, 4706, 6728, 4619, 313, 29888, 29915, 29966, 9653, 3114, 543, 7042, 29899, 2780, 29901, 426, 2780, 3400, 29915, 30004, 13, 462, 268, 285, 29915, 2103, 29901, 426, 1272, 29889, 657, 703, 7728, 613, 29871, 29900, 1125, 29900, 29889, 29941, 29888, 29913, 8874, 29908, 525, 30004, 13, 462, 268, 285, 29915, 1990, 543, 18035, 29899, 667, 5319, 9653, 29958, 1495, 30004, 13, 4706, 6361, 29918, 1761, 4619, 285, 15945, 19451, 13, 29966, 492, 3114, 543, 18962, 29899, 18829, 29901, 426, 29875, 334, 9055, 29918, 14811, 29913, 1516, 29936, 10175, 13, 29966, 15120, 9463, 543, 1124, 597, 1636, 29889, 29893, 29941, 29889, 990, 29914, 29906, 29900, 29900, 29900, 29914, 15120, 29908, 770, 543, 20082, 4144, 29908, 3114, 543, 5589, 26254, 2780, 3400, 19451, 13, 1493, 3313, 543, 29900, 29871, 29900, 29871, 29896, 29953, 29871, 29896, 29953, 29908, 1873, 543, 29896, 29889, 29896, 29908, 2920, 543, 29896, 29953, 29908, 3171, 543, 29896, 29953, 3254, 2084, 30004, 13, 5589, 29899, 7491, 543, 11884, 22861, 29908, 270, 543, 29924, 29947, 29871, 29946, 29874, 29946, 29871, 29946, 29871, 29900, 29871, 29896, 29900, 29900, 29871, 29947, 29871, 29946, 29871, 29946, 29871, 29900, 29871, 29900, 29900, 29900, 29899, 29947, 29920, 5319, 2084, 2565, 15120, 3238, 13, 29966, 9653, 770, 543, 3893, 1013, 29912, 3893, 16040, 9653, 3238, 13, 29966, 9653, 770, 543, 25376, 1013, 29912, 1272, 29889, 657, 703, 7728, 613, 29871, 29900, 1125, 29900, 29889, 29906, 29888, 10560, 829, 9653, 3238, 13, 829, 492, 3238, 13, 30004, 13, 15945, 19451, 13, 30004, 13, 1678, 1962, 353, 337, 29889, 1491, 29898, 29878, 29908, 6224, 6728, 9156, 613, 6728, 29892, 1962, 8443, 13, 1678, 1962, 353, 337, 29889, 1491, 29898, 29878, 29908, 6224, 6361, 29918, 1761, 9156, 613, 6361, 29918, 1761, 29892, 1962, 8443, 13, 30004, 13, 1678, 5706, 29918, 4905, 29918, 12083, 26471, 13, 1678, 411, 1722, 703, 13525, 29914, 29880, 8737, 29889, 15120, 613, 376, 29893, 1159, 408, 285, 29901, 30004, 13, 4706, 285, 29889, 3539, 29898, 4905, 8443, 13, 30004, 13, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 29937, 4241, 6680, 30004, 13, 13383, 13383, 13383, 13383, 13383, 30004, 13, 30004, 13, 12674, 822, 1667, 580, 1599, 6213, 29901, 30004, 13, 1678, 9995, 30004, 13, 1678, 3251, 403, 599, 4319, 2710, 30004, 13, 1678, 9995, 30004, 13, 1678, 2130, 29918, 6979, 353, 2897, 29889, 657, 6272, 703, 2477, 23524, 29918, 4986, 29968, 1430, 1159, 30004, 13, 1678, 565, 451, 2130, 29918, 6979, 29901, 30004, 13, 4706, 396, 2130, 29918, 6979, 353, 2897, 29889, 657, 6272, 703, 29954, 13054, 7466, 29918, 4986, 29968, 1430, 1159, 30004, 13, 4706, 12020, 8960, 703, 29909, 7333, 2130, 5993, 338, 3734, 304, 8469, 29991, 1159, 30004, 13, 1678, 1404, 353, 2897, 29889, 657, 6272, 703, 29954, 13054, 7466, 29918, 17923, 1955, 1159, 30004, 13, 1678, 19060, 29918, 276, 1066, 353, 2897, 29889, 657, 6272, 703, 5746, 6154, 29965, 2287, 29928, 1159, 30004, 13, 1678, 19060, 29918, 276, 1066, 353, 21313, 29916, 29889, 17010, 580, 363, 921, 297, 19060, 29918, 276, 1066, 29889, 5451, 28165, 1159, 8117, 13, 462, 268, 565, 19060, 29918, 276, 1066, 1683, 6213, 8443, 13, 1678, 19060, 29918, 3893, 29879, 353, 2897, 29889, 657, 6272, 703, 5746, 6154, 29965, 2287, 29928, 29918, 29931, 2190, 10749, 1159, 30004, 13, 1678, 19060, 29918, 3893, 29879, 353, 21313, 29916, 29889, 17010, 580, 363, 921, 297, 19060, 29918, 3893, 29879, 29889, 5451, 28165, 1159, 8117, 13, 462, 268, 565, 19060, 29918, 3893, 29879, 1683, 6213, 8443, 13, 1678, 396, 14806, 263, 8760, 29891, 995, 304, 263, 11185, 30004, 13, 1678, 11455, 29918, 29888, 548, 287, 29918, 276, 1066, 353, 2897, 29889, 657, 6272, 703, 5746, 6154, 29965, 2287, 29918, 22051, 29968, 3352, 29918, 1525, 24815, 1159, 30004, 13, 1678, 11455, 29918, 29888, 548, 287, 29918, 276, 1066, 353, 313, 1333, 451, 11455, 29918, 29888, 548, 287, 29918, 276, 1066, 6756, 13, 462, 965, 322, 11455, 29918, 29888, 548, 287, 29918, 276, 1066, 29889, 17010, 2141, 13609, 580, 2804, 376, 4541, 1159, 30004, 13, 1678, 7465, 411, 263, 601, 1124, 29889, 4032, 7317, 580, 408, 4867, 29901, 30004, 13, 4706, 269, 353, 624, 1446, 29898, 1792, 29892, 2130, 29918, 6979, 29892, 4867, 29892, 19060, 29918, 276, 1066, 29922, 735, 2325, 29918, 276, 1066, 11167, 13, 462, 29871, 19060, 29918, 3893, 29879, 29922, 735, 2325, 29918, 3893, 29879, 11167, 13, 462, 29871, 11455, 29918, 29888, 548, 287, 29918, 276, 1066, 29922, 17281, 29918, 29888, 548, 287, 29918, 276, 1066, 8443, 13, 4706, 7272, 408, 948, 3934, 29889, 29887, 1624, 29898, 17158, 29918, 29880, 8737, 29898, 29879, 511, 5706, 29918, 957, 1493, 29898, 29879, 876, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 30004, 13, 1678, 408, 948, 3934, 29889, 3389, 29898, 3396, 3101, 30004, 13, 2 ]
experiments/counters.py
PetrDlouhy/django-experiments
237
76462
from django.utils.functional import cached_property from redis.exceptions import ConnectionError, ResponseError from experiments.redis_client import get_redis_client COUNTER_CACHE_KEY = 'experiments:participants:%s' COUNTER_FREQ_CACHE_KEY = 'experiments:freq:%s' class Counters(object): @cached_property def _redis(self): return get_redis_client() def increment(self, key, participant_identifier, count=1): if count == 0: return try: cache_key = COUNTER_CACHE_KEY % key freq_cache_key = COUNTER_FREQ_CACHE_KEY % key new_value = self._redis.hincrby(cache_key, participant_identifier, count) # Maintain histogram of per-user counts if new_value > count: self._redis.hincrby(freq_cache_key, new_value - count, -1) self._redis.hincrby(freq_cache_key, new_value, 1) except (ConnectionError, ResponseError): # Handle Redis failures gracefully pass def clear(self, key, participant_identifier): try: # Remove the direct entry cache_key = COUNTER_CACHE_KEY % key pipe = self._redis.pipeline() freq, _ = pipe.hget(cache_key, participant_identifier).hdel(cache_key, participant_identifier).execute() # Remove from the histogram freq_cache_key = COUNTER_FREQ_CACHE_KEY % key self._redis.hincrby(freq_cache_key, freq or 0, -1) except (ConnectionError, ResponseError): # Handle Redis failures gracefully pass def get(self, key): try: cache_key = COUNTER_CACHE_KEY % key return self._redis.hlen(cache_key) except (ConnectionError, ResponseError): # Handle Redis failures gracefully return 0 def get_frequency(self, key, participant_identifier): try: cache_key = COUNTER_CACHE_KEY % key freq = self._redis.hget(cache_key, participant_identifier) return int(freq) if freq else 0 except (ConnectionError, ResponseError): # Handle Redis failures gracefully return 0 def get_frequencies(self, key): try: freq_cache_key = COUNTER_FREQ_CACHE_KEY % key # In some cases when there are concurrent updates going on, there can # briefly be a negative result for some frequency count. We discard these # as they shouldn't really affect the result, and they are about to become # zero anyway. return dict((int(k), int(v)) for (k, v) in self._redis.hgetall(freq_cache_key).items() if int(v) > 0) except (ConnectionError, ResponseError): # Handle Redis failures gracefully return dict() def reset(self, key): try: cache_key = COUNTER_CACHE_KEY % key self._redis.delete(cache_key) freq_cache_key = COUNTER_FREQ_CACHE_KEY % key self._redis.delete(freq_cache_key) return True except (ConnectionError, ResponseError): # Handle Redis failures gracefully return False def reset_pattern(self, pattern_key): #similar to above, but can pass pattern as arg instead try: cache_key = COUNTER_CACHE_KEY % pattern_key for key in self._redis.keys(cache_key): self._redis.delete(key) freq_cache_key = COUNTER_FREQ_CACHE_KEY % pattern_key for key in self._redis.keys(freq_cache_key): self._redis.delete(key) return True except (ConnectionError, ResponseError): # Handle Redis failures gracefully return False def reset_prefix(self, key_prefix): # Delete all data in redis for a given key prefix from experiments.utils import grouper try: for key_pattern in [COUNTER_CACHE_KEY, COUNTER_FREQ_CACHE_KEY]: match = "%s:*" % (key_pattern % key_prefix) key_iter = self._redis.scan_iter(match) # Delete keys in groups of 1000 to prevent problems with long # running experiments having many participants for keys in grouper(key_iter, 1000): # The last group will be padded with None to reach the specified batch # size, so these are filtered out here self._redis.delete(*filter(None, keys)) except (ConnectionError, ResponseError): # Handle Redis failures gracefully pass
[ 1, 515, 9557, 29889, 13239, 29889, 2220, 284, 1053, 22152, 29918, 6799, 13, 13, 3166, 29825, 29889, 11739, 29879, 1053, 15160, 2392, 29892, 13291, 2392, 13, 13, 3166, 15729, 29889, 1127, 275, 29918, 4645, 1053, 679, 29918, 1127, 275, 29918, 4645, 13, 13, 13, 3217, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 353, 525, 735, 546, 7862, 29901, 1595, 12654, 1934, 16664, 29879, 29915, 13, 3217, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 353, 525, 735, 546, 7862, 29901, 29888, 7971, 16664, 29879, 29915, 13, 13, 13, 1990, 6237, 2153, 29898, 3318, 1125, 13, 13, 1678, 732, 29883, 3791, 29918, 6799, 13, 1678, 822, 903, 1127, 275, 29898, 1311, 1125, 13, 4706, 736, 679, 29918, 1127, 275, 29918, 4645, 580, 13, 13, 1678, 822, 11924, 29898, 1311, 29892, 1820, 29892, 5221, 424, 29918, 25378, 29892, 2302, 29922, 29896, 1125, 13, 4706, 565, 2302, 1275, 29871, 29900, 29901, 13, 9651, 736, 13, 13, 4706, 1018, 29901, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 3005, 29939, 29918, 8173, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 716, 29918, 1767, 353, 1583, 3032, 1127, 275, 29889, 29882, 3742, 29878, 1609, 29898, 8173, 29918, 1989, 29892, 5221, 424, 29918, 25378, 29892, 2302, 29897, 13, 13, 9651, 396, 341, 2365, 475, 9825, 13342, 310, 639, 29899, 1792, 18139, 13, 9651, 565, 716, 29918, 1767, 1405, 2302, 29901, 13, 18884, 1583, 3032, 1127, 275, 29889, 29882, 3742, 29878, 1609, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 29892, 716, 29918, 1767, 448, 2302, 29892, 448, 29896, 29897, 13, 9651, 1583, 3032, 1127, 275, 29889, 29882, 3742, 29878, 1609, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 29892, 716, 29918, 1767, 29892, 29871, 29896, 29897, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 1209, 13, 13, 1678, 822, 2821, 29898, 1311, 29892, 1820, 29892, 5221, 424, 29918, 25378, 1125, 13, 4706, 1018, 29901, 13, 9651, 396, 15154, 278, 1513, 6251, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 14282, 353, 1583, 3032, 1127, 275, 29889, 13096, 5570, 580, 13, 9651, 3005, 29939, 29892, 903, 353, 14282, 29889, 29882, 657, 29898, 8173, 29918, 1989, 29892, 5221, 424, 29918, 25378, 467, 29882, 6144, 29898, 8173, 29918, 1989, 29892, 5221, 424, 29918, 25378, 467, 7978, 580, 13, 13, 9651, 396, 15154, 515, 278, 9825, 13342, 13, 9651, 3005, 29939, 29918, 8173, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 1583, 3032, 1127, 275, 29889, 29882, 3742, 29878, 1609, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 29892, 3005, 29939, 470, 29871, 29900, 29892, 448, 29896, 29897, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 1209, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 1820, 1125, 13, 4706, 1018, 29901, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 736, 1583, 3032, 1127, 275, 29889, 29785, 29898, 8173, 29918, 1989, 29897, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 736, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 10745, 23860, 29898, 1311, 29892, 1820, 29892, 5221, 424, 29918, 25378, 1125, 13, 4706, 1018, 29901, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 3005, 29939, 353, 1583, 3032, 1127, 275, 29889, 29882, 657, 29898, 8173, 29918, 1989, 29892, 5221, 424, 29918, 25378, 29897, 13, 9651, 736, 938, 29898, 29888, 7971, 29897, 565, 3005, 29939, 1683, 29871, 29900, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 736, 29871, 29900, 13, 13, 1678, 822, 679, 29918, 10745, 339, 15942, 29898, 1311, 29892, 1820, 1125, 13, 4706, 1018, 29901, 13, 9651, 3005, 29939, 29918, 8173, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 396, 512, 777, 4251, 746, 727, 526, 21984, 11217, 2675, 373, 29892, 727, 508, 13, 9651, 396, 23359, 367, 263, 8178, 1121, 363, 777, 10868, 2302, 29889, 1334, 2313, 538, 1438, 13, 9651, 396, 408, 896, 9273, 29915, 29873, 2289, 6602, 278, 1121, 29892, 322, 896, 526, 1048, 304, 4953, 13, 9651, 396, 5225, 8763, 29889, 13, 9651, 736, 9657, 3552, 524, 29898, 29895, 511, 938, 29898, 29894, 876, 363, 313, 29895, 29892, 325, 29897, 297, 1583, 3032, 1127, 275, 29889, 29882, 657, 497, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 467, 7076, 580, 565, 938, 29898, 29894, 29897, 1405, 29871, 29900, 29897, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 736, 9657, 580, 13, 13, 1678, 822, 10092, 29898, 1311, 29892, 1820, 1125, 13, 4706, 1018, 29901, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 1583, 3032, 1127, 275, 29889, 8143, 29898, 8173, 29918, 1989, 29897, 13, 9651, 3005, 29939, 29918, 8173, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 1820, 13, 9651, 1583, 3032, 1127, 275, 29889, 8143, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 29897, 13, 9651, 736, 5852, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 736, 7700, 13, 13, 1678, 822, 10092, 29918, 11037, 29898, 1311, 29892, 4766, 29918, 1989, 1125, 13, 4706, 396, 29764, 304, 2038, 29892, 541, 508, 1209, 4766, 408, 1852, 2012, 13, 4706, 1018, 29901, 13, 9651, 7090, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 4766, 29918, 1989, 13, 9651, 363, 1820, 297, 1583, 3032, 1127, 275, 29889, 8149, 29898, 8173, 29918, 1989, 1125, 13, 18884, 1583, 3032, 1127, 275, 29889, 8143, 29898, 1989, 29897, 13, 9651, 3005, 29939, 29918, 8173, 29918, 1989, 353, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 1273, 4766, 29918, 1989, 13, 9651, 363, 1820, 297, 1583, 3032, 1127, 275, 29889, 8149, 29898, 29888, 7971, 29918, 8173, 29918, 1989, 1125, 13, 18884, 1583, 3032, 1127, 275, 29889, 8143, 29898, 1989, 29897, 13, 9651, 736, 5852, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 736, 7700, 13, 418, 13, 1678, 822, 10092, 29918, 13506, 29898, 1311, 29892, 1820, 29918, 13506, 1125, 13, 4706, 396, 21267, 599, 848, 297, 29825, 363, 263, 2183, 1820, 10944, 13, 4706, 515, 15729, 29889, 13239, 1053, 867, 283, 546, 13, 308, 13, 4706, 1018, 29901, 13, 9651, 363, 1820, 29918, 11037, 297, 518, 3217, 3904, 4945, 29918, 29907, 2477, 9606, 29918, 10818, 29892, 4810, 3904, 4945, 29918, 29943, 1525, 29984, 29918, 29907, 2477, 9606, 29918, 10818, 5387, 13, 18884, 1993, 353, 11860, 29879, 29901, 20605, 1273, 313, 1989, 29918, 11037, 1273, 1820, 29918, 13506, 29897, 13, 18884, 1820, 29918, 1524, 353, 1583, 3032, 1127, 275, 29889, 16192, 29918, 1524, 29898, 4352, 29897, 13, 13, 18884, 396, 21267, 6611, 297, 6471, 310, 29871, 29896, 29900, 29900, 29900, 304, 5557, 4828, 411, 1472, 13, 18884, 396, 2734, 15729, 2534, 1784, 27138, 13, 18884, 363, 6611, 297, 867, 283, 546, 29898, 1989, 29918, 1524, 29892, 29871, 29896, 29900, 29900, 29900, 1125, 13, 462, 1678, 396, 450, 1833, 2318, 674, 367, 282, 23959, 411, 6213, 304, 6159, 278, 6790, 9853, 13, 462, 1678, 396, 2159, 29892, 577, 1438, 526, 22289, 714, 1244, 13, 462, 1678, 1583, 3032, 1127, 275, 29889, 8143, 10456, 4572, 29898, 8516, 29892, 6611, 876, 13, 4706, 5174, 313, 5350, 2392, 29892, 13291, 2392, 1125, 13, 9651, 396, 29273, 4367, 275, 4418, 1973, 17659, 3730, 13, 9651, 1209, 13, 2 ]
galaxy/main/migrations/0063_remove_deprecated_role_fields.py
tima/galaxy
0
185327
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('main', '0062_move_repository_counters'), ] operations = [ migrations.RemoveField(model_name='role', name='average_score'), migrations.RemoveField(model_name='role', name='bayesian_score'), migrations.RemoveField(model_name='role', name='num_ratings'), ]
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 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, 3396, 742, 525, 29900, 29900, 29953, 29906, 29918, 11631, 29918, 19033, 29918, 29883, 1309, 2153, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 4299, 29918, 978, 2433, 12154, 742, 1024, 2433, 12483, 482, 29918, 13628, 5477, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 4299, 29918, 978, 2433, 12154, 742, 1024, 2433, 27495, 18970, 29918, 13628, 5477, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 4299, 29918, 978, 2433, 12154, 742, 1024, 2433, 1949, 29918, 3605, 886, 5477, 13, 1678, 4514, 13, 2 ]
tests/observers/k8s_api_test.py
superhsuSFX/signalfx-agent
1
199511
from functools import partial as p import pytest import yaml from tests.helpers.assertions import has_all_dims, has_datapoint, has_dim_key from tests.helpers.kubernetes.utils import add_pod_spec_annotations from tests.helpers.util import wait_for from tests.paths import TEST_SERVICES_DIR @pytest.mark.kubernetes def test_k8s_api_observer_basic(k8s_cluster): nginx_yaml = TEST_SERVICES_DIR / "nginx/nginx-k8s.yaml" with k8s_cluster.create_resources([nginx_yaml]): config = f""" observers: - type: k8s-api monitors: - type: collectd/nginx discoveryRule: 'discovered_by == "k8s-api" && kubernetes_namespace == "{k8s_cluster.test_namespace}" && port == 80 && container_spec_name == "nginx"' url: "http://{{{{.Host}}}}:{{{{.Port}}}}/nginx_status" """ with k8s_cluster.run_agent(config) as agent: assert wait_for(p(has_datapoint, agent.fake_services, dimensions={"plugin": "nginx"})) @pytest.mark.kubernetes def test_config_from_annotations(k8s_cluster): nginx_yaml = TEST_SERVICES_DIR / "nginx/nginx-k8s.yaml" nginx_with_annotations = yaml.dump_all( add_pod_spec_annotations( yaml.safe_load_all(nginx_yaml.read_bytes()), { "agent.signalfx.com/monitorType.http": "collectd/nginx", "agent.signalfx.com/config.80.extraDimensions": "{source: myapp}", "agent.signalfx.com/config.80.disableEndpointDimensions": "true", }, ) ) with k8s_cluster.create_resources([nginx_with_annotations]): config = f""" observers: - type: k8s-api monitors: [] """ with k8s_cluster.run_agent(config) as agent: assert wait_for(p(has_datapoint, agent.fake_services, dimensions={"plugin": "nginx", "source": "myapp"})) for dp in agent.fake_services.datapoints: if not has_all_dims(dp, {"source": "myapp"}): continue assert not has_dim_key(dp, "kubernetes_pod_uid") @pytest.mark.kubernetes def test_k8s_annotations_in_discovery(k8s_cluster): nginx_yaml = TEST_SERVICES_DIR / "nginx/nginx-k8s.yaml" with k8s_cluster.create_resources([nginx_yaml]): config = """ observers: - type: k8s-api monitors: - type: collectd/nginx discoveryRule: 'Get(kubernetes_annotations, "allowScraping") == "true" && port == 80' """ with k8s_cluster.run_agent(config) as agent: assert wait_for(p(has_datapoint, agent.fake_services, dimensions={"plugin": "nginx"})) @pytest.mark.kubernetes def test_k8s_annotations_with_alt_ports(k8s_cluster): consul_yaml = list(yaml.safe_load_all((TEST_SERVICES_DIR / "consul/k8s.yaml").read_bytes())) # Remove the declared port so we make sure the additionalPortAnnotations is # what is causing it to be discovered. consul_yaml[0]["spec"]["template"]["spec"]["containers"][0]["ports"] = [] with k8s_cluster.create_resources([yaml.dump_all(consul_yaml)]): config = """ observers: - type: k8s-api additionalPortAnnotations: - prometheus.io/port monitors: - type: prometheus-exporter discoveryRule: 'Get(kubernetes_annotations, "prometheus.io/scrape") == "true" && Get(kubernetes_annotations, "prometheus.io/port") == ToString(port)' configEndpointMappings: metricPath: 'Get(kubernetes_annotations, "prometheus.io/path", "/metrics")' """ with k8s_cluster.run_agent(config) as agent: assert wait_for(p(has_datapoint, agent.fake_services, metric_name="consul_runtime_malloc_count"))
[ 1, 515, 2090, 312, 8789, 1053, 7687, 408, 282, 13, 13, 5215, 11451, 1688, 13, 5215, 343, 8807, 13, 3166, 6987, 29889, 3952, 6774, 29889, 9294, 1080, 1053, 756, 29918, 497, 29918, 6229, 29879, 29892, 756, 29918, 4130, 481, 2461, 29892, 756, 29918, 6229, 29918, 1989, 13, 3166, 6987, 29889, 3952, 6774, 29889, 29895, 17547, 29889, 13239, 1053, 788, 29918, 15334, 29918, 6550, 29918, 6735, 800, 13, 3166, 6987, 29889, 3952, 6774, 29889, 4422, 1053, 4480, 29918, 1454, 13, 3166, 6987, 29889, 24772, 1053, 17067, 1254, 29918, 6304, 29963, 2965, 2890, 29918, 9464, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 29895, 17547, 13, 1753, 1243, 29918, 29895, 29947, 29879, 29918, 2754, 29918, 711, 2974, 29918, 16121, 29898, 29895, 29947, 29879, 29918, 19594, 1125, 13, 1678, 19376, 29918, 25162, 353, 17067, 1254, 29918, 6304, 29963, 2965, 2890, 29918, 9464, 847, 376, 23257, 29914, 23257, 29899, 29895, 29947, 29879, 29889, 25162, 29908, 13, 1678, 411, 413, 29947, 29879, 29918, 19594, 29889, 3258, 29918, 13237, 4197, 23257, 29918, 25162, 29962, 1125, 13, 4706, 2295, 353, 285, 15945, 29908, 13, 9651, 5366, 874, 29901, 13, 632, 448, 1134, 29901, 413, 29947, 29879, 29899, 2754, 13, 9651, 1601, 17259, 29901, 13, 632, 448, 1134, 29901, 6314, 29881, 29914, 23257, 13, 1669, 20699, 10740, 29901, 525, 2218, 11911, 287, 29918, 1609, 1275, 376, 29895, 29947, 29879, 29899, 2754, 29908, 2607, 413, 17547, 29918, 22377, 1275, 29850, 29895, 29947, 29879, 29918, 19594, 29889, 1688, 29918, 22377, 5038, 2607, 2011, 1275, 29871, 29947, 29900, 2607, 5639, 29918, 6550, 29918, 978, 1275, 376, 23257, 29908, 29915, 13, 1669, 3142, 29901, 376, 1124, 597, 6224, 6224, 29889, 8514, 930, 930, 29901, 6224, 6224, 29889, 2290, 930, 930, 29914, 23257, 29918, 4882, 29908, 13, 4706, 9995, 13, 4706, 411, 413, 29947, 29879, 29918, 19594, 29889, 3389, 29918, 14748, 29898, 2917, 29897, 408, 10823, 29901, 13, 9651, 4974, 4480, 29918, 1454, 29898, 29886, 29898, 5349, 29918, 4130, 481, 2461, 29892, 10823, 29889, 29888, 1296, 29918, 9916, 29892, 13391, 3790, 29908, 8582, 1115, 376, 23257, 9092, 876, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 29895, 17547, 13, 1753, 1243, 29918, 2917, 29918, 3166, 29918, 6735, 800, 29898, 29895, 29947, 29879, 29918, 19594, 1125, 13, 1678, 19376, 29918, 25162, 353, 17067, 1254, 29918, 6304, 29963, 2965, 2890, 29918, 9464, 847, 376, 23257, 29914, 23257, 29899, 29895, 29947, 29879, 29889, 25162, 29908, 13, 1678, 19376, 29918, 2541, 29918, 6735, 800, 353, 343, 8807, 29889, 15070, 29918, 497, 29898, 13, 4706, 788, 29918, 15334, 29918, 6550, 29918, 6735, 800, 29898, 13, 9651, 343, 8807, 29889, 11177, 29918, 1359, 29918, 497, 29898, 23257, 29918, 25162, 29889, 949, 29918, 13193, 25739, 13, 9651, 426, 13, 18884, 376, 14748, 29889, 4530, 3131, 29916, 29889, 510, 29914, 3712, 2105, 1542, 29889, 1124, 1115, 376, 15914, 29881, 29914, 23257, 613, 13, 18884, 376, 14748, 29889, 4530, 3131, 29916, 29889, 510, 29914, 2917, 29889, 29947, 29900, 29889, 17833, 16142, 5580, 1115, 29850, 4993, 29901, 590, 932, 17671, 13, 18884, 376, 14748, 29889, 4530, 3131, 29916, 29889, 510, 29914, 2917, 29889, 29947, 29900, 29889, 20472, 25602, 16142, 5580, 1115, 376, 3009, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 1678, 1723, 13, 1678, 411, 413, 29947, 29879, 29918, 19594, 29889, 3258, 29918, 13237, 4197, 23257, 29918, 2541, 29918, 6735, 800, 29962, 1125, 13, 4706, 2295, 353, 285, 15945, 29908, 13, 9651, 5366, 874, 29901, 13, 632, 448, 1134, 29901, 413, 29947, 29879, 29899, 2754, 13, 9651, 1601, 17259, 29901, 5159, 13, 4706, 9995, 13, 4706, 411, 413, 29947, 29879, 29918, 19594, 29889, 3389, 29918, 14748, 29898, 2917, 29897, 408, 10823, 29901, 13, 9651, 4974, 4480, 29918, 1454, 29898, 29886, 29898, 5349, 29918, 4130, 481, 2461, 29892, 10823, 29889, 29888, 1296, 29918, 9916, 29892, 13391, 3790, 29908, 8582, 1115, 376, 23257, 613, 376, 4993, 1115, 376, 1357, 932, 9092, 876, 13, 9651, 363, 270, 29886, 297, 10823, 29889, 29888, 1296, 29918, 9916, 29889, 4130, 481, 2461, 29879, 29901, 13, 18884, 565, 451, 756, 29918, 497, 29918, 6229, 29879, 29898, 6099, 29892, 8853, 4993, 1115, 376, 1357, 932, 9092, 1125, 13, 462, 1678, 6773, 13, 18884, 4974, 451, 756, 29918, 6229, 29918, 1989, 29898, 6099, 29892, 376, 29895, 17547, 29918, 15334, 29918, 5416, 1159, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 29895, 17547, 13, 1753, 1243, 29918, 29895, 29947, 29879, 29918, 6735, 800, 29918, 262, 29918, 2218, 11911, 29891, 29898, 29895, 29947, 29879, 29918, 19594, 1125, 13, 1678, 19376, 29918, 25162, 353, 17067, 1254, 29918, 6304, 29963, 2965, 2890, 29918, 9464, 847, 376, 23257, 29914, 23257, 29899, 29895, 29947, 29879, 29889, 25162, 29908, 13, 1678, 411, 413, 29947, 29879, 29918, 19594, 29889, 3258, 29918, 13237, 4197, 23257, 29918, 25162, 29962, 1125, 13, 4706, 2295, 353, 9995, 13, 9651, 5366, 874, 29901, 13, 9651, 448, 1134, 29901, 413, 29947, 29879, 29899, 2754, 13, 13, 9651, 1601, 17259, 29901, 13, 9651, 448, 1134, 29901, 6314, 29881, 29914, 23257, 13, 795, 20699, 10740, 29901, 525, 2577, 29898, 29895, 17547, 29918, 6735, 800, 29892, 376, 9536, 4421, 2390, 292, 1159, 1275, 376, 3009, 29908, 2607, 2011, 1275, 29871, 29947, 29900, 29915, 13, 4706, 9995, 13, 4706, 411, 413, 29947, 29879, 29918, 19594, 29889, 3389, 29918, 14748, 29898, 2917, 29897, 408, 10823, 29901, 13, 9651, 4974, 4480, 29918, 1454, 29898, 29886, 29898, 5349, 29918, 4130, 481, 2461, 29892, 10823, 29889, 29888, 1296, 29918, 9916, 29892, 13391, 3790, 29908, 8582, 1115, 376, 23257, 9092, 876, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 29895, 17547, 13, 1753, 1243, 29918, 29895, 29947, 29879, 29918, 6735, 800, 29918, 2541, 29918, 1997, 29918, 4011, 29898, 29895, 29947, 29879, 29918, 19594, 1125, 13, 1678, 1136, 352, 29918, 25162, 353, 1051, 29898, 25162, 29889, 11177, 29918, 1359, 29918, 497, 3552, 18267, 29918, 6304, 29963, 2965, 2890, 29918, 9464, 847, 376, 3200, 352, 29914, 29895, 29947, 29879, 29889, 25162, 2564, 949, 29918, 13193, 22130, 13, 1678, 396, 15154, 278, 8052, 2011, 577, 591, 1207, 1854, 278, 5684, 2290, 2744, 1333, 800, 338, 13, 1678, 396, 825, 338, 10805, 372, 304, 367, 10943, 29889, 13, 1678, 1136, 352, 29918, 25162, 29961, 29900, 29962, 3366, 6550, 3108, 3366, 6886, 3108, 3366, 6550, 3108, 3366, 1285, 475, 414, 3108, 29961, 29900, 29962, 3366, 4011, 3108, 353, 5159, 13, 13, 1678, 411, 413, 29947, 29879, 29918, 19594, 29889, 3258, 29918, 13237, 4197, 25162, 29889, 15070, 29918, 497, 29898, 3200, 352, 29918, 25162, 4638, 1125, 13, 4706, 2295, 353, 9995, 13, 9651, 5366, 874, 29901, 13, 9651, 448, 1134, 29901, 413, 29947, 29879, 29899, 2754, 13, 795, 5684, 2290, 2744, 1333, 800, 29901, 13, 1669, 448, 2504, 23043, 375, 29889, 601, 29914, 637, 13, 13, 9651, 1601, 17259, 29901, 13, 632, 448, 1134, 29901, 2504, 23043, 375, 29899, 735, 18505, 13, 1669, 20699, 10740, 29901, 525, 2577, 29898, 29895, 17547, 29918, 6735, 800, 29892, 376, 14032, 23043, 375, 29889, 601, 29914, 1557, 336, 412, 1159, 1275, 376, 3009, 29908, 2607, 3617, 29898, 29895, 17547, 29918, 6735, 800, 29892, 376, 14032, 23043, 375, 29889, 601, 29914, 637, 1159, 1275, 1763, 1231, 29898, 637, 16029, 13, 1669, 2295, 25602, 9689, 886, 29901, 13, 462, 12714, 2605, 29901, 525, 2577, 29898, 29895, 17547, 29918, 6735, 800, 29892, 376, 14032, 23043, 375, 29889, 601, 29914, 2084, 613, 5591, 2527, 10817, 1159, 29915, 13, 4706, 9995, 13, 4706, 411, 413, 29947, 29879, 29918, 19594, 29889, 3389, 29918, 14748, 29898, 2917, 29897, 408, 10823, 29901, 13, 9651, 4974, 4480, 29918, 1454, 29898, 29886, 29898, 5349, 29918, 4130, 481, 2461, 29892, 10823, 29889, 29888, 1296, 29918, 9916, 29892, 12714, 29918, 978, 543, 3200, 352, 29918, 15634, 29918, 27631, 29918, 2798, 5783, 13, 2 ]
lib/segmentation/algorithm.py
rusty1s/embedded_gcnn
74
50455
<reponame>rusty1s/embedded_gcnn<gh_stars>10-100 import numpy as np from skimage import color, segmentation def slic(image, num_segments, compactness=10, max_iterations=10, sigma=0): image = _preprocess(image) return segmentation.slic(image, num_segments, compactness, max_iterations, sigma) def slic_fixed(num_segments, compactness=10, max_iterations=10, sigma=0): def slic_image(image): return slic(image, num_segments, compactness, max_iterations, sigma) return slic_image def quickshift(image, ratio=1, kernel_size=5, max_dist=1, sigma=0): image = _preprocess(image) return segmentation.quickshift( image, ratio, kernel_size, max_dist, sigma=sigma) def quickshift_fixed(ratio=1, kernel_size=5, max_dist=1, sigma=0): def quickshift_image(image): return quickshift(image, ratio, kernel_size, max_dist, sigma) return quickshift_image def felzenszwalb(image, scale=1, min_size=1, sigma=0): image = _preprocess(image) return segmentation.felzenszwalb(image, scale, sigma, min_size) def felzenszwalb_fixed(scale=1, min_size=1, sigma=0): def felzenszwalb_image(image): return felzenszwalb(image, scale, min_size, sigma) return felzenszwalb_image def _preprocess(image): if len(image.shape) == 2 or image.shape[2] == 1: return color.gray2rgb( np.reshape(image, (image.shape[0], image.shape[1]))) else: return image
[ 1, 529, 276, 1112, 420, 29958, 23575, 29891, 29896, 29879, 29914, 17987, 7176, 29918, 27354, 15755, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 3027, 1053, 2927, 29892, 10768, 362, 13, 13, 13, 1753, 269, 506, 29898, 3027, 29892, 954, 29918, 10199, 1860, 29892, 11071, 2264, 29922, 29896, 29900, 29892, 4236, 29918, 1524, 800, 29922, 29896, 29900, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 1967, 353, 903, 1457, 5014, 29898, 3027, 29897, 13, 1678, 736, 10768, 362, 29889, 29879, 506, 29898, 3027, 29892, 954, 29918, 10199, 1860, 29892, 11071, 2264, 29892, 4236, 29918, 1524, 800, 29892, 13, 462, 632, 269, 2934, 29897, 13, 13, 13, 1753, 269, 506, 29918, 20227, 29898, 1949, 29918, 10199, 1860, 29892, 11071, 2264, 29922, 29896, 29900, 29892, 4236, 29918, 1524, 800, 29922, 29896, 29900, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 822, 269, 506, 29918, 3027, 29898, 3027, 1125, 13, 4706, 736, 269, 506, 29898, 3027, 29892, 954, 29918, 10199, 1860, 29892, 11071, 2264, 29892, 4236, 29918, 1524, 800, 29892, 269, 2934, 29897, 13, 13, 1678, 736, 269, 506, 29918, 3027, 13, 13, 13, 1753, 4996, 10889, 29898, 3027, 29892, 11959, 29922, 29896, 29892, 8466, 29918, 2311, 29922, 29945, 29892, 4236, 29918, 5721, 29922, 29896, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 1967, 353, 903, 1457, 5014, 29898, 3027, 29897, 13, 1678, 736, 10768, 362, 29889, 24561, 10889, 29898, 13, 4706, 1967, 29892, 11959, 29892, 8466, 29918, 2311, 29892, 4236, 29918, 5721, 29892, 269, 2934, 29922, 3754, 29897, 13, 13, 13, 1753, 4996, 10889, 29918, 20227, 29898, 3605, 601, 29922, 29896, 29892, 8466, 29918, 2311, 29922, 29945, 29892, 4236, 29918, 5721, 29922, 29896, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 822, 4996, 10889, 29918, 3027, 29898, 3027, 1125, 13, 4706, 736, 4996, 10889, 29898, 3027, 29892, 11959, 29892, 8466, 29918, 2311, 29892, 4236, 29918, 5721, 29892, 269, 2934, 29897, 13, 13, 1678, 736, 4996, 10889, 29918, 3027, 13, 13, 13, 1753, 7995, 29920, 575, 7659, 284, 29890, 29898, 3027, 29892, 6287, 29922, 29896, 29892, 1375, 29918, 2311, 29922, 29896, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 1967, 353, 903, 1457, 5014, 29898, 3027, 29897, 13, 1678, 736, 10768, 362, 29889, 13287, 29920, 575, 7659, 284, 29890, 29898, 3027, 29892, 6287, 29892, 269, 2934, 29892, 1375, 29918, 2311, 29897, 13, 13, 13, 1753, 7995, 29920, 575, 7659, 284, 29890, 29918, 20227, 29898, 7052, 29922, 29896, 29892, 1375, 29918, 2311, 29922, 29896, 29892, 269, 2934, 29922, 29900, 1125, 13, 1678, 822, 7995, 29920, 575, 7659, 284, 29890, 29918, 3027, 29898, 3027, 1125, 13, 4706, 736, 7995, 29920, 575, 7659, 284, 29890, 29898, 3027, 29892, 6287, 29892, 1375, 29918, 2311, 29892, 269, 2934, 29897, 13, 13, 1678, 736, 7995, 29920, 575, 7659, 284, 29890, 29918, 3027, 13, 13, 13, 1753, 903, 1457, 5014, 29898, 3027, 1125, 13, 1678, 565, 7431, 29898, 3027, 29889, 12181, 29897, 1275, 29871, 29906, 470, 1967, 29889, 12181, 29961, 29906, 29962, 1275, 29871, 29896, 29901, 13, 4706, 736, 2927, 29889, 21012, 29906, 23973, 29898, 13, 9651, 7442, 29889, 690, 14443, 29898, 3027, 29892, 313, 3027, 29889, 12181, 29961, 29900, 1402, 1967, 29889, 12181, 29961, 29896, 29962, 4961, 13, 1678, 1683, 29901, 13, 4706, 736, 1967, 13, 2 ]
allocate/__init__.py
BraeWebb/allocate
0
75297
<filename>allocate/__init__.py """ Tutor allocation algorithm for allocating tutors to the optimal sessions. """ __author__ = "<NAME>, <NAME>" __all__ = ['allocation', 'doodle', 'model', 'solver', 'csvalidator']
[ 1, 529, 9507, 29958, 15956, 403, 29914, 1649, 2344, 26914, 2272, 13, 15945, 29908, 13, 29911, 3406, 24082, 5687, 363, 6643, 1218, 7149, 943, 304, 278, 14413, 21396, 29889, 13, 15945, 29908, 13, 13, 1649, 8921, 1649, 353, 9872, 5813, 10202, 529, 5813, 11903, 13, 1649, 497, 1649, 353, 6024, 284, 5479, 742, 525, 1867, 397, 280, 742, 525, 4299, 742, 525, 2929, 369, 742, 525, 2395, 3084, 1061, 2033, 13, 2 ]