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
utils/data_preparation.py
hkailee/Quant-Finance
1
111967
<reponame>hkailee/Quant-Finance # importing library packages import os, pickle, requests import bs4 as bs import numpy as np import pandas as pd import pandas_market_calendars as mcal import re from alpha_vantage.timeseries import TimeSeries from datetime import datetime, timedelta from pandas.tseries.holiday import AbstractHolidayCalendar, Holiday, nearest_workday, \ USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, \ USLaborDay, USThanksgivingDay ts = TimeSeries(key='<KEY>', output_format='pandas', indexing_type='date', retries=100) ###================================================================== # Defining class for US Non-Trading date class USNonTradingCalendar(AbstractHolidayCalendar): rules = [ Holiday('NewYearsDay', month=1, day=1, observance=nearest_workday), USMartinLutherKingJr, USPresidentsDay, GoodFriday, USMemorialDay, Holiday('USIndependenceDay', month=7, day=4, observance=nearest_workday), USLaborDay, USThanksgivingDay, Holiday('Christmas', month=12, day=25, observance=nearest_workday) ] # to get trading closed holidays def get_trading_close_holidays(year): inst = USNonTradingCalendar() return inst.holidays(datetime(year-1, 12, 31), datetime(year, 12, 31)) # to get and save the companies listed in current sp500 def save_sp500_tickers(): resp = requests.get('https://en.wikipedia.org/wiki/List_of_S%26P_500_companies') soup = bs.BeautifulSoup(resp.text, 'lxml') table = soup.find('table', {'class':'wikitable sortable'}) tickers = [] for row in table.findAll('tr')[1:]: ticker = row.findAll('td')[1].text tickers.append(ticker) # define today date todaydate = datetime.now().strftime('%Y%m%d') with open('sp500ticker_{}.pickle'.format(todaydate), 'wb') as f: pickle.dump(tickers, f) return tickers # to get and save the companies listed in current sp500 def get_data(reload_sp500=False): init = 0 if reload_sp500: tickers = save_sp500_tickers() else: with open('sp500ticker.pickle', 'rb') as f: tickers = pickle.load(f) if not os.path.exists('eod_alphavantage'): os.makedirs('eod_alphavantage') for ticker in tickers: if init == 45: break # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' try: if not os.path.exists('eod_alphavantage/{}.csv'.format(ticker)): df, meta_data = ts.get_daily_adjusted(ticker, outputsize='full') df.to_csv('eod_alphavantage/{}.csv'.format(ticker)) print(ticker, 'okay') init += 1 else: print('Already have {}'.format(ticker)) except: print(ticker, '>>>>>>>> bad') init += 1 continue # to get and save the companies listed in current sp500 def get_data(reload_sp500=False): init = 0 if reload_sp500: tickers = save_sp500_tickers() else: with open('sp500ticker.pickle', 'rb') as f: tickers = pickle.load(f) if not os.path.exists('eod_alphavantage'): os.makedirs('eod_alphavantage') for ticker in tickers: if init == 45: break # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' try: if not os.path.exists('eod_alphavantage/{}.csv'.format(ticker)): df, meta_data = ts.get_daily_adjusted(ticker, outputsize='full') df.to_csv('eod_alphavantage/{}.csv'.format(ticker)) print(ticker, 'okay') init += 1 else: print('Already have {}'.format(ticker)) except: print(ticker, '>>>>>>>> bad') init += 1 continue # to get and save the S&P500 companies of interest (retrieved on 7th April 2019) def get_data_targeted(csvdir_processed_startdate='2012-05-18'): todayDate = datetime.now().strftime('%Y-%m-%d') if not os.path.exists('eod_alphavantage/' + todayDate): os.makedirs('eod_alphavantage/' + todayDate) init = 0 # list all the csv files in the target directory ###++++++++++++++++++++++++++++++++++++++++#### csvs_directory = 'csvdir_processed/' + csvdir_processed_startdate \ + '_breakout/daily' # Filing number of unique ticker found in the csvs_directory csvFiles = [f for f in os.listdir(csvs_directory) if re.match(r'[A-Z]+\.csv', f)] tickerFile_re = re.compile(r'([A-Z]+)\.csv') tickers = [] for ticker in csvFiles: tickers.append(tickerFile_re.findall(ticker)) tickers_list = list(traverse(tickers)) for ticker in tickers_list: if init == 100: break # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' try: if not os.path.exists('eod_alphavantage/' + todayDate + '/{}.csv'.format(ticker)): df, meta_data = ts.get_daily_adjusted(ticker, outputsize='full') df.to_csv('eod_alphavantage/' + todayDate + '/{}.csv'.format(ticker)) print(ticker, 'okay') init += 1 else: print('Already have {}'.format(ticker)) except: print(ticker, '>>>>>>>> bad') init += 1 continue # A function to prepare raw data for zipline bundles def process_raw_data(tickers, startdate='2010-07-15'): if not os.path.exists('csvdir_processed/' + startdate + '/daily'): os.makedirs('csvdir_processed/' + startdate + '/daily') parsable_tickers = [ticker for ticker in tickers if ticker not in ['APTV', 'DOW']] for ticker in parsable_tickers: # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' # read raw data df = pd.read_csv('eod_alphavantage/{}.csv'.format(ticker)) # only include those data with the startdate data if startdate in set(df['date']): df.set_index('date', inplace=True) df.columns = ['open', 'high', 'low','close', 'adjusted close', 'volume', \ 'dividend', 'split'] df.drop('adjusted close', axis=1, inplace=True) df = df.loc[startdate:] df.iloc[:-1].to_csv('csvdir_processed/' + startdate + '/daily/{}.csv'.format(ticker)) else: print(ticker + ' was excluded as its first tick was collected from ' + df['date'][0]) # A function to prepare raw data for breakout strategy input def process_raw_data_breakout(tickers, startdate='2012-05-18'): if not os.path.exists('csvdir_processed/' + startdate + '_breakout/daily'): os.makedirs('csvdir_processed/' + startdate + '_breakout/daily') parsable_tickers = [ticker for ticker in tickers if ticker not in ['APTV', 'DOW']] for ticker in parsable_tickers: # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' # read raw data df = pd.read_csv('eod_alphavantage/{}.csv'.format(ticker)) # only include those data with the startdate data if startdate in set(df['date']): df.set_index('date', inplace=True) df.columns = ['open', 'high', 'low','close', 'adjusted close', 'volume', \ 'dividend', 'split'] df = df.loc[startdate:] df.to_csv('csvdir_processed/' + startdate + '_breakout/daily/{}.csv'.format(ticker)) else: print(ticker + ' was excluded as its first tick was collected from ' + df['date'][0]) # A function to prepare raw data for breakout strategy input def process_raw_data_breakout_appending(startdate='2012-05-18', enddate='2019-04-11'): # todayDate = datetime.now().strftime('%Y-%m-%d') init = 0 # list all the csv files in the target directory ###++++++++++++++++++++++++++++++++++++++++#### csvs_directory = 'csvdir_processed/' + startdate \ + '_breakout/daily' # Filing number of unique ticker found in the csvs_directory csvFiles = [f for f in os.listdir(csvs_directory) if re.match(r'[A-Z]+\.csv', f)] tickerFile_re = re.compile(r'([A-Z]+)\.csv') tickers = [] for ticker in csvFiles: tickers.append(tickerFile_re.findall(ticker)) tickers_list = list(traverse(tickers)) for ticker in tickers_list: # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' # read existing ticker dataset to update df = pd.read_csv(csvs_directory + '/{}.csv'.format(ticker), index_col='date') # read new ticker dataset to append df_to_append = pd.read_csv('eod_alphavantage/'+ enddate + '/{}.csv'.format(ticker), index_col='date') # standardize the order of columns of new dataset init_cols = ['1. open', '2. high', '3. low', '4. close', \ '5. adjusted close', '6. volume', '7. dividend amount', \ '8. split coefficient'] df_to_append = df_to_append[init_cols] # standardize column names of new to match that of the existing datasets df_to_append.columns = ['open', 'high', 'low','close', 'adjusted close', 'volume', \ 'dividend', 'split'] # replace and append data! for idx in df_to_append.index: df.loc[idx, df_to_append.columns] = df_to_append.loc[idx, df_to_append.columns] # overwrite the existing csv df.to_csv('csvdir_processed/' + startdate + '_breakout/daily/{}.csv'.format(ticker)) # define traverse to unlist the lists in a list def traverse(o, tree_types=(list, tuple)): if isinstance(o, tree_types): for value in o: for subvalue in traverse(value, tree_types): yield subvalue else: yield o # a function to combine all ticker csv's from a starting date def combine_csvs(startdate='2012-05-18'): # define all the column names for the dataframe ###++++++++++++++++++++++++++++++++++++++++#### init_cols = ['ticker', 'date', 'open', 'high', 'low', 'close', 'adjusted close', \ 'volume', 'dividend', 'split'] # initiate a new data frame with column names defined df = pd.DataFrame(columns=init_cols) # list all the csv files in the target directory ###++++++++++++++++++++++++++++++++++++++++#### csvs_directory = 'csvdir_processed/' + startdate + '_breakout/daily' # Filing number of unique ticker found in the csvs_directory csvFiles = [f for f in os.listdir(csvs_directory) if re.match(r'[A-Z]+\.csv', f)] tickerFile_re = re.compile(r'([A-Z]+)\.csv') tickers = [] for ticker in csvFiles: tickers.append(tickerFile_re.findall(ticker)) tickers_list = list(traverse(tickers)) # read and append each csv file to the main df ###++++++++++++++++++++++++++++++++++++++++#### for ticker in tickers_list: # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' # reading and appending df_temp = pd.read_csv('csvdir_processed/' + startdate + \ '_breakout/daily/{}.csv'.format(ticker)) df_temp['ticker'] = [ticker for ti in range(len(df_temp))] df_temp = df_temp[init_cols] df = df.append(df_temp, ignore_index=True) # check or create the file directories if not os.path.exists('csvdir_processed/combined_csvs'): os.makedirs('csvdir_processed/combined_csvs') # export df to csv file df.set_index('ticker', inplace=True) df.to_csv('csvdir_processed/combined_csvs/combined_sp500.csv'.format(ticker)) ############################################################################################ ## Functions not in use now ############################################################################################ # A function to fill in the gap def filling_gaps_of_raw_data(ticker, missingDateStr): # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' df = pd.read_csv('csvdir_processed/daily/{}.csv'.format(ticker)) df.set_index('date', inplace=True) nyse = mcal.get_calendar('NYSE') tradingDays = nyse.schedule(start_date='1998-11-01', end_date='2019-07-10') tradingDays_str_array = mcal.date_range(tradingDays, frequency='1D').strftime('%Y-%m-%d') missingdateindex = np.where(tradingDays_str_array==missingDateStr) # previous day of missing date print(missingdateindex) previousDateindex=missingdateindex[0][0] - 1 previousDate = tradingDays_str_array[previousDateindex] # next day of missing date nextDateindex=missingdateindex[0][0] + 1 nextDate = tradingDays_str_array[nextDateindex] # preparing data in dataframe for the missing date df_missing = pd.DataFrame(columns = df.columns) df_missing = df_missing.append((df.loc[previousDate] + df.loc[nextDate]) / 2, ignore_index=True) df_missing.index = [missingDateStr] df_missing.index.name = 'date' # merging and saving the missing date and main dataframe df_final = pd.concat([df, df_missing]).sort_index() df_final.to_csv('csvdir_processed/daily/{}.csv'.format(ticker)) print('Data gap filled for ' + ticker + ' on missing date ' + missingDateStr) # ingestion by zipline individually def ingest_by_zipline(ticker, delta=0): # resolve discordance of the BF.B ticker naming between wikipedia and AV if ticker == 'BF.B': ticker = 'BF-B' df = pd.read_csv('csvdir_processed/daily/{}.csv'.format(ticker)) startDate_str = df.iloc[0]['date'] endDate_obj = datetime.strptime(df.iloc[-1]['date'], '%Y-%m-%d') endDate_final_obj = endDate_obj - timedelta(days=delta) endDate_str = endDate_final_obj.strftime('%Y-%m-%d') with open(os.path.expanduser('~/.zipline/extension.py'), 'r') as fp: content = fp.read() content_n1 = re.sub("start\_session \= pd\.Timestamp\(\'[0-9]{4}\-[0-9]+-[0-9]+", \ "start_session = pd.Timestamp(\'" + startDate_str, content, flags = re.M) content_n2 = re.sub("end\_session \= pd\.Timestamp\(\'[0-9]{4}\-[0-9]+-[0-9]+", \ "end_session = pd.Timestamp(\'" + endDate_str, content_n1, flags = re.M) with open(os.path.expanduser('~/.zipline/extension.py'), 'w') as fo: fo.write(content_n2)
[ 1, 529, 276, 1112, 420, 29958, 29882, 1335, 488, 29872, 29914, 22930, 29899, 12881, 749, 13, 29937, 28348, 3489, 9741, 30004, 13, 5215, 2897, 29892, 5839, 280, 29892, 7274, 30004, 13, 5215, 24512, 29946, 408, 24512, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 11701, 408, 10518, 30004, 13, 5215, 11701, 29918, 28549, 29918, 1052, 355, 1503, 408, 286, 1052, 30004, 13, 5215, 337, 30004, 13, 30004, 13, 3166, 15595, 29918, 29894, 8501, 29889, 3706, 6358, 1053, 5974, 19204, 30004, 13, 3166, 12865, 1053, 12865, 29892, 5335, 287, 2554, 30004, 13, 3166, 11701, 29889, 29873, 13757, 29889, 5391, 22394, 1053, 25513, 29950, 17211, 388, 17447, 29892, 4168, 22394, 29892, 20471, 29918, 1287, 3250, 29892, 320, 30004, 13, 1678, 3148, 22628, 29931, 14107, 29968, 292, 29967, 29878, 29892, 3148, 13504, 16719, 12742, 29892, 7197, 29943, 2429, 388, 29892, 3148, 11442, 9020, 12742, 29892, 320, 30004, 13, 1678, 3148, 29931, 3717, 12742, 29892, 501, 1254, 29882, 1331, 29887, 4357, 12742, 30004, 13, 30004, 13, 1372, 353, 5974, 19204, 29898, 1989, 2433, 29966, 10818, 29958, 742, 1962, 29918, 4830, 2433, 15112, 742, 26190, 29918, 1853, 2433, 1256, 742, 3240, 2722, 29922, 29896, 29900, 29900, 8443, 13, 30004, 13, 2277, 29937, 9166, 9166, 9166, 9166, 1360, 30004, 13, 30004, 13, 29937, 5282, 2827, 770, 363, 3148, 10050, 29899, 2308, 9382, 2635, 30004, 13, 1990, 3148, 12283, 2308, 9382, 17447, 29898, 9118, 29950, 17211, 388, 17447, 1125, 30004, 13, 1678, 6865, 353, 518, 30004, 13, 4706, 4168, 22394, 877, 4373, 12883, 29879, 12742, 742, 4098, 29922, 29896, 29892, 2462, 29922, 29896, 29892, 5820, 749, 29922, 28502, 342, 29918, 1287, 3250, 511, 30004, 13, 4706, 3148, 22628, 29931, 14107, 29968, 292, 29967, 29878, 11167, 13, 4706, 3148, 13504, 16719, 12742, 11167, 13, 4706, 7197, 29943, 2429, 388, 11167, 13, 4706, 3148, 11442, 9020, 12742, 11167, 13, 4706, 4168, 22394, 877, 3308, 2568, 1022, 355, 663, 12742, 742, 4098, 29922, 29955, 29892, 2462, 29922, 29946, 29892, 5820, 749, 29922, 28502, 342, 29918, 1287, 3250, 511, 30004, 13, 4706, 3148, 29931, 3717, 12742, 11167, 13, 4706, 501, 1254, 29882, 1331, 29887, 4357, 12742, 11167, 13, 4706, 4168, 22394, 877, 18687, 8247, 742, 4098, 29922, 29896, 29906, 29892, 2462, 29922, 29906, 29945, 29892, 5820, 749, 29922, 28502, 342, 29918, 1287, 3250, 8443, 13, 1678, 4514, 30004, 13, 30004, 13, 1678, 6756, 13, 29937, 304, 679, 3534, 292, 5764, 8753, 333, 1036, 30004, 13, 1753, 679, 29918, 509, 9382, 29918, 5358, 29918, 5391, 333, 1036, 29898, 6360, 1125, 30004, 13, 1678, 832, 353, 3148, 12283, 2308, 9382, 17447, 26471, 13, 30004, 13, 1678, 736, 832, 29889, 5391, 333, 1036, 29898, 12673, 29898, 6360, 29899, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29941, 29896, 511, 12865, 29898, 6360, 29892, 29871, 29896, 29906, 29892, 29871, 29941, 29896, 876, 30004, 13, 30004, 13, 30004, 13, 29937, 304, 679, 322, 4078, 278, 14582, 9904, 297, 1857, 805, 29945, 29900, 29900, 30004, 13, 1753, 4078, 29918, 1028, 29945, 29900, 29900, 29918, 24667, 414, 7295, 30004, 13, 1678, 4613, 353, 7274, 29889, 657, 877, 991, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 1293, 29918, 974, 29918, 29903, 29995, 29906, 29953, 29925, 29918, 29945, 29900, 29900, 29918, 2388, 273, 583, 1495, 30004, 13, 1678, 22300, 353, 24512, 29889, 3629, 1300, 6845, 29903, 1132, 29898, 13713, 29889, 726, 29892, 525, 29880, 3134, 1495, 30004, 13, 1678, 1591, 353, 22300, 29889, 2886, 877, 2371, 742, 11117, 1990, 22099, 2851, 8270, 2656, 519, 29915, 1800, 30004, 13, 1678, 16892, 414, 353, 5159, 30004, 13, 1678, 363, 1948, 297, 1591, 29889, 2886, 3596, 877, 509, 29861, 29896, 29901, 5387, 30004, 13, 4706, 260, 6541, 353, 1948, 29889, 2886, 3596, 877, 1594, 29861, 29896, 1822, 726, 30004, 13, 4706, 16892, 414, 29889, 4397, 29898, 29873, 6541, 8443, 13, 1678, 6756, 13, 1678, 396, 4529, 9826, 2635, 30004, 13, 1678, 9826, 1256, 353, 12865, 29889, 3707, 2141, 710, 615, 603, 877, 29995, 29979, 29995, 29885, 29995, 29881, 1495, 30004, 13, 1678, 6756, 13, 1678, 411, 1722, 877, 1028, 29945, 29900, 29900, 29873, 6541, 648, 1836, 23945, 280, 4286, 4830, 29898, 27765, 1256, 511, 525, 29893, 29890, 1495, 408, 285, 29901, 30004, 13, 4706, 5839, 280, 29889, 15070, 29898, 24667, 414, 29892, 285, 8443, 13, 1678, 6756, 13, 1678, 736, 16892, 414, 30004, 13, 30004, 13, 30004, 13, 29937, 304, 679, 322, 4078, 278, 14582, 9904, 297, 1857, 805, 29945, 29900, 29900, 30004, 13, 1753, 679, 29918, 1272, 29898, 28120, 29918, 1028, 29945, 29900, 29900, 29922, 8824, 1125, 30004, 13, 1678, 6756, 13, 1678, 2069, 353, 29871, 29900, 30004, 13, 1678, 6756, 13, 1678, 565, 19763, 29918, 1028, 29945, 29900, 29900, 29901, 30004, 13, 4706, 16892, 414, 353, 4078, 29918, 1028, 29945, 29900, 29900, 29918, 24667, 414, 26471, 13, 1678, 1683, 29901, 30004, 13, 4706, 411, 1722, 877, 1028, 29945, 29900, 29900, 29873, 6541, 29889, 23945, 280, 742, 525, 6050, 1495, 408, 285, 29901, 30004, 13, 9651, 16892, 414, 353, 5839, 280, 29889, 1359, 29898, 29888, 8443, 13, 9651, 6756, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 29374, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 29872, 397, 29918, 19712, 485, 8501, 1495, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 16892, 414, 29901, 30004, 13, 4706, 6756, 13, 4706, 565, 2069, 1275, 29871, 29946, 29945, 29901, 30004, 13, 9651, 2867, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 9651, 6756, 13, 4706, 1018, 29901, 30004, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 22164, 30004, 13, 18884, 4489, 29892, 12700, 29918, 1272, 353, 18696, 29889, 657, 29918, 29881, 8683, 29918, 328, 5143, 287, 29898, 29873, 6541, 29892, 1962, 2311, 2433, 8159, 1495, 30004, 13, 18884, 4489, 29889, 517, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 1596, 29898, 29873, 6541, 29892, 525, 554, 388, 1495, 30004, 13, 18884, 2069, 4619, 29871, 29896, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1596, 877, 2499, 2040, 505, 6571, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 6756, 13, 4706, 5174, 29901, 30004, 13, 9651, 1596, 29898, 29873, 6541, 29892, 525, 6778, 6778, 6778, 6778, 4319, 1495, 30004, 13, 9651, 2069, 4619, 29871, 29896, 30004, 13, 9651, 6773, 30004, 13, 30004, 13, 30004, 13, 29937, 304, 679, 322, 4078, 278, 14582, 9904, 297, 1857, 805, 29945, 29900, 29900, 30004, 13, 1753, 679, 29918, 1272, 29898, 28120, 29918, 1028, 29945, 29900, 29900, 29922, 8824, 1125, 30004, 13, 1678, 6756, 13, 1678, 2069, 353, 29871, 29900, 30004, 13, 1678, 6756, 13, 1678, 565, 19763, 29918, 1028, 29945, 29900, 29900, 29901, 30004, 13, 4706, 16892, 414, 353, 4078, 29918, 1028, 29945, 29900, 29900, 29918, 24667, 414, 26471, 13, 1678, 1683, 29901, 30004, 13, 4706, 411, 1722, 877, 1028, 29945, 29900, 29900, 29873, 6541, 29889, 23945, 280, 742, 525, 6050, 1495, 408, 285, 29901, 30004, 13, 9651, 16892, 414, 353, 5839, 280, 29889, 1359, 29898, 29888, 8443, 13, 9651, 6756, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 29374, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 29872, 397, 29918, 19712, 485, 8501, 1495, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 16892, 414, 29901, 30004, 13, 4706, 6756, 13, 4706, 565, 2069, 1275, 29871, 29946, 29945, 29901, 30004, 13, 9651, 2867, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 9651, 6756, 13, 4706, 1018, 29901, 30004, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 22164, 30004, 13, 18884, 4489, 29892, 12700, 29918, 1272, 353, 18696, 29889, 657, 29918, 29881, 8683, 29918, 328, 5143, 287, 29898, 29873, 6541, 29892, 1962, 2311, 2433, 8159, 1495, 30004, 13, 18884, 4489, 29889, 517, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 1596, 29898, 29873, 6541, 29892, 525, 554, 388, 1495, 30004, 13, 18884, 2069, 4619, 29871, 29896, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1596, 877, 2499, 2040, 505, 6571, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 6756, 13, 4706, 5174, 29901, 30004, 13, 9651, 1596, 29898, 29873, 6541, 29892, 525, 6778, 6778, 6778, 6778, 4319, 1495, 30004, 13, 9651, 2069, 4619, 29871, 29896, 30004, 13, 9651, 6773, 30004, 13, 30004, 13, 30004, 13, 29937, 304, 679, 322, 4078, 278, 317, 29987, 29925, 29945, 29900, 29900, 14582, 310, 4066, 313, 276, 509, 6402, 373, 29871, 29955, 386, 3786, 29871, 29906, 29900, 29896, 29929, 8443, 13, 1753, 679, 29918, 1272, 29918, 5182, 287, 29898, 7638, 3972, 29918, 5014, 287, 29918, 2962, 1256, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29945, 29899, 29896, 29947, 29374, 30004, 13, 30004, 13, 1678, 9826, 2539, 353, 12865, 29889, 3707, 2141, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1495, 30004, 13, 30004, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 22208, 718, 9826, 2539, 1125, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 29872, 397, 29918, 19712, 485, 8501, 22208, 718, 9826, 2539, 8443, 13, 1678, 6756, 13, 1678, 2069, 353, 29871, 29900, 30004, 13, 1678, 6756, 13, 1678, 396, 1051, 599, 278, 11799, 2066, 297, 278, 3646, 3884, 30004, 13, 1678, 835, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 4136, 30004, 13, 1678, 5939, 4270, 29918, 12322, 353, 525, 7638, 3972, 29918, 5014, 287, 22208, 718, 11799, 3972, 29918, 5014, 287, 29918, 2962, 1256, 320, 30004, 13, 462, 4706, 718, 22868, 8690, 449, 29914, 29881, 8683, 29915, 30004, 13, 1678, 6756, 13, 1678, 396, 2514, 292, 1353, 310, 5412, 260, 6541, 1476, 297, 278, 5939, 4270, 29918, 12322, 30004, 13, 1678, 11799, 10547, 353, 518, 29888, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 2395, 4270, 29918, 12322, 29897, 565, 337, 29889, 4352, 29898, 29878, 29915, 29961, 29909, 29899, 29999, 29962, 3124, 29889, 7638, 742, 285, 4638, 30004, 13, 1678, 260, 6541, 2283, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 4197, 29909, 29899, 29999, 10062, 2144, 29889, 7638, 1495, 30004, 13, 1678, 16892, 414, 353, 5159, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 11799, 10547, 29901, 30004, 13, 4706, 16892, 414, 29889, 4397, 29898, 29873, 6541, 2283, 29918, 276, 29889, 2886, 497, 29898, 29873, 6541, 876, 30004, 13, 1678, 6756, 13, 1678, 16892, 414, 29918, 1761, 353, 1051, 29898, 3018, 3901, 29898, 24667, 414, 876, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 16892, 414, 29918, 1761, 29901, 30004, 13, 4706, 6756, 13, 4706, 565, 2069, 1275, 29871, 29896, 29900, 29900, 29901, 30004, 13, 9651, 2867, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 4706, 6756, 13, 4706, 1018, 29901, 30004, 13, 9651, 6756, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 29872, 397, 29918, 19712, 485, 8501, 22208, 718, 9826, 2539, 718, 8207, 29912, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 22164, 30004, 13, 18884, 4489, 29892, 12700, 29918, 1272, 353, 18696, 29889, 657, 29918, 29881, 8683, 29918, 328, 5143, 287, 29898, 29873, 6541, 29892, 1962, 2311, 2433, 8159, 1495, 30004, 13, 18884, 4489, 29889, 517, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 22208, 718, 9826, 2539, 718, 8207, 29912, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 1596, 29898, 29873, 6541, 29892, 525, 554, 388, 1495, 30004, 13, 18884, 2069, 4619, 29871, 29896, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1596, 877, 2499, 2040, 505, 6571, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 18884, 6756, 13, 4706, 5174, 29901, 30004, 13, 9651, 1596, 29898, 29873, 6541, 29892, 525, 6778, 6778, 6778, 6778, 4319, 1495, 30004, 13, 9651, 2069, 4619, 29871, 29896, 30004, 13, 9651, 6773, 30004, 13, 9651, 6756, 13, 9651, 6756, 13, 9651, 6756, 13, 29937, 319, 740, 304, 19012, 10650, 848, 363, 503, 29875, 572, 457, 22813, 793, 30004, 13, 1753, 1889, 29918, 1610, 29918, 1272, 29898, 24667, 414, 29892, 1369, 1256, 2433, 29906, 29900, 29896, 29900, 29899, 29900, 29955, 29899, 29896, 29945, 29374, 30004, 13, 1678, 6756, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 8207, 29881, 8683, 29374, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 8207, 29881, 8683, 1495, 30004, 13, 1678, 6756, 13, 1678, 610, 29879, 519, 29918, 24667, 414, 353, 518, 29873, 6541, 363, 260, 6541, 297, 16892, 414, 565, 260, 6541, 451, 297, 6024, 3301, 8050, 742, 525, 3970, 29956, 2033, 29962, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 610, 29879, 519, 29918, 24667, 414, 29901, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 4706, 6756, 13, 4706, 396, 1303, 10650, 848, 30004, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 4706, 6756, 13, 4706, 396, 871, 3160, 1906, 848, 411, 278, 1369, 1256, 848, 30004, 13, 4706, 565, 1369, 1256, 297, 731, 29898, 2176, 1839, 1256, 2033, 1125, 30004, 13, 9651, 4489, 29889, 842, 29918, 2248, 877, 1256, 742, 297, 6689, 29922, 5574, 8443, 13, 9651, 4489, 29889, 13099, 353, 6024, 3150, 742, 525, 9812, 742, 525, 677, 3788, 5358, 742, 525, 328, 5143, 287, 3802, 742, 525, 24623, 742, 320, 30004, 13, 462, 3986, 525, 29881, 3640, 355, 742, 525, 5451, 2033, 30004, 13, 9651, 4489, 29889, 8865, 877, 328, 5143, 287, 3802, 742, 9685, 29922, 29896, 29892, 297, 6689, 29922, 5574, 8443, 13, 9651, 4489, 353, 4489, 29889, 2029, 29961, 2962, 1256, 17531, 30004, 13, 9651, 4489, 29889, 309, 542, 7503, 29899, 29896, 1822, 517, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 8207, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 4706, 6756, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 29898, 29873, 6541, 718, 525, 471, 429, 13347, 408, 967, 937, 16892, 471, 16531, 515, 525, 718, 4489, 1839, 1256, 2033, 29961, 29900, 2314, 30004, 13, 1678, 6756, 13, 30004, 13, 29937, 319, 740, 304, 19012, 10650, 848, 363, 2867, 449, 13705, 1881, 30004, 13, 1753, 1889, 29918, 1610, 29918, 1272, 29918, 8690, 449, 29898, 24667, 414, 29892, 1369, 1256, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29945, 29899, 29896, 29947, 29374, 30004, 13, 1678, 6756, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 22868, 8690, 449, 29914, 29881, 8683, 29374, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 22868, 8690, 449, 29914, 29881, 8683, 1495, 30004, 13, 1678, 6756, 13, 1678, 610, 29879, 519, 29918, 24667, 414, 353, 518, 29873, 6541, 363, 260, 6541, 297, 16892, 414, 565, 260, 6541, 451, 297, 6024, 3301, 8050, 742, 525, 3970, 29956, 2033, 29962, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 610, 29879, 519, 29918, 24667, 414, 29901, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 4706, 6756, 13, 4706, 396, 1303, 10650, 848, 30004, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 4706, 6756, 13, 4706, 396, 871, 3160, 1906, 848, 411, 278, 1369, 1256, 848, 30004, 13, 4706, 565, 1369, 1256, 297, 731, 29898, 2176, 1839, 1256, 2033, 1125, 30004, 13, 9651, 4489, 29889, 842, 29918, 2248, 877, 1256, 742, 297, 6689, 29922, 5574, 8443, 13, 9651, 4489, 29889, 13099, 353, 6024, 3150, 742, 525, 9812, 742, 525, 677, 3788, 5358, 742, 525, 328, 5143, 287, 3802, 742, 525, 24623, 742, 320, 30004, 13, 462, 3986, 525, 29881, 3640, 355, 742, 525, 5451, 2033, 30004, 13, 9651, 4489, 353, 4489, 29889, 2029, 29961, 2962, 1256, 17531, 30004, 13, 9651, 4489, 29889, 517, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 22868, 8690, 449, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 4706, 6756, 13, 4706, 1683, 29901, 30004, 13, 9651, 1596, 29898, 29873, 6541, 718, 525, 471, 429, 13347, 408, 967, 937, 16892, 471, 16531, 515, 525, 718, 4489, 1839, 1256, 2033, 29961, 29900, 2314, 30004, 13, 1678, 6756, 13, 30004, 13, 29937, 319, 740, 304, 19012, 10650, 848, 363, 2867, 449, 13705, 1881, 30004, 13, 1753, 1889, 29918, 1610, 29918, 1272, 29918, 8690, 449, 29918, 932, 2548, 29898, 2962, 1256, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29945, 29899, 29896, 29947, 742, 1095, 1256, 2433, 29906, 29900, 29896, 29929, 29899, 29900, 29946, 29899, 29896, 29896, 29374, 30004, 13, 30004, 13, 29937, 268, 9826, 2539, 353, 12865, 29889, 3707, 2141, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1495, 30004, 13, 30004, 13, 1678, 2069, 353, 29871, 29900, 30004, 13, 1678, 6756, 13, 1678, 396, 1051, 599, 278, 11799, 2066, 297, 278, 3646, 3884, 30004, 13, 1678, 835, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 4136, 30004, 13, 1678, 5939, 4270, 29918, 12322, 353, 525, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 320, 30004, 13, 462, 4706, 718, 22868, 8690, 449, 29914, 29881, 8683, 29915, 30004, 13, 1678, 6756, 13, 1678, 396, 2514, 292, 1353, 310, 5412, 260, 6541, 1476, 297, 278, 5939, 4270, 29918, 12322, 30004, 13, 1678, 11799, 10547, 353, 518, 29888, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 2395, 4270, 29918, 12322, 29897, 565, 337, 29889, 4352, 29898, 29878, 29915, 29961, 29909, 29899, 29999, 29962, 3124, 29889, 7638, 742, 285, 4638, 30004, 13, 1678, 260, 6541, 2283, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 4197, 29909, 29899, 29999, 10062, 2144, 29889, 7638, 1495, 30004, 13, 1678, 16892, 414, 353, 5159, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 11799, 10547, 29901, 30004, 13, 4706, 16892, 414, 29889, 4397, 29898, 29873, 6541, 2283, 29918, 276, 29889, 2886, 497, 29898, 29873, 6541, 876, 30004, 13, 1678, 6756, 13, 1678, 16892, 414, 29918, 1761, 353, 1051, 29898, 3018, 3901, 29898, 24667, 414, 876, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 16892, 414, 29918, 1761, 29901, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 4706, 6756, 13, 4706, 396, 1303, 5923, 260, 6541, 8783, 304, 2767, 30004, 13, 4706, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 2395, 4270, 29918, 12322, 718, 8207, 29912, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 511, 2380, 29918, 1054, 2433, 1256, 1495, 30004, 13, 4706, 6756, 13, 4706, 396, 1303, 716, 260, 6541, 8783, 304, 9773, 30004, 13, 4706, 4489, 29918, 517, 29918, 4397, 353, 10518, 29889, 949, 29918, 7638, 877, 29872, 397, 29918, 19712, 485, 8501, 29914, 18717, 1095, 1256, 718, 8207, 29912, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 511, 2380, 29918, 1054, 2433, 1256, 1495, 30004, 13, 4706, 6756, 13, 4706, 396, 3918, 675, 278, 1797, 310, 4341, 310, 716, 8783, 30004, 13, 4706, 2069, 29918, 22724, 353, 6024, 29896, 29889, 1722, 742, 525, 29906, 29889, 1880, 742, 525, 29941, 29889, 4482, 742, 525, 29946, 29889, 3802, 742, 320, 30004, 13, 462, 268, 525, 29945, 29889, 10365, 287, 3802, 742, 525, 29953, 29889, 7977, 742, 525, 29955, 29889, 25227, 355, 5253, 742, 320, 30004, 13, 462, 268, 525, 29947, 29889, 6219, 10825, 2033, 30004, 13, 4706, 4489, 29918, 517, 29918, 4397, 353, 4489, 29918, 517, 29918, 4397, 29961, 2344, 29918, 22724, 29962, 30004, 13, 4706, 6756, 13, 4706, 396, 3918, 675, 1897, 2983, 310, 716, 304, 1993, 393, 310, 278, 5923, 20035, 30004, 13, 4706, 4489, 29918, 517, 29918, 4397, 29889, 13099, 353, 6024, 3150, 742, 525, 9812, 742, 525, 677, 3788, 5358, 742, 525, 328, 5143, 287, 3802, 742, 525, 24623, 742, 320, 30004, 13, 462, 3986, 525, 29881, 3640, 355, 742, 525, 5451, 2033, 30004, 13, 4706, 6756, 13, 4706, 396, 5191, 322, 9773, 848, 29991, 30004, 13, 4706, 363, 22645, 297, 4489, 29918, 517, 29918, 4397, 29889, 2248, 29901, 30004, 13, 9651, 4489, 29889, 2029, 29961, 13140, 29892, 4489, 29918, 517, 29918, 4397, 29889, 13099, 29962, 353, 4489, 29918, 517, 29918, 4397, 29889, 2029, 29961, 13140, 29892, 4489, 29918, 517, 29918, 4397, 29889, 13099, 29962, 30004, 13, 4706, 6756, 13, 4706, 396, 26556, 278, 5923, 11799, 30004, 13, 4706, 4489, 29889, 517, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 22868, 8690, 449, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 30004, 13, 30004, 13, 4706, 6756, 13, 29937, 4529, 29370, 304, 443, 1761, 278, 8857, 297, 263, 1051, 30004, 13, 1753, 29370, 29898, 29877, 29892, 5447, 29918, 8768, 7607, 1761, 29892, 18761, 22164, 30004, 13, 1678, 565, 338, 8758, 29898, 29877, 29892, 5447, 29918, 8768, 1125, 30004, 13, 4706, 363, 995, 297, 288, 29901, 30004, 13, 9651, 363, 1014, 1767, 297, 29370, 29898, 1767, 29892, 5447, 29918, 8768, 1125, 30004, 13, 18884, 7709, 1014, 1767, 30004, 13, 1678, 1683, 29901, 30004, 13, 4706, 7709, 288, 30004, 13, 30004, 13, 30004, 13, 29937, 263, 740, 304, 14405, 599, 260, 6541, 11799, 29915, 29879, 515, 263, 6257, 2635, 30004, 13, 1753, 14405, 29918, 2395, 4270, 29898, 2962, 1256, 2433, 29906, 29900, 29896, 29906, 29899, 29900, 29945, 29899, 29896, 29947, 29374, 30004, 13, 1678, 6756, 13, 1678, 396, 4529, 599, 278, 1897, 2983, 363, 278, 12205, 30004, 13, 1678, 835, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 4136, 30004, 13, 1678, 2069, 29918, 22724, 353, 6024, 29873, 6541, 742, 525, 1256, 742, 525, 3150, 742, 525, 9812, 742, 525, 677, 742, 525, 5358, 742, 525, 328, 5143, 287, 3802, 742, 320, 30004, 13, 462, 525, 24623, 742, 525, 29881, 3640, 355, 742, 525, 5451, 2033, 30004, 13, 1678, 6756, 13, 1678, 396, 14511, 403, 263, 716, 848, 3515, 411, 1897, 2983, 3342, 30004, 13, 1678, 4489, 353, 10518, 29889, 17271, 29898, 13099, 29922, 2344, 29918, 22724, 8443, 13, 268, 6756, 13, 1678, 6756, 13, 1678, 396, 1051, 599, 278, 11799, 2066, 297, 278, 3646, 3884, 30004, 13, 1678, 835, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 4136, 30004, 13, 1678, 5939, 4270, 29918, 12322, 353, 525, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 22868, 8690, 449, 29914, 29881, 8683, 29915, 30004, 13, 1678, 6756, 13, 1678, 396, 2514, 292, 1353, 310, 5412, 260, 6541, 1476, 297, 278, 5939, 4270, 29918, 12322, 30004, 13, 1678, 11799, 10547, 353, 518, 29888, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 2395, 4270, 29918, 12322, 29897, 565, 337, 29889, 4352, 29898, 29878, 29915, 29961, 29909, 29899, 29999, 29962, 3124, 29889, 7638, 742, 285, 4638, 30004, 13, 1678, 260, 6541, 2283, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 4197, 29909, 29899, 29999, 10062, 2144, 29889, 7638, 1495, 30004, 13, 1678, 16892, 414, 353, 5159, 30004, 13, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 11799, 10547, 29901, 30004, 13, 4706, 16892, 414, 29889, 4397, 29898, 29873, 6541, 2283, 29918, 276, 29889, 2886, 497, 29898, 29873, 6541, 876, 30004, 13, 1678, 6756, 13, 1678, 16892, 414, 29918, 1761, 353, 1051, 29898, 3018, 3901, 29898, 24667, 414, 876, 30004, 13, 1678, 6756, 13, 1678, 396, 1303, 322, 9773, 1269, 11799, 934, 304, 278, 1667, 4489, 30004, 13, 1678, 835, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 1817, 4136, 1678, 6756, 13, 1678, 363, 260, 6541, 297, 16892, 414, 29918, 1761, 29901, 30004, 13, 4706, 6756, 13, 4706, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 4706, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 9651, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 4706, 6756, 13, 4706, 396, 5183, 322, 623, 2548, 30004, 13, 4706, 4489, 29918, 7382, 353, 10518, 29889, 949, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 22208, 718, 1369, 1256, 718, 320, 30004, 13, 462, 795, 22868, 8690, 449, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 4706, 4489, 29918, 7382, 1839, 29873, 6541, 2033, 353, 518, 29873, 6541, 363, 19538, 297, 3464, 29898, 2435, 29898, 2176, 29918, 7382, 28166, 30004, 13, 4706, 4489, 29918, 7382, 353, 4489, 29918, 7382, 29961, 2344, 29918, 22724, 29962, 30004, 13, 4706, 4489, 353, 4489, 29889, 4397, 29898, 2176, 29918, 7382, 29892, 11455, 29918, 2248, 29922, 5574, 8443, 13, 1678, 6756, 13, 1678, 396, 1423, 470, 1653, 278, 934, 17525, 30004, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 877, 7638, 3972, 29918, 5014, 287, 29914, 17743, 1312, 29918, 2395, 4270, 29374, 30004, 13, 4706, 2897, 29889, 29885, 12535, 12935, 877, 7638, 3972, 29918, 5014, 287, 29914, 17743, 1312, 29918, 2395, 4270, 1495, 30004, 13, 1678, 6756, 13, 1678, 396, 5609, 4489, 304, 11799, 934, 30004, 13, 1678, 4489, 29889, 842, 29918, 2248, 877, 29873, 6541, 742, 297, 6689, 29922, 5574, 8443, 13, 1678, 4489, 29889, 517, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 29914, 17743, 1312, 29918, 2395, 4270, 29914, 17743, 1312, 29918, 1028, 29945, 29900, 29900, 29889, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 1678, 6756, 13, 1678, 6756, 13, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 30004, 13, 2277, 6680, 29879, 451, 297, 671, 1286, 30004, 13, 13383, 13383, 13383, 13383, 13383, 7346, 4136, 30004, 13, 30004, 13, 29937, 319, 740, 304, 5445, 297, 278, 17261, 30004, 13, 1753, 27523, 29918, 29887, 2547, 29918, 974, 29918, 1610, 29918, 1272, 29898, 29873, 6541, 29892, 4567, 2539, 5015, 1125, 30004, 13, 1678, 6756, 13, 1678, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 1678, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 4706, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 1678, 6756, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 1678, 4489, 29889, 842, 29918, 2248, 877, 1256, 742, 297, 6689, 29922, 5574, 8443, 13, 1678, 6756, 13, 1678, 7098, 344, 353, 286, 1052, 29889, 657, 29918, 23392, 877, 29940, 29979, 1660, 1495, 30004, 13, 1678, 3534, 292, 25991, 353, 7098, 344, 29889, 816, 11272, 29898, 2962, 29918, 1256, 2433, 29896, 29929, 29929, 29947, 29899, 29896, 29896, 29899, 29900, 29896, 742, 1095, 29918, 1256, 2433, 29906, 29900, 29896, 29929, 29899, 29900, 29955, 29899, 29896, 29900, 1495, 30004, 13, 1678, 3534, 292, 25991, 29918, 710, 29918, 2378, 353, 286, 1052, 29889, 1256, 29918, 3881, 29898, 509, 9382, 25991, 29892, 10868, 2433, 29896, 29928, 2824, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1495, 30004, 13, 1678, 4567, 1256, 2248, 353, 7442, 29889, 3062, 29898, 509, 9382, 25991, 29918, 710, 29918, 2378, 1360, 27259, 2539, 5015, 8443, 13, 1678, 6756, 13, 1678, 396, 3517, 2462, 310, 4567, 2635, 30004, 13, 1678, 1596, 29898, 27259, 1256, 2248, 8443, 13, 1678, 3517, 2539, 2248, 29922, 27259, 1256, 2248, 29961, 29900, 3816, 29900, 29962, 448, 29871, 29896, 30004, 13, 1678, 3517, 2539, 353, 3534, 292, 25991, 29918, 710, 29918, 2378, 29961, 24957, 2539, 2248, 29962, 30004, 13, 1678, 6756, 13, 1678, 396, 2446, 2462, 310, 4567, 2635, 30004, 13, 1678, 2446, 2539, 2248, 29922, 27259, 1256, 2248, 29961, 29900, 3816, 29900, 29962, 718, 29871, 29896, 30004, 13, 1678, 2446, 2539, 353, 3534, 292, 25991, 29918, 710, 29918, 2378, 29961, 4622, 2539, 2248, 29962, 30004, 13, 30004, 13, 1678, 396, 10223, 292, 848, 297, 12205, 363, 278, 4567, 2635, 30004, 13, 1678, 4489, 29918, 27259, 353, 10518, 29889, 17271, 29898, 13099, 353, 4489, 29889, 13099, 8443, 13, 1678, 4489, 29918, 27259, 353, 4489, 29918, 27259, 29889, 4397, 3552, 2176, 29889, 2029, 29961, 24957, 2539, 29962, 718, 4489, 29889, 2029, 29961, 4622, 2539, 2314, 847, 29871, 29906, 29892, 11455, 29918, 2248, 29922, 5574, 8443, 13, 1678, 4489, 29918, 27259, 29889, 2248, 353, 518, 27259, 2539, 5015, 29962, 30004, 13, 1678, 4489, 29918, 27259, 29889, 2248, 29889, 978, 353, 525, 1256, 29915, 30004, 13, 1678, 6756, 13, 1678, 396, 2778, 3460, 322, 14238, 278, 4567, 2635, 322, 1667, 12205, 29871, 6756, 13, 1678, 4489, 29918, 8394, 353, 10518, 29889, 17685, 4197, 2176, 29892, 4489, 29918, 27259, 14664, 6605, 29918, 2248, 26471, 13, 1678, 4489, 29918, 8394, 29889, 517, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 1678, 6756, 13, 1678, 1596, 877, 1469, 17261, 10423, 363, 525, 718, 29871, 260, 6541, 718, 525, 373, 4567, 2635, 525, 718, 4567, 2539, 5015, 8443, 13, 1678, 6756, 13, 30004, 13, 30004, 13, 29937, 2348, 602, 491, 503, 29875, 572, 457, 29689, 6756, 13, 1753, 2348, 342, 29918, 1609, 29918, 2526, 572, 457, 29898, 29873, 6541, 29892, 19471, 29922, 29900, 1125, 30004, 13, 1678, 6756, 13, 1678, 396, 8814, 2313, 536, 749, 310, 278, 350, 29943, 29889, 29933, 260, 6541, 22006, 1546, 281, 638, 4652, 322, 16884, 30004, 13, 1678, 565, 260, 6541, 1275, 525, 28062, 29889, 29933, 2396, 30004, 13, 4706, 260, 6541, 353, 525, 28062, 29899, 29933, 29915, 30004, 13, 30004, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 877, 7638, 3972, 29918, 5014, 287, 29914, 29881, 8683, 19248, 1836, 7638, 4286, 4830, 29898, 29873, 6541, 876, 30004, 13, 1678, 1369, 2539, 29918, 710, 353, 4489, 29889, 309, 542, 29961, 29900, 22322, 1256, 2033, 30004, 13, 1678, 1095, 2539, 29918, 5415, 353, 12865, 29889, 710, 415, 603, 29898, 2176, 29889, 309, 542, 14352, 29896, 22322, 1256, 7464, 14210, 29979, 19222, 29885, 19222, 29881, 1495, 6756, 13, 1678, 1095, 2539, 29918, 8394, 29918, 5415, 353, 1095, 2539, 29918, 5415, 448, 5335, 287, 2554, 29898, 16700, 29922, 4181, 8443, 13, 1678, 1095, 2539, 29918, 710, 353, 1095, 2539, 29918, 8394, 29918, 5415, 29889, 710, 615, 603, 877, 29995, 29979, 19222, 29885, 19222, 29881, 1495, 30004, 13, 1678, 6756, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 18837, 1792, 877, 30022, 6294, 2526, 572, 457, 29914, 17588, 29889, 2272, 5477, 525, 29878, 1495, 408, 285, 29886, 29901, 30004, 13, 4706, 2793, 353, 285, 29886, 29889, 949, 26471, 13, 4706, 6756, 13, 1678, 2793, 29918, 29876, 29896, 353, 337, 29889, 1491, 703, 2962, 20122, 7924, 320, 29922, 10518, 23301, 27939, 29905, 1194, 29915, 29961, 29900, 29899, 29929, 3199, 29946, 1012, 29899, 29961, 29900, 29899, 29929, 10062, 29899, 29961, 29900, 29899, 29929, 10062, 613, 320, 30004, 13, 462, 308, 376, 2962, 29918, 7924, 353, 10518, 29889, 27939, 1194, 11838, 718, 1369, 2539, 29918, 710, 29892, 2793, 29892, 13449, 353, 337, 29889, 29924, 8443, 13, 1678, 2793, 29918, 29876, 29906, 353, 337, 29889, 1491, 703, 355, 20122, 7924, 320, 29922, 10518, 23301, 27939, 29905, 1194, 29915, 29961, 29900, 29899, 29929, 3199, 29946, 1012, 29899, 29961, 29900, 29899, 29929, 10062, 29899, 29961, 29900, 29899, 29929, 10062, 613, 320, 30004, 13, 462, 308, 376, 355, 29918, 7924, 353, 10518, 29889, 27939, 1194, 11838, 718, 1095, 2539, 29918, 710, 29892, 2793, 29918, 29876, 29896, 29892, 13449, 353, 337, 29889, 29924, 8443, 13, 1678, 6756, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 18837, 1792, 877, 30022, 6294, 2526, 572, 457, 29914, 17588, 29889, 2272, 5477, 525, 29893, 1495, 408, 1701, 29901, 30004, 13, 4706, 1701, 29889, 3539, 29898, 3051, 29918, 29876, 29906, 8443, 13, 2 ]
pymatgen/core/__init__.py
miaoliu/pymatgen
0
112037
""" This package contains core modules and classes for representing structures and operations on them. """ __author__ = "<NAME>" __date__ = "Dec 15, 2010 7:21:29 PM" from .periodic_table import * from .composition import * from .structure import * from .structure_modifier import * from .bonds import * from .lattice import * from .sites import * from .operations import *
[ 1, 9995, 13, 4013, 3577, 3743, 7136, 10585, 322, 4413, 363, 15783, 12286, 322, 13, 3372, 800, 373, 963, 29889, 13, 15945, 29908, 13, 13, 1649, 8921, 1649, 353, 9872, 5813, 11903, 13, 1649, 1256, 1649, 353, 376, 6185, 29871, 29896, 29945, 29892, 29871, 29906, 29900, 29896, 29900, 29871, 29955, 29901, 29906, 29896, 29901, 29906, 29929, 11278, 29908, 13, 13, 3166, 869, 19145, 293, 29918, 2371, 1053, 334, 13, 3166, 869, 510, 3283, 1053, 334, 13, 3166, 869, 23905, 1053, 334, 13, 3166, 869, 23905, 29918, 26625, 1053, 334, 13, 3166, 869, 29890, 13788, 1053, 334, 13, 3166, 869, 29880, 19704, 1053, 334, 13, 3166, 869, 16315, 1053, 334, 13, 3166, 869, 3372, 800, 1053, 334, 13, 2 ]
api/data_explorer/models/__init__.py
karamalhotra/data-explorer
0
22127
<gh_stars>0 # coding: utf-8 # flake8: noqa from __future__ import absolute_import # import models into model package from data_explorer.models.dataset_response import DatasetResponse from data_explorer.models.facet import Facet from data_explorer.models.facet_value import FacetValue from data_explorer.models.facets_response import FacetsResponse
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 17422, 446, 29947, 29901, 694, 25621, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 29937, 1053, 4733, 964, 1904, 3577, 13, 3166, 848, 29918, 735, 14716, 29889, 9794, 29889, 24713, 29918, 5327, 1053, 13373, 24541, 5103, 13, 3166, 848, 29918, 735, 14716, 29889, 9794, 29889, 17470, 300, 1053, 14184, 300, 13, 3166, 848, 29918, 735, 14716, 29889, 9794, 29889, 17470, 300, 29918, 1767, 1053, 14184, 300, 1917, 13, 3166, 848, 29918, 735, 14716, 29889, 9794, 29889, 17470, 1691, 29918, 5327, 1053, 14184, 1691, 5103, 13, 2 ]
trading_api_wrappers/buda/client_public.py
delta575/trading-api-wrappers
44
80830
<filename>trading_api_wrappers/buda/client_public.py from datetime import datetime from . import constants as _c from . import models as _m from ..base import Client, ModelMixin class BudaPublic(Client, ModelMixin): base_url = "https://www.buda.com/api/v2/" error_keys = ["message"] def markets(self): data = self.get("markets") if self.return_json: return data return [_m.Market.create_from_json(market) for market in data["markets"]] def market_details(self, market_id: str): data = self.get(f"markets/{market_id}") if self.return_json: return data return _m.Market.create_from_json(data["market"]) def ticker(self, market_id: str): data = self.get(f"markets/{market_id}/ticker") if self.return_json: return data return _m.Ticker.create_from_json(data["ticker"]) def order_book(self, market_id: str): data = self.get(f"markets/{market_id}/order_book") if self.return_json: return data return _m.OrderBook.create_from_json(data["order_book"]) def trades(self, market_id: str, timestamp: int = None, limit: int = None): data = self.get( f"markets/{market_id}/trades", params={ "timestamp": timestamp, "limit": limit, }, ) if self.return_json: return data return _m.Trades.create_from_json(data["trades"]) def quotation( self, market_id: str, quotation_type: str, amount: float, limit: float = None ): data = self.post( f"markets/{market_id}/quotations", json={ "quotation": { "type": str(quotation_type), "amount": str(amount), "limit": str(limit) if limit else None, }, }, ) if self.return_json: return data return _m.Quotation.create_from_json(data["quotation"]) def quotation_market(self, market_id: str, quotation_type: str, amount: float): return self.quotation(market_id, quotation_type, amount, limit=None) def quotation_limit( self, market_id: str, quotation_type: str, amount: float, limit: float ): return self.quotation(market_id, quotation_type, amount, limit) def _report( self, market_id: str, report_type: _c.ReportType, start_at: datetime = None, end_at: datetime = None, ): if isinstance(start_at, datetime): start_at = int(start_at.timestamp()) if isinstance(end_at, datetime): end_at = int(end_at.timestamp()) data = self.get( f"markets/{market_id}/reports", params={ "report_type": str(report_type), "from": start_at, "to": end_at, }, ) return data def report_average_prices( self, market_id: str, start_at: datetime = None, end_at: datetime = None ): data = self._report(market_id, _c.ReportType.AVERAGE_PRICES, start_at, end_at) if self.return_json: return data return [_m.AveragePrice.create_from_json(report) for report in data["reports"]] def report_candlestick( self, market_id: str, start_at: datetime = None, end_at: datetime = None ): data = self._report(market_id, _c.ReportType.CANDLESTICK, start_at, end_at) if self.return_json: return data return [_m.Candlestick.create_from_json(report) for report in data["reports"]]
[ 1, 529, 9507, 29958, 509, 9382, 29918, 2754, 29918, 29893, 336, 22437, 29914, 29890, 6191, 29914, 4645, 29918, 3597, 29889, 2272, 13, 3166, 12865, 1053, 12865, 13, 13, 3166, 869, 1053, 17727, 408, 903, 29883, 13, 3166, 869, 1053, 4733, 408, 903, 29885, 13, 3166, 6317, 3188, 1053, 12477, 29892, 8125, 29924, 861, 262, 13, 13, 13, 1990, 350, 6191, 19858, 29898, 4032, 29892, 8125, 29924, 861, 262, 1125, 13, 1678, 2967, 29918, 2271, 353, 376, 991, 597, 1636, 29889, 29890, 6191, 29889, 510, 29914, 2754, 29914, 29894, 29906, 12975, 13, 1678, 1059, 29918, 8149, 353, 6796, 4906, 3108, 13, 13, 1678, 822, 2791, 1691, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 657, 703, 3502, 1691, 1159, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 23160, 29885, 29889, 9802, 300, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 28549, 29897, 363, 9999, 297, 848, 3366, 3502, 1691, 3108, 29962, 13, 13, 1678, 822, 9999, 29918, 14144, 29898, 1311, 29892, 9999, 29918, 333, 29901, 851, 1125, 13, 4706, 848, 353, 1583, 29889, 657, 29898, 29888, 29908, 3502, 1691, 19248, 28549, 29918, 333, 27195, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 903, 29885, 29889, 9802, 300, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 1272, 3366, 28549, 20068, 13, 13, 1678, 822, 260, 6541, 29898, 1311, 29892, 9999, 29918, 333, 29901, 851, 1125, 13, 4706, 848, 353, 1583, 29889, 657, 29898, 29888, 29908, 3502, 1691, 19248, 28549, 29918, 333, 6822, 29873, 6541, 1159, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 903, 29885, 29889, 29911, 6541, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 1272, 3366, 29873, 6541, 20068, 13, 13, 1678, 822, 1797, 29918, 2909, 29898, 1311, 29892, 9999, 29918, 333, 29901, 851, 1125, 13, 4706, 848, 353, 1583, 29889, 657, 29898, 29888, 29908, 3502, 1691, 19248, 28549, 29918, 333, 6822, 2098, 29918, 2909, 1159, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 903, 29885, 29889, 7514, 10967, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 1272, 3366, 2098, 29918, 2909, 20068, 13, 13, 1678, 822, 534, 3076, 29898, 1311, 29892, 9999, 29918, 333, 29901, 851, 29892, 14334, 29901, 938, 353, 6213, 29892, 4046, 29901, 938, 353, 6213, 1125, 13, 4706, 848, 353, 1583, 29889, 657, 29898, 13, 9651, 285, 29908, 3502, 1691, 19248, 28549, 29918, 333, 6822, 509, 3076, 613, 13, 9651, 8636, 3790, 13, 18884, 376, 16394, 1115, 14334, 29892, 13, 18884, 376, 13400, 1115, 4046, 29892, 13, 9651, 2981, 13, 4706, 1723, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 903, 29885, 29889, 2308, 3076, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 1272, 3366, 509, 3076, 20068, 13, 13, 1678, 822, 13911, 362, 29898, 13, 4706, 1583, 29892, 9999, 29918, 333, 29901, 851, 29892, 13911, 362, 29918, 1853, 29901, 851, 29892, 5253, 29901, 5785, 29892, 4046, 29901, 5785, 353, 6213, 13, 268, 1125, 13, 4706, 848, 353, 1583, 29889, 2490, 29898, 13, 9651, 285, 29908, 3502, 1691, 19248, 28549, 29918, 333, 6822, 23083, 800, 613, 13, 9651, 4390, 3790, 13, 18884, 376, 23083, 362, 1115, 426, 13, 462, 1678, 376, 1853, 1115, 851, 29898, 23083, 362, 29918, 1853, 511, 13, 462, 1678, 376, 14506, 1115, 851, 29898, 14506, 511, 13, 462, 1678, 376, 13400, 1115, 851, 29898, 13400, 29897, 565, 4046, 1683, 6213, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 4706, 1723, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 903, 29885, 29889, 2182, 327, 362, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 1272, 3366, 23083, 362, 20068, 13, 13, 1678, 822, 13911, 362, 29918, 28549, 29898, 1311, 29892, 9999, 29918, 333, 29901, 851, 29892, 13911, 362, 29918, 1853, 29901, 851, 29892, 5253, 29901, 5785, 1125, 13, 4706, 736, 1583, 29889, 23083, 362, 29898, 28549, 29918, 333, 29892, 13911, 362, 29918, 1853, 29892, 5253, 29892, 4046, 29922, 8516, 29897, 13, 13, 1678, 822, 13911, 362, 29918, 13400, 29898, 13, 4706, 1583, 29892, 9999, 29918, 333, 29901, 851, 29892, 13911, 362, 29918, 1853, 29901, 851, 29892, 5253, 29901, 5785, 29892, 4046, 29901, 5785, 13, 268, 1125, 13, 4706, 736, 1583, 29889, 23083, 362, 29898, 28549, 29918, 333, 29892, 13911, 362, 29918, 1853, 29892, 5253, 29892, 4046, 29897, 13, 13, 1678, 822, 903, 12276, 29898, 13, 4706, 1583, 29892, 13, 4706, 9999, 29918, 333, 29901, 851, 29892, 13, 4706, 3461, 29918, 1853, 29901, 903, 29883, 29889, 13020, 1542, 29892, 13, 4706, 1369, 29918, 271, 29901, 12865, 353, 6213, 29892, 13, 4706, 1095, 29918, 271, 29901, 12865, 353, 6213, 29892, 13, 268, 1125, 13, 4706, 565, 338, 8758, 29898, 2962, 29918, 271, 29892, 12865, 1125, 13, 9651, 1369, 29918, 271, 353, 938, 29898, 2962, 29918, 271, 29889, 16394, 3101, 13, 4706, 565, 338, 8758, 29898, 355, 29918, 271, 29892, 12865, 1125, 13, 9651, 1095, 29918, 271, 353, 938, 29898, 355, 29918, 271, 29889, 16394, 3101, 13, 4706, 848, 353, 1583, 29889, 657, 29898, 13, 9651, 285, 29908, 3502, 1691, 19248, 28549, 29918, 333, 6822, 276, 4011, 613, 13, 9651, 8636, 3790, 13, 18884, 376, 12276, 29918, 1853, 1115, 851, 29898, 12276, 29918, 1853, 511, 13, 18884, 376, 3166, 1115, 1369, 29918, 271, 29892, 13, 18884, 376, 517, 1115, 1095, 29918, 271, 29892, 13, 9651, 2981, 13, 4706, 1723, 13, 4706, 736, 848, 13, 13, 1678, 822, 3461, 29918, 12483, 482, 29918, 558, 1575, 29898, 13, 4706, 1583, 29892, 9999, 29918, 333, 29901, 851, 29892, 1369, 29918, 271, 29901, 12865, 353, 6213, 29892, 1095, 29918, 271, 29901, 12865, 353, 6213, 13, 268, 1125, 13, 4706, 848, 353, 1583, 3032, 12276, 29898, 28549, 29918, 333, 29892, 903, 29883, 29889, 13020, 1542, 29889, 29909, 5348, 10461, 29918, 10593, 2965, 2890, 29892, 1369, 29918, 271, 29892, 1095, 29918, 271, 29897, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 23160, 29885, 29889, 29909, 19698, 13026, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 12276, 29897, 363, 3461, 297, 848, 3366, 276, 4011, 3108, 29962, 13, 13, 1678, 822, 3461, 29918, 29883, 392, 29880, 342, 860, 29898, 13, 4706, 1583, 29892, 9999, 29918, 333, 29901, 851, 29892, 1369, 29918, 271, 29901, 12865, 353, 6213, 29892, 1095, 29918, 271, 29901, 12865, 353, 6213, 13, 268, 1125, 13, 4706, 848, 353, 1583, 3032, 12276, 29898, 28549, 29918, 333, 29892, 903, 29883, 29889, 13020, 1542, 29889, 29907, 9468, 1307, 1254, 2965, 29968, 29892, 1369, 29918, 271, 29892, 1095, 29918, 271, 29897, 13, 4706, 565, 1583, 29889, 2457, 29918, 3126, 29901, 13, 9651, 736, 848, 13, 4706, 736, 23160, 29885, 29889, 29907, 392, 29880, 342, 860, 29889, 3258, 29918, 3166, 29918, 3126, 29898, 12276, 29897, 363, 3461, 297, 848, 3366, 276, 4011, 3108, 29962, 13, 2 ]
chia_tea/discord/commands/test_wallets.py
Tea-n-Tech/chia-tea
6
1069
<gh_stars>1-10 import os import tempfile import unittest from datetime import datetime from google.protobuf.json_format import ParseDict from ...monitoring.MonitoringDatabase import MonitoringDatabase from ...protobuf.generated.computer_info_pb2 import ADD, UpdateEvent from ...protobuf.generated.monitoring_service_pb2 import DataUpdateRequest from ...utils.testing import async_test from .wallets import wallets_cmd class TestWalletsCmd(unittest.TestCase): @async_test async def test_no_wallets_case(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: db_filepath = os.path.join(tmpdir, "temp.db") with MonitoringDatabase(db_filepath): messages = await wallets_cmd(db_filepath) self.assertEqual(len(messages), 1) self.assertTrue(messages[0].startswith("No wallets")) @async_test async def test_not_running_wallet_not_displayed(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: db_filepath = os.path.join(tmpdir, "temp.db") now_timestamp = datetime.now().timestamp() with MonitoringDatabase(db_filepath) as db: event = ParseDict( js_dict=dict( event_type=ADD, wallet=dict( is_running=False, is_synced=True, ), ), message=UpdateEvent(), ) request = DataUpdateRequest( machine_id=1, machine_name="machine A", timestamp=now_timestamp, events=[event], ) db.store_data_update_request(request) messages = await wallets_cmd(db_filepath) self.assertEqual(len(messages), 1) self.assertTrue(messages[0].startswith("No wallets")) @async_test async def test_display_running_wallet(self) -> None: with tempfile.TemporaryDirectory() as tmpdir: db_filepath = os.path.join(tmpdir, "tmp.db") now_timestamp = datetime.now().timestamp() with MonitoringDatabase(db_filepath) as db: update_events = [ ParseDict( js_dict=dict( event_type=ADD, wallet=dict( is_running=True, is_synced=True, ), ), message=UpdateEvent(), ), ] request = DataUpdateRequest( machine_id=1, machine_name="machine A", timestamp=now_timestamp, events=update_events, ) db.store_data_update_request(request) messages = await wallets_cmd(db_filepath) print(messages) # no failure self.assertEqual(len(messages), 1) msg = messages[0] self.assertFalse(msg.startswith("Traceback")) # display online harvester self.assertTrue("machine A" in msg) self.assertIn("synchronized", msg)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 5694, 1445, 13, 5215, 443, 27958, 13, 3166, 12865, 1053, 12865, 13, 13, 3166, 5386, 29889, 17529, 9721, 29889, 3126, 29918, 4830, 1053, 20969, 21533, 13, 13, 3166, 2023, 3712, 2105, 292, 29889, 7185, 2105, 292, 9112, 1053, 2598, 2105, 292, 9112, 13, 3166, 2023, 17529, 9721, 29889, 13525, 29889, 12097, 261, 29918, 3888, 29918, 24381, 29906, 1053, 27827, 29892, 10318, 2624, 13, 3166, 2023, 17529, 9721, 29889, 13525, 29889, 3712, 2105, 292, 29918, 5509, 29918, 24381, 29906, 1053, 3630, 6422, 3089, 13, 3166, 2023, 13239, 29889, 13424, 1053, 7465, 29918, 1688, 13, 3166, 869, 14625, 10376, 1053, 17042, 10376, 29918, 9006, 13, 13, 13, 1990, 4321, 29956, 284, 10376, 23651, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 732, 12674, 29918, 1688, 13, 1678, 7465, 822, 1243, 29918, 1217, 29918, 14625, 10376, 29918, 4878, 29898, 1311, 29897, 1599, 6213, 29901, 13, 13, 4706, 411, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 13128, 3972, 29901, 13, 9651, 4833, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 3972, 29892, 376, 7382, 29889, 2585, 1159, 13, 13, 9651, 411, 2598, 2105, 292, 9112, 29898, 2585, 29918, 1445, 2084, 1125, 13, 18884, 7191, 353, 7272, 17042, 10376, 29918, 9006, 29898, 2585, 29918, 1445, 2084, 29897, 13, 13, 18884, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 19158, 511, 29871, 29896, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 19158, 29961, 29900, 1822, 27382, 2541, 703, 3782, 17042, 10376, 5783, 13, 13, 1678, 732, 12674, 29918, 1688, 13, 1678, 7465, 822, 1243, 29918, 1333, 29918, 21094, 29918, 14625, 1026, 29918, 1333, 29918, 4990, 287, 29898, 1311, 29897, 1599, 6213, 29901, 13, 13, 4706, 411, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 13128, 3972, 29901, 13, 9651, 4833, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 3972, 29892, 376, 7382, 29889, 2585, 1159, 13, 9651, 1286, 29918, 16394, 353, 12865, 29889, 3707, 2141, 16394, 580, 13, 13, 9651, 411, 2598, 2105, 292, 9112, 29898, 2585, 29918, 1445, 2084, 29897, 408, 4833, 29901, 13, 18884, 1741, 353, 20969, 21533, 29898, 13, 462, 1678, 6965, 29918, 8977, 29922, 8977, 29898, 13, 462, 4706, 1741, 29918, 1853, 29922, 17744, 29892, 13, 462, 4706, 17042, 1026, 29922, 8977, 29898, 13, 462, 9651, 338, 29918, 21094, 29922, 8824, 29892, 13, 462, 9651, 338, 29918, 19274, 1133, 29922, 5574, 29892, 13, 462, 4706, 10353, 13, 462, 1678, 10353, 13, 462, 1678, 2643, 29922, 6422, 2624, 3285, 13, 18884, 1723, 13, 18884, 2009, 353, 3630, 6422, 3089, 29898, 13, 462, 1678, 4933, 29918, 333, 29922, 29896, 29892, 13, 462, 1678, 4933, 29918, 978, 543, 23523, 319, 613, 13, 462, 1678, 14334, 29922, 3707, 29918, 16394, 29892, 13, 462, 1678, 4959, 11759, 3696, 1402, 13, 18884, 1723, 13, 18884, 4833, 29889, 8899, 29918, 1272, 29918, 5504, 29918, 3827, 29898, 3827, 29897, 13, 13, 18884, 7191, 353, 7272, 17042, 10376, 29918, 9006, 29898, 2585, 29918, 1445, 2084, 29897, 13, 13, 18884, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 19158, 511, 29871, 29896, 29897, 13, 18884, 1583, 29889, 9294, 5574, 29898, 19158, 29961, 29900, 1822, 27382, 2541, 703, 3782, 17042, 10376, 5783, 13, 13, 1678, 732, 12674, 29918, 1688, 13, 1678, 7465, 822, 1243, 29918, 4990, 29918, 21094, 29918, 14625, 1026, 29898, 1311, 29897, 1599, 6213, 29901, 13, 13, 4706, 411, 5694, 1445, 29889, 5776, 1971, 653, 9882, 580, 408, 13128, 3972, 29901, 13, 9651, 4833, 29918, 1445, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 3972, 29892, 376, 7050, 29889, 2585, 1159, 13, 9651, 1286, 29918, 16394, 353, 12865, 29889, 3707, 2141, 16394, 580, 13, 13, 9651, 411, 2598, 2105, 292, 9112, 29898, 2585, 29918, 1445, 2084, 29897, 408, 4833, 29901, 13, 18884, 2767, 29918, 13604, 353, 518, 13, 462, 1678, 20969, 21533, 29898, 13, 462, 4706, 6965, 29918, 8977, 29922, 8977, 29898, 13, 462, 9651, 1741, 29918, 1853, 29922, 17744, 29892, 13, 462, 9651, 17042, 1026, 29922, 8977, 29898, 13, 462, 18884, 338, 29918, 21094, 29922, 5574, 29892, 13, 462, 18884, 338, 29918, 19274, 1133, 29922, 5574, 29892, 13, 462, 9651, 10353, 13, 462, 4706, 10353, 13, 462, 4706, 2643, 29922, 6422, 2624, 3285, 13, 462, 1678, 10353, 13, 18884, 4514, 13, 18884, 2009, 353, 3630, 6422, 3089, 29898, 13, 462, 1678, 4933, 29918, 333, 29922, 29896, 29892, 13, 462, 1678, 4933, 29918, 978, 543, 23523, 319, 613, 13, 462, 1678, 14334, 29922, 3707, 29918, 16394, 29892, 13, 462, 1678, 4959, 29922, 5504, 29918, 13604, 29892, 13, 18884, 1723, 13, 18884, 4833, 29889, 8899, 29918, 1272, 29918, 5504, 29918, 3827, 29898, 3827, 29897, 13, 13, 18884, 7191, 353, 7272, 17042, 10376, 29918, 9006, 29898, 2585, 29918, 1445, 2084, 29897, 13, 18884, 1596, 29898, 19158, 29897, 13, 18884, 396, 694, 10672, 13, 18884, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 19158, 511, 29871, 29896, 29897, 13, 18884, 10191, 353, 7191, 29961, 29900, 29962, 13, 18884, 1583, 29889, 9294, 8824, 29898, 7645, 29889, 27382, 2541, 703, 11591, 1627, 5783, 13, 18884, 396, 2479, 7395, 4023, 29894, 4156, 13, 18884, 1583, 29889, 9294, 5574, 703, 23523, 319, 29908, 297, 10191, 29897, 13, 18884, 1583, 29889, 9294, 797, 703, 29879, 9524, 1891, 613, 10191, 29897, 13, 2 ]
flowpatrolcore/templatetags/flowpatrol_tags.py
chrxr/flowpatrol_old
0
162221
<gh_stars>0 from django import template from django.conf import settings from flowpatrolcore.models import * register = template.Library() # settings value @register.assignment_tag def get_googe_maps_key(): return getattr(settings, 'GOOGLE_MAPS_KEY', "") @register.assignment_tag(takes_context=True) def get_site_root(context): # NB this returns a core.Page, not the implementation-specific model used # so object-comparison to self will return false as objects would differ return context['request'].site.root_page def has_menu_children(page): if page.get_children().filter(live=True, show_in_menus=True): return True else: return False # Retrieves the top menu items - the immediate children of the parent page # The has_menu_children method is necessary because the bootstrap menu requires # a dropdown class to be applied to a parent @register.inclusion_tag('flowpatrolcore/tags/top_menu.html', takes_context=True) def top_menu(context, parent, calling_page=None): menuitems = parent.get_children().filter( live=True, show_in_menus=True ) for menuitem in menuitems: menuitem.show_dropdown = has_menu_children(menuitem) return { 'calling_page': calling_page, 'menuitems': menuitems, # required by the pageurl tag that we want to use within this template 'request': context['request'], } # Retrieves the children of the top menu items for the drop downs @register.inclusion_tag('flowpatrolcore/tags/top_menu_children.html', takes_context=True) def top_menu_children(context, parent): menuitems_children = parent.get_children() menuitems_children = menuitems_children.filter( live=True, show_in_menus=True ) return { 'parent': parent, 'menuitems_children': menuitems_children, # required by the pageurl tag that we want to use within this template 'request': context['request'], } @register.inclusion_tag('flowpatrolcore/tags/mobile_menu.html', takes_context=True) def mobile_menu(context, parent, calling_page=None): menuitems = parent.get_children().filter( live=True, show_in_menus=True ) # for menuitem in menuitems: # menuitem.show_dropdown = has_menu_children(menuitem) return { 'calling_page': calling_page, 'menuitems': menuitems, # required by the pageurl tag that we want to use within this template 'request': context['request'], } # Retrieves the secondary links for the 'also in this section' links # - either the children or siblings of the current page @register.inclusion_tag('flowpatrolcore/tags/secondary_menu.html', takes_context=True) def secondary_menu(context, calling_page=None): pages = [] if calling_page: pages = calling_page.get_children().filter( live=True, show_in_menus=True ) # If no children, get siblings instead if len(pages) == 0: pages = calling_page.get_siblings(inclusive=False).filter( live=True, show_in_menus=True ) return { 'pages': pages, # required by the pageurl tag that we want to use within this template 'request': context['request'], }
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 1053, 4472, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 3166, 4972, 5031, 1467, 3221, 29889, 9794, 1053, 334, 13, 13, 9573, 353, 4472, 29889, 12284, 580, 13, 13, 13, 29937, 6055, 995, 13, 29992, 9573, 29889, 465, 10194, 29918, 4039, 13, 1753, 679, 29918, 1484, 21317, 29918, 10339, 29918, 1989, 7295, 13, 1678, 736, 679, 5552, 29898, 11027, 29892, 525, 17080, 29949, 29954, 1307, 29918, 1529, 7024, 29918, 10818, 742, 20569, 13, 13, 13, 29992, 9573, 29889, 465, 10194, 29918, 4039, 29898, 29873, 6926, 29918, 4703, 29922, 5574, 29897, 13, 1753, 679, 29918, 2746, 29918, 4632, 29898, 4703, 1125, 13, 1678, 396, 405, 29933, 445, 3639, 263, 7136, 29889, 5074, 29892, 451, 278, 5314, 29899, 14940, 1904, 1304, 13, 1678, 396, 577, 1203, 29899, 510, 20941, 304, 1583, 674, 736, 2089, 408, 3618, 723, 1163, 13, 1678, 736, 3030, 1839, 3827, 13359, 2746, 29889, 4632, 29918, 3488, 13, 13, 13, 1753, 756, 29918, 6510, 29918, 11991, 29898, 3488, 1125, 13, 1678, 565, 1813, 29889, 657, 29918, 11991, 2141, 4572, 29898, 9258, 29922, 5574, 29892, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 1125, 13, 4706, 736, 5852, 13, 1678, 1683, 29901, 13, 4706, 736, 7700, 13, 13, 13, 29937, 19338, 1960, 278, 2246, 6143, 4452, 448, 278, 16800, 4344, 310, 278, 3847, 1813, 13, 29937, 450, 756, 29918, 6510, 29918, 11991, 1158, 338, 5181, 1363, 278, 16087, 6143, 6858, 13, 29937, 263, 14687, 770, 304, 367, 7436, 304, 263, 3847, 13, 29992, 9573, 29889, 262, 10085, 29918, 4039, 877, 1731, 5031, 1467, 3221, 29914, 11338, 29914, 3332, 29918, 6510, 29889, 1420, 742, 4893, 29918, 4703, 29922, 5574, 29897, 13, 1753, 2246, 29918, 6510, 29898, 4703, 29892, 3847, 29892, 5432, 29918, 3488, 29922, 8516, 1125, 13, 1678, 6143, 7076, 353, 3847, 29889, 657, 29918, 11991, 2141, 4572, 29898, 13, 4706, 5735, 29922, 5574, 29892, 13, 4706, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 13, 1678, 1723, 13, 1678, 363, 6143, 667, 297, 6143, 7076, 29901, 13, 4706, 6143, 667, 29889, 4294, 29918, 19305, 353, 756, 29918, 6510, 29918, 11991, 29898, 6510, 667, 29897, 13, 1678, 736, 426, 13, 4706, 525, 4804, 292, 29918, 3488, 2396, 5432, 29918, 3488, 29892, 13, 4706, 525, 6510, 7076, 2396, 6143, 7076, 29892, 13, 4706, 396, 3734, 491, 278, 1813, 2271, 4055, 393, 591, 864, 304, 671, 2629, 445, 4472, 13, 4706, 525, 3827, 2396, 3030, 1839, 3827, 7464, 13, 1678, 500, 13, 13, 13, 29937, 19338, 1960, 278, 4344, 310, 278, 2246, 6143, 4452, 363, 278, 5768, 1623, 29879, 13, 29992, 9573, 29889, 262, 10085, 29918, 4039, 877, 1731, 5031, 1467, 3221, 29914, 11338, 29914, 3332, 29918, 6510, 29918, 11991, 29889, 1420, 742, 4893, 29918, 4703, 29922, 5574, 29897, 13, 1753, 2246, 29918, 6510, 29918, 11991, 29898, 4703, 29892, 3847, 1125, 13, 1678, 6143, 7076, 29918, 11991, 353, 3847, 29889, 657, 29918, 11991, 580, 13, 1678, 6143, 7076, 29918, 11991, 353, 6143, 7076, 29918, 11991, 29889, 4572, 29898, 13, 4706, 5735, 29922, 5574, 29892, 13, 4706, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 13, 1678, 1723, 13, 1678, 736, 426, 13, 4706, 525, 3560, 2396, 3847, 29892, 13, 4706, 525, 6510, 7076, 29918, 11991, 2396, 6143, 7076, 29918, 11991, 29892, 13, 4706, 396, 3734, 491, 278, 1813, 2271, 4055, 393, 591, 864, 304, 671, 2629, 445, 4472, 13, 4706, 525, 3827, 2396, 3030, 1839, 3827, 7464, 13, 1678, 500, 13, 13, 29992, 9573, 29889, 262, 10085, 29918, 4039, 877, 1731, 5031, 1467, 3221, 29914, 11338, 29914, 16769, 29918, 6510, 29889, 1420, 742, 4893, 29918, 4703, 29922, 5574, 29897, 13, 1753, 10426, 29918, 6510, 29898, 4703, 29892, 3847, 29892, 5432, 29918, 3488, 29922, 8516, 1125, 13, 1678, 6143, 7076, 353, 3847, 29889, 657, 29918, 11991, 2141, 4572, 29898, 13, 4706, 5735, 29922, 5574, 29892, 13, 4706, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 13, 1678, 1723, 13, 1678, 396, 363, 6143, 667, 297, 6143, 7076, 29901, 13, 1678, 396, 268, 6143, 667, 29889, 4294, 29918, 19305, 353, 756, 29918, 6510, 29918, 11991, 29898, 6510, 667, 29897, 13, 1678, 736, 426, 13, 4706, 525, 4804, 292, 29918, 3488, 2396, 5432, 29918, 3488, 29892, 13, 4706, 525, 6510, 7076, 2396, 6143, 7076, 29892, 13, 4706, 396, 3734, 491, 278, 1813, 2271, 4055, 393, 591, 864, 304, 671, 2629, 445, 4472, 13, 4706, 525, 3827, 2396, 3030, 1839, 3827, 7464, 13, 1678, 500, 13, 13, 29937, 19338, 1960, 278, 16723, 2988, 363, 278, 525, 15189, 297, 445, 4004, 29915, 2988, 13, 29937, 448, 2845, 278, 4344, 470, 27767, 18964, 310, 278, 1857, 1813, 13, 29992, 9573, 29889, 262, 10085, 29918, 4039, 877, 1731, 5031, 1467, 3221, 29914, 11338, 29914, 7496, 653, 29918, 6510, 29889, 1420, 742, 4893, 29918, 4703, 29922, 5574, 29897, 13, 1753, 16723, 29918, 6510, 29898, 4703, 29892, 5432, 29918, 3488, 29922, 8516, 1125, 13, 1678, 6515, 353, 5159, 13, 1678, 565, 5432, 29918, 3488, 29901, 13, 4706, 6515, 353, 5432, 29918, 3488, 29889, 657, 29918, 11991, 2141, 4572, 29898, 13, 9651, 5735, 29922, 5574, 29892, 13, 9651, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 13, 4706, 1723, 13, 13, 4706, 396, 960, 694, 4344, 29892, 679, 27767, 18964, 2012, 13, 4706, 565, 7431, 29898, 12292, 29897, 1275, 29871, 29900, 29901, 13, 9651, 6515, 353, 5432, 29918, 3488, 29889, 657, 29918, 29879, 747, 18964, 29898, 262, 7009, 573, 29922, 8824, 467, 4572, 29898, 13, 18884, 5735, 29922, 5574, 29892, 13, 18884, 1510, 29918, 262, 29918, 1527, 375, 29922, 5574, 13, 9651, 1723, 13, 1678, 736, 426, 13, 4706, 525, 12292, 2396, 6515, 29892, 13, 4706, 396, 3734, 491, 278, 1813, 2271, 4055, 393, 591, 864, 304, 671, 2629, 445, 4472, 13, 4706, 525, 3827, 2396, 3030, 1839, 3827, 7464, 13, 1678, 500, 13, 13, 13, 13, 13, 2 ]
tests/test_rw_minio.py
gva-jjoyce/mabel
0
1617451
import os import sys sys.path.insert(1, os.path.join(sys.path[0], "..")) from mabel.adapters.minio import MinIoWriter, MinIoReader from mabel.operators.minio import MinIoBatchWriterOperator from mabel.data import BatchWriter from mabel.data import Reader from rich import traceback traceback.install() BUCKET_NAME = "test" VAMPIRIC_COUNCIL = [ {"player": "<NAME>", "from": "Only Lovers Left Alive"}, {"player": "<NAME>", "from": "True Blood"}, {"player": "<NAME>", "from": "From Duck Til Dawn"}, {"player": "<NAME>", "from": "Buffy the Vampire Slayer"}, {"player": "<NAME>", "from": "Blade"}, ] def _create_bucket(): from minio import Minio end_point = os.getenv("MINIO_END_POINT") access_key = os.getenv("MINIO_ACCESS_KEY") secret_key = os.getenv("MINIO_SECRET_KEY") client = Minio(end_point, access_key, secret_key, secure=False) if not client.bucket_exists(BUCKET_NAME): client.make_bucket(BUCKET_NAME) def test_using_batch_writer(): errored = False try: _create_bucket() w = BatchWriter( inner_writer=MinIoWriter, end_point=os.getenv("MINIO_END_POINT"), access_key=os.getenv("MINIO_ACCESS_KEY"), secret_key=os.getenv("MINIO_SECRET_KEY"), secure=False, dataset=f"{BUCKET_NAME}/test_writer", ) for member in VAMPIRIC_COUNCIL: w.append(member) w.finalize() except: errored = True assert not errored def test_using_operator(): _create_bucket() w = MinIoBatchWriterOperator( end_point=os.getenv("MINIO_END_POINT"), access_key=os.getenv("MINIO_ACCESS_KEY"), secret_key=os.getenv("MINIO_SECRET_KEY"), secure=False, dataset=f"{BUCKET_NAME}/test_operator", ) for member in VAMPIRIC_COUNCIL: w.execute(member) w.finalize() reader = Reader( end_point=os.getenv("MINIO_END_POINT"), access_key=os.getenv("MINIO_ACCESS_KEY"), secret_key=os.getenv("MINIO_SECRET_KEY"), secure=False, dataset=f"{BUCKET_NAME}/test_operator", inner_reader=MinIoReader, ) for i, item in enumerate(reader): pass assert (i + 1) == len(VAMPIRIC_COUNCIL), i assert item == VAMPIRIC_COUNCIL[i] if __name__ == "__main__": # pragma: no cover test_using_batch_writer() test_using_operator() print("okay")
[ 1, 1053, 2897, 13, 5215, 10876, 13, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29896, 29892, 2897, 29889, 2084, 29889, 7122, 29898, 9675, 29889, 2084, 29961, 29900, 1402, 376, 636, 5783, 13, 3166, 286, 1107, 29889, 328, 481, 2153, 29889, 1195, 601, 1053, 3080, 29902, 29877, 10507, 29892, 3080, 29902, 29877, 6982, 13, 3166, 286, 1107, 29889, 3372, 4097, 29889, 1195, 601, 1053, 3080, 29902, 29877, 23145, 10507, 26486, 13, 3166, 286, 1107, 29889, 1272, 1053, 350, 905, 10507, 13, 3166, 286, 1107, 29889, 1272, 1053, 830, 1664, 13, 3166, 8261, 1053, 9637, 1627, 13, 13, 15003, 1627, 29889, 6252, 580, 13, 13, 13, 7838, 7077, 2544, 29918, 5813, 353, 376, 1688, 29908, 13, 13, 29963, 5194, 2227, 29934, 2965, 29918, 3217, 3904, 29907, 6227, 353, 518, 13, 1678, 8853, 9106, 1115, 9872, 5813, 28341, 376, 3166, 1115, 376, 11730, 4309, 874, 19941, 319, 9258, 10758, 13, 1678, 8853, 9106, 1115, 9872, 5813, 28341, 376, 3166, 1115, 376, 5574, 25122, 10758, 13, 1678, 8853, 9106, 1115, 9872, 5813, 28341, 376, 3166, 1115, 376, 4591, 360, 2707, 323, 309, 7266, 1233, 10758, 13, 1678, 8853, 9106, 1115, 9872, 5813, 28341, 376, 3166, 1115, 376, 29933, 3096, 29891, 278, 478, 1160, 533, 317, 13148, 10758, 13, 1678, 8853, 9106, 1115, 9872, 5813, 28341, 376, 3166, 1115, 376, 29933, 23373, 10758, 13, 29962, 13, 13, 13, 1753, 903, 3258, 29918, 21454, 7295, 13, 1678, 515, 1375, 601, 1053, 3080, 601, 13, 13, 1678, 1095, 29918, 3149, 353, 2897, 29889, 657, 6272, 703, 16173, 5971, 29918, 11794, 29918, 29925, 6992, 29911, 1159, 13, 1678, 2130, 29918, 1989, 353, 2897, 29889, 657, 6272, 703, 16173, 5971, 29918, 2477, 23524, 29918, 10818, 1159, 13, 1678, 7035, 29918, 1989, 353, 2897, 29889, 657, 6272, 703, 16173, 5971, 29918, 1660, 22245, 29911, 29918, 10818, 1159, 13, 13, 1678, 3132, 353, 3080, 601, 29898, 355, 29918, 3149, 29892, 2130, 29918, 1989, 29892, 7035, 29918, 1989, 29892, 11592, 29922, 8824, 29897, 13, 1678, 565, 451, 3132, 29889, 21454, 29918, 9933, 29898, 7838, 7077, 2544, 29918, 5813, 1125, 13, 4706, 3132, 29889, 5675, 29918, 21454, 29898, 7838, 7077, 2544, 29918, 5813, 29897, 13, 13, 13, 1753, 1243, 29918, 4746, 29918, 16175, 29918, 13236, 7295, 13, 13, 1678, 1059, 287, 353, 7700, 13, 1678, 1018, 29901, 13, 4706, 903, 3258, 29918, 21454, 580, 13, 4706, 281, 353, 350, 905, 10507, 29898, 13, 9651, 6426, 29918, 13236, 29922, 8140, 29902, 29877, 10507, 29892, 13, 9651, 1095, 29918, 3149, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 11794, 29918, 29925, 6992, 29911, 4968, 13, 9651, 2130, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 2477, 23524, 29918, 10818, 4968, 13, 9651, 7035, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 1660, 22245, 29911, 29918, 10818, 4968, 13, 9651, 11592, 29922, 8824, 29892, 13, 9651, 8783, 29922, 29888, 29908, 29912, 7838, 7077, 2544, 29918, 5813, 6822, 1688, 29918, 13236, 613, 13, 4706, 1723, 13, 13, 4706, 363, 4509, 297, 478, 5194, 2227, 29934, 2965, 29918, 3217, 3904, 29907, 6227, 29901, 13, 9651, 281, 29889, 4397, 29898, 14242, 29897, 13, 4706, 281, 29889, 8394, 675, 580, 13, 1678, 5174, 29901, 13, 4706, 1059, 287, 353, 5852, 13, 13, 1678, 4974, 451, 1059, 287, 13, 13, 13, 1753, 1243, 29918, 4746, 29918, 6891, 7295, 13, 13, 1678, 903, 3258, 29918, 21454, 580, 13, 13, 1678, 281, 353, 3080, 29902, 29877, 23145, 10507, 26486, 29898, 13, 4706, 1095, 29918, 3149, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 11794, 29918, 29925, 6992, 29911, 4968, 13, 4706, 2130, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 2477, 23524, 29918, 10818, 4968, 13, 4706, 7035, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 1660, 22245, 29911, 29918, 10818, 4968, 13, 4706, 11592, 29922, 8824, 29892, 13, 4706, 8783, 29922, 29888, 29908, 29912, 7838, 7077, 2544, 29918, 5813, 6822, 1688, 29918, 6891, 613, 13, 1678, 1723, 13, 13, 1678, 363, 4509, 297, 478, 5194, 2227, 29934, 2965, 29918, 3217, 3904, 29907, 6227, 29901, 13, 4706, 281, 29889, 7978, 29898, 14242, 29897, 13, 1678, 281, 29889, 8394, 675, 580, 13, 13, 1678, 9591, 353, 830, 1664, 29898, 13, 4706, 1095, 29918, 3149, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 11794, 29918, 29925, 6992, 29911, 4968, 13, 4706, 2130, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 2477, 23524, 29918, 10818, 4968, 13, 4706, 7035, 29918, 1989, 29922, 359, 29889, 657, 6272, 703, 16173, 5971, 29918, 1660, 22245, 29911, 29918, 10818, 4968, 13, 4706, 11592, 29922, 8824, 29892, 13, 4706, 8783, 29922, 29888, 29908, 29912, 7838, 7077, 2544, 29918, 5813, 6822, 1688, 29918, 6891, 613, 13, 4706, 6426, 29918, 16950, 29922, 8140, 29902, 29877, 6982, 29892, 13, 1678, 1723, 13, 13, 1678, 363, 474, 29892, 2944, 297, 26985, 29898, 16950, 1125, 13, 4706, 1209, 13, 13, 1678, 4974, 313, 29875, 718, 29871, 29896, 29897, 1275, 7431, 29898, 29963, 5194, 2227, 29934, 2965, 29918, 3217, 3904, 29907, 6227, 511, 474, 13, 1678, 4974, 2944, 1275, 478, 5194, 2227, 29934, 2965, 29918, 3217, 3904, 29907, 6227, 29961, 29875, 29962, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 29871, 396, 282, 23929, 29901, 694, 4612, 13, 1678, 1243, 29918, 4746, 29918, 16175, 29918, 13236, 580, 13, 1678, 1243, 29918, 4746, 29918, 6891, 580, 13, 13, 1678, 1596, 703, 554, 388, 1159, 13, 2 ]
muz/beatmap/formats/osu.py
Akaricchi/muz
9
184777
<filename>muz/beatmap/formats/osu.py from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals import re import muz import muz.beatmap import muz.util import math name = "osu! beatmap" extensions = ["osu"] inferExtensions = extensions locations = ["beatmaps"] ARTable = [ 1800, 1680, 1560, 1440, 1320, 1200, 1050, 900, 750, 600, 450 ] def ARToNoterate(ar): ar = muz.util.clamp(0, ar, len(ARTable) - 1) iar = int(ar) low = ARTable[iar] high = ARTable[int(math.ceil(ar))] msec = low + (high - low) * (ar - iar) return 1000.0 / msec patternSection = re.compile(r'^\[([a-zA-Z0-9]+)\]$') patternKeyVal = re.compile(r'^([a-zA-Z0-9]+)\s*:\s*(.*)$') def read(fobj, filename, bare=False, options=None): buf = b"" bmap = muz.beatmap.Beatmap(None, 1) versionOk = False section = None while True: byte = fobj.read(1) if not byte: break if byte in (b'\r', b'\n'): buf = buf.decode('utf-8').strip() if not buf or buf.startswith("//"): buf = b"" continue if not versionOk: assert "osu file format v" in buf versionOk = True buf = b"" continue s = patternSection.findall(buf) if s: section = s[0] buf = b"" continue if section == "Events" or section == "TimingPoints" or (bare and section == "HitObjects"): buf = b"" continue elif section == "HitObjects": vals = buf.split(',') hit = int(vals[2]) hold = 0 if int(vals[3]) & 128: hold = int(vals[5].split(":")[0]) - hit # "human-readable" my ass # let's hope there is no beatmap that sets "CircleSize" AFTER the HitObjects section band = int(int(vals[0]) / (512 / bmap.numbands)) # maybe CircleSize lied to us... bmap.numbands = max(bmap.numbands, band + 1) bmap.append(muz.beatmap.Note(band, hit, hold)) buf = b"" continue else: s = patternKeyVal.findall(buf) if s: key, val = s[0] if section == "General": if key == "AudioFilename": bmap.music = val.replace("\\", "/") elif section == "Difficulty": if key == "CircleSize": bmap.numbands = int(float(val)) elif key == "ApproachRate": bmap.noterate = ARToNoterate(float(val)) bmap.meta["osu.%s.%s" % (section, key)] = val buf = b"" continue raise SyntaxError("failed to parse %s in an osu! beatmap" % repr(buf)) buf += byte bmap.meta["Music.Name"] = bmap.meta["osu.Metadata.TitleUnicode"] bmap.meta["Music.Name.ASCII"] = bmap.meta["osu.Metadata.Title"] bmap.meta["Music.Artist"] = bmap.meta["osu.Metadata.ArtistUnicode"] bmap.meta["Music.Artist.ASCII"] = bmap.meta["osu.Metadata.Artist"] bmap.meta["Beatmap.Variant"] = bmap.meta["osu.Metadata.Version"] bmap.meta["Beatmap.Author"] = bmap.meta["osu.Metadata.Creator"] bmap.applyMeta() return bmap
[ 1, 529, 9507, 29958, 2589, 29920, 29914, 915, 271, 1958, 29914, 689, 1446, 29914, 359, 29884, 29889, 2272, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 337, 13, 5215, 23948, 13, 5215, 23948, 29889, 915, 271, 1958, 13, 5215, 23948, 29889, 4422, 13, 5215, 5844, 13, 13, 978, 353, 376, 359, 29884, 29991, 16646, 1958, 29908, 13, 24299, 353, 6796, 359, 29884, 3108, 13, 262, 571, 26982, 353, 17752, 13, 2029, 800, 353, 6796, 915, 271, 10339, 3108, 13, 13, 1718, 3562, 353, 518, 13, 268, 29896, 29947, 29900, 29900, 29892, 13, 268, 29896, 29953, 29947, 29900, 29892, 13, 268, 29896, 29945, 29953, 29900, 29892, 13, 268, 29896, 29946, 29946, 29900, 29892, 13, 268, 29896, 29941, 29906, 29900, 29892, 13, 268, 29896, 29906, 29900, 29900, 29892, 13, 268, 29896, 29900, 29945, 29900, 29892, 13, 418, 29929, 29900, 29900, 29892, 13, 418, 29955, 29945, 29900, 29892, 13, 418, 29953, 29900, 29900, 29892, 13, 418, 29946, 29945, 29900, 13, 29962, 13, 13, 1753, 9033, 1762, 3664, 261, 403, 29898, 279, 1125, 13, 1678, 564, 353, 23948, 29889, 4422, 29889, 695, 1160, 29898, 29900, 29892, 564, 29892, 7431, 29898, 1718, 3562, 29897, 448, 29871, 29896, 29897, 13, 1678, 474, 279, 353, 938, 29898, 279, 29897, 13, 13, 1678, 4482, 29871, 353, 9033, 3562, 29961, 4447, 29962, 13, 1678, 1880, 353, 9033, 3562, 29961, 524, 29898, 755, 29889, 27696, 29898, 279, 28166, 13, 1678, 286, 3471, 353, 4482, 718, 313, 9812, 448, 4482, 29897, 334, 313, 279, 448, 474, 279, 29897, 13, 13, 1678, 736, 29871, 29896, 29900, 29900, 29900, 29889, 29900, 847, 286, 3471, 13, 13, 11037, 13438, 353, 337, 29889, 12198, 29898, 29878, 29915, 3823, 29961, 4197, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 10062, 2144, 9341, 1495, 13, 11037, 2558, 1440, 353, 337, 29889, 12198, 29898, 29878, 29915, 29985, 4197, 29874, 29899, 25265, 29899, 29999, 29900, 29899, 29929, 10062, 2144, 29879, 29930, 3583, 29879, 16395, 5575, 1262, 1495, 13, 13, 1753, 1303, 29898, 29888, 5415, 29892, 10422, 29892, 16079, 29922, 8824, 29892, 3987, 29922, 8516, 1125, 13, 1678, 18392, 353, 289, 15945, 13, 1678, 289, 1958, 353, 23948, 29889, 915, 271, 1958, 29889, 3629, 271, 1958, 29898, 8516, 29892, 29871, 29896, 29897, 13, 1678, 1873, 20434, 353, 7700, 13, 1678, 4004, 353, 6213, 13, 13, 1678, 1550, 5852, 29901, 13, 4706, 7023, 353, 285, 5415, 29889, 949, 29898, 29896, 29897, 13, 13, 4706, 565, 451, 7023, 29901, 13, 9651, 2867, 13, 13, 4706, 565, 7023, 297, 313, 29890, 12764, 29878, 742, 289, 12764, 29876, 29374, 13, 9651, 18392, 353, 18392, 29889, 13808, 877, 9420, 29899, 29947, 2824, 17010, 580, 13, 13, 9651, 565, 451, 18392, 470, 29871, 18392, 29889, 27382, 2541, 703, 458, 29908, 1125, 13, 18884, 18392, 353, 289, 15945, 13, 18884, 6773, 13, 13, 9651, 565, 451, 1873, 20434, 29901, 13, 18884, 4974, 376, 359, 29884, 934, 3402, 325, 29908, 297, 18392, 13, 18884, 1873, 20434, 353, 5852, 13, 18884, 18392, 353, 289, 15945, 13, 18884, 6773, 13, 13, 9651, 269, 353, 4766, 13438, 29889, 2886, 497, 29898, 9721, 29897, 13, 9651, 565, 269, 29901, 13, 18884, 4004, 353, 269, 29961, 29900, 29962, 13, 18884, 18392, 353, 289, 15945, 13, 18884, 6773, 13, 13, 9651, 565, 4004, 1275, 376, 13634, 29908, 470, 4004, 1275, 376, 13711, 292, 20325, 29908, 470, 313, 18354, 322, 4004, 1275, 376, 29950, 277, 12724, 29908, 1125, 13, 18884, 18392, 353, 289, 15945, 13, 18884, 6773, 13, 9651, 25342, 4004, 1275, 376, 29950, 277, 12724, 1115, 13, 18884, 659, 29879, 353, 18392, 29889, 5451, 29317, 1495, 13, 18884, 7124, 353, 938, 29898, 791, 29879, 29961, 29906, 2314, 13, 18884, 4808, 353, 29871, 29900, 13, 13, 18884, 565, 938, 29898, 791, 29879, 29961, 29941, 2314, 669, 29871, 29896, 29906, 29947, 29901, 13, 462, 1678, 4808, 353, 938, 29898, 791, 29879, 29961, 29945, 1822, 5451, 703, 29901, 1159, 29961, 29900, 2314, 448, 7124, 13, 13, 18884, 396, 376, 26029, 29899, 949, 519, 29908, 590, 1223, 13, 18884, 396, 1235, 29915, 29879, 4966, 727, 338, 694, 16646, 1958, 393, 6166, 376, 23495, 280, 3505, 29908, 23844, 4945, 278, 14309, 12724, 4004, 13, 18884, 3719, 353, 938, 29898, 524, 29898, 791, 29879, 29961, 29900, 2314, 847, 313, 29945, 29896, 29906, 847, 289, 1958, 29889, 1949, 29890, 4167, 876, 13, 13, 18884, 396, 5505, 27927, 3505, 619, 287, 304, 502, 856, 13, 18884, 289, 1958, 29889, 1949, 29890, 4167, 353, 4236, 29898, 29890, 1958, 29889, 1949, 29890, 4167, 29892, 3719, 718, 29871, 29896, 29897, 13, 13, 18884, 289, 1958, 29889, 4397, 29898, 2589, 29920, 29889, 915, 271, 1958, 29889, 9842, 29898, 4980, 29892, 7124, 29892, 4808, 876, 13, 13, 18884, 18392, 353, 289, 15945, 13, 18884, 6773, 13, 9651, 1683, 29901, 13, 18884, 269, 353, 4766, 2558, 1440, 29889, 2886, 497, 29898, 9721, 29897, 13, 18884, 565, 269, 29901, 13, 462, 1678, 1820, 29892, 659, 353, 269, 29961, 29900, 29962, 13, 13, 462, 1678, 565, 4004, 1275, 376, 15263, 1115, 13, 462, 4706, 565, 1820, 1275, 376, 17111, 3434, 3871, 1115, 13, 462, 9651, 289, 1958, 29889, 23596, 353, 659, 29889, 6506, 703, 1966, 613, 5591, 1159, 13, 462, 1678, 25342, 4004, 1275, 376, 26023, 3953, 29891, 1115, 13, 462, 4706, 565, 1820, 1275, 376, 23495, 280, 3505, 1115, 13, 462, 9651, 289, 1958, 29889, 1949, 29890, 4167, 353, 938, 29898, 7411, 29898, 791, 876, 13, 462, 4706, 25342, 1820, 1275, 376, 2052, 307, 496, 19907, 1115, 13, 462, 9651, 289, 1958, 29889, 1333, 261, 403, 353, 9033, 1762, 3664, 261, 403, 29898, 7411, 29898, 791, 876, 13, 13, 462, 1678, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 29995, 29879, 29889, 29995, 29879, 29908, 1273, 313, 2042, 29892, 1820, 4638, 353, 659, 13, 462, 1678, 18392, 353, 289, 15945, 13, 462, 1678, 6773, 13, 13, 9651, 12020, 21306, 2392, 703, 26061, 304, 6088, 1273, 29879, 297, 385, 288, 2146, 29991, 16646, 1958, 29908, 1273, 2062, 29898, 9721, 876, 13, 13, 4706, 18392, 4619, 7023, 13, 13, 1678, 289, 1958, 29889, 7299, 3366, 21238, 29889, 1170, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 7030, 2525, 12858, 3108, 13, 1678, 289, 1958, 29889, 7299, 3366, 21238, 29889, 1170, 29889, 28599, 2687, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 7030, 3108, 13, 13, 1678, 289, 1958, 29889, 7299, 3366, 21238, 29889, 9986, 391, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 9986, 391, 2525, 12858, 3108, 13, 1678, 289, 1958, 29889, 7299, 3366, 21238, 29889, 9986, 391, 29889, 28599, 2687, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 9986, 391, 3108, 13, 13, 1678, 289, 1958, 29889, 7299, 3366, 3629, 271, 1958, 29889, 10444, 424, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 6594, 3108, 13, 1678, 289, 1958, 29889, 7299, 3366, 3629, 271, 1958, 29889, 13720, 3108, 353, 289, 1958, 29889, 7299, 3366, 359, 29884, 29889, 18417, 29889, 9832, 1061, 3108, 13, 13, 1678, 289, 1958, 29889, 7302, 19346, 580, 13, 1678, 736, 289, 1958, 13, 2 ]
example_site/address/__init__.py
gnipp/django-address
0
87812
default_app_config = "address.apps.AddressConfig"
[ 1, 2322, 29918, 932, 29918, 2917, 353, 376, 7328, 29889, 13371, 29889, 7061, 3991, 29908, 13, 2 ]
bayern/ffb.py
risklayer/corona-landkreis-crawler
12
115722
<filename>bayern/ffb.py #!/usr/bin/python3 from botbase import * _ffb_c = re.compile(r"Stand\s\w+,\s(\d\d?\.\d\d?.20\d\d)\s\((\d\d?:\d\d)\sUhr\),\sgibt\ses\sinsgesamt\s+([0-9.]+)\s*(?:Infektionen|Corona-Infizierte)", re.U) _ffb_d = re.compile(r"Todesfälle insgesamt mit Covid-19-Befund und Wohnsitz im Landkreis Fürstenfeldbruck: *([0-9.]+) *\(Stand (\d\d\.\d\d\.20\d\d)\)", re.U) _ffb_g = re.compile(r"Genesene: ([0-9.]+) Personen \(Stand (\d\d\.\d\d.20\d\d)\)") def ffb(sheets): soup = get_soup("https://www.lra-ffb.de/aktuelles/corona-informationen/corona-statistik-infizierte-genesene-verstorbene-und-geimpfte-im-landkreis") text = soup.find(class_="content").get_text() #print(text) m = _ffb_c.search(text).groups() date = " ".join(m[0:2]) date = check_date(date, "Fürstenfeldbruck") c = force_int(m[2]) m2 = _ffb_d.search(text) d = force_int(m2.group(1)) if m2 and m2.group(2) == m[0] else None m2 = _ffb_g.search(text) g = force_int(m2.group(1)) if m2 and m2.group(2) == m[0] else None update(sheets, 9179, c=c, d=d, g=g, sig="Bot", ignore_delta="mon") return True schedule.append(Task(11, 0, 16, 35, 360, ffb, 9179)) if __name__ == '__main__': ffb(googlesheets())
[ 1, 529, 9507, 29958, 27495, 824, 29914, 600, 29890, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29941, 13, 3166, 9225, 3188, 1053, 334, 13, 13, 29918, 600, 29890, 29918, 29883, 353, 337, 29889, 12198, 29898, 29878, 29908, 11042, 29905, 29879, 29905, 29893, 29974, 2053, 29879, 1194, 29881, 29905, 29881, 29973, 29905, 7790, 29881, 29905, 29881, 9808, 29906, 29900, 29905, 29881, 29905, 29881, 2144, 29879, 29905, 29898, 1194, 29881, 29905, 29881, 29973, 3583, 29881, 29905, 29881, 2144, 29879, 29965, 1092, 29905, 20481, 5311, 9268, 29905, 29879, 267, 29905, 29879, 1144, 20914, 29905, 29879, 29974, 4197, 29900, 29899, 29929, 5586, 29974, 2144, 29879, 29930, 10780, 29901, 797, 1725, 23668, 29989, 12521, 2681, 29899, 25433, 466, 5423, 19123, 337, 29889, 29965, 29897, 13, 29918, 600, 29890, 29918, 29881, 353, 337, 29889, 12198, 29898, 29878, 29908, 29911, 2631, 29888, 23637, 26696, 1380, 25669, 333, 29899, 29896, 29929, 29899, 29933, 1389, 870, 563, 399, 1148, 1983, 2784, 527, 19126, 10528, 3510, 10612, 29890, 10857, 29901, 334, 4197, 29900, 29899, 29929, 5586, 28135, 334, 29905, 29898, 11042, 3441, 29881, 29905, 29881, 29905, 7790, 29881, 29905, 29881, 23301, 29906, 29900, 29905, 29881, 29905, 29881, 2144, 19123, 337, 29889, 29965, 29897, 13, 29918, 600, 29890, 29918, 29887, 353, 337, 29889, 12198, 29898, 29878, 29908, 15462, 267, 1600, 29901, 9310, 29900, 29899, 29929, 5586, 28135, 15497, 4269, 11042, 3441, 29881, 29905, 29881, 29905, 7790, 29881, 29905, 29881, 29889, 29906, 29900, 29905, 29881, 29905, 29881, 2144, 25760, 13, 13, 1753, 14336, 29890, 29898, 19360, 1125, 13, 1678, 22300, 353, 679, 29918, 29879, 1132, 703, 991, 597, 1636, 29889, 29880, 336, 29899, 600, 29890, 29889, 311, 29914, 5867, 29884, 4999, 29914, 2616, 2681, 29899, 19678, 264, 29914, 2616, 2681, 29899, 6112, 27013, 29899, 7192, 466, 5423, 29899, 1885, 267, 1600, 29899, 369, 303, 11831, 1600, 29899, 870, 29899, 479, 6574, 11927, 29899, 326, 29899, 1049, 12364, 1159, 13, 1678, 1426, 353, 22300, 29889, 2886, 29898, 1990, 29918, 543, 3051, 2564, 657, 29918, 726, 580, 13, 1678, 396, 2158, 29898, 726, 29897, 13, 1678, 286, 353, 903, 600, 29890, 29918, 29883, 29889, 4478, 29898, 726, 467, 13155, 580, 13, 1678, 2635, 353, 376, 11393, 7122, 29898, 29885, 29961, 29900, 29901, 29906, 2314, 13, 1678, 2635, 353, 1423, 29918, 1256, 29898, 1256, 29892, 376, 29943, 1276, 3510, 10612, 29890, 10857, 1159, 13, 1678, 274, 353, 4889, 29918, 524, 29898, 29885, 29961, 29906, 2314, 13, 1678, 286, 29906, 353, 903, 600, 29890, 29918, 29881, 29889, 4478, 29898, 726, 29897, 13, 1678, 270, 353, 4889, 29918, 524, 29898, 29885, 29906, 29889, 2972, 29898, 29896, 876, 565, 286, 29906, 322, 286, 29906, 29889, 2972, 29898, 29906, 29897, 1275, 286, 29961, 29900, 29962, 1683, 6213, 13, 1678, 286, 29906, 353, 903, 600, 29890, 29918, 29887, 29889, 4478, 29898, 726, 29897, 13, 1678, 330, 353, 4889, 29918, 524, 29898, 29885, 29906, 29889, 2972, 29898, 29896, 876, 565, 286, 29906, 322, 286, 29906, 29889, 2972, 29898, 29906, 29897, 1275, 286, 29961, 29900, 29962, 1683, 6213, 13, 1678, 2767, 29898, 19360, 29892, 29871, 29929, 29896, 29955, 29929, 29892, 274, 29922, 29883, 29892, 270, 29922, 29881, 29892, 330, 29922, 29887, 29892, 4365, 543, 29933, 327, 613, 11455, 29918, 4181, 543, 3712, 1159, 13, 1678, 736, 5852, 13, 13, 816, 11272, 29889, 4397, 29898, 5398, 29898, 29896, 29896, 29892, 29871, 29900, 29892, 29871, 29896, 29953, 29892, 29871, 29941, 29945, 29892, 29871, 29941, 29953, 29900, 29892, 14336, 29890, 29892, 29871, 29929, 29896, 29955, 29929, 876, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 14336, 29890, 29898, 1484, 468, 793, 354, 1691, 3101, 13, 2 ]
bot.py
ShawnQiang1/QQ-GitHub-Bot
0
1616624
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Author : yanyongyu @Date : 2020-09-10 17:12:05 @LastEditors : yanyongyu @LastEditTime : 2021-01-01 17:57:10 @Description : Entry File of the Bot @GitHub : https://github.com/yanyongyu """ __author__ = "yanyongyu" import nonebot from nonebot.adapters.cqhttp import Bot as CQHTTPBot from nonebot.adapters.ding import Bot as DINGBot nonebot.init() app = nonebot.get_asgi() driver = nonebot.get_driver() driver.register_adapter("cqhttp", CQHTTPBot) driver.register_adapter("ding", DINGBot) nonebot.load_plugins("src/plugins") if __name__ == "__main__": nonebot.run(app="bot:app")
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 29992, 13720, 308, 584, 343, 1384, 549, 29891, 29884, 13, 29992, 2539, 965, 584, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29929, 29899, 29896, 29900, 29871, 29896, 29955, 29901, 29896, 29906, 29901, 29900, 29945, 13, 29992, 8897, 6103, 943, 1678, 584, 343, 1384, 549, 29891, 29884, 13, 29992, 8897, 6103, 2481, 259, 584, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 29871, 29896, 29955, 29901, 29945, 29955, 29901, 29896, 29900, 13, 29992, 9868, 1678, 584, 28236, 3497, 310, 278, 11273, 13, 29992, 28712, 16046, 308, 584, 2045, 597, 3292, 29889, 510, 29914, 29891, 1384, 549, 29891, 29884, 13, 15945, 29908, 13, 1649, 8921, 1649, 353, 376, 29891, 1384, 549, 29891, 29884, 29908, 13, 13, 5215, 5642, 7451, 13, 3166, 5642, 7451, 29889, 328, 481, 2153, 29889, 29883, 29939, 1124, 1053, 11273, 408, 315, 29984, 10493, 29933, 327, 13, 3166, 5642, 7451, 29889, 328, 481, 2153, 29889, 8497, 1053, 11273, 408, 360, 4214, 29933, 327, 13, 13, 9290, 7451, 29889, 2344, 580, 13, 932, 353, 5642, 7451, 29889, 657, 29918, 294, 3146, 580, 13, 13, 9465, 353, 5642, 7451, 29889, 657, 29918, 9465, 580, 13, 9465, 29889, 9573, 29918, 21412, 703, 29883, 29939, 1124, 613, 315, 29984, 10493, 29933, 327, 29897, 13, 9465, 29889, 9573, 29918, 21412, 703, 8497, 613, 360, 4214, 29933, 327, 29897, 13, 13, 9290, 7451, 29889, 1359, 29918, 12800, 703, 4351, 29914, 12800, 1159, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 5642, 7451, 29889, 3389, 29898, 932, 543, 7451, 29901, 932, 1159, 13, 2 ]
solvcon/parcel/bulk/material.py
j8xixo12/solvcon
16
175822
# -*- coding: UTF-8 -*- # # Copyright (c) 2014, <NAME> <<EMAIL>> # # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted 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 copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software # without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. """ Material definition. """ from solvcon import gendata class BulkFluid(object): """ Fluid properties for :py:class:`~.solver.BulkSolver`. """ def __init__(self, **kw): self.bulk = kw.pop('bulk', 1.0) self.dvisco = kw.pop('dvisco', 1.0) self.rho = kw.pop('rho', 1.0) vel = kw.pop('vel', (0, 0, 0)) #: Collection of :py:class:`BulkFluid` objects. fluids = gendata.AttributeDict() fluids['air'] = BulkFluid( bulk=1.42e5, # Pa rho=1.225, # kg/m^3 dvisco=1.983e-5, # kg/(m s) ) # vim: set ff=unix fenc=utf8 ft=python ai et sw=4 ts=4 tw=79:
[ 1, 396, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29946, 29892, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 4367, 391, 3224, 322, 671, 297, 2752, 322, 7581, 7190, 29892, 411, 470, 1728, 13, 29937, 21733, 29892, 526, 21905, 4944, 393, 278, 1494, 5855, 526, 1539, 29901, 13, 29937, 13, 29937, 448, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 8369, 29892, 445, 13, 29937, 259, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 448, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 8369, 29892, 13, 29937, 259, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 5106, 13, 29937, 259, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 29937, 448, 2448, 2121, 278, 1024, 310, 278, 3509, 1266, 19464, 3643, 278, 2983, 310, 967, 17737, 29560, 13, 29937, 259, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 10723, 515, 445, 7047, 13, 29937, 259, 1728, 2702, 7536, 3971, 10751, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 5300, 8707, 29911, 3960, 29933, 2692, 24125, 376, 3289, 8519, 29908, 13, 29937, 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, 27848, 3352, 7495, 29892, 6093, 13, 29937, 306, 3580, 5265, 3352, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 5300, 383, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 13, 29937, 319, 1525, 28657, 13875, 8890, 29928, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 6323, 8707, 29911, 3960, 29933, 2692, 24125, 20700, 13, 29937, 17705, 6181, 15842, 13764, 29979, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 2672, 29907, 1367, 3919, 1964, 29892, 317, 4162, 8426, 1964, 29892, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 13, 29937, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 313, 1177, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 13756, 29907, 11499, 13780, 8079, 13, 29937, 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, 350, 3308, 8895, 1799, 13, 29937, 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, 2672, 13, 29937, 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, 15945, 29908, 13, 24095, 5023, 29889, 13, 15945, 29908, 13, 13, 13, 3166, 899, 29894, 535, 1053, 330, 355, 532, 13, 13, 13, 1990, 8313, 29895, 8754, 5416, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 2379, 5416, 4426, 363, 584, 2272, 29901, 1990, 18078, 30022, 29889, 2929, 369, 29889, 29933, 24456, 13296, 369, 1412, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 11022, 1125, 13, 4706, 1583, 29889, 8645, 29895, 353, 9049, 29889, 7323, 877, 8645, 29895, 742, 29871, 29896, 29889, 29900, 29897, 13, 4706, 1583, 29889, 29881, 1730, 1111, 353, 9049, 29889, 7323, 877, 29881, 1730, 1111, 742, 29871, 29896, 29889, 29900, 29897, 13, 4706, 1583, 29889, 4650, 353, 9049, 29889, 7323, 877, 4650, 742, 29871, 29896, 29889, 29900, 29897, 13, 4706, 5343, 353, 9049, 29889, 7323, 877, 955, 742, 313, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 876, 13, 13, 13, 29937, 29901, 14348, 310, 584, 2272, 29901, 1990, 18078, 29933, 24456, 8754, 5416, 29952, 3618, 29889, 13, 25044, 4841, 353, 330, 355, 532, 29889, 6708, 21533, 580, 13, 13, 25044, 4841, 1839, 1466, 2033, 353, 8313, 29895, 8754, 5416, 29898, 13, 1678, 21610, 29922, 29896, 29889, 29946, 29906, 29872, 29945, 29892, 396, 2621, 13, 1678, 364, 1251, 29922, 29896, 29889, 29906, 29906, 29945, 29892, 396, 12118, 29914, 29885, 29985, 29941, 13, 1678, 270, 1730, 1111, 29922, 29896, 29889, 29929, 29947, 29941, 29872, 29899, 29945, 29892, 396, 12118, 14571, 29885, 269, 29897, 13, 29897, 13, 13, 29937, 325, 326, 29901, 731, 14336, 29922, 24538, 285, 3977, 29922, 9420, 29947, 11791, 29922, 4691, 7468, 634, 2381, 29922, 29946, 18696, 29922, 29946, 3252, 29922, 29955, 29929, 29901, 13, 2 ]
pycad/py_src/transformations.py
markendr/esys-escript.github.io
0
2264
############################################################################## # # Copyright (c) 2003-2020 by The University of Queensland # http://www.uq.edu.au # # Primary Business: Queensland, Australia # Licensed under the Apache License, version 2.0 # http://www.apache.org/licenses/LICENSE-2.0 # # Development until 2012 by Earth Systems Science Computational Center (ESSCC) # Development 2012-2013 by School of Earth Sciences # Development from 2014 by Centre for Geoscience Computing (GeoComp) # Development from 2019 by School of Earth and Environmental Sciences # ############################################################################## from __future__ import print_function, division __copyright__="""Copyright (c) 2003-2020 by The University of Queensland http://www.uq.edu.au Primary Business: Queensland, Australia""" __license__="""Licensed under the Apache License, version 2.0 http://www.apache.org/licenses/LICENSE-2.0""" __url__="https://launchpad.net/escript-finley" """ transformations :var __author__: name of author :var __copyright__: copyrights :var __license__: licence agreement :var __url__: url entry point on documentation :var __version__: version :var __date__: date of the version :var DEG: unit of degree :var RAD: unit of radiant """ __author__="<NAME>, <EMAIL>" import numpy import math _TYPE=numpy.float64 DEG=math.pi/180. RAD=1. class Transformation(object): """ General class to define an affine transformation *x->Ax+b*. """ def __init__(self): """ Creates a linear transformation. """ pass def __call__(self,x=numpy.zeros((3,))): """ Applies transformation to ``x``. """ raise NotImplementeError() class Translation(Transformation): """ Defines a translation *x->x+b*. """ def __init__(self,b=numpy.zeros((3,),dtype=_TYPE)): """ Creates the linear transformation *x->x+b*. """ super(Translation, self).__init__() self.__b=numpy.array(b,_TYPE) def __call__(self,x=numpy.zeros((3,))): """ Applies translation to ``x``. """ return numpy.array(x,_TYPE)+self.__b class Rotatation(Transformation): """ Defines a rotation. """ def __init__(self,axis=numpy.ones((3,),dtype=_TYPE),point=numpy.zeros((3,),dtype=_TYPE),angle=0.*RAD): """ Creates a rotation using an axis and a point on the axis. """ self.__axis=numpy.array(axis,dtype=_TYPE) self.__point=numpy.array(point,dtype=_TYPE) lax=numpy.dot(self.__axis,self.__axis) if not lax>0: raise ValueError("points must be distinct.") self.__axis/=math.sqrt(lax) self.__angle=float(angle) def __call__(self,x=numpy.zeros((3,))): """ Applies the rotation to ``x``. """ x=numpy.array(x,_TYPE) z=x-self.__point z0=numpy.dot(z,self.__axis) z_per=z-z0*self.__axis lz_per=numpy.dot(z_per,z_per) if lz_per>0: axis1=z_per/math.sqrt(lz_per) axis2=_cross(axis1,self.__axis) lax2=numpy.dot(axis2,axis2) if lax2>0: axis2/=math.sqrt(lax2) return z0*self.__axis+math.sqrt(lz_per)*(math.cos(self.__angle)*axis1-math.sin(self.__angle)*axis2)+self.__point else: return x else: return x def _cross(x, y): """ Returns the cross product of ``x`` and ``y``. """ return numpy.array([x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]], _TYPE) class Dilation(Transformation): """ Defines a dilation. """ def __init__(self,factor=1.,center=numpy.zeros((3,),dtype=_TYPE)): """ Creates a dilation with a center and a given expansion/contraction factor. """ if not abs(factor)>0: raise ValueError("factor must be non-zero.") self.__factor=factor self.__center=numpy.array(center,dtype=_TYPE) def __call__(self,x=numpy.zeros((3,))): """ Applies dilation to ``x``. """ x=numpy.array(x,_TYPE) return self.__factor*(x-self.__center)+self.__center class Reflection(Transformation): """ Defines a reflection on a plane. """ def __init__(self,normal=numpy.ones((3,),dtype=_TYPE),offset=0.): """ Defines a reflection on a plane defined in normal form. """ self.__normal=numpy.array(normal,dtype=_TYPE) ln=math.sqrt(numpy.dot(self.__normal,self.__normal)) if not ln>0.: raise ValueError("normal must have positive length.") self.__normal/=ln if isinstance(offset,float) or isinstance(offset,int): self.__offset=offset/ln else: self.__offset=numpy.dot(numpy.array(offset,dtype=_TYPE),self.__normal) def __call__(self,x=numpy.zeros((3,))): """ Applies reflection to ``x``. """ x=numpy.array(x,_TYPE) return x - 2*(numpy.dot(x,self.__normal)-self.__offset)*self.__normal
[ 1, 29871, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29941, 29899, 29906, 29900, 29906, 29900, 491, 450, 3014, 310, 25195, 13, 29937, 1732, 597, 1636, 29889, 29884, 29939, 29889, 6085, 29889, 585, 13, 29937, 13, 29937, 28267, 15197, 29901, 25195, 29892, 8314, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 1873, 29871, 29906, 29889, 29900, 13, 29937, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 14650, 2745, 29871, 29906, 29900, 29896, 29906, 491, 11563, 23985, 9327, 11796, 1288, 7817, 313, 29923, 1799, 4174, 29897, 13, 29937, 14650, 29871, 29906, 29900, 29896, 29906, 29899, 29906, 29900, 29896, 29941, 491, 4523, 310, 11563, 17253, 13, 29937, 14650, 515, 29871, 29906, 29900, 29896, 29946, 491, 11319, 363, 1879, 359, 15277, 11796, 292, 313, 7999, 29877, 6843, 29897, 13, 29937, 14650, 515, 29871, 29906, 29900, 29896, 29929, 491, 4523, 310, 11563, 322, 16738, 284, 17253, 13, 29937, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 29892, 8542, 13, 13, 1649, 8552, 1266, 1649, 13776, 29908, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29900, 29941, 29899, 29906, 29900, 29906, 29900, 491, 450, 3014, 310, 25195, 13, 1124, 597, 1636, 29889, 29884, 29939, 29889, 6085, 29889, 585, 13, 26666, 15197, 29901, 25195, 29892, 8314, 15945, 29908, 13, 1649, 506, 1947, 1649, 13776, 29908, 29931, 293, 21144, 1090, 278, 13380, 19245, 29892, 1873, 29871, 29906, 29889, 29900, 13, 1124, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 15945, 29908, 13, 1649, 2271, 1649, 543, 991, 597, 15343, 8305, 29889, 1212, 29914, 267, 924, 29899, 4951, 2330, 29908, 13, 13, 15945, 29908, 13, 9067, 800, 13, 13, 29901, 1707, 4770, 8921, 1649, 29901, 1024, 310, 4148, 13, 29901, 1707, 4770, 8552, 1266, 1649, 29901, 3509, 1266, 29879, 13, 29901, 1707, 4770, 506, 1947, 1649, 29901, 7794, 663, 17327, 13, 29901, 1707, 4770, 2271, 1649, 29901, 3142, 6251, 1298, 373, 5106, 13, 29901, 1707, 4770, 3259, 1649, 29901, 1873, 13, 29901, 1707, 4770, 1256, 1649, 29901, 2635, 310, 278, 1873, 13, 29901, 1707, 5012, 29954, 29901, 5190, 310, 7426, 13, 29901, 1707, 390, 3035, 29901, 5190, 310, 17937, 424, 13, 15945, 29908, 13, 13, 1649, 8921, 1649, 543, 29966, 5813, 10202, 529, 26862, 6227, 11903, 13, 13, 5215, 12655, 13, 5215, 5844, 13, 13, 29918, 11116, 29922, 23749, 29889, 7411, 29953, 29946, 13, 2287, 29954, 29922, 755, 29889, 1631, 29914, 29896, 29947, 29900, 29889, 13, 29934, 3035, 29922, 29896, 29889, 13, 1990, 4103, 5404, 29898, 3318, 1125, 13, 259, 9995, 13, 259, 4593, 770, 304, 4529, 385, 2756, 457, 13852, 334, 29916, 976, 29909, 29916, 29974, 29890, 10521, 13, 259, 9995, 13, 259, 822, 4770, 2344, 12035, 1311, 1125, 13, 539, 9995, 13, 539, 6760, 1078, 263, 5608, 13852, 29889, 13, 539, 9995, 13, 539, 1209, 13, 13, 259, 822, 4770, 4804, 12035, 1311, 29892, 29916, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 876, 1125, 13, 539, 9995, 13, 539, 2401, 3687, 13852, 304, 4954, 29916, 29952, 1412, 13, 539, 9995, 13, 539, 12020, 2216, 1888, 2037, 29872, 2392, 580, 13, 13, 1990, 4103, 18411, 29898, 4300, 5404, 1125, 13, 1678, 9995, 13, 1678, 5282, 1475, 263, 13962, 334, 29916, 976, 29916, 29974, 29890, 10521, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29890, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 511, 29881, 1853, 29922, 29918, 11116, 22164, 13, 539, 9995, 13, 539, 6760, 1078, 278, 5608, 13852, 334, 29916, 976, 29916, 29974, 29890, 10521, 13, 539, 9995, 13, 539, 2428, 29898, 4300, 18411, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 539, 1583, 17255, 29890, 29922, 23749, 29889, 2378, 29898, 29890, 29892, 29918, 11116, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 29916, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 876, 1125, 13, 539, 9995, 13, 539, 2401, 3687, 13962, 304, 4954, 29916, 29952, 1412, 13, 539, 9995, 13, 539, 736, 12655, 29889, 2378, 29898, 29916, 29892, 29918, 11116, 7240, 1311, 17255, 29890, 13, 13, 1990, 9664, 271, 362, 29898, 4300, 5404, 1125, 13, 1678, 9995, 13, 1678, 5282, 1475, 263, 13733, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8990, 29922, 23749, 29889, 2873, 3552, 29941, 29892, 511, 29881, 1853, 29922, 29918, 11116, 511, 3149, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 511, 29881, 1853, 29922, 29918, 11116, 511, 2521, 29922, 29900, 5575, 29934, 3035, 1125, 13, 539, 9995, 13, 539, 6760, 1078, 263, 13733, 773, 385, 9685, 322, 263, 1298, 373, 278, 9685, 29889, 13, 539, 9995, 13, 539, 1583, 17255, 8990, 29922, 23749, 29889, 2378, 29898, 8990, 29892, 29881, 1853, 29922, 29918, 11116, 29897, 13, 539, 1583, 17255, 3149, 29922, 23749, 29889, 2378, 29898, 3149, 29892, 29881, 1853, 29922, 29918, 11116, 29897, 13, 539, 425, 29916, 29922, 23749, 29889, 6333, 29898, 1311, 17255, 8990, 29892, 1311, 17255, 8990, 29897, 13, 539, 565, 451, 425, 29916, 29958, 29900, 29901, 13, 3986, 12020, 7865, 2392, 703, 9748, 1818, 367, 8359, 23157, 13, 539, 1583, 17255, 8990, 29914, 29922, 755, 29889, 3676, 29898, 21222, 29897, 13, 539, 1583, 17255, 2521, 29922, 7411, 29898, 2521, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 29916, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 876, 1125, 13, 539, 9995, 13, 539, 2401, 3687, 278, 13733, 304, 4954, 29916, 29952, 1412, 13, 539, 9995, 13, 539, 921, 29922, 23749, 29889, 2378, 29898, 29916, 29892, 29918, 11116, 29897, 13, 539, 503, 29922, 29916, 29899, 1311, 17255, 3149, 13, 539, 503, 29900, 29922, 23749, 29889, 6333, 29898, 29920, 29892, 1311, 17255, 8990, 29897, 13, 539, 503, 29918, 546, 29922, 29920, 29899, 29920, 29900, 29930, 1311, 17255, 8990, 13, 539, 301, 29920, 29918, 546, 29922, 23749, 29889, 6333, 29898, 29920, 29918, 546, 29892, 29920, 29918, 546, 29897, 13, 539, 565, 301, 29920, 29918, 546, 29958, 29900, 29901, 13, 308, 9685, 29896, 29922, 29920, 29918, 546, 29914, 755, 29889, 3676, 29898, 29880, 29920, 29918, 546, 29897, 13, 308, 9685, 29906, 29922, 29918, 19128, 29898, 8990, 29896, 29892, 1311, 17255, 8990, 29897, 13, 308, 425, 29916, 29906, 29922, 23749, 29889, 6333, 29898, 8990, 29906, 29892, 8990, 29906, 29897, 13, 308, 565, 425, 29916, 29906, 29958, 29900, 29901, 13, 9651, 9685, 29906, 29914, 29922, 755, 29889, 3676, 29898, 21222, 29906, 29897, 13, 9651, 736, 503, 29900, 29930, 1311, 17255, 8990, 29974, 755, 29889, 3676, 29898, 29880, 29920, 29918, 546, 11877, 29898, 755, 29889, 3944, 29898, 1311, 17255, 2521, 11877, 8990, 29896, 29899, 755, 29889, 5223, 29898, 1311, 17255, 2521, 11877, 8990, 29906, 7240, 1311, 17255, 3149, 13, 308, 1683, 29901, 13, 9651, 736, 921, 13, 539, 1683, 29901, 13, 308, 736, 921, 13, 13, 1753, 903, 19128, 29898, 29916, 29892, 343, 1125, 13, 1678, 9995, 13, 1678, 16969, 278, 4891, 3234, 310, 4954, 29916, 16159, 322, 4954, 29891, 29952, 1412, 13, 1678, 9995, 13, 1678, 736, 12655, 29889, 2378, 4197, 29916, 29961, 29896, 29962, 334, 343, 29961, 29906, 29962, 448, 921, 29961, 29906, 29962, 334, 343, 29961, 29896, 1402, 921, 29961, 29906, 29962, 334, 343, 29961, 29900, 29962, 448, 921, 29961, 29900, 29962, 334, 343, 29961, 29906, 1402, 921, 29961, 29900, 29962, 334, 343, 29961, 29896, 29962, 448, 921, 29961, 29896, 29962, 334, 343, 29961, 29900, 20526, 903, 11116, 29897, 13, 13, 1990, 360, 8634, 29898, 4300, 5404, 1125, 13, 1678, 9995, 13, 1678, 5282, 1475, 263, 270, 8634, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19790, 29922, 29896, 1696, 5064, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 511, 29881, 1853, 29922, 29918, 11116, 22164, 13, 539, 9995, 13, 539, 6760, 1078, 263, 270, 8634, 411, 263, 4818, 322, 263, 2183, 13184, 29914, 1285, 13857, 13, 539, 7329, 29889, 13, 539, 9995, 13, 539, 565, 451, 6425, 29898, 19790, 15410, 29900, 29901, 13, 3986, 12020, 7865, 2392, 703, 19790, 1818, 367, 1661, 29899, 9171, 23157, 13, 539, 1583, 17255, 19790, 29922, 19790, 13, 539, 1583, 17255, 5064, 29922, 23749, 29889, 2378, 29898, 5064, 29892, 29881, 1853, 29922, 29918, 11116, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 29916, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 876, 1125, 13, 539, 9995, 13, 539, 2401, 3687, 270, 8634, 304, 4954, 29916, 29952, 1412, 13, 539, 9995, 13, 539, 921, 29922, 23749, 29889, 2378, 29898, 29916, 29892, 29918, 11116, 29897, 13, 539, 736, 1583, 17255, 19790, 16395, 29916, 29899, 1311, 17255, 5064, 7240, 1311, 17255, 5064, 13, 13, 1990, 9897, 1464, 29898, 4300, 5404, 1125, 13, 1678, 9995, 13, 1678, 5282, 1475, 263, 17842, 373, 263, 10694, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8945, 29922, 23749, 29889, 2873, 3552, 29941, 29892, 511, 29881, 1853, 29922, 29918, 11116, 511, 10289, 29922, 29900, 9575, 13, 539, 9995, 13, 539, 5282, 1475, 263, 17842, 373, 263, 10694, 3342, 297, 4226, 883, 29889, 13, 539, 9995, 13, 539, 1583, 17255, 8945, 29922, 23749, 29889, 2378, 29898, 8945, 29892, 29881, 1853, 29922, 29918, 11116, 29897, 13, 539, 301, 29876, 29922, 755, 29889, 3676, 29898, 23749, 29889, 6333, 29898, 1311, 17255, 8945, 29892, 1311, 17255, 8945, 876, 13, 539, 565, 451, 301, 29876, 29958, 29900, 4898, 13, 3986, 12020, 7865, 2392, 703, 8945, 1818, 505, 6374, 3309, 23157, 13, 539, 1583, 17255, 8945, 29914, 29922, 3083, 13, 539, 565, 338, 8758, 29898, 10289, 29892, 7411, 29897, 470, 338, 8758, 29898, 10289, 29892, 524, 1125, 13, 3986, 1583, 17255, 10289, 29922, 10289, 29914, 3083, 13, 539, 1683, 29901, 13, 3986, 1583, 17255, 10289, 29922, 23749, 29889, 6333, 29898, 23749, 29889, 2378, 29898, 10289, 29892, 29881, 1853, 29922, 29918, 11116, 511, 1311, 17255, 8945, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 29916, 29922, 23749, 29889, 3298, 359, 3552, 29941, 29892, 876, 1125, 13, 539, 9995, 13, 539, 2401, 3687, 17842, 304, 4954, 29916, 29952, 1412, 13, 539, 9995, 13, 539, 921, 29922, 23749, 29889, 2378, 29898, 29916, 29892, 29918, 11116, 29897, 13, 539, 736, 921, 448, 29871, 29906, 16395, 23749, 29889, 6333, 29898, 29916, 29892, 1311, 17255, 8945, 6817, 1311, 17255, 10289, 11877, 1311, 17255, 8945, 13, 13, 2 ]
stagecraft/apps/datasets/admin/data_type.py
alphagov-mirror/stagecraft
3
72262
<gh_stars>1-10 from __future__ import unicode_literals from django.contrib import admin from reversion.admin import VersionAdmin from stagecraft.apps.datasets.models.data_set import DataSet from stagecraft.apps.datasets.models.data_type import DataType class DataSetInline(admin.StackedInline): model = DataSet fields = ('name', 'data_group',) readonly_fields = ('name', 'data_group',) extra = 0 def has_delete_permission(self, request, obj=None): return False class DataTypeAdmin(VersionAdmin): search_fields = ['name'] list_display = ('name',) inlines = [ DataSetInline ] admin.site.register(DataType, DataTypeAdmin)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 337, 3259, 29889, 6406, 1053, 10079, 12754, 13, 13, 3166, 7408, 17293, 29889, 13371, 29889, 14538, 1691, 29889, 9794, 29889, 1272, 29918, 842, 1053, 3630, 2697, 13, 3166, 7408, 17293, 29889, 13371, 29889, 14538, 1691, 29889, 9794, 29889, 1272, 29918, 1853, 1053, 3630, 1542, 13, 13, 13, 1990, 3630, 2697, 797, 1220, 29898, 6406, 29889, 7264, 287, 797, 1220, 1125, 13, 1678, 1904, 353, 3630, 2697, 13, 1678, 4235, 353, 6702, 978, 742, 525, 1272, 29918, 2972, 742, 29897, 13, 1678, 20623, 29918, 9621, 353, 6702, 978, 742, 525, 1272, 29918, 2972, 742, 29897, 13, 1678, 4805, 353, 29871, 29900, 13, 13, 1678, 822, 756, 29918, 8143, 29918, 16074, 29898, 1311, 29892, 2009, 29892, 5446, 29922, 8516, 1125, 13, 4706, 736, 7700, 13, 13, 13, 1990, 3630, 1542, 12754, 29898, 6594, 12754, 1125, 13, 1678, 2740, 29918, 9621, 353, 6024, 978, 2033, 13, 1678, 1051, 29918, 4990, 353, 6702, 978, 742, 29897, 13, 1678, 297, 9012, 353, 518, 13, 4706, 3630, 2697, 797, 1220, 13, 1678, 4514, 13, 13, 13, 6406, 29889, 2746, 29889, 9573, 29898, 1469, 1542, 29892, 3630, 1542, 12754, 29897, 13, 2 ]
tests/test_number.py
marcodeangelis/intervals
6
104073
import unittest import logging import sys import numpy from intervals.number import Interval as I from intervals.methods import (intervalise,lo,hi) from .interval_generator import pick_endpoints_at_random_uniform class TestIntervalArithmetic(unittest.TestCase): def test_addition_by_endpoints_analysis(self): """ Test addition 100 times between random intervals. """ # log = logging.getLogger("TestLog") # log.debug("testing addition hundred times between random intervals") x = intervalise(pick_endpoints_at_random_uniform(n=100)) y = intervalise(pick_endpoints_at_random_uniform(n=100)) for xi,yi in zip(x,y): xi_op_yi = xi+yi a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)] c = [ai+bj for ai in a for bj in b] # endpoints analysis ea = [min(c), max(c)] self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7) self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7) def test_subtraction_by_endpoints_analysis(self): """ Test subtraction 100 times between random intervals. """ x = intervalise(pick_endpoints_at_random_uniform(n=100)) y = intervalise(pick_endpoints_at_random_uniform(n=100)) for xi,yi in zip(x,y): xi_op_yi = xi-yi a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)] c = [ai-bj for ai in a for bj in b] # endpoints analysis ea = [min(c), max(c)] self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7) self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7) def test_multiplication_by_endpoints_analysis(self): """ Test multiplication 100 times between random intervals. """ x = intervalise(pick_endpoints_at_random_uniform(n=100)) y = intervalise(pick_endpoints_at_random_uniform(n=100)) for xi,yi in zip(x,y): xi_op_yi = xi*yi a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)] c = [ai*bj for ai in a for bj in b] # endpoints analysis ea = [min(c), max(c)] self.assertAlmostEqual(lo(xi_op_yi), ea[0], places=7) self.assertAlmostEqual(hi(xi_op_yi), ea[1], places=7) def test_division_by_endpoints_analysis(self): """ Test division 100 times between random intervals. """ x = intervalise(pick_endpoints_at_random_uniform(n=100)) y = intervalise(pick_endpoints_at_random_uniform(n=100,left_bound=0.001)) for xi,yi in zip(x,y): xi_plus_yi = xi/yi a,b = [lo(xi),hi(xi)], [lo(yi),hi(yi)] c = [ai/bj for ai in a for bj in b] # endpoints analysis ea = [min(c), max(c)] self.assertAlmostEqual(lo(xi_plus_yi), ea[0], places=7) self.assertAlmostEqual(hi(xi_plus_yi), ea[1], places=7) def test_four_operations_between_interval_2darrays(self): """ Test element-wise operations between two dimensional arrays of intervals. """ x = intervalise(pick_endpoints_at_random_uniform(shape=(100,4))) y = intervalise(pick_endpoints_at_random_uniform(shape=(100,4),left_bound=0.001)) x_add_y = x+y x_sub_y = x-y x_mul_y = x*y x_div_y = x/y for xi,yi,z1,z2,z3,z4 in zip(x,y,x_add_y,x_sub_y,x_mul_y,x_div_y): xi_add_yi = xi+yi xi_sub_yi = xi-yi xi_mul_yi = xi*yi xi_div_yi = xi/yi self.assertAlmostEqual(lo(z1), lo(xi_add_yi), places=7) self.assertAlmostEqual(hi(z1), hi(xi_add_yi), places=7) self.assertAlmostEqual(lo(z2), lo(xi_sub_yi), places=7) self.assertAlmostEqual(hi(z2), hi(xi_sub_yi), places=7) self.assertAlmostEqual(lo(z3), lo(xi_mul_yi), places=7) self.assertAlmostEqual(hi(z3), hi(xi_mul_yi), places=7) self.assertAlmostEqual(lo(z4), lo(xi_div_yi), places=7) self.assertAlmostEqual(hi(z4), hi(xi_div_yi), places=7) def test_four_operations_between_interval_3darrays(self): """ Test element-wise operations between three dimensional arrays of intervals. """ x = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3))) y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001)) x_add_y = x+y x_sub_y = x-y x_mul_y = x*y x_div_y = x/y for xi,yi,z1,z2,z3,z4 in zip(x,y,x_add_y,x_sub_y,x_mul_y,x_div_y): xi_add_yi = xi+yi xi_sub_yi = xi-yi xi_mul_yi = xi*yi xi_div_yi = xi/yi self.assertAlmostEqual(lo(z1), lo(xi_add_yi), places=7) self.assertAlmostEqual(hi(z1), hi(xi_add_yi), places=7) self.assertAlmostEqual(lo(z2), lo(xi_sub_yi), places=7) self.assertAlmostEqual(hi(z2), hi(xi_sub_yi), places=7) self.assertAlmostEqual(lo(z3), lo(xi_mul_yi), places=7) self.assertAlmostEqual(hi(z3), hi(xi_mul_yi), places=7) self.assertAlmostEqual(lo(z4), lo(xi_div_yi), places=7) self.assertAlmostEqual(hi(z4), hi(xi_div_yi), places=7) def test_four_operations_between_scalar_and_arrays(self): """ Test element-wise operations between array-like and scalar intervals. """ a = intervalise(pick_endpoints_at_random_uniform(n=1,left_bound=-1,right_bound=1)) y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001)) a_add_y = a+y a_sub_y = a-y a_mul_y = a*y a_div_y = a/y for yi,z1,z2,z3,z4 in zip(y,a_add_y,a_sub_y,a_mul_y,a_div_y): ai_add_yi = a+yi ai_sub_yi = a-yi ai_mul_yi = a*yi ai_div_yi = a/yi self.assertAlmostEqual(lo(z1), lo(ai_add_yi), places=7) self.assertAlmostEqual(hi(z1), hi(ai_add_yi), places=7) self.assertAlmostEqual(lo(z2), lo(ai_sub_yi), places=7) self.assertAlmostEqual(hi(z2), hi(ai_sub_yi), places=7) self.assertAlmostEqual(lo(z3), lo(ai_mul_yi), places=7) self.assertAlmostEqual(hi(z3), hi(ai_mul_yi), places=7) self.assertAlmostEqual(lo(z4), lo(ai_div_yi), places=7) self.assertAlmostEqual(hi(z4), hi(ai_div_yi), places=7) def test_four_operations_between_arrays_and_scalars(self): """ Test element-wise operations between array-like and scalar intervals. """ a = intervalise(pick_endpoints_at_random_uniform(n=1,left_bound=0.001,right_bound=1)) y = intervalise(pick_endpoints_at_random_uniform(shape=(10,3,3),left_bound=0.001)) y_add_a = y+a y_sub_a = y-a y_mul_a = y*a y_div_a = y/a for yi,z1,z2,z3,z4 in zip(y,y_add_a,y_sub_a,y_mul_a,y_div_a): yi_add_ai = yi+a yi_sub_ai = yi-a yi_mul_ai = yi*a yi_div_ai = yi/a self.assertAlmostEqual(lo(z1), lo(yi_add_ai), places=7) self.assertAlmostEqual(hi(z1), hi(yi_add_ai), places=7) self.assertAlmostEqual(lo(z2), lo(yi_sub_ai), places=7) self.assertAlmostEqual(hi(z2), hi(yi_sub_ai), places=7) self.assertAlmostEqual(lo(z3), lo(yi_mul_ai), places=7) self.assertAlmostEqual(hi(z3), hi(yi_mul_ai), places=7) self.assertAlmostEqual(lo(z4), lo(yi_div_ai), places=7) self.assertAlmostEqual(hi(z4), hi(yi_div_ai), places=7) def test_four_operations_between_interval_and_numeric(self): """ Test element-wise operations between array-like and non-interval numbers. """ a = -10 + numpy.random.rand() * 20 # a random number between -10 and 10 y = intervalise(pick_endpoints_at_random_uniform(n=100,left_bound=0.001)) for yi in y: yi_add_a = yi+a yi_sub_a = yi-a yi_mul_a = yi*a yi_div_a = yi/a yy = [lo(yi),hi(yi)] c_add = [bj+a for bj in yy] # endpoints analysis c_sub = [bj-a for bj in yy] # endpoints analysis c_mul = [bj*a for bj in yy] # endpoints analysis c_div = [bj/a for bj in yy] # endpoints analysis ea_add = [min(c_add), max(c_add)] ea_sub = [min(c_sub), max(c_sub)] ea_mul = [min(c_mul), max(c_mul)] ea_div = [min(c_div), max(c_div)] self.assertAlmostEqual(lo(yi_add_a), ea_add[0], places=7) self.assertAlmostEqual(hi(yi_add_a), ea_add[1], places=7) self.assertAlmostEqual(lo(yi_sub_a), ea_sub[0], places=7) self.assertAlmostEqual(hi(yi_sub_a), ea_sub[1], places=7) self.assertAlmostEqual(lo(yi_mul_a), ea_mul[0], places=7) self.assertAlmostEqual(hi(yi_mul_a), ea_mul[1], places=7) self.assertAlmostEqual(lo(yi_div_a), ea_div[0], places=7) self.assertAlmostEqual(hi(yi_div_a), ea_div[1], places=7) def test_four_operations_between_arrays_and_numeric(self): """ Test element-wise operations between array-like and non-interval numbers. """ a = -10 + numpy.random.rand() * 20 y = intervalise(pick_endpoints_at_random_uniform(shape=(7,4,3),left_bound=0.001)) y_add_a = y+a y_sub_a = y-a y_mul_a = y*a y_div_a = y/a for yi,z1,z2,z3,z4 in zip(y,y_add_a,y_sub_a,y_mul_a,y_div_a): yi_add_ai = yi+a yi_sub_ai = yi-a yi_mul_ai = yi*a yi_div_ai = yi/a self.assertAlmostEqual(lo(z1), lo(yi_add_ai), places=7) self.assertAlmostEqual(hi(z1), hi(yi_add_ai), places=7) self.assertAlmostEqual(lo(z2), lo(yi_sub_ai), places=7) self.assertAlmostEqual(hi(z2), hi(yi_sub_ai), places=7) self.assertAlmostEqual(lo(z3), lo(yi_mul_ai), places=7) self.assertAlmostEqual(hi(z3), hi(yi_mul_ai), places=7) self.assertAlmostEqual(lo(z4), lo(yi_div_ai), places=7) self.assertAlmostEqual(hi(z4), hi(yi_div_ai), places=7) def parsing_degenerate_intervals(self): a = numpy.random.rand() x = I(a) self.assertEqual(lo(x), a) self.assertEqual(hi(x), a) if __name__ == '__main__': # logging.basicConfig(stream=sys.stderr,level=logging.DEBUG) # unittest.TextTestRunner().run(TestIntervalArithmetic()) # logging.basicConfig( stream=sys.stderr ) # logging.getLogger( "SomeTest.testSomething" ).setLevel( logging.DEBUG ) unittest.main()
[ 1, 1053, 443, 27958, 13, 13, 5215, 12183, 13, 5215, 10876, 13, 13, 5215, 12655, 13, 13, 3166, 18747, 29889, 4537, 1053, 4124, 791, 408, 306, 13, 3166, 18747, 29889, 23515, 1053, 313, 19207, 895, 29892, 417, 29892, 2918, 29897, 13, 3166, 869, 19207, 29918, 27959, 1053, 5839, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 13, 13, 1990, 4321, 12506, 1433, 18542, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 1202, 654, 29918, 1609, 29918, 355, 9748, 29918, 15916, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 6124, 29871, 29896, 29900, 29900, 3064, 1546, 4036, 18747, 29889, 13, 4706, 9995, 13, 4706, 396, 1480, 353, 12183, 29889, 657, 16363, 703, 3057, 3403, 1159, 13, 4706, 396, 1480, 29889, 8382, 703, 13424, 6124, 6893, 3064, 1546, 4036, 18747, 1159, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 363, 921, 29875, 29892, 25675, 297, 14319, 29898, 29916, 29892, 29891, 1125, 13, 9651, 921, 29875, 29918, 459, 29918, 25675, 353, 921, 29875, 29974, 25675, 13, 9651, 263, 29892, 29890, 353, 518, 417, 29898, 5389, 511, 2918, 29898, 5389, 29897, 1402, 518, 417, 29898, 25675, 511, 2918, 29898, 25675, 4638, 29871, 13, 9651, 274, 353, 518, 1794, 29974, 29890, 29926, 363, 7468, 297, 263, 363, 289, 29926, 297, 289, 29962, 396, 1095, 9748, 7418, 13, 9651, 321, 29874, 353, 518, 1195, 29898, 29883, 511, 4236, 29898, 29883, 4638, 29871, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 1491, 3018, 428, 29918, 1609, 29918, 355, 9748, 29918, 15916, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1014, 3018, 428, 29871, 29896, 29900, 29900, 3064, 1546, 4036, 18747, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 363, 921, 29875, 29892, 25675, 297, 14319, 29898, 29916, 29892, 29891, 1125, 13, 9651, 921, 29875, 29918, 459, 29918, 25675, 353, 921, 29875, 29899, 25675, 13, 9651, 263, 29892, 29890, 353, 518, 417, 29898, 5389, 511, 2918, 29898, 5389, 29897, 1402, 518, 417, 29898, 25675, 511, 2918, 29898, 25675, 4638, 29871, 13, 9651, 274, 353, 518, 1794, 29899, 29890, 29926, 363, 7468, 297, 263, 363, 289, 29926, 297, 289, 29962, 396, 1095, 9748, 7418, 13, 9651, 321, 29874, 353, 518, 1195, 29898, 29883, 511, 4236, 29898, 29883, 4638, 29871, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 18056, 1414, 29918, 1609, 29918, 355, 9748, 29918, 15916, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 21666, 29871, 29896, 29900, 29900, 3064, 1546, 4036, 18747, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 363, 921, 29875, 29892, 25675, 297, 14319, 29898, 29916, 29892, 29891, 1125, 13, 9651, 921, 29875, 29918, 459, 29918, 25675, 353, 921, 29875, 29930, 25675, 13, 9651, 263, 29892, 29890, 353, 518, 417, 29898, 5389, 511, 2918, 29898, 5389, 29897, 1402, 518, 417, 29898, 25675, 511, 2918, 29898, 25675, 4638, 29871, 13, 9651, 274, 353, 518, 1794, 29930, 29890, 29926, 363, 7468, 297, 263, 363, 289, 29926, 297, 289, 29962, 396, 1095, 9748, 7418, 13, 9651, 321, 29874, 353, 518, 1195, 29898, 29883, 511, 4236, 29898, 29883, 4638, 29871, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 5389, 29918, 459, 29918, 25675, 511, 321, 29874, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 4563, 2459, 29918, 1609, 29918, 355, 9748, 29918, 15916, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 8542, 29871, 29896, 29900, 29900, 3064, 1546, 4036, 18747, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 29892, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 363, 921, 29875, 29892, 25675, 297, 14319, 29898, 29916, 29892, 29891, 1125, 13, 9651, 921, 29875, 29918, 11242, 29918, 25675, 353, 921, 29875, 29914, 25675, 13, 9651, 263, 29892, 29890, 353, 518, 417, 29898, 5389, 511, 2918, 29898, 5389, 29897, 1402, 518, 417, 29898, 25675, 511, 2918, 29898, 25675, 4638, 29871, 13, 9651, 274, 353, 518, 1794, 29914, 29890, 29926, 363, 7468, 297, 263, 363, 289, 29926, 297, 289, 29962, 396, 1095, 9748, 7418, 13, 9651, 321, 29874, 353, 518, 1195, 29898, 29883, 511, 4236, 29898, 29883, 4638, 29871, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 5389, 29918, 11242, 29918, 25675, 511, 321, 29874, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 5389, 29918, 11242, 29918, 25675, 511, 321, 29874, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 19207, 29918, 29906, 29881, 2378, 29879, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 1023, 22112, 7049, 310, 18747, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29900, 29892, 29946, 4961, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29900, 29892, 29946, 511, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 921, 29918, 1202, 29918, 29891, 353, 921, 29974, 29891, 13, 4706, 921, 29918, 1491, 29918, 29891, 353, 921, 29899, 29891, 13, 4706, 921, 29918, 16109, 29918, 29891, 353, 921, 29930, 29891, 13, 4706, 921, 29918, 4563, 29918, 29891, 353, 921, 29914, 29891, 13, 4706, 363, 921, 29875, 29892, 25675, 29892, 29920, 29896, 29892, 29920, 29906, 29892, 29920, 29941, 29892, 29920, 29946, 297, 14319, 29898, 29916, 29892, 29891, 29892, 29916, 29918, 1202, 29918, 29891, 29892, 29916, 29918, 1491, 29918, 29891, 29892, 29916, 29918, 16109, 29918, 29891, 29892, 29916, 29918, 4563, 29918, 29891, 1125, 13, 9651, 921, 29875, 29918, 1202, 29918, 25675, 353, 921, 29875, 29974, 25675, 13, 9651, 921, 29875, 29918, 1491, 29918, 25675, 353, 921, 29875, 29899, 25675, 13, 9651, 921, 29875, 29918, 16109, 29918, 25675, 353, 921, 29875, 29930, 25675, 13, 9651, 921, 29875, 29918, 4563, 29918, 25675, 353, 921, 29875, 29914, 25675, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29896, 511, 658, 29898, 5389, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29896, 511, 7251, 29898, 5389, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29906, 511, 658, 29898, 5389, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29906, 511, 7251, 29898, 5389, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29941, 511, 658, 29898, 5389, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29941, 511, 7251, 29898, 5389, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29946, 511, 658, 29898, 5389, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29946, 511, 7251, 29898, 5389, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 19207, 29918, 29941, 29881, 2378, 29879, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 2211, 22112, 7049, 310, 18747, 29889, 13, 4706, 9995, 13, 4706, 921, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29892, 29941, 29892, 29941, 4961, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29892, 29941, 29892, 29941, 511, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 921, 29918, 1202, 29918, 29891, 353, 921, 29974, 29891, 13, 4706, 921, 29918, 1491, 29918, 29891, 353, 921, 29899, 29891, 13, 4706, 921, 29918, 16109, 29918, 29891, 353, 921, 29930, 29891, 13, 4706, 921, 29918, 4563, 29918, 29891, 353, 921, 29914, 29891, 13, 4706, 363, 921, 29875, 29892, 25675, 29892, 29920, 29896, 29892, 29920, 29906, 29892, 29920, 29941, 29892, 29920, 29946, 297, 14319, 29898, 29916, 29892, 29891, 29892, 29916, 29918, 1202, 29918, 29891, 29892, 29916, 29918, 1491, 29918, 29891, 29892, 29916, 29918, 16109, 29918, 29891, 29892, 29916, 29918, 4563, 29918, 29891, 1125, 13, 9651, 921, 29875, 29918, 1202, 29918, 25675, 353, 921, 29875, 29974, 25675, 13, 9651, 921, 29875, 29918, 1491, 29918, 25675, 353, 921, 29875, 29899, 25675, 13, 9651, 921, 29875, 29918, 16109, 29918, 25675, 353, 921, 29875, 29930, 25675, 13, 9651, 921, 29875, 29918, 4563, 29918, 25675, 353, 921, 29875, 29914, 25675, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29896, 511, 658, 29898, 5389, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29896, 511, 7251, 29898, 5389, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29906, 511, 658, 29898, 5389, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29906, 511, 7251, 29898, 5389, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29941, 511, 658, 29898, 5389, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29941, 511, 7251, 29898, 5389, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29946, 511, 658, 29898, 5389, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29946, 511, 7251, 29898, 5389, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 19529, 279, 29918, 392, 29918, 2378, 29879, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 1409, 29899, 4561, 322, 17336, 18747, 29889, 13, 4706, 9995, 13, 4706, 263, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29892, 1563, 29918, 9917, 10457, 29896, 29892, 1266, 29918, 9917, 29922, 29896, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29892, 29941, 29892, 29941, 511, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 263, 29918, 1202, 29918, 29891, 353, 263, 29974, 29891, 13, 4706, 263, 29918, 1491, 29918, 29891, 353, 263, 29899, 29891, 13, 4706, 263, 29918, 16109, 29918, 29891, 353, 263, 29930, 29891, 13, 4706, 263, 29918, 4563, 29918, 29891, 353, 263, 29914, 29891, 13, 4706, 363, 343, 29875, 29892, 29920, 29896, 29892, 29920, 29906, 29892, 29920, 29941, 29892, 29920, 29946, 297, 14319, 29898, 29891, 29892, 29874, 29918, 1202, 29918, 29891, 29892, 29874, 29918, 1491, 29918, 29891, 29892, 29874, 29918, 16109, 29918, 29891, 29892, 29874, 29918, 4563, 29918, 29891, 1125, 13, 9651, 7468, 29918, 1202, 29918, 25675, 353, 263, 29974, 25675, 13, 9651, 7468, 29918, 1491, 29918, 25675, 353, 263, 29899, 25675, 13, 9651, 7468, 29918, 16109, 29918, 25675, 353, 263, 29930, 25675, 13, 9651, 7468, 29918, 4563, 29918, 25675, 353, 263, 29914, 25675, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29896, 511, 658, 29898, 1794, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29896, 511, 7251, 29898, 1794, 29918, 1202, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29906, 511, 658, 29898, 1794, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29906, 511, 7251, 29898, 1794, 29918, 1491, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29941, 511, 658, 29898, 1794, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29941, 511, 7251, 29898, 1794, 29918, 16109, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29946, 511, 658, 29898, 1794, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29946, 511, 7251, 29898, 1794, 29918, 4563, 29918, 25675, 511, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 2378, 29879, 29918, 392, 29918, 19529, 1503, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 1409, 29899, 4561, 322, 17336, 18747, 29889, 13, 4706, 9995, 13, 4706, 263, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29892, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 29892, 1266, 29918, 9917, 29922, 29896, 876, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29896, 29900, 29892, 29941, 29892, 29941, 511, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 343, 29918, 1202, 29918, 29874, 353, 343, 29974, 29874, 13, 4706, 343, 29918, 1491, 29918, 29874, 353, 343, 29899, 29874, 13, 4706, 343, 29918, 16109, 29918, 29874, 353, 343, 29930, 29874, 13, 4706, 343, 29918, 4563, 29918, 29874, 353, 343, 29914, 29874, 13, 4706, 363, 343, 29875, 29892, 29920, 29896, 29892, 29920, 29906, 29892, 29920, 29941, 29892, 29920, 29946, 297, 14319, 29898, 29891, 29892, 29891, 29918, 1202, 29918, 29874, 29892, 29891, 29918, 1491, 29918, 29874, 29892, 29891, 29918, 16109, 29918, 29874, 29892, 29891, 29918, 4563, 29918, 29874, 1125, 13, 9651, 343, 29875, 29918, 1202, 29918, 1794, 353, 343, 29875, 29974, 29874, 13, 9651, 343, 29875, 29918, 1491, 29918, 1794, 353, 343, 29875, 29899, 29874, 13, 9651, 343, 29875, 29918, 16109, 29918, 1794, 353, 343, 29875, 29930, 29874, 13, 9651, 343, 29875, 29918, 4563, 29918, 1794, 353, 343, 29875, 29914, 29874, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29896, 511, 658, 29898, 25675, 29918, 1202, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29896, 511, 7251, 29898, 25675, 29918, 1202, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29906, 511, 658, 29898, 25675, 29918, 1491, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29906, 511, 7251, 29898, 25675, 29918, 1491, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29941, 511, 658, 29898, 25675, 29918, 16109, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29941, 511, 7251, 29898, 25675, 29918, 16109, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29946, 511, 658, 29898, 25675, 29918, 4563, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29946, 511, 7251, 29898, 25675, 29918, 4563, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 19207, 29918, 392, 29918, 21574, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 1409, 29899, 4561, 322, 1661, 29899, 19207, 3694, 29889, 13, 4706, 9995, 13, 4706, 263, 353, 448, 29896, 29900, 718, 12655, 29889, 8172, 29889, 9502, 580, 334, 29871, 29906, 29900, 396, 263, 4036, 1353, 1546, 448, 29896, 29900, 322, 29871, 29896, 29900, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 29876, 29922, 29896, 29900, 29900, 29892, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 363, 343, 29875, 297, 343, 29901, 13, 9651, 343, 29875, 29918, 1202, 29918, 29874, 353, 343, 29875, 29974, 29874, 13, 9651, 343, 29875, 29918, 1491, 29918, 29874, 353, 343, 29875, 29899, 29874, 13, 9651, 343, 29875, 29918, 16109, 29918, 29874, 353, 343, 29875, 29930, 29874, 13, 9651, 343, 29875, 29918, 4563, 29918, 29874, 353, 343, 29875, 29914, 29874, 13, 9651, 343, 29891, 353, 518, 417, 29898, 25675, 511, 2918, 29898, 25675, 4638, 13, 9651, 274, 29918, 1202, 353, 518, 29890, 29926, 29974, 29874, 363, 289, 29926, 297, 343, 29891, 29962, 396, 1095, 9748, 7418, 13, 9651, 274, 29918, 1491, 353, 518, 29890, 29926, 29899, 29874, 363, 289, 29926, 297, 343, 29891, 29962, 396, 1095, 9748, 7418, 13, 9651, 274, 29918, 16109, 353, 518, 29890, 29926, 29930, 29874, 363, 289, 29926, 297, 343, 29891, 29962, 396, 1095, 9748, 7418, 13, 9651, 274, 29918, 4563, 353, 518, 29890, 29926, 29914, 29874, 363, 289, 29926, 297, 343, 29891, 29962, 396, 1095, 9748, 7418, 13, 9651, 321, 29874, 29918, 1202, 353, 518, 1195, 29898, 29883, 29918, 1202, 511, 4236, 29898, 29883, 29918, 1202, 4638, 29871, 13, 9651, 321, 29874, 29918, 1491, 353, 518, 1195, 29898, 29883, 29918, 1491, 511, 4236, 29898, 29883, 29918, 1491, 4638, 29871, 13, 9651, 321, 29874, 29918, 16109, 353, 518, 1195, 29898, 29883, 29918, 16109, 511, 4236, 29898, 29883, 29918, 16109, 4638, 29871, 13, 9651, 321, 29874, 29918, 4563, 353, 518, 1195, 29898, 29883, 29918, 4563, 511, 4236, 29898, 29883, 29918, 4563, 4638, 29871, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 25675, 29918, 1202, 29918, 29874, 511, 321, 29874, 29918, 1202, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 25675, 29918, 1202, 29918, 29874, 511, 321, 29874, 29918, 1202, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 25675, 29918, 1491, 29918, 29874, 511, 321, 29874, 29918, 1491, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 25675, 29918, 1491, 29918, 29874, 511, 321, 29874, 29918, 1491, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 25675, 29918, 16109, 29918, 29874, 511, 321, 29874, 29918, 16109, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 25675, 29918, 16109, 29918, 29874, 511, 321, 29874, 29918, 16109, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 25675, 29918, 4563, 29918, 29874, 511, 321, 29874, 29918, 4563, 29961, 29900, 1402, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 25675, 29918, 4563, 29918, 29874, 511, 321, 29874, 29918, 4563, 29961, 29896, 1402, 7600, 29922, 29955, 29897, 13, 1678, 822, 1243, 29918, 17823, 29918, 3372, 800, 29918, 14811, 29918, 2378, 29879, 29918, 392, 29918, 21574, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 1543, 29899, 3538, 6931, 1546, 1409, 29899, 4561, 322, 1661, 29899, 19207, 3694, 29889, 13, 4706, 9995, 13, 4706, 263, 353, 448, 29896, 29900, 718, 12655, 29889, 8172, 29889, 9502, 580, 334, 29871, 29906, 29900, 13, 4706, 343, 353, 7292, 895, 29898, 23945, 29918, 355, 9748, 29918, 271, 29918, 8172, 29918, 29590, 29898, 12181, 7607, 29955, 29892, 29946, 29892, 29941, 511, 1563, 29918, 9917, 29922, 29900, 29889, 29900, 29900, 29896, 876, 13, 4706, 343, 29918, 1202, 29918, 29874, 353, 343, 29974, 29874, 13, 4706, 343, 29918, 1491, 29918, 29874, 353, 343, 29899, 29874, 13, 4706, 343, 29918, 16109, 29918, 29874, 353, 343, 29930, 29874, 13, 4706, 343, 29918, 4563, 29918, 29874, 353, 343, 29914, 29874, 13, 4706, 363, 343, 29875, 29892, 29920, 29896, 29892, 29920, 29906, 29892, 29920, 29941, 29892, 29920, 29946, 297, 14319, 29898, 29891, 29892, 29891, 29918, 1202, 29918, 29874, 29892, 29891, 29918, 1491, 29918, 29874, 29892, 29891, 29918, 16109, 29918, 29874, 29892, 29891, 29918, 4563, 29918, 29874, 1125, 13, 9651, 343, 29875, 29918, 1202, 29918, 1794, 353, 343, 29875, 29974, 29874, 13, 9651, 343, 29875, 29918, 1491, 29918, 1794, 353, 343, 29875, 29899, 29874, 13, 9651, 343, 29875, 29918, 16109, 29918, 1794, 353, 343, 29875, 29930, 29874, 13, 9651, 343, 29875, 29918, 4563, 29918, 1794, 353, 343, 29875, 29914, 29874, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29896, 511, 658, 29898, 25675, 29918, 1202, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29896, 511, 7251, 29898, 25675, 29918, 1202, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29906, 511, 658, 29898, 25675, 29918, 1491, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29906, 511, 7251, 29898, 25675, 29918, 1491, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29941, 511, 658, 29898, 25675, 29918, 16109, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29941, 511, 7251, 29898, 25675, 29918, 16109, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 417, 29898, 29920, 29946, 511, 658, 29898, 25675, 29918, 4563, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 9651, 1583, 29889, 9294, 2499, 3242, 9843, 29898, 2918, 29898, 29920, 29946, 511, 7251, 29898, 25675, 29918, 4563, 29918, 1794, 511, 7600, 29922, 29955, 29897, 13, 1678, 822, 13755, 29918, 311, 17158, 29918, 19207, 29879, 29898, 1311, 1125, 13, 4706, 263, 353, 12655, 29889, 8172, 29889, 9502, 580, 13, 4706, 921, 353, 306, 29898, 29874, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 417, 29898, 29916, 511, 263, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2918, 29898, 29916, 511, 263, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 12183, 29889, 16121, 3991, 29898, 5461, 29922, 9675, 29889, 303, 20405, 29892, 5563, 29922, 21027, 29889, 18525, 29897, 13, 1678, 396, 443, 27958, 29889, 1626, 3057, 16802, 2141, 3389, 29898, 3057, 12506, 1433, 18542, 3101, 13, 1678, 396, 12183, 29889, 16121, 3991, 29898, 4840, 29922, 9675, 29889, 303, 20405, 1723, 13, 1678, 396, 12183, 29889, 657, 16363, 29898, 376, 9526, 3057, 29889, 1688, 16804, 29908, 13742, 842, 10108, 29898, 12183, 29889, 18525, 1723, 13, 1678, 443, 27958, 29889, 3396, 580, 2 ]
foxylib/tools/auth/auth0/application/machine_to_machine/foxylib_auth0app_m2m.py
foxytrixy-com/foxylib
0
1612925
import logging import os from dataclasses import dataclass, asdict from functools import reduce, lru_cache from typing import Optional from urllib.parse import urlencode import requests from dacite import from_dict from nose.tools import assert_is_not_none, assert_equal from foxylib.singleton.env.foxylib_env import FoxylibEnv from foxylib.tools.auth.auth0.application.machine_to_machine.auth0_m2m_tool import \ Auth0M2MTool from foxylib.tools.auth.auth0.auth0_tool import Auth0AppInfo from foxylib.tools.auth.auth0.foxylib_auth0_api import FoxylibAuth0API from foxylib.tools.collections.collections_tool import DictTool, \ vwrite_overwrite from foxylib.tools.dataclass.dataclass_tool import DataclassTool from foxylib.tools.locale.locale_tool import LocaleTool from foxylib.tools.log.foxylib_logger import FoxylibLogger from foxylib.tools.network.requests.requests_tool import RequestsTool from foxylib.tools.url.url_tool import URLTool FILE_PATH = os.path.realpath(__file__) FILE_DIR = os.path.dirname(FILE_PATH) REPO_DIR = reduce(lambda x, f: f(x), [os.path.dirname] * 4, FILE_DIR) class FoxylibAuth0appM2M: @classmethod def domain(cls): return FoxylibEnv.key2value("AUTH0_DOMAIN") @classmethod def client_id(cls): return FoxylibEnv.key2value("AUTH0_M2M_CLIENT_ID") @classmethod def client_secret(cls): return FoxylibEnv.key2value("AUTH0_M2M_CLIENT_SECRET") @classmethod @lru_cache(maxsize=1) def app_info(cls) -> Auth0AppInfo: j_info = { 'api_info':FoxylibAuth0API.api_info(), 'client_id':cls.client_id(), 'client_secret':cls.client_secret(), } app_info = from_dict(Auth0AppInfo, j_info) return app_info @classmethod def users(cls): logger = FoxylibLogger.func_level2logger(cls.users, logging.DEBUG) url = f'{cls.domain()}/api/v2/users' token = cls.app_info().token() logger.debug({'token':token}) headers = RequestsTool.token2header_bearer(token) response = requests.get(url, headers=headers,) j_response = response.json() return j_response @dataclass(frozen=True) class TicketOption: ticket_type: Optional[str] = None locale: Optional[str] = None website_name: Optional[str] = None result_url: Optional[str] = None class TicketType: INVITATION = 'invitation' PASSWORD_CHANGE = 'password_change' class Locale: KO = 'ko' EN = 'en' @classmethod def option2str_invitation(cls, option_in): def option2norm(option_): if not option_: return {} if not option_.locale: return option_ lang = LocaleTool.locale2lang(option_.locale) option_out = DataclassTool.merge([ option_in, cls(locale=lang), ], lambda dataobj: DictTool.nullvalues2excluded(asdict(dataobj)), vwrite=DictTool.VWrite.overwrite) return option_out j_norm = DictTool.keys2excluded( asdict(option2norm(option_in)), [DataclassTool.fieldname2checked(cls, 'result_url')], ) return urlencode(DictTool.nullvalues2excluded(j_norm)) @classmethod def ticket2invitation(cls, ticket, option=None): assert_is_not_none(ticket) if option and option.ticket_type: assert_equal(option.ticket_type, cls.TicketType.INVITATION) option_out = DataclassTool.merge([ option if option else None, cls(ticket_type=cls.TicketType.INVITATION), ], lambda dataobj: DictTool.nullvalues2excluded(asdict(dataobj)), vwrite=DictTool.VWrite.overwrite, ) invitation = ticket + cls.option2str_invitation(option_out) return invitation @classmethod def user_id2url_invitation(cls, app_info, user_id, option: "TicketOption" = None): logger = FoxylibLogger.func_level2logger( cls.user_id2url_invitation, logging.DEBUG) ticket_pw_change = Auth0M2MTool.user_id2ticket_password_change( app_info, user_id, result_url=option.result_url) ticket_invitation = TicketOption.ticket2invitation( ticket_pw_change, option=option) logger.debug({'ticket_invitation':ticket_invitation}) return ticket_invitation
[ 1, 1053, 12183, 13, 5215, 2897, 13, 3166, 848, 13203, 1053, 848, 1990, 29892, 408, 8977, 13, 3166, 2090, 312, 8789, 1053, 10032, 29892, 301, 582, 29918, 8173, 13, 3166, 19229, 1053, 28379, 13, 3166, 3142, 1982, 29889, 5510, 1053, 3142, 12508, 13, 13, 5215, 7274, 13, 3166, 270, 562, 568, 1053, 515, 29918, 8977, 13, 3166, 26414, 29889, 8504, 1053, 4974, 29918, 275, 29918, 1333, 29918, 9290, 29892, 4974, 29918, 11745, 13, 13, 3166, 1701, 3594, 1982, 29889, 2976, 11285, 29889, 6272, 29889, 1181, 3594, 1982, 29918, 6272, 1053, 14802, 29891, 1982, 21745, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 5150, 29889, 5150, 29900, 29889, 6214, 29889, 23523, 29918, 517, 29918, 23523, 29889, 5150, 29900, 29918, 29885, 29906, 29885, 29918, 10154, 1053, 320, 13, 1678, 13189, 29900, 29924, 29906, 11490, 1507, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 5150, 29889, 5150, 29900, 29889, 5150, 29900, 29918, 10154, 1053, 13189, 29900, 2052, 3401, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 5150, 29889, 5150, 29900, 29889, 1181, 3594, 1982, 29918, 5150, 29900, 29918, 2754, 1053, 14802, 29891, 1982, 6444, 29900, 8787, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 29027, 29889, 29027, 29918, 10154, 1053, 360, 919, 12229, 29892, 320, 13, 1678, 325, 3539, 29918, 957, 3539, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 1272, 1990, 29889, 1272, 1990, 29918, 10154, 1053, 3630, 1990, 12229, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 23337, 29889, 23337, 29918, 10154, 1053, 5976, 744, 12229, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 1188, 29889, 1181, 3594, 1982, 29918, 21707, 1053, 14802, 29891, 1982, 16363, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 11618, 29889, 24830, 29889, 24830, 29918, 10154, 1053, 10729, 29879, 12229, 13, 3166, 1701, 3594, 1982, 29889, 8504, 29889, 2271, 29889, 2271, 29918, 10154, 1053, 3988, 12229, 13, 13, 7724, 29918, 10145, 353, 2897, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 29897, 13, 7724, 29918, 9464, 353, 2897, 29889, 2084, 29889, 25721, 29898, 7724, 29918, 10145, 29897, 13, 1525, 13152, 29918, 9464, 353, 10032, 29898, 2892, 921, 29892, 285, 29901, 285, 29898, 29916, 511, 518, 359, 29889, 2084, 29889, 25721, 29962, 334, 29871, 29946, 29892, 24080, 29918, 9464, 29897, 13, 13, 13, 1990, 14802, 29891, 1982, 6444, 29900, 932, 29924, 29906, 29924, 29901, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 5354, 29898, 25932, 1125, 13, 4706, 736, 14802, 29891, 1982, 21745, 29889, 1989, 29906, 1767, 703, 20656, 29950, 29900, 29918, 3970, 29032, 1159, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 3132, 29918, 333, 29898, 25932, 1125, 13, 4706, 736, 14802, 29891, 1982, 21745, 29889, 1989, 29906, 1767, 703, 20656, 29950, 29900, 29918, 29924, 29906, 29924, 29918, 27205, 3919, 29918, 1367, 1159, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 3132, 29918, 19024, 29898, 25932, 1125, 13, 4706, 736, 14802, 29891, 1982, 21745, 29889, 1989, 29906, 1767, 703, 20656, 29950, 29900, 29918, 29924, 29906, 29924, 29918, 27205, 3919, 29918, 1660, 22245, 29911, 1159, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 732, 29880, 582, 29918, 8173, 29898, 3317, 2311, 29922, 29896, 29897, 13, 1678, 822, 623, 29918, 3888, 29898, 25932, 29897, 1599, 13189, 29900, 2052, 3401, 29901, 13, 4706, 432, 29918, 3888, 353, 426, 13, 9651, 525, 2754, 29918, 3888, 2396, 29943, 2251, 29891, 1982, 6444, 29900, 8787, 29889, 2754, 29918, 3888, 3285, 13, 9651, 525, 4645, 29918, 333, 2396, 25932, 29889, 4645, 29918, 333, 3285, 13, 9651, 525, 4645, 29918, 19024, 2396, 25932, 29889, 4645, 29918, 19024, 3285, 13, 4706, 500, 13, 4706, 623, 29918, 3888, 353, 515, 29918, 8977, 29898, 6444, 29900, 2052, 3401, 29892, 432, 29918, 3888, 29897, 13, 4706, 736, 623, 29918, 3888, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 4160, 29898, 25932, 1125, 13, 4706, 17927, 353, 14802, 29891, 1982, 16363, 29889, 9891, 29918, 5563, 29906, 21707, 29898, 25932, 29889, 7193, 29892, 12183, 29889, 18525, 29897, 13, 13, 4706, 3142, 353, 285, 29915, 29912, 25932, 29889, 7247, 580, 6822, 2754, 29914, 29894, 29906, 29914, 7193, 29915, 13, 4706, 5993, 353, 29871, 1067, 29879, 29889, 932, 29918, 3888, 2141, 6979, 580, 13, 4706, 17927, 29889, 8382, 3319, 29915, 6979, 2396, 6979, 1800, 13, 13, 4706, 9066, 353, 10729, 29879, 12229, 29889, 6979, 29906, 6672, 29918, 29890, 799, 261, 29898, 6979, 29897, 13, 4706, 2933, 353, 7274, 29889, 657, 29898, 2271, 29892, 9066, 29922, 13662, 29892, 29897, 13, 13, 4706, 432, 29918, 5327, 353, 2933, 29889, 3126, 580, 13, 13, 4706, 736, 432, 29918, 5327, 13, 13, 13, 29992, 1272, 1990, 29898, 29888, 307, 2256, 29922, 5574, 29897, 13, 1990, 323, 8522, 8375, 29901, 13, 1678, 23381, 29918, 1853, 29901, 28379, 29961, 710, 29962, 353, 6213, 13, 1678, 15068, 29901, 28379, 29961, 710, 29962, 353, 6213, 13, 1678, 4700, 29918, 978, 29901, 28379, 29961, 710, 29962, 353, 6213, 13, 1678, 1121, 29918, 2271, 29901, 28379, 29961, 710, 29962, 353, 6213, 13, 13, 1678, 770, 323, 8522, 1542, 29901, 13, 4706, 2672, 29963, 1806, 8098, 353, 525, 11569, 7018, 29915, 13, 4706, 17687, 1799, 17013, 29918, 3210, 24336, 353, 525, 5630, 29918, 3167, 29915, 13, 13, 1678, 770, 5976, 744, 29901, 13, 4706, 476, 29949, 353, 525, 2901, 29915, 13, 4706, 12524, 353, 525, 264, 29915, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2984, 29906, 710, 29918, 11569, 7018, 29898, 25932, 29892, 2984, 29918, 262, 1125, 13, 4706, 822, 2984, 29906, 12324, 29898, 3385, 29918, 1125, 13, 9651, 565, 451, 2984, 29918, 29901, 13, 18884, 736, 6571, 13, 13, 9651, 565, 451, 2984, 5396, 23337, 29901, 13, 18884, 736, 2984, 29918, 13, 13, 9651, 6361, 353, 5976, 744, 12229, 29889, 23337, 29906, 3893, 29898, 3385, 5396, 23337, 29897, 13, 9651, 2984, 29918, 449, 353, 3630, 1990, 12229, 29889, 14634, 4197, 13, 18884, 2984, 29918, 262, 29892, 13, 18884, 1067, 29879, 29898, 23337, 29922, 3893, 511, 13, 9651, 21251, 13, 18884, 14013, 848, 5415, 29901, 360, 919, 12229, 29889, 4304, 5975, 29906, 735, 13347, 29898, 294, 8977, 29898, 1272, 5415, 8243, 13, 18884, 325, 3539, 29922, 21533, 12229, 29889, 29963, 6113, 29889, 957, 3539, 29897, 13, 9651, 736, 2984, 29918, 449, 13, 13, 4706, 432, 29918, 12324, 353, 360, 919, 12229, 29889, 8149, 29906, 735, 13347, 29898, 13, 9651, 408, 8977, 29898, 3385, 29906, 12324, 29898, 3385, 29918, 262, 8243, 13, 9651, 518, 1469, 1990, 12229, 29889, 2671, 978, 29906, 11238, 29898, 25932, 29892, 525, 2914, 29918, 2271, 1495, 1402, 13, 4706, 1723, 13, 4706, 736, 3142, 12508, 29898, 21533, 12229, 29889, 4304, 5975, 29906, 735, 13347, 29898, 29926, 29918, 12324, 876, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 23381, 29906, 11569, 7018, 29898, 25932, 29892, 23381, 29892, 2984, 29922, 8516, 1125, 13, 4706, 4974, 29918, 275, 29918, 1333, 29918, 9290, 29898, 29873, 8522, 29897, 13, 13, 4706, 565, 2984, 322, 2984, 29889, 29873, 8522, 29918, 1853, 29901, 13, 9651, 4974, 29918, 11745, 29898, 3385, 29889, 29873, 8522, 29918, 1853, 29892, 1067, 29879, 29889, 29911, 8522, 1542, 29889, 1177, 29963, 1806, 8098, 29897, 13, 13, 4706, 2984, 29918, 449, 353, 3630, 1990, 12229, 29889, 14634, 4197, 13, 9651, 2984, 565, 2984, 1683, 6213, 29892, 13, 9651, 1067, 29879, 29898, 29873, 8522, 29918, 1853, 29922, 25932, 29889, 29911, 8522, 1542, 29889, 1177, 29963, 1806, 8098, 511, 13, 4706, 21251, 13, 9651, 14013, 848, 5415, 29901, 360, 919, 12229, 29889, 4304, 5975, 29906, 735, 13347, 29898, 294, 8977, 29898, 1272, 5415, 8243, 13, 9651, 325, 3539, 29922, 21533, 12229, 29889, 29963, 6113, 29889, 957, 3539, 29892, 1723, 13, 13, 4706, 2437, 7018, 353, 23381, 718, 1067, 29879, 29889, 3385, 29906, 710, 29918, 11569, 7018, 29898, 3385, 29918, 449, 29897, 13, 4706, 736, 2437, 7018, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1404, 29918, 333, 29906, 2271, 29918, 11569, 7018, 29898, 25932, 29892, 623, 29918, 3888, 29892, 1404, 29918, 333, 29892, 2984, 29901, 376, 29911, 8522, 8375, 29908, 353, 6213, 1125, 13, 4706, 17927, 353, 14802, 29891, 1982, 16363, 29889, 9891, 29918, 5563, 29906, 21707, 29898, 13, 9651, 1067, 29879, 29889, 1792, 29918, 333, 29906, 2271, 29918, 11569, 7018, 29892, 12183, 29889, 18525, 29897, 13, 13, 4706, 23381, 29918, 29886, 29893, 29918, 3167, 353, 13189, 29900, 29924, 29906, 11490, 1507, 29889, 1792, 29918, 333, 29906, 29873, 8522, 29918, 5630, 29918, 3167, 29898, 13, 9651, 623, 29918, 3888, 29892, 1404, 29918, 333, 29892, 1121, 29918, 2271, 29922, 3385, 29889, 2914, 29918, 2271, 29897, 13, 13, 4706, 23381, 29918, 11569, 7018, 353, 323, 8522, 8375, 29889, 29873, 8522, 29906, 11569, 7018, 29898, 13, 9651, 23381, 29918, 29886, 29893, 29918, 3167, 29892, 2984, 29922, 3385, 29897, 13, 13, 4706, 17927, 29889, 8382, 3319, 29915, 29873, 8522, 29918, 11569, 7018, 2396, 29873, 8522, 29918, 11569, 7018, 1800, 13, 13, 4706, 736, 23381, 29918, 11569, 7018, 13, 13, 2 ]
test/test_basic.py
CivicKnowledge/metapack-db
0
93049
import unittest from metapack import MetapackDoc from metapack_db import Database, MetatabManager from metapack_db.document import Document from metapack_db.term import Term from os import remove from os.path import exists from sqlalchemy.exc import IntegrityError def test_data(*paths): from os.path import dirname, join, abspath return abspath(join(dirname(dirname(abspath(__file__))), 'test-data', *paths)) test_database_path = '/tmp/test.db' class BasicTests(unittest.TestCase): def test_create_and_delete_tables(self): from os import remove from os.path import exists doc = MetapackDoc(test_data('example1.csv')) if exists(test_database_path): remove(test_database_path) db = Database('sqlite:///'+test_database_path) db.create_tables() mm = MetatabManager(db) mm.add_doc(doc) with mm.session() as s: self.assertEqual(1, len(list(s.query(Document)))) self.assertEqual(154, len(list(s.query(Term)))) with self.assertRaises(IntegrityError): mm.add_doc(doc) with mm.session() as s: self.assertEqual(1, len(list(s.query(Document)))) self.assertEqual(154, len(list(s.query(Term)))) with mm.session() as s: db_doc = mm.document(identifier=doc.get_value('Root.Identifier')) self.assertIsNotNone(db_doc) s.delete(db_doc) with mm.session() as s: self.assertEqual(0, len(list(s.query(Document)))) self.assertEqual(0, len(list(s.query(Term)))) def test_iterate_doc(self): doc = MetapackDoc(test_data('example1.csv')) if exists(test_database_path): remove(test_database_path) db = Database('sqlite:///'+test_database_path) mm = MetatabManager(db) mm.add_doc(doc) with mm.session() as s: db_doc = mm.document(identifier=doc.get_value('Root.Identifier')) mt_doc = db_doc.mt_doc self.assertEqual(23, len(mt_doc.terms)) self.assertEqual(['http://example.com/example1.csv', 'http://example.com/example2.csv'], [str(r.resolved_url) for r in mt_doc.find("Root.Datafile")]) with mm.session(): with mm.session(): db_doc = mm.document(identifier=doc.get_value('Root.Identifier')) mt_doc = db_doc.mt_doc self.assertEqual(23, len(mt_doc.terms)) def test_multiple_docs(self): if exists(test_database_path): remove(test_database_path) db = Database('sqlite:///'+test_database_path) mm = MetatabManager(db) with mm.session(): # # add_doc session are nested mm.add_doc(MetapackDoc(test_data('example1.csv'))) mm.add_doc(MetapackDoc(test_data('example.com-full-2017-us.csv'))) mm.add_doc(MetapackDoc('http://library.metatab.org/example.com-simple_example-2017-us-2.csv')) with mm.session(): self.assertEqual(['cfcba102-9d8f-11e7-8adb-3c0754078006', '316821b9-9082-4c9e-8662-db50d9d91135', '96cd659b-94ad-46ae-9c18-4018caa64355' ], [d.identifier for d in mm.documents()]) doc = mm.document(ref="file:"+test_data('example1.csv')) self.assertEquals('cfcba102-9d8f-11e7-8adb-3c0754078006', doc.identifier) doc = mm.document(ref='metapack+http://library.metatab.org/example.com-simple_example-2017-us-2.csv') self.assertEquals('96cd659b-94ad-46ae-9c18-4018caa64355', doc.identifier) doc = mm.document(ref='http://library.metatab.org/example.com-simple_example-2017-us-2.csv') self.assertEquals('96cd659b-94ad-46ae-9c18-4018caa64355', doc.identifier) doc = mm.document(name=doc.name) self.assertEquals('96cd659b-94ad-46ae-9c18-4018caa64355', doc.identifier) def test_load_one_resource(self): if exists(test_database_path): remove(test_database_path) db = Database('sqlite:///' + test_database_path) mm = MetatabManager(db) mm.add_doc(MetapackDoc('http://library.metatab.org/example.com-full-2017-us-1.csv')) ident = next(d.identifier for d in mm.documents()) doc = mm.document(identifier=ident) self.assertIsNotNone(doc) resources = [ r.name for r in mm.resources(doc) ] self.assertEquals(['renter_cost', 'simple-example-altnames', 'simple-example', 'unicode-latin1', 'unicode-utf8', 'renter_cost_excel07', 'renter_cost_excel97', 'renter_cost-2', 'random-names', 'random-names-fs', 'random-names-csv', 'random-names-xlsx', 'random-names-zip', 'sra', 'rowgen', 'simple-fixed'], resources) r = mm.resource(doc, 'random-names') mm.load_resource(r) def test_load_from_url(self): if exists(test_database_path): remove(test_database_path) db = Database('sqlite:///' + test_database_path) mm = MetatabManager(db) mm.load('http://library.metatab.org/example.com-full-2017-us-1.csv#renter_cost_excel97') mm.load('http://library.metatab.org/example.com-full-2017-us-1.csv#random-names') mm.load('http://library.metatab.org/example.com-full-2017-us-1.csv#random-names') if __name__ == '__main__': unittest.main()
[ 1, 1053, 443, 27958, 13, 13, 13, 3166, 1539, 481, 547, 1053, 4737, 481, 547, 14526, 13, 3166, 1539, 481, 547, 29918, 2585, 1053, 5470, 29892, 4737, 271, 370, 3260, 13, 3166, 1539, 481, 547, 29918, 2585, 29889, 3225, 1053, 10854, 13, 3166, 1539, 481, 547, 29918, 2585, 29889, 8489, 1053, 11814, 13, 3166, 2897, 1053, 3349, 13, 3166, 2897, 29889, 2084, 1053, 4864, 13, 13, 3166, 4576, 284, 305, 6764, 29889, 735, 29883, 1053, 17100, 537, 2392, 13, 13, 1753, 1243, 29918, 1272, 10456, 24772, 1125, 13, 1678, 515, 2897, 29889, 2084, 1053, 4516, 978, 29892, 5988, 29892, 633, 1028, 493, 13, 13, 1678, 736, 633, 1028, 493, 29898, 7122, 29898, 25721, 29898, 25721, 29898, 370, 1028, 493, 22168, 1445, 1649, 876, 511, 525, 1688, 29899, 1272, 742, 334, 24772, 876, 13, 13, 1688, 29918, 9803, 29918, 2084, 353, 8207, 7050, 29914, 1688, 29889, 2585, 29915, 13, 13, 13, 1990, 19219, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 392, 29918, 8143, 29918, 24051, 29898, 1311, 1125, 13, 4706, 515, 2897, 1053, 3349, 13, 4706, 515, 2897, 29889, 2084, 1053, 4864, 13, 13, 4706, 1574, 353, 4737, 481, 547, 14526, 29898, 1688, 29918, 1272, 877, 4773, 29896, 29889, 7638, 8785, 13, 13, 4706, 565, 4864, 29898, 1688, 29918, 9803, 29918, 2084, 1125, 13, 9651, 3349, 29898, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 353, 5470, 877, 22793, 597, 29914, 18717, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 29889, 3258, 29918, 24051, 580, 13, 13, 4706, 5654, 353, 4737, 271, 370, 3260, 29898, 2585, 29897, 13, 13, 4706, 5654, 29889, 1202, 29918, 1514, 29898, 1514, 29897, 13, 13, 4706, 411, 5654, 29889, 7924, 580, 408, 269, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 6268, 13697, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29896, 29945, 29946, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 14343, 13697, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 23573, 537, 2392, 1125, 13, 9651, 5654, 29889, 1202, 29918, 1514, 29898, 1514, 29897, 13, 13, 4706, 411, 5654, 29889, 7924, 580, 408, 269, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29896, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 6268, 13697, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29896, 29945, 29946, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 14343, 13697, 13, 13, 4706, 411, 5654, 29889, 7924, 580, 408, 269, 29901, 13, 9651, 4833, 29918, 1514, 353, 5654, 29889, 3225, 29898, 25378, 29922, 1514, 29889, 657, 29918, 1767, 877, 10303, 29889, 12889, 8785, 13, 9651, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 2585, 29918, 1514, 29897, 13, 9651, 269, 29889, 8143, 29898, 2585, 29918, 1514, 29897, 13, 13, 4706, 411, 5654, 29889, 7924, 580, 408, 269, 29901, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 6268, 13697, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 7431, 29898, 1761, 29898, 29879, 29889, 1972, 29898, 14343, 13697, 13, 13, 1678, 822, 1243, 29918, 1524, 403, 29918, 1514, 29898, 1311, 1125, 13, 13, 4706, 1574, 353, 4737, 481, 547, 14526, 29898, 1688, 29918, 1272, 877, 4773, 29896, 29889, 7638, 8785, 13, 13, 4706, 565, 4864, 29898, 1688, 29918, 9803, 29918, 2084, 1125, 13, 9651, 3349, 29898, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 353, 5470, 877, 22793, 597, 29914, 18717, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 5654, 353, 4737, 271, 370, 3260, 29898, 2585, 29897, 13, 13, 4706, 5654, 29889, 1202, 29918, 1514, 29898, 1514, 29897, 13, 13, 4706, 411, 5654, 29889, 7924, 580, 408, 269, 29901, 13, 9651, 4833, 29918, 1514, 353, 5654, 29889, 3225, 29898, 25378, 29922, 1514, 29889, 657, 29918, 1767, 877, 10303, 29889, 12889, 8785, 13, 13, 9651, 286, 29873, 29918, 1514, 353, 4833, 29918, 1514, 29889, 4378, 29918, 1514, 13, 13, 9651, 1583, 29889, 9294, 9843, 29898, 29906, 29941, 29892, 7431, 29898, 4378, 29918, 1514, 29889, 357, 1516, 876, 13, 13, 9651, 1583, 29889, 9294, 9843, 18959, 1124, 597, 4773, 29889, 510, 29914, 4773, 29896, 29889, 7638, 742, 525, 1124, 597, 4773, 29889, 510, 29914, 4773, 29906, 29889, 7638, 7464, 13, 462, 632, 518, 710, 29898, 29878, 29889, 9778, 1490, 29918, 2271, 29897, 363, 364, 297, 286, 29873, 29918, 1514, 29889, 2886, 703, 10303, 29889, 1469, 1445, 1159, 2314, 13, 13, 4706, 411, 5654, 29889, 7924, 7295, 13, 9651, 411, 5654, 29889, 7924, 7295, 13, 18884, 4833, 29918, 1514, 353, 5654, 29889, 3225, 29898, 25378, 29922, 1514, 29889, 657, 29918, 1767, 877, 10303, 29889, 12889, 8785, 13, 13, 18884, 286, 29873, 29918, 1514, 353, 4833, 29918, 1514, 29889, 4378, 29918, 1514, 13, 13, 18884, 1583, 29889, 9294, 9843, 29898, 29906, 29941, 29892, 7431, 29898, 4378, 29918, 1514, 29889, 357, 1516, 876, 13, 13, 1678, 822, 1243, 29918, 20787, 29918, 2640, 29898, 1311, 1125, 13, 13, 4706, 565, 4864, 29898, 1688, 29918, 9803, 29918, 2084, 1125, 13, 9651, 3349, 29898, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 353, 5470, 877, 22793, 597, 29914, 18717, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 5654, 353, 4737, 271, 370, 3260, 29898, 2585, 29897, 13, 13, 4706, 411, 5654, 29889, 7924, 7295, 396, 396, 788, 29918, 1514, 4867, 526, 9322, 13, 9651, 5654, 29889, 1202, 29918, 1514, 29898, 10095, 481, 547, 14526, 29898, 1688, 29918, 1272, 877, 4773, 29896, 29889, 7638, 29915, 4961, 13, 9651, 5654, 29889, 1202, 29918, 1514, 29898, 10095, 481, 547, 14526, 29898, 1688, 29918, 1272, 877, 4773, 29889, 510, 29899, 8159, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29889, 7638, 29915, 4961, 13, 9651, 5654, 29889, 1202, 29918, 1514, 29898, 10095, 481, 547, 14526, 877, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 12857, 29918, 4773, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29906, 29889, 7638, 8785, 13, 13, 4706, 411, 5654, 29889, 7924, 7295, 13, 9651, 1583, 29889, 9294, 9843, 18959, 6854, 29883, 2291, 29896, 29900, 29906, 29899, 29929, 29881, 29947, 29888, 29899, 29896, 29896, 29872, 29955, 29899, 29947, 328, 29890, 29899, 29941, 29883, 29900, 29955, 29945, 29946, 29900, 29955, 29947, 29900, 29900, 29953, 742, 525, 29941, 29896, 29953, 29947, 29906, 29896, 29890, 29929, 29899, 29929, 29900, 29947, 29906, 29899, 29946, 29883, 29929, 29872, 29899, 29947, 29953, 29953, 29906, 29899, 2585, 29945, 29900, 29881, 29929, 29881, 29929, 29896, 29896, 29941, 29945, 742, 13, 462, 795, 525, 29929, 29953, 2252, 29953, 29945, 29929, 29890, 29899, 29929, 29946, 328, 29899, 29946, 29953, 3660, 29899, 29929, 29883, 29896, 29947, 29899, 29946, 29900, 29896, 29947, 1113, 29874, 29953, 29946, 29941, 29945, 29945, 29915, 21251, 13, 462, 632, 518, 29881, 29889, 25378, 363, 270, 297, 5654, 29889, 3225, 29879, 580, 2314, 13, 13, 4706, 1574, 353, 5654, 29889, 3225, 29898, 999, 543, 1445, 6160, 29974, 1688, 29918, 1272, 877, 4773, 29896, 29889, 7638, 8785, 13, 4706, 1583, 29889, 9294, 14776, 877, 6854, 29883, 2291, 29896, 29900, 29906, 29899, 29929, 29881, 29947, 29888, 29899, 29896, 29896, 29872, 29955, 29899, 29947, 328, 29890, 29899, 29941, 29883, 29900, 29955, 29945, 29946, 29900, 29955, 29947, 29900, 29900, 29953, 742, 1574, 29889, 25378, 29897, 13, 13, 4706, 1574, 353, 5654, 29889, 3225, 29898, 999, 2433, 2527, 481, 547, 29974, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 12857, 29918, 4773, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29906, 29889, 7638, 1495, 13, 4706, 1583, 29889, 9294, 14776, 877, 29929, 29953, 2252, 29953, 29945, 29929, 29890, 29899, 29929, 29946, 328, 29899, 29946, 29953, 3660, 29899, 29929, 29883, 29896, 29947, 29899, 29946, 29900, 29896, 29947, 1113, 29874, 29953, 29946, 29941, 29945, 29945, 742, 1574, 29889, 25378, 29897, 13, 13, 4706, 1574, 353, 5654, 29889, 3225, 29898, 999, 2433, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 12857, 29918, 4773, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29906, 29889, 7638, 1495, 13, 4706, 1583, 29889, 9294, 14776, 877, 29929, 29953, 2252, 29953, 29945, 29929, 29890, 29899, 29929, 29946, 328, 29899, 29946, 29953, 3660, 29899, 29929, 29883, 29896, 29947, 29899, 29946, 29900, 29896, 29947, 1113, 29874, 29953, 29946, 29941, 29945, 29945, 742, 1574, 29889, 25378, 29897, 13, 13, 4706, 1574, 353, 5654, 29889, 3225, 29898, 978, 29922, 1514, 29889, 978, 29897, 13, 4706, 1583, 29889, 9294, 14776, 877, 29929, 29953, 2252, 29953, 29945, 29929, 29890, 29899, 29929, 29946, 328, 29899, 29946, 29953, 3660, 29899, 29929, 29883, 29896, 29947, 29899, 29946, 29900, 29896, 29947, 1113, 29874, 29953, 29946, 29941, 29945, 29945, 742, 1574, 29889, 25378, 29897, 13, 13, 1678, 822, 1243, 29918, 1359, 29918, 650, 29918, 10314, 29898, 1311, 1125, 13, 13, 4706, 565, 4864, 29898, 1688, 29918, 9803, 29918, 2084, 1125, 13, 9651, 3349, 29898, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 353, 5470, 877, 22793, 597, 22208, 718, 1243, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 5654, 353, 4737, 271, 370, 3260, 29898, 2585, 29897, 13, 13, 4706, 5654, 29889, 1202, 29918, 1514, 29898, 10095, 481, 547, 14526, 877, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 8159, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29896, 29889, 7638, 8785, 13, 13, 4706, 2893, 353, 2446, 29898, 29881, 29889, 25378, 363, 270, 297, 5654, 29889, 3225, 29879, 3101, 13, 4706, 1574, 353, 5654, 29889, 3225, 29898, 25378, 29922, 1693, 29897, 13, 13, 4706, 1583, 29889, 9294, 3624, 3664, 8516, 29898, 1514, 29897, 13, 13, 4706, 7788, 353, 518, 364, 29889, 978, 363, 364, 297, 5654, 29889, 13237, 29898, 1514, 29897, 4514, 13, 13, 4706, 1583, 29889, 9294, 14776, 18959, 29878, 5893, 29918, 18253, 742, 525, 12857, 29899, 4773, 29899, 1997, 7039, 742, 525, 12857, 29899, 4773, 742, 525, 2523, 356, 29899, 5066, 262, 29896, 742, 13, 462, 965, 525, 2523, 356, 29899, 9420, 29947, 742, 525, 29878, 5893, 29918, 18253, 29918, 24633, 29900, 29955, 742, 525, 29878, 5893, 29918, 18253, 29918, 24633, 29929, 29955, 742, 525, 29878, 5893, 29918, 18253, 29899, 29906, 742, 13, 462, 965, 525, 8172, 29899, 7039, 742, 525, 8172, 29899, 7039, 29899, 5847, 742, 525, 8172, 29899, 7039, 29899, 7638, 742, 525, 8172, 29899, 7039, 29899, 20267, 29916, 742, 13, 462, 965, 525, 8172, 29899, 7039, 29899, 7554, 742, 525, 29879, 336, 742, 525, 798, 1885, 742, 525, 12857, 29899, 20227, 7464, 13, 462, 3986, 7788, 29897, 13, 13, 4706, 364, 353, 5654, 29889, 10314, 29898, 1514, 29892, 525, 8172, 29899, 7039, 1495, 13, 13, 4706, 5654, 29889, 1359, 29918, 10314, 29898, 29878, 29897, 13, 13, 1678, 822, 1243, 29918, 1359, 29918, 3166, 29918, 2271, 29898, 1311, 1125, 13, 13, 4706, 565, 4864, 29898, 1688, 29918, 9803, 29918, 2084, 1125, 13, 9651, 3349, 29898, 1688, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 4833, 353, 5470, 877, 22793, 597, 22208, 718, 1243, 29918, 9803, 29918, 2084, 29897, 13, 13, 4706, 5654, 353, 4737, 271, 370, 3260, 29898, 2585, 29897, 13, 13, 4706, 5654, 29889, 1359, 877, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 8159, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29896, 29889, 7638, 29937, 29878, 5893, 29918, 18253, 29918, 24633, 29929, 29955, 1495, 13, 13, 4706, 5654, 29889, 1359, 877, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 8159, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29896, 29889, 7638, 29937, 8172, 29899, 7039, 1495, 13, 13, 4706, 5654, 29889, 1359, 877, 1124, 597, 5258, 29889, 2527, 271, 370, 29889, 990, 29914, 4773, 29889, 510, 29899, 8159, 29899, 29906, 29900, 29896, 29955, 29899, 375, 29899, 29896, 29889, 7638, 29937, 8172, 29899, 7039, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
osbs/tekton.py
tkdchen/osbs-client
0
1611779
""" Copyright (c) 2015, 2019, 2021 Red Hat, Inc All rights reserved. This software may be modified and distributed under the terms of the BSD license. See the LICENSE file for details. """ import json import time import logging import base64 import os import requests import copy from osbs.exceptions import OsbsResponseException, OsbsAuthException, OsbsException from osbs.constants import (DEFAULT_NAMESPACE, SERVICEACCOUNT_SECRET, SERVICEACCOUNT_TOKEN, SERVICEACCOUNT_CACRT) from osbs.osbs_http import HttpSession from osbs.kerberos_ccache import kerberos_ccache_init from osbs.utils import retry_on_conflict from urllib.parse import urljoin, urlencode, urlparse, parse_qs from requests.utils import guess_json_utf logger = logging.getLogger(__name__) # Retry each connection attempt after 5 seconds, for a maximum of 10 times WATCH_RETRY_SECS = 5 WATCH_RETRY = 10 MAX_BAD_RESPONSES = WATCH_RETRY // 3 # Give up after 12 hours WAIT_RETRY_HOURS = 12 WAIT_RETRY = WAIT_RETRY_HOURS * 3600 // (WATCH_RETRY_SECS * WATCH_RETRY) API_VERSION = "tekton.dev/v1beta1" def check_response(response, log_level=logging.ERROR): if response.status_code not in ( requests.status_codes.codes.ok, requests.status_codes.codes.created, ): if hasattr(response, 'content'): content = response.content else: content = b''.join(response.iter_lines()) logger.log(log_level, "[%d] %s", response.status_code, content) raise OsbsResponseException(message=content, status_code=response.status_code) class Openshift(object): def __init__(self, openshift_api_url, openshift_oauth_url, k8s_api_url=None, verbose=False, username=None, password=None, use_kerberos=False, kerberos_keytab=None, kerberos_principal=None, kerberos_ccache=None, client_cert=None, client_key=None, verify_ssl=True, use_auth=None, token=None, namespace=DEFAULT_NAMESPACE): self.os_api_url = openshift_api_url self.k8s_api_url = k8s_api_url self._os_oauth_url = openshift_oauth_url self.namespace = namespace self.verbose = verbose self.verify_ssl = verify_ssl self._con = HttpSession(verbose=self.verbose) self.retries_enabled = True # auth stuff self.use_kerberos = use_kerberos self.username = username self.password = password self.client_cert = client_cert self.client_key = client_key self.kerberos_keytab = kerberos_keytab self.kerberos_principal = kerberos_principal self.kerberos_ccache = kerberos_ccache self.token = token self.ca = None auth_credentials_provided = bool(use_kerberos or token or (username and password)) if use_auth is None: self.use_auth = auth_credentials_provided if not self.use_auth: # Are we running inside a pod? If so, we will have a # token available which can be used for authentication self.use_auth = self.can_use_serviceaccount_token() else: self.use_auth = use_auth if not auth_credentials_provided: # We've been told to use authentication but no # credentials have been given. See if we're running # inside a pod, and if so use the provided token. self.can_use_serviceaccount_token() def can_use_serviceaccount_token(self): try: with open(os.path.join(SERVICEACCOUNT_SECRET, SERVICEACCOUNT_TOKEN), mode='rt') as tfp: self.token = tfp.read().rstrip() ca = os.path.join(SERVICEACCOUNT_SECRET, SERVICEACCOUNT_CACRT) if os.access(ca, os.R_OK): self.ca = ca except IOError: # No token available return False else: # We can authenticate using the supplied token logger.info("Using service account's auth token") return True @property def os_oauth_url(self): return self._os_oauth_url def _build_k8s_url(self, url, _prepend_namespace=True, **query): if _prepend_namespace: url = "namespaces/%s/%s" % (self.namespace, url) if query: url += ("?" + urlencode(query)) return urljoin(self.k8s_api_url, url) def build_url(self, api_path, api_version, url, _prepend_namespace=True, **query): if _prepend_namespace: url = "namespaces/%s/%s" % (self.namespace, url) if query: url += ("?" + urlencode(query)) url = f"{api_path}/{api_version}/{url}" return urljoin(self.os_api_url, url) def _request_args(self, with_auth=True, **kwargs): headers = kwargs.pop("headers", {}) if with_auth and self.use_auth: if self.token is None: self.get_oauth_token() if self.token: headers["Authorization"] = "Bearer %s" % self.token else: raise OsbsAuthException("Please check your credentials. " "Token was not retrieved successfully.") # Use the client certificate both for the OAuth request and OpenShift # API requests. Certificate auth can be used as an alternative to # OAuth, however a scenario where they are used to get OAuth token is # also possible. Certificate is not sent when server does not request it. if self.client_cert or self.client_key: if self.client_cert and self.client_key: kwargs["client_cert"] = self.client_cert kwargs["client_key"] = self.client_key else: raise OsbsAuthException("You need to provide both client certificate and key.") # Do we have a ca.crt? If so, use it if self.verify_ssl and self.ca is not None: kwargs["ca"] = self.ca return headers, kwargs def post(self, url, with_auth=True, **kwargs): headers, kwargs = self._request_args(with_auth, **kwargs) return self._con.post( url, headers=headers, verify_ssl=self.verify_ssl, retries_enabled=self.retries_enabled, **kwargs) def get(self, url, with_auth=True, **kwargs): headers, kwargs = self._request_args(with_auth, **kwargs) return self._con.get( url, headers=headers, verify_ssl=self.verify_ssl, retries_enabled=self.retries_enabled, **kwargs) def put(self, url, with_auth=True, **kwargs): headers, kwargs = self._request_args(with_auth, **kwargs) return self._con.put( url, headers=headers, verify_ssl=self.verify_ssl, retries_enabled=self.retries_enabled, **kwargs) def patch(self, url, with_auth=True, **kwargs): headers, kwargs = self._request_args(with_auth, **kwargs) return self._con.patch( url, headers=headers, verify_ssl=self.verify_ssl, retries_enabled=self.retries_enabled, **kwargs) def delete(self, url, with_auth=True, **kwargs): headers, kwargs = self._request_args(with_auth, **kwargs) return self._con.delete( url, headers=headers, verify_ssl=self.verify_ssl, retries_enabled=self.retries_enabled, **kwargs) def get_oauth_token(self): url = self.os_oauth_url + "?response_type=token&client_id=openshift-challenging-client" if self.use_auth: if self.username and self.password: logger.debug("using basic authentication") r = self.get( url, with_auth=False, allow_redirects=False, username=self.username, password=<PASSWORD>, ) elif self.use_kerberos: logger.debug("using kerberos authentication") if self.kerberos_keytab: if not self.kerberos_principal: raise OsbsAuthException("You need to provide kerberos principal along " "with the keytab path.") kerberos_ccache_init(self.kerberos_principal, self.kerberos_keytab, ccache_file=self.kerberos_ccache) r = self.get(url, with_auth=False, allow_redirects=False, kerberos_auth=True) else: logger.debug("using identity authentication") r = self.get(url, with_auth=False, allow_redirects=False) else: logger.debug("getting token without any authentication (fingers crossed)") r = self.get(url, with_auth=False, allow_redirects=False) try: redir_url = r.headers['location'] except KeyError: logger.error("[%s] 'Location' header is missing in response, cannot retrieve token", r.status_code) return "" parsed_url = urlparse(redir_url) fragment = parsed_url.fragment parsed_fragment = parse_qs(fragment) self.token = parsed_fragment['access_token'][0] return self.token def get_serviceaccount_tokens(self, username="~"): result = {} url = self._build_k8s_url("serviceaccounts/%s/" % username, _prepend_namespace=True) response = self.get(url) check_response(response) sa_json = response.json() if not sa_json: return {} if 'secrets' not in sa_json.keys(): logger.debug("No secrets found for service account %s", username) return {} secrets = sa_json['secrets'] for secret in secrets: if 'name' not in secret.keys(): logger.debug("Malformed secret info: missing 'name' key in %r", secret) continue secret_name = secret['name'] if 'token' not in secret_name: logger.debug("Secret %s is not a token", secret_name) continue url = self._build_k8s_url("secrets/%s/" % secret_name, _prepend_namespace=True) response = self.get(url) check_response(response) secret_json = response.json() if not secret_json: continue if 'data' not in secret_json.keys(): logger.debug("Malformed secret info: missing 'data' key in %r", json) continue secret_data = secret_json['data'] if 'token' not in secret_data.keys(): logger.debug("Malformed secret data: missing 'token' key in %r", secret_data) continue token = secret_data['token'] # Token needs to be base64-decoded result[secret_name] = base64.b64decode(token) return result def watch_resource(self, api_path, api_version, resource_type, resource_name, **request_args): """ Watch for changes in openshift object and return it's json representation after each update to the object """ def log_and_sleep(): logger.debug("connection closed, reconnecting in %ds", WATCH_RETRY_SECS) time.sleep(WATCH_RETRY_SECS) watch_path = f"watch/namespaces/{self.namespace}/{resource_type}/{resource_name}/" watch_url = self.build_url( api_path, api_version, watch_path, _prepend_namespace=False, **request_args ) get_url = self.build_url(api_path, api_version, f"{resource_type}/{resource_name}") bad_responses = 0 for _ in range(WATCH_RETRY): logger.debug("watching for updates for %s, %s", resource_type, resource_name) try: response = self.get(watch_url, stream=True, headers={'Connection': 'close'}) check_response(response) # we're already retrying, so there's no need to panic just because of a bad response except OsbsResponseException as exc: bad_responses += 1 if bad_responses > MAX_BAD_RESPONSES: raise exc else: # check_response() already logged the message, so just report that we're # sleeping and retry log_and_sleep() continue for line in response.iter_lines(): encoding = guess_json_utf(line) try: j = json.loads(line.decode(encoding)) except ValueError: logger.error("Cannot decode watch event: %s", line) continue if 'object' not in j: logger.error("Watch event has no 'object': %s", j) continue if 'type' not in j: logger.error("Watch event has no 'type': %s", j) continue # Avoid races. We've already asked the server to tell us # about changes to the object, but now ask for a fresh # copy of the object as well. This is to catch the # situation where the object changed before the call to # this method, or in between retries in this method. logger.debug("retrieving fresh version of object %s", resource_name) fresh_response = self.get(get_url) check_response(fresh_response) yield fresh_response.json() log_and_sleep() class PipelineRun(): def __init__(self, os, pipeline_run_name, pipeline_run_data=None): self.os = os self.pipeline_run_name = pipeline_run_name self.api_path = 'apis' self.api_version = API_VERSION self.input_data = pipeline_run_data self._pipeline_run_url = None self.minimal_data = { "apiVersion": API_VERSION, "kind": "PipelineRun", "metadata": {"name": self.pipeline_run_name}, "spec": {}, } @property def data(self): # always get fresh info return self.get_info() @property def pipeline_run_url(self): if self._pipeline_run_url is None: self._pipeline_run_url = self.os.build_url( self.api_path, self.api_version, f"pipelineruns/{self.pipeline_run_name}" ) return self._pipeline_run_url def start_pipeline_run(self): if not self.input_data: raise OsbsException("No input data provided for pipeline run to start") run_name = self.input_data.get('metadata', {}).get('name') if run_name != self.pipeline_run_name: msg = f"Pipeline run name provided '{self.pipeline_run_name}' is different " \ f"than in input data '{run_name}'" raise OsbsException(msg) url = self.os.build_url( self.api_path, self.api_version, "pipelineruns" ) response = self.os.post( url, data=json.dumps(self.input_data), headers={"Content-Type": "application/json", "Accept": "application/json"}, ) return response.json() def _check_response(self, response, cmd): try: run_json = response.json() except OsbsResponseException as ex: if ex.status_code == 404: run_json = None else: logger.error("%s failed with : [%d] %s", cmd, ex.status_code, ex) raise return run_json @retry_on_conflict def cancel_pipeline_run(self): data = copy.deepcopy(self.minimal_data) data['spec']['status'] = 'PipelineRunCancelled' response = self.os.patch( self.pipeline_run_url, data=json.dumps(data), headers={ "Content-Type": "application/merge-patch+json", "Accept": "application/json", }, ) msg = f"cancel pipeline run '{self.pipeline_run_name}'" exc_msg = f"Pipeline run '{self.pipeline_run_name}' can't be canceled, " \ f"because it doesn't exist" response_json = self._check_response(response, msg) if not response_json: raise OsbsException(exc_msg) return response_json @retry_on_conflict def update_labels(self, labels): data = copy.deepcopy(self.minimal_data) data['metadata']['labels'] = labels response = self.os.patch( self.pipeline_run_url, data=json.dumps(data), headers={ "Content-Type": "application/merge-patch+json", "Accept": "application/json", }, ) msg = f"update labels on pipeline run '{self.pipeline_run_name}'" exc_msg = f"Can't update labels on pipeline run '{self.pipeline_run_name}', " \ f"because it doesn't exist" response_json = self._check_response(response, msg) if not response_json: raise OsbsException(exc_msg) return response_json @retry_on_conflict def update_annotations(self, annotations): data = copy.deepcopy(self.minimal_data) data['metadata']['annotations'] = annotations response = self.os.patch( self.pipeline_run_url, data=json.dumps(data), headers={ "Content-Type": "application/merge-patch+json", "Accept": "application/json", }, ) msg = f"update annotations on pipeline run '{self.pipeline_run_name}'" exc_msg = f"Can't update annotations on pipeline run '{self.pipeline_run_name}', " \ f"because it doesn't exist" response_json = self._check_response(response, msg) if not response_json: raise OsbsException(exc_msg) return response_json def get_info(self, wait=False): if wait: self.wait_for_start() response = self.os.get(self.pipeline_run_url) return self._check_response(response, 'get_info') def get_error_message(self): data = self.data if not data: return None annotations = data['metadata']['annotations'] plugins_metadata = annotations.get('plugins-metadata') plugin_errors = None if plugins_metadata: metadata_dict = json.loads(plugins_metadata) plugin_errors = metadata_dict.get('errors') err_message = "" if plugin_errors: err_message = "plugin errors:\n" for plugin, error in plugin_errors.items(): err_message += f"{plugin} : {error}\n" err_message += "\npipeline run errors:\n" task_runs_status = data['status'].get('taskRuns', {}) for task_name, stats in task_runs_status.items(): if stats['status']['conditions'][0]['reason'] == 'Succeeded': continue err_message += f"pipeline task '{task_name}' failed:\n" if 'steps' in stats['status']: for step in stats['status']['steps']: exit_code = step['terminated']['exitCode'] if exit_code == 0: continue reason = step['terminated']['reason'] err_message += f"task step '{step['name']}' failed with exit " \ f"code: {exit_code} " \ f"and reason: '{reason}'" else: task_condition = stats['status']['conditions'][0] err_message += f"task run '{task_name}' failed with reason:" \ f" '{task_condition['reason']}' and message:" \ f" '{task_condition['message']}'" if not task_runs_status: pipeline_run_condition = data['status']['conditions'][0] err_message += f"pipeline run {self.pipeline_run_name} failed with reason:" \ f" '{pipeline_run_condition['reason']}' and message:" \ f" '{pipeline_run_condition['message']}'" return err_message def has_succeeded(self): return self.status_reason == 'Succeeded' def has_not_finished(self): return self.status_status == 'Unknown' and self.status_reason != 'PipelineRunCancelled' def was_cancelled(self): return self.status_reason == 'PipelineRunCancelled' @property def annotations(self): data = self.data if not data: return None return data['metadata']['annotations'] @property def labels(self): data = self.data if not data: return None return data['metadata']['labels'] @property def status_reason(self): data = self.data if not data: return None return data['status']['conditions'][0]['reason'] @property def status_status(self): data = self.data if not data: return None return data['status']['conditions'][0]['status'] def wait_for_start(self): """ https://tekton.dev/docs/pipelines/pipelineruns/#monitoring-execution-status """ logger.info("Waiting for pipeline run '%s' to start", self.pipeline_run_name) for pipeline_run in self.os.watch_resource( self.api_path, self.api_version, resource_type="pipelineruns", resource_name=self.pipeline_run_name, ): try: status = pipeline_run['status']['conditions'][0]['status'] reason = pipeline_run['status']['conditions'][0]['reason'] except KeyError: logger.error("pipeline run does not have any status") continue # pipeline run finished succesfully or failed if status in ['True', 'False']: return pipeline_run elif status == 'Unknown' and reason == 'Running': return pipeline_run else: # (Unknown, Started), (Unknown, PipelineRunCancelled) logger.debug("Waiting for pipeline run, current status %s, reason %s", status, reason) def wait_for_taskruns(self): """ This generator method watches new task runs in a pipeline run and yields newly started task runs. The reason we have to watch for changes is that at the start, the pipeline run does not have information about all of its task runs, especially when there are multiple sequential tasks. """ watched_task_runs = [] for pipeline_run in self.os.watch_resource( self.api_path, self.api_version, resource_type="pipelineruns", resource_name=self.pipeline_run_name, ): try: task_runs = pipeline_run['status']['taskRuns'] except KeyError: logger.error("pipeline run does not have any task runs") continue for task_run in task_runs: if task_run not in watched_task_runs: watched_task_runs.append(task_run) yield task_run # all task runs accounted for if len(pipeline_run['status']['pipelineSpec']['tasks']) == len(task_runs): return def _get_logs(self): logs = {} pipeline_run = self.data if not pipeline_run: return None task_runs = pipeline_run['status']['taskRuns'] for task_run in task_runs: logs[task_run] = TaskRun(os=self.os, task_run_name=task_run).get_logs() return logs def _get_logs_stream(self): self.wait_for_start() for task_run in self.wait_for_taskruns(): yield from TaskRun(os=self.os, task_run_name=task_run).get_logs( follow=True, wait=True) def get_logs(self, follow=False, wait=False): if wait or follow: return self._get_logs_stream() else: return self._get_logs() class TaskRun(): def __init__(self, os, task_run_name): self.os = os self.task_run_name = task_run_name self.api_path = 'apis' self.api_version = API_VERSION def get_info(self, wait=False): if wait: self.wait_for_start() url = self.os.build_url( self.api_path, self.api_version, f"taskruns/{self.task_run_name}" ) r = self.os.get(url) return r.json() def get_logs(self, follow=False, wait=False): if follow or wait: task_run = self.wait_for_start() else: task_run = self.get_info() pod_name = task_run['status']['podName'] containers = [step['container'] for step in task_run['status']['steps']] pod = Pod(os=self.os, pod_name=pod_name, containers=containers) return pod.get_logs(follow=follow, wait=wait) def wait_for_start(self): """ https://tekton.dev/docs/pipelines/taskruns/#monitoring-execution-status """ logger.info("Waiting for task run '%s' to start", self.task_run_name) for task_run in self.os.watch_resource( self.api_path, self.api_version, resource_type="taskruns", resource_name=self.task_run_name, ): try: status = task_run['status']['conditions'][0]['status'] reason = task_run['status']['conditions'][0]['reason'] except KeyError: logger.error("Task run does not have any status") continue # task run finished succesfully or failed if status in ['True', 'False']: return task_run elif status == 'Unknown' and reason == 'Running': return task_run else: # (Unknown, Started), (Unknown, Pending), (Unknown, TaskRunCancelled) logger.debug("Waiting for task run, current status: %s, reason %s", status, reason) class Pod(): def __init__(self, os, pod_name, containers=None): self.os = os self.pod_name = pod_name self.containers = containers self.api_version = 'v1' self.api_path = 'api' def get_info(self, wait=False): if wait: self.wait_for_start() url = self.os.build_url( self.api_path, self.api_version, f"pods/{self.pod_name}" ) r = self.os.get(url) return r.json() def _get_logs_no_container(self): url = self.os.build_url( self.api_path, self.api_version, f"pods/{self.pod_name}/log" ) r = self.os.get(url) check_response(r) return r.content.decode('utf-8') def _get_logs(self): logs = {} for container in self.containers: kwargs = {'container': container} logger.debug("Getting log for container %s", container) url = self.os.build_url( self.api_path, self.api_version, f"pods/{self.pod_name}/log", **kwargs ) r = self.os.get(url) check_response(r) logs[container] = r.content.decode('utf-8') return logs def _get_logs_stream(self): self.wait_for_start() for container in self.containers: yield from self._stream_logs(container) def get_logs(self, follow=False, wait=False): if follow or wait: return self._get_logs_stream() if self.containers: return self._get_logs() else: return self._get_logs_no_container() def _stream_logs(self, container): kwargs = {'follow': True} if container: kwargs['container'] = container # If connection is closed within this many seconds, give up: min_idle_timeout = 60 # Stream logs, but be careful of the connection closing # due to idle timeout. In that case, try again until the # call returns more quickly than a reasonable timeout # would be set to. while True: connected = time.time() url = self.os.build_url( self.api_path, self.api_version, f"pods/{self.pod_name}/log", **kwargs ) try: logger.debug('Streaming logs for container %s', container) response = self.os.get(url, stream=True, headers={'Connection': 'close'}) check_response(response) for line in response.iter_lines(): connected = time.time() yield line.decode('utf-8') # NOTE1: If self.get causes ChunkedEncodingError, ConnectionError, # or IncompleteRead to be raised, they'll be wrapped in # OsbsNetworkException or OsbsException # NOTE2: If iter_lines causes ChunkedEncodingError # or IncompleteRead to be raised, it'll simply be silenced. # NOTE3: An exception may be raised from # check_response(). In this case, exception will be # wrapped in OsbsException or OsbsNetworkException, # inspect cause to detect ConnectionError. except OsbsException as exc: if not isinstance(exc.cause, requests.ConnectionError): raise except requests.exceptions.ConnectionError: pass idle = time.time() - connected logger.debug("connection closed after %ds", idle) if idle < min_idle_timeout: # Finish output return since = int(idle - 1) logger.debug("fetching logs starting from %ds ago", since) kwargs['sinceSeconds'] = since def wait_for_start(self): logger.info("Waiting for pod to start '%s'", self.pod_name) for pod in self.os.watch_resource( self.api_path, self.api_version, resource_type="pods", resource_name=self.pod_name ): try: status = pod['status']['phase'] except KeyError: logger.error("Pod does not have any status") continue if status in ['Running', 'Succeeded', 'Failed']: return pod else: # unknown or pending logger.debug("Waiting for pod, current state: %s", status)
[ 1, 9995, 13, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 29892, 29871, 29906, 29900, 29896, 29929, 29892, 29871, 29906, 29900, 29906, 29896, 4367, 25966, 29892, 9266, 13, 3596, 10462, 21676, 29889, 13, 4013, 7047, 1122, 367, 9120, 322, 13235, 1090, 278, 4958, 13, 974, 278, 350, 7230, 19405, 29889, 2823, 278, 365, 2965, 1430, 1660, 934, 363, 4902, 29889, 13, 15945, 29908, 13, 5215, 4390, 13, 5215, 931, 13, 5215, 12183, 13, 5215, 2967, 29953, 29946, 13, 5215, 2897, 13, 5215, 7274, 13, 5215, 3509, 13, 13, 13, 3166, 2897, 5824, 29889, 11739, 29879, 1053, 6657, 5824, 5103, 2451, 29892, 6657, 5824, 6444, 2451, 29892, 6657, 5824, 2451, 13, 3166, 2897, 5824, 29889, 3075, 1934, 1053, 313, 23397, 29918, 5813, 5550, 11538, 29892, 26996, 19059, 2477, 18736, 29918, 1660, 22245, 29911, 29892, 26996, 19059, 2477, 18736, 29918, 4986, 29968, 1430, 29892, 13, 462, 9651, 26996, 19059, 2477, 18736, 29918, 29907, 2477, 13079, 29897, 13, 3166, 2897, 5824, 29889, 359, 5824, 29918, 1124, 1053, 9056, 7317, 13, 3166, 2897, 5824, 29889, 3946, 495, 359, 29918, 617, 1829, 1053, 13023, 495, 359, 29918, 617, 1829, 29918, 2344, 13, 3166, 2897, 5824, 29889, 13239, 1053, 337, 2202, 29918, 265, 29918, 5527, 29176, 13, 3166, 3142, 1982, 29889, 5510, 1053, 3142, 7122, 29892, 3142, 12508, 29892, 3142, 5510, 29892, 6088, 29918, 29939, 29879, 13, 3166, 7274, 29889, 13239, 1053, 4140, 29918, 3126, 29918, 9420, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 29937, 4649, 719, 1269, 3957, 4218, 1156, 29871, 29945, 6923, 29892, 363, 263, 7472, 310, 29871, 29896, 29900, 3064, 13, 29956, 14789, 29918, 1525, 5659, 29979, 29918, 1660, 9295, 353, 29871, 29945, 13, 29956, 14789, 29918, 1525, 5659, 29979, 353, 29871, 29896, 29900, 13, 12648, 29918, 29933, 3035, 29918, 1525, 5550, 1164, 1660, 29903, 353, 399, 14789, 29918, 1525, 5659, 29979, 849, 29871, 29941, 13, 29937, 25538, 701, 1156, 29871, 29896, 29906, 6199, 13, 12982, 1806, 29918, 1525, 5659, 29979, 29918, 8187, 4574, 29903, 353, 29871, 29896, 29906, 13, 12982, 1806, 29918, 1525, 5659, 29979, 353, 399, 29909, 1806, 29918, 1525, 5659, 29979, 29918, 8187, 4574, 29903, 334, 29871, 29941, 29953, 29900, 29900, 849, 313, 29956, 14789, 29918, 1525, 5659, 29979, 29918, 1660, 9295, 334, 399, 14789, 29918, 1525, 5659, 29979, 29897, 13, 13, 8787, 29918, 16358, 353, 376, 12681, 880, 29889, 3359, 29914, 29894, 29896, 3571, 29896, 29908, 13, 13, 13, 1753, 1423, 29918, 5327, 29898, 5327, 29892, 1480, 29918, 5563, 29922, 21027, 29889, 11432, 1125, 13, 1678, 565, 2933, 29889, 4882, 29918, 401, 451, 297, 313, 13, 9651, 7274, 29889, 4882, 29918, 18137, 29889, 18137, 29889, 554, 29892, 13, 9651, 7274, 29889, 4882, 29918, 18137, 29889, 18137, 29889, 11600, 29892, 13, 268, 1125, 13, 4706, 565, 756, 5552, 29898, 5327, 29892, 525, 3051, 29374, 13, 9651, 2793, 353, 2933, 29889, 3051, 13, 4706, 1683, 29901, 13, 9651, 2793, 353, 289, 29915, 4286, 7122, 29898, 5327, 29889, 1524, 29918, 9012, 3101, 13, 13, 4706, 17927, 29889, 1188, 29898, 1188, 29918, 5563, 29892, 14704, 29995, 29881, 29962, 1273, 29879, 613, 2933, 29889, 4882, 29918, 401, 29892, 2793, 29897, 13, 4706, 12020, 6657, 5824, 5103, 2451, 29898, 4906, 29922, 3051, 29892, 4660, 29918, 401, 29922, 5327, 29889, 4882, 29918, 401, 29897, 13, 13, 13, 1990, 6461, 575, 29882, 2027, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13246, 29882, 2027, 29918, 2754, 29918, 2271, 29892, 13246, 29882, 2027, 29918, 23106, 29918, 2271, 29892, 13, 462, 413, 29947, 29879, 29918, 2754, 29918, 2271, 29922, 8516, 29892, 13, 462, 26952, 29922, 8824, 29892, 8952, 29922, 8516, 29892, 4800, 29922, 8516, 29892, 671, 29918, 3946, 495, 359, 29922, 8824, 29892, 13, 462, 13023, 495, 359, 29918, 1989, 3891, 29922, 8516, 29892, 13023, 495, 359, 29918, 558, 26706, 29922, 8516, 29892, 13023, 495, 359, 29918, 617, 1829, 29922, 8516, 29892, 13, 462, 3132, 29918, 6327, 29922, 8516, 29892, 3132, 29918, 1989, 29922, 8516, 29892, 11539, 29918, 16265, 29922, 5574, 29892, 671, 29918, 5150, 29922, 8516, 29892, 13, 462, 5993, 29922, 8516, 29892, 7397, 29922, 23397, 29918, 5813, 5550, 11538, 1125, 13, 4706, 1583, 29889, 359, 29918, 2754, 29918, 2271, 353, 13246, 29882, 2027, 29918, 2754, 29918, 2271, 13, 4706, 1583, 29889, 29895, 29947, 29879, 29918, 2754, 29918, 2271, 353, 413, 29947, 29879, 29918, 2754, 29918, 2271, 13, 4706, 1583, 3032, 359, 29918, 23106, 29918, 2271, 353, 13246, 29882, 2027, 29918, 23106, 29918, 2271, 13, 4706, 1583, 29889, 22377, 353, 7397, 13, 4706, 1583, 29889, 369, 15828, 353, 26952, 13, 4706, 1583, 29889, 27902, 29918, 16265, 353, 11539, 29918, 16265, 13, 4706, 1583, 3032, 535, 353, 9056, 7317, 29898, 369, 15828, 29922, 1311, 29889, 369, 15828, 29897, 13, 4706, 1583, 29889, 2267, 2722, 29918, 17590, 353, 5852, 13, 13, 4706, 396, 4817, 6433, 13, 4706, 1583, 29889, 1509, 29918, 3946, 495, 359, 353, 671, 29918, 3946, 495, 359, 13, 4706, 1583, 29889, 6786, 353, 8952, 13, 4706, 1583, 29889, 5630, 353, 4800, 13, 4706, 1583, 29889, 4645, 29918, 6327, 353, 3132, 29918, 6327, 13, 4706, 1583, 29889, 4645, 29918, 1989, 353, 3132, 29918, 1989, 13, 4706, 1583, 29889, 3946, 495, 359, 29918, 1989, 3891, 353, 13023, 495, 359, 29918, 1989, 3891, 13, 4706, 1583, 29889, 3946, 495, 359, 29918, 558, 26706, 353, 13023, 495, 359, 29918, 558, 26706, 13, 4706, 1583, 29889, 3946, 495, 359, 29918, 617, 1829, 353, 13023, 495, 359, 29918, 617, 1829, 13, 4706, 1583, 29889, 6979, 353, 5993, 13, 13, 4706, 1583, 29889, 1113, 353, 6213, 13, 4706, 4817, 29918, 11944, 9409, 29918, 16123, 2618, 353, 6120, 29898, 1509, 29918, 3946, 495, 359, 470, 13, 462, 462, 308, 5993, 470, 13, 462, 462, 308, 313, 6786, 322, 4800, 876, 13, 4706, 565, 671, 29918, 5150, 338, 6213, 29901, 13, 9651, 1583, 29889, 1509, 29918, 5150, 353, 4817, 29918, 11944, 9409, 29918, 16123, 2618, 13, 9651, 565, 451, 1583, 29889, 1509, 29918, 5150, 29901, 13, 18884, 396, 4683, 591, 2734, 2768, 263, 2532, 29973, 960, 577, 29892, 591, 674, 505, 263, 13, 18884, 396, 5993, 3625, 607, 508, 367, 1304, 363, 10760, 13, 18884, 1583, 29889, 1509, 29918, 5150, 353, 1583, 29889, 3068, 29918, 1509, 29918, 5509, 10149, 29918, 6979, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1509, 29918, 5150, 353, 671, 29918, 5150, 13, 9651, 565, 451, 4817, 29918, 11944, 9409, 29918, 16123, 2618, 29901, 13, 18884, 396, 1334, 29915, 345, 1063, 5429, 304, 671, 10760, 541, 694, 13, 18884, 396, 16140, 505, 1063, 2183, 29889, 2823, 565, 591, 29915, 276, 2734, 13, 18884, 396, 2768, 263, 2532, 29892, 322, 565, 577, 671, 278, 4944, 5993, 29889, 13, 18884, 1583, 29889, 3068, 29918, 1509, 29918, 5509, 10149, 29918, 6979, 580, 13, 13, 1678, 822, 508, 29918, 1509, 29918, 5509, 10149, 29918, 6979, 29898, 1311, 1125, 13, 4706, 1018, 29901, 13, 9651, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 6304, 19059, 2477, 18736, 29918, 1660, 22245, 29911, 29892, 13, 462, 462, 259, 26996, 19059, 2477, 18736, 29918, 4986, 29968, 1430, 511, 13, 462, 418, 4464, 2433, 2273, 1495, 408, 15886, 29886, 29901, 13, 18884, 1583, 29889, 6979, 353, 15886, 29886, 29889, 949, 2141, 29878, 17010, 580, 13, 13, 9651, 5777, 353, 2897, 29889, 2084, 29889, 7122, 29898, 6304, 19059, 2477, 18736, 29918, 1660, 22245, 29911, 29892, 13, 462, 795, 26996, 19059, 2477, 18736, 29918, 29907, 2477, 13079, 29897, 13, 9651, 565, 2897, 29889, 5943, 29898, 1113, 29892, 2897, 29889, 29934, 29918, 8949, 1125, 13, 18884, 1583, 29889, 1113, 353, 5777, 13, 4706, 5174, 10663, 2392, 29901, 13, 9651, 396, 1939, 5993, 3625, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 396, 1334, 508, 15585, 403, 773, 278, 19056, 5993, 13, 9651, 17927, 29889, 3888, 703, 15156, 2669, 3633, 29915, 29879, 4817, 5993, 1159, 13, 9651, 736, 5852, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2897, 29918, 23106, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 359, 29918, 23106, 29918, 2271, 13, 13, 1678, 822, 903, 4282, 29918, 29895, 29947, 29879, 29918, 2271, 29898, 1311, 29892, 3142, 29892, 903, 1457, 14081, 29918, 22377, 29922, 5574, 29892, 3579, 1972, 1125, 13, 4706, 565, 903, 1457, 14081, 29918, 22377, 29901, 13, 9651, 3142, 353, 376, 7039, 22459, 22584, 29879, 22584, 29879, 29908, 1273, 313, 1311, 29889, 22377, 29892, 3142, 29897, 13, 4706, 565, 2346, 29901, 13, 9651, 3142, 4619, 4852, 3026, 718, 3142, 12508, 29898, 1972, 876, 13, 4706, 736, 3142, 7122, 29898, 1311, 29889, 29895, 29947, 29879, 29918, 2754, 29918, 2271, 29892, 3142, 29897, 13, 13, 1678, 822, 2048, 29918, 2271, 29898, 1311, 29892, 7882, 29918, 2084, 29892, 7882, 29918, 3259, 29892, 3142, 29892, 903, 1457, 14081, 29918, 22377, 29922, 5574, 29892, 3579, 1972, 1125, 13, 4706, 565, 903, 1457, 14081, 29918, 22377, 29901, 13, 9651, 3142, 353, 376, 7039, 22459, 22584, 29879, 22584, 29879, 29908, 1273, 313, 1311, 29889, 22377, 29892, 3142, 29897, 13, 4706, 565, 2346, 29901, 13, 9651, 3142, 4619, 4852, 3026, 718, 3142, 12508, 29898, 1972, 876, 13, 4706, 3142, 353, 285, 29908, 29912, 2754, 29918, 2084, 6822, 29912, 2754, 29918, 3259, 6822, 29912, 2271, 5038, 13, 4706, 736, 3142, 7122, 29898, 1311, 29889, 359, 29918, 2754, 29918, 2271, 29892, 3142, 29897, 13, 13, 1678, 822, 903, 3827, 29918, 5085, 29898, 1311, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 353, 9049, 5085, 29889, 7323, 703, 13662, 613, 426, 1800, 13, 4706, 565, 411, 29918, 5150, 322, 1583, 29889, 1509, 29918, 5150, 29901, 13, 9651, 565, 1583, 29889, 6979, 338, 6213, 29901, 13, 18884, 1583, 29889, 657, 29918, 23106, 29918, 6979, 580, 13, 9651, 565, 1583, 29889, 6979, 29901, 13, 18884, 9066, 3366, 25471, 3108, 353, 376, 29933, 799, 261, 1273, 29879, 29908, 1273, 1583, 29889, 6979, 13, 9651, 1683, 29901, 13, 18884, 12020, 6657, 5824, 6444, 2451, 703, 12148, 1423, 596, 16140, 29889, 376, 13, 462, 462, 4706, 376, 6066, 471, 451, 27387, 8472, 23157, 13, 13, 4706, 396, 4803, 278, 3132, 12289, 1716, 363, 278, 438, 6444, 2009, 322, 4673, 29657, 13, 4706, 396, 3450, 7274, 29889, 18410, 8021, 4817, 508, 367, 1304, 408, 385, 8671, 304, 13, 4706, 396, 438, 6444, 29892, 3138, 263, 10483, 988, 896, 526, 1304, 304, 679, 438, 6444, 5993, 338, 13, 4706, 396, 884, 1950, 29889, 18410, 8021, 338, 451, 2665, 746, 1923, 947, 451, 2009, 372, 29889, 13, 4706, 565, 1583, 29889, 4645, 29918, 6327, 470, 1583, 29889, 4645, 29918, 1989, 29901, 13, 9651, 565, 1583, 29889, 4645, 29918, 6327, 322, 1583, 29889, 4645, 29918, 1989, 29901, 13, 18884, 9049, 5085, 3366, 4645, 29918, 6327, 3108, 353, 1583, 29889, 4645, 29918, 6327, 13, 18884, 9049, 5085, 3366, 4645, 29918, 1989, 3108, 353, 1583, 29889, 4645, 29918, 1989, 13, 9651, 1683, 29901, 13, 18884, 12020, 6657, 5824, 6444, 2451, 703, 3492, 817, 304, 3867, 1716, 3132, 12289, 322, 1820, 23157, 13, 13, 4706, 396, 1938, 591, 505, 263, 5777, 29889, 29883, 2273, 29973, 960, 577, 29892, 671, 372, 13, 4706, 565, 1583, 29889, 27902, 29918, 16265, 322, 1583, 29889, 1113, 338, 451, 6213, 29901, 13, 9651, 9049, 5085, 3366, 1113, 3108, 353, 1583, 29889, 1113, 13, 13, 4706, 736, 9066, 29892, 9049, 5085, 13, 13, 1678, 822, 1400, 29898, 1311, 29892, 3142, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 29892, 9049, 5085, 353, 1583, 3032, 3827, 29918, 5085, 29898, 2541, 29918, 5150, 29892, 3579, 19290, 29897, 13, 4706, 736, 1583, 3032, 535, 29889, 2490, 29898, 13, 9651, 3142, 29892, 9066, 29922, 13662, 29892, 11539, 29918, 16265, 29922, 1311, 29889, 27902, 29918, 16265, 29892, 13, 9651, 3240, 2722, 29918, 17590, 29922, 1311, 29889, 2267, 2722, 29918, 17590, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29898, 1311, 29892, 3142, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 29892, 9049, 5085, 353, 1583, 3032, 3827, 29918, 5085, 29898, 2541, 29918, 5150, 29892, 3579, 19290, 29897, 13, 4706, 736, 1583, 3032, 535, 29889, 657, 29898, 13, 9651, 3142, 29892, 9066, 29922, 13662, 29892, 11539, 29918, 16265, 29922, 1311, 29889, 27902, 29918, 16265, 29892, 13, 9651, 3240, 2722, 29918, 17590, 29922, 1311, 29889, 2267, 2722, 29918, 17590, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 1925, 29898, 1311, 29892, 3142, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 29892, 9049, 5085, 353, 1583, 3032, 3827, 29918, 5085, 29898, 2541, 29918, 5150, 29892, 3579, 19290, 29897, 13, 4706, 736, 1583, 3032, 535, 29889, 649, 29898, 13, 9651, 3142, 29892, 9066, 29922, 13662, 29892, 11539, 29918, 16265, 29922, 1311, 29889, 27902, 29918, 16265, 29892, 13, 9651, 3240, 2722, 29918, 17590, 29922, 1311, 29889, 2267, 2722, 29918, 17590, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 13261, 29898, 1311, 29892, 3142, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 29892, 9049, 5085, 353, 1583, 3032, 3827, 29918, 5085, 29898, 2541, 29918, 5150, 29892, 3579, 19290, 29897, 13, 4706, 736, 1583, 3032, 535, 29889, 5041, 29898, 13, 9651, 3142, 29892, 9066, 29922, 13662, 29892, 11539, 29918, 16265, 29922, 1311, 29889, 27902, 29918, 16265, 29892, 13, 9651, 3240, 2722, 29918, 17590, 29922, 1311, 29889, 2267, 2722, 29918, 17590, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 3142, 29892, 411, 29918, 5150, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9066, 29892, 9049, 5085, 353, 1583, 3032, 3827, 29918, 5085, 29898, 2541, 29918, 5150, 29892, 3579, 19290, 29897, 13, 4706, 736, 1583, 3032, 535, 29889, 8143, 29898, 13, 9651, 3142, 29892, 9066, 29922, 13662, 29892, 11539, 29918, 16265, 29922, 1311, 29889, 27902, 29918, 16265, 29892, 13, 9651, 3240, 2722, 29918, 17590, 29922, 1311, 29889, 2267, 2722, 29918, 17590, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 23106, 29918, 6979, 29898, 1311, 1125, 13, 4706, 3142, 353, 1583, 29889, 359, 29918, 23106, 29918, 2271, 718, 376, 29973, 5327, 29918, 1853, 29922, 6979, 29987, 4645, 29918, 333, 29922, 22156, 29882, 2027, 29899, 305, 16047, 292, 29899, 4645, 29908, 13, 4706, 565, 1583, 29889, 1509, 29918, 5150, 29901, 13, 9651, 565, 1583, 29889, 6786, 322, 1583, 29889, 5630, 29901, 13, 18884, 17927, 29889, 8382, 703, 4746, 6996, 10760, 1159, 13, 18884, 364, 353, 1583, 29889, 657, 29898, 13, 462, 1678, 3142, 29892, 13, 462, 1678, 411, 29918, 5150, 29922, 8824, 29892, 13, 462, 1678, 2758, 29918, 17886, 29879, 29922, 8824, 29892, 13, 462, 1678, 8952, 29922, 1311, 29889, 6786, 29892, 13, 462, 1678, 4800, 29922, 29966, 25711, 17013, 10202, 13, 18884, 1723, 13, 9651, 25342, 1583, 29889, 1509, 29918, 3946, 495, 359, 29901, 13, 18884, 17927, 29889, 8382, 703, 4746, 13023, 495, 359, 10760, 1159, 13, 13, 18884, 565, 1583, 29889, 3946, 495, 359, 29918, 1989, 3891, 29901, 13, 462, 1678, 565, 451, 1583, 29889, 3946, 495, 359, 29918, 558, 26706, 29901, 13, 462, 4706, 12020, 6657, 5824, 6444, 2451, 703, 3492, 817, 304, 3867, 13023, 495, 359, 5882, 3412, 376, 13, 462, 462, 18884, 376, 2541, 278, 1820, 3891, 2224, 23157, 13, 462, 1678, 13023, 495, 359, 29918, 617, 1829, 29918, 2344, 29898, 1311, 29889, 3946, 495, 359, 29918, 558, 26706, 29892, 1583, 29889, 3946, 495, 359, 29918, 1989, 3891, 29892, 13, 462, 462, 308, 274, 8173, 29918, 1445, 29922, 1311, 29889, 3946, 495, 359, 29918, 617, 1829, 29897, 13, 13, 18884, 364, 353, 1583, 29889, 657, 29898, 2271, 29892, 411, 29918, 5150, 29922, 8824, 29892, 2758, 29918, 17886, 29879, 29922, 8824, 29892, 13023, 495, 359, 29918, 5150, 29922, 5574, 29897, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 8382, 703, 4746, 10110, 10760, 1159, 13, 18884, 364, 353, 1583, 29889, 657, 29898, 2271, 29892, 411, 29918, 5150, 29922, 8824, 29892, 2758, 29918, 17886, 29879, 29922, 8824, 29897, 13, 4706, 1683, 29901, 13, 9651, 17927, 29889, 8382, 703, 29264, 5993, 1728, 738, 10760, 313, 29888, 19936, 21692, 25760, 13, 9651, 364, 353, 1583, 29889, 657, 29898, 2271, 29892, 411, 29918, 5150, 29922, 8824, 29892, 2758, 29918, 17886, 29879, 29922, 8824, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 2654, 381, 29918, 2271, 353, 364, 29889, 13662, 1839, 5479, 2033, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 17927, 29889, 2704, 703, 29961, 29995, 29879, 29962, 525, 6508, 29915, 4839, 338, 4567, 297, 2933, 29892, 2609, 10563, 5993, 613, 13, 462, 308, 364, 29889, 4882, 29918, 401, 29897, 13, 9651, 736, 5124, 13, 4706, 21213, 29918, 2271, 353, 3142, 5510, 29898, 1127, 381, 29918, 2271, 29897, 13, 4706, 9376, 353, 21213, 29918, 2271, 29889, 20777, 13, 4706, 21213, 29918, 20777, 353, 6088, 29918, 29939, 29879, 29898, 20777, 29897, 13, 4706, 1583, 29889, 6979, 353, 21213, 29918, 20777, 1839, 5943, 29918, 6979, 2033, 29961, 29900, 29962, 13, 4706, 736, 1583, 29889, 6979, 13, 13, 1678, 822, 679, 29918, 5509, 10149, 29918, 517, 12360, 29898, 1311, 29892, 8952, 543, 30022, 29908, 1125, 13, 4706, 1121, 353, 6571, 13, 13, 4706, 3142, 353, 1583, 3032, 4282, 29918, 29895, 29947, 29879, 29918, 2271, 703, 5509, 10149, 29879, 22584, 29879, 12975, 1273, 8952, 29892, 903, 1457, 14081, 29918, 22377, 29922, 5574, 29897, 13, 4706, 2933, 353, 1583, 29889, 657, 29898, 2271, 29897, 13, 4706, 1423, 29918, 5327, 29898, 5327, 29897, 13, 4706, 872, 29918, 3126, 353, 2933, 29889, 3126, 580, 13, 4706, 565, 451, 872, 29918, 3126, 29901, 13, 9651, 736, 6571, 13, 13, 4706, 565, 525, 344, 1037, 1372, 29915, 451, 297, 872, 29918, 3126, 29889, 8149, 7295, 13, 9651, 17927, 29889, 8382, 703, 3782, 22183, 1372, 1476, 363, 2669, 3633, 1273, 29879, 613, 8952, 29897, 13, 9651, 736, 6571, 13, 13, 4706, 22183, 1372, 353, 872, 29918, 3126, 1839, 344, 1037, 1372, 2033, 13, 13, 4706, 363, 7035, 297, 22183, 1372, 29901, 13, 9651, 565, 525, 978, 29915, 451, 297, 7035, 29889, 8149, 7295, 13, 18884, 17927, 29889, 8382, 703, 22995, 15628, 7035, 5235, 29901, 4567, 525, 978, 29915, 1820, 297, 1273, 29878, 613, 13, 462, 632, 7035, 29897, 13, 18884, 6773, 13, 9651, 7035, 29918, 978, 353, 7035, 1839, 978, 2033, 13, 9651, 565, 525, 6979, 29915, 451, 297, 7035, 29918, 978, 29901, 13, 18884, 17927, 29889, 8382, 703, 28459, 1273, 29879, 338, 451, 263, 5993, 613, 7035, 29918, 978, 29897, 13, 18884, 6773, 13, 13, 9651, 3142, 353, 1583, 3032, 4282, 29918, 29895, 29947, 29879, 29918, 2271, 703, 344, 1037, 1372, 22584, 29879, 12975, 1273, 7035, 29918, 978, 29892, 903, 1457, 14081, 29918, 22377, 29922, 5574, 29897, 13, 9651, 2933, 353, 1583, 29889, 657, 29898, 2271, 29897, 13, 9651, 1423, 29918, 5327, 29898, 5327, 29897, 13, 13, 9651, 7035, 29918, 3126, 353, 2933, 29889, 3126, 580, 13, 9651, 565, 451, 7035, 29918, 3126, 29901, 13, 18884, 6773, 13, 9651, 565, 525, 1272, 29915, 451, 297, 7035, 29918, 3126, 29889, 8149, 7295, 13, 18884, 17927, 29889, 8382, 703, 22995, 15628, 7035, 5235, 29901, 4567, 525, 1272, 29915, 1820, 297, 1273, 29878, 613, 13, 462, 632, 4390, 29897, 13, 18884, 6773, 13, 13, 9651, 7035, 29918, 1272, 353, 7035, 29918, 3126, 1839, 1272, 2033, 13, 9651, 565, 525, 6979, 29915, 451, 297, 7035, 29918, 1272, 29889, 8149, 7295, 13, 18884, 17927, 29889, 8382, 703, 22995, 15628, 7035, 848, 29901, 4567, 525, 6979, 29915, 1820, 297, 1273, 29878, 613, 13, 462, 632, 7035, 29918, 1272, 29897, 13, 18884, 6773, 13, 13, 9651, 5993, 353, 7035, 29918, 1272, 1839, 6979, 2033, 13, 13, 9651, 396, 25159, 4225, 304, 367, 2967, 29953, 29946, 29899, 7099, 6797, 13, 9651, 1121, 29961, 19024, 29918, 978, 29962, 353, 2967, 29953, 29946, 29889, 29890, 29953, 29946, 13808, 29898, 6979, 29897, 13, 13, 4706, 736, 1121, 13, 13, 1678, 822, 6505, 29918, 10314, 29898, 1311, 29892, 7882, 29918, 2084, 29892, 7882, 29918, 3259, 29892, 6503, 29918, 1853, 29892, 6503, 29918, 978, 29892, 13, 462, 539, 3579, 3827, 29918, 5085, 1125, 13, 4706, 9995, 13, 4706, 24274, 363, 3620, 297, 13246, 29882, 2027, 1203, 322, 736, 372, 29915, 29879, 4390, 8954, 13, 4706, 1156, 1269, 2767, 304, 278, 1203, 13, 4706, 9995, 13, 4706, 822, 1480, 29918, 392, 29918, 17059, 7295, 13, 9651, 17927, 29889, 8382, 703, 9965, 5764, 29892, 337, 6915, 292, 297, 1273, 6289, 613, 399, 14789, 29918, 1525, 5659, 29979, 29918, 1660, 9295, 29897, 13, 9651, 931, 29889, 17059, 29898, 29956, 14789, 29918, 1525, 5659, 29979, 29918, 1660, 9295, 29897, 13, 13, 4706, 6505, 29918, 2084, 353, 285, 29908, 12344, 29914, 7039, 22459, 19248, 1311, 29889, 22377, 6822, 29912, 10314, 29918, 1853, 6822, 29912, 10314, 29918, 978, 6822, 29908, 13, 4706, 6505, 29918, 2271, 353, 1583, 29889, 4282, 29918, 2271, 29898, 13, 9651, 7882, 29918, 2084, 29892, 7882, 29918, 3259, 29892, 6505, 29918, 2084, 29892, 903, 1457, 14081, 29918, 22377, 29922, 8824, 29892, 3579, 3827, 29918, 5085, 13, 4706, 1723, 13, 4706, 679, 29918, 2271, 353, 1583, 29889, 4282, 29918, 2271, 29898, 2754, 29918, 2084, 29892, 7882, 29918, 3259, 29892, 13, 462, 462, 285, 29908, 29912, 10314, 29918, 1853, 6822, 29912, 10314, 29918, 978, 27195, 13, 13, 4706, 4319, 29918, 26679, 267, 353, 29871, 29900, 13, 4706, 363, 903, 297, 3464, 29898, 29956, 14789, 29918, 1525, 5659, 29979, 1125, 13, 9651, 17927, 29889, 8382, 703, 12344, 292, 363, 11217, 363, 1273, 29879, 29892, 1273, 29879, 613, 6503, 29918, 1853, 29892, 6503, 29918, 978, 29897, 13, 9651, 1018, 29901, 13, 18884, 2933, 353, 1583, 29889, 657, 29898, 12344, 29918, 2271, 29892, 4840, 29922, 5574, 29892, 13, 462, 462, 1678, 9066, 3790, 29915, 5350, 2396, 525, 5358, 29915, 1800, 13, 18884, 1423, 29918, 5327, 29898, 5327, 29897, 13, 9651, 396, 591, 29915, 276, 2307, 337, 2202, 292, 29892, 577, 727, 29915, 29879, 694, 817, 304, 7243, 293, 925, 1363, 310, 263, 4319, 2933, 13, 9651, 5174, 6657, 5824, 5103, 2451, 408, 5566, 29901, 13, 18884, 4319, 29918, 26679, 267, 4619, 29871, 29896, 13, 18884, 565, 4319, 29918, 26679, 267, 1405, 18134, 29918, 29933, 3035, 29918, 1525, 5550, 1164, 1660, 29903, 29901, 13, 462, 1678, 12020, 5566, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 1423, 29918, 5327, 580, 2307, 13817, 278, 2643, 29892, 577, 925, 3461, 393, 591, 29915, 276, 13, 462, 1678, 396, 8709, 292, 322, 337, 2202, 13, 462, 1678, 1480, 29918, 392, 29918, 17059, 580, 13, 462, 1678, 6773, 13, 13, 9651, 363, 1196, 297, 2933, 29889, 1524, 29918, 9012, 7295, 13, 18884, 8025, 353, 4140, 29918, 3126, 29918, 9420, 29898, 1220, 29897, 13, 18884, 1018, 29901, 13, 462, 1678, 432, 353, 4390, 29889, 18132, 29898, 1220, 29889, 13808, 29898, 22331, 876, 13, 18884, 5174, 7865, 2392, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 29089, 21822, 6505, 1741, 29901, 1273, 29879, 613, 1196, 29897, 13, 462, 1678, 6773, 13, 18884, 565, 525, 3318, 29915, 451, 297, 432, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 24709, 1741, 756, 694, 525, 3318, 2396, 1273, 29879, 613, 432, 29897, 13, 462, 1678, 6773, 13, 18884, 565, 525, 1853, 29915, 451, 297, 432, 29901, 13, 462, 1678, 17927, 29889, 2704, 703, 24709, 1741, 756, 694, 525, 1853, 2396, 1273, 29879, 613, 432, 29897, 13, 462, 1678, 6773, 13, 13, 18884, 396, 319, 5405, 19830, 29889, 1334, 29915, 345, 2307, 4433, 278, 1923, 304, 2649, 502, 13, 18884, 396, 1048, 3620, 304, 278, 1203, 29892, 541, 1286, 2244, 363, 263, 10849, 13, 18884, 396, 3509, 310, 278, 1203, 408, 1532, 29889, 910, 338, 304, 4380, 278, 13, 18884, 396, 6434, 988, 278, 1203, 3939, 1434, 278, 1246, 304, 13, 18884, 396, 445, 1158, 29892, 470, 297, 1546, 3240, 2722, 297, 445, 1158, 29889, 13, 18884, 17927, 29889, 8382, 703, 276, 509, 15387, 10849, 1873, 310, 1203, 1273, 29879, 613, 6503, 29918, 978, 29897, 13, 18884, 10849, 29918, 5327, 353, 1583, 29889, 657, 29898, 657, 29918, 2271, 29897, 13, 18884, 1423, 29918, 5327, 29898, 29888, 3781, 29918, 5327, 29897, 13, 18884, 7709, 10849, 29918, 5327, 29889, 3126, 580, 13, 13, 9651, 1480, 29918, 392, 29918, 17059, 580, 13, 13, 13, 1990, 349, 23828, 6558, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2897, 29892, 16439, 29918, 3389, 29918, 978, 29892, 16439, 29918, 3389, 29918, 1272, 29922, 8516, 1125, 13, 4706, 1583, 29889, 359, 353, 2897, 13, 4706, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 978, 353, 16439, 29918, 3389, 29918, 978, 13, 4706, 1583, 29889, 2754, 29918, 2084, 353, 525, 11355, 29915, 13, 4706, 1583, 29889, 2754, 29918, 3259, 353, 3450, 29918, 16358, 13, 4706, 1583, 29889, 2080, 29918, 1272, 353, 16439, 29918, 3389, 29918, 1272, 13, 4706, 1583, 3032, 13096, 5570, 29918, 3389, 29918, 2271, 353, 6213, 13, 4706, 1583, 29889, 1195, 3039, 29918, 1272, 353, 426, 13, 9651, 376, 2754, 6594, 1115, 3450, 29918, 16358, 29892, 13, 9651, 376, 14380, 1115, 376, 29925, 23828, 6558, 613, 13, 9651, 376, 19635, 1115, 8853, 978, 1115, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 978, 1118, 13, 9651, 376, 6550, 1115, 24335, 13, 4706, 500, 13, 13, 1678, 732, 6799, 13, 1678, 822, 848, 29898, 1311, 1125, 13, 4706, 396, 2337, 679, 10849, 5235, 13, 4706, 736, 1583, 29889, 657, 29918, 3888, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 16439, 29918, 3389, 29918, 2271, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 13096, 5570, 29918, 3389, 29918, 2271, 338, 6213, 29901, 13, 9651, 1583, 3032, 13096, 5570, 29918, 3389, 29918, 2271, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 285, 29908, 13096, 295, 4983, 6948, 19248, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 5038, 13, 9651, 1723, 13, 4706, 736, 1583, 3032, 13096, 5570, 29918, 3389, 29918, 2271, 13, 13, 1678, 822, 1369, 29918, 13096, 5570, 29918, 3389, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 29889, 2080, 29918, 1272, 29901, 13, 9651, 12020, 6657, 5824, 2451, 703, 3782, 1881, 848, 4944, 363, 16439, 1065, 304, 1369, 1159, 13, 13, 4706, 1065, 29918, 978, 353, 1583, 29889, 2080, 29918, 1272, 29889, 657, 877, 19635, 742, 6571, 467, 657, 877, 978, 1495, 13, 13, 4706, 565, 1065, 29918, 978, 2804, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29901, 13, 9651, 10191, 353, 285, 29908, 29925, 23828, 1065, 1024, 4944, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 10162, 338, 1422, 376, 320, 13, 462, 29871, 285, 29908, 27603, 297, 1881, 848, 22372, 3389, 29918, 978, 10162, 29908, 13, 9651, 12020, 6657, 5824, 2451, 29898, 7645, 29897, 13, 13, 4706, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 9651, 1583, 29889, 2754, 29918, 2084, 29892, 13, 9651, 1583, 29889, 2754, 29918, 3259, 29892, 13, 9651, 376, 13096, 295, 4983, 6948, 29908, 13, 4706, 1723, 13, 4706, 2933, 353, 1583, 29889, 359, 29889, 2490, 29898, 13, 9651, 3142, 29892, 13, 9651, 848, 29922, 3126, 29889, 29881, 17204, 29898, 1311, 29889, 2080, 29918, 1272, 511, 13, 9651, 9066, 3790, 29908, 3916, 29899, 1542, 1115, 376, 6214, 29914, 3126, 613, 376, 23965, 1115, 376, 6214, 29914, 3126, 10758, 13, 4706, 1723, 13, 4706, 736, 2933, 29889, 3126, 580, 13, 13, 1678, 822, 903, 3198, 29918, 5327, 29898, 1311, 29892, 2933, 29892, 9920, 1125, 13, 4706, 1018, 29901, 13, 9651, 1065, 29918, 3126, 353, 2933, 29889, 3126, 580, 13, 4706, 5174, 6657, 5824, 5103, 2451, 408, 429, 29901, 13, 9651, 565, 429, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 18884, 1065, 29918, 3126, 353, 6213, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 2704, 11702, 29879, 5229, 411, 584, 518, 29995, 29881, 29962, 1273, 29879, 613, 9920, 29892, 429, 29889, 4882, 29918, 401, 29892, 429, 29897, 13, 18884, 12020, 13, 13, 4706, 736, 1065, 29918, 3126, 13, 13, 1678, 732, 276, 2202, 29918, 265, 29918, 5527, 29176, 13, 1678, 822, 12611, 29918, 13096, 5570, 29918, 3389, 29898, 1311, 1125, 13, 4706, 848, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 1195, 3039, 29918, 1272, 29897, 13, 4706, 848, 1839, 6550, 16215, 4882, 2033, 353, 525, 29925, 23828, 6558, 19420, 839, 29915, 13, 13, 4706, 2933, 353, 1583, 29889, 359, 29889, 5041, 29898, 13, 9651, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 2271, 29892, 13, 9651, 848, 29922, 3126, 29889, 29881, 17204, 29898, 1272, 511, 13, 9651, 9066, 3790, 13, 18884, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 14634, 29899, 5041, 29974, 3126, 613, 13, 18884, 376, 23965, 1115, 376, 6214, 29914, 3126, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 4706, 10191, 353, 285, 29908, 20713, 16439, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 10162, 29908, 13, 4706, 5566, 29918, 7645, 353, 285, 29908, 29925, 23828, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 10162, 508, 29915, 29873, 367, 508, 346, 839, 29892, 376, 320, 13, 462, 29871, 285, 29908, 18103, 372, 1838, 29915, 29873, 1863, 29908, 13, 4706, 2933, 29918, 3126, 353, 1583, 3032, 3198, 29918, 5327, 29898, 5327, 29892, 10191, 29897, 13, 4706, 565, 451, 2933, 29918, 3126, 29901, 13, 9651, 12020, 6657, 5824, 2451, 29898, 735, 29883, 29918, 7645, 29897, 13, 4706, 736, 2933, 29918, 3126, 13, 13, 1678, 732, 276, 2202, 29918, 265, 29918, 5527, 29176, 13, 1678, 822, 2767, 29918, 21134, 29898, 1311, 29892, 11073, 1125, 13, 4706, 848, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 1195, 3039, 29918, 1272, 29897, 13, 4706, 848, 1839, 19635, 16215, 21134, 2033, 353, 11073, 13, 13, 4706, 2933, 353, 1583, 29889, 359, 29889, 5041, 29898, 13, 9651, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 2271, 29892, 13, 9651, 848, 29922, 3126, 29889, 29881, 17204, 29898, 1272, 511, 13, 9651, 9066, 3790, 13, 18884, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 14634, 29899, 5041, 29974, 3126, 613, 13, 18884, 376, 23965, 1115, 376, 6214, 29914, 3126, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 4706, 10191, 353, 285, 29908, 5504, 11073, 373, 16439, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 10162, 29908, 13, 4706, 5566, 29918, 7645, 353, 285, 29908, 6028, 29915, 29873, 2767, 11073, 373, 16439, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29913, 742, 376, 320, 13, 462, 29871, 285, 29908, 18103, 372, 1838, 29915, 29873, 1863, 29908, 13, 4706, 2933, 29918, 3126, 353, 1583, 3032, 3198, 29918, 5327, 29898, 5327, 29892, 10191, 29897, 13, 4706, 565, 451, 2933, 29918, 3126, 29901, 13, 9651, 12020, 6657, 5824, 2451, 29898, 735, 29883, 29918, 7645, 29897, 13, 4706, 736, 2933, 29918, 3126, 13, 13, 1678, 732, 276, 2202, 29918, 265, 29918, 5527, 29176, 13, 1678, 822, 2767, 29918, 6735, 800, 29898, 1311, 29892, 25495, 1125, 13, 4706, 848, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 1195, 3039, 29918, 1272, 29897, 13, 4706, 848, 1839, 19635, 16215, 6735, 800, 2033, 353, 25495, 13, 13, 4706, 2933, 353, 1583, 29889, 359, 29889, 5041, 29898, 13, 9651, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 2271, 29892, 13, 9651, 848, 29922, 3126, 29889, 29881, 17204, 29898, 1272, 511, 13, 9651, 9066, 3790, 13, 18884, 376, 3916, 29899, 1542, 1115, 376, 6214, 29914, 14634, 29899, 5041, 29974, 3126, 613, 13, 18884, 376, 23965, 1115, 376, 6214, 29914, 3126, 613, 13, 9651, 2981, 13, 4706, 1723, 13, 13, 4706, 10191, 353, 285, 29908, 5504, 25495, 373, 16439, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 10162, 29908, 13, 4706, 5566, 29918, 7645, 353, 285, 29908, 6028, 29915, 29873, 2767, 25495, 373, 16439, 1065, 22372, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29913, 742, 376, 320, 13, 462, 29871, 285, 29908, 18103, 372, 1838, 29915, 29873, 1863, 29908, 13, 4706, 2933, 29918, 3126, 353, 1583, 3032, 3198, 29918, 5327, 29898, 5327, 29892, 10191, 29897, 13, 4706, 565, 451, 2933, 29918, 3126, 29901, 13, 9651, 12020, 6657, 5824, 2451, 29898, 735, 29883, 29918, 7645, 29897, 13, 4706, 736, 2933, 29918, 3126, 13, 13, 1678, 822, 679, 29918, 3888, 29898, 1311, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 4480, 29901, 13, 9651, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 4706, 2933, 353, 1583, 29889, 359, 29889, 657, 29898, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 2271, 29897, 13, 13, 4706, 736, 1583, 3032, 3198, 29918, 5327, 29898, 5327, 29892, 525, 657, 29918, 3888, 1495, 13, 13, 1678, 822, 679, 29918, 2704, 29918, 4906, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 848, 29901, 13, 9651, 736, 6213, 13, 13, 4706, 25495, 353, 848, 1839, 19635, 16215, 6735, 800, 2033, 13, 13, 4706, 18224, 29918, 19635, 353, 25495, 29889, 657, 877, 12800, 29899, 19635, 1495, 13, 4706, 7079, 29918, 12523, 353, 6213, 13, 13, 4706, 565, 18224, 29918, 19635, 29901, 13, 9651, 15562, 29918, 8977, 353, 4390, 29889, 18132, 29898, 12800, 29918, 19635, 29897, 13, 9651, 7079, 29918, 12523, 353, 15562, 29918, 8977, 29889, 657, 877, 12523, 1495, 13, 13, 4706, 4589, 29918, 4906, 353, 5124, 13, 13, 4706, 565, 7079, 29918, 12523, 29901, 13, 9651, 4589, 29918, 4906, 353, 376, 8582, 4436, 3583, 29876, 29908, 13, 9651, 363, 7079, 29892, 1059, 297, 7079, 29918, 12523, 29889, 7076, 7295, 13, 18884, 4589, 29918, 4906, 4619, 285, 29908, 29912, 8582, 29913, 584, 426, 2704, 1012, 29876, 29908, 13, 13, 4706, 4589, 29918, 4906, 4619, 6634, 9302, 23828, 1065, 4436, 3583, 29876, 29908, 13, 13, 4706, 3414, 29918, 3389, 29879, 29918, 4882, 353, 848, 1839, 4882, 13359, 657, 877, 7662, 6558, 29879, 742, 426, 1800, 13, 13, 4706, 363, 3414, 29918, 978, 29892, 22663, 297, 3414, 29918, 3389, 29879, 29918, 4882, 29889, 7076, 7295, 13, 9651, 565, 22663, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 23147, 2033, 1275, 525, 29903, 1682, 3947, 287, 2396, 13, 18884, 6773, 13, 13, 9651, 4589, 29918, 4906, 4619, 285, 29908, 13096, 5570, 3414, 22372, 7662, 29918, 978, 10162, 5229, 3583, 29876, 29908, 13, 13, 9651, 565, 525, 24530, 29915, 297, 22663, 1839, 4882, 2033, 29901, 13, 18884, 363, 4331, 297, 22663, 1839, 4882, 16215, 24530, 2033, 29901, 13, 462, 1678, 6876, 29918, 401, 353, 4331, 1839, 18821, 630, 16215, 13322, 3399, 2033, 13, 462, 1678, 565, 6876, 29918, 401, 1275, 29871, 29900, 29901, 13, 462, 4706, 6773, 13, 13, 462, 1678, 2769, 353, 4331, 1839, 18821, 630, 16215, 23147, 2033, 13, 462, 1678, 4589, 29918, 4906, 4619, 285, 29908, 7662, 4331, 22372, 10568, 1839, 978, 2033, 10162, 5229, 411, 6876, 376, 320, 13, 462, 462, 259, 285, 29908, 401, 29901, 426, 13322, 29918, 401, 29913, 376, 320, 13, 462, 462, 259, 285, 29908, 392, 2769, 29901, 22372, 23147, 10162, 29908, 13, 9651, 1683, 29901, 13, 18884, 3414, 29918, 16122, 353, 22663, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 29962, 13, 18884, 4589, 29918, 4906, 4619, 285, 29908, 7662, 1065, 22372, 7662, 29918, 978, 10162, 5229, 411, 2769, 6160, 320, 13, 462, 1669, 285, 29908, 22372, 7662, 29918, 16122, 1839, 23147, 2033, 10162, 322, 2643, 6160, 320, 13, 462, 1669, 285, 29908, 22372, 7662, 29918, 16122, 1839, 4906, 2033, 10162, 29908, 13, 13, 4706, 565, 451, 3414, 29918, 3389, 29879, 29918, 4882, 29901, 13, 9651, 16439, 29918, 3389, 29918, 16122, 353, 848, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 29962, 13, 9651, 4589, 29918, 4906, 4619, 285, 29908, 13096, 5570, 1065, 426, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29913, 5229, 411, 2769, 6160, 320, 13, 462, 965, 285, 29908, 22372, 13096, 5570, 29918, 3389, 29918, 16122, 1839, 23147, 2033, 10162, 322, 2643, 6160, 320, 13, 462, 965, 285, 29908, 22372, 13096, 5570, 29918, 3389, 29918, 16122, 1839, 4906, 2033, 10162, 29908, 13, 13, 4706, 736, 4589, 29918, 4906, 13, 13, 1678, 822, 756, 29918, 29879, 1682, 3947, 287, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4882, 29918, 23147, 1275, 525, 29903, 1682, 3947, 287, 29915, 13, 13, 1678, 822, 756, 29918, 1333, 29918, 4951, 3276, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4882, 29918, 4882, 1275, 525, 14148, 29915, 322, 1583, 29889, 4882, 29918, 23147, 2804, 525, 29925, 23828, 6558, 19420, 839, 29915, 13, 13, 1678, 822, 471, 29918, 20713, 839, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 4882, 29918, 23147, 1275, 525, 29925, 23828, 6558, 19420, 839, 29915, 13, 13, 1678, 732, 6799, 13, 1678, 822, 25495, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 848, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 848, 1839, 19635, 16215, 6735, 800, 2033, 13, 13, 1678, 732, 6799, 13, 1678, 822, 11073, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 848, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 848, 1839, 19635, 16215, 21134, 2033, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4660, 29918, 23147, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 848, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 848, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 23147, 2033, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4660, 29918, 4882, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 848, 29901, 13, 9651, 736, 6213, 13, 4706, 736, 848, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 4882, 2033, 13, 13, 1678, 822, 4480, 29918, 1454, 29918, 2962, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2045, 597, 12681, 880, 29889, 3359, 29914, 2640, 29914, 13096, 24210, 29914, 13096, 295, 4983, 6948, 8484, 3712, 2105, 292, 29899, 22256, 29899, 4882, 13, 4706, 9995, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 16439, 1065, 14210, 29879, 29915, 304, 1369, 613, 1583, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29897, 13, 4706, 363, 16439, 29918, 3389, 297, 1583, 29889, 359, 29889, 12344, 29918, 10314, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 6503, 29918, 1853, 543, 13096, 295, 4983, 6948, 613, 13, 18884, 6503, 29918, 978, 29922, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29892, 13, 308, 1125, 13, 9651, 1018, 29901, 13, 18884, 4660, 353, 16439, 29918, 3389, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 4882, 2033, 13, 18884, 2769, 353, 16439, 29918, 3389, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 23147, 2033, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 17927, 29889, 2704, 703, 13096, 5570, 1065, 947, 451, 505, 738, 4660, 1159, 13, 18884, 6773, 13, 9651, 396, 16439, 1065, 7743, 8348, 267, 3730, 470, 5229, 13, 9651, 565, 4660, 297, 6024, 5574, 742, 525, 8824, 2033, 29901, 13, 18884, 736, 16439, 29918, 3389, 13, 9651, 25342, 4660, 1275, 525, 14148, 29915, 322, 2769, 1275, 525, 27795, 2396, 13, 18884, 736, 16439, 29918, 3389, 13, 9651, 1683, 29901, 13, 18884, 396, 313, 14148, 29892, 7370, 287, 511, 313, 14148, 29892, 349, 23828, 6558, 19420, 839, 29897, 13, 18884, 17927, 29889, 8382, 703, 15716, 292, 363, 16439, 1065, 29892, 1857, 4660, 1273, 29879, 29892, 2769, 1273, 29879, 613, 13, 462, 632, 4660, 29892, 2769, 29897, 13, 13, 1678, 822, 4480, 29918, 1454, 29918, 7662, 3389, 29879, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 910, 15299, 1158, 6505, 267, 716, 3414, 6057, 297, 263, 16439, 1065, 13, 4706, 322, 17498, 15141, 4687, 3414, 6057, 29889, 13, 4706, 450, 2769, 591, 505, 304, 6505, 363, 3620, 338, 393, 472, 278, 1369, 29892, 278, 16439, 1065, 13, 4706, 947, 451, 505, 2472, 1048, 599, 310, 967, 3414, 6057, 29892, 7148, 746, 727, 526, 2999, 13, 4706, 8617, 2556, 9595, 29889, 13, 4706, 9995, 13, 4706, 20654, 29918, 7662, 29918, 3389, 29879, 353, 5159, 13, 4706, 363, 16439, 29918, 3389, 297, 1583, 29889, 359, 29889, 12344, 29918, 10314, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 6503, 29918, 1853, 543, 13096, 295, 4983, 6948, 613, 13, 18884, 6503, 29918, 978, 29922, 1311, 29889, 13096, 5570, 29918, 3389, 29918, 978, 29892, 13, 308, 1125, 13, 9651, 1018, 29901, 13, 18884, 3414, 29918, 3389, 29879, 353, 16439, 29918, 3389, 1839, 4882, 16215, 7662, 6558, 29879, 2033, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 17927, 29889, 2704, 703, 13096, 5570, 1065, 947, 451, 505, 738, 3414, 6057, 1159, 13, 18884, 6773, 13, 9651, 363, 3414, 29918, 3389, 297, 3414, 29918, 3389, 29879, 29901, 13, 18884, 565, 3414, 29918, 3389, 451, 297, 20654, 29918, 7662, 29918, 3389, 29879, 29901, 13, 462, 1678, 20654, 29918, 7662, 29918, 3389, 29879, 29889, 4397, 29898, 7662, 29918, 3389, 29897, 13, 462, 1678, 7709, 3414, 29918, 3389, 13, 9651, 396, 599, 3414, 6057, 3633, 287, 363, 13, 9651, 565, 7431, 29898, 13096, 5570, 29918, 3389, 1839, 4882, 16215, 13096, 5570, 10299, 16215, 20673, 11287, 1275, 7431, 29898, 7662, 29918, 3389, 29879, 1125, 13, 18884, 736, 13, 13, 1678, 822, 903, 657, 29918, 20756, 29898, 1311, 1125, 13, 4706, 10748, 353, 6571, 13, 4706, 16439, 29918, 3389, 353, 1583, 29889, 1272, 13, 13, 4706, 565, 451, 16439, 29918, 3389, 29901, 13, 9651, 736, 6213, 13, 13, 4706, 3414, 29918, 3389, 29879, 353, 16439, 29918, 3389, 1839, 4882, 16215, 7662, 6558, 29879, 2033, 13, 4706, 363, 3414, 29918, 3389, 297, 3414, 29918, 3389, 29879, 29901, 13, 9651, 10748, 29961, 7662, 29918, 3389, 29962, 353, 9330, 6558, 29898, 359, 29922, 1311, 29889, 359, 29892, 3414, 29918, 3389, 29918, 978, 29922, 7662, 29918, 3389, 467, 657, 29918, 20756, 580, 13, 4706, 736, 10748, 13, 13, 1678, 822, 903, 657, 29918, 20756, 29918, 5461, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 4706, 363, 3414, 29918, 3389, 297, 1583, 29889, 10685, 29918, 1454, 29918, 7662, 3389, 29879, 7295, 13, 9651, 7709, 515, 9330, 6558, 29898, 359, 29922, 1311, 29889, 359, 29892, 3414, 29918, 3389, 29918, 978, 29922, 7662, 29918, 3389, 467, 657, 29918, 20756, 29898, 13, 18884, 1101, 29922, 5574, 29892, 4480, 29922, 5574, 29897, 13, 13, 1678, 822, 679, 29918, 20756, 29898, 1311, 29892, 1101, 29922, 8824, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 4480, 470, 1101, 29901, 13, 9651, 736, 1583, 3032, 657, 29918, 20756, 29918, 5461, 580, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 657, 29918, 20756, 580, 13, 13, 13, 1990, 9330, 6558, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2897, 29892, 3414, 29918, 3389, 29918, 978, 1125, 13, 4706, 1583, 29889, 359, 353, 2897, 13, 4706, 1583, 29889, 7662, 29918, 3389, 29918, 978, 353, 3414, 29918, 3389, 29918, 978, 13, 4706, 1583, 29889, 2754, 29918, 2084, 353, 525, 11355, 29915, 13, 4706, 1583, 29889, 2754, 29918, 3259, 353, 3450, 29918, 16358, 13, 13, 1678, 822, 679, 29918, 3888, 29898, 1311, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 4480, 29901, 13, 9651, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 13, 4706, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 9651, 1583, 29889, 2754, 29918, 2084, 29892, 13, 9651, 1583, 29889, 2754, 29918, 3259, 29892, 13, 9651, 285, 29908, 7662, 3389, 29879, 19248, 1311, 29889, 7662, 29918, 3389, 29918, 978, 5038, 13, 4706, 1723, 13, 4706, 364, 353, 1583, 29889, 359, 29889, 657, 29898, 2271, 29897, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 679, 29918, 20756, 29898, 1311, 29892, 1101, 29922, 8824, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 1101, 470, 4480, 29901, 13, 9651, 3414, 29918, 3389, 353, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 4706, 1683, 29901, 13, 9651, 3414, 29918, 3389, 353, 1583, 29889, 657, 29918, 3888, 580, 13, 13, 4706, 2532, 29918, 978, 353, 3414, 29918, 3389, 1839, 4882, 16215, 15334, 1170, 2033, 13, 4706, 22637, 353, 518, 10568, 1839, 7611, 2033, 363, 4331, 297, 3414, 29918, 3389, 1839, 4882, 16215, 24530, 2033, 29962, 13, 4706, 2532, 353, 8594, 29898, 359, 29922, 1311, 29889, 359, 29892, 2532, 29918, 978, 29922, 15334, 29918, 978, 29892, 22637, 29922, 1285, 475, 414, 29897, 13, 4706, 736, 2532, 29889, 657, 29918, 20756, 29898, 23031, 29922, 23031, 29892, 4480, 29922, 10685, 29897, 13, 13, 1678, 822, 4480, 29918, 1454, 29918, 2962, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2045, 597, 12681, 880, 29889, 3359, 29914, 2640, 29914, 13096, 24210, 29914, 7662, 3389, 29879, 8484, 3712, 2105, 292, 29899, 22256, 29899, 4882, 13, 4706, 9995, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 3414, 1065, 14210, 29879, 29915, 304, 1369, 613, 1583, 29889, 7662, 29918, 3389, 29918, 978, 29897, 13, 4706, 363, 3414, 29918, 3389, 297, 1583, 29889, 359, 29889, 12344, 29918, 10314, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 6503, 29918, 1853, 543, 7662, 3389, 29879, 613, 13, 18884, 6503, 29918, 978, 29922, 1311, 29889, 7662, 29918, 3389, 29918, 978, 29892, 13, 308, 1125, 13, 9651, 1018, 29901, 13, 18884, 4660, 353, 3414, 29918, 3389, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 4882, 2033, 13, 18884, 2769, 353, 3414, 29918, 3389, 1839, 4882, 16215, 1116, 2187, 2033, 29961, 29900, 22322, 23147, 2033, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 17927, 29889, 2704, 703, 5398, 1065, 947, 451, 505, 738, 4660, 1159, 13, 18884, 6773, 13, 9651, 396, 3414, 1065, 7743, 8348, 267, 3730, 470, 5229, 13, 9651, 565, 4660, 297, 6024, 5574, 742, 525, 8824, 2033, 29901, 13, 18884, 736, 3414, 29918, 3389, 13, 9651, 25342, 4660, 1275, 525, 14148, 29915, 322, 2769, 1275, 525, 27795, 2396, 13, 18884, 736, 3414, 29918, 3389, 13, 9651, 1683, 29901, 13, 18884, 396, 313, 14148, 29892, 7370, 287, 511, 313, 14148, 29892, 349, 2548, 511, 313, 14148, 29892, 9330, 6558, 19420, 839, 29897, 13, 18884, 17927, 29889, 8382, 703, 15716, 292, 363, 3414, 1065, 29892, 1857, 4660, 29901, 1273, 29879, 29892, 2769, 1273, 29879, 613, 4660, 29892, 2769, 29897, 13, 13, 13, 1990, 8594, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2897, 29892, 2532, 29918, 978, 29892, 22637, 29922, 8516, 1125, 13, 4706, 1583, 29889, 359, 353, 2897, 13, 4706, 1583, 29889, 15334, 29918, 978, 353, 2532, 29918, 978, 13, 4706, 1583, 29889, 1285, 475, 414, 353, 22637, 13, 4706, 1583, 29889, 2754, 29918, 3259, 353, 525, 29894, 29896, 29915, 13, 4706, 1583, 29889, 2754, 29918, 2084, 353, 525, 2754, 29915, 13, 13, 1678, 822, 679, 29918, 3888, 29898, 1311, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 4480, 29901, 13, 9651, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 4706, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 9651, 1583, 29889, 2754, 29918, 2084, 29892, 13, 9651, 1583, 29889, 2754, 29918, 3259, 29892, 13, 9651, 285, 29908, 15334, 29879, 19248, 1311, 29889, 15334, 29918, 978, 5038, 13, 4706, 1723, 13, 4706, 364, 353, 1583, 29889, 359, 29889, 657, 29898, 2271, 29897, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 903, 657, 29918, 20756, 29918, 1217, 29918, 7611, 29898, 1311, 1125, 13, 4706, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 9651, 1583, 29889, 2754, 29918, 2084, 29892, 13, 9651, 1583, 29889, 2754, 29918, 3259, 29892, 13, 9651, 285, 29908, 15334, 29879, 19248, 1311, 29889, 15334, 29918, 978, 6822, 1188, 29908, 13, 4706, 1723, 13, 4706, 364, 353, 1583, 29889, 359, 29889, 657, 29898, 2271, 29897, 13, 4706, 1423, 29918, 5327, 29898, 29878, 29897, 13, 4706, 736, 364, 29889, 3051, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 13, 1678, 822, 903, 657, 29918, 20756, 29898, 1311, 1125, 13, 4706, 10748, 353, 6571, 13, 4706, 363, 5639, 297, 1583, 29889, 1285, 475, 414, 29901, 13, 9651, 9049, 5085, 353, 11117, 7611, 2396, 5639, 29913, 13, 9651, 17927, 29889, 8382, 703, 2577, 1259, 1480, 363, 5639, 1273, 29879, 613, 5639, 29897, 13, 9651, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 285, 29908, 15334, 29879, 19248, 1311, 29889, 15334, 29918, 978, 6822, 1188, 613, 13, 18884, 3579, 19290, 13, 9651, 1723, 13, 9651, 364, 353, 1583, 29889, 359, 29889, 657, 29898, 2271, 29897, 13, 9651, 1423, 29918, 5327, 29898, 29878, 29897, 13, 9651, 10748, 29961, 7611, 29962, 353, 364, 29889, 3051, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 4706, 736, 10748, 13, 13, 1678, 822, 903, 657, 29918, 20756, 29918, 5461, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10685, 29918, 1454, 29918, 2962, 580, 13, 4706, 363, 5639, 297, 1583, 29889, 1285, 475, 414, 29901, 13, 9651, 7709, 515, 1583, 3032, 5461, 29918, 20756, 29898, 7611, 29897, 13, 13, 1678, 822, 679, 29918, 20756, 29898, 1311, 29892, 1101, 29922, 8824, 29892, 4480, 29922, 8824, 1125, 13, 4706, 565, 1101, 470, 4480, 29901, 13, 9651, 736, 1583, 3032, 657, 29918, 20756, 29918, 5461, 580, 13, 4706, 565, 1583, 29889, 1285, 475, 414, 29901, 13, 9651, 736, 1583, 3032, 657, 29918, 20756, 580, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 3032, 657, 29918, 20756, 29918, 1217, 29918, 7611, 580, 13, 13, 1678, 822, 903, 5461, 29918, 20756, 29898, 1311, 29892, 5639, 1125, 13, 4706, 9049, 5085, 353, 11117, 23031, 2396, 5852, 29913, 13, 4706, 565, 5639, 29901, 13, 9651, 9049, 5085, 1839, 7611, 2033, 353, 5639, 13, 13, 4706, 396, 960, 3957, 338, 5764, 2629, 445, 1784, 6923, 29892, 2367, 701, 29901, 13, 4706, 1375, 29918, 333, 280, 29918, 15619, 353, 29871, 29953, 29900, 13, 13, 4706, 396, 13763, 10748, 29892, 541, 367, 16010, 310, 278, 3957, 14382, 13, 4706, 396, 2861, 304, 28132, 11815, 29889, 512, 393, 1206, 29892, 1018, 1449, 2745, 278, 13, 4706, 396, 1246, 3639, 901, 9098, 1135, 263, 15590, 11815, 13, 4706, 396, 723, 367, 731, 304, 29889, 13, 4706, 1550, 5852, 29901, 13, 9651, 6631, 353, 931, 29889, 2230, 580, 13, 9651, 3142, 353, 1583, 29889, 359, 29889, 4282, 29918, 2271, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 13, 18884, 1583, 29889, 2754, 29918, 3259, 29892, 13, 18884, 285, 29908, 15334, 29879, 19248, 1311, 29889, 15334, 29918, 978, 6822, 1188, 613, 13, 18884, 3579, 19290, 13, 9651, 1723, 13, 9651, 1018, 29901, 13, 18884, 17927, 29889, 8382, 877, 3835, 292, 10748, 363, 5639, 1273, 29879, 742, 5639, 29897, 13, 18884, 2933, 353, 1583, 29889, 359, 29889, 657, 29898, 2271, 29892, 4840, 29922, 5574, 29892, 13, 462, 462, 539, 9066, 3790, 29915, 5350, 2396, 525, 5358, 29915, 1800, 13, 18884, 1423, 29918, 5327, 29898, 5327, 29897, 13, 13, 18884, 363, 1196, 297, 2933, 29889, 1524, 29918, 9012, 7295, 13, 462, 1678, 6631, 353, 931, 29889, 2230, 580, 13, 462, 1678, 7709, 1196, 29889, 13808, 877, 9420, 29899, 29947, 1495, 13, 9651, 396, 6058, 29923, 29896, 29901, 960, 1583, 29889, 657, 9946, 678, 2960, 287, 14934, 2392, 29892, 15160, 2392, 29892, 13, 9651, 396, 470, 512, 8835, 6359, 304, 367, 10425, 29892, 896, 29915, 645, 367, 21021, 297, 13, 9651, 396, 6657, 5824, 13724, 2451, 470, 6657, 5824, 2451, 13, 9651, 396, 6058, 29923, 29906, 29901, 960, 4256, 29918, 9012, 9946, 678, 2960, 287, 14934, 2392, 13, 9651, 396, 470, 512, 8835, 6359, 304, 367, 10425, 29892, 372, 29915, 645, 3763, 367, 4047, 9223, 29889, 13, 9651, 396, 6058, 29923, 29941, 29901, 530, 3682, 1122, 367, 10425, 515, 13, 9651, 396, 1423, 29918, 5327, 2141, 512, 445, 1206, 29892, 3682, 674, 367, 13, 9651, 396, 21021, 297, 6657, 5824, 2451, 470, 6657, 5824, 13724, 2451, 29892, 13, 9651, 396, 16096, 4556, 304, 6459, 15160, 2392, 29889, 13, 9651, 5174, 6657, 5824, 2451, 408, 5566, 29901, 13, 18884, 565, 451, 338, 8758, 29898, 735, 29883, 29889, 29883, 1071, 29892, 7274, 29889, 5350, 2392, 1125, 13, 462, 1678, 12020, 13, 9651, 5174, 7274, 29889, 11739, 29879, 29889, 5350, 2392, 29901, 13, 18884, 1209, 13, 13, 9651, 28132, 353, 931, 29889, 2230, 580, 448, 6631, 13, 9651, 17927, 29889, 8382, 703, 9965, 5764, 1156, 1273, 6289, 613, 28132, 29897, 13, 9651, 565, 28132, 529, 1375, 29918, 333, 280, 29918, 15619, 29901, 13, 18884, 396, 4231, 728, 1962, 13, 18884, 736, 13, 13, 9651, 1951, 353, 938, 29898, 333, 280, 448, 29871, 29896, 29897, 13, 9651, 17927, 29889, 8382, 703, 9155, 292, 10748, 6257, 515, 1273, 6289, 8020, 613, 1951, 29897, 13, 9651, 9049, 5085, 1839, 16076, 27535, 2033, 353, 1951, 13, 13, 1678, 822, 4480, 29918, 1454, 29918, 2962, 29898, 1311, 1125, 13, 4706, 17927, 29889, 3888, 703, 15716, 292, 363, 2532, 304, 1369, 14210, 29879, 29915, 613, 1583, 29889, 15334, 29918, 978, 29897, 13, 4706, 363, 2532, 297, 1583, 29889, 359, 29889, 12344, 29918, 10314, 29898, 13, 18884, 1583, 29889, 2754, 29918, 2084, 29892, 1583, 29889, 2754, 29918, 3259, 29892, 6503, 29918, 1853, 543, 15334, 29879, 613, 6503, 29918, 978, 29922, 1311, 29889, 15334, 29918, 978, 13, 308, 1125, 13, 9651, 1018, 29901, 13, 18884, 4660, 353, 2532, 1839, 4882, 16215, 21646, 2033, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 17927, 29889, 2704, 703, 27345, 947, 451, 505, 738, 4660, 1159, 13, 18884, 6773, 13, 9651, 565, 4660, 297, 6024, 27795, 742, 525, 29903, 1682, 3947, 287, 742, 525, 17776, 2033, 29901, 13, 18884, 736, 2532, 13, 9651, 1683, 29901, 13, 18884, 396, 9815, 470, 28235, 13, 18884, 17927, 29889, 8382, 703, 15716, 292, 363, 2532, 29892, 1857, 2106, 29901, 1273, 29879, 613, 4660, 29897, 13, 2 ]
src/ga4gh/vrs/_internal/models.py
GenomicMedLab/vrs-python
1
66937
<reponame>GenomicMedLab/vrs-python<filename>src/ga4gh/vrs/_internal/models.py """Generate VRS models at runtime from the json schema **This module should not be imported directly.** Instead, users should use one of the following: * `from ga4gh.vrs import models`, and refer to models with the abbreviated name, e.g., `models.Allele` (recommended) * `import ga4gh.vrs`, and refer to models using the fully-qualified module name, e.g., `ga4gh.vrs.models.Allele` This module reads the spec and generates classes at runtime. The advantage of this approach over models defined in code is that the models are always in sync with the spec. """ import logging import os import pkg_resources from ga4gh.core import build_models, build_class_referable_attribute_map _logger = logging.getLogger(__name__) # specify VRS_SCHEMA_DIR to use a schema other than the one embedded # in vrs-python schema_dir = os.environ.get("VRS_SCHEMA_DIR", pkg_resources.resource_filename(__name__, "data/schema")) schema_path = schema_dir + "/vrs.json" models = None class_refatt_map = None def _load_vrs_models(): """load/reload models from `schema_path` This function facilitates reloading changes to the schema during development. """ global class_refatt_map, models models = build_models(schema_path, standardize_names=False) class_refatt_map = build_class_referable_attribute_map(models) return models _load_vrs_models()
[ 1, 529, 276, 1112, 420, 29958, 15462, 25426, 19302, 28632, 29914, 29894, 2288, 29899, 4691, 29966, 9507, 29958, 4351, 29914, 3249, 29946, 12443, 29914, 29894, 2288, 19891, 7564, 29914, 9794, 29889, 2272, 13, 15945, 29908, 5631, 403, 478, 12445, 4733, 472, 10073, 515, 278, 4390, 10938, 13, 13, 1068, 4013, 3883, 881, 451, 367, 19673, 4153, 29889, 1068, 13, 13, 3379, 1479, 29892, 4160, 881, 671, 697, 310, 278, 1494, 29901, 13, 13, 29871, 334, 421, 3166, 10364, 29946, 12443, 29889, 29894, 2288, 1053, 4733, 1673, 322, 2737, 304, 4733, 411, 278, 13, 1678, 29759, 1403, 630, 1024, 29892, 321, 29889, 29887, 1696, 421, 9794, 29889, 2499, 280, 280, 29952, 313, 276, 2055, 2760, 29897, 13, 13, 29871, 334, 421, 5215, 10364, 29946, 12443, 29889, 29894, 2288, 1673, 322, 2737, 304, 4733, 773, 278, 8072, 29899, 15380, 2164, 13, 1678, 3883, 1024, 29892, 321, 29889, 29887, 1696, 421, 3249, 29946, 12443, 29889, 29894, 2288, 29889, 9794, 29889, 2499, 280, 280, 29952, 13, 13, 13, 4013, 3883, 13623, 278, 1580, 322, 16785, 4413, 472, 10073, 29889, 29871, 450, 13, 17263, 8501, 310, 445, 2948, 975, 4733, 3342, 297, 775, 338, 393, 278, 13, 9794, 526, 2337, 297, 16523, 411, 278, 1580, 29889, 13, 13, 15945, 29908, 13, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 5215, 282, 9415, 29918, 13237, 13, 13, 3166, 10364, 29946, 12443, 29889, 3221, 1053, 2048, 29918, 9794, 29892, 2048, 29918, 1990, 29918, 20275, 519, 29918, 12715, 29918, 1958, 13, 13, 13, 29918, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 29937, 6084, 478, 12445, 29918, 29903, 3210, 26862, 29918, 9464, 304, 671, 263, 10938, 916, 1135, 278, 697, 15685, 13, 29937, 297, 325, 2288, 29899, 4691, 13, 11010, 29918, 3972, 353, 2897, 29889, 21813, 29889, 657, 703, 29963, 12445, 29918, 29903, 3210, 26862, 29918, 9464, 613, 282, 9415, 29918, 13237, 29889, 10314, 29918, 9507, 22168, 978, 1649, 29892, 376, 1272, 29914, 11010, 5783, 13, 11010, 29918, 2084, 353, 10938, 29918, 3972, 718, 5591, 29894, 2288, 29889, 3126, 29908, 13, 13, 9794, 353, 6213, 13, 1990, 29918, 999, 1131, 29918, 1958, 353, 6213, 13, 13, 1753, 903, 1359, 29918, 29894, 2288, 29918, 9794, 7295, 13, 1678, 9995, 1359, 29914, 28120, 4733, 515, 421, 11010, 29918, 2084, 29952, 13, 13, 1678, 910, 740, 16089, 277, 1078, 337, 13234, 3620, 304, 278, 10938, 2645, 13, 1678, 5849, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 5534, 770, 29918, 999, 1131, 29918, 1958, 29892, 4733, 13, 1678, 4733, 353, 2048, 29918, 9794, 29898, 11010, 29918, 2084, 29892, 3918, 675, 29918, 7039, 29922, 8824, 29897, 13, 1678, 770, 29918, 999, 1131, 29918, 1958, 353, 2048, 29918, 1990, 29918, 20275, 519, 29918, 12715, 29918, 1958, 29898, 9794, 29897, 13, 1678, 736, 4733, 13, 13, 13, 29918, 1359, 29918, 29894, 2288, 29918, 9794, 580, 13, 2 ]
tests/test_counters.py
automerge/automerge-py
11
174901
import json import unittest from automerge import doc from automerge.datatypes import Counter class TestCounters(unittest.TestCase): def test_make_counters_behave_like_primitive_numbers(self): d0 = doc.Doc(initial_data={"birds": Counter(3)}) self.assertEqual(d0["birds"], 3) self.assertTrue(d0["birds"] < 4) self.assertTrue(d0["birds"] >= 0) self.assertFalse(d0["birds"] <= 2) self.assertEqual(d0["birds"] + 10, 13) self.assertEqual(f"I saw {d0['birds']} birds", "I saw 3 birds") def test_allow_counters_to_be_serialized_to_JSON(self): d0 = doc.Doc(initial_data={"birds": Counter(0)}) s = json.dumps(d0.get_active_root_obj()) self.assertEqual(s, '{"birds": 0}')
[ 1, 1053, 4390, 13, 5215, 443, 27958, 13, 3166, 3345, 261, 479, 1053, 1574, 13, 3166, 3345, 261, 479, 29889, 4130, 271, 7384, 1053, 315, 5336, 13, 13, 13, 1990, 4321, 29907, 1309, 2153, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 5675, 29918, 29883, 1309, 2153, 29918, 915, 17532, 29918, 4561, 29918, 9469, 3321, 29918, 20326, 29898, 1311, 1125, 13, 4706, 270, 29900, 353, 1574, 29889, 14526, 29898, 11228, 29918, 1272, 3790, 29908, 18513, 29879, 1115, 315, 5336, 29898, 29941, 26972, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29881, 29900, 3366, 18513, 29879, 12436, 29871, 29941, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29881, 29900, 3366, 18513, 29879, 3108, 529, 29871, 29946, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29881, 29900, 3366, 18513, 29879, 3108, 6736, 29871, 29900, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 29881, 29900, 3366, 18513, 29879, 3108, 5277, 29871, 29906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29881, 29900, 3366, 18513, 29879, 3108, 718, 29871, 29896, 29900, 29892, 29871, 29896, 29941, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29888, 29908, 29902, 4446, 426, 29881, 29900, 1839, 18513, 29879, 2033, 29913, 17952, 613, 376, 29902, 4446, 29871, 29941, 17952, 1159, 13, 13, 1678, 822, 1243, 29918, 9536, 29918, 29883, 1309, 2153, 29918, 517, 29918, 915, 29918, 15550, 1891, 29918, 517, 29918, 7249, 29898, 1311, 1125, 13, 4706, 270, 29900, 353, 1574, 29889, 14526, 29898, 11228, 29918, 1272, 3790, 29908, 18513, 29879, 1115, 315, 5336, 29898, 29900, 26972, 13, 4706, 269, 353, 4390, 29889, 29881, 17204, 29898, 29881, 29900, 29889, 657, 29918, 4925, 29918, 4632, 29918, 5415, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29879, 29892, 525, 6377, 18513, 29879, 1115, 29871, 29900, 29913, 1495, 13, 2 ]
env/lib/python3.4/site-packages/django_extensions/management/signals.py
dj-amadeous/deficit
11
194925
<filename>env/lib/python3.4/site-packages/django_extensions/management/signals.py """ signals we use to trigger regular batch jobs """ from django.dispatch import Signal run_minutely_jobs = Signal() run_quarter_hourly_jobs = Signal() run_hourly_jobs = Signal() run_daily_jobs = Signal() run_weekly_jobs = Signal() run_monthly_jobs = Signal() run_yearly_jobs = Signal() pre_command = Signal(providing_args=["args", "kwargs"]) post_command = Signal(providing_args=["args", "kwargs", "outcome"])
[ 1, 529, 9507, 29958, 6272, 29914, 1982, 29914, 4691, 29941, 29889, 29946, 29914, 2746, 29899, 8318, 29914, 14095, 29918, 24299, 29914, 21895, 29914, 4530, 1338, 29889, 2272, 13, 15945, 29908, 13, 4530, 1338, 591, 671, 304, 7135, 4943, 9853, 17643, 13, 15945, 29908, 13, 3166, 9557, 29889, 13369, 1053, 9954, 284, 13, 13, 3389, 29918, 1195, 11579, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 339, 4254, 29918, 18721, 368, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 18721, 368, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 29881, 8683, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 18448, 368, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 10874, 368, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 3389, 29918, 6360, 368, 29918, 9057, 29879, 353, 9954, 284, 580, 13, 13, 1457, 29918, 6519, 353, 9954, 284, 29898, 16123, 4821, 29918, 5085, 29922, 3366, 5085, 613, 376, 19290, 20068, 13, 2490, 29918, 6519, 353, 9954, 284, 29898, 16123, 4821, 29918, 5085, 29922, 3366, 5085, 613, 376, 19290, 613, 376, 449, 2763, 20068, 13, 2 ]
tools/BlenderProc/src/object/ObjectPoseSampler.py
GeorgSchenzel/pose-detector
0
33811
import bpy import mathutils from src.main.Module import Module from src.utility.BlenderUtility import check_intersection, check_bb_intersection, get_all_mesh_objects class ObjectPoseSampler(Module): """ Samples positions and rotations of selected object inside the sampling volume while performing mesh and bounding box collision checks. Example 1: Sample poses (locations and rotations) for objects with a suctom property `sample_pose` set to True. .. code-block:: yaml { "module": "object.ObjectPoseSampler", "config":{ "max_iterations": 1000, "objects_to_sample": { "provider": "getter.Entity", "condition": { "cp_sample_pose": True } }, "pos_sampler":{ "provider": "sampler.Uniform3d", "max": [5,5,5], "min": [-5,-5,-5] }, "rot_sampler": { "provider": "sampler.Uniform3d", "max": [0,0,0], "min": [6.28,6.28,6.28] } } } .. list-table:: :widths: 25 100 10 :header-rows: 1 * - Parameter - Description - Type * - objects_to_sample - Here call an appropriate Provider (Getter) in order to select objects. Default: all mesh objects. - Provider * - max_iterations - Amount of tries before giving up on an object and moving to the next one. Default: 1000. - int * - pos_sampler - Here call an appropriate Provider (Sampler) in order to sample position (XYZ 3d vector) for each object. - Provider * - rot_sampler - Here call an appropriate Provider (Sampler) in order to sample rotation (Euler angles 3d vector) for each object. - Provider """ def __init__(self, config): Module.__init__(self, config) def run(self): """ Samples positions and rotations of selected object inside the sampling volume while performing mesh and bounding box collision checks in the following steps: 1. While we have objects remaining and have not run out of tries - sample a point. 2. If no collisions are found keep the point. """ # While we have objects remaining and have not run out of tries - sample a point # List of successfully placed objects placed = [] # After this many tries we give up on current object and continue with the rest max_tries = self.config.get_int("max_iterations", 1000) objects = self.config.get_list("objects_to_sample", get_all_mesh_objects()) if max_tries <= 0: raise ValueError("The value of max_tries must be greater than zero: {}".format(max_tries)) if not objects: raise Exception("The list of objects can not be empty!") # cache to fasten collision detection bvh_cache = {} # for every selected object for obj in objects: if obj.type == "MESH": no_collision = True amount_of_tries_done = -1 # Try max_iter amount of times for i in range(max_tries): # Put the top object in queue at the sampled point in space position = self.config.get_vector3d("pos_sampler") rotation = self.config.get_vector3d("rot_sampler") no_collision = ObjectPoseSampler.check_pose_for_object(obj, position, rotation, bvh_cache, placed, []) # If no collision then keep the position if no_collision: amount_of_tries_done = i break if amount_of_tries_done == -1: amount_of_tries_done = max_tries placed.append(obj) if not no_collision: print("Could not place " + obj.name + " without a collision.") else: print("It took " + str(amount_of_tries_done + 1) + " tries to place " + obj.name) def insert_key_frames(self, obj, frame_id): """ Insert key frames for given object pose :param obj: Loaded object. Type: blender object. :param frame_id: The frame number where key frames should be inserted. Type: int. """ obj.keyframe_insert(data_path='location', frame=frame_id) obj.keyframe_insert(data_path='rotation_euler', frame=frame_id) @staticmethod def check_pose_for_object(obj: bpy.types.Object, position: mathutils.Vector, rotation: mathutils.Vector, bvh_cache: dict, objects_to_check_against: list, list_of_objects_with_no_inside_check: list): """ Checks if a object placed at the given pose intersects with any object given in the list. The bvh_cache adds all current objects to the bvh tree, which increases the speed. If an object is already in the cache it is removed, before performing the check. :param obj: Object which should be checked. Type: :class:`bpy.types.Object` :param position: 3D Vector of the location of the object. Type: :class:`mathutils.Vector` :param rotation: 3D Vector of the rotation in euler angles. If this is None, the rotation is not changed \ Type: :class:`mathutils.Vector` :param bvh_cache: Dict of all the bvh trees, removes the `obj` from the cache before adding it again. \ Type: :class:`dict` :param objects_to_check_against: List of objects which the object is checked again \ Type: :class:`list` :param list_of_objects_with_no_inside_check: List of objects on which no inside check is performed. \ This check is only done for the objects in \ `objects_to_check_against`. Type: :class:`list` :return: Type: :class:`bool`, True if no collision was found, false if at least one collision was found """ # assign it a new pose obj.location = position if rotation: obj.rotation_euler = rotation bpy.context.view_layer.update() # Remove bvh cache, as object has changed if obj.name in bvh_cache: del bvh_cache[obj.name] no_collision = True # Now check for collisions for already_placed in objects_to_check_against: # First check if bounding boxes collides intersection = check_bb_intersection(obj, already_placed) # if they do if intersection: skip_inside_check = already_placed in list_of_objects_with_no_inside_check # then check for more refined collisions intersection, bvh_cache = check_intersection(obj, already_placed, bvh_cache=bvh_cache, skip_inside_check=skip_inside_check) if intersection: no_collision = False break return no_collision
[ 1, 1053, 289, 2272, 13, 5215, 5844, 13239, 13, 13, 3166, 4765, 29889, 3396, 29889, 7355, 1053, 15591, 13, 3166, 4765, 29889, 329, 1793, 29889, 10358, 1581, 7270, 537, 1053, 1423, 29918, 1639, 2042, 29892, 1423, 29918, 1327, 29918, 1639, 2042, 29892, 679, 29918, 497, 29918, 4467, 29882, 29918, 12650, 13, 13, 13, 1990, 4669, 29925, 852, 22966, 20069, 29898, 7355, 1125, 13, 1678, 9995, 13, 1678, 3685, 2701, 11909, 322, 5731, 800, 310, 4629, 1203, 2768, 278, 23460, 7977, 1550, 15859, 27716, 322, 13, 1678, 3216, 292, 3800, 22369, 12747, 29889, 13, 13, 1678, 8741, 29871, 29896, 29901, 21029, 926, 267, 313, 2029, 800, 322, 5731, 800, 29897, 363, 3618, 411, 263, 480, 312, 290, 2875, 421, 11249, 29918, 4220, 29952, 731, 304, 5852, 29889, 13, 13, 1678, 6317, 775, 29899, 1271, 1057, 343, 8807, 13, 13, 4706, 426, 13, 3986, 376, 5453, 1115, 376, 3318, 29889, 2061, 29925, 852, 22966, 20069, 613, 13, 3986, 376, 2917, 1115, 29912, 13, 9651, 376, 3317, 29918, 1524, 800, 1115, 29871, 29896, 29900, 29900, 29900, 29892, 13, 9651, 376, 12650, 29918, 517, 29918, 11249, 1115, 426, 13, 795, 376, 18121, 1115, 376, 657, 357, 29889, 6691, 613, 13, 795, 376, 16122, 1115, 426, 13, 18884, 376, 6814, 29918, 11249, 29918, 4220, 1115, 5852, 13, 795, 500, 13, 9651, 2981, 13, 9651, 376, 1066, 29918, 13445, 20069, 1115, 29912, 13, 795, 376, 18121, 1115, 376, 13445, 20069, 29889, 2525, 5560, 29941, 29881, 613, 13, 795, 376, 3317, 1115, 518, 29945, 29892, 29945, 29892, 29945, 1402, 13, 795, 376, 1195, 1115, 21069, 29945, 6653, 29945, 6653, 29945, 29962, 13, 9651, 2981, 13, 9651, 376, 5450, 29918, 13445, 20069, 1115, 426, 13, 795, 376, 18121, 1115, 376, 13445, 20069, 29889, 2525, 5560, 29941, 29881, 613, 13, 795, 376, 3317, 1115, 518, 29900, 29892, 29900, 29892, 29900, 1402, 13, 795, 376, 1195, 1115, 518, 29953, 29889, 29906, 29947, 29892, 29953, 29889, 29906, 29947, 29892, 29953, 29889, 29906, 29947, 29962, 13, 9651, 500, 13, 3986, 500, 13, 4706, 500, 13, 13, 1678, 6317, 1051, 29899, 2371, 1057, 29871, 13, 4706, 584, 2103, 29879, 29901, 29871, 29906, 29945, 29871, 29896, 29900, 29900, 29871, 29896, 29900, 13, 4706, 584, 6672, 29899, 5727, 29901, 29871, 29896, 13, 13, 4706, 334, 448, 24953, 13, 3986, 448, 12953, 13, 3986, 448, 5167, 13, 4706, 334, 448, 3618, 29918, 517, 29918, 11249, 13, 3986, 448, 2266, 1246, 385, 8210, 1019, 5489, 313, 2577, 357, 29897, 297, 1797, 304, 1831, 3618, 29889, 13109, 29901, 599, 27716, 3618, 29889, 13, 3986, 448, 1019, 5489, 13, 4706, 334, 448, 4236, 29918, 1524, 800, 13, 3986, 448, 1913, 792, 310, 14335, 1434, 6820, 701, 373, 385, 1203, 322, 8401, 304, 278, 2446, 697, 29889, 13109, 29901, 29871, 29896, 29900, 29900, 29900, 29889, 13, 3986, 448, 938, 13, 4706, 334, 448, 926, 29918, 13445, 20069, 13, 3986, 448, 2266, 1246, 385, 8210, 1019, 5489, 313, 22966, 20069, 29897, 297, 1797, 304, 4559, 2602, 313, 18454, 29999, 29871, 29941, 29881, 4608, 29897, 363, 1269, 1203, 29889, 13, 632, 13, 3986, 448, 1019, 5489, 13, 4706, 334, 448, 5731, 29918, 13445, 20069, 13, 3986, 448, 2266, 1246, 385, 8210, 1019, 5489, 313, 22966, 20069, 29897, 297, 1797, 304, 4559, 13733, 313, 29923, 8584, 23619, 29871, 29941, 29881, 4608, 29897, 363, 13, 9651, 1269, 1203, 29889, 29871, 13, 3986, 448, 1019, 5489, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2295, 1125, 13, 4706, 15591, 17255, 2344, 12035, 1311, 29892, 2295, 29897, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3685, 2701, 11909, 322, 5731, 800, 310, 4629, 1203, 2768, 278, 23460, 7977, 1550, 15859, 27716, 322, 13, 4706, 3216, 292, 3800, 22369, 12747, 297, 278, 1494, 6576, 29901, 13, 308, 29896, 29889, 5806, 591, 505, 3618, 9886, 322, 505, 451, 1065, 714, 310, 14335, 448, 4559, 263, 1298, 29889, 29871, 13, 308, 29906, 29889, 960, 694, 5321, 12112, 526, 1476, 3013, 278, 1298, 29889, 13, 4706, 9995, 13, 4706, 396, 5806, 591, 505, 3618, 9886, 322, 505, 451, 1065, 714, 310, 14335, 448, 4559, 263, 1298, 13, 4706, 396, 2391, 310, 8472, 7180, 3618, 13, 4706, 7180, 353, 5159, 13, 4706, 396, 2860, 445, 1784, 14335, 591, 2367, 701, 373, 1857, 1203, 322, 6773, 411, 278, 1791, 13, 4706, 4236, 29918, 29873, 2722, 353, 1583, 29889, 2917, 29889, 657, 29918, 524, 703, 3317, 29918, 1524, 800, 613, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 3618, 353, 1583, 29889, 2917, 29889, 657, 29918, 1761, 703, 12650, 29918, 517, 29918, 11249, 613, 679, 29918, 497, 29918, 4467, 29882, 29918, 12650, 3101, 13, 13, 4706, 565, 4236, 29918, 29873, 2722, 5277, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 1576, 995, 310, 4236, 29918, 29873, 2722, 1818, 367, 7621, 1135, 5225, 29901, 6571, 1642, 4830, 29898, 3317, 29918, 29873, 2722, 876, 13, 13, 4706, 565, 451, 3618, 29901, 13, 9651, 12020, 8960, 703, 1576, 1051, 310, 3618, 508, 451, 367, 4069, 29991, 1159, 13, 13, 4706, 396, 7090, 304, 5172, 264, 22369, 15326, 13, 4706, 289, 29894, 29882, 29918, 8173, 353, 6571, 13, 13, 4706, 396, 363, 1432, 4629, 1203, 13, 4706, 363, 5446, 297, 3618, 29901, 13, 9651, 565, 5446, 29889, 1853, 1275, 376, 2303, 7068, 1115, 13, 18884, 694, 29918, 22017, 2459, 353, 5852, 13, 13, 18884, 5253, 29918, 974, 29918, 29873, 2722, 29918, 15091, 353, 448, 29896, 13, 18884, 396, 3967, 4236, 29918, 1524, 5253, 310, 3064, 13, 18884, 363, 474, 297, 3464, 29898, 3317, 29918, 29873, 2722, 1125, 13, 13, 462, 1678, 396, 12065, 278, 2246, 1203, 297, 9521, 472, 278, 4559, 29881, 1298, 297, 2913, 13, 462, 1678, 2602, 353, 1583, 29889, 2917, 29889, 657, 29918, 8111, 29941, 29881, 703, 1066, 29918, 13445, 20069, 1159, 13, 462, 1678, 13733, 353, 1583, 29889, 2917, 29889, 657, 29918, 8111, 29941, 29881, 703, 5450, 29918, 13445, 20069, 1159, 13, 462, 1678, 694, 29918, 22017, 2459, 353, 4669, 29925, 852, 22966, 20069, 29889, 3198, 29918, 4220, 29918, 1454, 29918, 3318, 29898, 5415, 29892, 2602, 29892, 13733, 29892, 289, 29894, 29882, 29918, 8173, 29892, 13, 462, 462, 462, 462, 965, 7180, 29892, 518, 2314, 13, 13, 462, 1678, 396, 960, 694, 22369, 769, 3013, 278, 2602, 13, 462, 1678, 565, 694, 29918, 22017, 2459, 29901, 13, 462, 4706, 5253, 29918, 974, 29918, 29873, 2722, 29918, 15091, 353, 474, 13, 462, 4706, 2867, 13, 13, 18884, 565, 5253, 29918, 974, 29918, 29873, 2722, 29918, 15091, 1275, 448, 29896, 29901, 13, 462, 1678, 5253, 29918, 974, 29918, 29873, 2722, 29918, 15091, 353, 4236, 29918, 29873, 2722, 13, 13, 18884, 7180, 29889, 4397, 29898, 5415, 29897, 13, 13, 18884, 565, 451, 694, 29918, 22017, 2459, 29901, 13, 462, 1678, 1596, 703, 23323, 451, 2058, 376, 718, 5446, 29889, 978, 718, 376, 1728, 263, 22369, 23157, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 703, 3112, 3614, 376, 718, 851, 29898, 14506, 29918, 974, 29918, 29873, 2722, 29918, 15091, 718, 29871, 29896, 29897, 718, 376, 14335, 304, 2058, 376, 718, 5446, 29889, 978, 29897, 13, 13, 1678, 822, 4635, 29918, 1989, 29918, 19935, 29898, 1311, 29892, 5446, 29892, 3515, 29918, 333, 1125, 13, 4706, 9995, 24505, 1820, 16608, 363, 2183, 1203, 18593, 13, 13, 4706, 584, 3207, 5446, 29901, 4309, 11932, 1203, 29889, 5167, 29901, 1999, 1581, 1203, 29889, 13, 4706, 584, 3207, 3515, 29918, 333, 29901, 450, 3515, 1353, 988, 1820, 16608, 881, 367, 15478, 29889, 5167, 29901, 938, 29889, 13, 4706, 9995, 13, 13, 4706, 5446, 29889, 1989, 2557, 29918, 7851, 29898, 1272, 29918, 2084, 2433, 5479, 742, 3515, 29922, 2557, 29918, 333, 29897, 13, 4706, 5446, 29889, 1989, 2557, 29918, 7851, 29898, 1272, 29918, 2084, 2433, 5450, 362, 29918, 29872, 8584, 742, 3515, 29922, 2557, 29918, 333, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1423, 29918, 4220, 29918, 1454, 29918, 3318, 29898, 5415, 29901, 289, 2272, 29889, 8768, 29889, 2061, 29892, 2602, 29901, 5844, 13239, 29889, 12877, 29892, 13733, 29901, 5844, 13239, 29889, 12877, 29892, 13, 462, 795, 289, 29894, 29882, 29918, 8173, 29901, 9657, 29892, 3618, 29918, 517, 29918, 3198, 29918, 351, 475, 303, 29901, 1051, 29892, 13, 462, 795, 1051, 29918, 974, 29918, 12650, 29918, 2541, 29918, 1217, 29918, 26102, 29918, 3198, 29901, 1051, 1125, 13, 4706, 9995, 13, 4706, 5399, 29879, 565, 263, 1203, 7180, 472, 278, 2183, 18593, 25869, 29879, 411, 738, 1203, 2183, 297, 278, 1051, 29889, 13, 13, 4706, 450, 289, 29894, 29882, 29918, 8173, 12778, 599, 1857, 3618, 304, 278, 289, 29894, 29882, 5447, 29892, 607, 16415, 278, 6210, 29889, 13, 13, 4706, 960, 385, 1203, 338, 2307, 297, 278, 7090, 372, 338, 6206, 29892, 1434, 15859, 278, 1423, 29889, 13, 13, 4706, 584, 3207, 5446, 29901, 4669, 607, 881, 367, 7120, 29889, 5167, 29901, 584, 1990, 18078, 29890, 2272, 29889, 8768, 29889, 2061, 29952, 13, 4706, 584, 3207, 2602, 29901, 29871, 29941, 29928, 16510, 310, 278, 4423, 310, 278, 1203, 29889, 5167, 29901, 584, 1990, 18078, 755, 13239, 29889, 12877, 29952, 13, 4706, 584, 3207, 13733, 29901, 29871, 29941, 29928, 16510, 310, 278, 13733, 297, 321, 8584, 23619, 29889, 960, 445, 338, 6213, 29892, 278, 13733, 338, 451, 3939, 320, 13, 462, 308, 5167, 29901, 584, 1990, 18078, 755, 13239, 29889, 12877, 29952, 13, 4706, 584, 3207, 289, 29894, 29882, 29918, 8173, 29901, 360, 919, 310, 599, 278, 289, 29894, 29882, 10697, 29892, 25388, 278, 421, 5415, 29952, 515, 278, 7090, 1434, 4417, 372, 1449, 29889, 320, 13, 462, 3986, 5167, 29901, 584, 1990, 18078, 8977, 29952, 13, 4706, 584, 3207, 3618, 29918, 517, 29918, 3198, 29918, 351, 475, 303, 29901, 2391, 310, 3618, 607, 278, 1203, 338, 7120, 1449, 320, 13, 462, 462, 308, 5167, 29901, 584, 1990, 18078, 1761, 29952, 13, 4706, 584, 3207, 1051, 29918, 974, 29918, 12650, 29918, 2541, 29918, 1217, 29918, 26102, 29918, 3198, 29901, 2391, 310, 3618, 373, 607, 694, 2768, 1423, 338, 8560, 29889, 320, 13, 462, 462, 462, 268, 910, 1423, 338, 871, 2309, 363, 278, 3618, 297, 320, 13, 462, 462, 462, 268, 421, 12650, 29918, 517, 29918, 3198, 29918, 351, 475, 303, 1412, 5167, 29901, 584, 1990, 18078, 1761, 29952, 13, 4706, 584, 2457, 29901, 5167, 29901, 584, 1990, 18078, 11227, 1673, 5852, 565, 694, 22369, 471, 1476, 29892, 2089, 565, 472, 3203, 697, 22369, 471, 1476, 13, 4706, 9995, 13, 4706, 396, 3566, 372, 263, 716, 18593, 13, 4706, 5446, 29889, 5479, 353, 2602, 13, 4706, 565, 13733, 29901, 13, 9651, 5446, 29889, 5450, 362, 29918, 29872, 8584, 353, 13733, 13, 4706, 289, 2272, 29889, 4703, 29889, 1493, 29918, 13148, 29889, 5504, 580, 13, 4706, 396, 15154, 289, 29894, 29882, 7090, 29892, 408, 1203, 756, 3939, 13, 4706, 565, 5446, 29889, 978, 297, 289, 29894, 29882, 29918, 8173, 29901, 13, 9651, 628, 289, 29894, 29882, 29918, 8173, 29961, 5415, 29889, 978, 29962, 13, 13, 4706, 694, 29918, 22017, 2459, 353, 5852, 13, 4706, 396, 2567, 1423, 363, 5321, 12112, 13, 4706, 363, 2307, 29918, 13974, 1133, 297, 3618, 29918, 517, 29918, 3198, 29918, 351, 475, 303, 29901, 13, 9651, 396, 3824, 1423, 565, 3216, 292, 16273, 5321, 2247, 13, 9651, 17686, 353, 1423, 29918, 1327, 29918, 1639, 2042, 29898, 5415, 29892, 2307, 29918, 13974, 1133, 29897, 13, 9651, 396, 565, 896, 437, 13, 9651, 565, 17686, 29901, 13, 18884, 14383, 29918, 26102, 29918, 3198, 353, 2307, 29918, 13974, 1133, 297, 1051, 29918, 974, 29918, 12650, 29918, 2541, 29918, 1217, 29918, 26102, 29918, 3198, 13, 18884, 396, 769, 1423, 363, 901, 2143, 1312, 5321, 12112, 13, 18884, 17686, 29892, 289, 29894, 29882, 29918, 8173, 353, 1423, 29918, 1639, 2042, 29898, 5415, 29892, 2307, 29918, 13974, 1133, 29892, 289, 29894, 29882, 29918, 8173, 29922, 29890, 29894, 29882, 29918, 8173, 29892, 13, 462, 462, 462, 632, 14383, 29918, 26102, 29918, 3198, 29922, 11014, 29918, 26102, 29918, 3198, 29897, 13, 9651, 565, 17686, 29901, 13, 18884, 694, 29918, 22017, 2459, 353, 7700, 13, 18884, 2867, 13, 4706, 736, 694, 29918, 22017, 2459, 13, 2 ]
swift/common/ring/__init__.py
vvechkanov/SwiftUml
1
47662
<gh_stars>1-10 from ring import RingData, Ring from builder import RingBuilder __all__ = [ 'RingData', 'Ring', 'RingBuilder', ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9228, 1053, 17716, 1469, 29892, 17716, 13, 3166, 12856, 1053, 17716, 5627, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 29934, 292, 1469, 742, 13, 1678, 525, 29934, 292, 742, 13, 1678, 525, 29934, 292, 5627, 742, 13, 29962, 13, 2 ]
swaglyrics/__init__.py
chriswang030/SwagLyrics-For-Spotify
1
128004
name = 'swaglyrics'
[ 1, 1024, 353, 525, 2774, 351, 368, 10817, 29915, 13, 2 ]
api/battle_client.py
MUzzell/the_pokemon_api
0
57703
from base_client import BaseClient, format_query class BattleClient(BaseClient): retries = 3 def do_battle(self, ident): return self._send_request(format_query("BATTLE", ident))
[ 1, 29871, 13, 3166, 2967, 29918, 4645, 1053, 7399, 4032, 29892, 3402, 29918, 1972, 13, 13, 13, 1990, 12788, 4032, 29898, 5160, 4032, 1125, 13, 1678, 3240, 2722, 353, 29871, 29941, 13, 13, 1678, 822, 437, 29918, 29890, 5315, 29898, 1311, 29892, 2893, 1125, 13, 4706, 736, 1583, 3032, 6717, 29918, 3827, 29898, 4830, 29918, 1972, 703, 29933, 1299, 29911, 1307, 613, 2893, 876, 13, 2 ]
apps/usuarios/models.py
RagAndRoll/BlueList
0
83051
<filename>apps/usuarios/models.py # from django.db import models # Create your models here. # comentarios, sera un capo de texto mas relacion comentario a comentario # los itens que pueden ser comentados tendran la llave foranea # el delete no en casacada
[ 1, 529, 9507, 29958, 13371, 29914, 375, 29884, 8596, 29914, 9794, 29889, 2272, 13, 29937, 515, 9557, 29889, 2585, 1053, 4733, 13, 13, 29937, 6204, 596, 4733, 1244, 29889, 13, 29937, 419, 296, 8596, 29892, 16933, 443, 2117, 29877, 316, 1426, 29877, 5516, 19727, 419, 296, 2628, 263, 419, 296, 2628, 13, 29937, 1232, 372, 575, 712, 19796, 724, 419, 296, 2255, 10331, 661, 425, 301, 18398, 363, 1662, 29874, 13, 29937, 560, 5217, 694, 427, 3209, 562, 1114, 13, 13, 2 ]
osd/classes/blank.py
bmeyers/optimal-signal-decomposition
9
1611835
<filename>osd/classes/blank.py<gh_stars>1-10 # -*- coding: utf-8 -*- ''' Gaussian Noise Component This module contains the class for Gaussian Noise Author: <NAME> ''' import cvxpy as cvx import numpy as np from osd.classes.component import Component class Blank(Component): def __init__(self, **kwargs): super().__init__(**kwargs) return @property def is_convex(self): return True def _get_cost(self): return lambda x: 0 def prox_op(self, v, weight, rho, use_set=None, prox_weights=None): return v
[ 1, 529, 9507, 29958, 359, 29881, 29914, 13203, 29914, 19465, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 12008, 22477, 1939, 895, 15924, 13, 13, 4013, 3883, 3743, 278, 770, 363, 22477, 1939, 895, 13, 13, 13720, 29901, 529, 5813, 29958, 13, 12008, 13, 13, 5215, 13850, 29916, 2272, 408, 13850, 29916, 13, 5215, 12655, 408, 7442, 13, 3166, 2897, 29881, 29889, 13203, 29889, 9700, 1053, 15924, 13, 13, 1990, 3164, 804, 29898, 5308, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 736, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 535, 13809, 29898, 1311, 1125, 13, 4706, 736, 5852, 13, 13, 1678, 822, 903, 657, 29918, 18253, 29898, 1311, 1125, 13, 4706, 736, 14013, 921, 29901, 29871, 29900, 13, 13, 1678, 822, 410, 29916, 29918, 459, 29898, 1311, 29892, 325, 29892, 7688, 29892, 364, 1251, 29892, 671, 29918, 842, 29922, 8516, 29892, 410, 29916, 29918, 705, 5861, 29922, 8516, 1125, 13, 4706, 736, 325, 2 ]
tests/services/alertrules/test_exfiltration.py
ryanvanasse/py42
0
159571
from py42.services.alertrules import ExfiltrationService class TestExfiltrationClient(object): def test_get_by_id_posts_expected_data_for_exfiltration_type(self, mock_connection): alert_rule_client = ExfiltrationService(mock_connection, u"tenant-id") alert_rule_client.get(u"rule-id") assert mock_connection.post.call_count == 1 url = mock_connection.post.call_args[0][0] assert url == "/svc/api/v1/Rules/query-endpoint-exfiltration-rule" posted_data = mock_connection.post.call_args[1]["json"] assert posted_data["tenantId"] == u"tenant-id" and posted_data["ruleIds"] == [ u"rule-id" ]
[ 1, 515, 11451, 29946, 29906, 29889, 9916, 29889, 18362, 509, 2540, 1053, 1222, 1777, 509, 362, 3170, 13, 13, 13, 1990, 4321, 1252, 1777, 509, 362, 4032, 29898, 3318, 1125, 13, 1678, 822, 1243, 29918, 657, 29918, 1609, 29918, 333, 29918, 14080, 29918, 9684, 29918, 1272, 29918, 1454, 29918, 735, 1777, 509, 362, 29918, 1853, 29898, 1311, 29892, 11187, 29918, 9965, 1125, 13, 4706, 6655, 29918, 7491, 29918, 4645, 353, 1222, 1777, 509, 362, 3170, 29898, 17640, 29918, 9965, 29892, 318, 29908, 841, 424, 29899, 333, 1159, 13, 4706, 6655, 29918, 7491, 29918, 4645, 29889, 657, 29898, 29884, 29908, 7491, 29899, 333, 1159, 13, 13, 4706, 4974, 11187, 29918, 9965, 29889, 2490, 29889, 4804, 29918, 2798, 1275, 29871, 29896, 13, 4706, 3142, 353, 11187, 29918, 9965, 29889, 2490, 29889, 4804, 29918, 5085, 29961, 29900, 3816, 29900, 29962, 13, 4706, 4974, 3142, 1275, 5591, 4501, 29883, 29914, 2754, 29914, 29894, 29896, 29914, 29934, 2540, 29914, 1972, 29899, 29734, 29899, 735, 1777, 509, 362, 29899, 7491, 29908, 13, 4706, 8059, 29918, 1272, 353, 11187, 29918, 9965, 29889, 2490, 29889, 4804, 29918, 5085, 29961, 29896, 29962, 3366, 3126, 3108, 13, 4706, 4974, 8059, 29918, 1272, 3366, 841, 424, 1204, 3108, 1275, 318, 29908, 841, 424, 29899, 333, 29908, 322, 8059, 29918, 1272, 3366, 7491, 21943, 3108, 1275, 518, 13, 9651, 318, 29908, 7491, 29899, 333, 29908, 13, 4706, 4514, 13, 2 ]
unbrake-api/unbrake_api/management/commands/_script.py
fga-eps-mds/2019.1-Simulador-de-Frenagem
9
81220
<gh_stars>1-10 ''' General helper module for running scripts ''' import os from django.core.management import CommandError def run_script(script, error_message=''): ''' General function for running scripts ''' return_code = os.system(script) if return_code: if not error_message: error_message = f'{script.split("/")[-1]} failed!' raise CommandError(error_message)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 12008, 13, 15263, 16876, 3883, 363, 2734, 12078, 13, 12008, 13, 13, 5215, 2897, 13, 3166, 9557, 29889, 3221, 29889, 21895, 1053, 10516, 2392, 13, 13, 13, 1753, 1065, 29918, 2154, 29898, 2154, 29892, 1059, 29918, 4906, 2433, 29374, 13, 1678, 14550, 13, 1678, 4593, 740, 363, 2734, 12078, 13, 1678, 14550, 13, 1678, 736, 29918, 401, 353, 2897, 29889, 5205, 29898, 2154, 29897, 13, 13, 1678, 565, 736, 29918, 401, 29901, 13, 4706, 565, 451, 1059, 29918, 4906, 29901, 13, 9651, 1059, 29918, 4906, 353, 285, 29915, 29912, 2154, 29889, 5451, 11974, 1159, 14352, 29896, 12258, 5229, 20714, 13, 4706, 12020, 10516, 2392, 29898, 2704, 29918, 4906, 29897, 13, 2 ]
12_mrna/solution2_rev_dict.py
ilaydabozan/biofx_python
74
131891
#!/usr/bin/env python3 """ Infer mRNA from Protein """ import argparse import os import math from typing import NamedTuple class Args(NamedTuple): """ Command-line arguments """ protein: str modulo: int # -------------------------------------------------- def get_args() -> Args: """ Get command-line arguments """ parser = argparse.ArgumentParser( description='Infer mRNA from Protein', formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('protein', metavar='protein', type=str, help='Input protein or file') parser.add_argument('-m', '--modulo', metavar='int', type=int, default=1000000, help='Modulo value') args = parser.parse_args() if os.path.isfile(args.protein): args.protein = open(args.protein).read().rstrip() return Args(args.protein, args.modulo) # -------------------------------------------------- def main(): """ Make a jazz noise here """ args = get_args() aa_to_codon = { 'A': ['GCA', 'GCC', 'GCG', 'GCU'], 'C': ['UGC', 'UGU'], 'D': ['GAC', 'GAU'], 'E': ['GAA', 'GAG'], 'F': ['UUC', 'UUU'], 'G': ['GGA', 'GGC', 'GGG', 'GGU'], 'H': ['CAC', 'CAU'], 'I': ['AUA', 'AUC', 'AUU'], 'K': ['AAA', 'AAG'], 'L': ['CUA', 'CUC', 'CUG', 'CUU', 'UUA', 'UUG'], 'M': ['AUG'], 'N': ['AAC', 'AAU'], 'P': ['CCA', 'CCC', 'CCG', 'CCU'], 'Q': ['CAA', 'CAG'], 'R': ['AGA', 'AGG', 'CGA', 'CGC', 'CGG', 'CGU'], 'S': ['AGC', 'AGU', 'UCA', 'UCC', 'UCG', 'UCU'], 'T': ['ACA', 'ACC', 'ACG', 'ACU'], 'V': ['GUA', 'GUC', 'GUG', 'GUU'], 'W': ['UGG'], 'Y': ['UAC', 'UAU'], '*': ['UAA', 'UAG', 'UGA'], } possible = [len(aa_to_codon.get(aa, 1)) for aa in args.protein + '*'] print(math.prod(possible) % args.modulo) # -------------------------------------------------- if __name__ == '__main__': main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 512, 571, 286, 29934, 3521, 515, 14409, 262, 9995, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 5844, 13, 3166, 19229, 1053, 405, 2795, 23215, 552, 13, 13, 13, 1990, 826, 3174, 29898, 22175, 23215, 552, 1125, 13, 1678, 9995, 10516, 29899, 1220, 6273, 9995, 13, 1678, 26823, 29901, 851, 13, 1678, 878, 7207, 29901, 938, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 29899, 13, 1753, 679, 29918, 5085, 580, 1599, 826, 3174, 29901, 13, 1678, 9995, 3617, 1899, 29899, 1220, 6273, 9995, 13, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 6139, 2433, 797, 571, 286, 29934, 3521, 515, 14409, 262, 742, 13, 4706, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 15730, 24863, 29648, 18522, 29897, 13, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 14676, 262, 742, 13, 462, 4706, 1539, 485, 279, 2433, 14676, 262, 742, 13, 462, 4706, 1134, 29922, 710, 29892, 13, 462, 4706, 1371, 2433, 4290, 26823, 470, 934, 1495, 13, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29885, 742, 13, 462, 4706, 525, 489, 1545, 7207, 742, 13, 462, 4706, 1539, 485, 279, 2433, 524, 742, 13, 462, 4706, 1134, 29922, 524, 29892, 13, 462, 4706, 2322, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29892, 13, 462, 4706, 1371, 2433, 2111, 7207, 995, 1495, 13, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 5085, 29889, 14676, 262, 1125, 13, 4706, 6389, 29889, 14676, 262, 353, 1722, 29898, 5085, 29889, 14676, 262, 467, 949, 2141, 29878, 17010, 580, 13, 13, 1678, 736, 826, 3174, 29898, 5085, 29889, 14676, 262, 29892, 6389, 29889, 1545, 7207, 29897, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 29899, 13, 1753, 1667, 7295, 13, 1678, 9995, 8561, 263, 21230, 11462, 1244, 9995, 13, 13, 1678, 6389, 353, 679, 29918, 5085, 580, 13, 1678, 29099, 29918, 517, 29918, 19284, 265, 353, 426, 13, 4706, 525, 29909, 2396, 6024, 29954, 5454, 742, 525, 29954, 4174, 742, 525, 8766, 29954, 742, 525, 8766, 29965, 7464, 13, 4706, 525, 29907, 2396, 6024, 29965, 8766, 742, 525, 23338, 29965, 7464, 13, 4706, 525, 29928, 2396, 6024, 29954, 2477, 742, 525, 12739, 29965, 7464, 13, 4706, 525, 29923, 2396, 6024, 29954, 6344, 742, 525, 29954, 10051, 7464, 13, 4706, 525, 29943, 2396, 6024, 29965, 23129, 742, 525, 29965, 29965, 29965, 7464, 13, 4706, 525, 29954, 2396, 6024, 29954, 12739, 742, 525, 29954, 8766, 742, 525, 26788, 29954, 742, 525, 26788, 29965, 7464, 13, 4706, 525, 29950, 2396, 6024, 29907, 2477, 742, 525, 5454, 29965, 7464, 13, 4706, 525, 29902, 2396, 6024, 25951, 29909, 742, 525, 29909, 23129, 742, 525, 25951, 29965, 7464, 13, 4706, 525, 29968, 2396, 6024, 6344, 29909, 742, 525, 6344, 29954, 7464, 13, 4706, 525, 29931, 2396, 6024, 29907, 29965, 29909, 742, 525, 29907, 23129, 742, 525, 29907, 23338, 742, 525, 29907, 29965, 29965, 742, 525, 29965, 29965, 29909, 742, 525, 29965, 23338, 7464, 13, 4706, 525, 29924, 2396, 6024, 29909, 23338, 7464, 13, 4706, 525, 29940, 2396, 6024, 29909, 2477, 742, 525, 6344, 29965, 7464, 13, 4706, 525, 29925, 2396, 6024, 4174, 29909, 742, 525, 4174, 29907, 742, 525, 4174, 29954, 742, 525, 4174, 29965, 7464, 13, 4706, 525, 29984, 2396, 6024, 22701, 742, 525, 5454, 29954, 7464, 13, 4706, 525, 29934, 2396, 6024, 10051, 29909, 742, 525, 10051, 29954, 742, 525, 11135, 29909, 742, 525, 29907, 8766, 742, 525, 11135, 29954, 742, 525, 11135, 29965, 7464, 13, 4706, 525, 29903, 2396, 6024, 29909, 8766, 742, 525, 10051, 29965, 742, 525, 29965, 5454, 742, 525, 29965, 4174, 742, 525, 29965, 11135, 742, 525, 23129, 29965, 7464, 13, 4706, 525, 29911, 2396, 6024, 2477, 29909, 742, 525, 2477, 29907, 742, 525, 2477, 29954, 742, 525, 2477, 29965, 7464, 13, 4706, 525, 29963, 2396, 6024, 29954, 29965, 29909, 742, 525, 29954, 23129, 742, 525, 29954, 23338, 742, 525, 29954, 29965, 29965, 7464, 13, 4706, 525, 29956, 2396, 6024, 23338, 29954, 7464, 13, 4706, 525, 29979, 2396, 6024, 29965, 2477, 742, 525, 29965, 25951, 7464, 13, 4706, 525, 29930, 2396, 6024, 29965, 6344, 742, 525, 29965, 10051, 742, 525, 29965, 12739, 7464, 13, 1678, 500, 13, 13, 1678, 1950, 353, 518, 2435, 29898, 7340, 29918, 517, 29918, 19284, 265, 29889, 657, 29898, 7340, 29892, 29871, 29896, 876, 363, 29099, 297, 6389, 29889, 14676, 262, 718, 525, 29930, 2033, 13, 1678, 1596, 29898, 755, 29889, 10633, 29898, 27338, 29897, 1273, 6389, 29889, 1545, 7207, 29897, 13, 13, 13, 29937, 448, 2683, 2683, 2683, 29899, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
traceback_with_variables/global_hooks.py
cclauss/traceback_with_variables
550
51147
import sys from typing import NoReturn, Optional, Type from traceback_with_variables.print import print_exc, Format def global_print_exc(fmt: Optional[Format] = None) -> NoReturn: sys.excepthook = lambda e_cls, e, tb: print_exc(e=e, fmt=fmt) def global_print_exc_in_ipython(fmt: Optional[Format] = None) -> NoReturn: try: import IPython except ModuleNotFoundError: raise ValueError("IPython not found") IPython.core.interactiveshell.InteractiveShell.showtraceback = \ lambda self, *args, **kwargs: print_exc(num_skipped_frames=1, fmt=fmt) def is_ipython_global(name: str, type_: Type, filename: str, is_global: bool) -> bool: return is_global and ( name in ['In', 'Out', 'get_ipython', 'exit', 'quit'] or name.startswith('_') )
[ 1, 1053, 10876, 30004, 13, 3166, 19229, 1053, 1939, 11609, 29892, 28379, 29892, 5167, 30004, 13, 30004, 13, 3166, 9637, 1627, 29918, 2541, 29918, 20897, 29889, 2158, 1053, 1596, 29918, 735, 29883, 29892, 19191, 30004, 13, 30004, 13, 30004, 13, 1753, 5534, 29918, 2158, 29918, 735, 29883, 29898, 23479, 29901, 28379, 29961, 5809, 29962, 353, 6213, 29897, 1599, 1939, 11609, 29901, 30004, 13, 1678, 10876, 29889, 735, 13300, 386, 2550, 353, 14013, 321, 29918, 25932, 29892, 321, 29892, 260, 29890, 29901, 1596, 29918, 735, 29883, 29898, 29872, 29922, 29872, 29892, 19200, 29922, 23479, 8443, 13, 30004, 13, 30004, 13, 1753, 5534, 29918, 2158, 29918, 735, 29883, 29918, 262, 29918, 666, 1656, 29898, 23479, 29901, 28379, 29961, 5809, 29962, 353, 6213, 29897, 1599, 1939, 11609, 29901, 30004, 13, 1678, 1018, 29901, 30004, 13, 4706, 1053, 5641, 1656, 30004, 13, 1678, 5174, 15591, 17413, 2392, 29901, 30004, 13, 4706, 12020, 7865, 2392, 703, 5690, 1656, 451, 1476, 1159, 30004, 13, 30004, 13, 1678, 5641, 1656, 29889, 3221, 29889, 1639, 627, 3145, 14181, 29889, 4074, 4925, 16037, 29889, 4294, 15003, 1627, 353, 320, 30004, 13, 4706, 14013, 1583, 29892, 334, 5085, 29892, 3579, 19290, 29901, 1596, 29918, 735, 29883, 29898, 1949, 29918, 2574, 2986, 29918, 19935, 29922, 29896, 29892, 19200, 29922, 23479, 8443, 13, 30004, 13, 30004, 13, 1753, 338, 29918, 666, 1656, 29918, 10945, 29898, 978, 29901, 851, 29892, 1134, 29918, 29901, 5167, 29892, 10422, 29901, 851, 29892, 338, 29918, 10945, 29901, 6120, 29897, 1599, 6120, 29901, 30004, 13, 1678, 736, 338, 29918, 10945, 322, 313, 30004, 13, 4706, 1024, 297, 6024, 797, 742, 525, 3744, 742, 525, 657, 29918, 666, 1656, 742, 525, 13322, 742, 525, 28358, 2033, 30004, 13, 4706, 470, 1024, 29889, 27382, 2541, 877, 29918, 1495, 30004, 13, 1678, 1723, 30004, 13, 2 ]
quantiphyse_basil/oxasl_process.py
physimals/quantiphyse-asl
1
94387
""" QP-BASIL - Quantiphyse processes for ASL data These processes use the ``oxasl`` and `fslpyt` python libraries which involves the following key mappings between Quantiphyse concepts and oxasl concepts. - ``quantiphyse.data.QpData`` <-> ``fsl.data.image.Image`` Quantiphyse data objects can be transformed to and from ``fslpy`` Image objects. - Quantiphyse process options -> oxasl.Workspace Process options are used to set standard attributes on the ``oxasl.Workspace`` object. In addition, Quantiphyse options which represent data names are transformed into ``fsl.data.image.Image`` objects. - ``oxasl.AslImage`` <-> ``quantiphyse.data.QpData`` with ``AslData`` metadata Additional information stored in the ``oxasl.AslImage`` structure is handled in quantiphyse using the metadata extensions. Copyright (c) 2013-2018 University of Oxford """ from six import StringIO from quantiphyse.data import DataGrid, NumpyData, QpData from quantiphyse.utils import QpException from quantiphyse.utils.cmdline import OutputStreamMonitor, LogProcess METADATA_ATTRS = ["iaf", "ibf", "order", "tis", "plds", "rpts", "taus", "tau", "bolus", "casl", "nphases", "nenc", "slicedt", "sliceband"] def qpdata_to_fslimage(qpd, grid=None): """ Convert QpData to fsl.data.image.Image """ from fsl.data.image import Image if grid is None: return Image(qpd.raw(), name=qpd.name, xform=qpd.grid.affine) else: return Image(qpd.resample(grid), name=qpd.name, xform=grid.affine) def fslimage_to_qpdata(img, name=None): """ Convert fsl.data.image.Image to QpData """ if not name: name = img.name return NumpyData(img.data, grid=DataGrid(img.shape[:3], img.voxToWorldMat), name=name) def qpdata_to_aslimage(qpd, options=None, metadata=None, grid=None): """ Convert QpData to oxasl.AslImage using stored metadata where available """ # If metadata is not provided, get the existing metadata if metadata is None: metadata = qpd.metadata.get("AslData", {}) # If options are provided, use them to override existing metadata if options: for opt in METADATA_ATTRS: val = options.pop(opt, None) if val is not None: metadata[opt] = val else: metadata.pop(opt, None) # Create AslImage object, this will fail if metadat is insufficient or inconsistent from oxasl import AslImage if grid is None: aslimage = AslImage(qpd.raw(), name=qpd.name, xform=qpd.grid.affine, **metadata) else: aslimage = AslImage(qpd.resample(grid), name=qpd.name, xform=grid.affine, **metadata) return aslimage, metadata def aslimage_to_metadata(aslimage): metadata = {} for opt in METADATA_ATTRS: if opt == "tis" and aslimage.have_plds: # Write PLDs only for PLD data sets continue if hasattr(aslimage, opt): val = getattr(aslimage, opt) if val is not None: metadata[opt] = val return metadata def aslimage_to_qpdata(aslimage): """ Convert oxasl.AslImage to QpData storing additional information as metadata """ qpd = fslimage_to_qpdata(aslimage) metadata = aslimage_to_metadata(aslimage) qpd.metadata["AslData"] = metadata return qpd def workspace_from_options(options, images, grid, ivm): """ Create an oxasl.Workspace object from process options """ from oxasl import Workspace wsp = Workspace(log=StringIO(), **options) for key in images: if key in options: data_name = options[key] data = ivm.data.get(data_name, None) if data is not None: setattr(wsp, key, qpdata_to_fslimage(data, grid=grid)) else: raise QpException("Data not found: %s" % data_name) # Clear out options otherwise they will generate warnings. # We have to hope that the process will warn us about unused options for key in options.keys(): options.pop(key) return wsp def wsp_to_dict(wsp): from fsl.data.image import Image from oxasl import Workspace, AslImage ret = dict(vars(wsp)) for key in ret.keys(): value = ret[key] if isinstance(value, AslImage): ret[key] = aslimage_to_qpdata(value) elif isinstance(value, Image): ret[key] = fslimage_to_qpdata(value) elif isinstance(value, Workspace): ret[key] = wsp_to_dict(value) elif key in ("log", "fsllog", "report") or key[0] == "_": ret.pop(key) print(ret) return ret def qp_oxasl(worker_id, queue, asldata, options): try: from fsl.data.image import Image from oxasl import Workspace, AslImage from oxasl.oxford_asl import oxasl for key, value in options.items(): if isinstance(value, QpData): options[key] = qpdata_to_fslimage(value) output_monitor = OutputStreamMonitor(queue) wsp = Workspace(log=output_monitor) wsp.asldata, _ = qpdata_to_aslimage(asldata) oxasl(wsp) print("done") ret = wsp_to_dict(wsp) return worker_id, True, ret except: import sys, traceback traceback.print_exc() return worker_id, False, sys.exc_info()[1] class OxaslProcess(LogProcess): """ Process which runs the Python version of oxford_asl """ PROCESS_NAME = "Oxasl" def __init__(self, ivm, **kwargs): LogProcess.__init__(self, ivm, worker_fn=qp_oxasl, **kwargs) def run(self, options): self.data = self.get_data(options) options["mask"] = self.get_roi(options, self.data.grid) self.expected_steps = [ ("Pre-processing", "Pre-processing"), #("Registering", "Initial ASL->Structural registration"), (".*initial fit", "Initial model fitting"), (".*fit on full", "Model fitting to full data"), #("segmentation", "Segmenting structural image"), #("BBR registration", "Final ASL->Structural registration"), ] self.current_step = 0 self.start_bg([self.data, options]) def finished(self, worker_output): """ Called when process finishes """ print("finished") ret = worker_output[0] print(ret) self.ivm.add(ret["native"]["perfusion"], name="perfusion") print("finished")
[ 1, 9995, 13, 29984, 29925, 29899, 29933, 3289, 6227, 448, 751, 3656, 11461, 344, 10174, 363, 3339, 29931, 848, 13, 13, 1349, 968, 10174, 671, 278, 4954, 2251, 294, 29880, 16159, 322, 421, 29888, 2536, 2272, 29873, 29952, 3017, 9562, 607, 20789, 13, 1552, 1494, 1820, 611, 27775, 1546, 751, 3656, 11461, 344, 22001, 322, 29871, 13, 2251, 294, 29880, 22001, 29889, 13, 13, 448, 4954, 339, 3656, 11461, 344, 29889, 1272, 29889, 29984, 29886, 1469, 16159, 529, 976, 4954, 29888, 2536, 29889, 1272, 29889, 3027, 29889, 2940, 16159, 13, 13, 2182, 3656, 11461, 344, 848, 3618, 508, 367, 27615, 304, 322, 515, 4954, 29888, 2536, 2272, 16159, 7084, 3618, 29889, 13, 13, 448, 751, 3656, 11461, 344, 1889, 3987, 1599, 19100, 294, 29880, 29889, 5531, 3493, 13, 13, 7032, 3987, 526, 1304, 304, 731, 3918, 8393, 373, 278, 4954, 2251, 294, 29880, 29889, 5531, 3493, 16159, 1203, 29889, 13, 797, 6124, 29892, 751, 3656, 11461, 344, 3987, 607, 2755, 848, 2983, 526, 27615, 964, 29871, 13, 16159, 29888, 2536, 29889, 1272, 29889, 3027, 29889, 2940, 16159, 3618, 29889, 13, 13, 448, 4954, 2251, 294, 29880, 29889, 29909, 2536, 2940, 16159, 529, 976, 4954, 339, 3656, 11461, 344, 29889, 1272, 29889, 29984, 29886, 1469, 16159, 411, 4954, 29909, 2536, 1469, 16159, 15562, 13, 13, 2528, 3245, 2472, 6087, 297, 278, 4954, 2251, 294, 29880, 29889, 29909, 2536, 2940, 16159, 3829, 338, 16459, 13, 262, 439, 3656, 11461, 344, 773, 278, 15562, 17752, 29889, 13, 13, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29941, 29899, 29906, 29900, 29896, 29947, 3014, 310, 11045, 13, 15945, 29908, 13, 13, 3166, 4832, 1053, 1714, 5971, 13, 13, 3166, 439, 3656, 11461, 344, 29889, 1272, 1053, 3630, 5756, 29892, 11848, 2272, 1469, 29892, 660, 29886, 1469, 13, 3166, 439, 3656, 11461, 344, 29889, 13239, 1053, 660, 29886, 2451, 13, 3166, 439, 3656, 11461, 344, 29889, 13239, 29889, 9006, 1220, 1053, 10604, 3835, 7185, 2105, 29892, 4522, 7032, 13, 13, 2303, 29911, 3035, 8254, 29918, 1299, 5659, 29903, 353, 6796, 423, 29888, 613, 376, 747, 29888, 613, 376, 2098, 613, 376, 28898, 613, 376, 29886, 430, 29879, 613, 376, 29878, 16485, 613, 376, 941, 375, 613, 376, 4722, 613, 376, 2095, 375, 613, 376, 9398, 29880, 613, 376, 29876, 561, 2129, 613, 376, 29876, 3977, 613, 376, 29879, 506, 287, 29873, 613, 376, 29879, 506, 774, 392, 3108, 13, 13, 1753, 3855, 29886, 1272, 29918, 517, 29918, 29888, 2536, 3027, 29898, 29939, 15926, 29892, 6856, 29922, 8516, 1125, 13, 1678, 9995, 29871, 13, 1678, 14806, 660, 29886, 1469, 304, 285, 2536, 29889, 1272, 29889, 3027, 29889, 2940, 13, 1678, 9995, 13, 1678, 515, 285, 2536, 29889, 1272, 29889, 3027, 1053, 7084, 13, 1678, 565, 6856, 338, 6213, 29901, 13, 4706, 736, 7084, 29898, 29939, 15926, 29889, 1610, 3285, 1024, 29922, 29939, 15926, 29889, 978, 29892, 921, 689, 29922, 29939, 15926, 29889, 7720, 29889, 3470, 457, 29897, 13, 1678, 1683, 29901, 13, 4706, 736, 7084, 29898, 29939, 15926, 29889, 690, 981, 29898, 7720, 511, 1024, 29922, 29939, 15926, 29889, 978, 29892, 921, 689, 29922, 7720, 29889, 3470, 457, 29897, 13, 308, 13, 1753, 285, 2536, 3027, 29918, 517, 29918, 29939, 29886, 1272, 29898, 2492, 29892, 1024, 29922, 8516, 1125, 13, 1678, 9995, 14806, 285, 2536, 29889, 1272, 29889, 3027, 29889, 2940, 304, 660, 29886, 1469, 9995, 13, 1678, 565, 451, 1024, 29901, 1024, 353, 10153, 29889, 978, 13, 1678, 736, 11848, 2272, 1469, 29898, 2492, 29889, 1272, 29892, 6856, 29922, 1469, 5756, 29898, 2492, 29889, 12181, 7503, 29941, 1402, 10153, 29889, 1365, 29916, 1762, 14058, 9782, 511, 1024, 29922, 978, 29897, 13, 13, 1753, 3855, 29886, 1272, 29918, 517, 29918, 294, 2576, 482, 29898, 29939, 15926, 29892, 3987, 29922, 8516, 29892, 15562, 29922, 8516, 29892, 6856, 29922, 8516, 1125, 13, 1678, 9995, 29871, 13, 1678, 14806, 660, 29886, 1469, 304, 19100, 294, 29880, 29889, 29909, 2536, 2940, 773, 6087, 15562, 988, 3625, 29871, 13, 1678, 9995, 13, 13, 1678, 396, 960, 15562, 338, 451, 4944, 29892, 679, 278, 5923, 15562, 13, 1678, 565, 15562, 338, 6213, 29901, 13, 4706, 15562, 353, 3855, 15926, 29889, 19635, 29889, 657, 703, 29909, 2536, 1469, 613, 426, 1800, 13, 268, 13, 1678, 396, 960, 3987, 526, 4944, 29892, 671, 963, 304, 5712, 5923, 15562, 13, 1678, 565, 3987, 29901, 13, 4706, 363, 3523, 297, 341, 2544, 3035, 8254, 29918, 1299, 5659, 29903, 29901, 13, 9651, 659, 353, 3987, 29889, 7323, 29898, 3670, 29892, 6213, 29897, 13, 9651, 565, 659, 338, 451, 6213, 29901, 13, 18884, 15562, 29961, 3670, 29962, 353, 659, 13, 9651, 1683, 29901, 13, 18884, 15562, 29889, 7323, 29898, 3670, 29892, 6213, 29897, 13, 13, 1678, 396, 6204, 1094, 29880, 2940, 1203, 29892, 445, 674, 4418, 565, 1539, 328, 271, 338, 1663, 29884, 4543, 470, 22435, 9696, 13, 1678, 515, 19100, 294, 29880, 1053, 1094, 29880, 2940, 13, 1678, 565, 6856, 338, 6213, 29901, 13, 4706, 408, 2576, 482, 353, 1094, 29880, 2940, 29898, 29939, 15926, 29889, 1610, 3285, 1024, 29922, 29939, 15926, 29889, 978, 29892, 921, 689, 29922, 29939, 15926, 29889, 7720, 29889, 3470, 457, 29892, 3579, 19635, 29897, 13, 1678, 1683, 29901, 13, 4706, 408, 2576, 482, 353, 1094, 29880, 2940, 29898, 29939, 15926, 29889, 690, 981, 29898, 7720, 511, 1024, 29922, 29939, 15926, 29889, 978, 29892, 921, 689, 29922, 7720, 29889, 3470, 457, 29892, 3579, 19635, 29897, 13, 462, 268, 13, 1678, 736, 408, 2576, 482, 29892, 15562, 13, 13, 1753, 408, 2576, 482, 29918, 517, 29918, 19635, 29898, 294, 2576, 482, 1125, 13, 1678, 15562, 353, 6571, 13, 1678, 363, 3523, 297, 341, 2544, 3035, 8254, 29918, 1299, 5659, 29903, 29901, 13, 4706, 565, 3523, 1275, 376, 28898, 29908, 322, 408, 2576, 482, 29889, 17532, 29918, 29886, 430, 29879, 29901, 13, 9651, 396, 14350, 349, 10249, 29879, 871, 363, 349, 10249, 848, 6166, 13, 9651, 6773, 13, 4706, 565, 756, 5552, 29898, 294, 2576, 482, 29892, 3523, 1125, 13, 9651, 659, 353, 679, 5552, 29898, 294, 2576, 482, 29892, 3523, 29897, 13, 9651, 565, 659, 338, 451, 6213, 29901, 13, 18884, 15562, 29961, 3670, 29962, 353, 659, 13, 1678, 736, 15562, 13, 13, 1753, 408, 2576, 482, 29918, 517, 29918, 29939, 29886, 1272, 29898, 294, 2576, 482, 1125, 13, 1678, 9995, 29871, 13, 1678, 14806, 19100, 294, 29880, 29889, 29909, 2536, 2940, 304, 660, 29886, 1469, 15446, 5684, 2472, 408, 15562, 29871, 13, 1678, 9995, 13, 1678, 3855, 15926, 353, 285, 2536, 3027, 29918, 517, 29918, 29939, 29886, 1272, 29898, 294, 2576, 482, 29897, 13, 1678, 15562, 353, 408, 2576, 482, 29918, 517, 29918, 19635, 29898, 294, 2576, 482, 29897, 13, 1678, 3855, 15926, 29889, 19635, 3366, 29909, 2536, 1469, 3108, 353, 15562, 13, 1678, 736, 3855, 15926, 13, 13, 1753, 664, 3493, 29918, 3166, 29918, 6768, 29898, 6768, 29892, 4558, 29892, 6856, 29892, 20444, 29885, 1125, 13, 1678, 9995, 29871, 13, 1678, 6204, 385, 19100, 294, 29880, 29889, 5531, 3493, 1203, 515, 1889, 3987, 29871, 13, 1678, 9995, 13, 1678, 515, 19100, 294, 29880, 1053, 5244, 3493, 13, 1678, 16438, 353, 5244, 3493, 29898, 1188, 29922, 1231, 5971, 3285, 3579, 6768, 29897, 13, 13, 1678, 363, 1820, 297, 4558, 29901, 13, 4706, 565, 1820, 297, 3987, 29901, 13, 9651, 848, 29918, 978, 353, 3987, 29961, 1989, 29962, 13, 9651, 848, 353, 20444, 29885, 29889, 1272, 29889, 657, 29898, 1272, 29918, 978, 29892, 6213, 29897, 13, 9651, 565, 848, 338, 451, 6213, 29901, 13, 18884, 731, 5552, 29898, 29893, 1028, 29892, 1820, 29892, 3855, 29886, 1272, 29918, 517, 29918, 29888, 2536, 3027, 29898, 1272, 29892, 6856, 29922, 7720, 876, 13, 9651, 1683, 29901, 13, 18884, 12020, 660, 29886, 2451, 703, 1469, 451, 1476, 29901, 1273, 29879, 29908, 1273, 848, 29918, 978, 29897, 13, 13, 1678, 396, 17732, 714, 3987, 6467, 896, 674, 5706, 18116, 29889, 29871, 13, 1678, 396, 1334, 505, 304, 4966, 393, 278, 1889, 674, 29383, 502, 1048, 443, 3880, 3987, 13, 1678, 363, 1820, 297, 3987, 29889, 8149, 7295, 13, 4706, 3987, 29889, 7323, 29898, 1989, 29897, 13, 13, 1678, 736, 16438, 13, 13, 1753, 16438, 29918, 517, 29918, 8977, 29898, 29893, 1028, 1125, 13, 1678, 515, 285, 2536, 29889, 1272, 29889, 3027, 1053, 7084, 13, 1678, 515, 19100, 294, 29880, 1053, 5244, 3493, 29892, 1094, 29880, 2940, 13, 1678, 3240, 353, 9657, 29898, 16908, 29898, 29893, 1028, 876, 13, 1678, 363, 1820, 297, 3240, 29889, 8149, 7295, 13, 4706, 995, 353, 3240, 29961, 1989, 29962, 29871, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 1094, 29880, 2940, 1125, 13, 9651, 3240, 29961, 1989, 29962, 353, 408, 2576, 482, 29918, 517, 29918, 29939, 29886, 1272, 29898, 1767, 29897, 13, 4706, 25342, 338, 8758, 29898, 1767, 29892, 7084, 1125, 13, 9651, 3240, 29961, 1989, 29962, 353, 285, 2536, 3027, 29918, 517, 29918, 29939, 29886, 1272, 29898, 1767, 29897, 13, 4706, 25342, 338, 8758, 29898, 1767, 29892, 5244, 3493, 1125, 13, 9651, 3240, 29961, 1989, 29962, 353, 16438, 29918, 517, 29918, 8977, 29898, 1767, 29897, 13, 4706, 25342, 1820, 297, 4852, 1188, 613, 376, 29888, 2536, 1188, 613, 376, 12276, 1159, 470, 1820, 29961, 29900, 29962, 1275, 11119, 1115, 13, 9651, 3240, 29889, 7323, 29898, 1989, 29897, 13, 1678, 1596, 29898, 2267, 29897, 13, 1678, 736, 3240, 13, 13, 1753, 3855, 29886, 29918, 2251, 294, 29880, 29898, 24602, 29918, 333, 29892, 9521, 29892, 408, 430, 532, 29892, 3987, 1125, 13, 1678, 1018, 29901, 13, 4706, 515, 285, 2536, 29889, 1272, 29889, 3027, 1053, 7084, 13, 4706, 515, 19100, 294, 29880, 1053, 5244, 3493, 29892, 1094, 29880, 2940, 13, 4706, 515, 19100, 294, 29880, 29889, 2251, 4006, 29918, 294, 29880, 1053, 19100, 294, 29880, 13, 13, 4706, 363, 1820, 29892, 995, 297, 3987, 29889, 7076, 7295, 13, 9651, 565, 338, 8758, 29898, 1767, 29892, 660, 29886, 1469, 1125, 13, 18884, 3987, 29961, 1989, 29962, 353, 3855, 29886, 1272, 29918, 517, 29918, 29888, 2536, 3027, 29898, 1767, 29897, 13, 13, 4706, 1962, 29918, 3712, 2105, 353, 10604, 3835, 7185, 2105, 29898, 9990, 29897, 13, 4706, 16438, 353, 5244, 3493, 29898, 1188, 29922, 4905, 29918, 3712, 2105, 29897, 13, 4706, 16438, 29889, 294, 430, 532, 29892, 903, 353, 3855, 29886, 1272, 29918, 517, 29918, 294, 2576, 482, 29898, 294, 430, 532, 29897, 13, 13, 4706, 19100, 294, 29880, 29898, 29893, 1028, 29897, 13, 13, 4706, 1596, 703, 15091, 1159, 13, 4706, 3240, 353, 16438, 29918, 517, 29918, 8977, 29898, 29893, 1028, 29897, 13, 4706, 736, 15645, 29918, 333, 29892, 5852, 29892, 3240, 13, 1678, 5174, 29901, 13, 4706, 1053, 10876, 29892, 9637, 1627, 13, 4706, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 4706, 736, 15645, 29918, 333, 29892, 7700, 29892, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29896, 29962, 13, 13, 1990, 9471, 294, 29880, 7032, 29898, 3403, 7032, 1125, 13, 1678, 9995, 13, 1678, 10554, 607, 6057, 278, 5132, 1873, 310, 19100, 4006, 29918, 294, 29880, 13, 1678, 9995, 13, 1678, 13756, 23524, 29918, 5813, 353, 376, 29949, 29916, 294, 29880, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 20444, 29885, 29892, 3579, 19290, 1125, 13, 4706, 4522, 7032, 17255, 2344, 12035, 1311, 29892, 20444, 29885, 29892, 15645, 29918, 9144, 29922, 29939, 29886, 29918, 2251, 294, 29880, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 1065, 29898, 1311, 29892, 3987, 1125, 13, 29871, 13, 4706, 1583, 29889, 1272, 353, 1583, 29889, 657, 29918, 1272, 29898, 6768, 29897, 13, 4706, 3987, 3366, 13168, 3108, 353, 1583, 29889, 657, 29918, 307, 29875, 29898, 6768, 29892, 1583, 29889, 1272, 29889, 7720, 29897, 13, 13, 4706, 1583, 29889, 9684, 29918, 24530, 353, 518, 13, 9651, 4852, 6572, 29899, 19170, 613, 376, 6572, 29899, 19170, 4968, 13, 9651, 396, 703, 15213, 292, 613, 376, 15514, 3339, 29931, 976, 19560, 3631, 22583, 4968, 13, 9651, 313, 1642, 29930, 11228, 6216, 613, 376, 15514, 1904, 28221, 4968, 13, 9651, 313, 1642, 29930, 9202, 373, 2989, 613, 376, 3195, 28221, 304, 2989, 848, 4968, 268, 13, 9651, 396, 703, 28192, 362, 613, 376, 17669, 358, 292, 2281, 3631, 1967, 4968, 13, 9651, 396, 703, 14388, 29934, 22583, 613, 376, 15790, 3339, 29931, 976, 19560, 3631, 22583, 4968, 13, 4706, 4514, 13, 4706, 1583, 29889, 3784, 29918, 10568, 353, 29871, 29900, 13, 4706, 1583, 29889, 2962, 29918, 16264, 4197, 1311, 29889, 1272, 29892, 3987, 2314, 13, 13, 1678, 822, 7743, 29898, 1311, 29892, 15645, 29918, 4905, 1125, 13, 4706, 9995, 3037, 839, 746, 1889, 8341, 267, 9995, 13, 4706, 1596, 703, 4951, 3276, 1159, 13, 4706, 3240, 353, 15645, 29918, 4905, 29961, 29900, 29962, 13, 4706, 1596, 29898, 2267, 29897, 13, 4706, 1583, 29889, 440, 29885, 29889, 1202, 29898, 2267, 3366, 11487, 3108, 3366, 546, 29888, 3958, 12436, 1024, 543, 546, 29888, 3958, 1159, 13, 4706, 1596, 703, 4951, 3276, 1159, 13, 2 ]
Exercicios/ex063.py
vincytarsis/Python
0
149187
""" Escreva um programa que leia um número n inteiro qualquer e mostre na tela os n primeiros elementos de uma sequência de Fibonacci. Ex: 0 → 1 → 1 → 2 → 3 → 5 → 8 """ n = int(input('Entre com um número:')) a = 0 b = 1 c = 0 count = 1 print('Sequencia de Fibonacci: ', end=' ') while count <= n: print(c, end=' ') count += 1 a = b b = c c = a + b
[ 1, 9995, 3423, 1037, 1564, 1922, 16914, 712, 454, 423, 1922, 13831, 302, 2293, 3350, 4021, 7808, 321, 1556, 276, 1055, 260, 3100, 2897, 302, 6019, 17177, 29290, 316, 13, 10859, 8617, 10544, 316, 383, 747, 265, 21566, 29889, 1222, 29901, 29871, 29900, 10309, 29871, 29896, 10309, 29871, 29896, 10309, 29871, 29906, 10309, 29871, 29941, 10309, 29871, 29945, 10309, 29871, 29947, 9995, 13, 13, 29876, 353, 938, 29898, 2080, 877, 5292, 276, 419, 1922, 13831, 29901, 8785, 13, 13, 29874, 353, 29871, 29900, 13, 29890, 353, 29871, 29896, 13, 29883, 353, 29871, 29900, 13, 2798, 353, 29871, 29896, 13, 13, 2158, 877, 16941, 5760, 316, 383, 747, 265, 21566, 29901, 13420, 1095, 2433, 25710, 13, 13, 8000, 2302, 5277, 302, 29901, 13, 1678, 1596, 29898, 29883, 29892, 1095, 2433, 25710, 13, 1678, 2302, 4619, 29871, 29896, 13, 1678, 263, 353, 289, 13, 1678, 289, 353, 274, 13, 1678, 274, 353, 263, 718, 289, 13, 2 ]
ratings.py
parappayo/rank-em
0
1601265
<reponame>parappayo/rank-em import math class InvalidEventTypeError(Exception): """Raised when event type is unrecognized.""" def __init__(type): self.message = 'type is ' + type class PlayerRegisteredEvent: def __init__(self, player): self.type = 'PlayerRegistered' self.player = player class MatchFinishedEvent: def __init__(self, winner, loser): self.type = 'MatchFinished' self.winner = winner self.loser = loser class RatingsAggregate: def __init__(self): self.ratings = {} self.initial_rating = 1000 self.min_swing = 10 self.max_swing = 200 self.delta_factor = 0.8 self.reducers = { 'PlayerRegistered': lambda ev: self.register_player(ev.player), 'MatchFinished': lambda ev: self.apply_match_result(ev.winner, ev.loser), } def __str__(self): return str(self.ratings) def players(self): return list(self.ratings) def register_player(self, key): if key in self.ratings: return self.ratings[key] = self.initial_rating def match_delta(self, winner_rating, loser_rating): # TODO: this isn't working, the winner gets the same points whether they are # the higher or lower rated player delta = abs(winner_rating - loser_rating) * self.delta_factor distance = abs(self.initial_rating - (winner_rating + loser_rating) / 2) award = delta if loser_rating > winner_rating else self.max_swing - delta distance_div = max(distance / 100, 1) return min(max(math.floor(award / distance_div), self.min_swing), self.max_swing) def apply_match_result(self, winner, loser): delta = self.match_delta(self.ratings[winner], self.ratings[loser]) self.ratings[winner] += delta self.ratings[loser] -= delta def process_events(self, events): for event in events: self.reducers[event.type](event)
[ 1, 529, 276, 1112, 420, 29958, 862, 932, 388, 29877, 29914, 10003, 29899, 331, 13, 5215, 5844, 13, 13, 13, 1990, 21403, 2624, 1542, 2392, 29898, 2451, 1125, 13, 1678, 9995, 29934, 1759, 287, 746, 1741, 1134, 338, 443, 29423, 1891, 1213, 15945, 13, 1678, 822, 4770, 2344, 12035, 1853, 1125, 13, 4706, 1583, 29889, 4906, 353, 525, 1853, 338, 525, 718, 1134, 13, 13, 13, 1990, 14574, 15213, 287, 2624, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4847, 1125, 13, 4706, 1583, 29889, 1853, 353, 525, 9075, 15213, 287, 29915, 13, 4706, 1583, 29889, 9106, 353, 4847, 13, 13, 13, 1990, 14514, 12881, 3276, 2624, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19576, 29892, 1232, 261, 1125, 13, 4706, 1583, 29889, 1853, 353, 525, 9652, 12881, 3276, 29915, 13, 4706, 1583, 29889, 29893, 3993, 353, 19576, 13, 4706, 1583, 29889, 5409, 261, 353, 1232, 261, 13, 13, 13, 1990, 17450, 886, 29909, 26127, 403, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 3605, 886, 353, 6571, 13, 4706, 1583, 29889, 11228, 29918, 29741, 353, 29871, 29896, 29900, 29900, 29900, 13, 4706, 1583, 29889, 1195, 29918, 18013, 353, 29871, 29896, 29900, 13, 4706, 1583, 29889, 3317, 29918, 18013, 353, 29871, 29906, 29900, 29900, 13, 4706, 1583, 29889, 4181, 29918, 19790, 353, 29871, 29900, 29889, 29947, 13, 13, 4706, 1583, 29889, 9313, 22543, 353, 426, 13, 9651, 525, 9075, 15213, 287, 2396, 13, 18884, 14013, 3415, 29901, 1583, 29889, 9573, 29918, 9106, 29898, 5750, 29889, 9106, 511, 13, 9651, 525, 9652, 12881, 3276, 2396, 13, 18884, 14013, 3415, 29901, 1583, 29889, 7302, 29918, 4352, 29918, 2914, 29898, 5750, 29889, 29893, 3993, 29892, 3415, 29889, 5409, 261, 511, 13, 4706, 500, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 1311, 29889, 3605, 886, 29897, 13, 13, 1678, 822, 10769, 29898, 1311, 1125, 13, 4706, 736, 1051, 29898, 1311, 29889, 3605, 886, 29897, 13, 13, 1678, 822, 6036, 29918, 9106, 29898, 1311, 29892, 1820, 1125, 13, 4706, 565, 1820, 297, 1583, 29889, 3605, 886, 29901, 736, 13, 4706, 1583, 29889, 3605, 886, 29961, 1989, 29962, 353, 1583, 29889, 11228, 29918, 29741, 13, 13, 1678, 822, 1993, 29918, 4181, 29898, 1311, 29892, 19576, 29918, 29741, 29892, 1232, 261, 29918, 29741, 1125, 13, 4706, 396, 14402, 29901, 445, 3508, 29915, 29873, 1985, 29892, 278, 19576, 4947, 278, 1021, 3291, 3692, 896, 526, 13, 4706, 396, 278, 6133, 470, 5224, 364, 630, 4847, 13, 4706, 19471, 353, 6425, 29898, 29893, 3993, 29918, 29741, 448, 1232, 261, 29918, 29741, 29897, 334, 1583, 29889, 4181, 29918, 19790, 13, 4706, 5418, 353, 6425, 29898, 1311, 29889, 11228, 29918, 29741, 448, 313, 29893, 3993, 29918, 29741, 718, 1232, 261, 29918, 29741, 29897, 847, 29871, 29906, 29897, 13, 4706, 9862, 353, 19471, 565, 1232, 261, 29918, 29741, 1405, 19576, 29918, 29741, 1683, 1583, 29889, 3317, 29918, 18013, 448, 19471, 13, 4706, 5418, 29918, 4563, 353, 4236, 29898, 19244, 847, 29871, 29896, 29900, 29900, 29892, 29871, 29896, 29897, 13, 4706, 736, 1375, 29898, 3317, 29898, 755, 29889, 14939, 29898, 29874, 1328, 847, 5418, 29918, 4563, 511, 1583, 29889, 1195, 29918, 18013, 511, 1583, 29889, 3317, 29918, 18013, 29897, 13, 13, 1678, 822, 3394, 29918, 4352, 29918, 2914, 29898, 1311, 29892, 19576, 29892, 1232, 261, 1125, 13, 4706, 19471, 353, 1583, 29889, 4352, 29918, 4181, 29898, 1311, 29889, 3605, 886, 29961, 29893, 3993, 1402, 1583, 29889, 3605, 886, 29961, 5409, 261, 2314, 13, 4706, 1583, 29889, 3605, 886, 29961, 29893, 3993, 29962, 4619, 19471, 13, 4706, 1583, 29889, 3605, 886, 29961, 5409, 261, 29962, 22361, 19471, 13, 13, 1678, 822, 1889, 29918, 13604, 29898, 1311, 29892, 4959, 1125, 13, 4706, 363, 1741, 297, 4959, 29901, 13, 9651, 1583, 29889, 9313, 22543, 29961, 3696, 29889, 1853, 850, 3696, 29897, 13, 2 ]
sdk/python/pulumi_aws_native/pinpoint/get_apns_sandbox_channel.py
pulumi/pulumi-aws-native
29
86114
<reponame>pulumi/pulumi-aws-native<filename>sdk/python/pulumi_aws_native/pinpoint/get_apns_sandbox_channel.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union, overload from .. import _utilities __all__ = [ 'GetAPNSSandboxChannelResult', 'AwaitableGetAPNSSandboxChannelResult', 'get_apns_sandbox_channel', 'get_apns_sandbox_channel_output', ] @pulumi.output_type class GetAPNSSandboxChannelResult: def __init__(__self__, bundle_id=None, certificate=None, default_authentication_method=None, enabled=None, id=None, private_key=None, team_id=None, token_key=None, token_key_id=None): if bundle_id and not isinstance(bundle_id, str): raise TypeError("Expected argument 'bundle_id' to be a str") pulumi.set(__self__, "bundle_id", bundle_id) if certificate and not isinstance(certificate, str): raise TypeError("Expected argument 'certificate' to be a str") pulumi.set(__self__, "certificate", certificate) if default_authentication_method and not isinstance(default_authentication_method, str): raise TypeError("Expected argument 'default_authentication_method' to be a str") pulumi.set(__self__, "default_authentication_method", default_authentication_method) if enabled and not isinstance(enabled, bool): raise TypeError("Expected argument 'enabled' to be a bool") pulumi.set(__self__, "enabled", enabled) if id and not isinstance(id, str): raise TypeError("Expected argument 'id' to be a str") pulumi.set(__self__, "id", id) if private_key and not isinstance(private_key, str): raise TypeError("Expected argument 'private_key' to be a str") pulumi.set(__self__, "private_key", private_key) if team_id and not isinstance(team_id, str): raise TypeError("Expected argument 'team_id' to be a str") pulumi.set(__self__, "team_id", team_id) if token_key and not isinstance(token_key, str): raise TypeError("Expected argument 'token_key' to be a str") pulumi.set(__self__, "token_key", token_key) if token_key_id and not isinstance(token_key_id, str): raise TypeError("Expected argument 'token_key_id' to be a str") pulumi.set(__self__, "token_key_id", token_key_id) @property @pulumi.getter(name="bundleId") def bundle_id(self) -> Optional[str]: return pulumi.get(self, "bundle_id") @property @pulumi.getter def certificate(self) -> Optional[str]: return pulumi.get(self, "certificate") @property @pulumi.getter(name="defaultAuthenticationMethod") def default_authentication_method(self) -> Optional[str]: return pulumi.get(self, "default_authentication_method") @property @pulumi.getter def enabled(self) -> Optional[bool]: return pulumi.get(self, "enabled") @property @pulumi.getter def id(self) -> Optional[str]: return pulumi.get(self, "id") @property @pulumi.getter(name="privateKey") def private_key(self) -> Optional[str]: return pulumi.get(self, "private_key") @property @pulumi.getter(name="teamId") def team_id(self) -> Optional[str]: return pulumi.get(self, "team_id") @property @pulumi.getter(name="tokenKey") def token_key(self) -> Optional[str]: return pulumi.get(self, "token_key") @property @pulumi.getter(name="tokenKeyId") def token_key_id(self) -> Optional[str]: return pulumi.get(self, "token_key_id") class AwaitableGetAPNSSandboxChannelResult(GetAPNSSandboxChannelResult): # pylint: disable=using-constant-test def __await__(self): if False: yield self return GetAPNSSandboxChannelResult( bundle_id=self.bundle_id, certificate=self.certificate, default_authentication_method=self.default_authentication_method, enabled=self.enabled, id=self.id, private_key=self.private_key, team_id=self.team_id, token_key=self.token_key, token_key_id=self.token_key_id) def get_apns_sandbox_channel(id: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetAPNSSandboxChannelResult: """ Resource Type definition for AWS::Pinpoint::APNSSandboxChannel """ __args__ = dict() __args__['id'] = id if opts is None: opts = pulumi.InvokeOptions() if opts.version is None: opts.version = _utilities.get_version() __ret__ = pulumi.runtime.invoke('aws-native:pinpoint:getAPNSSandboxChannel', __args__, opts=opts, typ=GetAPNSSandboxChannelResult).value return AwaitableGetAPNSSandboxChannelResult( bundle_id=__ret__.bundle_id, certificate=__ret__.certificate, default_authentication_method=__ret__.default_authentication_method, enabled=__ret__.enabled, id=__ret__.id, private_key=__ret__.private_key, team_id=__ret__.team_id, token_key=__ret__.token_key, token_key_id=__ret__.token_key_id) @_utilities.lift_output_func(get_apns_sandbox_channel) def get_apns_sandbox_channel_output(id: Optional[pulumi.Input[str]] = None, opts: Optional[pulumi.InvokeOptions] = None) -> pulumi.Output[GetAPNSSandboxChannelResult]: """ Resource Type definition for AWS::Pinpoint::APNSSandboxChannel """ ...
[ 1, 529, 276, 1112, 420, 29958, 29886, 352, 15547, 29914, 29886, 352, 15547, 29899, 10467, 29899, 11487, 29966, 9507, 29958, 15348, 29914, 4691, 29914, 29886, 352, 15547, 29918, 10467, 29918, 11487, 29914, 12687, 3149, 29914, 657, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 29889, 2272, 13, 29937, 14137, 29922, 9420, 29899, 29947, 13, 29937, 18610, 399, 25614, 29901, 445, 934, 471, 5759, 491, 278, 27477, 15547, 12967, 3251, 1061, 29889, 18610, 13, 29937, 18610, 1938, 451, 3863, 491, 1361, 6521, 366, 29915, 276, 3058, 366, 1073, 825, 366, 526, 2599, 29991, 18610, 13, 13, 5215, 18116, 13, 5215, 9505, 15547, 13, 5215, 9505, 15547, 29889, 15634, 13, 3166, 19229, 1053, 3139, 29892, 341, 20304, 29892, 28379, 29892, 922, 3910, 29892, 7761, 29892, 975, 1359, 13, 3166, 6317, 1053, 903, 4422, 1907, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 742, 13, 1678, 525, 29909, 10685, 519, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 742, 13, 1678, 525, 657, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 742, 13, 1678, 525, 657, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 29918, 4905, 742, 13, 29962, 13, 13, 29992, 29886, 352, 15547, 29889, 4905, 29918, 1853, 13, 1990, 3617, 3301, 29940, 1799, 26738, 13599, 3591, 29901, 13, 1678, 822, 4770, 2344, 12035, 1649, 1311, 1649, 29892, 11846, 29918, 333, 29922, 8516, 29892, 12289, 29922, 8516, 29892, 2322, 29918, 23055, 29918, 5696, 29922, 8516, 29892, 9615, 29922, 8516, 29892, 1178, 29922, 8516, 29892, 2024, 29918, 1989, 29922, 8516, 29892, 3815, 29918, 333, 29922, 8516, 29892, 5993, 29918, 1989, 29922, 8516, 29892, 5993, 29918, 1989, 29918, 333, 29922, 8516, 1125, 13, 4706, 565, 11846, 29918, 333, 322, 451, 338, 8758, 29898, 16718, 29918, 333, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 16718, 29918, 333, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 16718, 29918, 333, 613, 11846, 29918, 333, 29897, 13, 4706, 565, 12289, 322, 451, 338, 8758, 29898, 6327, 8021, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 6327, 8021, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 6327, 8021, 613, 12289, 29897, 13, 4706, 565, 2322, 29918, 23055, 29918, 5696, 322, 451, 338, 8758, 29898, 4381, 29918, 23055, 29918, 5696, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 4381, 29918, 23055, 29918, 5696, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 4381, 29918, 23055, 29918, 5696, 613, 2322, 29918, 23055, 29918, 5696, 29897, 13, 4706, 565, 9615, 322, 451, 338, 8758, 29898, 17590, 29892, 6120, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 17590, 29915, 304, 367, 263, 6120, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 17590, 613, 9615, 29897, 13, 4706, 565, 1178, 322, 451, 338, 8758, 29898, 333, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 333, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 333, 613, 1178, 29897, 13, 4706, 565, 2024, 29918, 1989, 322, 451, 338, 8758, 29898, 9053, 29918, 1989, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 9053, 29918, 1989, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 9053, 29918, 1989, 613, 2024, 29918, 1989, 29897, 13, 4706, 565, 3815, 29918, 333, 322, 451, 338, 8758, 29898, 14318, 29918, 333, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 14318, 29918, 333, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 14318, 29918, 333, 613, 3815, 29918, 333, 29897, 13, 4706, 565, 5993, 29918, 1989, 322, 451, 338, 8758, 29898, 6979, 29918, 1989, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 6979, 29918, 1989, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 6979, 29918, 1989, 613, 5993, 29918, 1989, 29897, 13, 4706, 565, 5993, 29918, 1989, 29918, 333, 322, 451, 338, 8758, 29898, 6979, 29918, 1989, 29918, 333, 29892, 851, 1125, 13, 9651, 12020, 20948, 703, 1252, 6021, 2980, 525, 6979, 29918, 1989, 29918, 333, 29915, 304, 367, 263, 851, 1159, 13, 4706, 9505, 15547, 29889, 842, 22168, 1311, 1649, 29892, 376, 6979, 29918, 1989, 29918, 333, 613, 5993, 29918, 1989, 29918, 333, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 16718, 1204, 1159, 13, 1678, 822, 11846, 29918, 333, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 16718, 29918, 333, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 13, 1678, 822, 12289, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 6327, 8021, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 4381, 16746, 4062, 1159, 13, 1678, 822, 2322, 29918, 23055, 29918, 5696, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 4381, 29918, 23055, 29918, 5696, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 13, 1678, 822, 9615, 29898, 1311, 29897, 1599, 28379, 29961, 11227, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 17590, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 13, 1678, 822, 1178, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 333, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 9053, 2558, 1159, 13, 1678, 822, 2024, 29918, 1989, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 9053, 29918, 1989, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 14318, 1204, 1159, 13, 1678, 822, 3815, 29918, 333, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 14318, 29918, 333, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 6979, 2558, 1159, 13, 1678, 822, 5993, 29918, 1989, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 6979, 29918, 1989, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 732, 29886, 352, 15547, 29889, 657, 357, 29898, 978, 543, 6979, 2558, 1204, 1159, 13, 1678, 822, 5993, 29918, 1989, 29918, 333, 29898, 1311, 29897, 1599, 28379, 29961, 710, 5387, 13, 4706, 736, 9505, 15547, 29889, 657, 29898, 1311, 29892, 376, 6979, 29918, 1989, 29918, 333, 1159, 13, 13, 13, 1990, 319, 10685, 519, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 29898, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 1125, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 4746, 29899, 23362, 29899, 1688, 13, 1678, 822, 4770, 20675, 12035, 1311, 1125, 13, 4706, 565, 7700, 29901, 13, 9651, 7709, 1583, 13, 4706, 736, 3617, 3301, 29940, 1799, 26738, 13599, 3591, 29898, 13, 9651, 11846, 29918, 333, 29922, 1311, 29889, 16718, 29918, 333, 29892, 13, 9651, 12289, 29922, 1311, 29889, 6327, 8021, 29892, 13, 9651, 2322, 29918, 23055, 29918, 5696, 29922, 1311, 29889, 4381, 29918, 23055, 29918, 5696, 29892, 13, 9651, 9615, 29922, 1311, 29889, 17590, 29892, 13, 9651, 1178, 29922, 1311, 29889, 333, 29892, 13, 9651, 2024, 29918, 1989, 29922, 1311, 29889, 9053, 29918, 1989, 29892, 13, 9651, 3815, 29918, 333, 29922, 1311, 29889, 14318, 29918, 333, 29892, 13, 9651, 5993, 29918, 1989, 29922, 1311, 29889, 6979, 29918, 1989, 29892, 13, 9651, 5993, 29918, 1989, 29918, 333, 29922, 1311, 29889, 6979, 29918, 1989, 29918, 333, 29897, 13, 13, 13, 1753, 679, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 29898, 333, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 462, 632, 29111, 29901, 28379, 29961, 29886, 352, 15547, 29889, 20731, 5856, 29962, 353, 6213, 29897, 1599, 319, 10685, 519, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 29901, 13, 1678, 9995, 13, 1678, 18981, 5167, 5023, 363, 15540, 1057, 29925, 262, 3149, 1057, 3301, 29940, 1799, 26738, 13599, 13, 1678, 9995, 13, 1678, 4770, 5085, 1649, 353, 9657, 580, 13, 1678, 4770, 5085, 1649, 1839, 333, 2033, 353, 1178, 13, 1678, 565, 29111, 338, 6213, 29901, 13, 4706, 29111, 353, 9505, 15547, 29889, 20731, 5856, 580, 13, 1678, 565, 29111, 29889, 3259, 338, 6213, 29901, 13, 4706, 29111, 29889, 3259, 353, 903, 4422, 1907, 29889, 657, 29918, 3259, 580, 13, 1678, 4770, 2267, 1649, 353, 9505, 15547, 29889, 15634, 29889, 9772, 877, 10467, 29899, 11487, 29901, 12687, 3149, 29901, 657, 3301, 29940, 1799, 26738, 13599, 742, 4770, 5085, 1649, 29892, 29111, 29922, 25707, 29892, 2393, 29922, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 467, 1767, 13, 13, 1678, 736, 319, 10685, 519, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 29898, 13, 4706, 11846, 29918, 333, 29922, 1649, 2267, 26914, 16718, 29918, 333, 29892, 13, 4706, 12289, 29922, 1649, 2267, 26914, 6327, 8021, 29892, 13, 4706, 2322, 29918, 23055, 29918, 5696, 29922, 1649, 2267, 26914, 4381, 29918, 23055, 29918, 5696, 29892, 13, 4706, 9615, 29922, 1649, 2267, 26914, 17590, 29892, 13, 4706, 1178, 29922, 1649, 2267, 26914, 333, 29892, 13, 4706, 2024, 29918, 1989, 29922, 1649, 2267, 26914, 9053, 29918, 1989, 29892, 13, 4706, 3815, 29918, 333, 29922, 1649, 2267, 26914, 14318, 29918, 333, 29892, 13, 4706, 5993, 29918, 1989, 29922, 1649, 2267, 26914, 6979, 29918, 1989, 29892, 13, 4706, 5993, 29918, 1989, 29918, 333, 29922, 1649, 2267, 26914, 6979, 29918, 1989, 29918, 333, 29897, 13, 13, 13, 29992, 29918, 4422, 1907, 29889, 29880, 2027, 29918, 4905, 29918, 9891, 29898, 657, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 29897, 13, 1753, 679, 29918, 481, 1983, 29918, 29879, 26738, 29918, 12719, 29918, 4905, 29898, 333, 29901, 28379, 29961, 29886, 352, 15547, 29889, 4290, 29961, 710, 5262, 353, 6213, 29892, 13, 462, 462, 1678, 29111, 29901, 28379, 29961, 29886, 352, 15547, 29889, 20731, 5856, 29962, 353, 6213, 29897, 1599, 9505, 15547, 29889, 6466, 29961, 2577, 3301, 29940, 1799, 26738, 13599, 3591, 5387, 13, 1678, 9995, 13, 1678, 18981, 5167, 5023, 363, 15540, 1057, 29925, 262, 3149, 1057, 3301, 29940, 1799, 26738, 13599, 13, 1678, 9995, 13, 1678, 2023, 13, 2 ]
webhooksocket/models.py
ToxicFrazzles/django-webhooksocket
0
108044
<gh_stars>0 from django.db import models from django.urls import reverse import secrets def random_ident(): characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" return "".join(secrets.choice(characters) for i in range(64)) class Bridge(models.Model): name = models.CharField(max_length=60) hook_ident = models.CharField( verbose_name="Webhook Unique Identifier", max_length=64, unique=True, db_index=True, default=random_ident ) socket_ident = models.CharField( verbose_name="Websocket Unique Identifier", max_length=64, unique=True, db_index=True, default=random_ident ) description = models.CharField(max_length=1024, default="", blank=True) def hook_url(self): return reverse('webhooksocket:hooks', kwargs={ "ident": self.hook_ident }) def socket_url(self): return reverse('webhooksocket:sockets', kwargs={ "ident": self.socket_ident }) def __str__(self): return self.name
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 5215, 22183, 1372, 13, 13, 13, 1753, 4036, 29918, 1693, 7295, 13, 1678, 4890, 353, 376, 10736, 1753, 12443, 823, 6321, 23521, 459, 29939, 29878, 303, 4090, 29893, 20230, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29984, 29934, 1254, 29965, 29963, 29956, 18454, 29999, 29900, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29908, 13, 1678, 736, 376, 1642, 7122, 29898, 344, 1037, 1372, 29889, 16957, 29898, 3090, 21706, 29897, 363, 474, 297, 3464, 29898, 29953, 29946, 876, 13, 13, 13, 1990, 16230, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29953, 29900, 29897, 13, 1678, 12422, 29918, 1693, 353, 4733, 29889, 27890, 29898, 13, 4706, 26952, 29918, 978, 543, 3609, 20849, 853, 1387, 20286, 613, 13, 4706, 4236, 29918, 2848, 29922, 29953, 29946, 29892, 5412, 29922, 5574, 29892, 13, 4706, 4833, 29918, 2248, 29922, 5574, 29892, 2322, 29922, 8172, 29918, 1693, 13, 1678, 1723, 13, 1678, 9909, 29918, 1693, 353, 4733, 29889, 27890, 29898, 13, 4706, 26952, 29918, 978, 543, 3609, 11514, 853, 1387, 20286, 613, 13, 4706, 4236, 29918, 2848, 29922, 29953, 29946, 29892, 5412, 29922, 5574, 29892, 13, 4706, 4833, 29918, 2248, 29922, 5574, 29892, 2322, 29922, 8172, 29918, 1693, 13, 1678, 1723, 13, 1678, 6139, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29906, 29946, 29892, 2322, 543, 613, 9654, 29922, 5574, 29897, 13, 13, 1678, 822, 12422, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 11837, 877, 2676, 20849, 11514, 29901, 1251, 12117, 742, 9049, 5085, 3790, 13, 9651, 376, 1693, 1115, 1583, 29889, 20849, 29918, 1693, 13, 4706, 5615, 13, 13, 1678, 822, 9909, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 11837, 877, 2676, 20849, 11514, 29901, 578, 9737, 742, 9049, 5085, 3790, 13, 9651, 376, 1693, 1115, 1583, 29889, 11514, 29918, 1693, 13, 4706, 5615, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 978, 13, 2 ]
dependencyinjection/internal/param_type_resolver.py
Cologler/dependencyinjection-python
0
12820
<reponame>Cologler/dependencyinjection-python<filename>dependencyinjection/internal/param_type_resolver.py<gh_stars>0 #!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (c) 2017~2999 - cologler <<EMAIL>> # ---------- # # ---------- import typing import inspect from .errors import ParameterTypeResolveError class ParameterTypeResolver: ''' desgin for resolve type from parameter. ''' def __init__(self, name_map: typing.Dict[str, type]): self._name_map = name_map.copy() def resolve(self, parameter: inspect.Parameter, allow_none): if parameter.annotation is inspect.Parameter.empty: typ = self._name_map.get(parameter.name) if typ is None: msg = "cannot resolve parameter type from name: '{}'".format(parameter.name) raise ParameterTypeResolveError(msg) return typ elif isinstance(parameter.annotation, type): return parameter.annotation elif not allow_none: msg = 'cannot parse type from annotation: {}'.format(parameter.annotation) raise ParameterTypeResolveError(msg)
[ 1, 529, 276, 1112, 420, 29958, 29907, 1189, 1358, 29914, 10836, 262, 6929, 29899, 4691, 29966, 9507, 29958, 10836, 262, 6929, 29914, 7564, 29914, 3207, 29918, 1853, 29918, 9778, 369, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 30022, 29906, 29929, 29929, 29929, 448, 784, 468, 1358, 3532, 26862, 6227, 6778, 13, 29937, 448, 1378, 29899, 13, 29937, 13, 29937, 448, 1378, 29899, 13, 13, 5215, 19229, 13, 5215, 16096, 13, 3166, 869, 12523, 1053, 24953, 1542, 12375, 345, 2392, 13, 13, 1990, 24953, 1542, 19648, 29901, 13, 1678, 14550, 553, 5359, 363, 8814, 1134, 515, 3443, 29889, 14550, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29918, 1958, 29901, 19229, 29889, 21533, 29961, 710, 29892, 1134, 29962, 1125, 13, 4706, 1583, 3032, 978, 29918, 1958, 353, 1024, 29918, 1958, 29889, 8552, 580, 13, 13, 1678, 822, 8814, 29898, 1311, 29892, 3443, 29901, 16096, 29889, 9329, 29892, 2758, 29918, 9290, 1125, 13, 4706, 565, 3443, 29889, 18317, 338, 16096, 29889, 9329, 29889, 6310, 29901, 13, 9651, 2393, 353, 1583, 3032, 978, 29918, 1958, 29889, 657, 29898, 15501, 29889, 978, 29897, 13, 9651, 565, 2393, 338, 6213, 29901, 13, 18884, 10191, 353, 376, 29883, 6735, 8814, 3443, 1134, 515, 1024, 29901, 525, 8875, 29915, 1642, 4830, 29898, 15501, 29889, 978, 29897, 13, 18884, 12020, 24953, 1542, 12375, 345, 2392, 29898, 7645, 29897, 13, 9651, 736, 2393, 13, 13, 4706, 25342, 338, 8758, 29898, 15501, 29889, 18317, 29892, 1134, 1125, 13, 9651, 736, 3443, 29889, 18317, 13, 13, 4706, 25342, 451, 2758, 29918, 9290, 29901, 13, 9651, 10191, 353, 525, 29883, 6735, 6088, 1134, 515, 17195, 29901, 6571, 4286, 4830, 29898, 15501, 29889, 18317, 29897, 13, 9651, 12020, 24953, 1542, 12375, 345, 2392, 29898, 7645, 29897, 13, 2 ]
feed/models.py
Lisgevan/DJANGO-101-PROJECT-COPY
0
14920
from django.db import models from sorl.thumbnail import ImageField # Create your models here. class Post(models.Model): text = models.CharField(max_length=140, blank=False, null=False) image = ImageField() def __str__(self): return self.text
[ 1, 515, 9557, 29889, 2585, 1053, 4733, 13, 3166, 7319, 29880, 29889, 386, 21145, 1053, 7084, 3073, 13, 13, 29937, 6204, 596, 4733, 1244, 29889, 13, 1990, 4918, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1426, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29946, 29900, 29892, 9654, 29922, 8824, 29892, 1870, 29922, 8824, 29897, 13, 1678, 1967, 353, 7084, 3073, 580, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 726, 2 ]
curso/PY2/condicao_aninhada/ex4.py
smrsassa/Studying-Python
1
189781
<reponame>smrsassa/Studying-Python idade = int(input('digite sua idade: ')) if idade < 18: tf = 18 - idade print ('Ainda não é hora de fazer o alistamento') print ('O alistamento será necessario daqui {} anos'.format(tf)) elif idade == 18: print ('Esta na hora de se alistar') else: tf = idade - 18 print ('Passou do tempo para se alistar') print ('Voce esta {} anos atrasado'.format(tf)) print ('Alistar-se é importante')
[ 1, 529, 276, 1112, 420, 29958, 3844, 2288, 24573, 29914, 855, 566, 5414, 29899, 11980, 13, 5558, 353, 938, 29898, 2080, 877, 7501, 568, 4171, 1178, 1943, 29901, 525, 876, 13, 361, 1178, 1943, 529, 29871, 29896, 29947, 29901, 13, 1678, 15886, 353, 29871, 29896, 29947, 448, 1178, 1943, 13, 1678, 1596, 6702, 29909, 11054, 8145, 904, 298, 2207, 316, 16928, 261, 288, 394, 391, 4487, 1495, 13, 1678, 1596, 6702, 29949, 394, 391, 4487, 724, 29976, 3520, 2628, 1146, 6578, 6571, 14110, 4286, 4830, 29898, 13264, 876, 13, 23681, 1178, 1943, 1275, 29871, 29896, 29947, 29901, 13, 1678, 1596, 6702, 29923, 5173, 1055, 298, 2207, 316, 409, 394, 391, 279, 1495, 13, 2870, 29901, 13, 1678, 15886, 353, 1178, 1943, 448, 29871, 29896, 29947, 13, 1678, 1596, 6702, 7129, 283, 437, 11413, 1702, 409, 394, 391, 279, 1495, 13, 1678, 1596, 6702, 29963, 25802, 7444, 6571, 14110, 472, 3417, 912, 4286, 4830, 29898, 13264, 876, 13, 2158, 6702, 29909, 1761, 279, 29899, 344, 904, 13483, 1495, 2 ]
docs.bak/test.py
goujou/CompartmentalSystems
0
17386
<reponame>goujou/CompartmentalSystems<gh_stars>0 from CompartmentalSystems import smooth_reservoir_model from CompartmentalSystems import smooth_model_run from CompartmentalSystems import start_distributions
[ 1, 529, 276, 1112, 420, 29958, 29887, 283, 20551, 29914, 1523, 8076, 284, 3924, 29879, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 422, 8076, 284, 3924, 29879, 1053, 10597, 29918, 690, 261, 7869, 29918, 4299, 13, 3166, 422, 8076, 284, 3924, 29879, 1053, 10597, 29918, 4299, 29918, 3389, 13, 3166, 422, 8076, 284, 3924, 29879, 1053, 1369, 29918, 27691, 29879, 13, 13, 2 ]
distance_travelled.py
maria-kuruvilla/temp_collective_new
0
160140
""" Goal - Calculate distance travelled by each fish Date - Mar 11 2021 """ import os import pathlib from pprint import pprint import numpy as np from scipy import stats from scipy.spatial import distance import matplotlib.pyplot as plt from matplotlib.pyplot import figure import trajectorytools as tt import trajectorytools.plot as ttplot import trajectorytools.socialcontext as ttsocial from trajectorytools.constants import dir_of_data import csv import pickle import argparse import pandas as pd def position(tr): #shape returns tr.s.shape return(tr.s) def speed(tr): #speed(tr).shape returns tr.speed.shape - 2 v = (position(tr)[2:] - position(tr)[:-2]) / 2 b = np.linalg.norm(v, axis=-1) return(b*60) def acceleration(tr): #shape returns tr.acceleration.shape - 2 a = position(tr)[2:] - 2 * position(tr)[1:-1] + position(tr)[:-2] aa = np.linalg.norm(a, axis=-1) return(aa*3600) def e(tr): #e.shape returns tr.speed.shape - 2 vel = (position(tr)[2:] - position(tr)[:-2]) / 2 n = np.linalg.norm(v,axis = 2) return(vel/n[...,np.newaxis]) def filter_low_pass(tr, roi1 = 30, roi2 = 3340): #ind (for individual) starts from 0, roi - edge of region of interest position_mask0 = np.ma.masked_where((speed(tr)[1:-1] > roi1)|(speed(tr)[0:-2] > roi1)|(speed(tr)[2:] > roi1)|(acceleration(tr)[1:-1] > roi2)|(acceleration(tr)[0:-2] > roi2)|(acceleration(tr)[2:] > roi2), position(tr)[2:-2,:,0],copy=False) position_mask1 = np.ma.masked_where((speed(tr)[1:-1] > roi1)|(speed(tr)[0:-2] > roi1)|(speed(tr)[2:] > roi1)|(acceleration(tr)[1:-1] > roi2)|(acceleration(tr)[0:-2] > roi2)|(acceleration(tr)[2:] > roi2), position(tr)[2:-2,:,1],copy=False) return(position_mask0,position_mask1) def filter_speed_low_pass(tr, roi1 = 30, roi2 = 3340): speed_mask = np.ma.masked_where((speed(tr) > roi1)|(acceleration(tr) > roi2), speed(tr),copy=False) return(speed_mask) def filter_acc_low_pass(tr, roi1 = 30, roi2 = 3340): acc_mask = np.ma.masked_where((speed(tr) > roi1)|(acceleration(tr) > roi2), acceleration(tr),copy=False) return(acc_mask)#[~acc_mask.mask].data) def distance_loom(tr, looms, n, roi1 = 30, roi2 = 3340): d = filter_speed_low_pass(tr,roi1,roi2)[(looms[n]+500):(looms[n] + 700)] dd = d.sum(axis=0) return(np.nanmean(dd)/60) def distance_before_loom(tr, looms,roi1 = 30, roi2 = 3340): d = filter_speed_low_pass(tr,roi1,roi2)[0:(looms[0]+500)] dd = d.sum(axis=0) return(np.nanmean(dd)/60) def distance_total(tr, roi1 = 30, roi2 = 3340): d = filter_speed_low_pass(tr,roi1,roi2)[0:80000] dd = d.sum(axis=0) return(np.nanmean(dd)/60) temperature = [9,13,17,21,25,29]#range(9,30,4) group = [1,2,4,8,16] replication = range(10) # number of replicates per treatment met = pd.read_csv('../../data/temp_collective/roi/metadata_w_loom.csv') with open('../../data/temp_collective/roi/distance_wo_loom.csv', mode='w') as stats_speed: writer = csv.writer(stats_speed, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) writer.writerow([ 'Temperature', 'Groupsize', 'Replicate', 'Trial', 'Date', 'Subtrial', 'Time_fish_in', 'Time_start_record','Distance before loom','Total distance']) for i in temperature: for j in group: for k in replication: #print(i,j,k+1) if j == 1: trajectories_file_path = '../../data/temp_collective/roi/'+str(i)+'/' +str(j)+'/GS_'+str(j)+'_T_'+str(i)+'_roi_'+str(k+1)+'/trajectories.npy' else: trajectories_file_path = '../../data/temp_collective/roi/'+str(i)+'/' +str(j)+'/GS_'+str(j)+'_T_'+str(i)+'_roi_'+str(k+1)+'/trajectories_wo_gaps.npy' try: tr = tt.Trajectories.from_idtrackerai(trajectories_file_path, center=True).normalise_by('body_length') tr.new_time_unit(tr.params['frame_rate'], 'seconds') except FileNotFoundError: print(i,j,k) print('File not found') continue looms = [] for m in range(len(met.Temperature)): if met.Temperature[m] == i and met.Groupsize[m] == j and met.Replicate[m] == (k+1): looms.append(met['Loom 1'][m]) looms.append(met['Loom 2'][m]) looms.append(met['Loom 3'][m]) looms.append(met['Loom 4'][m]) looms.append(met['Loom 5'][m]) writer.writerow([ i,j,k+1,met.Trial[m],met.Date[m],met.Subtrial[m], met.Time_fish_in[m],met.Time_start_record[m], distance_before_loom(tr,looms), distance_total(tr)])
[ 1, 9995, 13, 8120, 284, 448, 20535, 403, 5418, 9850, 839, 491, 1269, 9427, 29871, 13, 2539, 448, 1085, 29871, 29896, 29896, 29871, 29906, 29900, 29906, 29896, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 5215, 2224, 1982, 13, 3166, 282, 2158, 1053, 282, 2158, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 4560, 2272, 1053, 22663, 13, 3166, 4560, 2272, 29889, 1028, 15238, 1053, 5418, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 22889, 29889, 2272, 5317, 1053, 4377, 13, 13, 5215, 23324, 706, 8504, 408, 260, 29873, 13, 5215, 23324, 706, 8504, 29889, 5317, 408, 260, 29873, 5317, 13, 5215, 23324, 706, 8504, 29889, 24911, 4703, 408, 260, 29873, 24911, 13, 3166, 23324, 706, 8504, 29889, 3075, 1934, 1053, 4516, 29918, 974, 29918, 1272, 13, 5215, 11799, 13, 5215, 5839, 280, 13, 5215, 1852, 5510, 13, 5215, 11701, 408, 10518, 13, 13, 1753, 2602, 29898, 509, 1125, 396, 12181, 3639, 534, 29889, 29879, 29889, 12181, 13, 1678, 736, 29898, 509, 29889, 29879, 29897, 13, 13, 13, 1753, 6210, 29898, 509, 1125, 396, 19322, 29898, 509, 467, 12181, 3639, 534, 29889, 19322, 29889, 12181, 448, 29871, 29906, 13, 1678, 325, 353, 313, 3283, 29898, 509, 9601, 29906, 17531, 448, 2602, 29898, 509, 29897, 7503, 29899, 29906, 2314, 847, 29871, 29906, 13, 1678, 289, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29894, 29892, 9685, 10457, 29896, 29897, 13, 1678, 736, 29898, 29890, 29930, 29953, 29900, 29897, 13, 13, 1753, 28178, 29898, 509, 1125, 396, 12181, 3639, 534, 29889, 562, 2242, 261, 362, 29889, 12181, 448, 29871, 29906, 13, 1678, 263, 353, 2602, 29898, 509, 9601, 29906, 17531, 448, 29871, 29906, 334, 2602, 29898, 509, 9601, 29896, 13018, 29896, 29962, 718, 2602, 29898, 509, 29897, 7503, 29899, 29906, 29962, 13, 1678, 29099, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29874, 29892, 9685, 10457, 29896, 29897, 259, 13, 1678, 736, 29898, 7340, 29930, 29941, 29953, 29900, 29900, 29897, 13, 308, 13, 1753, 321, 29898, 509, 1125, 396, 29872, 29889, 12181, 3639, 534, 29889, 19322, 29889, 12181, 448, 29871, 29906, 13, 1678, 5343, 353, 313, 3283, 29898, 509, 9601, 29906, 17531, 448, 2602, 29898, 509, 29897, 7503, 29899, 29906, 2314, 847, 29871, 29906, 13, 1678, 302, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 29894, 29892, 8990, 353, 29871, 29906, 29897, 259, 13, 1678, 736, 29898, 955, 29914, 29876, 29961, 16361, 9302, 29889, 1482, 8990, 2314, 13, 13, 13, 1753, 4175, 29918, 677, 29918, 3364, 29898, 509, 29892, 14100, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 396, 513, 313, 1454, 5375, 29897, 8665, 515, 29871, 29900, 29892, 14100, 448, 7636, 310, 5120, 310, 4066, 13, 1678, 2602, 29918, 13168, 29900, 353, 7442, 29889, 655, 29889, 13168, 287, 29918, 3062, 3552, 19322, 29898, 509, 9601, 29896, 13018, 29896, 29962, 1405, 14100, 29896, 10531, 29898, 19322, 29898, 509, 9601, 29900, 13018, 29906, 29962, 1405, 14100, 29896, 10531, 29898, 19322, 29898, 509, 9601, 29906, 17531, 1405, 14100, 29896, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29896, 13018, 29896, 29962, 1405, 14100, 29906, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29900, 13018, 29906, 29962, 1405, 14100, 29906, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29906, 17531, 1405, 14100, 29906, 511, 2602, 29898, 509, 9601, 29906, 13018, 29906, 29892, 29901, 29892, 29900, 1402, 8552, 29922, 8824, 29897, 13, 1678, 2602, 29918, 13168, 29896, 353, 7442, 29889, 655, 29889, 13168, 287, 29918, 3062, 3552, 19322, 29898, 509, 9601, 29896, 13018, 29896, 29962, 1405, 14100, 29896, 10531, 29898, 19322, 29898, 509, 9601, 29900, 13018, 29906, 29962, 1405, 14100, 29896, 10531, 29898, 19322, 29898, 509, 9601, 29906, 17531, 1405, 14100, 29896, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29896, 13018, 29896, 29962, 1405, 14100, 29906, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29900, 13018, 29906, 29962, 1405, 14100, 29906, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 9601, 29906, 17531, 1405, 14100, 29906, 511, 2602, 29898, 509, 9601, 29906, 13018, 29906, 29892, 29901, 29892, 29896, 1402, 8552, 29922, 8824, 29897, 13, 1678, 736, 29898, 3283, 29918, 13168, 29900, 29892, 3283, 29918, 13168, 29896, 29897, 462, 462, 29871, 13, 13, 1753, 4175, 29918, 19322, 29918, 677, 29918, 3364, 29898, 509, 29892, 14100, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 13, 1678, 6210, 29918, 13168, 353, 7442, 29889, 655, 29889, 13168, 287, 29918, 3062, 3552, 19322, 29898, 509, 29897, 1405, 14100, 29896, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 29897, 1405, 14100, 29906, 511, 6210, 29898, 509, 511, 8552, 29922, 8824, 29897, 13, 268, 13, 1678, 736, 29898, 19322, 29918, 13168, 29897, 3986, 13, 13, 1753, 4175, 29918, 5753, 29918, 677, 29918, 3364, 29898, 509, 29892, 14100, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 13, 1678, 1035, 29918, 13168, 353, 7442, 29889, 655, 29889, 13168, 287, 29918, 3062, 3552, 19322, 29898, 509, 29897, 1405, 14100, 29896, 10531, 29898, 562, 2242, 261, 362, 29898, 509, 29897, 1405, 14100, 29906, 511, 28178, 29898, 509, 511, 8552, 29922, 8824, 29897, 13, 268, 13, 1678, 736, 29898, 5753, 29918, 13168, 29897, 29937, 29961, 30022, 5753, 29918, 13168, 29889, 13168, 1822, 1272, 29897, 259, 13, 13, 1753, 5418, 29918, 417, 290, 29898, 509, 29892, 658, 4835, 29892, 302, 29892, 14100, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 13, 1678, 270, 353, 4175, 29918, 19322, 29918, 677, 29918, 3364, 29898, 509, 29892, 307, 29875, 29896, 29892, 307, 29875, 29906, 9601, 29898, 417, 4835, 29961, 29876, 10062, 29945, 29900, 29900, 1125, 29898, 417, 4835, 29961, 29876, 29962, 718, 29871, 29955, 29900, 29900, 4638, 13, 1678, 24488, 353, 270, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 13, 1678, 736, 29898, 9302, 29889, 13707, 12676, 29898, 1289, 6802, 29953, 29900, 29897, 13, 13, 1753, 5418, 29918, 11083, 29918, 417, 290, 29898, 509, 29892, 658, 4835, 29892, 307, 29875, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 13, 1678, 270, 353, 4175, 29918, 19322, 29918, 677, 29918, 3364, 29898, 509, 29892, 307, 29875, 29896, 29892, 307, 29875, 29906, 9601, 29900, 5919, 417, 4835, 29961, 29900, 10062, 29945, 29900, 29900, 4638, 13, 1678, 24488, 353, 270, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 13, 1678, 736, 29898, 9302, 29889, 13707, 12676, 29898, 1289, 6802, 29953, 29900, 29897, 13, 13, 1753, 5418, 29918, 7827, 29898, 509, 29892, 14100, 29896, 353, 29871, 29941, 29900, 29892, 14100, 29906, 353, 29871, 29941, 29941, 29946, 29900, 1125, 13, 1678, 270, 353, 4175, 29918, 19322, 29918, 677, 29918, 3364, 29898, 509, 29892, 307, 29875, 29896, 29892, 307, 29875, 29906, 9601, 29900, 29901, 29947, 29900, 29900, 29900, 29900, 29962, 13, 1678, 24488, 353, 270, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 13, 1678, 736, 29898, 9302, 29889, 13707, 12676, 29898, 1289, 6802, 29953, 29900, 29897, 13, 13, 12863, 1535, 353, 518, 29929, 29892, 29896, 29941, 29892, 29896, 29955, 29892, 29906, 29896, 29892, 29906, 29945, 29892, 29906, 29929, 29962, 29937, 3881, 29898, 29929, 29892, 29941, 29900, 29892, 29946, 29897, 13, 13, 2972, 353, 518, 29896, 29892, 29906, 29892, 29946, 29892, 29947, 29892, 29896, 29953, 29962, 13, 13, 3445, 1414, 353, 3464, 29898, 29896, 29900, 29897, 396, 1353, 310, 1634, 15815, 639, 14502, 13, 13, 2527, 353, 10518, 29889, 949, 29918, 7638, 877, 21546, 1272, 29914, 7382, 29918, 15914, 573, 29914, 307, 29875, 29914, 19635, 29918, 29893, 29918, 417, 290, 29889, 7638, 1495, 13, 13, 2541, 1722, 877, 21546, 1272, 29914, 7382, 29918, 15914, 573, 29914, 307, 29875, 29914, 19244, 29918, 827, 29918, 417, 290, 29889, 7638, 742, 4464, 2433, 29893, 1495, 408, 22663, 29918, 19322, 29901, 13, 1678, 9227, 353, 11799, 29889, 13236, 29898, 16202, 29918, 19322, 29892, 28552, 29922, 742, 742, 14978, 3090, 2433, 29908, 742, 439, 11427, 29922, 7638, 29889, 13356, 2891, 29923, 29918, 16173, 2260, 29931, 29897, 13, 13, 1678, 9227, 29889, 13236, 340, 4197, 13, 4706, 525, 5776, 546, 1535, 742, 525, 24020, 675, 742, 525, 5612, 5926, 742, 525, 29911, 9315, 742, 525, 2539, 742, 525, 4035, 3626, 284, 742, 13, 4706, 525, 2481, 29918, 15161, 29918, 262, 742, 525, 2481, 29918, 2962, 29918, 11651, 3788, 27469, 1434, 658, 290, 3788, 11536, 5418, 11287, 13, 13, 1678, 363, 474, 297, 10430, 29901, 13, 308, 13, 4706, 363, 432, 297, 2318, 29901, 13, 632, 13, 13, 9651, 363, 413, 297, 1634, 1414, 29901, 13, 18884, 396, 2158, 29898, 29875, 29892, 29926, 29892, 29895, 29974, 29896, 29897, 13, 18884, 565, 432, 1275, 29871, 29896, 29901, 13, 462, 1678, 23324, 3842, 29918, 1445, 29918, 2084, 353, 525, 21546, 1272, 29914, 7382, 29918, 15914, 573, 29914, 307, 29875, 29914, 18717, 710, 29898, 29875, 7240, 29915, 22208, 718, 710, 29898, 29926, 7240, 29915, 29914, 10749, 29918, 18717, 710, 29898, 29926, 7240, 15972, 29911, 29918, 18717, 710, 29898, 29875, 7240, 15972, 307, 29875, 29918, 18717, 710, 29898, 29895, 29974, 29896, 7240, 29915, 29914, 3018, 622, 3842, 29889, 29876, 2272, 29915, 13, 18884, 1683, 29901, 13, 462, 1678, 23324, 3842, 29918, 1445, 29918, 2084, 353, 525, 21546, 1272, 29914, 7382, 29918, 15914, 573, 29914, 307, 29875, 29914, 18717, 710, 29898, 29875, 7240, 29915, 22208, 718, 710, 29898, 29926, 7240, 29915, 29914, 10749, 29918, 18717, 710, 29898, 29926, 7240, 15972, 29911, 29918, 18717, 710, 29898, 29875, 7240, 15972, 307, 29875, 29918, 18717, 710, 29898, 29895, 29974, 29896, 7240, 29915, 29914, 3018, 622, 3842, 29918, 827, 29918, 29887, 2547, 29889, 29876, 2272, 29915, 13, 18884, 1018, 29901, 13, 462, 1678, 534, 353, 260, 29873, 29889, 5323, 622, 3842, 29889, 3166, 29918, 333, 11294, 1572, 29875, 29898, 3018, 622, 3842, 29918, 1445, 29918, 2084, 29892, 4818, 29922, 5574, 467, 8945, 895, 29918, 1609, 877, 2587, 29918, 2848, 1495, 13, 462, 268, 13, 462, 1678, 534, 29889, 1482, 29918, 2230, 29918, 5441, 29898, 509, 29889, 7529, 1839, 2557, 29918, 10492, 7464, 525, 23128, 1495, 13, 462, 268, 13, 18884, 5174, 3497, 17413, 2392, 29901, 13, 462, 1678, 1596, 29898, 29875, 29892, 29926, 29892, 29895, 29897, 13, 462, 1678, 1596, 877, 2283, 451, 1476, 1495, 13, 462, 1678, 6773, 13, 462, 29871, 13, 462, 13, 18884, 658, 4835, 353, 5159, 13, 18884, 363, 286, 297, 3464, 29898, 2435, 29898, 2527, 29889, 5776, 546, 1535, 22164, 13, 462, 1678, 565, 1539, 29889, 5776, 546, 1535, 29961, 29885, 29962, 1275, 474, 322, 1539, 29889, 24020, 675, 29961, 29885, 29962, 1275, 432, 322, 1539, 29889, 5612, 5926, 29961, 29885, 29962, 1275, 313, 29895, 29974, 29896, 1125, 29871, 13, 462, 4706, 658, 4835, 29889, 4397, 29898, 2527, 1839, 3410, 290, 29871, 29896, 2033, 29961, 29885, 2314, 29871, 13, 462, 4706, 658, 4835, 29889, 4397, 29898, 2527, 1839, 3410, 290, 29871, 29906, 2033, 29961, 29885, 2314, 29871, 13, 462, 4706, 658, 4835, 29889, 4397, 29898, 2527, 1839, 3410, 290, 29871, 29941, 2033, 29961, 29885, 2314, 29871, 13, 462, 4706, 658, 4835, 29889, 4397, 29898, 2527, 1839, 3410, 290, 29871, 29946, 2033, 29961, 29885, 2314, 29871, 13, 462, 4706, 658, 4835, 29889, 4397, 29898, 2527, 1839, 3410, 290, 29871, 29945, 2033, 29961, 29885, 2314, 13, 462, 4706, 9227, 29889, 13236, 340, 4197, 13, 462, 18884, 474, 29892, 29926, 29892, 29895, 29974, 29896, 29892, 2527, 29889, 29911, 9315, 29961, 29885, 1402, 2527, 29889, 2539, 29961, 29885, 1402, 2527, 29889, 4035, 3626, 284, 29961, 29885, 1402, 13, 462, 18884, 1539, 29889, 2481, 29918, 15161, 29918, 262, 29961, 29885, 1402, 2527, 29889, 2481, 29918, 2962, 29918, 11651, 29961, 29885, 1402, 13, 462, 18884, 5418, 29918, 11083, 29918, 417, 290, 29898, 509, 29892, 417, 4835, 511, 5418, 29918, 7827, 29898, 509, 29897, 2314, 13, 462, 2 ]
experiments/timit/config.py
mdenil/parameter_prediction
7
115984
import numpy as np import os import sys data_dir = "/global/scratch/bshakibi/data/timit" base_dir = "scratch_space_COV" template_dir = "templates/COV" NVIS = 429 # This dictionary is available to all templates. # You can add parameters here. global_template_params = { } def _n_atoms_per_column(n_vis, n_columns, prop): return int(int(n_vis / n_columns) * prop) def _n_hid_per_column(n_hid, n_columns): return int(n_hid / n_columns) def _n_hid_total(n_hid, n_columns): return _n_hid_per_column(n_hid, n_columns) * n_columns def get_job( n_hid, n_columns, prop, n_epochs, n_atoms_dict, n_epochs_dict, ): return { "templates": [ # model config files { "target": "pretrain_layer1.yaml", "params_target": "pretrain_layer1_params.yaml", "src": "pretrain_layer1.yaml", "params": { "n_epochs": n_epochs[0], "n_vis": NVIS, "columns": [ { "n_atoms": _n_atoms_per_column(NVIS, n_columns, prop), "n_hid": _n_hid_per_column(n_hid, n_columns) }, ] * n_columns, }, }, { "target": "pretrain_layer2.yaml", "params_target": "pretrain_layer2_params.yaml", "src": "pretrain_layer2.yaml", "params": { "n_epochs": n_epochs[1], "n_vis": _n_hid_total(n_hid, n_columns), "columns": [ { "n_atoms": _n_atoms_per_column(_n_hid_total(n_hid, n_columns), n_columns, prop), "n_hid": _n_hid_per_column(n_hid, n_columns) }, ] * n_columns, }, }, { "target": "finetune_all.yaml", "params_target": "finetune_all_params.yaml", "src": "finetune_all.yaml", "params": { "n_epochs": n_epochs[2], "n_vis": NVIS, }, }, # launcher { "target": "launcher.sh", "params_target": "launcher_params.yaml", "src": "launcher.pbs", "params": { "data_dir": data_dir, }, }, ], "task_params": { "launcher_file": "launcher.sh", }, }
[ 1, 1053, 12655, 408, 7442, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 1272, 29918, 3972, 353, 5591, 10945, 29914, 10526, 905, 29914, 29890, 845, 557, 747, 29875, 29914, 1272, 29914, 9346, 277, 29908, 13, 3188, 29918, 3972, 353, 376, 10526, 905, 29918, 3493, 29918, 3217, 29963, 29908, 13, 6886, 29918, 3972, 353, 376, 20943, 29914, 3217, 29963, 29908, 13, 29940, 28607, 353, 29871, 29946, 29906, 29929, 13, 13, 29937, 910, 8600, 338, 3625, 304, 599, 17475, 29889, 13, 29937, 887, 508, 788, 4128, 1244, 29889, 13, 10945, 29918, 6886, 29918, 7529, 353, 426, 13, 1678, 500, 13, 13, 1753, 903, 29876, 29918, 271, 4835, 29918, 546, 29918, 4914, 29898, 29876, 29918, 1730, 29892, 302, 29918, 13099, 29892, 3107, 1125, 13, 1678, 736, 938, 29898, 524, 29898, 29876, 29918, 1730, 847, 302, 29918, 13099, 29897, 334, 3107, 29897, 13, 13, 1753, 903, 29876, 29918, 29882, 333, 29918, 546, 29918, 4914, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 1125, 13, 1678, 736, 938, 29898, 29876, 29918, 29882, 333, 847, 302, 29918, 13099, 29897, 13, 13, 1753, 903, 29876, 29918, 29882, 333, 29918, 7827, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 1125, 13, 1678, 736, 903, 29876, 29918, 29882, 333, 29918, 546, 29918, 4914, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 29897, 334, 302, 29918, 13099, 13, 13, 1753, 679, 29918, 9057, 29898, 13, 4706, 302, 29918, 29882, 333, 29892, 13, 4706, 302, 29918, 13099, 29892, 13, 4706, 3107, 29892, 13, 4706, 302, 29918, 1022, 2878, 29879, 29892, 13, 4706, 302, 29918, 271, 4835, 29918, 8977, 29892, 13, 4706, 302, 29918, 1022, 2878, 29879, 29918, 8977, 29892, 13, 308, 1125, 13, 1678, 736, 426, 13, 4706, 376, 20943, 1115, 518, 13, 9651, 396, 1904, 2295, 2066, 13, 965, 426, 13, 18884, 376, 5182, 1115, 376, 1457, 14968, 29918, 13148, 29896, 29889, 25162, 613, 13, 18884, 376, 7529, 29918, 5182, 1115, 376, 1457, 14968, 29918, 13148, 29896, 29918, 7529, 29889, 25162, 613, 13, 18884, 376, 4351, 1115, 376, 1457, 14968, 29918, 13148, 29896, 29889, 25162, 613, 13, 18884, 376, 7529, 1115, 426, 13, 462, 1678, 376, 29876, 29918, 1022, 2878, 29879, 1115, 302, 29918, 1022, 2878, 29879, 29961, 29900, 1402, 13, 462, 1678, 376, 29876, 29918, 1730, 1115, 405, 28607, 29892, 13, 462, 1678, 376, 13099, 1115, 518, 13, 462, 4706, 426, 13, 462, 9651, 376, 29876, 29918, 271, 4835, 1115, 903, 29876, 29918, 271, 4835, 29918, 546, 29918, 4914, 29898, 29940, 28607, 29892, 302, 29918, 13099, 29892, 3107, 511, 13, 462, 9651, 376, 29876, 29918, 29882, 333, 1115, 903, 29876, 29918, 29882, 333, 29918, 546, 29918, 4914, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 29897, 13, 462, 4706, 2981, 13, 462, 1678, 4514, 334, 302, 29918, 13099, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 13, 9651, 426, 13, 18884, 376, 5182, 1115, 376, 1457, 14968, 29918, 13148, 29906, 29889, 25162, 613, 13, 18884, 376, 7529, 29918, 5182, 1115, 376, 1457, 14968, 29918, 13148, 29906, 29918, 7529, 29889, 25162, 613, 13, 18884, 376, 4351, 1115, 376, 1457, 14968, 29918, 13148, 29906, 29889, 25162, 613, 13, 18884, 376, 7529, 1115, 426, 13, 462, 1678, 376, 29876, 29918, 1022, 2878, 29879, 1115, 302, 29918, 1022, 2878, 29879, 29961, 29896, 1402, 13, 462, 1678, 376, 29876, 29918, 1730, 1115, 903, 29876, 29918, 29882, 333, 29918, 7827, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 511, 13, 462, 1678, 376, 13099, 1115, 518, 13, 462, 4706, 426, 13, 462, 9651, 376, 29876, 29918, 271, 4835, 1115, 903, 29876, 29918, 271, 4835, 29918, 546, 29918, 4914, 7373, 29876, 29918, 29882, 333, 29918, 7827, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 511, 302, 29918, 13099, 29892, 3107, 511, 13, 462, 9651, 376, 29876, 29918, 29882, 333, 1115, 903, 29876, 29918, 29882, 333, 29918, 546, 29918, 4914, 29898, 29876, 29918, 29882, 333, 29892, 302, 29918, 13099, 29897, 13, 462, 4706, 2981, 13, 462, 1678, 4514, 334, 302, 29918, 13099, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 632, 13, 9651, 426, 13, 18884, 376, 5182, 1115, 376, 4951, 300, 1540, 29918, 497, 29889, 25162, 613, 13, 18884, 376, 7529, 29918, 5182, 1115, 376, 4951, 300, 1540, 29918, 497, 29918, 7529, 29889, 25162, 613, 13, 18884, 376, 4351, 1115, 376, 4951, 300, 1540, 29918, 497, 29889, 25162, 613, 13, 18884, 376, 7529, 1115, 426, 13, 462, 1678, 376, 29876, 29918, 1022, 2878, 29879, 1115, 302, 29918, 1022, 2878, 29879, 29961, 29906, 1402, 13, 462, 1678, 376, 29876, 29918, 1730, 1115, 405, 28607, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 632, 13, 9651, 396, 6826, 261, 13, 9651, 426, 13, 18884, 376, 5182, 1115, 376, 15343, 261, 29889, 845, 613, 13, 18884, 376, 7529, 29918, 5182, 1115, 376, 15343, 261, 29918, 7529, 29889, 25162, 613, 13, 18884, 376, 4351, 1115, 376, 15343, 261, 29889, 29886, 5824, 613, 13, 18884, 376, 7529, 1115, 426, 13, 462, 1678, 376, 1272, 29918, 3972, 1115, 848, 29918, 3972, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 9651, 21251, 13, 4706, 376, 7662, 29918, 7529, 1115, 426, 13, 9651, 376, 15343, 261, 29918, 1445, 1115, 376, 15343, 261, 29889, 845, 613, 13, 4706, 2981, 13, 1678, 500, 13, 13, 2 ]
tools/zoom_flamegraph.py
allevo/rust-advent
16
128850
import fileinput import io from html import escape from html.entities import name2codepoint from html.parser import HTMLParser class MyHTMLParser(HTMLParser): script = False in_a_g = False record_next_y = False g_buffer = None y_limit = None g_current_y = None g_dict = dict() def _print(self, s): if self.g_buffer is not None: print(s, file=self.g_buffer) else: print(s) def handle_starttag(self, tag, attrs): formatted_attrs = "" for k, v in attrs: formatted_attrs += f' {k}="{v}"' if k == "y": y = float(v) if self.record_next_y: self.y_limit = y self.record_next_y = False if self.g_current_y is None or self.g_current_y > y: self.g_current_y = y if tag == "script": self.script = True elif tag == "g": self.in_a_g = True self.g_buffer = io.StringIO() self.g_current_y = None self._print(f"<{tag}{formatted_attrs}>") def handle_endtag(self, tag): self._print(f"</{tag}>") if tag == "script": self.script = False elif tag == "g": if self.y_limit and self.g_current_y <= self.y_limit: print(self.g_buffer.getvalue()) self.in_a_g = False self.g_buffer.close() self.g_buffer = None def handle_data(self, data): if not self.script: data = escape(data) if "::bench " in data: self.record_next_y = True self._print(data) def handle_decl(self, data): self._print(f"<!{data}>") def handle_pi(self, data): self._print(f"<?{data}>") def handle_comment(self, data): self._print(f"<!--{data}-->") def handle_entityref(self, name): c = chr(name2codepoint[name]) raise NotImplementedError(f"Named ent: {c}") def handle_charref(self, name): if name.startswith("x"): c = chr(int(name[1:], 16)) else: c = chr(int(name)) raise NotImplementedError(f"Num ent: {c}") parser = MyHTMLParser() for line in fileinput.input(): parser.feed(line)
[ 1, 1053, 934, 2080, 13, 5215, 12013, 13, 3166, 3472, 1053, 10169, 13, 3166, 3472, 29889, 296, 1907, 1053, 1024, 29906, 401, 3149, 13, 3166, 3472, 29889, 16680, 1053, 4544, 11726, 13, 13, 13, 1990, 1619, 7020, 11726, 29898, 7020, 11726, 1125, 13, 1678, 2471, 353, 7700, 13, 1678, 297, 29918, 29874, 29918, 29887, 353, 7700, 13, 1678, 2407, 29918, 4622, 29918, 29891, 353, 7700, 13, 1678, 330, 29918, 9040, 353, 6213, 13, 1678, 343, 29918, 13400, 353, 6213, 13, 1678, 330, 29918, 3784, 29918, 29891, 353, 6213, 13, 1678, 330, 29918, 8977, 353, 9657, 580, 13, 13, 1678, 822, 903, 2158, 29898, 1311, 29892, 269, 1125, 13, 4706, 565, 1583, 29889, 29887, 29918, 9040, 338, 451, 6213, 29901, 13, 9651, 1596, 29898, 29879, 29892, 934, 29922, 1311, 29889, 29887, 29918, 9040, 29897, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 29879, 29897, 13, 13, 1678, 822, 4386, 29918, 2962, 4039, 29898, 1311, 29892, 4055, 29892, 12421, 29879, 1125, 13, 4706, 20917, 29918, 5552, 29879, 353, 5124, 13, 4706, 363, 413, 29892, 325, 297, 12421, 29879, 29901, 13, 9651, 20917, 29918, 5552, 29879, 4619, 285, 29915, 426, 29895, 29913, 10724, 29894, 5038, 29915, 13, 9651, 565, 413, 1275, 376, 29891, 1115, 13, 18884, 343, 353, 5785, 29898, 29894, 29897, 13, 18884, 565, 1583, 29889, 11651, 29918, 4622, 29918, 29891, 29901, 13, 462, 1678, 1583, 29889, 29891, 29918, 13400, 353, 343, 13, 462, 1678, 1583, 29889, 11651, 29918, 4622, 29918, 29891, 353, 7700, 13, 18884, 565, 1583, 29889, 29887, 29918, 3784, 29918, 29891, 338, 6213, 470, 1583, 29889, 29887, 29918, 3784, 29918, 29891, 1405, 343, 29901, 13, 462, 1678, 1583, 29889, 29887, 29918, 3784, 29918, 29891, 353, 343, 13, 13, 4706, 565, 4055, 1275, 376, 2154, 1115, 13, 9651, 1583, 29889, 2154, 353, 5852, 13, 4706, 25342, 4055, 1275, 376, 29887, 1115, 13, 9651, 1583, 29889, 262, 29918, 29874, 29918, 29887, 353, 5852, 13, 9651, 1583, 29889, 29887, 29918, 9040, 353, 12013, 29889, 1231, 5971, 580, 13, 9651, 1583, 29889, 29887, 29918, 3784, 29918, 29891, 353, 6213, 13, 13, 4706, 1583, 3032, 2158, 29898, 29888, 29908, 29966, 29912, 4039, 1157, 689, 19667, 29918, 5552, 29879, 17428, 1159, 13, 13, 1678, 822, 4386, 29918, 355, 4039, 29898, 1311, 29892, 4055, 1125, 13, 4706, 1583, 3032, 2158, 29898, 29888, 29908, 829, 29912, 4039, 17428, 1159, 13, 13, 4706, 565, 4055, 1275, 376, 2154, 1115, 13, 9651, 1583, 29889, 2154, 353, 7700, 13, 4706, 25342, 4055, 1275, 376, 29887, 1115, 13, 9651, 565, 1583, 29889, 29891, 29918, 13400, 322, 1583, 29889, 29887, 29918, 3784, 29918, 29891, 5277, 1583, 29889, 29891, 29918, 13400, 29901, 13, 18884, 1596, 29898, 1311, 29889, 29887, 29918, 9040, 29889, 657, 1767, 3101, 13, 13, 9651, 1583, 29889, 262, 29918, 29874, 29918, 29887, 353, 7700, 13, 9651, 1583, 29889, 29887, 29918, 9040, 29889, 5358, 580, 13, 9651, 1583, 29889, 29887, 29918, 9040, 353, 6213, 13, 13, 1678, 822, 4386, 29918, 1272, 29898, 1311, 29892, 848, 1125, 13, 4706, 565, 451, 1583, 29889, 2154, 29901, 13, 9651, 848, 353, 10169, 29898, 1272, 29897, 13, 4706, 565, 376, 1057, 1785, 305, 376, 297, 848, 29901, 13, 9651, 1583, 29889, 11651, 29918, 4622, 29918, 29891, 353, 5852, 13, 4706, 1583, 3032, 2158, 29898, 1272, 29897, 13, 13, 1678, 822, 4386, 29918, 27787, 29898, 1311, 29892, 848, 1125, 13, 4706, 1583, 3032, 2158, 29898, 29888, 29908, 29966, 29991, 29912, 1272, 17428, 1159, 13, 13, 1678, 822, 4386, 29918, 1631, 29898, 1311, 29892, 848, 1125, 13, 4706, 1583, 3032, 2158, 29898, 29888, 29908, 8169, 29912, 1272, 17428, 1159, 13, 13, 1678, 822, 4386, 29918, 9342, 29898, 1311, 29892, 848, 1125, 13, 4706, 1583, 3032, 2158, 29898, 29888, 29908, 14136, 29912, 1272, 29913, 15110, 1159, 13, 13, 1678, 822, 4386, 29918, 10041, 999, 29898, 1311, 29892, 1024, 1125, 13, 4706, 274, 353, 18460, 29898, 978, 29906, 401, 3149, 29961, 978, 2314, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 22175, 875, 29901, 426, 29883, 27195, 13, 13, 1678, 822, 4386, 29918, 3090, 999, 29898, 1311, 29892, 1024, 1125, 13, 4706, 565, 1024, 29889, 27382, 2541, 703, 29916, 29908, 1125, 13, 9651, 274, 353, 18460, 29898, 524, 29898, 978, 29961, 29896, 29901, 1402, 29871, 29896, 29953, 876, 13, 4706, 1683, 29901, 13, 9651, 274, 353, 18460, 29898, 524, 29898, 978, 876, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 29898, 29888, 29908, 8009, 875, 29901, 426, 29883, 27195, 13, 13, 13, 16680, 353, 1619, 7020, 11726, 580, 13, 1454, 1196, 297, 934, 2080, 29889, 2080, 7295, 13, 1678, 13812, 29889, 18798, 29898, 1220, 29897, 13, 2 ]
py300/py300To120.py
metacogpe/python
0
1617846
# # 사용자 입력 # data = input("") # print(data*2) # # 숫자 입력 + 식 # data = input("숫자를 입력하세요 : ") # print(int(data) + 10) # # 짝수 홀수 판별 # data = input(">> ") # data = int(data) # if data % 2 == 0: # print("짝수") # else: # print("홀수") # 200 # # 255를 초과하는지 여부 # data = input("입력값 : ") # data = int(data) # data = data +20 # if data >255: # print(255) # else: # print(data) # # # data = input("입력값:") # data = int(data) # if data <0: # print(0) # elif data>255: # print(255) # else: # print(data) # data = input("현재시간:") # if data[-2:] == "00": # 시간의 뒤에서 2자리만 보기 # print("정각입니다") # else: # print("정각이 아닙니다") # fruit = ["사과","포도","홍시"] # data = input("좋아하는 과일은?") # if data in fruit: # print("정답입니다.") # else: # print("오답입니다. ") # # 종목 경고 # wan_invest_list = ["MS", 'KAKAO'] # item = input("종목입력: ") # if item in wan_invest_list: # print("투자 경고") # else: # print("투자 정상") # 계절 딕셔너리 fruit ={"봄":"딸기","여름":"토마토","가을":"사과"} season = input("종하하는 계절은?") if season in fruit.keys(): print("정답") else: print("오답") # 과일 입력 fruit ={"봄":"딸기","여름":"토마토","가을":"사과"} fruit_mem = input("종하하는 과일은?") if fruit_mem in fruit.values(): print("정답") else: print("오답")
[ 1, 396, 396, 29871, 30791, 31737, 31013, 29871, 239, 161, 136, 238, 163, 168, 13, 29937, 848, 353, 1881, 703, 1159, 13, 29937, 1596, 29898, 1272, 29930, 29906, 29897, 13, 13, 29937, 396, 29871, 239, 139, 174, 31013, 29871, 239, 161, 136, 238, 163, 168, 718, 29871, 31895, 13, 29937, 848, 353, 1881, 703, 239, 139, 174, 31013, 31517, 29871, 239, 161, 136, 238, 163, 168, 30944, 31578, 31527, 584, 16521, 13, 29937, 1596, 29898, 524, 29898, 1272, 29897, 718, 29871, 29896, 29900, 29897, 13, 13, 13, 29937, 396, 29871, 239, 170, 160, 30970, 29871, 240, 156, 131, 30970, 29871, 240, 143, 147, 238, 182, 135, 13, 29937, 848, 353, 1881, 703, 6778, 16521, 13, 29937, 848, 353, 938, 29898, 1272, 29897, 13, 29937, 565, 848, 1273, 29871, 29906, 1275, 29871, 29900, 29901, 13, 29937, 268, 1596, 703, 239, 170, 160, 30970, 1159, 13, 29937, 1683, 29901, 13, 29937, 268, 1596, 703, 240, 156, 131, 30970, 1159, 13, 29937, 29871, 29906, 29900, 29900, 13, 13, 29937, 396, 29871, 29906, 29945, 29945, 31517, 29871, 239, 183, 139, 31906, 30944, 31081, 30811, 29871, 31457, 31279, 29871, 13, 29937, 848, 353, 1881, 703, 239, 161, 136, 238, 163, 168, 237, 179, 149, 584, 16521, 13, 29937, 848, 353, 938, 29898, 1272, 29897, 13, 29937, 848, 353, 848, 718, 29906, 29900, 13, 29937, 565, 848, 1405, 29906, 29945, 29945, 29901, 13, 29937, 268, 1596, 29898, 29906, 29945, 29945, 29897, 13, 29937, 1683, 29901, 13, 29937, 268, 1596, 29898, 1272, 29897, 13, 13, 29937, 396, 13, 29937, 848, 353, 1881, 703, 239, 161, 136, 238, 163, 168, 237, 179, 149, 29901, 1159, 13, 29937, 848, 353, 938, 29898, 1272, 29897, 13, 29937, 565, 848, 529, 29900, 29901, 13, 29937, 268, 1596, 29898, 29900, 29897, 13, 29937, 25342, 848, 29958, 29906, 29945, 29945, 29901, 13, 29937, 268, 1596, 29898, 29906, 29945, 29945, 29897, 13, 29937, 1683, 29901, 13, 29937, 268, 1596, 29898, 1272, 29897, 13, 13, 29937, 848, 353, 1881, 703, 31680, 31973, 30889, 237, 179, 135, 29901, 1159, 13, 29937, 565, 848, 14352, 29906, 17531, 1275, 376, 29900, 29900, 1115, 396, 29871, 30889, 237, 179, 135, 30708, 29871, 238, 149, 167, 31054, 31093, 29871, 29906, 31013, 30826, 31826, 29871, 31199, 30827, 29871, 13, 29937, 268, 1596, 703, 30852, 237, 179, 132, 239, 161, 136, 31063, 30709, 1159, 13, 29937, 1683, 29901, 13, 29937, 268, 1596, 703, 30852, 237, 179, 132, 30393, 29871, 30860, 238, 142, 156, 31063, 30709, 1159, 13, 13, 29937, 15774, 353, 6796, 30791, 31906, 3284, 240, 146, 175, 31136, 3284, 240, 156, 144, 30889, 3108, 13, 29937, 848, 353, 1881, 703, 239, 165, 142, 30860, 30944, 31081, 29871, 31906, 31153, 31354, 29973, 1159, 13, 29937, 565, 848, 297, 15774, 29901, 13, 29937, 268, 1596, 703, 30852, 238, 142, 184, 239, 161, 136, 31063, 30709, 23157, 13, 29937, 1683, 29901, 29871, 13, 29937, 268, 1596, 703, 31346, 238, 142, 184, 239, 161, 136, 31063, 30709, 29889, 16521, 13, 13, 29937, 396, 29871, 31930, 238, 173, 172, 29871, 31378, 31137, 13, 29937, 281, 273, 29918, 262, 10147, 29918, 1761, 353, 6796, 4345, 613, 525, 29968, 22311, 29909, 29949, 2033, 13, 29937, 2944, 353, 1881, 703, 31930, 238, 173, 172, 239, 161, 136, 238, 163, 168, 29901, 16521, 13, 29937, 565, 2944, 297, 281, 273, 29918, 262, 10147, 29918, 1761, 29901, 13, 29937, 268, 1596, 703, 240, 139, 175, 31013, 29871, 31378, 31137, 1159, 13, 29937, 1683, 29901, 29871, 13, 29937, 268, 1596, 703, 240, 139, 175, 31013, 29871, 30852, 31158, 1159, 13, 13, 29937, 29871, 237, 182, 135, 239, 163, 139, 29871, 238, 151, 152, 239, 136, 151, 238, 135, 139, 30826, 29871, 13, 29888, 9216, 353, 6377, 238, 183, 135, 4710, 238, 151, 187, 30827, 3284, 31457, 238, 169, 135, 4710, 240, 137, 163, 31417, 240, 137, 163, 3284, 30903, 31286, 4710, 30791, 31906, 9092, 13, 25682, 353, 1881, 703, 31930, 30944, 30944, 31081, 29871, 237, 182, 135, 239, 163, 139, 31354, 29973, 1159, 13, 361, 4259, 297, 15774, 29889, 8149, 7295, 13, 1678, 1596, 703, 30852, 238, 142, 184, 1159, 13, 2870, 29901, 13, 1678, 1596, 703, 31346, 238, 142, 184, 1159, 13, 13, 13, 29937, 29871, 31906, 31153, 29871, 239, 161, 136, 238, 163, 168, 29871, 13, 29888, 9216, 353, 6377, 238, 183, 135, 4710, 238, 151, 187, 30827, 3284, 31457, 238, 169, 135, 4710, 240, 137, 163, 31417, 240, 137, 163, 3284, 30903, 31286, 4710, 30791, 31906, 9092, 13, 29888, 9216, 29918, 6954, 353, 1881, 703, 31930, 30944, 30944, 31081, 29871, 31906, 31153, 31354, 29973, 1159, 13, 361, 15774, 29918, 6954, 297, 15774, 29889, 5975, 7295, 13, 1678, 1596, 703, 30852, 238, 142, 184, 1159, 13, 2870, 29901, 13, 1678, 1596, 703, 31346, 238, 142, 184, 1159, 2 ]
state-of-the-data-for-webgis/completeness.py
twever/state-of-the-data
18
1616035
<filename>state-of-the-data-for-webgis/completeness.py """----------------------------------------------------------------------------- Name: completeness.py Purpose: Creates the completness indicator from two caomparable feature classes. Description: This tool calculates the completeness score of a curve feature dataset by comparing your features to an alternative source of features (for example, Open Street Map features). Feature comparisons should be apples-to-apples. For example, you should compare road features to road features or water features to water features. Requirements: Python 2.7.x/Python3.x, ArcGIS 10.4+/Pro 1.2+ Author(s): <NAME>, Contractor for National Geospatial-Intelligence Agency (NGA) | <NAME>, Contractor for NGA Program Manager: <NAME>, NGA (<EMAIL>) Created: August 8, 2015 Upated: Fall 2016 | April, 2017 Copyright: Esri License: TBD -----------------------------------------------------------------------------""" from __future__ import division import pandas as pd import numpy as np import os import sys from collections import Counter import arcgis from arcgis.gis import GIS from arcgis.features import FeatureLayer from arcgis.features import SpatialDataFrame from arcgis.geometry import filters from arcgis.geometry import Geometry FIELDS = ['TDS_DENSITY', 'COMP_DENSITY', 'COMPLETENESS_VALUE', 'DIFFERENCE'] #-------------------------------------------------------------------------- class FunctionError(Exception): """ raised when a function fails to run """ pass #-------------------------------------------------------------------------- def trace(): """ trace finds the line, the filename and error message and returns it to the user """ import traceback tb = sys.exc_info()[2] tbinfo = traceback.format_tb(tb)[0] # script name + line number line = tbinfo.split(", ")[1] # Get Python syntax error # synerror = traceback.format_exc().splitlines()[-1] return line, __file__, synerror ###-------------------------------------------------------------------------- ##def extend_table(table, rows=None): ## """ ## Adds the required columns to the table and appends new records if ## given. ## """ ## try: ## if rows is None: ## rows = [] ## dtypes = np.dtype( ## [ ## ('_ID', np.int), ## ('TDS_DENSITY', np.float64), ## ('COMP_DENSITY', np.float64), ## ('COMPLETENESS_VALUE', np.float64), ## ('DIFFERENCE', np.float64) ## ] ## ) ## array = np.array(rows, dtypes) ## da.ExtendTable(table, "OID@", array, "_ID", False) ## return table ## except: ## line, filename, synerror = trace() ## raise FunctionError( ## { ## "function": "extend_table", ## "line": line, ## "filename": filename, ## "synerror": synerror, ## "arc" : str(arcpy.GetMessages(2)) ## } ## ) def get_score(ratio, baseVal, inputVal): if inputVal > 0: #ratio = baseVal/inputVal if (ratio >= 0 and ratio <= 0.5): result = 1 elif (ratio > 0.5 and ratio <= 0.75): result = 2 elif (ratio > 0.75 and ratio <= 1.25): result = 3 elif (ratio > 1.25 and ratio <= 1.5): result = 4 elif (ratio > 1.5): result = 5 else: result = 0 else: if baseVal > 0: result = 5 else: result = 0 return result #-------------------------------------------------------------------------- def completeness(gis, df_after, df_before, output_features, grid_filter, geom): """ main driver of program """ try: out_fl = FeatureLayer(gis=gis, url=output_features) out_sdf = out_fl.query(geometry_filter=grid_filter,return_geometry=True, return_all_records=True).df geometry_type = df_after.geometry_type sq = df_before[df_before.geometry.notnull()].geometry.disjoint(geom) == False df_before = df_before[sq].copy() before_count = len(df_before) sq = df_after[df_after.geometry.notnull()].geometry.disjoint(geom) == False df_after = df_after[sq].copy() after_count = len(df_after) geoms_after = df_after.clip(geom.extent) geoms_before = df_before.clip(geom.extent) geoms_before_sdf = SpatialDataFrame(geometry=geoms_before) geoms_after_sdf = SpatialDataFrame(geometry=geoms_after) q_after = geoms_after_sdf.geometry.JSON == '{"paths":[]}' geoms_after_sdf = geoms_after_sdf[~q_after].copy() geoms_after_sdf.reset_index(inplace=True, drop=True) q_before = geoms_before_sdf.geometry.JSON == '{"paths":[]}' geoms_before_sdf = geoms_before_sdf[~q_before].copy() geoms_before_sdf.reset_index(inplace=True, drop=True) if geometry_type == "Polygon": before_val = geoms_before_sdf.geometry.get_area('GEODESIC','SQUAREKILOMETERS').sum() after_val = geoms_after_sdf.geometry.get_area('GEODESIC','SQUAREKILOMETERS').sum() if after_val > 0: score = get_score(ratio=before_val/after_val, baseVal=before_val, inputVal=after_val) else: score = get_score(0, before_val, after_val) out_sdf[FIELDS[0]][0] = round(before_val,1) out_sdf[FIELDS[1]][0] = round(after_val,1) out_sdf[FIELDS[3]][0] = round(before_val - after_val,1) out_sdf[FIELDS[2]][0] = score elif geometry_type == "Polyline": before_val = geoms_before_sdf.geometry.get_length('GEODESIC','KILOMETERS').sum() after_val = geoms_after_sdf.geometry.get_length('GEODESIC','KILOMETERS').sum() if after_val > 0: score = get_score(ratio=before_val/after_val, baseVal=before_val, inputVal=after_val) else: score = get_score(0, before_val, after_val) out_sdf[FIELDS[0]][0] = round(before_val,1) out_sdf[FIELDS[1]][0] = round(after_val,1) out_sdf[FIELDS[3]][0] = round(before_val - after_val,1) out_sdf[FIELDS[2]][0] = score else: before_count = len(geoms_before_sdf) after_count = len(geoms_after_sdf) if after_count > 0: score = get_score(ratio=before_count/after_count, baseVal=before_count, inputVal=after_count) else: score = get_score(ratio=0, baseVal=before_count, inputVal=after_count) out_sdf[FIELDS[0]][0] = before_count out_sdf[FIELDS[1]][0] = after_count out_sdf[FIELDS[3]][0] = before_count - after_count out_sdf[FIELDS[2]][0] = score del sq del df_after del df_before del geom return out_sdf, out_fl #arcpy.SetParameterAsText(4, out_grid) except FunctionError as f_e: messages = f_e.args[0] except: line, filename, synerror = trace() #-------------------------------------------------------------------------- ##if __name__ == "__main__": ## #env.overwriteOutput = True ## argv = tuple(arcpy.GetParameterAsText(i) ## for i in range(arcpy.GetArgumentCount())) ## main(*argv)
[ 1, 529, 9507, 29958, 3859, 29899, 974, 29899, 1552, 29899, 1272, 29899, 1454, 29899, 2676, 29887, 275, 29914, 5729, 841, 404, 29889, 2272, 13, 15945, 29908, 2683, 2683, 2683, 2683, 9072, 29899, 13, 1170, 29901, 1614, 841, 404, 29889, 2272, 13, 29925, 332, 4220, 29901, 6760, 1078, 278, 3315, 2264, 27717, 515, 1023, 5777, 290, 862, 519, 4682, 13, 4706, 4413, 29889, 13, 9868, 29901, 910, 5780, 3408, 1078, 278, 1614, 841, 404, 8158, 310, 263, 11672, 4682, 13, 4706, 8783, 491, 17420, 596, 5680, 304, 385, 8671, 2752, 310, 5680, 13, 4706, 313, 1454, 1342, 29892, 4673, 7103, 7315, 5680, 467, 5169, 1535, 5734, 14125, 881, 367, 13, 4706, 623, 793, 29899, 517, 29899, 932, 793, 29889, 1152, 1342, 29892, 366, 881, 7252, 6520, 5680, 304, 6520, 13, 4706, 5680, 470, 4094, 5680, 304, 4094, 5680, 29889, 13, 1123, 1548, 1860, 29901, 5132, 29871, 29906, 29889, 29955, 29889, 29916, 29914, 11980, 29941, 29889, 29916, 29892, 22711, 29954, 3235, 29871, 29896, 29900, 29889, 29946, 29974, 29914, 1184, 29871, 29896, 29889, 29906, 29974, 13, 13720, 29898, 29879, 1125, 529, 5813, 10202, 2866, 28891, 363, 3086, 1879, 4705, 15238, 29899, 2928, 28286, 13, 4706, 29353, 313, 9312, 29909, 29897, 891, 529, 5813, 10202, 2866, 28891, 363, 405, 12739, 13, 9283, 15629, 29901, 529, 5813, 10202, 405, 12739, 313, 29966, 26862, 6227, 12948, 13, 20399, 29901, 3111, 29871, 29947, 29892, 29871, 29906, 29900, 29896, 29945, 13, 3373, 630, 29901, 14053, 29871, 29906, 29900, 29896, 29953, 891, 3786, 29892, 29871, 29906, 29900, 29896, 29955, 13, 11882, 1266, 29901, 3423, 374, 13, 29931, 293, 1947, 29901, 323, 29121, 13, 2683, 2683, 2683, 2683, 9072, 29899, 15945, 29908, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 5215, 10876, 13, 3166, 16250, 1053, 315, 5336, 13, 13, 5215, 15232, 29887, 275, 13, 3166, 15232, 29887, 275, 29889, 29887, 275, 1053, 402, 3235, 13, 3166, 15232, 29887, 275, 29889, 22100, 1053, 5169, 1535, 14420, 13, 3166, 15232, 29887, 275, 29889, 22100, 1053, 1706, 15238, 17271, 13, 3166, 15232, 29887, 275, 29889, 19156, 1053, 18094, 13, 3166, 15232, 29887, 275, 29889, 19156, 1053, 1879, 7843, 13, 13, 3738, 6670, 8452, 353, 6024, 29911, 8452, 29918, 29928, 1430, 29903, 11937, 742, 13, 1678, 525, 21514, 29918, 29928, 1430, 29903, 11937, 742, 13, 1678, 525, 21514, 1307, 29911, 1430, 29923, 1799, 29918, 19143, 742, 13, 1678, 525, 4571, 28483, 1430, 4741, 2033, 13, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 1990, 6680, 2392, 29898, 2451, 1125, 13, 1678, 9995, 10425, 746, 263, 740, 8465, 304, 1065, 9995, 13, 1678, 1209, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 1753, 9637, 7295, 13, 1678, 9995, 13, 4706, 9637, 14061, 278, 1196, 29892, 278, 10422, 13, 4706, 322, 1059, 2643, 322, 3639, 372, 13, 4706, 304, 278, 1404, 13, 1678, 9995, 13, 1678, 1053, 9637, 1627, 13, 1678, 260, 29890, 353, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29906, 29962, 13, 1678, 260, 2109, 1181, 353, 9637, 1627, 29889, 4830, 29918, 22625, 29898, 22625, 9601, 29900, 29962, 13, 1678, 396, 2471, 1024, 718, 1196, 1353, 13, 1678, 1196, 353, 260, 2109, 1181, 29889, 5451, 28165, 376, 9601, 29896, 29962, 13, 1678, 396, 3617, 5132, 5877, 1059, 13, 1678, 396, 13, 1678, 5222, 2704, 353, 9637, 1627, 29889, 4830, 29918, 735, 29883, 2141, 5451, 9012, 580, 14352, 29896, 29962, 13, 1678, 736, 1196, 29892, 4770, 1445, 1649, 29892, 5222, 2704, 13, 13, 2277, 29937, 2683, 2683, 2683, 2683, 28400, 13, 2277, 1753, 10985, 29918, 2371, 29898, 2371, 29892, 4206, 29922, 8516, 1125, 13, 2277, 1678, 9995, 13, 2277, 1678, 3462, 29879, 278, 3734, 4341, 304, 278, 1591, 322, 623, 1975, 716, 6475, 565, 13, 2277, 1678, 2183, 29889, 13, 2277, 1678, 9995, 13, 2277, 1678, 1018, 29901, 13, 2277, 4706, 565, 4206, 338, 6213, 29901, 13, 2277, 9651, 4206, 353, 5159, 13, 2277, 4706, 270, 8768, 353, 7442, 29889, 29881, 1853, 29898, 13, 2277, 9651, 518, 13, 2277, 18884, 6702, 29918, 1367, 742, 7442, 29889, 524, 511, 13, 2277, 18884, 6702, 29911, 8452, 29918, 29928, 1430, 29903, 11937, 742, 7442, 29889, 7411, 29953, 29946, 511, 13, 2277, 18884, 6702, 21514, 29918, 29928, 1430, 29903, 11937, 742, 7442, 29889, 7411, 29953, 29946, 511, 13, 2277, 18884, 6702, 21514, 1307, 29911, 1430, 29923, 1799, 29918, 19143, 742, 7442, 29889, 7411, 29953, 29946, 511, 13, 2277, 18884, 6702, 4571, 28483, 1430, 4741, 742, 7442, 29889, 7411, 29953, 29946, 29897, 13, 2277, 9651, 4514, 13, 2277, 4706, 1723, 13, 2277, 4706, 1409, 353, 7442, 29889, 2378, 29898, 5727, 29892, 270, 8768, 29897, 13, 2277, 4706, 1146, 29889, 5647, 355, 3562, 29898, 2371, 29892, 376, 29949, 1367, 24695, 1409, 29892, 11119, 1367, 613, 7700, 29897, 13, 2277, 4706, 736, 1591, 13, 2277, 1678, 5174, 29901, 13, 2277, 4706, 1196, 29892, 10422, 29892, 5222, 2704, 353, 9637, 580, 13, 2277, 4706, 12020, 6680, 2392, 29898, 13, 2277, 18884, 426, 13, 2277, 18884, 376, 2220, 1115, 376, 21843, 29918, 2371, 613, 13, 2277, 18884, 376, 1220, 1115, 1196, 29892, 13, 2277, 18884, 376, 9507, 1115, 10422, 29892, 13, 2277, 18884, 376, 19274, 2704, 1115, 5222, 2704, 29892, 13, 2277, 18884, 376, 5666, 29908, 584, 851, 29898, 5666, 2272, 29889, 2577, 25510, 29898, 29906, 876, 13, 2277, 18884, 500, 13, 2277, 4706, 1723, 13, 1753, 679, 29918, 13628, 29898, 3605, 601, 29892, 2967, 1440, 29892, 1881, 1440, 1125, 13, 1678, 565, 1881, 1440, 1405, 29871, 29900, 29901, 13, 4706, 396, 3605, 601, 353, 2967, 1440, 29914, 2080, 1440, 13, 4706, 565, 313, 3605, 601, 6736, 29871, 29900, 322, 11959, 5277, 29871, 29900, 29889, 29945, 1125, 13, 9651, 1121, 353, 29871, 29896, 13, 4706, 25342, 313, 3605, 601, 1405, 29871, 29900, 29889, 29945, 322, 11959, 5277, 29871, 29900, 29889, 29955, 29945, 1125, 13, 9651, 1121, 353, 29871, 29906, 13, 4706, 25342, 313, 3605, 601, 1405, 29871, 29900, 29889, 29955, 29945, 322, 11959, 5277, 29871, 29896, 29889, 29906, 29945, 1125, 13, 9651, 1121, 353, 29871, 29941, 13, 4706, 25342, 313, 3605, 601, 1405, 29871, 29896, 29889, 29906, 29945, 322, 11959, 5277, 29871, 29896, 29889, 29945, 1125, 13, 9651, 1121, 353, 29871, 29946, 13, 4706, 25342, 313, 3605, 601, 1405, 29871, 29896, 29889, 29945, 1125, 13, 9651, 1121, 353, 29871, 29945, 13, 4706, 1683, 29901, 13, 9651, 1121, 353, 29871, 29900, 13, 1678, 1683, 29901, 13, 4706, 565, 2967, 1440, 1405, 29871, 29900, 29901, 13, 9651, 1121, 353, 29871, 29945, 13, 4706, 1683, 29901, 13, 9651, 1121, 353, 29871, 29900, 13, 13, 1678, 736, 1121, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 1753, 1614, 841, 404, 29898, 29887, 275, 29892, 4489, 29918, 7045, 29892, 4489, 29918, 11083, 29892, 1962, 29918, 22100, 29892, 6856, 29918, 4572, 29892, 23216, 1125, 13, 1678, 9995, 1667, 7156, 310, 1824, 9995, 13, 1678, 1018, 29901, 13, 13, 4706, 714, 29918, 1579, 353, 5169, 1535, 14420, 29898, 29887, 275, 29922, 29887, 275, 29892, 3142, 29922, 4905, 29918, 22100, 29897, 13, 4706, 714, 29918, 29879, 2176, 353, 714, 29918, 1579, 29889, 1972, 29898, 19156, 29918, 4572, 29922, 7720, 29918, 4572, 29892, 2457, 29918, 19156, 29922, 5574, 29892, 13, 18884, 736, 29918, 497, 29918, 3757, 4339, 29922, 5574, 467, 2176, 13, 13, 4706, 16303, 29918, 1853, 353, 4489, 29918, 7045, 29889, 19156, 29918, 1853, 13, 13, 4706, 18074, 353, 4489, 29918, 11083, 29961, 2176, 29918, 11083, 29889, 19156, 29889, 1333, 4304, 580, 1822, 19156, 29889, 2218, 12090, 29898, 479, 290, 29897, 1275, 7700, 13, 4706, 4489, 29918, 11083, 353, 4489, 29918, 11083, 29961, 3044, 1822, 8552, 580, 13, 4706, 1434, 29918, 2798, 353, 7431, 29898, 2176, 29918, 11083, 29897, 13, 4706, 18074, 353, 4489, 29918, 7045, 29961, 2176, 29918, 7045, 29889, 19156, 29889, 1333, 4304, 580, 1822, 19156, 29889, 2218, 12090, 29898, 479, 290, 29897, 1275, 7700, 13, 4706, 4489, 29918, 7045, 353, 4489, 29918, 7045, 29961, 3044, 1822, 8552, 580, 13, 4706, 1156, 29918, 2798, 353, 7431, 29898, 2176, 29918, 7045, 29897, 13, 4706, 1737, 4835, 29918, 7045, 353, 4489, 29918, 7045, 29889, 24049, 29898, 479, 290, 29889, 1062, 296, 29897, 13, 4706, 1737, 4835, 29918, 11083, 353, 4489, 29918, 11083, 29889, 24049, 29898, 479, 290, 29889, 1062, 296, 29897, 13, 13, 4706, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 353, 1706, 15238, 17271, 29898, 19156, 29922, 479, 4835, 29918, 11083, 29897, 13, 4706, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 353, 1706, 15238, 17271, 29898, 19156, 29922, 479, 4835, 29918, 7045, 29897, 13, 13, 4706, 3855, 29918, 7045, 353, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 29889, 19156, 29889, 7249, 1275, 525, 6377, 24772, 1115, 2636, 10162, 13, 4706, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 353, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 29961, 30022, 29939, 29918, 7045, 1822, 8552, 580, 13, 4706, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 29889, 12071, 29918, 2248, 29898, 262, 6689, 29922, 5574, 29892, 5768, 29922, 5574, 29897, 13, 4706, 3855, 29918, 11083, 353, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 29889, 19156, 29889, 7249, 1275, 525, 6377, 24772, 1115, 2636, 10162, 13, 4706, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 353, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 29961, 30022, 29939, 29918, 11083, 1822, 8552, 580, 13, 4706, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 29889, 12071, 29918, 2248, 29898, 262, 6689, 29922, 5574, 29892, 5768, 29922, 5574, 29897, 13, 13, 4706, 565, 16303, 29918, 1853, 1275, 376, 7713, 17125, 1115, 13, 9651, 1434, 29918, 791, 353, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 29889, 19156, 29889, 657, 29918, 6203, 877, 1692, 29949, 2287, 29903, 2965, 3788, 29903, 13356, 29909, 1525, 29968, 29902, 3927, 2303, 4945, 29903, 2824, 2083, 580, 13, 9651, 1156, 29918, 791, 353, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 29889, 19156, 29889, 657, 29918, 6203, 877, 1692, 29949, 2287, 29903, 2965, 3788, 29903, 13356, 29909, 1525, 29968, 29902, 3927, 2303, 4945, 29903, 2824, 2083, 580, 13, 9651, 565, 1156, 29918, 791, 1405, 29871, 29900, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 3605, 601, 29922, 11083, 29918, 791, 29914, 7045, 29918, 791, 29892, 13, 462, 4706, 2967, 1440, 29922, 11083, 29918, 791, 29892, 13, 462, 4706, 1881, 1440, 29922, 7045, 29918, 791, 29897, 13, 9651, 1683, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 29900, 29892, 1434, 29918, 791, 29892, 1156, 29918, 791, 29897, 13, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29900, 29962, 3816, 29900, 29962, 353, 4513, 29898, 11083, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29896, 29962, 3816, 29900, 29962, 353, 4513, 29898, 7045, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29941, 29962, 3816, 29900, 29962, 353, 4513, 29898, 11083, 29918, 791, 448, 1156, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29906, 29962, 3816, 29900, 29962, 353, 8158, 13, 13, 4706, 25342, 16303, 29918, 1853, 1275, 376, 7713, 29891, 1220, 1115, 13, 9651, 1434, 29918, 791, 353, 1737, 4835, 29918, 11083, 29918, 29879, 2176, 29889, 19156, 29889, 657, 29918, 2848, 877, 1692, 29949, 2287, 29903, 2965, 3788, 29968, 29902, 3927, 2303, 4945, 29903, 2824, 2083, 580, 13, 9651, 1156, 29918, 791, 353, 1737, 4835, 29918, 7045, 29918, 29879, 2176, 29889, 19156, 29889, 657, 29918, 2848, 877, 1692, 29949, 2287, 29903, 2965, 3788, 29968, 29902, 3927, 2303, 4945, 29903, 2824, 2083, 580, 13, 13, 9651, 565, 1156, 29918, 791, 1405, 29871, 29900, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 3605, 601, 29922, 11083, 29918, 791, 29914, 7045, 29918, 791, 29892, 13, 462, 4706, 2967, 1440, 29922, 11083, 29918, 791, 29892, 13, 462, 4706, 1881, 1440, 29922, 7045, 29918, 791, 29897, 13, 9651, 1683, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 29900, 29892, 1434, 29918, 791, 29892, 1156, 29918, 791, 29897, 13, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29900, 29962, 3816, 29900, 29962, 353, 4513, 29898, 11083, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29896, 29962, 3816, 29900, 29962, 353, 4513, 29898, 7045, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29941, 29962, 3816, 29900, 29962, 353, 4513, 29898, 11083, 29918, 791, 448, 1156, 29918, 791, 29892, 29896, 29897, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29906, 29962, 3816, 29900, 29962, 353, 8158, 13, 13, 4706, 1683, 29901, 13, 9651, 1434, 29918, 2798, 353, 7431, 29898, 479, 4835, 29918, 11083, 29918, 29879, 2176, 29897, 13, 9651, 1156, 29918, 2798, 353, 7431, 29898, 479, 4835, 29918, 7045, 29918, 29879, 2176, 29897, 13, 9651, 565, 1156, 29918, 2798, 1405, 29871, 29900, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 3605, 601, 29922, 11083, 29918, 2798, 29914, 7045, 29918, 2798, 29892, 13, 462, 4706, 2967, 1440, 29922, 11083, 29918, 2798, 29892, 13, 462, 4706, 1881, 1440, 29922, 7045, 29918, 2798, 29897, 13, 9651, 1683, 29901, 13, 18884, 8158, 353, 679, 29918, 13628, 29898, 3605, 601, 29922, 29900, 29892, 13, 462, 4706, 2967, 1440, 29922, 11083, 29918, 2798, 29892, 13, 462, 4706, 1881, 1440, 29922, 7045, 29918, 2798, 29897, 13, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29900, 29962, 3816, 29900, 29962, 353, 1434, 29918, 2798, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29896, 29962, 3816, 29900, 29962, 353, 1156, 29918, 2798, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29941, 29962, 3816, 29900, 29962, 353, 1434, 29918, 2798, 448, 1156, 29918, 2798, 13, 9651, 714, 29918, 29879, 2176, 29961, 3738, 6670, 8452, 29961, 29906, 29962, 3816, 29900, 29962, 353, 8158, 13, 13, 4706, 628, 18074, 13, 4706, 628, 4489, 29918, 7045, 13, 4706, 628, 4489, 29918, 11083, 13, 4706, 628, 23216, 13, 13, 4706, 736, 714, 29918, 29879, 2176, 29892, 714, 29918, 1579, 13, 13, 4706, 396, 5666, 2272, 29889, 2697, 9329, 2887, 1626, 29898, 29946, 29892, 714, 29918, 7720, 29897, 13, 1678, 5174, 6680, 2392, 408, 285, 29918, 29872, 29901, 13, 4706, 7191, 353, 285, 29918, 29872, 29889, 5085, 29961, 29900, 29962, 13, 13, 1678, 5174, 29901, 13, 4706, 1196, 29892, 10422, 29892, 5222, 2704, 353, 9637, 580, 13, 13, 29937, 2683, 2683, 2683, 2683, 28400, 13, 2277, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 2277, 1678, 396, 6272, 29889, 957, 3539, 6466, 353, 5852, 13, 2277, 1678, 1852, 29894, 353, 18761, 29898, 5666, 2272, 29889, 2577, 9329, 2887, 1626, 29898, 29875, 29897, 13, 2277, 1678, 363, 474, 297, 3464, 29898, 5666, 2272, 29889, 2577, 15730, 3981, 22130, 13, 2277, 1678, 1667, 10456, 19218, 29897, 2 ]
test/functional/test_framework/beerchainconfig.py
beerchainproject/beerchain
0
68906
<filename>test/functional/test_framework/beerchainconfig.py COINBASE_MATURITY = 500 INITIAL_BLOCK_REWARD = 20000 INITIAL_HASH_UTXO_ROOT = 0x21b463e3b52f6201c0ad6c991be0485b6ef8c092e64583ffa655cc1b171fe856 INITIAL_HASH_STATE_ROOT = 0x9514771014c9ae803d8cea2731b2063e83de44802b40dce2d06acd02d0ff65e9 MAX_BLOCK_BASE_SIZE = 2000000 BEERCHAIN_MIN_GAS_PRICE = 40 BEERCHAIN_MIN_GAS_PRICE_STR = "0.00000040" NUM_DEFAULT_DGP_CONTRACTS = 5 MPOS_PARTICIPANTS = 10 LAST_POW_BLOCK = 5000 BLOCKS_BEFORE_PROPOSAL_EXPIRATION = 216
[ 1, 529, 9507, 29958, 1688, 29914, 2220, 284, 29914, 1688, 29918, 4468, 29914, 915, 261, 14153, 2917, 29889, 2272, 13, 3217, 1177, 25416, 29918, 29924, 1299, 4574, 11937, 353, 29871, 29945, 29900, 29900, 13, 26019, 25758, 29918, 29933, 21339, 29918, 1525, 29956, 17011, 353, 29871, 29906, 29900, 29900, 29900, 29900, 13, 26019, 25758, 29918, 29950, 24943, 29918, 2692, 29990, 29949, 29918, 21289, 353, 29871, 29900, 29916, 29906, 29896, 29890, 29946, 29953, 29941, 29872, 29941, 29890, 29945, 29906, 29888, 29953, 29906, 29900, 29896, 29883, 29900, 328, 29953, 29883, 29929, 29929, 29896, 915, 29900, 29946, 29947, 29945, 29890, 29953, 1389, 29947, 29883, 29900, 29929, 29906, 29872, 29953, 29946, 29945, 29947, 29941, 600, 29874, 29953, 29945, 29945, 617, 29896, 29890, 29896, 29955, 29896, 1725, 29947, 29945, 29953, 13, 26019, 25758, 29918, 29950, 24943, 29918, 19713, 29918, 21289, 353, 29871, 29900, 29916, 29929, 29945, 29896, 29946, 29955, 29955, 29896, 29900, 29896, 29946, 29883, 29929, 3660, 29947, 29900, 29941, 29881, 29947, 346, 29874, 29906, 29955, 29941, 29896, 29890, 29906, 29900, 29953, 29941, 29872, 29947, 29941, 311, 29946, 29946, 29947, 29900, 29906, 29890, 29946, 29900, 29881, 346, 29906, 29881, 29900, 29953, 562, 29881, 29900, 29906, 29881, 29900, 600, 29953, 29945, 29872, 29929, 13, 12648, 29918, 29933, 21339, 29918, 25416, 29918, 14226, 353, 29871, 29906, 29900, 29900, 29900, 29900, 29900, 29900, 13, 15349, 1001, 3210, 29909, 1177, 29918, 16173, 29918, 29954, 3289, 29918, 10593, 12107, 353, 29871, 29946, 29900, 13, 15349, 1001, 3210, 29909, 1177, 29918, 16173, 29918, 29954, 3289, 29918, 10593, 12107, 29918, 10810, 353, 376, 29900, 29889, 29900, 29900, 29900, 29900, 29900, 29900, 29946, 29900, 29908, 13, 13967, 29918, 23397, 29918, 29928, 19903, 29918, 22412, 4717, 1783, 29903, 353, 29871, 29945, 13, 3580, 3267, 29918, 26092, 2965, 5690, 2190, 9375, 353, 29871, 29896, 29900, 13, 4375, 1254, 29918, 29925, 9806, 29918, 29933, 21339, 353, 29871, 29945, 29900, 29900, 29900, 13, 29933, 21339, 29903, 29918, 15349, 5800, 1525, 29918, 8618, 24815, 1964, 29918, 5746, 2227, 29934, 8098, 353, 29871, 29906, 29896, 29953, 13, 2 ]
app/tests/test_validators.py
ogambakerubo/StackOverflow-lite
0
189520
#StackOverflow-lite/app/tests/test_validators.py """Tests for validators run with pytest""" import unittest from app.api.validators import validate_string class ValidatorsTestCase(unittest.TestCase): def test_for_strings(self): with self.assertRaises(ValueError): validate_string("@##$$Hello")
[ 1, 396, 7264, 23773, 29899, 29880, 568, 29914, 932, 29914, 21150, 29914, 1688, 29918, 3084, 4097, 29889, 2272, 13, 15945, 29908, 24376, 363, 2854, 4097, 1065, 411, 11451, 1688, 15945, 29908, 13, 5215, 443, 27958, 13, 3166, 623, 29889, 2754, 29889, 3084, 4097, 1053, 12725, 29918, 1807, 1678, 13, 13, 13, 1990, 15758, 4097, 3057, 8259, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 13, 1678, 822, 1243, 29918, 1454, 29918, 19651, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 12725, 29918, 1807, 29475, 2277, 3997, 10994, 1159, 13, 13, 268, 2 ]
rtmbot/app/test_rtmbot.py
narunask/silly_chatbot
0
69779
#!/usr/bin/env python3 # coding: utf-8 from unittest.mock import create_autospec from slackclient import SlackClient, _channel, _server, _util from rtmbot.core import RtmBot from testfixtures import LogCapture from plugins.chatbot import Reply def init_rtmbot(): ''' Initializes an instance of RTMBot with some default values ''' rtmbot = RtmBot({ 'SLACK_TOKEN': '<PASSWORD>', 'BASE_PATH': '/tmp/', 'LOGFILE': '/tmp/rtmbot.log', 'DEBUG': True }) return rtmbot def test_init(): with LogCapture() as l: rtmbot = init_rtmbot() assert rtmbot.token == '<PASSWORD>' assert rtmbot.directory == '/tmp/' assert rtmbot.debug == True l.check( ('root', 'INFO', 'Initialized in: /tmp/') ) class TestRTMBot: RTMBot = init_rtmbot() Server_mock = create_autospec(_server.Server) SlackClient_mock = create_autospec(SlackClient) SearchList_mock = create_autospec(_util.SearchList) Channel_mock = create_autospec(_channel.Channel) # Mock Server with channels method and correct return value Server_mock.channels = SearchList_mock SlackClient_mock.server = Server_mock SlackClient_mock.server.channels.find.return_value = Channel_mock RTMBot.slack_client = SlackClient_mock #Plugin_mock = create_autospec(Reply) Plugin_mock = Reply() #plugin_mock.slack_client = SlackClient_mock RTMBot.bot_plugins.append(Plugin_mock) message = { 'channel': 'D5FQCHAN', 'source_team': 'T5HQTEAM', 'team': 'T5HQTEAM', 'text': '', 'type': 'message', 'user': 'U5THEBEST'} def bot_trigger(self, txt): self.message['text'] = txt self.Plugin_mock.process_message(self.message) self.RTMBot.output() def test_tellme(self): self.bot_trigger('') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert a[0] == '<BOT> Unknown command...' self.Channel_mock.reset_mock() self.bot_trigger('@tellme') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert a[0] == '<BOT> Unknown command...' self.Channel_mock.reset_mock() def test_tellme_help(self): self.bot_trigger('@tellme help') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert 'Please use' in a[0] self.Channel_mock.reset_mock() def test_tellme_list(self): self.bot_trigger('@tellme list') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert 'Currently online' in a[0] self.Channel_mock.reset_mock() def test_start_sess(self): self.bot_trigger('@tellme start_session') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert 'forgotten to specify Bot name' in a[0] self.Channel_mock.reset_mock() self.bot_trigger('@tellme start_session unknown_bot') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert '"unknown_bot"' in a[0] self.Channel_mock.reset_mock() self.bot_trigger('@tellme start_session Agent Smith') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert 'BOT@Agent Smith' in a[0] self.Channel_mock.reset_mock() def test_end_sess(self): self.bot_trigger('@tellme end_session') assert self.Channel_mock.send_message.called a, kw = self.Channel_mock.send_message.call_args assert 'Session ended' in a[0] self.Channel_mock.reset_mock()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 3166, 443, 27958, 29889, 17640, 1053, 1653, 29918, 1300, 359, 3135, 13, 3166, 269, 2364, 4645, 1053, 317, 2364, 4032, 29892, 903, 12719, 29892, 903, 2974, 29892, 903, 4422, 13, 3166, 364, 18276, 7451, 29889, 3221, 1053, 390, 18276, 29933, 327, 13, 3166, 1243, 7241, 486, 1973, 1053, 4522, 21133, 545, 13, 13, 3166, 18224, 29889, 13496, 7451, 1053, 10088, 368, 13, 13, 13, 1753, 2069, 29918, 2273, 29885, 7451, 7295, 13, 1678, 14550, 17250, 7093, 385, 2777, 310, 390, 29911, 9486, 327, 411, 777, 2322, 1819, 14550, 13, 1678, 364, 18276, 7451, 353, 390, 18276, 29933, 327, 3319, 13, 4706, 525, 12750, 11375, 29918, 4986, 29968, 1430, 2396, 12801, 25711, 17013, 29958, 742, 13, 4706, 525, 25416, 29918, 10145, 2396, 8207, 7050, 29914, 742, 13, 4706, 525, 14480, 7724, 2396, 8207, 7050, 29914, 2273, 29885, 7451, 29889, 1188, 742, 13, 4706, 525, 18525, 2396, 5852, 13, 1678, 5615, 13, 1678, 736, 364, 18276, 7451, 13, 13, 13, 1753, 1243, 29918, 2344, 7295, 13, 1678, 411, 4522, 21133, 545, 580, 408, 301, 29901, 13, 4706, 364, 18276, 7451, 353, 2069, 29918, 2273, 29885, 7451, 580, 13, 13, 1678, 4974, 364, 18276, 7451, 29889, 6979, 1275, 12801, 25711, 17013, 16299, 13, 1678, 4974, 364, 18276, 7451, 29889, 12322, 1275, 8207, 7050, 22208, 13, 1678, 4974, 364, 18276, 7451, 29889, 8382, 1275, 5852, 13, 13, 1678, 301, 29889, 3198, 29898, 13, 4706, 6702, 4632, 742, 525, 11690, 742, 525, 15514, 1891, 297, 29901, 847, 7050, 29914, 1495, 13, 1678, 1723, 13, 13, 13, 1990, 4321, 13079, 9486, 327, 29901, 13, 13, 1678, 390, 29911, 9486, 327, 353, 2069, 29918, 2273, 29885, 7451, 580, 13, 13, 1678, 5656, 29918, 17640, 353, 1653, 29918, 1300, 359, 3135, 7373, 2974, 29889, 6004, 29897, 13, 1678, 317, 2364, 4032, 29918, 17640, 353, 1653, 29918, 1300, 359, 3135, 29898, 29903, 2364, 4032, 29897, 13, 1678, 11856, 1293, 29918, 17640, 353, 1653, 29918, 1300, 359, 3135, 7373, 4422, 29889, 7974, 1293, 29897, 13, 1678, 17368, 29918, 17640, 353, 1653, 29918, 1300, 359, 3135, 7373, 12719, 29889, 13599, 29897, 13, 13, 1678, 396, 26297, 5656, 411, 18196, 1158, 322, 1959, 736, 995, 13, 1678, 5656, 29918, 17640, 29889, 305, 12629, 353, 11856, 1293, 29918, 17640, 13, 1678, 317, 2364, 4032, 29918, 17640, 29889, 2974, 353, 5656, 29918, 17640, 13, 1678, 317, 2364, 4032, 29918, 17640, 29889, 2974, 29889, 305, 12629, 29889, 2886, 29889, 2457, 29918, 1767, 353, 17368, 29918, 17640, 13, 13, 1678, 390, 29911, 9486, 327, 29889, 29879, 2364, 29918, 4645, 353, 317, 2364, 4032, 29918, 17640, 13, 13, 1678, 396, 16288, 29918, 17640, 353, 1653, 29918, 1300, 359, 3135, 29898, 5612, 368, 29897, 13, 1678, 1858, 3851, 29918, 17640, 353, 10088, 368, 580, 13, 1678, 396, 8582, 29918, 17640, 29889, 29879, 2364, 29918, 4645, 353, 317, 2364, 4032, 29918, 17640, 13, 13, 1678, 390, 29911, 9486, 327, 29889, 7451, 29918, 12800, 29889, 4397, 29898, 16288, 29918, 17640, 29897, 13, 13, 1678, 2643, 353, 426, 13, 4706, 525, 12719, 2396, 525, 29928, 29945, 29943, 29984, 3210, 2190, 742, 13, 4706, 525, 4993, 29918, 14318, 2396, 525, 29911, 29945, 29950, 29984, 4330, 5194, 742, 13, 4706, 525, 14318, 2396, 525, 29911, 29945, 29950, 29984, 4330, 5194, 742, 13, 4706, 525, 726, 2396, 15516, 13, 4706, 525, 1853, 2396, 525, 4906, 742, 13, 4706, 525, 1792, 2396, 525, 29965, 29945, 28350, 15349, 1254, 10827, 13, 13, 1678, 822, 9225, 29918, 21001, 29898, 1311, 29892, 13872, 1125, 13, 4706, 1583, 29889, 4906, 1839, 726, 2033, 353, 13872, 13, 4706, 1583, 29889, 16288, 29918, 17640, 29889, 5014, 29918, 4906, 29898, 1311, 29889, 4906, 29897, 13, 4706, 1583, 29889, 13079, 9486, 327, 29889, 4905, 580, 13, 13, 1678, 822, 1243, 29918, 29873, 514, 1004, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 263, 29961, 29900, 29962, 1275, 12801, 29933, 2891, 29958, 853, 5203, 1899, 856, 29915, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 263, 29961, 29900, 29962, 1275, 12801, 29933, 2891, 29958, 853, 5203, 1899, 856, 29915, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 1678, 822, 1243, 29918, 29873, 514, 1004, 29918, 8477, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1371, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 525, 12148, 671, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 1678, 822, 1243, 29918, 29873, 514, 1004, 29918, 1761, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1051, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 525, 7583, 368, 7395, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 1678, 822, 1243, 29918, 2962, 29918, 29879, 404, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1369, 29918, 7924, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 525, 29888, 990, 327, 841, 304, 6084, 11273, 1024, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1369, 29918, 7924, 9815, 29918, 7451, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 18793, 26690, 29918, 7451, 29908, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1369, 29918, 7924, 28330, 7075, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 525, 29933, 2891, 29992, 19661, 7075, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 13, 1678, 822, 1243, 29918, 355, 29918, 29879, 404, 29898, 1311, 1125, 13, 4706, 1583, 29889, 7451, 29918, 21001, 877, 29992, 29873, 514, 1004, 1095, 29918, 7924, 1495, 13, 4706, 4974, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 13998, 13, 4706, 263, 29892, 9049, 353, 1583, 29889, 13599, 29918, 17640, 29889, 6717, 29918, 4906, 29889, 4804, 29918, 5085, 13, 4706, 4974, 525, 7317, 9698, 29915, 297, 263, 29961, 29900, 29962, 13, 4706, 1583, 29889, 13599, 29918, 17640, 29889, 12071, 29918, 17640, 580, 13, 2 ]
App/components/entradas.py
Alexfm101/automata
0
156813
<filename>App/components/entradas.py<gh_stars>0 import sys from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtCore import * dato_entrada = [2,3,4,1] class entradas(QDialog): def __init__(self): super(entradas ,self).__init__() layout = QGridLayout() self.setLayout(layout) self.dato_entrada = dato_entrada #tabla tabla = QTableWidget(1, 4) newitem = QTableWidgetItem() l_entrada = QLabel() l_entrada.setText("entrada") #boton ok = QPushButton('ok') def datas(): for i in range(0, 4): newitem = tabla.item(0,i) if (newitem == None): a = "x" pass elif (not newitem.text() == "1" and not newitem.text() == "0"): a = "x" pass else: a = newitem.text() pass dato_entrada[i] = a def _print(): print(dato_entrada) tabla.cellChanged.connect(datas) ok.clicked.connect(_print) #mostrar layout.addWidget(l_entrada,0,0) layout.addWidget(tabla,1,0) # layout.addWidget(ok,2,0)
[ 1, 529, 9507, 29958, 2052, 29914, 14036, 29914, 296, 3665, 294, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 10876, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 28707, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 334, 13, 13, 13, 29881, 1219, 29918, 14856, 1114, 353, 518, 29906, 29892, 29941, 29892, 29946, 29892, 29896, 29962, 13, 13, 1990, 875, 3665, 294, 29898, 29984, 7647, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 296, 3665, 294, 1919, 1311, 467, 1649, 2344, 1649, 580, 13, 4706, 5912, 353, 660, 5756, 3453, 580, 13, 4706, 1583, 29889, 842, 3453, 29898, 2680, 29897, 13, 4706, 1583, 29889, 29881, 1219, 29918, 14856, 1114, 353, 270, 1219, 29918, 14856, 1114, 539, 13, 13, 4706, 396, 3891, 433, 13, 4706, 4434, 433, 353, 660, 3562, 8801, 29898, 29896, 29892, 29871, 29946, 29897, 13, 4706, 716, 667, 353, 660, 3562, 8801, 2001, 580, 13, 13, 4706, 301, 29918, 14856, 1114, 353, 660, 4775, 580, 13, 4706, 301, 29918, 14856, 1114, 29889, 12038, 703, 14856, 1114, 1159, 13, 13, 4706, 396, 7451, 265, 13, 4706, 3431, 353, 660, 27031, 3125, 877, 554, 1495, 13, 13, 4706, 822, 6155, 7295, 13, 9651, 363, 474, 297, 3464, 29898, 29900, 29892, 29871, 29946, 1125, 13, 18884, 716, 667, 353, 4434, 433, 29889, 667, 29898, 29900, 29892, 29875, 29897, 13, 18884, 565, 313, 1482, 667, 1275, 6213, 1125, 13, 462, 1678, 263, 353, 376, 29916, 29908, 13, 462, 1678, 1209, 13, 18884, 25342, 313, 1333, 716, 667, 29889, 726, 580, 1275, 376, 29896, 29908, 322, 451, 716, 667, 29889, 726, 580, 1275, 376, 29900, 29908, 1125, 13, 462, 1678, 263, 353, 376, 29916, 29908, 13, 462, 1678, 1209, 13, 18884, 1683, 29901, 13, 462, 1678, 263, 353, 716, 667, 29889, 726, 580, 13, 462, 1678, 1209, 13, 18884, 270, 1219, 29918, 14856, 1114, 29961, 29875, 29962, 353, 263, 13, 462, 13, 4706, 822, 903, 2158, 7295, 13, 9651, 1596, 29898, 29881, 1219, 29918, 14856, 1114, 29897, 13, 13, 308, 13, 4706, 4434, 433, 29889, 3729, 7590, 29889, 6915, 29898, 14538, 29897, 13, 4706, 3431, 29889, 3808, 287, 29889, 6915, 7373, 2158, 29897, 13, 308, 13, 308, 13, 13, 4706, 396, 3242, 13678, 13, 4706, 5912, 29889, 1202, 8801, 29898, 29880, 29918, 14856, 1114, 29892, 29900, 29892, 29900, 29897, 13, 4706, 5912, 29889, 1202, 8801, 29898, 3891, 433, 29892, 29896, 29892, 29900, 29897, 13, 418, 396, 29871, 5912, 29889, 1202, 8801, 29898, 554, 29892, 29906, 29892, 29900, 29897, 2 ]
datapackage_pipelines/generators/utilities.py
gperonato/datapackage-pipelines
109
17848
def arg_to_step(arg): if isinstance(arg, str): return {'run': arg} else: return dict(zip(['run', 'parameters', 'cache'], arg)) def steps(*args): return [arg_to_step(arg) for arg in args]
[ 1, 822, 1852, 29918, 517, 29918, 10568, 29898, 1191, 1125, 13, 1678, 565, 338, 8758, 29898, 1191, 29892, 851, 1125, 13, 4706, 736, 11117, 3389, 2396, 1852, 29913, 13, 1678, 1683, 29901, 13, 4706, 736, 9657, 29898, 7554, 18959, 3389, 742, 525, 16744, 742, 525, 8173, 7464, 1852, 876, 13, 13, 13, 1753, 6576, 10456, 5085, 1125, 13, 1678, 736, 518, 1191, 29918, 517, 29918, 10568, 29898, 1191, 29897, 363, 1852, 297, 6389, 29962, 13, 2 ]
ThingsConnectorTests/ThingsConnectorBaseTests.py
huvermann/MyPiHomeAutomation
0
52616
import unittest import sys import json sys.path.append("..\ThingsConnector") from ThingsConnectorBase import ThingsConectorBase #from .. import module # Import module from a higher directory. from ThingsItemBase import ThingsItemBase class FunctionMock(object): def __init__(self, ): self.mockCalled = False self.dummyCalled = False self.mockSendHandwareInfoCalled = False return super(FunctionMock, self).__init__() def mockHandleUIMessage(self, ws, message): self.mockCalled = True def mockRefresh(self): self.mockCalled = True def mockDummy(self): self.dummyCalled = True pass def mockSendHandwareInfo(self): self.mockSendHandwareInfoCalled = True class WebsocketMock(object): def send(self, msg): self.message = msg pass class Test_ThingsConnectorBaseTests(unittest.TestCase): def test_authHardwareSendsMessage(self): wsmock = WebsocketMock() connector = ThingsConectorBase("testid", "node", "descr", 1) connector.ws = wsmock connector.authHardware() self.assertTrue(wsmock.message == '{"data": {"nodeid": "testid", "key": "secretkey"}, "messagetype": "authHardware"}') def test_MessageTypeLogonResult_setsAuthenticated(self): """Checks if authenticated property is set to true""" mock = FunctionMock() message = {"messagetype" : "LogonResult", "data" : {"success": True}} connector = ThingsConectorBase("testid", "node", "descr", 1) connector.cutConnection = mock.mockDummy self.assertFalse(connector.authenticated) connector.sendNodeInfo = mock.mockSendHandwareInfo connector.parseJsonMessage(None, message) self.assertTrue(connector.authenticated) def test_MessageTypeLogonResult_cuts_Connection(self): """Checks if message LogonResult calls cut connection if authentication fails.""" mock = FunctionMock() message = {"messagetype" : "LogonResult", "data" : {"success": False}} connector = ThingsConectorBase("testid", "node", "descr", 1) connector.cutConnection = mock.mockDummy self.assertFalse(connector.authenticated) connector.parseJsonMessage(None, message) # check if authenticated is false self.assertFalse(connector.authenticated) # check if cutConnection() was called self.assertTrue(mock.dummyCalled) def test_HandleLogonResultCalls_SendHardwareInfo(self): """Checks if handleLogonResult calls sendHardwareInfo().""" mock = FunctionMock() connector = ThingsConectorBase("testid", "node", "descr", 1) message = {"messagetype" : "LogonResult", "data" : {"success": True}} connector.cutConnection = mock.mockDummy connector.sendNodeInfo = mock.mockSendHandwareInfo self.assertFalse(mock.mockSendHandwareInfoCalled) connector.handleLogonResult(None, message) self.assertTrue(mock.mockSendHandwareInfoCalled) def test_MessageTypeUIMessage(self): """Checks if UI-Message calls handleUiMessage.""" mock = FunctionMock() connector = ThingsConectorBase("testid", "node", "descr", 1) connector.cutConnection = mock.mockDummy message = {"messagetype" : "UI-Message", "data" : ""} connector.handleUIMessage = mock.mockHandleUIMessage self.assertFalse(mock.mockCalled) connector.parseJsonMessage(None, message) self.assertTrue(mock.mockCalled) def test_MessageTypeRefresh(self): """Checks if Refresh message calls prepareRefresh""" mock = FunctionMock() message = {"messagetype" : "Refresh", "data" : ""} connector = ThingsConectorBase("testid", "node", "descr", 1) connector.prepareRefresh = mock.mockRefresh connector.parseJsonMessage(None, message) self.assertTrue(mock.mockCalled) def test_sendNodeInfo(self): """Checks if sendNodeInfo works.""" mock = FunctionMock() wsmock = WebsocketMock() connector = ThingsConectorBase("nodeid", "nodename", "nodedescr", 1) connector.ws = wsmock testItem = ThingsItemBase("testid", "type1", "descr") connector.addItem(testItem) connector.sendNodeInfo() message = json.loads(wsmock.message.encode('utf-8')) self.assertTrue(message["messagetype"] == 'nodeinfo') def test_sendNodeInfoSendsNodeId(self): mock = FunctionMock() wsmock = WebsocketMock() connector = ThingsConectorBase("nodeid", "nodename", "nodedescr", 1) connector.ws = wsmock testItem = ThingsItemBase("testid", "type1", "descr") connector.addItem(testItem) connector.sendNodeInfo() message = json.loads(wsmock.message.encode('utf-8')) data = message["data"] self.assertEqual(data['nodeid'], "nodeid") self.assertEqual(data['description'], "nodedescr") def test_sendNodeInfoSendsHardwareInfo(self): mock = FunctionMock() wsmock = WebsocketMock() connector = ThingsConectorBase("nodeid", "nodename", "nodedescr", 1) connector.ws = wsmock testItem = ThingsItemBase("testid", "type1", "descr") connector.addItem(testItem) connector.sendNodeInfo() message = json.loads(wsmock.message.encode('utf-8')) hardware = message["data"]["hardwareinfo"][0] self.assertEqual(hardware['id'], "testid") self.assertEqual(hardware['type'], "type1") self.assertEqual(hardware['description'], "descr") if __name__ == '__main__': unittest.main()
[ 1, 29871, 30143, 5215, 443, 27958, 13, 5215, 10876, 13, 5215, 4390, 13, 9675, 29889, 2084, 29889, 4397, 703, 636, 29905, 1349, 886, 20971, 2801, 1159, 13, 3166, 28706, 20971, 2801, 5160, 1053, 28706, 1168, 3019, 5160, 13, 29937, 3166, 6317, 1053, 3883, 396, 16032, 3883, 515, 263, 6133, 3884, 29889, 13, 3166, 28706, 2001, 5160, 1053, 28706, 2001, 5160, 13, 13, 1990, 6680, 18680, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29871, 1125, 13, 4706, 1583, 29889, 17640, 29907, 4212, 353, 7700, 13, 4706, 1583, 29889, 29881, 11770, 29907, 4212, 353, 7700, 13, 4706, 1583, 29889, 17640, 12600, 3481, 2519, 3401, 29907, 4212, 353, 7700, 13, 13, 4706, 736, 2428, 29898, 6678, 18680, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 1678, 822, 11187, 13554, 3120, 3728, 29898, 1311, 29892, 16904, 29892, 2643, 1125, 13, 4706, 1583, 29889, 17640, 29907, 4212, 353, 5852, 13, 13, 1678, 822, 11187, 27132, 29898, 1311, 1125, 13, 4706, 1583, 29889, 17640, 29907, 4212, 353, 5852, 13, 1678, 822, 11187, 29928, 11770, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29881, 11770, 29907, 4212, 353, 5852, 13, 4706, 1209, 13, 13, 1678, 822, 11187, 12600, 3481, 2519, 3401, 29898, 1311, 1125, 13, 4706, 1583, 29889, 17640, 12600, 3481, 2519, 3401, 29907, 4212, 353, 5852, 13, 13, 13, 1990, 2563, 11514, 18680, 29898, 3318, 1125, 13, 1678, 822, 3638, 29898, 1311, 29892, 10191, 1125, 13, 4706, 1583, 29889, 4906, 353, 10191, 13, 4706, 1209, 13, 13, 13, 1990, 4321, 29918, 1349, 886, 20971, 2801, 5160, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 5150, 29950, 538, 2519, 29903, 1975, 3728, 29898, 1311, 1125, 13, 4706, 281, 3844, 1698, 353, 2563, 11514, 18680, 580, 13, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 5652, 353, 281, 3844, 1698, 13, 4706, 1826, 2801, 29889, 5150, 29950, 538, 2519, 580, 13, 4706, 1583, 29889, 9294, 5574, 29898, 29893, 3844, 1698, 29889, 4906, 1275, 525, 6377, 1272, 1115, 8853, 3177, 333, 1115, 376, 1688, 333, 613, 376, 1989, 1115, 376, 19024, 1989, 10758, 376, 12062, 26084, 668, 1115, 376, 5150, 29950, 538, 2519, 9092, 1495, 13, 13, 1678, 822, 1243, 29918, 3728, 1542, 3403, 265, 3591, 29918, 7224, 6444, 4173, 630, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 15585, 630, 2875, 338, 731, 304, 1565, 15945, 29908, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 2643, 353, 8853, 12062, 26084, 668, 29908, 584, 376, 3403, 265, 3591, 613, 376, 1272, 29908, 584, 8853, 8698, 1115, 5852, 930, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 7582, 5350, 353, 11187, 29889, 17640, 29928, 11770, 13, 4706, 1583, 29889, 9294, 8824, 29898, 11958, 2801, 29889, 27218, 630, 29897, 13, 4706, 1826, 2801, 29889, 6717, 4247, 3401, 353, 11187, 29889, 17640, 12600, 3481, 2519, 3401, 13, 4706, 1826, 2801, 29889, 5510, 8148, 3728, 29898, 8516, 29892, 2643, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 11958, 2801, 29889, 27218, 630, 29897, 13, 13, 1678, 822, 1243, 29918, 3728, 1542, 3403, 265, 3591, 29918, 7582, 29879, 29918, 5350, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 2643, 4522, 265, 3591, 5717, 5700, 3957, 565, 10760, 8465, 1213, 15945, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 2643, 353, 8853, 12062, 26084, 668, 29908, 584, 376, 3403, 265, 3591, 613, 376, 1272, 29908, 584, 8853, 8698, 1115, 7700, 930, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 7582, 5350, 353, 11187, 29889, 17640, 29928, 11770, 13, 4706, 1583, 29889, 9294, 8824, 29898, 11958, 2801, 29889, 27218, 630, 29897, 13, 4706, 1826, 2801, 29889, 5510, 8148, 3728, 29898, 8516, 29892, 2643, 29897, 13, 4706, 396, 1423, 565, 15585, 630, 338, 2089, 13, 4706, 1583, 29889, 9294, 8824, 29898, 11958, 2801, 29889, 27218, 630, 29897, 13, 4706, 396, 1423, 565, 5700, 5350, 580, 471, 2000, 13, 4706, 1583, 29889, 9294, 5574, 29898, 17640, 29889, 29881, 11770, 29907, 4212, 29897, 13, 13, 308, 13, 13, 1678, 822, 1243, 29918, 13554, 3403, 265, 3591, 29907, 4293, 29918, 12600, 29950, 538, 2519, 3401, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 4386, 3403, 265, 3591, 5717, 3638, 29950, 538, 2519, 3401, 2141, 15945, 29908, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 308, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 2643, 353, 8853, 12062, 26084, 668, 29908, 584, 376, 3403, 265, 3591, 613, 376, 1272, 29908, 584, 8853, 8698, 1115, 5852, 930, 13, 4706, 1826, 2801, 29889, 7582, 5350, 353, 11187, 29889, 17640, 29928, 11770, 13, 4706, 1826, 2801, 29889, 6717, 4247, 3401, 353, 11187, 29889, 17640, 12600, 3481, 2519, 3401, 13, 4706, 1583, 29889, 9294, 8824, 29898, 17640, 29889, 17640, 12600, 3481, 2519, 3401, 29907, 4212, 29897, 13, 4706, 1826, 2801, 29889, 8411, 3403, 265, 3591, 29898, 8516, 29892, 2643, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 17640, 29889, 17640, 12600, 3481, 2519, 3401, 29907, 4212, 29897, 13, 13, 13, 1678, 822, 1243, 29918, 3728, 1542, 3120, 3728, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 3740, 29899, 3728, 5717, 4386, 29965, 29875, 3728, 1213, 15945, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 7582, 5350, 353, 11187, 29889, 17640, 29928, 11770, 13, 13, 4706, 2643, 353, 8853, 12062, 26084, 668, 29908, 584, 376, 3120, 29899, 3728, 613, 376, 1272, 29908, 584, 5124, 29913, 13, 4706, 1826, 2801, 29889, 8411, 3120, 3728, 353, 11187, 29889, 17640, 13554, 3120, 3728, 13, 4706, 1583, 29889, 9294, 8824, 29898, 17640, 29889, 17640, 29907, 4212, 29897, 13, 4706, 1826, 2801, 29889, 5510, 8148, 3728, 29898, 8516, 29892, 2643, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 17640, 29889, 17640, 29907, 4212, 29897, 13, 13, 1678, 822, 1243, 29918, 3728, 1542, 27132, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 9897, 3781, 2643, 5717, 19012, 27132, 15945, 29908, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 2643, 353, 8853, 12062, 26084, 668, 29908, 584, 376, 27132, 613, 376, 1272, 29908, 584, 5124, 29913, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 1688, 333, 613, 376, 3177, 613, 376, 2783, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 19125, 27132, 353, 11187, 29889, 17640, 27132, 13, 4706, 1826, 2801, 29889, 5510, 8148, 3728, 29898, 8516, 29892, 2643, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 17640, 29889, 17640, 29907, 4212, 29897, 13, 13, 1678, 822, 1243, 29918, 6717, 4247, 3401, 29898, 1311, 1125, 13, 4706, 9995, 5596, 29879, 565, 3638, 4247, 3401, 1736, 1213, 15945, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 281, 3844, 1698, 353, 2563, 11514, 18680, 580, 13, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 3177, 333, 613, 376, 29876, 397, 3871, 613, 376, 29876, 6797, 267, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 5652, 353, 281, 3844, 1698, 13, 4706, 1243, 2001, 353, 28706, 2001, 5160, 703, 1688, 333, 613, 376, 1853, 29896, 613, 376, 2783, 7283, 1159, 13, 4706, 1826, 2801, 29889, 1202, 2001, 29898, 1688, 2001, 29897, 13, 4706, 1826, 2801, 29889, 6717, 4247, 3401, 580, 13, 4706, 2643, 353, 4390, 29889, 18132, 29898, 29893, 3844, 1698, 29889, 4906, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 4706, 1583, 29889, 9294, 5574, 29898, 4906, 3366, 12062, 26084, 668, 3108, 1275, 525, 3177, 3888, 1495, 13, 308, 13, 13, 1678, 822, 1243, 29918, 6717, 4247, 3401, 29903, 1975, 4247, 1204, 29898, 1311, 1125, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 281, 3844, 1698, 353, 2563, 11514, 18680, 580, 13, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 3177, 333, 613, 376, 29876, 397, 3871, 613, 376, 29876, 6797, 267, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 5652, 353, 281, 3844, 1698, 13, 4706, 1243, 2001, 353, 28706, 2001, 5160, 703, 1688, 333, 613, 376, 1853, 29896, 613, 376, 2783, 7283, 1159, 13, 4706, 1826, 2801, 29889, 1202, 2001, 29898, 1688, 2001, 29897, 13, 4706, 1826, 2801, 29889, 6717, 4247, 3401, 580, 13, 4706, 2643, 353, 4390, 29889, 18132, 29898, 29893, 3844, 1698, 29889, 4906, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 4706, 848, 353, 2643, 3366, 1272, 3108, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1272, 1839, 3177, 333, 7464, 376, 3177, 333, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1272, 1839, 8216, 7464, 376, 29876, 6797, 267, 7283, 1159, 13, 13, 1678, 822, 1243, 29918, 6717, 4247, 3401, 29903, 1975, 29950, 538, 2519, 3401, 29898, 1311, 1125, 13, 4706, 11187, 353, 6680, 18680, 580, 13, 4706, 281, 3844, 1698, 353, 2563, 11514, 18680, 580, 13, 13, 4706, 1826, 2801, 353, 28706, 1168, 3019, 5160, 703, 3177, 333, 613, 376, 29876, 397, 3871, 613, 376, 29876, 6797, 267, 7283, 613, 29871, 29896, 29897, 13, 4706, 1826, 2801, 29889, 5652, 353, 281, 3844, 1698, 13, 4706, 1243, 2001, 353, 28706, 2001, 5160, 703, 1688, 333, 613, 376, 1853, 29896, 613, 376, 2783, 7283, 1159, 13, 4706, 1826, 2801, 29889, 1202, 2001, 29898, 1688, 2001, 29897, 13, 4706, 1826, 2801, 29889, 6717, 4247, 3401, 580, 13, 4706, 2643, 353, 4390, 29889, 18132, 29898, 29893, 3844, 1698, 29889, 4906, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 4706, 12837, 353, 2643, 3366, 1272, 3108, 3366, 6800, 2519, 3888, 3108, 29961, 29900, 29962, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6800, 2519, 1839, 333, 7464, 376, 1688, 333, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6800, 2519, 1839, 1853, 7464, 376, 1853, 29896, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 6800, 2519, 1839, 8216, 7464, 376, 2783, 7283, 1159, 13, 13, 13, 308, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 443, 27958, 29889, 3396, 580, 2 ]
ArkDiscordBot/__init__.py
Jackybeat/ArkDiscordBot
1
167560
<reponame>Jackybeat/ArkDiscordBot default_app_config = 'ArkDiscordBot.apps.MyAppConfig'
[ 1, 529, 276, 1112, 420, 29958, 27006, 29891, 915, 271, 29914, 1433, 29895, 4205, 16090, 29933, 327, 13, 4381, 29918, 932, 29918, 2917, 353, 525, 1433, 29895, 4205, 16090, 29933, 327, 29889, 13371, 29889, 3421, 2052, 3991, 29915, 2 ]
setup.py
IvanProgramming/dnevnik_mos_ru
19
47980
<gh_stars>10-100 from setuptools import setup, find_packages from dnevnik import __version__ with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name='dnevnik-mos-ru', version=__version__, description="This package is kind of wrapper for dnevnik.mos.ru API service", long_description_content_type="text/markdown", long_description=long_description, classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], url='https://github.com/IvanProgramming/dnevnik_mos_ru', project_urls={ "Bug Tracker": "https://github.com/IvanProgramming/dnevnik_mos_ru/issues", }, author='Ivan', packages=find_packages(), install_requires=[ 'requests', 'selenium', 'bs4', 'lxml', 'pydantic', 'Inject' ] )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 3166, 270, 484, 29894, 5585, 1053, 4770, 3259, 1649, 13, 13, 2541, 1722, 703, 16310, 2303, 29889, 3487, 613, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29882, 29901, 13, 1678, 1472, 29918, 8216, 353, 285, 29882, 29889, 949, 580, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 29881, 484, 29894, 5585, 29899, 7681, 29899, 582, 742, 13, 1678, 1873, 29922, 1649, 3259, 1649, 29892, 13, 1678, 6139, 543, 4013, 3577, 338, 2924, 310, 14476, 363, 270, 484, 29894, 5585, 29889, 7681, 29889, 582, 3450, 2669, 613, 13, 1678, 1472, 29918, 8216, 29918, 3051, 29918, 1853, 543, 726, 29914, 3502, 3204, 613, 13, 1678, 1472, 29918, 8216, 29922, 5426, 29918, 8216, 29892, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 613, 13, 4706, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 613, 13, 4706, 376, 7094, 1218, 2184, 4761, 6570, 25266, 613, 13, 1678, 21251, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29902, 3703, 9283, 4056, 29914, 29881, 484, 29894, 5585, 29918, 7681, 29918, 582, 742, 13, 1678, 2060, 29918, 26045, 3790, 13, 4706, 376, 29933, 688, 3201, 4937, 1115, 376, 991, 597, 3292, 29889, 510, 29914, 29902, 3703, 9283, 4056, 29914, 29881, 484, 29894, 5585, 29918, 7681, 29918, 582, 29914, 12175, 613, 13, 1678, 2981, 13, 1678, 4148, 2433, 29902, 3703, 742, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 2601, 29918, 276, 339, 2658, 11759, 13, 4706, 525, 24830, 742, 13, 4706, 525, 27373, 742, 13, 4706, 525, 5824, 29946, 742, 13, 4706, 525, 29880, 3134, 742, 13, 4706, 525, 2272, 29881, 7716, 742, 13, 4706, 525, 28329, 29915, 13, 1678, 4514, 13, 29897, 13, 2 ]
hknweb/events/views/event_transactions/show_event.py
jyxzhang/hknweb
0
18905
from django.shortcuts import render, redirect, reverse from django.contrib import messages from django.shortcuts import get_object_or_404 from django.core.paginator import Paginator from hknweb.utils import markdownify from hknweb.utils import allow_public_access from hknweb.events.constants import ( ACCESSLEVEL_TO_DESCRIPTION, ATTR, RSVPS_PER_PAGE, ) from hknweb.events.models import Event, Rsvp, AttendanceForm from hknweb.events.utils import format_url from hknweb.utils import get_access_level @allow_public_access def show_details(request, id): return show_details_helper(request, id, reverse("events:index"), True) def show_details_helper(request, id, back_link: str, can_edit: bool): event = get_object_or_404(Event, pk=id) if event.access_level < get_access_level(request.user): messages.warning(request, "Insufficent permission to access event.") return redirect(back_link) context = { "event": event, "event_description": markdownify(event.description), "event_location": format_url(event.location), "user_access_level": ACCESSLEVEL_TO_DESCRIPTION[get_access_level(request.user)], "event_access_level": ACCESSLEVEL_TO_DESCRIPTION[event.access_level], "back_link": back_link, "can_edit": can_edit and request.user.has_perm("events.change_event"), } if not request.user.is_authenticated: return render(request, "events/show_details.html", context) rsvps = Rsvp.objects.filter(event=event) waitlisted = False waitlist_position = 0 rsvp = None user_rsvps = rsvps.filter(user=request.user) if user_rsvps.exists(): # Gets the rsvp object for the user rsvp = user_rsvps.first() # Check if waitlisted if event.rsvp_limit: rsvps_before = rsvps.filter(created_at__lt=rsvp.created_at).count() waitlisted = rsvps_before >= event.rsvp_limit # Get waitlist position if waitlisted: position = rsvps.filter(created_at__lt=rsvp.created_at).count() waitlist_position = position - event.rsvp_limit + 1 # Render only non-waitlisted rsvps rsvps = event.admitted_set() waitlists = event.waitlist_set() limit = event.rsvp_limit rsvps_page = Paginator(rsvps, RSVPS_PER_PAGE).get_page( request.GET.get("rsvps_page") ) waitlists_page = Paginator(waitlists, RSVPS_PER_PAGE).get_page( request.GET.get("waitlists_page") ) data = [ { ATTR.TITLE: "RSVPs", ATTR.DATA: rsvps_page if len(rsvps_page) > 0 else None, ATTR.PAGE_PARAM: "rsvps_page", ATTR.COUNT: str(rsvps.count()) + " / {limit}".format(limit=limit), }, ] if limit: data.append( { ATTR.TITLE: "Waitlist", ATTR.DATA: waitlists_page if len(waitlists_page) > 0 else None, ATTR.PAGE_PARAM: "waitlists_page", ATTR.COUNT: str(waitlists.count()), } ) context = { **context, ATTR.DATA: data, "rsvp": rsvp, "attendance_form": AttendanceForm.objects.filter(event=event).first(), "waitlisted": waitlisted, "waitlist_position": waitlist_position, } return render(request, "events/show_details.html", context)
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 29892, 6684, 29892, 11837, 13, 3166, 9557, 29889, 21570, 1053, 7191, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 13, 3166, 9557, 29889, 3221, 29889, 13573, 262, 1061, 1053, 349, 26584, 1061, 13, 13, 3166, 298, 3959, 2676, 29889, 13239, 1053, 2791, 3204, 1598, 13, 13, 3166, 298, 3959, 2676, 29889, 13239, 1053, 2758, 29918, 3597, 29918, 5943, 13, 3166, 298, 3959, 2676, 29889, 13604, 29889, 3075, 1934, 1053, 313, 13, 1678, 319, 26925, 1307, 29963, 6670, 29918, 4986, 29918, 2287, 7187, 24290, 2725, 29892, 13, 1678, 15531, 5659, 29892, 13, 1678, 390, 7597, 7024, 29918, 13171, 29918, 7228, 1692, 29892, 13, 29897, 13, 3166, 298, 3959, 2676, 29889, 13604, 29889, 9794, 1053, 6864, 29892, 390, 4501, 29886, 29892, 6212, 21642, 2500, 13, 3166, 298, 3959, 2676, 29889, 13604, 29889, 13239, 1053, 3402, 29918, 2271, 13, 3166, 298, 3959, 2676, 29889, 13239, 1053, 679, 29918, 5943, 29918, 5563, 13, 13, 13, 29992, 9536, 29918, 3597, 29918, 5943, 13, 1753, 1510, 29918, 14144, 29898, 3827, 29892, 1178, 1125, 13, 1678, 736, 1510, 29918, 14144, 29918, 20907, 29898, 3827, 29892, 1178, 29892, 11837, 703, 13604, 29901, 2248, 4968, 5852, 29897, 13, 13, 13, 1753, 1510, 29918, 14144, 29918, 20907, 29898, 3827, 29892, 1178, 29892, 1250, 29918, 2324, 29901, 851, 29892, 508, 29918, 5628, 29901, 6120, 1125, 13, 1678, 1741, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 2624, 29892, 282, 29895, 29922, 333, 29897, 13, 1678, 565, 1741, 29889, 5943, 29918, 5563, 529, 679, 29918, 5943, 29918, 5563, 29898, 3827, 29889, 1792, 1125, 13, 4706, 7191, 29889, 27392, 29898, 3827, 29892, 376, 797, 2146, 2416, 296, 10751, 304, 2130, 1741, 23157, 13, 4706, 736, 6684, 29898, 1627, 29918, 2324, 29897, 13, 13, 1678, 3030, 353, 426, 13, 4706, 376, 3696, 1115, 1741, 29892, 13, 4706, 376, 3696, 29918, 8216, 1115, 2791, 3204, 1598, 29898, 3696, 29889, 8216, 511, 13, 4706, 376, 3696, 29918, 5479, 1115, 3402, 29918, 2271, 29898, 3696, 29889, 5479, 511, 13, 4706, 376, 1792, 29918, 5943, 29918, 5563, 1115, 319, 26925, 1307, 29963, 6670, 29918, 4986, 29918, 2287, 7187, 24290, 2725, 29961, 657, 29918, 5943, 29918, 5563, 29898, 3827, 29889, 1792, 29897, 1402, 13, 4706, 376, 3696, 29918, 5943, 29918, 5563, 1115, 319, 26925, 1307, 29963, 6670, 29918, 4986, 29918, 2287, 7187, 24290, 2725, 29961, 3696, 29889, 5943, 29918, 5563, 1402, 13, 4706, 376, 1627, 29918, 2324, 1115, 1250, 29918, 2324, 29892, 13, 4706, 376, 3068, 29918, 5628, 1115, 508, 29918, 5628, 322, 2009, 29889, 1792, 29889, 5349, 29918, 17858, 703, 13604, 29889, 3167, 29918, 3696, 4968, 13, 1678, 500, 13, 13, 1678, 565, 451, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 29901, 13, 4706, 736, 4050, 29898, 3827, 29892, 376, 13604, 29914, 4294, 29918, 14144, 29889, 1420, 613, 3030, 29897, 13, 13, 1678, 364, 4501, 567, 353, 390, 4501, 29886, 29889, 12650, 29889, 4572, 29898, 3696, 29922, 3696, 29897, 13, 1678, 4480, 1761, 287, 353, 7700, 13, 1678, 4480, 1761, 29918, 3283, 353, 29871, 29900, 13, 13, 1678, 364, 4501, 29886, 353, 6213, 13, 1678, 1404, 29918, 2288, 29894, 567, 353, 364, 4501, 567, 29889, 4572, 29898, 1792, 29922, 3827, 29889, 1792, 29897, 13, 1678, 565, 1404, 29918, 2288, 29894, 567, 29889, 9933, 7295, 13, 4706, 396, 402, 1691, 278, 364, 4501, 29886, 1203, 363, 278, 1404, 13, 4706, 364, 4501, 29886, 353, 1404, 29918, 2288, 29894, 567, 29889, 4102, 580, 13, 4706, 396, 5399, 565, 4480, 1761, 287, 13, 4706, 565, 1741, 29889, 2288, 29894, 29886, 29918, 13400, 29901, 13, 9651, 364, 4501, 567, 29918, 11083, 353, 364, 4501, 567, 29889, 4572, 29898, 11600, 29918, 271, 1649, 1896, 29922, 2288, 29894, 29886, 29889, 11600, 29918, 271, 467, 2798, 580, 13, 9651, 4480, 1761, 287, 353, 364, 4501, 567, 29918, 11083, 6736, 1741, 29889, 2288, 29894, 29886, 29918, 13400, 13, 13, 1678, 396, 3617, 4480, 1761, 2602, 13, 1678, 565, 4480, 1761, 287, 29901, 13, 4706, 2602, 353, 364, 4501, 567, 29889, 4572, 29898, 11600, 29918, 271, 1649, 1896, 29922, 2288, 29894, 29886, 29889, 11600, 29918, 271, 467, 2798, 580, 13, 4706, 4480, 1761, 29918, 3283, 353, 2602, 448, 1741, 29889, 2288, 29894, 29886, 29918, 13400, 718, 29871, 29896, 13, 1678, 396, 26000, 871, 1661, 29899, 10685, 1761, 287, 364, 4501, 567, 13, 1678, 364, 4501, 567, 353, 1741, 29889, 328, 29885, 4430, 29918, 842, 580, 13, 1678, 4480, 21513, 353, 1741, 29889, 10685, 1761, 29918, 842, 580, 13, 1678, 4046, 353, 1741, 29889, 2288, 29894, 29886, 29918, 13400, 13, 13, 1678, 364, 4501, 567, 29918, 3488, 353, 349, 26584, 1061, 29898, 2288, 29894, 567, 29892, 390, 7597, 7024, 29918, 13171, 29918, 7228, 1692, 467, 657, 29918, 3488, 29898, 13, 4706, 2009, 29889, 7194, 29889, 657, 703, 2288, 29894, 567, 29918, 3488, 1159, 13, 1678, 1723, 13, 1678, 4480, 21513, 29918, 3488, 353, 349, 26584, 1061, 29898, 10685, 21513, 29892, 390, 7597, 7024, 29918, 13171, 29918, 7228, 1692, 467, 657, 29918, 3488, 29898, 13, 4706, 2009, 29889, 7194, 29889, 657, 703, 10685, 21513, 29918, 3488, 1159, 13, 1678, 1723, 13, 13, 1678, 848, 353, 518, 13, 4706, 426, 13, 9651, 15531, 5659, 29889, 29911, 1806, 1307, 29901, 376, 29934, 7597, 29925, 29879, 613, 13, 9651, 15531, 5659, 29889, 14573, 29901, 364, 4501, 567, 29918, 3488, 565, 7431, 29898, 2288, 29894, 567, 29918, 3488, 29897, 1405, 29871, 29900, 1683, 6213, 29892, 13, 9651, 15531, 5659, 29889, 7228, 1692, 29918, 16320, 5194, 29901, 376, 2288, 29894, 567, 29918, 3488, 613, 13, 9651, 15531, 5659, 29889, 18736, 29901, 851, 29898, 2288, 29894, 567, 29889, 2798, 3101, 718, 376, 847, 426, 13400, 29913, 1642, 4830, 29898, 13400, 29922, 13400, 511, 13, 4706, 2981, 13, 1678, 4514, 13, 1678, 565, 4046, 29901, 13, 4706, 848, 29889, 4397, 29898, 13, 9651, 426, 13, 18884, 15531, 5659, 29889, 29911, 1806, 1307, 29901, 376, 15716, 1761, 613, 13, 18884, 15531, 5659, 29889, 14573, 29901, 4480, 21513, 29918, 3488, 565, 7431, 29898, 10685, 21513, 29918, 3488, 29897, 1405, 29871, 29900, 1683, 6213, 29892, 13, 18884, 15531, 5659, 29889, 7228, 1692, 29918, 16320, 5194, 29901, 376, 10685, 21513, 29918, 3488, 613, 13, 18884, 15531, 5659, 29889, 18736, 29901, 851, 29898, 10685, 21513, 29889, 2798, 25739, 13, 9651, 500, 13, 4706, 1723, 13, 13, 1678, 3030, 353, 426, 13, 4706, 3579, 4703, 29892, 13, 4706, 15531, 5659, 29889, 14573, 29901, 848, 29892, 13, 4706, 376, 2288, 29894, 29886, 1115, 364, 4501, 29886, 29892, 13, 4706, 376, 1131, 21642, 29918, 689, 1115, 6212, 21642, 2500, 29889, 12650, 29889, 4572, 29898, 3696, 29922, 3696, 467, 4102, 3285, 13, 4706, 376, 10685, 1761, 287, 1115, 4480, 1761, 287, 29892, 13, 4706, 376, 10685, 1761, 29918, 3283, 1115, 4480, 1761, 29918, 3283, 29892, 13, 1678, 500, 13, 1678, 736, 4050, 29898, 3827, 29892, 376, 13604, 29914, 4294, 29918, 14144, 29889, 1420, 613, 3030, 29897, 13, 2 ]
graphql_utilities/__init__.py
melvinkcx/graphql-utils
17
108206
from .decorators import run_only_once from .directives import GraphQLCostDirective, schema_with_cost_directive, cost_directive_source_doc from .execution import ExtendedExecutionContext from .utilities import build_schema_with_cost __version__ = "0.4.0" __all__ = [ "run_only_once", "ExtendedExecutionContext", "GraphQLCostDirective", "schema_with_cost_directive", "cost_directive_source_doc", "build_schema_with_cost" ]
[ 1, 515, 869, 19557, 4097, 1053, 1065, 29918, 6194, 29918, 10646, 13, 3166, 869, 11851, 3145, 1053, 12367, 2239, 25733, 17392, 573, 29892, 10938, 29918, 2541, 29918, 18253, 29918, 11851, 573, 29892, 3438, 29918, 11851, 573, 29918, 4993, 29918, 1514, 13, 3166, 869, 22256, 1053, 7338, 2760, 20418, 2677, 13, 3166, 869, 4422, 1907, 1053, 2048, 29918, 11010, 29918, 2541, 29918, 18253, 13, 13, 1649, 3259, 1649, 353, 376, 29900, 29889, 29946, 29889, 29900, 29908, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 376, 3389, 29918, 6194, 29918, 10646, 613, 13, 1678, 376, 5647, 2760, 20418, 2677, 613, 13, 1678, 376, 9527, 2239, 25733, 17392, 573, 613, 13, 1678, 376, 11010, 29918, 2541, 29918, 18253, 29918, 11851, 573, 613, 13, 1678, 376, 18253, 29918, 11851, 573, 29918, 4993, 29918, 1514, 613, 13, 1678, 376, 4282, 29918, 11010, 29918, 2541, 29918, 18253, 29908, 13, 29962, 13, 2 ]
index_creation/pq_index.py
lukasstracke/postgres-word2vec
131
191036
<filename>index_creation/pq_index.py #!/bin/python3 from scipy.cluster.vq import kmeans from scipy.spatial.distance import sqeuclidean from scipy.spatial.distance import cdist import sys import numpy as np import faiss import time import psycopg2 import pickle from config import * from logger import * from vector_feeder import * import index_utils as utils import index_manager as im import quantizer_creation as qcreator from pq_index_creator import * USE_PIPELINE_APPROACH = True USE_BYTEA_TYPE = True def get_table_information(index_config): if USE_BYTEA_TYPE: return ((index_config.get_value("pq_table_name"),"(id serial PRIMARY KEY, word varchar(100), vector bytea)"), (index_config.get_value("cb_table_name"), "(id serial PRIMARY KEY, pos int, code int, vector bytea, count int)")) else: return ((index_config.get_value("pq_table_name"),"(id serial PRIMARY KEY, word varchar(100), vector int[])"), (index_config.get_value("cb_table_name"), "(id serial PRIMARY KEY, pos int, code int, vector float4[], count int)")) def create_index_with_faiss(vectors, codebook, logger): logger.log(Logger.INFO, 'Length of vectors: ' + str(len(vectors))) result = [] indices = [] m = len(codebook) len_centr = int(len(vectors[0]) / m) # create indices for codebook for i in range(m): index = faiss.IndexFlatL2(len_centr) logger.log(Logger.INFO, str(codebook[i])) # TODO replace info index.add(codebook[i]) indices.append(index) count = 0 batches = [[] for i in range(m)] for c in range(len(vectors)): count += 1 vec = vectors[c] partition = np.array([np.array(vec[i:i + len_centr]).astype('float32') for i in range(0, len(vec), len_centr)]) for i in range(m): batches[i].append(partition[i]) if (count % 18 == 0) or (c == (len(vectors)-1)): # 18 seems to be a good value size = 18 if (count % 18 == 0) else (c+1) % 18 codes=[[] for i in range(size)] for i in range(m): _, I = indices[i].search(np.array(batches[i]), 1) for j in range(len(codes)): codes[j].append(I[j][0]) result += codes batches = [[] for i in range(m)] if count % 1000 == 0: logger.log(Logger.INFO, 'Appended ' + str(len(result)) + ' vectors') logger.log(Logger.INFO, 'Appended ' + str(len(result)) + ' vectors') return result def create_index(vectors, codebook, logger): result = [] m = len(codebook) len_centr = int(len(vectors[0]) / m) count = 0 for vec in vectors: code = [] # partition vector partition = np.array([np.array(vec[i:i + len_centr]) for i in range(0, len(vec), len_centr)]).astype('float32') # determine nearest centroide from the codebook for each partition # -> generate code for i in range(m): min_dist = None code_id = None for j in range(len(codebook[i])): c = codebook[i][j] # calculate dist dist = np.linalg.norm(partition[i] - codebook[i][j]) if (not min_dist) or (dist < min_dist): min_dist = dist code_id = j code.append(code_id) # add code to result count += 1 result.append(code) if count % 100 == 0: logger.log(Logger.INFO, 'Appended ' + str(count) + ' vectors') return result def add_to_database(words, codebook, pq_quantization, counts, con, cur, index_config, batch_size, logger): logger.log(Logger.INFO, 'Length of words: ' + str(len(words)) + ' Length of pq_quantization: ' + str(len(pq_quantization))) # add codebook add_codebook_to_database(codebook, counts, con, cur, index_config) # add pq qunatization values = [] for i in range(len(pq_quantization)): output_vec = utils.serialize_vector(pq_quantization[i]) values.append({"word": words[i][:100], "vector": output_vec}) if (i % (batch_size-1) == 0) or (i == (len(pq_quantization)-1)): if USE_BYTEA_TYPE: cur.executemany("INSERT INTO "+ index_config.get_value("pq_table_name") + " (word,vector) VALUES (%(word)s, vec_to_bytea(%(vector)s::int2[]))", tuple(values)) else: cur.executemany("INSERT INTO "+ index_config.get_value("pq_table_name") + " (word,vector) VALUES (%(word)s, %(vector)s)", tuple(values)) con.commit() logger.log(Logger.INFO, 'Inserted ' + str(i+1) + ' vectors') values = [] return def add_codebook_to_database(codebook, counts, con, cur, index_config): for pos in range(len(codebook)): values = [] for i in range(len(codebook[pos])): output_vec = utils.serialize_vector(codebook[pos][i]) values.append({"pos": pos, "code": i, "vector": output_vec, "count": counts[(pos, i)]}) if USE_BYTEA_TYPE: cur.executemany("INSERT INTO "+ index_config.get_value("cb_table_name") + " (pos,code,vector, count) VALUES (%(pos)s, %(code)s, vec_to_bytea(%(vector)s::float4[]), %(count)s)", tuple(values)) else: cur.executemany("INSERT INTO "+ index_config.get_value("cb_table_name") + " (pos,code,vector, count) VALUES (%(pos)s, %(code)s, %(vector)s, %(count)s)", tuple(values)) con.commit() return def add_batch_to_database(word_batch, pq_quantization, con, cur, index_config, batch_size, logger): values = [] for i in range(len(pq_quantization)): output_vec = utils.serialize_vector(pq_quantization[i]) values.append({"word": word_batch[i][:100], "vector": output_vec}) if (i % (batch_size-1) == 0) or (i == (len(pq_quantization)-1)): if USE_BYTEA_TYPE: cur.executemany("INSERT INTO "+ index_config.get_value("pq_table_name") + " (word,vector) VALUES (%(word)s, vec_to_bytea(%(vector)s::int2[]))", tuple(values)) else: cur.executemany("INSERT INTO "+ index_config.get_value("pq_table_name") + " (word,vector) VALUES (%(word)s, %(vector)s)", tuple(values)) con.commit() values = [] return def determine_counts(codebook, pq_quantization): result = dict() for i in range(len(pq_quantization)): for j in range(len(pq_quantization[i])): pos = j code = pq_quantization[i][j] if not (pos, code) in result: result[(pos, code)] = 1 else: result[(pos, code)] += 1 return result def main(argc, argv): db_config = Configuration('config/db_config.json') logger = Logger(db_config.get_value('log')) if argc < 2: logger.log(Logger.ERROR, 'Configuration file for index creation required') return index_config = Configuration(argv[1]) batch_size = db_config.get_value("batch_size") # get vectors words, vectors, vectors_size = utils.get_vectors(index_config.get_value("vec_file_path"), logger) logger.log(Logger.INFO, 'vectors_size : ' + str(vectors_size)) # determine codebook codebook = None if index_config.has_key('codebook_file'): codebook_filename = index_config.get_value('codebook_file') if codebook_filename: logger.log(Logger.INFO, 'Use codebook from ' + codebook_filename) codebook = qcreator.load_quantizer(codebook_filename) if type(codebook) == type(None): logger.log(Logger.INFO, 'Create new codebook') # apply k-means -> get codebook codebook = qcreator.create_quantizer(vectors[:index_config.get_value('train_size')], index_config.get_value('m'), index_config.get_value('k'), logger) # save codebook to file (optional) qcreator.store_quantizer(codebook, 'codebook.pcl') con = None cur = None if (index_config.get_value('add_to_database')): # create db connection try: con = psycopg2.connect("dbname='" + db_config.get_value('db_name') + "' user='" + db_config.get_value('username') + "' host='" + db_config.get_value('host') + "' password='" + db_config.get_value('password') + "'") except: logger.log(Logger.ERROR, 'Can not connect to database') return cur = con.cursor() utils.init_tables(con, cur, get_table_information(index_config), logger) utils.disable_triggers(index_config.get_value("pq_table_name"), con,cur) # create index with qunatizer use_pipeline = False if index_config.has_key('pipeline'): use_pipeline = index_config.get_value('pipeline') # singel cycle if not use_pipeline: logger.log(logger.INFO, 'Start index creation (single cycle)') start = time.time() index = create_index_with_faiss(vectors[:vectors_size], codebook, logger) end = time.time() logger.log(Logger.INFO, 'Finish index creation after ' + str(end - start) + ' seconds') counts = determine_counts(codebook, index) # add to file if (index_config.get_value('export_filename')): index_data = dict({ 'words': words, 'codebook': codebook, 'index': index, 'counts': counts }) im.save_index(index_data, index_config.get_value('export_filename')) if (index_config.get_value('add_to_database')): add_to_database(words, codebook, index, counts, con, cur, index_config, batch_size, logger) logger.log(logger.INFO, 'Create database index structures') utils.create_index(index_config.get_value("pq_table_name"), index_config.get_value("pq_index_name"), 'word', con, cur, logger) utils.enable_triggers(index_config.get_value("pq_table_name"), con, cur) # pipeline approach if use_pipeline: logger.log(logger.INFO, 'Start index creation (pipeline)') start = time.time() feeder = VectorFeeder(vectors[:vectors_size], words) m = len(codebook) len_centr = int(len(vectors[0]) / m) calculation = PQIndexCreator(codebook, m, len_centr, logger) counts = dict() output_file = None if (index_config.get_value('export_pipeline_data')): output_file = open(index_config.get_value('export_pipeline_data'), 'wb') while (feeder.has_next()): # calculate batch, word_batch = feeder.get_next_batch(batch_size) entries, counts = calculation.index_batch(batch) # write to database or add to file if (index_config.get_value('add_to_database')): add_batch_to_database(word_batch, entries, con, cur, index_config, batch_size, logger) logger.log(logger.INFO, 'Added ' + str(feeder.get_cursor() - batch_size + len(batch)) + ' vectors to the database') if (index_config.get_value('export_pipeline_data')): index_batch = dict({ 'words': word_batch, 'index': entries, }) pickle.dump(index_batch, output_file) f = open(index_config.get_value('export_pipeline_data')+'.tmp', 'wb') pickle.dump(counts, f) f.close() logger.log(logger.INFO, 'Processed ' + str(feeder.get_cursor() - batch_size + len(batch)) + ' vectors') if output_file: output_file.close() if (index_config.get_value('add_to_database')): # add codebook to database add_codebook_to_database(codebook, counts, con, cur, index_config) logger.log(Logger.INFO, 'Added codebook entries into database') logger.log(logger.INFO, 'Create database index structures') utils.create_index(index_config.get_value("pq_table_name"), index_config.get_value("pq_index_name"), 'word', con, cur, logger) utils.enable_triggers(index_config.get_value("pq_table_name"), con, cur) if __name__ == "__main__": main(len(sys.argv), sys.argv)
[ 1, 529, 9507, 29958, 2248, 29918, 1037, 362, 29914, 29886, 29939, 29918, 2248, 29889, 2272, 13, 29937, 14708, 2109, 29914, 4691, 29941, 13, 3166, 4560, 2272, 29889, 19594, 29889, 29894, 29939, 1053, 413, 1004, 550, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 1053, 18074, 29872, 27511, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 1053, 274, 5721, 13, 5215, 10876, 13, 5215, 12655, 408, 7442, 13, 5215, 2258, 790, 13, 5215, 931, 13, 5215, 6529, 29891, 9708, 29887, 29906, 13, 5215, 5839, 280, 13, 13, 3166, 2295, 1053, 334, 13, 3166, 17927, 1053, 334, 13, 3166, 4608, 29918, 1725, 2447, 1053, 334, 13, 5215, 2380, 29918, 13239, 408, 3667, 29879, 13, 5215, 2380, 29918, 12847, 408, 527, 13, 5215, 4323, 3950, 29918, 1037, 362, 408, 3855, 1037, 1061, 13, 3166, 282, 29939, 29918, 2248, 29918, 1037, 1061, 1053, 334, 13, 13, 17171, 29918, 2227, 4162, 18521, 29918, 3301, 8618, 2477, 29950, 353, 5852, 13, 17171, 29918, 22716, 4330, 29909, 29918, 11116, 353, 5852, 13, 13, 1753, 679, 29918, 2371, 29918, 19678, 29898, 2248, 29918, 2917, 1125, 13, 1678, 565, 501, 1660, 29918, 22716, 4330, 29909, 29918, 11116, 29901, 13, 4706, 736, 5135, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 29908, 29898, 333, 7797, 29778, 14636, 29892, 1734, 15236, 29898, 29896, 29900, 29900, 511, 4608, 7023, 29874, 29897, 4968, 13, 9651, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 10702, 29918, 2371, 29918, 978, 4968, 18227, 333, 7797, 29778, 14636, 29892, 926, 938, 29892, 775, 938, 29892, 4608, 7023, 29874, 29892, 2302, 938, 5513, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 5135, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 29908, 29898, 333, 7797, 29778, 14636, 29892, 1734, 15236, 29898, 29896, 29900, 29900, 511, 4608, 938, 23076, 4968, 13, 9651, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 10702, 29918, 2371, 29918, 978, 4968, 18227, 333, 7797, 29778, 14636, 29892, 926, 938, 29892, 775, 938, 29892, 4608, 5785, 29946, 29961, 1402, 2302, 938, 5513, 876, 13, 13, 1753, 1653, 29918, 2248, 29918, 2541, 29918, 5444, 790, 29898, 345, 14359, 29892, 775, 2909, 29892, 17927, 1125, 13, 1678, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 6513, 310, 12047, 29901, 525, 718, 851, 29898, 2435, 29898, 345, 14359, 4961, 13, 1678, 1121, 353, 5159, 13, 1678, 16285, 353, 5159, 13, 1678, 286, 353, 7431, 29898, 401, 2909, 29897, 13, 1678, 7431, 29918, 1760, 29878, 353, 938, 29898, 2435, 29898, 345, 14359, 29961, 29900, 2314, 847, 286, 29897, 13, 1678, 396, 1653, 16285, 363, 775, 2909, 13, 1678, 363, 474, 297, 3464, 29898, 29885, 1125, 13, 4706, 2380, 353, 2258, 790, 29889, 3220, 29943, 5066, 29931, 29906, 29898, 2435, 29918, 1760, 29878, 29897, 13, 4706, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 851, 29898, 401, 2909, 29961, 29875, 12622, 396, 14402, 5191, 5235, 13, 4706, 2380, 29889, 1202, 29898, 401, 2909, 29961, 29875, 2314, 13, 4706, 16285, 29889, 4397, 29898, 2248, 29897, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 9853, 267, 353, 518, 2636, 363, 474, 297, 3464, 29898, 29885, 4638, 13, 1678, 363, 274, 297, 3464, 29898, 2435, 29898, 345, 14359, 22164, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 9649, 353, 12047, 29961, 29883, 29962, 13, 4706, 8877, 353, 7442, 29889, 2378, 4197, 9302, 29889, 2378, 29898, 2003, 29961, 29875, 29901, 29875, 718, 7431, 29918, 1760, 29878, 14664, 579, 668, 877, 7411, 29941, 29906, 1495, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 2003, 511, 7431, 29918, 1760, 29878, 29897, 2314, 13, 4706, 363, 474, 297, 3464, 29898, 29885, 1125, 13, 9651, 9853, 267, 29961, 29875, 1822, 4397, 29898, 16707, 29961, 29875, 2314, 13, 4706, 565, 313, 2798, 1273, 29871, 29896, 29947, 1275, 29871, 29900, 29897, 470, 313, 29883, 1275, 313, 2435, 29898, 345, 14359, 6817, 29896, 22164, 396, 29871, 29896, 29947, 2444, 304, 367, 263, 1781, 995, 13, 9651, 2159, 353, 29871, 29896, 29947, 565, 313, 2798, 1273, 29871, 29896, 29947, 1275, 29871, 29900, 29897, 1683, 313, 29883, 29974, 29896, 29897, 1273, 29871, 29896, 29947, 13, 9651, 11561, 11759, 2636, 363, 474, 297, 3464, 29898, 2311, 4638, 13, 9651, 363, 474, 297, 3464, 29898, 29885, 1125, 13, 18884, 17117, 306, 353, 16285, 29961, 29875, 1822, 4478, 29898, 9302, 29889, 2378, 29898, 16175, 267, 29961, 29875, 11724, 29871, 29896, 29897, 13, 18884, 363, 432, 297, 3464, 29898, 2435, 29898, 18137, 22164, 13, 462, 1678, 11561, 29961, 29926, 1822, 4397, 29898, 29902, 29961, 29926, 3816, 29900, 2314, 13, 9651, 1121, 4619, 11561, 13, 9651, 9853, 267, 353, 518, 2636, 363, 474, 297, 3464, 29898, 29885, 4638, 13, 4706, 565, 2302, 1273, 29871, 29896, 29900, 29900, 29900, 1275, 29871, 29900, 29901, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 2052, 2760, 525, 718, 851, 29898, 2435, 29898, 2914, 876, 718, 525, 12047, 1495, 13, 1678, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 2052, 2760, 525, 718, 851, 29898, 2435, 29898, 2914, 876, 718, 525, 12047, 1495, 13, 1678, 736, 1121, 13, 13, 1753, 1653, 29918, 2248, 29898, 345, 14359, 29892, 775, 2909, 29892, 17927, 1125, 13, 1678, 1121, 353, 5159, 13, 1678, 286, 353, 7431, 29898, 401, 2909, 29897, 13, 1678, 7431, 29918, 1760, 29878, 353, 938, 29898, 2435, 29898, 345, 14359, 29961, 29900, 2314, 847, 286, 29897, 13, 1678, 2302, 353, 29871, 29900, 13, 1678, 363, 9649, 297, 12047, 29901, 13, 4706, 775, 353, 5159, 13, 4706, 396, 8877, 4608, 13, 4706, 8877, 353, 7442, 29889, 2378, 4197, 9302, 29889, 2378, 29898, 2003, 29961, 29875, 29901, 29875, 718, 7431, 29918, 1760, 29878, 2314, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 2003, 511, 7431, 29918, 1760, 29878, 4638, 467, 579, 668, 877, 7411, 29941, 29906, 1495, 13, 4706, 396, 8161, 20471, 13632, 680, 515, 278, 775, 2909, 363, 1269, 8877, 13, 4706, 396, 29871, 1599, 5706, 775, 13, 4706, 363, 474, 297, 3464, 29898, 29885, 1125, 13, 9651, 1375, 29918, 5721, 353, 6213, 13, 9651, 775, 29918, 333, 353, 6213, 13, 9651, 363, 432, 297, 3464, 29898, 2435, 29898, 401, 2909, 29961, 29875, 12622, 29901, 13, 18884, 274, 353, 775, 2909, 29961, 29875, 3816, 29926, 29962, 13, 18884, 396, 8147, 1320, 13, 18884, 1320, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 16707, 29961, 29875, 29962, 448, 775, 2909, 29961, 29875, 3816, 29926, 2314, 13, 18884, 565, 313, 1333, 1375, 29918, 5721, 29897, 470, 313, 5721, 529, 1375, 29918, 5721, 1125, 13, 462, 1678, 1375, 29918, 5721, 353, 1320, 13, 462, 1678, 775, 29918, 333, 353, 432, 13, 9651, 775, 29889, 4397, 29898, 401, 29918, 333, 29897, 13, 4706, 396, 788, 775, 304, 1121, 13, 4706, 2302, 4619, 29871, 29896, 13, 4706, 1121, 29889, 4397, 29898, 401, 29897, 13, 4706, 565, 2302, 1273, 29871, 29896, 29900, 29900, 1275, 29871, 29900, 29901, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 2052, 2760, 525, 718, 851, 29898, 2798, 29897, 718, 525, 12047, 1495, 13, 1678, 736, 1121, 13, 13, 1753, 788, 29918, 517, 29918, 9803, 29898, 9303, 29892, 775, 2909, 29892, 282, 29939, 29918, 12150, 2133, 29892, 18139, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29892, 9853, 29918, 2311, 29892, 17927, 1125, 13, 1678, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 6513, 310, 3838, 29901, 525, 718, 851, 29898, 2435, 29898, 9303, 876, 718, 525, 365, 1477, 310, 282, 29939, 29918, 12150, 2133, 29901, 525, 718, 851, 29898, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 4961, 13, 1678, 396, 788, 775, 2909, 13, 1678, 788, 29918, 401, 2909, 29918, 517, 29918, 9803, 29898, 401, 2909, 29892, 18139, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29897, 13, 13, 1678, 396, 788, 282, 29939, 439, 8924, 2133, 13, 1678, 1819, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 22164, 13, 4706, 1962, 29918, 2003, 353, 3667, 29879, 29889, 643, 6646, 29918, 8111, 29898, 29886, 29939, 29918, 12150, 2133, 29961, 29875, 2314, 13, 4706, 1819, 29889, 4397, 3319, 29908, 1742, 1115, 3838, 29961, 29875, 3816, 29901, 29896, 29900, 29900, 1402, 376, 8111, 1115, 1962, 29918, 2003, 1800, 13, 4706, 565, 313, 29875, 1273, 313, 16175, 29918, 2311, 29899, 29896, 29897, 1275, 29871, 29900, 29897, 470, 313, 29875, 1275, 313, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 6817, 29896, 22164, 13, 9651, 565, 501, 1660, 29918, 22716, 4330, 29909, 29918, 11116, 29901, 13, 18884, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1742, 29892, 8111, 29897, 15673, 313, 29995, 29898, 1742, 29897, 29879, 29892, 9649, 29918, 517, 29918, 10389, 29874, 29414, 29898, 8111, 29897, 29879, 1057, 524, 29906, 2636, 876, 613, 18761, 29898, 5975, 876, 13, 9651, 1683, 29901, 13, 18884, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1742, 29892, 8111, 29897, 15673, 313, 29995, 29898, 1742, 29897, 29879, 29892, 1273, 29898, 8111, 29897, 29879, 19123, 18761, 29898, 5975, 876, 13, 9651, 378, 29889, 15060, 580, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 17491, 287, 525, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 525, 12047, 1495, 13, 9651, 1819, 353, 5159, 13, 1678, 736, 13, 13, 1753, 788, 29918, 401, 2909, 29918, 517, 29918, 9803, 29898, 401, 2909, 29892, 18139, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 1125, 13, 1678, 363, 926, 297, 3464, 29898, 2435, 29898, 401, 2909, 22164, 13, 4706, 1819, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 401, 2909, 29961, 1066, 12622, 29901, 13, 9651, 1962, 29918, 2003, 353, 3667, 29879, 29889, 643, 6646, 29918, 8111, 29898, 401, 2909, 29961, 1066, 3816, 29875, 2314, 13, 9651, 1819, 29889, 4397, 3319, 29908, 1066, 1115, 926, 29892, 376, 401, 1115, 474, 29892, 376, 8111, 1115, 1962, 29918, 2003, 29892, 376, 2798, 1115, 18139, 15625, 1066, 29892, 474, 4638, 1800, 13, 4706, 565, 501, 1660, 29918, 22716, 4330, 29909, 29918, 11116, 29901, 13, 9651, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 10702, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1066, 29892, 401, 29892, 8111, 29892, 2302, 29897, 15673, 313, 29995, 29898, 1066, 29897, 29879, 29892, 1273, 29898, 401, 29897, 29879, 29892, 9649, 29918, 517, 29918, 10389, 29874, 29414, 29898, 8111, 29897, 29879, 1057, 7411, 29946, 2636, 511, 1273, 29898, 2798, 29897, 29879, 19123, 18761, 29898, 5975, 876, 13, 4706, 1683, 29901, 13, 9651, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 10702, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1066, 29892, 401, 29892, 8111, 29892, 2302, 29897, 15673, 313, 29995, 29898, 1066, 29897, 29879, 29892, 1273, 29898, 401, 29897, 29879, 29892, 1273, 29898, 8111, 29897, 29879, 29892, 1273, 29898, 2798, 29897, 29879, 19123, 18761, 29898, 5975, 876, 13, 4706, 378, 29889, 15060, 580, 13, 1678, 736, 13, 13, 1753, 788, 29918, 16175, 29918, 517, 29918, 9803, 29898, 1742, 29918, 16175, 29892, 282, 29939, 29918, 12150, 2133, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29892, 9853, 29918, 2311, 29892, 17927, 1125, 13, 1678, 1819, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 22164, 13, 4706, 1962, 29918, 2003, 353, 3667, 29879, 29889, 643, 6646, 29918, 8111, 29898, 29886, 29939, 29918, 12150, 2133, 29961, 29875, 2314, 13, 4706, 1819, 29889, 4397, 3319, 29908, 1742, 1115, 1734, 29918, 16175, 29961, 29875, 3816, 29901, 29896, 29900, 29900, 1402, 376, 8111, 1115, 1962, 29918, 2003, 1800, 13, 4706, 565, 313, 29875, 1273, 313, 16175, 29918, 2311, 29899, 29896, 29897, 1275, 29871, 29900, 29897, 470, 313, 29875, 1275, 313, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 6817, 29896, 22164, 13, 9651, 565, 501, 1660, 29918, 22716, 4330, 29909, 29918, 11116, 29901, 13, 18884, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1742, 29892, 8111, 29897, 15673, 313, 29995, 29898, 1742, 29897, 29879, 29892, 9649, 29918, 517, 29918, 10389, 29874, 29414, 29898, 8111, 29897, 29879, 1057, 524, 29906, 2636, 876, 613, 18761, 29898, 5975, 876, 13, 9651, 1683, 29901, 13, 18884, 3151, 29889, 4258, 329, 331, 1384, 703, 19460, 11646, 15691, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 1159, 718, 376, 313, 1742, 29892, 8111, 29897, 15673, 313, 29995, 29898, 1742, 29897, 29879, 29892, 1273, 29898, 8111, 29897, 29879, 19123, 18761, 29898, 5975, 876, 13, 9651, 378, 29889, 15060, 580, 13, 9651, 1819, 353, 5159, 13, 1678, 736, 13, 13, 1753, 8161, 29918, 2798, 29879, 29898, 401, 2909, 29892, 282, 29939, 29918, 12150, 2133, 1125, 13, 1678, 1121, 353, 9657, 580, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 22164, 13, 4706, 363, 432, 297, 3464, 29898, 2435, 29898, 29886, 29939, 29918, 12150, 2133, 29961, 29875, 12622, 29901, 13, 9651, 926, 353, 432, 13, 9651, 775, 353, 282, 29939, 29918, 12150, 2133, 29961, 29875, 3816, 29926, 29962, 13, 9651, 565, 451, 313, 1066, 29892, 775, 29897, 297, 1121, 29901, 13, 18884, 1121, 15625, 1066, 29892, 775, 4638, 353, 29871, 29896, 13, 9651, 1683, 29901, 13, 18884, 1121, 15625, 1066, 29892, 775, 4638, 4619, 29871, 29896, 13, 1678, 736, 1121, 13, 13, 1753, 1667, 29898, 1191, 29883, 29892, 1852, 29894, 1125, 13, 1678, 4833, 29918, 2917, 353, 20999, 877, 2917, 29914, 2585, 29918, 2917, 29889, 3126, 1495, 13, 1678, 17927, 353, 28468, 29898, 2585, 29918, 2917, 29889, 657, 29918, 1767, 877, 1188, 8785, 13, 1678, 565, 1852, 29883, 529, 29871, 29906, 29901, 13, 4706, 17927, 29889, 1188, 29898, 16363, 29889, 11432, 29892, 525, 8614, 934, 363, 2380, 11265, 3734, 1495, 13, 4706, 736, 13, 1678, 2380, 29918, 2917, 353, 20999, 29898, 19218, 29961, 29896, 2314, 13, 13, 1678, 9853, 29918, 2311, 353, 4833, 29918, 2917, 29889, 657, 29918, 1767, 703, 16175, 29918, 2311, 1159, 13, 13, 1678, 396, 679, 12047, 13, 1678, 3838, 29892, 12047, 29892, 12047, 29918, 2311, 353, 3667, 29879, 29889, 657, 29918, 345, 14359, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 2003, 29918, 1445, 29918, 2084, 4968, 17927, 29897, 13, 1678, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 345, 14359, 29918, 2311, 584, 525, 718, 851, 29898, 345, 14359, 29918, 2311, 876, 13, 13, 1678, 396, 8161, 775, 2909, 13, 1678, 775, 2909, 353, 6213, 13, 1678, 565, 2380, 29918, 2917, 29889, 5349, 29918, 1989, 877, 401, 2909, 29918, 1445, 29374, 13, 4706, 775, 2909, 29918, 9507, 353, 2380, 29918, 2917, 29889, 657, 29918, 1767, 877, 401, 2909, 29918, 1445, 1495, 13, 4706, 565, 775, 2909, 29918, 9507, 29901, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 11403, 775, 2909, 515, 525, 718, 775, 2909, 29918, 9507, 29897, 13, 9651, 775, 2909, 353, 3855, 1037, 1061, 29889, 1359, 29918, 12150, 3950, 29898, 401, 2909, 29918, 9507, 29897, 13, 1678, 565, 1134, 29898, 401, 2909, 29897, 1275, 1134, 29898, 8516, 1125, 13, 4706, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 4391, 716, 775, 2909, 1495, 13, 4706, 396, 3394, 413, 29899, 1004, 550, 1599, 679, 775, 2909, 13, 4706, 775, 2909, 353, 3855, 1037, 1061, 29889, 3258, 29918, 12150, 3950, 29898, 345, 14359, 7503, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 14968, 29918, 2311, 1495, 1402, 2380, 29918, 2917, 29889, 657, 29918, 1767, 877, 29885, 5477, 2380, 29918, 2917, 29889, 657, 29918, 1767, 877, 29895, 5477, 17927, 29897, 13, 4706, 396, 4078, 775, 2909, 304, 934, 313, 25253, 29897, 13, 4706, 3855, 1037, 1061, 29889, 8899, 29918, 12150, 3950, 29898, 401, 2909, 29892, 525, 401, 2909, 29889, 29886, 695, 1495, 13, 13, 1678, 378, 353, 6213, 13, 1678, 3151, 353, 6213, 13, 1678, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 1202, 29918, 517, 29918, 9803, 8785, 29901, 13, 4706, 396, 1653, 4833, 3957, 13, 4706, 1018, 29901, 13, 9651, 378, 353, 6529, 29891, 9708, 29887, 29906, 29889, 6915, 703, 2585, 978, 2433, 29908, 718, 29871, 4833, 29918, 2917, 29889, 657, 29918, 1767, 877, 2585, 29918, 978, 1495, 718, 13577, 1404, 2433, 29908, 718, 29871, 4833, 29918, 2917, 29889, 657, 29918, 1767, 877, 6786, 1495, 718, 13577, 3495, 2433, 29908, 718, 29871, 4833, 29918, 2917, 29889, 657, 29918, 1767, 877, 3069, 1495, 718, 13577, 4800, 2433, 29908, 718, 29871, 4833, 29918, 2917, 29889, 657, 29918, 1767, 877, 5630, 1495, 718, 13577, 1159, 13, 4706, 5174, 29901, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11432, 29892, 525, 6028, 451, 4511, 304, 2566, 1495, 13, 9651, 736, 13, 4706, 3151, 353, 378, 29889, 18127, 580, 13, 13, 4706, 3667, 29879, 29889, 2344, 29918, 24051, 29898, 535, 29892, 3151, 29892, 679, 29918, 2371, 29918, 19678, 29898, 2248, 29918, 2917, 511, 17927, 29897, 13, 4706, 3667, 29879, 29889, 20472, 29918, 509, 335, 5743, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 378, 29892, 2764, 29897, 13, 13, 13, 1678, 396, 1653, 2380, 411, 439, 8924, 3950, 13, 1678, 671, 29918, 13096, 5570, 353, 7700, 13, 1678, 565, 2380, 29918, 2917, 29889, 5349, 29918, 1989, 877, 13096, 5570, 29374, 13, 4706, 671, 29918, 13096, 5570, 353, 2380, 29918, 2917, 29889, 657, 29918, 1767, 877, 13096, 5570, 1495, 13, 13, 1678, 396, 1809, 295, 11412, 13, 1678, 565, 451, 671, 29918, 13096, 5570, 29901, 13, 4706, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 4763, 2380, 11265, 313, 14369, 11412, 29897, 1495, 13, 4706, 1369, 353, 931, 29889, 2230, 580, 13, 4706, 2380, 353, 1653, 29918, 2248, 29918, 2541, 29918, 5444, 790, 29898, 345, 14359, 7503, 345, 14359, 29918, 2311, 1402, 775, 2909, 29892, 17927, 29897, 13, 4706, 1095, 353, 931, 29889, 2230, 580, 13, 4706, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 12881, 728, 2380, 11265, 1156, 525, 718, 851, 29898, 355, 448, 1369, 29897, 718, 525, 6923, 1495, 13, 13, 4706, 18139, 353, 8161, 29918, 2798, 29879, 29898, 401, 2909, 29892, 2380, 29897, 13, 13, 4706, 396, 788, 304, 934, 13, 4706, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 9507, 8785, 29901, 13, 9651, 2380, 29918, 1272, 353, 9657, 3319, 13, 18884, 525, 9303, 2396, 3838, 29892, 13, 18884, 525, 401, 2909, 2396, 775, 2909, 29892, 13, 18884, 525, 2248, 2396, 2380, 29892, 13, 18884, 525, 2798, 29879, 2396, 18139, 13, 9651, 5615, 13, 9651, 527, 29889, 7620, 29918, 2248, 29898, 2248, 29918, 1272, 29892, 2380, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 9507, 8785, 13, 13, 4706, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 1202, 29918, 517, 29918, 9803, 8785, 29901, 13, 9651, 788, 29918, 517, 29918, 9803, 29898, 9303, 29892, 775, 2909, 29892, 2380, 29892, 18139, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29892, 9853, 29918, 2311, 29892, 17927, 29897, 13, 9651, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 4391, 2566, 2380, 12286, 1495, 13, 9651, 3667, 29879, 29889, 3258, 29918, 2248, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2248, 29918, 978, 4968, 525, 1742, 742, 378, 29892, 3151, 29892, 17927, 29897, 13, 9651, 3667, 29879, 29889, 12007, 29918, 509, 335, 5743, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 378, 29892, 3151, 29897, 13, 13, 1678, 396, 16439, 2948, 13, 1678, 565, 671, 29918, 13096, 5570, 29901, 13, 4706, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 4763, 2380, 11265, 313, 13096, 5570, 29897, 1495, 13, 4706, 1369, 353, 931, 29889, 2230, 580, 13, 4706, 1238, 2447, 353, 16510, 8263, 2447, 29898, 345, 14359, 7503, 345, 14359, 29918, 2311, 1402, 3838, 29897, 13, 4706, 286, 353, 7431, 29898, 401, 2909, 29897, 13, 4706, 7431, 29918, 1760, 29878, 353, 938, 29898, 2435, 29898, 345, 14359, 29961, 29900, 2314, 847, 286, 29897, 13, 4706, 13944, 353, 349, 29984, 3220, 9832, 1061, 29898, 401, 2909, 29892, 286, 29892, 7431, 29918, 1760, 29878, 29892, 17927, 29897, 13, 4706, 18139, 353, 9657, 580, 13, 4706, 1962, 29918, 1445, 353, 6213, 13, 4706, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 13096, 5570, 29918, 1272, 8785, 29901, 13, 9651, 1962, 29918, 1445, 353, 1722, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 13096, 5570, 29918, 1272, 5477, 525, 29893, 29890, 1495, 13, 4706, 1550, 313, 1725, 2447, 29889, 5349, 29918, 4622, 580, 1125, 13, 9651, 396, 8147, 13, 9651, 9853, 29892, 1734, 29918, 16175, 353, 1238, 2447, 29889, 657, 29918, 4622, 29918, 16175, 29898, 16175, 29918, 2311, 29897, 13, 9651, 9976, 29892, 18139, 353, 13944, 29889, 2248, 29918, 16175, 29898, 16175, 29897, 13, 9651, 396, 2436, 304, 2566, 470, 788, 304, 934, 13, 9651, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 1202, 29918, 517, 29918, 9803, 8785, 29901, 13, 18884, 788, 29918, 16175, 29918, 517, 29918, 9803, 29898, 1742, 29918, 16175, 29892, 9976, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29892, 9853, 29918, 2311, 29892, 17927, 29897, 13, 18884, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 2528, 287, 525, 718, 851, 29898, 1725, 2447, 29889, 657, 29918, 18127, 580, 448, 9853, 29918, 2311, 718, 7431, 29898, 16175, 876, 718, 525, 12047, 304, 278, 2566, 1495, 13, 9651, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 13096, 5570, 29918, 1272, 8785, 29901, 13, 18884, 2380, 29918, 16175, 353, 9657, 3319, 13, 462, 1678, 525, 9303, 2396, 1734, 29918, 16175, 29892, 13, 462, 1678, 525, 2248, 2396, 9976, 29892, 13, 18884, 5615, 13, 18884, 5839, 280, 29889, 15070, 29898, 2248, 29918, 16175, 29892, 1962, 29918, 1445, 29897, 13, 18884, 285, 353, 1722, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 15843, 29918, 13096, 5570, 29918, 1272, 1495, 29974, 4286, 7050, 742, 525, 29893, 29890, 1495, 13, 18884, 5839, 280, 29889, 15070, 29898, 2798, 29879, 29892, 285, 29897, 13, 18884, 285, 29889, 5358, 580, 13, 18884, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 7032, 287, 525, 718, 851, 29898, 1725, 2447, 29889, 657, 29918, 18127, 580, 448, 9853, 29918, 2311, 718, 7431, 29898, 16175, 876, 718, 525, 12047, 1495, 13, 4706, 565, 1962, 29918, 1445, 29901, 13, 9651, 1962, 29918, 1445, 29889, 5358, 580, 13, 4706, 565, 313, 2248, 29918, 2917, 29889, 657, 29918, 1767, 877, 1202, 29918, 517, 29918, 9803, 8785, 29901, 13, 9651, 396, 788, 775, 2909, 304, 2566, 13, 9651, 788, 29918, 401, 2909, 29918, 517, 29918, 9803, 29898, 401, 2909, 29892, 18139, 29892, 378, 29892, 3151, 29892, 2380, 29918, 2917, 29897, 13, 9651, 17927, 29889, 1188, 29898, 16363, 29889, 11690, 29892, 525, 2528, 287, 775, 2909, 9976, 964, 2566, 1495, 13, 9651, 17927, 29889, 1188, 29898, 21707, 29889, 11690, 29892, 525, 4391, 2566, 2380, 12286, 1495, 13, 9651, 3667, 29879, 29889, 3258, 29918, 2248, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 2380, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2248, 29918, 978, 4968, 525, 1742, 742, 378, 29892, 3151, 29892, 17927, 29897, 13, 9651, 3667, 29879, 29889, 12007, 29918, 509, 335, 5743, 29898, 2248, 29918, 2917, 29889, 657, 29918, 1767, 703, 29886, 29939, 29918, 2371, 29918, 978, 4968, 378, 29892, 3151, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 3396, 29898, 2435, 29898, 9675, 29889, 19218, 511, 10876, 29889, 19218, 29897, 13, 2 ]
processing/views.py
Nivocse/notam
0
187252
<gh_stars>0 import io, csv import requests import datetime from . import util from django.shortcuts import render, redirect from django.urls import reverse_lazy from django.views import View from django.http import JsonResponse from django.views.generic import FormView, ListView, CreateView, UpdateView, DeleteView from django.contrib.auth.decorators import login_required from django.contrib.admin.views.decorators import staff_member_required from django.utils.decorators import method_decorator from .models import Runway, Notam, Airport from .forms import RunwayForm, AirportForm, NotamSelectForm, NotamForm from notam.settings import API_KEY def home(request): return render(request, 'home.html') @method_decorator(staff_member_required, name='dispatch') class DataView(FormView): template_name = "runways_upload.html" form_class = RunwayForm success_url = "/upload/" def form_valid(self, form): form.process_csv() return super().form_valid(form) @method_decorator(staff_member_required, name='dispatch') class AirportView(FormView): template_name = "airports_upload.html" form_class = AirportForm success_url = "/" def form_valid(self, form): form.process_csv() return super().form_valid(form) @method_decorator(staff_member_required, name='dispatch') class NotamSelectView(FormView): template_name = "notam_select.html" form_class = NotamSelectForm success_url = reverse_lazy("notam_select") API_ADDRESS = f"https://applications.icao.int/dataservices/api/notams-list?api_key={API_KEY}&format=json&locations=" @staff_member_required def call(request): if request.method == "GET": locations = [airport.icao for airport in Airport.objects.filter(purpose__in=["BASE", "DEST"])] elif request.method == "POST": if request.POST["locations"] == "0": locations = [airport.icao for airport in Airport.objects.filter(purpose="BASE")] elif request.POST["locations"] == "1": locations = [airport.icao for airport in Airport.objects.filter(purpose__in=["BASE", "DEST"])] elif request.POST["locations"] == "2": locations = request.POST["remark"].split() response = requests.get(f"{API_ADDRESS}{','.join(locations)}") notamdata = response.json() notam_ids = [notam.notam_id for notam in Notam.objects.all()] notams = [Notam( notam_id = f"{data['location'][0:2]} {data['id']}", airport = data["location"], qcode = data["Qcode"], message = data["message"] if len(data["message"]) < 511 else data["message"][:511], startdate = datetime.datetime( int(data["startdate"][0:4]), int(data["startdate"][5:7]), int(data["startdate"][8:10]), int(data["startdate"][11:13]), int(data["startdate"][14:16])), enddate = datetime.datetime( int(data["enddate"][0:4]), int(data["enddate"][5:7]), int(data["enddate"][8:10]), int(data["enddate"][11:13]), int(data["enddate"][14:16])), comment = util.comment(data["message"], data["Qcode"]) ) for data in notamdata if f"{data['location'][0:2]} {data['id']}" not in notam_ids and data["Qcode"] in ["MRLC", "FAAH", "STAH", "FALC", "ATCA", "SPAH", "ACAH", "AECA", "PIAU", "ICCT", "ICAS", "ISAS", "IGAS", "ILAS", "IUAS", "FIAU"]] Notam.objects.bulk_create(notams) return redirect(reverse_lazy("notam_list")) @method_decorator(login_required, name='dispatch') class NotamListView(ListView): model = Notam context_object_name = 'notams' template_name = 'notams.html' @staff_member_required def cleanup(request): now = datetime.datetime.now() Notam.objects.filter(enddate__lt=now).delete() return redirect(reverse_lazy("notam_list")) @method_decorator(staff_member_required, name='dispatch') class NotamCreateView(CreateView): model = Notam form_class = NotamForm success_url = reverse_lazy("notam_list") template_name = "notam_create.html" @method_decorator(staff_member_required, name='dispatch') class NotamUpdateView(UpdateView): model = Notam form_class = NotamForm template_name = "notam_update.html" success_url = reverse_lazy("notam_list") @method_decorator(staff_member_required, name='dispatch') class NotamDeleteView(DeleteView): model = Notam success_url = reverse_lazy("notam_list")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12013, 29892, 11799, 13, 5215, 7274, 13, 5215, 12865, 13, 3166, 869, 1053, 3667, 13, 13, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 29892, 6684, 13, 3166, 9557, 29889, 26045, 1053, 11837, 29918, 433, 1537, 13, 3166, 9557, 29889, 7406, 1053, 4533, 13, 3166, 9557, 29889, 1124, 1053, 14355, 5103, 13, 3166, 9557, 29889, 7406, 29889, 19206, 1053, 3812, 1043, 29892, 22184, 29892, 6204, 1043, 29892, 10318, 1043, 29892, 21267, 1043, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 19557, 4097, 1053, 6464, 29918, 12403, 13, 3166, 9557, 29889, 21570, 29889, 6406, 29889, 7406, 29889, 19557, 4097, 1053, 13925, 29918, 14242, 29918, 12403, 13, 3166, 9557, 29889, 13239, 29889, 19557, 4097, 1053, 1158, 29918, 19557, 1061, 13, 13, 13, 13, 3166, 869, 9794, 1053, 7525, 1582, 29892, 2216, 314, 29892, 18117, 13, 3166, 869, 9514, 1053, 7525, 1582, 2500, 29892, 18117, 2500, 29892, 2216, 314, 3549, 2500, 29892, 2216, 314, 2500, 13, 3166, 451, 314, 29889, 11027, 1053, 3450, 29918, 10818, 13, 13, 13, 1753, 3271, 29898, 3827, 1125, 13, 29871, 736, 4050, 29898, 3827, 29892, 525, 5184, 29889, 1420, 1495, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 3630, 1043, 29898, 2500, 1043, 1125, 13, 29871, 4472, 29918, 978, 353, 376, 3389, 1994, 29918, 9009, 29889, 1420, 29908, 13, 29871, 883, 29918, 1990, 353, 7525, 1582, 2500, 13, 29871, 2551, 29918, 2271, 353, 5591, 9009, 12975, 13, 13, 29871, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 1678, 883, 29889, 5014, 29918, 7638, 580, 13, 1678, 736, 2428, 2141, 689, 29918, 3084, 29898, 689, 29897, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 18117, 1043, 29898, 2500, 1043, 1125, 13, 29871, 4472, 29918, 978, 353, 376, 1466, 4011, 29918, 9009, 29889, 1420, 29908, 13, 29871, 883, 29918, 1990, 353, 18117, 2500, 13, 29871, 2551, 29918, 2271, 353, 5591, 29908, 13, 13, 29871, 822, 883, 29918, 3084, 29898, 1311, 29892, 883, 1125, 13, 1678, 883, 29889, 5014, 29918, 7638, 580, 13, 1678, 736, 2428, 2141, 689, 29918, 3084, 29898, 689, 29897, 13, 13, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 2216, 314, 3549, 1043, 29898, 2500, 1043, 1125, 13, 29871, 4472, 29918, 978, 353, 376, 1333, 314, 29918, 2622, 29889, 1420, 29908, 13, 29871, 883, 29918, 1990, 353, 2216, 314, 3549, 2500, 13, 29871, 2551, 29918, 2271, 353, 11837, 29918, 433, 1537, 703, 1333, 314, 29918, 2622, 1159, 13, 13, 13, 13, 13, 8787, 29918, 17744, 26785, 353, 285, 29908, 991, 597, 932, 5795, 29889, 983, 29877, 29889, 524, 29914, 14538, 6972, 1575, 29914, 2754, 29914, 1333, 2232, 29899, 1761, 29973, 2754, 29918, 1989, 3790, 8787, 29918, 10818, 15704, 4830, 29922, 3126, 29987, 2029, 800, 543, 13, 13, 29992, 303, 3470, 29918, 14242, 29918, 12403, 13, 1753, 1246, 29898, 3827, 1125, 13, 29871, 565, 2009, 29889, 5696, 1275, 376, 7194, 1115, 13, 1678, 14354, 353, 518, 1466, 637, 29889, 983, 29877, 363, 4799, 637, 297, 18117, 29889, 12650, 29889, 4572, 29898, 15503, 4220, 1649, 262, 29922, 3366, 25416, 613, 376, 2287, 1254, 20068, 29962, 13, 29871, 25342, 2009, 29889, 5696, 1275, 376, 5438, 1115, 13, 1678, 565, 2009, 29889, 5438, 3366, 2029, 800, 3108, 1275, 376, 29900, 1115, 13, 418, 14354, 353, 518, 1466, 637, 29889, 983, 29877, 363, 4799, 637, 297, 18117, 29889, 12650, 29889, 4572, 29898, 15503, 4220, 543, 25416, 13531, 13, 1678, 25342, 2009, 29889, 5438, 3366, 2029, 800, 3108, 1275, 376, 29896, 1115, 13, 418, 14354, 353, 518, 1466, 637, 29889, 983, 29877, 363, 4799, 637, 297, 18117, 29889, 12650, 29889, 4572, 29898, 15503, 4220, 1649, 262, 29922, 3366, 25416, 613, 376, 2287, 1254, 20068, 29962, 13, 1678, 25342, 2009, 29889, 5438, 3366, 2029, 800, 3108, 1275, 376, 29906, 1115, 13, 418, 14354, 353, 2009, 29889, 5438, 3366, 26294, 16862, 5451, 580, 13, 259, 13, 29871, 2933, 353, 7274, 29889, 657, 29898, 29888, 29908, 29912, 8787, 29918, 17744, 26785, 1157, 3788, 29889, 7122, 29898, 2029, 800, 2915, 1159, 13, 29871, 451, 314, 1272, 353, 2933, 29889, 3126, 580, 13, 13, 29871, 451, 314, 29918, 4841, 353, 518, 1333, 314, 29889, 1333, 314, 29918, 333, 363, 451, 314, 297, 2216, 314, 29889, 12650, 29889, 497, 580, 29962, 13, 259, 13, 29871, 451, 2232, 353, 518, 3664, 314, 29898, 13, 1678, 451, 314, 29918, 333, 353, 285, 29908, 29912, 1272, 1839, 5479, 2033, 29961, 29900, 29901, 29906, 12258, 426, 1272, 1839, 333, 2033, 17671, 13, 1678, 4799, 637, 353, 848, 3366, 5479, 12436, 13, 1678, 3855, 401, 353, 848, 3366, 29984, 401, 12436, 13, 1678, 2643, 353, 848, 3366, 4906, 3108, 565, 7431, 29898, 1272, 3366, 4906, 20068, 529, 29871, 29945, 29896, 29896, 1683, 848, 3366, 4906, 3108, 7503, 29945, 29896, 29896, 1402, 13, 1678, 1369, 1256, 353, 12865, 29889, 12673, 29898, 13, 418, 938, 29898, 1272, 3366, 2962, 1256, 3108, 29961, 29900, 29901, 29946, 11724, 13, 418, 938, 29898, 1272, 3366, 2962, 1256, 3108, 29961, 29945, 29901, 29955, 11724, 13, 418, 938, 29898, 1272, 3366, 2962, 1256, 3108, 29961, 29947, 29901, 29896, 29900, 11724, 13, 418, 938, 29898, 1272, 3366, 2962, 1256, 3108, 29961, 29896, 29896, 29901, 29896, 29941, 11724, 13, 418, 938, 29898, 1272, 3366, 2962, 1256, 3108, 29961, 29896, 29946, 29901, 29896, 29953, 2314, 511, 13, 1678, 1095, 1256, 353, 12865, 29889, 12673, 29898, 13, 418, 938, 29898, 1272, 3366, 355, 1256, 3108, 29961, 29900, 29901, 29946, 11724, 13, 418, 938, 29898, 1272, 3366, 355, 1256, 3108, 29961, 29945, 29901, 29955, 11724, 13, 418, 938, 29898, 1272, 3366, 355, 1256, 3108, 29961, 29947, 29901, 29896, 29900, 11724, 13, 418, 938, 29898, 1272, 3366, 355, 1256, 3108, 29961, 29896, 29896, 29901, 29896, 29941, 11724, 13, 418, 938, 29898, 1272, 3366, 355, 1256, 3108, 29961, 29896, 29946, 29901, 29896, 29953, 2314, 511, 13, 1678, 3440, 353, 3667, 29889, 9342, 29898, 1272, 3366, 4906, 12436, 848, 3366, 29984, 401, 20068, 13, 29871, 1723, 363, 848, 297, 451, 314, 1272, 565, 285, 29908, 29912, 1272, 1839, 5479, 2033, 29961, 29900, 29901, 29906, 12258, 426, 1272, 1839, 333, 2033, 5038, 451, 297, 451, 314, 29918, 4841, 322, 848, 3366, 29984, 401, 3108, 297, 29871, 13, 462, 3986, 6796, 29924, 2241, 29907, 613, 376, 4519, 29909, 29950, 613, 376, 1254, 29909, 29950, 613, 376, 29943, 1964, 29907, 613, 29871, 13, 462, 3986, 376, 1299, 5454, 613, 376, 5550, 29909, 29950, 613, 376, 2477, 29909, 29950, 613, 376, 16036, 5454, 613, 13, 462, 3986, 376, 2227, 25951, 613, 376, 2965, 1783, 613, 376, 2965, 3289, 613, 376, 3235, 3289, 613, 13, 462, 3986, 376, 6259, 3289, 613, 376, 6227, 3289, 613, 376, 29902, 29965, 3289, 613, 376, 3738, 25951, 3108, 29962, 13, 13, 29871, 2216, 314, 29889, 12650, 29889, 8645, 29895, 29918, 3258, 29898, 1333, 2232, 29897, 13, 13, 29871, 736, 6684, 29898, 24244, 29918, 433, 1537, 703, 1333, 314, 29918, 1761, 5783, 13, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 7507, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 2216, 314, 15660, 29898, 15660, 1125, 13, 29871, 1904, 353, 2216, 314, 13, 29871, 3030, 29918, 3318, 29918, 978, 353, 525, 1333, 2232, 29915, 13, 29871, 4472, 29918, 978, 353, 525, 1333, 2232, 29889, 1420, 29915, 13, 13, 29992, 303, 3470, 29918, 14242, 29918, 12403, 13, 1753, 5941, 786, 29898, 3827, 1125, 13, 29871, 1286, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 29871, 2216, 314, 29889, 12650, 29889, 4572, 29898, 355, 1256, 1649, 1896, 29922, 3707, 467, 8143, 580, 13, 13, 29871, 736, 6684, 29898, 24244, 29918, 433, 1537, 703, 1333, 314, 29918, 1761, 5783, 13, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 2216, 314, 4391, 1043, 29898, 4391, 1043, 1125, 13, 29871, 1904, 353, 2216, 314, 13, 29871, 883, 29918, 1990, 353, 2216, 314, 2500, 13, 29871, 2551, 29918, 2271, 353, 11837, 29918, 433, 1537, 703, 1333, 314, 29918, 1761, 1159, 13, 29871, 4472, 29918, 978, 353, 376, 1333, 314, 29918, 3258, 29889, 1420, 29908, 13, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 2216, 314, 6422, 1043, 29898, 6422, 1043, 1125, 13, 29871, 1904, 353, 2216, 314, 13, 29871, 883, 29918, 1990, 353, 2216, 314, 2500, 13, 29871, 4472, 29918, 978, 353, 376, 1333, 314, 29918, 5504, 29889, 1420, 29908, 13, 29871, 2551, 29918, 2271, 353, 11837, 29918, 433, 1537, 703, 1333, 314, 29918, 1761, 1159, 13, 13, 13, 29992, 5696, 29918, 19557, 1061, 29898, 303, 3470, 29918, 14242, 29918, 12403, 29892, 1024, 2433, 13369, 1495, 13, 1990, 2216, 314, 12498, 1043, 29898, 12498, 1043, 1125, 13, 29871, 1904, 353, 2216, 314, 13, 29871, 2551, 29918, 2271, 353, 11837, 29918, 433, 1537, 703, 1333, 314, 29918, 1761, 1159, 2 ]
shunt/shunt/hmap.py
velezj/project-manager
0
106668
<gh_stars>0 import logging logger = logging.getLogger( __name__ ) ## # Interface functions for Hiearchichal Maps (hmaps) # which are jsut dictionaries-of-dictionaries :) ##============================================================================ ## # Returns true iff the given object is a structured key with # given delimiter def is_structured_key( x, delim='/' ): return isinstance( x, str ) and delim in x ##============================================================================ ## # Convert from a structured key to a path. # A structured key is just a delimited single-string key # much like a file system path or url :) def structured_key_to_path( sk, delim='/' ): def _numerate(x): if isinstance( x , str ) and x.startswith('[') and x.endswith(']'): try: return int(x[1:-1]) except: return x return x return list(map(_numerate, sk.split( delim ))) ##============================================================================ ## # Take a path of a structured key and return a path def ensure_path( sk_or_path, delim='/' ): if isinstance( sk_or_path, str ): return structured_key_to_path( sk_or_path, delim=delim ) return sk_or_path ##============================================================================ ## # Traverse a hiearchical map (dict of dict) structure with a path # (a list of keys). # This will return the parent dictionary and key for the last # item in the path or None,None if the path is not valid # # This will *change* the given hmap (potentially) since it will # *create* the hmap structure down the path if it was not # previously created in the hmap def hmap_probe( hmap, path ): path = ensure_path( path ) if path is None or hmap is None or len(path) < 1: return None, None if len(path) == 1: return hmap, path[0] next_element_type = dict if isinstance( path[1], int ): next_element_type = list if isinstance( path[0], int ) and isinstance( hmap, list ): while len( hmap ) < path[0]: hmap.append( None ) if len(hmap) == path[0]: hmap.append( next_element_type() ) else: if path[0] not in hmap: hmap[ path[0] ] = next_element_type() return hmap_probe( hmap[ path[0] ], path[1:] ) ##============================================================================ ## # Get the value for a path from an hmap # Or returns the given default value. # This may change the given hmap by probing it. def hmap_get( hmap, path, default ): node, key = hmap_probe( hmap, path ) if node is None or ( isinstance(node,dict) and key not in node ) or ( isinstance( node, list ) and len(node) <= key): return default return node[ key ] ##============================================================================ ## # Sets the value of the given path in an hmap to the # given value. # This will create the path layers if need be def hmap_set( hmap, path, value ): node, key = hmap_probe( hmap, path ) if node is None: raise ValueError( "Could not probe hmap, returned None. This usually means that the hmap itself was None!" ) if isinstance( node, dict ): old = node.get( key, None ) node[ key ] = value elif isinstance( node, list ): old = None if key < len(node): old = node[ key ] while len(node) <= key: node.append( None ) node[ key ] = value else: raise ValueError( "Could not probe hmap, returned neither a dict or list. This usually means that hte hamp itself was malformed" ) return old ##============================================================================ ## # returns true if the given path has a set value in the given hmap def hmap_has_path( hmap, path ): node, key = hmap_probe( hmap_probe, path ) return node is not None and ( ( isinstance(node,dict) and key in node ) or ( isinstance(node,list) and key < len(node) ) ) ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================ ##============================================================================
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12183, 13, 21707, 353, 12183, 29889, 657, 16363, 29898, 4770, 978, 1649, 1723, 13, 13, 13, 2277, 13, 29937, 25796, 3168, 363, 379, 347, 1279, 436, 284, 25846, 313, 29882, 10339, 29897, 13, 29937, 607, 526, 6965, 329, 21503, 4314, 29899, 974, 29899, 29467, 4314, 4248, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 16969, 1565, 565, 29888, 278, 2183, 1203, 338, 263, 2281, 2955, 1820, 411, 13, 29937, 2183, 28552, 13, 1753, 338, 29918, 4984, 2955, 29918, 1989, 29898, 921, 29892, 628, 326, 2433, 22208, 29871, 1125, 13, 1678, 736, 338, 8758, 29898, 921, 29892, 851, 1723, 322, 628, 326, 297, 921, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 14806, 515, 263, 2281, 2955, 1820, 304, 263, 2224, 29889, 13, 29937, 319, 2281, 2955, 1820, 338, 925, 263, 628, 326, 1573, 2323, 29899, 1807, 1820, 13, 29937, 1568, 763, 263, 934, 1788, 2224, 470, 3142, 4248, 13, 1753, 2281, 2955, 29918, 1989, 29918, 517, 29918, 2084, 29898, 2071, 29892, 628, 326, 2433, 22208, 29871, 1125, 13, 1678, 822, 903, 8058, 403, 29898, 29916, 1125, 13, 4706, 565, 338, 8758, 29898, 921, 1919, 851, 1723, 322, 921, 29889, 27382, 2541, 877, 29961, 1495, 322, 921, 29889, 1975, 2541, 877, 29962, 29374, 13, 9651, 1018, 29901, 13, 18884, 736, 938, 29898, 29916, 29961, 29896, 13018, 29896, 2314, 13, 9651, 5174, 29901, 13, 18884, 736, 921, 13, 4706, 736, 921, 632, 13, 1678, 736, 1051, 29898, 1958, 7373, 8058, 403, 29892, 2071, 29889, 5451, 29898, 628, 326, 29871, 4961, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 11190, 263, 2224, 310, 263, 2281, 2955, 1820, 322, 736, 263, 2224, 13, 1753, 9801, 29918, 2084, 29898, 2071, 29918, 272, 29918, 2084, 29892, 628, 326, 2433, 22208, 29871, 1125, 13, 1678, 565, 338, 8758, 29898, 2071, 29918, 272, 29918, 2084, 29892, 851, 29871, 1125, 13, 4706, 736, 2281, 2955, 29918, 1989, 29918, 517, 29918, 2084, 29898, 2071, 29918, 272, 29918, 2084, 29892, 628, 326, 29922, 6144, 326, 1723, 13, 1678, 736, 2071, 29918, 272, 29918, 2084, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 3201, 3901, 263, 298, 347, 1279, 936, 2910, 313, 8977, 310, 9657, 29897, 3829, 411, 263, 2224, 13, 29937, 313, 29874, 1051, 310, 6611, 467, 13, 29937, 910, 674, 736, 278, 3847, 8600, 322, 1820, 363, 278, 1833, 13, 29937, 2944, 297, 278, 2224, 470, 6213, 29892, 8516, 565, 278, 2224, 338, 451, 2854, 13, 29937, 13, 29937, 910, 674, 334, 3167, 29930, 278, 2183, 298, 1958, 313, 17765, 9247, 29897, 1951, 372, 674, 13, 29937, 334, 3258, 29930, 278, 298, 1958, 3829, 1623, 278, 2224, 565, 372, 471, 451, 13, 29937, 9251, 2825, 297, 278, 298, 1958, 13, 1753, 298, 1958, 29918, 771, 915, 29898, 298, 1958, 29892, 2224, 29871, 1125, 13, 1678, 2224, 353, 9801, 29918, 2084, 29898, 2224, 1723, 13, 1678, 565, 2224, 338, 6213, 470, 298, 1958, 338, 6213, 470, 7431, 29898, 2084, 29897, 529, 29871, 29896, 29901, 13, 4706, 736, 6213, 29892, 6213, 13, 1678, 565, 7431, 29898, 2084, 29897, 1275, 29871, 29896, 29901, 13, 4706, 736, 298, 1958, 29892, 2224, 29961, 29900, 29962, 13, 1678, 2446, 29918, 5029, 29918, 1853, 353, 9657, 13, 1678, 565, 338, 8758, 29898, 2224, 29961, 29896, 1402, 938, 29871, 1125, 13, 4706, 2446, 29918, 5029, 29918, 1853, 353, 1051, 13, 1678, 565, 338, 8758, 29898, 2224, 29961, 29900, 1402, 938, 1723, 322, 338, 8758, 29898, 298, 1958, 29892, 1051, 29871, 1125, 13, 4706, 1550, 7431, 29898, 298, 1958, 1723, 529, 2224, 29961, 29900, 5387, 13, 9651, 298, 1958, 29889, 4397, 29898, 6213, 1723, 13, 4706, 565, 7431, 29898, 29882, 1958, 29897, 1275, 2224, 29961, 29900, 5387, 13, 9651, 298, 1958, 29889, 4397, 29898, 2446, 29918, 5029, 29918, 1853, 580, 1723, 13, 1678, 1683, 29901, 13, 4706, 565, 2224, 29961, 29900, 29962, 451, 297, 298, 1958, 29901, 13, 9651, 298, 1958, 29961, 2224, 29961, 29900, 29962, 4514, 353, 2446, 29918, 5029, 29918, 1853, 580, 13, 1678, 736, 298, 1958, 29918, 771, 915, 29898, 298, 1958, 29961, 2224, 29961, 29900, 29962, 21251, 2224, 29961, 29896, 17531, 1723, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 3617, 278, 995, 363, 263, 2224, 515, 385, 298, 1958, 13, 29937, 1394, 3639, 278, 2183, 2322, 995, 29889, 13, 29937, 910, 1122, 1735, 278, 2183, 298, 1958, 491, 2070, 292, 372, 29889, 13, 1753, 298, 1958, 29918, 657, 29898, 298, 1958, 29892, 2224, 29892, 2322, 29871, 1125, 13, 1678, 2943, 29892, 1820, 353, 298, 1958, 29918, 771, 915, 29898, 298, 1958, 29892, 2224, 1723, 13, 1678, 565, 2943, 338, 6213, 470, 313, 338, 8758, 29898, 3177, 29892, 8977, 29897, 322, 1820, 451, 297, 2943, 1723, 470, 313, 338, 8758, 29898, 2943, 29892, 1051, 1723, 322, 7431, 29898, 3177, 29897, 5277, 1820, 1125, 13, 4706, 736, 2322, 13, 1678, 736, 2943, 29961, 1820, 4514, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 317, 1691, 278, 995, 310, 278, 2183, 2224, 297, 385, 298, 1958, 304, 278, 13, 29937, 2183, 995, 29889, 13, 29937, 910, 674, 1653, 278, 2224, 15359, 565, 817, 367, 13, 1753, 298, 1958, 29918, 842, 29898, 298, 1958, 29892, 2224, 29892, 995, 29871, 1125, 13, 1678, 2943, 29892, 1820, 353, 298, 1958, 29918, 771, 915, 29898, 298, 1958, 29892, 2224, 1723, 13, 1678, 565, 2943, 338, 6213, 29901, 13, 4706, 12020, 7865, 2392, 29898, 376, 23323, 451, 410, 915, 298, 1958, 29892, 4133, 6213, 29889, 910, 5491, 2794, 393, 278, 298, 1958, 3528, 471, 6213, 3850, 1723, 13, 1678, 565, 338, 8758, 29898, 2943, 29892, 9657, 29871, 1125, 13, 4706, 2030, 353, 2943, 29889, 657, 29898, 1820, 29892, 6213, 1723, 13, 4706, 2943, 29961, 1820, 4514, 353, 995, 13, 1678, 25342, 338, 8758, 29898, 2943, 29892, 1051, 29871, 1125, 13, 4706, 2030, 353, 6213, 13, 4706, 565, 1820, 529, 7431, 29898, 3177, 1125, 13, 9651, 2030, 353, 2943, 29961, 1820, 4514, 13, 4706, 1550, 7431, 29898, 3177, 29897, 5277, 1820, 29901, 13, 9651, 2943, 29889, 4397, 29898, 6213, 1723, 13, 4706, 2943, 29961, 1820, 4514, 353, 995, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 29898, 376, 23323, 451, 410, 915, 298, 1958, 29892, 4133, 9561, 263, 9657, 470, 1051, 29889, 910, 5491, 2794, 393, 298, 371, 298, 1160, 3528, 471, 4439, 15628, 29908, 1723, 268, 13, 1678, 736, 2030, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 13, 2277, 13, 29937, 3639, 1565, 565, 278, 2183, 2224, 756, 263, 731, 995, 297, 278, 2183, 298, 1958, 13, 1753, 298, 1958, 29918, 5349, 29918, 2084, 29898, 298, 1958, 29892, 2224, 29871, 1125, 13, 1678, 2943, 29892, 1820, 353, 298, 1958, 29918, 771, 915, 29898, 298, 1958, 29918, 771, 915, 29892, 2224, 1723, 13, 1678, 736, 2943, 338, 451, 6213, 322, 313, 13, 965, 313, 338, 8758, 29898, 3177, 29892, 8977, 29897, 322, 1820, 297, 2943, 1723, 13, 4706, 470, 313, 338, 8758, 29898, 3177, 29892, 1761, 29897, 322, 1820, 529, 7431, 29898, 3177, 29897, 1723, 1723, 13, 13, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2277, 9166, 9166, 9166, 9166, 4936, 2751, 13, 2 ]
eval/run_eval.py
lintool/MSMARCO-Document-Ranking-Archive
2
91689
import argparse import bz2 import gzip import json import re import os import shutil import subprocess from urllib.request import urlretrieve def evaluate_run_with_qrels(run, qrels): output = subprocess.check_output( f'python eval/ms_marco_eval.py {run} eval/{qrels}', shell=True).decode('utf-8') print(f'\n\n{output}\n\n') m = re.compile('MRR @100: ([0-9.]+)').search(output) return m.group(1) def main(args): id = args.id base_dir = os.path.join('.', 'submissions', id) print(f'Processing submission {id}') print(f'Submission directory {base_dir}') assert os.path.exists(base_dir), f'Error: {base_dir} does not exist!' print('Verified: submission directory exists!') dev_run = os.path.join(base_dir, 'dev.txt.bz2') test_run = os.path.join(base_dir, 'eval.txt.bz2') metadata_file = os.path.join(base_dir, 'metadata.json') for f in [dev_run, test_run, metadata_file]: assert os.path.exists(f), f'Error: {f} does not exist!' print('Verified: expected files appear in the submission directory!') # Uncompress the dev run and the test run for filepath in [dev_run, test_run]: newfilepath = filepath[:-4] with open(newfilepath, 'wb') as new_file, bz2.BZ2File(filepath, 'rb') as file: for data in iter(lambda: file.read(100 * 1024), b''): new_file.write(data) # Evaluate dev run # TODO: Unify eval scripts # https://raw.githubusercontent.com/microsoft/MSMARCO-Document-Ranking/main/ms_marco_eval.py # # The eval script checked into this repo is a fork of the above with a bucnh of minor fixes. if not os.path.exists(os.path.join('eval', 'msmarco-docdev-qrels.tsv')): print('Dev qrels not found, downloading...') dev_qrels_url = 'https://msmarco.blob.core.windows.net/msmarcoranking/msmarco-docdev-qrels.tsv.gz' dev_qrels_compressed = os.path.join('eval', 'msmarco-docdev-qrels.tsv.gz') dev_qrels_uncompressed = os.path.join('eval', 'msmarco-docdev-qrels.tsv') urlretrieve(dev_qrels_url, filename=dev_qrels_compressed) with gzip.open(dev_qrels_compressed, 'rb') as f_in: with open(dev_qrels_uncompressed, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) dev_run_uncompressed = dev_run[:-4] # Strip the .bz2 suffix dev_run_mrr = evaluate_run_with_qrels(dev_run_uncompressed, 'msmarco-docdev-qrels.tsv') print(f'Dev run MRR@100: {dev_run_mrr}') # Evaluate test run if os.path.exists('eval/docleaderboard-qrels.tsv'): test_run_uncompressed = test_run[:-4] # Strip the .bz2 suffix test_run_mrr = evaluate_run_with_qrels(test_run_uncompressed, 'docleaderboard-qrels.tsv') else: print('Test qrels not available, skipping evaluation.') # Piece together entry in leaderboard.csv with open(metadata_file, 'r') as f: metadata = json.load(f) leaderboard_entry = [id, metadata['date'], '', # this is where the emojis go '"' + metadata['model_description'].replace('"', '\\"') + '"', '"' + metadata['team'].replace('"', '\\"') + '"', metadata['paper'], metadata['code'], metadata['type'], '0.000', # This would be where the eval set score goes '' # This is the tweetid field, leaving empty for now ] print('\n\n############') print(','.join(leaderboard_entry)) print('############') if __name__ == '__main__': parser = argparse.ArgumentParser(description='Automated run script for leaderboard') parser.add_argument('--id', type=str, metavar='str', required=True, help='submission id.') main(parser.parse_args())
[ 1, 1053, 1852, 5510, 13, 5215, 289, 29920, 29906, 13, 5215, 330, 7554, 13, 5215, 4390, 13, 5215, 337, 13, 5215, 2897, 13, 5215, 528, 4422, 13, 5215, 1014, 5014, 13, 13, 3166, 3142, 1982, 29889, 3827, 1053, 3142, 276, 509, 2418, 13, 13, 13, 1753, 14707, 29918, 3389, 29918, 2541, 29918, 29939, 2674, 29879, 29898, 3389, 29892, 3855, 2674, 29879, 1125, 13, 1678, 1962, 353, 1014, 5014, 29889, 3198, 29918, 4905, 29898, 13, 4706, 285, 29915, 4691, 19745, 29914, 1516, 29918, 3034, 1111, 29918, 14513, 29889, 2272, 426, 3389, 29913, 19745, 19248, 29939, 2674, 29879, 29913, 742, 6473, 29922, 5574, 467, 13808, 877, 9420, 29899, 29947, 1495, 13, 13, 1678, 1596, 29898, 29888, 12764, 29876, 29905, 29876, 29912, 4905, 1012, 29876, 29905, 29876, 1495, 13, 1678, 286, 353, 337, 29889, 12198, 877, 21055, 29934, 732, 29896, 29900, 29900, 29901, 9310, 29900, 29899, 29929, 5586, 28135, 2824, 4478, 29898, 4905, 29897, 13, 1678, 736, 286, 29889, 2972, 29898, 29896, 29897, 13, 13, 13, 1753, 1667, 29898, 5085, 1125, 13, 1678, 1178, 353, 6389, 29889, 333, 13, 1678, 2967, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 12839, 742, 525, 1491, 29885, 6847, 742, 1178, 29897, 13, 13, 1678, 1596, 29898, 29888, 29915, 7032, 292, 29240, 426, 333, 29913, 1495, 13, 1678, 1596, 29898, 29888, 29915, 4035, 6737, 3884, 426, 3188, 29918, 3972, 29913, 1495, 13, 13, 1678, 4974, 2897, 29889, 2084, 29889, 9933, 29898, 3188, 29918, 3972, 511, 285, 29915, 2392, 29901, 426, 3188, 29918, 3972, 29913, 947, 451, 1863, 20714, 13, 13, 1678, 1596, 877, 6565, 2164, 29901, 29240, 3884, 4864, 29991, 1495, 13, 13, 1678, 2906, 29918, 3389, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 3972, 29892, 525, 3359, 29889, 3945, 29889, 29890, 29920, 29906, 1495, 13, 1678, 1243, 29918, 3389, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 3972, 29892, 525, 14513, 29889, 3945, 29889, 29890, 29920, 29906, 1495, 13, 1678, 15562, 29918, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 3188, 29918, 3972, 29892, 525, 19635, 29889, 3126, 1495, 13, 13, 1678, 363, 285, 297, 518, 3359, 29918, 3389, 29892, 1243, 29918, 3389, 29892, 15562, 29918, 1445, 5387, 13, 4706, 4974, 2897, 29889, 2084, 29889, 9933, 29898, 29888, 511, 285, 29915, 2392, 29901, 426, 29888, 29913, 947, 451, 1863, 20714, 13, 13, 1678, 1596, 877, 6565, 2164, 29901, 3806, 2066, 2615, 297, 278, 29240, 3884, 29991, 1495, 13, 13, 1678, 396, 853, 510, 2139, 278, 2906, 1065, 322, 278, 1243, 1065, 13, 1678, 363, 934, 2084, 297, 518, 3359, 29918, 3389, 29892, 1243, 29918, 3389, 5387, 13, 4706, 716, 1445, 2084, 353, 934, 2084, 7503, 29899, 29946, 29962, 13, 4706, 411, 1722, 29898, 1482, 1445, 2084, 29892, 525, 29893, 29890, 1495, 408, 716, 29918, 1445, 29892, 289, 29920, 29906, 29889, 29933, 29999, 29906, 2283, 29898, 1445, 2084, 29892, 525, 6050, 1495, 408, 934, 29901, 13, 9651, 363, 848, 297, 4256, 29898, 2892, 29901, 934, 29889, 949, 29898, 29896, 29900, 29900, 334, 29871, 29896, 29900, 29906, 29946, 511, 289, 4907, 1125, 13, 18884, 716, 29918, 1445, 29889, 3539, 29898, 1272, 29897, 13, 13, 1678, 396, 382, 4387, 403, 2906, 1065, 13, 13, 1678, 396, 14402, 29901, 853, 1598, 19745, 12078, 13, 1678, 396, 2045, 597, 1610, 29889, 3292, 1792, 3051, 29889, 510, 29914, 4994, 29914, 4345, 1529, 29934, 3217, 29899, 6268, 29899, 29934, 804, 292, 29914, 3396, 29914, 1516, 29918, 3034, 1111, 29918, 14513, 29889, 2272, 13, 1678, 396, 13, 1678, 396, 450, 19745, 2471, 7120, 964, 445, 13761, 338, 263, 27350, 310, 278, 2038, 411, 263, 1321, 18038, 29882, 310, 9461, 24626, 29889, 13, 13, 1678, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 359, 29889, 2084, 29889, 7122, 877, 14513, 742, 525, 1516, 3034, 1111, 29899, 1514, 3359, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 8785, 29901, 13, 4706, 1596, 877, 16618, 3855, 2674, 29879, 451, 1476, 29892, 28536, 856, 1495, 13, 4706, 2906, 29918, 29939, 2674, 29879, 29918, 2271, 353, 525, 991, 597, 1516, 3034, 1111, 29889, 10054, 29889, 3221, 29889, 10499, 29889, 1212, 29914, 1516, 3034, 2616, 804, 292, 29914, 1516, 3034, 1111, 29899, 1514, 3359, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 29889, 18828, 29915, 13, 4706, 2906, 29918, 29939, 2674, 29879, 29918, 510, 13120, 353, 2897, 29889, 2084, 29889, 7122, 877, 14513, 742, 525, 1516, 3034, 1111, 29899, 1514, 3359, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 29889, 18828, 1495, 13, 4706, 2906, 29918, 29939, 2674, 29879, 29918, 348, 510, 13120, 353, 2897, 29889, 2084, 29889, 7122, 877, 14513, 742, 525, 1516, 3034, 1111, 29899, 1514, 3359, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 1495, 13, 4706, 3142, 276, 509, 2418, 29898, 3359, 29918, 29939, 2674, 29879, 29918, 2271, 29892, 10422, 29922, 3359, 29918, 29939, 2674, 29879, 29918, 510, 13120, 29897, 13, 13, 4706, 411, 330, 7554, 29889, 3150, 29898, 3359, 29918, 29939, 2674, 29879, 29918, 510, 13120, 29892, 525, 6050, 1495, 408, 285, 29918, 262, 29901, 13, 9651, 411, 1722, 29898, 3359, 29918, 29939, 2674, 29879, 29918, 348, 510, 13120, 29892, 525, 29893, 29890, 1495, 408, 285, 29918, 449, 29901, 13, 18884, 528, 4422, 29889, 8552, 1445, 5415, 29898, 29888, 29918, 262, 29892, 285, 29918, 449, 29897, 13, 13, 1678, 2906, 29918, 3389, 29918, 348, 510, 13120, 353, 2906, 29918, 3389, 7503, 29899, 29946, 29962, 29871, 396, 624, 6472, 278, 869, 29890, 29920, 29906, 25557, 13, 1678, 2906, 29918, 3389, 29918, 29885, 21478, 353, 14707, 29918, 3389, 29918, 2541, 29918, 29939, 2674, 29879, 29898, 3359, 29918, 3389, 29918, 348, 510, 13120, 29892, 525, 1516, 3034, 1111, 29899, 1514, 3359, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 1495, 13, 13, 1678, 1596, 29898, 29888, 29915, 16618, 1065, 29751, 29934, 29992, 29896, 29900, 29900, 29901, 426, 3359, 29918, 3389, 29918, 29885, 21478, 29913, 1495, 13, 13, 1678, 396, 382, 4387, 403, 1243, 1065, 13, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 877, 14513, 29914, 1514, 280, 1664, 3377, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 29374, 13, 4706, 1243, 29918, 3389, 29918, 348, 510, 13120, 353, 1243, 29918, 3389, 7503, 29899, 29946, 29962, 29871, 396, 624, 6472, 278, 869, 29890, 29920, 29906, 25557, 13, 4706, 1243, 29918, 3389, 29918, 29885, 21478, 353, 14707, 29918, 3389, 29918, 2541, 29918, 29939, 2674, 29879, 29898, 1688, 29918, 3389, 29918, 348, 510, 13120, 29892, 525, 1514, 280, 1664, 3377, 29899, 29939, 2674, 29879, 29889, 1372, 29894, 1495, 13, 1678, 1683, 29901, 13, 4706, 1596, 877, 3057, 3855, 2674, 29879, 451, 3625, 29892, 14993, 3262, 17983, 29889, 1495, 13, 13, 1678, 396, 26005, 346, 4208, 6251, 297, 11822, 3377, 29889, 7638, 13, 1678, 411, 1722, 29898, 19635, 29918, 1445, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 15562, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 11822, 3377, 29918, 8269, 353, 518, 333, 29892, 13, 462, 308, 15562, 1839, 1256, 7464, 13, 462, 308, 15516, 29871, 396, 445, 338, 988, 278, 953, 3848, 275, 748, 13, 462, 308, 18793, 29915, 718, 15562, 1839, 4299, 29918, 8216, 13359, 6506, 877, 29908, 742, 525, 1966, 29908, 1495, 718, 18793, 742, 13, 462, 308, 18793, 29915, 718, 15562, 1839, 14318, 13359, 6506, 877, 29908, 742, 525, 1966, 29908, 1495, 718, 18793, 742, 13, 462, 308, 15562, 1839, 19773, 7464, 13, 462, 308, 15562, 1839, 401, 7464, 13, 462, 308, 15562, 1839, 1853, 7464, 13, 462, 308, 525, 29900, 29889, 29900, 29900, 29900, 742, 418, 396, 910, 723, 367, 988, 278, 19745, 731, 8158, 5771, 13, 462, 308, 6629, 9651, 396, 910, 338, 278, 7780, 300, 333, 1746, 29892, 10124, 4069, 363, 1286, 13, 462, 308, 4514, 13, 13, 1678, 1596, 28909, 29876, 29905, 29876, 7346, 4136, 1495, 13, 1678, 1596, 29898, 3788, 29889, 7122, 29898, 280, 1664, 3377, 29918, 8269, 876, 13, 1678, 1596, 877, 7346, 4136, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 28451, 630, 1065, 2471, 363, 11822, 3377, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 333, 742, 1134, 29922, 710, 29892, 1539, 485, 279, 2433, 710, 742, 3734, 29922, 5574, 29892, 1371, 2433, 1491, 6737, 1178, 29889, 1495, 13, 13, 1678, 1667, 29898, 16680, 29889, 5510, 29918, 5085, 3101, 13, 2 ]
async/netdev-async.py
caputomarcos/network-programmability-stream
120
163691
<reponame>caputomarcos/network-programmability-stream import asyncio from datetime import datetime from typing import List, Dict, Any, Iterable, Tuple import netdev import colorama HOSTS = { "R1": "198.18.1.101", "R2": "198.18.1.102", "R3": "198.18.1.103", "R4": "198.18.1.104", "R5": "198.18.1.105", "R6": "198.18.1.106", "R7": "198.18.1.107", "R8": "198.18.1.108", "R9": "198.18.1.109", "R10": "198.18.1.110", } OTHER_PARAMS = { "username": "cisco", "password": "<PASSWORD>", "device_type": "cisco_ios", } COMMANDS = [ "show version", "show ip int brief", "show plat soft status control-processor br" ] async def get_outputs(host_info: Tuple[str, str], commands: Iterable[str]) -> Iterable[str]: hostname, host = host_info device_params = { "host": host } device_params.update(OTHER_PARAMS) async with netdev.create(**device_params) as device_conn: outputs = [await device_conn.send_command(command) for command in commands] return outputs def main() -> None: colorama.init() start_time = datetime.now() loop = asyncio.get_event_loop() tasks = [ loop.create_task(get_outputs(host_info, COMMANDS)) for host_info in HOSTS.items() ] loop.run_until_complete(asyncio.wait(tasks)) for hostname, task in zip(HOSTS, tasks): outputs = task.result() print(f"Device {hostname}") for command, output in zip(COMMANDS, outputs): print(f"===== Output from command {command} =====") print(f"{output}\n") print(f"=" * 80) exec_time = (datetime.now() - start_time).total_seconds() print(colorama.Fore.GREEN + f"Summary: it took {exec_time:,.2f} seconds to run") if __name__ == '__main__': main()
[ 1, 529, 276, 1112, 420, 29958, 5030, 329, 290, 279, 3944, 29914, 11618, 29899, 8860, 29885, 3097, 29899, 5461, 13, 5215, 408, 948, 3934, 13, 3166, 12865, 1053, 12865, 13, 3166, 19229, 1053, 2391, 29892, 360, 919, 29892, 3139, 29892, 20504, 519, 29892, 12603, 552, 13, 13, 5215, 7787, 3359, 13, 5215, 2927, 3304, 13, 13, 20832, 29903, 353, 426, 13, 1678, 376, 29934, 29896, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29896, 613, 13, 1678, 376, 29934, 29906, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29906, 613, 13, 1678, 376, 29934, 29941, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29941, 613, 13, 1678, 376, 29934, 29946, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29946, 613, 13, 1678, 376, 29934, 29945, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29945, 613, 13, 1678, 376, 29934, 29953, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29953, 613, 13, 1678, 376, 29934, 29955, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29955, 613, 13, 1678, 376, 29934, 29947, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29947, 613, 13, 1678, 376, 29934, 29929, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29900, 29929, 613, 13, 1678, 376, 29934, 29896, 29900, 1115, 376, 29896, 29929, 29947, 29889, 29896, 29947, 29889, 29896, 29889, 29896, 29896, 29900, 613, 13, 29913, 13, 13, 2891, 4448, 29918, 16320, 29909, 4345, 353, 426, 13, 1678, 376, 6786, 1115, 376, 3476, 1111, 613, 13, 1678, 376, 5630, 1115, 9872, 25711, 17013, 28341, 13, 1678, 376, 10141, 29918, 1853, 1115, 376, 3476, 1111, 29918, 2363, 613, 13, 29913, 13, 13, 13, 19795, 1529, 2797, 29903, 353, 518, 13, 1678, 376, 4294, 1873, 613, 13, 1678, 376, 4294, 10377, 938, 11473, 613, 13, 1678, 376, 4294, 18870, 4964, 4660, 2761, 29899, 26482, 1506, 29908, 13, 29962, 13, 13, 13, 12674, 822, 679, 29918, 4905, 29879, 29898, 3069, 29918, 3888, 29901, 12603, 552, 29961, 710, 29892, 851, 1402, 8260, 29901, 20504, 519, 29961, 710, 2314, 1599, 20504, 519, 29961, 710, 5387, 13, 1678, 3495, 978, 29892, 3495, 353, 3495, 29918, 3888, 13, 1678, 4742, 29918, 7529, 353, 426, 13, 4706, 376, 3069, 1115, 3495, 13, 1678, 500, 13, 1678, 4742, 29918, 7529, 29889, 5504, 29898, 2891, 4448, 29918, 16320, 29909, 4345, 29897, 13, 13, 1678, 7465, 411, 7787, 3359, 29889, 3258, 29898, 1068, 10141, 29918, 7529, 29897, 408, 4742, 29918, 13082, 29901, 13, 4706, 14391, 353, 518, 20675, 4742, 29918, 13082, 29889, 6717, 29918, 6519, 29898, 6519, 29897, 363, 1899, 297, 8260, 29962, 13, 4706, 736, 14391, 13, 13, 13, 1753, 1667, 580, 1599, 6213, 29901, 13, 1678, 2927, 3304, 29889, 2344, 580, 13, 1678, 1369, 29918, 2230, 353, 12865, 29889, 3707, 580, 13, 1678, 2425, 353, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 580, 13, 13, 1678, 9595, 353, 518, 13, 4706, 2425, 29889, 3258, 29918, 7662, 29898, 657, 29918, 4905, 29879, 29898, 3069, 29918, 3888, 29892, 23353, 1529, 2797, 29903, 876, 13, 4706, 363, 3495, 29918, 3888, 297, 379, 3718, 29903, 29889, 7076, 580, 13, 1678, 4514, 13, 13, 1678, 2425, 29889, 3389, 29918, 29305, 29918, 8835, 29898, 294, 948, 3934, 29889, 10685, 29898, 20673, 876, 13, 13, 1678, 363, 3495, 978, 29892, 3414, 297, 14319, 29898, 20832, 29903, 29892, 9595, 1125, 13, 4706, 14391, 353, 3414, 29889, 2914, 580, 13, 4706, 1596, 29898, 29888, 29908, 11501, 426, 28988, 27195, 13, 4706, 363, 1899, 29892, 1962, 297, 14319, 29898, 19795, 1529, 2797, 29903, 29892, 14391, 1125, 13, 9651, 1596, 29898, 29888, 29908, 2751, 29922, 10604, 515, 1899, 426, 6519, 29913, 1275, 1360, 543, 29897, 13, 9651, 1596, 29898, 29888, 29908, 29912, 4905, 1012, 29876, 1159, 13, 4706, 1596, 29898, 29888, 29908, 543, 334, 29871, 29947, 29900, 29897, 13, 13, 1678, 2279, 29918, 2230, 353, 313, 12673, 29889, 3707, 580, 448, 1369, 29918, 2230, 467, 7827, 29918, 23128, 580, 13, 1678, 1596, 29898, 2780, 3304, 29889, 29943, 487, 29889, 29954, 1525, 1430, 718, 285, 29908, 26289, 29901, 372, 3614, 426, 4258, 29918, 2230, 29901, 7671, 29906, 29888, 29913, 6923, 304, 1065, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
tests.py
Shetty4L/mnist-pytorch
0
45363
if __name__ == '__main__': assert True == True
[ 1, 565, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 4974, 5852, 1275, 5852, 13, 2 ]
src/api/recorded.py
what-ewer/tuner-backend
0
107527
from flask import Response import json from src.database.db_model import RecordInformation class RecordedAPI: def __init__(self, db_manager, heartbeat_api): self.db_manager = db_manager self.heartbeat = heartbeat_api def get_recorded(self, id): query = """SELECT ri.order_id, ri.channel_name, ri.channel_id, ri.channel_number, ri.start, ri.stop, ri.title, ri.subtitle, ri.summary, ri.description, ri.genres, ri.record_size, ri.file_name FROM recorded_files as rf INNER JOIN record_information as ri ON rf.order_id = ri.order_id WHERE tuner_id = %s""" args = [id] result = self.db_manager.run_query(query, args) if result: recorded = [RecordInformation(*r) for r in result] return Response( json.dumps(recorded, default=lambda o: o.__dict__, indent=4), mimetype="json", status=200, ) else: return Response("Something went wrong", status=500) def post_recorded(self, id, recorded): posted = [] not_posted = [] updated = [] recorded_ids = [o.order_id for o in recorded] if not self.__remove_deleted_recorded(id, recorded_ids): return Response("Something went wrong", status=500) self.heartbeat.ask_for_information(id, "changed_settings") for o in recorded: if self.__order_with_id_exists(o.order_id): if not self.__recorded_exists(o.order_id): if not self.__insert_recorded(id, o): return Response("Something went wrong", status=500) else: posted.append(o.order_id) else: if not self.__update_recorded(id, o): return Response("Something went wrong", status=500) else: updated.append(o.order_id) if not self.__update_information( o.order_id, o.record_size, o.file_name ): return Response("Something went wrong", status=500) else: not_posted.append(o.order_id) return Response( json.dumps( {"posted_ids": posted, "not_posted": not_posted, "updated": updated} ), status=201, ) def __remove_deleted_recorded(self, id, recorded_ids): query = """DELETE FROM recorded_files WHERE tuner_id = %s""" if recorded_ids: query += " AND (" query += "order_id != %s" for _ in recorded_ids[1:]: query += " AND order_id != %s" query += ")" args = [id, *recorded_ids] return self.db_manager.run_query(query, args, return_result=False) def __update_information(self, order_id, record_size, filename): query = """UPDATE record_information SET record_size = %s, file_name = %s WHERE order_id = %s""" args = [record_size, filename, order_id] return self.db_manager.run_query(query, args, return_result=False) def __order_with_id_exists(self, id): query = """SELECT * FROM record_orders WHERE id = %s""" args = [id] return self.db_manager.run_query(query, args) def __insert_recorded(self, id, o): query = """INSERT INTO recorded_files(order_id, tuner_id, channel_id, program_name, record_size, start, stop) VALUES(%s, %s, %s, %s, %s, %s, %s) RETURNING order_id;""" args = [ o.order_id, id, o.channel_id, o.program_name, o.record_size, o.start, o.stop, ] return self.db_manager.run_query(query, args, return_id=True) def __recorded_exists(self, id): query = """SELECT * FROM recorded_files WHERE order_id = %s""" args = [id] return self.db_manager.run_query(query, args) def __update_recorded(self, id, o): query = """UPDATE recorded_files SET tuner_id = %s, channel_id = %s, program_name = %s, record_size = %s, start = %s, stop = %s WHERE order_id = %s""" args = [ id, o.channel_id, o.program_name, o.record_size, o.start, o.stop, o.order_id, ] return self.db_manager.run_query(query, args, return_result=False)
[ 1, 515, 29784, 1053, 13291, 13, 5215, 4390, 13, 3166, 4765, 29889, 9803, 29889, 2585, 29918, 4299, 1053, 14164, 20350, 13, 13, 13, 1990, 14164, 287, 8787, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4833, 29918, 12847, 29892, 5192, 915, 271, 29918, 2754, 1125, 13, 4706, 1583, 29889, 2585, 29918, 12847, 353, 4833, 29918, 12847, 13, 4706, 1583, 29889, 23057, 915, 271, 353, 5192, 915, 271, 29918, 2754, 13, 13, 1678, 822, 679, 29918, 11651, 287, 29898, 1311, 29892, 1178, 1125, 13, 4706, 2346, 353, 9995, 6404, 10107, 29889, 2098, 29918, 333, 29892, 13, 9651, 10107, 29889, 12719, 29918, 978, 29892, 13, 9651, 10107, 29889, 12719, 29918, 333, 29892, 13, 9651, 10107, 29889, 12719, 29918, 4537, 29892, 13, 9651, 10107, 29889, 2962, 29892, 13, 9651, 10107, 29889, 9847, 29892, 13, 9651, 10107, 29889, 3257, 29892, 13, 9651, 10107, 29889, 1491, 3257, 29892, 13, 9651, 10107, 29889, 7727, 29892, 13, 9651, 10107, 29889, 8216, 29892, 13, 9651, 10107, 29889, 1885, 690, 29892, 13, 9651, 10107, 29889, 11651, 29918, 2311, 29892, 13, 9651, 10107, 29889, 1445, 29918, 978, 13, 9651, 3895, 10478, 29918, 5325, 408, 364, 29888, 13, 9651, 20735, 8780, 2407, 29918, 19678, 408, 10107, 13, 9651, 6732, 364, 29888, 29889, 2098, 29918, 333, 353, 10107, 29889, 2098, 29918, 333, 13, 9651, 5754, 18515, 261, 29918, 333, 353, 1273, 29879, 15945, 29908, 13, 4706, 6389, 353, 518, 333, 29962, 13, 13, 4706, 1121, 353, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29897, 13, 4706, 565, 1121, 29901, 13, 9651, 10478, 353, 518, 9182, 20350, 10456, 29878, 29897, 363, 364, 297, 1121, 29962, 13, 9651, 736, 13291, 29898, 13, 18884, 4390, 29889, 29881, 17204, 29898, 11651, 287, 29892, 2322, 29922, 2892, 288, 29901, 288, 17255, 8977, 1649, 29892, 29536, 29922, 29946, 511, 13, 18884, 286, 17528, 668, 543, 3126, 613, 13, 18884, 4660, 29922, 29906, 29900, 29900, 29892, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 736, 13291, 703, 16804, 3512, 2743, 613, 4660, 29922, 29945, 29900, 29900, 29897, 13, 13, 1678, 822, 1400, 29918, 11651, 287, 29898, 1311, 29892, 1178, 29892, 10478, 1125, 13, 4706, 8059, 353, 5159, 13, 4706, 451, 29918, 2490, 287, 353, 5159, 13, 4706, 4784, 353, 5159, 13, 4706, 10478, 29918, 4841, 353, 518, 29877, 29889, 2098, 29918, 333, 363, 288, 297, 10478, 29962, 13, 4706, 565, 451, 1583, 17255, 5992, 29918, 311, 22742, 29918, 11651, 287, 29898, 333, 29892, 10478, 29918, 4841, 1125, 13, 9651, 736, 13291, 703, 16804, 3512, 2743, 613, 4660, 29922, 29945, 29900, 29900, 29897, 13, 4706, 1583, 29889, 23057, 915, 271, 29889, 1278, 29918, 1454, 29918, 19678, 29898, 333, 29892, 376, 15033, 29918, 11027, 1159, 13, 4706, 363, 288, 297, 10478, 29901, 13, 9651, 565, 1583, 17255, 2098, 29918, 2541, 29918, 333, 29918, 9933, 29898, 29877, 29889, 2098, 29918, 333, 1125, 13, 18884, 565, 451, 1583, 17255, 11651, 287, 29918, 9933, 29898, 29877, 29889, 2098, 29918, 333, 1125, 13, 462, 1678, 565, 451, 1583, 17255, 7851, 29918, 11651, 287, 29898, 333, 29892, 288, 1125, 13, 462, 4706, 736, 13291, 703, 16804, 3512, 2743, 613, 4660, 29922, 29945, 29900, 29900, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 8059, 29889, 4397, 29898, 29877, 29889, 2098, 29918, 333, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 565, 451, 1583, 17255, 5504, 29918, 11651, 287, 29898, 333, 29892, 288, 1125, 13, 462, 4706, 736, 13291, 703, 16804, 3512, 2743, 613, 4660, 29922, 29945, 29900, 29900, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 4784, 29889, 4397, 29898, 29877, 29889, 2098, 29918, 333, 29897, 13, 13, 18884, 565, 451, 1583, 17255, 5504, 29918, 19678, 29898, 13, 462, 1678, 288, 29889, 2098, 29918, 333, 29892, 288, 29889, 11651, 29918, 2311, 29892, 288, 29889, 1445, 29918, 978, 13, 462, 1125, 13, 462, 1678, 736, 13291, 703, 16804, 3512, 2743, 613, 4660, 29922, 29945, 29900, 29900, 29897, 13, 9651, 1683, 29901, 13, 18884, 451, 29918, 2490, 287, 29889, 4397, 29898, 29877, 29889, 2098, 29918, 333, 29897, 13, 4706, 736, 13291, 29898, 13, 9651, 4390, 29889, 29881, 17204, 29898, 13, 18884, 8853, 2490, 287, 29918, 4841, 1115, 8059, 29892, 376, 1333, 29918, 2490, 287, 1115, 451, 29918, 2490, 287, 29892, 376, 21402, 1115, 4784, 29913, 13, 9651, 10353, 13, 9651, 4660, 29922, 29906, 29900, 29896, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 4770, 5992, 29918, 311, 22742, 29918, 11651, 287, 29898, 1311, 29892, 1178, 29892, 10478, 29918, 4841, 1125, 13, 4706, 2346, 353, 9995, 2287, 18476, 29871, 13, 9651, 3895, 10478, 29918, 5325, 29871, 13, 9651, 5754, 18515, 261, 29918, 333, 353, 1273, 29879, 15945, 29908, 13, 4706, 565, 10478, 29918, 4841, 29901, 13, 9651, 2346, 4619, 376, 5300, 4852, 13, 9651, 2346, 4619, 376, 2098, 29918, 333, 2804, 1273, 29879, 29908, 13, 9651, 363, 903, 297, 10478, 29918, 4841, 29961, 29896, 29901, 5387, 13, 18884, 2346, 4619, 376, 5300, 1797, 29918, 333, 2804, 1273, 29879, 29908, 13, 9651, 2346, 4619, 376, 5513, 13, 4706, 6389, 353, 518, 333, 29892, 334, 11651, 287, 29918, 4841, 29962, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29892, 736, 29918, 2914, 29922, 8824, 29897, 13, 13, 1678, 822, 4770, 5504, 29918, 19678, 29898, 1311, 29892, 1797, 29918, 333, 29892, 2407, 29918, 2311, 29892, 10422, 1125, 13, 4706, 2346, 353, 9995, 14474, 2407, 29918, 19678, 13, 9651, 11368, 2407, 29918, 2311, 353, 1273, 29879, 29892, 934, 29918, 978, 353, 1273, 29879, 13, 9651, 5754, 1797, 29918, 333, 353, 1273, 29879, 15945, 29908, 13, 4706, 6389, 353, 518, 11651, 29918, 2311, 29892, 10422, 29892, 1797, 29918, 333, 29962, 13, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29892, 736, 29918, 2914, 29922, 8824, 29897, 13, 13, 1678, 822, 4770, 2098, 29918, 2541, 29918, 333, 29918, 9933, 29898, 1311, 29892, 1178, 1125, 13, 4706, 2346, 353, 9995, 6404, 334, 13, 9651, 3895, 2407, 29918, 20488, 13, 9651, 5754, 1178, 353, 1273, 29879, 15945, 29908, 13, 4706, 6389, 353, 518, 333, 29962, 13, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29897, 13, 13, 1678, 822, 4770, 7851, 29918, 11651, 287, 29898, 1311, 29892, 1178, 29892, 288, 1125, 13, 4706, 2346, 353, 9995, 19460, 11646, 10478, 29918, 5325, 29898, 2098, 29918, 333, 29892, 18515, 261, 29918, 333, 29892, 8242, 29918, 333, 29892, 1824, 29918, 978, 29892, 2407, 29918, 2311, 29892, 1369, 29892, 5040, 29897, 29871, 13, 9651, 15673, 29414, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29897, 13, 9651, 28081, 24015, 4214, 1797, 29918, 333, 15458, 15945, 13, 4706, 6389, 353, 518, 13, 9651, 288, 29889, 2098, 29918, 333, 29892, 13, 9651, 1178, 29892, 13, 9651, 288, 29889, 12719, 29918, 333, 29892, 13, 9651, 288, 29889, 8860, 29918, 978, 29892, 13, 9651, 288, 29889, 11651, 29918, 2311, 29892, 13, 9651, 288, 29889, 2962, 29892, 13, 9651, 288, 29889, 9847, 29892, 13, 4706, 4514, 13, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29892, 736, 29918, 333, 29922, 5574, 29897, 13, 13, 1678, 822, 4770, 11651, 287, 29918, 9933, 29898, 1311, 29892, 1178, 1125, 13, 4706, 2346, 353, 9995, 6404, 334, 13, 9651, 3895, 10478, 29918, 5325, 13, 9651, 5754, 1797, 29918, 333, 353, 1273, 29879, 15945, 29908, 13, 4706, 6389, 353, 518, 333, 29962, 13, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29897, 13, 13, 1678, 822, 4770, 5504, 29918, 11651, 287, 29898, 1311, 29892, 1178, 29892, 288, 1125, 13, 4706, 2346, 353, 9995, 14474, 10478, 29918, 5325, 13, 9651, 11368, 18515, 261, 29918, 333, 353, 1273, 29879, 29892, 29871, 13, 18884, 8242, 29918, 333, 353, 1273, 29879, 29892, 29871, 13, 18884, 1824, 29918, 978, 353, 1273, 29879, 29892, 29871, 13, 18884, 2407, 29918, 2311, 353, 1273, 29879, 29892, 29871, 13, 18884, 1369, 353, 1273, 29879, 29892, 29871, 13, 18884, 5040, 353, 1273, 29879, 13, 9651, 5754, 1797, 29918, 333, 353, 1273, 29879, 15945, 29908, 13, 4706, 6389, 353, 518, 13, 9651, 1178, 29892, 13, 9651, 288, 29889, 12719, 29918, 333, 29892, 13, 9651, 288, 29889, 8860, 29918, 978, 29892, 13, 9651, 288, 29889, 11651, 29918, 2311, 29892, 13, 9651, 288, 29889, 2962, 29892, 13, 9651, 288, 29889, 9847, 29892, 13, 9651, 288, 29889, 2098, 29918, 333, 29892, 13, 4706, 4514, 13, 13, 4706, 736, 1583, 29889, 2585, 29918, 12847, 29889, 3389, 29918, 1972, 29898, 1972, 29892, 6389, 29892, 736, 29918, 2914, 29922, 8824, 29897, 13, 2 ]
app.py
hans00/gitlab-telegram-bot
0
100651
<gh_stars>0 #!/usr/bin/env python3 import os import json import logging from flask import ( Flask, render_template, request, jsonify, g ) from teleflask import Teleflask from teleflask.messages import MarkdownMessage from hashlib import sha1 import requests import dataset import shlex import random import re from distutils.version import StrictVersion __version__ = '0.2.0' app = Flask(__name__) bot = Teleflask(os.environ.get('TG_TOKEN'), app) DATABASE_URL = os.environ.get('DATABASE_URL', "sqlite:///data.db") url_regex = re.compile(r"^(https?:\/\/[\w\-\.]+\.[a-z]{2,20}\/[\w\-]+\/[\w\-]+)$", re.I) def get_db(): db = getattr(g, '_database', None) if db is None: db = g._database = dataset.connect(DATABASE_URL) return db def init_db(): with app.app_context(): db = get_db() fresh_db = False if len(db.tables) == 0: fresh_db = True elif StrictVersion(db['meta_data'].find_one(key='version')['value']) < StrictVersion(__version__): for table in db.tables: db[table].drop() fresh_db = True if fresh_db: db.create_table( 'meta_data', primary_id='key', primary_type=db.types.string(20) ) db['meta_data'].create_column('colunm', db.types.text) db['meta_data'].insert(dict(key='version', value=str(__version__))) db.create_table( 'repos', primary_id='token', primary_type=db.types.string(40) ) db['repos'].create_column('name', db.types.text) db['repos'].create_column('url', db.types.text) db.create_table('chats') db['chats'].create_column('token', db.types.string(40)) db['chats'].create_column('chat_id', db.types.bigint) db.commit() def is_group(update): return True if update.message.chat else False def get_id(update): if is_group(update): # is a group chat return update.message.chat.id else: # user chat return update.message.from_peer.id def is_tag_bot(update): if len(update.message.entities) == 0: return False else: for entity in update.message.entities: if entity.type == 'mention' and entity.user == bot.username: return True return False def check_url(url): return requests.get(url).text.find('GitLab') != -1 def markdown_escape(data): return data.replace("_", "\_").replace("*", "\*") @app.teardown_appcontext def close_connection(exception): db = getattr(g, '_database', None) if db is not None: db.commit() @bot.on_startup def bot_started(): db = get_db() msg = "大家好,台灣最大的 GitLab 機器人上線啦。" for chat in db['chats'].all(): bot.send_message(MarkdownMessage(msg), chat['chat_id'], None) @bot.on_message def msg_me(update, msg): if msg.text.startswith('/'): pass elif not is_group(update) or is_tag_bot(update): return MarkdownMessage("我不會講話,所以不要跟我說話。") @bot.command("start") def start(update, text): return MarkdownMessage("*Hello World*\n歡迎使用 @" + markdown_escape(bot.username)) @bot.command("help") def ping(update, text): help_text = "/help - this message\n" help_text += "/ping - ping bot\n" help_text += "/reg <token> - bind repo\n" help_text += "/bye \[token\] - unbind repo\n" leading_message = [ "你以為我會給你提示ㄇ (?\n\n\n\n\n\n對我會\n\n", "我才不會幫助你呢 (X\n\n\n\n", ] return MarkdownMessage(random.choice(leading_message)+help_text) @bot.command("ping") def ping(update, text): return MarkdownMessage("pong") @bot.command("reg") def reg(update, text): if not text: return MarkdownMessage("Usage: /reg <token>") else: args = shlex.split(text) token = args[0] db = get_db() sender = get_id(update) if db['repos'].count(token=token) > 0: if db['chats'].count(token=token, chat_id=sender) == 0: db['chats'].insert(dict(token=token, chat_id=sender)) return MarkdownMessage("\U0001F60E Yey! It's works.") else: return MarkdownMessage("重複綁定") else: return MarkdownMessage("Not exists token!") @bot.command("bye") def bye(update, text): db = get_db() sender = get_id(update) bind_count = db['chats'].count(chat_id=sender) if bind_count == 0: return MarkdownMessage("你未曾綁定過任何專案唷") if bind_count == 1: db['chats'].delete(chat_id=sender) return MarkdownMessage("\U0001F63F 好吧\n掰掰") elif not text: repo_list = "*token* - *專案名稱*\n`all` - *全部*" for bind in db['chats'].find(chat_id=sender): repo = db['repos'].find_one(token=bind['token']) repo_list += "`\n%s` - *%s*" % (repo['token'], markdown_escape(repo['name'])) return MarkdownMessage("找到有綁定多個專案,請指定。\n使用方法: /bye <token>\n"+repo_list) else: args = shlex.split(text) token = args[0] if token == 'all': db['chats'].delete(chat_id=sender) return MarkdownMessage("\U0001F63F 好吧\n掰掰...") elif db['chats'].count(chat_id=sender, token=token): db['chats'].delete(chat_id=sender, token=token) return MarkdownMessage("\U0001F63F 好吧\n掰掰") else: return MarkdownMessage("呃... 你似乎沒綁定過這個") @app.route("/", methods=['GET']) def index(): db = get_db() repos = db['repos'].all() return render_template('index.html', repos=repos) @app.route("/register", methods=['GET', 'POST']) def register(): if request.method == 'GET': return render_template('register.html') else: db = get_db() name = request.form.get('name', type=str, default='') url = request.form.get('url', type=str, default='') token = sha1(url.encode('utf8')).hexdigest() exists = db['repos'].count(token=token) if name != '' and url != '' and exists == 0 and url_regex.match(url) and check_url(url): db['repos'].insert(dict(token=token, name=name, url=url)) base_url = '/'.join(bot.webhook_url.split("/")[:3]) return render_template('register_done.html', success=True, token=token, base_url=base_url, bot_username=bot.username) else: return render_template('register_done.html', success=False) @app.route("/gitlab/", methods=['GET', 'POST']) def gitlab_webhook(): if request.method == 'POST': token = request.headers.get('X-Gitlab-Token') db = get_db() if not db['repos'].count(token=token): return jsonify({'status':'bad token'}), 401 data = request.json # json contains an attribute that differenciates between the types, see # https://docs.gitlab.com/ce/user/project/integrations/webhooks.html # for more infos kind = data['object_kind'] if kind == 'push': msg = generatePushMsg(data) elif kind == 'tag_push': msg = generatePushMsg(data) # TODO:Make own function for this elif kind == 'issue': msg = generateIssueMsg(data) elif kind == 'note': msg = generateCommentMsg(data) elif kind == 'merge_request': msg = generateMergeRequestMsg(data) elif kind == 'wiki_page': msg = generateWikiMsg(data) elif kind == 'pipeline': msg = generatePipelineMsg(data) elif kind == 'build': msg = generateBuildMsg(data) else: msg = 'ERROR: `unknown_event`' if msg is not None: chats = db['chats'].find(token=token) for chat in chats: bot.send_message(MarkdownMessage(msg), chat['chat_id'], None) return jsonify({'status': 'ok'}), 200 else: return jsonify({'status':'invalid request'}), 400 def generatePushMsg(data): msg = '*{0} ({1}) - {2} new commits*\n'\ .format(data['project']['name'], data['project']['default_branch'], data['total_commits_count']) for commit in data['commits']: msg = msg + '----------------------------------------------------------------\n' msg = msg + markdown_escape(commit['message'].rstrip()) msg = msg + '\n' + markdown_escape(commit['url']) + '\n' msg = msg + '----------------------------------------------------------------\n' return msg def generateIssueMsg(data): action = data['object_attributes']['action'] if action == 'open': msg = '*{0} new Issue for {1}*\n'\ .format(markdown_escape(data['project']['name']), markdown_escape(data['assignee']['name'])) elif action == 'close': msg = '*{0} Issue closed by {1}*\n'\ .format(markdown_escape(data['project']['name']), markdown_escape(data['user']['name'])) msg = msg + '*{0}*'.format(markdown_escape(data['object_attributes']['title'])) msg = msg + 'see {0} for further details'.format(markdown_escape(data['object_attributes']['url'])) return msg def generateCommentMsg(data): ntype = data['object_attributes']['noteable_type'] if ntype == 'Commit': msg = '*Comment commit on {project}*\n{hr}\n{note}\n{url}'\ .format( project=markdown_escape(data['project']['path_with_namespace']), hr="----------------------------------------------------------------", note=markdown_escape(data['object_attributes']['note']), url=markdown_escape(data['object_attributes']['url']) ) elif ntype == 'MergeRequest': msg = '*Comment merge request on {project}!{mr_id}*\n{hr}\n*{title}*\n{note}\n{url}'\ .format( project=markdown_escape(data['project']['path_with_namespace']), url=markdown_escape(data['object_attributes']['url']), mr_id=data['merge_request']['id'], hr="----------------------------------------------------------------", title=markdown_escape(data['merge_request']['title']), note=markdown_escape(data['object_attributes']['note']) ) elif ntype == 'Issue': msg = '*Comment issue on {project}#{issue_id}*\n{hr}\n*{title}*\n{note}\n{url}'\ .format( project=markdown_escape(data['project']['path_with_namespace']), url=markdown_escape(data['object_attributes']['url']), issue_id=data['issue']['id'], hr="----------------------------------------------------------------", title=markdown_escape(data['issue']['title']), note=markdown_escape(data['object_attributes']['note']) ) elif ntype == 'Snippet': msg = '*Comment snippet on {project}/{snippet_id}*\n{hr}\n*{title}*\n{note}\n{url}'\ .format( project=markdown_escape(data['project']['path_with_namespace']), url=markdown_escape(data['object_attributes']['url']), snippet_id=data['snippet']['id'], hr="----------------------------------------------------------------", title=markdown_escape(data['snippet']['title']), note=markdown_escape(data['object_attributes']['note']) ) return msg def generateMergeRequestMsg(data): action = data['object_attributes']['action'] if action in ['open', 'close']: msg = "*{project_name} {state} Merge Request*\nfrom *{source}* to *{target}*\n\n*{title}*\n{description}"\ .format( project_name=markdown_escape(data['project']['name']), state=data['object_attributes']['state'], title=markdown_escape(data['object_attributes']['title']), source=markdown_escape(data['object_attributes']['source']['path_with_namespace']+':'+data['object_attributes']['source_branch']), target=markdown_escape(data['object_attributes']['target']['path_with_namespace']+':'+data['object_attributes']['target_branch']), description=markdown_escape(data['object_attributes']['description']) ) else: msg = None return msg def generateWikiMsg(data): return None def generatePipelineMsg(data): return None def generateBuildMsg(data): return "*{project_name} build on {build_stage}:{build_name} {build_state}*\n{hr}\n{message}\n{author_name}<{author_email}>"\ .format( project_name=markdown_escape(data['project_name']), build_state=data['build_state'], build_stage=data['build_stage'], build_name=markdown_escape(data['build_name']), hr="----------------------------------------------------------------", message=markdown_escape(data['commit']['message'].rstrip()), author_name=markdown_escape(data['commit']['author_name']), author_email=markdown_escape(data['commit']['author_email']) ) if __name__ == "__main__": init_db() app.run()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 5215, 2897, 13, 5215, 4390, 13, 5215, 12183, 13, 3166, 29784, 1053, 313, 13, 1678, 2379, 1278, 29892, 13, 1678, 4050, 29918, 6886, 29892, 13, 1678, 2009, 29892, 13, 1678, 4390, 1598, 29892, 13, 1678, 330, 13, 29897, 13, 3166, 4382, 1579, 1278, 1053, 9699, 1579, 1278, 13, 3166, 4382, 1579, 1278, 29889, 19158, 1053, 4485, 3204, 3728, 13, 3166, 6608, 1982, 1053, 528, 29874, 29896, 13, 5215, 7274, 13, 5215, 8783, 13, 5215, 528, 2506, 13, 5215, 4036, 13, 5215, 337, 13, 3166, 1320, 13239, 29889, 3259, 1053, 3767, 919, 6594, 13, 13, 1649, 3259, 1649, 29871, 353, 525, 29900, 29889, 29906, 29889, 29900, 29915, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 7451, 353, 9699, 1579, 1278, 29898, 359, 29889, 21813, 29889, 657, 877, 29911, 29954, 29918, 4986, 29968, 1430, 5477, 623, 29897, 13, 13, 25832, 27982, 29918, 4219, 353, 2897, 29889, 21813, 29889, 657, 877, 25832, 27982, 29918, 4219, 742, 376, 22793, 597, 29914, 1272, 29889, 2585, 1159, 13, 13, 2271, 29918, 13087, 353, 337, 29889, 12198, 29898, 29878, 29908, 23733, 991, 29973, 3583, 7998, 29914, 7110, 29893, 29905, 2612, 5586, 3124, 7226, 29874, 29899, 29920, 3199, 29906, 29892, 29906, 29900, 1012, 29914, 7110, 29893, 29905, 29899, 29962, 3124, 29914, 7110, 29893, 29905, 29899, 10062, 1262, 613, 337, 29889, 29902, 29897, 13, 13, 1753, 679, 29918, 2585, 7295, 13, 1678, 4833, 353, 679, 5552, 29898, 29887, 29892, 22868, 9803, 742, 6213, 29897, 13, 1678, 565, 4833, 338, 6213, 29901, 13, 4706, 4833, 353, 330, 3032, 9803, 353, 8783, 29889, 6915, 29898, 25832, 27982, 29918, 4219, 29897, 13, 1678, 736, 4833, 13, 13, 1753, 2069, 29918, 2585, 7295, 13, 1678, 411, 623, 29889, 932, 29918, 4703, 7295, 13, 4706, 4833, 353, 679, 29918, 2585, 580, 13, 4706, 10849, 29918, 2585, 353, 7700, 13, 4706, 565, 7431, 29898, 2585, 29889, 24051, 29897, 1275, 29871, 29900, 29901, 13, 9651, 10849, 29918, 2585, 353, 5852, 13, 4706, 25342, 3767, 919, 6594, 29898, 2585, 1839, 7299, 29918, 1272, 13359, 2886, 29918, 650, 29898, 1989, 2433, 3259, 1495, 1839, 1767, 11287, 529, 3767, 919, 6594, 22168, 3259, 1649, 1125, 13, 9651, 363, 1591, 297, 4833, 29889, 24051, 29901, 13, 18884, 4833, 29961, 2371, 1822, 8865, 580, 13, 9651, 10849, 29918, 2585, 353, 5852, 13, 4706, 565, 10849, 29918, 2585, 29901, 13, 9651, 4833, 29889, 3258, 29918, 2371, 29898, 13, 18884, 525, 7299, 29918, 1272, 742, 13, 18884, 7601, 29918, 333, 2433, 1989, 742, 13, 18884, 7601, 29918, 1853, 29922, 2585, 29889, 8768, 29889, 1807, 29898, 29906, 29900, 29897, 13, 18884, 1723, 13, 9651, 4833, 1839, 7299, 29918, 1272, 13359, 3258, 29918, 4914, 877, 1054, 348, 29885, 742, 4833, 29889, 8768, 29889, 726, 29897, 13, 9651, 4833, 1839, 7299, 29918, 1272, 13359, 7851, 29898, 8977, 29898, 1989, 2433, 3259, 742, 995, 29922, 710, 22168, 3259, 1649, 4961, 13, 9651, 4833, 29889, 3258, 29918, 2371, 29898, 13, 18884, 525, 276, 1066, 742, 13, 18884, 7601, 29918, 333, 2433, 6979, 742, 13, 18884, 7601, 29918, 1853, 29922, 2585, 29889, 8768, 29889, 1807, 29898, 29946, 29900, 29897, 13, 18884, 1723, 13, 9651, 4833, 1839, 276, 1066, 13359, 3258, 29918, 4914, 877, 978, 742, 4833, 29889, 8768, 29889, 726, 29897, 13, 9651, 4833, 1839, 276, 1066, 13359, 3258, 29918, 4914, 877, 2271, 742, 4833, 29889, 8768, 29889, 726, 29897, 13, 9651, 4833, 29889, 3258, 29918, 2371, 877, 305, 1446, 1495, 13, 9651, 4833, 1839, 305, 1446, 13359, 3258, 29918, 4914, 877, 6979, 742, 4833, 29889, 8768, 29889, 1807, 29898, 29946, 29900, 876, 13, 9651, 4833, 1839, 305, 1446, 13359, 3258, 29918, 4914, 877, 13496, 29918, 333, 742, 4833, 29889, 8768, 29889, 3752, 524, 29897, 13, 9651, 4833, 29889, 15060, 580, 13, 13, 1753, 338, 29918, 2972, 29898, 5504, 1125, 13, 1678, 736, 5852, 565, 2767, 29889, 4906, 29889, 13496, 1683, 7700, 13, 13, 1753, 679, 29918, 333, 29898, 5504, 1125, 13, 1678, 565, 338, 29918, 2972, 29898, 5504, 1125, 29871, 396, 338, 263, 2318, 13563, 13, 4706, 736, 2767, 29889, 4906, 29889, 13496, 29889, 333, 13, 1678, 1683, 29901, 29871, 396, 1404, 13563, 13, 4706, 736, 2767, 29889, 4906, 29889, 3166, 29918, 412, 261, 29889, 333, 13, 13, 1753, 338, 29918, 4039, 29918, 7451, 29898, 5504, 1125, 13, 1678, 565, 7431, 29898, 5504, 29889, 4906, 29889, 296, 1907, 29897, 1275, 29871, 29900, 29901, 13, 4706, 736, 7700, 13, 1678, 1683, 29901, 13, 4706, 363, 7855, 297, 2767, 29889, 4906, 29889, 296, 1907, 29901, 13, 9651, 565, 7855, 29889, 1853, 1275, 525, 358, 291, 29915, 322, 7855, 29889, 1792, 1275, 9225, 29889, 6786, 29901, 13, 18884, 736, 5852, 13, 4706, 736, 7700, 13, 13, 1753, 1423, 29918, 2271, 29898, 2271, 1125, 13, 1678, 736, 7274, 29889, 657, 29898, 2271, 467, 726, 29889, 2886, 877, 28712, 28632, 1495, 2804, 448, 29896, 13, 13, 1753, 2791, 3204, 29918, 21587, 29898, 1272, 1125, 13, 1678, 736, 848, 29889, 6506, 703, 29918, 613, 6634, 29918, 2564, 6506, 703, 29930, 613, 6634, 29930, 1159, 13, 13, 29992, 932, 29889, 371, 538, 776, 29918, 932, 4703, 13, 1753, 3802, 29918, 9965, 29898, 11739, 1125, 13, 1678, 4833, 353, 679, 5552, 29898, 29887, 29892, 22868, 9803, 742, 6213, 29897, 13, 1678, 565, 4833, 338, 451, 6213, 29901, 13, 4706, 4833, 29889, 15060, 580, 13, 13, 29992, 7451, 29889, 265, 29918, 2962, 786, 13, 1753, 9225, 29918, 2962, 287, 7295, 13, 1678, 4833, 353, 679, 29918, 2585, 580, 13, 1678, 10191, 353, 376, 30257, 30613, 31076, 30214, 31037, 234, 132, 166, 30878, 30257, 30210, 11786, 28632, 29871, 31540, 30943, 30313, 30429, 31357, 232, 152, 169, 30267, 29908, 13, 1678, 363, 13563, 297, 4833, 1839, 305, 1446, 13359, 497, 7295, 13, 4706, 9225, 29889, 6717, 29918, 4906, 29898, 9802, 3204, 3728, 29898, 7645, 511, 13563, 1839, 13496, 29918, 333, 7464, 6213, 29897, 13, 13, 29992, 7451, 29889, 265, 29918, 4906, 13, 1753, 10191, 29918, 1004, 29898, 5504, 29892, 10191, 1125, 13, 1678, 565, 10191, 29889, 726, 29889, 27382, 2541, 11219, 29374, 13, 4706, 1209, 13, 1678, 25342, 451, 338, 29918, 2972, 29898, 5504, 29897, 470, 338, 29918, 4039, 29918, 7451, 29898, 5504, 1125, 13, 4706, 736, 4485, 3204, 3728, 703, 30672, 30413, 31411, 235, 175, 158, 31812, 30214, 30744, 30651, 30413, 30698, 235, 186, 162, 30672, 235, 173, 173, 31812, 30267, 1159, 13, 13, 29992, 7451, 29889, 6519, 703, 2962, 1159, 13, 1753, 1369, 29898, 5504, 29892, 1426, 1125, 13, 1678, 736, 4485, 3204, 3728, 703, 29930, 10994, 2787, 17710, 29876, 233, 176, 164, 235, 194, 145, 30785, 30406, 12490, 718, 2791, 3204, 29918, 21587, 29898, 7451, 29889, 6786, 876, 13, 13, 29992, 7451, 29889, 6519, 703, 8477, 1159, 13, 1753, 24543, 29898, 5504, 29892, 1426, 1125, 13, 1678, 1371, 29918, 726, 29871, 353, 5591, 8477, 448, 445, 2643, 29905, 29876, 29908, 13, 1678, 1371, 29918, 726, 4619, 5591, 15702, 448, 24543, 9225, 29905, 29876, 29908, 13, 1678, 1371, 29918, 726, 4619, 5591, 1727, 529, 6979, 29958, 448, 7868, 13761, 29905, 29876, 29908, 13, 1678, 1371, 29918, 726, 4619, 5591, 26966, 5539, 6979, 18899, 448, 443, 5355, 13761, 29905, 29876, 29908, 13, 1678, 8236, 29918, 4906, 353, 518, 13, 4706, 376, 30919, 30651, 234, 133, 189, 30672, 31411, 234, 184, 169, 30919, 31302, 30858, 230, 135, 138, 22308, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 232, 179, 144, 30672, 31411, 29905, 29876, 29905, 29876, 613, 13, 4706, 376, 30672, 31979, 30413, 31411, 232, 188, 174, 31931, 30919, 232, 148, 165, 313, 29990, 29905, 29876, 29905, 29876, 29905, 29876, 29905, 29876, 613, 13, 1678, 4514, 13, 1678, 736, 4485, 3204, 3728, 29898, 8172, 29889, 16957, 29898, 25369, 29918, 4906, 7240, 8477, 29918, 726, 29897, 13, 13, 29992, 7451, 29889, 6519, 703, 15702, 1159, 13, 1753, 24543, 29898, 5504, 29892, 1426, 1125, 13, 1678, 736, 4485, 3204, 3728, 703, 29886, 549, 1159, 13, 13, 29992, 7451, 29889, 6519, 703, 1727, 1159, 13, 1753, 1072, 29898, 5504, 29892, 1426, 1125, 13, 1678, 565, 451, 1426, 29901, 13, 4706, 736, 4485, 3204, 3728, 703, 27573, 29901, 847, 1727, 529, 6979, 29958, 1159, 13, 1678, 1683, 29901, 13, 4706, 6389, 353, 528, 2506, 29889, 5451, 29898, 726, 29897, 13, 4706, 5993, 353, 6389, 29961, 29900, 29962, 13, 4706, 4833, 353, 679, 29918, 2585, 580, 13, 4706, 10004, 353, 679, 29918, 333, 29898, 5504, 29897, 13, 4706, 565, 4833, 1839, 276, 1066, 13359, 2798, 29898, 6979, 29922, 6979, 29897, 1405, 29871, 29900, 29901, 13, 9651, 565, 4833, 1839, 305, 1446, 13359, 2798, 29898, 6979, 29922, 6979, 29892, 13563, 29918, 333, 29922, 15452, 29897, 1275, 29871, 29900, 29901, 13, 18884, 4833, 1839, 305, 1446, 13359, 7851, 29898, 8977, 29898, 6979, 29922, 6979, 29892, 13563, 29918, 333, 29922, 15452, 876, 13, 18884, 736, 4485, 3204, 3728, 14182, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29900, 29923, 612, 1032, 29991, 739, 29915, 29879, 1736, 23157, 13, 9651, 1683, 29901, 13, 18884, 736, 4485, 3204, 3728, 703, 30908, 235, 167, 138, 234, 185, 132, 30495, 1159, 13, 4706, 1683, 29901, 13, 9651, 736, 4485, 3204, 3728, 703, 3664, 4864, 5993, 29991, 1159, 13, 13, 29992, 7451, 29889, 6519, 703, 26966, 1159, 13, 1753, 491, 29872, 29898, 5504, 29892, 1426, 1125, 13, 1678, 4833, 353, 679, 29918, 2585, 580, 13, 1678, 10004, 353, 679, 29918, 333, 29898, 5504, 29897, 13, 1678, 7868, 29918, 2798, 353, 4833, 1839, 305, 1446, 13359, 2798, 29898, 13496, 29918, 333, 29922, 15452, 29897, 13, 1678, 565, 7868, 29918, 2798, 1275, 29871, 29900, 29901, 13, 4706, 736, 4485, 3204, 3728, 703, 30919, 31295, 233, 158, 193, 234, 185, 132, 30495, 236, 132, 145, 31450, 31502, 232, 179, 139, 233, 164, 139, 232, 151, 186, 1159, 13, 1678, 565, 7868, 29918, 2798, 1275, 29871, 29896, 29901, 13, 4706, 4833, 1839, 305, 1446, 13359, 8143, 29898, 13496, 29918, 333, 29922, 15452, 29897, 13, 4706, 736, 4485, 3204, 3728, 14182, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29941, 29943, 29871, 31076, 232, 147, 170, 29905, 29876, 233, 145, 179, 233, 145, 179, 1159, 13, 1678, 25342, 451, 1426, 29901, 13, 4706, 13761, 29918, 1761, 353, 26345, 6979, 29930, 448, 334, 232, 179, 139, 233, 164, 139, 30548, 234, 171, 180, 17710, 29876, 29952, 497, 29952, 448, 334, 30753, 30636, 20605, 13, 4706, 363, 7868, 297, 4833, 1839, 305, 1446, 13359, 2886, 29898, 13496, 29918, 333, 29922, 15452, 1125, 13, 9651, 13761, 353, 4833, 1839, 276, 1066, 13359, 2886, 29918, 650, 29898, 6979, 29922, 5355, 1839, 6979, 11287, 13, 9651, 13761, 29918, 1761, 4619, 29724, 29905, 29876, 29995, 29879, 29952, 448, 334, 29995, 29879, 20605, 1273, 313, 20095, 1839, 6979, 7464, 2791, 3204, 29918, 21587, 29898, 20095, 1839, 978, 25901, 13, 4706, 736, 4485, 3204, 3728, 703, 233, 140, 193, 30780, 30417, 234, 185, 132, 30495, 30923, 232, 131, 142, 232, 179, 139, 233, 164, 139, 30214, 235, 174, 142, 31084, 30495, 30267, 29905, 29876, 30785, 30406, 30525, 30545, 30383, 847, 26966, 529, 6979, 14247, 29876, 17969, 20095, 29918, 1761, 29897, 13, 1678, 1683, 29901, 13, 4706, 6389, 353, 528, 2506, 29889, 5451, 29898, 726, 29897, 13, 4706, 5993, 353, 6389, 29961, 29900, 29962, 13, 4706, 565, 5993, 1275, 525, 497, 2396, 13, 9651, 4833, 1839, 305, 1446, 13359, 8143, 29898, 13496, 29918, 333, 29922, 15452, 29897, 13, 9651, 736, 4485, 3204, 3728, 14182, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29941, 29943, 29871, 31076, 232, 147, 170, 29905, 29876, 233, 145, 179, 233, 145, 179, 856, 1159, 13, 4706, 25342, 4833, 1839, 305, 1446, 13359, 2798, 29898, 13496, 29918, 333, 29922, 15452, 29892, 5993, 29922, 6979, 1125, 13, 9651, 4833, 1839, 305, 1446, 13359, 8143, 29898, 13496, 29918, 333, 29922, 15452, 29892, 5993, 29922, 6979, 29897, 13, 9651, 736, 4485, 3204, 3728, 14182, 29965, 29900, 29900, 29900, 29896, 29943, 29953, 29941, 29943, 29871, 31076, 232, 147, 170, 29905, 29876, 233, 145, 179, 233, 145, 179, 1159, 13, 4706, 1683, 29901, 13, 9651, 736, 4485, 3204, 3728, 703, 232, 148, 134, 856, 29871, 30919, 231, 191, 191, 231, 188, 145, 233, 181, 149, 234, 185, 132, 30495, 236, 132, 145, 236, 131, 156, 232, 131, 142, 1159, 13, 13, 29992, 932, 29889, 13134, 11974, 613, 3519, 29922, 1839, 7194, 11287, 13, 1753, 2380, 7295, 13, 1678, 4833, 353, 679, 29918, 2585, 580, 13, 1678, 17573, 353, 4833, 1839, 276, 1066, 13359, 497, 580, 13, 1678, 736, 4050, 29918, 6886, 877, 2248, 29889, 1420, 742, 17573, 29922, 276, 1066, 29897, 13, 13, 29992, 932, 29889, 13134, 11974, 9573, 613, 3519, 29922, 1839, 7194, 742, 525, 5438, 11287, 13, 1753, 6036, 7295, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 7194, 2396, 13, 4706, 736, 4050, 29918, 6886, 877, 9573, 29889, 1420, 1495, 13, 1678, 1683, 29901, 13, 4706, 4833, 353, 679, 29918, 2585, 580, 13, 4706, 1024, 29871, 353, 2009, 29889, 689, 29889, 657, 877, 978, 742, 1134, 29922, 710, 29892, 2322, 2433, 1495, 13, 4706, 3142, 259, 353, 2009, 29889, 689, 29889, 657, 877, 2271, 742, 1134, 29922, 710, 29892, 2322, 2433, 1495, 13, 4706, 5993, 353, 528, 29874, 29896, 29898, 2271, 29889, 12508, 877, 9420, 29947, 1495, 467, 20970, 7501, 342, 580, 13, 4706, 4864, 353, 4833, 1839, 276, 1066, 13359, 2798, 29898, 6979, 29922, 6979, 29897, 13, 4706, 565, 1024, 2804, 6629, 322, 3142, 2804, 6629, 322, 4864, 1275, 29871, 29900, 322, 3142, 29918, 13087, 29889, 4352, 29898, 2271, 29897, 322, 1423, 29918, 2271, 29898, 2271, 1125, 13, 9651, 4833, 1839, 276, 1066, 13359, 7851, 29898, 8977, 29898, 6979, 29922, 6979, 29892, 1024, 29922, 978, 29892, 3142, 29922, 2271, 876, 13, 9651, 2967, 29918, 2271, 353, 8207, 4286, 7122, 29898, 7451, 29889, 2676, 20849, 29918, 2271, 29889, 5451, 11974, 1159, 7503, 29941, 2314, 13, 9651, 736, 4050, 29918, 6886, 877, 9573, 29918, 15091, 29889, 1420, 742, 2551, 29922, 5574, 29892, 5993, 29922, 6979, 29892, 2967, 29918, 2271, 29922, 3188, 29918, 2271, 29892, 9225, 29918, 6786, 29922, 7451, 29889, 6786, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 4050, 29918, 6886, 877, 9573, 29918, 15091, 29889, 1420, 742, 2551, 29922, 8824, 29897, 13, 13, 29992, 932, 29889, 13134, 11974, 5559, 8205, 29914, 613, 3519, 29922, 1839, 7194, 742, 525, 5438, 11287, 13, 1753, 6315, 8205, 29918, 2676, 20849, 7295, 13, 1678, 565, 2009, 29889, 5696, 1275, 525, 5438, 2396, 13, 4706, 5993, 353, 2009, 29889, 13662, 29889, 657, 877, 29990, 29899, 28712, 8205, 29899, 6066, 1495, 13, 4706, 4833, 353, 679, 29918, 2585, 580, 13, 4706, 565, 451, 4833, 1839, 276, 1066, 13359, 2798, 29898, 6979, 29922, 6979, 1125, 13, 9651, 736, 4390, 1598, 3319, 29915, 4882, 22099, 12313, 5993, 29915, 9594, 29871, 29946, 29900, 29896, 13, 4706, 848, 353, 2009, 29889, 3126, 13, 4706, 396, 4390, 3743, 385, 5352, 393, 1163, 13640, 1078, 1546, 278, 4072, 29892, 1074, 13, 4706, 396, 2045, 597, 2640, 29889, 5559, 8205, 29889, 510, 29914, 346, 29914, 1792, 29914, 4836, 29914, 14146, 800, 29914, 2676, 1251, 12117, 29889, 1420, 13, 4706, 396, 363, 901, 3041, 359, 13, 4706, 2924, 353, 848, 1839, 3318, 29918, 14380, 2033, 13, 4706, 565, 2924, 1275, 525, 5910, 2396, 13, 9651, 10191, 353, 5706, 27031, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 4039, 29918, 5910, 2396, 13, 9651, 10191, 353, 5706, 27031, 16190, 29898, 1272, 29897, 29871, 396, 14402, 29901, 9984, 1914, 740, 363, 445, 13, 4706, 25342, 2924, 1275, 525, 15118, 2396, 13, 9651, 10191, 353, 5706, 29902, 893, 434, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 6812, 2396, 13, 9651, 10191, 353, 5706, 20001, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 14634, 29918, 3827, 2396, 13, 9651, 10191, 353, 5706, 15836, 479, 3089, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 4594, 29918, 3488, 2396, 13, 9651, 10191, 353, 5706, 5653, 29875, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 13096, 5570, 2396, 13, 9651, 10191, 353, 5706, 29925, 23828, 16190, 29898, 1272, 29897, 13, 4706, 25342, 2924, 1275, 525, 4282, 2396, 13, 9651, 10191, 353, 5706, 8893, 16190, 29898, 1272, 29897, 13, 4706, 1683, 29901, 13, 9651, 10191, 353, 525, 11432, 29901, 421, 26690, 29918, 3696, 20497, 13, 4706, 565, 10191, 338, 451, 6213, 29901, 13, 9651, 521, 1446, 353, 4833, 1839, 305, 1446, 13359, 2886, 29898, 6979, 29922, 6979, 29897, 13, 9651, 363, 13563, 297, 521, 1446, 29901, 13, 18884, 9225, 29889, 6717, 29918, 4906, 29898, 9802, 3204, 3728, 29898, 7645, 511, 13563, 1839, 13496, 29918, 333, 7464, 6213, 29897, 13, 4706, 736, 4390, 1598, 3319, 29915, 4882, 2396, 525, 554, 29915, 9594, 29871, 29906, 29900, 29900, 13, 1678, 1683, 29901, 13, 4706, 736, 4390, 1598, 3319, 29915, 4882, 22099, 20965, 2009, 29915, 9594, 29871, 29946, 29900, 29900, 13, 13, 13, 1753, 5706, 27031, 16190, 29898, 1272, 1125, 13, 1678, 10191, 353, 525, 19740, 29900, 29913, 21313, 29896, 1800, 448, 426, 29906, 29913, 716, 25741, 17710, 29876, 12764, 13, 4706, 869, 4830, 29898, 1272, 1839, 4836, 16215, 978, 7464, 848, 1839, 4836, 16215, 4381, 29918, 17519, 7464, 848, 1839, 7827, 29918, 2055, 1169, 29918, 2798, 11287, 13, 1678, 363, 9063, 297, 848, 1839, 2055, 1169, 2033, 29901, 13, 4706, 10191, 353, 10191, 718, 525, 2683, 2683, 2683, 2683, 29905, 29876, 29915, 13, 4706, 10191, 353, 10191, 718, 2791, 3204, 29918, 21587, 29898, 15060, 1839, 4906, 13359, 29878, 17010, 3101, 13, 4706, 10191, 353, 10191, 718, 11297, 29876, 29915, 718, 2791, 3204, 29918, 21587, 29898, 15060, 1839, 2271, 11287, 718, 11297, 29876, 29915, 13, 1678, 10191, 353, 10191, 718, 525, 2683, 2683, 2683, 2683, 29905, 29876, 29915, 13, 1678, 736, 10191, 13, 13, 13, 1753, 5706, 29902, 893, 434, 16190, 29898, 1272, 1125, 13, 1678, 3158, 353, 848, 1839, 3318, 29918, 15697, 16215, 2467, 2033, 13, 1678, 565, 3158, 1275, 525, 3150, 2396, 13, 4706, 10191, 353, 525, 19740, 29900, 29913, 716, 26246, 363, 426, 29896, 29913, 17710, 29876, 12764, 13, 9651, 869, 4830, 29898, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 978, 2033, 511, 2791, 3204, 29918, 21587, 29898, 1272, 1839, 465, 4895, 29872, 16215, 978, 25901, 13, 1678, 25342, 3158, 1275, 525, 5358, 2396, 13, 4706, 10191, 353, 525, 19740, 29900, 29913, 26246, 5764, 491, 426, 29896, 29913, 17710, 29876, 12764, 13, 9651, 869, 4830, 29898, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 978, 2033, 511, 2791, 3204, 29918, 21587, 29898, 1272, 1839, 1792, 16215, 978, 25901, 13, 1678, 10191, 353, 10191, 718, 525, 19740, 29900, 29913, 29930, 4286, 4830, 29898, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 3257, 25901, 13, 1678, 10191, 353, 10191, 718, 525, 4149, 426, 29900, 29913, 363, 4340, 4902, 4286, 4830, 29898, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 2271, 25901, 13, 1678, 736, 10191, 13, 13, 13, 1753, 5706, 20001, 16190, 29898, 1272, 1125, 13, 1678, 302, 1853, 353, 848, 1839, 3318, 29918, 15697, 16215, 6812, 519, 29918, 1853, 2033, 13, 1678, 565, 302, 1853, 1275, 525, 1523, 2415, 2396, 13, 4706, 10191, 353, 525, 29930, 20001, 9063, 373, 426, 4836, 29913, 17710, 29876, 29912, 1092, 1012, 29876, 29912, 6812, 1012, 29876, 29912, 2271, 10162, 29905, 13, 4706, 869, 4830, 29898, 13, 9651, 2060, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 511, 13, 9651, 22157, 543, 2683, 2683, 2683, 2683, 613, 13, 9651, 4443, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 6812, 2033, 511, 13, 9651, 3142, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 2271, 11287, 13, 9651, 1723, 13, 1678, 25342, 302, 1853, 1275, 525, 15836, 479, 3089, 2396, 13, 4706, 10191, 353, 525, 29930, 20001, 10366, 2009, 373, 426, 4836, 29913, 29991, 29912, 29885, 29878, 29918, 333, 29913, 17710, 29876, 29912, 1092, 1012, 29876, 19740, 3257, 29913, 17710, 29876, 29912, 6812, 1012, 29876, 29912, 2271, 10162, 29905, 13, 4706, 869, 4830, 29898, 13, 9651, 2060, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 511, 13, 9651, 3142, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 2271, 2033, 511, 13, 9651, 286, 29878, 29918, 333, 29922, 1272, 1839, 14634, 29918, 3827, 16215, 333, 7464, 13, 9651, 22157, 543, 2683, 2683, 2683, 2683, 613, 13, 9651, 3611, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 14634, 29918, 3827, 16215, 3257, 2033, 511, 13, 9651, 4443, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 6812, 11287, 13, 9651, 1723, 13, 1678, 25342, 302, 1853, 1275, 525, 29902, 893, 434, 2396, 13, 4706, 10191, 353, 525, 29930, 20001, 2228, 373, 426, 4836, 29913, 26660, 15118, 29918, 333, 29913, 17710, 29876, 29912, 1092, 1012, 29876, 19740, 3257, 29913, 17710, 29876, 29912, 6812, 1012, 29876, 29912, 2271, 10162, 29905, 13, 4706, 869, 4830, 29898, 13, 9651, 2060, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 511, 13, 9651, 3142, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 2271, 2033, 511, 13, 9651, 2228, 29918, 333, 29922, 1272, 1839, 15118, 16215, 333, 7464, 13, 9651, 22157, 543, 2683, 2683, 2683, 2683, 613, 13, 9651, 3611, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 15118, 16215, 3257, 2033, 511, 13, 9651, 4443, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 6812, 11287, 13, 9651, 1723, 13, 1678, 25342, 302, 1853, 1275, 525, 29903, 1240, 7988, 2396, 13, 4706, 10191, 353, 525, 29930, 20001, 11534, 373, 426, 4836, 6822, 29912, 29879, 1240, 7988, 29918, 333, 29913, 17710, 29876, 29912, 1092, 1012, 29876, 19740, 3257, 29913, 17710, 29876, 29912, 6812, 1012, 29876, 29912, 2271, 10162, 29905, 13, 4706, 869, 4830, 29898, 13, 9651, 2060, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 511, 13, 9651, 3142, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 2271, 2033, 511, 13, 9651, 11534, 29918, 333, 29922, 1272, 1839, 29879, 1240, 7988, 16215, 333, 7464, 13, 9651, 22157, 543, 2683, 2683, 2683, 2683, 613, 13, 9651, 3611, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 29879, 1240, 7988, 16215, 3257, 2033, 511, 13, 9651, 4443, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 6812, 11287, 13, 9651, 1723, 13, 1678, 736, 10191, 13, 13, 13, 1753, 5706, 15836, 479, 3089, 16190, 29898, 1272, 1125, 13, 1678, 3158, 353, 848, 1839, 3318, 29918, 15697, 16215, 2467, 2033, 13, 1678, 565, 3158, 297, 6024, 3150, 742, 525, 5358, 2033, 29901, 13, 4706, 10191, 353, 376, 19740, 4836, 29918, 978, 29913, 426, 3859, 29913, 4702, 479, 10729, 17710, 29876, 3166, 334, 29912, 4993, 29913, 29930, 304, 334, 29912, 5182, 29913, 17710, 29876, 29905, 29876, 19740, 3257, 29913, 17710, 29876, 29912, 8216, 5038, 29905, 13, 4706, 869, 4830, 29898, 13, 9651, 2060, 29918, 978, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 16215, 978, 2033, 511, 13, 9651, 2106, 29922, 1272, 1839, 3318, 29918, 15697, 16215, 3859, 7464, 13, 9651, 3611, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 3257, 2033, 511, 13, 9651, 2752, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 4993, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 29974, 2396, 18717, 1272, 1839, 3318, 29918, 15697, 16215, 4993, 29918, 17519, 2033, 511, 13, 9651, 3646, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 5182, 16215, 2084, 29918, 2541, 29918, 22377, 2033, 29974, 2396, 18717, 1272, 1839, 3318, 29918, 15697, 16215, 5182, 29918, 17519, 2033, 511, 13, 9651, 6139, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 3318, 29918, 15697, 16215, 8216, 11287, 13, 9651, 1723, 13, 1678, 1683, 29901, 13, 4706, 10191, 353, 6213, 13, 1678, 736, 10191, 13, 13, 1753, 5706, 5653, 29875, 16190, 29898, 1272, 1125, 13, 1678, 736, 6213, 13, 13, 1753, 5706, 29925, 23828, 16190, 29898, 1272, 1125, 13, 1678, 736, 6213, 13, 13, 1753, 5706, 8893, 16190, 29898, 1272, 1125, 13, 1678, 736, 376, 19740, 4836, 29918, 978, 29913, 2048, 373, 426, 4282, 29918, 19190, 6177, 29912, 4282, 29918, 978, 29913, 426, 4282, 29918, 3859, 29913, 17710, 29876, 29912, 1092, 1012, 29876, 29912, 4906, 1012, 29876, 29912, 8921, 29918, 978, 29913, 29966, 29912, 8921, 29918, 5269, 29913, 11903, 29905, 13, 1678, 869, 4830, 29898, 13, 4706, 2060, 29918, 978, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4836, 29918, 978, 2033, 511, 13, 4706, 2048, 29918, 3859, 29922, 1272, 1839, 4282, 29918, 3859, 7464, 13, 4706, 2048, 29918, 19190, 29922, 1272, 1839, 4282, 29918, 19190, 7464, 13, 4706, 2048, 29918, 978, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 4282, 29918, 978, 2033, 511, 13, 4706, 22157, 543, 2683, 2683, 2683, 2683, 613, 13, 4706, 2643, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 15060, 16215, 4906, 13359, 29878, 17010, 25739, 13, 4706, 4148, 29918, 978, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 15060, 16215, 8921, 29918, 978, 2033, 511, 13, 4706, 4148, 29918, 5269, 29922, 3502, 3204, 29918, 21587, 29898, 1272, 1839, 15060, 16215, 8921, 29918, 5269, 11287, 13, 4706, 1723, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 2069, 29918, 2585, 580, 13, 1678, 623, 29889, 3389, 580, 13, 2 ]
test/test_rpq_manual.py
6851-2021/retroactive-priority-queue
0
198301
import unittest from retropq import RetroactivePriorityQueue class PriorityQueueManualTest(unittest.TestCase): def test_simple(self): queue = RetroactivePriorityQueue() self.assertEqual([], list(queue)) queue.add_insert(0, 5) self.assertEqual([5], list(queue)) queue.add_insert(10, 3) self.assertEqual([3, 5], list(queue)) queue.add_delete_min(5) self.assertEqual([3], list(queue)) queue.add_insert(2, 7) self.assertEqual([3, 7], list(queue)) queue.add_insert(3, 4) self.assertEqual([3, 5, 7], list(queue)) queue.add_delete_min(7) self.assertEqual([3, 7], list(queue)) # delete insert queue.remove(2) self.assertEqual([3], list(queue)) # delete delete queue.remove(5) self.assertEqual([3, 5], list(queue)) def test_get_min(self): queue = RetroactivePriorityQueue() self.assertEqual(None, queue.get_min()) queue.add_insert(2, 3) queue.add_insert(5, 8) self.assertEqual(3, queue.get_min()) queue.remove(2) self.assertEqual(8, queue.get_min())
[ 1, 1053, 443, 27958, 13, 3166, 3240, 1336, 29939, 1053, 4649, 307, 4925, 29925, 21766, 10620, 13, 13, 1990, 22096, 537, 10620, 2517, 950, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 12857, 29898, 1311, 1125, 13, 4706, 9521, 353, 4649, 307, 4925, 29925, 21766, 10620, 580, 13, 4706, 1583, 29889, 9294, 9843, 4197, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29900, 29892, 29871, 29945, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29945, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29896, 29900, 29892, 29871, 29941, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 29892, 29871, 29945, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 8143, 29918, 1195, 29898, 29945, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29906, 29892, 29871, 29955, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 29892, 29871, 29955, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29941, 29892, 29871, 29946, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 29892, 29871, 29945, 29892, 29871, 29955, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 9521, 29889, 1202, 29918, 8143, 29918, 1195, 29898, 29955, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 29892, 29871, 29955, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 396, 5217, 4635, 13, 4706, 9521, 29889, 5992, 29898, 29906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 1402, 1051, 29898, 9990, 876, 13, 13, 4706, 396, 5217, 5217, 13, 4706, 9521, 29889, 5992, 29898, 29945, 29897, 13, 4706, 1583, 29889, 9294, 9843, 4197, 29941, 29892, 29871, 29945, 1402, 1051, 29898, 9990, 876, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 1195, 29898, 1311, 1125, 13, 4706, 9521, 353, 4649, 307, 4925, 29925, 21766, 10620, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 8516, 29892, 9521, 29889, 657, 29918, 1195, 3101, 13, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29906, 29892, 29871, 29941, 29897, 13, 4706, 9521, 29889, 1202, 29918, 7851, 29898, 29945, 29892, 29871, 29947, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29941, 29892, 9521, 29889, 657, 29918, 1195, 3101, 13, 13, 4706, 9521, 29889, 5992, 29898, 29906, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29947, 29892, 9521, 29889, 657, 29918, 1195, 3101, 13, 2 ]
Jumping around and changing speed.py
Toulik1729231/Python3.7
0
143986
import turtle ninja = turtle.Turtle() ninja.speed(10) for i in range(180): ninja.forward(100) ninja.right(30) ninja.forward(20) ninja.left(60) ninja.forward(50) ninja.right(30) ninja.penup() ninja.setposition(0, 0) ninja.pendown() ninja.right(2) turtle.done()
[ 1, 1053, 260, 4227, 280, 6756, 13, 30004, 13, 29876, 262, 1764, 353, 260, 4227, 280, 29889, 29911, 4227, 280, 26471, 13, 30004, 13, 29876, 262, 1764, 29889, 19322, 29898, 29896, 29900, 8443, 13, 30004, 13, 1454, 474, 297, 3464, 29898, 29896, 29947, 29900, 1125, 30004, 13, 1678, 17081, 1764, 29889, 11333, 29898, 29896, 29900, 29900, 8443, 13, 1678, 17081, 1764, 29889, 1266, 29898, 29941, 29900, 8443, 13, 1678, 17081, 1764, 29889, 11333, 29898, 29906, 29900, 8443, 13, 1678, 17081, 1764, 29889, 1563, 29898, 29953, 29900, 8443, 13, 1678, 17081, 1764, 29889, 11333, 29898, 29945, 29900, 8443, 13, 1678, 17081, 1764, 29889, 1266, 29898, 29941, 29900, 8443, 13, 1678, 6756, 13, 1678, 17081, 1764, 29889, 2238, 786, 26471, 13, 1678, 17081, 1764, 29889, 842, 3283, 29898, 29900, 29892, 29871, 29900, 8443, 13, 1678, 17081, 1764, 29889, 14081, 776, 26471, 13, 1678, 6756, 13, 1678, 17081, 1764, 29889, 1266, 29898, 29906, 8443, 13, 1678, 6756, 13, 29873, 4227, 280, 29889, 15091, 26471, 13, 2 ]
tests/integration/hub_usage/dummyhub_slow/__init__.py
abreu4/jina
2
7781
import time from jina.executors.crafters import BaseCrafter from .helper import foo class DummyHubExecutorSlow(BaseCrafter): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) time.sleep(15) foo()
[ 1, 1053, 931, 13, 3166, 432, 1099, 29889, 4258, 29560, 29889, 26844, 906, 29879, 1053, 7399, 29907, 336, 906, 13, 13, 3166, 869, 20907, 1053, 7953, 13, 13, 13, 1990, 360, 11770, 16046, 13366, 29903, 677, 29898, 5160, 29907, 336, 906, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 931, 29889, 17059, 29898, 29896, 29945, 29897, 13, 4706, 7953, 580, 13, 2 ]
Auto2DSelect/train.py
MPI-Dortmund/sphire_classes_autoselect
3
1616723
<gh_stars>1-10 #! /usr/bin/env python """ Automatic 2D class selection tool. MIT License Copyright (c) 2019 <NAME> Institute of Molecular Physiology Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import multiprocessing import argparse import os import json os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" try: os.environ["CUDA_VISIBLE_DEVICES"] except KeyError: os.environ["CUDA_VISIBLE_DEVICES"] = "0" os.environ["HDF5_USE_FILE_LOCKING"] = "FALSE" ARGPARSER = argparse.ArgumentParser( description="Train auto 2D class selection", formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) ARGPARSER.add_argument("-c", "--config", required=True, help="Path to config file.") ARGPARSER.add_argument("--gpu", default=-1, type=int, help="GPU to run on.") def _main_(): args = ARGPARSER.parse_args() if args.gpu != -1: str_gpu = str(args.gpu) os.environ["CUDA_VISIBLE_DEVICES"] = str_gpu with open(args.config) as config_buffer: try: config = json.load(config_buffer) except json.JSONDecodeError: print( "Your configuration file seems to be corrupted. Please check if it is valid." ) input_size = config["model"]["input_size"] batch_size = config["train"]["batch_size"] good_path = config["train"]["good_path"] bad_path = config["train"]["bad_path"] pretrained_weights = config["train"]["pretrained_weights"] output_file = config["train"]["saved_weights_name"] nb_epoch = config["train"]["nb_epoch"] nb_epoch_early_stop = config["train"]["nb_early_stop"] learning_rate = config["train"]["learning_rate"] mask_radius=None if "mask_radius" in config["model"]: mask_radius = config["model"]["mask_radius"] valid_good_path = None valid_bad_path = None if ( "valid" in config and "good_path" in config["valid"] and "bad_path" in config["valid"] and config["valid"]["good_path"] and config["valid"]["bad_path"] ): valid_good_path = config["valid"]["good_path"] valid_bad_path = config["valid"]["bad_path"] if "train_valid_split" in config["train"]: train_valid_thresh = config["train"]["train_valid_split"] else: train_valid_thresh = 0.8 max_valid_img_per_file = -1 if "max_valid_img_per_file" in config["train"]: if config["train"]["max_valid_img_per_file"] is not None: max_valid_img_per_file = config["train"]["max_valid_img_per_file"] if input_size[0] % 32 > 0 or input_size[1] % 32 > 0: input_size[0] = int(input_size[0] / 32) * 32 input_size[1] = int(input_size[1] / 32) * 32 print("Input size has to be a multiple of 32. Changed it to:", input_size) from .auto_2d_select import Auto2DSelectNet if mask_radius is None: mask_radius = input_size[0] * 0.4 full_rotation_aug = mask_radius != -1 print("Mask radius is", mask_radius) auto2dnet = Auto2DSelectNet(batch_size, input_size, depth=1,mask_radius=mask_radius) auto2dnet.train( train_good_path=good_path, train_bad_path=bad_path, save_weights_name=output_file, pretrained_weights=pretrained_weights, nb_epoch=nb_epoch, nb_epoch_early=nb_epoch_early_stop, learning_rate=learning_rate, train_val_thresh=train_valid_thresh, max_valid_img_per_file=max_valid_img_per_file, valid_good_path=valid_good_path, valid_bad_path=valid_bad_path, full_rotation_aug=full_rotation_aug ) if __name__ == "__main__": multiprocessing.set_start_method("spawn") _main_()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 15945, 29908, 13, 28451, 2454, 29871, 29906, 29928, 770, 9262, 5780, 29889, 13, 13, 26349, 19245, 13, 13, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29929, 529, 5813, 29958, 8907, 310, 341, 1772, 16637, 11661, 29875, 3002, 13, 13, 27293, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 974, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 262, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 517, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 9708, 583, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 29888, 595, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 1576, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 9708, 583, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 13, 28350, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 376, 3289, 8519, 613, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29979, 8079, 13764, 29979, 476, 22255, 29892, 8528, 15094, 1799, 6323, 13, 29902, 3580, 5265, 3352, 29892, 2672, 6154, 15789, 4214, 350, 2692, 6058, 27848, 3352, 7495, 6093, 399, 1718, 29934, 13566, 29059, 8079, 341, 1001, 3210, 13566, 2882, 6227, 11937, 29892, 13, 29943, 1806, 8186, 1799, 15842, 319, 349, 8322, 2965, 13309, 1718, 349, 4574, 13152, 1660, 5300, 405, 1164, 1177, 15860, 1177, 1692, 13780, 29889, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 13, 20656, 29950, 24125, 6323, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 20700, 17705, 6181, 15842, 13764, 29979, 315, 4375, 7833, 29892, 21330, 1529, 1692, 29903, 6323, 438, 29911, 4448, 13, 5265, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 13764, 319, 9838, 8079, 8707, 29911, 4717, 1783, 29892, 323, 8476, 6323, 438, 29911, 4448, 22119, 1660, 29892, 9033, 3235, 4214, 3895, 29892, 13, 12015, 8079, 6323, 2672, 8707, 8186, 9838, 22659, 6093, 7791, 7818, 12982, 1525, 6323, 6093, 501, 1660, 6323, 438, 29911, 4448, 5012, 1964, 4214, 29903, 2672, 6093, 13, 6156, 7818, 12982, 1525, 29889, 13, 13, 15945, 29908, 13, 13, 5215, 6674, 307, 985, 292, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 4390, 13, 13, 13, 359, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 2287, 19059, 29918, 22364, 3108, 353, 376, 29925, 8426, 29918, 29933, 3308, 29918, 1367, 29908, 13, 2202, 29901, 13, 1678, 2897, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 3108, 13, 19499, 7670, 2392, 29901, 13, 1678, 2897, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 3108, 353, 376, 29900, 29908, 13, 359, 29889, 21813, 3366, 29950, 4037, 29945, 29918, 17171, 29918, 7724, 29918, 21339, 4214, 3108, 353, 376, 25717, 29908, 13, 13, 1718, 29954, 16320, 6304, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 1678, 6139, 543, 5323, 262, 4469, 29871, 29906, 29928, 770, 9262, 613, 13, 1678, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 15730, 24863, 29648, 18522, 29892, 13, 29897, 13, 13, 1718, 29954, 16320, 6304, 29889, 1202, 29918, 23516, 703, 29899, 29883, 613, 376, 489, 2917, 613, 3734, 29922, 5574, 29892, 1371, 543, 2605, 304, 2295, 934, 23157, 13, 13, 1718, 29954, 16320, 6304, 29889, 1202, 29918, 23516, 703, 489, 29887, 3746, 613, 2322, 10457, 29896, 29892, 1134, 29922, 524, 29892, 1371, 543, 29954, 7056, 304, 1065, 373, 23157, 13, 13, 13, 1753, 903, 3396, 29918, 7295, 13, 1678, 6389, 353, 9033, 29954, 16320, 6304, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 29887, 3746, 2804, 448, 29896, 29901, 13, 4706, 851, 29918, 29887, 3746, 353, 851, 29898, 5085, 29889, 29887, 3746, 29897, 13, 4706, 2897, 29889, 21813, 3366, 29907, 29965, 7698, 29918, 28607, 8979, 1307, 29918, 2287, 29963, 2965, 2890, 3108, 353, 851, 29918, 29887, 3746, 13, 13, 1678, 411, 1722, 29898, 5085, 29889, 2917, 29897, 408, 2295, 29918, 9040, 29901, 13, 4706, 1018, 29901, 13, 9651, 2295, 353, 4390, 29889, 1359, 29898, 2917, 29918, 9040, 29897, 13, 4706, 5174, 4390, 29889, 7249, 2772, 401, 2392, 29901, 13, 9651, 1596, 29898, 13, 18884, 376, 10858, 5285, 934, 2444, 304, 367, 1034, 14214, 29889, 3529, 1423, 565, 372, 338, 2854, 1213, 13, 9651, 1723, 13, 13, 1678, 1881, 29918, 2311, 353, 2295, 3366, 4299, 3108, 3366, 2080, 29918, 2311, 3108, 13, 1678, 9853, 29918, 2311, 353, 2295, 3366, 14968, 3108, 3366, 16175, 29918, 2311, 3108, 13, 1678, 1781, 29918, 2084, 353, 2295, 3366, 14968, 3108, 3366, 16773, 29918, 2084, 3108, 13, 1678, 4319, 29918, 2084, 353, 2295, 3366, 14968, 3108, 3366, 12313, 29918, 2084, 3108, 13, 1678, 758, 3018, 1312, 29918, 705, 5861, 353, 2295, 3366, 14968, 3108, 3366, 1457, 3018, 1312, 29918, 705, 5861, 3108, 13, 1678, 1962, 29918, 1445, 353, 2295, 3366, 14968, 3108, 3366, 17314, 29918, 705, 5861, 29918, 978, 3108, 13, 1678, 302, 29890, 29918, 1022, 2878, 353, 2295, 3366, 14968, 3108, 3366, 9877, 29918, 1022, 2878, 3108, 13, 1678, 302, 29890, 29918, 1022, 2878, 29918, 799, 368, 29918, 9847, 353, 2295, 3366, 14968, 3108, 3366, 9877, 29918, 799, 368, 29918, 9847, 3108, 13, 1678, 6509, 29918, 10492, 353, 2295, 3366, 14968, 3108, 3366, 21891, 29918, 10492, 3108, 13, 1678, 11105, 29918, 13471, 29922, 8516, 13, 1678, 565, 376, 13168, 29918, 13471, 29908, 297, 2295, 3366, 4299, 3108, 29901, 13, 4706, 11105, 29918, 13471, 353, 2295, 3366, 4299, 3108, 3366, 13168, 29918, 13471, 3108, 13, 13, 1678, 2854, 29918, 16773, 29918, 2084, 353, 6213, 13, 1678, 2854, 29918, 12313, 29918, 2084, 353, 6213, 13, 1678, 565, 313, 13, 4706, 376, 3084, 29908, 297, 2295, 13, 4706, 322, 376, 16773, 29918, 2084, 29908, 297, 2295, 3366, 3084, 3108, 13, 4706, 322, 376, 12313, 29918, 2084, 29908, 297, 2295, 3366, 3084, 3108, 13, 4706, 322, 2295, 3366, 3084, 3108, 3366, 16773, 29918, 2084, 3108, 13, 4706, 322, 2295, 3366, 3084, 3108, 3366, 12313, 29918, 2084, 3108, 13, 268, 1125, 13, 4706, 2854, 29918, 16773, 29918, 2084, 353, 2295, 3366, 3084, 3108, 3366, 16773, 29918, 2084, 3108, 13, 4706, 2854, 29918, 12313, 29918, 2084, 353, 2295, 3366, 3084, 3108, 3366, 12313, 29918, 2084, 3108, 13, 13, 1678, 565, 376, 14968, 29918, 3084, 29918, 5451, 29908, 297, 2295, 3366, 14968, 3108, 29901, 13, 4706, 7945, 29918, 3084, 29918, 386, 3781, 353, 2295, 3366, 14968, 3108, 3366, 14968, 29918, 3084, 29918, 5451, 3108, 13, 1678, 1683, 29901, 13, 4706, 7945, 29918, 3084, 29918, 386, 3781, 353, 29871, 29900, 29889, 29947, 13, 13, 1678, 4236, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 353, 448, 29896, 13, 1678, 565, 376, 3317, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 29908, 297, 2295, 3366, 14968, 3108, 29901, 13, 4706, 565, 2295, 3366, 14968, 3108, 3366, 3317, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 3108, 338, 451, 6213, 29901, 13, 9651, 4236, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 353, 2295, 3366, 14968, 3108, 3366, 3317, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 3108, 13, 13, 1678, 565, 1881, 29918, 2311, 29961, 29900, 29962, 1273, 29871, 29941, 29906, 1405, 29871, 29900, 470, 1881, 29918, 2311, 29961, 29896, 29962, 1273, 29871, 29941, 29906, 1405, 29871, 29900, 29901, 13, 4706, 1881, 29918, 2311, 29961, 29900, 29962, 353, 938, 29898, 2080, 29918, 2311, 29961, 29900, 29962, 847, 29871, 29941, 29906, 29897, 334, 29871, 29941, 29906, 13, 4706, 1881, 29918, 2311, 29961, 29896, 29962, 353, 938, 29898, 2080, 29918, 2311, 29961, 29896, 29962, 847, 29871, 29941, 29906, 29897, 334, 29871, 29941, 29906, 13, 4706, 1596, 703, 4290, 2159, 756, 304, 367, 263, 2999, 310, 29871, 29941, 29906, 29889, 678, 4618, 372, 304, 29901, 613, 1881, 29918, 2311, 29897, 13, 1678, 515, 869, 6921, 29918, 29906, 29881, 29918, 2622, 1053, 11133, 29906, 29928, 3549, 6779, 13, 1678, 565, 11105, 29918, 13471, 338, 6213, 29901, 13, 4706, 11105, 29918, 13471, 353, 1881, 29918, 2311, 29961, 29900, 29962, 334, 29871, 29900, 29889, 29946, 13, 13, 13, 13, 1678, 2989, 29918, 5450, 362, 29918, 2987, 353, 11105, 29918, 13471, 2804, 448, 29896, 13, 1678, 1596, 703, 19832, 11855, 338, 613, 11105, 29918, 13471, 29897, 13, 1678, 4469, 29906, 29881, 1212, 353, 11133, 29906, 29928, 3549, 6779, 29898, 16175, 29918, 2311, 29892, 1881, 29918, 2311, 29892, 10809, 29922, 29896, 29892, 13168, 29918, 13471, 29922, 13168, 29918, 13471, 29897, 13, 13, 1678, 4469, 29906, 29881, 1212, 29889, 14968, 29898, 13, 4706, 7945, 29918, 16773, 29918, 2084, 29922, 16773, 29918, 2084, 29892, 13, 4706, 7945, 29918, 12313, 29918, 2084, 29922, 12313, 29918, 2084, 29892, 13, 4706, 4078, 29918, 705, 5861, 29918, 978, 29922, 4905, 29918, 1445, 29892, 13, 4706, 758, 3018, 1312, 29918, 705, 5861, 29922, 1457, 3018, 1312, 29918, 705, 5861, 29892, 13, 4706, 302, 29890, 29918, 1022, 2878, 29922, 9877, 29918, 1022, 2878, 29892, 13, 4706, 302, 29890, 29918, 1022, 2878, 29918, 799, 368, 29922, 9877, 29918, 1022, 2878, 29918, 799, 368, 29918, 9847, 29892, 13, 4706, 6509, 29918, 10492, 29922, 21891, 29918, 10492, 29892, 13, 4706, 7945, 29918, 791, 29918, 386, 3781, 29922, 14968, 29918, 3084, 29918, 386, 3781, 29892, 13, 4706, 4236, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 29922, 3317, 29918, 3084, 29918, 2492, 29918, 546, 29918, 1445, 29892, 13, 4706, 2854, 29918, 16773, 29918, 2084, 29922, 3084, 29918, 16773, 29918, 2084, 29892, 13, 4706, 2854, 29918, 12313, 29918, 2084, 29922, 3084, 29918, 12313, 29918, 2084, 29892, 13, 4706, 2989, 29918, 5450, 362, 29918, 2987, 29922, 8159, 29918, 5450, 362, 29918, 2987, 13, 1678, 1723, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6674, 307, 985, 292, 29889, 842, 29918, 2962, 29918, 5696, 703, 1028, 18101, 1159, 13, 1678, 903, 3396, 29918, 580, 13, 2 ]
bloodhound_search/bhsearch/query_suggestion.py
HelionDevPlatform/bloodhound
0
89055
#!/usr/bin/env python # -*- coding: UTF-8 -*- # Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you 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 trac.core import Component, implements from bhsearch.api import IDocIndexPreprocessor, IndexFields class SuggestionFields(IndexFields): SUMMARY = 'summary' BASKET = 'query_suggestion_basket' class QuerySuggestionPreprocessor(Component): implements(IDocIndexPreprocessor) suggestion_fields = [ IndexFields.NAME, IndexFields.CONTENT, SuggestionFields.SUMMARY, ] # IDocIndexPreprocessor methods def pre_process(self, doc): basket = u' '.join(doc.get(field, '') for field in self.suggestion_fields) doc[SuggestionFields.BASKET] = basket
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 13, 13, 29937, 29871, 10413, 21144, 304, 278, 13380, 18540, 10606, 313, 3289, 29943, 29897, 1090, 697, 13, 29937, 29871, 470, 901, 17737, 3406, 19405, 8571, 4110, 29889, 29871, 2823, 278, 6058, 12107, 934, 13, 29937, 29871, 13235, 411, 445, 664, 363, 5684, 2472, 13, 29937, 29871, 11211, 3509, 1266, 27428, 29889, 29871, 450, 3339, 29943, 7794, 11259, 445, 934, 13, 29937, 29871, 304, 366, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 13, 29937, 29871, 376, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 13, 29937, 29871, 411, 278, 19245, 29889, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 259, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 29871, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 13, 29937, 29871, 7047, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 13, 29937, 29871, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 13, 29937, 29871, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 29871, 2823, 278, 19245, 363, 278, 13, 29937, 29871, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 29871, 1090, 278, 19245, 29889, 13, 13, 3166, 16703, 29889, 3221, 1053, 15924, 29892, 10703, 13, 3166, 289, 29882, 4478, 29889, 2754, 1053, 3553, 542, 3220, 6572, 26482, 29892, 11374, 14256, 13, 13, 13, 1990, 317, 12981, 602, 14256, 29898, 3220, 14256, 1125, 13, 1678, 22753, 1529, 13207, 353, 525, 7727, 29915, 13, 1678, 350, 3289, 29968, 2544, 353, 525, 1972, 29918, 29879, 12981, 602, 29918, 29890, 7896, 29915, 13, 13, 13, 1990, 13641, 29903, 12981, 602, 6572, 26482, 29898, 5308, 1125, 13, 1678, 10703, 29898, 1367, 542, 3220, 6572, 26482, 29897, 13, 13, 1678, 8998, 29918, 9621, 353, 518, 13, 4706, 11374, 14256, 29889, 5813, 29892, 13, 4706, 11374, 14256, 29889, 22412, 3919, 29892, 13, 4706, 317, 12981, 602, 14256, 29889, 25021, 1529, 13207, 29892, 13, 1678, 4514, 13, 13, 1678, 396, 3553, 542, 3220, 6572, 26482, 3519, 13, 1678, 822, 758, 29918, 5014, 29898, 1311, 29892, 1574, 1125, 13, 4706, 25972, 353, 318, 29915, 15300, 7122, 29898, 1514, 29889, 657, 29898, 2671, 29892, 27255, 13, 462, 965, 363, 1746, 297, 1583, 29889, 29879, 12981, 602, 29918, 9621, 29897, 13, 4706, 1574, 29961, 29903, 12981, 602, 14256, 29889, 29933, 3289, 29968, 2544, 29962, 353, 25972, 13, 2 ]
code/Experiments/neon-master/neon/data/datasets.py
matthijsvk/convNets
53
88335
<reponame>matthijsvk/convNets # ---------------------------------------------------------------------------- # Copyright 2014-2016 Nervana Systems Inc. # 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. # ---------------------------------------------------------------------------- """ Functions used to load commonly available datasets. """ from __future__ import division from future import standard_library standard_library.install_aliases() # triggers E402, hence noqa below from future.moves.urllib.request import Request, urlopen # noqa import logging # noqa import os # noqa import sys # noqa import zipfile # noqa from neon import NervanaObject, logger as neon_logger # noqa from neon.util.compat import PY3 # noqa logger = logging.getLogger(__name__) class Dataset(NervanaObject): """ Container class for stock datasets. Arguments: filename (str/list): name of the file to download url (str): url for dataset size (int/list): file size path (str): local path to place files subset_pct (float/int): percentage of data set to use for training """ def __init__(self, filename, url, size, path='.', subset_pct=100): # parameters to use in dataset config serialization super(Dataset, self).__init__(name=None) self.filename = filename self.url = url self.size = size self.path = path self.subset_pct = subset_pct self._data_dict = None if subset_pct != 100: # placeholder to use partial data set raise NotImplemented('subset percentage feature is not yet implemented') def serialize(self): """ Generates dictionary with the required parameters to describe this object """ return self.get_description() def load_zip(self, filename, size): """ Helper function for downloading test files Will download and unzip the file into the directory self.path Arguments: filename (str): name of file to download from self.url size (str): size of the file in bytes? Returns: str: Path to the downloaded dataset. """ workdir, filepath = self._valid_path_append(self.path, '', filename) if not os.path.exists(filepath): self.fetch_dataset(self.url, filename, filepath, size) if '.zip' in filepath: zip_ref = zipfile.ZipFile(filepath) zip_ref.extractall(workdir) zip_ref.close() filepath = filepath.split('.zip')[0] return filepath @staticmethod def _valid_path_append(path, *args): """ Helper to validate passed path directory and append any subsequent filename arguments. Arguments: path (str): Initial filesystem path. Should expand to a valid directory. *args (list, optional): Any filename or path suffices to append to path for returning. Returns: (list, str): path prepended list of files from args, or path alone if no args specified. Raises: ValueError: if path is not a valid directory on this filesystem. """ full_path = os.path.expanduser(path) res = [] if not os.path.exists(full_path): os.makedirs(full_path) if not os.path.isdir(full_path): raise ValueError("path: {0} is not a valid directory".format(path)) for suffix_path in args: res.append(os.path.join(full_path, suffix_path)) if len(res) == 0: return path elif len(res) == 1: return res[0] else: return res @staticmethod def fetch_dataset(url, sourcefile, destfile, totalsz): """ Download the file specified by the given URL. Args: url (str): Base URL of the file to be downloaded. sourcefile (str): Name of the source file. destfile (str): Path to the destination. totalsz (int): Size of the file to be downloaded. """ req = Request(os.path.join(url, sourcefile), headers={'User-Agent': 'neon'}) # backport https limitation and workaround per http://python-future.org/imports.html cloudfile = urlopen(req) neon_logger.display("Downloading file: {}".format(destfile)) blockchar = u'\u2588' # character to display in progress bar with open(destfile, 'wb') as f: data_read = 0 chunksz = 1024**2 while 1: data = cloudfile.read(chunksz) if not data: break data_read = min(totalsz, data_read + chunksz) progress_string = u'Download Progress |{:<50}| '.format( blockchar * int(float(data_read) / totalsz * 50)) sys.stdout.write('\r') if PY3: sys.stdout.write(progress_string) else: sys.stdout.write(progress_string.encode("utf-8")) sys.stdout.flush() f.write(data) neon_logger.display("Download Complete") def gen_iterators(self): """ Method that generates the data set iterators for the train, test and validation data sets. This method needs to set the instance data_set attribute to a dictionary of data iterators. Returns: dict: dictionary with the various data set iterators """ raise NotImplemented() @property def data_dict(self): if self._data_dict is None: self._data_dict = self.gen_iterators() return self._data_dict def get_iterator(self, setname): """ Helper method to get the data iterator for specified dataset Arguments: setname (str): which iterator to return (e.g. 'train', 'valid') """ assert setname in self.data_dict, 'no iterator for set %s' % setname return self.data_dict[setname] @property def train_iter(self): """ Helper method to return training set iterator """ return self.get_iterator('train') @property def valid_iter(self): """ Helper method to return validation set iterator """ return self.get_iterator('valid') @property def test_iter(self): """ Helper method to return test set iterator """ return self.get_iterator('test')
[ 1, 529, 276, 1112, 420, 29958, 2922, 386, 823, 4501, 29895, 29914, 20580, 29940, 1691, 13, 29937, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29946, 29899, 29906, 29900, 29896, 29953, 405, 6972, 1648, 23985, 9266, 29889, 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, 418, 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, 448, 2683, 2683, 2683, 2683, 1378, 5634, 13, 15945, 29908, 13, 6678, 29879, 1304, 304, 2254, 15574, 3625, 20035, 29889, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 13, 3166, 5434, 1053, 3918, 29918, 5258, 13, 15770, 29918, 5258, 29889, 6252, 29918, 2606, 2129, 580, 29871, 396, 23660, 382, 29946, 29900, 29906, 29892, 8151, 694, 25621, 2400, 13, 3166, 5434, 29889, 13529, 267, 29889, 2271, 1982, 29889, 3827, 1053, 10729, 29892, 5065, 417, 2238, 29871, 396, 694, 25621, 13, 13, 5215, 12183, 29871, 396, 694, 25621, 13, 5215, 2897, 29871, 396, 694, 25621, 13, 5215, 10876, 29871, 396, 694, 25621, 13, 5215, 14319, 1445, 29871, 396, 694, 25621, 13, 13, 3166, 452, 265, 1053, 405, 6972, 1648, 2061, 29892, 17927, 408, 452, 265, 29918, 21707, 29871, 396, 694, 25621, 13, 3166, 452, 265, 29889, 4422, 29889, 12667, 1053, 349, 29979, 29941, 29871, 396, 694, 25621, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 13373, 24541, 29898, 29940, 6972, 1648, 2061, 1125, 13, 1678, 9995, 13, 1678, 21679, 770, 363, 10961, 20035, 29889, 13, 13, 1678, 11842, 9331, 29901, 13, 4706, 10422, 313, 710, 29914, 1761, 1125, 1024, 310, 278, 934, 304, 5142, 13, 4706, 3142, 313, 710, 1125, 3142, 363, 8783, 13, 4706, 2159, 313, 524, 29914, 1761, 1125, 934, 2159, 13, 4706, 2224, 313, 710, 1125, 1887, 2224, 304, 2058, 2066, 13, 4706, 11306, 29918, 29886, 312, 313, 7411, 29914, 524, 1125, 19649, 310, 848, 731, 304, 671, 363, 6694, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10422, 29892, 3142, 29892, 2159, 29892, 2224, 2433, 29889, 742, 11306, 29918, 29886, 312, 29922, 29896, 29900, 29900, 1125, 13, 4706, 396, 4128, 304, 671, 297, 8783, 2295, 7797, 2133, 13, 4706, 2428, 29898, 16390, 24541, 29892, 1583, 467, 1649, 2344, 12035, 978, 29922, 8516, 29897, 13, 4706, 1583, 29889, 9507, 353, 10422, 13, 4706, 1583, 29889, 2271, 353, 3142, 13, 4706, 1583, 29889, 2311, 353, 2159, 13, 4706, 1583, 29889, 2084, 353, 2224, 13, 4706, 1583, 29889, 6484, 29918, 29886, 312, 353, 11306, 29918, 29886, 312, 13, 4706, 1583, 3032, 1272, 29918, 8977, 353, 6213, 13, 4706, 565, 11306, 29918, 29886, 312, 2804, 29871, 29896, 29900, 29900, 29901, 13, 9651, 396, 12983, 304, 671, 7687, 848, 731, 13, 9651, 12020, 2216, 1888, 2037, 287, 877, 6484, 19649, 4682, 338, 451, 3447, 8762, 1495, 13, 13, 1678, 822, 28755, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 3251, 1078, 8600, 411, 278, 3734, 4128, 304, 8453, 445, 1203, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 657, 29918, 8216, 580, 13, 13, 1678, 822, 2254, 29918, 7554, 29898, 1311, 29892, 10422, 29892, 2159, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 740, 363, 28536, 1243, 2066, 13, 4706, 2811, 5142, 322, 443, 7554, 278, 934, 964, 278, 3884, 1583, 29889, 2084, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 10422, 313, 710, 1125, 1024, 310, 934, 304, 5142, 515, 1583, 29889, 2271, 13, 9651, 2159, 313, 710, 1125, 2159, 310, 278, 934, 297, 6262, 29973, 13, 13, 4706, 16969, 29901, 13, 9651, 851, 29901, 10802, 304, 278, 16532, 8783, 29889, 13, 4706, 9995, 13, 4706, 664, 3972, 29892, 934, 2084, 353, 1583, 3032, 3084, 29918, 2084, 29918, 4397, 29898, 1311, 29889, 2084, 29892, 15516, 10422, 29897, 13, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1445, 2084, 1125, 13, 9651, 1583, 29889, 9155, 29918, 24713, 29898, 1311, 29889, 2271, 29892, 10422, 29892, 934, 2084, 29892, 2159, 29897, 13, 4706, 565, 15300, 7554, 29915, 297, 934, 2084, 29901, 13, 9651, 14319, 29918, 999, 353, 14319, 1445, 29889, 26264, 2283, 29898, 1445, 2084, 29897, 13, 9651, 14319, 29918, 999, 29889, 21111, 497, 29898, 1287, 3972, 29897, 13, 9651, 14319, 29918, 999, 29889, 5358, 580, 13, 9651, 934, 2084, 353, 934, 2084, 29889, 5451, 12839, 7554, 29861, 29900, 29962, 13, 4706, 736, 934, 2084, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 3084, 29918, 2084, 29918, 4397, 29898, 2084, 29892, 334, 5085, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 304, 12725, 4502, 2224, 3884, 322, 9773, 738, 15352, 13, 4706, 10422, 6273, 29889, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 2224, 313, 710, 1125, 17250, 22101, 2224, 29889, 29871, 10575, 7985, 304, 263, 2854, 13, 462, 4706, 3884, 29889, 13, 9651, 334, 5085, 313, 1761, 29892, 13136, 1125, 3139, 10422, 470, 2224, 9378, 1575, 304, 9773, 304, 2224, 13, 462, 462, 1678, 363, 7863, 29889, 13, 13, 9651, 16969, 29901, 13, 18884, 313, 1761, 29892, 851, 1125, 2224, 8273, 2760, 1051, 310, 2066, 515, 6389, 29892, 470, 2224, 7432, 565, 13, 462, 308, 694, 6389, 6790, 29889, 13, 13, 4706, 390, 1759, 267, 29901, 13, 9651, 7865, 2392, 29901, 565, 2224, 338, 451, 263, 2854, 3884, 373, 445, 22101, 29889, 13, 4706, 9995, 13, 4706, 2989, 29918, 2084, 353, 2897, 29889, 2084, 29889, 18837, 1792, 29898, 2084, 29897, 13, 4706, 620, 353, 5159, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 8159, 29918, 2084, 1125, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 8159, 29918, 2084, 29897, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 3972, 29898, 8159, 29918, 2084, 1125, 13, 9651, 12020, 7865, 2392, 703, 2084, 29901, 426, 29900, 29913, 338, 451, 263, 2854, 3884, 1642, 4830, 29898, 2084, 876, 13, 4706, 363, 25557, 29918, 2084, 297, 6389, 29901, 13, 9651, 620, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 29898, 8159, 29918, 2084, 29892, 25557, 29918, 2084, 876, 13, 4706, 565, 7431, 29898, 690, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 2224, 13, 4706, 25342, 7431, 29898, 690, 29897, 1275, 29871, 29896, 29901, 13, 9651, 736, 620, 29961, 29900, 29962, 13, 4706, 1683, 29901, 13, 9651, 736, 620, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6699, 29918, 24713, 29898, 2271, 29892, 2752, 1445, 29892, 2731, 1445, 29892, 2025, 1338, 29920, 1125, 13, 4706, 9995, 13, 4706, 25553, 278, 934, 6790, 491, 278, 2183, 3988, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 3142, 313, 710, 1125, 7399, 3988, 310, 278, 934, 304, 367, 16532, 29889, 13, 9651, 2752, 1445, 313, 710, 1125, 4408, 310, 278, 2752, 934, 29889, 13, 9651, 2731, 1445, 313, 710, 1125, 10802, 304, 278, 12551, 29889, 13, 9651, 2025, 1338, 29920, 313, 524, 1125, 21179, 310, 278, 934, 304, 367, 16532, 29889, 13, 4706, 9995, 13, 4706, 12428, 353, 10729, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2271, 29892, 2752, 1445, 511, 9066, 3790, 29915, 2659, 29899, 19661, 2396, 525, 484, 265, 29915, 1800, 13, 4706, 396, 1250, 637, 2045, 29485, 322, 14725, 639, 1732, 597, 4691, 29899, 29888, 9130, 29889, 990, 29914, 326, 4011, 29889, 1420, 13, 4706, 9570, 1445, 353, 5065, 417, 2238, 29898, 7971, 29897, 13, 4706, 452, 265, 29918, 21707, 29889, 4990, 703, 6767, 13234, 934, 29901, 6571, 1642, 4830, 29898, 7854, 1445, 876, 13, 4706, 2908, 3090, 353, 318, 12764, 29884, 29906, 29945, 29947, 29947, 29915, 29871, 396, 2931, 304, 2479, 297, 6728, 2594, 13, 4706, 411, 1722, 29898, 7854, 1445, 29892, 525, 29893, 29890, 1495, 408, 285, 29901, 13, 9651, 848, 29918, 949, 353, 29871, 29900, 13, 9651, 521, 18801, 29920, 353, 29871, 29896, 29900, 29906, 29946, 1068, 29906, 13, 9651, 1550, 29871, 29896, 29901, 13, 18884, 848, 353, 9570, 1445, 29889, 949, 29898, 305, 18801, 29920, 29897, 13, 18884, 565, 451, 848, 29901, 13, 462, 1678, 2867, 13, 18884, 848, 29918, 949, 353, 1375, 29898, 4260, 1338, 29920, 29892, 848, 29918, 949, 718, 521, 18801, 29920, 29897, 13, 18884, 6728, 29918, 1807, 353, 318, 29915, 22954, 20018, 891, 25641, 29966, 29945, 29900, 11079, 15300, 4830, 29898, 13, 462, 1678, 2908, 3090, 334, 938, 29898, 7411, 29898, 1272, 29918, 949, 29897, 847, 2025, 1338, 29920, 334, 29871, 29945, 29900, 876, 13, 18884, 10876, 29889, 25393, 29889, 3539, 28909, 29878, 1495, 13, 18884, 565, 349, 29979, 29941, 29901, 13, 462, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 18035, 29918, 1807, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 10876, 29889, 25393, 29889, 3539, 29898, 18035, 29918, 1807, 29889, 12508, 703, 9420, 29899, 29947, 5783, 13, 18884, 10876, 29889, 25393, 29889, 23126, 580, 13, 13, 18884, 285, 29889, 3539, 29898, 1272, 29897, 13, 9651, 452, 265, 29918, 21707, 29889, 4990, 703, 22954, 25034, 1159, 13, 13, 1678, 822, 2531, 29918, 1524, 4097, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 8108, 393, 16785, 278, 848, 731, 4256, 4097, 363, 278, 13, 4706, 7945, 29892, 1243, 322, 8845, 848, 6166, 29889, 29871, 910, 1158, 13, 4706, 4225, 304, 731, 278, 2777, 848, 29918, 842, 5352, 304, 263, 13, 4706, 8600, 310, 848, 4256, 4097, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 9657, 29901, 29871, 8600, 411, 278, 5164, 848, 731, 4256, 4097, 13, 4706, 9995, 13, 4706, 12020, 2216, 1888, 2037, 287, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 848, 29918, 8977, 29898, 1311, 1125, 13, 4706, 565, 1583, 3032, 1272, 29918, 8977, 338, 6213, 29901, 13, 9651, 1583, 3032, 1272, 29918, 8977, 353, 1583, 29889, 1885, 29918, 1524, 4097, 580, 13, 4706, 736, 1583, 3032, 1272, 29918, 8977, 13, 13, 1678, 822, 679, 29918, 17609, 29898, 1311, 29892, 731, 978, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 1158, 304, 679, 278, 848, 20380, 363, 6790, 8783, 13, 13, 4706, 11842, 9331, 29901, 13, 9651, 731, 978, 313, 710, 1125, 607, 20380, 304, 736, 313, 29872, 29889, 29887, 29889, 525, 14968, 742, 525, 3084, 1495, 13, 4706, 9995, 13, 4706, 4974, 731, 978, 297, 1583, 29889, 1272, 29918, 8977, 29892, 525, 1217, 20380, 363, 731, 1273, 29879, 29915, 1273, 731, 978, 13, 4706, 736, 1583, 29889, 1272, 29918, 8977, 29961, 842, 978, 29962, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7945, 29918, 1524, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 1158, 304, 736, 6694, 731, 20380, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 657, 29918, 17609, 877, 14968, 1495, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2854, 29918, 1524, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 1158, 304, 736, 8845, 731, 20380, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 657, 29918, 17609, 877, 3084, 1495, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1243, 29918, 1524, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 6162, 546, 1158, 304, 736, 1243, 731, 20380, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 657, 29918, 17609, 877, 1688, 1495, 13, 2 ]
anyway/parsers/cbs.py
edermon/anyway
0
18387
# -*- coding: utf-8 -*- import glob import os import json from collections import OrderedDict import itertools import re from datetime import datetime import six from six import iteritems from flask.ext.sqlalchemy import SQLAlchemy from sqlalchemy import or_ from .. import field_names, localization from ..models import AccidentMarker, Involved, Vehicle from .. import models from ..utilities import ItmToWGS84, init_flask, CsvReader, time_delta, decode_hebrew,ImporterUI,truncate_tables from functools import partial import logging failed_dirs = OrderedDict() CONTENT_ENCODING = 'cp1255' ACCIDENT_TYPE_REGEX = re.compile(r"Accidents Type (?P<type>\d)") ACCIDENTS = 'accidents' CITIES = 'cities' STREETS = 'streets' ROADS = "roads" URBAN_INTERSECTION = 'urban_intersection' NON_URBAN_INTERSECTION = 'non_urban_intersection' DICTIONARY = "dictionary" INVOLVED = "involved" VEHICLES = "vehicles" cbs_files = { ACCIDENTS: "AccData.csv", URBAN_INTERSECTION: "IntersectUrban.csv", NON_URBAN_INTERSECTION: "IntersectNonUrban.csv", STREETS: "DicStreets.csv", DICTIONARY: "Dictionary.csv", INVOLVED: "InvData.csv", VEHICLES: "VehData.csv" } coordinates_converter = ItmToWGS84() app = init_flask() db = SQLAlchemy(app) json_dumps = partial(json.dumps, encoding=models.db_encoding) if six.PY2 else json.dumps def get_street(settlement_sign, street_sign, streets): """ extracts the street name using the settlement id and street id """ if settlement_sign not in streets: # Changed to return blank string instead of None for correct presentation (Omer) return u"" street_name = [decode_hebrew(x[field_names.street_name]) for x in streets[settlement_sign] if x[field_names.street_sign] == street_sign] # there should be only one street name, or none if it wasn't found. return street_name[0] if len(street_name) == 1 else u"" def get_address(accident, streets): """ extracts the address of the main street. tries to build the full address: <street_name> <street_number>, <settlement>, but might return a partial one if unsuccessful. """ street = get_street(accident[field_names.settlement_sign], accident[field_names.street1], streets) if not street: return u"" # the home field is invalid if it's empty or if it contains 9999 home = accident[field_names.home] if accident[field_names.home] != 9999 else None settlement = localization.get_city_name(accident[field_names.settlement_sign]) if not home and not settlement: return street if not home and settlement: return u"{}, {}".format(street, settlement) if home and not settlement: return u"{} {}".format(street, home) return u"{} {}, {}".format(street, home, settlement) def get_streets(accident, streets): """ extracts the streets the accident occurred in. every accident has a main street and a secondary street. :return: a tuple containing both streets. """ main_street = get_address(accident, streets) secondary_street = get_street(accident[field_names.settlement_sign], accident[field_names.street2], streets) return main_street, secondary_street def get_junction(accident, roads): """ extracts the junction from an accident omerxx: added "km" parameter to the calculation to only show the right junction, every non-urban accident shows nearest junction with distance and direction :return: returns the junction or None if it wasn't found """ if accident["KM"] is not None and accident[field_names.non_urban_intersection] is None: min_dist = 100000 key = (), () junc_km = 0 for option in roads: if accident[field_names.road1] == option[0] and abs(accident["KM"]-option[2]) < min_dist: min_dist = abs(accident["KM"]-option[2]) key = accident[field_names.road1], option[1], option[2] junc_km = option[2] junction = roads.get(key, None) if junction: if accident["KM"] - junc_km > 0: direction = u"צפונית" if accident[field_names.road1] % 2 == 0 else u"מזרחית" else: direction = u"דרומית" if accident[field_names.road1] % 2 == 0 else u"מערבית" if abs(float(accident["KM"] - junc_km)/10) >= 1: string = str(abs(float(accident["KM"])-junc_km)/10) + u" ק״מ " + direction + u" ל" + \ decode_hebrew(junction) elif 0 < abs(float(accident["KM"] - junc_km)/10) < 1: string = str(int((abs(float(accident["KM"])-junc_km)/10)*1000)) + u" מטרים " + direction + u" ל" + \ decode_hebrew(junction) else: string = decode_hebrew(junction) return string else: return u"" elif accident[field_names.non_urban_intersection] is not None: key = accident[field_names.road1], accident[field_names.road2], accident["KM"] junction = roads.get(key, None) return decode_hebrew(junction) if junction else u"" else: return u"" def parse_date(accident): """ parses an accident's date """ year = accident[field_names.accident_year] month = accident[field_names.accident_month] day = accident[field_names.accident_day] ''' hours calculation explanation - The value of the hours is between 1 to 96. These values represent 15 minutes each that start at 00:00: 1 equals 00:00, 2 equals 00:15, 3 equals 00:30 and so on. ''' minutes = accident[field_names.accident_hour] * 15 - 15 hours = int(minutes // 60) minutes %= 60 accident_date = datetime(year, month, day, hours, minutes, 0) return accident_date def load_extra_data(accident, streets, roads): """ loads more data about the accident :return: a dictionary containing all the extra fields and their values :rtype: dict """ extra_fields = {} # if the accident occurred in an urban setting if bool(accident[field_names.urban_intersection]): main_street, secondary_street = get_streets(accident, streets) if main_street: extra_fields[field_names.street1] = main_street if secondary_street: extra_fields[field_names.street2] = secondary_street # if the accident occurred in a non urban setting (highway, etc') if bool(accident[field_names.non_urban_intersection]): junction = get_junction(accident, roads) if junction: extra_fields[field_names.junction_name] = junction # localize static accident values for field in localization.get_supported_tables(): # if we have a localized field for that particular field, save the field value # it will be fetched we deserialized if accident[field] and localization.get_field(field, accident[field]): extra_fields[field] = accident[field] return extra_fields def get_data_value(value): """ :returns: value for parameters which are not mandatory in an accident data OR -1 if the parameter value does not exist """ return int(value) if value else -1 def import_accidents(provider_code, accidents, streets, roads, **kwargs): logging.info("\tReading accident data from '%s'..." % os.path.basename(accidents.name())) markers = [] for accident in accidents: if field_names.x_coordinate not in accident or field_names.y_coordinate not in accident: raise ValueError("Missing x and y coordinates") if accident[field_names.x_coordinate] and accident[field_names.y_coordinate]: lng, lat = coordinates_converter.convert(accident[field_names.x_coordinate], accident[field_names.y_coordinate]) else: lng, lat = None, None # Must insert everything to avoid foreign key failure main_street, secondary_street = get_streets(accident, streets) assert(int(provider_code) == int(accident[field_names.file_type])) marker = { "id": int(accident[field_names.id]), "provider_code": int(provider_code), "title": "Accident", "description": json_dumps(load_extra_data(accident, streets, roads)), "address": get_address(accident, streets), "latitude": lat, "longitude": lng, "subtype": int(accident[field_names.accident_type]), "severity": int(accident[field_names.accident_severity]), "created": parse_date(accident), "locationAccuracy": int(accident[field_names.igun]), "roadType": int(accident[field_names.road_type]), "roadShape": int(accident[field_names.road_shape]), "dayType": int(accident[field_names.day_type]), "unit": int(accident[field_names.unit]), "mainStreet": main_street, "secondaryStreet": secondary_street, "junction": get_junction(accident, roads), "one_lane": get_data_value(accident[field_names.one_lane]), "multi_lane": get_data_value(accident[field_names.multi_lane]), "speed_limit": get_data_value(accident[field_names.speed_limit]), "intactness": get_data_value(accident[field_names.intactness]), "road_width": get_data_value(accident[field_names.road_width]), "road_sign": get_data_value(accident[field_names.road_sign]), "road_light": get_data_value(accident[field_names.road_light]), "road_control": get_data_value(accident[field_names.road_control]), "weather": get_data_value(accident[field_names.weather]), "road_surface": get_data_value(accident[field_names.road_surface]), "road_object": get_data_value(accident[field_names.road_object]), "object_distance": get_data_value(accident[field_names.object_distance]), "didnt_cross": get_data_value(accident[field_names.didnt_cross]), "cross_mode": get_data_value(accident[field_names.cross_mode]), "cross_location": get_data_value(accident[field_names.cross_location]), "cross_direction": get_data_value(accident[field_names.cross_direction]), "road1": get_data_value(accident[field_names.road1]), "road2": get_data_value(accident[field_names.road2]), "km": float(accident[field_names.km]) if accident[field_names.km] else None, "yishuv_symbol": get_data_value(accident[field_names.yishuv_symbol]), "geo_area": get_data_value(accident[field_names.geo_area]), "day_night": get_data_value(accident[field_names.day_night]), "day_in_week": get_data_value(accident[field_names.day_in_week]), "traffic_light": get_data_value(accident[field_names.traffic_light]), "region": get_data_value(accident[field_names.region]), "district": get_data_value(accident[field_names.district]), "natural_area": get_data_value(accident[field_names.natural_area]), "minizipali_status": get_data_value(accident[field_names.minizipali_status]), "yishuv_shape": get_data_value(accident[field_names.yishuv_shape]), } markers.append(marker) return markers def import_involved(provider_code, involved, **kwargs): logging.info("\tReading involved data from '%s'..." % os.path.basename(involved.name())) involved_result = [] for involve in involved: if not involve[field_names.id]: # skip lines with no accident id continue involved_result.append({ "accident_id": int(involve[field_names.id]), "provider_code": int(provider_code), "involved_type": int(involve[field_names.involved_type]), "license_acquiring_date": int(involve[field_names.license_acquiring_date]), "age_group": int(involve[field_names.age_group]), "sex": get_data_value(involve[field_names.sex]), "car_type": get_data_value(involve[field_names.car_type]), "safety_measures": get_data_value(involve[field_names.safety_measures]), "home_city": get_data_value(involve[field_names.home_city]), "injury_severity": get_data_value(involve[field_names.injury_severity]), "injured_type": get_data_value(involve[field_names.injured_type]), "Injured_position": get_data_value(involve[field_names.injured_position]), "population_type": get_data_value(involve[field_names.population_type]), "home_district": get_data_value(involve[field_names.home_district]), "home_nafa": get_data_value(involve[field_names.home_nafa]), "home_area": get_data_value(involve[field_names.home_area]), "home_municipal_status": get_data_value(involve[field_names.home_municipal_status]), "home_residence_type": get_data_value(involve[field_names.home_residence_type]), "hospital_time": get_data_value(involve[field_names.hospital_time]), "medical_type": get_data_value(involve[field_names.medical_type]), "release_dest": get_data_value(involve[field_names.release_dest]), "safety_measures_use": get_data_value(involve[field_names.safety_measures_use]), "late_deceased": get_data_value(involve[field_names.late_deceased]), }) return involved_result def import_vehicles(provider_code, vehicles, **kwargs): logging.info("\tReading vehicles data from '%s'..." % os.path.basename(vehicles.name())) vehicles_result = [] for vehicle in vehicles: vehicles_result.append({ "accident_id": int(vehicle[field_names.id]), "provider_code": int(provider_code), "engine_volume": int(vehicle[field_names.engine_volume]), "manufacturing_year": get_data_value(vehicle[field_names.manufacturing_year]), "driving_directions": get_data_value(vehicle[field_names.driving_directions]), "vehicle_status": get_data_value(vehicle[field_names.vehicle_status]), "vehicle_attribution": get_data_value(vehicle[field_names.vehicle_attribution]), "vehicle_type": get_data_value(vehicle[field_names.vehicle_type]), "seats": get_data_value(vehicle[field_names.seats]), "total_weight": get_data_value(vehicle[field_names.total_weight]), }) return vehicles_result def get_files(directory): for name, filename in iteritems(cbs_files): if name not in (STREETS, NON_URBAN_INTERSECTION, ACCIDENTS, INVOLVED, VEHICLES): continue files = [path for path in os.listdir(directory) if filename.lower() in path.lower()] amount = len(files) if amount == 0: raise ValueError("Not found: '%s'" % filename) if amount > 1: raise ValueError("Ambiguous: '%s'" % filename) csv = CsvReader(os.path.join(directory, files[0]), encoding="cp1255") if name == STREETS: streets_map = {} for settlement in itertools.groupby(csv, lambda street: street.get(field_names.settlement, "OTHER")): key, val = tuple(settlement) streets_map[key] = [{field_names.street_sign: x[field_names.street_sign], field_names.street_name: x[field_names.street_name]} for x in val if field_names.street_name in x and field_names.street_sign in x] csv.close() yield name, streets_map elif name == NON_URBAN_INTERSECTION: roads = {(x[field_names.road1], x[field_names.road2], x["KM"]): x[field_names.junction_name] for x in csv if field_names.road1 in x and field_names.road2 in x} csv.close() yield ROADS, roads elif name in (ACCIDENTS, INVOLVED, VEHICLES): yield name, csv def chunks(l, n, xrange): """Yield successive n-sized chunks from l.""" for i in xrange(0, len(l), n): yield l[i:i + n] def import_to_datastore(directory, provider_code, batch_size): """ goes through all the files in a given directory, parses and commits them """ try: xrange except NameError: xrange = range try: assert batch_size > 0 files_from_cbs = dict(get_files(directory)) if len(files_from_cbs) == 0: return 0 logging.info("Importing '{}'".format(directory)) started = datetime.now() new_items = 0 all_existing_accidents_ids = set(map(lambda x: x[0], db.session.query(AccidentMarker.id).all())) accidents = import_accidents(provider_code=provider_code, **files_from_cbs) accidents = [accident for accident in accidents if accident['id'] not in all_existing_accidents_ids] new_items += len(accidents) for accidents_chunk in chunks(accidents, batch_size, xrange): db.session.bulk_insert_mappings(AccidentMarker, accidents_chunk) all_involved_accident_ids = set(map(lambda x: x[0], db.session.query(Involved.accident_id).all())) involved = import_involved(provider_code=provider_code, **files_from_cbs) involved = [x for x in involved if x['accident_id'] not in all_involved_accident_ids] for involved_chunk in chunks(involved, batch_size, xrange): db.session.bulk_insert_mappings(Involved, involved_chunk) new_items += len(involved) all_vehicles_accident_ids = set(map(lambda x: x[0], db.session.query(Vehicle.accident_id).all())) vehicles = import_vehicles(provider_code=provider_code, **files_from_cbs) vehicles = [x for x in vehicles if x['accident_id'] not in all_vehicles_accident_ids] for vehicles_chunk in chunks(vehicles, batch_size, xrange): db.session.bulk_insert_mappings(Vehicle, vehicles_chunk) new_items += len(vehicles) logging.info("\t{0} items in {1}".format(new_items, time_delta(started))) return new_items except ValueError as e: failed_dirs[directory] = str(e) return 0 def delete_invalid_entries(): """ deletes all markers in the database with null latitude or longitude first deletes from tables Involved and Vehicle, then from table AccidentMarker """ marker_ids_to_delete = db.session.query(AccidentMarker.id).filter(or_((AccidentMarker.longitude == None), (AccidentMarker.latitude == None))).all() marker_ids_to_delete = [acc_id[0] for acc_id in marker_ids_to_delete] q = db.session.query(Involved).filter(Involved.accident_id.in_(marker_ids_to_delete)) if q.all(): print('deleting invalid entries from Involved') q.delete(synchronize_session='fetch') q = db.session.query(Vehicle).filter(Vehicle.accident_id.in_(marker_ids_to_delete)) if q.all(): print('deleting invalid entries from Vehicle') q.delete(synchronize_session='fetch') q = db.session.query(AccidentMarker).filter(AccidentMarker.id.in_(marker_ids_to_delete)) if q.all(): print('deleting invalid entries from AccidentMarker') q.delete(synchronize_session='fetch') db.session.commit() def get_provider_code(directory_name=None): if directory_name: match = ACCIDENT_TYPE_REGEX.match(directory_name) if match: return int(match.groupdict()['type']) ans = "" while not ans.isdigit(): ans = six.moves.input("Directory provider code is invalid. Please enter a valid code: ") if ans.isdigit(): return int(ans) def main(specific_folder, delete_all, path, batch_size): import_ui = ImporterUI(path, specific_folder, delete_all) dir_name = import_ui.source_path() if specific_folder: dir_list = [dir_name] else: dir_list = glob.glob("{0}/*/*".format(dir_name)) # wipe all the AccidentMarker and Vehicle and Involved data first if import_ui.is_delete_all(): truncate_tables(db, (Vehicle, Involved, AccidentMarker)) started = datetime.now() total = 0 for directory in dir_list: parent_directory = os.path.basename(os.path.dirname(os.path.join(os.pardir, directory))) provider_code = get_provider_code(parent_directory) total += import_to_datastore(directory, provider_code, batch_size) delete_invalid_entries() failed = ["\t'{0}' ({1})".format(directory, fail_reason) for directory, fail_reason in iteritems(failed_dirs)] logging.info("Finished processing all directories{0}{1}".format(", except:\n" if failed else "", "\n".join(failed))) logging.info("Total: {0} items in {1}".format(total, time_delta(started)))
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 13149, 13, 5215, 2897, 13, 5215, 4390, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 5215, 4256, 8504, 13, 5215, 337, 13, 3166, 12865, 1053, 12865, 13, 5215, 4832, 13, 3166, 4832, 1053, 4256, 7076, 13, 13, 3166, 29784, 29889, 1062, 29889, 2850, 284, 305, 6764, 1053, 3758, 2499, 305, 6764, 13, 3166, 4576, 284, 305, 6764, 1053, 470, 29918, 13, 13, 3166, 6317, 1053, 1746, 29918, 7039, 29892, 1887, 2133, 13, 3166, 6317, 9794, 1053, 4831, 1693, 24619, 29892, 512, 1555, 1490, 29892, 8980, 29882, 2512, 13, 3166, 6317, 1053, 4733, 13, 3166, 6317, 4422, 1907, 1053, 739, 29885, 1762, 29956, 10749, 29947, 29946, 29892, 2069, 29918, 1579, 1278, 29892, 315, 4501, 6982, 29892, 931, 29918, 4181, 29892, 21822, 29918, 354, 1030, 29893, 29892, 24192, 9555, 3120, 29892, 509, 4661, 403, 29918, 24051, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 5215, 12183, 13, 13, 26061, 29918, 3972, 29879, 353, 8170, 287, 21533, 580, 13, 13, 22412, 3919, 29918, 1430, 3217, 29928, 4214, 353, 525, 6814, 29896, 29906, 29945, 29945, 29915, 13, 2477, 29907, 1367, 3919, 29918, 11116, 29918, 1525, 1692, 29990, 353, 337, 29889, 12198, 29898, 29878, 29908, 7504, 16719, 5167, 22308, 29925, 29966, 1853, 14247, 29881, 25760, 13, 13, 2477, 29907, 1367, 3919, 29903, 353, 525, 5753, 16719, 29915, 13, 29907, 1806, 29059, 353, 525, 29883, 1907, 29915, 13, 1254, 1525, 2544, 29903, 353, 525, 13045, 1691, 29915, 13, 1672, 3035, 29903, 353, 376, 307, 7925, 29908, 13, 4574, 29933, 2190, 29918, 23845, 1660, 9838, 353, 525, 25006, 29918, 1639, 2042, 29915, 13, 29940, 1164, 29918, 4574, 29933, 2190, 29918, 23845, 1660, 9838, 353, 525, 5464, 29918, 25006, 29918, 1639, 2042, 29915, 13, 4571, 9838, 19926, 353, 376, 27126, 29908, 13, 1177, 29963, 5607, 29963, 3352, 353, 376, 262, 1555, 1490, 29908, 13, 12064, 29950, 2965, 17101, 353, 376, 345, 29882, 4027, 29908, 13, 13, 29883, 5824, 29918, 5325, 353, 426, 13, 1678, 319, 4174, 1367, 3919, 29903, 29901, 376, 7504, 1469, 29889, 7638, 613, 13, 1678, 501, 29934, 29933, 2190, 29918, 23845, 1660, 9838, 29901, 376, 4074, 8803, 29965, 29878, 2571, 29889, 7638, 613, 13, 1678, 405, 1164, 29918, 4574, 29933, 2190, 29918, 23845, 1660, 9838, 29901, 376, 4074, 8803, 12283, 29965, 29878, 2571, 29889, 7638, 613, 13, 1678, 6850, 1525, 2544, 29903, 29901, 376, 29928, 293, 855, 276, 1691, 29889, 7638, 613, 13, 1678, 22471, 9838, 19926, 29901, 376, 11513, 29889, 7638, 613, 13, 1678, 2672, 29963, 5607, 29963, 3352, 29901, 376, 12165, 1469, 29889, 7638, 613, 13, 1678, 478, 29923, 29950, 2965, 17101, 29901, 376, 29963, 14797, 1469, 29889, 7638, 29908, 13, 29913, 13, 13, 1111, 24266, 29918, 535, 13549, 353, 739, 29885, 1762, 29956, 10749, 29947, 29946, 580, 13, 932, 353, 2069, 29918, 1579, 1278, 580, 13, 2585, 353, 3758, 2499, 305, 6764, 29898, 932, 29897, 13, 13, 3126, 29918, 29881, 17204, 353, 7687, 29898, 3126, 29889, 29881, 17204, 29892, 8025, 29922, 9794, 29889, 2585, 29918, 22331, 29897, 565, 4832, 29889, 20055, 29906, 1683, 4390, 29889, 29881, 17204, 13, 13, 1753, 679, 29918, 29352, 29898, 9915, 944, 29918, 4530, 29892, 11952, 29918, 4530, 29892, 19756, 1125, 13, 1678, 9995, 13, 1678, 6597, 29879, 278, 11952, 1024, 773, 278, 16493, 1178, 322, 11952, 1178, 13, 1678, 9995, 13, 1678, 565, 16493, 29918, 4530, 451, 297, 19756, 29901, 13, 4706, 396, 678, 4618, 304, 736, 9654, 1347, 2012, 310, 6213, 363, 1959, 24329, 313, 29949, 1050, 29897, 13, 4706, 736, 318, 15945, 13, 1678, 11952, 29918, 978, 353, 518, 13808, 29918, 354, 1030, 29893, 29898, 29916, 29961, 2671, 29918, 7039, 29889, 29352, 29918, 978, 2314, 363, 921, 297, 19756, 29961, 9915, 944, 29918, 4530, 29962, 565, 13, 462, 259, 921, 29961, 2671, 29918, 7039, 29889, 29352, 29918, 4530, 29962, 1275, 11952, 29918, 4530, 29962, 13, 1678, 396, 727, 881, 367, 871, 697, 11952, 1024, 29892, 470, 5642, 565, 372, 9007, 29915, 29873, 1476, 29889, 13, 1678, 736, 11952, 29918, 978, 29961, 29900, 29962, 565, 7431, 29898, 29352, 29918, 978, 29897, 1275, 29871, 29896, 1683, 318, 15945, 13, 13, 13, 1753, 679, 29918, 7328, 29898, 5753, 1693, 29892, 19756, 1125, 13, 1678, 9995, 13, 1678, 6597, 29879, 278, 3211, 310, 278, 1667, 11952, 29889, 13, 1678, 14335, 304, 2048, 278, 2989, 3211, 29901, 529, 29352, 29918, 978, 29958, 529, 29352, 29918, 4537, 10202, 529, 9915, 944, 10202, 13, 1678, 541, 1795, 736, 263, 7687, 697, 565, 443, 8698, 1319, 29889, 13, 1678, 9995, 13, 1678, 11952, 353, 679, 29918, 29352, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9915, 944, 29918, 4530, 1402, 11423, 29961, 2671, 29918, 7039, 29889, 29352, 29896, 1402, 19756, 29897, 13, 1678, 565, 451, 11952, 29901, 13, 4706, 736, 318, 15945, 13, 13, 1678, 396, 278, 3271, 1746, 338, 8340, 565, 372, 29915, 29879, 4069, 470, 565, 372, 3743, 29871, 29929, 29929, 29929, 29929, 13, 1678, 3271, 353, 11423, 29961, 2671, 29918, 7039, 29889, 5184, 29962, 565, 11423, 29961, 2671, 29918, 7039, 29889, 5184, 29962, 2804, 29871, 29929, 29929, 29929, 29929, 1683, 6213, 13, 1678, 16493, 353, 1887, 2133, 29889, 657, 29918, 12690, 29918, 978, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9915, 944, 29918, 4530, 2314, 13, 13, 1678, 565, 451, 3271, 322, 451, 16493, 29901, 13, 4706, 736, 11952, 13, 1678, 565, 451, 3271, 322, 16493, 29901, 13, 4706, 736, 318, 29908, 29912, 1118, 6571, 1642, 4830, 29898, 29352, 29892, 16493, 29897, 13, 1678, 565, 3271, 322, 451, 16493, 29901, 13, 4706, 736, 318, 29908, 8875, 6571, 1642, 4830, 29898, 29352, 29892, 3271, 29897, 13, 13, 1678, 736, 318, 29908, 8875, 24335, 6571, 1642, 4830, 29898, 29352, 29892, 3271, 29892, 16493, 29897, 13, 13, 13, 1753, 679, 29918, 13045, 1691, 29898, 5753, 1693, 29892, 19756, 1125, 13, 1678, 9995, 13, 1678, 6597, 29879, 278, 19756, 278, 11423, 10761, 297, 29889, 13, 1678, 1432, 11423, 756, 263, 1667, 11952, 322, 263, 16723, 11952, 29889, 13, 1678, 584, 2457, 29901, 263, 18761, 6943, 1716, 19756, 29889, 13, 1678, 9995, 13, 1678, 1667, 29918, 29352, 353, 679, 29918, 7328, 29898, 5753, 1693, 29892, 19756, 29897, 13, 1678, 16723, 29918, 29352, 353, 679, 29918, 29352, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9915, 944, 29918, 4530, 1402, 11423, 29961, 2671, 29918, 7039, 29889, 29352, 29906, 1402, 19756, 29897, 13, 1678, 736, 1667, 29918, 29352, 29892, 16723, 29918, 29352, 13, 13, 13, 1753, 679, 29918, 29926, 651, 29898, 5753, 1693, 29892, 25320, 1125, 13, 1678, 9995, 13, 1678, 6597, 29879, 278, 432, 651, 515, 385, 11423, 13, 1678, 288, 1050, 4419, 29901, 2715, 376, 8848, 29908, 3443, 304, 278, 13944, 304, 871, 1510, 278, 1492, 432, 651, 29892, 13, 1678, 1432, 1661, 29899, 25006, 11423, 3697, 20471, 432, 651, 411, 5418, 322, 5305, 13, 1678, 584, 2457, 29901, 3639, 278, 432, 651, 470, 6213, 565, 372, 9007, 29915, 29873, 1476, 13, 1678, 9995, 13, 1678, 565, 11423, 3366, 29968, 29924, 3108, 338, 451, 6213, 322, 11423, 29961, 2671, 29918, 7039, 29889, 5464, 29918, 25006, 29918, 1639, 2042, 29962, 338, 6213, 29901, 13, 4706, 1375, 29918, 5721, 353, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 13, 4706, 1820, 353, 313, 511, 3861, 13, 4706, 432, 4661, 29918, 8848, 353, 29871, 29900, 13, 4706, 363, 2984, 297, 25320, 29901, 13, 9651, 565, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 29962, 1275, 2984, 29961, 29900, 29962, 322, 6425, 29898, 5753, 1693, 3366, 29968, 29924, 3108, 29899, 3385, 29961, 29906, 2314, 529, 1375, 29918, 5721, 29901, 13, 18884, 1375, 29918, 5721, 353, 6425, 29898, 5753, 1693, 3366, 29968, 29924, 3108, 29899, 3385, 29961, 29906, 2314, 13, 18884, 1820, 353, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 1402, 2984, 29961, 29896, 1402, 2984, 29961, 29906, 29962, 13, 18884, 432, 4661, 29918, 8848, 353, 2984, 29961, 29906, 29962, 13, 4706, 432, 651, 353, 25320, 29889, 657, 29898, 1989, 29892, 6213, 29897, 13, 4706, 565, 432, 651, 29901, 13, 9651, 565, 11423, 3366, 29968, 29924, 3108, 448, 432, 4661, 29918, 8848, 1405, 29871, 29900, 29901, 13, 18884, 5305, 353, 318, 29908, 30692, 30471, 30205, 30328, 30196, 30286, 29908, 565, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 29962, 1273, 29871, 29906, 1275, 29871, 29900, 1683, 318, 29908, 30285, 30776, 30236, 30428, 30196, 30286, 29908, 13, 9651, 1683, 29901, 13, 18884, 5305, 353, 318, 29908, 30336, 30236, 30205, 30285, 30196, 30286, 29908, 565, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 29962, 1273, 29871, 29906, 1275, 29871, 29900, 1683, 318, 29908, 30285, 30324, 30236, 30276, 30196, 30286, 29908, 13, 9651, 565, 6425, 29898, 7411, 29898, 5753, 1693, 3366, 29968, 29924, 3108, 448, 432, 4661, 29918, 8848, 6802, 29896, 29900, 29897, 6736, 29871, 29896, 29901, 13, 18884, 1347, 353, 851, 29898, 6897, 29898, 7411, 29898, 5753, 1693, 3366, 29968, 29924, 20068, 29899, 29926, 4661, 29918, 8848, 6802, 29896, 29900, 29897, 718, 318, 29908, 29871, 30433, 218, 183, 30285, 376, 718, 5305, 718, 318, 29908, 29871, 30249, 29908, 718, 320, 13, 462, 1678, 21822, 29918, 354, 1030, 29893, 29898, 29926, 651, 29897, 13, 9651, 25342, 29871, 29900, 529, 6425, 29898, 7411, 29898, 5753, 1693, 3366, 29968, 29924, 3108, 448, 432, 4661, 29918, 8848, 6802, 29896, 29900, 29897, 529, 29871, 29896, 29901, 13, 18884, 1347, 353, 851, 29898, 524, 3552, 6897, 29898, 7411, 29898, 5753, 1693, 3366, 29968, 29924, 20068, 29899, 29926, 4661, 29918, 8848, 6802, 29896, 29900, 11877, 29896, 29900, 29900, 29900, 876, 718, 318, 29908, 29871, 30285, 30639, 30236, 30196, 30404, 376, 718, 5305, 718, 318, 29908, 29871, 30249, 29908, 718, 320, 13, 462, 1678, 21822, 29918, 354, 1030, 29893, 29898, 29926, 651, 29897, 13, 9651, 1683, 29901, 13, 18884, 1347, 353, 21822, 29918, 354, 1030, 29893, 29898, 29926, 651, 29897, 13, 9651, 736, 1347, 13, 4706, 1683, 29901, 13, 9651, 736, 318, 15945, 13, 13, 1678, 25342, 11423, 29961, 2671, 29918, 7039, 29889, 5464, 29918, 25006, 29918, 1639, 2042, 29962, 338, 451, 6213, 29901, 13, 4706, 1820, 353, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 1402, 11423, 29961, 2671, 29918, 7039, 29889, 9972, 29906, 1402, 11423, 3366, 29968, 29924, 3108, 13, 4706, 432, 651, 353, 25320, 29889, 657, 29898, 1989, 29892, 6213, 29897, 13, 4706, 736, 21822, 29918, 354, 1030, 29893, 29898, 29926, 651, 29897, 565, 432, 651, 1683, 318, 15945, 13, 1678, 1683, 29901, 13, 4706, 736, 318, 15945, 13, 13, 13, 1753, 6088, 29918, 1256, 29898, 5753, 1693, 1125, 13, 1678, 9995, 13, 1678, 610, 29879, 267, 385, 11423, 29915, 29879, 2635, 13, 1678, 9995, 13, 1678, 1629, 353, 11423, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 6360, 29962, 13, 1678, 4098, 353, 11423, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 10874, 29962, 13, 1678, 2462, 353, 11423, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 3250, 29962, 13, 13, 1678, 14550, 13, 1678, 6199, 13944, 8252, 448, 450, 995, 310, 278, 6199, 338, 1546, 29871, 29896, 304, 29871, 29929, 29953, 29889, 13, 1678, 4525, 1819, 2755, 29871, 29896, 29945, 6233, 1269, 393, 1369, 472, 29871, 29900, 29900, 29901, 29900, 29900, 29901, 13, 268, 29896, 15743, 29871, 29900, 29900, 29901, 29900, 29900, 29892, 29871, 29906, 15743, 29871, 29900, 29900, 29901, 29896, 29945, 29892, 29871, 29941, 15743, 29871, 29900, 29900, 29901, 29941, 29900, 322, 577, 373, 29889, 13, 1678, 14550, 13, 1678, 6233, 353, 11423, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 18721, 29962, 334, 29871, 29896, 29945, 448, 29871, 29896, 29945, 13, 1678, 6199, 353, 938, 29898, 1195, 2667, 849, 29871, 29953, 29900, 29897, 13, 1678, 6233, 1273, 29922, 29871, 29953, 29900, 13, 1678, 11423, 29918, 1256, 353, 12865, 29898, 6360, 29892, 4098, 29892, 2462, 29892, 6199, 29892, 6233, 29892, 29871, 29900, 29897, 13, 1678, 736, 11423, 29918, 1256, 13, 13, 13, 1753, 2254, 29918, 17833, 29918, 1272, 29898, 5753, 1693, 29892, 19756, 29892, 25320, 1125, 13, 1678, 9995, 13, 1678, 15376, 901, 848, 1048, 278, 11423, 13, 1678, 584, 2457, 29901, 263, 8600, 6943, 599, 278, 4805, 4235, 322, 1009, 1819, 13, 1678, 584, 29878, 1853, 29901, 9657, 13, 1678, 9995, 13, 1678, 4805, 29918, 9621, 353, 6571, 13, 1678, 396, 565, 278, 11423, 10761, 297, 385, 17164, 4444, 13, 1678, 565, 6120, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 25006, 29918, 1639, 2042, 29962, 1125, 13, 4706, 1667, 29918, 29352, 29892, 16723, 29918, 29352, 353, 679, 29918, 13045, 1691, 29898, 5753, 1693, 29892, 19756, 29897, 13, 4706, 565, 1667, 29918, 29352, 29901, 13, 9651, 4805, 29918, 9621, 29961, 2671, 29918, 7039, 29889, 29352, 29896, 29962, 353, 1667, 29918, 29352, 13, 4706, 565, 16723, 29918, 29352, 29901, 13, 9651, 4805, 29918, 9621, 29961, 2671, 29918, 7039, 29889, 29352, 29906, 29962, 353, 16723, 29918, 29352, 13, 13, 1678, 396, 565, 278, 11423, 10761, 297, 263, 1661, 17164, 4444, 313, 9812, 1582, 29892, 2992, 1495, 13, 1678, 565, 6120, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 5464, 29918, 25006, 29918, 1639, 2042, 29962, 1125, 13, 4706, 432, 651, 353, 679, 29918, 29926, 651, 29898, 5753, 1693, 29892, 25320, 29897, 13, 4706, 565, 432, 651, 29901, 13, 9651, 4805, 29918, 9621, 29961, 2671, 29918, 7039, 29889, 29926, 651, 29918, 978, 29962, 353, 432, 651, 13, 13, 1678, 396, 1887, 675, 2294, 11423, 1819, 13, 1678, 363, 1746, 297, 1887, 2133, 29889, 657, 29918, 23765, 29918, 24051, 7295, 13, 4706, 396, 565, 591, 505, 263, 1887, 1891, 1746, 363, 393, 3153, 1746, 29892, 4078, 278, 1746, 995, 13, 4706, 396, 372, 674, 367, 6699, 287, 591, 16964, 616, 1891, 13, 4706, 565, 11423, 29961, 2671, 29962, 322, 1887, 2133, 29889, 657, 29918, 2671, 29898, 2671, 29892, 11423, 29961, 2671, 29962, 1125, 13, 9651, 4805, 29918, 9621, 29961, 2671, 29962, 353, 11423, 29961, 2671, 29962, 13, 13, 1678, 736, 4805, 29918, 9621, 13, 13, 13, 1753, 679, 29918, 1272, 29918, 1767, 29898, 1767, 1125, 13, 1678, 9995, 13, 1678, 584, 18280, 29901, 995, 363, 4128, 607, 526, 451, 9619, 7606, 297, 385, 11423, 848, 13, 1678, 6323, 448, 29896, 565, 278, 3443, 995, 947, 451, 1863, 13, 1678, 9995, 13, 1678, 736, 938, 29898, 1767, 29897, 565, 995, 1683, 448, 29896, 13, 13, 13, 1753, 1053, 29918, 5753, 16719, 29898, 18121, 29918, 401, 29892, 1035, 16719, 29892, 19756, 29892, 25320, 29892, 3579, 19290, 1125, 13, 1678, 12183, 29889, 3888, 14182, 29873, 6359, 292, 11423, 848, 515, 14210, 29879, 29915, 17794, 1273, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 5753, 16719, 29889, 978, 22130, 13, 1678, 29320, 353, 5159, 13, 1678, 363, 11423, 297, 1035, 16719, 29901, 13, 4706, 565, 1746, 29918, 7039, 29889, 29916, 29918, 29302, 451, 297, 11423, 470, 1746, 29918, 7039, 29889, 29891, 29918, 29302, 451, 297, 11423, 29901, 13, 9651, 12020, 7865, 2392, 703, 18552, 292, 921, 322, 343, 10350, 1159, 13, 4706, 565, 11423, 29961, 2671, 29918, 7039, 29889, 29916, 29918, 29302, 29962, 322, 11423, 29961, 2671, 29918, 7039, 29889, 29891, 29918, 29302, 5387, 13, 9651, 301, 865, 29892, 3405, 353, 10350, 29918, 535, 13549, 29889, 13441, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 29916, 29918, 29302, 1402, 13, 462, 462, 462, 268, 11423, 29961, 2671, 29918, 7039, 29889, 29891, 29918, 29302, 2314, 13, 4706, 1683, 29901, 13, 9651, 301, 865, 29892, 3405, 353, 6213, 29892, 6213, 259, 396, 19928, 4635, 4129, 304, 4772, 9117, 1820, 10672, 13, 4706, 1667, 29918, 29352, 29892, 16723, 29918, 29352, 353, 679, 29918, 13045, 1691, 29898, 5753, 1693, 29892, 19756, 29897, 13, 13, 4706, 4974, 29898, 524, 29898, 18121, 29918, 401, 29897, 1275, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 1445, 29918, 1853, 12622, 13, 13, 4706, 17456, 353, 426, 13, 9651, 376, 333, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 333, 11724, 13, 9651, 376, 18121, 29918, 401, 1115, 938, 29898, 18121, 29918, 401, 511, 13, 9651, 376, 3257, 1115, 376, 7504, 1693, 613, 13, 9651, 376, 8216, 1115, 4390, 29918, 29881, 17204, 29898, 1359, 29918, 17833, 29918, 1272, 29898, 5753, 1693, 29892, 19756, 29892, 25320, 8243, 13, 9651, 376, 7328, 1115, 679, 29918, 7328, 29898, 5753, 1693, 29892, 19756, 511, 13, 9651, 376, 5066, 4279, 1115, 3405, 29892, 13, 9651, 376, 5426, 4279, 1115, 301, 865, 29892, 13, 9651, 376, 1491, 1853, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 1853, 11724, 13, 9651, 376, 344, 369, 537, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 5753, 1693, 29918, 344, 369, 537, 11724, 13, 9651, 376, 11600, 1115, 6088, 29918, 1256, 29898, 5753, 1693, 511, 13, 9651, 376, 5479, 7504, 332, 4135, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 335, 348, 11724, 13, 9651, 376, 9972, 1542, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 1853, 11724, 13, 9651, 376, 9972, 24111, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 12181, 11724, 13, 9651, 376, 3250, 1542, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 3250, 29918, 1853, 11724, 13, 9651, 376, 5441, 1115, 938, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 5441, 11724, 13, 9651, 376, 3396, 855, 4521, 1115, 1667, 29918, 29352, 29892, 13, 9651, 376, 7496, 653, 855, 4521, 1115, 16723, 29918, 29352, 29892, 13, 9651, 376, 29926, 651, 1115, 679, 29918, 29926, 651, 29898, 5753, 1693, 29892, 25320, 511, 13, 9651, 376, 650, 29918, 25821, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 650, 29918, 25821, 11724, 13, 9651, 376, 9910, 29918, 25821, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9910, 29918, 25821, 11724, 13, 9651, 376, 19322, 29918, 13400, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 19322, 29918, 13400, 11724, 13, 9651, 376, 524, 627, 2264, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 524, 627, 2264, 11724, 13, 9651, 376, 9972, 29918, 2103, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 2103, 11724, 13, 9651, 376, 9972, 29918, 4530, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 4530, 11724, 13, 9651, 376, 9972, 29918, 4366, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 4366, 11724, 13, 9651, 376, 9972, 29918, 6451, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 6451, 11724, 13, 9651, 376, 705, 1624, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 705, 1624, 11724, 13, 9651, 376, 9972, 29918, 7610, 2161, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 7610, 2161, 11724, 13, 9651, 376, 9972, 29918, 3318, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29918, 3318, 11724, 13, 9651, 376, 3318, 29918, 19244, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 3318, 29918, 19244, 11724, 13, 9651, 376, 18361, 593, 29918, 19128, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 18361, 593, 29918, 19128, 11724, 13, 9651, 376, 19128, 29918, 8513, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 19128, 29918, 8513, 11724, 13, 9651, 376, 19128, 29918, 5479, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 19128, 29918, 5479, 11724, 13, 9651, 376, 19128, 29918, 20845, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 19128, 29918, 20845, 11724, 13, 9651, 376, 9972, 29896, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 11724, 13, 9651, 376, 9972, 29906, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 9972, 29906, 11724, 13, 9651, 376, 8848, 1115, 5785, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 8848, 2314, 565, 11423, 29961, 2671, 29918, 7039, 29889, 8848, 29962, 1683, 6213, 29892, 13, 9651, 376, 29891, 728, 4090, 29918, 18098, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 29891, 728, 4090, 29918, 18098, 11724, 13, 9651, 376, 24756, 29918, 6203, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 24756, 29918, 6203, 11724, 13, 9651, 376, 3250, 29918, 11147, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 3250, 29918, 11147, 11724, 13, 9651, 376, 3250, 29918, 262, 29918, 18448, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 3250, 29918, 262, 29918, 18448, 11724, 13, 9651, 376, 3018, 2416, 29918, 4366, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 3018, 2416, 29918, 4366, 11724, 13, 9651, 376, 12803, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 12803, 11724, 13, 9651, 376, 29881, 6801, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 29881, 6801, 11724, 13, 9651, 376, 25047, 29918, 6203, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 25047, 29918, 6203, 11724, 13, 9651, 376, 1195, 466, 666, 2606, 29918, 4882, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 1195, 466, 666, 2606, 29918, 4882, 11724, 13, 9651, 376, 29891, 728, 4090, 29918, 12181, 1115, 679, 29918, 1272, 29918, 1767, 29898, 5753, 1693, 29961, 2671, 29918, 7039, 29889, 29891, 728, 4090, 29918, 12181, 11724, 13, 4706, 500, 13, 13, 4706, 29320, 29889, 4397, 29898, 22976, 29897, 13, 13, 1678, 736, 29320, 13, 13, 13, 1753, 1053, 29918, 262, 1555, 1490, 29898, 18121, 29918, 401, 29892, 9701, 29892, 3579, 19290, 1125, 13, 1678, 12183, 29889, 3888, 14182, 29873, 6359, 292, 9701, 848, 515, 14210, 29879, 29915, 17794, 1273, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 262, 1555, 1490, 29889, 978, 22130, 13, 1678, 9701, 29918, 2914, 353, 5159, 13, 1678, 363, 25135, 297, 9701, 29901, 13, 4706, 565, 451, 25135, 29961, 2671, 29918, 7039, 29889, 333, 5387, 29871, 396, 14383, 3454, 411, 694, 11423, 1178, 13, 9651, 6773, 13, 4706, 9701, 29918, 2914, 29889, 4397, 3319, 13, 9651, 376, 5753, 1693, 29918, 333, 1115, 938, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 333, 11724, 13, 9651, 376, 18121, 29918, 401, 1115, 938, 29898, 18121, 29918, 401, 511, 13, 9651, 376, 262, 1555, 1490, 29918, 1853, 1115, 938, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 262, 1555, 1490, 29918, 1853, 11724, 13, 9651, 376, 506, 1947, 29918, 562, 339, 8491, 29918, 1256, 1115, 938, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 506, 1947, 29918, 562, 339, 8491, 29918, 1256, 11724, 13, 9651, 376, 482, 29918, 2972, 1115, 938, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 482, 29918, 2972, 11724, 13, 9651, 376, 14167, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 14167, 11724, 13, 9651, 376, 4287, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 4287, 29918, 1853, 11724, 13, 9651, 376, 29879, 2142, 3305, 29918, 1004, 25414, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 29879, 2142, 3305, 29918, 1004, 25414, 11724, 13, 9651, 376, 5184, 29918, 12690, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 12690, 11724, 13, 9651, 376, 262, 29926, 2857, 29918, 344, 369, 537, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 262, 29926, 2857, 29918, 344, 369, 537, 11724, 13, 9651, 376, 262, 29926, 2955, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 262, 29926, 2955, 29918, 1853, 11724, 13, 9651, 376, 797, 29926, 2955, 29918, 3283, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 262, 29926, 2955, 29918, 3283, 11724, 13, 9651, 376, 7323, 2785, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 7323, 2785, 29918, 1853, 11724, 13, 9651, 376, 5184, 29918, 29881, 6801, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 29881, 6801, 11724, 13, 9651, 376, 5184, 29918, 1056, 5444, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 1056, 5444, 11724, 13, 9651, 376, 5184, 29918, 6203, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 6203, 11724, 13, 9651, 376, 5184, 29918, 29885, 4376, 284, 29918, 4882, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 29885, 4376, 284, 29918, 4882, 11724, 13, 9651, 376, 5184, 29918, 690, 5084, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 5184, 29918, 690, 5084, 29918, 1853, 11724, 13, 9651, 376, 29882, 8189, 29918, 2230, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 29882, 8189, 29918, 2230, 11724, 13, 9651, 376, 2168, 936, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 2168, 936, 29918, 1853, 11724, 13, 9651, 376, 14096, 29918, 7854, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 14096, 29918, 7854, 11724, 13, 9651, 376, 29879, 2142, 3305, 29918, 1004, 25414, 29918, 1509, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 29879, 2142, 3305, 29918, 1004, 25414, 29918, 1509, 11724, 13, 9651, 376, 9632, 29918, 311, 346, 1463, 1115, 679, 29918, 1272, 29918, 1767, 29898, 262, 1555, 345, 29961, 2671, 29918, 7039, 29889, 9632, 29918, 311, 346, 1463, 11724, 13, 4706, 5615, 13, 1678, 736, 9701, 29918, 2914, 13, 13, 13, 1753, 1053, 29918, 345, 29882, 4027, 29898, 18121, 29918, 401, 29892, 24413, 29892, 3579, 19290, 1125, 13, 1678, 12183, 29889, 3888, 14182, 29873, 6359, 292, 24413, 848, 515, 14210, 29879, 29915, 17794, 1273, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 345, 29882, 4027, 29889, 978, 22130, 13, 1678, 24413, 29918, 2914, 353, 5159, 13, 1678, 363, 19716, 297, 24413, 29901, 13, 4706, 24413, 29918, 2914, 29889, 4397, 3319, 13, 9651, 376, 5753, 1693, 29918, 333, 1115, 938, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 333, 11724, 13, 9651, 376, 18121, 29918, 401, 1115, 938, 29898, 18121, 29918, 401, 511, 13, 9651, 376, 10599, 29918, 24623, 1115, 938, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 10599, 29918, 24623, 11724, 13, 9651, 376, 1171, 9765, 3864, 29918, 6360, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 1171, 9765, 3864, 29918, 6360, 11724, 13, 9651, 376, 29881, 1150, 292, 29918, 20146, 1953, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 29881, 1150, 292, 29918, 20146, 1953, 11724, 13, 9651, 376, 345, 29882, 2512, 29918, 4882, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 345, 29882, 2512, 29918, 4882, 11724, 13, 9651, 376, 345, 29882, 2512, 29918, 1131, 3224, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 345, 29882, 2512, 29918, 1131, 3224, 11724, 13, 9651, 376, 345, 29882, 2512, 29918, 1853, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 345, 29882, 2512, 29918, 1853, 11724, 13, 9651, 376, 344, 1446, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 344, 1446, 11724, 13, 9651, 376, 7827, 29918, 7915, 1115, 679, 29918, 1272, 29918, 1767, 29898, 345, 29882, 2512, 29961, 2671, 29918, 7039, 29889, 7827, 29918, 7915, 11724, 13, 4706, 5615, 13, 1678, 736, 24413, 29918, 2914, 13, 13, 13, 1753, 679, 29918, 5325, 29898, 12322, 1125, 13, 1678, 363, 1024, 29892, 10422, 297, 4256, 7076, 29898, 29883, 5824, 29918, 5325, 1125, 13, 13, 4706, 565, 1024, 451, 297, 313, 1254, 1525, 2544, 29903, 29892, 405, 1164, 29918, 4574, 29933, 2190, 29918, 23845, 1660, 9838, 29892, 319, 4174, 1367, 3919, 29903, 29892, 2672, 29963, 5607, 29963, 3352, 29892, 478, 29923, 29950, 2965, 17101, 1125, 13, 9651, 6773, 13, 13, 4706, 2066, 353, 518, 2084, 363, 2224, 297, 2897, 29889, 1761, 3972, 29898, 12322, 29897, 13, 462, 565, 10422, 29889, 13609, 580, 297, 2224, 29889, 13609, 580, 29962, 13, 4706, 5253, 353, 7431, 29898, 5325, 29897, 13, 4706, 565, 5253, 1275, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 3664, 1476, 29901, 14210, 29879, 11838, 1273, 10422, 29897, 13, 4706, 565, 5253, 1405, 29871, 29896, 29901, 13, 9651, 12020, 7865, 2392, 703, 6833, 3752, 17269, 29901, 14210, 29879, 11838, 1273, 10422, 29897, 13, 13, 4706, 11799, 353, 315, 4501, 6982, 29898, 359, 29889, 2084, 29889, 7122, 29898, 12322, 29892, 2066, 29961, 29900, 11724, 8025, 543, 6814, 29896, 29906, 29945, 29945, 1159, 13, 13, 4706, 565, 1024, 1275, 6850, 1525, 2544, 29903, 29901, 13, 9651, 19756, 29918, 1958, 353, 6571, 13, 9651, 363, 16493, 297, 4256, 8504, 29889, 27789, 29898, 7638, 29892, 14013, 11952, 29901, 11952, 29889, 657, 29898, 2671, 29918, 7039, 29889, 9915, 944, 29892, 376, 2891, 4448, 5783, 29901, 13, 18884, 1820, 29892, 659, 353, 18761, 29898, 9915, 944, 29897, 13, 13, 18884, 19756, 29918, 1958, 29961, 1989, 29962, 353, 15974, 2671, 29918, 7039, 29889, 29352, 29918, 4530, 29901, 921, 29961, 2671, 29918, 7039, 29889, 29352, 29918, 4530, 1402, 13, 462, 462, 268, 1746, 29918, 7039, 29889, 29352, 29918, 978, 29901, 921, 29961, 2671, 29918, 7039, 29889, 29352, 29918, 978, 12258, 363, 921, 297, 659, 565, 13, 462, 462, 1678, 1746, 29918, 7039, 29889, 29352, 29918, 978, 297, 921, 322, 1746, 29918, 7039, 29889, 29352, 29918, 4530, 297, 921, 29962, 13, 9651, 11799, 29889, 5358, 580, 13, 9651, 7709, 1024, 29892, 19756, 29918, 1958, 13, 4706, 25342, 1024, 1275, 405, 1164, 29918, 4574, 29933, 2190, 29918, 23845, 1660, 9838, 29901, 13, 9651, 25320, 353, 426, 29898, 29916, 29961, 2671, 29918, 7039, 29889, 9972, 29896, 1402, 921, 29961, 2671, 29918, 7039, 29889, 9972, 29906, 1402, 921, 3366, 29968, 29924, 3108, 1125, 921, 29961, 2671, 29918, 7039, 29889, 29926, 651, 29918, 978, 29962, 363, 921, 297, 11799, 565, 13, 462, 268, 1746, 29918, 7039, 29889, 9972, 29896, 297, 921, 322, 1746, 29918, 7039, 29889, 9972, 29906, 297, 921, 29913, 13, 9651, 11799, 29889, 5358, 580, 13, 9651, 7709, 16641, 3035, 29903, 29892, 25320, 13, 4706, 25342, 1024, 297, 313, 2477, 29907, 1367, 3919, 29903, 29892, 2672, 29963, 5607, 29963, 3352, 29892, 478, 29923, 29950, 2965, 17101, 1125, 13, 9651, 7709, 1024, 29892, 11799, 13, 13, 1753, 521, 18801, 29898, 29880, 29892, 302, 29892, 921, 3881, 1125, 13, 1678, 9995, 29979, 969, 2551, 573, 302, 29899, 29879, 1891, 521, 18801, 515, 301, 1213, 15945, 13, 1678, 363, 474, 297, 921, 3881, 29898, 29900, 29892, 7431, 29898, 29880, 511, 302, 1125, 13, 4706, 7709, 301, 29961, 29875, 29901, 29875, 718, 302, 29962, 13, 13, 13, 1753, 1053, 29918, 517, 29918, 4130, 579, 487, 29898, 12322, 29892, 13113, 29918, 401, 29892, 9853, 29918, 2311, 1125, 13, 1678, 9995, 13, 1678, 5771, 1549, 599, 278, 2066, 297, 263, 2183, 3884, 29892, 610, 29879, 267, 322, 25741, 963, 13, 1678, 9995, 13, 1678, 1018, 29901, 921, 3881, 13, 1678, 5174, 4408, 2392, 29901, 13, 4706, 921, 3881, 353, 3464, 13, 1678, 1018, 29901, 13, 4706, 4974, 9853, 29918, 2311, 1405, 29871, 29900, 13, 13, 4706, 2066, 29918, 3166, 29918, 29883, 5824, 353, 9657, 29898, 657, 29918, 5325, 29898, 12322, 876, 13, 4706, 565, 7431, 29898, 5325, 29918, 3166, 29918, 29883, 5824, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 29871, 29900, 13, 4706, 12183, 29889, 3888, 703, 17518, 292, 525, 8875, 29915, 1642, 4830, 29898, 12322, 876, 13, 4706, 4687, 353, 12865, 29889, 3707, 580, 13, 13, 4706, 716, 29918, 7076, 353, 29871, 29900, 13, 13, 4706, 599, 29918, 735, 15423, 29918, 5753, 16719, 29918, 4841, 353, 731, 29898, 1958, 29898, 2892, 921, 29901, 921, 29961, 29900, 1402, 4833, 29889, 7924, 29889, 1972, 29898, 7504, 1693, 24619, 29889, 333, 467, 497, 22130, 13, 4706, 1035, 16719, 353, 1053, 29918, 5753, 16719, 29898, 18121, 29918, 401, 29922, 18121, 29918, 401, 29892, 3579, 5325, 29918, 3166, 29918, 29883, 5824, 29897, 13, 4706, 1035, 16719, 353, 518, 5753, 1693, 363, 11423, 297, 1035, 16719, 565, 11423, 1839, 333, 2033, 451, 297, 599, 29918, 735, 15423, 29918, 5753, 16719, 29918, 4841, 29962, 13, 4706, 716, 29918, 7076, 4619, 7431, 29898, 5753, 16719, 29897, 13, 4706, 363, 1035, 16719, 29918, 29812, 297, 521, 18801, 29898, 5753, 16719, 29892, 9853, 29918, 2311, 29892, 921, 3881, 1125, 13, 9651, 4833, 29889, 7924, 29889, 8645, 29895, 29918, 7851, 29918, 655, 27775, 29898, 7504, 1693, 24619, 29892, 1035, 16719, 29918, 29812, 29897, 13, 13, 4706, 599, 29918, 262, 1555, 1490, 29918, 5753, 1693, 29918, 4841, 353, 731, 29898, 1958, 29898, 2892, 921, 29901, 921, 29961, 29900, 1402, 4833, 29889, 7924, 29889, 1972, 29898, 797, 1555, 1490, 29889, 5753, 1693, 29918, 333, 467, 497, 22130, 13, 4706, 9701, 353, 1053, 29918, 262, 1555, 1490, 29898, 18121, 29918, 401, 29922, 18121, 29918, 401, 29892, 3579, 5325, 29918, 3166, 29918, 29883, 5824, 29897, 13, 4706, 9701, 353, 518, 29916, 363, 921, 297, 9701, 565, 921, 1839, 5753, 1693, 29918, 333, 2033, 451, 297, 599, 29918, 262, 1555, 1490, 29918, 5753, 1693, 29918, 4841, 29962, 13, 4706, 363, 9701, 29918, 29812, 297, 521, 18801, 29898, 262, 1555, 1490, 29892, 9853, 29918, 2311, 29892, 921, 3881, 1125, 13, 9651, 4833, 29889, 7924, 29889, 8645, 29895, 29918, 7851, 29918, 655, 27775, 29898, 797, 1555, 1490, 29892, 9701, 29918, 29812, 29897, 13, 4706, 716, 29918, 7076, 4619, 7431, 29898, 262, 1555, 1490, 29897, 13, 13, 4706, 599, 29918, 345, 29882, 4027, 29918, 5753, 1693, 29918, 4841, 353, 731, 29898, 1958, 29898, 2892, 921, 29901, 921, 29961, 29900, 1402, 4833, 29889, 7924, 29889, 1972, 29898, 29963, 14797, 2512, 29889, 5753, 1693, 29918, 333, 467, 497, 22130, 13, 4706, 24413, 353, 1053, 29918, 345, 29882, 4027, 29898, 18121, 29918, 401, 29922, 18121, 29918, 401, 29892, 3579, 5325, 29918, 3166, 29918, 29883, 5824, 29897, 13, 4706, 24413, 353, 518, 29916, 363, 921, 297, 24413, 565, 921, 1839, 5753, 1693, 29918, 333, 2033, 451, 297, 599, 29918, 345, 29882, 4027, 29918, 5753, 1693, 29918, 4841, 29962, 13, 4706, 363, 24413, 29918, 29812, 297, 521, 18801, 29898, 345, 29882, 4027, 29892, 9853, 29918, 2311, 29892, 921, 3881, 1125, 13, 9651, 4833, 29889, 7924, 29889, 8645, 29895, 29918, 7851, 29918, 655, 27775, 29898, 29963, 14797, 2512, 29892, 24413, 29918, 29812, 29897, 13, 4706, 716, 29918, 7076, 4619, 7431, 29898, 345, 29882, 4027, 29897, 13, 13, 4706, 12183, 29889, 3888, 14182, 29873, 29912, 29900, 29913, 4452, 297, 426, 29896, 29913, 1642, 4830, 29898, 1482, 29918, 7076, 29892, 931, 29918, 4181, 29898, 2962, 287, 4961, 13, 4706, 736, 716, 29918, 7076, 13, 1678, 5174, 7865, 2392, 408, 321, 29901, 13, 4706, 5229, 29918, 3972, 29879, 29961, 12322, 29962, 353, 851, 29898, 29872, 29897, 13, 4706, 736, 29871, 29900, 13, 13, 13, 1753, 5217, 29918, 20965, 29918, 26586, 7295, 13, 1678, 9995, 13, 1678, 7374, 267, 599, 29320, 297, 278, 2566, 411, 1870, 26271, 470, 28745, 13, 1678, 937, 7374, 267, 515, 6131, 512, 1555, 1490, 322, 8980, 29882, 2512, 29892, 769, 515, 1591, 4831, 1693, 24619, 13, 1678, 9995, 13, 13, 1678, 17456, 29918, 4841, 29918, 517, 29918, 8143, 353, 4833, 29889, 7924, 29889, 1972, 29898, 7504, 1693, 24619, 29889, 333, 467, 4572, 29898, 272, 29918, 3552, 7504, 1693, 24619, 29889, 5426, 4279, 1275, 6213, 511, 13, 462, 462, 462, 1678, 313, 7504, 1693, 24619, 29889, 5066, 4279, 29871, 1275, 6213, 876, 467, 497, 580, 13, 13, 1678, 17456, 29918, 4841, 29918, 517, 29918, 8143, 353, 518, 5753, 29918, 333, 29961, 29900, 29962, 363, 1035, 29918, 333, 297, 17456, 29918, 4841, 29918, 517, 29918, 8143, 29962, 13, 13, 1678, 3855, 353, 4833, 29889, 7924, 29889, 1972, 29898, 797, 1555, 1490, 467, 4572, 29898, 797, 1555, 1490, 29889, 5753, 1693, 29918, 333, 29889, 262, 23538, 22976, 29918, 4841, 29918, 517, 29918, 8143, 876, 13, 13, 1678, 565, 3855, 29889, 497, 7295, 13, 4706, 1596, 877, 311, 1026, 292, 8340, 9976, 515, 512, 1555, 1490, 1495, 13, 4706, 3855, 29889, 8143, 29898, 29879, 9524, 675, 29918, 7924, 2433, 9155, 1495, 13, 13, 1678, 3855, 353, 4833, 29889, 7924, 29889, 1972, 29898, 29963, 14797, 2512, 467, 4572, 29898, 29963, 14797, 2512, 29889, 5753, 1693, 29918, 333, 29889, 262, 23538, 22976, 29918, 4841, 29918, 517, 29918, 8143, 876, 13, 13, 1678, 565, 3855, 29889, 497, 7295, 13, 4706, 1596, 877, 311, 1026, 292, 8340, 9976, 515, 8980, 29882, 2512, 1495, 13, 4706, 3855, 29889, 8143, 29898, 29879, 9524, 675, 29918, 7924, 2433, 9155, 1495, 13, 13, 1678, 3855, 353, 4833, 29889, 7924, 29889, 1972, 29898, 7504, 1693, 24619, 467, 4572, 29898, 7504, 1693, 24619, 29889, 333, 29889, 262, 23538, 22976, 29918, 4841, 29918, 517, 29918, 8143, 876, 13, 13, 1678, 565, 3855, 29889, 497, 7295, 13, 4706, 1596, 877, 311, 1026, 292, 8340, 9976, 515, 4831, 1693, 24619, 1495, 13, 4706, 3855, 29889, 8143, 29898, 29879, 9524, 675, 29918, 7924, 2433, 9155, 1495, 13, 13, 1678, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 13, 1753, 679, 29918, 18121, 29918, 401, 29898, 12322, 29918, 978, 29922, 8516, 1125, 13, 1678, 565, 3884, 29918, 978, 29901, 13, 4706, 1993, 353, 319, 4174, 1367, 3919, 29918, 11116, 29918, 1525, 1692, 29990, 29889, 4352, 29898, 12322, 29918, 978, 29897, 13, 4706, 565, 1993, 29901, 13, 9651, 736, 938, 29898, 4352, 29889, 2972, 8977, 580, 1839, 1853, 11287, 13, 13, 1678, 6063, 353, 5124, 13, 1678, 1550, 451, 6063, 29889, 275, 26204, 7295, 13, 4706, 6063, 353, 4832, 29889, 13529, 267, 29889, 2080, 703, 9882, 13113, 775, 338, 8340, 29889, 3529, 3896, 263, 2854, 775, 29901, 16521, 13, 4706, 565, 6063, 29889, 275, 26204, 7295, 13, 9651, 736, 938, 29898, 550, 29897, 13, 13, 13, 1753, 1667, 29898, 14940, 29918, 12083, 29892, 5217, 29918, 497, 29892, 2224, 29892, 9853, 29918, 2311, 1125, 13, 1678, 1053, 29918, 1481, 353, 14305, 9555, 3120, 29898, 2084, 29892, 2702, 29918, 12083, 29892, 5217, 29918, 497, 29897, 13, 1678, 4516, 29918, 978, 353, 1053, 29918, 1481, 29889, 4993, 29918, 2084, 580, 13, 13, 1678, 565, 2702, 29918, 12083, 29901, 13, 4706, 4516, 29918, 1761, 353, 518, 3972, 29918, 978, 29962, 13, 1678, 1683, 29901, 13, 4706, 4516, 29918, 1761, 353, 13149, 29889, 23705, 703, 29912, 29900, 6822, 3877, 29930, 1642, 4830, 29898, 3972, 29918, 978, 876, 13, 13, 1678, 396, 281, 15705, 599, 278, 4831, 1693, 24619, 322, 8980, 29882, 2512, 322, 512, 1555, 1490, 848, 937, 13, 1678, 565, 1053, 29918, 1481, 29889, 275, 29918, 8143, 29918, 497, 7295, 13, 4706, 21022, 403, 29918, 24051, 29898, 2585, 29892, 313, 29963, 14797, 2512, 29892, 512, 1555, 1490, 29892, 4831, 1693, 24619, 876, 13, 13, 1678, 4687, 353, 12865, 29889, 3707, 580, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 363, 3884, 297, 4516, 29918, 1761, 29901, 13, 4706, 3847, 29918, 12322, 353, 2897, 29889, 2084, 29889, 6500, 3871, 29898, 359, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 29886, 538, 381, 29892, 3884, 4961, 13, 4706, 13113, 29918, 401, 353, 679, 29918, 18121, 29918, 401, 29898, 3560, 29918, 12322, 29897, 13, 4706, 3001, 4619, 1053, 29918, 517, 29918, 4130, 579, 487, 29898, 12322, 29892, 13113, 29918, 401, 29892, 9853, 29918, 2311, 29897, 13, 13, 1678, 5217, 29918, 20965, 29918, 26586, 580, 13, 13, 1678, 5229, 353, 6796, 29905, 29873, 29915, 29912, 29900, 10162, 21313, 29896, 1800, 1642, 4830, 29898, 12322, 29892, 4418, 29918, 23147, 29897, 363, 3884, 29892, 4418, 29918, 23147, 297, 13, 795, 4256, 7076, 29898, 26061, 29918, 3972, 29879, 4638, 13, 1678, 12183, 29889, 3888, 703, 12881, 3276, 9068, 599, 17525, 29912, 29900, 1157, 29896, 29913, 1642, 4830, 28165, 5174, 3583, 29876, 29908, 565, 5229, 1683, 12633, 13, 462, 462, 462, 462, 1678, 6634, 29876, 1642, 7122, 29898, 26061, 4961, 13, 1678, 12183, 29889, 3888, 703, 11536, 29901, 426, 29900, 29913, 4452, 297, 426, 29896, 29913, 1642, 4830, 29898, 7827, 29892, 931, 29918, 4181, 29898, 2962, 287, 4961, 13, 2 ]
http.py
Senarc-Studios/Semethon
2
54770
import requests import cool_utils from typing import Union cache = {} cool_utils.JSON.open("config") class HTTPClient: def __init__(self): self.username = None self.token = None self.BASE = cool_utils.JSON.get_data("server") @classmethod def create_request( self, type: str, route: str, payload: dict = None, args: dict = None ): if type == "GET": if route.startswith("/") == False: route = "/" + route arg = "" for key, value in args: if arg == "": arg = arg + key + "=" + value else: arg = arg + "&" + key + "=" + value response = requests.get(HTTPClient.BASE + route + "?" + arg, json=payload) return response elif type == "POST": if route.startswith("/") == False: route = "/" + route payload['username'] = self.username if self.token != None: payload['token'] = self.token response = requests.post(HTTPClient.BASE + route, json=payload) return response elif type == "DELETE": if route.startswith("/") == False: route = "/" + route payload['username'] = self.username if self.token != None: payload['token'] = self.token response = requests.delete(HTTPClient.BASE + route, json=payload) return response @classmethod def create_session(self, username): self.username = username token = HTTPClient.create_request("POST", "create-session").json()['token'] self.token = token return token @staticmethod def delete_session(): return HTTPClient.create_request("DELETE", "delete-session")
[ 1, 1053, 7274, 13, 5215, 12528, 29918, 13239, 13, 3166, 19229, 1053, 7761, 13, 13, 8173, 353, 6571, 13, 1111, 324, 29918, 13239, 29889, 7249, 29889, 3150, 703, 2917, 1159, 13, 13, 1990, 7331, 4032, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 6786, 353, 6213, 13, 4706, 1583, 29889, 6979, 353, 6213, 13, 4706, 1583, 29889, 25416, 353, 12528, 29918, 13239, 29889, 7249, 29889, 657, 29918, 1272, 703, 2974, 1159, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1653, 29918, 3827, 29898, 13, 4706, 1583, 29892, 13, 4706, 1134, 29901, 851, 29892, 13, 4706, 5782, 29901, 851, 29892, 13, 4706, 20092, 29901, 9657, 353, 6213, 29892, 13, 4706, 6389, 29901, 9657, 353, 6213, 13, 268, 1125, 13, 4706, 565, 1134, 1275, 376, 7194, 1115, 13, 9651, 565, 5782, 29889, 27382, 2541, 11974, 1159, 1275, 7700, 29901, 13, 18884, 5782, 353, 5591, 29908, 718, 5782, 13, 13, 9651, 1852, 353, 5124, 13, 13, 9651, 363, 1820, 29892, 995, 297, 6389, 29901, 13, 18884, 565, 1852, 1275, 376, 1115, 13, 462, 1678, 1852, 353, 1852, 718, 1820, 718, 376, 543, 718, 995, 13, 18884, 1683, 29901, 13, 462, 1678, 1852, 353, 1852, 718, 376, 29987, 29908, 718, 1820, 718, 376, 543, 718, 995, 13, 632, 13, 9651, 2933, 353, 7274, 29889, 657, 29898, 10493, 4032, 29889, 25416, 718, 5782, 718, 376, 3026, 718, 1852, 29892, 4390, 29922, 23813, 29897, 13, 632, 13, 9651, 736, 2933, 13, 13, 4706, 25342, 1134, 1275, 376, 5438, 1115, 13, 9651, 565, 5782, 29889, 27382, 2541, 11974, 1159, 1275, 7700, 29901, 13, 18884, 5782, 353, 5591, 29908, 718, 5782, 13, 13, 9651, 20092, 1839, 6786, 2033, 353, 1583, 29889, 6786, 13, 632, 13, 9651, 565, 1583, 29889, 6979, 2804, 6213, 29901, 13, 18884, 20092, 1839, 6979, 2033, 353, 1583, 29889, 6979, 13, 13, 9651, 2933, 353, 7274, 29889, 2490, 29898, 10493, 4032, 29889, 25416, 718, 5782, 29892, 4390, 29922, 23813, 29897, 13, 13, 9651, 736, 2933, 13, 13, 4706, 25342, 1134, 1275, 376, 2287, 18476, 1115, 13, 9651, 565, 5782, 29889, 27382, 2541, 11974, 1159, 1275, 7700, 29901, 13, 18884, 5782, 353, 5591, 29908, 718, 5782, 13, 13, 9651, 20092, 1839, 6786, 2033, 353, 1583, 29889, 6786, 13, 632, 13, 9651, 565, 1583, 29889, 6979, 2804, 6213, 29901, 13, 18884, 20092, 1839, 6979, 2033, 353, 1583, 29889, 6979, 13, 13, 9651, 2933, 353, 7274, 29889, 8143, 29898, 10493, 4032, 29889, 25416, 718, 5782, 29892, 4390, 29922, 23813, 29897, 13, 13, 9651, 736, 2933, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1653, 29918, 7924, 29898, 1311, 29892, 8952, 1125, 13, 4706, 1583, 29889, 6786, 353, 8952, 13, 4706, 5993, 353, 7331, 4032, 29889, 3258, 29918, 3827, 703, 5438, 613, 376, 3258, 29899, 7924, 2564, 3126, 580, 1839, 6979, 2033, 13, 4706, 1583, 29889, 6979, 353, 5993, 13, 4706, 736, 5993, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 5217, 29918, 7924, 7295, 13, 4706, 736, 7331, 4032, 29889, 3258, 29918, 3827, 703, 2287, 18476, 613, 376, 8143, 29899, 7924, 1159, 2 ]
src/opendr/control/mobile_manipulation/mobileRL/envs/eeplanner.py
makistsantekidis/opendr
3
38120
# Copyright 2020-2021 OpenDR European Project # # 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 os from pybindings import RobotObs, EEObs, LinearPlanner, GMMPlanner MIN_PLANNER_VELOCITY = 0.001 MAX_PLANNER_VELOCITY = 0.1 # also defined in robot_env.cpp! TIME_STEP_TRAIN = 0.1 class EEPlanner: def __init__(self, gripper_goal_tip, gripper_goal_wrist, head_start, map): self.gripper_goal_tip = gripper_goal_tip self.gripper_goal_wrist = gripper_goal_wrist self._head_start = head_start self._map = map def reset(self, robot_obs: RobotObs, slow_down_factor: float, is_analytic_env: bool, success_thres_dist: float, success_thres_rot: float) -> EEObs: raise NotImplementedError() def step(self, robot_obs: RobotObs, learned_vel_norm: float) -> EEObs: raise NotImplementedError() def generate_obs_step(self, robot_state: RobotObs) -> EEObs: raise NotImplementedError() class LinearPlannerWrapper(EEPlanner): def __init__(self, gripper_goal_tip, gripper_goal_wrist, head_start, map): super(LinearPlannerWrapper, self).__init__(gripper_goal_tip, gripper_goal_wrist, head_start, map) self._planner = None def reset(self, robot_obs: RobotObs, slow_down_factor: float, is_analytic_env: bool, success_thres_dist: float, success_thres_rot: float) -> EEObs: self._planner = LinearPlanner(self.gripper_goal_wrist, robot_obs.gripper_tf, [0, 0, 0, 0, 0, 0, 1], robot_obs.base_tf, success_thres_dist, success_thres_rot, MIN_PLANNER_VELOCITY, MAX_PLANNER_VELOCITY, slow_down_factor, self._head_start, TIME_STEP_TRAIN, is_analytic_env) return self.generate_obs_step(robot_obs) def step(self, robot_obs: RobotObs, learned_vel_norm: float) -> EEObs: return self._planner.step(robot_obs, learned_vel_norm) def generate_obs_step(self, robot_state: RobotObs) -> EEObs: return self._planner.generate_obs_step(robot_state) class GMMPlannerWrapper(EEPlanner): def __init__(self, gripper_goal_tip, gripper_goal_wrist, head_start, map, gmm_model_path: str, robot_config): super(GMMPlannerWrapper, self).__init__(gripper_goal_tip, gripper_goal_wrist, head_start, map) self._planner = None assert os.path.exists(gmm_model_path), f"Path {gmm_model_path} doesn't exist" self._gmm_model_path = gmm_model_path self._robot_config = robot_config def reset(self, robot_obs: RobotObs, slow_down_factor: float, is_analytic_env: bool, success_thres_dist, success_thres_rot) -> EEObs: # NOTE: planners either take in the goal for the tip or the wrist, but always output plans for the wrist! self._planner = GMMPlanner(self.gripper_goal_wrist, robot_obs.gripper_tf, [0, 0, 0, 0, 0, 0, 1], robot_obs.base_tf, success_thres_dist, success_thres_rot, MIN_PLANNER_VELOCITY, MAX_PLANNER_VELOCITY, slow_down_factor, self._head_start, TIME_STEP_TRAIN, is_analytic_env, self._robot_config["tip_to_gripper_offset"], self._robot_config["gripper_to_base_rot_offset"], str(self._gmm_model_path), self._robot_config["gmm_base_offset"]) return self.generate_obs_step(robot_obs) def step(self, robot_obs: RobotObs, learned_vel_norm: float) -> EEObs: return self._planner.step(robot_obs, learned_vel_norm) def generate_obs_step(self, robot_state: RobotObs) -> EEObs: return self._planner.generate_obs_step(robot_state)
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 29899, 29906, 29900, 29906, 29896, 4673, 8353, 7824, 8010, 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, 268, 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, 2897, 13, 13, 3166, 11451, 5355, 886, 1053, 6417, 327, 29949, 5824, 29892, 382, 29923, 29949, 5824, 29892, 22985, 3247, 7310, 29892, 402, 7428, 3247, 7310, 13, 13, 16173, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 353, 29871, 29900, 29889, 29900, 29900, 29896, 13, 12648, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 353, 29871, 29900, 29889, 29896, 13, 29937, 884, 3342, 297, 19964, 29918, 6272, 29889, 8223, 29991, 13, 15307, 29918, 1254, 15488, 29918, 29911, 4717, 1177, 353, 29871, 29900, 29889, 29896, 13, 13, 13, 1990, 382, 29923, 3247, 7310, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 12632, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 2343, 29918, 2962, 29892, 13, 462, 2910, 1125, 13, 4706, 1583, 29889, 29887, 374, 2496, 29918, 28111, 29918, 12632, 353, 330, 374, 2496, 29918, 28111, 29918, 12632, 13, 4706, 1583, 29889, 29887, 374, 2496, 29918, 28111, 29918, 29893, 2021, 353, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 13, 4706, 1583, 3032, 2813, 29918, 2962, 353, 2343, 29918, 2962, 13, 4706, 1583, 3032, 1958, 353, 2910, 13, 13, 1678, 822, 10092, 29898, 1311, 29892, 13, 795, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 13, 795, 5232, 29918, 3204, 29918, 19790, 29901, 5785, 29892, 13, 795, 338, 29918, 7054, 3637, 293, 29918, 6272, 29901, 6120, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5721, 29901, 5785, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5450, 29901, 5785, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 822, 4331, 29898, 1311, 29892, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 10972, 29918, 955, 29918, 12324, 29901, 5785, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 822, 5706, 29918, 26290, 29918, 10568, 29898, 1311, 29892, 19964, 29918, 3859, 29901, 6417, 327, 29949, 5824, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 13, 1990, 22985, 3247, 7310, 15646, 29898, 17896, 3247, 7310, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 12632, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 2343, 29918, 2962, 29892, 13, 462, 2910, 1125, 13, 4706, 2428, 29898, 12697, 3247, 7310, 15646, 29892, 1583, 467, 1649, 2344, 12035, 29887, 374, 2496, 29918, 28111, 29918, 12632, 29892, 13, 462, 462, 462, 259, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 462, 462, 259, 2343, 29918, 2962, 29892, 13, 462, 462, 462, 259, 2910, 29897, 13, 4706, 1583, 3032, 572, 7310, 353, 6213, 13, 13, 1678, 822, 10092, 29898, 1311, 29892, 13, 795, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 13, 795, 5232, 29918, 3204, 29918, 19790, 29901, 5785, 29892, 13, 795, 338, 29918, 7054, 3637, 293, 29918, 6272, 29901, 6120, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5721, 29901, 5785, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5450, 29901, 5785, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 1583, 3032, 572, 7310, 353, 22985, 3247, 7310, 29898, 1311, 29889, 29887, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 462, 418, 19964, 29918, 26290, 29889, 29887, 374, 2496, 29918, 13264, 29892, 13, 462, 462, 418, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 1402, 13, 462, 462, 418, 19964, 29918, 26290, 29889, 3188, 29918, 13264, 29892, 13, 462, 462, 418, 2551, 29918, 386, 690, 29918, 5721, 29892, 13, 462, 462, 418, 2551, 29918, 386, 690, 29918, 5450, 29892, 13, 462, 462, 418, 341, 1177, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 29892, 13, 462, 462, 418, 18134, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 29892, 13, 462, 462, 418, 5232, 29918, 3204, 29918, 19790, 29892, 13, 462, 462, 418, 1583, 3032, 2813, 29918, 2962, 29892, 13, 462, 462, 418, 323, 8890, 29918, 1254, 15488, 29918, 29911, 4717, 1177, 29892, 13, 462, 462, 418, 338, 29918, 7054, 3637, 293, 29918, 6272, 29897, 13, 4706, 736, 1583, 29889, 17158, 29918, 26290, 29918, 10568, 29898, 307, 7451, 29918, 26290, 29897, 13, 13, 1678, 822, 4331, 29898, 1311, 29892, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 10972, 29918, 955, 29918, 12324, 29901, 5785, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 736, 1583, 3032, 572, 7310, 29889, 10568, 29898, 307, 7451, 29918, 26290, 29892, 10972, 29918, 955, 29918, 12324, 29897, 13, 13, 1678, 822, 5706, 29918, 26290, 29918, 10568, 29898, 1311, 29892, 19964, 29918, 3859, 29901, 6417, 327, 29949, 5824, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 736, 1583, 3032, 572, 7310, 29889, 17158, 29918, 26290, 29918, 10568, 29898, 307, 7451, 29918, 3859, 29897, 13, 13, 13, 1990, 402, 7428, 3247, 7310, 15646, 29898, 17896, 3247, 7310, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 12632, 29892, 13, 462, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 2343, 29918, 2962, 29892, 13, 462, 2910, 29892, 13, 462, 330, 4317, 29918, 4299, 29918, 2084, 29901, 851, 29892, 13, 462, 19964, 29918, 2917, 1125, 13, 4706, 2428, 29898, 29954, 7428, 3247, 7310, 15646, 29892, 1583, 467, 1649, 2344, 12035, 29887, 374, 2496, 29918, 28111, 29918, 12632, 29892, 13, 462, 462, 18884, 330, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 462, 18884, 2343, 29918, 2962, 29892, 13, 462, 462, 18884, 2910, 29897, 13, 4706, 1583, 3032, 572, 7310, 353, 6213, 13, 4706, 4974, 2897, 29889, 2084, 29889, 9933, 29898, 29887, 4317, 29918, 4299, 29918, 2084, 511, 285, 29908, 2605, 426, 29887, 4317, 29918, 4299, 29918, 2084, 29913, 1838, 29915, 29873, 1863, 29908, 13, 4706, 1583, 3032, 29887, 4317, 29918, 4299, 29918, 2084, 353, 330, 4317, 29918, 4299, 29918, 2084, 13, 4706, 1583, 3032, 307, 7451, 29918, 2917, 353, 19964, 29918, 2917, 13, 13, 1678, 822, 10092, 29898, 1311, 29892, 13, 795, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 13, 795, 5232, 29918, 3204, 29918, 19790, 29901, 5785, 29892, 13, 795, 338, 29918, 7054, 3637, 293, 29918, 6272, 29901, 6120, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5721, 29892, 13, 795, 2551, 29918, 386, 690, 29918, 5450, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 396, 6058, 29923, 29901, 715, 812, 414, 2845, 2125, 297, 278, 7306, 363, 278, 6872, 470, 278, 281, 2021, 29892, 541, 2337, 1962, 13900, 363, 278, 281, 2021, 29991, 13, 4706, 1583, 3032, 572, 7310, 353, 402, 7428, 3247, 7310, 29898, 1311, 29889, 29887, 374, 2496, 29918, 28111, 29918, 29893, 2021, 29892, 13, 462, 462, 259, 19964, 29918, 26290, 29889, 29887, 374, 2496, 29918, 13264, 29892, 13, 462, 462, 259, 518, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 1402, 13, 462, 462, 259, 19964, 29918, 26290, 29889, 3188, 29918, 13264, 29892, 13, 462, 462, 259, 2551, 29918, 386, 690, 29918, 5721, 29892, 13, 462, 462, 259, 2551, 29918, 386, 690, 29918, 5450, 29892, 13, 462, 462, 259, 341, 1177, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 29892, 13, 462, 462, 259, 18134, 29918, 7390, 2190, 13865, 29918, 12064, 16652, 11937, 29892, 13, 462, 462, 259, 5232, 29918, 3204, 29918, 19790, 29892, 13, 462, 462, 259, 1583, 3032, 2813, 29918, 2962, 29892, 13, 462, 462, 259, 323, 8890, 29918, 1254, 15488, 29918, 29911, 4717, 1177, 29892, 13, 462, 462, 259, 338, 29918, 7054, 3637, 293, 29918, 6272, 29892, 13, 462, 462, 259, 1583, 3032, 307, 7451, 29918, 2917, 3366, 12632, 29918, 517, 29918, 29887, 374, 2496, 29918, 10289, 12436, 13, 462, 462, 259, 1583, 3032, 307, 7451, 29918, 2917, 3366, 29887, 374, 2496, 29918, 517, 29918, 3188, 29918, 5450, 29918, 10289, 12436, 13, 462, 462, 259, 851, 29898, 1311, 3032, 29887, 4317, 29918, 4299, 29918, 2084, 511, 13, 462, 462, 259, 1583, 3032, 307, 7451, 29918, 2917, 3366, 29887, 4317, 29918, 3188, 29918, 10289, 20068, 13, 4706, 736, 1583, 29889, 17158, 29918, 26290, 29918, 10568, 29898, 307, 7451, 29918, 26290, 29897, 13, 13, 1678, 822, 4331, 29898, 1311, 29892, 19964, 29918, 26290, 29901, 6417, 327, 29949, 5824, 29892, 10972, 29918, 955, 29918, 12324, 29901, 5785, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 736, 1583, 3032, 572, 7310, 29889, 10568, 29898, 307, 7451, 29918, 26290, 29892, 10972, 29918, 955, 29918, 12324, 29897, 13, 13, 1678, 822, 5706, 29918, 26290, 29918, 10568, 29898, 1311, 29892, 19964, 29918, 3859, 29901, 6417, 327, 29949, 5824, 29897, 1599, 382, 29923, 29949, 5824, 29901, 13, 4706, 736, 1583, 3032, 572, 7310, 29889, 17158, 29918, 26290, 29918, 10568, 29898, 307, 7451, 29918, 3859, 29897, 13, 2 ]
scripts/ssc/models/Competitors/test_competitors.py
MrBellamonte/MT-VAEs-TDA
0
112736
<gh_stars>0 from scripts.ssc.models.Competitors.config_libraries.umap_mnist import ( umap_mnist_test_local, umap_mnist_euler_1) from src.competitors.train_engine import simulator_competitor if __name__ == "__main__": for config in umap_mnist_test_local.configs_from_grid(): print(config) simulator_competitor(config)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 12078, 29889, 893, 29883, 29889, 9794, 29889, 6843, 300, 17259, 29889, 2917, 29918, 492, 8464, 29889, 398, 481, 29918, 23521, 391, 1053, 313, 13, 1678, 1922, 481, 29918, 23521, 391, 29918, 1688, 29918, 2997, 29892, 13, 1678, 1922, 481, 29918, 23521, 391, 29918, 29872, 8584, 29918, 29896, 29897, 13, 3166, 4765, 29889, 2388, 300, 17259, 29889, 14968, 29918, 10599, 1053, 1027, 9183, 29918, 2388, 300, 2105, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 363, 2295, 297, 1922, 481, 29918, 23521, 391, 29918, 1688, 29918, 2997, 29889, 2917, 29879, 29918, 3166, 29918, 7720, 7295, 13, 4706, 1596, 29898, 2917, 29897, 13, 4706, 1027, 9183, 29918, 2388, 300, 2105, 29898, 2917, 29897, 13, 13, 13, 2 ]
dataset_split.py
Complicateddd/Complicateddd-ROITransformer
0
116027
import os import random import shutil file=os.listdir("/media/ubuntu/data/huojianjun/科目四热身赛数据/labelTxt") tv=int(len(file)*0.8) list_one=list(range(1,len(file)+1)) trainval=random.sample(list_one,tv) for i in list_one: if i in trainval: shutil.copy(os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/images/{}.tif'.format(i)), os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/trainval/images/{}.tif'.format(i))) shutil.copy(os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/labelTxt/{}.txt'.format(i)), os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/trainval/labelTxt/{}.txt'.format(i))) else: shutil.copy(os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/images/{}.tif'.format(i)), os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/test/images/{}.tif'.format(i))) shutil.copy(os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/labelTxt/{}.txt'.format(i)), os.path.join('/media/ubuntu/data/huojianjun/科目四热身赛数据/test/labelTxt/{}.txt'.format(i))) # print(list_one) # import os # import shutil # file=open("/media/ubuntu/新加卷/xiangmu/dataset/ImageSets/Main/test.txt",'r') # list_=[] # for line in file.readlines(): # list_.append(line.strip()+'.jpg') # print(line) # print(list_) # img=os.listdir("/media/ubuntu/新加卷/xiangmu/dataset/JPEGImages") # print(len(img)) # for i in img: # if i in list_: # shutil.copy(os.path.join("/media/ubuntu/新加卷/xiangmu/dataset/JPEGImages",i), # os.path.join("/media/ubuntu/新加卷/xiangmu/sample",i)) # file.close()
[ 1, 1053, 2897, 13, 5215, 4036, 13, 5215, 528, 4422, 13, 13, 1445, 29922, 359, 29889, 1761, 3972, 11974, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 1643, 29911, 486, 1159, 13, 12427, 29922, 524, 29898, 2435, 29898, 1445, 11877, 29900, 29889, 29947, 29897, 13, 13, 1761, 29918, 650, 29922, 1761, 29898, 3881, 29898, 29896, 29892, 2435, 29898, 1445, 7240, 29896, 876, 13, 14968, 791, 29922, 8172, 29889, 11249, 29898, 1761, 29918, 650, 29892, 12427, 29897, 13, 13, 1454, 474, 297, 1051, 29918, 650, 29901, 13, 12, 361, 474, 297, 7945, 791, 29901, 13, 12, 12, 845, 4422, 29889, 8552, 29898, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 8346, 19248, 1836, 29873, 361, 4286, 4830, 29898, 29875, 8243, 13, 12, 12, 12, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 14968, 791, 29914, 8346, 19248, 1836, 29873, 361, 4286, 4830, 29898, 29875, 4961, 13, 13, 12, 12, 845, 4422, 29889, 8552, 29898, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 1643, 29911, 486, 19248, 1836, 3945, 4286, 4830, 29898, 29875, 8243, 13, 12, 12, 12, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 14968, 791, 29914, 1643, 29911, 486, 19248, 1836, 3945, 4286, 4830, 29898, 29875, 4961, 13, 12, 2870, 29901, 13, 12, 12, 845, 4422, 29889, 8552, 29898, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 8346, 19248, 1836, 29873, 361, 4286, 4830, 29898, 29875, 8243, 13, 12, 12, 12, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 1688, 29914, 8346, 19248, 1836, 29873, 361, 4286, 4830, 29898, 29875, 4961, 13, 13, 12, 12, 845, 4422, 29889, 8552, 29898, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 1643, 29911, 486, 19248, 1836, 3945, 4286, 4830, 29898, 29875, 8243, 13, 12, 12, 12, 359, 29889, 2084, 29889, 7122, 11219, 9799, 29914, 8767, 29914, 1272, 29914, 6905, 3848, 713, 29926, 348, 29914, 31030, 30895, 30928, 234, 134, 176, 31687, 235, 184, 158, 30354, 30763, 29914, 1688, 29914, 1643, 29911, 486, 19248, 1836, 3945, 4286, 4830, 29898, 29875, 4961, 13, 29937, 1596, 29898, 1761, 29918, 650, 29897, 13, 13, 13, 13, 29937, 1053, 2897, 13, 29937, 1053, 528, 4422, 13, 29937, 934, 29922, 3150, 11974, 9799, 29914, 8767, 29914, 30374, 30666, 232, 144, 186, 29914, 5389, 574, 2589, 29914, 24713, 29914, 2940, 29903, 1691, 29914, 6330, 29914, 1688, 29889, 3945, 613, 29915, 29878, 1495, 13, 29937, 1051, 29918, 29922, 2636, 13, 29937, 363, 1196, 297, 934, 29889, 949, 9012, 7295, 13, 29937, 29871, 12, 1761, 5396, 4397, 29898, 1220, 29889, 17010, 580, 29974, 4286, 6173, 1495, 13, 29937, 29871, 12, 2158, 29898, 1220, 29897, 13, 29937, 1596, 29898, 1761, 19925, 13, 29937, 10153, 29922, 359, 29889, 1761, 3972, 11974, 9799, 29914, 8767, 29914, 30374, 30666, 232, 144, 186, 29914, 5389, 574, 2589, 29914, 24713, 29914, 29967, 4162, 29954, 20163, 1159, 13, 29937, 1596, 29898, 2435, 29898, 2492, 876, 13, 29937, 363, 474, 297, 10153, 29901, 13, 29937, 29871, 12, 361, 474, 297, 1051, 29918, 29901, 13, 29937, 29871, 12, 12, 845, 4422, 29889, 8552, 29898, 359, 29889, 2084, 29889, 7122, 11974, 9799, 29914, 8767, 29914, 30374, 30666, 232, 144, 186, 29914, 5389, 574, 2589, 29914, 24713, 29914, 29967, 4162, 29954, 20163, 613, 29875, 511, 13, 29937, 29871, 12, 12, 12, 359, 29889, 2084, 29889, 7122, 11974, 9799, 29914, 8767, 29914, 30374, 30666, 232, 144, 186, 29914, 5389, 574, 2589, 29914, 11249, 613, 29875, 876, 13, 29937, 934, 29889, 5358, 580, 2 ]
Task/urls.py
DudaEugen/JustTesting
0
129585
<reponame>DudaEugen/JustTesting<gh_stars>0 from django.conf.urls import url from .views import * urlpatterns = [ url(r'^lists$', TaskListView.as_view(), name='task lists'), url(r'^list=(?P<task_list_pk>\d+)/multiple_choice_tests', MultipleChoiceTestsOfTaskLisk.as_view(), name="multiple choice tests of task list"), url(r'^multiple_choice_test/create$', MultipleChoiceTestCreateView.as_view(), name='create multiple choice test'), url(r'^multiple_choice_test/update=(?P<pk>\d+)$', MultipleChoiceTestUpdateView.as_view(), name='update multiple choice test'), ]
[ 1, 529, 276, 1112, 420, 29958, 29928, 6191, 29923, 10214, 29914, 14084, 3057, 292, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 13, 3166, 869, 7406, 1053, 334, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 3142, 29898, 29878, 29915, 29985, 21513, 29938, 742, 9330, 15660, 29889, 294, 29918, 1493, 3285, 1024, 2433, 7662, 8857, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 1761, 7607, 29973, 29925, 29966, 7662, 29918, 1761, 29918, 20571, 14247, 29881, 29974, 6802, 20787, 29918, 16957, 29918, 21150, 742, 26905, 29620, 24376, 2776, 5398, 29931, 3873, 29889, 294, 29918, 1493, 3285, 29871, 13, 4706, 1024, 543, 20787, 7348, 6987, 310, 3414, 1051, 4968, 13, 1678, 3142, 29898, 29878, 29915, 29985, 20787, 29918, 16957, 29918, 1688, 29914, 3258, 29938, 742, 26905, 29620, 3057, 4391, 1043, 29889, 294, 29918, 1493, 3285, 13, 4706, 1024, 2433, 3258, 2999, 7348, 1243, 5477, 13, 1678, 3142, 29898, 29878, 29915, 29985, 20787, 29918, 16957, 29918, 1688, 29914, 5504, 7607, 29973, 29925, 29966, 20571, 14247, 29881, 29974, 1262, 742, 26905, 29620, 3057, 6422, 1043, 29889, 294, 29918, 1493, 3285, 13, 4706, 1024, 2433, 5504, 2999, 7348, 1243, 5477, 13, 29962, 13, 2 ]
last_time/noise_utils.py
abdelabdalla/deepmind-research
0
66928
<reponame>abdelabdalla/deepmind-research # Lint as: python3 # pylint: disable=g-bad-file-header # Copyright 2020 DeepMind Technologies Limited. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. # ============================================================================ """Methods to calculate input noise.""" import tensorflow as tf from learning_to_simulate import learned_simulator def get_random_walk_noise_for_velocity_sequence( velocity_sequence, noise_std_last_step): """Returns random-walk noise in the velocity applied to the position.""" acc_sequence = learned_simulator.time_diff(velocity_sequence) # We want the noise scale in the velocity at the last step to be fixed. # Because we are going to compose noise at each step using a random_walk: # std_last_step**2 = num_velocities * std_each_step**2 # so to keep `std_last_step` fixed, we apply at each step: # std_each_step `std_last_step / np.sqrt(num_input_velocities)` # TODO(alvarosg): Make sure this is consistent with the value and # description provided in the paper. num_acc = acc_sequence.shape.as_list()[1] acc_sequence_noise = tf.random.normal( tf.shape(acc_sequence), stddev=noise_std_last_step / num_acc ** 0.5, dtype=velocity_sequence.dtype) # Apply the random walk. velocity_sequence_noise = tf.cumsum(acc_sequence_noise, axis=1) # Integrate the noise in the velocity to the positions, assuming # an Euler intergrator and a dt = 1, and adding no noise to the very first # position (since that will only be used to calculate the first position # change). vel_sequence_noise = tf.concat([ tf.zeros_like(acc_sequence_noise[:, 0:1]), tf.cumsum(acc_sequence_noise, axis=1)], axis=1) return vel_sequence_noise
[ 1, 529, 276, 1112, 420, 29958, 370, 6144, 370, 29881, 9864, 29914, 24535, 24021, 29899, 690, 2842, 13, 29937, 365, 524, 408, 29901, 3017, 29941, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 29887, 29899, 12313, 29899, 1445, 29899, 6672, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 21784, 29924, 513, 8364, 11763, 28873, 29889, 2178, 26863, 2538, 9841, 29889, 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, 29871, 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, 1360, 13, 15945, 29908, 26112, 304, 8147, 1881, 11462, 1213, 15945, 13, 13, 5215, 26110, 408, 15886, 13, 13, 3166, 6509, 29918, 517, 29918, 3601, 5987, 1053, 10972, 29918, 3601, 9183, 13, 13, 13, 1753, 679, 29918, 8172, 29918, 20919, 29918, 1217, 895, 29918, 1454, 29918, 955, 25245, 29918, 16506, 29898, 13, 4706, 12885, 29918, 16506, 29892, 11462, 29918, 4172, 29918, 4230, 29918, 10568, 1125, 13, 1678, 9995, 11609, 29879, 4036, 29899, 20919, 11462, 297, 278, 12885, 7436, 304, 278, 2602, 1213, 15945, 13, 13, 1678, 1035, 29918, 16506, 353, 10972, 29918, 3601, 9183, 29889, 2230, 29918, 12765, 29898, 955, 25245, 29918, 16506, 29897, 13, 13, 1678, 396, 1334, 864, 278, 11462, 6287, 297, 278, 12885, 472, 278, 1833, 4331, 304, 367, 4343, 29889, 13, 1678, 396, 7311, 591, 526, 2675, 304, 27435, 11462, 472, 1269, 4331, 773, 263, 4036, 29918, 20919, 29901, 13, 1678, 396, 3659, 29918, 4230, 29918, 10568, 1068, 29906, 353, 954, 29918, 955, 542, 1907, 334, 3659, 29918, 4204, 29918, 10568, 1068, 29906, 13, 1678, 396, 577, 304, 3013, 421, 4172, 29918, 4230, 29918, 10568, 29952, 4343, 29892, 591, 3394, 472, 1269, 4331, 29901, 13, 1678, 396, 3659, 29918, 4204, 29918, 10568, 421, 4172, 29918, 4230, 29918, 10568, 847, 7442, 29889, 3676, 29898, 1949, 29918, 2080, 29918, 955, 542, 1907, 3569, 13, 1678, 396, 14402, 29898, 284, 1707, 359, 29887, 1125, 8561, 1854, 445, 338, 13747, 411, 278, 995, 322, 13, 1678, 396, 6139, 4944, 297, 278, 5650, 29889, 13, 1678, 954, 29918, 5753, 353, 1035, 29918, 16506, 29889, 12181, 29889, 294, 29918, 1761, 580, 29961, 29896, 29962, 13, 1678, 1035, 29918, 16506, 29918, 1217, 895, 353, 15886, 29889, 8172, 29889, 8945, 29898, 13, 4706, 15886, 29889, 12181, 29898, 5753, 29918, 16506, 511, 13, 4706, 3659, 3359, 29922, 1217, 895, 29918, 4172, 29918, 4230, 29918, 10568, 847, 954, 29918, 5753, 3579, 29871, 29900, 29889, 29945, 29892, 13, 4706, 26688, 29922, 955, 25245, 29918, 16506, 29889, 29881, 1853, 29897, 13, 13, 1678, 396, 2401, 368, 278, 4036, 6686, 29889, 13, 1678, 12885, 29918, 16506, 29918, 1217, 895, 353, 15886, 29889, 29883, 398, 2083, 29898, 5753, 29918, 16506, 29918, 1217, 895, 29892, 9685, 29922, 29896, 29897, 13, 13, 1678, 396, 17100, 403, 278, 11462, 297, 278, 12885, 304, 278, 11909, 29892, 10241, 13, 1678, 396, 385, 382, 8584, 1006, 629, 1061, 322, 263, 11636, 353, 29871, 29896, 29892, 322, 4417, 694, 11462, 304, 278, 1407, 937, 13, 1678, 396, 2602, 313, 16076, 393, 674, 871, 367, 1304, 304, 8147, 278, 937, 2602, 13, 1678, 396, 1735, 467, 13, 1678, 5343, 29918, 16506, 29918, 1217, 895, 353, 15886, 29889, 17685, 4197, 13, 4706, 15886, 29889, 3298, 359, 29918, 4561, 29898, 5753, 29918, 16506, 29918, 1217, 895, 7503, 29892, 29871, 29900, 29901, 29896, 11724, 13, 4706, 15886, 29889, 29883, 398, 2083, 29898, 5753, 29918, 16506, 29918, 1217, 895, 29892, 9685, 29922, 29896, 29897, 1402, 9685, 29922, 29896, 29897, 13, 13, 1678, 736, 5343, 29918, 16506, 29918, 1217, 895, 13, 2 ]
model.py
andriikushch/CarND-Behavioral-Cloning-P3
1
29498
<gh_stars>1-10 import csv from math import ceil import cv2 import numpy as np from sklearn.model_selection import train_test_split import sklearn from keras.models import Sequential from keras.layers import Flatten, Dense, Lambda, BatchNormalization, Dropout, Cropping2D from keras.layers.convolutional import Convolution2D from keras.callbacks import EarlyStopping batch_size = 32 lines = [] # load stored data with open('./data/driving_log.csv') as csvfile: reader = csv.reader(csvfile) for line in reader: lines.append(line) # helper function to read image from path def read_image_from_disk(source_path): file_name = source_path.split('/')[-1] current_path = "./data/IMG/" + file_name image = cv2.imread(current_path) return image # splitting data into train_samples and validation_samples train_samples, validation_samples = train_test_split(lines, test_size=0.2) # create a generator for memory efficiency def generator(samples, batch_size=32): num_samples = len(samples) while 1: # Loop forever so the generator never terminates sklearn.utils.shuffle(samples) for offset in range(0, num_samples, batch_size): batch_samples = samples[offset:offset + batch_size] images, measurements = [], [] for sample in batch_samples: # create adjusted steering measurements for the center and side camera images # center image measurement = float(sample[3]) center_image = read_image_from_disk(sample[0]) images.append(center_image) measurements.append(measurement) images.append(cv2.flip(center_image, 1)) measurements.append(measurement * -1.0) # side images left_image = read_image_from_disk(sample[1]) right_image = read_image_from_disk(sample[2]) correction = 0.2 # this is a parameter to tune steering_left = measurement + correction steering_right = measurement - correction measurements.extend([steering_left, steering_right]) images.extend([left_image, right_image]) # convert images and measurements to np.array X_train = np.array(images) y_train = np.array(measurements) yield sklearn.utils.shuffle(X_train, y_train) # compile and train the model using the generator function train_generator = generator(train_samples, batch_size=batch_size) validation_generator = generator(validation_samples, batch_size=batch_size) callbacks = [EarlyStopping(monitor='val_loss', min_delta=0, patience=0, verbose=0, mode='auto', baseline=None, restore_best_weights=True)] # define model model = Sequential() # preprocess input normalize and crop model.add(Lambda(lambda x: x / 255.0 - 0.5, input_shape=(160, 320, 3))) model.add(Cropping2D(cropping=((50, 20), (0, 0)))) # add Convolution2D layers model.add(Convolution2D(filters=24, kernel_size=(5, 5), padding='valid', activation='relu')) model.add(Convolution2D(filters=36, kernel_size=(5, 5), padding='valid', activation='relu')) model.add(Convolution2D(filters=48, kernel_size=(5, 5), padding='valid', activation='relu')) model.add(Convolution2D(filters=64, kernel_size=(3, 3), padding='valid', activation='relu')) model.add(Convolution2D(filters=64, kernel_size=(3, 3), padding='valid', activation='relu')) # add fully connected layers model.add(Flatten()) model.add(Dense(100, activation='relu')) model.add(BatchNormalization()) model.add(Dropout(0.4)) model.add(Dense(50, activation='relu')) model.add(BatchNormalization()) model.add(Dense(50, activation='relu')) model.add(Dense(10, activation='relu')) model.add(BatchNormalization()) model.add(Dense(1)) model.compile(loss='mse', optimizer='adam') model.fit_generator(train_generator, steps_per_epoch=ceil(len(train_samples) / batch_size), validation_data=validation_generator, validation_steps=ceil(len(validation_samples) / batch_size), epochs=5, verbose=1, callbacks=callbacks) # save result model.save('model.h5')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 11799, 13, 3166, 5844, 1053, 2257, 309, 13, 13, 5215, 13850, 29906, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 5215, 2071, 19668, 13, 3166, 13023, 294, 29889, 9794, 1053, 922, 339, 2556, 13, 3166, 13023, 294, 29889, 29277, 1053, 2379, 8606, 29892, 360, 1947, 29892, 365, 2269, 29892, 350, 905, 19077, 2133, 29892, 20724, 449, 29892, 8764, 3262, 29906, 29928, 13, 3166, 13023, 294, 29889, 29277, 29889, 535, 4068, 284, 1053, 1281, 4068, 29906, 29928, 13, 3166, 13023, 294, 29889, 14035, 29879, 1053, 11095, 20754, 3262, 13, 13, 16175, 29918, 2311, 353, 29871, 29941, 29906, 13, 9012, 353, 5159, 13, 13, 29937, 2254, 6087, 848, 13, 2541, 1722, 877, 6904, 1272, 29914, 29881, 1150, 292, 29918, 1188, 29889, 7638, 1495, 408, 11799, 1445, 29901, 13, 1678, 9591, 353, 11799, 29889, 16950, 29898, 7638, 1445, 29897, 13, 1678, 363, 1196, 297, 9591, 29901, 13, 4706, 3454, 29889, 4397, 29898, 1220, 29897, 13, 13, 13, 29937, 16876, 740, 304, 1303, 1967, 515, 2224, 13, 1753, 1303, 29918, 3027, 29918, 3166, 29918, 20960, 29898, 4993, 29918, 2084, 1125, 13, 1678, 934, 29918, 978, 353, 2752, 29918, 2084, 29889, 5451, 11219, 1495, 14352, 29896, 29962, 13, 1678, 1857, 29918, 2084, 353, 376, 6904, 1272, 29914, 7833, 29954, 12975, 718, 934, 29918, 978, 13, 1678, 1967, 353, 13850, 29906, 29889, 326, 949, 29898, 3784, 29918, 2084, 29897, 13, 1678, 736, 1967, 13, 13, 13, 29937, 24368, 848, 964, 7945, 29918, 27736, 322, 8845, 29918, 27736, 13, 14968, 29918, 27736, 29892, 8845, 29918, 27736, 353, 7945, 29918, 1688, 29918, 5451, 29898, 9012, 29892, 1243, 29918, 2311, 29922, 29900, 29889, 29906, 29897, 13, 13, 13, 29937, 1653, 263, 15299, 363, 3370, 19201, 13, 1753, 15299, 29898, 27736, 29892, 9853, 29918, 2311, 29922, 29941, 29906, 1125, 13, 1678, 954, 29918, 27736, 353, 7431, 29898, 27736, 29897, 13, 1678, 1550, 29871, 29896, 29901, 29871, 396, 21493, 22296, 577, 278, 15299, 2360, 6624, 1078, 13, 4706, 2071, 19668, 29889, 13239, 29889, 845, 21897, 29898, 27736, 29897, 13, 4706, 363, 9210, 297, 3464, 29898, 29900, 29892, 954, 29918, 27736, 29892, 9853, 29918, 2311, 1125, 13, 9651, 9853, 29918, 27736, 353, 11916, 29961, 10289, 29901, 10289, 718, 9853, 29918, 2311, 29962, 13, 13, 9651, 4558, 29892, 20398, 353, 19997, 5159, 13, 13, 9651, 363, 4559, 297, 9853, 29918, 27736, 29901, 13, 18884, 396, 1653, 10365, 287, 1886, 3241, 20398, 363, 278, 4818, 322, 2625, 10656, 4558, 13, 13, 18884, 396, 4818, 1967, 13, 18884, 20039, 353, 5785, 29898, 11249, 29961, 29941, 2314, 13, 18884, 4818, 29918, 3027, 353, 1303, 29918, 3027, 29918, 3166, 29918, 20960, 29898, 11249, 29961, 29900, 2314, 13, 18884, 4558, 29889, 4397, 29898, 5064, 29918, 3027, 29897, 13, 13, 18884, 20398, 29889, 4397, 29898, 26658, 358, 29897, 13, 13, 18884, 4558, 29889, 4397, 29898, 11023, 29906, 29889, 29888, 3466, 29898, 5064, 29918, 3027, 29892, 29871, 29896, 876, 13, 18884, 20398, 29889, 4397, 29898, 26658, 358, 334, 448, 29896, 29889, 29900, 29897, 13, 13, 18884, 396, 2625, 4558, 13, 18884, 2175, 29918, 3027, 353, 1303, 29918, 3027, 29918, 3166, 29918, 20960, 29898, 11249, 29961, 29896, 2314, 13, 18884, 1492, 29918, 3027, 353, 1303, 29918, 3027, 29918, 3166, 29918, 20960, 29898, 11249, 29961, 29906, 2314, 13, 13, 18884, 26385, 353, 29871, 29900, 29889, 29906, 29871, 396, 445, 338, 263, 3443, 304, 260, 1540, 13, 18884, 1886, 3241, 29918, 1563, 353, 20039, 718, 26385, 13, 18884, 1886, 3241, 29918, 1266, 353, 20039, 448, 26385, 13, 13, 18884, 20398, 29889, 21843, 4197, 1655, 3241, 29918, 1563, 29892, 1886, 3241, 29918, 1266, 2314, 13, 18884, 4558, 29889, 21843, 4197, 1563, 29918, 3027, 29892, 1492, 29918, 3027, 2314, 13, 13, 9651, 396, 3588, 4558, 322, 20398, 304, 7442, 29889, 2378, 13, 9651, 1060, 29918, 14968, 353, 7442, 29889, 2378, 29898, 8346, 29897, 13, 9651, 343, 29918, 14968, 353, 7442, 29889, 2378, 29898, 26658, 1860, 29897, 13, 13, 9651, 7709, 2071, 19668, 29889, 13239, 29889, 845, 21897, 29898, 29990, 29918, 14968, 29892, 343, 29918, 14968, 29897, 13, 13, 13, 29937, 6633, 322, 7945, 278, 1904, 773, 278, 15299, 740, 13, 14968, 29918, 27959, 353, 15299, 29898, 14968, 29918, 27736, 29892, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 29897, 13, 18157, 29918, 27959, 353, 15299, 29898, 18157, 29918, 27736, 29892, 9853, 29918, 2311, 29922, 16175, 29918, 2311, 29897, 13, 13, 14035, 29879, 353, 518, 29923, 279, 368, 20754, 3262, 29898, 3712, 2105, 2433, 791, 29918, 6758, 742, 1375, 29918, 4181, 29922, 29900, 29892, 282, 24701, 29922, 29900, 29892, 26952, 29922, 29900, 29892, 4464, 2433, 6921, 742, 2362, 5570, 29922, 8516, 29892, 13, 462, 965, 17749, 29918, 13318, 29918, 705, 5861, 29922, 5574, 4638, 13, 29937, 4529, 1904, 13, 4299, 353, 922, 339, 2556, 580, 13, 13, 29937, 758, 5014, 1881, 4226, 675, 322, 274, 1336, 13, 4299, 29889, 1202, 29898, 9099, 29898, 2892, 921, 29901, 921, 847, 29871, 29906, 29945, 29945, 29889, 29900, 448, 29871, 29900, 29889, 29945, 29892, 1881, 29918, 12181, 7607, 29896, 29953, 29900, 29892, 29871, 29941, 29906, 29900, 29892, 29871, 29941, 4961, 13, 4299, 29889, 1202, 29898, 29907, 307, 3262, 29906, 29928, 29898, 24077, 3262, 29922, 3552, 29945, 29900, 29892, 29871, 29906, 29900, 511, 313, 29900, 29892, 29871, 29900, 13697, 13, 13, 29937, 788, 1281, 4068, 29906, 29928, 15359, 13, 4299, 29889, 1202, 29898, 1168, 4068, 29906, 29928, 29898, 26705, 29922, 29906, 29946, 29892, 8466, 29918, 2311, 7607, 29945, 29892, 29871, 29945, 511, 7164, 2433, 3084, 742, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 1168, 4068, 29906, 29928, 29898, 26705, 29922, 29941, 29953, 29892, 8466, 29918, 2311, 7607, 29945, 29892, 29871, 29945, 511, 7164, 2433, 3084, 742, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 1168, 4068, 29906, 29928, 29898, 26705, 29922, 29946, 29947, 29892, 8466, 29918, 2311, 7607, 29945, 29892, 29871, 29945, 511, 7164, 2433, 3084, 742, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 1168, 4068, 29906, 29928, 29898, 26705, 29922, 29953, 29946, 29892, 8466, 29918, 2311, 7607, 29941, 29892, 29871, 29941, 511, 7164, 2433, 3084, 742, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 1168, 4068, 29906, 29928, 29898, 26705, 29922, 29953, 29946, 29892, 8466, 29918, 2311, 7607, 29941, 29892, 29871, 29941, 511, 7164, 2433, 3084, 742, 26229, 2433, 2674, 29884, 8785, 13, 13, 29937, 788, 8072, 6631, 15359, 13, 4299, 29889, 1202, 29898, 29943, 5066, 841, 3101, 13, 4299, 29889, 1202, 29898, 29928, 1947, 29898, 29896, 29900, 29900, 29892, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 23145, 19077, 2133, 3101, 13, 4299, 29889, 1202, 29898, 15063, 449, 29898, 29900, 29889, 29946, 876, 13, 4299, 29889, 1202, 29898, 29928, 1947, 29898, 29945, 29900, 29892, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 23145, 19077, 2133, 3101, 13, 4299, 29889, 1202, 29898, 29928, 1947, 29898, 29945, 29900, 29892, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 29928, 1947, 29898, 29896, 29900, 29892, 26229, 2433, 2674, 29884, 8785, 13, 4299, 29889, 1202, 29898, 23145, 19077, 2133, 3101, 13, 4299, 29889, 1202, 29898, 29928, 1947, 29898, 29896, 876, 13, 13, 4299, 29889, 12198, 29898, 6758, 2433, 29885, 344, 742, 5994, 3950, 2433, 328, 314, 1495, 13, 4299, 29889, 9202, 29918, 27959, 29898, 14968, 29918, 27959, 29892, 13, 462, 1678, 6576, 29918, 546, 29918, 1022, 2878, 29922, 27696, 29898, 2435, 29898, 14968, 29918, 27736, 29897, 847, 9853, 29918, 2311, 511, 13, 462, 1678, 8845, 29918, 1272, 29922, 18157, 29918, 27959, 29892, 13, 462, 1678, 8845, 29918, 24530, 29922, 27696, 29898, 2435, 29898, 18157, 29918, 27736, 29897, 847, 9853, 29918, 2311, 511, 13, 462, 1678, 21502, 12168, 29922, 29945, 29892, 26952, 29922, 29896, 29892, 6939, 29879, 29922, 14035, 29879, 29897, 13, 13, 29937, 4078, 1121, 13, 4299, 29889, 7620, 877, 4299, 29889, 29882, 29945, 1495, 13, 2 ]
dinamics/pieces/bishop.py
RiccardoTancredi/Chess
1
89726
<reponame>RiccardoTancredi/Chess from dinamics.piece import Piece from dinamics.constants import ROWS, COLS class Bishop(Piece): def __init__(self, color): super().__init__(color) def get_movements(self): count = min(ROWS, COLS) moves = set() for k in range(-count, count): moves.add((k, k)) moves.add((k, -k)) moves.remove((0, 0)) return list(moves) # return [(1, 1), (2, 2), (3, 3), (4, 4), (5, 5), (6, 6), (7, 7), # (-1, -1), (-2, -2), (-3, -3), (-4, -4), (-5, -5), (-6, -6), (-7, -7), # (1, -1), (2, -2), (3, -3), (4, -4), (5, -5), (6, -6), (7, -7), # (-1, 1), (-2, 2), (-3, 3), (-4, 4), (-5, 5), (-6, 6), (-7, 7)] def edit_moves(self, board, position, moves): row, col = position # tutte le mosse possibili mosse (anche non legali) verso NE, NW, SE e SW moves_ne = [(row - k, col + k) for k in range(1, min(row + 1, COLS - col))] moves_nw = [(row - k, col - k) for k in range(1, min(row + 1, col + 1))] moves_se = [(row + k, col + k) for k in range(1, min(ROWS - row, COLS - col))] moves_sw = [(row + k, col - k) for k in range(1, min(ROWS - row, col + 1))] good_moves = set() # qui filtriamo le mosse tenendo soltanto quelle legali per ogni direzione good_moves = good_moves.union(self._keep_until_piece(board, moves_ne, moves)) good_moves = good_moves.union(self._keep_until_piece(board, moves_nw, moves)) good_moves = good_moves.union(self._keep_until_piece(board, moves_se, moves)) good_moves = good_moves.union(self._keep_until_piece(board, moves_sw, moves)) # moves = bishop_moves # for (i, j), piece in board.get_pieces(valid=True): # if (i, j) in moves: # if j < position[1] and i > position[0]: # for l in range(i, ROWS): # for k in range(j): # if (l, k) in moves: # moves.remove((l, k)) # elif j > position[1] and i < position[0]: # for l in range(i): # for k in range(j, COLS): # if (l, k) in moves: # moves.remove((l, k)) # elif j < position[1] and i < position[0]: # for l in range(i): # for k in range(j): # if (l, k) in moves: # moves.remove((l, k)) # elif j > position[1] and i > position[0]: # for l in range(i + 1, ROWS): # for k in range(j + 1, COLS): # if (l, k) in moves: # moves.remove((l, k)) return list(good_moves) # come la torre def _keep_until_piece(self, board, moves, legal_moves): good_moves = set() for move in moves: piece = board.get_piece(move) if piece: if piece.color != self.color and move in legal_moves: good_moves.add(move) break if move in legal_moves: good_moves.add(move) return good_moves
[ 1, 529, 276, 1112, 420, 29958, 29934, 293, 29883, 6491, 29911, 273, 1037, 6051, 29914, 1451, 404, 13, 3166, 4538, 314, 1199, 29889, 12343, 346, 1053, 26005, 346, 13, 3166, 4538, 314, 1199, 29889, 3075, 1934, 1053, 16641, 7811, 29892, 4810, 8547, 13, 13, 13, 1990, 16880, 29898, 29925, 347, 346, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2927, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 2780, 29897, 13, 13, 1678, 822, 679, 29918, 13529, 4110, 29898, 1311, 1125, 13, 13, 4706, 2302, 353, 1375, 29898, 1672, 7811, 29892, 4810, 8547, 29897, 13, 4706, 16229, 353, 731, 580, 13, 4706, 363, 413, 297, 3464, 6278, 2798, 29892, 2302, 1125, 13, 9651, 16229, 29889, 1202, 3552, 29895, 29892, 413, 876, 13, 9651, 16229, 29889, 1202, 3552, 29895, 29892, 448, 29895, 876, 13, 4706, 16229, 29889, 5992, 3552, 29900, 29892, 29871, 29900, 876, 13, 4706, 736, 1051, 29898, 13529, 267, 29897, 13, 13, 4706, 396, 736, 17288, 29896, 29892, 29871, 29896, 511, 313, 29906, 29892, 29871, 29906, 511, 313, 29941, 29892, 29871, 29941, 511, 313, 29946, 29892, 29871, 29946, 511, 313, 29945, 29892, 29871, 29945, 511, 313, 29953, 29892, 29871, 29953, 511, 313, 29955, 29892, 29871, 29955, 511, 13, 4706, 396, 308, 8521, 29896, 29892, 448, 29896, 511, 8521, 29906, 29892, 448, 29906, 511, 8521, 29941, 29892, 448, 29941, 511, 8521, 29946, 29892, 448, 29946, 511, 8521, 29945, 29892, 448, 29945, 511, 8521, 29953, 29892, 448, 29953, 511, 8521, 29955, 29892, 448, 29955, 511, 13, 4706, 396, 308, 313, 29896, 29892, 448, 29896, 511, 313, 29906, 29892, 448, 29906, 511, 313, 29941, 29892, 448, 29941, 511, 313, 29946, 29892, 448, 29946, 511, 313, 29945, 29892, 448, 29945, 511, 313, 29953, 29892, 448, 29953, 511, 313, 29955, 29892, 448, 29955, 511, 13, 4706, 396, 308, 8521, 29896, 29892, 29871, 29896, 511, 8521, 29906, 29892, 29871, 29906, 511, 8521, 29941, 29892, 29871, 29941, 511, 8521, 29946, 29892, 29871, 29946, 511, 8521, 29945, 29892, 29871, 29945, 511, 8521, 29953, 29892, 29871, 29953, 511, 8521, 29955, 29892, 29871, 29955, 4638, 13, 13, 1678, 822, 3863, 29918, 13529, 267, 29898, 1311, 29892, 7613, 29892, 2602, 29892, 16229, 1125, 13, 13, 4706, 1948, 29892, 784, 353, 2602, 13, 4706, 396, 25301, 454, 19767, 344, 6458, 2638, 19767, 344, 313, 20372, 1661, 2814, 2606, 29897, 19803, 14693, 29892, 405, 29956, 29892, 3725, 321, 25289, 13, 4706, 16229, 29918, 484, 353, 17288, 798, 448, 413, 29892, 784, 718, 413, 29897, 363, 413, 297, 3464, 29898, 29896, 29892, 1375, 29898, 798, 718, 29871, 29896, 29892, 4810, 8547, 448, 784, 28166, 13, 4706, 16229, 29918, 29876, 29893, 353, 17288, 798, 448, 413, 29892, 784, 448, 413, 29897, 363, 413, 297, 3464, 29898, 29896, 29892, 1375, 29898, 798, 718, 29871, 29896, 29892, 784, 718, 29871, 29896, 28166, 13, 4706, 16229, 29918, 344, 353, 17288, 798, 718, 413, 29892, 784, 718, 413, 29897, 363, 413, 297, 3464, 29898, 29896, 29892, 1375, 29898, 1672, 7811, 448, 1948, 29892, 4810, 8547, 448, 784, 28166, 13, 4706, 16229, 29918, 2774, 353, 17288, 798, 718, 413, 29892, 784, 448, 413, 29897, 363, 413, 297, 3464, 29898, 29896, 29892, 1375, 29898, 1672, 7811, 448, 1948, 29892, 784, 718, 29871, 29896, 28166, 13, 13, 4706, 1781, 29918, 13529, 267, 353, 731, 580, 13, 4706, 396, 1750, 977, 3626, 10178, 454, 19767, 344, 3006, 2765, 899, 29873, 5361, 25178, 2814, 2606, 639, 18579, 2970, 4246, 13, 4706, 1781, 29918, 13529, 267, 353, 1781, 29918, 13529, 267, 29889, 13094, 29898, 1311, 3032, 17462, 29918, 29305, 29918, 12343, 346, 29898, 3377, 29892, 16229, 29918, 484, 29892, 16229, 876, 13, 4706, 1781, 29918, 13529, 267, 353, 1781, 29918, 13529, 267, 29889, 13094, 29898, 1311, 3032, 17462, 29918, 29305, 29918, 12343, 346, 29898, 3377, 29892, 16229, 29918, 29876, 29893, 29892, 16229, 876, 13, 4706, 1781, 29918, 13529, 267, 353, 1781, 29918, 13529, 267, 29889, 13094, 29898, 1311, 3032, 17462, 29918, 29305, 29918, 12343, 346, 29898, 3377, 29892, 16229, 29918, 344, 29892, 16229, 876, 13, 4706, 1781, 29918, 13529, 267, 353, 1781, 29918, 13529, 267, 29889, 13094, 29898, 1311, 3032, 17462, 29918, 29305, 29918, 12343, 346, 29898, 3377, 29892, 16229, 29918, 2774, 29892, 16229, 876, 13, 13, 4706, 396, 16229, 353, 26201, 29918, 13529, 267, 13, 4706, 396, 363, 313, 29875, 29892, 432, 511, 8424, 297, 7613, 29889, 657, 29918, 12343, 778, 29898, 3084, 29922, 5574, 1125, 13, 4706, 396, 268, 565, 313, 29875, 29892, 432, 29897, 297, 16229, 29901, 13, 4706, 396, 308, 565, 432, 529, 2602, 29961, 29896, 29962, 322, 474, 1405, 2602, 29961, 29900, 5387, 13, 4706, 396, 632, 363, 301, 297, 3464, 29898, 29875, 29892, 16641, 7811, 1125, 13, 4706, 396, 462, 363, 413, 297, 3464, 29898, 29926, 1125, 13, 4706, 396, 462, 268, 565, 313, 29880, 29892, 413, 29897, 297, 16229, 29901, 13, 4706, 396, 462, 308, 16229, 29889, 5992, 3552, 29880, 29892, 413, 876, 13, 4706, 396, 308, 25342, 432, 1405, 2602, 29961, 29896, 29962, 322, 474, 529, 2602, 29961, 29900, 5387, 13, 4706, 396, 632, 363, 301, 297, 3464, 29898, 29875, 1125, 13, 4706, 396, 462, 363, 413, 297, 3464, 29898, 29926, 29892, 4810, 8547, 1125, 13, 4706, 396, 462, 268, 565, 313, 29880, 29892, 413, 29897, 297, 16229, 29901, 13, 4706, 396, 462, 308, 16229, 29889, 5992, 3552, 29880, 29892, 413, 876, 13, 4706, 396, 308, 25342, 432, 529, 2602, 29961, 29896, 29962, 322, 474, 529, 2602, 29961, 29900, 5387, 13, 4706, 396, 632, 363, 301, 297, 3464, 29898, 29875, 1125, 13, 4706, 396, 462, 363, 413, 297, 3464, 29898, 29926, 1125, 13, 4706, 396, 462, 268, 565, 313, 29880, 29892, 413, 29897, 297, 16229, 29901, 13, 4706, 396, 462, 308, 16229, 29889, 5992, 3552, 29880, 29892, 413, 876, 13, 4706, 396, 308, 25342, 432, 1405, 2602, 29961, 29896, 29962, 322, 474, 1405, 2602, 29961, 29900, 5387, 13, 4706, 396, 632, 363, 301, 297, 3464, 29898, 29875, 718, 29871, 29896, 29892, 16641, 7811, 1125, 13, 4706, 396, 462, 363, 413, 297, 3464, 29898, 29926, 718, 29871, 29896, 29892, 4810, 8547, 1125, 13, 4706, 396, 462, 268, 565, 313, 29880, 29892, 413, 29897, 297, 16229, 29901, 13, 4706, 396, 462, 308, 16229, 29889, 5992, 3552, 29880, 29892, 413, 876, 13, 13, 4706, 736, 1051, 29898, 16773, 29918, 13529, 267, 29897, 13, 13, 1678, 396, 2041, 425, 4842, 276, 13, 1678, 822, 903, 17462, 29918, 29305, 29918, 12343, 346, 29898, 1311, 29892, 7613, 29892, 16229, 29892, 11706, 29918, 13529, 267, 1125, 13, 4706, 1781, 29918, 13529, 267, 353, 731, 580, 13, 4706, 363, 4337, 297, 16229, 29901, 13, 9651, 8424, 353, 7613, 29889, 657, 29918, 12343, 346, 29898, 11631, 29897, 13, 9651, 565, 8424, 29901, 13, 18884, 565, 8424, 29889, 2780, 2804, 1583, 29889, 2780, 322, 4337, 297, 11706, 29918, 13529, 267, 29901, 13, 462, 1678, 1781, 29918, 13529, 267, 29889, 1202, 29898, 11631, 29897, 13, 13, 18884, 2867, 13, 13, 9651, 565, 4337, 297, 11706, 29918, 13529, 267, 29901, 13, 18884, 1781, 29918, 13529, 267, 29889, 1202, 29898, 11631, 29897, 13, 4706, 736, 1781, 29918, 13529, 267, 13, 2 ]
extract.py
facebookresearch/banmo
201
1611344
<reponame>facebookresearch/banmo # Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. from absl import flags, app import sys sys.path.insert(0,'third_party') import numpy as np import torch import os import glob import pdb import cv2 import trimesh from scipy.spatial.transform import Rotation as R import imageio from utils.io import save_vid, str_to_frame, save_bones from utils.colors import label_colormap from nnutils.train_utils import v2s_trainer from nnutils.geom_utils import obj_to_cam, tensor2array, vec_to_sim3, obj_to_cam from ext_utils.util_flow import write_pfm from ext_utils.flowlib import cat_imgflo opts = flags.FLAGS def save_output(rendered_seq, aux_seq, seqname, save_flo): save_dir = '%s/'%(opts.model_path.rsplit('/',1)[0]) length = len(aux_seq['mesh']) mesh_rest = aux_seq['mesh_rest'] len_max = (mesh_rest.vertices.max(0) - mesh_rest.vertices.min(0)).max() mesh_rest.export('%s/mesh-rest.obj'%save_dir) if 'mesh_rest_skin' in aux_seq.keys(): aux_seq['mesh_rest_skin'].export('%s/mesh-rest-skin.obj'%save_dir) if 'bone_rest' in aux_seq.keys(): bone_rest = aux_seq['bone_rest'] save_bones(bone_rest, len_max, '%s/bone-rest.obj'%save_dir) flo_gt_vid = [] flo_p_vid = [] for i in range(length): impath = aux_seq['impath'][i] seqname = impath.split('/')[-2] save_prefix = '%s/%s'%(save_dir,seqname) idx = int(impath.split('/')[-1].split('.')[-2]) mesh = aux_seq['mesh'][i] rtk = aux_seq['rtk'][i] # convert bones to meshes TODO: warp with a function if 'bone' in aux_seq.keys() and len(aux_seq['bone'])>0: bones = aux_seq['bone'][i] bone_path = '%s-bone-%05d.obj'%(save_prefix, idx) save_bones(bones, len_max, bone_path) mesh.export('%s-mesh-%05d.obj'%(save_prefix, idx)) np.savetxt('%s-cam-%05d.txt' %(save_prefix, idx), rtk) img_gt = rendered_seq['img'][i] flo_gt = rendered_seq['flo'][i] mask_gt = rendered_seq['sil'][i][...,0] flo_gt[mask_gt<=0] = 0 img_gt[mask_gt<=0] = 1 if save_flo: img_gt = cat_imgflo(img_gt, flo_gt) else: img_gt*=255 cv2.imwrite('%s-img-gt-%05d.jpg'%(save_prefix, idx), img_gt[...,::-1]) flo_gt_vid.append(img_gt) img_p = rendered_seq['img_coarse'][i] flo_p = rendered_seq['flo_coarse'][i] mask_gt = cv2.resize(mask_gt, flo_p.shape[:2][::-1]).astype(bool) flo_p[mask_gt<=0] = 0 img_p[mask_gt<=0] = 1 if save_flo: img_p = cat_imgflo(img_p, flo_p) else: img_p*=255 cv2.imwrite('%s-img-p-%05d.jpg'%(save_prefix, idx), img_p[...,::-1]) flo_p_vid.append(img_p) flo_gt = cv2.resize(flo_gt, flo_p.shape[:2]) flo_err = np.linalg.norm( flo_p - flo_gt ,2,-1) flo_err_med = np.median(flo_err[mask_gt]) flo_err[~mask_gt] = 0. cv2.imwrite('%s-flo-err-%05d.jpg'%(save_prefix, idx), 128*flo_err/flo_err_med) img_gt = rendered_seq['img'][i] img_p = rendered_seq['img_coarse'][i] img_gt = cv2.resize(img_gt, img_p.shape[:2][::-1]) img_err = np.power(img_gt - img_p,2).sum(-1) img_err_med = np.median(img_err[mask_gt]) img_err[~mask_gt] = 0. cv2.imwrite('%s-img-err-%05d.jpg'%(save_prefix, idx), 128*img_err/img_err_med) # fps = 1./(5./len(flo_p_vid)) upsample_frame = min(30, len(flo_p_vid)) save_vid('%s-img-p' %(save_prefix), flo_p_vid, upsample_frame=upsample_frame) save_vid('%s-img-gt' %(save_prefix),flo_gt_vid,upsample_frame=upsample_frame) def transform_shape(mesh,rtk): """ (deprecated): absorb rt into mesh vertices, """ vertices = torch.Tensor(mesh.vertices) Rmat = torch.Tensor(rtk[:3,:3]) Tmat = torch.Tensor(rtk[:3,3]) vertices = obj_to_cam(vertices, Rmat, Tmat) rtk[:3,:3] = np.eye(3) rtk[:3,3] = 0. mesh = trimesh.Trimesh(vertices.numpy(), mesh.faces) return mesh, rtk def main(_): trainer = v2s_trainer(opts, is_eval=True) data_info = trainer.init_dataset() trainer.define_model(data_info) seqname=opts.seqname dynamic_mesh = opts.flowbw or opts.lbs idx_render = str_to_frame(opts.test_frames, data_info) # idx_render[0] += 50 # idx_render[0] += 374 # idx_render[0] += 292 # idx_render[0] += 10 # idx_render[0] += 340 # idx_render[0] += 440 # idx_render[0] += 540 # idx_render[0] += 640 # idx_render[0] += trainer.model.data_offset[4]-4 + 37 # idx_render[0] += 36 trainer.model.img_size = opts.render_size chunk = opts.frame_chunk for i in range(0, len(idx_render), chunk): rendered_seq, aux_seq = trainer.eval(idx_render=idx_render[i:i+chunk], dynamic_mesh=dynamic_mesh) rendered_seq = tensor2array(rendered_seq) save_output(rendered_seq, aux_seq, seqname, save_flo=opts.use_corresp) #TODO merge the outputs if __name__ == '__main__': app.run(main)
[ 1, 529, 276, 1112, 420, 29958, 15445, 690, 2842, 29914, 2571, 4346, 13, 29937, 14187, 1266, 313, 29883, 29897, 13327, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 2178, 10462, 21676, 29889, 13, 13, 3166, 633, 2536, 1053, 13449, 29892, 623, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 5501, 22585, 29918, 22633, 1495, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 2897, 13, 5215, 13149, 13, 5215, 282, 2585, 13, 5215, 13850, 29906, 13, 5215, 534, 1355, 29882, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 9067, 1053, 9664, 362, 408, 390, 13, 5215, 1967, 601, 13, 13, 3166, 3667, 29879, 29889, 601, 1053, 4078, 29918, 8590, 29892, 851, 29918, 517, 29918, 2557, 29892, 4078, 29918, 29890, 2873, 13, 3166, 3667, 29879, 29889, 27703, 1053, 3858, 29918, 1054, 555, 481, 13, 3166, 302, 29876, 13239, 29889, 14968, 29918, 13239, 1053, 325, 29906, 29879, 29918, 3018, 4983, 13, 3166, 302, 29876, 13239, 29889, 479, 290, 29918, 13239, 1053, 5446, 29918, 517, 29918, 11108, 29892, 12489, 29906, 2378, 29892, 9649, 29918, 517, 29918, 3601, 29941, 29892, 5446, 29918, 517, 29918, 11108, 13, 3166, 1294, 29918, 13239, 29889, 4422, 29918, 1731, 1053, 2436, 29918, 7810, 29885, 13, 3166, 1294, 29918, 13239, 29889, 1731, 1982, 1053, 6635, 29918, 2492, 29888, 417, 29871, 13, 25707, 353, 13449, 29889, 18823, 10749, 13, 462, 13, 1753, 4078, 29918, 4905, 29898, 9482, 287, 29918, 11762, 29892, 3479, 29918, 11762, 29892, 19359, 978, 29892, 4078, 29918, 29888, 417, 1125, 13, 1678, 4078, 29918, 3972, 353, 14210, 29879, 22208, 29995, 29898, 25707, 29889, 4299, 29918, 2084, 29889, 2288, 2830, 11219, 742, 29896, 9601, 29900, 2314, 13, 1678, 3309, 353, 7431, 29898, 2993, 29918, 11762, 1839, 4467, 29882, 11287, 13, 1678, 27716, 29918, 5060, 353, 3479, 29918, 11762, 1839, 4467, 29882, 29918, 5060, 2033, 13, 1678, 7431, 29918, 3317, 353, 313, 4467, 29882, 29918, 5060, 29889, 1765, 1575, 29889, 3317, 29898, 29900, 29897, 448, 27716, 29918, 5060, 29889, 1765, 1575, 29889, 1195, 29898, 29900, 8106, 3317, 580, 13, 1678, 27716, 29918, 5060, 29889, 15843, 877, 29995, 29879, 29914, 4467, 29882, 29899, 5060, 29889, 5415, 29915, 29995, 7620, 29918, 3972, 29897, 13, 1678, 565, 525, 4467, 29882, 29918, 5060, 29918, 808, 262, 29915, 297, 3479, 29918, 11762, 29889, 8149, 7295, 13, 4706, 3479, 29918, 11762, 1839, 4467, 29882, 29918, 5060, 29918, 808, 262, 13359, 15843, 877, 29995, 29879, 29914, 4467, 29882, 29899, 5060, 29899, 808, 262, 29889, 5415, 29915, 29995, 7620, 29918, 3972, 29897, 13, 1678, 565, 525, 15933, 29918, 5060, 29915, 297, 3479, 29918, 11762, 29889, 8149, 7295, 13, 4706, 289, 650, 29918, 5060, 353, 3479, 29918, 11762, 1839, 15933, 29918, 5060, 2033, 13, 4706, 4078, 29918, 29890, 2873, 29898, 15933, 29918, 5060, 29892, 7431, 29918, 3317, 29892, 14210, 29879, 29914, 15933, 29899, 5060, 29889, 5415, 29915, 29995, 7620, 29918, 3972, 29897, 13, 13, 1678, 5685, 29918, 4141, 29918, 8590, 353, 5159, 13, 1678, 5685, 29918, 29886, 29918, 8590, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 2848, 1125, 13, 4706, 527, 2084, 353, 3479, 29918, 11762, 1839, 326, 2084, 2033, 29961, 29875, 29962, 13, 4706, 19359, 978, 353, 527, 2084, 29889, 5451, 11219, 1495, 14352, 29906, 29962, 13, 4706, 4078, 29918, 13506, 353, 14210, 29879, 22584, 29879, 29915, 29995, 29898, 7620, 29918, 3972, 29892, 11762, 978, 29897, 13, 4706, 22645, 353, 938, 29898, 326, 2084, 29889, 5451, 11219, 1495, 14352, 29896, 1822, 5451, 12839, 1495, 14352, 29906, 2314, 13, 4706, 27716, 353, 3479, 29918, 11762, 1839, 4467, 29882, 2033, 29961, 29875, 29962, 13, 4706, 364, 11178, 353, 3479, 29918, 11762, 1839, 2273, 29895, 2033, 29961, 29875, 29962, 13, 308, 13, 4706, 396, 3588, 289, 2873, 304, 4883, 13244, 14402, 29901, 1370, 29886, 411, 263, 740, 13, 4706, 565, 525, 15933, 29915, 297, 3479, 29918, 11762, 29889, 8149, 580, 322, 7431, 29898, 2993, 29918, 11762, 1839, 15933, 11287, 29958, 29900, 29901, 13, 9651, 289, 2873, 353, 3479, 29918, 11762, 1839, 15933, 2033, 29961, 29875, 29962, 13, 9651, 289, 650, 29918, 2084, 353, 14210, 29879, 29899, 15933, 19222, 29900, 29945, 29881, 29889, 5415, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 29897, 13, 9651, 4078, 29918, 29890, 2873, 29898, 29890, 2873, 29892, 7431, 29918, 3317, 29892, 289, 650, 29918, 2084, 29897, 13, 4706, 13, 4706, 27716, 29889, 15843, 877, 29995, 29879, 29899, 4467, 29882, 19222, 29900, 29945, 29881, 29889, 5415, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 876, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 877, 29995, 29879, 29899, 11108, 19222, 29900, 29945, 29881, 29889, 3945, 29915, 29871, 1273, 29898, 7620, 29918, 13506, 29892, 22645, 511, 364, 11178, 29897, 13, 632, 13, 4706, 10153, 29918, 4141, 353, 13751, 29918, 11762, 1839, 2492, 2033, 29961, 29875, 29962, 13, 4706, 5685, 29918, 4141, 353, 13751, 29918, 11762, 1839, 29888, 417, 2033, 29961, 29875, 29962, 13, 4706, 11105, 29918, 4141, 353, 13751, 29918, 11762, 1839, 25590, 2033, 29961, 29875, 3816, 16361, 29900, 29962, 13, 4706, 5685, 29918, 4141, 29961, 13168, 29918, 4141, 14065, 29900, 29962, 353, 29871, 29900, 13, 4706, 10153, 29918, 4141, 29961, 13168, 29918, 4141, 14065, 29900, 29962, 353, 29871, 29896, 13, 4706, 565, 4078, 29918, 29888, 417, 29901, 10153, 29918, 4141, 353, 6635, 29918, 2492, 29888, 417, 29898, 2492, 29918, 4141, 29892, 5685, 29918, 4141, 29897, 13, 4706, 1683, 29901, 10153, 29918, 4141, 29930, 29922, 29906, 29945, 29945, 13, 4706, 13850, 29906, 29889, 326, 3539, 877, 29995, 29879, 29899, 2492, 29899, 4141, 19222, 29900, 29945, 29881, 29889, 6173, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 511, 10153, 29918, 4141, 29961, 16361, 1057, 29899, 29896, 2314, 13, 4706, 5685, 29918, 4141, 29918, 8590, 29889, 4397, 29898, 2492, 29918, 4141, 29897, 13, 308, 13, 4706, 10153, 29918, 29886, 353, 13751, 29918, 11762, 1839, 2492, 29918, 1111, 7989, 2033, 29961, 29875, 29962, 13, 4706, 5685, 29918, 29886, 353, 13751, 29918, 11762, 1839, 29888, 417, 29918, 1111, 7989, 2033, 29961, 29875, 29962, 13, 4706, 11105, 29918, 4141, 353, 13850, 29906, 29889, 21476, 29898, 13168, 29918, 4141, 29892, 5685, 29918, 29886, 29889, 12181, 7503, 29906, 3816, 1057, 29899, 29896, 14664, 579, 668, 29898, 11227, 29897, 13, 4706, 5685, 29918, 29886, 29961, 13168, 29918, 4141, 14065, 29900, 29962, 353, 29871, 29900, 13, 4706, 10153, 29918, 29886, 29961, 13168, 29918, 4141, 14065, 29900, 29962, 353, 29871, 29896, 13, 4706, 565, 4078, 29918, 29888, 417, 29901, 10153, 29918, 29886, 353, 6635, 29918, 2492, 29888, 417, 29898, 2492, 29918, 29886, 29892, 5685, 29918, 29886, 29897, 13, 4706, 1683, 29901, 10153, 29918, 29886, 29930, 29922, 29906, 29945, 29945, 13, 4706, 13850, 29906, 29889, 326, 3539, 877, 29995, 29879, 29899, 2492, 29899, 29886, 19222, 29900, 29945, 29881, 29889, 6173, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 511, 10153, 29918, 29886, 29961, 16361, 1057, 29899, 29896, 2314, 13, 4706, 5685, 29918, 29886, 29918, 8590, 29889, 4397, 29898, 2492, 29918, 29886, 29897, 13, 13, 4706, 5685, 29918, 4141, 353, 13850, 29906, 29889, 21476, 29898, 29888, 417, 29918, 4141, 29892, 5685, 29918, 29886, 29889, 12181, 7503, 29906, 2314, 13, 4706, 5685, 29918, 3127, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 5685, 29918, 29886, 448, 5685, 29918, 4141, 1919, 29906, 6653, 29896, 29897, 13, 4706, 5685, 29918, 3127, 29918, 2168, 353, 7442, 29889, 2168, 713, 29898, 29888, 417, 29918, 3127, 29961, 13168, 29918, 4141, 2314, 13, 4706, 5685, 29918, 3127, 29961, 30022, 13168, 29918, 4141, 29962, 353, 29871, 29900, 29889, 13, 4706, 13850, 29906, 29889, 326, 3539, 877, 29995, 29879, 29899, 29888, 417, 29899, 3127, 19222, 29900, 29945, 29881, 29889, 6173, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 511, 29871, 13, 462, 29896, 29906, 29947, 29930, 29888, 417, 29918, 3127, 29914, 29888, 417, 29918, 3127, 29918, 2168, 29897, 13, 13, 4706, 10153, 29918, 4141, 353, 13751, 29918, 11762, 1839, 2492, 2033, 29961, 29875, 29962, 13, 4706, 10153, 29918, 29886, 353, 13751, 29918, 11762, 1839, 2492, 29918, 1111, 7989, 2033, 29961, 29875, 29962, 13, 4706, 10153, 29918, 4141, 353, 13850, 29906, 29889, 21476, 29898, 2492, 29918, 4141, 29892, 10153, 29918, 29886, 29889, 12181, 7503, 29906, 3816, 1057, 29899, 29896, 2314, 13, 4706, 10153, 29918, 3127, 353, 7442, 29889, 13519, 29898, 2492, 29918, 4141, 448, 10153, 29918, 29886, 29892, 29906, 467, 2083, 6278, 29896, 29897, 13, 4706, 10153, 29918, 3127, 29918, 2168, 353, 7442, 29889, 2168, 713, 29898, 2492, 29918, 3127, 29961, 13168, 29918, 4141, 2314, 13, 4706, 10153, 29918, 3127, 29961, 30022, 13168, 29918, 4141, 29962, 353, 29871, 29900, 29889, 13, 4706, 13850, 29906, 29889, 326, 3539, 877, 29995, 29879, 29899, 2492, 29899, 3127, 19222, 29900, 29945, 29881, 29889, 6173, 29915, 29995, 29898, 7620, 29918, 13506, 29892, 22645, 511, 29871, 13, 462, 29896, 29906, 29947, 29930, 2492, 29918, 3127, 29914, 2492, 29918, 3127, 29918, 2168, 29897, 13, 13, 13, 29937, 1678, 285, 567, 353, 29871, 29896, 6904, 29898, 29945, 6904, 2435, 29898, 29888, 417, 29918, 29886, 29918, 8590, 876, 13, 1678, 24081, 981, 29918, 2557, 353, 1375, 29898, 29941, 29900, 29892, 7431, 29898, 29888, 417, 29918, 29886, 29918, 8590, 876, 13, 1678, 4078, 29918, 8590, 877, 29995, 29879, 29899, 2492, 29899, 29886, 29915, 1273, 29898, 7620, 29918, 13506, 511, 5685, 29918, 29886, 29918, 8590, 29892, 24081, 981, 29918, 2557, 29922, 14340, 981, 29918, 2557, 29897, 13, 1678, 4078, 29918, 8590, 877, 29995, 29879, 29899, 2492, 29899, 4141, 29915, 1273, 29898, 7620, 29918, 13506, 511, 29888, 417, 29918, 4141, 29918, 8590, 29892, 14340, 981, 29918, 2557, 29922, 14340, 981, 29918, 2557, 29897, 13, 13, 1753, 4327, 29918, 12181, 29898, 4467, 29882, 29892, 2273, 29895, 1125, 13, 1678, 9995, 13, 1678, 313, 311, 17990, 630, 1125, 6425, 11831, 364, 29873, 964, 27716, 13791, 29892, 29871, 13, 1678, 9995, 13, 1678, 13791, 353, 4842, 305, 29889, 29911, 6073, 29898, 4467, 29882, 29889, 1765, 1575, 29897, 13, 1678, 390, 2922, 353, 4842, 305, 29889, 29911, 6073, 29898, 2273, 29895, 7503, 29941, 29892, 29901, 29941, 2314, 13, 1678, 323, 2922, 353, 4842, 305, 29889, 29911, 6073, 29898, 2273, 29895, 7503, 29941, 29892, 29941, 2314, 13, 1678, 13791, 353, 5446, 29918, 517, 29918, 11108, 29898, 1765, 1575, 29892, 390, 2922, 29892, 323, 2922, 29897, 13, 13, 1678, 364, 11178, 7503, 29941, 29892, 29901, 29941, 29962, 353, 7442, 29889, 1032, 29872, 29898, 29941, 29897, 13, 1678, 364, 11178, 7503, 29941, 29892, 29941, 29962, 353, 29871, 29900, 29889, 13, 1678, 27716, 353, 534, 1355, 29882, 29889, 2308, 1355, 29882, 29898, 1765, 1575, 29889, 23749, 3285, 27716, 29889, 8726, 29897, 13, 1678, 736, 27716, 29892, 364, 11178, 13, 13, 1753, 1667, 7373, 1125, 13, 1678, 1020, 4983, 353, 325, 29906, 29879, 29918, 3018, 4983, 29898, 25707, 29892, 338, 29918, 14513, 29922, 5574, 29897, 13, 1678, 848, 29918, 3888, 353, 1020, 4983, 29889, 2344, 29918, 24713, 580, 268, 13, 1678, 1020, 4983, 29889, 7922, 29918, 4299, 29898, 1272, 29918, 3888, 29897, 13, 1678, 19359, 978, 29922, 25707, 29889, 11762, 978, 13, 13, 1678, 7343, 29918, 4467, 29882, 353, 29111, 29889, 1731, 29890, 29893, 470, 29111, 29889, 29880, 5824, 13, 1678, 22645, 29918, 9482, 353, 851, 29918, 517, 29918, 2557, 29898, 25707, 29889, 1688, 29918, 19935, 29892, 848, 29918, 3888, 29897, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29945, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29941, 29955, 29946, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29906, 29929, 29906, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29896, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29941, 29946, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29946, 29946, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29945, 29946, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29953, 29946, 29900, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 1020, 4983, 29889, 4299, 29889, 1272, 29918, 10289, 29961, 29946, 29962, 29899, 29946, 718, 29871, 29941, 29955, 13, 29937, 1678, 22645, 29918, 9482, 29961, 29900, 29962, 4619, 29871, 29941, 29953, 13, 13, 1678, 1020, 4983, 29889, 4299, 29889, 2492, 29918, 2311, 353, 29111, 29889, 9482, 29918, 2311, 13, 1678, 19875, 353, 29111, 29889, 2557, 29918, 29812, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 13140, 29918, 9482, 511, 19875, 1125, 13, 4706, 13751, 29918, 11762, 29892, 3479, 29918, 11762, 353, 1020, 4983, 29889, 14513, 29898, 13140, 29918, 9482, 29922, 13140, 29918, 9482, 29961, 29875, 29901, 29875, 29974, 29812, 1402, 13, 462, 462, 632, 7343, 29918, 4467, 29882, 29922, 16626, 29918, 4467, 29882, 29897, 29871, 13, 4706, 13751, 29918, 11762, 353, 12489, 29906, 2378, 29898, 9482, 287, 29918, 11762, 29897, 13, 4706, 4078, 29918, 4905, 29898, 9482, 287, 29918, 11762, 29892, 3479, 29918, 11762, 29892, 19359, 978, 29892, 4078, 29918, 29888, 417, 29922, 25707, 29889, 1509, 29918, 2616, 13713, 29897, 13, 1678, 396, 4986, 3970, 10366, 278, 14391, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 623, 29889, 3389, 29898, 3396, 29897, 13, 2 ]
PersonalSite/projects/scripts/sudoku3.py
joeyuan19/flaming-bear
0
94497
<reponame>joeyuan19/flaming-bear<gh_stars>0 #!/bin/sh # sudoku3.py # SudokuSolver # # Created by <NAME> on 3/6/11. # Copyright 2011 __MyCompanyName__. All rights reserved. import time import sys def rowbyrow(): d = [] for i in range(9): x = INPUT_PROCESS(i) d.append(x) for k,i in enumerate(d): for j,c in enumerate(i): d[k][j] = int(c) return d def INPUT_PROCESS(i,u=False): while not u: x = INPUT(i) x, u = input_check(x,i) return x def INPUT(i): x = list(raw_input("Row " + str(i+1) + ":\n")) if ''.join(p for p in x) in ["Q","quit","q","Quit","QUIT"]: sys.exit(1) print(x) return x def input_check(x,i,u=False): while not u: x, u = entry_check(x,i) x, c = length_check(x,i) return x, u def length_check(x,i): while len(x) != 9: print("Invalid entry. Please enter the 9 entries from the indicated row using zeroes for blank entries:") x = INPUT(i) x, c = input_error(x,i) return x, c def entry_check(x,i,c = False,u = True): for p in x: try: h = int(p) except ValueError: print("Invalid entry. Each space must be an integer 0-9.") u = False return x,u return x, u def input_error(x,i): c = raw_input("Is this correct? (y/n)\n") while c == "n": print("Please input the row again: ") x = INPUT(i) x,c = input_check(x,i) return x,c def puzzprint(n): print '+ - - - + - - - + - - - +' for p in range(3): print '|', for i in range(3): print n[p][i], print '|', for i in range(3,6): print n[p][i], print '|', for i in range(6,9): print n[p][i], print '|' print '+ - - - + - - - + - - - +' for p in range(3,6): print '|', for i in range(3): print n[p][i], print '|', for i in range(3,6): print n[p][i], print '|', for i in range(6,9): print n[p][i], print '|' print '+ - - - + - - - + - - - +' for p in range(6,9): print '|', for i in range(3): print n[p][i], print '|', for i in range(3,6): print n[p][i], print '|', for i in range(6,9): print n[p][i], print '|' print '+ - - - + - - - + - - - +' ### Transforms def transpose(n): """Takes a list-style Matrix and gives back the transpose""" d = [[n[j][i] for j in range(len(n[0]))] for i in range(len(n))] return d def box(n): d = [[] for i in range(len(n))] m = 0 for Q in range(len(n)): if 18 <= m < 27: if 24 <= m < 27: for i in range(6,9): m = m + 1 for c in range(6,9): d[Q].append(n[i][c]) elif 21 <= m < 24: for i in range(3,6): m = m + 1 for c in range(6,9): d[Q].append(n[i][c]) elif 18 <= m < 21: for i in range(3): m = m + 1 for c in range(6,9): d[Q].append(n[i][c]) elif 9 <= m < 18: if 15 <= m < 18: for i in range(6,9): m = m + 1 for c in range(3,6): d[Q].append(n[i][c]) elif 12 <= m < 15: for i in range(3,6): m = m + 1 for c in range(3,6): d[Q].append(n[i][c]) elif 9 <= m < 12: for i in range(3): m = m + 1 for c in range(3,6): d[Q].append(n[i][c]) elif m < 9: if 6 <= m < 9: for i in range(6,9): m = m + 1 for c in range(3): d[Q].append(n[i][c]) elif 3 <= m < 6: for i in range(3,6): m = m + 1 for c in range(3): d[Q].append(n[i][c]) elif m < 3: for i in range(3): m = m + 1 for c in range(3): d[Q].append(n[i][c]) return d ### useful functions def ld(x, y): pos = [i for i in x if i not in y] return pos def solved(n): # Checks if each position has been made into an integer d = 0 for i in n: for c in i: if not type(c) == int: d = d + 1 if d == 0: return True else: return False def linecheck(n): for k,i in enumerate(n): for j,c in enumerate(i): if type(c) == list: n[k][j] = ld(c,i) return n def single(puzzle): # Goes line by line finding variables then tests each possibility in a # list of variables then takes each possibility and checks to see # if that is the only variable spot in which that possibility appears. for line_index, line in enumerate(puzzle): for variable_index, variable1 in enumerate(line): if type(variable1) == list: for possibility in variable1: count = 0 for variable2 in line: if type(variable2) == list: if possibility in variable2: count = count + 1 if count > 1: break if count == 1: puzzle[line_index][variable_index] = possibility break return puzzle def confirm(n): # replaces the variables that have been knocked down to one possibility for k,i in enumerate(n): for j,c in enumerate(i): if type(c) == list: if len(c) == 1: n[k][j] = int(c[0]) return n def step(n): # checks lines, eliminating variables and singularities n = linecheck(n) n = single(n) n = confirm(n) return n def rc(n): # column then row for w in range(2): n = transpose(n) n = step(n) return n def boxxy(n): # box n = box(n) n = step(n) n = box(box(n)) return n def solve(n): n = rc(n) n = boxxy(n) n = confirm(n) return n def var(n,t=0): # Gives coordinates for spot with the least number of variables. vc = [] v = [] for x1,line in enumerate(n): for x2,nums in enumerate(line): if type(nums) == list: vc.append([len(nums),[x1,x2]]) if len(nums) == 2: return [len(nums),[x1,x2]] vc.sort() m = vc[t] return m def bruteforce1(n,xfs): # First Brute force, this method does not incude a backtracking # function as it is the first place for a source of error. # Finds the variable with the lowest number of possiblities # cycles through the variables until the correct one has been found. m = var(n) for i in range(m[0]): n[m[1][0]][m[1][1]] = n[m[1][0]][m[1][1]][i] u = False while not solved(n): n1 = n n = solve(n) if bfcondition(n): # Backtrack: error raised n = xfs[-1] m = var(n) break if n == n1: n2 = failsafe(n) xfs.append(n2) n, u = bruteforce2(n,xfs) if solved(n): break m = var(n) if solved(n): break return n def bruteforce2(n,xfs): # Finds the variable with the lowest number of possiblities # cycles through the variables until the correct one has been found. m = var(n) for i in range(m[0]): n[m[1][0]][m[1][1]] = n[m[1][0]][m[1][1]][i] u = False while not solved(n): n1 = n n = solve(n) if bfcondition(n): # backtrack: error raised n = xfs[-1] m = var(n) break elif n == n1: # New forced solution needed n2 = failsafe(n) xfs.append(n2) n, u = bruteforce2(n,xfs) if solved(n): break elif bfcondition(n): n = xfs[-1] m = var(n) break if u: break if solved(n): break if solved(n): return n, True elif not bfcondition(n): f = xfs[-1] xfs.pop() return f, False else: return n, True def bfcondition(n): for i in n: for c in i: if c == []: return True for i in n: for c in i: if type(c) == int: if i.count(c) > 1: return True for i in box(n): for c in i: if type(c) == int: if i.count(c) > 1: return True for i in transpose(n): for c in i: if type(c) == int: if i.count(c) > 1: return True return False def failsafe(n): # Recreates list from scratch so that the failsafe does not get redefined later. n1 = [i for i in n] return n1 def puzzle_setup(x,v): xc = [i for i in range(1,10)] if v: print "Here's your puzzle:\n" puzzprint(x) xgrid = [] for i in range(9): dc = [] for i in range(9): dc.append(xc) xgrid.append(dc) for i in range(9): for p,c in enumerate(x[i]): if c != 0: xgrid[i][p] = c return xgrid def solve_puzzle(xgrid,v=False): xgrid = puzzle_setup(xgrid,v) start = time.clock() t = 0 while not solved(xgrid): xgrid1 = failsafe(xgrid) xgrid = solve(xgrid) if xgrid == xgrid1: xgrid2 = failsafe(xgrid) xfs = [xgrid2] xgrid = bruteforce1(xgrid,xfs) end = time.clock() t = end - start return t,xgrid ### RUNNING PORTION ### if __name__ == "__main__": print("Welcome!") print("This program solves Sudoku problems \n") print("Enter the digits in your puzzle row by row.") print("At anytime hitting enter is ok instead of typing yes(y).\n") print("Typing quit during the input process will end the program.") print("Type a digit for a digit and a 0 (zero) for a blank entry: ") exit = "y" while exit != "n": x = rowbyrow() t,xgrid = solve_puzzle(x) print "You're puzzle has been solved!\n" print "It took " + str(t) + " secs." puzzprint(xgrid) print '\n' exit = raw_input("Another puzzle? (y/n): ")
[ 1, 529, 276, 1112, 420, 29958, 2212, 1032, 12323, 29896, 29929, 29914, 1579, 11500, 29899, 29890, 799, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 2109, 29914, 845, 13, 13, 29937, 5053, 9154, 29941, 29889, 2272, 13, 29937, 8383, 9154, 13296, 369, 13, 29937, 13, 29937, 6760, 630, 491, 529, 5813, 29958, 373, 29871, 29941, 29914, 29953, 29914, 29896, 29896, 29889, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29896, 4770, 3421, 21410, 1170, 26914, 2178, 10462, 21676, 29889, 13, 13, 5215, 931, 13, 5215, 10876, 13, 13, 1753, 1948, 1609, 798, 7295, 13, 1678, 270, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 29929, 1125, 13, 4706, 921, 353, 2672, 12336, 29918, 8618, 23524, 29898, 29875, 29897, 13, 4706, 270, 29889, 4397, 29898, 29916, 29897, 13, 1678, 363, 413, 29892, 29875, 297, 26985, 29898, 29881, 1125, 13, 4706, 363, 432, 29892, 29883, 297, 26985, 29898, 29875, 1125, 13, 18884, 270, 29961, 29895, 3816, 29926, 29962, 353, 938, 29898, 29883, 29897, 13, 1678, 736, 270, 13, 13, 1753, 2672, 12336, 29918, 8618, 23524, 29898, 29875, 29892, 29884, 29922, 8824, 1125, 13, 1678, 1550, 451, 318, 29901, 13, 4706, 921, 353, 2672, 12336, 29898, 29875, 29897, 13, 4706, 921, 29892, 318, 353, 1881, 29918, 3198, 29898, 29916, 29892, 29875, 29897, 13, 1678, 736, 921, 13, 13, 1753, 2672, 12336, 29898, 29875, 1125, 13, 1678, 921, 353, 1051, 29898, 1610, 29918, 2080, 703, 4301, 376, 718, 851, 29898, 29875, 29974, 29896, 29897, 718, 376, 3583, 29876, 5783, 13, 1678, 565, 525, 4286, 7122, 29898, 29886, 363, 282, 297, 921, 29897, 297, 6796, 29984, 3284, 28358, 3284, 29939, 3284, 2182, 277, 3284, 13356, 1806, 3108, 29901, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 1678, 1596, 29898, 29916, 29897, 13, 1678, 736, 921, 13, 13, 1753, 1881, 29918, 3198, 29898, 29916, 29892, 29875, 29892, 29884, 29922, 8824, 1125, 13, 1678, 1550, 451, 318, 29901, 13, 4706, 921, 29892, 318, 353, 6251, 29918, 3198, 29898, 29916, 29892, 29875, 29897, 13, 1678, 921, 29892, 274, 353, 3309, 29918, 3198, 29898, 29916, 29892, 29875, 29897, 13, 1678, 736, 921, 29892, 318, 13, 13, 1753, 3309, 29918, 3198, 29898, 29916, 29892, 29875, 1125, 13, 1678, 1550, 7431, 29898, 29916, 29897, 2804, 29871, 29929, 29901, 13, 4706, 1596, 703, 13919, 6251, 29889, 3529, 3896, 278, 29871, 29929, 9976, 515, 278, 18694, 1948, 773, 5225, 267, 363, 9654, 9976, 29901, 1159, 13, 4706, 921, 353, 2672, 12336, 29898, 29875, 29897, 13, 1678, 921, 29892, 274, 353, 1881, 29918, 2704, 29898, 29916, 29892, 29875, 29897, 13, 1678, 736, 921, 29892, 274, 13, 13, 1753, 6251, 29918, 3198, 29898, 29916, 29892, 29875, 29892, 29883, 353, 7700, 29892, 29884, 353, 5852, 1125, 13, 1678, 363, 282, 297, 921, 29901, 13, 4706, 1018, 29901, 13, 9651, 298, 353, 938, 29898, 29886, 29897, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 1596, 703, 13919, 6251, 29889, 7806, 2913, 1818, 367, 385, 6043, 29871, 29900, 29899, 29929, 23157, 13, 9651, 318, 353, 7700, 13, 9651, 736, 921, 29892, 29884, 13, 1678, 736, 921, 29892, 318, 13, 13, 1753, 1881, 29918, 2704, 29898, 29916, 29892, 29875, 1125, 13, 1678, 274, 353, 10650, 29918, 2080, 703, 3624, 445, 1959, 29973, 313, 29891, 29914, 29876, 2144, 29876, 1159, 13, 1678, 1550, 274, 1275, 376, 29876, 1115, 13, 4706, 1596, 703, 12148, 1881, 278, 1948, 1449, 29901, 16521, 13, 4706, 921, 353, 2672, 12336, 29898, 29875, 29897, 13, 4706, 921, 29892, 29883, 353, 1881, 29918, 3198, 29898, 29916, 29892, 29875, 29897, 13, 1678, 736, 921, 29892, 29883, 13, 13, 1753, 20285, 2158, 29898, 29876, 1125, 13, 1678, 1596, 525, 29974, 448, 448, 448, 718, 448, 448, 448, 718, 448, 448, 448, 718, 29915, 13, 1678, 363, 282, 297, 3464, 29898, 29941, 1125, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 29915, 13, 1678, 1596, 525, 29974, 448, 448, 448, 718, 448, 448, 448, 718, 448, 448, 448, 718, 29915, 13, 1678, 363, 282, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 29915, 13, 1678, 1596, 525, 29974, 448, 448, 448, 718, 448, 448, 448, 718, 448, 448, 448, 718, 29915, 13, 1678, 363, 282, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 742, 13, 4706, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 9651, 1596, 302, 29961, 29886, 3816, 29875, 1402, 13, 4706, 1596, 525, 29989, 29915, 13, 1678, 1596, 525, 29974, 448, 448, 448, 718, 448, 448, 448, 718, 448, 448, 448, 718, 29915, 13, 13, 2277, 29937, 4103, 9514, 13, 13, 1753, 1301, 4220, 29898, 29876, 1125, 13, 1678, 9995, 29911, 6926, 263, 1051, 29899, 3293, 22513, 322, 4076, 1250, 278, 1301, 4220, 15945, 29908, 13, 1678, 270, 353, 5519, 29876, 29961, 29926, 3816, 29875, 29962, 363, 432, 297, 3464, 29898, 2435, 29898, 29876, 29961, 29900, 12622, 29962, 363, 474, 297, 3464, 29898, 2435, 29898, 29876, 28166, 13, 1678, 736, 270, 13, 13, 1753, 3800, 29898, 29876, 1125, 13, 1678, 270, 353, 518, 2636, 363, 474, 297, 3464, 29898, 2435, 29898, 29876, 28166, 13, 1678, 286, 353, 29871, 29900, 13, 1678, 363, 660, 297, 3464, 29898, 2435, 29898, 29876, 22164, 13, 4706, 565, 29871, 29896, 29947, 5277, 286, 529, 29871, 29906, 29955, 29901, 13, 9651, 565, 29871, 29906, 29946, 5277, 286, 529, 29871, 29906, 29955, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 9651, 25342, 29871, 29906, 29896, 5277, 286, 529, 29871, 29906, 29946, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 9651, 25342, 29871, 29896, 29947, 5277, 286, 529, 29871, 29906, 29896, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 29871, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 4706, 25342, 29871, 29929, 5277, 286, 529, 29871, 29896, 29947, 29901, 13, 9651, 565, 29871, 29896, 29945, 5277, 286, 529, 29871, 29896, 29947, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 308, 13, 9651, 25342, 29871, 29896, 29906, 5277, 286, 529, 29871, 29896, 29945, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 9651, 25342, 29871, 29929, 5277, 286, 529, 29871, 29896, 29906, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 4706, 25342, 286, 529, 29871, 29929, 29901, 13, 9651, 565, 29871, 29953, 5277, 286, 529, 29871, 29929, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29953, 29892, 29929, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 9651, 25342, 29871, 29941, 5277, 286, 529, 29871, 29953, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 29892, 29953, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 1125, 13, 462, 9651, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 9651, 25342, 286, 529, 29871, 29941, 29901, 13, 18884, 363, 474, 297, 3464, 29898, 29941, 1125, 13, 462, 1678, 286, 353, 286, 718, 29871, 29896, 13, 462, 1678, 363, 274, 297, 3464, 29898, 29941, 1125, 13, 462, 4706, 270, 29961, 29984, 1822, 4397, 29898, 29876, 29961, 29875, 3816, 29883, 2314, 13, 632, 13, 1678, 736, 270, 13, 13, 2277, 29937, 5407, 3168, 13, 13, 1753, 301, 29881, 29898, 29916, 29892, 343, 1125, 13, 1678, 926, 353, 518, 29875, 363, 474, 297, 921, 565, 474, 451, 297, 343, 29962, 13, 1678, 736, 926, 13, 13, 13, 29871, 13, 1753, 7484, 29898, 29876, 1125, 13, 1678, 396, 5399, 29879, 565, 1269, 2602, 756, 1063, 1754, 964, 385, 6043, 13, 1678, 270, 353, 29871, 29900, 13, 1678, 363, 474, 297, 302, 29901, 13, 4706, 363, 274, 297, 474, 29901, 13, 9651, 565, 451, 1134, 29898, 29883, 29897, 1275, 938, 29901, 13, 18884, 270, 353, 270, 718, 29871, 29896, 13, 1678, 565, 270, 1275, 29871, 29900, 29901, 13, 4706, 736, 5852, 13, 1678, 1683, 29901, 13, 4706, 736, 7700, 13, 13, 13, 1753, 1196, 3198, 29898, 29876, 1125, 13, 1678, 363, 413, 29892, 29875, 297, 26985, 29898, 29876, 1125, 13, 4706, 363, 432, 29892, 29883, 297, 26985, 29898, 29875, 1125, 13, 9651, 565, 1134, 29898, 29883, 29897, 1275, 1051, 29901, 13, 18884, 302, 29961, 29895, 3816, 29926, 29962, 353, 301, 29881, 29898, 29883, 29892, 29875, 29897, 13, 1678, 736, 302, 13, 13, 1753, 2323, 29898, 29886, 18813, 280, 1125, 13, 1678, 396, 2921, 267, 1196, 491, 1196, 9138, 3651, 769, 6987, 1269, 13331, 297, 263, 13, 1678, 396, 1051, 310, 3651, 769, 4893, 1269, 13331, 322, 12747, 304, 1074, 13, 1678, 396, 565, 393, 338, 278, 871, 2286, 9758, 297, 607, 393, 13331, 5692, 29889, 13, 1678, 363, 1196, 29918, 2248, 29892, 1196, 297, 26985, 29898, 29886, 18813, 280, 1125, 13, 4706, 363, 2286, 29918, 2248, 29892, 2286, 29896, 297, 26985, 29898, 1220, 1125, 13, 9651, 565, 1134, 29898, 11918, 29896, 29897, 1275, 1051, 29901, 13, 18884, 363, 13331, 297, 2286, 29896, 29901, 13, 462, 1678, 2302, 353, 29871, 29900, 13, 462, 1678, 363, 2286, 29906, 297, 1196, 29901, 13, 462, 4706, 565, 1134, 29898, 11918, 29906, 29897, 1275, 1051, 29901, 13, 462, 9651, 565, 13331, 297, 2286, 29906, 29901, 13, 462, 18884, 2302, 353, 2302, 718, 29871, 29896, 13, 462, 18884, 565, 2302, 1405, 29871, 29896, 29901, 2867, 13, 462, 1678, 565, 2302, 1275, 29871, 29896, 29901, 13, 462, 4706, 20285, 280, 29961, 1220, 29918, 2248, 3816, 11918, 29918, 2248, 29962, 353, 13331, 13, 462, 4706, 2867, 13, 1678, 736, 20285, 280, 13, 13, 1753, 9659, 29898, 29876, 1125, 13, 1678, 396, 1634, 6048, 278, 3651, 393, 505, 1063, 18232, 287, 1623, 304, 697, 13331, 13, 1678, 363, 413, 29892, 29875, 297, 26985, 29898, 29876, 1125, 13, 4706, 363, 432, 29892, 29883, 297, 26985, 29898, 29875, 1125, 13, 9651, 565, 1134, 29898, 29883, 29897, 1275, 1051, 29901, 13, 18884, 565, 7431, 29898, 29883, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 302, 29961, 29895, 3816, 29926, 29962, 353, 938, 29898, 29883, 29961, 29900, 2314, 13, 1678, 736, 302, 13, 13, 1753, 4331, 29898, 29876, 1125, 13, 1678, 396, 12747, 3454, 29892, 10397, 1218, 3651, 322, 13512, 1907, 13, 1678, 302, 353, 1196, 3198, 29898, 29876, 29897, 13, 1678, 302, 353, 2323, 29898, 29876, 29897, 13, 1678, 302, 353, 9659, 29898, 29876, 29897, 13, 1678, 736, 302, 13, 268, 13, 1753, 364, 29883, 29898, 29876, 1125, 13, 1678, 396, 1897, 769, 1948, 13, 1678, 363, 281, 297, 3464, 29898, 29906, 1125, 13, 4706, 302, 353, 1301, 4220, 29898, 29876, 29897, 13, 4706, 302, 353, 4331, 29898, 29876, 29897, 13, 1678, 736, 302, 13, 268, 13, 1753, 3800, 3594, 29898, 29876, 1125, 13, 1678, 396, 3800, 13, 1678, 302, 353, 3800, 29898, 29876, 29897, 13, 1678, 302, 353, 4331, 29898, 29876, 29897, 13, 1678, 302, 353, 3800, 29898, 1884, 29898, 29876, 876, 13, 1678, 736, 302, 13, 268, 13, 1753, 4505, 29898, 29876, 1125, 13, 1678, 302, 353, 364, 29883, 29898, 29876, 29897, 13, 1678, 302, 353, 3800, 3594, 29898, 29876, 29897, 13, 1678, 302, 353, 9659, 29898, 29876, 29897, 13, 1678, 736, 302, 13, 268, 13, 1753, 722, 29898, 29876, 29892, 29873, 29922, 29900, 1125, 13, 1678, 396, 402, 3145, 10350, 363, 9758, 411, 278, 3203, 1353, 310, 3651, 29889, 13, 1678, 325, 29883, 353, 5159, 13, 1678, 325, 353, 5159, 13, 1678, 363, 921, 29896, 29892, 1220, 297, 26985, 29898, 29876, 1125, 13, 4706, 363, 921, 29906, 29892, 1949, 29879, 297, 26985, 29898, 1220, 1125, 13, 9651, 565, 1134, 29898, 1949, 29879, 29897, 1275, 1051, 29901, 13, 18884, 325, 29883, 29889, 4397, 4197, 2435, 29898, 1949, 29879, 511, 29961, 29916, 29896, 29892, 29916, 29906, 24960, 13, 18884, 565, 7431, 29898, 1949, 29879, 29897, 1275, 29871, 29906, 29901, 13, 462, 1678, 736, 518, 2435, 29898, 1949, 29879, 511, 29961, 29916, 29896, 29892, 29916, 29906, 5262, 13, 1678, 325, 29883, 29889, 6605, 580, 13, 1678, 286, 353, 325, 29883, 29961, 29873, 29962, 13, 1678, 736, 286, 13, 308, 13, 1753, 1506, 1082, 10118, 29896, 29898, 29876, 29892, 29916, 5847, 1125, 13, 1678, 396, 3824, 1771, 1082, 4889, 29892, 445, 1158, 947, 451, 5528, 1151, 263, 1250, 11294, 292, 29871, 13, 1678, 396, 740, 408, 372, 338, 278, 937, 2058, 363, 263, 2752, 310, 1059, 29889, 13, 1678, 396, 10987, 29879, 278, 2286, 411, 278, 19604, 1353, 310, 6458, 29880, 1907, 13, 1678, 396, 25785, 1549, 278, 3651, 2745, 278, 1959, 697, 756, 1063, 1476, 29889, 13, 1678, 286, 353, 722, 29898, 29876, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29885, 29961, 29900, 29962, 1125, 13, 4706, 302, 29961, 29885, 29961, 29896, 3816, 29900, 29962, 3816, 29885, 29961, 29896, 3816, 29896, 5262, 353, 302, 29961, 29885, 29961, 29896, 3816, 29900, 29962, 3816, 29885, 29961, 29896, 3816, 29896, 29962, 3816, 29875, 29962, 13, 4706, 318, 353, 7700, 13, 4706, 1550, 451, 7484, 29898, 29876, 1125, 13, 9651, 302, 29896, 353, 302, 13, 9651, 302, 353, 4505, 29898, 29876, 29897, 13, 9651, 565, 289, 29888, 16122, 29898, 29876, 1125, 13, 18884, 396, 7437, 11294, 29901, 1059, 10425, 13, 18884, 302, 353, 921, 5847, 14352, 29896, 29962, 13, 18884, 286, 353, 722, 29898, 29876, 29897, 13, 18884, 2867, 13, 9651, 565, 302, 1275, 302, 29896, 29901, 13, 18884, 302, 29906, 353, 8465, 29874, 1725, 29898, 29876, 29897, 13, 18884, 921, 5847, 29889, 4397, 29898, 29876, 29906, 29897, 13, 18884, 302, 29892, 318, 353, 1506, 1082, 10118, 29906, 29898, 29876, 29892, 29916, 5847, 29897, 13, 18884, 565, 7484, 29898, 29876, 1125, 13, 462, 1678, 2867, 13, 18884, 286, 353, 722, 29898, 29876, 29897, 13, 4706, 565, 7484, 29898, 29876, 1125, 13, 9651, 2867, 13, 1678, 736, 302, 13, 268, 13, 1753, 1506, 1082, 10118, 29906, 29898, 29876, 29892, 29916, 5847, 1125, 13, 1678, 396, 10987, 29879, 278, 2286, 411, 278, 19604, 1353, 310, 6458, 29880, 1907, 13, 1678, 396, 25785, 1549, 278, 3651, 2745, 278, 1959, 697, 756, 1063, 1476, 29889, 13, 1678, 286, 353, 722, 29898, 29876, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29885, 29961, 29900, 29962, 1125, 13, 4706, 302, 29961, 29885, 29961, 29896, 3816, 29900, 29962, 3816, 29885, 29961, 29896, 3816, 29896, 5262, 353, 302, 29961, 29885, 29961, 29896, 3816, 29900, 29962, 3816, 29885, 29961, 29896, 3816, 29896, 29962, 3816, 29875, 29962, 13, 4706, 318, 353, 7700, 13, 4706, 1550, 451, 7484, 29898, 29876, 1125, 13, 9651, 302, 29896, 353, 302, 13, 9651, 302, 353, 4505, 29898, 29876, 29897, 13, 9651, 565, 289, 29888, 16122, 29898, 29876, 1125, 13, 18884, 396, 1250, 11294, 29901, 1059, 10425, 13, 18884, 302, 353, 921, 5847, 14352, 29896, 29962, 13, 18884, 286, 353, 722, 29898, 29876, 29897, 13, 18884, 2867, 13, 9651, 25342, 302, 1275, 302, 29896, 29901, 13, 18884, 396, 1570, 11826, 1650, 4312, 13, 18884, 302, 29906, 353, 8465, 29874, 1725, 29898, 29876, 29897, 13, 18884, 921, 5847, 29889, 4397, 29898, 29876, 29906, 29897, 13, 18884, 302, 29892, 318, 353, 1506, 1082, 10118, 29906, 29898, 29876, 29892, 29916, 5847, 29897, 13, 18884, 565, 7484, 29898, 29876, 1125, 13, 462, 1678, 2867, 13, 18884, 25342, 289, 29888, 16122, 29898, 29876, 1125, 13, 462, 1678, 302, 353, 921, 5847, 14352, 29896, 29962, 13, 462, 1678, 286, 353, 722, 29898, 29876, 29897, 13, 462, 1678, 2867, 13, 9651, 565, 318, 29901, 13, 18884, 2867, 13, 4706, 565, 7484, 29898, 29876, 1125, 13, 9651, 2867, 13, 1678, 565, 7484, 29898, 29876, 1125, 13, 4706, 736, 302, 29892, 5852, 13, 1678, 25342, 451, 289, 29888, 16122, 29898, 29876, 1125, 13, 4706, 285, 353, 921, 5847, 14352, 29896, 29962, 13, 4706, 921, 5847, 29889, 7323, 580, 13, 4706, 736, 285, 29892, 7700, 13, 1678, 1683, 29901, 13, 4706, 736, 302, 29892, 5852, 13, 308, 13, 1753, 289, 29888, 16122, 29898, 29876, 1125, 13, 1678, 363, 474, 297, 302, 29901, 13, 4706, 363, 274, 297, 474, 29901, 13, 9651, 565, 274, 1275, 5159, 29901, 13, 18884, 736, 5852, 13, 1678, 363, 474, 297, 302, 29901, 13, 4706, 363, 274, 297, 474, 29901, 13, 9651, 565, 1134, 29898, 29883, 29897, 1275, 938, 29901, 13, 18884, 565, 474, 29889, 2798, 29898, 29883, 29897, 1405, 29871, 29896, 29901, 13, 462, 1678, 736, 5852, 13, 1678, 363, 474, 297, 3800, 29898, 29876, 1125, 13, 4706, 363, 274, 297, 474, 29901, 13, 9651, 565, 1134, 29898, 29883, 29897, 1275, 938, 29901, 13, 18884, 565, 474, 29889, 2798, 29898, 29883, 29897, 1405, 29871, 29896, 29901, 13, 462, 1678, 736, 5852, 13, 1678, 363, 474, 297, 1301, 4220, 29898, 29876, 1125, 13, 4706, 363, 274, 297, 474, 29901, 13, 9651, 565, 1134, 29898, 29883, 29897, 1275, 938, 29901, 13, 18884, 565, 474, 29889, 2798, 29898, 29883, 29897, 1405, 29871, 29896, 29901, 13, 462, 1678, 736, 5852, 13, 1678, 736, 7700, 13, 13, 1753, 8465, 29874, 1725, 29898, 29876, 1125, 13, 1678, 396, 3599, 276, 1078, 1051, 515, 22728, 577, 393, 278, 8465, 29874, 1725, 947, 451, 679, 337, 12119, 2678, 29889, 13, 1678, 302, 29896, 353, 518, 29875, 363, 474, 297, 302, 29962, 13, 1678, 736, 302, 29896, 13, 13, 1753, 20285, 280, 29918, 14669, 29898, 29916, 29892, 29894, 1125, 13, 12, 21791, 353, 518, 29875, 363, 474, 297, 3464, 29898, 29896, 29892, 29896, 29900, 4638, 13, 12, 361, 325, 29901, 13, 12, 12, 2158, 376, 10605, 29915, 29879, 596, 20285, 280, 3583, 29876, 29908, 13, 12, 12, 29886, 18813, 2158, 29898, 29916, 29897, 13, 12, 29916, 7720, 353, 5159, 13, 12, 1454, 474, 297, 3464, 29898, 29929, 1125, 13, 12, 12, 13891, 353, 5159, 13, 12, 12, 1454, 474, 297, 3464, 29898, 29929, 1125, 13, 12, 12, 12, 13891, 29889, 4397, 29898, 21791, 29897, 13, 12, 12, 29916, 7720, 29889, 4397, 29898, 13891, 29897, 13, 12, 1454, 474, 297, 3464, 29898, 29929, 1125, 13, 12, 12, 1454, 282, 29892, 29883, 297, 26985, 29898, 29916, 29961, 29875, 29962, 1125, 13, 12, 12, 12, 361, 274, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 12, 29916, 7720, 29961, 29875, 3816, 29886, 29962, 353, 274, 13, 12, 2457, 921, 7720, 13, 268, 13, 1753, 4505, 29918, 29886, 18813, 280, 29898, 29916, 7720, 29892, 29894, 29922, 8824, 1125, 13, 12, 29916, 7720, 353, 20285, 280, 29918, 14669, 29898, 29916, 7720, 29892, 29894, 29897, 13, 12, 2962, 353, 931, 29889, 13058, 580, 13, 12, 29873, 353, 29871, 29900, 13, 12, 8000, 451, 7484, 29898, 29916, 7720, 1125, 13, 12, 12, 29916, 7720, 29896, 353, 8465, 29874, 1725, 29898, 29916, 7720, 29897, 13, 12, 12, 29916, 7720, 353, 4505, 29898, 29916, 7720, 29897, 13, 12, 12, 361, 921, 7720, 1275, 921, 7720, 29896, 29901, 13, 12, 12, 12, 29916, 7720, 29906, 353, 8465, 29874, 1725, 29898, 29916, 7720, 29897, 13, 12, 12, 12, 29916, 5847, 353, 518, 29916, 7720, 29906, 29962, 13, 12, 12, 12, 29916, 7720, 353, 1506, 1082, 10118, 29896, 29898, 29916, 7720, 29892, 29916, 5847, 29897, 13, 12, 355, 353, 931, 29889, 13058, 580, 13, 12, 29873, 353, 1095, 448, 1369, 13, 12, 2457, 260, 29892, 29916, 7720, 13, 13, 2277, 29937, 27694, 29940, 4214, 349, 8476, 2725, 835, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 2158, 703, 28862, 2763, 29991, 1159, 13, 12, 2158, 703, 4013, 1824, 24307, 8383, 9154, 4828, 320, 29876, 1159, 13, 12, 2158, 703, 10399, 278, 13340, 297, 596, 20285, 280, 1948, 491, 1948, 23157, 13, 12, 2158, 703, 4178, 738, 2230, 29425, 3896, 338, 3431, 2012, 310, 19229, 4874, 29898, 29891, 467, 29905, 29876, 1159, 13, 12, 2158, 703, 24933, 292, 23283, 2645, 278, 1881, 1889, 674, 1095, 278, 1824, 23157, 13, 12, 2158, 703, 1542, 263, 13615, 363, 263, 13615, 322, 263, 29871, 29900, 313, 9171, 29897, 363, 263, 9654, 6251, 29901, 16521, 13, 12, 13322, 353, 376, 29891, 29908, 13, 12, 8000, 6876, 2804, 376, 29876, 1115, 13, 12, 12, 29916, 353, 1948, 1609, 798, 580, 13, 12, 12, 29873, 29892, 29916, 7720, 353, 4505, 29918, 29886, 18813, 280, 29898, 29916, 29897, 13, 12, 12, 2158, 376, 3492, 29915, 276, 20285, 280, 756, 1063, 7484, 9903, 29876, 29908, 13, 12, 12, 2158, 376, 3112, 3614, 376, 718, 851, 29898, 29873, 29897, 718, 376, 409, 2395, 1213, 13, 12, 12, 29886, 18813, 2158, 29898, 29916, 7720, 29897, 13, 12, 12, 2158, 11297, 29876, 29915, 13, 308, 13, 12, 12, 13322, 353, 10650, 29918, 2080, 703, 2744, 1228, 20285, 280, 29973, 313, 29891, 29914, 29876, 1125, 16521, 13, 308, 13, 268, 13, 268, 13, 268, 13, 2 ]
classical/socialforce.py
JosephGesnouin/Asymmetrical-Bi-RNNs-to-encode-pedestrian-trajectories
9
105724
<reponame>JosephGesnouin/Asymmetrical-Bi-RNNs-to-encode-pedestrian-trajectories<filename>classical/socialforce.py import numpy as np from scipy.interpolate import interp1d import trajnetplusplustools import socialforce from socialforce.potentials import PedPedPotential from socialforce.fieldofview import FieldOfView def predict(input_paths, dest_dict=None, dest_type='interp', sf_params=[0.5, 2.1, 0.3], predict_all=True, n_predict=12, obs_length=9): pred_length = n_predict def init_states(input_paths, start_frame, dest_dict, dest_type): initial_state = [] for i, _ in enumerate(input_paths): path = input_paths[i] ped_id = path[0].pedestrian past_path = [t for t in path if t.frame <= start_frame] past_frames = [t.frame for t in path if t.frame <= start_frame] future_path = [t for t in path if t.frame > start_frame] len_path = len(past_path) ## To consider agent or not consider. if start_frame in past_frames: curr = past_path[-1] ## Velocity if len_path >= 4: stride = 3 prev = past_path[-4] else: stride = len_path - 1 prev = past_path[-len_path] [v_x, v_y] = vel_state(prev, curr, stride) ## Destination if dest_type == 'true': if dest_dict is not None: [d_x, d_y] = dest_dict[ped_id] else: raise ValueError elif dest_type == 'interp': [d_x, d_y] = dest_state(past_path, len_path) elif dest_type == 'vel': [d_x, d_y] = [pred_length*v_x, pred_length*v_y] elif dest_type == 'pred_end': [d_x, d_y] = [future_path[-1].x, future_path[-1].y] else: raise NotImplementedError ## Initialize State initial_state.append([curr.x, curr.y, v_x, v_y, d_x, d_y]) return np.array(initial_state) def vel_state(prev, curr, stride): if stride == 0: return [0, 0] diff = np.array([curr.x - prev.x, curr.y - prev.y]) theta = np.arctan2(diff[1], diff[0]) speed = np.linalg.norm(diff) / (stride * 0.4) return [speed*np.cos(theta), speed*np.sin(theta)] def dest_state(path, length): if length == 1: return [path[-1].x, path[-1].y] x = [t.x for t in path] y = [t.y for t in path] time = list(range(length)) f = interp1d(x=time, y=[x, y], fill_value='extrapolate') return f(time[-1] + pred_length) multimodal_outputs = {} primary = input_paths[0] neighbours_tracks = [] frame_diff = primary[1].frame - primary[0].frame start_frame = primary[obs_length-1].frame first_frame = primary[obs_length-1].frame + frame_diff # initialize initial_state = init_states(input_paths, start_frame, dest_dict, dest_type) fps = 20 sampling_rate = int(fps / 2.5) if len(initial_state) != 0: # run ped_ped = PedPedPotential(1./fps, v0=sf_params[1], sigma=sf_params[2]) field_of_view = FieldOfView() s = socialforce.Simulator(initial_state, ped_ped=ped_ped, field_of_view=field_of_view, delta_t=1./fps, tau=sf_params[0]) states = np.stack([s.step().state.copy() for _ in range(pred_length*sampling_rate)]) ## states : pred_length x num_ped x 7 states = np.array([s for num, s in enumerate(states) if num % sampling_rate == 0]) else: ## Stationary past_path = [t for t in input_paths[0] if t.frame == start_frame] states = np.stack([[[past_path[0].x, past_path[0].y]] for _ in range(pred_length)]) # predictions primary_track = states[:, 0, 0:2] neighbours_tracks = states[:, 1:, 0:2] ## Primary Prediction Only if not predict_all: neighbours_tracks = [] # Unimodal Prediction multimodal_outputs[0] = primary_track, neighbours_tracks return multimodal_outputs
[ 1, 529, 276, 1112, 420, 29958, 26473, 561, 29954, 267, 22897, 262, 29914, 2887, 962, 2527, 16888, 29899, 20517, 29899, 29934, 10262, 29879, 29899, 517, 29899, 12508, 29899, 9795, 342, 6392, 29899, 3018, 622, 3842, 29966, 9507, 29958, 1990, 936, 29914, 24911, 10118, 29889, 2272, 13, 5215, 12655, 408, 7442, 13, 3166, 4560, 2272, 29889, 1639, 3733, 403, 1053, 1006, 29886, 29896, 29881, 13, 13, 5215, 1020, 29926, 1212, 11242, 572, 504, 8789, 13, 13, 5215, 5264, 10118, 13, 3166, 5264, 10118, 29889, 17765, 9409, 1053, 9293, 29925, 287, 29925, 327, 2556, 13, 3166, 5264, 10118, 29889, 2671, 974, 1493, 1053, 8989, 2776, 1043, 13, 13, 1753, 8500, 29898, 2080, 29918, 24772, 29892, 2731, 29918, 8977, 29922, 8516, 29892, 2731, 29918, 1853, 2433, 1639, 29886, 742, 18668, 29918, 7529, 11759, 29900, 29889, 29945, 29892, 29871, 29906, 29889, 29896, 29892, 29871, 29900, 29889, 29941, 1402, 13, 9651, 8500, 29918, 497, 29922, 5574, 29892, 302, 29918, 27711, 29922, 29896, 29906, 29892, 20881, 29918, 2848, 29922, 29929, 1125, 13, 268, 13, 1678, 4450, 29918, 2848, 353, 302, 29918, 27711, 13, 13, 1678, 822, 2069, 29918, 28631, 29898, 2080, 29918, 24772, 29892, 1369, 29918, 2557, 29892, 2731, 29918, 8977, 29892, 2731, 29918, 1853, 1125, 13, 4706, 2847, 29918, 3859, 353, 5159, 13, 4706, 363, 474, 29892, 903, 297, 26985, 29898, 2080, 29918, 24772, 1125, 13, 9651, 2224, 353, 1881, 29918, 24772, 29961, 29875, 29962, 13, 9651, 8939, 29918, 333, 353, 2224, 29961, 29900, 1822, 9795, 342, 6392, 13, 9651, 4940, 29918, 2084, 353, 518, 29873, 363, 260, 297, 2224, 565, 260, 29889, 2557, 5277, 1369, 29918, 2557, 29962, 13, 9651, 4940, 29918, 19935, 353, 518, 29873, 29889, 2557, 363, 260, 297, 2224, 565, 260, 29889, 2557, 5277, 1369, 29918, 2557, 29962, 13, 9651, 5434, 29918, 2084, 353, 518, 29873, 363, 260, 297, 2224, 565, 260, 29889, 2557, 1405, 1369, 29918, 2557, 29962, 13, 9651, 7431, 29918, 2084, 353, 7431, 29898, 29886, 579, 29918, 2084, 29897, 13, 13, 9651, 444, 1763, 2050, 10823, 470, 451, 2050, 29889, 13, 9651, 565, 1369, 29918, 2557, 297, 4940, 29918, 19935, 29901, 13, 18884, 16256, 353, 4940, 29918, 2084, 14352, 29896, 29962, 13, 13, 18884, 444, 12019, 25245, 13, 18884, 565, 7431, 29918, 2084, 6736, 29871, 29946, 29901, 13, 462, 1678, 380, 2426, 353, 29871, 29941, 13, 462, 1678, 12379, 353, 4940, 29918, 2084, 14352, 29946, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 380, 2426, 353, 7431, 29918, 2084, 448, 29871, 29896, 13, 462, 1678, 12379, 353, 4940, 29918, 2084, 14352, 2435, 29918, 2084, 29962, 13, 18884, 518, 29894, 29918, 29916, 29892, 325, 29918, 29891, 29962, 353, 5343, 29918, 3859, 29898, 16304, 29892, 16256, 29892, 380, 2426, 29897, 13, 13, 18884, 444, 15435, 3381, 13, 18884, 565, 2731, 29918, 1853, 1275, 525, 3009, 2396, 13, 462, 1678, 565, 2731, 29918, 8977, 338, 451, 6213, 29901, 13, 462, 4706, 518, 29881, 29918, 29916, 29892, 270, 29918, 29891, 29962, 353, 2731, 29918, 8977, 29961, 9795, 29918, 333, 29962, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 12020, 7865, 2392, 13, 18884, 25342, 2731, 29918, 1853, 1275, 525, 1639, 29886, 2396, 13, 462, 1678, 518, 29881, 29918, 29916, 29892, 270, 29918, 29891, 29962, 353, 2731, 29918, 3859, 29898, 29886, 579, 29918, 2084, 29892, 7431, 29918, 2084, 29897, 13, 18884, 25342, 2731, 29918, 1853, 1275, 525, 955, 2396, 13, 462, 1678, 518, 29881, 29918, 29916, 29892, 270, 29918, 29891, 29962, 353, 518, 11965, 29918, 2848, 29930, 29894, 29918, 29916, 29892, 4450, 29918, 2848, 29930, 29894, 29918, 29891, 29962, 13, 18884, 25342, 2731, 29918, 1853, 1275, 525, 11965, 29918, 355, 2396, 13, 462, 1678, 518, 29881, 29918, 29916, 29892, 270, 29918, 29891, 29962, 353, 518, 29888, 9130, 29918, 2084, 14352, 29896, 1822, 29916, 29892, 5434, 29918, 2084, 14352, 29896, 1822, 29891, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 18884, 444, 25455, 4306, 13, 18884, 2847, 29918, 3859, 29889, 4397, 4197, 21962, 29889, 29916, 29892, 16256, 29889, 29891, 29892, 325, 29918, 29916, 29892, 325, 29918, 29891, 29892, 270, 29918, 29916, 29892, 270, 29918, 29891, 2314, 13, 4706, 736, 7442, 29889, 2378, 29898, 11228, 29918, 3859, 29897, 13, 13, 1678, 822, 5343, 29918, 3859, 29898, 16304, 29892, 16256, 29892, 380, 2426, 1125, 13, 4706, 565, 380, 2426, 1275, 29871, 29900, 29901, 13, 9651, 736, 518, 29900, 29892, 29871, 29900, 29962, 13, 4706, 2923, 353, 7442, 29889, 2378, 4197, 21962, 29889, 29916, 448, 12379, 29889, 29916, 29892, 16256, 29889, 29891, 448, 12379, 29889, 29891, 2314, 13, 4706, 278, 941, 353, 7442, 29889, 27014, 273, 29906, 29898, 12765, 29961, 29896, 1402, 2923, 29961, 29900, 2314, 13, 4706, 6210, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 12765, 29897, 847, 313, 303, 2426, 334, 29871, 29900, 29889, 29946, 29897, 13, 4706, 736, 518, 19322, 29930, 9302, 29889, 3944, 29898, 3416, 511, 6210, 29930, 9302, 29889, 5223, 29898, 3416, 4638, 13, 13, 1678, 822, 2731, 29918, 3859, 29898, 2084, 29892, 3309, 1125, 13, 4706, 565, 3309, 1275, 29871, 29896, 29901, 13, 9651, 736, 518, 2084, 14352, 29896, 1822, 29916, 29892, 2224, 14352, 29896, 1822, 29891, 29962, 13, 4706, 921, 353, 518, 29873, 29889, 29916, 363, 260, 297, 2224, 29962, 13, 4706, 343, 353, 518, 29873, 29889, 29891, 363, 260, 297, 2224, 29962, 13, 4706, 931, 353, 1051, 29898, 3881, 29898, 2848, 876, 13, 4706, 285, 353, 1006, 29886, 29896, 29881, 29898, 29916, 29922, 2230, 29892, 343, 11759, 29916, 29892, 343, 1402, 5445, 29918, 1767, 2433, 1062, 2390, 23167, 1495, 13, 4706, 736, 285, 29898, 2230, 14352, 29896, 29962, 718, 4450, 29918, 2848, 29897, 13, 13, 1678, 1773, 326, 397, 284, 29918, 4905, 29879, 353, 6571, 13, 1678, 7601, 353, 1881, 29918, 24772, 29961, 29900, 29962, 13, 1678, 22092, 2470, 29918, 3018, 4684, 353, 5159, 13, 1678, 3515, 29918, 12765, 353, 7601, 29961, 29896, 1822, 2557, 448, 7601, 29961, 29900, 1822, 2557, 13, 1678, 1369, 29918, 2557, 353, 7601, 29961, 26290, 29918, 2848, 29899, 29896, 1822, 2557, 13, 1678, 937, 29918, 2557, 353, 7601, 29961, 26290, 29918, 2848, 29899, 29896, 1822, 2557, 718, 3515, 29918, 12765, 13, 13, 1678, 396, 11905, 13, 1678, 2847, 29918, 3859, 353, 2069, 29918, 28631, 29898, 2080, 29918, 24772, 29892, 1369, 29918, 2557, 29892, 2731, 29918, 8977, 29892, 2731, 29918, 1853, 29897, 13, 13, 1678, 285, 567, 353, 29871, 29906, 29900, 13, 1678, 23460, 29918, 10492, 353, 938, 29898, 29888, 567, 847, 29871, 29906, 29889, 29945, 29897, 13, 13, 1678, 565, 7431, 29898, 11228, 29918, 3859, 29897, 2804, 29871, 29900, 29901, 13, 4706, 396, 1065, 259, 13, 4706, 8939, 29918, 9795, 353, 9293, 29925, 287, 29925, 327, 2556, 29898, 29896, 6904, 29888, 567, 29892, 325, 29900, 29922, 4668, 29918, 7529, 29961, 29896, 1402, 269, 2934, 29922, 4668, 29918, 7529, 29961, 29906, 2314, 13, 4706, 1746, 29918, 974, 29918, 1493, 353, 8989, 2776, 1043, 580, 13, 4706, 269, 353, 5264, 10118, 29889, 8942, 9183, 29898, 11228, 29918, 3859, 29892, 8939, 29918, 9795, 29922, 9795, 29918, 9795, 29892, 1746, 29918, 974, 29918, 1493, 29922, 2671, 29918, 974, 29918, 1493, 29892, 13, 462, 462, 29871, 19471, 29918, 29873, 29922, 29896, 6904, 29888, 567, 29892, 260, 585, 29922, 4668, 29918, 7529, 29961, 29900, 2314, 13, 4706, 5922, 353, 7442, 29889, 1429, 4197, 29879, 29889, 10568, 2141, 3859, 29889, 8552, 580, 363, 903, 297, 3464, 29898, 11965, 29918, 2848, 29930, 13445, 10335, 29918, 10492, 29897, 2314, 13, 4706, 444, 5922, 584, 4450, 29918, 2848, 921, 954, 29918, 9795, 921, 29871, 29955, 13, 4706, 5922, 353, 7442, 29889, 2378, 4197, 29879, 363, 954, 29892, 269, 297, 26985, 29898, 28631, 29897, 565, 954, 1273, 23460, 29918, 10492, 1275, 29871, 29900, 2314, 13, 1678, 1683, 29901, 13, 4706, 444, 12039, 653, 13, 4706, 4940, 29918, 2084, 353, 518, 29873, 363, 260, 297, 1881, 29918, 24772, 29961, 29900, 29962, 565, 260, 29889, 2557, 1275, 1369, 29918, 2557, 29962, 13, 4706, 5922, 353, 7442, 29889, 1429, 4197, 8999, 29886, 579, 29918, 2084, 29961, 29900, 1822, 29916, 29892, 4940, 29918, 2084, 29961, 29900, 1822, 29891, 5262, 363, 903, 297, 3464, 29898, 11965, 29918, 2848, 29897, 2314, 13, 13, 1678, 396, 27303, 13, 1678, 7601, 29918, 11294, 353, 5922, 7503, 29892, 29871, 29900, 29892, 29871, 29900, 29901, 29906, 29962, 13, 1678, 22092, 2470, 29918, 3018, 4684, 353, 5922, 7503, 29892, 29871, 29896, 29901, 29892, 29871, 29900, 29901, 29906, 29962, 13, 13, 1678, 444, 28267, 21099, 2463, 9333, 13, 1678, 565, 451, 8500, 29918, 497, 29901, 13, 4706, 22092, 2470, 29918, 3018, 4684, 353, 5159, 13, 13, 1678, 396, 853, 326, 397, 284, 21099, 2463, 13, 1678, 1773, 326, 397, 284, 29918, 4905, 29879, 29961, 29900, 29962, 353, 7601, 29918, 11294, 29892, 22092, 2470, 29918, 3018, 4684, 13, 1678, 736, 1773, 326, 397, 284, 29918, 4905, 29879, 13, 2 ]
pygem/openfhandler.py
endelgado/PyGeM
2
75454
""" Derived module from filehandler.py to handle OpenFOAM files. """ import numpy as np import pygem.filehandler as fh class OpenFoamHandler(fh.FileHandler): """ OpenFOAM mesh file handler class. :cvar string infile: name of the input file to be processed. :cvar string outfile: name of the output file where to write in. :cvar list extensions: extensions of the input/output files. It is equal to [''] since openFOAM files do not have extension. """ def __init__(self): super(OpenFoamHandler, self).__init__() self.extensions = [''] def parse(self, filename): """ Method to parse the `filename`. It returns a matrix with all the coordinates. :param string filename: name of the input file. :return: mesh_points: it is a `n_points`-by-3 matrix containing the coordinates of the points of the mesh :rtype: numpy.ndarray .. todo:: - specify when it works """ self._check_filename_type(filename) self._check_extension(filename) self.infile = filename nrow = 0 i = 0 with open(self.infile, 'r') as input_file: for line in input_file: nrow += 1 if nrow == 19: n_points = int(line) mesh_points = np.zeros(shape=(n_points, 3)) if 20 < nrow < 21 + n_points: line = line[line.index("(") + 1:line.rindex(")")] j = 0 for number in line.split(): mesh_points[i][j] = float(number) j += 1 i += 1 return mesh_points def write(self, mesh_points, filename): """ Writes a openFOAM file, called filename, copying all the lines from self.filename but the coordinates. mesh_points is a matrix that contains the new coordinates to write in the openFOAM file. :param numpy.ndarray mesh_points: it is a `n_points`-by-3 matrix containing the coordinates of the points of the mesh. :param string filename: name of the output file. .. todo:: DOCS """ self._check_filename_type(filename) self._check_extension(filename) self._check_infile_instantiation() self.outfile = filename n_points = mesh_points.shape[0] nrow = 0 i = 0 with open(self.infile, 'r') as input_file, open(self.outfile, 'w') as output_file: for line in input_file: nrow += 1 if 20 < nrow < 21 + n_points: output_file.write('(' + str(mesh_points[i][0]) + ' ' + str( mesh_points[i][1]) + ' ' + str(mesh_points[i][2]) + ')') output_file.write('\n') i += 1 else: output_file.write(line)
[ 1, 9995, 13, 15383, 2347, 3883, 515, 934, 13789, 29889, 2272, 304, 4386, 4673, 5800, 5194, 2066, 29889, 13, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 5215, 19484, 331, 29889, 1445, 13789, 408, 285, 29882, 13, 13, 13, 1990, 4673, 29943, 29877, 314, 4598, 29898, 29888, 29882, 29889, 2283, 4598, 1125, 13, 1678, 9995, 13, 1678, 4673, 5800, 5194, 27716, 934, 7834, 770, 29889, 13, 13, 1678, 584, 29883, 1707, 1347, 297, 1445, 29901, 1024, 310, 278, 1881, 934, 304, 367, 19356, 29889, 13, 1678, 584, 29883, 1707, 1347, 714, 1445, 29901, 1024, 310, 278, 1962, 934, 988, 304, 2436, 297, 29889, 13, 1678, 584, 29883, 1707, 1051, 17752, 29901, 17752, 310, 278, 1881, 29914, 4905, 2066, 29889, 739, 13, 4706, 338, 5186, 304, 6024, 2033, 1951, 1722, 5800, 5194, 2066, 437, 451, 505, 6081, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 6585, 29943, 29877, 314, 4598, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 24299, 353, 6024, 2033, 13, 13, 1678, 822, 6088, 29898, 1311, 29892, 10422, 1125, 13, 4706, 9995, 13, 4706, 8108, 304, 6088, 278, 421, 9507, 1412, 739, 3639, 263, 4636, 411, 599, 13, 4706, 278, 10350, 29889, 13, 13, 4706, 584, 3207, 1347, 10422, 29901, 1024, 310, 278, 1881, 934, 29889, 13, 308, 13, 4706, 584, 2457, 29901, 27716, 29918, 9748, 29901, 372, 338, 263, 421, 29876, 29918, 9748, 27969, 1609, 29899, 29941, 4636, 6943, 13, 9651, 278, 10350, 310, 278, 3291, 310, 278, 27716, 13, 4706, 584, 29878, 1853, 29901, 12655, 29889, 299, 2378, 13, 13, 4706, 6317, 10481, 1057, 13, 13, 9651, 448, 6084, 746, 372, 1736, 13, 4706, 9995, 13, 4706, 1583, 3032, 3198, 29918, 9507, 29918, 1853, 29898, 9507, 29897, 13, 4706, 1583, 3032, 3198, 29918, 17588, 29898, 9507, 29897, 13, 13, 4706, 1583, 29889, 262, 1445, 353, 10422, 13, 13, 4706, 302, 798, 353, 29871, 29900, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 411, 1722, 29898, 1311, 29889, 262, 1445, 29892, 525, 29878, 1495, 408, 1881, 29918, 1445, 29901, 13, 9651, 363, 1196, 297, 1881, 29918, 1445, 29901, 13, 18884, 302, 798, 4619, 29871, 29896, 13, 18884, 565, 302, 798, 1275, 29871, 29896, 29929, 29901, 13, 462, 1678, 302, 29918, 9748, 353, 938, 29898, 1220, 29897, 13, 462, 1678, 27716, 29918, 9748, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 29876, 29918, 9748, 29892, 29871, 29941, 876, 13, 18884, 565, 29871, 29906, 29900, 529, 302, 798, 529, 29871, 29906, 29896, 718, 302, 29918, 9748, 29901, 13, 462, 1678, 1196, 353, 1196, 29961, 1220, 29889, 2248, 703, 703, 29897, 718, 29871, 29896, 29901, 1220, 29889, 29878, 2248, 703, 29897, 13531, 13, 462, 1678, 432, 353, 29871, 29900, 13, 462, 1678, 363, 1353, 297, 1196, 29889, 5451, 7295, 13, 462, 4706, 27716, 29918, 9748, 29961, 29875, 3816, 29926, 29962, 353, 5785, 29898, 4537, 29897, 13, 462, 4706, 432, 4619, 29871, 29896, 13, 462, 1678, 474, 4619, 29871, 29896, 13, 13, 4706, 736, 27716, 29918, 9748, 13, 13, 1678, 822, 2436, 29898, 1311, 29892, 27716, 29918, 9748, 29892, 10422, 1125, 13, 4706, 9995, 13, 4706, 16849, 267, 263, 1722, 5800, 5194, 934, 29892, 2000, 10422, 29892, 17596, 599, 278, 13, 4706, 3454, 515, 1583, 29889, 9507, 541, 278, 10350, 29889, 27716, 29918, 9748, 13, 4706, 338, 263, 4636, 393, 3743, 278, 716, 10350, 304, 2436, 297, 13, 4706, 278, 1722, 5800, 5194, 934, 29889, 13, 13, 4706, 584, 3207, 12655, 29889, 299, 2378, 27716, 29918, 9748, 29901, 372, 338, 263, 421, 29876, 29918, 9748, 27969, 1609, 29899, 29941, 13, 9651, 4636, 6943, 278, 10350, 310, 278, 3291, 310, 278, 27716, 29889, 13, 4706, 584, 3207, 1347, 10422, 29901, 1024, 310, 278, 1962, 934, 29889, 13, 13, 4706, 6317, 10481, 1057, 11662, 9295, 13, 4706, 9995, 13, 4706, 1583, 3032, 3198, 29918, 9507, 29918, 1853, 29898, 9507, 29897, 13, 4706, 1583, 3032, 3198, 29918, 17588, 29898, 9507, 29897, 13, 4706, 1583, 3032, 3198, 29918, 262, 1445, 29918, 2611, 3656, 362, 580, 13, 13, 4706, 1583, 29889, 449, 1445, 353, 10422, 13, 13, 4706, 302, 29918, 9748, 353, 27716, 29918, 9748, 29889, 12181, 29961, 29900, 29962, 13, 4706, 302, 798, 353, 29871, 29900, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 411, 1722, 29898, 1311, 29889, 262, 1445, 29892, 525, 29878, 1495, 408, 1881, 29918, 1445, 29892, 1722, 29898, 1311, 29889, 449, 1445, 29892, 13, 462, 462, 462, 4706, 525, 29893, 1495, 408, 1962, 29918, 1445, 29901, 13, 9651, 363, 1196, 297, 1881, 29918, 1445, 29901, 13, 18884, 302, 798, 4619, 29871, 29896, 13, 18884, 565, 29871, 29906, 29900, 529, 302, 798, 529, 29871, 29906, 29896, 718, 302, 29918, 9748, 29901, 13, 462, 1678, 1962, 29918, 1445, 29889, 3539, 877, 877, 718, 851, 29898, 4467, 29882, 29918, 9748, 29961, 29875, 3816, 29900, 2314, 718, 525, 525, 718, 851, 29898, 13, 462, 4706, 27716, 29918, 9748, 29961, 29875, 3816, 29896, 2314, 718, 525, 525, 718, 851, 29898, 4467, 29882, 29918, 9748, 29961, 29875, 3816, 29906, 2314, 718, 25710, 1495, 13, 462, 1678, 1962, 29918, 1445, 29889, 3539, 28909, 29876, 1495, 13, 462, 1678, 474, 4619, 29871, 29896, 13, 18884, 1683, 29901, 13, 462, 1678, 1962, 29918, 1445, 29889, 3539, 29898, 1220, 29897, 13, 2 ]
exercise/newfile45.py
LeeBeral/python
0
23077
<filename>exercise/newfile45.py<gh_stars>0 show databases; show tables desc table名 use database名 delete from 库名.表名 where id=5; select * from 表名 where id=5; update 表名 set age=15,home='北京' where id=5
[ 1, 529, 9507, 29958, 735, 6269, 895, 29914, 1482, 1445, 29946, 29945, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 4294, 21218, 2104, 13, 4294, 6131, 30004, 13, 14273, 1591, 30548, 30004, 13, 1509, 2566, 30548, 30004, 13, 8143, 515, 29871, 31700, 30548, 29889, 30746, 30548, 988, 1178, 29922, 29945, 2104, 13, 2622, 334, 515, 29871, 30746, 30548, 988, 1178, 29922, 29945, 2104, 13, 5504, 29871, 30746, 30548, 731, 5046, 29922, 29896, 29945, 29892, 5184, 2433, 30662, 30675, 29915, 988, 1178, 29922, 29945, 2 ]
fast_home_api/routes/auth.py
DevN00bs/FastHomeNextAPI
0
1614065
<gh_stars>0 from apiflask import APIBlueprint, input, output, abort, doc import fast_home_api.controllers.auth as auth import fast_home_api.controllers.mail as mail import fast_home_api.models.auth as models from ..utils.enums import ControllerStatus router = APIBlueprint("auth", __name__, "Authentication", url_prefix="/api/auth") @router.post("/register") @input(models.RegistrationRequest) @output({}) @doc(summary="Create an account", description="""This endpoint will send a verification email. If the delivery fails, you can use the 'send' endpoint to retry""", responses={204: "User was registered successfully", 409: "A user with that username and/or e-mail is already registered"}) def create_user(data): result = auth.register_user(data) if result[0] == ControllerStatus.ALREADY_EXISTS: abort(409) if result[0] == ControllerStatus.ERROR: abort(500, "registration") mail_result = mail.send_email("Verify your account", data["email"], "verify.html", {"username": data["username"], "link": mail.create_mail_link(result[1], "verify")}) if mail_result == ControllerStatus.ERROR: abort(500, "email") return "" @router.post("/login") @input(models.LoginRequest) @output(models.LoginResponse) @doc(summary="Log in into your account and get your authentication token", responses={200: "Credentials are correct and we return the user's bearer token", 401: "Username and/or password combination is incorrect", 403: "Your account hasn't been verified yet"}) def log_in_user(data): result = auth.log_in(data) if result[0] == ControllerStatus.ERROR: abort(500) if result[0] == ControllerStatus.WRONG_CREDS: abort(401) if result[0] == ControllerStatus.NOT_VERIFIED: abort(403) return {"token": f"Bearer {result[1]}"} @router.get("/verify/<token>") @output({}) @doc(summary="Verify an account using a link from a verification email", responses={ 204: "Account was verified successfully", 410: "Link has expired and/or it's invalid", 404: "No token was provided" }) def verify_account(token): result = auth.verify_verification_token(token) if result == ControllerStatus.INVALID_LINK: abort(410) if result == ControllerStatus.ERROR: abort(500) return "" @router.post("/send") @input(models.SendEmailRequest) @output({}) @doc(summary="Send an email to an account", description="""Currently, you can only send 2 types of email: - 'verify' type: Used to verify an account - 'forgot' type: Used to restore an account's password""", responses={ 204: "Email address is valid, but only registered email adresses will be sent a message" }) def send_account_email(data): # This should probably not be here email_subjects_dict = { "verify": "Verify your account", "forgot": "Password restoration" } user_data = auth.get_user_document_by_email(data["email"]) if user_data[0] == ControllerStatus.DOES_NOT_EXISTS: return "" if user_data[0] == ControllerStatus.ERROR: abort(500) result = mail.send_email(email_subjects_dict[data["purpose"]], data["email"], f"{data['purpose']}.html", { "username": user_data[1]["username"], "link": mail.create_mail_link(str(user_data[1].id), data["purpose"]) }) if result == ControllerStatus.ERROR: abort(500) return "" @router.post("/forgot") @input(models.ForgotPasswordRequest) @output({}) @doc(summary="Change an account's password using an email link", responses={ 204: "Password was changed successfully", 410: "Link has expired and/or it's invalid", }) def change_password_mail_link(data): token_data = auth.decode_mail_token(data["token"], "forgot") if token_data[0] == ControllerStatus.INVALID_LINK: abort(410) if token_data[0] == ControllerStatus.ERROR: abort(500) result = auth.change_password(token_data[1]["id"], data["new_password"]) if result == ControllerStatus.DOES_NOT_EXISTS: abort(410) if result == ControllerStatus.ERROR: abort(500) return ""
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 3095, 361, 29880, 1278, 1053, 3450, 21319, 2158, 29892, 1881, 29892, 1962, 29892, 27450, 29892, 1574, 13, 13, 5215, 5172, 29918, 5184, 29918, 2754, 29889, 1285, 11897, 29889, 5150, 408, 4817, 13, 5215, 5172, 29918, 5184, 29918, 2754, 29889, 1285, 11897, 29889, 2549, 408, 10524, 13, 5215, 5172, 29918, 5184, 29918, 2754, 29889, 9794, 29889, 5150, 408, 4733, 13, 3166, 6317, 13239, 29889, 264, 6762, 1053, 15830, 5709, 13, 13, 15140, 353, 3450, 21319, 2158, 703, 5150, 613, 4770, 978, 1649, 29892, 376, 16746, 613, 3142, 29918, 13506, 13802, 2754, 29914, 5150, 1159, 13, 13, 13, 29992, 15140, 29889, 2490, 11974, 9573, 1159, 13, 29992, 2080, 29898, 9794, 29889, 4597, 8306, 3089, 29897, 13, 29992, 4905, 3319, 1800, 13, 29992, 1514, 29898, 7727, 543, 4391, 385, 3633, 613, 13, 268, 6139, 13776, 29908, 4013, 16248, 674, 3638, 263, 1147, 2450, 4876, 29889, 13, 268, 960, 278, 28289, 8465, 29892, 366, 508, 671, 278, 525, 6717, 29915, 16248, 304, 337, 2202, 15945, 613, 13, 268, 20890, 3790, 29906, 29900, 29946, 29901, 376, 2659, 471, 15443, 8472, 613, 13, 462, 29946, 29900, 29929, 29901, 376, 29909, 1404, 411, 393, 8952, 322, 29914, 272, 321, 29899, 2549, 338, 2307, 15443, 29908, 1800, 13, 1753, 1653, 29918, 1792, 29898, 1272, 1125, 13, 1678, 1121, 353, 4817, 29889, 9573, 29918, 1792, 29898, 1272, 29897, 13, 1678, 565, 1121, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 1964, 16310, 29979, 29918, 5746, 24306, 29901, 13, 4706, 27450, 29898, 29946, 29900, 29929, 29897, 13, 13, 1678, 565, 1121, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29892, 376, 1727, 8306, 1159, 13, 13, 1678, 10524, 29918, 2914, 353, 10524, 29889, 6717, 29918, 5269, 703, 6565, 1598, 596, 3633, 613, 848, 3366, 5269, 12436, 376, 27902, 29889, 1420, 613, 13, 462, 462, 29871, 8853, 6786, 1115, 848, 3366, 6786, 12436, 376, 2324, 1115, 10524, 29889, 3258, 29918, 2549, 29918, 2324, 29898, 2914, 29961, 29896, 1402, 376, 27902, 1159, 1800, 13, 1678, 565, 10524, 29918, 2914, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29892, 376, 5269, 1159, 13, 13, 1678, 736, 5124, 13, 13, 13, 29992, 15140, 29889, 2490, 11974, 7507, 1159, 13, 29992, 2080, 29898, 9794, 29889, 11049, 3089, 29897, 13, 29992, 4905, 29898, 9794, 29889, 11049, 5103, 29897, 13, 29992, 1514, 29898, 7727, 543, 3403, 297, 964, 596, 3633, 322, 679, 596, 10760, 5993, 613, 13, 268, 20890, 3790, 29906, 29900, 29900, 29901, 376, 28037, 526, 1959, 322, 591, 736, 278, 1404, 29915, 29879, 11460, 261, 5993, 613, 13, 462, 29946, 29900, 29896, 29901, 376, 20249, 322, 29914, 272, 4800, 10296, 338, 10240, 613, 29871, 29946, 29900, 29941, 29901, 376, 10858, 3633, 22602, 29915, 29873, 1063, 26834, 3447, 29908, 1800, 13, 1753, 1480, 29918, 262, 29918, 1792, 29898, 1272, 1125, 13, 1678, 1121, 353, 4817, 29889, 1188, 29918, 262, 29898, 1272, 29897, 13, 1678, 565, 1121, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 565, 1121, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 9980, 20614, 29918, 22245, 8452, 29901, 13, 4706, 27450, 29898, 29946, 29900, 29896, 29897, 13, 13, 1678, 565, 1121, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 12256, 29918, 5348, 29902, 3738, 3352, 29901, 13, 4706, 27450, 29898, 29946, 29900, 29941, 29897, 13, 13, 1678, 736, 8853, 6979, 1115, 285, 29908, 29933, 799, 261, 426, 2914, 29961, 29896, 29962, 5038, 29913, 13, 13, 13, 29992, 15140, 29889, 657, 11974, 27902, 29914, 29966, 6979, 29958, 1159, 13, 29992, 4905, 3319, 1800, 13, 29992, 1514, 29898, 7727, 543, 6565, 1598, 385, 3633, 773, 263, 1544, 515, 263, 1147, 2450, 4876, 613, 20890, 3790, 13, 268, 29906, 29900, 29946, 29901, 376, 10601, 471, 26834, 8472, 613, 13, 268, 29946, 29896, 29900, 29901, 376, 6595, 756, 1518, 2859, 322, 29914, 272, 372, 29915, 29879, 8340, 613, 13, 268, 29946, 29900, 29946, 29901, 376, 3782, 5993, 471, 4944, 29908, 13, 1800, 13, 1753, 11539, 29918, 10149, 29898, 6979, 1125, 13, 1678, 1121, 353, 4817, 29889, 27902, 29918, 369, 2450, 29918, 6979, 29898, 6979, 29897, 13, 1678, 565, 1121, 1275, 15830, 5709, 29889, 1177, 26707, 29918, 23714, 29968, 29901, 13, 4706, 27450, 29898, 29946, 29896, 29900, 29897, 13, 13, 1678, 565, 1121, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 736, 5124, 13, 13, 13, 29992, 15140, 29889, 2490, 11974, 6717, 1159, 13, 29992, 2080, 29898, 9794, 29889, 12600, 9823, 3089, 29897, 13, 29992, 4905, 3319, 1800, 13, 29992, 1514, 29898, 7727, 543, 12600, 385, 4876, 304, 385, 3633, 613, 13, 268, 6139, 13776, 29908, 7583, 368, 29892, 366, 508, 871, 3638, 29871, 29906, 4072, 310, 4876, 29901, 13, 29899, 525, 27902, 29915, 1134, 29901, 501, 8485, 304, 11539, 385, 3633, 13, 29899, 525, 29888, 990, 327, 29915, 1134, 29901, 501, 8485, 304, 17749, 385, 3633, 29915, 29879, 4800, 15945, 613, 13, 268, 20890, 3790, 13, 3986, 29906, 29900, 29946, 29901, 376, 9823, 3211, 338, 2854, 29892, 541, 871, 15443, 4876, 594, 1253, 267, 674, 367, 2665, 263, 2643, 29908, 13, 268, 5615, 13, 1753, 3638, 29918, 10149, 29918, 5269, 29898, 1272, 1125, 13, 1678, 396, 910, 881, 3117, 451, 367, 1244, 13, 1678, 4876, 29918, 16009, 29879, 29918, 8977, 353, 426, 13, 4706, 376, 27902, 1115, 376, 6565, 1598, 596, 3633, 613, 13, 4706, 376, 29888, 990, 327, 1115, 376, 10048, 1791, 12418, 29908, 13, 1678, 500, 13, 13, 1678, 1404, 29918, 1272, 353, 4817, 29889, 657, 29918, 1792, 29918, 3225, 29918, 1609, 29918, 5269, 29898, 1272, 3366, 5269, 20068, 13, 1678, 565, 1404, 29918, 1272, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 3970, 2890, 29918, 12256, 29918, 5746, 24306, 29901, 13, 4706, 736, 5124, 13, 13, 1678, 565, 1404, 29918, 1272, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 1121, 353, 10524, 29889, 6717, 29918, 5269, 29898, 5269, 29918, 16009, 29879, 29918, 8977, 29961, 1272, 3366, 15503, 4220, 3108, 1402, 848, 3366, 5269, 12436, 285, 29908, 29912, 1272, 1839, 15503, 4220, 2033, 1836, 1420, 613, 426, 13, 4706, 376, 6786, 1115, 1404, 29918, 1272, 29961, 29896, 29962, 3366, 6786, 12436, 376, 2324, 1115, 10524, 29889, 3258, 29918, 2549, 29918, 2324, 29898, 710, 29898, 1792, 29918, 1272, 29961, 29896, 1822, 333, 511, 848, 3366, 15503, 4220, 20068, 13, 1678, 5615, 13, 13, 1678, 565, 1121, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 736, 5124, 13, 13, 13, 29992, 15140, 29889, 2490, 11974, 29888, 990, 327, 1159, 13, 29992, 2080, 29898, 9794, 29889, 29943, 990, 327, 10048, 3089, 29897, 13, 29992, 4905, 3319, 1800, 13, 29992, 1514, 29898, 7727, 543, 7277, 385, 3633, 29915, 29879, 4800, 773, 385, 4876, 1544, 613, 20890, 3790, 13, 268, 29906, 29900, 29946, 29901, 376, 10048, 471, 3939, 8472, 613, 13, 268, 29946, 29896, 29900, 29901, 376, 6595, 756, 1518, 2859, 322, 29914, 272, 372, 29915, 29879, 8340, 613, 13, 1800, 13, 1753, 1735, 29918, 5630, 29918, 2549, 29918, 2324, 29898, 1272, 1125, 13, 1678, 5993, 29918, 1272, 353, 4817, 29889, 13808, 29918, 2549, 29918, 6979, 29898, 1272, 3366, 6979, 12436, 376, 29888, 990, 327, 1159, 13, 1678, 565, 5993, 29918, 1272, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 1177, 26707, 29918, 23714, 29968, 29901, 13, 4706, 27450, 29898, 29946, 29896, 29900, 29897, 13, 13, 1678, 565, 5993, 29918, 1272, 29961, 29900, 29962, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 1121, 353, 4817, 29889, 3167, 29918, 5630, 29898, 6979, 29918, 1272, 29961, 29896, 29962, 3366, 333, 12436, 848, 3366, 1482, 29918, 5630, 20068, 13, 1678, 565, 1121, 1275, 15830, 5709, 29889, 3970, 2890, 29918, 12256, 29918, 5746, 24306, 29901, 13, 4706, 27450, 29898, 29946, 29896, 29900, 29897, 13, 13, 1678, 565, 1121, 1275, 15830, 5709, 29889, 11432, 29901, 13, 4706, 27450, 29898, 29945, 29900, 29900, 29897, 13, 13, 1678, 736, 5124, 13, 2 ]
models/vit_utils/layers/norm_act.py
Kanaricc/M3TR
3
135128
<filename>models/vit_utils/layers/norm_act.py """ Normalization + Activation Layers """ import torch from torch import nn as nn from torch.nn import functional as F from .create_act import get_act_layer class BatchNormAct2d(nn.BatchNorm2d): """BatchNorm + Activation This module performs BatchNorm + Activation in a manner that will remain backwards compatible with weights trained with separate bn, act. This is why we inherit from BN instead of composing it as a .bn member. """ def __init__(self, num_features, eps=1e-5, momentum=0.1, affine=True, track_running_stats=True, apply_act=True, act_layer=nn.ReLU, inplace=True, drop_block=None): super(BatchNormAct2d, self).__init__( num_features, eps=eps, momentum=momentum, affine=affine, track_running_stats=track_running_stats) if isinstance(act_layer, str): act_layer = get_act_layer(act_layer) if act_layer is not None and apply_act: act_args = dict(inplace=True) if inplace else {} self.act = act_layer(**act_args) else: self.act = nn.Identity() def _forward_jit(self, x): """ A cut & paste of the contents of the PyTorch BatchNorm2d forward function """ # exponential_average_factor is self.momentum set to # (when it is available) only so that if gets updated # in ONNX graph when this node is exported to ONNX. if self.momentum is None: exponential_average_factor = 0.0 else: exponential_average_factor = self.momentum if self.training and self.track_running_stats: # TODO: if statement only here to tell the jit to skip emitting this when it is None if self.num_batches_tracked is not None: self.num_batches_tracked += 1 if self.momentum is None: # use cumulative moving average exponential_average_factor = 1.0 / float(self.num_batches_tracked) else: # use exponential moving average exponential_average_factor = self.momentum x = F.batch_norm( x, self.running_mean, self.running_var, self.weight, self.bias, self.training or not self.track_running_stats, exponential_average_factor, self.eps) return x @torch.jit.ignore def _forward_python(self, x): return super(BatchNormAct2d, self).forward(x) def forward(self, x): # FIXME cannot call parent forward() and maintain jit.script compatibility? if torch.jit.is_scripting(): x = self._forward_jit(x) else: x = self._forward_python(x) x = self.act(x) return x class GroupNormAct(nn.GroupNorm): # NOTE num_channel and num_groups order flipped for easier layer swaps / binding of fixed args def __init__(self, num_channels, num_groups, eps=1e-5, affine=True, apply_act=True, act_layer=nn.ReLU, inplace=True, drop_block=None): super(GroupNormAct, self).__init__(num_groups, num_channels, eps=eps, affine=affine) if isinstance(act_layer, str): act_layer = get_act_layer(act_layer) if act_layer is not None and apply_act: act_args = dict(inplace=True) if inplace else {} self.act = act_layer(**act_args) else: self.act = nn.Identity() def forward(self, x): x = F.group_norm(x, self.num_groups, self.weight, self.bias, self.eps) x = self.act(x) return x
[ 1, 529, 9507, 29958, 9794, 29914, 29894, 277, 29918, 13239, 29914, 29277, 29914, 12324, 29918, 627, 29889, 2272, 13, 15945, 29908, 21981, 2133, 718, 21775, 362, 365, 388, 414, 30004, 13, 15945, 19451, 13, 5215, 4842, 305, 30004, 13, 3166, 4842, 305, 1053, 302, 29876, 408, 302, 29876, 30004, 13, 3166, 4842, 305, 29889, 15755, 1053, 13303, 408, 383, 30004, 13, 30004, 13, 3166, 869, 3258, 29918, 627, 1053, 679, 29918, 627, 29918, 13148, 30004, 13, 30004, 13, 30004, 13, 1990, 350, 905, 29940, 555, 2865, 29906, 29881, 29898, 15755, 29889, 23145, 29940, 555, 29906, 29881, 1125, 30004, 13, 1678, 9995, 23145, 29940, 555, 718, 21775, 362, 30004, 13, 30004, 13, 1678, 910, 3883, 23233, 350, 905, 29940, 555, 718, 21775, 362, 297, 263, 8214, 393, 674, 3933, 28953, 30004, 13, 1678, 15878, 411, 18177, 16370, 411, 5004, 289, 29876, 29892, 1044, 29889, 910, 338, 2020, 591, 13125, 515, 350, 29940, 30004, 13, 1678, 2012, 310, 5541, 292, 372, 408, 263, 869, 11197, 4509, 22993, 13, 1678, 9995, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 22100, 29892, 321, 567, 29922, 29896, 29872, 29899, 29945, 29892, 19399, 29922, 29900, 29889, 29896, 29892, 2756, 457, 29922, 5574, 29892, 5702, 29918, 21094, 29918, 16202, 29922, 5574, 11167, 13, 462, 3394, 29918, 627, 29922, 5574, 29892, 1044, 29918, 13148, 29922, 15755, 29889, 1123, 29931, 29965, 29892, 297, 6689, 29922, 5574, 29892, 5768, 29918, 1271, 29922, 8516, 1125, 30004, 13, 4706, 2428, 29898, 23145, 29940, 555, 2865, 29906, 29881, 29892, 1583, 467, 1649, 2344, 12035, 30004, 13, 9651, 954, 29918, 22100, 29892, 321, 567, 29922, 8961, 29892, 19399, 29922, 29885, 2932, 398, 29892, 2756, 457, 29922, 3470, 457, 29892, 5702, 29918, 21094, 29918, 16202, 29922, 11294, 29918, 21094, 29918, 16202, 8443, 13, 4706, 565, 338, 8758, 29898, 627, 29918, 13148, 29892, 851, 1125, 30004, 13, 9651, 1044, 29918, 13148, 353, 679, 29918, 627, 29918, 13148, 29898, 627, 29918, 13148, 8443, 13, 4706, 565, 1044, 29918, 13148, 338, 451, 6213, 322, 3394, 29918, 627, 29901, 30004, 13, 9651, 1044, 29918, 5085, 353, 9657, 29898, 262, 6689, 29922, 5574, 29897, 565, 297, 6689, 1683, 6571, 30004, 13, 9651, 1583, 29889, 627, 353, 1044, 29918, 13148, 29898, 1068, 627, 29918, 5085, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 1583, 29889, 627, 353, 302, 29876, 29889, 18415, 26471, 13, 30004, 13, 1678, 822, 903, 11333, 29918, 29926, 277, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 9995, 319, 5700, 669, 11417, 310, 278, 8118, 310, 278, 10772, 29911, 25350, 350, 905, 29940, 555, 29906, 29881, 6375, 740, 30004, 13, 4706, 9995, 30004, 13, 4706, 396, 25658, 29918, 12483, 482, 29918, 19790, 338, 1583, 29889, 29885, 2932, 398, 731, 304, 30004, 13, 4706, 396, 313, 8256, 372, 338, 3625, 29897, 871, 577, 393, 565, 4947, 4784, 30004, 13, 4706, 396, 297, 6732, 29940, 29990, 3983, 746, 445, 2943, 338, 5609, 287, 304, 6732, 29940, 29990, 22993, 13, 4706, 565, 1583, 29889, 29885, 2932, 398, 338, 6213, 29901, 30004, 13, 9651, 25658, 29918, 12483, 482, 29918, 19790, 353, 29871, 29900, 29889, 29900, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 25658, 29918, 12483, 482, 29918, 19790, 353, 1583, 29889, 29885, 2932, 398, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 26495, 322, 1583, 29889, 11294, 29918, 21094, 29918, 16202, 29901, 30004, 13, 9651, 396, 14402, 29901, 565, 3229, 871, 1244, 304, 2649, 278, 432, 277, 304, 14383, 953, 5367, 445, 746, 372, 338, 6213, 30004, 13, 9651, 565, 1583, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 338, 451, 6213, 29901, 30004, 13, 18884, 1583, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 4619, 29871, 29896, 30004, 13, 18884, 565, 1583, 29889, 29885, 2932, 398, 338, 6213, 29901, 29871, 396, 671, 13299, 28524, 8401, 6588, 30004, 13, 462, 1678, 25658, 29918, 12483, 482, 29918, 19790, 353, 29871, 29896, 29889, 29900, 847, 5785, 29898, 1311, 29889, 1949, 29918, 16175, 267, 29918, 11294, 287, 8443, 13, 18884, 1683, 29901, 29871, 396, 671, 25658, 8401, 6588, 30004, 13, 462, 1678, 25658, 29918, 12483, 482, 29918, 19790, 353, 1583, 29889, 29885, 2932, 398, 30004, 13, 30004, 13, 4706, 921, 353, 383, 29889, 16175, 29918, 12324, 29898, 30004, 13, 18884, 921, 29892, 1583, 29889, 21094, 29918, 12676, 29892, 1583, 29889, 21094, 29918, 1707, 29892, 1583, 29889, 7915, 29892, 1583, 29889, 29890, 3173, 11167, 13, 18884, 1583, 29889, 26495, 470, 451, 1583, 29889, 11294, 29918, 21094, 29918, 16202, 11167, 13, 18884, 25658, 29918, 12483, 482, 29918, 19790, 29892, 1583, 29889, 8961, 8443, 13, 4706, 736, 921, 30004, 13, 30004, 13, 1678, 732, 7345, 305, 29889, 29926, 277, 29889, 17281, 30004, 13, 1678, 822, 903, 11333, 29918, 4691, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 736, 2428, 29898, 23145, 29940, 555, 2865, 29906, 29881, 29892, 1583, 467, 11333, 29898, 29916, 8443, 13, 30004, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 396, 383, 6415, 2303, 2609, 1246, 3847, 6375, 580, 322, 7344, 432, 277, 29889, 2154, 24521, 29973, 30004, 13, 4706, 565, 4842, 305, 29889, 29926, 277, 29889, 275, 29918, 2154, 292, 7295, 30004, 13, 9651, 921, 353, 1583, 3032, 11333, 29918, 29926, 277, 29898, 29916, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 921, 353, 1583, 3032, 11333, 29918, 4691, 29898, 29916, 8443, 13, 4706, 921, 353, 1583, 29889, 627, 29898, 29916, 8443, 13, 4706, 736, 921, 30004, 13, 30004, 13, 30004, 13, 1990, 6431, 29940, 555, 2865, 29898, 15755, 29889, 4782, 29940, 555, 1125, 30004, 13, 1678, 396, 6058, 29923, 954, 29918, 12719, 322, 954, 29918, 13155, 1797, 285, 492, 2986, 363, 6775, 7546, 2381, 2547, 847, 9956, 310, 4343, 6389, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 305, 12629, 29892, 954, 29918, 13155, 29892, 321, 567, 29922, 29896, 29872, 29899, 29945, 29892, 2756, 457, 29922, 5574, 11167, 13, 462, 3394, 29918, 627, 29922, 5574, 29892, 1044, 29918, 13148, 29922, 15755, 29889, 1123, 29931, 29965, 29892, 297, 6689, 29922, 5574, 29892, 5768, 29918, 1271, 29922, 8516, 1125, 30004, 13, 4706, 2428, 29898, 4782, 29940, 555, 2865, 29892, 1583, 467, 1649, 2344, 12035, 1949, 29918, 13155, 29892, 954, 29918, 305, 12629, 29892, 321, 567, 29922, 8961, 29892, 2756, 457, 29922, 3470, 457, 8443, 13, 4706, 565, 338, 8758, 29898, 627, 29918, 13148, 29892, 851, 1125, 30004, 13, 9651, 1044, 29918, 13148, 353, 679, 29918, 627, 29918, 13148, 29898, 627, 29918, 13148, 8443, 13, 4706, 565, 1044, 29918, 13148, 338, 451, 6213, 322, 3394, 29918, 627, 29901, 30004, 13, 9651, 1044, 29918, 5085, 353, 9657, 29898, 262, 6689, 29922, 5574, 29897, 565, 297, 6689, 1683, 6571, 30004, 13, 9651, 1583, 29889, 627, 353, 1044, 29918, 13148, 29898, 1068, 627, 29918, 5085, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 1583, 29889, 627, 353, 302, 29876, 29889, 18415, 26471, 13, 30004, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 921, 353, 383, 29889, 2972, 29918, 12324, 29898, 29916, 29892, 1583, 29889, 1949, 29918, 13155, 29892, 1583, 29889, 7915, 29892, 1583, 29889, 29890, 3173, 29892, 1583, 29889, 8961, 8443, 13, 4706, 921, 353, 1583, 29889, 627, 29898, 29916, 8443, 13, 4706, 736, 921, 30004, 13, 2 ]
nappy/nc_interface/na_content_collector.py
ahurka/nappy
0
73600
# Copyright (C) 2004 CCLRC & NERC( Natural Environment Research Council ). # This software may be distributed under the terms of the # Q Public License, version 1.0 or later. http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt """ na_content_collector.py ======================= Holds the class NAContentCollector that converts a set of CDMS variables and global attributes to a NASA Ames dictionary. """ # Imports from python standard library import sys import time import re import logging # Import from nappy package from nappy.na_error import na_error import nappy.utils import cdms_utils.axis_utils import cdms_utils.var_utils import nappy.utils.common_utils import nappy.na_file.na_core config_dict = nappy.utils.getConfigDict() nc_to_na_map = config_dict["nc_to_na_map"] header_partitions = config_dict["header_partitions"] hp = header_partitions version = nappy.utils.getVersion() # Import external packages (if available) if sys.platform.find("win") > -1: raise na_error.NAPlatformError("Windows does not support CDMS. CDMS is required to convert to CDMS objects and NetCDF.") try: import cdms2 as cdms import numpy as N except: try: import cdms import Numeric as N except: raise Exception("Could not import third-party software. Nappy requires the CDMS and Numeric packages to be installed to convert to CDMS and NetCDF.") cdms.setAutoBounds("off") DEBUG = nappy.utils.getDebug() logging.basicConfig() log = logging.getLogger(__name__) class NAContentCollector(nappy.na_file.na_core.NACore): """ Class to build a NASA Ames File object from a set of CDMS variables and global attributes (optional). """ def __init__(self, variables, global_attributes=[], requested_ffi=None): """ Sets up instance variables and calls appropriate methods to generate sections of NASA Ames file object. Input arguments are: * variables - list/tuple of actual CDMS variables * global_attributes - list of user-defined global (key,value) attributes to include. Typical usage: >>> x = NAContentCollector(["temp", "precip"]) >>> x.collectNAContent() >>> if x.found_na: ... print x.na_dict, x.var_ids, x.unused_vars """ self.output_message = [] self.na_dict = {} self.vars = variables # Note that self.var_ids will be a list containing: # [ordered_vars, auxiliary_vars, rank_zero_vars] self.var_ids = None self.globals = dict(global_attributes) self.requested_ffi = requested_ffi self.rank_zero_vars = [] self.rank_zero_var_ids = [] # Create a flag to check if anything found self.found_na = False def collectNAContent(self): """ Collect NASA Ames content. Save the contents to the following instance attributes: * self.na_dict * self.var_ids * self.unused_vars """ log.debug("Call to collectNAContent():\n") for v in self.vars: log.debug("\t%s, %s, %s" % (v.id, v.shape, v.getAxisIds())) (self.ordered_vars, aux_vars) = self._analyseVariables() if self.ordered_vars == []: log.warn("No NASA Ames content created.") self.unused_vars = [] else: self.var_ids = [[var.id for var in self.ordered_vars], [var.id for var in aux_vars], self.rank_zero_var_ids] self.na_dict["NLHEAD"] = -999 self._defineNAVars(self.ordered_vars) self._defineNAAuxVars(aux_vars) self._defineNAGlobals() self._defineNAComments() self._defineGeneralHeader() self.found_na = True def _analyseVariables(self): """ Method to examine the content of CDMS variables to return a tuple of two lists containing variables and auxiliary variables for the NASA Ames file object. Variables not compatible with the first file are put in self.unused_vars """ self.unused_vars = [] ffis_limited = False highest_rank = -1 best_var = None count = 0 # Need to get highest ranked variable (most dimensions) so that we can work out FFI for var in self.vars: msg = "Analysing: %s" % var.id self.output_message.append(msg) count = count + 1 # get rank rank = var.rank() # Deal with singleton variables if rank == 0: self.rank_zero_vars.append(var) self.rank_zero_var_ids.append(var.id) continue # Update highest if highest found or if equals highest with bigger size try: var.size = var.size() ; best_var.size = best_var.size() except: pass if rank > highest_rank or (rank == highest_rank and var.size > best_var.size): highest_rank = rank best_var = var best_var_index = count - 1 # If all are zero ranked variables or no vars identified/found then we cannot write any to NASA Ames and return ([], []) if len(self.rank_zero_vars) == len(self.vars) or best_var is None: return ([], []) # Now start to sort the variables into main and auxiliary vars_for_na = [best_var] aux_vars_for_na = [] shape = best_var.shape number_of_dims = len(shape) self.na_dict["NIV"] = number_of_dims # If 2D then do a quick test to see if 2310 is feasible (i.e. uniformly spaced 2nd axis) if number_of_dims == 2: ffis_limited = [2010, 2110] axis = best_var.getAxis(1) if cdms_utils.axis_utils.isUniformlySpaced(axis): ffis_limited.append(2310) # Get the axes for the main variable being used best_var_axes = best_var.getAxisList() # Get other variables into a list and analyse them rest_of_the_vars = self.vars[:best_var_index] + self.vars[(best_var_index + 1):] for var in rest_of_the_vars: if var.id in self.rank_zero_var_ids: continue # What to do with variables that have different number of dimensions or different shape if len(var.shape) != number_of_dims or var.shape != shape: # Could it be an auxiliary variable? if len(var.shape) != 1: self.unused_vars.append(var) continue first_axis = var.getAxis(0) # Check if axis is identical to first axis of main best variable, if so, can be auxiliary var if not cdms_utils.axis_utils.areAxesIdentical(best_var_axes[0], first_axis): # If not identical, then it might still qualify as an auxiliary every n time points - valid for 1020 if len(var.shape) == 1: nvpm = cdms_utils.axis_utils.isAxisRegularlySpacedSubsetOf(first_axis, best_var_axes[0]) # NVPM is the number of implied values which is equal to (len(ax2)/len(ax1)) if nvpm: ffis_limited = [1020] self.na_dict["NVPM"] = nvpm else: # if returned False, i.e. not regular subset axis self.unused_vars.append(var) else: self.unused_vars.append(var) continue else: # This could be used as a standard auxiliary variable if ffis_limited in ([1020],): # Already fixed on 1020 and cannot collect incompatible FFI vars so do not use self.unused_vars.append(var) else: aux_vars_for_na.append(var) else: this_var_axes = var.getAxisList() # Loop through dimensions for i in range(number_of_dims): if not cdms_utils.axis_utils.areAxesIdentical(best_var_axes[i], this_var_axes[i]): self.unused_vars.append(var) break else: # OK, I think the current variable is compatible to write with the best variable along with a NASA Ames file vars_for_na.append(var) # Send vars_for_na AND aux_vars_for_na to a method to check if they have previously been mapped # from NASA Ames. In which case we'll write them back in the order they were initially read from the input file. (vars_for_na, aux_vars_for_na) = self._reorderVarsIfPreviouslyNA(vars_for_na, aux_vars_for_na) # Get the FFI self.na_dict["FFI"] = self._decideFileFormatIndex(number_of_dims, aux_vars_for_na, ffis_limited) return (vars_for_na, aux_vars_for_na) def _reorderVarsIfPreviouslyNA(self, vars_for_na, aux_vars_for_na): """ Re-order if they previously came from NASA Ames files (i.e. including the attribute 'nasa_ames_var_number'). Return re-ordered or unchanged pair of (vars_for_na, aux_vars_for_na). """ # THIS SHOULD REALLY BE DONE IN A LOOP # First do the main variables ordered_vars = [None] * 1000 # Make a long list to put vars in # Create a list of other variables to collect up any that are not labelled as nasa ames variables other_vars = [] for var in vars_for_na: if hasattr(var, "nasa_ames_var_number"): ordered_vars[var.nasa_ames_var_number[0]] = var else: other_vars.append(var) # Remake vars_for_na now in new order and clean out any that are "None" vars_for_na = [] for var in ordered_vars: if type(var) != type(None): vars_for_na.append(var) vars_for_na = vars_for_na + other_vars # Now re-order the Auxiliary variables if they previously came from NASA ordered_aux_vars = [None] * 1000 other_aux_vars = [] for var in aux_vars_for_na: if hasattr(var, "nasa_ames_aux_var_number"): ordered_aux_vars[var.nasa_ames_aux_var_number[0]] = var else: other_aux_vars.append(var) # Remake aux_vars_for_na now in order aux_vars_for_na = [] for var in ordered_aux_vars: if type(var) != type(None): aux_vars_for_na.append(var) aux_vars_for_na = aux_vars_for_na + other_aux_vars return (vars_for_na, aux_vars_for_na) def _decideFileFormatIndex(self, number_of_dims, aux_vars_for_na, ffis_limited=False): """ Based on the number of dimensions and the NASA Ames dictionary return the File Format Index. If there is a choice then make the most sensible selection. If the user has specified a 'requested_ffi' then try and deliver that. Raise an error if not possible. """ # If ffis_limited is set then must use one of those if self.requested_ffi and ffis_limited: if self.requested_ffi not in ffis_limited: raise Exception("Cannot write this data to FFI '" + str(self.requested_ffi) + "', can only write to: " + str(ffis_limited) + ".") else: return self.requested_ffi # Base the sub-selection on number of dimensions if number_of_dims > 4: raise Exception("Cannot write variables defined against greater than 4 axes in NASA Ames format.") elif number_of_dims > 2: ffi = 10 + (number_of_dims * 1000) elif number_of_dims == 2: if self.requested_ffi in (2010, 2110, 2310): ffi = self.requested_ffi else: ffi = 2010 else: if len(aux_vars_for_na) > 0 or (self.na_dict.has_key("NAUXV") and self.na_dict["NAUXV"] > 0): ffi = 1010 else: ffi = 1001 if self.requested_ffi and ffi != self.requested_ffi: raise Exception("Cannot write this data to FFI '" + str(self.requested_ffi) + "', can only write to: " + str(ffi) + ".") return ffi def _defineNAVars(self, vars): """ Method to define NASA Ames file object variables and their associated metadata. """ self.na_dict["NV"] = len(vars) self.na_dict["VNAME"] = [] self.na_dict["VMISS"] = [] self.na_dict["VSCAL"] = [] self.na_dict["V"] = [] for var in vars: name = cdms_utils.var_utils.getBestName(var) self.na_dict["VNAME"].append(name) miss = cdms_utils.var_utils.getMissingValue(var) if type(miss) not in (type(1.2), type(1), type(1L)): miss = miss[0] self.na_dict["VMISS"].append(miss) self.na_dict["VSCAL"].append(1) # Populate the variable list with the array # Make sure missing values are converted to real values using the required missing value self.na_dict["V"].append(self._getFilledArrayAsList(var, miss)) # Create independent variable info if not self.na_dict.has_key("X"): # Set up lists ready to populate with values self.na_dict["NXDEF"] = [] self.na_dict["NX"] = [] self.ax0 = var.getAxis(0) self.na_dict["X"] = [self.ax0[:].tolist()] self.na_dict["XNAME"] = [cdms_utils.var_utils.getBestName(self.ax0)] if len(self.ax0) == 1: self.na_dict["DX"] = [0] else: incr = self.ax0[1] - self.ax0[0] # Set default increment as gap between first two self.na_dict["DX"] = [incr] # Now overwrite it as zero if non-uniform interval in axis for i in range(1, len(self.ax0)): if (self.ax0[i] - self.ax0[i - 1]) != incr: self.na_dict["DX"] = [0] break # If 1D only then "X" should only be a list and not list of lists if self.na_dict["FFI"] in (1001, 1010, 1020): self.na_dict["X"] = self.na_dict["X"][0] # If FFI is 1020 need to reduce axis down to reduced values as most are implied if self.na_dict["FFI"] == 1020: vals = self.na_dict["X"] self.na_dict["X"] = vals[0:len(vals):self.na_dict["NVPM"]] # Now add the rest of the axes to the self.na_dict objects for axis in var.getAxisList()[1:]: self._appendAxisDefinition(axis) # If FFI is 2110 then need to modify the "NX" and "X" lists to cope with odd shape # Also need to add NX to auxiliary variables if self.na_dict["FFI"] == 2110: new_x = [] new_nx = [] ax2_values = var.getAxis(1)[:].tolist() for i in self.ax0[:]: new_x.append([i, ax2_values]) new_nx.append(len(ax2_values)) # Re-assign to new lists self.na_dict["NX"] = new_nx self.na_dict["X"] = new_x # Now auxiliary variable info here with independent var info # First aux var is NX self.na_dict["A"] = [self.na_dict["NX"][:]] ind_var_name = self.na_dict["XNAME"][0] self.na_dict["ANAME"] = ["Number of '%s' values recorded in subsequent data records" % ind_var_name] self.na_dict["AMISS"] = [-9999.999] self.na_dict["ASCAL"] = [1.0] # If FFI is 2310 then need to modify na_dict items for that elif self.na_dict["FFI"] == 2310: new_x = [] new_nx = [] new_dx = [] ax2_values = var.getAxis(1)[:].tolist() incr = ax2_values[1] - ax2_values[0] for i in self.ax0[:]: new_x.append([i, ax2_values]) new_nx.append(len(ax2_values)) new_dx.append(incr) # Re-assign to new lists self.na_dict["NX"] = new_nx self.na_dict["X"] = new_x self.na_dict["DX"] = new_dx # Now auxiliary variable info here with independent var info # First three aux vars are NX, X0 and DX self.na_dict["A"] = [] self.na_dict["A"].append(self.na_dict["NX"][:]) self.na_dict["A"].append([i[1][0] for i in self.na_dict["X"]]) self.na_dict["A"].append(self.na_dict["DX"][:]) ind_var_name = self.na_dict["XNAME"][0] self.na_dict["ANAME"] = ["Number of '%s' values recorded in subsequent data records" % ind_var_name, "'%s' value for first data point" % ind_var_name, "'%s' increment" % ind_var_name] self.na_dict["AMISS"] = [-9999.999, -9999.999, -9999.999] self.na_dict["ASCAL"] = [1.0, 1.0, 1.0] def _defineNAAuxVars(self, aux_vars): """ Method to define NASA Ames file object auxiliary variables and their associated metadata. Note that "A" may already have content if independent variable items (relating to "X") are defined as aux vars. """ # Initialise aux var itesms as empty lists unless already defined when # setting up independent variables for item in ("ANAME", "AMISS", "ASCAL", "A"): if not self.na_dict.has_key(item): self.na_dict[item] = [] for var in aux_vars: name = cdms_utils.var_utils.getBestName(var) self.na_dict["ANAME"].append(name) miss = cdms_utils.var_utils.getMissingValue(var) if type(miss) not in (type(1.1), type(1), type(1L)): miss = miss[0] self.na_dict["AMISS"].append(miss) self.na_dict["ASCAL"].append(1) # Populate the variable list with the array self.na_dict["A"].append(self._getFilledArrayAsList(var, miss)) self.na_dict["NAUXV"] = len(self.na_dict["A"]) def _appendAxisDefinition(self, axis): """ Method to create the appropriate NASA Ames file object items associated with an axis (independent variable in NASA Ames). It appends to the various self.na_dict containers. """ length = len(axis) self.na_dict["NX"].append(length) self.na_dict["XNAME"].append(cdms_utils.var_utils.getBestName(axis)) # If only one item in axis values if length < 2: self.na_dict["DX"].append(0) self.na_dict["NXDEF"].append(length) self.na_dict["X"].append(axis[:].tolist()) return incr = axis[1] - axis[0] for i in range(1, length): if (axis[i] - axis[i - 1]) != incr: self.na_dict["DX"].append(0) self.na_dict["NXDEF"].append(length) self.na_dict["X"].append(axis[:].tolist()) break else: # If did not break out of the loop max_length = length if length > 3: max_length = 3 self.na_dict["DX"].append(incr) self.na_dict["NXDEF"].append(max_length) self.na_dict["X"].append(axis[:max_length]) def _defineNAGlobals(self): """ Maps CDMS (NetCDF) global attributes into NASA Ames Header fields. """ # Check if we should add to it with locally set rules local_attributes = nappy.utils.getLocalAttributesConfigDict() local_nc_atts = local_attributes["nc_attributes"] for att, value in local_nc_atts.items(): if not nc_to_na_map.has_key(att): nc_to_na_map[key] = value self.extra_comments = [[],[],[]] # Normal comments, special comments, other comments convention_or_reference_comments = [] for key in self.globals.keys(): if key != "first_valid_date_of_data" and type(self.globals[key]) \ not in (type("s"), type(1.1), type(1)): continue # Loop through keys of header/comment items to map if key in nc_to_na_map.keys(): if key == "history": time_string = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time.time())) history = "History: %s - Converted to NASA Ames format using nappy-%s.\n %s" % \ (time_string, version, self.globals[key]) history = history.split("\n") self.history = [] for h in history: if h[:8] != "History:" and h[:1] != " ": h = " " + h self.history.append(h) elif key == "institution": # If fields came from NA then extract appropriate fields. match = re.match(r"(.*)\s+\(ONAME from NASA Ames file\);\s+(.*)\s+\(ORG from NASA Ames file\)\.", self.globals[key]) if match: self.na_dict["ONAME"] = match.groups()[0] self.na_dict["ORG"] = match.groups()[1] else: self.na_dict["ONAME"] = self.globals[key] self.na_dict["ORG"] = self.globals[key] # NOTE: should probably do the following search and replace on all string lines self.na_dict["ONAME"] = self.na_dict["ONAME"].replace("\n", " ") self.na_dict["ORG"] = self.na_dict["ORG"].replace("\n", " ") elif key == "comment": # Need to work out if they are actually comments from NASA Ames in the first place comment_lines = self.globals[key].split("\n") normal_comments = [] normal_comm_flag = None special_comments = [] special_comm_flag = None for line in comment_lines: if line.find(hp["sc_start"]) > -1: special_comm_flag = 1 elif line.find(hp["sc_end"]) > -1: special_comm_flag = None elif line.find(hp["nc_start"]) > -1: normal_comm_flag = 1 elif line.find(hp["nc_end"]) > -1: normal_comm_flag = None elif special_comm_flag == 1: special_comments.append(line) elif normal_comm_flag == 1: normal_comments.append(line) elif line.find(hp["data_next"]) > -1: pass else: normal_comments.append(line) self.extra_comments = [special_comments, normal_comments, []] elif key == "first_valid_date_of_data": self.na_dict["DATE"] = self.globals[key] elif key in ("Conventions", "references"): #convention_or_reference_comments.append("%s: %s" % (key, self.globals[key])) self.extra_comments[2].append("%s: %s" % (key, self.globals[key])) else: self.na_dict[nc_to_na_map[key]] = self.globals[key] else: self.extra_comments[2].append("%s: %s" % (key, self.globals[key])) return def _defineNAComments(self, normal_comments=[], special_comments=[]): """ Defines the Special and Normal comments sections in the NASA Ames file object - including information gathered from the defineNAGlobals method. Starts with values provided for normal_comments and special_comments. """ if hasattr(self, "ncom"): normal_comments = self.ncom + normal_comments NCOM = [] for ncom in normal_comments: NCOM.append(ncom) if len(NCOM) > 0: NCOM.append("") # Use third item in self.extra_comments and adds to NCOM if len(self.extra_comments[2]) > 0: for excom in self.extra_comments[2]: NCOM.append(excom) if len(self.extra_comments[1]) > 0: NCOM.append(hp["addl_globals"]) for excom in self.extra_comments[1]: NCOM.append(excom) if hasattr(self, "history"): for h in self.history: NCOM.append(h) # When NCOM has been defined then surround it in some extras if len(NCOM) > 0: NCOM.insert(0, hp["nc_start"]) NCOM.append("") NCOM.append(hp["nc_end"]) NCOM.append(hp["data_next"]) spec_comm_flag = None # Start with special_comments added in SCOM = [] # Uses first item in self.extra_comments to start SCOM special_comments = special_comments + self.extra_comments[0] if len(special_comments) > 0: SCOM = [hp["sc_start"]] spec_comm_flag = 1 for scom in special_comments: SCOM.append(scom) used_var_atts = ("id", "missing_value", "fill_value", "nasa_ames_var_number", "nasa_ames_aux_var_number") var_comm_flag = None # Create a string for the Special comments to hold rank-zero vars rank_zero_vars_string = [] for var in self.rank_zero_vars: rank_zero_vars_string.append(" Variable %s: %s" % (var.id, cdms_utils.var_utils.getBestName(var))) for att in var.attributes.keys(): value = var.attributes[att] if type(value) in (type("s"), type(1.0), type(1)): rank_zero_vars_string.append(" %s = %s" % (att, var.attributes[att])) if len(rank_zero_vars_string) > 0: rank_zero_vars_string.insert(0, hp["sing_start"]) rank_zero_vars_string.append(hp["sing_end"]) for var in self.ordered_vars: varflag = "unused" var_name_written = False name = cdms_utils.var_utils.getBestName(var) for scom,value in var.attributes.items(): if type(value) in (type([]), type(N.array([0]))) and len(value) == 1: value = value[0] if type(value) in (type("s"), type(1.1), type(1)) and scom not in used_var_atts: if varflag == "unused": if var_comm_flag == None: var_comm_flag = 1 if spec_comm_flag == None: SCOM = [hp["sc_start"]] + rank_zero_vars_string SCOM.append(hp["addl_vatts"]) SCOM.append(hp["ncatts_start"]) varflag = "using" spec_comm_flag = 1 if not var_name_written: SCOM.append(" Variable %s: %s" % (var.id, name)) var_name_written = True SCOM.append(" %s = %s" % (scom, value)) if var_comm_flag == 1: SCOM.append(hp["ncatts_end"]) if spec_comm_flag == 1: SCOM.append(hp["sc_end"]) # Strip out empty lines (or returns) NCOM_cleaned = [] SCOM_cleaned = [] for c in NCOM: if c.strip() not in ("", " ", " "): # Replace new lines within one attribute with a newline and tab so easier to read lines = c.split("\n") for line in lines: if line != lines[0]: line = " " + line NCOM_cleaned.append(line) for c in SCOM: if c.strip() not in ("", " ", " "): # Replace new lines within one attribute with a newline and tab so easier to read lines = c.split("\n") for line in lines: if line != lines[0]: line = " " + line SCOM_cleaned.append(line) self.na_dict["NCOM"] = NCOM_cleaned self.na_dict["NNCOML"] = len(self.na_dict["NCOM"]) self.na_dict["SCOM"] = SCOM_cleaned self.na_dict["NSCOML"] = len(self.na_dict["SCOM"]) return def _defineGeneralHeader(self, header_items={}): """ Defines known header items and overwrites any with header_items key/value pairs. """ warning_message = "Nappy Warning: Could not get the first date in the file. You will need to manually edit the output file." # Check if DATE field previously known in NASA Ames file time_now = [int(i) for i in time.strftime("%Y %m %d", time.localtime(time.time())).split()] if not self.na_dict.has_key("RDATE"): self.na_dict["RDATE"] = time_now if self.ax0.isTime(): # Get first date in list try: (unit, start_date) = re.match("(\w+)\s+?since\s+?(\d+-\d+-\d+)", self.ax0.units).groups() comptime = cdtime.s2c(start_date) first_day = comptime.add(self.na_dict["X"][0], getattr(cdtime, unit.capitalize())) self.na_dict["DATE"] = [int(i) for i in str(first_day).split(" ")[0].replace("-", " ").split()] except: msg = warning_message log.info(msg) self.output_message.append(msg) self.na_dict["DATE"] = [999] * 3 else: if not self.na_dict.has_key("DATE"): msg = warning_message log.info(msg) self.output_message.append(msg) self.na_dict["DATE"] = [999] * 3 else: pass # i.e. use existing DATE self.na_dict["IVOL"] = 1 self.na_dict["NVOL"] = 1 for key in header_items.keys(): self.na_dict[key] = header_items[key] def _getFilledArrayAsList(self, arr, missing_value): """ Takes an array ``arr`` (either a numpy array or a Masked Array). If the array is a masked array then replace masked values with ``missing_value`` and convert to a numpy array. Finally convert to a list and return that. """ if N.ma.isMaskedArray(arr): arr = arr.filled(missing_value) return arr[:].tolist()
[ 1, 396, 259, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29900, 29946, 315, 6154, 10363, 669, 405, 1001, 29907, 29898, 18385, 16738, 10550, 8831, 13742, 13, 29937, 259, 910, 7047, 1122, 367, 13235, 1090, 278, 4958, 310, 278, 13, 29937, 259, 660, 5236, 19245, 29892, 1873, 29871, 29896, 29889, 29900, 470, 2678, 29889, 1732, 597, 299, 29887, 29889, 1089, 29883, 29889, 562, 29889, 2679, 29914, 3597, 29918, 2640, 29914, 29984, 19858, 29918, 506, 1947, 29889, 3945, 13, 13, 15945, 29908, 13, 1056, 29918, 3051, 29918, 15914, 272, 29889, 2272, 13, 9166, 2751, 25512, 13, 13, 29950, 3361, 278, 770, 8598, 3916, 28916, 272, 393, 29436, 263, 731, 310, 7307, 4345, 3651, 322, 5534, 8393, 304, 263, 24206, 1913, 267, 8600, 29889, 13, 13, 15945, 29908, 13, 13, 29937, 1954, 4011, 515, 3017, 3918, 3489, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 337, 13, 5215, 12183, 13, 13, 29937, 16032, 515, 302, 14862, 3577, 13, 3166, 302, 14862, 29889, 1056, 29918, 2704, 1053, 1055, 29918, 2704, 13, 5215, 302, 14862, 29889, 13239, 13, 5215, 14965, 1516, 29918, 13239, 29889, 8990, 29918, 13239, 13, 5215, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 13, 5215, 302, 14862, 29889, 13239, 29889, 9435, 29918, 13239, 13, 5215, 302, 14862, 29889, 1056, 29918, 1445, 29889, 1056, 29918, 3221, 13, 13, 2917, 29918, 8977, 353, 302, 14862, 29889, 13239, 29889, 657, 3991, 21533, 580, 13, 17608, 29918, 517, 29918, 1056, 29918, 1958, 353, 2295, 29918, 8977, 3366, 17608, 29918, 517, 29918, 1056, 29918, 1958, 3108, 13, 6672, 29918, 1595, 2187, 353, 2295, 29918, 8977, 3366, 6672, 29918, 1595, 2187, 3108, 13, 28887, 353, 4839, 29918, 1595, 2187, 13, 13, 3259, 353, 302, 14862, 29889, 13239, 29889, 657, 6594, 580, 13, 13, 29937, 16032, 7029, 9741, 313, 361, 3625, 29897, 13, 361, 10876, 29889, 12120, 29889, 2886, 703, 5080, 1159, 1405, 448, 29896, 29901, 13, 1678, 12020, 1055, 29918, 2704, 29889, 3521, 21889, 2392, 703, 7685, 947, 451, 2304, 7307, 4345, 29889, 7307, 4345, 338, 3734, 304, 3588, 304, 7307, 4345, 3618, 322, 12670, 29907, 4037, 23157, 13, 2202, 29901, 13, 1678, 1053, 14965, 1516, 29906, 408, 14965, 1516, 13, 1678, 1053, 12655, 408, 405, 13, 19499, 29901, 13, 1678, 1018, 29901, 13, 4706, 1053, 14965, 1516, 13, 4706, 1053, 405, 25099, 408, 405, 13, 1678, 5174, 29901, 13, 4706, 12020, 8960, 703, 23323, 451, 1053, 4654, 29899, 22633, 7047, 29889, 405, 14862, 6858, 278, 7307, 4345, 322, 405, 25099, 9741, 304, 367, 5130, 304, 3588, 304, 7307, 4345, 322, 12670, 29907, 4037, 23157, 13, 13, 2252, 1516, 29889, 842, 12300, 18526, 703, 2696, 1159, 29871, 13, 18525, 353, 302, 14862, 29889, 13239, 29889, 657, 11862, 580, 29871, 13, 13, 21027, 29889, 16121, 3991, 580, 13, 1188, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 1990, 8598, 3916, 28916, 272, 29898, 29876, 14862, 29889, 1056, 29918, 1445, 29889, 1056, 29918, 3221, 29889, 29940, 2477, 487, 1125, 13, 1678, 9995, 13, 1678, 4134, 304, 2048, 263, 24206, 1913, 267, 3497, 1203, 515, 263, 731, 310, 29871, 13, 1678, 7307, 4345, 3651, 322, 5534, 8393, 313, 25253, 467, 13, 1678, 9995, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3651, 29892, 5534, 29918, 15697, 11759, 1402, 13877, 29918, 600, 29875, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 317, 1691, 701, 2777, 3651, 322, 5717, 8210, 3519, 304, 13, 4706, 5706, 13926, 310, 24206, 1913, 267, 934, 1203, 29889, 13, 13, 4706, 10567, 6273, 526, 29901, 13, 3986, 334, 3651, 448, 1051, 29914, 23583, 310, 3935, 7307, 4345, 3651, 13, 3986, 334, 5534, 29918, 15697, 448, 1051, 310, 1404, 29899, 12119, 5534, 313, 1989, 29892, 1767, 29897, 8393, 304, 3160, 29889, 13, 13, 4706, 14213, 936, 8744, 29901, 13, 4706, 8653, 921, 353, 8598, 3916, 28916, 272, 29898, 3366, 7382, 613, 376, 1457, 7334, 20068, 13, 4706, 8653, 921, 29889, 15914, 3521, 3916, 580, 13, 4706, 8653, 565, 921, 29889, 11940, 29918, 1056, 29901, 13, 4706, 2023, 268, 1596, 921, 29889, 1056, 29918, 8977, 29892, 921, 29889, 1707, 29918, 4841, 29892, 921, 29889, 348, 3880, 29918, 16908, 29871, 13, 4706, 9995, 13, 4706, 1583, 29889, 4905, 29918, 4906, 353, 5159, 13, 4706, 1583, 29889, 1056, 29918, 8977, 353, 6571, 13, 4706, 1583, 29889, 16908, 353, 3651, 13, 13, 4706, 396, 3940, 393, 1583, 29889, 1707, 29918, 4841, 674, 367, 263, 1051, 6943, 29901, 13, 4706, 396, 1678, 518, 21693, 29918, 16908, 29892, 29871, 29587, 653, 29918, 16908, 29892, 259, 7115, 29918, 9171, 29918, 16908, 29962, 13, 4706, 1583, 29889, 1707, 29918, 4841, 353, 6213, 13, 4706, 1583, 29889, 23705, 1338, 353, 9657, 29898, 10945, 29918, 15697, 29897, 13, 4706, 1583, 29889, 3827, 287, 29918, 600, 29875, 353, 13877, 29918, 600, 29875, 13, 13, 4706, 1583, 29889, 10003, 29918, 9171, 29918, 16908, 353, 5159, 13, 4706, 1583, 29889, 10003, 29918, 9171, 29918, 1707, 29918, 4841, 353, 5159, 13, 13, 4706, 396, 6204, 263, 7353, 304, 1423, 565, 3099, 1476, 13, 4706, 1583, 29889, 11940, 29918, 1056, 353, 7700, 13, 13, 13, 1678, 822, 6314, 3521, 3916, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 24930, 24206, 1913, 267, 2793, 29889, 16913, 278, 8118, 304, 278, 1494, 2777, 13, 4706, 8393, 29901, 13, 308, 334, 1583, 29889, 1056, 29918, 8977, 13, 308, 334, 1583, 29889, 1707, 29918, 4841, 13, 308, 334, 1583, 29889, 348, 3880, 29918, 16908, 13, 4706, 9995, 13, 4706, 1480, 29889, 8382, 703, 5594, 304, 6314, 3521, 3916, 580, 3583, 29876, 1159, 13, 4706, 363, 325, 297, 1583, 29889, 16908, 29901, 29871, 13, 9651, 1480, 29889, 8382, 14182, 29873, 29995, 29879, 29892, 1273, 29879, 29892, 1273, 29879, 29908, 1273, 313, 29894, 29889, 333, 29892, 325, 29889, 12181, 29892, 325, 29889, 657, 16070, 21943, 22130, 13, 29871, 13, 4706, 313, 1311, 29889, 21693, 29918, 16908, 29892, 3479, 29918, 16908, 29897, 353, 1583, 3032, 24209, 344, 10444, 1849, 580, 13, 418, 13, 4706, 565, 1583, 29889, 21693, 29918, 16908, 1275, 5159, 29901, 13, 9651, 1480, 29889, 25442, 703, 3782, 24206, 1913, 267, 2793, 2825, 23157, 13, 9651, 1583, 29889, 348, 3880, 29918, 16908, 353, 5159, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1707, 29918, 4841, 353, 5519, 1707, 29889, 333, 363, 722, 297, 1583, 29889, 21693, 29918, 16908, 1402, 13, 462, 9651, 518, 1707, 29889, 333, 363, 722, 297, 3479, 29918, 16908, 1402, 29871, 13, 462, 9651, 1583, 29889, 10003, 29918, 9171, 29918, 1707, 29918, 4841, 29962, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 25103, 23252, 3108, 353, 448, 29929, 29929, 29929, 13, 9651, 1583, 3032, 7922, 3521, 29963, 1503, 29898, 1311, 29889, 21693, 29918, 16908, 29897, 13, 9651, 1583, 3032, 7922, 3521, 29909, 1314, 29963, 1503, 29898, 2993, 29918, 16908, 29897, 13, 9651, 1583, 3032, 7922, 3521, 29954, 2127, 1338, 580, 13, 9651, 1583, 3032, 7922, 3521, 1523, 1860, 580, 13, 9651, 1583, 3032, 7922, 15263, 7850, 580, 13, 9651, 1583, 29889, 11940, 29918, 1056, 353, 5852, 13, 13, 13, 1678, 822, 903, 24209, 344, 10444, 1849, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 8108, 304, 25917, 278, 2793, 310, 7307, 4345, 3651, 304, 736, 13, 4706, 263, 18761, 310, 1023, 8857, 6943, 3651, 322, 29587, 653, 3651, 13, 4706, 363, 278, 24206, 1913, 267, 934, 1203, 29889, 13, 4706, 9586, 1849, 451, 15878, 411, 278, 937, 934, 526, 1925, 297, 1583, 29889, 348, 3880, 29918, 16908, 13, 4706, 9995, 13, 4706, 1583, 29889, 348, 3880, 29918, 16908, 353, 5159, 13, 4706, 14336, 275, 29918, 29044, 353, 7700, 13, 13, 4706, 9939, 29918, 10003, 353, 448, 29896, 13, 4706, 1900, 29918, 1707, 353, 6213, 13, 4706, 2302, 353, 29871, 29900, 13, 13, 4706, 396, 20768, 304, 679, 9939, 26642, 2286, 313, 3242, 13391, 29897, 577, 393, 591, 508, 664, 714, 383, 3738, 13, 4706, 363, 722, 297, 1583, 29889, 16908, 29901, 13, 9651, 10191, 353, 376, 21067, 952, 292, 29901, 1273, 29879, 29908, 1273, 722, 29889, 333, 13, 9651, 1583, 29889, 4905, 29918, 4906, 29889, 4397, 29898, 7645, 29897, 13, 9651, 2302, 353, 2302, 718, 29871, 29896, 13, 9651, 396, 679, 7115, 13, 9651, 7115, 353, 722, 29889, 10003, 580, 13, 13, 9651, 396, 897, 284, 411, 27130, 3651, 13, 9651, 565, 7115, 1275, 29871, 29900, 29901, 29871, 13, 18884, 1583, 29889, 10003, 29918, 9171, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 18884, 1583, 29889, 10003, 29918, 9171, 29918, 1707, 29918, 4841, 29889, 4397, 29898, 1707, 29889, 333, 29897, 13, 18884, 6773, 13, 13, 9651, 396, 10318, 9939, 565, 9939, 1476, 470, 565, 15743, 9939, 411, 16600, 2159, 13, 9651, 1018, 29901, 13, 18884, 722, 29889, 2311, 353, 722, 29889, 2311, 580, 2056, 1900, 29918, 1707, 29889, 2311, 353, 1900, 29918, 1707, 29889, 2311, 580, 13, 9651, 5174, 29901, 13, 18884, 1209, 13, 9651, 565, 7115, 1405, 9939, 29918, 10003, 470, 313, 10003, 1275, 9939, 29918, 10003, 322, 722, 29889, 2311, 1405, 1900, 29918, 1707, 29889, 2311, 1125, 13, 18884, 9939, 29918, 10003, 353, 7115, 13, 18884, 1900, 29918, 1707, 353, 722, 13, 18884, 1900, 29918, 1707, 29918, 2248, 353, 2302, 448, 29871, 29896, 13, 13, 4706, 396, 960, 599, 526, 5225, 26642, 3651, 470, 694, 24987, 15659, 29914, 11940, 769, 591, 2609, 2436, 738, 304, 24206, 1913, 267, 322, 736, 9310, 1402, 518, 2314, 13, 4706, 565, 7431, 29898, 1311, 29889, 10003, 29918, 9171, 29918, 16908, 29897, 1275, 7431, 29898, 1311, 29889, 16908, 29897, 470, 1900, 29918, 1707, 338, 6213, 29901, 29871, 13, 9651, 736, 9310, 1402, 518, 2314, 13, 13, 4706, 396, 2567, 1369, 304, 2656, 278, 3651, 964, 1667, 322, 29587, 653, 29871, 13, 4706, 24987, 29918, 1454, 29918, 1056, 353, 518, 13318, 29918, 1707, 29962, 13, 4706, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 353, 5159, 13, 4706, 8267, 353, 1900, 29918, 1707, 29889, 12181, 13, 4706, 1353, 29918, 974, 29918, 6229, 29879, 353, 7431, 29898, 12181, 29897, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 5667, 3108, 353, 1353, 29918, 974, 29918, 6229, 29879, 13, 13, 13, 4706, 396, 960, 29871, 29906, 29928, 769, 437, 263, 4996, 1243, 304, 1074, 565, 29871, 29906, 29941, 29896, 29900, 338, 28326, 1821, 313, 29875, 29889, 29872, 29889, 26018, 26325, 287, 29871, 29906, 299, 9685, 29897, 13, 4706, 565, 1353, 29918, 974, 29918, 6229, 29879, 1275, 29871, 29906, 29901, 13, 9651, 14336, 275, 29918, 29044, 353, 518, 29906, 29900, 29896, 29900, 29892, 29871, 29906, 29896, 29896, 29900, 29962, 13, 9651, 9685, 353, 1900, 29918, 1707, 29889, 657, 16070, 29898, 29896, 29897, 13, 9651, 565, 14965, 1516, 29918, 13239, 29889, 8990, 29918, 13239, 29889, 275, 2525, 5560, 368, 5592, 562, 287, 29898, 8990, 1125, 13, 18884, 14336, 275, 29918, 29044, 29889, 4397, 29898, 29906, 29941, 29896, 29900, 29897, 13, 13, 4706, 396, 3617, 278, 27815, 363, 278, 1667, 2286, 1641, 1304, 13, 4706, 1900, 29918, 1707, 29918, 1165, 267, 353, 1900, 29918, 1707, 29889, 657, 16070, 1293, 580, 13, 308, 13, 4706, 396, 3617, 916, 3651, 964, 263, 1051, 322, 16455, 344, 963, 13, 4706, 1791, 29918, 974, 29918, 1552, 29918, 16908, 353, 1583, 29889, 16908, 7503, 13318, 29918, 1707, 29918, 2248, 29962, 718, 1583, 29889, 16908, 15625, 13318, 29918, 1707, 29918, 2248, 718, 29871, 29896, 1125, 29962, 13, 13, 4706, 363, 722, 297, 1791, 29918, 974, 29918, 1552, 29918, 16908, 29901, 13, 13, 9651, 565, 722, 29889, 333, 297, 1583, 29889, 10003, 29918, 9171, 29918, 1707, 29918, 4841, 29901, 6773, 13, 13, 9651, 396, 1724, 304, 437, 411, 3651, 393, 505, 1422, 1353, 310, 13391, 470, 1422, 8267, 13, 9651, 565, 7431, 29898, 1707, 29889, 12181, 29897, 2804, 1353, 29918, 974, 29918, 6229, 29879, 470, 722, 29889, 12181, 2804, 8267, 29901, 29871, 13, 18884, 396, 6527, 372, 367, 385, 29587, 653, 2286, 29973, 13, 18884, 565, 7431, 29898, 1707, 29889, 12181, 29897, 2804, 29871, 29896, 29901, 29871, 13, 462, 1678, 1583, 29889, 348, 3880, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 462, 1678, 6773, 13, 13, 18884, 937, 29918, 8990, 353, 722, 29889, 657, 16070, 29898, 29900, 29897, 13, 18884, 396, 5399, 565, 9685, 338, 13557, 304, 937, 9685, 310, 1667, 1900, 2286, 29892, 565, 577, 29892, 508, 367, 29587, 653, 722, 13, 18884, 565, 451, 14965, 1516, 29918, 13239, 29889, 8990, 29918, 13239, 29889, 598, 29909, 9100, 7648, 936, 29898, 13318, 29918, 1707, 29918, 1165, 267, 29961, 29900, 1402, 937, 29918, 8990, 1125, 13, 13, 462, 1678, 396, 960, 451, 13557, 29892, 769, 372, 1795, 1603, 4021, 1598, 408, 385, 29587, 653, 1432, 302, 931, 3291, 448, 2854, 363, 29871, 29896, 29900, 29906, 29900, 13, 462, 1678, 565, 7431, 29898, 1707, 29889, 12181, 29897, 1275, 29871, 29896, 29901, 13, 462, 4706, 302, 29894, 3358, 353, 14965, 1516, 29918, 13239, 29889, 8990, 29918, 13239, 29889, 275, 16070, 4597, 1070, 368, 5592, 562, 287, 4035, 842, 2776, 29898, 4102, 29918, 8990, 29892, 1900, 29918, 1707, 29918, 1165, 267, 29961, 29900, 2314, 13, 462, 4706, 396, 405, 29963, 13427, 338, 278, 1353, 310, 2411, 2957, 1819, 607, 338, 5186, 304, 313, 2435, 29898, 1165, 29906, 6802, 2435, 29898, 1165, 29896, 876, 13, 462, 4706, 565, 302, 29894, 3358, 29901, 13, 462, 9651, 14336, 275, 29918, 29044, 353, 518, 29896, 29900, 29906, 29900, 29962, 13, 462, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29963, 13427, 3108, 353, 302, 29894, 3358, 13, 462, 4706, 1683, 29901, 396, 565, 4133, 7700, 29892, 474, 29889, 29872, 29889, 451, 4943, 11306, 9685, 13, 462, 9651, 1583, 29889, 348, 3880, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1583, 29889, 348, 3880, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 462, 4706, 6773, 13, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 910, 1033, 367, 1304, 408, 263, 3918, 29587, 653, 2286, 13, 462, 1678, 565, 14336, 275, 29918, 29044, 297, 9310, 29896, 29900, 29906, 29900, 1402, 1125, 13, 462, 4706, 396, 838, 2040, 4343, 373, 29871, 29896, 29900, 29906, 29900, 322, 2609, 6314, 297, 23712, 383, 3738, 24987, 577, 437, 451, 671, 13, 462, 4706, 1583, 29889, 348, 3880, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29889, 4397, 29898, 1707, 29897, 29871, 13, 13, 9651, 1683, 29901, 13, 18884, 445, 29918, 1707, 29918, 1165, 267, 353, 722, 29889, 657, 16070, 1293, 580, 13, 13, 18884, 396, 21493, 1549, 13391, 13, 18884, 363, 474, 297, 3464, 29898, 4537, 29918, 974, 29918, 6229, 29879, 1125, 632, 13, 462, 1678, 565, 451, 14965, 1516, 29918, 13239, 29889, 8990, 29918, 13239, 29889, 598, 29909, 9100, 7648, 936, 29898, 13318, 29918, 1707, 29918, 1165, 267, 29961, 29875, 1402, 445, 29918, 1707, 29918, 1165, 267, 29961, 29875, 29962, 1125, 13, 462, 4706, 1583, 29889, 348, 3880, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 462, 4706, 2867, 13, 18884, 1683, 29901, 13, 462, 1678, 396, 9280, 29892, 306, 1348, 278, 1857, 2286, 338, 15878, 304, 2436, 411, 278, 1900, 2286, 3412, 411, 263, 24206, 1913, 267, 934, 29871, 13, 462, 1678, 24987, 29918, 1454, 29918, 1056, 29889, 4397, 29898, 1707, 29897, 13, 13, 4706, 396, 15076, 24987, 29918, 1454, 29918, 1056, 5300, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 304, 263, 1158, 304, 1423, 565, 896, 505, 9251, 1063, 20545, 29871, 13, 4706, 396, 515, 24206, 1913, 267, 29889, 512, 607, 1206, 591, 29915, 645, 2436, 963, 1250, 297, 278, 1797, 896, 892, 12919, 1303, 515, 278, 1881, 934, 29889, 13, 4706, 313, 16908, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29897, 353, 1583, 3032, 276, 2098, 29963, 1503, 3644, 6572, 16604, 3521, 29898, 16908, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29897, 13, 13, 4706, 396, 3617, 278, 383, 3738, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29943, 3738, 3108, 353, 1583, 3032, 311, 8204, 2283, 5809, 3220, 29898, 4537, 29918, 974, 29918, 6229, 29879, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29892, 14336, 275, 29918, 29044, 29897, 13, 4706, 736, 313, 16908, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29897, 13, 13, 13, 1678, 822, 903, 276, 2098, 29963, 1503, 3644, 6572, 16604, 3521, 29898, 1311, 29892, 24987, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 1125, 13, 4706, 9995, 13, 4706, 830, 29899, 2098, 565, 896, 9251, 2996, 515, 24206, 1913, 267, 2066, 313, 29875, 29889, 29872, 29889, 3704, 278, 29871, 13, 4706, 5352, 525, 29876, 11290, 29918, 1280, 29918, 1707, 29918, 4537, 2824, 7106, 337, 29899, 21693, 470, 443, 15033, 5101, 310, 13, 4706, 313, 16908, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 467, 13, 4706, 9995, 13, 4706, 396, 3446, 3235, 317, 8187, 29965, 10249, 5195, 9818, 29979, 20700, 360, 12413, 2672, 319, 11247, 4590, 13, 4706, 396, 3824, 437, 278, 1667, 3651, 13, 4706, 10372, 29918, 16908, 353, 518, 8516, 29962, 334, 29871, 29896, 29900, 29900, 29900, 396, 8561, 263, 1472, 1051, 304, 1925, 24987, 297, 29871, 13, 4706, 396, 6204, 263, 1051, 310, 916, 3651, 304, 6314, 701, 738, 393, 526, 451, 3858, 839, 408, 8281, 29874, 626, 267, 3651, 13, 4706, 916, 29918, 16908, 353, 5159, 13, 4706, 363, 722, 297, 24987, 29918, 1454, 29918, 1056, 29901, 13, 9651, 565, 756, 5552, 29898, 1707, 29892, 376, 29876, 11290, 29918, 1280, 29918, 1707, 29918, 4537, 29908, 1125, 13, 18884, 10372, 29918, 16908, 29961, 1707, 29889, 29876, 11290, 29918, 1280, 29918, 1707, 29918, 4537, 29961, 29900, 5262, 353, 722, 13, 9651, 1683, 29901, 13, 18884, 916, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 13, 4706, 396, 5240, 1296, 24987, 29918, 1454, 29918, 1056, 1286, 297, 716, 1797, 322, 5941, 714, 738, 393, 526, 376, 8516, 29908, 13, 4706, 24987, 29918, 1454, 29918, 1056, 353, 5159, 13, 4706, 363, 722, 297, 10372, 29918, 16908, 29901, 13, 9651, 565, 1134, 29898, 1707, 29897, 2804, 1134, 29898, 8516, 1125, 29871, 13, 18884, 24987, 29918, 1454, 29918, 1056, 29889, 4397, 29898, 1707, 29897, 13, 13, 4706, 24987, 29918, 1454, 29918, 1056, 353, 24987, 29918, 1454, 29918, 1056, 718, 916, 29918, 16908, 13, 13, 4706, 396, 2567, 337, 29899, 2098, 278, 319, 1314, 2638, 653, 3651, 565, 896, 9251, 2996, 515, 24206, 29871, 13, 4706, 10372, 29918, 2993, 29918, 16908, 353, 518, 8516, 29962, 334, 29871, 29896, 29900, 29900, 29900, 13, 4706, 916, 29918, 2993, 29918, 16908, 353, 5159, 13, 13, 4706, 363, 722, 297, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29901, 13, 9651, 565, 756, 5552, 29898, 1707, 29892, 376, 29876, 11290, 29918, 1280, 29918, 2993, 29918, 1707, 29918, 4537, 29908, 1125, 13, 18884, 10372, 29918, 2993, 29918, 16908, 29961, 1707, 29889, 29876, 11290, 29918, 1280, 29918, 2993, 29918, 1707, 29918, 4537, 29961, 29900, 5262, 353, 722, 13, 9651, 1683, 29901, 13, 18884, 916, 29918, 2993, 29918, 16908, 29889, 4397, 29898, 1707, 29897, 13, 13, 4706, 396, 5240, 1296, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 1286, 297, 1797, 13, 4706, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 353, 5159, 13, 4706, 363, 722, 297, 10372, 29918, 2993, 29918, 16908, 29901, 13, 9651, 565, 1134, 29898, 1707, 29897, 2804, 1134, 29898, 8516, 1125, 29871, 13, 18884, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29889, 4397, 29898, 1707, 29897, 13, 13, 4706, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 353, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 718, 916, 29918, 2993, 29918, 16908, 13, 4706, 736, 313, 16908, 29918, 1454, 29918, 1056, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29897, 13, 13, 13, 1678, 822, 903, 311, 8204, 2283, 5809, 3220, 29898, 1311, 29892, 1353, 29918, 974, 29918, 6229, 29879, 29892, 3479, 29918, 16908, 29918, 1454, 29918, 1056, 29892, 14336, 275, 29918, 29044, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 16564, 373, 278, 1353, 310, 13391, 322, 278, 24206, 1913, 267, 8600, 736, 13, 4706, 278, 3497, 19191, 11374, 29889, 29871, 13, 4706, 960, 727, 338, 263, 7348, 769, 1207, 278, 1556, 25182, 9262, 29889, 13, 4706, 960, 278, 1404, 756, 6790, 263, 525, 3827, 287, 29918, 600, 29875, 29915, 769, 1018, 322, 12021, 13, 4706, 393, 29889, 6981, 895, 385, 1059, 565, 451, 1950, 29889, 13, 4706, 9995, 13, 4706, 396, 960, 14336, 275, 29918, 29044, 338, 731, 769, 1818, 671, 697, 310, 1906, 13, 4706, 565, 1583, 29889, 3827, 287, 29918, 600, 29875, 322, 14336, 275, 29918, 29044, 29901, 13, 9651, 565, 1583, 29889, 3827, 287, 29918, 600, 29875, 451, 297, 14336, 275, 29918, 29044, 29901, 13, 18884, 12020, 8960, 703, 29089, 2436, 445, 848, 304, 383, 3738, 18793, 718, 851, 29898, 1311, 29889, 3827, 287, 29918, 600, 29875, 29897, 718, 376, 742, 508, 871, 2436, 304, 29901, 376, 718, 851, 29898, 600, 275, 29918, 29044, 29897, 718, 11393, 1159, 13, 9651, 1683, 29901, 13, 18884, 736, 1583, 29889, 3827, 287, 29918, 600, 29875, 13, 13, 4706, 396, 7399, 278, 1014, 29899, 21731, 373, 1353, 310, 13391, 13, 4706, 565, 1353, 29918, 974, 29918, 6229, 29879, 1405, 29871, 29946, 29901, 13, 9651, 12020, 8960, 703, 29089, 2436, 3651, 3342, 2750, 7621, 1135, 29871, 29946, 27815, 297, 24206, 1913, 267, 3402, 23157, 13, 4706, 25342, 1353, 29918, 974, 29918, 6229, 29879, 1405, 29871, 29906, 29901, 29871, 13, 9651, 285, 7241, 353, 29871, 29896, 29900, 718, 313, 4537, 29918, 974, 29918, 6229, 29879, 334, 29871, 29896, 29900, 29900, 29900, 29897, 13, 4706, 25342, 1353, 29918, 974, 29918, 6229, 29879, 1275, 29871, 29906, 29901, 13, 9651, 565, 1583, 29889, 3827, 287, 29918, 600, 29875, 297, 313, 29906, 29900, 29896, 29900, 29892, 29871, 29906, 29896, 29896, 29900, 29892, 29871, 29906, 29941, 29896, 29900, 1125, 13, 18884, 285, 7241, 353, 1583, 29889, 3827, 287, 29918, 600, 29875, 29871, 13, 9651, 1683, 29901, 13, 18884, 285, 7241, 353, 29871, 29906, 29900, 29896, 29900, 13, 4706, 1683, 29901, 13, 9651, 565, 7431, 29898, 2993, 29918, 16908, 29918, 1454, 29918, 1056, 29897, 1405, 29871, 29900, 470, 313, 1311, 29889, 1056, 29918, 8977, 29889, 5349, 29918, 1989, 703, 3521, 29965, 28462, 1159, 322, 1583, 29889, 1056, 29918, 8977, 3366, 3521, 29965, 28462, 3108, 1405, 29871, 29900, 1125, 13, 18884, 285, 7241, 353, 29871, 29896, 29900, 29896, 29900, 13, 9651, 1683, 29901, 13, 18884, 285, 7241, 353, 29871, 29896, 29900, 29900, 29896, 13, 13, 4706, 565, 1583, 29889, 3827, 287, 29918, 600, 29875, 322, 285, 7241, 2804, 1583, 29889, 3827, 287, 29918, 600, 29875, 29901, 13, 9651, 12020, 8960, 703, 29089, 2436, 445, 848, 304, 383, 3738, 18793, 718, 851, 29898, 1311, 29889, 3827, 287, 29918, 600, 29875, 29897, 718, 376, 742, 508, 871, 2436, 304, 29901, 376, 718, 851, 29898, 600, 29875, 29897, 718, 11393, 1159, 13, 4706, 736, 285, 7241, 13, 13, 13, 1678, 822, 903, 7922, 3521, 29963, 1503, 29898, 1311, 29892, 24987, 1125, 13, 4706, 9995, 13, 4706, 8108, 304, 4529, 24206, 1913, 267, 934, 1203, 3651, 322, 1009, 13, 4706, 6942, 15562, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29963, 3108, 353, 7431, 29898, 16908, 29897, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 5813, 3108, 353, 5159, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 9219, 29902, 1799, 3108, 353, 5159, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 7187, 1964, 3108, 353, 5159, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 3108, 353, 5159, 13, 13, 4706, 363, 722, 297, 24987, 29901, 13, 9651, 1024, 353, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 1707, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 5813, 16862, 4397, 29898, 978, 29897, 13, 9651, 3052, 353, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 18552, 292, 1917, 29898, 1707, 29897, 13, 13, 9651, 565, 1134, 29898, 9894, 29897, 451, 297, 313, 1853, 29898, 29896, 29889, 29906, 511, 1134, 29898, 29896, 511, 1134, 29898, 29896, 29931, 22164, 259, 13, 18884, 3052, 353, 3052, 29961, 29900, 29962, 13, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 9219, 29902, 1799, 16862, 4397, 29898, 9894, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 7187, 1964, 16862, 4397, 29898, 29896, 29897, 13, 13, 9651, 396, 6977, 5987, 278, 2286, 1051, 411, 278, 1409, 13, 9651, 396, 8561, 1854, 4567, 1819, 526, 11543, 304, 1855, 1819, 773, 278, 3734, 4567, 995, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29963, 16862, 4397, 29898, 1311, 3032, 657, 3434, 839, 2588, 2887, 1293, 29898, 1707, 29892, 3052, 876, 13, 13, 9651, 396, 6204, 7417, 2286, 5235, 13, 9651, 565, 451, 1583, 29889, 1056, 29918, 8977, 29889, 5349, 29918, 1989, 703, 29990, 29908, 1125, 13, 18884, 396, 3789, 701, 8857, 7960, 304, 19450, 411, 1819, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 24405, 3108, 353, 5159, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 3108, 353, 5159, 13, 13, 18884, 1583, 29889, 1165, 29900, 353, 722, 29889, 657, 16070, 29898, 29900, 29897, 13, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 353, 518, 1311, 29889, 1165, 29900, 7503, 1822, 25027, 391, 580, 29962, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 5813, 3108, 353, 518, 2252, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 1311, 29889, 1165, 29900, 4638, 13, 13, 18884, 565, 7431, 29898, 1311, 29889, 1165, 29900, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 3108, 353, 518, 29900, 29962, 13, 18884, 1683, 29901, 13, 462, 1678, 5528, 29878, 353, 1583, 29889, 1165, 29900, 29961, 29896, 29962, 448, 1583, 29889, 1165, 29900, 29961, 29900, 29962, 13, 462, 1678, 396, 3789, 2322, 11924, 408, 17261, 1546, 937, 1023, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 3108, 353, 518, 3742, 29878, 29962, 13, 462, 1678, 396, 2567, 26556, 372, 408, 5225, 565, 1661, 29899, 29590, 7292, 297, 9685, 13, 462, 1678, 363, 474, 297, 3464, 29898, 29896, 29892, 7431, 29898, 1311, 29889, 1165, 29900, 22164, 13, 462, 4706, 565, 313, 1311, 29889, 1165, 29900, 29961, 29875, 29962, 448, 1583, 29889, 1165, 29900, 29961, 29875, 448, 29871, 29896, 2314, 2804, 5528, 29878, 29901, 13, 462, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 3108, 353, 518, 29900, 29962, 13, 462, 9651, 2867, 13, 13, 18884, 396, 960, 29871, 29896, 29928, 871, 769, 376, 29990, 29908, 881, 871, 367, 263, 1051, 322, 451, 1051, 310, 8857, 13, 18884, 565, 1583, 29889, 1056, 29918, 8977, 3366, 29943, 3738, 3108, 297, 313, 29896, 29900, 29900, 29896, 29892, 29871, 29896, 29900, 29896, 29900, 29892, 29871, 29896, 29900, 29906, 29900, 1125, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 353, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 29961, 29900, 29962, 13, 13, 18884, 396, 960, 383, 3738, 338, 29871, 29896, 29900, 29906, 29900, 817, 304, 10032, 9685, 1623, 304, 12212, 1819, 408, 1556, 526, 2411, 2957, 13, 18884, 565, 1583, 29889, 1056, 29918, 8977, 3366, 29943, 3738, 3108, 1275, 29871, 29896, 29900, 29906, 29900, 29901, 29871, 13, 462, 1678, 659, 29879, 353, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 353, 659, 29879, 29961, 29900, 29901, 2435, 29898, 791, 29879, 1125, 1311, 29889, 1056, 29918, 8977, 3366, 29940, 29963, 13427, 3108, 29962, 29871, 13, 13, 18884, 396, 2567, 788, 278, 1791, 310, 278, 27815, 304, 278, 1583, 29889, 1056, 29918, 8977, 3618, 29871, 13, 18884, 363, 9685, 297, 722, 29889, 657, 16070, 1293, 580, 29961, 29896, 29901, 5387, 13, 462, 1678, 1583, 3032, 4397, 16070, 14683, 29898, 8990, 29897, 13, 13, 18884, 396, 960, 383, 3738, 338, 29871, 29906, 29896, 29896, 29900, 769, 817, 304, 6623, 278, 376, 29940, 29990, 29908, 322, 376, 29990, 29908, 8857, 304, 1302, 412, 411, 7736, 8267, 13, 18884, 396, 3115, 817, 304, 788, 405, 29990, 304, 29587, 653, 3651, 13, 18884, 565, 1583, 29889, 1056, 29918, 8977, 3366, 29943, 3738, 3108, 1275, 29871, 29906, 29896, 29896, 29900, 29901, 13, 462, 1678, 716, 29918, 29916, 353, 5159, 13, 462, 1678, 716, 29918, 23818, 353, 5159, 13, 462, 1678, 4853, 29906, 29918, 5975, 353, 722, 29889, 657, 16070, 29898, 29896, 29897, 7503, 1822, 25027, 391, 580, 13, 13, 462, 1678, 363, 474, 297, 1583, 29889, 1165, 29900, 7503, 5387, 13, 462, 4706, 716, 29918, 29916, 29889, 4397, 4197, 29875, 29892, 4853, 29906, 29918, 5975, 2314, 13, 462, 4706, 716, 29918, 23818, 29889, 4397, 29898, 2435, 29898, 1165, 29906, 29918, 5975, 876, 13, 13, 462, 1678, 396, 830, 29899, 16645, 304, 716, 8857, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 3108, 353, 716, 29918, 23818, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 353, 716, 29918, 29916, 462, 268, 13, 13, 462, 1678, 396, 2567, 29587, 653, 2286, 5235, 1244, 411, 7417, 722, 5235, 13, 462, 1678, 396, 3824, 3479, 722, 338, 405, 29990, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 3108, 353, 518, 1311, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 3108, 7503, 5262, 13, 462, 1678, 1399, 29918, 1707, 29918, 978, 353, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 5813, 3108, 29961, 29900, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 2190, 25797, 3108, 353, 6796, 4557, 310, 14210, 29879, 29915, 1819, 10478, 297, 15352, 848, 6475, 29908, 1273, 1399, 29918, 1707, 29918, 978, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 5194, 29902, 1799, 3108, 353, 21069, 29929, 29929, 29929, 29929, 29889, 29929, 29929, 29929, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 28599, 1964, 3108, 353, 518, 29896, 29889, 29900, 29962, 13, 13, 18884, 396, 960, 383, 3738, 338, 29871, 29906, 29941, 29896, 29900, 769, 817, 304, 6623, 1055, 29918, 8977, 4452, 363, 393, 13, 18884, 25342, 1583, 29889, 1056, 29918, 8977, 3366, 29943, 3738, 3108, 1275, 29871, 29906, 29941, 29896, 29900, 29901, 13, 462, 1678, 716, 29918, 29916, 353, 5159, 13, 462, 1678, 716, 29918, 23818, 353, 5159, 13, 462, 1678, 716, 29918, 8235, 353, 5159, 13, 462, 1678, 4853, 29906, 29918, 5975, 353, 722, 29889, 657, 16070, 29898, 29896, 29897, 7503, 1822, 25027, 391, 580, 13, 462, 1678, 5528, 29878, 353, 4853, 29906, 29918, 5975, 29961, 29896, 29962, 448, 4853, 29906, 29918, 5975, 29961, 29900, 29962, 13, 13, 462, 1678, 363, 474, 297, 1583, 29889, 1165, 29900, 7503, 5387, 13, 462, 4706, 716, 29918, 29916, 29889, 4397, 4197, 29875, 29892, 4853, 29906, 29918, 5975, 2314, 13, 462, 4706, 716, 29918, 23818, 29889, 4397, 29898, 2435, 29898, 1165, 29906, 29918, 5975, 876, 13, 462, 4706, 716, 29918, 8235, 29889, 4397, 29898, 3742, 29878, 29897, 13, 13, 462, 1678, 396, 830, 29899, 16645, 304, 716, 8857, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 3108, 353, 716, 29918, 23818, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 353, 716, 29918, 29916, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 3108, 353, 716, 29918, 8235, 13, 13, 462, 1678, 396, 2567, 29587, 653, 2286, 5235, 1244, 411, 7417, 722, 5235, 13, 462, 1678, 396, 3824, 2211, 3479, 24987, 526, 405, 29990, 29892, 1060, 29900, 322, 360, 29990, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 3108, 353, 5159, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 16862, 4397, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 3108, 7503, 2314, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 16862, 4397, 4197, 29875, 29961, 29896, 3816, 29900, 29962, 363, 474, 297, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 2314, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 16862, 4397, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 3108, 7503, 2314, 13, 462, 1678, 1399, 29918, 1707, 29918, 978, 353, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 5813, 3108, 29961, 29900, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 2190, 25797, 3108, 353, 6796, 4557, 310, 14210, 29879, 29915, 1819, 10478, 297, 15352, 848, 6475, 29908, 1273, 1399, 29918, 1707, 29918, 978, 29892, 13, 462, 462, 632, 13577, 29995, 29879, 29915, 995, 363, 937, 848, 1298, 29908, 1273, 1399, 29918, 1707, 29918, 978, 29892, 13, 462, 462, 632, 13577, 29995, 29879, 29915, 11924, 29908, 1273, 1399, 29918, 1707, 29918, 978, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 5194, 29902, 1799, 3108, 353, 21069, 29929, 29929, 29929, 29929, 29889, 29929, 29929, 29929, 29892, 448, 29929, 29929, 29929, 29929, 29889, 29929, 29929, 29929, 29892, 448, 29929, 29929, 29929, 29929, 29889, 29929, 29929, 29929, 29962, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 28599, 1964, 3108, 353, 518, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29962, 13, 29871, 13, 13, 1678, 822, 903, 7922, 3521, 29909, 1314, 29963, 1503, 29898, 1311, 29892, 3479, 29918, 16908, 1125, 13, 4706, 9995, 13, 4706, 8108, 304, 4529, 24206, 1913, 267, 934, 1203, 29587, 653, 3651, 322, 1009, 13, 4706, 6942, 15562, 29889, 3940, 393, 376, 29909, 29908, 1122, 2307, 505, 2793, 565, 13, 4706, 7417, 2286, 4452, 313, 2674, 1218, 304, 376, 29990, 1159, 526, 3342, 408, 3479, 24987, 29889, 13, 4706, 9995, 13, 4706, 396, 17250, 895, 3479, 722, 372, 267, 1516, 408, 4069, 8857, 6521, 2307, 3342, 746, 13, 4706, 396, 4444, 701, 7417, 3651, 13, 4706, 363, 2944, 297, 4852, 2190, 25797, 613, 376, 5194, 29902, 1799, 613, 376, 28599, 1964, 613, 376, 29909, 29908, 1125, 13, 9651, 565, 451, 1583, 29889, 1056, 29918, 8977, 29889, 5349, 29918, 1989, 29898, 667, 1125, 13, 18884, 1583, 29889, 1056, 29918, 8977, 29961, 667, 29962, 353, 5159, 29871, 13, 13, 4706, 363, 722, 297, 3479, 29918, 16908, 29901, 13, 9651, 1024, 353, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 1707, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 2190, 25797, 16862, 4397, 29898, 978, 29897, 13, 9651, 3052, 353, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 18552, 292, 1917, 29898, 1707, 29897, 13, 9651, 565, 1134, 29898, 9894, 29897, 451, 297, 313, 1853, 29898, 29896, 29889, 29896, 511, 1134, 29898, 29896, 511, 1134, 29898, 29896, 29931, 22164, 29871, 3052, 353, 3052, 29961, 29900, 29962, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 5194, 29902, 1799, 16862, 4397, 29898, 9894, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 28599, 1964, 16862, 4397, 29898, 29896, 29897, 13, 9651, 396, 6977, 5987, 278, 2286, 1051, 411, 278, 1409, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29909, 16862, 4397, 29898, 1311, 3032, 657, 3434, 839, 2588, 2887, 1293, 29898, 1707, 29892, 3052, 876, 13, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 3521, 29965, 28462, 3108, 353, 7431, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29909, 20068, 13, 13, 1678, 822, 903, 4397, 16070, 14683, 29898, 1311, 29892, 9685, 1125, 13, 4706, 9995, 13, 4706, 8108, 304, 1653, 278, 8210, 24206, 1913, 267, 934, 1203, 29871, 13, 4706, 4452, 6942, 411, 385, 9685, 313, 262, 18980, 2286, 297, 29871, 13, 4706, 24206, 1913, 267, 467, 739, 623, 1975, 304, 278, 5164, 1583, 29889, 1056, 29918, 8977, 22637, 29889, 13, 4706, 9995, 13, 4706, 3309, 353, 7431, 29898, 8990, 29897, 13, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 16862, 4397, 29898, 2848, 29897, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 5813, 16862, 4397, 29898, 2252, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 8990, 876, 13, 4706, 396, 960, 871, 697, 2944, 297, 9685, 1819, 13, 4706, 565, 3309, 529, 29871, 29906, 29901, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 16862, 4397, 29898, 29900, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 24405, 16862, 4397, 29898, 2848, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 16862, 4397, 29898, 8990, 7503, 1822, 25027, 391, 3101, 308, 13, 9651, 736, 13, 1678, 13, 4706, 5528, 29878, 353, 9685, 29961, 29896, 29962, 448, 9685, 29961, 29900, 29962, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 3309, 1125, 13, 9651, 565, 313, 8990, 29961, 29875, 29962, 448, 9685, 29961, 29875, 448, 29871, 29896, 2314, 2804, 5528, 29878, 29901, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 16862, 4397, 29898, 29900, 29897, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 24405, 16862, 4397, 29898, 2848, 29897, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 16862, 4397, 29898, 8990, 7503, 1822, 25027, 391, 3101, 13, 18884, 2867, 13, 4706, 1683, 29901, 396, 960, 1258, 451, 2867, 714, 310, 278, 2425, 13, 9651, 4236, 29918, 2848, 353, 3309, 13, 9651, 565, 3309, 1405, 29871, 29941, 29901, 29871, 13, 18884, 4236, 29918, 2848, 353, 29871, 29941, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29928, 29990, 16862, 4397, 29898, 3742, 29878, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29990, 24405, 16862, 4397, 29898, 3317, 29918, 2848, 29897, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29990, 16862, 4397, 29898, 8990, 7503, 3317, 29918, 2848, 2314, 13, 13, 1678, 822, 903, 7922, 3521, 29954, 2127, 1338, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 25846, 7307, 4345, 313, 6779, 29907, 4037, 29897, 5534, 8393, 964, 24206, 1913, 267, 19345, 4235, 29889, 13, 4706, 9995, 13, 4706, 396, 5399, 565, 591, 881, 788, 304, 372, 411, 12430, 731, 6865, 13, 4706, 1887, 29918, 15697, 353, 302, 14862, 29889, 13239, 29889, 657, 7717, 15801, 3991, 21533, 580, 13, 4706, 1887, 29918, 17608, 29918, 1131, 29879, 353, 1887, 29918, 15697, 3366, 17608, 29918, 15697, 3108, 13, 3986, 13, 4706, 363, 1098, 29892, 995, 297, 1887, 29918, 17608, 29918, 1131, 29879, 29889, 7076, 7295, 13, 9651, 565, 451, 302, 29883, 29918, 517, 29918, 1056, 29918, 1958, 29889, 5349, 29918, 1989, 29898, 1131, 1125, 13, 18884, 302, 29883, 29918, 517, 29918, 1056, 29918, 1958, 29961, 1989, 29962, 353, 995, 13, 13, 4706, 1583, 29889, 17833, 29918, 21032, 353, 5519, 16272, 1402, 2636, 29962, 29871, 396, 21981, 6589, 29892, 4266, 6589, 29892, 916, 6589, 13, 4706, 15687, 29918, 272, 29918, 5679, 29918, 21032, 353, 5159, 13, 13, 4706, 363, 1820, 297, 1583, 29889, 23705, 1338, 29889, 8149, 7295, 13, 9651, 565, 1820, 2804, 376, 4102, 29918, 3084, 29918, 1256, 29918, 974, 29918, 1272, 29908, 322, 1134, 29898, 1311, 29889, 23705, 1338, 29961, 1989, 2314, 320, 13, 462, 462, 539, 451, 297, 313, 1853, 703, 29879, 4968, 1134, 29898, 29896, 29889, 29896, 511, 1134, 29898, 29896, 22164, 13, 18884, 6773, 13, 13, 9651, 396, 21493, 1549, 6611, 310, 4839, 29914, 9342, 4452, 304, 2910, 13, 9651, 565, 1820, 297, 302, 29883, 29918, 517, 29918, 1056, 29918, 1958, 29889, 8149, 7295, 13, 18884, 565, 1820, 1275, 376, 18434, 1115, 13, 462, 1678, 931, 29918, 1807, 353, 931, 29889, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 613, 931, 29889, 2997, 2230, 29898, 2230, 29889, 2230, 22130, 13, 462, 1678, 4955, 353, 376, 20570, 29901, 29871, 1273, 29879, 448, 14806, 287, 304, 24206, 1913, 267, 3402, 773, 302, 14862, 19222, 29879, 7790, 29876, 29871, 1273, 29879, 29908, 1273, 320, 13, 462, 462, 462, 313, 2230, 29918, 1807, 29892, 1873, 29892, 1583, 29889, 23705, 1338, 29961, 1989, 2314, 13, 462, 1678, 4955, 353, 4955, 29889, 5451, 14182, 29876, 1159, 29871, 13, 462, 1678, 1583, 29889, 18434, 353, 5159, 13, 462, 1678, 363, 298, 297, 4955, 29901, 13, 462, 4706, 565, 298, 7503, 29947, 29962, 2804, 376, 20570, 6160, 322, 298, 7503, 29896, 29962, 2804, 376, 29871, 29242, 29871, 13, 462, 9651, 298, 353, 376, 29871, 376, 718, 298, 13, 462, 4706, 1583, 29889, 18434, 29889, 4397, 29898, 29882, 29897, 29871, 13, 462, 268, 13, 18884, 25342, 1820, 1275, 376, 2611, 5008, 1115, 13, 462, 1678, 396, 960, 4235, 2996, 515, 8598, 769, 6597, 8210, 4235, 29889, 13, 462, 1678, 1993, 353, 337, 29889, 4352, 29898, 29878, 29908, 28104, 2144, 29879, 3124, 29898, 1164, 25797, 515, 24206, 1913, 267, 934, 29905, 416, 29905, 29879, 17108, 5575, 2144, 29879, 3124, 29898, 1955, 29954, 515, 24206, 1913, 267, 934, 29905, 2144, 19602, 29871, 13, 462, 632, 1583, 29889, 23705, 1338, 29961, 1989, 2314, 13, 462, 1678, 565, 1993, 29901, 13, 462, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 1164, 25797, 3108, 353, 1993, 29889, 13155, 580, 29961, 29900, 29962, 13, 462, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 1955, 29954, 3108, 353, 1993, 29889, 13155, 580, 29961, 29896, 29962, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 1164, 25797, 3108, 353, 1583, 29889, 23705, 1338, 29961, 1989, 29962, 13, 462, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 1955, 29954, 3108, 353, 1583, 29889, 23705, 1338, 29961, 1989, 29962, 13, 462, 1678, 396, 6058, 29923, 29901, 881, 3117, 437, 278, 1494, 2740, 322, 5191, 373, 599, 1347, 3454, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 1164, 25797, 3108, 353, 1583, 29889, 1056, 29918, 8977, 3366, 1164, 25797, 16862, 6506, 14182, 29876, 613, 376, 29871, 16521, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 1955, 29954, 3108, 353, 1583, 29889, 1056, 29918, 8977, 3366, 1955, 29954, 16862, 6506, 14182, 29876, 613, 376, 29871, 16521, 13, 13, 18884, 25342, 1820, 1275, 376, 9342, 1115, 13, 462, 1678, 396, 20768, 304, 664, 714, 565, 896, 526, 2869, 6589, 515, 24206, 1913, 267, 297, 278, 937, 2058, 13, 462, 1678, 3440, 29918, 9012, 353, 1583, 29889, 23705, 1338, 29961, 1989, 1822, 5451, 14182, 29876, 1159, 13, 462, 1678, 4226, 29918, 21032, 353, 5159, 13, 462, 1678, 4226, 29918, 2055, 29918, 15581, 353, 6213, 13, 462, 1678, 4266, 29918, 21032, 353, 5159, 13, 462, 1678, 4266, 29918, 2055, 29918, 15581, 353, 6213, 13, 13, 462, 1678, 363, 1196, 297, 3440, 29918, 9012, 29901, 13, 462, 4706, 565, 1196, 29889, 2886, 29898, 28887, 3366, 1557, 29918, 2962, 20068, 1405, 448, 29896, 29901, 13, 462, 9651, 4266, 29918, 2055, 29918, 15581, 353, 29871, 29896, 13, 462, 4706, 25342, 1196, 29889, 2886, 29898, 28887, 3366, 1557, 29918, 355, 20068, 1405, 448, 29896, 29901, 13, 462, 9651, 4266, 29918, 2055, 29918, 15581, 353, 6213, 13, 462, 4706, 25342, 1196, 29889, 2886, 29898, 28887, 3366, 17608, 29918, 2962, 20068, 1405, 448, 29896, 29901, 13, 462, 9651, 4226, 29918, 2055, 29918, 15581, 353, 29871, 29896, 13, 462, 4706, 25342, 1196, 29889, 2886, 29898, 28887, 3366, 17608, 29918, 355, 20068, 1405, 448, 29896, 29901, 13, 462, 9651, 4226, 29918, 2055, 29918, 15581, 353, 6213, 13, 462, 4706, 25342, 4266, 29918, 2055, 29918, 15581, 1275, 29871, 29896, 29901, 13, 462, 9651, 4266, 29918, 21032, 29889, 4397, 29898, 1220, 29897, 13, 462, 4706, 25342, 4226, 29918, 2055, 29918, 15581, 1275, 29871, 29896, 29901, 13, 462, 9651, 4226, 29918, 21032, 29889, 4397, 29898, 1220, 29897, 13, 462, 4706, 25342, 1196, 29889, 2886, 29898, 28887, 3366, 1272, 29918, 4622, 20068, 1405, 448, 29896, 29901, 13, 462, 9651, 1209, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 4226, 29918, 21032, 29889, 4397, 29898, 1220, 29897, 268, 13, 13, 462, 1678, 1583, 29889, 17833, 29918, 21032, 353, 518, 18732, 29918, 21032, 29892, 4226, 29918, 21032, 29892, 5159, 29962, 268, 13, 13, 18884, 25342, 1820, 1275, 376, 4102, 29918, 3084, 29918, 1256, 29918, 974, 29918, 1272, 1115, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 3366, 6248, 3108, 353, 1583, 29889, 23705, 1338, 29961, 1989, 29962, 13, 13, 18884, 25342, 1820, 297, 4852, 1168, 794, 1080, 613, 376, 276, 10662, 29908, 1125, 13, 462, 1678, 396, 535, 7316, 29918, 272, 29918, 5679, 29918, 21032, 29889, 4397, 11702, 29879, 29901, 259, 1273, 29879, 29908, 1273, 313, 1989, 29892, 1583, 29889, 23705, 1338, 29961, 1989, 12622, 13, 462, 1678, 1583, 29889, 17833, 29918, 21032, 29961, 29906, 1822, 4397, 11702, 29879, 29901, 259, 1273, 29879, 29908, 1273, 313, 1989, 29892, 1583, 29889, 23705, 1338, 29961, 1989, 12622, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 29889, 1056, 29918, 8977, 29961, 17608, 29918, 517, 29918, 1056, 29918, 1958, 29961, 1989, 5262, 353, 1583, 29889, 23705, 1338, 29961, 1989, 29962, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 17833, 29918, 21032, 29961, 29906, 1822, 4397, 11702, 29879, 29901, 259, 1273, 29879, 29908, 1273, 313, 1989, 29892, 1583, 29889, 23705, 1338, 29961, 1989, 12622, 13, 4706, 736, 13, 13, 13, 1678, 822, 903, 7922, 3521, 1523, 1860, 29898, 1311, 29892, 4226, 29918, 21032, 11759, 1402, 4266, 29918, 21032, 29922, 2636, 1125, 13, 4706, 9995, 13, 4706, 5282, 1475, 278, 12630, 322, 21981, 6589, 13926, 297, 278, 24206, 1913, 267, 934, 29871, 13, 4706, 1203, 448, 3704, 2472, 22229, 515, 278, 4529, 3521, 29954, 2127, 1338, 1158, 29889, 13, 13, 4706, 624, 5708, 411, 1819, 4944, 363, 4226, 29918, 21032, 322, 4266, 29918, 21032, 29889, 13, 4706, 9995, 13, 4706, 565, 756, 5552, 29898, 1311, 29892, 376, 29876, 510, 29908, 1125, 29871, 4226, 29918, 21032, 353, 1583, 29889, 29876, 510, 718, 4226, 29918, 21032, 13, 13, 4706, 405, 19795, 353, 5159, 13, 4706, 363, 302, 510, 297, 4226, 29918, 21032, 29901, 13, 9651, 405, 19795, 29889, 4397, 29898, 29876, 510, 29897, 13, 13, 4706, 565, 7431, 29898, 29940, 19795, 29897, 1405, 29871, 29900, 29901, 259, 405, 19795, 29889, 4397, 703, 1159, 13, 13, 4706, 396, 4803, 4654, 2944, 297, 1583, 29889, 17833, 29918, 21032, 322, 12778, 304, 405, 19795, 13, 4706, 565, 7431, 29898, 1311, 29889, 17833, 29918, 21032, 29961, 29906, 2314, 1405, 29871, 29900, 29901, 13, 9651, 363, 429, 510, 297, 1583, 29889, 17833, 29918, 21032, 29961, 29906, 5387, 13, 18884, 405, 19795, 29889, 4397, 29898, 735, 510, 29897, 13, 13, 4706, 565, 7431, 29898, 1311, 29889, 17833, 29918, 21032, 29961, 29896, 2314, 1405, 29871, 29900, 29901, 259, 13, 9651, 405, 19795, 29889, 4397, 29898, 28887, 3366, 1202, 29880, 29918, 23705, 1338, 20068, 13, 9651, 363, 429, 510, 297, 1583, 29889, 17833, 29918, 21032, 29961, 29896, 5387, 13, 18884, 405, 19795, 29889, 4397, 29898, 735, 510, 29897, 13, 13, 4706, 565, 756, 5552, 29898, 1311, 29892, 376, 18434, 29908, 1125, 13, 9651, 363, 298, 297, 1583, 29889, 18434, 29901, 13, 18884, 405, 19795, 29889, 4397, 29898, 29882, 29897, 13, 4706, 13, 4706, 396, 1932, 405, 19795, 756, 1063, 3342, 769, 8388, 618, 372, 297, 777, 429, 10678, 29871, 13, 4706, 565, 7431, 29898, 29940, 19795, 29897, 1405, 29871, 29900, 29901, 13, 9651, 405, 19795, 29889, 7851, 29898, 29900, 29892, 298, 29886, 3366, 17608, 29918, 2962, 20068, 29871, 13, 9651, 405, 19795, 29889, 4397, 703, 1159, 13, 9651, 405, 19795, 29889, 4397, 29898, 28887, 3366, 17608, 29918, 355, 20068, 13, 9651, 405, 19795, 29889, 4397, 29898, 28887, 3366, 1272, 29918, 4622, 20068, 13, 13, 4706, 1580, 29918, 2055, 29918, 15581, 353, 6213, 13, 4706, 396, 7370, 411, 4266, 29918, 21032, 2715, 297, 13, 4706, 317, 19795, 353, 5159, 13, 13, 4706, 396, 10783, 267, 937, 2944, 297, 1583, 29889, 17833, 29918, 21032, 304, 1369, 317, 19795, 13, 4706, 4266, 29918, 21032, 353, 4266, 29918, 21032, 718, 1583, 29889, 17833, 29918, 21032, 29961, 29900, 29962, 13, 13, 4706, 565, 7431, 29898, 18732, 29918, 21032, 29897, 1405, 29871, 29900, 29901, 29871, 13, 9651, 317, 19795, 353, 518, 28887, 3366, 1557, 29918, 2962, 3108, 29962, 13, 9651, 1580, 29918, 2055, 29918, 15581, 353, 29871, 29896, 13, 13, 4706, 363, 269, 510, 297, 4266, 29918, 21032, 29901, 13, 9651, 317, 19795, 29889, 4397, 29898, 29879, 510, 29897, 13, 13, 4706, 1304, 29918, 1707, 29918, 1131, 29879, 353, 4852, 333, 613, 29871, 376, 27259, 29918, 1767, 613, 376, 5589, 29918, 1767, 613, 29871, 13, 462, 259, 376, 29876, 11290, 29918, 1280, 29918, 1707, 29918, 4537, 613, 376, 29876, 11290, 29918, 1280, 29918, 2993, 29918, 1707, 29918, 4537, 1159, 13, 4706, 722, 29918, 2055, 29918, 15581, 353, 6213, 13, 13, 4706, 396, 6204, 263, 1347, 363, 278, 12630, 6589, 304, 4808, 7115, 29899, 9171, 24987, 13, 4706, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 353, 5159, 13, 13, 4706, 363, 722, 297, 1583, 29889, 10003, 29918, 9171, 29918, 16908, 29901, 13, 9651, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 29889, 4397, 703, 29871, 28736, 1273, 29879, 29901, 1273, 29879, 29908, 1273, 313, 1707, 29889, 333, 29892, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 1707, 4961, 13, 13, 9651, 363, 1098, 297, 722, 29889, 15697, 29889, 8149, 7295, 13, 18884, 995, 353, 722, 29889, 15697, 29961, 1131, 29962, 13, 13, 18884, 565, 1134, 29898, 1767, 29897, 297, 313, 1853, 703, 29879, 4968, 1134, 29898, 29896, 29889, 29900, 511, 1134, 29898, 29896, 22164, 13, 13, 462, 1678, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 29889, 4397, 703, 1678, 1273, 29879, 353, 1273, 29879, 29908, 1273, 313, 1131, 29892, 722, 29889, 15697, 29961, 1131, 12622, 13, 13, 4706, 565, 7431, 29898, 10003, 29918, 9171, 29918, 16908, 29918, 1807, 29897, 1405, 29871, 29900, 29901, 13, 9651, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 29889, 7851, 29898, 29900, 29892, 298, 29886, 3366, 2976, 29918, 2962, 20068, 13, 9651, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 29889, 4397, 29898, 28887, 3366, 2976, 29918, 355, 20068, 13, 13, 4706, 363, 722, 297, 1583, 29889, 21693, 29918, 16908, 29901, 13, 9651, 722, 15581, 353, 376, 348, 3880, 29908, 13, 9651, 722, 29918, 978, 29918, 17625, 353, 7700, 13, 13, 9651, 1024, 353, 14965, 1516, 29918, 13239, 29889, 1707, 29918, 13239, 29889, 657, 25353, 1170, 29898, 1707, 29897, 13, 13, 9651, 363, 269, 510, 29892, 1767, 297, 722, 29889, 15697, 29889, 7076, 7295, 13, 18884, 565, 1134, 29898, 1767, 29897, 297, 313, 1853, 29898, 2636, 511, 1134, 29898, 29940, 29889, 2378, 4197, 29900, 29962, 4961, 322, 7431, 29898, 1767, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 995, 353, 995, 29961, 29900, 29962, 13, 13, 18884, 565, 1134, 29898, 1767, 29897, 297, 313, 1853, 703, 29879, 4968, 1134, 29898, 29896, 29889, 29896, 511, 1134, 29898, 29896, 876, 322, 269, 510, 451, 297, 1304, 29918, 1707, 29918, 1131, 29879, 29901, 13, 462, 1678, 565, 722, 15581, 1275, 376, 348, 3880, 1115, 13, 462, 4706, 565, 722, 29918, 2055, 29918, 15581, 1275, 6213, 29901, 13, 462, 9651, 722, 29918, 2055, 29918, 15581, 353, 29871, 29896, 13, 13, 462, 1678, 565, 1580, 29918, 2055, 29918, 15581, 1275, 6213, 29901, 13, 462, 4706, 317, 19795, 353, 518, 28887, 3366, 1557, 29918, 2962, 3108, 29962, 718, 7115, 29918, 9171, 29918, 16908, 29918, 1807, 13, 462, 4706, 317, 19795, 29889, 4397, 29898, 28887, 3366, 1202, 29880, 29918, 29894, 1131, 29879, 20068, 13, 462, 4706, 317, 19795, 29889, 4397, 29898, 28887, 3366, 17608, 1131, 29879, 29918, 2962, 20068, 13, 462, 4706, 722, 15581, 353, 376, 4746, 29908, 29871, 13, 462, 4706, 1580, 29918, 2055, 29918, 15581, 353, 29871, 29896, 13, 13, 462, 1678, 565, 451, 722, 29918, 978, 29918, 17625, 29901, 13, 462, 4706, 317, 19795, 29889, 4397, 703, 29871, 28736, 1273, 29879, 29901, 1273, 29879, 29908, 1273, 313, 1707, 29889, 333, 29892, 1024, 876, 13, 462, 4706, 722, 29918, 978, 29918, 17625, 353, 5852, 13, 13, 462, 1678, 317, 19795, 29889, 4397, 703, 1678, 1273, 29879, 353, 1273, 29879, 29908, 1273, 313, 29879, 510, 29892, 995, 876, 13, 13, 4706, 565, 722, 29918, 2055, 29918, 15581, 1275, 29871, 29896, 29901, 259, 13, 9651, 317, 19795, 29889, 4397, 29898, 28887, 3366, 17608, 1131, 29879, 29918, 355, 20068, 13, 4706, 565, 1580, 29918, 2055, 29918, 15581, 1275, 29871, 29896, 29901, 13, 9651, 317, 19795, 29889, 4397, 29898, 28887, 3366, 1557, 29918, 355, 20068, 13, 13, 4706, 396, 624, 6472, 714, 4069, 3454, 313, 272, 3639, 29897, 13, 4706, 405, 19795, 29918, 14941, 287, 353, 5159, 13, 4706, 317, 19795, 29918, 14941, 287, 353, 5159, 13, 13, 4706, 363, 274, 297, 405, 19795, 29901, 13, 9651, 565, 274, 29889, 17010, 580, 451, 297, 4852, 613, 376, 9162, 376, 29871, 376, 1125, 13, 18884, 396, 22108, 716, 3454, 2629, 697, 5352, 411, 263, 25899, 322, 4434, 577, 6775, 304, 1303, 13, 18884, 3454, 353, 274, 29889, 5451, 14182, 29876, 1159, 13, 18884, 363, 1196, 297, 3454, 29901, 13, 462, 1678, 565, 1196, 2804, 3454, 29961, 29900, 5387, 29871, 13, 462, 4706, 1196, 353, 376, 29871, 376, 718, 1196, 13, 13, 462, 1678, 405, 19795, 29918, 14941, 287, 29889, 4397, 29898, 1220, 29897, 13, 13, 4706, 363, 274, 297, 317, 19795, 29901, 13, 9651, 565, 274, 29889, 17010, 580, 451, 297, 4852, 613, 376, 9162, 376, 29871, 376, 1125, 13, 18884, 396, 22108, 716, 3454, 2629, 697, 5352, 411, 263, 25899, 322, 4434, 577, 6775, 304, 1303, 13, 18884, 3454, 353, 274, 29889, 5451, 14182, 29876, 1159, 13, 18884, 363, 1196, 297, 3454, 29901, 13, 462, 1678, 565, 1196, 2804, 3454, 29961, 29900, 5387, 29871, 13, 462, 4706, 1196, 353, 376, 29871, 376, 718, 1196, 13, 13, 462, 1678, 317, 19795, 29918, 14941, 287, 29889, 4397, 29898, 1220, 29897, 13, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 19795, 3108, 353, 405, 19795, 29918, 14941, 287, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 10262, 3217, 1988, 3108, 353, 7431, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29940, 19795, 20068, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29903, 19795, 3108, 353, 317, 19795, 29918, 14941, 287, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 3059, 3217, 1988, 3108, 353, 7431, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29903, 19795, 20068, 13, 4706, 736, 13, 13, 13, 1678, 822, 903, 7922, 15263, 7850, 29898, 1311, 29892, 4839, 29918, 7076, 3790, 29913, 1125, 13, 4706, 9995, 13, 4706, 5282, 1475, 2998, 4839, 4452, 322, 975, 8231, 267, 738, 411, 4839, 29918, 7076, 29871, 13, 4706, 1820, 29914, 1767, 11000, 29889, 13, 4706, 9995, 13, 4706, 9177, 29918, 4906, 353, 376, 29940, 14862, 24412, 29901, 6527, 451, 679, 278, 937, 2635, 297, 278, 934, 29889, 887, 674, 817, 304, 7522, 3863, 278, 1962, 934, 1213, 13, 13, 4706, 396, 5399, 565, 20231, 1746, 9251, 2998, 297, 24206, 1913, 267, 934, 13, 4706, 931, 29918, 3707, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 931, 29889, 710, 615, 603, 11702, 29979, 1273, 29885, 1273, 29881, 613, 931, 29889, 2997, 2230, 29898, 2230, 29889, 2230, 3101, 467, 5451, 580, 29962, 13, 13, 4706, 565, 451, 1583, 29889, 1056, 29918, 8977, 29889, 5349, 29918, 1989, 703, 29934, 6248, 29908, 1125, 13, 9651, 1583, 29889, 1056, 29918, 8977, 3366, 29934, 6248, 3108, 353, 931, 29918, 3707, 13, 13, 4706, 565, 1583, 29889, 1165, 29900, 29889, 275, 2481, 7295, 13, 9651, 396, 3617, 937, 2635, 297, 1051, 13, 9651, 1018, 29901, 13, 18884, 313, 5441, 29892, 1369, 29918, 1256, 29897, 353, 337, 29889, 4352, 703, 1194, 29893, 29974, 2144, 29879, 29974, 29973, 16076, 29905, 29879, 29974, 29973, 1194, 29881, 29974, 2612, 29881, 29974, 2612, 29881, 29974, 19123, 1583, 29889, 1165, 29900, 29889, 348, 1169, 467, 13155, 580, 632, 13, 18884, 18741, 603, 353, 14965, 2230, 29889, 29879, 29906, 29883, 29898, 2962, 29918, 1256, 29897, 13, 18884, 937, 29918, 3250, 353, 18741, 603, 29889, 1202, 29898, 1311, 29889, 1056, 29918, 8977, 3366, 29990, 3108, 29961, 29900, 1402, 679, 5552, 29898, 2252, 2230, 29892, 5190, 29889, 5030, 2410, 675, 22130, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 6248, 3108, 353, 518, 524, 29898, 29875, 29897, 363, 474, 297, 851, 29898, 4102, 29918, 3250, 467, 5451, 703, 376, 9601, 29900, 1822, 6506, 703, 29899, 613, 376, 376, 467, 5451, 580, 29962, 13, 9651, 5174, 29901, 13, 18884, 10191, 353, 9177, 29918, 4906, 13, 18884, 1480, 29889, 3888, 29898, 7645, 29897, 13, 18884, 1583, 29889, 4905, 29918, 4906, 29889, 4397, 29898, 7645, 29897, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 6248, 3108, 353, 518, 29929, 29929, 29929, 29962, 334, 29871, 29941, 29871, 13, 4706, 1683, 29901, 29871, 13, 9651, 565, 451, 1583, 29889, 1056, 29918, 8977, 29889, 5349, 29918, 1989, 703, 6248, 29908, 1125, 13, 18884, 10191, 353, 9177, 29918, 4906, 13, 18884, 1480, 29889, 3888, 29898, 7645, 29897, 13, 18884, 1583, 29889, 4905, 29918, 4906, 29889, 4397, 29898, 7645, 29897, 13, 18884, 1583, 29889, 1056, 29918, 8977, 3366, 6248, 3108, 353, 518, 29929, 29929, 29929, 29962, 334, 29871, 29941, 29871, 13, 9651, 1683, 29901, 13, 18884, 1209, 396, 474, 29889, 29872, 29889, 671, 5923, 20231, 13, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 5667, 5607, 3108, 353, 29871, 29896, 13, 4706, 1583, 29889, 1056, 29918, 8977, 3366, 29940, 29963, 5607, 3108, 353, 29871, 29896, 13, 4706, 363, 1820, 297, 4839, 29918, 7076, 29889, 8149, 7295, 13, 632, 1583, 29889, 1056, 29918, 8977, 29961, 1989, 29962, 353, 4839, 29918, 7076, 29961, 1989, 29962, 13, 13, 13, 1678, 822, 903, 657, 3434, 839, 2588, 2887, 1293, 29898, 1311, 29892, 3948, 29892, 4567, 29918, 1767, 1125, 13, 4706, 9995, 13, 4706, 323, 6926, 385, 1409, 4954, 2749, 16159, 313, 29872, 2121, 263, 12655, 1409, 470, 263, 341, 1278, 287, 4398, 467, 13, 4706, 960, 278, 1409, 338, 263, 11105, 287, 1409, 769, 5191, 11105, 287, 1819, 411, 29871, 13, 4706, 4954, 27259, 29918, 1767, 16159, 322, 3588, 304, 263, 12655, 1409, 29889, 13, 4706, 9788, 3588, 304, 263, 1051, 322, 736, 393, 29889, 13, 4706, 9995, 13, 4706, 565, 405, 29889, 655, 29889, 275, 19832, 287, 2588, 29898, 2749, 1125, 13, 9651, 3948, 353, 3948, 29889, 26940, 29898, 27259, 29918, 1767, 29897, 13, 13, 4706, 736, 3948, 7503, 1822, 25027, 391, 580, 13, 13, 2 ]
nowcasting_dataset/data_sources/fake.py
vnshanmukh/nowcasting_dataset
0
151346
""" To make fake Datasets Wanted to keep this out of the testing frame works, as other repos, might want to use this """ from typing import List import numpy as np import pandas as pd import xarray as xr from nowcasting_dataset.consts import NWP_VARIABLE_NAMES, SAT_VARIABLE_NAMES from nowcasting_dataset.data_sources.gsp.gsp_model import GSP from nowcasting_dataset.data_sources.metadata.metadata_model import Metadata from nowcasting_dataset.data_sources.nwp.nwp_model import NWP from nowcasting_dataset.data_sources.pv.pv_model import PV from nowcasting_dataset.data_sources.satellite.satellite_model import HRVSatellite, Satellite from nowcasting_dataset.data_sources.sun.sun_model import Sun from nowcasting_dataset.data_sources.topographic.topographic_model import Topographic from nowcasting_dataset.dataset.xr_utils import ( convert_coordinates_to_indexes, convert_coordinates_to_indexes_for_list_datasets, join_list_dataset_to_batch_dataset, ) def gsp_fake( batch_size, seq_length_30, n_gsp_per_batch, ): """Create fake data""" # make batch of arrays xr_datasets = [ create_gsp_pv_dataset( seq_length=seq_length_30, freq="30T", number_of_systems=n_gsp_per_batch, ) for _ in range(batch_size) ] # change dimensions to dimension indexes xr_datasets = convert_coordinates_to_indexes_for_list_datasets(xr_datasets) # make dataset xr_dataset = join_list_dataset_to_batch_dataset(xr_datasets) return GSP(xr_dataset) def metadata_fake(batch_size): """Make a xr dataset""" xr_arrays = [create_metadata_dataset() for _ in range(batch_size)] # change to indexes xr_arrays = [convert_coordinates_to_indexes(xr_array) for xr_array in xr_arrays] # make dataset xr_dataset = join_list_dataset_to_batch_dataset(xr_arrays) return Metadata(xr_dataset) def nwp_fake( batch_size=32, seq_length_5=19, image_size_pixels=64, number_nwp_channels=7, ) -> NWP: """Create fake data""" # make batch of arrays xr_arrays = [ create_image_array( seq_length_5=seq_length_5, image_size_pixels=image_size_pixels, channels=NWP_VARIABLE_NAMES[0:number_nwp_channels], ) for _ in range(batch_size) ] # make dataset xr_dataset = join_list_data_array_to_batch_dataset(xr_arrays) xr_dataset["init_time"] = xr_dataset.time[:, 0] return NWP(xr_dataset) def pv_fake(batch_size, seq_length_5, n_pv_systems_per_batch): """Create fake data""" # make batch of arrays xr_datasets = [ create_gsp_pv_dataset( seq_length=seq_length_5, freq="5T", number_of_systems=n_pv_systems_per_batch, time_dependent_capacity=False, ) for _ in range(batch_size) ] # change dimensions to dimension indexes xr_datasets = convert_coordinates_to_indexes_for_list_datasets(xr_datasets) # make dataset xr_dataset = join_list_dataset_to_batch_dataset(xr_datasets) return PV(xr_dataset) def satellite_fake( batch_size=32, seq_length_5=19, satellite_image_size_pixels=64, number_satellite_channels=7, ) -> Satellite: """Create fake data""" # make batch of arrays xr_arrays = [ create_image_array( seq_length_5=seq_length_5, image_size_pixels=satellite_image_size_pixels, channels=SAT_VARIABLE_NAMES[1:number_satellite_channels], ) for _ in range(batch_size) ] # make dataset xr_dataset = join_list_data_array_to_batch_dataset(xr_arrays) return Satellite(xr_dataset) def hrv_satellite_fake( batch_size=32, seq_length_5=19, satellite_image_size_pixels=64, number_satellite_channels=7, ) -> Satellite: """Create fake data""" # make batch of arrays xr_arrays = [ create_image_array( seq_length_5=seq_length_5, image_size_pixels=satellite_image_size_pixels * 3, # HRV images are 3x other images channels=SAT_VARIABLE_NAMES[0:1], ) for _ in range(batch_size) ] # make dataset xr_dataset = join_list_data_array_to_batch_dataset(xr_arrays) return HRVSatellite(xr_dataset) def sun_fake(batch_size, seq_length_5): """Create fake data""" # create dataset with both azimuth and elevation, index with time # make batch of arrays xr_arrays = [ create_sun_dataset( seq_length=seq_length_5, ) for _ in range(batch_size) ] # make dataset xr_dataset = join_list_dataset_to_batch_dataset(xr_arrays) return Sun(xr_dataset) def topographic_fake(batch_size, image_size_pixels): """Create fake data""" # make batch of arrays xr_arrays = [ xr.DataArray( data=np.random.randn( image_size_pixels, image_size_pixels, ), dims=["x", "y"], coords=dict( x=np.sort(np.random.randn(image_size_pixels)), y=np.sort(np.random.randn(image_size_pixels))[::-1].copy(), ), name="data", ) for _ in range(batch_size) ] # make dataset xr_dataset = join_list_data_array_to_batch_dataset(xr_arrays) return Topographic(xr_dataset) def create_image_array( dims=("time", "x", "y", "channels"), seq_length_5=19, image_size_pixels=64, channels=SAT_VARIABLE_NAMES, ): """Create Satellite or NWP fake image data""" ALL_COORDS = { "time": pd.date_range("2021-01-01", freq="5T", periods=seq_length_5), "x": np.random.randint(low=0, high=1000, size=image_size_pixels), "y": np.random.randint(low=0, high=1000, size=image_size_pixels), "channels": np.array(channels), } coords = [(dim, ALL_COORDS[dim]) for dim in dims] image_data_array = xr.DataArray( abs( np.random.randn( seq_length_5, image_size_pixels, image_size_pixels, len(channels), ) ), coords=coords, name="data", ) # Fake data for testing! return image_data_array def create_gsp_pv_dataset( dims=("time", "id"), freq="5T", seq_length=19, number_of_systems=128, time_dependent_capacity: bool = True, ) -> xr.Dataset: """ Create gsp or pv fake dataset Args: dims: the dims that are made for "power_mw" freq: the frequency of the time steps seq_length: the time sequence length number_of_systems: number of pv or gsp systems time_dependent_capacity: if the capacity is time dependent. GSP capacities increase over time, but PV systems are the same (or should be). Returns: xr.Dataset of fake data """ ALL_COORDS = { "time": pd.date_range("2021-01-01", freq=freq, periods=seq_length), "id": np.random.choice(range(1000), number_of_systems, replace=False), } coords = [(dim, ALL_COORDS[dim]) for dim in dims] data_array = xr.DataArray( np.random.randn( seq_length, number_of_systems, ), coords=coords, ) # Fake data for testing! if time_dependent_capacity: capacity = xr.DataArray( np.repeat(np.random.randn(seq_length), number_of_systems) .reshape(number_of_systems, seq_length) .T, coords=coords, ) else: capacity = xr.DataArray( np.random.randn(number_of_systems), coords=[coords[1]], ) data = data_array.to_dataset(name="power_mw") x_coords = xr.DataArray( data=np.sort( np.random.choice(range(2 * number_of_systems), number_of_systems, replace=False) ), dims=["id"], ) y_coords = xr.DataArray( data=np.sort( np.random.choice(range(2 * number_of_systems), number_of_systems, replace=False) ), dims=["id"], ) data["capacity_mwp"] = capacity data["x_coords"] = x_coords data["y_coords"] = y_coords # Add 1000 to the id numbers for the row numbers. # This is a quick way to make sure row number is different from id, data["pv_system_row_number"] = data["id"] + 1000 data.__setitem__("power_mw", data.power_mw.clip(min=0)) return data def create_sun_dataset( dims=("time",), freq="5T", seq_length=19, ) -> xr.Dataset: """ Create sun fake dataset Args: dims: # TODO freq: # TODO seq_length: # TODO Returns: # TODO """ ALL_COORDS = { "time": pd.date_range("2021-01-01", freq=freq, periods=seq_length), } coords = [(dim, ALL_COORDS[dim]) for dim in dims] data_array = xr.DataArray( np.random.randn( seq_length, ), coords=coords, ) # Fake data for testing! sun = data_array.to_dataset(name="elevation") sun["azimuth"] = sun.elevation sun.__setitem__("azimuth", sun.azimuth.clip(min=0, max=360)) sun.__setitem__("elevation", sun.elevation.clip(min=-90, max=90)) sun = convert_coordinates_to_indexes(sun) return sun def create_metadata_dataset() -> xr.Dataset: """Create fake metadata dataset""" d = { "dims": ("t0_dt",), "data": pd.date_range("2021-01-01", freq="5T", periods=1) + pd.Timedelta("30T"), } data = (xr.DataArray.from_dict(d)).to_dataset(name="data") for v in ["x_meters_center", "y_meters_center", "object_at_center_label"]: d: dict = {"dims": ("t0_dt",), "data": [np.random.randint(0, 1000)]} d: xr.Dataset = (xr.DataArray.from_dict(d)).to_dataset(name=v) data[v] = getattr(d, v) return data def create_datetime_dataset( seq_length=19, ) -> xr.Dataset: """Create fake datetime dataset""" ALL_COORDS = { "time": pd.date_range("2021-01-01", freq="5T", periods=seq_length), } coords = [("time", ALL_COORDS["time"])] data_array = xr.DataArray( np.random.randn( seq_length, ), coords=coords, ) # Fake data data = data_array.to_dataset() ds = data.rename({"data": "day_of_year_cos"}) ds["day_of_year_sin"] = data.rename({"data": "day_of_year_sin"}).day_of_year_sin ds["hour_of_day_cos"] = data.rename({"data": "hour_of_day_cos"}).hour_of_day_cos ds["hour_of_day_sin"] = data.rename({"data": "hour_of_day_sin"}).hour_of_day_sin return data def join_list_data_array_to_batch_dataset(data_arrays: List[xr.DataArray]) -> xr.Dataset: """Join a list of xr.DataArrays into an xr.Dataset by concatenating on the example dim.""" datasets = [ convert_coordinates_to_indexes(data_arrays[i].to_dataset()) for i in range(len(data_arrays)) ] return join_list_dataset_to_batch_dataset(datasets)
[ 1, 9995, 1763, 1207, 25713, 13373, 294, 1691, 13, 13, 29956, 9714, 304, 3013, 445, 714, 310, 278, 6724, 3515, 1736, 29892, 408, 916, 17573, 29892, 1795, 864, 304, 671, 445, 13, 15945, 29908, 13, 3166, 19229, 1053, 2391, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 921, 2378, 408, 921, 29878, 13, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 3075, 29879, 1053, 405, 26433, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 29892, 317, 1299, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 29887, 1028, 29889, 29887, 1028, 29918, 4299, 1053, 402, 5550, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 19635, 29889, 19635, 29918, 4299, 1053, 4737, 7221, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 29876, 11912, 29889, 29876, 11912, 29918, 4299, 1053, 405, 26433, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 29886, 29894, 29889, 29886, 29894, 29918, 4299, 1053, 349, 29963, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 29879, 271, 20911, 29889, 29879, 271, 20911, 29918, 4299, 1053, 379, 29934, 21819, 271, 20911, 29892, 12178, 20911, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 11445, 29889, 11445, 29918, 4299, 1053, 8991, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 1272, 29918, 29879, 2863, 29889, 3332, 12122, 29889, 3332, 12122, 29918, 4299, 1053, 7488, 12122, 13, 3166, 1286, 4384, 292, 29918, 24713, 29889, 24713, 29889, 29916, 29878, 29918, 13239, 1053, 313, 13, 1678, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29892, 13, 1678, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29918, 1454, 29918, 1761, 29918, 14538, 1691, 29892, 13, 1678, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29892, 13, 29897, 13, 13, 13, 1753, 330, 1028, 29918, 29888, 1296, 29898, 13, 1678, 9853, 29918, 2311, 29892, 13, 1678, 19359, 29918, 2848, 29918, 29941, 29900, 29892, 13, 1678, 302, 29918, 29887, 1028, 29918, 546, 29918, 16175, 29892, 13, 1125, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 14538, 1691, 353, 518, 13, 4706, 1653, 29918, 29887, 1028, 29918, 29886, 29894, 29918, 24713, 29898, 13, 9651, 19359, 29918, 2848, 29922, 11762, 29918, 2848, 29918, 29941, 29900, 29892, 13, 9651, 3005, 29939, 543, 29941, 29900, 29911, 613, 13, 9651, 1353, 29918, 974, 29918, 5205, 29879, 29922, 29876, 29918, 29887, 1028, 29918, 546, 29918, 16175, 29892, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1735, 13391, 304, 9927, 18111, 13, 1678, 921, 29878, 29918, 14538, 1691, 353, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29918, 1454, 29918, 1761, 29918, 14538, 1691, 29898, 29916, 29878, 29918, 14538, 1691, 29897, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 14538, 1691, 29897, 13, 13, 1678, 736, 402, 5550, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 15562, 29918, 29888, 1296, 29898, 16175, 29918, 2311, 1125, 13, 1678, 9995, 9984, 263, 921, 29878, 8783, 15945, 29908, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 3258, 29918, 19635, 29918, 24713, 580, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 4638, 13, 13, 1678, 396, 1735, 304, 18111, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13441, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29898, 29916, 29878, 29918, 2378, 29897, 363, 921, 29878, 29918, 2378, 297, 921, 29878, 29918, 2378, 29879, 29962, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 736, 4737, 7221, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 302, 11912, 29918, 29888, 1296, 29898, 13, 1678, 9853, 29918, 2311, 29922, 29941, 29906, 29892, 13, 1678, 19359, 29918, 2848, 29918, 29945, 29922, 29896, 29929, 29892, 13, 1678, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29953, 29946, 29892, 13, 1678, 1353, 29918, 29876, 11912, 29918, 305, 12629, 29922, 29955, 29892, 13, 29897, 1599, 405, 26433, 29901, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13, 4706, 1653, 29918, 3027, 29918, 2378, 29898, 13, 9651, 19359, 29918, 2848, 29918, 29945, 29922, 11762, 29918, 2848, 29918, 29945, 29892, 13, 9651, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29922, 3027, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 9651, 18196, 29922, 29940, 26433, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 29961, 29900, 29901, 4537, 29918, 29876, 11912, 29918, 305, 12629, 1402, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 1272, 29918, 2378, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 921, 29878, 29918, 24713, 3366, 2344, 29918, 2230, 3108, 353, 921, 29878, 29918, 24713, 29889, 2230, 7503, 29892, 29871, 29900, 29962, 13, 13, 1678, 736, 405, 26433, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 282, 29894, 29918, 29888, 1296, 29898, 16175, 29918, 2311, 29892, 19359, 29918, 2848, 29918, 29945, 29892, 302, 29918, 29886, 29894, 29918, 5205, 29879, 29918, 546, 29918, 16175, 1125, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 14538, 1691, 353, 518, 13, 4706, 1653, 29918, 29887, 1028, 29918, 29886, 29894, 29918, 24713, 29898, 13, 9651, 19359, 29918, 2848, 29922, 11762, 29918, 2848, 29918, 29945, 29892, 13, 9651, 3005, 29939, 543, 29945, 29911, 613, 13, 9651, 1353, 29918, 974, 29918, 5205, 29879, 29922, 29876, 29918, 29886, 29894, 29918, 5205, 29879, 29918, 546, 29918, 16175, 29892, 13, 9651, 931, 29918, 18980, 29918, 5030, 5946, 29922, 8824, 29892, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1735, 13391, 304, 9927, 18111, 13, 1678, 921, 29878, 29918, 14538, 1691, 353, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29918, 1454, 29918, 1761, 29918, 14538, 1691, 29898, 29916, 29878, 29918, 14538, 1691, 29897, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 14538, 1691, 29897, 13, 13, 1678, 736, 349, 29963, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 28421, 29918, 29888, 1296, 29898, 13, 1678, 9853, 29918, 2311, 29922, 29941, 29906, 29892, 13, 1678, 19359, 29918, 2848, 29918, 29945, 29922, 29896, 29929, 29892, 13, 1678, 28421, 29918, 3027, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29953, 29946, 29892, 13, 1678, 1353, 29918, 29879, 271, 20911, 29918, 305, 12629, 29922, 29955, 29892, 13, 29897, 1599, 12178, 20911, 29901, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13, 4706, 1653, 29918, 3027, 29918, 2378, 29898, 13, 9651, 19359, 29918, 2848, 29918, 29945, 29922, 11762, 29918, 2848, 29918, 29945, 29892, 13, 9651, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29879, 271, 20911, 29918, 3027, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 9651, 18196, 29922, 29903, 1299, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 29961, 29896, 29901, 4537, 29918, 29879, 271, 20911, 29918, 305, 12629, 1402, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 1272, 29918, 2378, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 736, 12178, 20911, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 298, 15291, 29918, 29879, 271, 20911, 29918, 29888, 1296, 29898, 13, 1678, 9853, 29918, 2311, 29922, 29941, 29906, 29892, 13, 1678, 19359, 29918, 2848, 29918, 29945, 29922, 29896, 29929, 29892, 13, 1678, 28421, 29918, 3027, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29953, 29946, 29892, 13, 1678, 1353, 29918, 29879, 271, 20911, 29918, 305, 12629, 29922, 29955, 29892, 13, 29897, 1599, 12178, 20911, 29901, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13, 4706, 1653, 29918, 3027, 29918, 2378, 29898, 13, 9651, 19359, 29918, 2848, 29918, 29945, 29922, 11762, 29918, 2848, 29918, 29945, 29892, 13, 9651, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29879, 271, 20911, 29918, 3027, 29918, 2311, 29918, 29886, 861, 1379, 334, 29871, 29941, 29892, 29871, 396, 379, 29934, 29963, 4558, 526, 29871, 29941, 29916, 916, 4558, 13, 9651, 18196, 29922, 29903, 1299, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 29961, 29900, 29901, 29896, 1402, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 1272, 29918, 2378, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 736, 379, 29934, 21819, 271, 20911, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 6575, 29918, 29888, 1296, 29898, 16175, 29918, 2311, 29892, 19359, 29918, 2848, 29918, 29945, 1125, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1653, 8783, 411, 1716, 2698, 326, 2806, 322, 11858, 362, 29892, 2380, 411, 931, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13, 4706, 1653, 29918, 11445, 29918, 24713, 29898, 13, 9651, 19359, 29918, 2848, 29922, 11762, 29918, 2848, 29918, 29945, 29892, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 736, 8991, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 2246, 12122, 29918, 29888, 1296, 29898, 16175, 29918, 2311, 29892, 1967, 29918, 2311, 29918, 29886, 861, 1379, 1125, 13, 1678, 9995, 4391, 25713, 848, 15945, 29908, 13, 1678, 396, 1207, 9853, 310, 7049, 13, 1678, 921, 29878, 29918, 2378, 29879, 353, 518, 13, 4706, 921, 29878, 29889, 1469, 2588, 29898, 13, 9651, 848, 29922, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 13, 18884, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 18884, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 9651, 10353, 13, 9651, 3964, 29879, 29922, 3366, 29916, 613, 376, 29891, 12436, 13, 9651, 1302, 4339, 29922, 8977, 29898, 13, 18884, 921, 29922, 9302, 29889, 6605, 29898, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 3027, 29918, 2311, 29918, 29886, 861, 1379, 8243, 13, 18884, 343, 29922, 9302, 29889, 6605, 29898, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 3027, 29918, 2311, 29918, 29886, 861, 1379, 876, 29961, 1057, 29899, 29896, 1822, 8552, 3285, 13, 9651, 10353, 13, 9651, 1024, 543, 1272, 613, 13, 4706, 1723, 13, 4706, 363, 903, 297, 3464, 29898, 16175, 29918, 2311, 29897, 13, 1678, 4514, 13, 13, 1678, 396, 1207, 8783, 13, 1678, 921, 29878, 29918, 24713, 353, 5988, 29918, 1761, 29918, 1272, 29918, 2378, 29918, 517, 29918, 16175, 29918, 24713, 29898, 29916, 29878, 29918, 2378, 29879, 29897, 13, 13, 1678, 736, 7488, 12122, 29898, 29916, 29878, 29918, 24713, 29897, 13, 13, 13, 1753, 1653, 29918, 3027, 29918, 2378, 29898, 13, 1678, 3964, 29879, 29922, 703, 2230, 613, 376, 29916, 613, 376, 29891, 613, 376, 305, 12629, 4968, 13, 1678, 19359, 29918, 2848, 29918, 29945, 29922, 29896, 29929, 29892, 13, 1678, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29922, 29953, 29946, 29892, 13, 1678, 18196, 29922, 29903, 1299, 29918, 26865, 29902, 6181, 29918, 5813, 29903, 29892, 13, 1125, 13, 1678, 9995, 4391, 12178, 20911, 470, 405, 26433, 25713, 1967, 848, 15945, 29908, 13, 1678, 15149, 29918, 3217, 1955, 8452, 353, 426, 13, 4706, 376, 2230, 1115, 10518, 29889, 1256, 29918, 3881, 703, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 613, 3005, 29939, 543, 29945, 29911, 613, 23704, 29922, 11762, 29918, 2848, 29918, 29945, 511, 13, 4706, 376, 29916, 1115, 7442, 29889, 8172, 29889, 9502, 524, 29898, 677, 29922, 29900, 29892, 1880, 29922, 29896, 29900, 29900, 29900, 29892, 2159, 29922, 3027, 29918, 2311, 29918, 29886, 861, 1379, 511, 13, 4706, 376, 29891, 1115, 7442, 29889, 8172, 29889, 9502, 524, 29898, 677, 29922, 29900, 29892, 1880, 29922, 29896, 29900, 29900, 29900, 29892, 2159, 29922, 3027, 29918, 2311, 29918, 29886, 861, 1379, 511, 13, 4706, 376, 305, 12629, 1115, 7442, 29889, 2378, 29898, 305, 12629, 511, 13, 1678, 500, 13, 1678, 1302, 4339, 353, 17288, 6229, 29892, 15149, 29918, 3217, 1955, 8452, 29961, 6229, 2314, 363, 3964, 297, 3964, 29879, 29962, 13, 1678, 1967, 29918, 1272, 29918, 2378, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 6425, 29898, 13, 9651, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 13, 18884, 19359, 29918, 2848, 29918, 29945, 29892, 13, 18884, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 18884, 1967, 29918, 2311, 29918, 29886, 861, 1379, 29892, 13, 18884, 7431, 29898, 305, 12629, 511, 13, 9651, 1723, 13, 4706, 10353, 13, 4706, 1302, 4339, 29922, 1111, 4339, 29892, 13, 4706, 1024, 543, 1272, 613, 13, 1678, 1723, 29871, 396, 383, 1296, 848, 363, 6724, 29991, 13, 1678, 736, 1967, 29918, 1272, 29918, 2378, 13, 13, 13, 1753, 1653, 29918, 29887, 1028, 29918, 29886, 29894, 29918, 24713, 29898, 13, 1678, 3964, 29879, 29922, 703, 2230, 613, 376, 333, 4968, 13, 1678, 3005, 29939, 543, 29945, 29911, 613, 13, 1678, 19359, 29918, 2848, 29922, 29896, 29929, 29892, 13, 1678, 1353, 29918, 974, 29918, 5205, 29879, 29922, 29896, 29906, 29947, 29892, 13, 1678, 931, 29918, 18980, 29918, 5030, 5946, 29901, 6120, 353, 5852, 29892, 13, 29897, 1599, 921, 29878, 29889, 16390, 24541, 29901, 13, 1678, 9995, 13, 1678, 6204, 330, 1028, 470, 282, 29894, 25713, 8783, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3964, 29879, 29901, 278, 3964, 29879, 393, 526, 1754, 363, 376, 13519, 29918, 29885, 29893, 29908, 13, 4706, 3005, 29939, 29901, 278, 10868, 310, 278, 931, 6576, 13, 4706, 19359, 29918, 2848, 29901, 278, 931, 5665, 3309, 13, 4706, 1353, 29918, 974, 29918, 5205, 29879, 29901, 1353, 310, 282, 29894, 470, 330, 1028, 6757, 13, 4706, 931, 29918, 18980, 29918, 5030, 5946, 29901, 565, 278, 13284, 338, 931, 14278, 29889, 13, 9651, 402, 5550, 11101, 1907, 7910, 975, 931, 29892, 13, 9651, 541, 349, 29963, 6757, 526, 278, 1021, 313, 272, 881, 367, 467, 13, 13, 1678, 16969, 29901, 921, 29878, 29889, 16390, 24541, 310, 25713, 848, 13, 13, 1678, 9995, 13, 1678, 15149, 29918, 3217, 1955, 8452, 353, 426, 13, 4706, 376, 2230, 1115, 10518, 29889, 1256, 29918, 3881, 703, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 613, 3005, 29939, 29922, 29888, 7971, 29892, 23704, 29922, 11762, 29918, 2848, 511, 13, 4706, 376, 333, 1115, 7442, 29889, 8172, 29889, 16957, 29898, 3881, 29898, 29896, 29900, 29900, 29900, 511, 1353, 29918, 974, 29918, 5205, 29879, 29892, 5191, 29922, 8824, 511, 13, 1678, 500, 13, 1678, 1302, 4339, 353, 17288, 6229, 29892, 15149, 29918, 3217, 1955, 8452, 29961, 6229, 2314, 363, 3964, 297, 3964, 29879, 29962, 13, 1678, 848, 29918, 2378, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 13, 9651, 19359, 29918, 2848, 29892, 13, 9651, 1353, 29918, 974, 29918, 5205, 29879, 29892, 13, 4706, 10353, 13, 4706, 1302, 4339, 29922, 1111, 4339, 29892, 13, 1678, 1723, 29871, 396, 383, 1296, 848, 363, 6724, 29991, 13, 13, 1678, 565, 931, 29918, 18980, 29918, 5030, 5946, 29901, 13, 4706, 13284, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 9651, 7442, 29889, 14358, 29898, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 11762, 29918, 2848, 511, 1353, 29918, 974, 29918, 5205, 29879, 29897, 13, 9651, 869, 690, 14443, 29898, 4537, 29918, 974, 29918, 5205, 29879, 29892, 19359, 29918, 2848, 29897, 13, 9651, 869, 29911, 29892, 13, 9651, 1302, 4339, 29922, 1111, 4339, 29892, 13, 4706, 1723, 13, 1678, 1683, 29901, 13, 4706, 13284, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 9651, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 4537, 29918, 974, 29918, 5205, 29879, 511, 13, 9651, 1302, 4339, 11759, 1111, 4339, 29961, 29896, 20526, 13, 4706, 1723, 13, 13, 1678, 848, 353, 848, 29918, 2378, 29889, 517, 29918, 24713, 29898, 978, 543, 13519, 29918, 29885, 29893, 1159, 13, 13, 1678, 921, 29918, 1111, 4339, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 848, 29922, 9302, 29889, 6605, 29898, 13, 9651, 7442, 29889, 8172, 29889, 16957, 29898, 3881, 29898, 29906, 334, 1353, 29918, 974, 29918, 5205, 29879, 511, 1353, 29918, 974, 29918, 5205, 29879, 29892, 5191, 29922, 8824, 29897, 13, 4706, 10353, 13, 4706, 3964, 29879, 29922, 3366, 333, 12436, 13, 1678, 1723, 13, 13, 1678, 343, 29918, 1111, 4339, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 848, 29922, 9302, 29889, 6605, 29898, 13, 9651, 7442, 29889, 8172, 29889, 16957, 29898, 3881, 29898, 29906, 334, 1353, 29918, 974, 29918, 5205, 29879, 511, 1353, 29918, 974, 29918, 5205, 29879, 29892, 5191, 29922, 8824, 29897, 13, 4706, 10353, 13, 4706, 3964, 29879, 29922, 3366, 333, 12436, 13, 1678, 1723, 13, 13, 1678, 848, 3366, 5030, 5946, 29918, 29885, 11912, 3108, 353, 13284, 13, 1678, 848, 3366, 29916, 29918, 1111, 4339, 3108, 353, 921, 29918, 1111, 4339, 13, 1678, 848, 3366, 29891, 29918, 1111, 4339, 3108, 353, 343, 29918, 1111, 4339, 13, 13, 1678, 396, 3462, 29871, 29896, 29900, 29900, 29900, 304, 278, 1178, 3694, 363, 278, 1948, 3694, 29889, 13, 1678, 396, 910, 338, 263, 4996, 982, 304, 1207, 1854, 1948, 1353, 338, 1422, 515, 1178, 29892, 13, 1678, 848, 3366, 29886, 29894, 29918, 5205, 29918, 798, 29918, 4537, 3108, 353, 848, 3366, 333, 3108, 718, 29871, 29896, 29900, 29900, 29900, 13, 13, 1678, 848, 17255, 842, 667, 1649, 703, 13519, 29918, 29885, 29893, 613, 848, 29889, 13519, 29918, 29885, 29893, 29889, 24049, 29898, 1195, 29922, 29900, 876, 13, 13, 1678, 736, 848, 13, 13, 13, 1753, 1653, 29918, 11445, 29918, 24713, 29898, 13, 1678, 3964, 29879, 29922, 703, 2230, 613, 511, 13, 1678, 3005, 29939, 543, 29945, 29911, 613, 13, 1678, 19359, 29918, 2848, 29922, 29896, 29929, 29892, 13, 29897, 1599, 921, 29878, 29889, 16390, 24541, 29901, 13, 1678, 9995, 13, 1678, 6204, 6575, 25713, 8783, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3964, 29879, 29901, 396, 14402, 13, 4706, 3005, 29939, 29901, 396, 14402, 13, 4706, 19359, 29918, 2848, 29901, 396, 14402, 13, 13, 1678, 16969, 29901, 396, 14402, 13, 13, 1678, 9995, 13, 1678, 15149, 29918, 3217, 1955, 8452, 353, 426, 13, 4706, 376, 2230, 1115, 10518, 29889, 1256, 29918, 3881, 703, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 613, 3005, 29939, 29922, 29888, 7971, 29892, 23704, 29922, 11762, 29918, 2848, 511, 13, 1678, 500, 13, 1678, 1302, 4339, 353, 17288, 6229, 29892, 15149, 29918, 3217, 1955, 8452, 29961, 6229, 2314, 363, 3964, 297, 3964, 29879, 29962, 13, 1678, 848, 29918, 2378, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 13, 9651, 19359, 29918, 2848, 29892, 13, 4706, 10353, 13, 4706, 1302, 4339, 29922, 1111, 4339, 29892, 13, 1678, 1723, 29871, 396, 383, 1296, 848, 363, 6724, 29991, 13, 13, 1678, 6575, 353, 848, 29918, 2378, 29889, 517, 29918, 24713, 29898, 978, 543, 29872, 2608, 362, 1159, 13, 1678, 6575, 3366, 834, 326, 2806, 3108, 353, 6575, 29889, 29872, 2608, 362, 13, 13, 1678, 6575, 17255, 842, 667, 1649, 703, 834, 326, 2806, 613, 6575, 29889, 834, 326, 2806, 29889, 24049, 29898, 1195, 29922, 29900, 29892, 4236, 29922, 29941, 29953, 29900, 876, 13, 1678, 6575, 17255, 842, 667, 1649, 703, 29872, 2608, 362, 613, 6575, 29889, 29872, 2608, 362, 29889, 24049, 29898, 1195, 10457, 29929, 29900, 29892, 4236, 29922, 29929, 29900, 876, 13, 13, 1678, 6575, 353, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29898, 11445, 29897, 13, 13, 1678, 736, 6575, 13, 13, 13, 1753, 1653, 29918, 19635, 29918, 24713, 580, 1599, 921, 29878, 29889, 16390, 24541, 29901, 13, 1678, 9995, 4391, 25713, 15562, 8783, 15945, 29908, 13, 1678, 270, 353, 426, 13, 4706, 376, 6229, 29879, 1115, 4852, 29873, 29900, 29918, 6008, 613, 511, 13, 4706, 376, 1272, 1115, 10518, 29889, 1256, 29918, 3881, 703, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 613, 3005, 29939, 543, 29945, 29911, 613, 23704, 29922, 29896, 29897, 718, 10518, 29889, 13711, 287, 2554, 703, 29941, 29900, 29911, 4968, 13, 1678, 500, 13, 13, 1678, 848, 353, 313, 29916, 29878, 29889, 1469, 2588, 29889, 3166, 29918, 8977, 29898, 29881, 8106, 517, 29918, 24713, 29898, 978, 543, 1272, 1159, 13, 13, 1678, 363, 325, 297, 6796, 29916, 29918, 2527, 414, 29918, 5064, 613, 376, 29891, 29918, 2527, 414, 29918, 5064, 613, 376, 3318, 29918, 271, 29918, 5064, 29918, 1643, 3108, 29901, 13, 4706, 270, 29901, 9657, 353, 8853, 6229, 29879, 1115, 4852, 29873, 29900, 29918, 6008, 613, 511, 376, 1272, 1115, 518, 9302, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 4638, 29913, 13, 4706, 270, 29901, 921, 29878, 29889, 16390, 24541, 353, 313, 29916, 29878, 29889, 1469, 2588, 29889, 3166, 29918, 8977, 29898, 29881, 8106, 517, 29918, 24713, 29898, 978, 29922, 29894, 29897, 13, 4706, 848, 29961, 29894, 29962, 353, 679, 5552, 29898, 29881, 29892, 325, 29897, 13, 13, 1678, 736, 848, 13, 13, 13, 1753, 1653, 29918, 12673, 29918, 24713, 29898, 13, 1678, 19359, 29918, 2848, 29922, 29896, 29929, 29892, 13, 29897, 1599, 921, 29878, 29889, 16390, 24541, 29901, 13, 1678, 9995, 4391, 25713, 12865, 8783, 15945, 29908, 13, 1678, 15149, 29918, 3217, 1955, 8452, 353, 426, 13, 4706, 376, 2230, 1115, 10518, 29889, 1256, 29918, 3881, 703, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29896, 613, 3005, 29939, 543, 29945, 29911, 613, 23704, 29922, 11762, 29918, 2848, 511, 13, 1678, 500, 13, 1678, 1302, 4339, 353, 518, 703, 2230, 613, 15149, 29918, 3217, 1955, 8452, 3366, 2230, 20068, 29962, 13, 1678, 848, 29918, 2378, 353, 921, 29878, 29889, 1469, 2588, 29898, 13, 4706, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 13, 9651, 19359, 29918, 2848, 29892, 13, 4706, 10353, 13, 4706, 1302, 4339, 29922, 1111, 4339, 29892, 13, 1678, 1723, 29871, 396, 383, 1296, 848, 13, 13, 1678, 848, 353, 848, 29918, 2378, 29889, 517, 29918, 24713, 580, 13, 13, 1678, 18031, 353, 848, 29889, 1267, 420, 3319, 29908, 1272, 1115, 376, 3250, 29918, 974, 29918, 6360, 29918, 3944, 29908, 1800, 13, 1678, 18031, 3366, 3250, 29918, 974, 29918, 6360, 29918, 5223, 3108, 353, 848, 29889, 1267, 420, 3319, 29908, 1272, 1115, 376, 3250, 29918, 974, 29918, 6360, 29918, 5223, 29908, 7690, 3250, 29918, 974, 29918, 6360, 29918, 5223, 13, 1678, 18031, 3366, 18721, 29918, 974, 29918, 3250, 29918, 3944, 3108, 353, 848, 29889, 1267, 420, 3319, 29908, 1272, 1115, 376, 18721, 29918, 974, 29918, 3250, 29918, 3944, 29908, 7690, 18721, 29918, 974, 29918, 3250, 29918, 3944, 13, 1678, 18031, 3366, 18721, 29918, 974, 29918, 3250, 29918, 5223, 3108, 353, 848, 29889, 1267, 420, 3319, 29908, 1272, 1115, 376, 18721, 29918, 974, 29918, 3250, 29918, 5223, 29908, 7690, 18721, 29918, 974, 29918, 3250, 29918, 5223, 13, 13, 1678, 736, 848, 13, 13, 13, 1753, 5988, 29918, 1761, 29918, 1272, 29918, 2378, 29918, 517, 29918, 16175, 29918, 24713, 29898, 1272, 29918, 2378, 29879, 29901, 2391, 29961, 29916, 29878, 29889, 1469, 2588, 2314, 1599, 921, 29878, 29889, 16390, 24541, 29901, 13, 1678, 9995, 17242, 263, 1051, 310, 921, 29878, 29889, 1469, 2588, 29879, 964, 385, 921, 29878, 29889, 16390, 24541, 491, 16125, 1218, 373, 278, 1342, 3964, 1213, 15945, 13, 1678, 20035, 353, 518, 13, 4706, 3588, 29918, 1111, 24266, 29918, 517, 29918, 2248, 267, 29898, 1272, 29918, 2378, 29879, 29961, 29875, 1822, 517, 29918, 24713, 3101, 363, 474, 297, 3464, 29898, 2435, 29898, 1272, 29918, 2378, 29879, 876, 13, 1678, 4514, 13, 13, 1678, 736, 5988, 29918, 1761, 29918, 24713, 29918, 517, 29918, 16175, 29918, 24713, 29898, 14538, 1691, 29897, 13, 2 ]
ronin_3d/source/ronin_lstm_tcn.py
zju3dv/rnin-vio
10
37782
import json import os import sys import time from os import path as osp from pathlib import Path from shutil import copyfile import numpy as np import torch from torch.optim.lr_scheduler import ReduceLROnPlateau from torch.utils.data import DataLoader from tqdm import tqdm from model_temporal import LSTMSeqNetwork, BilinearLSTMSeqNetwork, TCNSeqNetwork from utils import load_config, MSEAverageMeter from data_glob_speed import GlobSpeedSequence, SequenceToSequenceDataset, SenseINSSequence from transformations import ComposeTransform, RandomHoriRotateSeq from metric import compute_absolute_trajectory_error, compute_relative_trajectory_error def WriteList(path, name, folders): with open(path+"/"+name, 'w') as f: for folder in folders: f.writelines(folder+"\n") f.close() def GetFolderName(path): names = os.listdir(path+"/") folders=[] for name in names: if os.path.isdir(os.path.join(os.path.abspath(path), name)): folders.append(name) folders.sort() return folders ''' Temporal models with loss functions in global coordinate frame Configurations - Model types TCN - type=tcn LSTM_simple - type=lstm, lstm_bilinear ''' torch.multiprocessing.set_sharing_strategy('file_system') _nano_to_sec = 1e09 _input_channel, _output_channel = 6, 3 # _input_channel, _output_channel = 6, 2 device = 'cpu' class GlobalPosLoss(torch.nn.Module): def __init__(self, mode='full', history=None): """ Calculate position loss in global coordinate frame Target :- Global Velocity Prediction :- Global Velocity """ super(GlobalPosLoss, self).__init__() self.mse_loss = torch.nn.MSELoss(reduction='none') assert mode in ['full', 'part'] self.mode = mode if self.mode == 'part': assert history is not None self.history = history elif self.mode == 'full': self.history = 1 def forward(self, pred, targ): gt_pos = torch.cumsum(targ[:, 1:, ], 1) pred_pos = torch.cumsum(pred[:, 1:, ], 1) if self.mode == 'part': gt_pos = gt_pos[:, self.history:, :] - gt_pos[:, :-self.history, :] pred_pos = pred_pos[:, self.history:, :] - pred_pos[:, :-self.history, :] loss = self.mse_loss(pred_pos, gt_pos) return torch.mean(loss) def write_config(args, **kwargs): if args.out_dir: with open(osp.join(args.out_dir, 'config.json'), 'w') as f: values = vars(args) values['file'] = "pytorch_global_position" if kwargs: values['kwargs'] = kwargs json.dump(values, f, sort_keys=True) def get_dataset(root_dir, data_list, args, **kwargs): input_format, output_format = [0, 3, 6], [0, _output_channel] mode = kwargs.get('mode', 'train') random_shift, shuffle, transforms, grv_only = 0, False, [], False if mode == 'train': random_shift = args.step_size // 2 shuffle = True transforms.append(RandomHoriRotateSeq(input_format, output_format)) elif mode == 'val': shuffle = True elif mode == 'test': shuffle = False grv_only = True transforms = ComposeTransform(transforms) if args.dataset == 'ronin': seq_type = GlobSpeedSequence elif args.dataset == 'ridi': from data_ridi import RIDIGlobSpeedSequence seq_type = RIDIGlobSpeedSequence elif args.dataset == 'sense': seq_type = SenseINSSequence dataset = SequenceToSequenceDataset(seq_type, root_dir, data_list, args.cache_path, args.step_size, args.window_size, random_shift=random_shift, transform=transforms, shuffle=shuffle, grv_only=grv_only, args=args, **kwargs) return dataset def get_dataset_from_list(root_dir, list_path, args, **kwargs): with open(list_path) as f: data_list = [s.strip().split(',')[0] for s in f.readlines() if len(s) > 0 and s[0] != '#'] return get_dataset(root_dir, data_list, args, **kwargs) def get_model(args, **kwargs): config = {} if kwargs.get('dropout'): config['dropout'] = kwargs.get('dropout') if args.type == 'tcn': network = TCNSeqNetwork(_input_channel, _output_channel, args.kernel_size, layer_channels=args.channels, **config) print("TCN Network. Receptive field: {} ".format(network.get_receptive_field())) elif args.type == 'lstm_bi': print("Bilinear LSTM Network") network = BilinearLSTMSeqNetwork(_input_channel, _output_channel, args.batch_size, device, lstm_layers=args.layers, lstm_size=args.layer_size, **config).to(device) else: print("Simple LSTM Network") network = LSTMSeqNetwork(_input_channel, _output_channel, args.batch_size, device, lstm_layers=args.layers, lstm_size=args.layer_size, **config).to(device) pytorch_total_params = sum(p.numel() for p in network.parameters() if p.requires_grad) print('Network constructed. trainable parameters: {}'.format(pytorch_total_params)) return network def get_loss_function(history, args, **kwargs): if args.type == 'tcn': config = {'mode': 'part', 'history': history} else: config = {'mode': 'full'} criterion = GlobalPosLoss(**config) return criterion def format_string(*argv, sep=' '): result = '' for val in argv: if isinstance(val, (tuple, list, np.ndarray)): for v in val: result += format_string(v, sep=sep) + sep else: result += str(val) + sep return result[:-1] def train(args, **kwargs): # Loading data start_t = time.time() train_dataset = get_dataset_from_list(args.root_dir, args.train_list, args, mode='train', **kwargs) train_loader = DataLoader(train_dataset, batch_size=args.batch_size, num_workers=args.num_workers, shuffle=True, drop_last=True) end_t = time.time() print('Training set loaded. Time usage: {:.3f}s'.format(end_t - start_t)) val_dataset, val_loader = None, None if args.val_list is not None: val_dataset = get_dataset_from_list(args.validation_dir, args.val_list, args, mode='val', **kwargs) val_loader = DataLoader(val_dataset, batch_size=args.batch_size, shuffle=True, drop_last=True) print('Validation set loaded') global device device = torch.device(args.device if torch.cuda.is_available() else 'cpu') if args.out_dir: if not osp.isdir(args.out_dir): os.makedirs(args.out_dir) if not osp.isdir(osp.join(args.out_dir, 'checkpoints')): os.makedirs(osp.join(args.out_dir, 'checkpoints')) if not osp.isdir(osp.join(args.out_dir, 'logs')): os.makedirs(osp.join(args.out_dir, 'logs')) write_config(args, **kwargs) print('\nNumber of train samples: {}'.format(len(train_dataset))) train_mini_batches = len(train_loader) if val_dataset: print('Number of val samples: {}'.format(len(val_dataset))) val_mini_batches = len(val_loader) network = get_model(args, **kwargs).to(device) history = network.get_receptive_field() if args.type == 'tcn' else args.window_size // 2 criterion = get_loss_function(history, args, **kwargs) optimizer = torch.optim.Adam(network.parameters(), args.lr) scheduler = ReduceLROnPlateau(optimizer, 'min', patience=10, factor=0.75, verbose=True, eps=1e-12) quiet_mode = kwargs.get('quiet', False) use_scheduler = kwargs.get('use_scheduler', False) log_file = None if args.out_dir: log_file = osp.join(args.out_dir, 'logs', 'log.txt') if osp.exists(log_file): if args.continue_from is None: os.remove(log_file) else: copyfile(log_file, osp.join(args.out_dir, 'logs', 'log_old.txt')) start_epoch = 0 if args.continue_from is not None and osp.exists(args.continue_from): with open(osp.join(str(Path(args.continue_from).parents[1]), 'config.json'), 'r') as f: model_data = json.load(f) if device.type == 'cpu': checkpoints = torch.load(args.continue_from, map_location=lambda storage, location: storage) else: checkpoints = torch.load(args.continue_from, map_location={model_data['device']: args.device}) start_epoch = checkpoints.get('epoch', 0) network.load_state_dict(checkpoints.get('model_state_dict')) optimizer.load_state_dict(checkpoints.get('optimizer_state_dict')) if kwargs.get('force_lr', False): for param_group in optimizer.param_groups: param_group['lr'] = args.lr step = 0 best_val_loss = np.inf train_errs = np.zeros(args.epochs) print("Starting from epoch {}".format(start_epoch )) try: for epoch in range(start_epoch, args.epochs): log_line = '' network.train() train_vel = MSEAverageMeter(3, [2], _output_channel) train_loss = 0 start_t = time.time() for bid, batch in tqdm(enumerate(train_loader)): feat, targ, _, _ = batch feat, targ = feat.to(device), targ.to(device) optimizer.zero_grad() predicted = network(feat) train_vel.add(predicted.cpu().detach().numpy(), targ.cpu().detach().numpy()) loss = criterion(predicted, targ) train_loss += loss.cpu().detach().numpy() loss.backward() optimizer.step() step += 1 train_errs[epoch] = train_loss / train_mini_batches end_t = time.time() if not quiet_mode: print('-' * 25) print('Epoch {}, time usage: {:.3f}s, loss: {}, val_loss {}/{:.6f}'.format( epoch, end_t - start_t, train_errs[epoch], train_vel.get_channel_avg(), train_vel.get_total_avg())) print('Learning rate: {}'.format(optimizer.param_groups[0]['lr'])) log_line = format_string(log_line, epoch, optimizer.param_groups[0]['lr'], train_errs[epoch], *train_vel.get_channel_avg()) saved_model = False if val_loader: network.eval() val_vel = MSEAverageMeter(3, [2], _output_channel) val_loss = 0 for bid, batch in tqdm(enumerate(val_loader)): feat, targ, _, _ = batch feat, targ = feat.to(device), targ.to(device) optimizer.zero_grad() pred = network(feat) val_vel.add(pred.cpu().detach().numpy(), targ.cpu().detach().numpy()) val_loss += criterion(pred, targ).cpu().detach().numpy() val_loss = val_loss / val_mini_batches log_line = format_string(log_line, val_loss, *val_vel.get_channel_avg()) if not quiet_mode: print('Validation loss: {} val_loss: {}/{:.6f}'.format(val_loss, val_vel.get_channel_avg(), val_vel.get_total_avg())) if val_loss < best_val_loss: best_val_loss = val_loss saved_model = True if args.out_dir: model_path = osp.join(args.out_dir, 'checkpoints', 'checkpoint_%d.pt' % epoch) torch.save({'model_state_dict': network.state_dict(), 'epoch': epoch, 'loss': train_errs[epoch], 'optimizer_state_dict': optimizer.state_dict()}, model_path) print('Best Validation Model saved to ', model_path) scheduler.step(val_loss) if args.out_dir and not saved_model and (epoch + 1) % args.save_interval == 0: # save even with validation model_path = osp.join(args.out_dir, 'checkpoints', 'icheckpoint_%d.pt' % epoch) torch.save({'model_state_dict': network.state_dict(), 'epoch': epoch, 'loss': train_errs[epoch], 'optimizer_state_dict': optimizer.state_dict()}, model_path) print('Model saved to ', model_path) if log_file: log_line += '\n' with open(log_file, 'a') as f: f.write(log_line) if np.isnan(train_loss): print("Invalid value. Stopping training.") break except KeyboardInterrupt: print('-' * 60) print('Early terminate') print('Training completed') if args.out_dir: model_path = osp.join(args.out_dir, 'checkpoints', 'checkpoint_latest.pt') torch.save({'model_state_dict': network.state_dict(), 'epoch': epoch, 'optimizer_state_dict': optimizer.state_dict()}, model_path) def recon_traj_with_preds_global(dataset, preds, ind=None, seq_id=0, type='preds', **kwargs): ind = ind if ind is not None else np.array([i[1] for i in dataset.index_map if i[0] == seq_id], dtype=np.int) if type == 'gt': # pos = dataset.gt_pos[seq_id][:, :2] pos = dataset.gt_pos[seq_id][:, :3] else: ts = dataset.ts[seq_id] # Compute the global velocity from local velocity. dts = np.mean(ts[ind[1:]] - ts[ind[:-1]]) pos = preds * dts # pos[0, :] = dataset.gt_pos[seq_id][0, :2] pos[0, :] = dataset.gt_pos[seq_id][0, :3] pos = np.cumsum(pos, axis=0) veloc = preds ori = dataset.orientations[seq_id] return pos, veloc, ori def test(args, **kwargs): global device, _output_channel import matplotlib.pyplot as plt device = torch.device(args.device if torch.cuda.is_available() else 'cpu') if args.test_path is not None: if args.test_path[-1] == '/': args.test_path = args.test_path[:-1] root_dir = osp.split(args.test_path)[0] test_data_list = [osp.split(args.test_path)[1]] elif args.test_list is not None: root_dir = args.root_dir if args.root_dir else osp.split(args.test_list)[0] with open(args.test_list) as f: test_data_list = [s.strip().split(',')[0] for s in f.readlines() if len(s) > 0 and s[0] != '#'] else: raise ValueError('Either test_path or test_list must be specified.') # Load the first sequence to update the input and output size _ = get_dataset(root_dir, [test_data_list[0]], args, mode='test') if args.out_dir and not osp.exists(args.out_dir): os.makedirs(args.out_dir) with open(osp.join(str(Path(args.model_path).parents[1]), 'config.json'), 'r') as f: model_data = json.load(f) if device.type == 'cpu': checkpoint = torch.load(args.model_path, map_location=lambda storage, location: storage) else: checkpoint = torch.load(args.model_path, map_location={model_data['device']: args.device}) network = get_model(args, **kwargs) network.load_state_dict(checkpoint.get('model_state_dict')) network.eval().to(device) print('Model {} loaded to device {}.'.format(args.model_path, device)) log_file = None if args.test_list and args.out_dir: log_file = osp.join(args.out_dir, osp.split(args.test_list)[-1].split('.')[0] + '_log.txt') with open(log_file, 'w') as f: f.write(args.model_path + '\n') f.write('Seq traj_len velocity ate rte\n') losses_vel = MSEAverageMeter(2, [1], _output_channel) ate_all, rte_all = [], [] pred_per_min = 200 * 60 seq_dataset = get_dataset(root_dir, test_data_list, args, mode='test', **kwargs) for idx, data in enumerate(test_data_list): assert data == osp.split(seq_dataset.data_path[idx])[1] feat, vel = seq_dataset.get_test_seq(idx) feat = torch.Tensor(feat).to(device) preds = np.squeeze(network(feat).cpu().detach().numpy())[-vel.shape[0]:, :_output_channel] ind = np.arange(vel.shape[0]) val_losses = np.mean((vel - preds) ** 2, axis=0) losses_vel.add(vel, preds) print('Reconstructing trajectory') pos_pred, gv_pred, _ = recon_traj_with_preds_global(seq_dataset, preds, ind=ind, type='pred', seq_id=idx) pos_gt, gv_gt, _ = recon_traj_with_preds_global(seq_dataset, vel, ind=ind, type='gt', seq_id=idx) if args.out_dir is not None and osp.isdir(args.out_dir): np.save(osp.join(args.out_dir, '{}_{}.npy'.format(data, args.type)), np.concatenate([pos_pred, pos_gt], axis=1)) ate = compute_absolute_trajectory_error(pos_pred, pos_gt) if pos_pred.shape[0] < pred_per_min: ratio = pred_per_min / pos_pred.shape[0] rte = compute_relative_trajectory_error(pos_pred, pos_gt, delta=pos_pred.shape[0] - 1) * ratio else: rte = compute_relative_trajectory_error(pos_pred, pos_gt, delta=pred_per_min) pos_cum_error = np.linalg.norm(pos_pred - pos_gt, axis=1) ate_all.append(ate) rte_all.append(rte) print('Sequence {}, Velocity loss {} / {}, ATE: {}, RTE:{}'.format(data, val_losses, np.mean(val_losses), ate, rte)) log_line = format_string(data, np.mean(val_losses), ate, rte) if not args.fast_test: kp = preds.shape[1] if kp == 2: targ_names = ['vx', 'vy'] elif kp == 3: targ_names = ['vx', 'vy', 'vz'] plt.figure('{}'.format(data), figsize=(16, 9)) plt.subplot2grid((kp, 2), (0, 0), rowspan=kp - 1) plt.plot(pos_pred[:, 0], pos_pred[:, 1]) plt.plot(pos_gt[:, 0], pos_gt[:, 1]) plt.title(data) plt.axis('equal') plt.legend(['Predicted', 'Ground truth']) plt.subplot2grid((kp, 2), (kp - 1, 0)) plt.plot(pos_cum_error) plt.legend(['ATE:{:.3f}, RTE:{:.3f}'.format(ate_all[-1], rte_all[-1])]) for i in range(kp): plt.subplot2grid((kp, 2), (i, 1)) plt.plot(ind, preds[:, i]) plt.plot(ind, vel[:, i]) plt.legend(['Predicted', 'Ground truth']) plt.title('{}, error: {:.6f}'.format(targ_names[i], val_losses[i])) plt.tight_layout() if args.show_plot: plt.show() if args.out_dir is not None and osp.isdir(args.out_dir): plt.savefig(osp.join(args.out_dir, '{}_{}.png'.format(data, args.type))) if log_file is not None: with open(log_file, 'a') as f: log_line += '\n' f.write(log_line) plt.close('all') ate_all = np.array(ate_all) rte_all = np.array(rte_all) measure = format_string('ATE', 'RTE', sep='\t') values = format_string(np.mean(ate_all), np.mean(rte_all), sep='\t') print(measure, '\n', values) if log_file is not None: with open(log_file, 'a') as f: f.write(measure + '\n') f.write(values) if __name__ == '__main__': """ Run file with individual arguments or/and config file. If argument appears in both config file and args, args is given precedence. """ default_config_file = osp.abspath(osp.join(osp.abspath(__file__), '../../config/temporal_model_defaults.json')) import argparse parser = argparse.ArgumentParser(description="Run seq2seq model in train/test mode [required]. Optional " "configurations can be specified as --key [value..] pairs", add_help=True) parser.add_argument('--config', type=str, help='Configuration file [Default: {}]'.format(default_config_file), default=default_config_file) # common parser.add_argument('--type', type=str, choices=['tcn', 'lstm', 'lstm_bi'], help='Model type', default='lstm') parser.add_argument('--root_dir', type=str, default="/data/INSData/ins_data_test/IDOL_SenseINS/building1/train_debug", help='Path to data directory') parser.add_argument('--validation_dir', type=str, default="/data/INSData/ins_data_test/IDOL_SenseINS/building1/train_debug") # parser.add_argument('--root_dir', type=str, # default="/home/SENSETIME/xurunsen/project/ronin/RONIN/train_debug", # help='Path to data directory') # parser.add_argument('--validation_dir', type=str, # default="/home/SENSETIME/xurunsen/project/ronin/RONIN/train_debug") parser.add_argument('--cache_path', type=str, default=None) parser.add_argument('--feature_sigma', type=float, help='Gaussian for smoothing features') parser.add_argument('--target_sigma', type=float, help='Gaussian for smoothing target') parser.add_argument('--window_size', type=int) parser.add_argument('--step_size', type=int) parser.add_argument('--batch_size', type=int) parser.add_argument('--num_workers', type=int) parser.add_argument('--out_dir', type=str, default='../output/ronin_lstm/idol/2021.05.14/train_debug') parser.add_argument('--device', type=str, help='Cuda device (e.g:- cuda:0) or cpu') parser.add_argument('--dataset', type=str, choices=['ronin', 'ridi', 'sense'], default='sense') parser.add_argument('--imu_freq', type=int, default=200) # tcn tcn_cmd = parser.add_argument_group('tcn', 'configuration for TCN') tcn_cmd.add_argument('--kernel_size', type=int) tcn_cmd.add_argument('--channels', type=str, help='Channel sizes for TCN layers (comma separated)') # lstm lstm_cmd = parser.add_argument_group('lstm', 'configuration for LSTM') lstm_cmd.add_argument('--layers', type=int) lstm_cmd.add_argument('--layer_size', type=int) mode = parser.add_subparsers(title='mode', dest='mode', help='Operation: [train] train model, [test] evaluate model') mode.required = False # train train_cmd = mode.add_parser('train') train_cmd.add_argument('--train_list', type=str) train_cmd.add_argument('--val_list', type=str) train_cmd.add_argument('--continue_from', type=str, default=None) train_cmd.add_argument('--epochs', type=int) train_cmd.add_argument('--save_interval', type=int) train_cmd.add_argument('--lr', '--learning_rate', type=float) # test test_cmd = mode.add_parser('test') test_cmd.add_argument('--test_path', type=str, default=None) test_cmd.add_argument('--test_list', type=str, default=None) test_cmd.add_argument('--model_path', type=str, default='/home/SENSETIME/xurunsen/project/ronin/output/ronin_lstm/idol/2021.05.14/train_debug/checkpoints/checkpoint_714.pt') test_cmd.add_argument('--fast_test', action='store_true') test_cmd.add_argument('--show_plot', action='store_true') ''' Extra arguments Set True: use_scheduler, quite (no output on stdout), force_lr (force lr when a model is loaded from continue_from) float: dropout, max_ori_error (err. threshold for priority grv in degrees) max_velocity_norm (filter outliers in training) ''' args, unknown_args = parser.parse_known_args() np.set_printoptions(formatter={'all': lambda x: '{:.6f}'.format(x)}) args, kwargs = load_config(default_config_file, args, unknown_args) print(args, kwargs) # add by runsen # write list if args.mode == "train": if args.train_list is None: WriteList(args.root_dir, "train_list.txt", GetFolderName(args.root_dir)) args.train_list = args.root_dir + "/train_list.txt" if args.validation_dir is not None: WriteList(args.validation_dir, "validation_list.txt", GetFolderName(args.validation_dir)) args.val_list = args.validation_dir + "/validation_list.txt" elif args.mode == "test": if args.test_list is None: WriteList(args.root_dir, "test_list.txt", GetFolderName(args.root_dir)) args.test_list = args.root_dir + "/test_list.txt" if args.mode == 'train': train(args, **kwargs) elif args.mode == 'test': if not args.model_path: raise ValueError("Model path required") args.batch_size = 1 test(args, **kwargs)
[ 1, 1053, 4390, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 931, 13, 3166, 2897, 1053, 2224, 408, 288, 1028, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 528, 4422, 1053, 3509, 1445, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 29889, 20640, 29889, 29212, 29918, 816, 14952, 1053, 4367, 24551, 29931, 1672, 29876, 3247, 403, 585, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 13, 3166, 1904, 29918, 1356, 1971, 284, 1053, 365, 1254, 4345, 1837, 13724, 29892, 20347, 457, 279, 29931, 1254, 4345, 1837, 13724, 29892, 323, 29907, 3059, 1837, 13724, 13, 3166, 3667, 29879, 1053, 2254, 29918, 2917, 29892, 341, 1660, 29909, 19698, 29924, 1308, 13, 3166, 848, 29918, 23705, 29918, 19322, 1053, 402, 2127, 26539, 20529, 29892, 922, 3910, 1762, 20529, 16390, 24541, 29892, 317, 1947, 1177, 1799, 1686, 663, 13, 3166, 29304, 1053, 3831, 852, 13372, 29892, 16968, 29950, 4170, 21281, 403, 23718, 13, 3166, 12714, 1053, 10272, 29918, 23552, 29918, 3018, 622, 706, 29918, 2704, 29892, 10272, 29918, 22925, 29918, 3018, 622, 706, 29918, 2704, 13, 13, 13, 1753, 14350, 1293, 29898, 2084, 29892, 1024, 29892, 16495, 1125, 13, 1678, 411, 1722, 29898, 2084, 13578, 12975, 29974, 978, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 363, 4138, 297, 16495, 29901, 13, 9651, 285, 29889, 8231, 24210, 29898, 12083, 13578, 29905, 29876, 1159, 13, 4706, 285, 29889, 5358, 580, 13, 13, 13, 1753, 3617, 12924, 1170, 29898, 2084, 1125, 13, 1678, 2983, 353, 2897, 29889, 1761, 3972, 29898, 2084, 13578, 29914, 1159, 13, 1678, 16495, 29922, 2636, 13, 1678, 363, 1024, 297, 2983, 29901, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 3972, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 2084, 511, 1024, 22164, 13, 9651, 16495, 29889, 4397, 29898, 978, 29897, 13, 1678, 16495, 29889, 6605, 580, 13, 1678, 736, 16495, 13, 13, 13, 12008, 13, 5776, 1971, 284, 4733, 411, 6410, 3168, 297, 5534, 14821, 3515, 13, 3991, 332, 800, 13, 1678, 448, 8125, 4072, 29871, 13, 4706, 323, 13778, 448, 1134, 29922, 14246, 29876, 13, 4706, 365, 1254, 29924, 29918, 12857, 448, 1134, 29922, 20155, 29885, 29892, 24471, 29885, 29918, 18152, 457, 279, 308, 13, 12008, 13, 13, 7345, 305, 29889, 18056, 307, 985, 292, 29889, 842, 29918, 845, 4362, 29918, 710, 8963, 877, 1445, 29918, 5205, 1495, 13, 29918, 29876, 1562, 29918, 517, 29918, 3471, 353, 29871, 29896, 29872, 29900, 29929, 13, 29918, 2080, 29918, 12719, 29892, 903, 4905, 29918, 12719, 353, 29871, 29953, 29892, 29871, 29941, 13, 29937, 903, 2080, 29918, 12719, 29892, 903, 4905, 29918, 12719, 353, 29871, 29953, 29892, 29871, 29906, 13, 10141, 353, 525, 21970, 29915, 13, 13, 13, 1990, 12002, 9135, 29931, 2209, 29898, 7345, 305, 29889, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4464, 2433, 8159, 742, 4955, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 20535, 403, 2602, 6410, 297, 5534, 14821, 3515, 13, 4706, 17157, 8956, 12002, 12019, 25245, 13, 4706, 21099, 2463, 8956, 12002, 12019, 25245, 13, 4706, 9995, 13, 4706, 2428, 29898, 12756, 9135, 29931, 2209, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 29885, 344, 29918, 6758, 353, 4842, 305, 29889, 15755, 29889, 29924, 1660, 29931, 2209, 29898, 9313, 428, 2433, 9290, 1495, 13, 13, 4706, 4974, 4464, 297, 6024, 8159, 742, 525, 1595, 2033, 13, 4706, 1583, 29889, 8513, 353, 4464, 13, 4706, 565, 1583, 29889, 8513, 1275, 525, 1595, 2396, 13, 9651, 4974, 4955, 338, 451, 6213, 13, 9651, 1583, 29889, 18434, 353, 4955, 13, 4706, 25342, 1583, 29889, 8513, 1275, 525, 8159, 2396, 13, 9651, 1583, 29889, 18434, 353, 29871, 29896, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 4450, 29892, 260, 1191, 1125, 13, 4706, 330, 29873, 29918, 1066, 353, 4842, 305, 29889, 29883, 398, 2083, 29898, 29873, 1191, 7503, 29892, 29871, 29896, 29901, 29892, 21251, 29871, 29896, 29897, 13, 4706, 4450, 29918, 1066, 353, 4842, 305, 29889, 29883, 398, 2083, 29898, 11965, 7503, 29892, 29871, 29896, 29901, 29892, 21251, 29871, 29896, 29897, 13, 4706, 565, 1583, 29889, 8513, 1275, 525, 1595, 2396, 13, 9651, 330, 29873, 29918, 1066, 353, 330, 29873, 29918, 1066, 7503, 29892, 1583, 29889, 18434, 29901, 29892, 584, 29962, 448, 330, 29873, 29918, 1066, 7503, 29892, 8956, 1311, 29889, 18434, 29892, 584, 29962, 13, 9651, 4450, 29918, 1066, 353, 4450, 29918, 1066, 7503, 29892, 1583, 29889, 18434, 29901, 29892, 584, 29962, 448, 4450, 29918, 1066, 7503, 29892, 8956, 1311, 29889, 18434, 29892, 584, 29962, 13, 4706, 6410, 353, 1583, 29889, 29885, 344, 29918, 6758, 29898, 11965, 29918, 1066, 29892, 330, 29873, 29918, 1066, 29897, 13, 4706, 736, 4842, 305, 29889, 12676, 29898, 6758, 29897, 13, 13, 13, 1753, 2436, 29918, 2917, 29898, 5085, 29892, 3579, 19290, 1125, 13, 1678, 565, 6389, 29889, 449, 29918, 3972, 29901, 13, 4706, 411, 1722, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 2917, 29889, 3126, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 1819, 353, 24987, 29898, 5085, 29897, 13, 9651, 1819, 1839, 1445, 2033, 353, 376, 2272, 7345, 305, 29918, 10945, 29918, 3283, 29908, 13, 9651, 565, 9049, 5085, 29901, 13, 18884, 1819, 1839, 19290, 2033, 353, 9049, 5085, 13, 9651, 4390, 29889, 15070, 29898, 5975, 29892, 285, 29892, 2656, 29918, 8149, 29922, 5574, 29897, 13, 13, 13, 1753, 679, 29918, 24713, 29898, 4632, 29918, 3972, 29892, 848, 29918, 1761, 29892, 6389, 29892, 3579, 19290, 1125, 13, 1678, 1881, 29918, 4830, 29892, 1962, 29918, 4830, 353, 518, 29900, 29892, 29871, 29941, 29892, 29871, 29953, 1402, 518, 29900, 29892, 903, 4905, 29918, 12719, 29962, 13, 1678, 4464, 353, 9049, 5085, 29889, 657, 877, 8513, 742, 525, 14968, 1495, 13, 13, 1678, 4036, 29918, 10889, 29892, 528, 21897, 29892, 4327, 29879, 29892, 867, 29894, 29918, 6194, 353, 29871, 29900, 29892, 7700, 29892, 19997, 7700, 13, 13, 1678, 565, 4464, 1275, 525, 14968, 2396, 13, 4706, 4036, 29918, 10889, 353, 6389, 29889, 10568, 29918, 2311, 849, 29871, 29906, 13, 4706, 528, 21897, 353, 5852, 13, 4706, 4327, 29879, 29889, 4397, 29898, 17875, 29950, 4170, 21281, 403, 23718, 29898, 2080, 29918, 4830, 29892, 1962, 29918, 4830, 876, 13, 1678, 25342, 4464, 1275, 525, 791, 2396, 13, 4706, 528, 21897, 353, 5852, 13, 1678, 25342, 4464, 1275, 525, 1688, 2396, 13, 4706, 528, 21897, 353, 7700, 13, 4706, 867, 29894, 29918, 6194, 353, 5852, 13, 1678, 4327, 29879, 353, 3831, 852, 13372, 29898, 9067, 29879, 29897, 13, 13, 1678, 565, 6389, 29889, 24713, 1275, 525, 1617, 262, 2396, 13, 4706, 19359, 29918, 1853, 353, 402, 2127, 26539, 20529, 13, 1678, 25342, 6389, 29889, 24713, 1275, 525, 2429, 29875, 2396, 13, 4706, 515, 848, 29918, 2429, 29875, 1053, 390, 1367, 6259, 2127, 26539, 20529, 13, 4706, 19359, 29918, 1853, 353, 390, 1367, 6259, 2127, 26539, 20529, 13, 1678, 25342, 6389, 29889, 24713, 1275, 525, 29879, 1947, 2396, 13, 4706, 19359, 29918, 1853, 353, 317, 1947, 1177, 1799, 1686, 663, 13, 1678, 8783, 353, 922, 3910, 1762, 20529, 16390, 24541, 29898, 11762, 29918, 1853, 29892, 3876, 29918, 3972, 29892, 848, 29918, 1761, 29892, 6389, 29889, 8173, 29918, 2084, 29892, 6389, 29889, 10568, 29918, 2311, 29892, 6389, 29889, 7165, 29918, 2311, 29892, 13, 462, 462, 4706, 4036, 29918, 10889, 29922, 8172, 29918, 10889, 29892, 4327, 29922, 9067, 29879, 29892, 528, 21897, 29922, 845, 21897, 29892, 13, 462, 462, 4706, 867, 29894, 29918, 6194, 29922, 629, 29894, 29918, 6194, 29892, 6389, 29922, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 736, 8783, 13, 13, 13, 1753, 679, 29918, 24713, 29918, 3166, 29918, 1761, 29898, 4632, 29918, 3972, 29892, 1051, 29918, 2084, 29892, 6389, 29892, 3579, 19290, 1125, 13, 1678, 411, 1722, 29898, 1761, 29918, 2084, 29897, 408, 285, 29901, 13, 4706, 848, 29918, 1761, 353, 518, 29879, 29889, 17010, 2141, 5451, 29317, 29861, 29900, 29962, 363, 269, 297, 285, 29889, 949, 9012, 580, 565, 7431, 29898, 29879, 29897, 1405, 29871, 29900, 322, 269, 29961, 29900, 29962, 2804, 16321, 2033, 13, 1678, 736, 679, 29918, 24713, 29898, 4632, 29918, 3972, 29892, 848, 29918, 1761, 29892, 6389, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 679, 29918, 4299, 29898, 5085, 29892, 3579, 19290, 1125, 13, 1678, 2295, 353, 6571, 13, 1678, 565, 9049, 5085, 29889, 657, 877, 8865, 449, 29374, 13, 4706, 2295, 1839, 8865, 449, 2033, 353, 9049, 5085, 29889, 657, 877, 8865, 449, 1495, 13, 13, 1678, 565, 6389, 29889, 1853, 1275, 525, 14246, 29876, 2396, 13, 4706, 3564, 353, 323, 29907, 3059, 1837, 13724, 7373, 2080, 29918, 12719, 29892, 903, 4905, 29918, 12719, 29892, 6389, 29889, 17460, 29918, 2311, 29892, 13, 462, 18884, 7546, 29918, 305, 12629, 29922, 5085, 29889, 305, 12629, 29892, 3579, 2917, 29897, 13, 4706, 1596, 703, 9472, 29940, 8527, 29889, 830, 1547, 573, 1746, 29901, 6571, 11393, 4830, 29898, 11618, 29889, 657, 29918, 276, 1547, 573, 29918, 2671, 22130, 13, 1678, 25342, 6389, 29889, 1853, 1275, 525, 20155, 29885, 29918, 5365, 2396, 13, 4706, 1596, 703, 29933, 309, 457, 279, 365, 1254, 29924, 8527, 1159, 13, 4706, 3564, 353, 20347, 457, 279, 29931, 1254, 4345, 1837, 13724, 7373, 2080, 29918, 12719, 29892, 903, 4905, 29918, 12719, 29892, 6389, 29889, 16175, 29918, 2311, 29892, 4742, 29892, 13, 462, 462, 308, 24471, 29885, 29918, 29277, 29922, 5085, 29889, 29277, 29892, 24471, 29885, 29918, 2311, 29922, 5085, 29889, 13148, 29918, 2311, 29892, 3579, 2917, 467, 517, 29898, 10141, 29897, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 15427, 365, 1254, 29924, 8527, 1159, 13, 4706, 3564, 353, 365, 1254, 4345, 1837, 13724, 7373, 2080, 29918, 12719, 29892, 903, 4905, 29918, 12719, 29892, 6389, 29889, 16175, 29918, 2311, 29892, 4742, 29892, 13, 462, 462, 24471, 29885, 29918, 29277, 29922, 5085, 29889, 29277, 29892, 24471, 29885, 29918, 2311, 29922, 5085, 29889, 13148, 29918, 2311, 29892, 3579, 2917, 467, 517, 29898, 10141, 29897, 13, 13, 1678, 282, 3637, 25350, 29918, 7827, 29918, 7529, 353, 2533, 29898, 29886, 29889, 1949, 295, 580, 363, 282, 297, 3564, 29889, 16744, 580, 565, 282, 29889, 276, 339, 2658, 29918, 5105, 29897, 13, 1678, 1596, 877, 13724, 13319, 29889, 7945, 519, 4128, 29901, 6571, 4286, 4830, 29898, 2272, 7345, 305, 29918, 7827, 29918, 7529, 876, 13, 1678, 736, 3564, 13, 13, 13, 1753, 679, 29918, 6758, 29918, 2220, 29898, 18434, 29892, 6389, 29892, 3579, 19290, 1125, 13, 1678, 565, 6389, 29889, 1853, 1275, 525, 14246, 29876, 2396, 13, 4706, 2295, 353, 11117, 8513, 2396, 525, 1595, 742, 13, 462, 29871, 525, 18434, 2396, 4955, 29913, 13, 1678, 1683, 29901, 13, 4706, 2295, 353, 11117, 8513, 2396, 525, 8159, 10827, 13, 13, 1678, 28770, 291, 353, 12002, 9135, 29931, 2209, 29898, 1068, 2917, 29897, 13, 1678, 736, 28770, 291, 13, 13, 13, 1753, 3402, 29918, 1807, 10456, 19218, 29892, 16345, 2433, 525, 1125, 13, 1678, 1121, 353, 6629, 13, 1678, 363, 659, 297, 1852, 29894, 29901, 13, 4706, 565, 338, 8758, 29898, 791, 29892, 313, 23583, 29892, 1051, 29892, 7442, 29889, 299, 2378, 22164, 13, 9651, 363, 325, 297, 659, 29901, 13, 18884, 1121, 4619, 3402, 29918, 1807, 29898, 29894, 29892, 16345, 29922, 19570, 29897, 718, 16345, 13, 4706, 1683, 29901, 13, 9651, 1121, 4619, 851, 29898, 791, 29897, 718, 16345, 13, 1678, 736, 1121, 7503, 29899, 29896, 29962, 13, 13, 13, 1753, 7945, 29898, 5085, 29892, 3579, 19290, 1125, 13, 1678, 396, 4309, 9382, 848, 13, 1678, 1369, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 1678, 7945, 29918, 24713, 353, 679, 29918, 24713, 29918, 3166, 29918, 1761, 29898, 5085, 29889, 4632, 29918, 3972, 29892, 6389, 29889, 14968, 29918, 1761, 29892, 6389, 29892, 4464, 2433, 14968, 742, 3579, 19290, 29897, 13, 1678, 7945, 29918, 12657, 353, 3630, 10036, 29898, 14968, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 954, 29918, 1287, 414, 29922, 5085, 29889, 1949, 29918, 1287, 414, 29892, 528, 21897, 29922, 5574, 29892, 13, 462, 795, 5768, 29918, 4230, 29922, 5574, 29897, 13, 1678, 1095, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 13, 1678, 1596, 877, 5323, 2827, 731, 7500, 29889, 5974, 8744, 29901, 12365, 29889, 29941, 29888, 29913, 29879, 4286, 4830, 29898, 355, 29918, 29873, 448, 1369, 29918, 29873, 876, 13, 1678, 659, 29918, 24713, 29892, 659, 29918, 12657, 353, 6213, 29892, 6213, 13, 1678, 565, 6389, 29889, 791, 29918, 1761, 338, 451, 6213, 29901, 13, 4706, 659, 29918, 24713, 353, 679, 29918, 24713, 29918, 3166, 29918, 1761, 29898, 5085, 29889, 18157, 29918, 3972, 29892, 6389, 29889, 791, 29918, 1761, 29892, 6389, 29892, 4464, 2433, 791, 742, 3579, 19290, 29897, 13, 4706, 659, 29918, 12657, 353, 3630, 10036, 29898, 791, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 5085, 29889, 16175, 29918, 2311, 29892, 528, 21897, 29922, 5574, 29892, 5768, 29918, 4230, 29922, 5574, 29897, 13, 4706, 1596, 877, 19448, 731, 7500, 1495, 13, 13, 1678, 5534, 4742, 13, 1678, 4742, 353, 4842, 305, 29889, 10141, 29898, 5085, 29889, 10141, 565, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 1683, 525, 21970, 1495, 13, 13, 1678, 565, 6389, 29889, 449, 29918, 3972, 29901, 13, 4706, 565, 451, 288, 1028, 29889, 275, 3972, 29898, 5085, 29889, 449, 29918, 3972, 1125, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 5085, 29889, 449, 29918, 3972, 29897, 13, 4706, 565, 451, 288, 1028, 29889, 275, 3972, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 3198, 9748, 8785, 29901, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 3198, 9748, 8785, 13, 4706, 565, 451, 288, 1028, 29889, 275, 3972, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 20756, 8785, 29901, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 20756, 8785, 13, 4706, 2436, 29918, 2917, 29898, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 1596, 28909, 29876, 4557, 310, 7945, 11916, 29901, 6571, 4286, 4830, 29898, 2435, 29898, 14968, 29918, 24713, 4961, 13, 1678, 7945, 29918, 1195, 29875, 29918, 16175, 267, 353, 7431, 29898, 14968, 29918, 12657, 29897, 13, 1678, 565, 659, 29918, 24713, 29901, 13, 4706, 1596, 877, 4557, 310, 659, 11916, 29901, 6571, 4286, 4830, 29898, 2435, 29898, 791, 29918, 24713, 4961, 13, 4706, 659, 29918, 1195, 29875, 29918, 16175, 267, 353, 7431, 29898, 791, 29918, 12657, 29897, 13, 13, 1678, 3564, 353, 679, 29918, 4299, 29898, 5085, 29892, 3579, 19290, 467, 517, 29898, 10141, 29897, 13, 1678, 4955, 353, 3564, 29889, 657, 29918, 276, 1547, 573, 29918, 2671, 580, 565, 6389, 29889, 1853, 1275, 525, 14246, 29876, 29915, 1683, 6389, 29889, 7165, 29918, 2311, 849, 29871, 29906, 13, 1678, 28770, 291, 353, 679, 29918, 6758, 29918, 2220, 29898, 18434, 29892, 6389, 29892, 3579, 19290, 29897, 13, 13, 1678, 5994, 3950, 353, 4842, 305, 29889, 20640, 29889, 3253, 314, 29898, 11618, 29889, 16744, 3285, 6389, 29889, 29212, 29897, 13, 1678, 1364, 14952, 353, 4367, 24551, 29931, 1672, 29876, 3247, 403, 585, 29898, 20640, 3950, 29892, 525, 1195, 742, 282, 24701, 29922, 29896, 29900, 29892, 7329, 29922, 29900, 29889, 29955, 29945, 29892, 26952, 29922, 5574, 29892, 321, 567, 29922, 29896, 29872, 29899, 29896, 29906, 29897, 13, 1678, 11813, 29918, 8513, 353, 9049, 5085, 29889, 657, 877, 339, 2035, 742, 7700, 29897, 13, 1678, 671, 29918, 816, 14952, 353, 9049, 5085, 29889, 657, 877, 1509, 29918, 816, 14952, 742, 7700, 29897, 13, 13, 1678, 1480, 29918, 1445, 353, 6213, 13, 1678, 565, 6389, 29889, 449, 29918, 3972, 29901, 13, 4706, 1480, 29918, 1445, 353, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 20756, 742, 525, 1188, 29889, 3945, 1495, 13, 4706, 565, 288, 1028, 29889, 9933, 29898, 1188, 29918, 1445, 1125, 13, 9651, 565, 6389, 29889, 19878, 29918, 3166, 338, 6213, 29901, 13, 18884, 2897, 29889, 5992, 29898, 1188, 29918, 1445, 29897, 13, 9651, 1683, 29901, 13, 18884, 3509, 1445, 29898, 1188, 29918, 1445, 29892, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 20756, 742, 525, 1188, 29918, 1025, 29889, 3945, 8785, 13, 13, 1678, 1369, 29918, 1022, 2878, 353, 29871, 29900, 13, 1678, 565, 6389, 29889, 19878, 29918, 3166, 338, 451, 6213, 322, 288, 1028, 29889, 9933, 29898, 5085, 29889, 19878, 29918, 3166, 1125, 13, 4706, 411, 1722, 29898, 4705, 29889, 7122, 29898, 710, 29898, 2605, 29898, 5085, 29889, 19878, 29918, 3166, 467, 862, 1237, 29961, 29896, 11724, 525, 2917, 29889, 3126, 5477, 525, 29878, 1495, 408, 285, 29901, 13, 9651, 1904, 29918, 1272, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 4706, 565, 4742, 29889, 1853, 1275, 525, 21970, 2396, 13, 9651, 1423, 9748, 353, 4842, 305, 29889, 1359, 29898, 5085, 29889, 19878, 29918, 3166, 29892, 2910, 29918, 5479, 29922, 2892, 8635, 29892, 4423, 29901, 8635, 29897, 13, 4706, 1683, 29901, 13, 9651, 1423, 9748, 353, 4842, 305, 29889, 1359, 29898, 5085, 29889, 19878, 29918, 3166, 29892, 2910, 29918, 5479, 3790, 4299, 29918, 1272, 1839, 10141, 2033, 29901, 6389, 29889, 10141, 1800, 13, 13, 4706, 1369, 29918, 1022, 2878, 353, 1423, 9748, 29889, 657, 877, 1022, 2878, 742, 29871, 29900, 29897, 13, 4706, 3564, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 9748, 29889, 657, 877, 4299, 29918, 3859, 29918, 8977, 8785, 13, 4706, 5994, 3950, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 9748, 29889, 657, 877, 20640, 3950, 29918, 3859, 29918, 8977, 8785, 13, 1678, 565, 9049, 5085, 29889, 657, 877, 10118, 29918, 29212, 742, 7700, 1125, 13, 4706, 363, 1828, 29918, 2972, 297, 5994, 3950, 29889, 3207, 29918, 13155, 29901, 13, 9651, 1828, 29918, 2972, 1839, 29212, 2033, 353, 6389, 29889, 29212, 13, 13, 1678, 4331, 353, 29871, 29900, 13, 1678, 1900, 29918, 791, 29918, 6758, 353, 7442, 29889, 7192, 13, 1678, 7945, 29918, 261, 2288, 353, 7442, 29889, 3298, 359, 29898, 5085, 29889, 1022, 2878, 29879, 29897, 13, 13, 1678, 1596, 703, 4763, 292, 515, 21502, 305, 6571, 1642, 4830, 29898, 2962, 29918, 1022, 2878, 13, 462, 462, 965, 876, 13, 1678, 1018, 29901, 13, 4706, 363, 21502, 305, 297, 3464, 29898, 2962, 29918, 1022, 2878, 29892, 6389, 29889, 1022, 2878, 29879, 1125, 13, 9651, 1480, 29918, 1220, 353, 6629, 13, 9651, 3564, 29889, 14968, 580, 13, 9651, 7945, 29918, 955, 353, 341, 1660, 29909, 19698, 29924, 1308, 29898, 29941, 29892, 518, 29906, 1402, 903, 4905, 29918, 12719, 29897, 13, 9651, 7945, 29918, 6758, 353, 29871, 29900, 13, 9651, 1369, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 13, 9651, 363, 21000, 29892, 9853, 297, 260, 29939, 18933, 29898, 15172, 29898, 14968, 29918, 12657, 22164, 13, 18884, 1238, 271, 29892, 260, 1191, 29892, 17117, 903, 353, 9853, 13, 18884, 1238, 271, 29892, 260, 1191, 353, 1238, 271, 29889, 517, 29898, 10141, 511, 260, 1191, 29889, 517, 29898, 10141, 29897, 13, 18884, 5994, 3950, 29889, 9171, 29918, 5105, 580, 13, 18884, 25383, 353, 3564, 29898, 1725, 271, 29897, 13, 18884, 7945, 29918, 955, 29889, 1202, 29898, 11965, 18186, 29889, 21970, 2141, 4801, 496, 2141, 23749, 3285, 260, 1191, 29889, 21970, 2141, 4801, 496, 2141, 23749, 3101, 13, 18884, 6410, 353, 28770, 291, 29898, 11965, 18186, 29892, 260, 1191, 29897, 13, 18884, 7945, 29918, 6758, 4619, 6410, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 18884, 6410, 29889, 1627, 1328, 580, 13, 18884, 5994, 3950, 29889, 10568, 580, 13, 18884, 4331, 4619, 29871, 29896, 13, 13, 9651, 7945, 29918, 261, 2288, 29961, 1022, 2878, 29962, 353, 7945, 29918, 6758, 847, 7945, 29918, 1195, 29875, 29918, 16175, 267, 13, 9651, 1095, 29918, 29873, 353, 931, 29889, 2230, 580, 13, 9651, 565, 451, 11813, 29918, 8513, 29901, 13, 18884, 1596, 877, 29899, 29915, 334, 29871, 29906, 29945, 29897, 13, 18884, 1596, 877, 29923, 1129, 305, 24335, 931, 8744, 29901, 12365, 29889, 29941, 29888, 29913, 29879, 29892, 6410, 29901, 24335, 659, 29918, 6758, 6571, 19248, 29901, 29889, 29953, 29888, 29913, 4286, 4830, 29898, 13, 462, 1678, 21502, 305, 29892, 1095, 29918, 29873, 448, 1369, 29918, 29873, 29892, 7945, 29918, 261, 2288, 29961, 1022, 2878, 1402, 7945, 29918, 955, 29889, 657, 29918, 12719, 29918, 485, 29887, 3285, 7945, 29918, 955, 29889, 657, 29918, 7827, 29918, 485, 29887, 22130, 13, 9651, 1596, 877, 29931, 799, 1076, 6554, 29901, 6571, 4286, 4830, 29898, 20640, 3950, 29889, 3207, 29918, 13155, 29961, 29900, 22322, 29212, 25901, 13, 9651, 1480, 29918, 1220, 353, 3402, 29918, 1807, 29898, 1188, 29918, 1220, 29892, 21502, 305, 29892, 5994, 3950, 29889, 3207, 29918, 13155, 29961, 29900, 22322, 29212, 7464, 7945, 29918, 261, 2288, 29961, 1022, 2878, 1402, 13, 462, 462, 268, 334, 14968, 29918, 955, 29889, 657, 29918, 12719, 29918, 485, 29887, 3101, 13, 13, 9651, 7160, 29918, 4299, 353, 7700, 13, 9651, 565, 659, 29918, 12657, 29901, 13, 18884, 3564, 29889, 14513, 580, 13, 18884, 659, 29918, 955, 353, 341, 1660, 29909, 19698, 29924, 1308, 29898, 29941, 29892, 518, 29906, 1402, 903, 4905, 29918, 12719, 29897, 13, 18884, 659, 29918, 6758, 353, 29871, 29900, 13, 18884, 363, 21000, 29892, 9853, 297, 260, 29939, 18933, 29898, 15172, 29898, 791, 29918, 12657, 22164, 13, 462, 1678, 1238, 271, 29892, 260, 1191, 29892, 17117, 903, 353, 9853, 13, 462, 1678, 1238, 271, 29892, 260, 1191, 353, 1238, 271, 29889, 517, 29898, 10141, 511, 260, 1191, 29889, 517, 29898, 10141, 29897, 13, 462, 1678, 5994, 3950, 29889, 9171, 29918, 5105, 580, 13, 462, 1678, 4450, 353, 3564, 29898, 1725, 271, 29897, 13, 462, 1678, 659, 29918, 955, 29889, 1202, 29898, 11965, 29889, 21970, 2141, 4801, 496, 2141, 23749, 3285, 260, 1191, 29889, 21970, 2141, 4801, 496, 2141, 23749, 3101, 13, 462, 1678, 659, 29918, 6758, 4619, 28770, 291, 29898, 11965, 29892, 260, 1191, 467, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 18884, 659, 29918, 6758, 353, 659, 29918, 6758, 847, 659, 29918, 1195, 29875, 29918, 16175, 267, 13, 18884, 1480, 29918, 1220, 353, 3402, 29918, 1807, 29898, 1188, 29918, 1220, 29892, 659, 29918, 6758, 29892, 334, 791, 29918, 955, 29889, 657, 29918, 12719, 29918, 485, 29887, 3101, 13, 18884, 565, 451, 11813, 29918, 8513, 29901, 13, 462, 1678, 1596, 877, 19448, 6410, 29901, 6571, 659, 29918, 6758, 29901, 6571, 19248, 29901, 29889, 29953, 29888, 29913, 4286, 4830, 29898, 791, 29918, 6758, 29892, 659, 29918, 955, 29889, 657, 29918, 12719, 29918, 485, 29887, 3285, 13, 462, 462, 462, 462, 965, 659, 29918, 955, 29889, 657, 29918, 7827, 29918, 485, 29887, 22130, 13, 18884, 565, 659, 29918, 6758, 529, 1900, 29918, 791, 29918, 6758, 29901, 13, 462, 1678, 1900, 29918, 791, 29918, 6758, 353, 659, 29918, 6758, 13, 462, 1678, 7160, 29918, 4299, 353, 5852, 13, 462, 1678, 565, 6389, 29889, 449, 29918, 3972, 29901, 13, 462, 4706, 1904, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 3198, 9748, 742, 525, 3198, 3149, 29918, 29995, 29881, 29889, 415, 29915, 1273, 21502, 305, 29897, 13, 462, 4706, 4842, 305, 29889, 7620, 3319, 29915, 4299, 29918, 3859, 29918, 8977, 2396, 3564, 29889, 3859, 29918, 8977, 3285, 13, 462, 462, 1678, 525, 1022, 2878, 2396, 21502, 305, 29892, 13, 462, 462, 1678, 525, 6758, 2396, 7945, 29918, 261, 2288, 29961, 1022, 2878, 1402, 13, 462, 462, 1678, 525, 20640, 3950, 29918, 3859, 29918, 8977, 2396, 5994, 3950, 29889, 3859, 29918, 8977, 580, 1118, 1904, 29918, 2084, 29897, 13, 462, 4706, 1596, 877, 25353, 15758, 362, 8125, 7160, 304, 13420, 1904, 29918, 2084, 29897, 13, 18884, 1364, 14952, 29889, 10568, 29898, 791, 29918, 6758, 29897, 13, 13, 9651, 565, 6389, 29889, 449, 29918, 3972, 322, 451, 7160, 29918, 4299, 322, 313, 1022, 2878, 718, 29871, 29896, 29897, 1273, 6389, 29889, 7620, 29918, 19207, 1275, 29871, 29900, 29901, 29871, 396, 4078, 1584, 411, 8845, 13, 18884, 1904, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 3198, 9748, 742, 525, 293, 3202, 3149, 29918, 29995, 29881, 29889, 415, 29915, 1273, 21502, 305, 29897, 13, 18884, 4842, 305, 29889, 7620, 3319, 29915, 4299, 29918, 3859, 29918, 8977, 2396, 3564, 29889, 3859, 29918, 8977, 3285, 13, 462, 9651, 525, 1022, 2878, 2396, 21502, 305, 29892, 13, 462, 9651, 525, 6758, 2396, 7945, 29918, 261, 2288, 29961, 1022, 2878, 1402, 13, 462, 9651, 525, 20640, 3950, 29918, 3859, 29918, 8977, 2396, 5994, 3950, 29889, 3859, 29918, 8977, 580, 1118, 1904, 29918, 2084, 29897, 13, 18884, 1596, 877, 3195, 7160, 304, 13420, 1904, 29918, 2084, 29897, 13, 13, 9651, 565, 1480, 29918, 1445, 29901, 13, 18884, 1480, 29918, 1220, 4619, 11297, 29876, 29915, 13, 18884, 411, 1722, 29898, 1188, 29918, 1445, 29892, 525, 29874, 1495, 408, 285, 29901, 13, 462, 1678, 285, 29889, 3539, 29898, 1188, 29918, 1220, 29897, 13, 9651, 565, 7442, 29889, 275, 13707, 29898, 14968, 29918, 6758, 1125, 13, 18884, 1596, 703, 13919, 995, 29889, 6639, 3262, 6694, 23157, 13, 18884, 2867, 13, 1678, 5174, 7670, 3377, 4074, 6685, 29901, 13, 4706, 1596, 877, 29899, 29915, 334, 29871, 29953, 29900, 29897, 13, 4706, 1596, 877, 29923, 279, 368, 29504, 1495, 13, 13, 1678, 1596, 877, 5323, 2827, 8676, 1495, 13, 1678, 565, 6389, 29889, 449, 29918, 3972, 29901, 13, 4706, 1904, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 525, 3198, 9748, 742, 525, 3198, 3149, 29918, 12333, 29889, 415, 1495, 13, 4706, 4842, 305, 29889, 7620, 3319, 29915, 4299, 29918, 3859, 29918, 8977, 2396, 3564, 29889, 3859, 29918, 8977, 3285, 13, 462, 1678, 525, 1022, 2878, 2396, 21502, 305, 29892, 13, 462, 1678, 525, 20640, 3950, 29918, 3859, 29918, 8977, 2396, 5994, 3950, 29889, 3859, 29918, 8977, 580, 1118, 1904, 29918, 2084, 29897, 13, 13, 13, 1753, 8265, 29918, 3018, 29926, 29918, 2541, 29918, 11965, 29879, 29918, 10945, 29898, 24713, 29892, 4450, 29879, 29892, 1399, 29922, 8516, 29892, 19359, 29918, 333, 29922, 29900, 29892, 1134, 2433, 11965, 29879, 742, 3579, 19290, 1125, 13, 1678, 1399, 353, 1399, 565, 1399, 338, 451, 6213, 1683, 7442, 29889, 2378, 4197, 29875, 29961, 29896, 29962, 363, 474, 297, 8783, 29889, 2248, 29918, 1958, 565, 474, 29961, 29900, 29962, 1275, 19359, 29918, 333, 1402, 26688, 29922, 9302, 29889, 524, 29897, 13, 13, 1678, 565, 1134, 1275, 525, 4141, 2396, 13, 4706, 396, 926, 353, 8783, 29889, 4141, 29918, 1066, 29961, 11762, 29918, 333, 3816, 29901, 29892, 584, 29906, 29962, 13, 4706, 926, 353, 8783, 29889, 4141, 29918, 1066, 29961, 11762, 29918, 333, 3816, 29901, 29892, 584, 29941, 29962, 13, 1678, 1683, 29901, 13, 4706, 18696, 353, 8783, 29889, 1372, 29961, 11762, 29918, 333, 29962, 13, 4706, 396, 11796, 29872, 278, 5534, 12885, 515, 1887, 12885, 29889, 13, 4706, 270, 1372, 353, 7442, 29889, 12676, 29898, 1372, 29961, 513, 29961, 29896, 29901, 5262, 448, 18696, 29961, 513, 7503, 29899, 29896, 24960, 13, 4706, 926, 353, 4450, 29879, 334, 270, 1372, 13, 4706, 396, 926, 29961, 29900, 29892, 584, 29962, 353, 8783, 29889, 4141, 29918, 1066, 29961, 11762, 29918, 333, 3816, 29900, 29892, 584, 29906, 29962, 13, 4706, 926, 29961, 29900, 29892, 584, 29962, 353, 8783, 29889, 4141, 29918, 1066, 29961, 11762, 29918, 333, 3816, 29900, 29892, 584, 29941, 29962, 13, 4706, 926, 353, 7442, 29889, 29883, 398, 2083, 29898, 1066, 29892, 9685, 29922, 29900, 29897, 13, 1678, 9110, 353, 4450, 29879, 13, 1678, 470, 29875, 353, 8783, 29889, 12236, 800, 29961, 11762, 29918, 333, 29962, 13, 13, 1678, 736, 926, 29892, 9110, 29892, 470, 29875, 13, 13, 13, 1753, 1243, 29898, 5085, 29892, 3579, 19290, 1125, 13, 1678, 5534, 4742, 29892, 903, 4905, 29918, 12719, 13, 1678, 1053, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 1678, 4742, 353, 4842, 305, 29889, 10141, 29898, 5085, 29889, 10141, 565, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 1683, 525, 21970, 1495, 13, 13, 1678, 565, 6389, 29889, 1688, 29918, 2084, 338, 451, 6213, 29901, 13, 4706, 565, 6389, 29889, 1688, 29918, 2084, 14352, 29896, 29962, 1275, 8207, 2396, 13, 9651, 6389, 29889, 1688, 29918, 2084, 353, 6389, 29889, 1688, 29918, 2084, 7503, 29899, 29896, 29962, 13, 4706, 3876, 29918, 3972, 353, 288, 1028, 29889, 5451, 29898, 5085, 29889, 1688, 29918, 2084, 9601, 29900, 29962, 13, 4706, 1243, 29918, 1272, 29918, 1761, 353, 518, 4705, 29889, 5451, 29898, 5085, 29889, 1688, 29918, 2084, 9601, 29896, 5262, 13, 1678, 25342, 6389, 29889, 1688, 29918, 1761, 338, 451, 6213, 29901, 13, 4706, 3876, 29918, 3972, 353, 6389, 29889, 4632, 29918, 3972, 565, 6389, 29889, 4632, 29918, 3972, 1683, 288, 1028, 29889, 5451, 29898, 5085, 29889, 1688, 29918, 1761, 9601, 29900, 29962, 13, 4706, 411, 1722, 29898, 5085, 29889, 1688, 29918, 1761, 29897, 408, 285, 29901, 13, 9651, 1243, 29918, 1272, 29918, 1761, 353, 518, 29879, 29889, 17010, 2141, 5451, 29317, 29861, 29900, 29962, 363, 269, 297, 285, 29889, 949, 9012, 580, 565, 7431, 29898, 29879, 29897, 1405, 29871, 29900, 322, 269, 29961, 29900, 29962, 2804, 16321, 2033, 13, 1678, 1683, 29901, 13, 4706, 12020, 7865, 2392, 877, 29923, 2121, 1243, 29918, 2084, 470, 1243, 29918, 1761, 1818, 367, 6790, 29889, 1495, 13, 13, 1678, 396, 16012, 278, 937, 5665, 304, 2767, 278, 1881, 322, 1962, 2159, 13, 1678, 903, 353, 679, 29918, 24713, 29898, 4632, 29918, 3972, 29892, 518, 1688, 29918, 1272, 29918, 1761, 29961, 29900, 20526, 6389, 29892, 4464, 2433, 1688, 1495, 13, 13, 1678, 565, 6389, 29889, 449, 29918, 3972, 322, 451, 288, 1028, 29889, 9933, 29898, 5085, 29889, 449, 29918, 3972, 1125, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 5085, 29889, 449, 29918, 3972, 29897, 13, 13, 1678, 411, 1722, 29898, 4705, 29889, 7122, 29898, 710, 29898, 2605, 29898, 5085, 29889, 4299, 29918, 2084, 467, 862, 1237, 29961, 29896, 11724, 525, 2917, 29889, 3126, 5477, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 1904, 29918, 1272, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 13, 1678, 565, 4742, 29889, 1853, 1275, 525, 21970, 2396, 13, 4706, 1423, 3149, 353, 4842, 305, 29889, 1359, 29898, 5085, 29889, 4299, 29918, 2084, 29892, 2910, 29918, 5479, 29922, 2892, 8635, 29892, 4423, 29901, 8635, 29897, 13, 1678, 1683, 29901, 13, 4706, 1423, 3149, 353, 4842, 305, 29889, 1359, 29898, 5085, 29889, 4299, 29918, 2084, 29892, 2910, 29918, 5479, 3790, 4299, 29918, 1272, 1839, 10141, 2033, 29901, 6389, 29889, 10141, 1800, 13, 13, 1678, 3564, 353, 679, 29918, 4299, 29898, 5085, 29892, 3579, 19290, 29897, 13, 1678, 3564, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 3198, 3149, 29889, 657, 877, 4299, 29918, 3859, 29918, 8977, 8785, 13, 1678, 3564, 29889, 14513, 2141, 517, 29898, 10141, 29897, 13, 1678, 1596, 877, 3195, 6571, 7500, 304, 4742, 426, 1836, 4286, 4830, 29898, 5085, 29889, 4299, 29918, 2084, 29892, 4742, 876, 13, 13, 1678, 1480, 29918, 1445, 353, 6213, 13, 1678, 565, 6389, 29889, 1688, 29918, 1761, 322, 6389, 29889, 449, 29918, 3972, 29901, 13, 4706, 1480, 29918, 1445, 353, 288, 1028, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 288, 1028, 29889, 5451, 29898, 5085, 29889, 1688, 29918, 1761, 9601, 29899, 29896, 1822, 5451, 12839, 29861, 29900, 29962, 718, 22868, 1188, 29889, 3945, 1495, 13, 4706, 411, 1722, 29898, 1188, 29918, 1445, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 5085, 29889, 4299, 29918, 2084, 718, 11297, 29876, 1495, 13, 9651, 285, 29889, 3539, 877, 23718, 1020, 29926, 29918, 2435, 12885, 263, 371, 364, 371, 29905, 29876, 1495, 13, 13, 1678, 28495, 29918, 955, 353, 341, 1660, 29909, 19698, 29924, 1308, 29898, 29906, 29892, 518, 29896, 1402, 903, 4905, 29918, 12719, 29897, 13, 1678, 263, 371, 29918, 497, 29892, 364, 371, 29918, 497, 353, 19997, 5159, 13, 1678, 4450, 29918, 546, 29918, 1195, 353, 29871, 29906, 29900, 29900, 334, 29871, 29953, 29900, 13, 13, 1678, 19359, 29918, 24713, 353, 679, 29918, 24713, 29898, 4632, 29918, 3972, 29892, 1243, 29918, 1272, 29918, 1761, 29892, 6389, 29892, 4464, 2433, 1688, 742, 3579, 19290, 29897, 13, 13, 1678, 363, 22645, 29892, 848, 297, 26985, 29898, 1688, 29918, 1272, 29918, 1761, 1125, 13, 4706, 4974, 848, 1275, 288, 1028, 29889, 5451, 29898, 11762, 29918, 24713, 29889, 1272, 29918, 2084, 29961, 13140, 2314, 29961, 29896, 29962, 13, 13, 4706, 1238, 271, 29892, 5343, 353, 19359, 29918, 24713, 29889, 657, 29918, 1688, 29918, 11762, 29898, 13140, 29897, 13, 4706, 1238, 271, 353, 4842, 305, 29889, 29911, 6073, 29898, 1725, 271, 467, 517, 29898, 10141, 29897, 13, 4706, 4450, 29879, 353, 7442, 29889, 29879, 802, 29872, 911, 29898, 11618, 29898, 1725, 271, 467, 21970, 2141, 4801, 496, 2141, 23749, 3101, 14352, 955, 29889, 12181, 29961, 29900, 5387, 29892, 584, 29918, 4905, 29918, 12719, 29962, 13, 13, 4706, 1399, 353, 7442, 29889, 279, 927, 29898, 955, 29889, 12181, 29961, 29900, 2314, 13, 4706, 659, 29918, 6758, 267, 353, 7442, 29889, 12676, 3552, 955, 448, 4450, 29879, 29897, 3579, 29871, 29906, 29892, 9685, 29922, 29900, 29897, 13, 4706, 28495, 29918, 955, 29889, 1202, 29898, 955, 29892, 4450, 29879, 29897, 13, 13, 4706, 1596, 877, 1123, 11433, 292, 23324, 706, 1495, 13, 4706, 926, 29918, 11965, 29892, 330, 29894, 29918, 11965, 29892, 903, 353, 8265, 29918, 3018, 29926, 29918, 2541, 29918, 11965, 29879, 29918, 10945, 29898, 11762, 29918, 24713, 29892, 4450, 29879, 29892, 1399, 29922, 513, 29892, 1134, 2433, 11965, 742, 19359, 29918, 333, 29922, 13140, 29897, 13, 4706, 926, 29918, 4141, 29892, 330, 29894, 29918, 4141, 29892, 903, 353, 8265, 29918, 3018, 29926, 29918, 2541, 29918, 11965, 29879, 29918, 10945, 29898, 11762, 29918, 24713, 29892, 5343, 29892, 1399, 29922, 513, 29892, 1134, 2433, 4141, 742, 19359, 29918, 333, 29922, 13140, 29897, 13, 13, 4706, 565, 6389, 29889, 449, 29918, 3972, 338, 451, 6213, 322, 288, 1028, 29889, 275, 3972, 29898, 5085, 29889, 449, 29918, 3972, 1125, 13, 9651, 7442, 29889, 7620, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 22372, 3227, 1836, 29876, 2272, 4286, 4830, 29898, 1272, 29892, 6389, 29889, 1853, 8243, 13, 462, 1678, 7442, 29889, 535, 29883, 2579, 403, 4197, 1066, 29918, 11965, 29892, 926, 29918, 4141, 1402, 9685, 29922, 29896, 876, 13, 13, 4706, 263, 371, 353, 10272, 29918, 23552, 29918, 3018, 622, 706, 29918, 2704, 29898, 1066, 29918, 11965, 29892, 926, 29918, 4141, 29897, 13, 4706, 565, 926, 29918, 11965, 29889, 12181, 29961, 29900, 29962, 529, 4450, 29918, 546, 29918, 1195, 29901, 13, 9651, 11959, 353, 4450, 29918, 546, 29918, 1195, 847, 926, 29918, 11965, 29889, 12181, 29961, 29900, 29962, 13, 9651, 364, 371, 353, 10272, 29918, 22925, 29918, 3018, 622, 706, 29918, 2704, 29898, 1066, 29918, 11965, 29892, 926, 29918, 4141, 29892, 19471, 29922, 1066, 29918, 11965, 29889, 12181, 29961, 29900, 29962, 448, 29871, 29896, 29897, 334, 11959, 13, 4706, 1683, 29901, 13, 9651, 364, 371, 353, 10272, 29918, 22925, 29918, 3018, 622, 706, 29918, 2704, 29898, 1066, 29918, 11965, 29892, 926, 29918, 4141, 29892, 19471, 29922, 11965, 29918, 546, 29918, 1195, 29897, 13, 4706, 926, 29918, 29883, 398, 29918, 2704, 353, 7442, 29889, 29880, 979, 29887, 29889, 12324, 29898, 1066, 29918, 11965, 448, 926, 29918, 4141, 29892, 9685, 29922, 29896, 29897, 13, 4706, 263, 371, 29918, 497, 29889, 4397, 29898, 403, 29897, 13, 4706, 364, 371, 29918, 497, 29889, 4397, 29898, 29878, 371, 29897, 13, 13, 4706, 1596, 877, 20529, 24335, 12019, 25245, 6410, 6571, 847, 24335, 319, 4330, 29901, 24335, 390, 4330, 29901, 8875, 4286, 4830, 29898, 1272, 29892, 659, 29918, 6758, 267, 29892, 7442, 29889, 12676, 29898, 791, 29918, 6758, 267, 511, 263, 371, 29892, 13, 462, 462, 462, 462, 965, 364, 371, 876, 13, 4706, 1480, 29918, 1220, 353, 3402, 29918, 1807, 29898, 1272, 29892, 7442, 29889, 12676, 29898, 791, 29918, 6758, 267, 511, 263, 371, 29892, 364, 371, 29897, 13, 13, 4706, 565, 451, 6389, 29889, 11255, 29918, 1688, 29901, 13, 9651, 413, 29886, 353, 4450, 29879, 29889, 12181, 29961, 29896, 29962, 13, 9651, 565, 413, 29886, 1275, 29871, 29906, 29901, 13, 18884, 260, 1191, 29918, 7039, 353, 6024, 29894, 29916, 742, 525, 13308, 2033, 13, 9651, 25342, 413, 29886, 1275, 29871, 29941, 29901, 13, 18884, 260, 1191, 29918, 7039, 353, 6024, 29894, 29916, 742, 525, 13308, 742, 525, 29894, 29920, 2033, 13, 13, 9651, 14770, 29889, 4532, 877, 8875, 4286, 4830, 29898, 1272, 511, 2537, 2311, 7607, 29896, 29953, 29892, 29871, 29929, 876, 13, 9651, 14770, 29889, 1491, 5317, 29906, 7720, 3552, 29895, 29886, 29892, 29871, 29906, 511, 313, 29900, 29892, 29871, 29900, 511, 1948, 9653, 29922, 29895, 29886, 448, 29871, 29896, 29897, 13, 9651, 14770, 29889, 5317, 29898, 1066, 29918, 11965, 7503, 29892, 29871, 29900, 1402, 926, 29918, 11965, 7503, 29892, 29871, 29896, 2314, 13, 9651, 14770, 29889, 5317, 29898, 1066, 29918, 4141, 7503, 29892, 29871, 29900, 1402, 926, 29918, 4141, 7503, 29892, 29871, 29896, 2314, 13, 9651, 14770, 29889, 3257, 29898, 1272, 29897, 13, 9651, 14770, 29889, 8990, 877, 11745, 1495, 13, 9651, 14770, 29889, 26172, 18959, 23084, 18186, 742, 525, 3338, 618, 8760, 11287, 13, 9651, 14770, 29889, 1491, 5317, 29906, 7720, 3552, 29895, 29886, 29892, 29871, 29906, 511, 313, 29895, 29886, 448, 29871, 29896, 29892, 29871, 29900, 876, 13, 9651, 14770, 29889, 5317, 29898, 1066, 29918, 29883, 398, 29918, 2704, 29897, 13, 9651, 14770, 29889, 26172, 18959, 3040, 29901, 25641, 29889, 29941, 29888, 1118, 390, 4330, 29901, 25641, 29889, 29941, 29888, 29913, 4286, 4830, 29898, 403, 29918, 497, 14352, 29896, 1402, 364, 371, 29918, 497, 14352, 29896, 2314, 2314, 13, 9651, 363, 474, 297, 3464, 29898, 29895, 29886, 1125, 13, 18884, 14770, 29889, 1491, 5317, 29906, 7720, 3552, 29895, 29886, 29892, 29871, 29906, 511, 313, 29875, 29892, 29871, 29896, 876, 13, 18884, 14770, 29889, 5317, 29898, 513, 29892, 4450, 29879, 7503, 29892, 474, 2314, 13, 18884, 14770, 29889, 5317, 29898, 513, 29892, 5343, 7503, 29892, 474, 2314, 13, 18884, 14770, 29889, 26172, 18959, 23084, 18186, 742, 525, 3338, 618, 8760, 11287, 13, 18884, 14770, 29889, 3257, 877, 29912, 1118, 1059, 29901, 12365, 29889, 29953, 29888, 29913, 4286, 4830, 29898, 29873, 1191, 29918, 7039, 29961, 29875, 1402, 659, 29918, 6758, 267, 29961, 29875, 12622, 13, 9651, 14770, 29889, 29873, 523, 29918, 2680, 580, 13, 13, 9651, 565, 6389, 29889, 4294, 29918, 5317, 29901, 13, 18884, 14770, 29889, 4294, 580, 13, 13, 9651, 565, 6389, 29889, 449, 29918, 3972, 338, 451, 6213, 322, 288, 1028, 29889, 275, 3972, 29898, 5085, 29889, 449, 29918, 3972, 1125, 13, 18884, 14770, 29889, 7620, 1003, 29898, 4705, 29889, 7122, 29898, 5085, 29889, 449, 29918, 3972, 29892, 22372, 3227, 1836, 2732, 4286, 4830, 29898, 1272, 29892, 6389, 29889, 1853, 4961, 13, 13, 4706, 565, 1480, 29918, 1445, 338, 451, 6213, 29901, 13, 9651, 411, 1722, 29898, 1188, 29918, 1445, 29892, 525, 29874, 1495, 408, 285, 29901, 13, 18884, 1480, 29918, 1220, 4619, 11297, 29876, 29915, 13, 18884, 285, 29889, 3539, 29898, 1188, 29918, 1220, 29897, 13, 13, 4706, 14770, 29889, 5358, 877, 497, 1495, 13, 13, 1678, 263, 371, 29918, 497, 353, 7442, 29889, 2378, 29898, 403, 29918, 497, 29897, 13, 1678, 364, 371, 29918, 497, 353, 7442, 29889, 2378, 29898, 29878, 371, 29918, 497, 29897, 13, 13, 1678, 5645, 353, 3402, 29918, 1807, 877, 3040, 742, 525, 29934, 4330, 742, 16345, 2433, 29905, 29873, 1495, 13, 1678, 1819, 353, 3402, 29918, 1807, 29898, 9302, 29889, 12676, 29898, 403, 29918, 497, 511, 7442, 29889, 12676, 29898, 29878, 371, 29918, 497, 511, 16345, 2433, 29905, 29873, 1495, 13, 1678, 1596, 29898, 26658, 29892, 11297, 29876, 742, 1819, 29897, 13, 13, 1678, 565, 1480, 29918, 1445, 338, 451, 6213, 29901, 13, 4706, 411, 1722, 29898, 1188, 29918, 1445, 29892, 525, 29874, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 3539, 29898, 26658, 718, 11297, 29876, 1495, 13, 9651, 285, 29889, 3539, 29898, 5975, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 9995, 13, 1678, 7525, 934, 411, 5375, 6273, 470, 29914, 392, 2295, 934, 29889, 960, 2980, 5692, 297, 1716, 2295, 934, 322, 6389, 29892, 29871, 13, 1678, 6389, 338, 2183, 9399, 663, 29889, 13, 1678, 9995, 13, 1678, 2322, 29918, 2917, 29918, 1445, 353, 288, 1028, 29889, 370, 1028, 493, 29898, 4705, 29889, 7122, 29898, 4705, 29889, 370, 1028, 493, 22168, 1445, 1649, 511, 525, 21546, 2917, 29914, 1356, 1971, 284, 29918, 4299, 29918, 4381, 29879, 29889, 3126, 8785, 13, 13, 1678, 1053, 1852, 5510, 13, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 543, 6558, 19359, 29906, 11762, 1904, 297, 7945, 29914, 1688, 4464, 518, 12403, 1822, 28379, 376, 13, 462, 462, 462, 376, 2917, 332, 800, 508, 367, 6790, 408, 1192, 1989, 518, 1767, 636, 29962, 11000, 613, 13, 462, 462, 268, 788, 29918, 8477, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2917, 742, 1134, 29922, 710, 29892, 1371, 2433, 8614, 934, 518, 4592, 29901, 426, 6525, 4286, 4830, 29898, 4381, 29918, 2917, 29918, 1445, 511, 13, 462, 4706, 2322, 29922, 4381, 29918, 2917, 29918, 1445, 29897, 13, 1678, 396, 3619, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1853, 742, 1134, 29922, 710, 29892, 19995, 29922, 1839, 14246, 29876, 742, 525, 20155, 29885, 742, 525, 20155, 29885, 29918, 5365, 7464, 1371, 2433, 3195, 1134, 742, 2322, 2433, 20155, 29885, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 4632, 29918, 3972, 742, 1134, 29922, 710, 29892, 2322, 13802, 1272, 29914, 1177, 29903, 1469, 29914, 1144, 29918, 1272, 29918, 1688, 29914, 1367, 5607, 29918, 29903, 1947, 1177, 29903, 29914, 25237, 29896, 29914, 14968, 29918, 8382, 613, 1371, 2433, 2605, 304, 848, 3884, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 18157, 29918, 3972, 742, 1134, 29922, 710, 29892, 2322, 13802, 1272, 29914, 1177, 29903, 1469, 29914, 1144, 29918, 1272, 29918, 1688, 29914, 1367, 5607, 29918, 29903, 1947, 1177, 29903, 29914, 25237, 29896, 29914, 14968, 29918, 8382, 1159, 13, 1678, 396, 13812, 29889, 1202, 29918, 23516, 877, 489, 4632, 29918, 3972, 742, 1134, 29922, 710, 29892, 13, 1678, 396, 462, 268, 2322, 13802, 5184, 29914, 29903, 1430, 10490, 8890, 29914, 29916, 332, 348, 4881, 29914, 4836, 29914, 1617, 262, 29914, 29934, 1164, 1177, 29914, 14968, 29918, 8382, 613, 13, 1678, 396, 462, 268, 1371, 2433, 2605, 304, 848, 3884, 1495, 13, 1678, 396, 13812, 29889, 1202, 29918, 23516, 877, 489, 18157, 29918, 3972, 742, 1134, 29922, 710, 29892, 13, 1678, 396, 462, 268, 2322, 13802, 5184, 29914, 29903, 1430, 10490, 8890, 29914, 29916, 332, 348, 4881, 29914, 4836, 29914, 1617, 262, 29914, 29934, 1164, 1177, 29914, 14968, 29918, 8382, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 8173, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 29922, 8516, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 14394, 29918, 3754, 742, 1134, 29922, 7411, 29892, 1371, 2433, 29954, 17019, 363, 1560, 29877, 6046, 5680, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5182, 29918, 3754, 742, 1134, 29922, 7411, 29892, 1371, 2433, 29954, 17019, 363, 1560, 29877, 6046, 3646, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 7165, 29918, 2311, 742, 1134, 29922, 524, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 10568, 29918, 2311, 742, 1134, 29922, 524, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16175, 29918, 2311, 742, 1134, 29922, 524, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1949, 29918, 1287, 414, 742, 1134, 29922, 524, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 449, 29918, 3972, 742, 1134, 29922, 710, 29892, 2322, 2433, 6995, 4905, 29914, 1617, 262, 29918, 20155, 29885, 29914, 333, 324, 29914, 29906, 29900, 29906, 29896, 29889, 29900, 29945, 29889, 29896, 29946, 29914, 14968, 29918, 8382, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 10141, 742, 1134, 29922, 710, 29892, 1371, 2433, 29907, 6191, 4742, 313, 29872, 29889, 29887, 13018, 274, 6191, 29901, 29900, 29897, 470, 26403, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 24713, 742, 1134, 29922, 710, 29892, 19995, 29922, 1839, 1617, 262, 742, 525, 2429, 29875, 742, 525, 29879, 1947, 7464, 2322, 2433, 29879, 1947, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 326, 29884, 29918, 29888, 7971, 742, 1134, 29922, 524, 29892, 2322, 29922, 29906, 29900, 29900, 29897, 13, 1678, 396, 260, 18038, 13, 1678, 260, 18038, 29918, 9006, 353, 13812, 29889, 1202, 29918, 23516, 29918, 2972, 877, 14246, 29876, 742, 525, 13305, 363, 323, 13778, 1495, 13, 1678, 260, 18038, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 17460, 29918, 2311, 742, 1134, 29922, 524, 29897, 13, 1678, 260, 18038, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 305, 12629, 742, 1134, 29922, 710, 29892, 1371, 2433, 13599, 15786, 363, 323, 13778, 15359, 313, 510, 655, 13055, 29897, 1495, 13, 1678, 396, 24471, 29885, 13, 1678, 24471, 29885, 29918, 9006, 353, 13812, 29889, 1202, 29918, 23516, 29918, 2972, 877, 20155, 29885, 742, 525, 13305, 363, 365, 1254, 29924, 1495, 13, 1678, 24471, 29885, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 29277, 742, 1134, 29922, 524, 29897, 13, 1678, 24471, 29885, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 13148, 29918, 2311, 742, 1134, 29922, 524, 29897, 13, 13, 1678, 4464, 353, 13812, 29889, 1202, 29918, 1491, 862, 4253, 29898, 3257, 2433, 8513, 742, 2731, 2433, 8513, 742, 1371, 2433, 10925, 29901, 518, 14968, 29962, 7945, 1904, 29892, 518, 1688, 29962, 14707, 1904, 1495, 13, 1678, 4464, 29889, 12403, 353, 7700, 13, 1678, 396, 7945, 13, 1678, 7945, 29918, 9006, 353, 4464, 29889, 1202, 29918, 16680, 877, 14968, 1495, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 14968, 29918, 1761, 742, 1134, 29922, 710, 29897, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 791, 29918, 1761, 742, 1134, 29922, 710, 29897, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 19878, 29918, 3166, 742, 1134, 29922, 710, 29892, 2322, 29922, 8516, 29897, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 1022, 2878, 29879, 742, 1134, 29922, 524, 29897, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 7620, 29918, 19207, 742, 1134, 29922, 524, 29897, 13, 1678, 7945, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 29212, 742, 525, 489, 21891, 29918, 10492, 742, 1134, 29922, 7411, 29897, 13, 1678, 396, 1243, 13, 1678, 1243, 29918, 9006, 353, 4464, 29889, 1202, 29918, 16680, 877, 1688, 1495, 13, 1678, 1243, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 1688, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 29922, 8516, 29897, 13, 1678, 1243, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 1688, 29918, 1761, 742, 1134, 29922, 710, 29892, 2322, 29922, 8516, 29897, 13, 1678, 1243, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 4299, 29918, 2084, 742, 1134, 29922, 710, 29892, 2322, 2433, 29914, 5184, 29914, 29903, 1430, 10490, 8890, 29914, 29916, 332, 348, 4881, 29914, 4836, 29914, 1617, 262, 29914, 4905, 29914, 1617, 262, 29918, 20155, 29885, 29914, 333, 324, 29914, 29906, 29900, 29906, 29896, 29889, 29900, 29945, 29889, 29896, 29946, 29914, 14968, 29918, 8382, 29914, 3198, 9748, 29914, 3198, 3149, 29918, 29955, 29896, 29946, 29889, 415, 1495, 13, 1678, 1243, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 11255, 29918, 1688, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 1678, 1243, 29918, 9006, 29889, 1202, 29918, 23516, 877, 489, 4294, 29918, 5317, 742, 3158, 2433, 8899, 29918, 3009, 1495, 13, 13, 1678, 14550, 13, 1678, 7338, 336, 6273, 13, 1678, 3789, 5852, 29901, 671, 29918, 816, 14952, 29892, 29871, 13, 795, 3755, 313, 1217, 1962, 373, 27591, 511, 29871, 13, 795, 4889, 29918, 29212, 313, 10118, 301, 29878, 746, 263, 1904, 338, 7500, 515, 6773, 29918, 3166, 29897, 13, 1678, 5785, 29901, 29871, 5768, 449, 29892, 29871, 13, 9651, 4236, 29918, 4170, 29918, 2704, 313, 3127, 29889, 16897, 363, 20136, 867, 29894, 297, 14496, 29897, 13, 9651, 4236, 29918, 955, 25245, 29918, 12324, 313, 4572, 714, 27801, 297, 6694, 29897, 29871, 13, 1678, 14550, 13, 13, 1678, 6389, 29892, 9815, 29918, 5085, 353, 13812, 29889, 5510, 29918, 5203, 29918, 5085, 580, 13, 1678, 7442, 29889, 842, 29918, 558, 8941, 1980, 29898, 689, 2620, 3790, 29915, 497, 2396, 14013, 921, 29901, 22372, 29901, 29889, 29953, 29888, 29913, 4286, 4830, 29898, 29916, 26972, 13, 13, 1678, 6389, 29892, 9049, 5085, 353, 2254, 29918, 2917, 29898, 4381, 29918, 2917, 29918, 1445, 29892, 6389, 29892, 9815, 29918, 5085, 29897, 13, 1678, 1596, 29898, 5085, 29892, 9049, 5085, 29897, 13, 13, 1678, 396, 788, 491, 1065, 4881, 13, 1678, 396, 2436, 1051, 13, 1678, 565, 6389, 29889, 8513, 1275, 376, 14968, 1115, 13, 4706, 565, 6389, 29889, 14968, 29918, 1761, 338, 6213, 29901, 13, 9651, 14350, 1293, 29898, 5085, 29889, 4632, 29918, 3972, 29892, 376, 14968, 29918, 1761, 29889, 3945, 613, 3617, 12924, 1170, 29898, 5085, 29889, 4632, 29918, 3972, 876, 13, 9651, 6389, 29889, 14968, 29918, 1761, 353, 6389, 29889, 4632, 29918, 3972, 718, 5591, 14968, 29918, 1761, 29889, 3945, 29908, 13, 4706, 565, 6389, 29889, 18157, 29918, 3972, 338, 451, 6213, 29901, 13, 9651, 14350, 1293, 29898, 5085, 29889, 18157, 29918, 3972, 29892, 376, 18157, 29918, 1761, 29889, 3945, 613, 3617, 12924, 1170, 29898, 5085, 29889, 18157, 29918, 3972, 876, 13, 9651, 6389, 29889, 791, 29918, 1761, 353, 6389, 29889, 18157, 29918, 3972, 718, 5591, 18157, 29918, 1761, 29889, 3945, 29908, 13, 1678, 25342, 6389, 29889, 8513, 1275, 376, 1688, 1115, 13, 4706, 565, 6389, 29889, 1688, 29918, 1761, 338, 6213, 29901, 13, 9651, 14350, 1293, 29898, 5085, 29889, 4632, 29918, 3972, 29892, 376, 1688, 29918, 1761, 29889, 3945, 613, 3617, 12924, 1170, 29898, 5085, 29889, 4632, 29918, 3972, 876, 13, 9651, 6389, 29889, 1688, 29918, 1761, 353, 6389, 29889, 4632, 29918, 3972, 718, 5591, 1688, 29918, 1761, 29889, 3945, 29908, 13, 13, 1678, 565, 6389, 29889, 8513, 1275, 525, 14968, 2396, 13, 4706, 7945, 29898, 5085, 29892, 3579, 19290, 29897, 13, 1678, 25342, 6389, 29889, 8513, 1275, 525, 1688, 2396, 13, 4706, 565, 451, 6389, 29889, 4299, 29918, 2084, 29901, 13, 9651, 12020, 7865, 2392, 703, 3195, 2224, 3734, 1159, 13, 4706, 6389, 29889, 16175, 29918, 2311, 353, 29871, 29896, 13, 4706, 1243, 29898, 5085, 29892, 3579, 19290, 29897, 13, 2 ]
scripts/build_LSTM_features.py
bhigy/zr-2021vg_baseline
6
83880
<reponame>bhigy/zr-2021vg_baseline # Based on https://github.com/bootphon/zerospeech2021_baseline/blob/master/scripts/build_LSTM_features.py import os import sys import json import argparse import progressbar from pathlib import Path from time import time import numpy as np from copy import deepcopy import torch from scripts.utils.utils_functions import writeArgs, loadLSTMLMCheckpoint def parseArgs(argv): # Run parameters parser = argparse.ArgumentParser(description='Export LSTM features from quantized units of audio files.') parser.add_argument('pathQuantizedUnits', type=str, help='Path to the quantized units. Each line of the input file must be' 'of the form file_name[tab]pseudo_units (ex. hat 1,1,2,3,4,4)') parser.add_argument('pathOutputDir', type=str, help='Path to the output directory.') parser.add_argument('pathLSTMCheckpoint', type=str, help='Path to the trained fairseq lstm_lm model.') parser.add_argument('--dict', type=str, help='Path to the dictionary file (dict.txt) used to train the LSTM LM model' '(if not speficied, look for dict.txt in the model directory)') parser.add_argument('--hidden_level', type=int, default=-1, help="Hidden layer of BERT to extract features from (default: -1, last layer).") parser.add_argument('--debug', action='store_true', help="Load only a very small amount of files for " "debugging purposes.") parser.add_argument('--cpu', action='store_true', help="Run on a cpu machine.") return parser.parse_args(argv) def main(argv): # Args parser args = parseArgs(argv) print("=============================================================") print(f"Building BERT features from {args.pathQuantizedUnits}") print("=============================================================") # Load input file print("") print(f"Reading input file from {args.pathQuantizedUnits}") seqNames = [] seqInputs = [] with open(args.pathQuantizedUnits, 'r') as f: for line in f: file_name, file_seq = line.strip().split("\t") # Convert sequence to the desired input form file_seq = file_seq.replace(",", " ") # Add to lists seqNames.append(file_name) seqInputs.append(file_seq) print(f"Found {len(seqNames)} sequences!") # Verify the output directory if os.path.exists(args.pathOutputDir): existing_files = set([os.path.splitext(os.path.basename(x))[0] for x in os.listdir(args.pathOutputDir) if x[-4:]==".npy"]) seqNames = [s for s in seqNames if os.path.splitext(os.path.basename(s[1]))[0] not in existing_files] print(f"Found existing output directory at {args.pathOutputDir}, continue to build features of {len(seqNames)} audio files left!") else: print("") print(f"Creating the output directory at {args.pathOutputDir}") Path(args.pathOutputDir).mkdir(parents=True, exist_ok=True) writeArgs(os.path.join(args.pathOutputDir, "_info_args.json"), args) # Debug mode if args.debug: nsamples=20 print("") print(f"Debug mode activated, only load {nsamples} samples!") # shuffle(seqNames) seqNames = seqNames[:nsamples] seqInputs = seqInputs[:nsamples] # Load LSTM model if args.dict is None: pathData = os.path.dirname(args.pathLSTMCheckpoint) else: pathData = os.path.dirname(args.dict) assert os.path.exists(os.path.join(pathData, "dict.txt")), \ f"Dictionary file (dict.txt) not found in {pathData}" print("") print(f"Loading LSTM model from {args.pathLSTMCheckpoint}...") print(f"Path data {pathData}") model, task = loadLSTMLMCheckpoint( args.pathLSTMCheckpoint, pathData) model.eval() # disable dropout (or leave in train mode to finetune) if not args.cpu: model.cuda() print("Model loaded !") # Define LSTM_feature_function def LSTM_feature_function(input_sequence, n_hidden=-1): # Get the number of layers num_layers = len(model.decoder.layers) assert abs(n_hidden) <= num_layers, \ "absolute value of n_hidden must be less than or equal to the number of hidden layers = {}".format(num_layers) if n_hidden < 0: n_hidden = num_layers + 1 + n_hidden # Get input tensor input_tensor = task.source_dictionary.encode_line( "<s> " + input_sequence, append_eos=True, add_if_not_exist=False).type(torch.LongTensor).unsqueeze(0) if not args.cpu: input_tensor = input_tensor.cuda() # Get the output if n_hidden == 0: # Take the embedding layer with torch.no_grad(): output_tensor = model.decoder.embed_tokens(input_tensor) else: decoder_clone = deepcopy(model.decoder) # We don't take the final fc features decoder_clone.fc_out = torch.nn.Identity() decoder_clone.additional_fc = torch.nn.Identity() # Restrict the number of hiddden layers to n_hidden decoder_clone.layers = decoder_clone.layers[:n_hidden] with torch.no_grad(): output_tensor = decoder_clone(input_tensor)[0] return output_tensor[0].data.cpu().numpy() # Building features print("") print(f"Building LSTM features and saving outputs to {args.pathOutputDir}...") bar = progressbar.ProgressBar(maxval=len(seqNames)) bar.start() start_time = time() for index, (name_seq, input_seq) in enumerate(zip(seqNames, seqInputs)): bar.update(index) # Computing features LSTM_features = LSTM_feature_function(input_seq, n_hidden=args.hidden_level) # Save the outputs file_name = os.path.splitext(name_seq)[0] + ".txt" file_out = os.path.join(args.pathOutputDir, file_name) np.savetxt(file_out, LSTM_features) bar.finish() print(f"...done {len(seqNames)} files in {time()-start_time} seconds.") if __name__ == "__main__": args = sys.argv[1:] main(args)
[ 1, 529, 276, 1112, 420, 29958, 29890, 29882, 335, 29891, 29914, 29920, 29878, 29899, 29906, 29900, 29906, 29896, 29894, 29887, 29918, 6500, 5570, 13, 29937, 16564, 373, 2045, 597, 3292, 29889, 510, 29914, 4777, 17607, 29914, 3298, 359, 412, 5309, 29906, 29900, 29906, 29896, 29918, 6500, 5570, 29914, 10054, 29914, 6207, 29914, 16713, 29914, 4282, 29918, 29931, 1254, 29924, 29918, 22100, 29889, 2272, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 4390, 13, 5215, 1852, 5510, 13, 5215, 6728, 1646, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 931, 1053, 931, 13, 5215, 12655, 408, 7442, 13, 3166, 3509, 1053, 6483, 8552, 13, 13, 5215, 4842, 305, 13, 13, 3166, 12078, 29889, 13239, 29889, 13239, 29918, 12171, 1053, 2436, 7883, 29892, 2254, 29931, 1254, 1988, 29924, 5596, 3149, 13, 13, 1753, 6088, 7883, 29898, 19218, 1125, 13, 1678, 396, 7525, 4128, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 26382, 365, 1254, 29924, 5680, 515, 4323, 1891, 10340, 310, 10348, 2066, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 2084, 22930, 1891, 2525, 1169, 742, 1134, 29922, 710, 29892, 13, 462, 4706, 1371, 2433, 2605, 304, 278, 4323, 1891, 10340, 29889, 7806, 1196, 310, 278, 1881, 934, 1818, 367, 29915, 13, 462, 4706, 525, 974, 278, 883, 934, 29918, 978, 29961, 3891, 29962, 27358, 5333, 29918, 348, 1169, 313, 735, 29889, 3056, 259, 29896, 29892, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29946, 29897, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 2084, 6466, 9170, 742, 1134, 29922, 710, 29892, 13, 462, 4706, 1371, 2433, 2605, 304, 278, 1962, 3884, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 2084, 29931, 1254, 29924, 5596, 3149, 742, 1134, 29922, 710, 29892, 13, 462, 4706, 1371, 2433, 2605, 304, 278, 16370, 6534, 11762, 24471, 29885, 29918, 21457, 1904, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 8977, 742, 1134, 29922, 710, 29892, 13, 462, 539, 1371, 2433, 2605, 304, 278, 8600, 934, 313, 8977, 29889, 3945, 29897, 1304, 304, 7945, 278, 365, 1254, 29924, 365, 29924, 1904, 29915, 13, 462, 539, 525, 29898, 361, 451, 961, 9639, 1000, 29892, 1106, 363, 9657, 29889, 3945, 297, 278, 1904, 3884, 29897, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 10892, 29918, 5563, 742, 1134, 29922, 524, 29892, 2322, 10457, 29896, 29892, 13, 462, 3986, 1371, 543, 25108, 7546, 310, 350, 20161, 304, 6597, 5680, 515, 313, 4381, 29901, 448, 29896, 29892, 1833, 7546, 467, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 8382, 742, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 4706, 1371, 543, 5896, 871, 263, 1407, 2319, 5253, 310, 2066, 363, 376, 13, 462, 4706, 376, 8382, 3460, 11976, 23157, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 21970, 742, 3158, 2433, 8899, 29918, 3009, 742, 13, 462, 4706, 1371, 543, 6558, 373, 263, 26403, 4933, 23157, 13, 1678, 736, 13812, 29889, 5510, 29918, 5085, 29898, 19218, 29897, 13, 13, 1753, 1667, 29898, 19218, 1125, 13, 1678, 396, 826, 3174, 13812, 13, 1678, 6389, 353, 6088, 7883, 29898, 19218, 29897, 13, 13, 1678, 1596, 703, 9166, 9166, 9166, 4936, 2751, 543, 29897, 13, 1678, 1596, 29898, 29888, 29908, 8893, 292, 350, 20161, 5680, 515, 426, 5085, 29889, 2084, 22930, 1891, 2525, 1169, 27195, 13, 1678, 1596, 703, 9166, 9166, 9166, 4936, 2751, 543, 29897, 13, 13, 1678, 396, 16012, 1881, 934, 13, 1678, 1596, 703, 1159, 13, 1678, 1596, 29898, 29888, 29908, 6359, 292, 1881, 934, 515, 426, 5085, 29889, 2084, 22930, 1891, 2525, 1169, 27195, 13, 1678, 19359, 8659, 353, 5159, 13, 1678, 19359, 4290, 29879, 353, 5159, 13, 1678, 411, 1722, 29898, 5085, 29889, 2084, 22930, 1891, 2525, 1169, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 4706, 363, 1196, 297, 285, 29901, 13, 9651, 934, 29918, 978, 29892, 934, 29918, 11762, 353, 1196, 29889, 17010, 2141, 5451, 14182, 29873, 1159, 13, 9651, 396, 14806, 5665, 304, 278, 7429, 1881, 883, 13, 9651, 934, 29918, 11762, 353, 934, 29918, 11762, 29889, 6506, 28165, 613, 376, 16521, 13, 9651, 396, 3462, 304, 8857, 13, 9651, 19359, 8659, 29889, 4397, 29898, 1445, 29918, 978, 29897, 13, 9651, 19359, 4290, 29879, 29889, 4397, 29898, 1445, 29918, 11762, 29897, 13, 1678, 1596, 29898, 29888, 29908, 9692, 426, 2435, 29898, 11762, 8659, 2915, 15602, 29991, 1159, 13, 13, 1678, 396, 1798, 1598, 278, 1962, 3884, 13, 1678, 565, 2897, 29889, 2084, 29889, 9933, 29898, 5085, 29889, 2084, 6466, 9170, 1125, 13, 4706, 5923, 29918, 5325, 353, 731, 4197, 359, 29889, 2084, 29889, 23579, 568, 486, 29898, 359, 29889, 2084, 29889, 6500, 3871, 29898, 29916, 876, 29961, 29900, 29962, 13, 462, 9651, 363, 921, 297, 2897, 29889, 1761, 3972, 29898, 5085, 29889, 2084, 6466, 9170, 29897, 565, 921, 14352, 29946, 29901, 13192, 29569, 29876, 2272, 20068, 13, 4706, 19359, 8659, 353, 518, 29879, 363, 269, 297, 19359, 8659, 565, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 359, 29889, 2084, 29889, 6500, 3871, 29898, 29879, 29961, 29896, 12622, 29961, 29900, 29962, 451, 297, 5923, 29918, 5325, 29962, 13, 4706, 1596, 29898, 29888, 29908, 9692, 5923, 1962, 3884, 472, 426, 5085, 29889, 2084, 6466, 9170, 1118, 6773, 304, 2048, 5680, 310, 426, 2435, 29898, 11762, 8659, 2915, 10348, 2066, 2175, 29991, 1159, 13, 1678, 1683, 29901, 13, 4706, 1596, 703, 1159, 13, 4706, 1596, 29898, 29888, 29908, 9832, 1218, 278, 1962, 3884, 472, 426, 5085, 29889, 2084, 6466, 9170, 27195, 13, 4706, 10802, 29898, 5085, 29889, 2084, 6466, 9170, 467, 11256, 3972, 29898, 862, 1237, 29922, 5574, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 2436, 7883, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 2084, 6466, 9170, 29892, 11119, 3888, 29918, 5085, 29889, 3126, 4968, 6389, 29897, 13, 13, 1678, 396, 16171, 4464, 13, 1678, 565, 6389, 29889, 8382, 29901, 13, 4706, 17534, 9422, 29922, 29906, 29900, 13, 4706, 1596, 703, 1159, 13, 4706, 1596, 29898, 29888, 29908, 11862, 4464, 5039, 630, 29892, 871, 2254, 426, 1983, 9422, 29913, 11916, 29991, 1159, 13, 4706, 396, 528, 21897, 29898, 11762, 8659, 29897, 13, 4706, 19359, 8659, 353, 19359, 8659, 7503, 1983, 9422, 29962, 13, 4706, 19359, 4290, 29879, 353, 19359, 4290, 29879, 7503, 1983, 9422, 29962, 13, 13, 1678, 396, 16012, 365, 1254, 29924, 1904, 13, 1678, 565, 6389, 29889, 8977, 338, 6213, 29901, 13, 4706, 2224, 1469, 353, 2897, 29889, 2084, 29889, 25721, 29898, 5085, 29889, 2084, 29931, 1254, 29924, 5596, 3149, 29897, 13, 1678, 1683, 29901, 13, 4706, 2224, 1469, 353, 2897, 29889, 2084, 29889, 25721, 29898, 5085, 29889, 8977, 29897, 13, 1678, 4974, 2897, 29889, 2084, 29889, 9933, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 1469, 29892, 376, 8977, 29889, 3945, 1159, 511, 320, 13, 4706, 285, 29908, 11513, 934, 313, 8977, 29889, 3945, 29897, 451, 1476, 297, 426, 2084, 1469, 5038, 13, 1678, 1596, 703, 1159, 13, 1678, 1596, 29898, 29888, 29908, 23456, 365, 1254, 29924, 1904, 515, 426, 5085, 29889, 2084, 29931, 1254, 29924, 5596, 3149, 29913, 856, 1159, 13, 1678, 1596, 29898, 29888, 29908, 2605, 848, 426, 2084, 1469, 27195, 13, 1678, 1904, 29892, 3414, 353, 2254, 29931, 1254, 1988, 29924, 5596, 3149, 29898, 13, 462, 1678, 6389, 29889, 2084, 29931, 1254, 29924, 5596, 3149, 29892, 29871, 13, 462, 1678, 2224, 1469, 29897, 13, 1678, 1904, 29889, 14513, 580, 29871, 396, 11262, 5768, 449, 313, 272, 5967, 297, 7945, 4464, 304, 1436, 300, 1540, 29897, 13, 1678, 565, 451, 6389, 29889, 21970, 29901, 13, 4706, 1904, 29889, 29883, 6191, 580, 13, 1678, 1596, 703, 3195, 7500, 1738, 1159, 13, 13, 1678, 396, 22402, 365, 1254, 29924, 29918, 14394, 29918, 2220, 13, 1678, 822, 365, 1254, 29924, 29918, 14394, 29918, 2220, 29898, 2080, 29918, 16506, 29892, 302, 29918, 10892, 10457, 29896, 1125, 13, 4706, 396, 3617, 278, 1353, 310, 15359, 13, 4706, 954, 29918, 29277, 353, 7431, 29898, 4299, 29889, 7099, 6119, 29889, 29277, 29897, 13, 4706, 4974, 6425, 29898, 29876, 29918, 10892, 29897, 5277, 954, 29918, 29277, 29892, 320, 13, 9651, 376, 23552, 995, 310, 302, 29918, 10892, 1818, 367, 3109, 1135, 470, 5186, 304, 278, 1353, 310, 7934, 15359, 353, 6571, 1642, 4830, 29898, 1949, 29918, 29277, 29897, 13, 13, 4706, 565, 302, 29918, 10892, 529, 29871, 29900, 29901, 13, 9651, 302, 29918, 10892, 353, 954, 29918, 29277, 718, 29871, 29896, 718, 302, 29918, 10892, 13, 13, 4706, 396, 3617, 1881, 12489, 13, 4706, 1881, 29918, 20158, 353, 3414, 29889, 4993, 29918, 27126, 29889, 12508, 29918, 1220, 29898, 13, 462, 9651, 376, 1, 29871, 376, 718, 1881, 29918, 16506, 29892, 13, 462, 9651, 9773, 29918, 29872, 359, 29922, 5574, 29892, 13, 462, 9651, 788, 29918, 361, 29918, 1333, 29918, 28997, 29922, 8824, 467, 1853, 29898, 7345, 305, 29889, 8208, 29911, 6073, 467, 6948, 802, 29872, 911, 29898, 29900, 29897, 13, 4706, 565, 451, 6389, 29889, 21970, 29901, 13, 9651, 1881, 29918, 20158, 353, 1881, 29918, 20158, 29889, 29883, 6191, 580, 13, 632, 13, 4706, 396, 3617, 278, 1962, 13, 4706, 565, 302, 29918, 10892, 1275, 29871, 29900, 29901, 396, 11190, 278, 23655, 7546, 13, 9651, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 18884, 1962, 29918, 20158, 353, 1904, 29889, 7099, 6119, 29889, 17987, 29918, 517, 12360, 29898, 2080, 29918, 20158, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 1602, 6119, 29918, 16513, 353, 6483, 8552, 29898, 4299, 29889, 7099, 6119, 29897, 13, 632, 13, 9651, 396, 1334, 1016, 29915, 29873, 2125, 278, 2186, 285, 29883, 5680, 13, 9651, 1602, 6119, 29918, 16513, 29889, 13801, 29918, 449, 353, 4842, 305, 29889, 15755, 29889, 18415, 580, 13, 9651, 1602, 6119, 29918, 16513, 29889, 1202, 3245, 29918, 13801, 353, 4842, 305, 29889, 15755, 29889, 18415, 580, 13, 632, 13, 9651, 396, 11654, 4146, 278, 1353, 310, 298, 2205, 1145, 15359, 304, 302, 29918, 10892, 13, 9651, 1602, 6119, 29918, 16513, 29889, 29277, 353, 1602, 6119, 29918, 16513, 29889, 29277, 7503, 29876, 29918, 10892, 29962, 13, 13, 9651, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 18884, 1962, 29918, 20158, 353, 1602, 6119, 29918, 16513, 29898, 2080, 29918, 20158, 9601, 29900, 29962, 13, 13, 4706, 736, 1962, 29918, 20158, 29961, 29900, 1822, 1272, 29889, 21970, 2141, 23749, 580, 13, 13, 1678, 396, 17166, 5680, 13, 1678, 1596, 703, 1159, 13, 1678, 1596, 29898, 29888, 29908, 8893, 292, 365, 1254, 29924, 5680, 322, 14238, 14391, 304, 426, 5085, 29889, 2084, 6466, 9170, 29913, 856, 1159, 13, 1678, 2594, 353, 6728, 1646, 29889, 14470, 4297, 29898, 3317, 791, 29922, 2435, 29898, 11762, 8659, 876, 13, 1678, 2594, 29889, 2962, 580, 13, 1678, 1369, 29918, 2230, 353, 931, 580, 13, 1678, 363, 2380, 29892, 313, 978, 29918, 11762, 29892, 1881, 29918, 11762, 29897, 297, 26985, 29898, 7554, 29898, 11762, 8659, 29892, 19359, 4290, 29879, 22164, 13, 4706, 2594, 29889, 5504, 29898, 2248, 29897, 13, 13, 4706, 396, 11796, 292, 5680, 13, 4706, 365, 1254, 29924, 29918, 22100, 353, 365, 1254, 29924, 29918, 14394, 29918, 2220, 29898, 2080, 29918, 11762, 29892, 302, 29918, 10892, 29922, 5085, 29889, 10892, 29918, 5563, 29897, 13, 13, 4706, 396, 16913, 278, 14391, 13, 4706, 934, 29918, 978, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 978, 29918, 11762, 9601, 29900, 29962, 718, 11393, 3945, 29908, 13, 4706, 934, 29918, 449, 353, 2897, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 2084, 6466, 9170, 29892, 934, 29918, 978, 29897, 13, 4706, 7442, 29889, 29879, 485, 300, 486, 29898, 1445, 29918, 449, 29892, 365, 1254, 29924, 29918, 22100, 29897, 13, 1678, 2594, 29889, 4951, 728, 580, 13, 1678, 1596, 29898, 29888, 29908, 856, 15091, 426, 2435, 29898, 11762, 8659, 2915, 2066, 297, 426, 2230, 580, 29899, 2962, 29918, 2230, 29913, 6923, 23157, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6389, 353, 10876, 29889, 19218, 29961, 29896, 17531, 13, 1678, 1667, 29898, 5085, 29897, 13, 2 ]
zvmsdk/vmops.py
jasealpers/python-zvm-sdk
9
15658
<gh_stars>1-10 # Copyright 2017 IBM Corp. # # 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 os import six from zvmsdk import config from zvmsdk import dist from zvmsdk import exception from zvmsdk import log from zvmsdk import smtclient from zvmsdk import database from zvmsdk import utils as zvmutils _VMOPS = None CONF = config.CONF LOG = log.LOG def get_vmops(): global _VMOPS if _VMOPS is None: _VMOPS = VMOps() return _VMOPS class VMOps(object): def __init__(self): self._smtclient = smtclient.get_smtclient() self._dist_manager = dist.LinuxDistManager() self._pathutils = zvmutils.PathUtils() self._namelist = zvmutils.get_namelist() self._GuestDbOperator = database.GuestDbOperator() self._ImageDbOperator = database.ImageDbOperator() def get_power_state(self, userid): """Get power status of a z/VM instance.""" return self._smtclient.get_power_state(userid) def _get_cpu_num_from_user_dict(self, dict_info): cpu_num = 0 for inf in dict_info: if 'CPU ' in inf: cpu_num += 1 return cpu_num def _get_max_memory_from_user_dict(self, dict_info): with zvmutils.expect_invalid_resp_data(): mem = dict_info[0].split(' ')[4] return zvmutils.convert_to_mb(mem) * 1024 def get_info(self, userid): power_stat = self.get_power_state(userid) perf_info = self._smtclient.get_image_performance_info(userid) if perf_info: try: max_mem_kb = int(perf_info['max_memory'].split()[0]) mem_kb = int(perf_info['used_memory'].split()[0]) num_cpu = int(perf_info['guest_cpus']) cpu_time_us = int(perf_info['used_cpu_time'].split()[0]) except (ValueError, TypeError, IndexError, AttributeError, KeyError) as err: LOG.error('Parse performance_info encounter error: %s', str(perf_info)) raise exception.SDKInternalError(msg=str(err), modID='guest') return {'power_state': power_stat, 'max_mem_kb': max_mem_kb, 'mem_kb': mem_kb, 'num_cpu': num_cpu, 'cpu_time_us': cpu_time_us} else: # virtual machine in shutdown state or not exists dict_info = self._smtclient.get_user_direct(userid) return { 'power_state': power_stat, 'max_mem_kb': self._get_max_memory_from_user_dict(dict_info), 'mem_kb': 0, 'num_cpu': self._get_cpu_num_from_user_dict(dict_info), 'cpu_time_us': 0} def instance_metadata(self, instance, content, extra_md): pass def add_instance_metadata(self): pass def is_reachable(self, userid): """Reachable through IUCV communication channel.""" return self._smtclient.get_guest_connection_status(userid) def guest_start(self, userid): """"Power on z/VM instance.""" LOG.info("Begin to power on vm %s", userid) self._smtclient.guest_start(userid) LOG.info("Complete power on vm %s", userid) def guest_stop(self, userid, **kwargs): LOG.info("Begin to power off vm %s", userid) self._smtclient.guest_stop(userid, **kwargs) LOG.info("Complete power off vm %s", userid) def guest_softstop(self, userid, **kwargs): LOG.info("Begin to soft power off vm %s", userid) self._smtclient.guest_softstop(userid, **kwargs) LOG.info("Complete soft power off vm %s", userid) def guest_pause(self, userid): LOG.info("Begin to pause vm %s", userid) self._smtclient.guest_pause(userid) LOG.info("Complete pause vm %s", userid) def guest_unpause(self, userid): LOG.info("Begin to unpause vm %s", userid) self._smtclient.guest_unpause(userid) LOG.info("Complete unpause vm %s", userid) def guest_reboot(self, userid): """Reboot a guest vm.""" LOG.info("Begin to reboot vm %s", userid) self._smtclient.guest_reboot(userid) LOG.info("Complete reboot vm %s", userid) def guest_reset(self, userid): """Reset z/VM instance.""" LOG.info("Begin to reset vm %s", userid) self._smtclient.guest_reset(userid) LOG.info("Complete reset vm %s", userid) def live_migrate_vm(self, userid, destination, parms, action): """Move an eligible, running z/VM(R) virtual machine transparently from one z/VM system to another within an SSI cluster.""" # Check guest state is 'on' state = self.get_power_state(userid) if state != 'on': LOG.error("Failed to live migrate guest %s, error: " "guest is inactive, cann't perform live migrate." % userid) raise exception.SDKConflictError(modID='guest', rs=1, userid=userid) # Do live migrate if action.lower() == 'move': LOG.info("Moving the specific vm %s", userid) self._smtclient.live_migrate_move(userid, destination, parms) LOG.info("Complete move vm %s", userid) if action.lower() == 'test': LOG.info("Testing the eligiblity of specific vm %s", userid) self._smtclient.live_migrate_test(userid, destination) def create_vm(self, userid, cpu, memory, disk_list, user_profile, max_cpu, max_mem, ipl_from, ipl_param, ipl_loadparam): """Create z/VM userid into user directory for a z/VM instance.""" LOG.info("Creating the user directory for vm %s", userid) info = self._smtclient.create_vm(userid, cpu, memory, disk_list, user_profile, max_cpu, max_mem, ipl_from, ipl_param, ipl_loadparam) # add userid into smapi namelist self._smtclient.namelist_add(self._namelist, userid) return info def create_disks(self, userid, disk_list): LOG.info("Beging to create disks for vm: %(userid)s, list: %(list)s", {'userid': userid, 'list': disk_list}) user_direct = self._smtclient.get_user_direct(userid) exist_disks = [] for ent in user_direct: if ent.strip().startswith('MDISK'): md_vdev = ent.split()[1].strip() exist_disks.append(md_vdev) if exist_disks: start_vdev = hex(int(max(exist_disks), 16) + 1)[2:].rjust(4, '0') else: start_vdev = None info = self._smtclient.add_mdisks(userid, disk_list, start_vdev) LOG.info("Complete create disks for vm: %s", userid) return info def delete_disks(self, userid, vdev_list): LOG.info("Begin to delete disk on vm: %(userid), vdev list: %(list)s", {'userid': userid, 'list': vdev_list}) # not support delete disks when guest is active if self._smtclient.get_power_state(userid) == 'on': func = 'delete disks when guest is active' raise exception.SDKFunctionNotImplementError(func) self._smtclient.remove_mdisks(userid, vdev_list) LOG.info("Complete delete disks for vm: %s", userid) def guest_config_minidisks(self, userid, disk_info): LOG.info("Begin to configure disks on vm: %(userid), info: %(info)s", {'userid': userid, 'info': disk_info}) if disk_info != []: self._smtclient.process_additional_minidisks(userid, disk_info) LOG.info("Complete configure disks for vm: %s", userid) else: LOG.info("No disk to handle on %s." % userid) def is_powered_off(self, instance_name): """Return True if the instance is powered off.""" return self._smtclient.get_power_state(instance_name) == 'off' def delete_vm(self, userid): """Delete z/VM userid for the instance.""" LOG.info("Begin to delete vm %s", userid) self._smtclient.delete_vm(userid) # remove userid from smapi namelist self._smtclient.namelist_remove(self._namelist, userid) LOG.info("Complete delete vm %s", userid) def execute_cmd(self, userid, cmdStr): """Execute commands on the guest vm.""" LOG.debug("executing cmd: %s", cmdStr) return self._smtclient.execute_cmd(userid, cmdStr) def set_hostname(self, userid, hostname, os_version): """Punch a script that used to set the hostname of the guest. :param str guest: the user id of the guest :param str hostname: the hostname of the guest :param str os_version: version of guest operation system """ tmp_path = self._pathutils.get_guest_temp_path(userid) if not os.path.exists(tmp_path): os.makedirs(tmp_path) tmp_file = tmp_path + '/hostname.sh' lnxdist = self._dist_manager.get_linux_dist(os_version)() lines = lnxdist.generate_set_hostname_script(hostname) with open(tmp_file, 'w') as f: f.writelines(lines) requestData = "ChangeVM " + userid + " punchfile " + \ tmp_file + " --class x" LOG.debug("Punch script to guest %s to set hostname" % userid) try: self._smtclient._request(requestData) except exception.SDKSMTRequestFailed as err: msg = ("Failed to punch set_hostname script to userid '%s'. SMT " "error: %s" % (userid, err.format_message())) LOG.error(msg) raise exception.SDKSMTRequestFailed(err.results, msg) finally: self._pathutils.clean_temp_folder(tmp_path) def guest_deploy(self, userid, image_name, transportfiles=None, remotehost=None, vdev=None, hostname=None): LOG.info("Begin to deploy image on vm %s", userid) self._smtclient.guest_deploy(userid, image_name, transportfiles, remotehost, vdev) # punch scripts to set hostname if (transportfiles is None) and hostname: image_info = self._ImageDbOperator.image_query_record(image_name) os_version = image_info[0]['imageosdistro'] self.set_hostname(userid, hostname, os_version) def guest_capture(self, userid, image_name, capture_type='rootonly', compress_level=6): LOG.info("Begin to capture vm %(userid), image name is %(name)s", {'userid': userid, 'name': image_name}) self._smtclient.guest_capture(userid, image_name, capture_type=capture_type, compress_level=compress_level) LOG.info("Complete capture image on vm %s", userid) def guest_list(self): return self._smtclient.get_vm_list() def get_definition_info(self, userid, **kwargs): check_command = ["nic_coupled"] direct_info = self._smtclient.get_user_direct(userid) info = {} info['user_direct'] = direct_info for k, v in kwargs.items(): if k in check_command: if (k == 'nic_coupled'): info['nic_coupled'] = False nstr = "NICDEF %s TYPE QDIO LAN SYSTEM" % v for inf in direct_info: if nstr in inf: info['nic_coupled'] = True break else: raise exception.SDKInvalidInputFormat( msg=("invalid check option for user direct: %s") % k) return info def get_console_output(self, userid): def append_to_log(log_data, log_path): LOG.debug('log_data: %(log_data)r, log_path: %(log_path)r', {'log_data': log_data, 'log_path': log_path}) with open(log_path, 'a+') as fp: fp.write(log_data) return log_path LOG.info("Begin to capture console log on vm %s", userid) log_size = CONF.guest.console_log_size * 1024 console_log = self._smtclient.get_user_console_output(userid) log_path = self._pathutils.get_console_log_path(userid) # TODO: need consider shrink log file size append_to_log(console_log, log_path) log_fp = open(log_path, 'rb') try: log_data, remaining = zvmutils.last_bytes(log_fp, log_size) except Exception as err: msg = ("Failed to truncate console log, error: %s" % six.text_type(err)) LOG.error(msg) raise exception.SDKInternalError(msg) if remaining > 0: LOG.info('Truncated console log returned, %d bytes ignored' % remaining) LOG.info("Complete get console output on vm %s", userid) return log_data def check_guests_exist_in_db(self, userids, raise_exc=True): if not isinstance(userids, list): # convert userid string to list userids = [userids] all_userids = self.guest_list() userids_not_in_db = list(set(userids) - set(all_userids)) if userids_not_in_db: if raise_exc: # log and raise exception userids_not_in_db = ' '.join(userids_not_in_db) LOG.error("Guest '%s' does not exist in guests database" % userids_not_in_db) raise exception.SDKObjectNotExistError( obj_desc=("Guest '%s'" % userids_not_in_db), modID='guest') else: return False else: userids_migrated = self._GuestDbOperator.get_migrated_guest_list() userids_in_migrated = list(set(userids) & set(userids_migrated)) # case1 userid has been migrated. if userids_in_migrated: if raise_exc: migrated_userids = ' '.join(userids_in_migrated) LOG.error("Guest(s) '%s' has been migrated." % migrated_userids) raise exception.SDKObjectNotExistError( obj_desc=("Guest(s) '%s'" % migrated_userids), modID='guest') else: return False flag = True for uid in userids: # case2 userid has been shudown and started on other host. if zvmutils.check_userid_on_others(uid): flag = False comment = self._GuestDbOperator.get_comments_by_userid(uid) comment['migrated'] = 1 action = "update guest '%s' in database" % uid with zvmutils.log_and_reraise_sdkbase_error(action): self._GuestDbOperator.update_guest_by_userid( uid, comments=comment) return flag def live_resize_cpus(self, userid, count): # Check power state is 'on' state = self.get_power_state(userid) if state != 'on': LOG.error("Failed to live resize cpus of guest %s, error: " "guest is inactive, cann't perform live resize." % userid) raise exception.SDKConflictError(modID='guest', rs=1, userid=userid) # Do live resize self._smtclient.live_resize_cpus(userid, count) LOG.info("Complete live resize cpu on vm %s", userid) def resize_cpus(self, userid, count): LOG.info("Begin to resize cpu on vm %s", userid) # Do resize self._smtclient.resize_cpus(userid, count) LOG.info("Complete resize cpu on vm %s", userid) def live_resize_memory(self, userid, memory): # Check power state is 'on' state = self.get_power_state(userid) if state != 'on': LOG.error("Failed to live resize memory of guest %s, error: " "guest is inactive, cann't perform live resize." % userid) raise exception.SDKConflictError(modID='guest', rs=1, userid=userid) # Do live resize self._smtclient.live_resize_memory(userid, memory) LOG.info("Complete live resize memory on vm %s", userid) def resize_memory(self, userid, memory): LOG.info("Begin to resize memory on vm %s", userid) # Do resize self._smtclient.resize_memory(userid, memory) LOG.info("Complete resize memory on vm %s", userid)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29955, 27955, 2994, 29886, 29889, 13, 29937, 13, 29937, 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, 13, 5215, 2897, 13, 5215, 4832, 13, 13, 3166, 15486, 1516, 8181, 1053, 2295, 13, 3166, 15486, 1516, 8181, 1053, 1320, 13, 3166, 15486, 1516, 8181, 1053, 3682, 13, 3166, 15486, 1516, 8181, 1053, 1480, 13, 3166, 15486, 1516, 8181, 1053, 1560, 29873, 4645, 13, 3166, 15486, 1516, 8181, 1053, 2566, 13, 3166, 15486, 1516, 8181, 1053, 3667, 29879, 408, 15486, 6149, 2719, 13, 13, 13, 29918, 9219, 4590, 29903, 353, 6213, 13, 6007, 29943, 353, 2295, 29889, 6007, 29943, 13, 14480, 353, 1480, 29889, 14480, 13, 13, 13, 1753, 679, 29918, 6925, 3554, 7295, 13, 1678, 5534, 903, 9219, 4590, 29903, 13, 1678, 565, 903, 9219, 4590, 29903, 338, 6213, 29901, 13, 4706, 903, 9219, 4590, 29903, 353, 478, 6720, 567, 580, 13, 1678, 736, 903, 9219, 4590, 29903, 13, 13, 13, 1990, 478, 6720, 567, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 3032, 3844, 29873, 4645, 353, 1560, 29873, 4645, 29889, 657, 29918, 3844, 29873, 4645, 580, 13, 4706, 1583, 3032, 5721, 29918, 12847, 353, 1320, 29889, 24085, 13398, 3260, 580, 13, 4706, 1583, 3032, 2084, 13239, 353, 15486, 6149, 2719, 29889, 2605, 12177, 580, 13, 4706, 1583, 3032, 8588, 295, 391, 353, 15486, 6149, 2719, 29889, 657, 29918, 8588, 295, 391, 580, 13, 4706, 1583, 3032, 9485, 342, 10234, 26486, 353, 2566, 29889, 9485, 342, 10234, 26486, 580, 13, 4706, 1583, 3032, 2940, 10234, 26486, 353, 2566, 29889, 2940, 10234, 26486, 580, 13, 13, 1678, 822, 679, 29918, 13519, 29918, 3859, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 2577, 3081, 4660, 310, 263, 503, 29914, 9219, 2777, 1213, 15945, 13, 4706, 736, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 13, 13, 1678, 822, 903, 657, 29918, 21970, 29918, 1949, 29918, 3166, 29918, 1792, 29918, 8977, 29898, 1311, 29892, 9657, 29918, 3888, 1125, 13, 4706, 26403, 29918, 1949, 353, 29871, 29900, 13, 4706, 363, 3041, 297, 9657, 29918, 3888, 29901, 13, 9651, 565, 525, 6271, 29965, 525, 297, 3041, 29901, 13, 18884, 26403, 29918, 1949, 4619, 29871, 29896, 13, 4706, 736, 26403, 29918, 1949, 13, 13, 1678, 822, 903, 657, 29918, 3317, 29918, 14834, 29918, 3166, 29918, 1792, 29918, 8977, 29898, 1311, 29892, 9657, 29918, 3888, 1125, 13, 4706, 411, 15486, 6149, 2719, 29889, 17854, 29918, 20965, 29918, 13713, 29918, 1272, 7295, 13, 9651, 2626, 353, 9657, 29918, 3888, 29961, 29900, 1822, 5451, 877, 525, 9601, 29946, 29962, 13, 9651, 736, 15486, 6149, 2719, 29889, 13441, 29918, 517, 29918, 8337, 29898, 6954, 29897, 334, 29871, 29896, 29900, 29906, 29946, 13, 13, 1678, 822, 679, 29918, 3888, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 3081, 29918, 6112, 353, 1583, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 13, 4706, 23895, 29918, 3888, 353, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 3027, 29918, 546, 13390, 29918, 3888, 29898, 1792, 333, 29897, 13, 13, 4706, 565, 23895, 29918, 3888, 29901, 13, 9651, 1018, 29901, 13, 18884, 4236, 29918, 6954, 29918, 21066, 353, 938, 29898, 546, 29888, 29918, 3888, 1839, 3317, 29918, 14834, 13359, 5451, 580, 29961, 29900, 2314, 13, 18884, 2626, 29918, 21066, 353, 938, 29898, 546, 29888, 29918, 3888, 1839, 3880, 29918, 14834, 13359, 5451, 580, 29961, 29900, 2314, 13, 18884, 954, 29918, 21970, 353, 938, 29898, 546, 29888, 29918, 3888, 1839, 2543, 342, 29918, 6814, 375, 11287, 13, 18884, 26403, 29918, 2230, 29918, 375, 353, 938, 29898, 546, 29888, 29918, 3888, 1839, 3880, 29918, 21970, 29918, 2230, 13359, 5451, 580, 29961, 29900, 2314, 13, 9651, 5174, 313, 1917, 2392, 29892, 20948, 29892, 11374, 2392, 29892, 23833, 2392, 29892, 13, 462, 1678, 7670, 2392, 29897, 408, 4589, 29901, 13, 18884, 25401, 29889, 2704, 877, 12914, 4180, 29918, 3888, 11735, 1059, 29901, 1273, 29879, 742, 13, 462, 3986, 851, 29898, 546, 29888, 29918, 3888, 876, 13, 18884, 12020, 3682, 29889, 26912, 16491, 2392, 29898, 7645, 29922, 710, 29898, 3127, 511, 13, 462, 462, 462, 1678, 878, 1367, 2433, 2543, 342, 1495, 13, 13, 9651, 736, 11117, 13519, 29918, 3859, 2396, 3081, 29918, 6112, 29892, 13, 462, 1678, 525, 3317, 29918, 6954, 29918, 21066, 2396, 4236, 29918, 6954, 29918, 21066, 29892, 13, 462, 1678, 525, 6954, 29918, 21066, 2396, 2626, 29918, 21066, 29892, 13, 462, 1678, 525, 1949, 29918, 21970, 2396, 954, 29918, 21970, 29892, 13, 462, 1678, 525, 21970, 29918, 2230, 29918, 375, 2396, 26403, 29918, 2230, 29918, 375, 29913, 13, 4706, 1683, 29901, 13, 9651, 396, 6901, 4933, 297, 12522, 3204, 2106, 470, 451, 4864, 13, 9651, 9657, 29918, 3888, 353, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 1792, 29918, 11851, 29898, 1792, 333, 29897, 13, 9651, 736, 426, 13, 18884, 525, 13519, 29918, 3859, 2396, 3081, 29918, 6112, 29892, 13, 18884, 525, 3317, 29918, 6954, 29918, 21066, 2396, 1583, 3032, 657, 29918, 3317, 29918, 14834, 29918, 3166, 29918, 1792, 29918, 8977, 29898, 8977, 29918, 3888, 511, 13, 18884, 525, 6954, 29918, 21066, 2396, 29871, 29900, 29892, 13, 18884, 525, 1949, 29918, 21970, 2396, 1583, 3032, 657, 29918, 21970, 29918, 1949, 29918, 3166, 29918, 1792, 29918, 8977, 29898, 8977, 29918, 3888, 511, 13, 18884, 525, 21970, 29918, 2230, 29918, 375, 2396, 29871, 29900, 29913, 13, 13, 1678, 822, 2777, 29918, 19635, 29898, 1311, 29892, 2777, 29892, 2793, 29892, 4805, 29918, 3487, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 788, 29918, 8758, 29918, 19635, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 338, 29918, 276, 496, 519, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 1123, 496, 519, 1549, 28668, 15633, 12084, 8242, 1213, 15945, 13, 4706, 736, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 2543, 342, 29918, 9965, 29918, 4882, 29898, 1792, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 2962, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 29908, 21472, 373, 503, 29914, 9219, 2777, 1213, 15945, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 3081, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 2962, 29898, 1792, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 3081, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 9847, 29898, 1311, 29892, 1404, 333, 29892, 3579, 19290, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 3081, 1283, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 9847, 29898, 1792, 333, 29892, 3579, 19290, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 3081, 1283, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 2695, 9847, 29898, 1311, 29892, 1404, 333, 29892, 3579, 19290, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 4964, 3081, 1283, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 2695, 9847, 29898, 1792, 333, 29892, 3579, 19290, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 4964, 3081, 1283, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 29886, 1071, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 19957, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 29886, 1071, 29898, 1792, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 19957, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 348, 29886, 1071, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 443, 29886, 1071, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 348, 29886, 1071, 29898, 1792, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 443, 29886, 1071, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 276, 4777, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 29934, 774, 3155, 263, 17838, 22419, 1213, 15945, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 22538, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 276, 4777, 29898, 1792, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 22538, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 12071, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 27175, 503, 29914, 9219, 2777, 1213, 15945, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 10092, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 12071, 29898, 1792, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 10092, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 5735, 29918, 26983, 403, 29918, 6925, 29898, 1311, 29892, 1404, 333, 29892, 12551, 29892, 610, 1516, 29892, 3158, 1125, 13, 4706, 9995, 16619, 385, 560, 335, 1821, 29892, 2734, 503, 29914, 9219, 29898, 29934, 29897, 6901, 4933, 1301, 862, 2705, 13, 4706, 515, 697, 503, 29914, 9219, 1788, 304, 1790, 2629, 385, 317, 5425, 9867, 1213, 15945, 13, 4706, 396, 5399, 17838, 2106, 338, 525, 265, 29915, 13, 4706, 2106, 353, 1583, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 13, 4706, 565, 2106, 2804, 525, 265, 2396, 13, 9651, 25401, 29889, 2704, 703, 17776, 304, 5735, 9725, 403, 17838, 1273, 29879, 29892, 1059, 29901, 376, 13, 462, 1678, 376, 2543, 342, 338, 297, 4925, 29892, 508, 29876, 29915, 29873, 2189, 5735, 9725, 403, 1213, 1273, 13, 462, 1678, 1404, 333, 29897, 13, 9651, 12020, 3682, 29889, 26912, 16376, 29176, 2392, 29898, 1545, 1367, 2433, 2543, 342, 742, 20371, 29922, 29896, 29892, 13, 462, 462, 632, 1404, 333, 29922, 1792, 333, 29897, 13, 4706, 396, 1938, 5735, 9725, 403, 13, 4706, 565, 3158, 29889, 13609, 580, 1275, 525, 11631, 2396, 13, 9651, 25401, 29889, 3888, 703, 29924, 21081, 278, 2702, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 9651, 1583, 3032, 3844, 29873, 4645, 29889, 9258, 29918, 26983, 403, 29918, 11631, 29898, 1792, 333, 29892, 12551, 29892, 610, 1516, 29897, 13, 9651, 25401, 29889, 3888, 703, 17813, 4337, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 4706, 565, 3158, 29889, 13609, 580, 1275, 525, 1688, 2396, 13, 9651, 25401, 29889, 3888, 703, 3057, 292, 278, 560, 335, 747, 29880, 537, 310, 2702, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 9651, 1583, 3032, 3844, 29873, 4645, 29889, 9258, 29918, 26983, 403, 29918, 1688, 29898, 1792, 333, 29892, 12551, 29897, 13, 13, 1678, 822, 1653, 29918, 6925, 29898, 1311, 29892, 1404, 333, 29892, 26403, 29892, 3370, 29892, 8086, 29918, 1761, 29892, 13, 462, 29871, 1404, 29918, 10185, 29892, 4236, 29918, 21970, 29892, 4236, 29918, 6954, 29892, 474, 572, 29918, 3166, 29892, 13, 462, 29871, 474, 572, 29918, 3207, 29892, 474, 572, 29918, 1359, 3207, 1125, 13, 4706, 9995, 4391, 503, 29914, 9219, 1404, 333, 964, 1404, 3884, 363, 263, 503, 29914, 9219, 2777, 1213, 15945, 13, 4706, 25401, 29889, 3888, 703, 9832, 1218, 278, 1404, 3884, 363, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 4706, 5235, 353, 1583, 3032, 3844, 29873, 4645, 29889, 3258, 29918, 6925, 29898, 1792, 333, 29892, 26403, 29892, 3370, 29892, 13, 462, 462, 259, 8086, 29918, 1761, 29892, 1404, 29918, 10185, 29892, 13, 462, 462, 259, 4236, 29918, 21970, 29892, 4236, 29918, 6954, 29892, 474, 572, 29918, 3166, 29892, 13, 462, 462, 259, 474, 572, 29918, 3207, 29892, 474, 572, 29918, 1359, 3207, 29897, 13, 13, 4706, 396, 788, 1404, 333, 964, 1560, 2754, 6869, 295, 391, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 8588, 295, 391, 29918, 1202, 29898, 1311, 3032, 8588, 295, 391, 29892, 1404, 333, 29897, 13, 4706, 736, 5235, 13, 13, 1678, 822, 1653, 29918, 2218, 2039, 29898, 1311, 29892, 1404, 333, 29892, 8086, 29918, 1761, 1125, 13, 4706, 25401, 29889, 3888, 703, 29933, 387, 292, 304, 1653, 766, 2039, 363, 22419, 29901, 1273, 29898, 1792, 333, 29897, 29879, 29892, 1051, 29901, 1273, 29898, 1761, 29897, 29879, 613, 13, 462, 11117, 1792, 333, 2396, 1404, 333, 29892, 525, 1761, 2396, 8086, 29918, 1761, 1800, 13, 4706, 1404, 29918, 11851, 353, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 1792, 29918, 11851, 29898, 1792, 333, 29897, 13, 13, 4706, 1863, 29918, 2218, 2039, 353, 5159, 13, 4706, 363, 875, 297, 1404, 29918, 11851, 29901, 13, 9651, 565, 875, 29889, 17010, 2141, 27382, 2541, 877, 5773, 3235, 29968, 29374, 13, 18884, 22821, 29918, 29894, 3359, 353, 875, 29889, 5451, 580, 29961, 29896, 1822, 17010, 580, 13, 18884, 1863, 29918, 2218, 2039, 29889, 4397, 29898, 3487, 29918, 29894, 3359, 29897, 13, 13, 4706, 565, 1863, 29918, 2218, 2039, 29901, 13, 9651, 1369, 29918, 29894, 3359, 353, 15090, 29898, 524, 29898, 3317, 29898, 28997, 29918, 2218, 2039, 511, 29871, 29896, 29953, 29897, 718, 29871, 29896, 9601, 29906, 29901, 1822, 29878, 5143, 29898, 29946, 29892, 525, 29900, 1495, 13, 4706, 1683, 29901, 13, 9651, 1369, 29918, 29894, 3359, 353, 6213, 13, 4706, 5235, 353, 1583, 3032, 3844, 29873, 4645, 29889, 1202, 29918, 29885, 2218, 2039, 29898, 1792, 333, 29892, 8086, 29918, 1761, 29892, 1369, 29918, 29894, 3359, 29897, 13, 13, 4706, 25401, 29889, 3888, 703, 17813, 1653, 766, 2039, 363, 22419, 29901, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 736, 5235, 13, 13, 1678, 822, 5217, 29918, 2218, 2039, 29898, 1311, 29892, 1404, 333, 29892, 325, 3359, 29918, 1761, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 5217, 8086, 373, 22419, 29901, 1273, 29898, 1792, 333, 511, 325, 3359, 1051, 29901, 1273, 29898, 1761, 29897, 29879, 613, 13, 462, 11117, 1792, 333, 2396, 1404, 333, 29892, 525, 1761, 2396, 325, 3359, 29918, 1761, 1800, 13, 13, 4706, 396, 451, 2304, 5217, 766, 2039, 746, 17838, 338, 6136, 13, 4706, 565, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 1275, 525, 265, 2396, 13, 9651, 3653, 353, 525, 8143, 766, 2039, 746, 17838, 338, 6136, 29915, 13, 9651, 12020, 3682, 29889, 26912, 6678, 3664, 1888, 2037, 2392, 29898, 9891, 29897, 13, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 5992, 29918, 29885, 2218, 2039, 29898, 1792, 333, 29892, 325, 3359, 29918, 1761, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 5217, 766, 2039, 363, 22419, 29901, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 2917, 29918, 1195, 333, 275, 2039, 29898, 1311, 29892, 1404, 333, 29892, 8086, 29918, 3888, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 10822, 766, 2039, 373, 22419, 29901, 1273, 29898, 1792, 333, 511, 5235, 29901, 1273, 29898, 3888, 29897, 29879, 613, 13, 462, 11117, 1792, 333, 2396, 1404, 333, 29892, 525, 3888, 2396, 8086, 29918, 3888, 1800, 13, 4706, 565, 8086, 29918, 3888, 2804, 5159, 29901, 13, 9651, 1583, 3032, 3844, 29873, 4645, 29889, 5014, 29918, 1202, 3245, 29918, 1195, 333, 275, 2039, 29898, 1792, 333, 29892, 8086, 29918, 3888, 29897, 13, 9651, 25401, 29889, 3888, 703, 17813, 10822, 766, 2039, 363, 22419, 29901, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1683, 29901, 13, 9651, 25401, 29889, 3888, 703, 3782, 8086, 304, 4386, 373, 1273, 29879, 1213, 1273, 1404, 333, 29897, 13, 13, 1678, 822, 338, 29918, 13519, 287, 29918, 2696, 29898, 1311, 29892, 2777, 29918, 978, 1125, 13, 4706, 9995, 11609, 5852, 565, 278, 2777, 338, 3081, 287, 1283, 1213, 15945, 13, 4706, 736, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 13519, 29918, 3859, 29898, 8758, 29918, 978, 29897, 1275, 525, 2696, 29915, 13, 13, 1678, 822, 5217, 29918, 6925, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 9995, 12498, 503, 29914, 9219, 1404, 333, 363, 278, 2777, 1213, 15945, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 5217, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 8143, 29918, 6925, 29898, 1792, 333, 29897, 13, 13, 4706, 396, 3349, 1404, 333, 515, 1560, 2754, 6869, 295, 391, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 8588, 295, 391, 29918, 5992, 29898, 1311, 3032, 8588, 295, 391, 29892, 1404, 333, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 5217, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 6222, 29918, 9006, 29898, 1311, 29892, 1404, 333, 29892, 9920, 5015, 1125, 13, 4706, 9995, 12296, 8260, 373, 278, 17838, 22419, 1213, 15945, 13, 4706, 25401, 29889, 8382, 703, 4258, 17068, 9920, 29901, 1273, 29879, 613, 9920, 5015, 29897, 13, 4706, 736, 1583, 3032, 3844, 29873, 4645, 29889, 7978, 29918, 9006, 29898, 1792, 333, 29892, 9920, 5015, 29897, 13, 13, 1678, 822, 731, 29918, 28988, 29898, 1311, 29892, 1404, 333, 29892, 3495, 978, 29892, 2897, 29918, 3259, 1125, 13, 4706, 9995, 29925, 3322, 263, 2471, 393, 1304, 304, 731, 278, 3495, 978, 310, 278, 17838, 29889, 13, 13, 4706, 584, 3207, 851, 17838, 29901, 278, 1404, 1178, 310, 278, 17838, 13, 4706, 584, 3207, 851, 3495, 978, 29901, 278, 3495, 978, 310, 278, 17838, 13, 4706, 584, 3207, 851, 2897, 29918, 3259, 29901, 1873, 310, 17838, 5858, 1788, 13, 4706, 9995, 13, 4706, 13128, 29918, 2084, 353, 1583, 3032, 2084, 13239, 29889, 657, 29918, 2543, 342, 29918, 7382, 29918, 2084, 29898, 1792, 333, 29897, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 7050, 29918, 2084, 1125, 13, 9651, 2897, 29889, 29885, 12535, 12935, 29898, 7050, 29918, 2084, 29897, 13, 4706, 13128, 29918, 1445, 353, 13128, 29918, 2084, 718, 8207, 28988, 29889, 845, 29915, 13, 13, 4706, 301, 23818, 5721, 353, 1583, 3032, 5721, 29918, 12847, 29889, 657, 29918, 9389, 29918, 5721, 29898, 359, 29918, 3259, 29897, 580, 13, 4706, 3454, 353, 301, 23818, 5721, 29889, 17158, 29918, 842, 29918, 28988, 29918, 2154, 29898, 28988, 29897, 13, 4706, 411, 1722, 29898, 7050, 29918, 1445, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 285, 29889, 8231, 24210, 29898, 9012, 29897, 13, 13, 4706, 2009, 1469, 353, 376, 7277, 9219, 376, 718, 1404, 333, 718, 376, 282, 3322, 1445, 376, 718, 320, 13, 462, 9651, 13128, 29918, 1445, 718, 376, 1192, 1990, 921, 29908, 13, 4706, 25401, 29889, 8382, 703, 29925, 3322, 2471, 304, 17838, 1273, 29879, 304, 731, 3495, 978, 29908, 1273, 1404, 333, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 3844, 29873, 4645, 3032, 3827, 29898, 3827, 1469, 29897, 13, 4706, 5174, 3682, 29889, 7230, 17557, 11490, 3089, 17776, 408, 4589, 29901, 13, 9651, 10191, 353, 4852, 17776, 304, 282, 3322, 731, 29918, 28988, 2471, 304, 1404, 333, 14210, 29879, 4286, 317, 11490, 376, 13, 462, 259, 376, 2704, 29901, 1273, 29879, 29908, 1273, 313, 1792, 333, 29892, 4589, 29889, 4830, 29918, 4906, 22130, 13, 9651, 25401, 29889, 2704, 29898, 7645, 29897, 13, 9651, 12020, 3682, 29889, 7230, 17557, 11490, 3089, 17776, 29898, 3127, 29889, 9902, 29892, 10191, 29897, 13, 4706, 7146, 29901, 13, 9651, 1583, 3032, 2084, 13239, 29889, 14941, 29918, 7382, 29918, 12083, 29898, 7050, 29918, 2084, 29897, 13, 13, 1678, 822, 17838, 29918, 16519, 29898, 1311, 29892, 1404, 333, 29892, 1967, 29918, 978, 29892, 8608, 5325, 29922, 8516, 29892, 13, 462, 268, 7592, 3069, 29922, 8516, 29892, 325, 3359, 29922, 8516, 29892, 3495, 978, 29922, 8516, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 7246, 1967, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 16519, 29898, 1792, 333, 29892, 1967, 29918, 978, 29892, 8608, 5325, 29892, 13, 462, 462, 418, 7592, 3069, 29892, 325, 3359, 29897, 13, 13, 4706, 396, 282, 3322, 12078, 304, 731, 3495, 978, 13, 4706, 565, 313, 27882, 5325, 338, 6213, 29897, 322, 3495, 978, 29901, 13, 9651, 1967, 29918, 3888, 353, 1583, 3032, 2940, 10234, 26486, 29889, 3027, 29918, 1972, 29918, 11651, 29898, 3027, 29918, 978, 29897, 13, 9651, 2897, 29918, 3259, 353, 1967, 29918, 3888, 29961, 29900, 22322, 3027, 359, 5721, 307, 2033, 13, 9651, 1583, 29889, 842, 29918, 28988, 29898, 1792, 333, 29892, 3495, 978, 29892, 2897, 29918, 3259, 29897, 13, 13, 1678, 822, 17838, 29918, 17885, 545, 29898, 1311, 29892, 1404, 333, 29892, 1967, 29918, 978, 29892, 10446, 29918, 1853, 2433, 4632, 6194, 742, 13, 462, 418, 27122, 29918, 5563, 29922, 29953, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 10446, 22419, 1273, 29898, 1792, 333, 511, 1967, 1024, 338, 1273, 29898, 978, 29897, 29879, 613, 13, 462, 11117, 1792, 333, 2396, 1404, 333, 29892, 525, 978, 2396, 1967, 29918, 978, 1800, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 2543, 342, 29918, 17885, 545, 29898, 1792, 333, 29892, 1967, 29918, 978, 29892, 13, 462, 462, 539, 10446, 29918, 1853, 29922, 17885, 545, 29918, 1853, 29892, 13, 462, 462, 539, 27122, 29918, 5563, 29922, 510, 2139, 29918, 5563, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 10446, 1967, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 17838, 29918, 1761, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 6925, 29918, 1761, 580, 13, 13, 1678, 822, 679, 29918, 16553, 29918, 3888, 29898, 1311, 29892, 1404, 333, 29892, 3579, 19290, 1125, 13, 4706, 1423, 29918, 6519, 353, 6796, 7823, 29918, 16589, 552, 29881, 3108, 13, 4706, 1513, 29918, 3888, 353, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 1792, 29918, 11851, 29898, 1792, 333, 29897, 13, 4706, 5235, 353, 6571, 13, 4706, 5235, 1839, 1792, 29918, 11851, 2033, 353, 1513, 29918, 3888, 13, 13, 4706, 363, 413, 29892, 325, 297, 9049, 5085, 29889, 7076, 7295, 13, 9651, 565, 413, 297, 1423, 29918, 6519, 29901, 13, 18884, 565, 313, 29895, 1275, 525, 7823, 29918, 16589, 552, 29881, 29374, 13, 462, 1678, 5235, 1839, 7823, 29918, 16589, 552, 29881, 2033, 353, 7700, 13, 462, 1678, 302, 710, 353, 376, 29940, 2965, 24405, 1273, 29879, 323, 6959, 660, 4571, 29949, 365, 2190, 28962, 1254, 12665, 29908, 1273, 325, 13, 462, 1678, 363, 3041, 297, 1513, 29918, 3888, 29901, 13, 462, 4706, 565, 302, 710, 297, 3041, 29901, 13, 462, 9651, 5235, 1839, 7823, 29918, 16589, 552, 29881, 2033, 353, 5852, 13, 462, 9651, 2867, 13, 9651, 1683, 29901, 13, 18884, 12020, 3682, 29889, 26912, 13919, 4290, 5809, 29898, 13, 462, 1678, 10191, 29922, 703, 20965, 1423, 2984, 363, 1404, 1513, 29901, 1273, 29879, 1159, 1273, 413, 29897, 13, 13, 4706, 736, 5235, 13, 13, 1678, 822, 679, 29918, 11058, 29918, 4905, 29898, 1311, 29892, 1404, 333, 1125, 13, 4706, 822, 9773, 29918, 517, 29918, 1188, 29898, 1188, 29918, 1272, 29892, 1480, 29918, 2084, 1125, 13, 9651, 25401, 29889, 8382, 877, 1188, 29918, 1272, 29901, 1273, 29898, 1188, 29918, 1272, 29897, 29878, 29892, 1480, 29918, 2084, 29901, 1273, 29898, 1188, 29918, 2084, 29897, 29878, 742, 13, 462, 308, 11117, 1188, 29918, 1272, 2396, 1480, 29918, 1272, 29892, 525, 1188, 29918, 2084, 2396, 1480, 29918, 2084, 1800, 13, 9651, 411, 1722, 29898, 1188, 29918, 2084, 29892, 525, 29874, 29974, 1495, 408, 285, 29886, 29901, 13, 18884, 285, 29886, 29889, 3539, 29898, 1188, 29918, 1272, 29897, 13, 13, 9651, 736, 1480, 29918, 2084, 13, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 10446, 2991, 1480, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 1480, 29918, 2311, 353, 8707, 29943, 29889, 2543, 342, 29889, 11058, 29918, 1188, 29918, 2311, 334, 29871, 29896, 29900, 29906, 29946, 13, 4706, 2991, 29918, 1188, 353, 1583, 3032, 3844, 29873, 4645, 29889, 657, 29918, 1792, 29918, 11058, 29918, 4905, 29898, 1792, 333, 29897, 13, 13, 4706, 1480, 29918, 2084, 353, 1583, 3032, 2084, 13239, 29889, 657, 29918, 11058, 29918, 1188, 29918, 2084, 29898, 1792, 333, 29897, 13, 4706, 396, 14402, 29901, 817, 2050, 14653, 682, 1480, 934, 2159, 13, 4706, 9773, 29918, 517, 29918, 1188, 29898, 11058, 29918, 1188, 29892, 1480, 29918, 2084, 29897, 13, 13, 4706, 1480, 29918, 18091, 353, 1722, 29898, 1188, 29918, 2084, 29892, 525, 6050, 1495, 13, 4706, 1018, 29901, 13, 9651, 1480, 29918, 1272, 29892, 9886, 353, 15486, 6149, 2719, 29889, 4230, 29918, 13193, 29898, 1188, 29918, 18091, 29892, 1480, 29918, 2311, 29897, 13, 4706, 5174, 8960, 408, 4589, 29901, 13, 9651, 10191, 353, 4852, 17776, 304, 21022, 403, 2991, 1480, 29892, 1059, 29901, 1273, 29879, 29908, 1273, 13, 462, 259, 4832, 29889, 726, 29918, 1853, 29898, 3127, 876, 13, 9651, 25401, 29889, 2704, 29898, 7645, 29897, 13, 9651, 12020, 3682, 29889, 26912, 16491, 2392, 29898, 7645, 29897, 13, 13, 4706, 565, 9886, 1405, 29871, 29900, 29901, 13, 9651, 25401, 29889, 3888, 877, 2308, 4661, 630, 2991, 1480, 4133, 29892, 1273, 29881, 6262, 17262, 29915, 1273, 13, 462, 268, 9886, 29897, 13, 13, 4706, 25401, 29889, 3888, 703, 17813, 679, 2991, 1962, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 736, 1480, 29918, 1272, 13, 13, 1678, 822, 1423, 29918, 2543, 9197, 29918, 28997, 29918, 262, 29918, 2585, 29898, 1311, 29892, 1404, 4841, 29892, 12020, 29918, 735, 29883, 29922, 5574, 1125, 13, 4706, 565, 451, 338, 8758, 29898, 1792, 4841, 29892, 1051, 1125, 13, 9651, 396, 3588, 1404, 333, 1347, 304, 1051, 13, 9651, 1404, 4841, 353, 518, 1792, 4841, 29962, 13, 13, 4706, 599, 29918, 1792, 4841, 353, 1583, 29889, 2543, 342, 29918, 1761, 580, 13, 13, 4706, 1404, 4841, 29918, 1333, 29918, 262, 29918, 2585, 353, 1051, 29898, 842, 29898, 1792, 4841, 29897, 448, 731, 29898, 497, 29918, 1792, 4841, 876, 13, 4706, 565, 1404, 4841, 29918, 1333, 29918, 262, 29918, 2585, 29901, 13, 9651, 565, 12020, 29918, 735, 29883, 29901, 13, 18884, 396, 1480, 322, 12020, 3682, 13, 18884, 1404, 4841, 29918, 1333, 29918, 262, 29918, 2585, 353, 525, 15300, 7122, 29898, 1792, 4841, 29918, 1333, 29918, 262, 29918, 2585, 29897, 13, 18884, 25401, 29889, 2704, 703, 9485, 342, 14210, 29879, 29915, 947, 451, 1863, 297, 28865, 2566, 29908, 1273, 13, 462, 3986, 1404, 4841, 29918, 1333, 29918, 262, 29918, 2585, 29897, 13, 18884, 12020, 3682, 29889, 26912, 2061, 3664, 1252, 391, 2392, 29898, 13, 462, 1678, 5446, 29918, 14273, 29922, 703, 9485, 342, 14210, 29879, 11838, 1273, 1404, 4841, 29918, 1333, 29918, 262, 29918, 2585, 511, 878, 1367, 2433, 2543, 342, 1495, 13, 9651, 1683, 29901, 13, 18884, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 1404, 4841, 29918, 26983, 630, 353, 1583, 3032, 9485, 342, 10234, 26486, 29889, 657, 29918, 26983, 630, 29918, 2543, 342, 29918, 1761, 580, 13, 9651, 1404, 4841, 29918, 262, 29918, 26983, 630, 353, 1051, 29898, 842, 29898, 1792, 4841, 29897, 669, 731, 29898, 1792, 4841, 29918, 26983, 630, 876, 13, 13, 9651, 396, 1206, 29896, 1404, 333, 756, 1063, 9725, 630, 29889, 13, 9651, 565, 1404, 4841, 29918, 262, 29918, 26983, 630, 29901, 13, 18884, 565, 12020, 29918, 735, 29883, 29901, 13, 462, 1678, 9725, 630, 29918, 1792, 4841, 353, 525, 15300, 7122, 29898, 1792, 4841, 29918, 262, 29918, 26983, 630, 29897, 13, 462, 1678, 25401, 29889, 2704, 703, 9485, 342, 29898, 29879, 29897, 14210, 29879, 29915, 756, 1063, 9725, 630, 1213, 1273, 13, 462, 795, 9725, 630, 29918, 1792, 4841, 29897, 13, 462, 1678, 12020, 3682, 29889, 26912, 2061, 3664, 1252, 391, 2392, 29898, 13, 462, 18884, 5446, 29918, 14273, 29922, 703, 9485, 342, 29898, 29879, 29897, 14210, 29879, 11838, 1273, 9725, 630, 29918, 1792, 4841, 511, 13, 462, 18884, 878, 1367, 2433, 2543, 342, 1495, 13, 18884, 1683, 29901, 13, 462, 1678, 736, 7700, 13, 13, 9651, 7353, 353, 5852, 13, 9651, 363, 318, 333, 297, 1404, 4841, 29901, 13, 18884, 396, 1206, 29906, 1404, 333, 756, 1063, 528, 566, 776, 322, 4687, 373, 916, 3495, 29889, 13, 18884, 565, 15486, 6149, 2719, 29889, 3198, 29918, 1792, 333, 29918, 265, 29918, 720, 414, 29898, 5416, 1125, 13, 462, 1678, 7353, 353, 7700, 13, 462, 1678, 3440, 353, 1583, 3032, 9485, 342, 10234, 26486, 29889, 657, 29918, 21032, 29918, 1609, 29918, 1792, 333, 29898, 5416, 29897, 13, 462, 1678, 3440, 1839, 26983, 630, 2033, 353, 29871, 29896, 13, 462, 1678, 3158, 353, 376, 5504, 17838, 14210, 29879, 29915, 297, 2566, 29908, 1273, 318, 333, 13, 462, 1678, 411, 15486, 6149, 2719, 29889, 1188, 29918, 392, 29918, 13941, 895, 29918, 15348, 3188, 29918, 2704, 29898, 2467, 1125, 13, 462, 4706, 1583, 3032, 9485, 342, 10234, 26486, 29889, 5504, 29918, 2543, 342, 29918, 1609, 29918, 1792, 333, 29898, 13, 462, 462, 4706, 318, 333, 29892, 6589, 29922, 9342, 29897, 13, 9651, 736, 7353, 13, 13, 1678, 822, 5735, 29918, 21476, 29918, 6814, 375, 29898, 1311, 29892, 1404, 333, 29892, 2302, 1125, 13, 4706, 396, 5399, 3081, 2106, 338, 525, 265, 29915, 13, 4706, 2106, 353, 1583, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 13, 4706, 565, 2106, 2804, 525, 265, 2396, 13, 9651, 25401, 29889, 2704, 703, 17776, 304, 5735, 19490, 274, 13364, 310, 17838, 1273, 29879, 29892, 1059, 29901, 376, 13, 462, 418, 376, 2543, 342, 338, 297, 4925, 29892, 508, 29876, 29915, 29873, 2189, 5735, 19490, 1213, 1273, 13, 462, 418, 1404, 333, 29897, 13, 9651, 12020, 3682, 29889, 26912, 16376, 29176, 2392, 29898, 1545, 1367, 2433, 2543, 342, 742, 20371, 29922, 29896, 29892, 13, 462, 462, 632, 1404, 333, 29922, 1792, 333, 29897, 13, 4706, 396, 1938, 5735, 19490, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 9258, 29918, 21476, 29918, 6814, 375, 29898, 1792, 333, 29892, 2302, 29897, 13, 13, 4706, 25401, 29889, 3888, 703, 17813, 5735, 19490, 26403, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 19490, 29918, 6814, 375, 29898, 1311, 29892, 1404, 333, 29892, 2302, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 19490, 26403, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 396, 1938, 19490, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 21476, 29918, 6814, 375, 29898, 1792, 333, 29892, 2302, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 19490, 26403, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 5735, 29918, 21476, 29918, 14834, 29898, 1311, 29892, 1404, 333, 29892, 3370, 1125, 13, 4706, 396, 5399, 3081, 2106, 338, 525, 265, 29915, 13, 4706, 2106, 353, 1583, 29889, 657, 29918, 13519, 29918, 3859, 29898, 1792, 333, 29897, 13, 4706, 565, 2106, 2804, 525, 265, 2396, 13, 9651, 25401, 29889, 2704, 703, 17776, 304, 5735, 19490, 3370, 310, 17838, 1273, 29879, 29892, 1059, 29901, 376, 13, 462, 418, 376, 2543, 342, 338, 297, 4925, 29892, 508, 29876, 29915, 29873, 2189, 5735, 19490, 1213, 1273, 13, 462, 418, 1404, 333, 29897, 13, 9651, 12020, 3682, 29889, 26912, 16376, 29176, 2392, 29898, 1545, 1367, 2433, 2543, 342, 742, 20371, 29922, 29896, 29892, 13, 462, 462, 632, 1404, 333, 29922, 1792, 333, 29897, 13, 4706, 396, 1938, 5735, 19490, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 9258, 29918, 21476, 29918, 14834, 29898, 1792, 333, 29892, 3370, 29897, 13, 13, 4706, 25401, 29889, 3888, 703, 17813, 5735, 19490, 3370, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 13, 1678, 822, 19490, 29918, 14834, 29898, 1311, 29892, 1404, 333, 29892, 3370, 1125, 13, 4706, 25401, 29889, 3888, 703, 17946, 304, 19490, 3370, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 4706, 396, 1938, 19490, 13, 4706, 1583, 3032, 3844, 29873, 4645, 29889, 21476, 29918, 14834, 29898, 1792, 333, 29892, 3370, 29897, 13, 4706, 25401, 29889, 3888, 703, 17813, 19490, 3370, 373, 22419, 1273, 29879, 613, 1404, 333, 29897, 13, 2 ]
test/test_all_contacts.py
Sergggio/python_training
0
1765
import re from model.contact import Contact def test_all_contacts(app, db): contacts_from_db = db.get_contact_list() phone_list_from_db = db.phones_from_db() #email_liset_from_db = db.emails_from_db() phone_list = [] for phone in phone_list_from_db: phone_list.append(merge_phones_like_on_home_page(phone)) email_list = [] #for email in email_liset_from_db: # email_list.append(merge_mail_like_on_home_page(email)) contacts_from_home_page = sorted(app.contact.get_contact_list(), key=Contact.id_or_max) phones_from_home_page = [con.all_phones_from_home_page for con in contacts_from_home_page] #emails_from_home_page = [con.all_mail_from_home_page for con in contacts_from_home_page] assert phone_list == phones_from_home_page #assert email_list == emails_from_home_page assert contacts_from_db == contacts_from_home_page def clear(s): return re.sub("[() -]", "", s) def remove_spaces(s): return re.sub(' +', ' ', s).rstrip() def merge_phones_like_on_home_page(contact): return "\n".join(filter(lambda x: x != "", map(lambda x: clear(x), filter(lambda x: x is not None, [contact.home_phone, contact.mobile_phone, contact.work_phone, contact.secondary_phone])))) def merge_email_like_on_home_page(contact): return "\n".join(filter(lambda x: x != "", map(lambda x: remove_spaces(x), filter(lambda x: x is not None, [contact.email, contact.email2, contact.email3]))))
[ 1, 1053, 337, 13, 3166, 1904, 29889, 12346, 1053, 22387, 13, 13, 13, 1753, 1243, 29918, 497, 29918, 12346, 29879, 29898, 932, 29892, 4833, 1125, 13, 1678, 25957, 29918, 3166, 29918, 2585, 353, 4833, 29889, 657, 29918, 12346, 29918, 1761, 580, 13, 1678, 9008, 29918, 1761, 29918, 3166, 29918, 2585, 353, 4833, 29889, 561, 2873, 29918, 3166, 29918, 2585, 580, 13, 1678, 396, 5269, 29918, 23443, 300, 29918, 3166, 29918, 2585, 353, 4833, 29889, 331, 2234, 29918, 3166, 29918, 2585, 580, 13, 1678, 9008, 29918, 1761, 353, 5159, 13, 1678, 363, 9008, 297, 9008, 29918, 1761, 29918, 3166, 29918, 2585, 29901, 13, 4706, 9008, 29918, 1761, 29889, 4397, 29898, 14634, 29918, 561, 2873, 29918, 4561, 29918, 265, 29918, 5184, 29918, 3488, 29898, 6710, 876, 13, 1678, 4876, 29918, 1761, 353, 5159, 13, 1678, 396, 1454, 4876, 297, 4876, 29918, 23443, 300, 29918, 3166, 29918, 2585, 29901, 13, 1678, 396, 1678, 4876, 29918, 1761, 29889, 4397, 29898, 14634, 29918, 2549, 29918, 4561, 29918, 265, 29918, 5184, 29918, 3488, 29898, 5269, 876, 13, 1678, 25957, 29918, 3166, 29918, 5184, 29918, 3488, 353, 12705, 29898, 932, 29889, 12346, 29889, 657, 29918, 12346, 29918, 1761, 3285, 1820, 29922, 13443, 29889, 333, 29918, 272, 29918, 3317, 29897, 13, 1678, 1374, 2873, 29918, 3166, 29918, 5184, 29918, 3488, 353, 518, 535, 29889, 497, 29918, 561, 2873, 29918, 3166, 29918, 5184, 29918, 3488, 363, 378, 297, 25957, 29918, 3166, 29918, 5184, 29918, 3488, 29962, 13, 1678, 396, 331, 2234, 29918, 3166, 29918, 5184, 29918, 3488, 353, 518, 535, 29889, 497, 29918, 2549, 29918, 3166, 29918, 5184, 29918, 3488, 363, 378, 297, 25957, 29918, 3166, 29918, 5184, 29918, 3488, 29962, 13, 1678, 4974, 9008, 29918, 1761, 1275, 1374, 2873, 29918, 3166, 29918, 5184, 29918, 3488, 13, 1678, 396, 9294, 4876, 29918, 1761, 1275, 24609, 29918, 3166, 29918, 5184, 29918, 3488, 13, 1678, 4974, 25957, 29918, 3166, 29918, 2585, 1275, 25957, 29918, 3166, 29918, 5184, 29918, 3488, 13, 13, 13, 1753, 2821, 29898, 29879, 1125, 13, 1678, 736, 337, 29889, 1491, 703, 29961, 580, 448, 29962, 613, 12633, 269, 29897, 13, 13, 13, 1753, 3349, 29918, 22854, 29898, 29879, 1125, 13, 1678, 736, 337, 29889, 1491, 877, 718, 742, 525, 13420, 269, 467, 29878, 17010, 580, 13, 13, 13, 1753, 10366, 29918, 561, 2873, 29918, 4561, 29918, 265, 29918, 5184, 29918, 3488, 29898, 12346, 1125, 13, 1678, 736, 6634, 29876, 1642, 7122, 29898, 4572, 29898, 2892, 921, 29901, 921, 2804, 12633, 13, 462, 9651, 2910, 29898, 2892, 921, 29901, 2821, 29898, 29916, 511, 13, 462, 18884, 4175, 29898, 2892, 921, 29901, 921, 338, 451, 6213, 29892, 13, 462, 462, 539, 518, 12346, 29889, 5184, 29918, 6710, 29892, 6958, 29889, 16769, 29918, 6710, 29892, 13, 462, 462, 4706, 6958, 29889, 1287, 29918, 6710, 29892, 6958, 29889, 7496, 653, 29918, 6710, 12622, 876, 13, 13, 13, 1753, 10366, 29918, 5269, 29918, 4561, 29918, 265, 29918, 5184, 29918, 3488, 29898, 12346, 1125, 13, 1678, 736, 6634, 29876, 1642, 7122, 29898, 4572, 29898, 2892, 921, 29901, 921, 2804, 12633, 13, 462, 9651, 2910, 29898, 2892, 921, 29901, 3349, 29918, 22854, 29898, 29916, 511, 13, 462, 18884, 4175, 29898, 2892, 921, 29901, 921, 338, 451, 6213, 29892, 13, 462, 462, 539, 518, 12346, 29889, 5269, 29892, 6958, 29889, 5269, 29906, 29892, 6958, 29889, 5269, 29941, 12622, 876, 13, 2 ]
jina/drivers/helper.py
boussoffara/jina
0
131504
<gh_stars>0 __copyright__ = "Copyright (c) 2020 Jina AI Limited. All rights reserved." __license__ = "Apache-2.0" import mimetypes import os import urllib.parse import urllib.request from typing import Dict, Any, Iterable, Tuple, Union, List import numpy as np from ..proto import jina_pb2 def pb2array(blob: 'jina_pb2.NdArray') -> 'np.ndarray': """Convert a blob protobuf to a numpy ndarray. Note if the argument ``quantize`` is specified in :func:`array2pb` then the returned result may be lossy. Nonetheless, it will always in original ``dtype``, i.e. ``float32`` or ``float64`` :param blob: a blob described in protobuf """ x = np.frombuffer(blob.buffer, dtype=blob.dtype) if blob.quantization == jina_pb2.NdArray.FP16: x = x.astype(blob.original_dtype) elif blob.quantization == jina_pb2.NdArray.UINT8: x = x.astype(blob.original_dtype) * blob.scale + blob.min_val return x.reshape(blob.shape) def array2pb(x: 'np.ndarray', quantize: str = None) -> 'jina_pb2.NdArray': """Convert a numpy ndarray to blob protobuf. :param x: the target ndarray :param quantize: the quantization method used when converting to protobuf. Availables are ``fp16``, ``uint8``, default is None. Remarks on quantization: The quantization only works when ``x`` is in ``float32`` or ``float64``. The motivation is to save the network bandwidth by using less bits to store the numpy array in the protobuf. - ``fp16`` quantization is lossless, can be used widely. Each float is represented by 16 bits. - ``uint8`` quantization is lossy. Each float is represented by 8 bits. The algorithm behind is standard scaling. There is no need to specify the quantization type in :func:`pb2array`, as the quantize type is stored and the blob is self-contained to recover the original numpy array """ blob = jina_pb2.NdArray() quantize = os.environ.get('JINA_ARRAY_QUANT', quantize) if quantize == 'fp16' and (x.dtype == np.float32 or x.dtype == np.float64): blob.quantization = jina_pb2.NdArray.FP16 blob.original_dtype = x.dtype.name x = x.astype(np.float16) elif quantize == 'uint8' and (x.dtype == np.float32 or x.dtype == np.float64 or x.dtype == np.float16): blob.quantization = jina_pb2.NdArray.UINT8 blob.max_val, blob.min_val = x.max(), x.min() blob.original_dtype = x.dtype.name blob.scale = (blob.max_val - blob.min_val) / 256 x = ((x - blob.min_val) / blob.scale).astype(np.uint8) else: blob.quantization = jina_pb2.NdArray.NONE blob.buffer = x.tobytes() blob.shape.extend(list(x.shape)) blob.dtype = x.dtype.name return blob def extract_chunks(docs: Iterable['jina_pb2.Document'], filter_by: Union[Tuple[str], List[str]], embedding: bool) -> Tuple: """Iterate over a list of protobuf documents and extract chunk-level information from them :param docs: an iterable of protobuf documents :param embedding: an indicator of extracting embedding or not. If ``True`` then all chunk-level embedding are extracted. If ``False`` then ``text``, ``buffer``, ``blob`` info of each chunks are extracted :param filter_by: a list of service names to wait :return: A tuple of four pieces: - a numpy ndarray of extracted info - the corresponding chunk references - the doc_id list where the doc has no chunk, useful for debugging - the chunk_id list where the chunk has no contents, useful for debugging """ _contents = [] chunk_pts = [] no_chunk_docs = [] bad_chunk_ids = [] if embedding: _extract_fn = lambda c: c.embedding.buffer and pb2array(c.embedding) else: _extract_fn = lambda c: c.text or c.buffer or (c.blob and pb2array(c.blob)) for d in docs: if not d.chunks: no_chunk_docs.append(d.doc_id) continue for c in d.chunks: _c = _extract_fn(c) if filter_by and c.field_name not in filter_by: continue if _c is not None: _contents.append(_c) chunk_pts.append(c) else: bad_chunk_ids.append((d.doc_id, c.chunk_id)) contents = np.stack(_contents) if len(_contents) > 0 else None return contents, chunk_pts, no_chunk_docs, bad_chunk_ids def routes2str(msg: 'jina_pb2.Message', flag_current: bool = False) -> str: """Get the string representation of the routes in a message. :param msg: a protobuf message :param flag_current: flag the current :class:`BasePod` as ``⚐`` """ route_str = [r.pod for r in msg.envelope.routes] if flag_current: route_str.append('⚐') from ..helper import colored return colored('▸', 'green').join(route_str) def add_route(evlp: 'jina_pb2.Envelope', name: str, identity: str) -> None: """Add a route to the envelope :param evlp: the envelope to modify :param name: the name of the pod service :param identity: the identity of the pod service """ r = evlp.routes.add() r.pod = name r.start_time.GetCurrentTime() r.pod_id = identity def pb_obj2dict(obj, keys: Iterable[str]) -> Dict[str, Any]: """Convert a protobuf object to a Dict by selected keys :param obj: a protobuf object :param keys: an iterable of keys for extraction """ return {k: getattr(obj, k) for k in keys if hasattr(obj, k)} def guess_mime(uri): # guess when uri points to a local file m_type = mimetypes.guess_type(uri)[0] # guess when uri points to a remote file if not m_type and urllib.parse.urlparse(uri).scheme in {'http', 'https', 'data'}: tmp = urllib.request.urlopen(uri) m_type = tmp.info().get_content_type() return m_type
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1649, 8552, 1266, 1649, 353, 376, 11882, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29900, 435, 1099, 319, 29902, 28873, 29889, 2178, 10462, 21676, 1213, 13, 1649, 506, 1947, 1649, 353, 376, 17396, 1829, 29899, 29906, 29889, 29900, 29908, 13, 13, 5215, 286, 17528, 7384, 13, 5215, 2897, 13, 5215, 3142, 1982, 29889, 5510, 13, 5215, 3142, 1982, 29889, 3827, 13, 3166, 19229, 1053, 360, 919, 29892, 3139, 29892, 20504, 519, 29892, 12603, 552, 29892, 7761, 29892, 2391, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 6317, 17529, 1053, 432, 1099, 29918, 24381, 29906, 13, 13, 13, 1753, 282, 29890, 29906, 2378, 29898, 10054, 29901, 525, 29926, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 1495, 1599, 525, 9302, 29889, 299, 2378, 2396, 13, 1678, 9995, 18455, 263, 23755, 17814, 9721, 304, 263, 12655, 29871, 299, 2378, 29889, 13, 13, 1678, 3940, 565, 278, 2980, 4954, 12150, 675, 16159, 338, 6790, 297, 584, 9891, 18078, 2378, 29906, 24381, 29952, 769, 278, 4133, 1121, 1122, 367, 6410, 29891, 29889, 13, 1678, 10050, 621, 6393, 29892, 372, 674, 2337, 297, 2441, 4954, 29881, 1853, 29952, 1673, 474, 29889, 29872, 29889, 4954, 7411, 29941, 29906, 16159, 470, 4954, 7411, 29953, 29946, 16159, 13, 13, 1678, 584, 3207, 23755, 29901, 263, 23755, 5439, 297, 17814, 9721, 13, 1678, 9995, 13, 1678, 921, 353, 7442, 29889, 3166, 9040, 29898, 10054, 29889, 9040, 29892, 26688, 29922, 10054, 29889, 29881, 1853, 29897, 13, 13, 1678, 565, 23755, 29889, 12150, 2133, 1275, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 29889, 26353, 29896, 29953, 29901, 13, 4706, 921, 353, 921, 29889, 579, 668, 29898, 10054, 29889, 13492, 29918, 29881, 1853, 29897, 13, 1678, 25342, 23755, 29889, 12150, 2133, 1275, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 29889, 29965, 10192, 29947, 29901, 13, 4706, 921, 353, 921, 29889, 579, 668, 29898, 10054, 29889, 13492, 29918, 29881, 1853, 29897, 334, 23755, 29889, 7052, 718, 23755, 29889, 1195, 29918, 791, 13, 13, 1678, 736, 921, 29889, 690, 14443, 29898, 10054, 29889, 12181, 29897, 13, 13, 13, 1753, 1409, 29906, 24381, 29898, 29916, 29901, 525, 9302, 29889, 299, 2378, 742, 4323, 675, 29901, 851, 353, 6213, 29897, 1599, 525, 29926, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 2396, 13, 1678, 9995, 18455, 263, 12655, 29871, 299, 2378, 304, 23755, 17814, 9721, 29889, 13, 13, 1678, 584, 3207, 921, 29901, 278, 3646, 29871, 299, 2378, 13, 1678, 584, 3207, 4323, 675, 29901, 278, 4323, 2133, 1158, 1304, 746, 17415, 304, 17814, 9721, 29889, 13, 9651, 7740, 737, 1849, 526, 4954, 18091, 29896, 29953, 29952, 1673, 4954, 13470, 29947, 29952, 1673, 2322, 338, 6213, 29889, 13, 13, 1678, 5240, 17862, 373, 4323, 2133, 29901, 13, 4706, 450, 4323, 2133, 871, 1736, 746, 4954, 29916, 16159, 338, 297, 4954, 7411, 29941, 29906, 16159, 470, 4954, 7411, 29953, 29946, 29952, 1412, 450, 17385, 362, 338, 304, 13, 4706, 4078, 278, 3564, 3719, 2103, 491, 773, 3109, 9978, 304, 3787, 278, 12655, 1409, 297, 278, 17814, 9721, 29889, 13, 13, 9651, 448, 4954, 18091, 29896, 29953, 16159, 4323, 2133, 338, 6410, 2222, 29892, 508, 367, 1304, 17644, 29889, 7806, 5785, 338, 9875, 491, 29871, 29896, 29953, 9978, 29889, 13, 9651, 448, 4954, 13470, 29947, 16159, 4323, 2133, 338, 6410, 29891, 29889, 7806, 5785, 338, 9875, 491, 29871, 29947, 9978, 29889, 450, 5687, 5742, 338, 3918, 21640, 29889, 13, 13, 4706, 1670, 338, 694, 817, 304, 6084, 278, 4323, 2133, 1134, 297, 584, 9891, 18078, 24381, 29906, 2378, 1673, 13, 4706, 408, 278, 4323, 675, 1134, 338, 6087, 322, 278, 23755, 338, 1583, 29899, 1285, 7114, 304, 9792, 278, 2441, 12655, 1409, 13, 1678, 9995, 13, 1678, 23755, 353, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 580, 13, 13, 1678, 4323, 675, 353, 2897, 29889, 21813, 29889, 657, 877, 29967, 1177, 29909, 29918, 1718, 22800, 29918, 13356, 13566, 742, 4323, 675, 29897, 13, 13, 1678, 565, 4323, 675, 1275, 525, 18091, 29896, 29953, 29915, 322, 313, 29916, 29889, 29881, 1853, 1275, 7442, 29889, 7411, 29941, 29906, 470, 921, 29889, 29881, 1853, 1275, 7442, 29889, 7411, 29953, 29946, 1125, 13, 4706, 23755, 29889, 12150, 2133, 353, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 29889, 26353, 29896, 29953, 13, 4706, 23755, 29889, 13492, 29918, 29881, 1853, 353, 921, 29889, 29881, 1853, 29889, 978, 13, 4706, 921, 353, 921, 29889, 579, 668, 29898, 9302, 29889, 7411, 29896, 29953, 29897, 13, 1678, 25342, 4323, 675, 1275, 525, 13470, 29947, 29915, 322, 313, 29916, 29889, 29881, 1853, 1275, 7442, 29889, 7411, 29941, 29906, 470, 921, 29889, 29881, 1853, 1275, 7442, 29889, 7411, 29953, 29946, 470, 921, 29889, 29881, 1853, 1275, 7442, 29889, 7411, 29896, 29953, 1125, 13, 4706, 23755, 29889, 12150, 2133, 353, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 29889, 29965, 10192, 29947, 13, 4706, 23755, 29889, 3317, 29918, 791, 29892, 23755, 29889, 1195, 29918, 791, 353, 921, 29889, 3317, 3285, 921, 29889, 1195, 580, 13, 4706, 23755, 29889, 13492, 29918, 29881, 1853, 353, 921, 29889, 29881, 1853, 29889, 978, 13, 4706, 23755, 29889, 7052, 353, 313, 10054, 29889, 3317, 29918, 791, 448, 23755, 29889, 1195, 29918, 791, 29897, 847, 29871, 29906, 29945, 29953, 13, 4706, 921, 353, 5135, 29916, 448, 23755, 29889, 1195, 29918, 791, 29897, 847, 23755, 29889, 7052, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 1678, 1683, 29901, 13, 4706, 23755, 29889, 12150, 2133, 353, 432, 1099, 29918, 24381, 29906, 29889, 29940, 29881, 2588, 29889, 29940, 12413, 13, 13, 1678, 23755, 29889, 9040, 353, 921, 29889, 517, 13193, 580, 13, 1678, 23755, 29889, 12181, 29889, 21843, 29898, 1761, 29898, 29916, 29889, 12181, 876, 13, 1678, 23755, 29889, 29881, 1853, 353, 921, 29889, 29881, 1853, 29889, 978, 13, 1678, 736, 23755, 13, 13, 13, 1753, 6597, 29918, 305, 18801, 29898, 2640, 29901, 20504, 519, 1839, 29926, 1099, 29918, 24381, 29906, 29889, 6268, 7464, 4175, 29918, 1609, 29901, 7761, 29961, 23215, 552, 29961, 710, 1402, 2391, 29961, 710, 20526, 13, 462, 259, 23655, 29901, 6120, 29897, 1599, 12603, 552, 29901, 13, 1678, 9995, 13463, 403, 975, 263, 1051, 310, 17814, 9721, 10701, 322, 6597, 19875, 29899, 5563, 2472, 515, 963, 13, 13, 1678, 584, 3207, 10561, 29901, 385, 4256, 519, 310, 17814, 9721, 10701, 13, 1678, 584, 3207, 23655, 29901, 385, 27717, 310, 6597, 292, 23655, 470, 451, 29889, 13, 462, 1678, 960, 4954, 5574, 16159, 769, 599, 19875, 29899, 5563, 23655, 526, 23892, 29889, 13, 462, 1678, 960, 4954, 8824, 16159, 769, 4954, 726, 29952, 1673, 4954, 9040, 29952, 1673, 4954, 10054, 16159, 5235, 310, 1269, 521, 18801, 526, 23892, 13, 1678, 584, 3207, 4175, 29918, 1609, 29901, 263, 1051, 310, 2669, 2983, 304, 4480, 13, 1678, 584, 2457, 29901, 319, 18761, 310, 3023, 12785, 29901, 13, 13, 9651, 448, 263, 12655, 29871, 299, 2378, 310, 23892, 5235, 13, 9651, 448, 278, 6590, 19875, 9282, 13, 9651, 448, 278, 1574, 29918, 333, 1051, 988, 278, 1574, 756, 694, 19875, 29892, 5407, 363, 13490, 13, 9651, 448, 278, 19875, 29918, 333, 1051, 988, 278, 19875, 756, 694, 8118, 29892, 5407, 363, 13490, 13, 1678, 9995, 13, 1678, 903, 10853, 353, 5159, 13, 1678, 19875, 29918, 16485, 353, 5159, 13, 1678, 694, 29918, 29812, 29918, 2640, 353, 5159, 13, 1678, 4319, 29918, 29812, 29918, 4841, 353, 5159, 13, 13, 1678, 565, 23655, 29901, 13, 4706, 903, 21111, 29918, 9144, 353, 14013, 274, 29901, 274, 29889, 17987, 8497, 29889, 9040, 322, 282, 29890, 29906, 2378, 29898, 29883, 29889, 17987, 8497, 29897, 13, 1678, 1683, 29901, 13, 4706, 903, 21111, 29918, 9144, 353, 14013, 274, 29901, 274, 29889, 726, 470, 274, 29889, 9040, 470, 313, 29883, 29889, 10054, 322, 282, 29890, 29906, 2378, 29898, 29883, 29889, 10054, 876, 13, 13, 1678, 363, 270, 297, 10561, 29901, 13, 4706, 565, 451, 270, 29889, 305, 18801, 29901, 13, 9651, 694, 29918, 29812, 29918, 2640, 29889, 4397, 29898, 29881, 29889, 1514, 29918, 333, 29897, 13, 9651, 6773, 13, 13, 4706, 363, 274, 297, 270, 29889, 305, 18801, 29901, 13, 9651, 903, 29883, 353, 903, 21111, 29918, 9144, 29898, 29883, 29897, 13, 9651, 565, 4175, 29918, 1609, 322, 274, 29889, 2671, 29918, 978, 451, 297, 4175, 29918, 1609, 29901, 13, 18884, 6773, 13, 13, 9651, 565, 903, 29883, 338, 451, 6213, 29901, 13, 18884, 903, 10853, 29889, 4397, 7373, 29883, 29897, 13, 18884, 19875, 29918, 16485, 29889, 4397, 29898, 29883, 29897, 13, 9651, 1683, 29901, 13, 18884, 4319, 29918, 29812, 29918, 4841, 29889, 4397, 3552, 29881, 29889, 1514, 29918, 333, 29892, 274, 29889, 29812, 29918, 333, 876, 13, 13, 1678, 8118, 353, 7442, 29889, 1429, 7373, 10853, 29897, 565, 7431, 7373, 10853, 29897, 1405, 29871, 29900, 1683, 6213, 13, 1678, 736, 8118, 29892, 19875, 29918, 16485, 29892, 694, 29918, 29812, 29918, 2640, 29892, 4319, 29918, 29812, 29918, 4841, 13, 13, 13, 1753, 12049, 29906, 710, 29898, 7645, 29901, 525, 29926, 1099, 29918, 24381, 29906, 29889, 3728, 742, 7353, 29918, 3784, 29901, 6120, 353, 7700, 29897, 1599, 851, 29901, 13, 1678, 9995, 2577, 278, 1347, 8954, 310, 278, 12049, 297, 263, 2643, 29889, 13, 13, 1678, 584, 3207, 10191, 29901, 263, 17814, 9721, 2643, 13, 1678, 584, 3207, 7353, 29918, 3784, 29901, 7353, 278, 1857, 584, 1990, 18078, 5160, 27345, 29952, 408, 4954, 229, 157, 147, 16159, 13, 1678, 9995, 13, 1678, 5782, 29918, 710, 353, 518, 29878, 29889, 15334, 363, 364, 297, 10191, 29889, 264, 21367, 29889, 27894, 29962, 13, 1678, 565, 7353, 29918, 3784, 29901, 13, 4706, 5782, 29918, 710, 29889, 4397, 877, 229, 157, 147, 1495, 13, 1678, 515, 6317, 20907, 1053, 28684, 13, 1678, 736, 28684, 877, 31234, 742, 525, 12692, 2824, 7122, 29898, 13134, 29918, 710, 29897, 13, 13, 13, 1753, 788, 29918, 13134, 29898, 5750, 22833, 29901, 525, 29926, 1099, 29918, 24381, 29906, 29889, 2369, 21367, 742, 1024, 29901, 851, 29892, 10110, 29901, 851, 29897, 1599, 6213, 29901, 13, 1678, 9995, 2528, 263, 5782, 304, 278, 427, 21367, 13, 13, 1678, 584, 3207, 3415, 22833, 29901, 278, 427, 21367, 304, 6623, 13, 1678, 584, 3207, 1024, 29901, 278, 1024, 310, 278, 2532, 2669, 13, 1678, 584, 3207, 10110, 29901, 278, 10110, 310, 278, 2532, 2669, 13, 1678, 9995, 13, 1678, 364, 353, 3415, 22833, 29889, 27894, 29889, 1202, 580, 13, 1678, 364, 29889, 15334, 353, 1024, 13, 1678, 364, 29889, 2962, 29918, 2230, 29889, 2577, 7583, 2481, 580, 13, 1678, 364, 29889, 15334, 29918, 333, 353, 10110, 13, 13, 13, 1753, 282, 29890, 29918, 5415, 29906, 8977, 29898, 5415, 29892, 6611, 29901, 20504, 519, 29961, 710, 2314, 1599, 360, 919, 29961, 710, 29892, 3139, 5387, 13, 1678, 9995, 18455, 263, 17814, 9721, 1203, 304, 263, 360, 919, 491, 4629, 6611, 13, 13, 1678, 584, 3207, 5446, 29901, 263, 17814, 9721, 1203, 13, 1678, 584, 3207, 6611, 29901, 385, 4256, 519, 310, 6611, 363, 4805, 428, 13, 1678, 9995, 13, 1678, 736, 426, 29895, 29901, 679, 5552, 29898, 5415, 29892, 413, 29897, 363, 413, 297, 6611, 565, 756, 5552, 29898, 5415, 29892, 413, 2915, 13, 13, 13, 1753, 4140, 29918, 29885, 603, 29898, 5338, 1125, 13, 1678, 396, 4140, 746, 21333, 3291, 304, 263, 1887, 934, 13, 1678, 286, 29918, 1853, 353, 286, 17528, 7384, 29889, 2543, 404, 29918, 1853, 29898, 5338, 9601, 29900, 29962, 13, 1678, 396, 4140, 746, 21333, 3291, 304, 263, 7592, 934, 13, 1678, 565, 451, 286, 29918, 1853, 322, 3142, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 5338, 467, 816, 2004, 297, 11117, 1124, 742, 525, 991, 742, 525, 1272, 29915, 6177, 13, 4706, 13128, 353, 3142, 1982, 29889, 3827, 29889, 332, 417, 2238, 29898, 5338, 29897, 13, 4706, 286, 29918, 1853, 353, 13128, 29889, 3888, 2141, 657, 29918, 3051, 29918, 1853, 580, 13, 1678, 736, 286, 29918, 1853, 13, 2 ]
core/domain/html_domain_test.py
mehrdad-shokri/oppia
0
101797
<gh_stars>0 # coding: utf-8 # # Copyright 2020 The Oppia Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # 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. """Tests for html domain objects.""" from __future__ import absolute_import # pylint: disable=import-only-modules from __future__ import unicode_literals # pylint: disable=import-only-modules from core.domain import html_domain from core.tests import test_utils class LatexStringSvgImageDimensionsTests(test_utils.GenericTestBase): def test_create_latex_string_svg_image_dimensions(self): latex_string_svg_image_dimensions = ( html_domain.LatexStringSvgImageDimensions( '1d345', '2d345', '0d241')) self.assertEqual( latex_string_svg_image_dimensions.to_dict(), { 'encoded_height_string': '1d345', 'encoded_width_string': '2d345', 'encoded_vertical_padding_string': '0d241' }) def test_validate_when_encoded_height_string_not_string(self): with self.assertRaisesRegexp( Exception, 'Expected encoded_height_string to be a str, received ' '1'): html_domain.LatexStringSvgImageDimensions( 1, '4d345', '0d124') def test_validate_when_encoded_width_string_not_string(self): with self.assertRaisesRegexp( Exception, 'Expected encoded_width_string to be a str, received ' '34'): html_domain.LatexStringSvgImageDimensions( '1d245', 34, '0d124') def test_validate_when_encoded_vertical_padding_string_not_string(self): with self.assertRaisesRegexp( Exception, 'Expected encoded_vertical_padding_string to be a str, received ' '0'): html_domain.LatexStringSvgImageDimensions( '1d245', '4d345', 0) class LatexStringSvgImageDataTests(test_utils.GenericTestBase): def test_create_latex_string_svg_image_dimensions(self): latex_string_svg_image_dimensions = ( html_domain.LatexStringSvgImageDimensions( '1d345', '2d345', '0d241')) raw_image = '<svg><path d="0" /></svg>' latex_string_svg_image_data = ( html_domain.LatexStringSvgImageData( raw_image, latex_string_svg_image_dimensions)) expected_dict = { 'raw_image': raw_image, 'latex_string_svg_image_dimensions': { 'encoded_height_string': '1d345', 'encoded_width_string': '2d345', 'encoded_vertical_padding_string': '0d241' } } self.assertEqual( latex_string_svg_image_data.to_dict(), expected_dict) def test_validate_when_raw_image_not_string(self): latex_string_svg_image_dimensions = ( html_domain.LatexStringSvgImageDimensions( '1d345', '2d345', '0d241')) with self.assertRaisesRegexp( Exception, 'Expected raw_image to be a str, received 0'): html_domain.LatexStringSvgImageData( 0, latex_string_svg_image_dimensions)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29900, 450, 438, 407, 423, 13189, 943, 29889, 2178, 26863, 2538, 9841, 29889, 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, 418, 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, 29899, 3235, 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, 15945, 29908, 24376, 363, 3472, 5354, 3618, 1213, 15945, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 5215, 29899, 6194, 29899, 7576, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 5215, 29899, 6194, 29899, 7576, 13, 13, 3166, 7136, 29889, 7247, 1053, 3472, 29918, 7247, 13, 3166, 7136, 29889, 21150, 1053, 1243, 29918, 13239, 13, 13, 13, 1990, 23089, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 24376, 29898, 1688, 29918, 13239, 29889, 15809, 3057, 5160, 1125, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 25694, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 29898, 1311, 1125, 13, 4706, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 353, 313, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 18884, 525, 29896, 29881, 29941, 29946, 29945, 742, 525, 29906, 29881, 29941, 29946, 29945, 742, 525, 29900, 29881, 29906, 29946, 29896, 8785, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 29889, 517, 29918, 8977, 3285, 426, 13, 18884, 525, 26716, 29918, 3545, 29918, 1807, 2396, 525, 29896, 29881, 29941, 29946, 29945, 742, 13, 18884, 525, 26716, 29918, 2103, 29918, 1807, 2396, 525, 29906, 29881, 29941, 29946, 29945, 742, 13, 18884, 525, 26716, 29918, 18575, 29918, 12791, 29918, 1807, 2396, 525, 29900, 29881, 29906, 29946, 29896, 29915, 13, 9651, 5615, 13, 13, 1678, 822, 1243, 29918, 15480, 29918, 8256, 29918, 26716, 29918, 3545, 29918, 1807, 29918, 1333, 29918, 1807, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 13, 9651, 8960, 29892, 13, 9651, 525, 1252, 6021, 18511, 29918, 3545, 29918, 1807, 304, 367, 263, 851, 29892, 4520, 525, 13, 9651, 525, 29896, 29374, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 462, 29896, 29892, 525, 29946, 29881, 29941, 29946, 29945, 742, 525, 29900, 29881, 29896, 29906, 29946, 1495, 13, 13, 1678, 822, 1243, 29918, 15480, 29918, 8256, 29918, 26716, 29918, 2103, 29918, 1807, 29918, 1333, 29918, 1807, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 13, 9651, 8960, 29892, 13, 9651, 525, 1252, 6021, 18511, 29918, 2103, 29918, 1807, 304, 367, 263, 851, 29892, 4520, 525, 13, 9651, 525, 29941, 29946, 29374, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 18884, 525, 29896, 29881, 29906, 29946, 29945, 742, 29871, 29941, 29946, 29892, 525, 29900, 29881, 29896, 29906, 29946, 1495, 13, 13, 1678, 822, 1243, 29918, 15480, 29918, 8256, 29918, 26716, 29918, 18575, 29918, 12791, 29918, 1807, 29918, 1333, 29918, 1807, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 13, 9651, 8960, 29892, 13, 9651, 525, 1252, 6021, 18511, 29918, 18575, 29918, 12791, 29918, 1807, 304, 367, 263, 851, 29892, 4520, 525, 13, 9651, 525, 29900, 29374, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 18884, 525, 29896, 29881, 29906, 29946, 29945, 742, 525, 29946, 29881, 29941, 29946, 29945, 742, 29871, 29900, 29897, 13, 13, 13, 1990, 23089, 29916, 1231, 29903, 29894, 29887, 2940, 1469, 24376, 29898, 1688, 29918, 13239, 29889, 15809, 3057, 5160, 1125, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 25694, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 29898, 1311, 1125, 13, 4706, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 353, 313, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 18884, 525, 29896, 29881, 29941, 29946, 29945, 742, 525, 29906, 29881, 29941, 29946, 29945, 742, 525, 29900, 29881, 29906, 29946, 29896, 8785, 13, 13, 4706, 10650, 29918, 3027, 353, 12801, 15120, 5299, 2084, 270, 543, 29900, 29908, 847, 2565, 15120, 16299, 13, 4706, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 1272, 353, 313, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 1469, 29898, 13, 18884, 10650, 29918, 3027, 29892, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 876, 13, 13, 4706, 3806, 29918, 8977, 353, 426, 13, 9651, 525, 1610, 29918, 3027, 2396, 10650, 29918, 3027, 29892, 13, 9651, 525, 25694, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 2396, 426, 13, 18884, 525, 26716, 29918, 3545, 29918, 1807, 2396, 525, 29896, 29881, 29941, 29946, 29945, 742, 13, 18884, 525, 26716, 29918, 2103, 29918, 1807, 2396, 525, 29906, 29881, 29941, 29946, 29945, 742, 13, 18884, 525, 26716, 29918, 18575, 29918, 12791, 29918, 1807, 2396, 525, 29900, 29881, 29906, 29946, 29896, 29915, 13, 9651, 500, 13, 4706, 500, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 1272, 29889, 517, 29918, 8977, 3285, 3806, 29918, 8977, 29897, 13, 13, 1678, 822, 1243, 29918, 15480, 29918, 8256, 29918, 1610, 29918, 3027, 29918, 1333, 29918, 1807, 29898, 1311, 1125, 13, 4706, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 353, 313, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 16142, 5580, 29898, 13, 18884, 525, 29896, 29881, 29941, 29946, 29945, 742, 525, 29906, 29881, 29941, 29946, 29945, 742, 525, 29900, 29881, 29906, 29946, 29896, 8785, 13, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 13, 9651, 8960, 29892, 13, 9651, 525, 1252, 6021, 10650, 29918, 3027, 304, 367, 263, 851, 29892, 4520, 29871, 29900, 29374, 13, 9651, 3472, 29918, 7247, 29889, 29931, 403, 29916, 1231, 29903, 29894, 29887, 2940, 1469, 29898, 13, 462, 29900, 29892, 5683, 29916, 29918, 1807, 29918, 15120, 29918, 3027, 29918, 6229, 5580, 29897, 13, 2 ]
mnist/replay/train_gan.py
limberc/hypercl
0
55642
<gh_stars>0 #!/usr/bin/env python3 # 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. # # @title :train.py # @author :jvo # @contact :<EMAIL> # @created :07/10/2019 # @version :1.0 # @python_version :3.6.8 """ Continual learning of MNIST GAN with hypernetworks --------------------------------------------------- An implementation of a simple fully-connected MNIST GAN. The goal of this script is to provide a sanity check, that an MNIST GAN can be realized through a hypernetwork, i.e., a hypernetwork that produces the weights of the generator. """ # Do not delete the following import for all executable scripts! import numpy as np import torch import torch.optim as optim import utils.hnet_regularizer as hreg import utils.optim_step as opstep from mnist.plotting import _viz_training, _plotImages from utils import gan_helpers def test(dis, gen, g_hnet, device, config, writer, train_iter=None, condition=None): """ Test the MNIST GAN - here we only sample from a fixed noise to compare images qualitatively. One should also keep track of the GAN loss error of e.g. a test set. Args: (....): See docstring of function :func:`mnist.replay.train_replay.train`. train_iter: The current training iteration. condition: Condition (class/task) we are currently training. """ if train_iter is None: print('### Final test run ...') train_iter = config.n_iter else: print('# Testing network before running training step %d ...' % \ train_iter) # if no condition is given, we iterate over all (trained) embeddings if condition is None: condition = config.num_embeddings - 1 # eval all nets dis.eval() gen.eval() if g_hnet is not None: g_hnet.eval() with torch.no_grad(): # iterate over all conditions for m in range(condition + 1): # Get pre training saved noise z = config.test_z[m] X_fake = sample(gen, g_hnet, config, m, device, z=z) X_fake = X_fake * 2 - 1 if config.show_plots: fig_real = _plotImages(X_fake, config) writer.add_figure('test_cond_' + str(m) + '_sampled_after_' + str(condition), fig_real, global_step=train_iter) if train_iter == config.n_iter: writer.add_figure('test_cond_final_' + str(m) + '_sampled_after_' + str(condition), fig_real, global_step=train_iter) # TODO test GAN loss def sample(gen, g_hnet, config, condition, device, z=None, bs=None): """Sample from the generator. Given a certain condition (the task id), we sample from the generator model a batch of replay data. This input of the generator will be a noise vector (optional with a specific mean) and/or and additional task specific input. Args: (....): See docstring of funct :func:`mnist.replay.train_replay.train`. condition: Condition (class/task) we want to sample from. Not to be confused with the additional option that one can input a task specific condition the replay model. Returns: Batch of replay data from the generator, given a certain condition / task id. """ if z is None: # get the prior mean if config.conditional_prior: cur_prior = config.priors[condition] else: cur_prior = torch.zeros((config.batch_size, config.latent_dim)).to(device) # sample normal gaussian and build noise vector eps = torch.randn_like(cur_prior) z = cur_prior + eps # get condition if given if config.conditional_replay: z = torch.cat([z, config.vae_conds[condition]], dim=1) # cut for replay when we need the X_fake from all previous tasks need to sum # up the given batch_size such that batch_size(X_fake) == batch_size(X_real) if bs is not None: z = z[:bs, :] # get weights from hnet if g_hnet is not None: weights_d = g_hnet.forward(condition) else: weights_d = None samples = gen.forward(z, weights_d) return torch.tanh(samples) def train_gan_one_t(dhandler, dis, gen, g_hnet, device, config, writer, embd_list, t): """ Train the conditional MNIST GAN for one task. In this function the main training logic for this replay model is implemented. After setting the optimizers for the discriminator/generator and it's hypernetwork if applicable, a standart variational autoencoder training scheme is implemented. To prevent the generator (its hypernetwork) from forgetting, we add our hypernetwork regularisation term for all tasks seen before ``t`` to the vae loss. Args: (....): See docstring of function :func:`mnist.replay.train_replay.train`. embd_list: Helper list of lists for embedding plotting. t: Task id to train. """ print("Training GAN on data handler: ", t) # get lists for plotting embeddings d_embeddings, g_embeddings, d_embedding_history, g_embedding_history = \ embd_list[:] # set training_iterations if epochs are set if config.epochs == -1: training_iterations = config.n_iter else: assert (config.epochs > 0) training_iterations = config.epochs * \ int(np.ceil(dhandler.num_train_samples / config.batch_size)) # Here we adjust the number of training iterations when we train our replay # method to replay every single class in a task given that condition. # We need to adjust the training iterations such that we train every # class in the task only a portion of the time we are given for the # whole task: # Training_time_per_class = training_time_per_task / num_class_per_task # This is important to compare to related work, as they set the training # time per task which we now have to split up. if config.single_class_replay: training_iterations = int(training_iterations / config.out_dim) # if we want to start training the new task with the weights of the previous # task we have to set the start embedding for the new task to the embedding # of the previous task. if config.embedding_reset == "old_embedding" and t > 0: if g_hnet is not None: last_emb = g_hnet.get_task_embs()[t - 1].detach().clone() g_hnet.get_task_embs()[t].data = last_emb # Compute targets for the hnet before training. if t > 0: if config.rp_beta > 0 and g_hnet is not None: targets_G = hreg.get_current_targets(t, g_hnet) else: targets_G = None ############ # OPTIMIZERS ############ # discriminator optimizer dis_paras = dis.parameters() doptimizer = optim.Adam(dis_paras, lr=config.enc_lr, betas=(0.9, 0.999)) # discriminator optimizer (hnet or weights directly) if g_hnet is not None: g_paras = list(g_hnet.theta) if not config.dont_train_rp_embeddings: # Set the embedding optimizer only for the current task embedding. # Note that we could here continue training the old embeddings. g_emb_optimizer = optim.Adam([g_hnet.get_task_emb(t)], lr=config.dec_lr_emb, betas=(0.9, 0.999)) else: g_emb_optimizer = None else: g_emb_optimizer = None g_paras = gen.parameters() goptimizer = optim.Adam(g_paras, lr=config.dec_lr, betas=(0.9, 0.999)) calc_reg = config.rp_beta > 0 and t > 0 and g_hnet is not None for i in range(training_iterations): ### Test network. # We test the network before we run the training iteration. # That way, we can see the initial performance of the untrained net. if i % config.val_iter == 0: test(dis, gen, g_hnet, device, config, writer, i, t) gen.train() dis.train() if g_hnet is not None: g_hnet.train() if i % 100 == 0: print('Training iteration: %d.' % i) if config.show_plots: if g_hnet is not None: if (not config.no_cuda): g_embedding_history.append(g_hnet.get_task_emb(t). clone().detach().cpu().numpy()) else: g_embedding_history.append(g_hnet.get_task_emb(t). clone().detach().numpy()) ####### # DATA ####### real_batch = dhandler.next_train_batch(config.batch_size) X_real = dhandler.input_to_torch_tensor(real_batch[0], device, mode='train') # shift data in range [-1, 1] so we can tanh the output of G X_real = X_real * 2 - 1.0 ###################### # TRAIN DISCRIMINATOR ###################### # set gradients again to zero doptimizer.zero_grad() goptimizer.zero_grad() if g_emb_optimizer is not None: g_emb_optimizer.zero_grad() # Note that X_fake is not normalize between 0 and 1 # but like in in https://github.com/Zackory/Kera # s-MNIST-GAN/blob/master/mnist_gan.py # inputs are shiftet between [-1, 1] and X_fake is put through tanh # X_fake = torch.tanh(X_fake) X_fake = sample(gen, g_hnet, config, t, device) fake = dis.forward(X_fake) real = dis.forward(X_real) # compute discriminator loss dloss = gan_helpers.dis_loss(real, fake, config.loss_fun) # compute gradients for discriminator and take gradient step dloss.backward() doptimizer.step() ###################### # TRAIN GENERATOR ###################### # set gradients again to zero goptimizer.zero_grad() doptimizer.zero_grad() if g_emb_optimizer is not None: g_emb_optimizer.zero_grad() X_fake = sample(gen, g_hnet, config, t, device) fake = dis.forward(X_fake) # compute generator loss gloss = gan_helpers.gen_loss(fake, config.loss_fun) gloss.backward(retain_graph=calc_reg, create_graph=calc_reg and \ config.backprop_dt) # compute hypernet reg loss and fix embedding->change current embs if calc_reg: if config.no_lookahead: dTheta = None else: dTheta = opstep.calc_delta_theta(goptimizer, config.use_sgd_change, lr=config.dec_lr, detach_dt=not config.backprop_dt) gloss_reg = config.rp_beta * hreg.calc_fix_target_reg(g_hnet, t, targets=targets_G, mnet=gen, dTheta=dTheta, dTembs=None) gloss_reg.backward() else: gloss_reg = 0 # compute gradients for generator and take gradient step goptimizer.step() if g_hnet is not None and not config.dont_train_rp_embeddings: g_emb_optimizer.step() # Visualization of current progress in tensorboard if i % config.plot_update_steps == 0 and i > 0 and config.show_plots: if d_embedding_history is not None: d_embedding_cut = np.asarray(d_embedding_history[2:]) else: d_embedding_cut = None if g_embedding_history is not None: g_embedding_cut = np.asarray(g_embedding_history[2:]) else: g_embedding_cut = None _viz_training(X_real, X_fake, g_embeddings, d_embeddings, g_embedding_cut, d_embedding_cut, writer, i, config, title="train_cond_" + str(t)) # track some training statistics writer.add_scalar('train/gen_loss_%d' % (t), gloss + gloss_reg, i) writer.add_scalar('train/dloss_all_%d' % (t), dloss, i) writer.add_scalar('train/dis_accuracy_%d' % (t), gan_helpers.accuracy(real, fake, config.loss_fun), i) if config.rp_beta > 0: writer.add_scalar('train/g_hnet_loss_reg_%d' % (t), gloss_reg, i) writer.add_scalar('train/g_loss_only_%d' % (t), gloss, i) test(dis, gen, g_hnet, device, config, writer, config.n_iter, t) if __name__ == '__main__': print('Use "train_replay.py --replay_method gan" to train a replay GAN ' + 'with hypernetworks.')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29929, 529, 5813, 29958, 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, 13, 29937, 732, 3257, 965, 584, 14968, 29889, 2272, 13, 29937, 732, 8921, 3986, 584, 29926, 1365, 13, 29937, 732, 12346, 308, 584, 29966, 26862, 6227, 29958, 13, 29937, 732, 11600, 308, 584, 29900, 29955, 29914, 29896, 29900, 29914, 29906, 29900, 29896, 29929, 13, 29937, 732, 3259, 308, 584, 29896, 29889, 29900, 13, 29937, 732, 4691, 29918, 3259, 29871, 584, 29941, 29889, 29953, 29889, 29947, 13, 13, 15945, 29908, 13, 1323, 262, 950, 6509, 310, 341, 29940, 9047, 402, 2190, 411, 11266, 11618, 29879, 13, 2683, 2683, 2683, 5634, 13, 13, 2744, 5314, 310, 263, 2560, 8072, 29899, 18045, 341, 29940, 9047, 402, 2190, 29889, 450, 7306, 310, 445, 13, 2154, 338, 304, 3867, 263, 9753, 537, 1423, 29892, 393, 385, 341, 29940, 9047, 402, 2190, 508, 367, 16387, 1549, 13, 29874, 11266, 11618, 29892, 474, 29889, 29872, 1696, 263, 11266, 11618, 393, 13880, 278, 18177, 310, 278, 15299, 29889, 13, 15945, 29908, 13, 13, 29937, 1938, 451, 5217, 278, 1494, 1053, 363, 599, 16813, 12078, 29991, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 20640, 408, 5994, 13, 13, 5215, 3667, 29879, 29889, 29882, 1212, 29918, 15227, 3950, 408, 298, 1727, 13, 5215, 3667, 29879, 29889, 20640, 29918, 10568, 408, 1015, 10568, 13, 3166, 28597, 391, 29889, 5317, 1259, 1053, 903, 29894, 466, 29918, 26495, 29892, 903, 5317, 20163, 13, 3166, 3667, 29879, 1053, 9581, 29918, 3952, 6774, 13, 13, 13, 1753, 1243, 29898, 2218, 29892, 2531, 29892, 330, 29918, 29882, 1212, 29892, 4742, 29892, 2295, 29892, 9227, 29892, 7945, 29918, 1524, 29922, 8516, 29892, 13, 308, 4195, 29922, 8516, 1125, 13, 1678, 9995, 4321, 278, 341, 29940, 9047, 402, 2190, 448, 1244, 591, 871, 4559, 515, 263, 4343, 11462, 304, 7252, 13, 1678, 4558, 4021, 277, 6703, 29889, 3118, 881, 884, 3013, 5702, 310, 278, 402, 2190, 6410, 29871, 13, 1678, 1059, 310, 321, 29889, 29887, 29889, 263, 1243, 731, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 313, 3045, 1125, 2823, 1574, 1807, 310, 740, 29871, 13, 9651, 584, 9891, 18078, 23521, 391, 29889, 276, 1456, 29889, 14968, 29918, 276, 1456, 29889, 14968, 1412, 13, 4706, 7945, 29918, 1524, 29901, 450, 1857, 6694, 12541, 29889, 13, 4706, 4195, 29901, 11790, 654, 313, 1990, 29914, 7662, 29897, 591, 526, 5279, 6694, 29889, 13, 1678, 9995, 13, 13, 1678, 565, 7945, 29918, 1524, 338, 6213, 29901, 13, 4706, 1596, 877, 2277, 29937, 9550, 1243, 1065, 2023, 1495, 13, 4706, 7945, 29918, 1524, 353, 2295, 29889, 29876, 29918, 1524, 13, 1678, 1683, 29901, 13, 4706, 1596, 14237, 4321, 292, 3564, 1434, 2734, 6694, 4331, 1273, 29881, 2023, 29915, 1273, 320, 13, 795, 7945, 29918, 1524, 29897, 13, 1678, 396, 565, 694, 4195, 338, 2183, 29892, 591, 13649, 975, 599, 313, 3018, 1312, 29897, 8297, 29881, 886, 13, 1678, 565, 4195, 338, 6213, 29901, 13, 4706, 4195, 353, 2295, 29889, 1949, 29918, 17987, 29881, 886, 448, 29871, 29896, 13, 13, 4706, 396, 19745, 599, 302, 1691, 13, 1678, 766, 29889, 14513, 580, 13, 1678, 2531, 29889, 14513, 580, 13, 1678, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 4706, 330, 29918, 29882, 1212, 29889, 14513, 580, 13, 13, 1678, 411, 4842, 305, 29889, 1217, 29918, 5105, 7295, 13, 4706, 396, 13649, 975, 599, 5855, 13, 4706, 363, 286, 297, 3464, 29898, 16122, 718, 29871, 29896, 1125, 13, 9651, 396, 3617, 758, 6694, 7160, 11462, 13, 9651, 503, 353, 2295, 29889, 1688, 29918, 29920, 29961, 29885, 29962, 13, 9651, 1060, 29918, 29888, 1296, 353, 4559, 29898, 1885, 29892, 330, 29918, 29882, 1212, 29892, 2295, 29892, 286, 29892, 4742, 29892, 503, 29922, 29920, 29897, 13, 9651, 1060, 29918, 29888, 1296, 353, 1060, 29918, 29888, 1296, 334, 29871, 29906, 448, 29871, 29896, 13, 9651, 565, 2295, 29889, 4294, 29918, 26762, 29901, 13, 18884, 2537, 29918, 6370, 353, 903, 5317, 20163, 29898, 29990, 29918, 29888, 1296, 29892, 2295, 29897, 13, 18884, 9227, 29889, 1202, 29918, 4532, 877, 1688, 29918, 1116, 29918, 29915, 718, 851, 29898, 29885, 29897, 718, 13, 462, 462, 29871, 22868, 11249, 29881, 29918, 7045, 29918, 29915, 718, 851, 29898, 16122, 511, 2537, 29918, 6370, 29892, 13, 462, 462, 29871, 5534, 29918, 10568, 29922, 14968, 29918, 1524, 29897, 13, 18884, 565, 7945, 29918, 1524, 1275, 2295, 29889, 29876, 29918, 1524, 29901, 13, 462, 1678, 9227, 29889, 1202, 29918, 4532, 877, 1688, 29918, 1116, 29918, 8394, 29918, 29915, 718, 851, 29898, 29885, 29897, 718, 13, 462, 462, 418, 22868, 11249, 29881, 29918, 7045, 29918, 29915, 718, 851, 29898, 16122, 511, 2537, 29918, 6370, 29892, 13, 462, 462, 418, 5534, 29918, 10568, 29922, 14968, 29918, 1524, 29897, 13, 9651, 396, 14402, 1243, 402, 2190, 6410, 9651, 13, 13, 13, 1753, 4559, 29898, 1885, 29892, 330, 29918, 29882, 1212, 29892, 2295, 29892, 4195, 29892, 4742, 29892, 503, 29922, 8516, 29892, 24512, 29922, 8516, 1125, 13, 1678, 9995, 17708, 515, 278, 15299, 29889, 11221, 263, 3058, 4195, 313, 1552, 3414, 1178, 511, 13, 1678, 591, 4559, 515, 278, 15299, 1904, 263, 9853, 310, 337, 1456, 848, 29889, 910, 1881, 310, 278, 29871, 13, 1678, 15299, 674, 367, 263, 11462, 4608, 313, 25253, 411, 263, 2702, 2099, 29897, 322, 29914, 272, 322, 13, 1678, 5684, 3414, 2702, 1881, 29889, 29871, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 313, 3045, 1125, 2823, 1574, 1807, 310, 2090, 312, 584, 9891, 18078, 23521, 391, 29889, 276, 1456, 29889, 14968, 29918, 276, 1456, 29889, 14968, 1412, 13, 4706, 4195, 29901, 11790, 654, 313, 1990, 29914, 7662, 29897, 591, 864, 304, 4559, 515, 29889, 2216, 304, 367, 29871, 13, 4706, 9613, 411, 278, 5684, 2984, 393, 697, 508, 1881, 263, 3414, 2702, 29871, 13, 4706, 4195, 278, 337, 1456, 1904, 29889, 29871, 13, 13, 1678, 16969, 29901, 13, 4706, 350, 905, 310, 337, 1456, 848, 515, 278, 15299, 29892, 2183, 263, 3058, 29871, 13, 4706, 4195, 847, 3414, 1178, 29889, 13, 1678, 9995, 13, 13, 1678, 565, 503, 338, 6213, 29901, 13, 4706, 396, 679, 278, 7536, 2099, 259, 13, 4706, 565, 2295, 29889, 1116, 3245, 29918, 29886, 13479, 29901, 13, 9651, 3151, 29918, 29886, 13479, 353, 2295, 29889, 29886, 28739, 29961, 16122, 29962, 13, 4706, 1683, 29901, 13, 9651, 3151, 29918, 29886, 13479, 353, 4842, 305, 29889, 3298, 359, 3552, 2917, 29889, 16175, 29918, 2311, 29892, 13, 462, 462, 268, 2295, 29889, 5066, 296, 29918, 6229, 8106, 517, 29898, 10141, 29897, 13, 13, 4706, 396, 4559, 4226, 330, 17019, 322, 2048, 11462, 4608, 13, 4706, 321, 567, 353, 4842, 305, 29889, 9502, 29876, 29918, 4561, 29898, 2764, 29918, 29886, 13479, 29897, 13, 4706, 503, 353, 3151, 29918, 29886, 13479, 718, 321, 567, 13, 13, 1678, 396, 679, 4195, 565, 2183, 13, 1678, 565, 2295, 29889, 1116, 3245, 29918, 276, 1456, 29901, 13, 4706, 503, 353, 4842, 305, 29889, 4117, 4197, 29920, 29892, 2295, 29889, 1564, 29872, 29918, 1116, 29879, 29961, 16122, 20526, 3964, 29922, 29896, 29897, 13, 13, 1678, 396, 5700, 363, 337, 1456, 746, 591, 817, 278, 1060, 29918, 29888, 1296, 515, 599, 3517, 9595, 817, 304, 2533, 13, 1678, 396, 701, 278, 2183, 9853, 29918, 2311, 1316, 393, 9853, 29918, 2311, 29898, 29990, 29918, 29888, 1296, 29897, 1275, 9853, 29918, 2311, 29898, 29990, 29918, 6370, 29897, 29871, 13, 1678, 565, 24512, 338, 451, 6213, 29901, 13, 4706, 503, 353, 503, 7503, 5824, 29892, 584, 29962, 13, 13, 1678, 396, 679, 18177, 515, 298, 1212, 13, 1678, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 4706, 18177, 29918, 29881, 353, 330, 29918, 29882, 1212, 29889, 11333, 29898, 16122, 29897, 13, 1678, 1683, 29901, 13, 4706, 18177, 29918, 29881, 353, 6213, 13, 13, 1678, 11916, 353, 2531, 29889, 11333, 29898, 29920, 29892, 18177, 29918, 29881, 29897, 13, 1678, 736, 4842, 305, 29889, 13161, 29882, 29898, 27736, 29897, 13, 13, 13, 1753, 7945, 29918, 6249, 29918, 650, 29918, 29873, 29898, 29881, 13789, 29892, 766, 29892, 2531, 29892, 330, 29918, 29882, 1212, 29892, 4742, 29892, 2295, 29892, 9227, 29892, 13, 462, 1678, 953, 6448, 29918, 1761, 29892, 260, 1125, 13, 1678, 9995, 28186, 278, 15047, 341, 29940, 9047, 402, 2190, 363, 697, 3414, 29889, 13, 1678, 512, 445, 740, 278, 1667, 6694, 5900, 363, 445, 337, 1456, 1904, 338, 29871, 13, 1678, 8762, 29889, 2860, 4444, 278, 5994, 19427, 363, 278, 2313, 20386, 1061, 29914, 27959, 29871, 13, 1678, 322, 372, 29915, 29879, 11266, 11618, 565, 22903, 29892, 263, 2317, 442, 1197, 1288, 4469, 3977, 6119, 29871, 13, 1678, 6694, 11380, 338, 8762, 29889, 1763, 5557, 278, 15299, 313, 1169, 11266, 11618, 29897, 29871, 13, 1678, 515, 9566, 1259, 29892, 591, 788, 1749, 11266, 11618, 4943, 4371, 1840, 363, 599, 9595, 29871, 13, 1678, 3595, 1434, 4954, 29873, 16159, 304, 278, 2947, 29872, 6410, 29889, 29871, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 313, 3045, 1125, 2823, 1574, 1807, 310, 740, 29871, 13, 9651, 584, 9891, 18078, 23521, 391, 29889, 276, 1456, 29889, 14968, 29918, 276, 1456, 29889, 14968, 1412, 13, 4706, 953, 6448, 29918, 1761, 29901, 6162, 546, 1051, 310, 8857, 363, 23655, 6492, 1259, 29889, 13, 4706, 260, 29901, 9330, 1178, 304, 7945, 29889, 13, 1678, 9995, 13, 13, 1678, 1596, 703, 5323, 2827, 402, 2190, 373, 848, 7834, 29901, 9162, 260, 29897, 13, 13, 1678, 396, 679, 8857, 363, 6492, 1259, 8297, 29881, 886, 13, 1678, 270, 29918, 17987, 29881, 886, 29892, 330, 29918, 17987, 29881, 886, 29892, 270, 29918, 17987, 8497, 29918, 18434, 29892, 330, 29918, 17987, 8497, 29918, 18434, 353, 320, 13, 4706, 953, 6448, 29918, 1761, 7503, 29962, 13, 1678, 396, 731, 6694, 29918, 1524, 800, 565, 21502, 12168, 526, 731, 13, 1678, 565, 2295, 29889, 1022, 2878, 29879, 1275, 448, 29896, 29901, 13, 4706, 6694, 29918, 1524, 800, 353, 2295, 29889, 29876, 29918, 1524, 13, 1678, 1683, 29901, 13, 4706, 4974, 313, 2917, 29889, 1022, 2878, 29879, 1405, 29871, 29900, 29897, 13, 4706, 6694, 29918, 1524, 800, 353, 2295, 29889, 1022, 2878, 29879, 334, 320, 13, 462, 795, 938, 29898, 9302, 29889, 27696, 29898, 29881, 13789, 29889, 1949, 29918, 14968, 29918, 27736, 847, 2295, 29889, 16175, 29918, 2311, 876, 13, 13, 1678, 396, 2266, 591, 10365, 278, 1353, 310, 6694, 24372, 746, 591, 7945, 1749, 337, 1456, 29871, 13, 1678, 396, 1158, 304, 337, 1456, 1432, 2323, 770, 297, 263, 3414, 2183, 393, 4195, 29889, 29871, 13, 1678, 396, 1334, 817, 304, 10365, 278, 6694, 24372, 1316, 393, 591, 7945, 1432, 29871, 13, 1678, 396, 770, 297, 278, 3414, 871, 263, 11910, 310, 278, 931, 591, 526, 2183, 363, 278, 29871, 13, 1678, 396, 3353, 3414, 29901, 13, 1678, 396, 26101, 29918, 2230, 29918, 546, 29918, 1990, 353, 6694, 29918, 2230, 29918, 546, 29918, 7662, 847, 954, 29918, 1990, 29918, 546, 29918, 7662, 13, 1678, 396, 910, 338, 4100, 304, 7252, 304, 4475, 664, 29892, 408, 896, 731, 278, 6694, 29871, 13, 1678, 396, 931, 639, 3414, 607, 591, 1286, 505, 304, 6219, 701, 29889, 13, 13, 1678, 565, 2295, 29889, 14369, 29918, 1990, 29918, 276, 1456, 29901, 13, 4706, 6694, 29918, 1524, 800, 353, 938, 29898, 26495, 29918, 1524, 800, 847, 2295, 29889, 449, 29918, 6229, 29897, 13, 13, 1678, 396, 565, 591, 864, 304, 1369, 6694, 278, 716, 3414, 411, 278, 18177, 310, 278, 3517, 13, 1678, 396, 3414, 591, 505, 304, 731, 278, 1369, 23655, 363, 278, 716, 3414, 304, 278, 23655, 13, 1678, 396, 310, 278, 3517, 3414, 29889, 29871, 13, 1678, 565, 2295, 29889, 17987, 8497, 29918, 12071, 1275, 376, 1025, 29918, 17987, 8497, 29908, 322, 260, 1405, 29871, 29900, 29901, 13, 4706, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 9651, 1833, 29918, 1590, 353, 330, 29918, 29882, 1212, 29889, 657, 29918, 7662, 29918, 1590, 29879, 580, 29961, 29873, 448, 29871, 29896, 1822, 4801, 496, 2141, 16513, 580, 13, 9651, 330, 29918, 29882, 1212, 29889, 657, 29918, 7662, 29918, 1590, 29879, 580, 29961, 29873, 1822, 1272, 353, 1833, 29918, 1590, 13, 13, 1678, 396, 11796, 29872, 22525, 363, 278, 298, 1212, 1434, 6694, 29889, 29871, 13, 1678, 565, 260, 1405, 29871, 29900, 29901, 13, 4706, 565, 2295, 29889, 19080, 29918, 3571, 1405, 29871, 29900, 322, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 9651, 22525, 29918, 29954, 353, 298, 1727, 29889, 657, 29918, 3784, 29918, 5182, 29879, 29898, 29873, 29892, 330, 29918, 29882, 1212, 29897, 13, 4706, 1683, 29901, 13, 9651, 22525, 29918, 29954, 353, 6213, 13, 13, 1678, 835, 7346, 29937, 13, 1678, 396, 6418, 29911, 7833, 26664, 23598, 29871, 13, 1678, 835, 7346, 29937, 13, 13, 1678, 396, 2313, 20386, 1061, 5994, 3950, 13, 1678, 766, 29918, 862, 294, 353, 766, 29889, 16744, 580, 13, 1678, 437, 415, 326, 3950, 353, 5994, 29889, 3253, 314, 29898, 2218, 29918, 862, 294, 29892, 301, 29878, 29922, 2917, 29889, 3977, 29918, 29212, 29892, 13, 462, 9651, 1010, 294, 7607, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 876, 13, 13, 1678, 396, 2313, 20386, 1061, 5994, 3950, 313, 29882, 1212, 470, 18177, 4153, 29897, 13, 1678, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 4706, 330, 29918, 862, 294, 353, 1051, 29898, 29887, 29918, 29882, 1212, 29889, 3416, 29897, 13, 4706, 565, 451, 2295, 29889, 29881, 609, 29918, 14968, 29918, 19080, 29918, 17987, 29881, 886, 29901, 13, 9651, 396, 3789, 278, 23655, 5994, 3950, 871, 363, 278, 1857, 3414, 23655, 29889, 13, 9651, 396, 3940, 393, 591, 1033, 1244, 6773, 6694, 278, 2030, 8297, 29881, 886, 29889, 13, 9651, 330, 29918, 1590, 29918, 20640, 3950, 353, 5994, 29889, 3253, 314, 4197, 29887, 29918, 29882, 1212, 29889, 657, 29918, 7662, 29918, 1590, 29898, 29873, 29897, 1402, 13, 462, 462, 308, 301, 29878, 29922, 2917, 29889, 7099, 29918, 29212, 29918, 1590, 29892, 1010, 294, 7607, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 876, 13, 4706, 1683, 29901, 13, 9651, 330, 29918, 1590, 29918, 20640, 3950, 353, 6213, 13, 1678, 1683, 29901, 13, 4706, 330, 29918, 1590, 29918, 20640, 3950, 353, 6213, 13, 4706, 330, 29918, 862, 294, 353, 2531, 29889, 16744, 580, 13, 13, 1678, 748, 415, 326, 3950, 353, 5994, 29889, 3253, 314, 29898, 29887, 29918, 862, 294, 29892, 301, 29878, 29922, 2917, 29889, 7099, 29918, 29212, 29892, 13, 462, 9651, 1010, 294, 7607, 29900, 29889, 29929, 29892, 29871, 29900, 29889, 29929, 29929, 29929, 876, 13, 13, 1678, 22235, 29918, 1727, 353, 2295, 29889, 19080, 29918, 3571, 1405, 29871, 29900, 322, 260, 1405, 29871, 29900, 322, 330, 29918, 29882, 1212, 338, 451, 6213, 13, 13, 1678, 363, 474, 297, 3464, 29898, 26495, 29918, 1524, 800, 1125, 13, 4706, 835, 4321, 3564, 29889, 13, 4706, 396, 1334, 1243, 278, 3564, 1434, 591, 1065, 278, 6694, 12541, 29889, 13, 4706, 396, 2193, 982, 29892, 591, 508, 1074, 278, 2847, 4180, 310, 278, 443, 3018, 1312, 7787, 29889, 13, 4706, 565, 474, 1273, 2295, 29889, 791, 29918, 1524, 1275, 29871, 29900, 29901, 13, 9651, 1243, 29898, 2218, 29892, 2531, 29892, 330, 29918, 29882, 1212, 29892, 4742, 29892, 2295, 29892, 9227, 29892, 474, 29892, 260, 29897, 13, 9651, 2531, 29889, 14968, 580, 13, 9651, 766, 29889, 14968, 580, 13, 9651, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 18884, 330, 29918, 29882, 1212, 29889, 14968, 580, 13, 13, 4706, 565, 474, 1273, 29871, 29896, 29900, 29900, 1275, 29871, 29900, 29901, 13, 9651, 1596, 877, 5323, 2827, 12541, 29901, 1273, 29881, 6169, 1273, 474, 29897, 13, 13, 4706, 565, 2295, 29889, 4294, 29918, 26762, 29901, 13, 9651, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 29901, 13, 18884, 565, 313, 1333, 2295, 29889, 1217, 29918, 29883, 6191, 1125, 13, 462, 1678, 330, 29918, 17987, 8497, 29918, 18434, 29889, 4397, 29898, 29887, 29918, 29882, 1212, 29889, 657, 29918, 7662, 29918, 1590, 29898, 29873, 467, 13, 462, 462, 1669, 17432, 2141, 4801, 496, 2141, 21970, 2141, 23749, 3101, 13, 18884, 1683, 29901, 13, 462, 1678, 330, 29918, 17987, 8497, 29918, 18434, 29889, 4397, 29898, 29887, 29918, 29882, 1212, 29889, 657, 29918, 7662, 29918, 1590, 29898, 29873, 467, 13, 462, 462, 1669, 17432, 2141, 4801, 496, 2141, 23749, 3101, 13, 13, 4706, 835, 4136, 13, 4706, 396, 360, 8254, 29871, 13, 4706, 835, 4136, 13, 4706, 1855, 29918, 16175, 353, 270, 13789, 29889, 4622, 29918, 14968, 29918, 16175, 29898, 2917, 29889, 16175, 29918, 2311, 29897, 13, 4706, 1060, 29918, 6370, 353, 270, 13789, 29889, 2080, 29918, 517, 29918, 7345, 305, 29918, 20158, 29898, 6370, 29918, 16175, 29961, 29900, 1402, 13, 462, 462, 18884, 4742, 29892, 4464, 2433, 14968, 1495, 13, 4706, 396, 9500, 848, 297, 3464, 21069, 29896, 29892, 29871, 29896, 29962, 577, 591, 508, 10345, 29882, 278, 1962, 310, 402, 13, 4706, 1060, 29918, 6370, 353, 1060, 29918, 6370, 334, 29871, 29906, 448, 29871, 29896, 29889, 29900, 13, 13, 4706, 835, 13383, 2277, 29937, 13, 4706, 396, 323, 4717, 1177, 28657, 29907, 3960, 16173, 1299, 1955, 13, 4706, 835, 13383, 2277, 29937, 13, 13, 4706, 396, 731, 4656, 10070, 1449, 304, 5225, 13, 4706, 437, 415, 326, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 748, 415, 326, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 565, 330, 29918, 1590, 29918, 20640, 3950, 338, 451, 6213, 29901, 13, 9651, 330, 29918, 1590, 29918, 20640, 3950, 29889, 9171, 29918, 5105, 580, 13, 13, 4706, 396, 3940, 393, 1060, 29918, 29888, 1296, 338, 451, 4226, 675, 1546, 29871, 29900, 322, 29871, 29896, 13, 4706, 396, 541, 763, 297, 297, 2045, 597, 3292, 29889, 510, 29914, 29999, 547, 706, 29914, 29968, 1572, 13, 4706, 396, 269, 29899, 29924, 29940, 9047, 29899, 29954, 2190, 29914, 10054, 29914, 6207, 29914, 23521, 391, 29918, 6249, 29889, 2272, 13, 4706, 396, 10970, 526, 9500, 300, 1546, 21069, 29896, 29892, 29871, 29896, 29962, 322, 1060, 29918, 29888, 1296, 338, 1925, 1549, 10345, 29882, 13, 4706, 396, 1060, 29918, 29888, 1296, 353, 4842, 305, 29889, 13161, 29882, 29898, 29990, 29918, 29888, 1296, 29897, 13, 4706, 1060, 29918, 29888, 1296, 353, 4559, 29898, 1885, 29892, 330, 29918, 29882, 1212, 29892, 2295, 29892, 260, 29892, 4742, 29897, 13, 13, 4706, 25713, 353, 766, 29889, 11333, 29898, 29990, 29918, 29888, 1296, 29897, 13, 4706, 1855, 353, 766, 29889, 11333, 29898, 29990, 29918, 6370, 29897, 13, 13, 4706, 396, 10272, 2313, 20386, 1061, 6410, 13, 4706, 270, 6758, 353, 9581, 29918, 3952, 6774, 29889, 2218, 29918, 6758, 29898, 6370, 29892, 25713, 29892, 2295, 29889, 6758, 29918, 7692, 29897, 13, 13, 4706, 396, 10272, 4656, 10070, 363, 2313, 20386, 1061, 322, 2125, 16030, 4331, 13, 4706, 270, 6758, 29889, 1627, 1328, 580, 13, 4706, 437, 415, 326, 3950, 29889, 10568, 580, 13, 13, 4706, 835, 13383, 2277, 29937, 13, 4706, 396, 323, 4717, 1177, 402, 1430, 1001, 1299, 1955, 13, 4706, 835, 13383, 2277, 29937, 13, 13, 4706, 396, 731, 4656, 10070, 1449, 304, 5225, 13, 4706, 748, 415, 326, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 437, 415, 326, 3950, 29889, 9171, 29918, 5105, 580, 13, 4706, 565, 330, 29918, 1590, 29918, 20640, 3950, 338, 451, 6213, 29901, 13, 9651, 330, 29918, 1590, 29918, 20640, 3950, 29889, 9171, 29918, 5105, 580, 13, 13, 4706, 1060, 29918, 29888, 1296, 353, 4559, 29898, 1885, 29892, 330, 29918, 29882, 1212, 29892, 2295, 29892, 260, 29892, 4742, 29897, 13, 4706, 25713, 353, 766, 29889, 11333, 29898, 29990, 29918, 29888, 1296, 29897, 13, 13, 4706, 396, 10272, 15299, 6410, 13, 4706, 3144, 2209, 353, 9581, 29918, 3952, 6774, 29889, 1885, 29918, 6758, 29898, 29888, 1296, 29892, 2295, 29889, 6758, 29918, 7692, 29897, 13, 13, 4706, 3144, 2209, 29889, 1627, 1328, 29898, 2267, 475, 29918, 4262, 29922, 28667, 29918, 1727, 29892, 1653, 29918, 4262, 29922, 28667, 29918, 1727, 322, 320, 13, 462, 462, 462, 965, 2295, 29889, 1627, 7728, 29918, 6008, 29897, 13, 13, 4706, 396, 10272, 11266, 1212, 1072, 6410, 322, 2329, 23655, 976, 3167, 1857, 953, 5824, 13, 4706, 565, 22235, 29918, 1727, 29901, 13, 9651, 565, 2295, 29889, 1217, 29918, 6914, 29874, 2813, 29901, 13, 18884, 270, 17458, 353, 6213, 13, 9651, 1683, 29901, 13, 18884, 270, 17458, 353, 1015, 10568, 29889, 28667, 29918, 4181, 29918, 3416, 29898, 1484, 415, 326, 3950, 29892, 13, 462, 462, 462, 2295, 29889, 1509, 29918, 5311, 29881, 29918, 3167, 29892, 301, 29878, 29922, 2917, 29889, 7099, 29918, 29212, 29892, 13, 462, 462, 462, 1439, 496, 29918, 6008, 29922, 1333, 2295, 29889, 1627, 7728, 29918, 6008, 29897, 13, 13, 9651, 3144, 2209, 29918, 1727, 353, 2295, 29889, 19080, 29918, 3571, 334, 298, 1727, 29889, 28667, 29918, 5878, 29918, 5182, 29918, 1727, 29898, 29887, 29918, 29882, 1212, 29892, 260, 29892, 13, 462, 462, 462, 462, 29871, 22525, 29922, 5182, 29879, 29918, 29954, 29892, 286, 1212, 29922, 1885, 29892, 270, 17458, 29922, 29881, 17458, 29892, 13, 462, 462, 462, 462, 29871, 270, 29911, 1590, 29879, 29922, 8516, 29897, 13, 9651, 3144, 2209, 29918, 1727, 29889, 1627, 1328, 580, 13, 4706, 1683, 29901, 13, 9651, 3144, 2209, 29918, 1727, 353, 29871, 29900, 13, 13, 4706, 396, 10272, 4656, 10070, 363, 15299, 322, 2125, 16030, 4331, 13, 4706, 748, 415, 326, 3950, 29889, 10568, 580, 13, 4706, 565, 330, 29918, 29882, 1212, 338, 451, 6213, 322, 451, 2295, 29889, 29881, 609, 29918, 14968, 29918, 19080, 29918, 17987, 29881, 886, 29901, 13, 9651, 330, 29918, 1590, 29918, 20640, 3950, 29889, 10568, 580, 13, 13, 4706, 396, 9249, 2133, 310, 1857, 6728, 297, 12489, 3377, 13, 4706, 565, 474, 1273, 2295, 29889, 5317, 29918, 5504, 29918, 24530, 1275, 29871, 29900, 322, 474, 1405, 29871, 29900, 322, 2295, 29889, 4294, 29918, 26762, 29901, 13, 9651, 565, 270, 29918, 17987, 8497, 29918, 18434, 338, 451, 6213, 29901, 13, 18884, 270, 29918, 17987, 8497, 29918, 7582, 353, 7442, 29889, 294, 2378, 29898, 29881, 29918, 17987, 8497, 29918, 18434, 29961, 29906, 29901, 2314, 13, 9651, 1683, 29901, 13, 18884, 270, 29918, 17987, 8497, 29918, 7582, 353, 6213, 13, 9651, 565, 330, 29918, 17987, 8497, 29918, 18434, 338, 451, 6213, 29901, 13, 18884, 330, 29918, 17987, 8497, 29918, 7582, 353, 7442, 29889, 294, 2378, 29898, 29887, 29918, 17987, 8497, 29918, 18434, 29961, 29906, 29901, 2314, 13, 9651, 1683, 29901, 13, 18884, 330, 29918, 17987, 8497, 29918, 7582, 353, 6213, 13, 9651, 903, 29894, 466, 29918, 26495, 29898, 29990, 29918, 6370, 29892, 1060, 29918, 29888, 1296, 29892, 330, 29918, 17987, 29881, 886, 29892, 270, 29918, 17987, 29881, 886, 29892, 13, 462, 3986, 330, 29918, 17987, 8497, 29918, 7582, 29892, 270, 29918, 17987, 8497, 29918, 7582, 29892, 13, 462, 3986, 9227, 29892, 474, 29892, 2295, 29892, 3611, 543, 14968, 29918, 1116, 27508, 718, 851, 29898, 29873, 876, 13, 13, 4706, 396, 5702, 777, 6694, 13964, 13, 4706, 9227, 29889, 1202, 29918, 19529, 279, 877, 14968, 29914, 1885, 29918, 6758, 29918, 29995, 29881, 29915, 1273, 313, 29873, 511, 3144, 2209, 718, 3144, 2209, 29918, 1727, 29892, 474, 29897, 13, 4706, 9227, 29889, 1202, 29918, 19529, 279, 877, 14968, 29914, 29881, 6758, 29918, 497, 29918, 29995, 29881, 29915, 1273, 313, 29873, 511, 270, 6758, 29892, 474, 29897, 13, 4706, 9227, 29889, 1202, 29918, 19529, 279, 877, 14968, 29914, 2218, 29918, 562, 2764, 4135, 29918, 29995, 29881, 29915, 1273, 313, 29873, 511, 13, 462, 3986, 9581, 29918, 3952, 6774, 29889, 562, 2764, 4135, 29898, 6370, 29892, 25713, 29892, 2295, 29889, 6758, 29918, 7692, 511, 474, 29897, 13, 4706, 565, 2295, 29889, 19080, 29918, 3571, 1405, 29871, 29900, 29901, 13, 9651, 9227, 29889, 1202, 29918, 19529, 279, 877, 14968, 29914, 29887, 29918, 29882, 1212, 29918, 6758, 29918, 1727, 29918, 29995, 29881, 29915, 1273, 313, 29873, 511, 3144, 2209, 29918, 1727, 29892, 474, 29897, 13, 9651, 9227, 29889, 1202, 29918, 19529, 279, 877, 14968, 29914, 29887, 29918, 6758, 29918, 6194, 29918, 29995, 29881, 29915, 1273, 313, 29873, 511, 3144, 2209, 29892, 474, 29897, 13, 13, 1678, 1243, 29898, 2218, 29892, 2531, 29892, 330, 29918, 29882, 1212, 29892, 4742, 29892, 2295, 29892, 9227, 29892, 2295, 29889, 29876, 29918, 1524, 29892, 260, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1596, 877, 11403, 376, 14968, 29918, 276, 1456, 29889, 2272, 1192, 276, 1456, 29918, 5696, 9581, 29908, 304, 7945, 263, 337, 1456, 402, 2190, 525, 718, 13, 3986, 525, 2541, 11266, 11618, 29879, 29889, 1495, 13, 2 ]
api/flags/migrations/0010_flaggingrule_excluded_values.py
django-doctor/lite-api
0
186849
# Generated by Django 2.2.16 on 2021-01-04 15:57 import django.contrib.postgres.fields from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("flags", "0009_auto_20201229_1454"), ] operations = [ migrations.AddField( model_name="flaggingrule", name="excluded_values", field=django.contrib.postgres.fields.ArrayField( base_field=models.TextField(default=""), default=list, size=None ), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29906, 29889, 29906, 29889, 29896, 29953, 373, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29896, 29899, 29900, 29946, 29871, 29896, 29945, 29901, 29945, 29955, 13, 13, 5215, 9557, 29889, 21570, 29889, 2490, 7201, 29889, 9621, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 4852, 15764, 613, 376, 29900, 29900, 29900, 29929, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29896, 29906, 29906, 29929, 29918, 29896, 29946, 29945, 29946, 4968, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 543, 15581, 3460, 7491, 613, 13, 9651, 1024, 543, 735, 13347, 29918, 5975, 613, 13, 9651, 1746, 29922, 14095, 29889, 21570, 29889, 2490, 7201, 29889, 9621, 29889, 2588, 3073, 29898, 13, 18884, 2967, 29918, 2671, 29922, 9794, 29889, 15778, 29898, 4381, 543, 4968, 2322, 29922, 1761, 29892, 2159, 29922, 8516, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
mat3json.py
tienhaophung/poseval
0
30763
<gh_stars>0 import os # import json from scipy.io import loadmat import argparse import mat4py import h5py import json_tricks as json parser = argparse.ArgumentParser(description="Convert .mat to .json file") parser.add_argument("-ddir", "--data_dir", type=str, default="", help="Data directory of .mat files") args = parser.parse_args() def list_dir(data_dir, allowed_extensions=['.mat']): """ List files in directory Args: data_dir: data directory allowed_extensions: File extensions were accepted Returns: file_paths: list of files """ file_paths = [] # anot_paths = [] # List files in data_dir for root, dirs, files in os.walk(data_dir): # print(root, dirs, files) for file in files: filename, extension = os.path.splitext(file) if extension in allowed_extensions: file_paths.append(os.path.join(root, file)) # print(file_paths) return file_paths def makedir(path): try: os.makedirs(path, exist_ok=True) print("Directory %s created successfully!" %path) except OSError: print("Directory %s failed to create!" %path) def main(args): paths = list_dir(args.data_dir) for path in paths: print(path) x = loadmat(path) # load mat file # x = h5py.File(path, 'r') # tables.openFile(path) # x = mat4py.loadmat(path) print(x["annolist"]["annorect"]) json_fn = os.path.splitext(path)[0] + ".json" with open(json_fn, 'wt') as json_f: json.dump(x, json_f) # break if __name__ == "__main__": main(args)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 2897, 13, 29937, 1053, 4390, 13, 3166, 4560, 2272, 29889, 601, 1053, 2254, 2922, 13, 5215, 1852, 5510, 13, 5215, 1775, 29946, 2272, 13, 5215, 298, 29945, 2272, 13, 5215, 4390, 29918, 509, 7358, 408, 4390, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 543, 18455, 869, 2922, 304, 869, 3126, 934, 1159, 13, 16680, 29889, 1202, 29918, 23516, 703, 29899, 1289, 381, 613, 376, 489, 1272, 29918, 3972, 613, 1134, 29922, 710, 29892, 2322, 543, 613, 13, 462, 1678, 1371, 543, 1469, 3884, 310, 869, 2922, 2066, 1159, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1753, 1051, 29918, 3972, 29898, 1272, 29918, 3972, 29892, 6068, 29918, 24299, 29922, 1839, 29889, 2922, 2033, 1125, 13, 1678, 9995, 13, 1678, 2391, 2066, 297, 3884, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 848, 29918, 3972, 29901, 848, 3884, 13, 4706, 6068, 29918, 24299, 29901, 3497, 17752, 892, 9259, 13, 13, 1678, 16969, 29901, 13, 4706, 934, 29918, 24772, 29901, 1051, 310, 2066, 13, 1678, 9995, 13, 1678, 934, 29918, 24772, 353, 5159, 13, 1678, 396, 385, 327, 29918, 24772, 353, 5159, 13, 1678, 396, 2391, 2066, 297, 848, 29918, 3972, 13, 1678, 363, 3876, 29892, 4516, 29879, 29892, 2066, 297, 2897, 29889, 20919, 29898, 1272, 29918, 3972, 1125, 13, 4706, 396, 1596, 29898, 4632, 29892, 4516, 29879, 29892, 2066, 29897, 13, 4706, 363, 934, 297, 2066, 29901, 13, 9651, 10422, 29892, 6081, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 1445, 29897, 13, 9651, 565, 6081, 297, 6068, 29918, 24299, 29901, 13, 18884, 934, 29918, 24772, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 29898, 4632, 29892, 934, 876, 13, 268, 13, 1678, 396, 1596, 29898, 1445, 29918, 24772, 29897, 13, 1678, 736, 934, 29918, 24772, 13, 13, 1753, 2136, 287, 381, 29898, 2084, 1125, 13, 1678, 1018, 29901, 13, 4706, 2897, 29889, 29885, 12535, 12935, 29898, 2084, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 4706, 1596, 703, 9882, 1273, 29879, 2825, 8472, 3850, 1273, 2084, 29897, 13, 1678, 5174, 438, 29173, 29901, 13, 4706, 1596, 703, 9882, 1273, 29879, 5229, 304, 1653, 3850, 1273, 2084, 29897, 13, 13, 1753, 1667, 29898, 5085, 1125, 13, 1678, 10898, 353, 1051, 29918, 3972, 29898, 5085, 29889, 1272, 29918, 3972, 29897, 13, 13, 1678, 363, 2224, 297, 10898, 29901, 13, 4706, 1596, 29898, 2084, 29897, 13, 4706, 921, 353, 2254, 2922, 29898, 2084, 29897, 29871, 396, 2254, 1775, 934, 13, 4706, 396, 921, 353, 298, 29945, 2272, 29889, 2283, 29898, 2084, 29892, 525, 29878, 1495, 13, 4706, 396, 6131, 29889, 3150, 2283, 29898, 2084, 29897, 13, 4706, 396, 921, 353, 1775, 29946, 2272, 29889, 1359, 2922, 29898, 2084, 29897, 13, 4706, 1596, 29898, 29916, 3366, 812, 324, 391, 3108, 3366, 812, 487, 312, 20068, 13, 4706, 4390, 29918, 9144, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 2084, 9601, 29900, 29962, 718, 11393, 3126, 29908, 13, 4706, 411, 1722, 29898, 3126, 29918, 9144, 29892, 525, 14554, 1495, 408, 4390, 29918, 29888, 29901, 13, 9651, 4390, 29889, 15070, 29898, 29916, 29892, 4390, 29918, 29888, 29897, 13, 4706, 396, 2867, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 29898, 5085, 29897, 13, 13, 2 ]
code/char_histo.py
tumuum/prog-book
0
177149
""" In this problem, we need a structure to store which character occurs how many times. It is best to use a dict object; but here we will use only lists. We will keep counts in a list of two element lists. For example: [["a",3],["b",5],["z",3]] """ def add_char(store,char): """add a character to the count store""" already_there = False for x in store: if x[0] == char: x[1] = x[1] + 1 already_there = True if not already_there: store.append([char,1]) def draw_histo(store): for x in store: print(x[0],x[1]*'*') input = input("Give me a string: ") count_store = [] for x in input: add_char(count_store,x) draw_histo(count_store)
[ 1, 9995, 13, 797, 445, 1108, 29892, 591, 817, 263, 3829, 304, 3787, 607, 2931, 10008, 920, 1784, 13, 3706, 29889, 739, 338, 1900, 304, 671, 263, 9657, 1203, 29936, 541, 1244, 591, 674, 671, 871, 8857, 29889, 1334, 674, 13, 17462, 18139, 297, 263, 1051, 310, 1023, 1543, 8857, 29889, 1152, 1342, 29901, 29871, 13, 13, 29961, 3366, 29874, 613, 29941, 1402, 3366, 29890, 613, 29945, 1402, 3366, 29920, 613, 29941, 5262, 29871, 13, 13, 15945, 29908, 13, 13, 1753, 788, 29918, 3090, 29898, 8899, 29892, 3090, 1125, 13, 12, 15945, 29908, 1202, 263, 2931, 304, 278, 2302, 3787, 15945, 29908, 12, 13, 12, 284, 2040, 29918, 12711, 353, 7700, 13, 13, 12, 1454, 921, 297, 3787, 29901, 13, 12, 12, 361, 921, 29961, 29900, 29962, 1275, 1373, 29901, 13, 12, 12, 12, 29916, 29961, 29896, 29962, 353, 921, 29961, 29896, 29962, 718, 29871, 29896, 13, 12, 12, 12, 284, 2040, 29918, 12711, 353, 5852, 13, 13, 12, 361, 451, 2307, 29918, 12711, 29901, 13, 12, 12, 8899, 29889, 4397, 4197, 3090, 29892, 29896, 2314, 13, 13, 13, 1753, 4216, 29918, 29882, 5137, 29898, 8899, 1125, 13, 12, 1454, 921, 297, 3787, 29901, 13, 12, 12, 2158, 29898, 29916, 29961, 29900, 1402, 29916, 29961, 29896, 14178, 29915, 29930, 1495, 13, 13, 2080, 353, 1881, 703, 29954, 573, 592, 263, 1347, 29901, 16521, 13, 13, 2798, 29918, 8899, 353, 5159, 13, 13, 1454, 921, 297, 1881, 29901, 13, 12, 1202, 29918, 3090, 29898, 2798, 29918, 8899, 29892, 29916, 29897, 13, 13, 13, 4012, 29918, 29882, 5137, 29898, 2798, 29918, 8899, 29897, 13, 2 ]
lists/stocks.py
migueldv90/stock-analysis
0
108846
<filename>lists/stocks.py tickers = [ 'aapl', 'tsla', ]
[ 1, 529, 9507, 29958, 21513, 29914, 17712, 29879, 29889, 2272, 13, 24667, 414, 353, 518, 13, 1678, 525, 29874, 481, 29880, 742, 13, 1678, 525, 1372, 433, 742, 13, 29962, 13, 2 ]
src/decode_data.py
andersberliner/decoder-ring
2
123867
<reponame>andersberliner/decoder-ring """ Module to decode byte-stream """ import os import pandas as pd import numpy as np from copy import deepcopy from warnings import warn # Relative imports from .lib import DATA_TYPES, DecoderRingError, cast_from_bytes, get_nbytes, get_filesize # Number of bytes in the packet PACKET_LENGTH = 21 FILLED_BYTE = "-" FILLED_KNOWN_BYTE = "." WASTED_BYTE = "*" # Portions of the packet map we know thus far KNOWNS = { 0: { "dtype": "uint8le", "label": "start", }, 1: { "dtype": "uint32le", "label": "dpt", }, 13: { "dtype": "int32le", "label": "cur", "factor": 1000 * 100, # 0.01 mA precision }, } DPT_INDEX = 1 class DataDecoder(object): """Class for decoding a binary file.""" def __init__(self, filepath, ndpts=4, dtypes=None, starting_bytes=None, packet_length=PACKET_LENGTH, knowns=KNOWNS, dpt_index=DPT_INDEX): """Initializes the DataDecoder object, including seeding the data.""" self._packet_length = packet_length self._knowns = knowns if knowns is not None else {} self._dpt_idx = dpt_index self._filepath = filepath self._filename = os.path.split(filepath)[1] self._total_bytes = get_filesize(self._filepath) # Seed the last four datapoints. self._seed_df = seed_data( filepath, ndpts=ndpts, dtypes=dtypes, starting_bytes=starting_bytes, packet_length=packet_length, knowns=knowns ) # Determine the maximum number of data-points in the file. self._max_dpts = None if (dpt_index is not None) and (dpt_index in self._knowns): sbyte, dtype, n, _ = self._seed_df.index.min() self._max_dpts = self._seed_df.loc[sbyte, dtype, 1, dpt_index].iloc[0] # Find the known labels self._known_labels = {byte_dict["label"]: byte_idx for byte_idx, byte_dict in self._knowns.items()} def decode_byte_idx(self, byte_idx=None, dtype=None, label=None, dpts=None): """Decodes all data in the file at specified byte in specified datatype. If `label` is specified and in the knowns, get the byte_idx and dtype from the knowns dict. Otherwise, `byte_idx` and `dtype` must be specified. If `dpts` is specified, will override the found maximum datapoints during init. Parameters ---------- byte_idx : int dtype : str label : str dpts : int, optional Returns ------- decoded_data : list of various Array of decoded data. Raises ------ DecoderRingError : for invalid arguments """ decoded_data = [] factor = 1.0 if label in self._known_labels: byte_idx = self._known_labels[label] dtype = self._knowns[byte_idx]["dtype"] factor = self._knowns[byte_idx].get("factor", 1.0) if byte_idx is None: raise DecoderRingError("A label in the knowns or byte_idx must be specified.") if dtype is None: raise DecoderRingError("A label in the knowns or dtype must be specified.") if dpts is None: dpts = self._max_dpts if dpts is None: raise DecoderRingError("Dpt must be in the knowns or dpts must be specified.") with open(self._filepath, "rb") as f: for i, n in enumerate(range(1, dpts + 1)[::-1]): if i == 0: f.seek(self._total_bytes - dpts * self._packet_length) packet = f.read(self._packet_length) decoded_data.append(decode_bytes(packet, byte_idx, dtype) / factor) return decoded_data def decode_knowns(self, csv_file=None, dpts=None): """Decode all known portions of the file and return as dataframe. If a csv_file is provided, add those columns, too. Parameters ---------- csv_file : str or None. Path to csv_file containing the 'actual' data. dpts : int, optional Specify number of datapoints to parse. If not specified, dpt must be specified in the knowns and will be used to determine who many bytes back to parse. Returns ------- out_df : pd.DataFrame Raises ------ DecoderRingError : for invalid arguments """ data = [] if dpts is None: dpts = self._max_dpts if dpts is None: raise DecoderRingError("Dpt must be in the knowns or dpts must be specified.") with open(self._filepath, "rb") as f: for i, n in enumerate(range(1, dpts + 1)[::-1]): if i == 0: f.seek(self._total_bytes - dpts * self._packet_length) # Get position of the first data-point packet = f.read(self._packet_length) dpt_data = {} for byte_idx, byte_dict in self._knowns.items(): dpt_data[byte_dict["label"]] = decode_bytes( packet, byte_idx, byte_dict["dtype"] ) / byte_dict.get("factor", 1) data.append(dpt_data) knowns_df = pd.DataFrame(data) csv_df = pd.DataFrame() if csv_file is not None: csv_df = pd.read_csv(csv_file) # If csv data is present, merge files together if not csv_df.empty: out_df = csv_df.copy() for label in knowns_df: out_df["{}_decoded".format(label)] = knowns_df[label] else: out_df = knowns_df return out_df def view_byte_idx(self, byte_idx, starting_byte, dtypes=None): """Returns view of byte at position `byte_idx` in data types `dtypes`. Data in packets start from posn `starting_byte`. Parameters ---------- seed_df : pd.DataFrame Output of seed_data byte_idx : int Index of byte to view starting_byte : int Position bytes where decoded from (in whichever data-type). Bytes before this position are assumed to be "start bytes". dtypes : list of str, optional Data-types to show decoded values for. Returns ------- view_df : pd.DataFrame See Also -------- view_byte_idx """ return view_byte_idx(self._seed_df, byte_idx, starting_byte, dtypes=dtypes) def view_dtypes(self, starting_byte, dtypes): """Returns a view of parsed data for a given starting byte and dtypes. Fills all possible values, starting at `starting_byte`, with each of the provided datatypes `dtypes`. Parameters ---------- seed_df : pd.DataFrame Output of `seed_data`. Must have been seeded with the provided `dtypes` and `starting_byte`. starting_byte : int dtypes : list of str Datatype keys. See `lib.DATA_TYPES` for supported data types. Returns ------- view_df : pd.DataFrame Raises ------ DecoderRingError : for `starting_byte` or `dtypes` not seeded in `self._seed_df`. Notes ----- Since `self._seed_df` will reflect the `knowns` you used when seeding, known bytes will not be re-parsed. See Also -------- view_byte_idx """ return view_dtypes(self._seed_df, starting_byte, dtypes) def __repr__(self): """String representation of the DataDecoder.""" return "<DataDecoder>: {}".format(self._filepath) def summary(self): """Returns a well-formatted summary of this DataDecoder.""" output = [ "Packet Length: {}".format(self._packet_length), "Total Bytes: {}".format(self._total_bytes), "Dpt Idx: {}".format(self._dpt_idx), "Max Dpts: {}".format(self._max_dpts), "Knowns: {}".format(self._known_labels), ] return "<DataDecoder: {}\n\t{}".format(self._filepath, "\n\t".join(output)) def seed_data(filepath, ndpts, dtypes=None, starting_bytes=None, packet_length=PACKET_LENGTH, knowns=KNOWNS): """Returns dataframe, indexed by byte position, of each byte interpretted as different data types. Parameters ---------- filepath : str Path to file to parse ndpts : int Number of datapoints from the end of the file to parse. starting_bytes : list of int or None Position to start parsing bytes from packet_length : int Number of bytes in each packet knowns : dict Portions of the byte map that are known. Key is starting byte idx. Value is a dict containing, at least: "dtype" : str Datatype bytes should be parsed as "label" : str Column label for the data. Returns ------- seed_df : pd.DataFrame """ if dtypes is None: dtypes = list(DATA_TYPES) if starting_bytes is None: starting_bytes = range(0, packet_length) if knowns is None: knowns = {} data = [] with open(filepath, "rb") as f: for i, n in enumerate(range(1, ndpts + 1)[::-1]): if i == 0: f.seek(get_filesize(filepath) - ndpts * packet_length) # Select current packet # packet = get_packet(byte_stream, n, packet_length=packet_length) packet = f.read(packet_length) known_data = fill_known_bytes(packet, knowns, packet_length=packet_length) for dtype in dtypes: nbytes = get_nbytes(dtype) for starting_byte in starting_bytes: # Parse values tmp_df = pd.DataFrame( decode_packet( packet, dtype, starting_byte, packet_length, knowns=knowns, known_data=known_data ) ).T # Add labels tmp_df["sbyte"] = starting_byte tmp_df["n"] = n tmp_df["dtype"] = dtype data.append(tmp_df) df = pd.concat(data) df.index.name = "idx" # Re-index for more efficient decoding later return df.reset_index().set_index(["sbyte", "dtype", "n", "idx"]).fillna("") def view_byte_idx(seed_df, byte_idx, starting_byte, dtypes=None): """Returns view of byte at position `byte_idx` in data type `dtypes`. Data in packets start from posn `starting_byte`. Parameters ---------- seed_df : pd.DataFrame Output of seed_data byte_idx : int Index of byte to view starting_byte : int Position bytes where decoded from (in whichever data-type). Bytes before this position are assumed to be "start bytes". dtypes : list of str, optional Data-types to show decoded values for. Returns ------- view_df : pd.DataFrame """ if dtypes is None: dtypes = seed_df.index.get_level_values("dtype").unique() return seed_df.loc[pd.IndexSlice[starting_byte, dtypes, :, byte_idx], :]\ .reset_index()\ .pivot(index="dtype", columns="n", values="val")\ .T[dtypes]\ .sort_index(ascending=False) def view_dtypes(seed_df, starting_byte, dtypes): """Returns a view of parsed data for a given starting byte and dtypes. Fills all possible values, starting at `starting_byte`, with each of the provided datatypes `dtypes`. Parameters ---------- seed_df : pd.DataFrame Output of `seed_data`. Must have been seeded with the provided `dtypes` and `starting_byte`. starting_byte : int dtypes : list of str Datatype keys. See `lib.DATA_TYPES` for supported data types. Returns ------- view_df : pd.DataFrame Raises ------ DecoderRingError : for `starting_byte` or `dtypes` not seeded in `seed_df`. Notes ----- Since `seed_df` will reflect the `knowns` you used when seeding, known bytes will not be re-parsed. See Also -------- view_byte_idx """ ndpts = seed_df.index.get_level_values("n").max() # Validate inputs if starting_byte not in seed_df.index.get_level_values("sbyte").unique(): raise DecoderRingError( ( "Invalid starting_byte {}; this starting_byte was not seeded." ).format(starting_byte) ) invalid_dtypes = set(dtypes).difference( seed_df.index.get_level_values("dtype").unique()) if invalid_dtypes: raise DecoderRingError( ( "Invalid dtype(s) {}; these dtypes were not seeded." ).format(dtypes) ) # Create composite column names and see data. df = seed_df.loc[starting_byte] dtype_dfs = [] for i, dtype in enumerate(dtypes): # dtype_data = df[df["dtype"] == dtype] dtype_data = df.loc[dtype] for n in range(1, ndpts + 1)[::-1]: # tmp_df = dtype_data[dtype_data["n"] == n] tmp_df = dtype_data.loc[n] # Add label column on first iteration if i == 0 and n == ndpts: out_df = tmp_df["label"].to_frame().copy() out_df["{}-{}".format(dtype, n)] = tmp_df["val"] # The following is in progress and may provide a better view. # return seed_df.loc[pd.IndexSlice[starting_byte, :, dtypes], :].sort_index(level=["dtype", "n"]).T return out_df def decode_packet(packet, dtype, starting_byte, packet_length=PACKET_LENGTH, knowns=KNOWNS, known_data=None): """Decodes the bytes in `packet`, converting to `dtype`. If byte(s) are assigned to `knowns`, uses the specified data types for those bytes (instead of `dtype`). Denotes bytes that can not be used for the specified data type with '*'. For data types requiring multiple bytes, decoded value is in the first byte and the remaining required bytes are deonted as being filled with '-' or '.'. Parameters ---------- filepath : str Path to file to parse ndpts : int Number of datapoints from the end of the file to parse. starting_bytes : list of int or None Position to start parsing bytes from packet_length : int Number of bytes in each packet knowns : dict Portions of the byte map that are known. Key is starting byte idx. Value is a dict containing, at least: "dtype" : str Datatype bytes should be parsed as "label" : str Column label for the data. Returns ------- packet_df : dict Data from `packet` decoded into `dtype` (or knowns). Byte idx => {label: label (str), val: val (various)} """ nbytes = get_nbytes(dtype) if known_data is None: data = fill_known_bytes(packet, knowns, packet_length=packet_length) else: data = deepcopy(known_data) # Handle already populated bytes or reservered/wasted bytes. known_bytes = _get_known_bytes(knowns) first_bytes = _get_first_bytes(starting_byte, nbytes, packet_length=packet_length) wasted_bytes = _get_wasted_bytes(starting_byte, nbytes, knowns, packet_length=packet_length, known_bytes=known_bytes, first_bytes=first_bytes) filled_bytes = _get_filled_bytes(starting_byte, nbytes, knowns, packet_length=packet_length, known_bytes=known_bytes, first_bytes=first_bytes, wasted_bytes=wasted_bytes) # Populate filler bytes for byte_idx in wasted_bytes: data[byte_idx] = {"val": WASTED_BYTE} for byte_idx in filled_bytes: data[byte_idx] = {"val": FILLED_BYTE} # Parse available values for byte_idx in first_bytes: if byte_idx in filled_bytes: data[byte_idx] = { "val": decode_bytes(packet, byte_idx, dtype), "label": FILLED_BYTE } return data def fill_known_bytes(packet, knowns, packet_length=PACKET_LENGTH): """Returns a byte dictionary (pos=> {val, label}) for known bytes. Parameters ---------- packet : byte str knowns : dict Portions of the byte map that are known. Key is starting byte idx. Value is a dict containing, at least: "dtype" : str Datatype bytes should be parsed as "label" : str Column label for the data. packet_length : int Number of bytes in each packet Returns ------- byte_vals_dict : dict Byte_idx to dict of: {"val": value in appropriate type, "label": column label} """ if knowns is None: knowns = {} decoded_packet = {i: {"val": None, "label": None} for i in range(packet_length)} for i, byte_dict in knowns.items(): dtype = byte_dict["dtype"] label = byte_dict["label"] decoded_packet[i] = {"val": decode_bytes(packet, i, dtype), "label": label} for j in range(i + 1, i + get_nbytes(dtype)): decoded_packet[j] = {"val": FILLED_KNOWN_BYTE, "label": label} return decoded_packet def _get_known_bytes(knowns, packet_length=PACKET_LENGTH): """Returns list of byte indexes containing known values. Parameters ---------- knowns : dict Portions of the byte map that are known. Key is starting byte idx. Value is a dict containing, at least: "dtype" : str Datatype bytes should be parsed as "label" : str Column label for the data. packet_length : int Number of bytes in each packet. Returns ------- known_bytes : list of int Index of bytes populated by 'known' values. """ if knowns is None: knowns = {} known_bytes = [] for known, known_dict in knowns.items(): nbytes = get_nbytes(known_dict["dtype"]) known_bytes.extend(range(known, known + nbytes)) return known_bytes def _get_wasted_bytes(starting_byte, nbytes, knowns, packet_length=PACKET_LENGTH, known_bytes=None, first_bytes=None): """Returns list of byte indexes that are wasted when filling bytes. Parameters ---------- starting_byte : int Position bytes where decoded from (in whichever data-type). Bytes before this position are assumed to be "start bytes". nbytes : int Number of bytes required to parsed into data-type. packet_length : int Number of bytes in each packet. known_bytes : list of int, optional Output of `_get_known_bytes`. Will be computed if not provided. first_bytes : list of int, optional Output of `_get_first_bytes`. Will be computed if not provided. Returns ------- wasted_bytes : list of int Index of bytes wasted (i.e. can not be filled) given `knowns`, `nbytes` and `starting_byte`. """ wasted_bytes = [] if known_bytes is None: known_bytes = _get_known_bytes(knowns=knowns, packet_length=packet_length) if first_bytes is None: first_bytes = _get_first_bytes(starting_byte, nbytes, packet_length=packet_length) # Find collision with known bytes and/or the end of the packet for first_byte in first_bytes: bytes_to_fill = np.arange(first_byte, first_byte + nbytes) waste = bytes_to_fill[np.in1d(bytes_to_fill, known_bytes)] if waste.any(): wasted_bytes.extend([ x for x in bytes_to_fill[~np.in1d(bytes_to_fill, known_bytes)] if x not in knowns and x < packet_length ]) return sorted(list(set(wasted_bytes))) def _get_filled_bytes(starting_byte, nbytes, knowns, packet_length=PACKET_LENGTH, known_bytes=None, first_bytes=None, wasted_bytes=None): """Returns list of byte indexes filled by new values. Parameters ---------- starting_byte : int Position bytes where decoded from (in whichever data-type). Bytes before this position are assumed to be "start bytes". nbytes : int Number of bytes required to parsed into data-type. packet_length : int Number of bytes in each packet. known_bytes : list of int, optional Output of `_get_known_bytes`. Will be computed if not provided. first_bytes : list of int, optional Output of `_get_first_bytes`. Will be computed if not provided. wasted_bytes : list of int, optional Output of `_get_wasted_bytes`. Will be computed if not provided. Returns ------- filled_bytes : list of int Index of bytes to be filled by decoding as data of `nbytes`. """ filled_bytes = [] if known_bytes is None: known_bytes = _get_known_bytes(knowns=knowns, packet_length=packet_length) if first_bytes is None: first_bytes = _get_first_bytes(starting_byte, nbytes, packet_length=packet_length) if wasted_bytes is None: wasted_bytes = _get_wasted_bytes(starting_byte, nbytes, knowns, packet_length=packet_length, known_bytes=known_bytes, first_bytes=first_bytes) for first_byte in first_bytes: if first_byte not in known_bytes and first_byte not in wasted_bytes: filled_bytes.extend(range(first_byte, first_byte + nbytes)) return filled_bytes def _get_first_bytes(starting_byte, nbytes, packet_length=PACKET_LENGTH): """Returns list of bytes that values can start on in the packet. Parameters ---------- starting_byte : int Position bytes where decoded from (in whichever data-type). Bytes before this position are assumed to be "start bytes". nbytes : int Number of bytes required to parsed into data-type. packet_length : int Number of bytes in each packet. Returns ------- first_bytes : list of int Index of starting bytes for a packet of length `packet_length` starting at byte `starting_byte` where each value is `nbytes` bytes in length. """ return list(range(starting_byte, packet_length, nbytes)) def get_packet(byte_stream, n, packet_length=PACKET_LENGTH): """Returns the bytes from the nth from the end data-packet. Parameters ---------- byte_stream : byte str n : int Ordinal from the end datapoints (e.g. 1 is the "last"). packet_length : int Number of bytes in a data-packet. Returns ------- packet : byte str Notes ----- This method is deprecated. All consumers no work from a filestream to alleviate memory concerns. """ warn( ( "This method is deprecated as it requires the full byte-stream." " See less memory intensive implementations in, e.g., seed_data." ), DeprecationWarning, stacklevel=2 ) if n == 1: return byte_stream[-packet_length:] return byte_stream[-packet_length * n : -packet_length * (n - 1)] def decode_bytes(packet, byte_idx, dtype): """Reads the `byte_idx` byte of `packet` as type `dtype`. Parameters ---------- packet : byte str Bytes from one datapoint (one data-packet) byte_idx : int Index of byte to read (i.e. 0 is the "first") dtype : str Code indicating data-type to parse bytes as; must be a key in `DATA_TYPES` (associated with valid numpy type). Returns ------- val : int or None Integer value of decoded bytes. None if too-few bytes remain in packet to parse as provided `dtype`. """ nbytes = get_nbytes(dtype) sub_bytes = packet[byte_idx: byte_idx + nbytes] # Not enough bytes to finish if len(sub_bytes) < nbytes: return None return cast_from_bytes(sub_bytes, dtype)
[ 1, 529, 276, 1112, 420, 29958, 392, 414, 495, 1915, 261, 29914, 7099, 6119, 29899, 5393, 13, 15945, 29908, 13, 7355, 304, 21822, 7023, 29899, 5461, 13, 15945, 29908, 13, 5215, 2897, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 3509, 1053, 6483, 8552, 13, 3166, 18116, 1053, 29383, 13, 13, 29937, 6376, 1230, 24802, 13, 3166, 869, 1982, 1053, 360, 8254, 29918, 15631, 29925, 2890, 29892, 3826, 6119, 29934, 292, 2392, 29892, 4320, 29918, 3166, 29918, 13193, 29892, 679, 29918, 29876, 13193, 29892, 679, 29918, 5325, 675, 13, 13, 29937, 9681, 310, 6262, 297, 278, 18203, 13, 29925, 11375, 2544, 29918, 19433, 353, 29871, 29906, 29896, 13, 3738, 29931, 20566, 29918, 22716, 4330, 353, 11663, 29908, 13, 3738, 29931, 20566, 29918, 29968, 6632, 16048, 29918, 22716, 4330, 353, 376, 1213, 13, 12982, 1254, 3352, 29918, 22716, 4330, 353, 376, 20605, 13, 13, 29937, 3371, 1080, 310, 278, 18203, 2910, 591, 1073, 4550, 2215, 13, 29968, 6632, 29956, 3059, 353, 426, 13, 268, 29900, 29901, 426, 13, 4706, 376, 29881, 1853, 1115, 376, 13470, 29947, 280, 613, 13, 4706, 376, 1643, 1115, 376, 2962, 613, 13, 1678, 2981, 13, 268, 29896, 29901, 426, 13, 4706, 376, 29881, 1853, 1115, 376, 13470, 29941, 29906, 280, 613, 13, 4706, 376, 1643, 1115, 376, 29881, 415, 613, 13, 1678, 2981, 13, 268, 29896, 29941, 29901, 426, 13, 4706, 376, 29881, 1853, 1115, 376, 524, 29941, 29906, 280, 613, 13, 4706, 376, 1643, 1115, 376, 2764, 613, 13, 4706, 376, 19790, 1115, 29871, 29896, 29900, 29900, 29900, 334, 29871, 29896, 29900, 29900, 29892, 396, 29871, 29900, 29889, 29900, 29896, 286, 29909, 16716, 13, 1678, 2981, 13, 29913, 13, 13, 29928, 7982, 29918, 27992, 353, 29871, 29896, 13, 13, 13, 1990, 3630, 6185, 6119, 29898, 3318, 1125, 13, 1678, 9995, 2385, 363, 1602, 3689, 263, 7581, 934, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 2084, 29892, 29871, 299, 16485, 29922, 29946, 29892, 270, 8768, 29922, 8516, 29892, 6257, 29918, 13193, 29922, 8516, 29892, 13, 9651, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 29892, 2998, 29879, 29922, 29968, 6632, 29956, 3059, 29892, 270, 415, 29918, 2248, 29922, 29928, 7982, 29918, 27992, 1125, 13, 4706, 9995, 15514, 7093, 278, 3630, 6185, 6119, 1203, 29892, 3704, 16717, 292, 278, 848, 1213, 15945, 13, 4706, 1583, 3032, 4058, 300, 29918, 2848, 353, 18203, 29918, 2848, 13, 4706, 1583, 3032, 5203, 29879, 353, 2998, 29879, 565, 2998, 29879, 338, 451, 6213, 1683, 6571, 13, 4706, 1583, 3032, 29881, 415, 29918, 13140, 353, 270, 415, 29918, 2248, 13, 4706, 1583, 3032, 1445, 2084, 353, 934, 2084, 13, 4706, 1583, 3032, 9507, 353, 2897, 29889, 2084, 29889, 5451, 29898, 1445, 2084, 9601, 29896, 29962, 13, 4706, 1583, 3032, 7827, 29918, 13193, 353, 679, 29918, 5325, 675, 29898, 1311, 3032, 1445, 2084, 29897, 13, 13, 4706, 396, 922, 287, 278, 1833, 3023, 1418, 481, 2461, 29879, 29889, 13, 4706, 1583, 3032, 26776, 29918, 2176, 353, 16717, 29918, 1272, 29898, 13, 9651, 934, 2084, 29892, 13, 632, 299, 16485, 29922, 299, 16485, 29892, 13, 9651, 270, 8768, 29922, 29881, 8768, 29892, 13, 9651, 6257, 29918, 13193, 29922, 2962, 292, 29918, 13193, 29892, 13, 9651, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29892, 13, 9651, 2998, 29879, 29922, 5203, 29879, 13, 4706, 1723, 13, 13, 4706, 396, 5953, 837, 457, 278, 7472, 1353, 310, 848, 29899, 9748, 297, 278, 934, 29889, 13, 4706, 1583, 3032, 3317, 29918, 29881, 16485, 353, 6213, 13, 4706, 565, 313, 29881, 415, 29918, 2248, 338, 451, 6213, 29897, 322, 313, 29881, 415, 29918, 2248, 297, 1583, 3032, 5203, 29879, 1125, 13, 9651, 269, 10389, 29892, 26688, 29892, 302, 29892, 903, 353, 1583, 3032, 26776, 29918, 2176, 29889, 2248, 29889, 1195, 580, 13, 9651, 1583, 3032, 3317, 29918, 29881, 16485, 353, 1583, 3032, 26776, 29918, 2176, 29889, 2029, 29961, 29879, 10389, 29892, 26688, 29892, 29871, 29896, 29892, 270, 415, 29918, 2248, 1822, 309, 542, 29961, 29900, 29962, 13, 13, 4706, 396, 10987, 278, 2998, 11073, 13, 4706, 1583, 3032, 5203, 29918, 21134, 353, 426, 10389, 29918, 8977, 3366, 1643, 3108, 29901, 7023, 29918, 13140, 363, 13, 18884, 7023, 29918, 13140, 29892, 7023, 29918, 8977, 297, 1583, 3032, 5203, 29879, 29889, 7076, 28296, 13, 13, 1678, 822, 21822, 29918, 10389, 29918, 13140, 29898, 1311, 29892, 7023, 29918, 13140, 29922, 8516, 29892, 26688, 29922, 8516, 29892, 3858, 29922, 8516, 29892, 270, 16485, 29922, 8516, 1125, 13, 4706, 9995, 6185, 2631, 599, 848, 297, 278, 934, 472, 6790, 7023, 297, 6790, 1418, 23179, 29889, 13, 13, 4706, 960, 421, 1643, 29952, 338, 6790, 322, 297, 278, 2998, 29879, 29892, 679, 278, 7023, 29918, 13140, 322, 26688, 13, 4706, 515, 278, 2998, 29879, 9657, 29889, 29871, 13466, 29892, 421, 10389, 29918, 13140, 29952, 322, 421, 29881, 1853, 29952, 1818, 367, 13, 4706, 6790, 29889, 13, 13, 4706, 960, 421, 29881, 16485, 29952, 338, 6790, 29892, 674, 5712, 278, 1476, 7472, 1418, 481, 2461, 29879, 13, 4706, 2645, 2069, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 7023, 29918, 13140, 584, 938, 13, 4706, 26688, 584, 851, 13, 4706, 3858, 584, 851, 13, 4706, 270, 16485, 584, 938, 29892, 13136, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1602, 6797, 29918, 1272, 584, 1051, 310, 5164, 13, 9651, 4398, 310, 1602, 6797, 848, 29889, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 3826, 6119, 29934, 292, 2392, 584, 363, 8340, 6273, 13, 4706, 9995, 13, 4706, 1602, 6797, 29918, 1272, 353, 5159, 13, 13, 4706, 7329, 353, 29871, 29896, 29889, 29900, 13, 4706, 565, 3858, 297, 1583, 3032, 5203, 29918, 21134, 29901, 13, 9651, 7023, 29918, 13140, 353, 1583, 3032, 5203, 29918, 21134, 29961, 1643, 29962, 13, 9651, 26688, 353, 1583, 3032, 5203, 29879, 29961, 10389, 29918, 13140, 29962, 3366, 29881, 1853, 3108, 13, 9651, 7329, 353, 1583, 3032, 5203, 29879, 29961, 10389, 29918, 13140, 1822, 657, 703, 19790, 613, 29871, 29896, 29889, 29900, 29897, 13, 13, 4706, 565, 7023, 29918, 13140, 338, 6213, 29901, 13, 9651, 12020, 3826, 6119, 29934, 292, 2392, 703, 29909, 3858, 297, 278, 2998, 29879, 470, 7023, 29918, 13140, 1818, 367, 6790, 23157, 13, 13, 4706, 565, 26688, 338, 6213, 29901, 13, 9651, 12020, 3826, 6119, 29934, 292, 2392, 703, 29909, 3858, 297, 278, 2998, 29879, 470, 26688, 1818, 367, 6790, 23157, 13, 13, 4706, 565, 270, 16485, 338, 6213, 29901, 13, 9651, 270, 16485, 353, 1583, 3032, 3317, 29918, 29881, 16485, 13, 13, 4706, 565, 270, 16485, 338, 6213, 29901, 13, 9651, 12020, 3826, 6119, 29934, 292, 2392, 703, 29928, 415, 1818, 367, 297, 278, 2998, 29879, 470, 270, 16485, 1818, 367, 6790, 23157, 13, 13, 4706, 411, 1722, 29898, 1311, 3032, 1445, 2084, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 9651, 363, 474, 29892, 302, 297, 26985, 29898, 3881, 29898, 29896, 29892, 270, 16485, 718, 29871, 29896, 9601, 1057, 29899, 29896, 29962, 1125, 13, 18884, 565, 474, 1275, 29871, 29900, 29901, 13, 462, 1678, 285, 29889, 344, 1416, 29898, 1311, 3032, 7827, 29918, 13193, 448, 270, 16485, 334, 1583, 3032, 4058, 300, 29918, 2848, 29897, 13, 18884, 18203, 353, 285, 29889, 949, 29898, 1311, 3032, 4058, 300, 29918, 2848, 29897, 13, 13, 18884, 1602, 6797, 29918, 1272, 29889, 4397, 29898, 13808, 29918, 13193, 29898, 4058, 300, 29892, 7023, 29918, 13140, 29892, 26688, 29897, 847, 7329, 29897, 13, 13, 4706, 736, 1602, 6797, 29918, 1272, 13, 13, 1678, 822, 21822, 29918, 5203, 29879, 29898, 1311, 29892, 11799, 29918, 1445, 29922, 8516, 29892, 270, 16485, 29922, 8516, 1125, 13, 4706, 9995, 2772, 401, 599, 2998, 2011, 1080, 310, 278, 934, 322, 736, 408, 12205, 29889, 13, 13, 4706, 960, 263, 11799, 29918, 1445, 338, 4944, 29892, 788, 1906, 4341, 29892, 2086, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 11799, 29918, 1445, 584, 851, 470, 6213, 29889, 13, 9651, 10802, 304, 11799, 29918, 1445, 6943, 278, 525, 19304, 29915, 848, 29889, 13, 4706, 270, 16485, 584, 938, 29892, 13136, 13, 9651, 12048, 1598, 1353, 310, 1418, 481, 2461, 29879, 304, 6088, 29889, 29871, 960, 451, 6790, 29892, 270, 415, 1818, 13, 9651, 367, 6790, 297, 278, 2998, 29879, 322, 674, 367, 1304, 304, 8161, 1058, 1784, 13, 9651, 6262, 1250, 304, 6088, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 714, 29918, 2176, 584, 10518, 29889, 17271, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 3826, 6119, 29934, 292, 2392, 584, 363, 8340, 6273, 13, 4706, 9995, 13, 4706, 848, 353, 5159, 13, 13, 4706, 565, 270, 16485, 338, 6213, 29901, 13, 9651, 270, 16485, 353, 1583, 3032, 3317, 29918, 29881, 16485, 13, 13, 4706, 565, 270, 16485, 338, 6213, 29901, 13, 9651, 12020, 3826, 6119, 29934, 292, 2392, 703, 29928, 415, 1818, 367, 297, 278, 2998, 29879, 470, 270, 16485, 1818, 367, 6790, 23157, 13, 13, 4706, 411, 1722, 29898, 1311, 3032, 1445, 2084, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 9651, 363, 474, 29892, 302, 297, 26985, 29898, 3881, 29898, 29896, 29892, 270, 16485, 718, 29871, 29896, 9601, 1057, 29899, 29896, 29962, 1125, 13, 18884, 565, 474, 1275, 29871, 29900, 29901, 13, 462, 1678, 285, 29889, 344, 1416, 29898, 1311, 3032, 7827, 29918, 13193, 448, 270, 16485, 334, 1583, 3032, 4058, 300, 29918, 2848, 29897, 13, 18884, 396, 3617, 2602, 310, 278, 937, 848, 29899, 3149, 13, 18884, 18203, 353, 285, 29889, 949, 29898, 1311, 3032, 4058, 300, 29918, 2848, 29897, 13, 13, 18884, 270, 415, 29918, 1272, 353, 6571, 13, 18884, 363, 7023, 29918, 13140, 29892, 7023, 29918, 8977, 297, 1583, 3032, 5203, 29879, 29889, 7076, 7295, 13, 462, 1678, 270, 415, 29918, 1272, 29961, 10389, 29918, 8977, 3366, 1643, 3108, 29962, 353, 21822, 29918, 13193, 29898, 13, 462, 4706, 18203, 29892, 13, 462, 4706, 7023, 29918, 13140, 29892, 13, 462, 4706, 7023, 29918, 8977, 3366, 29881, 1853, 3108, 13, 462, 1678, 1723, 847, 7023, 29918, 8977, 29889, 657, 703, 19790, 613, 29871, 29896, 29897, 13, 13, 18884, 848, 29889, 4397, 29898, 29881, 415, 29918, 1272, 29897, 13, 13, 4706, 2998, 29879, 29918, 2176, 353, 10518, 29889, 17271, 29898, 1272, 29897, 13, 13, 4706, 11799, 29918, 2176, 353, 10518, 29889, 17271, 580, 13, 4706, 565, 11799, 29918, 1445, 338, 451, 6213, 29901, 13, 9651, 11799, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 29898, 7638, 29918, 1445, 29897, 13, 13, 4706, 396, 960, 11799, 848, 338, 2198, 29892, 10366, 2066, 4208, 13, 4706, 565, 451, 11799, 29918, 2176, 29889, 6310, 29901, 13, 9651, 714, 29918, 2176, 353, 11799, 29918, 2176, 29889, 8552, 580, 13, 13, 9651, 363, 3858, 297, 2998, 29879, 29918, 2176, 29901, 13, 18884, 714, 29918, 2176, 3366, 29912, 2403, 7099, 6797, 1642, 4830, 29898, 1643, 4638, 353, 2998, 29879, 29918, 2176, 29961, 1643, 29962, 13, 13, 4706, 1683, 29901, 13, 9651, 714, 29918, 2176, 353, 2998, 29879, 29918, 2176, 13, 13, 4706, 736, 714, 29918, 2176, 13, 13, 1678, 822, 1776, 29918, 10389, 29918, 13140, 29898, 1311, 29892, 7023, 29918, 13140, 29892, 6257, 29918, 10389, 29892, 270, 8768, 29922, 8516, 1125, 13, 4706, 9995, 11609, 29879, 1776, 310, 7023, 472, 2602, 421, 10389, 29918, 13140, 29952, 297, 848, 4072, 421, 29881, 8768, 1412, 13, 13, 4706, 3630, 297, 23912, 1369, 515, 926, 29876, 421, 2962, 292, 29918, 10389, 1412, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 16717, 29918, 2176, 584, 10518, 29889, 17271, 13, 9651, 10604, 310, 16717, 29918, 1272, 13, 4706, 7023, 29918, 13140, 584, 938, 13, 9651, 11374, 310, 7023, 304, 1776, 13, 4706, 6257, 29918, 10389, 584, 938, 13, 9651, 20627, 6262, 988, 1602, 6797, 515, 313, 262, 377, 4070, 369, 848, 29899, 1853, 467, 29871, 2648, 2167, 13, 9651, 1434, 445, 2602, 526, 12023, 304, 367, 376, 2962, 6262, 1642, 13, 4706, 270, 8768, 584, 1051, 310, 851, 29892, 13136, 13, 9651, 3630, 29899, 8768, 304, 1510, 1602, 6797, 1819, 363, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1776, 29918, 2176, 584, 10518, 29889, 17271, 13, 13, 4706, 2823, 3115, 13, 4706, 448, 26589, 13, 4706, 1776, 29918, 10389, 29918, 13140, 13, 4706, 9995, 13, 4706, 736, 1776, 29918, 10389, 29918, 13140, 29898, 1311, 3032, 26776, 29918, 2176, 29892, 7023, 29918, 13140, 29892, 6257, 29918, 10389, 29892, 13, 18884, 270, 8768, 29922, 29881, 8768, 29897, 13, 13, 1678, 822, 1776, 29918, 29881, 8768, 29898, 1311, 29892, 6257, 29918, 10389, 29892, 270, 8768, 1125, 13, 4706, 9995, 11609, 29879, 263, 1776, 310, 21213, 848, 363, 263, 2183, 6257, 7023, 322, 270, 8768, 29889, 13, 13, 4706, 383, 6090, 599, 1950, 1819, 29892, 6257, 472, 421, 2962, 292, 29918, 10389, 1673, 411, 1269, 310, 13, 4706, 278, 4944, 1418, 271, 7384, 421, 29881, 8768, 1412, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 16717, 29918, 2176, 584, 10518, 29889, 17271, 13, 9651, 10604, 310, 421, 26776, 29918, 1272, 1412, 29871, 19928, 505, 1063, 16717, 287, 411, 278, 4944, 13, 9651, 421, 29881, 8768, 29952, 322, 421, 2962, 292, 29918, 10389, 1412, 13, 4706, 6257, 29918, 10389, 584, 938, 13, 4706, 270, 8768, 584, 1051, 310, 851, 13, 9651, 13373, 23179, 6611, 29889, 29871, 2823, 421, 1982, 29889, 14573, 29918, 15631, 29925, 2890, 29952, 363, 6969, 848, 4072, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1776, 29918, 2176, 584, 10518, 29889, 17271, 13, 13, 4706, 390, 1759, 267, 13, 4706, 448, 23648, 13, 4706, 3826, 6119, 29934, 292, 2392, 584, 363, 421, 2962, 292, 29918, 10389, 29952, 470, 421, 29881, 8768, 29952, 451, 16717, 287, 297, 13, 4706, 421, 1311, 3032, 26776, 29918, 2176, 1412, 13, 13, 4706, 8695, 13, 4706, 448, 807, 13, 4706, 4001, 421, 1311, 3032, 26776, 29918, 2176, 29952, 674, 9432, 278, 421, 5203, 29879, 29952, 366, 1304, 746, 16717, 292, 29892, 13, 4706, 2998, 6262, 674, 451, 367, 337, 29899, 862, 8485, 29889, 13, 13, 4706, 2823, 3115, 13, 4706, 448, 26589, 13, 4706, 1776, 29918, 10389, 29918, 13140, 13, 4706, 9995, 13, 4706, 736, 1776, 29918, 29881, 8768, 29898, 1311, 3032, 26776, 29918, 2176, 29892, 6257, 29918, 10389, 29892, 270, 8768, 29897, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 9995, 1231, 8954, 310, 278, 3630, 6185, 6119, 1213, 15945, 13, 4706, 736, 9872, 1469, 6185, 6119, 23917, 6571, 1642, 4830, 29898, 1311, 3032, 1445, 2084, 29897, 13, 13, 1678, 822, 15837, 29898, 1311, 1125, 13, 4706, 9995, 11609, 29879, 263, 1532, 29899, 689, 19667, 15837, 310, 445, 3630, 6185, 6119, 1213, 15945, 13, 4706, 1962, 353, 518, 13, 9651, 376, 16638, 300, 365, 1477, 29901, 6571, 1642, 4830, 29898, 1311, 3032, 4058, 300, 29918, 2848, 511, 13, 9651, 376, 11536, 2648, 2167, 29901, 6571, 1642, 4830, 29898, 1311, 3032, 7827, 29918, 13193, 511, 13, 9651, 376, 29928, 415, 5163, 29916, 29901, 6571, 1642, 4830, 29898, 1311, 3032, 29881, 415, 29918, 13140, 511, 13, 9651, 376, 7976, 360, 16485, 29901, 6571, 1642, 4830, 29898, 1311, 3032, 3317, 29918, 29881, 16485, 511, 13, 9651, 376, 29968, 21369, 29879, 29901, 6571, 1642, 4830, 29898, 1311, 3032, 5203, 29918, 21134, 511, 13, 4706, 4514, 13, 13, 4706, 736, 9872, 1469, 6185, 6119, 29901, 426, 1012, 29876, 29905, 29873, 8875, 1642, 4830, 29898, 1311, 3032, 1445, 2084, 29892, 6634, 29876, 29905, 29873, 1642, 7122, 29898, 4905, 876, 13, 13, 13, 1753, 16717, 29918, 1272, 29898, 1445, 2084, 29892, 29871, 299, 16485, 29892, 270, 8768, 29922, 8516, 29892, 6257, 29918, 13193, 29922, 8516, 29892, 13, 4706, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 29892, 2998, 29879, 29922, 29968, 6632, 29956, 3059, 1125, 13, 1678, 9995, 11609, 29879, 12205, 29892, 27541, 491, 7023, 2602, 29892, 310, 1269, 7023, 5133, 698, 287, 408, 1422, 848, 4072, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 934, 2084, 584, 851, 13, 4706, 10802, 304, 934, 304, 6088, 13, 268, 299, 16485, 584, 938, 13, 4706, 9681, 310, 1418, 481, 2461, 29879, 515, 278, 1095, 310, 278, 934, 304, 6088, 29889, 13, 1678, 6257, 29918, 13193, 584, 1051, 310, 938, 470, 6213, 13, 4706, 20627, 304, 1369, 13755, 6262, 515, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 13, 1678, 2998, 29879, 584, 9657, 13, 4706, 3371, 1080, 310, 278, 7023, 2910, 393, 526, 2998, 29889, 29871, 7670, 338, 6257, 7023, 22645, 29889, 13, 4706, 7865, 338, 263, 9657, 6943, 29892, 472, 3203, 29901, 13, 9651, 376, 29881, 1853, 29908, 584, 851, 13, 18884, 13373, 23179, 6262, 881, 367, 21213, 408, 13, 9651, 376, 1643, 29908, 584, 851, 13, 18884, 12481, 3858, 363, 278, 848, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 16717, 29918, 2176, 584, 10518, 29889, 17271, 13, 1678, 9995, 13, 1678, 565, 270, 8768, 338, 6213, 29901, 13, 4706, 270, 8768, 353, 1051, 29898, 14573, 29918, 15631, 29925, 2890, 29897, 13, 13, 1678, 565, 6257, 29918, 13193, 338, 6213, 29901, 13, 4706, 6257, 29918, 13193, 353, 3464, 29898, 29900, 29892, 18203, 29918, 2848, 29897, 13, 13, 1678, 565, 2998, 29879, 338, 6213, 29901, 13, 4706, 2998, 29879, 353, 6571, 13, 13, 1678, 848, 353, 5159, 13, 13, 1678, 411, 1722, 29898, 1445, 2084, 29892, 376, 6050, 1159, 408, 285, 29901, 13, 4706, 363, 474, 29892, 302, 297, 26985, 29898, 3881, 29898, 29896, 29892, 29871, 299, 16485, 718, 29871, 29896, 9601, 1057, 29899, 29896, 29962, 1125, 13, 9651, 565, 474, 1275, 29871, 29900, 29901, 13, 18884, 285, 29889, 344, 1416, 29898, 657, 29918, 5325, 675, 29898, 1445, 2084, 29897, 448, 29871, 299, 16485, 334, 18203, 29918, 2848, 29897, 13, 13, 9651, 396, 7605, 1857, 18203, 13, 9651, 396, 18203, 353, 679, 29918, 4058, 300, 29898, 10389, 29918, 5461, 29892, 302, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 9651, 18203, 353, 285, 29889, 949, 29898, 4058, 300, 29918, 2848, 29897, 13, 9651, 2998, 29918, 1272, 353, 5445, 29918, 5203, 29918, 13193, 29898, 4058, 300, 29892, 2998, 29879, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 13, 9651, 363, 26688, 297, 270, 8768, 29901, 13, 18884, 302, 13193, 353, 679, 29918, 29876, 13193, 29898, 29881, 1853, 29897, 13, 13, 18884, 363, 6257, 29918, 10389, 297, 6257, 29918, 13193, 29901, 13, 462, 1678, 396, 20969, 1819, 13, 462, 1678, 13128, 29918, 2176, 353, 10518, 29889, 17271, 29898, 13, 462, 4706, 21822, 29918, 4058, 300, 29898, 13, 462, 9651, 18203, 29892, 13, 462, 9651, 26688, 29892, 13, 462, 9651, 6257, 29918, 10389, 29892, 13, 462, 9651, 18203, 29918, 2848, 29892, 13, 462, 9651, 2998, 29879, 29922, 5203, 29879, 29892, 13, 462, 9651, 2998, 29918, 1272, 29922, 5203, 29918, 1272, 13, 462, 4706, 1723, 13, 462, 1678, 13742, 29911, 13, 13, 462, 1678, 396, 3462, 11073, 13, 462, 1678, 13128, 29918, 2176, 3366, 29879, 10389, 3108, 353, 6257, 29918, 10389, 13, 462, 1678, 13128, 29918, 2176, 3366, 29876, 3108, 353, 302, 13, 462, 1678, 13128, 29918, 2176, 3366, 29881, 1853, 3108, 353, 26688, 13, 13, 462, 1678, 848, 29889, 4397, 29898, 7050, 29918, 2176, 29897, 13, 13, 1678, 4489, 353, 10518, 29889, 17685, 29898, 1272, 29897, 13, 1678, 4489, 29889, 2248, 29889, 978, 353, 376, 13140, 29908, 13, 13, 1678, 396, 830, 29899, 2248, 363, 901, 8543, 1602, 3689, 2678, 13, 1678, 736, 4489, 29889, 12071, 29918, 2248, 2141, 842, 29918, 2248, 29898, 3366, 29879, 10389, 613, 376, 29881, 1853, 613, 376, 29876, 613, 376, 13140, 3108, 467, 5589, 1056, 703, 1159, 13, 13, 13, 1753, 1776, 29918, 10389, 29918, 13140, 29898, 26776, 29918, 2176, 29892, 7023, 29918, 13140, 29892, 6257, 29918, 10389, 29892, 270, 8768, 29922, 8516, 1125, 13, 1678, 9995, 11609, 29879, 1776, 310, 7023, 472, 2602, 421, 10389, 29918, 13140, 29952, 297, 848, 1134, 421, 29881, 8768, 1412, 13, 13, 1678, 3630, 297, 23912, 1369, 515, 926, 29876, 421, 2962, 292, 29918, 10389, 1412, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 16717, 29918, 2176, 584, 10518, 29889, 17271, 13, 4706, 10604, 310, 16717, 29918, 1272, 13, 1678, 7023, 29918, 13140, 584, 938, 13, 4706, 11374, 310, 7023, 304, 1776, 13, 1678, 6257, 29918, 10389, 584, 938, 13, 4706, 20627, 6262, 988, 1602, 6797, 515, 313, 262, 377, 4070, 369, 848, 29899, 1853, 467, 29871, 2648, 2167, 13, 4706, 1434, 445, 2602, 526, 12023, 304, 367, 376, 2962, 6262, 1642, 13, 1678, 270, 8768, 584, 1051, 310, 851, 29892, 13136, 13, 4706, 3630, 29899, 8768, 304, 1510, 1602, 6797, 1819, 363, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1776, 29918, 2176, 584, 10518, 29889, 17271, 13, 1678, 9995, 13, 1678, 565, 270, 8768, 338, 6213, 29901, 13, 4706, 270, 8768, 353, 16717, 29918, 2176, 29889, 2248, 29889, 657, 29918, 5563, 29918, 5975, 703, 29881, 1853, 2564, 13092, 580, 13, 13, 1678, 736, 16717, 29918, 2176, 29889, 2029, 29961, 15926, 29889, 3220, 29903, 5897, 29961, 2962, 292, 29918, 10389, 29892, 270, 8768, 29892, 584, 29892, 7023, 29918, 13140, 1402, 584, 10725, 13, 4706, 869, 12071, 29918, 2248, 580, 29905, 13, 4706, 869, 29886, 11002, 29898, 2248, 543, 29881, 1853, 613, 4341, 543, 29876, 613, 1819, 543, 791, 1159, 29905, 13, 4706, 869, 29911, 29961, 29881, 8768, 10725, 13, 4706, 869, 6605, 29918, 2248, 29898, 6151, 2548, 29922, 8824, 29897, 13, 13, 13, 1753, 1776, 29918, 29881, 8768, 29898, 26776, 29918, 2176, 29892, 6257, 29918, 10389, 29892, 270, 8768, 1125, 13, 1678, 9995, 11609, 29879, 263, 1776, 310, 21213, 848, 363, 263, 2183, 6257, 7023, 322, 270, 8768, 29889, 13, 13, 1678, 383, 6090, 599, 1950, 1819, 29892, 6257, 472, 421, 2962, 292, 29918, 10389, 1673, 411, 1269, 310, 278, 13, 1678, 4944, 1418, 271, 7384, 421, 29881, 8768, 1412, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 16717, 29918, 2176, 584, 10518, 29889, 17271, 13, 4706, 10604, 310, 421, 26776, 29918, 1272, 1412, 29871, 19928, 505, 1063, 16717, 287, 411, 278, 4944, 13, 4706, 421, 29881, 8768, 29952, 322, 421, 2962, 292, 29918, 10389, 1412, 13, 1678, 6257, 29918, 10389, 584, 938, 13, 1678, 270, 8768, 584, 1051, 310, 851, 13, 4706, 13373, 23179, 6611, 29889, 29871, 2823, 421, 1982, 29889, 14573, 29918, 15631, 29925, 2890, 29952, 363, 6969, 848, 4072, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 1776, 29918, 2176, 584, 10518, 29889, 17271, 13, 13, 1678, 390, 1759, 267, 13, 1678, 448, 23648, 13, 1678, 3826, 6119, 29934, 292, 2392, 584, 363, 421, 2962, 292, 29918, 10389, 29952, 470, 421, 29881, 8768, 29952, 451, 16717, 287, 297, 421, 26776, 29918, 2176, 1412, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 4001, 421, 26776, 29918, 2176, 29952, 674, 9432, 278, 421, 5203, 29879, 29952, 366, 1304, 746, 16717, 292, 29892, 2998, 13, 1678, 6262, 674, 451, 367, 337, 29899, 862, 8485, 29889, 13, 13, 1678, 2823, 3115, 13, 1678, 448, 26589, 13, 1678, 1776, 29918, 10389, 29918, 13140, 13, 1678, 9995, 13, 268, 299, 16485, 353, 16717, 29918, 2176, 29889, 2248, 29889, 657, 29918, 5563, 29918, 5975, 703, 29876, 2564, 3317, 580, 13, 13, 1678, 396, 15758, 403, 10970, 13, 1678, 565, 6257, 29918, 10389, 451, 297, 16717, 29918, 2176, 29889, 2248, 29889, 657, 29918, 5563, 29918, 5975, 703, 29879, 10389, 2564, 13092, 7295, 13, 4706, 12020, 3826, 6119, 29934, 292, 2392, 29898, 13, 9651, 313, 13, 18884, 376, 13919, 6257, 29918, 10389, 15739, 445, 6257, 29918, 10389, 471, 451, 16717, 287, 1213, 13, 9651, 13742, 4830, 29898, 2962, 292, 29918, 10389, 29897, 13, 4706, 1723, 13, 13, 1678, 8340, 29918, 29881, 8768, 353, 731, 29898, 29881, 8768, 467, 29881, 17678, 29898, 13, 9651, 16717, 29918, 2176, 29889, 2248, 29889, 657, 29918, 5563, 29918, 5975, 703, 29881, 1853, 2564, 13092, 3101, 13, 1678, 565, 8340, 29918, 29881, 8768, 29901, 13, 4706, 12020, 3826, 6119, 29934, 292, 2392, 29898, 13, 9651, 313, 13, 18884, 376, 13919, 26688, 29898, 29879, 29897, 15739, 1438, 270, 8768, 892, 451, 16717, 287, 1213, 13, 9651, 13742, 4830, 29898, 29881, 8768, 29897, 13, 4706, 1723, 13, 13, 1678, 396, 6204, 20842, 1897, 2983, 322, 1074, 848, 29889, 13, 1678, 4489, 353, 16717, 29918, 2176, 29889, 2029, 29961, 2962, 292, 29918, 10389, 29962, 13, 13, 1678, 26688, 29918, 29069, 353, 5159, 13, 13, 1678, 363, 474, 29892, 26688, 297, 26985, 29898, 29881, 8768, 1125, 13, 4706, 396, 26688, 29918, 1272, 353, 4489, 29961, 2176, 3366, 29881, 1853, 3108, 1275, 26688, 29962, 13, 4706, 26688, 29918, 1272, 353, 4489, 29889, 2029, 29961, 29881, 1853, 29962, 13, 13, 4706, 363, 302, 297, 3464, 29898, 29896, 29892, 29871, 299, 16485, 718, 29871, 29896, 9601, 1057, 29899, 29896, 5387, 13, 9651, 396, 13128, 29918, 2176, 353, 26688, 29918, 1272, 29961, 29881, 1853, 29918, 1272, 3366, 29876, 3108, 1275, 302, 29962, 13, 9651, 13128, 29918, 2176, 353, 26688, 29918, 1272, 29889, 2029, 29961, 29876, 29962, 13, 13, 9651, 396, 3462, 3858, 1897, 373, 937, 12541, 13, 9651, 565, 474, 1275, 29871, 29900, 322, 302, 1275, 29871, 299, 16485, 29901, 13, 18884, 714, 29918, 2176, 353, 13128, 29918, 2176, 3366, 1643, 16862, 517, 29918, 2557, 2141, 8552, 580, 13, 13, 9651, 714, 29918, 2176, 3366, 29912, 7402, 8875, 1642, 4830, 29898, 29881, 1853, 29892, 302, 4638, 353, 13128, 29918, 2176, 3366, 791, 3108, 13, 13, 1678, 396, 450, 1494, 338, 297, 6728, 322, 1122, 3867, 263, 2253, 1776, 29889, 13, 1678, 396, 736, 16717, 29918, 2176, 29889, 2029, 29961, 15926, 29889, 3220, 29903, 5897, 29961, 2962, 292, 29918, 10389, 29892, 584, 29892, 270, 8768, 1402, 584, 1822, 6605, 29918, 2248, 29898, 5563, 29922, 3366, 29881, 1853, 613, 376, 29876, 3108, 467, 29911, 13, 13, 1678, 736, 714, 29918, 2176, 13, 13, 13, 1753, 21822, 29918, 4058, 300, 29898, 4058, 300, 29892, 26688, 29892, 6257, 29918, 10389, 29892, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 29892, 13, 4706, 2998, 29879, 29922, 29968, 6632, 29956, 3059, 29892, 2998, 29918, 1272, 29922, 8516, 1125, 13, 1678, 9995, 6185, 2631, 278, 6262, 297, 421, 4058, 300, 1673, 17415, 304, 421, 29881, 1853, 1412, 13, 13, 1678, 960, 7023, 29898, 29879, 29897, 526, 9859, 304, 421, 5203, 29879, 1673, 3913, 278, 6790, 848, 4072, 363, 13, 1678, 1906, 6262, 313, 2611, 1479, 310, 421, 29881, 1853, 12913, 13, 13, 1678, 3384, 4769, 6262, 393, 508, 451, 367, 1304, 363, 278, 6790, 848, 1134, 411, 525, 29930, 4286, 13, 13, 1678, 1152, 848, 4072, 26795, 2999, 6262, 29892, 1602, 6797, 995, 338, 297, 278, 937, 13, 1678, 7023, 322, 278, 9886, 3734, 6262, 526, 316, 609, 287, 408, 1641, 10423, 411, 17411, 29915, 13, 1678, 470, 15300, 4286, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 934, 2084, 584, 851, 13, 4706, 10802, 304, 934, 304, 6088, 13, 268, 299, 16485, 584, 938, 13, 4706, 9681, 310, 1418, 481, 2461, 29879, 515, 278, 1095, 310, 278, 934, 304, 6088, 29889, 13, 1678, 6257, 29918, 13193, 584, 1051, 310, 938, 470, 6213, 13, 4706, 20627, 304, 1369, 13755, 6262, 515, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 13, 1678, 2998, 29879, 584, 9657, 13, 4706, 3371, 1080, 310, 278, 7023, 2910, 393, 526, 2998, 29889, 29871, 7670, 338, 6257, 7023, 22645, 29889, 13, 4706, 7865, 338, 263, 9657, 6943, 29892, 472, 3203, 29901, 13, 9651, 376, 29881, 1853, 29908, 584, 851, 13, 18884, 13373, 23179, 6262, 881, 367, 21213, 408, 13, 9651, 376, 1643, 29908, 584, 851, 13, 18884, 12481, 3858, 363, 278, 848, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 18203, 29918, 2176, 584, 9657, 13, 4706, 3630, 515, 421, 4058, 300, 29952, 1602, 6797, 964, 421, 29881, 1853, 29952, 313, 272, 2998, 29879, 467, 13, 4706, 19831, 22645, 1149, 426, 1643, 29901, 3858, 313, 710, 511, 659, 29901, 659, 313, 5927, 681, 2915, 13, 1678, 9995, 13, 1678, 302, 13193, 353, 679, 29918, 29876, 13193, 29898, 29881, 1853, 29897, 13, 13, 1678, 565, 2998, 29918, 1272, 338, 6213, 29901, 13, 4706, 848, 353, 5445, 29918, 5203, 29918, 13193, 29898, 4058, 300, 29892, 2998, 29879, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 1678, 1683, 29901, 13, 4706, 848, 353, 6483, 8552, 29898, 5203, 29918, 1272, 29897, 13, 13, 1678, 396, 29273, 2307, 24146, 6262, 470, 620, 261, 369, 287, 29914, 29893, 28470, 6262, 29889, 13, 1678, 2998, 29918, 13193, 353, 903, 657, 29918, 5203, 29918, 13193, 29898, 5203, 29879, 29897, 13, 1678, 937, 29918, 13193, 353, 903, 657, 29918, 4102, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 1678, 471, 9446, 29918, 13193, 353, 903, 657, 29918, 29893, 28470, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 2998, 29879, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29892, 2998, 29918, 13193, 29922, 5203, 29918, 13193, 29892, 937, 29918, 13193, 29922, 4102, 29918, 13193, 29897, 13, 1678, 10423, 29918, 13193, 353, 903, 657, 29918, 26940, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 2998, 29879, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29892, 2998, 29918, 13193, 29922, 5203, 29918, 13193, 29892, 937, 29918, 13193, 29922, 4102, 29918, 13193, 29892, 471, 9446, 29918, 13193, 29922, 29893, 28470, 29918, 13193, 29897, 13, 13, 1678, 396, 6977, 5987, 5445, 261, 6262, 13, 1678, 363, 7023, 29918, 13140, 297, 471, 9446, 29918, 13193, 29901, 13, 4706, 848, 29961, 10389, 29918, 13140, 29962, 353, 8853, 791, 1115, 399, 28938, 3352, 29918, 22716, 4330, 29913, 13, 13, 1678, 363, 7023, 29918, 13140, 297, 10423, 29918, 13193, 29901, 13, 4706, 848, 29961, 10389, 29918, 13140, 29962, 353, 8853, 791, 1115, 383, 6227, 20566, 29918, 22716, 4330, 29913, 13, 13, 1678, 396, 20969, 3625, 1819, 13, 1678, 363, 7023, 29918, 13140, 297, 937, 29918, 13193, 29901, 13, 4706, 565, 7023, 29918, 13140, 297, 10423, 29918, 13193, 29901, 13, 9651, 848, 29961, 10389, 29918, 13140, 29962, 353, 426, 13, 18884, 376, 791, 1115, 21822, 29918, 13193, 29898, 4058, 300, 29892, 7023, 29918, 13140, 29892, 26688, 511, 13, 18884, 376, 1643, 1115, 383, 6227, 20566, 29918, 22716, 4330, 13, 9651, 500, 13, 13, 1678, 736, 848, 13, 13, 13, 1753, 5445, 29918, 5203, 29918, 13193, 29898, 4058, 300, 29892, 2998, 29879, 29892, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 1125, 13, 1678, 9995, 11609, 29879, 263, 7023, 8600, 313, 1066, 4261, 426, 791, 29892, 3858, 1800, 363, 2998, 6262, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 18203, 584, 7023, 851, 13, 1678, 2998, 29879, 584, 9657, 13, 4706, 3371, 1080, 310, 278, 7023, 2910, 393, 526, 2998, 29889, 29871, 7670, 338, 6257, 7023, 22645, 29889, 13, 4706, 7865, 338, 263, 9657, 6943, 29892, 472, 3203, 29901, 13, 9651, 376, 29881, 1853, 29908, 584, 851, 13, 18884, 13373, 23179, 6262, 881, 367, 21213, 408, 13, 9651, 376, 1643, 29908, 584, 851, 13, 18884, 12481, 3858, 363, 278, 848, 29889, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 7023, 29918, 791, 29879, 29918, 8977, 584, 9657, 13, 4706, 19831, 29918, 13140, 304, 9657, 310, 29901, 13, 9651, 8853, 791, 1115, 995, 297, 8210, 1134, 29892, 376, 1643, 1115, 1897, 3858, 29913, 13, 1678, 9995, 13, 1678, 565, 2998, 29879, 338, 6213, 29901, 13, 4706, 2998, 29879, 353, 6571, 13, 13, 1678, 1602, 6797, 29918, 4058, 300, 353, 426, 29875, 29901, 8853, 791, 1115, 6213, 29892, 376, 1643, 1115, 6213, 29913, 363, 474, 297, 13, 9651, 3464, 29898, 4058, 300, 29918, 2848, 2915, 13, 13, 1678, 363, 474, 29892, 7023, 29918, 8977, 297, 2998, 29879, 29889, 7076, 7295, 13, 4706, 26688, 353, 7023, 29918, 8977, 3366, 29881, 1853, 3108, 13, 4706, 3858, 353, 7023, 29918, 8977, 3366, 1643, 3108, 13, 13, 4706, 1602, 6797, 29918, 4058, 300, 29961, 29875, 29962, 353, 8853, 791, 1115, 21822, 29918, 13193, 29898, 4058, 300, 29892, 474, 29892, 26688, 511, 376, 1643, 1115, 3858, 29913, 13, 13, 4706, 363, 432, 297, 3464, 29898, 29875, 718, 29871, 29896, 29892, 474, 718, 679, 29918, 29876, 13193, 29898, 29881, 1853, 22164, 13, 9651, 1602, 6797, 29918, 4058, 300, 29961, 29926, 29962, 353, 8853, 791, 1115, 383, 6227, 20566, 29918, 29968, 6632, 16048, 29918, 22716, 4330, 29892, 376, 1643, 1115, 3858, 29913, 13, 13, 1678, 736, 1602, 6797, 29918, 4058, 300, 13, 13, 13, 1753, 903, 657, 29918, 5203, 29918, 13193, 29898, 5203, 29879, 29892, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 1125, 13, 1678, 9995, 11609, 29879, 1051, 310, 7023, 18111, 6943, 2998, 1819, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2998, 29879, 584, 9657, 13, 4706, 3371, 1080, 310, 278, 7023, 2910, 393, 526, 2998, 29889, 29871, 7670, 338, 6257, 7023, 22645, 29889, 13, 4706, 7865, 338, 263, 9657, 6943, 29892, 472, 3203, 29901, 13, 9651, 376, 29881, 1853, 29908, 584, 851, 13, 18884, 13373, 23179, 6262, 881, 367, 21213, 408, 13, 9651, 376, 1643, 29908, 584, 851, 13, 18884, 12481, 3858, 363, 278, 848, 29889, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 2998, 29918, 13193, 584, 1051, 310, 938, 13, 4706, 11374, 310, 6262, 24146, 491, 525, 5203, 29915, 1819, 29889, 13, 1678, 9995, 13, 1678, 565, 2998, 29879, 338, 6213, 29901, 13, 4706, 2998, 29879, 353, 6571, 13, 1678, 2998, 29918, 13193, 353, 5159, 13, 13, 1678, 363, 2998, 29892, 2998, 29918, 8977, 297, 2998, 29879, 29889, 7076, 7295, 13, 4706, 302, 13193, 353, 679, 29918, 29876, 13193, 29898, 5203, 29918, 8977, 3366, 29881, 1853, 20068, 13, 13, 4706, 2998, 29918, 13193, 29889, 21843, 29898, 3881, 29898, 5203, 29892, 2998, 718, 302, 13193, 876, 13, 13, 1678, 736, 2998, 29918, 13193, 13, 13, 13, 1753, 903, 657, 29918, 29893, 28470, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 2998, 29879, 29892, 13, 4706, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 29892, 2998, 29918, 13193, 29922, 8516, 29892, 937, 29918, 13193, 29922, 8516, 1125, 13, 1678, 9995, 11609, 29879, 1051, 310, 7023, 18111, 393, 526, 471, 9446, 746, 27523, 6262, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 6257, 29918, 10389, 584, 938, 13, 4706, 20627, 6262, 988, 1602, 6797, 515, 313, 262, 377, 4070, 369, 848, 29899, 1853, 467, 29871, 2648, 2167, 13, 4706, 1434, 445, 2602, 526, 12023, 304, 367, 376, 2962, 6262, 1642, 13, 1678, 302, 13193, 584, 938, 13, 4706, 9681, 310, 6262, 3734, 304, 21213, 964, 848, 29899, 1853, 29889, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 29889, 13, 1678, 2998, 29918, 13193, 584, 1051, 310, 938, 29892, 13136, 13, 4706, 10604, 310, 19392, 657, 29918, 5203, 29918, 13193, 1412, 29871, 2811, 367, 15712, 565, 451, 4944, 29889, 13, 1678, 937, 29918, 13193, 584, 1051, 310, 938, 29892, 13136, 13, 4706, 10604, 310, 19392, 657, 29918, 4102, 29918, 13193, 1412, 29871, 2811, 367, 15712, 565, 451, 4944, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 471, 9446, 29918, 13193, 584, 1051, 310, 938, 13, 4706, 11374, 310, 6262, 471, 9446, 313, 29875, 29889, 29872, 29889, 508, 451, 367, 10423, 29897, 2183, 421, 5203, 29879, 1673, 421, 29876, 13193, 29952, 13, 4706, 322, 421, 2962, 292, 29918, 10389, 1412, 13, 1678, 9995, 13, 1678, 471, 9446, 29918, 13193, 353, 5159, 13, 1678, 565, 2998, 29918, 13193, 338, 6213, 29901, 13, 4706, 2998, 29918, 13193, 353, 903, 657, 29918, 5203, 29918, 13193, 29898, 5203, 29879, 29922, 5203, 29879, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 13, 1678, 565, 937, 29918, 13193, 338, 6213, 29901, 13, 4706, 937, 29918, 13193, 353, 903, 657, 29918, 4102, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 13, 1678, 396, 10987, 22369, 411, 2998, 6262, 322, 29914, 272, 278, 1095, 310, 278, 18203, 13, 1678, 363, 937, 29918, 10389, 297, 937, 29918, 13193, 29901, 13, 4706, 6262, 29918, 517, 29918, 5589, 353, 7442, 29889, 279, 927, 29898, 4102, 29918, 10389, 29892, 937, 29918, 10389, 718, 302, 13193, 29897, 13, 4706, 19863, 353, 6262, 29918, 517, 29918, 5589, 29961, 9302, 29889, 262, 29896, 29881, 29898, 13193, 29918, 517, 29918, 5589, 29892, 2998, 29918, 13193, 4638, 13, 13, 4706, 565, 19863, 29889, 1384, 7295, 13, 9651, 471, 9446, 29918, 13193, 29889, 21843, 4197, 13, 18884, 921, 363, 921, 297, 13, 18884, 6262, 29918, 517, 29918, 5589, 29961, 30022, 9302, 29889, 262, 29896, 29881, 29898, 13193, 29918, 517, 29918, 5589, 29892, 2998, 29918, 13193, 4638, 13, 18884, 565, 921, 451, 297, 2998, 29879, 322, 921, 529, 18203, 29918, 2848, 13, 632, 2314, 13, 13, 1678, 736, 12705, 29898, 1761, 29898, 842, 29898, 29893, 28470, 29918, 13193, 4961, 13, 13, 13, 1753, 903, 657, 29918, 26940, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 2998, 29879, 29892, 13, 4706, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 29892, 2998, 29918, 13193, 29922, 8516, 29892, 937, 29918, 13193, 29922, 8516, 29892, 13, 4706, 471, 9446, 29918, 13193, 29922, 8516, 1125, 13, 1678, 9995, 11609, 29879, 1051, 310, 7023, 18111, 10423, 491, 716, 1819, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 6257, 29918, 10389, 584, 938, 13, 4706, 20627, 6262, 988, 1602, 6797, 515, 313, 262, 377, 4070, 369, 848, 29899, 1853, 467, 29871, 2648, 2167, 13, 4706, 1434, 445, 2602, 526, 12023, 304, 367, 376, 2962, 6262, 1642, 13, 1678, 302, 13193, 584, 938, 13, 4706, 9681, 310, 6262, 3734, 304, 21213, 964, 848, 29899, 1853, 29889, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 29889, 13, 1678, 2998, 29918, 13193, 584, 1051, 310, 938, 29892, 13136, 13, 4706, 10604, 310, 19392, 657, 29918, 5203, 29918, 13193, 1412, 29871, 2811, 367, 15712, 565, 451, 4944, 29889, 13, 1678, 937, 29918, 13193, 584, 1051, 310, 938, 29892, 13136, 13, 4706, 10604, 310, 19392, 657, 29918, 4102, 29918, 13193, 1412, 29871, 2811, 367, 15712, 565, 451, 4944, 29889, 13, 1678, 471, 9446, 29918, 13193, 584, 1051, 310, 938, 29892, 13136, 13, 4706, 10604, 310, 19392, 657, 29918, 29893, 28470, 29918, 13193, 1412, 29871, 2811, 367, 15712, 565, 451, 4944, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 10423, 29918, 13193, 584, 1051, 310, 938, 13, 4706, 11374, 310, 6262, 304, 367, 10423, 491, 1602, 3689, 408, 848, 310, 421, 29876, 13193, 1412, 13, 1678, 9995, 13, 1678, 10423, 29918, 13193, 353, 5159, 13, 13, 1678, 565, 2998, 29918, 13193, 338, 6213, 29901, 13, 4706, 2998, 29918, 13193, 353, 903, 657, 29918, 5203, 29918, 13193, 29898, 5203, 29879, 29922, 5203, 29879, 29892, 13, 18884, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 13, 1678, 565, 937, 29918, 13193, 338, 6213, 29901, 13, 4706, 937, 29918, 13193, 353, 903, 657, 29918, 4102, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 13, 18884, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29897, 13, 13, 1678, 565, 471, 9446, 29918, 13193, 338, 6213, 29901, 13, 4706, 471, 9446, 29918, 13193, 353, 903, 657, 29918, 29893, 28470, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 2998, 29879, 29892, 13, 18884, 18203, 29918, 2848, 29922, 4058, 300, 29918, 2848, 29892, 2998, 29918, 13193, 29922, 5203, 29918, 13193, 29892, 13, 18884, 937, 29918, 13193, 29922, 4102, 29918, 13193, 29897, 13, 13, 1678, 363, 937, 29918, 10389, 297, 937, 29918, 13193, 29901, 13, 4706, 565, 937, 29918, 10389, 451, 297, 2998, 29918, 13193, 322, 937, 29918, 10389, 451, 297, 471, 9446, 29918, 13193, 29901, 13, 9651, 10423, 29918, 13193, 29889, 21843, 29898, 3881, 29898, 4102, 29918, 10389, 29892, 937, 29918, 10389, 718, 302, 13193, 876, 13, 13, 1678, 736, 10423, 29918, 13193, 13, 13, 13, 1753, 903, 657, 29918, 4102, 29918, 13193, 29898, 2962, 292, 29918, 10389, 29892, 302, 13193, 29892, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 1125, 13, 1678, 9995, 11609, 29879, 1051, 310, 6262, 393, 1819, 508, 1369, 373, 297, 278, 18203, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 6257, 29918, 10389, 584, 938, 13, 4706, 20627, 6262, 988, 1602, 6797, 515, 313, 262, 377, 4070, 369, 848, 29899, 1853, 467, 29871, 2648, 2167, 13, 4706, 1434, 445, 2602, 526, 12023, 304, 367, 376, 2962, 6262, 1642, 13, 1678, 302, 13193, 584, 938, 13, 4706, 9681, 310, 6262, 3734, 304, 21213, 964, 848, 29899, 1853, 29889, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 1269, 18203, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 937, 29918, 13193, 584, 1051, 310, 938, 13, 4706, 11374, 310, 6257, 6262, 363, 263, 18203, 310, 3309, 421, 4058, 300, 29918, 2848, 29952, 6257, 13, 4706, 472, 7023, 421, 2962, 292, 29918, 10389, 29952, 988, 1269, 995, 338, 421, 29876, 13193, 29952, 6262, 297, 3309, 29889, 13, 1678, 9995, 13, 1678, 736, 1051, 29898, 3881, 29898, 2962, 292, 29918, 10389, 29892, 18203, 29918, 2848, 29892, 302, 13193, 876, 13, 13, 13, 1753, 679, 29918, 4058, 300, 29898, 10389, 29918, 5461, 29892, 302, 29892, 18203, 29918, 2848, 29922, 29925, 11375, 2544, 29918, 19433, 1125, 13, 1678, 9995, 11609, 29879, 278, 6262, 515, 278, 302, 386, 515, 278, 1095, 848, 29899, 4058, 300, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 7023, 29918, 5461, 584, 7023, 851, 13, 1678, 302, 584, 938, 13, 4706, 16557, 979, 515, 278, 1095, 1418, 481, 2461, 29879, 313, 29872, 29889, 29887, 29889, 29871, 29896, 338, 278, 376, 4230, 2564, 13, 1678, 18203, 29918, 2848, 584, 938, 13, 4706, 9681, 310, 6262, 297, 263, 848, 29899, 4058, 300, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 18203, 584, 7023, 851, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 910, 1158, 338, 18164, 29889, 29871, 2178, 11233, 414, 694, 664, 515, 263, 977, 342, 1633, 304, 13, 1678, 4788, 1403, 403, 3370, 21838, 29889, 13, 1678, 9995, 13, 1678, 29383, 29898, 13, 4706, 313, 13, 9651, 376, 4013, 1158, 338, 18164, 408, 372, 6858, 278, 2989, 7023, 29899, 5461, 1213, 13, 9651, 376, 29871, 2823, 3109, 3370, 938, 6270, 20240, 297, 29892, 321, 29889, 29887, 1696, 16717, 29918, 1272, 1213, 13, 4706, 10353, 13, 4706, 897, 1457, 9252, 22709, 29892, 13, 4706, 5096, 5563, 29922, 29906, 13, 1678, 1723, 13, 13, 1678, 565, 302, 1275, 29871, 29896, 29901, 13, 4706, 736, 7023, 29918, 5461, 14352, 4058, 300, 29918, 2848, 17531, 13, 13, 1678, 736, 7023, 29918, 5461, 14352, 4058, 300, 29918, 2848, 334, 302, 584, 448, 4058, 300, 29918, 2848, 334, 313, 29876, 448, 29871, 29896, 4638, 13, 13, 13, 1753, 21822, 29918, 13193, 29898, 4058, 300, 29892, 7023, 29918, 13140, 29892, 26688, 1125, 13, 1678, 9995, 6359, 29879, 278, 421, 10389, 29918, 13140, 29952, 7023, 310, 421, 4058, 300, 29952, 408, 1134, 421, 29881, 1853, 1412, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 18203, 584, 7023, 851, 13, 4706, 2648, 2167, 515, 697, 1418, 481, 2461, 313, 650, 848, 29899, 4058, 300, 29897, 13, 1678, 7023, 29918, 13140, 584, 938, 13, 4706, 11374, 310, 7023, 304, 1303, 313, 29875, 29889, 29872, 29889, 29871, 29900, 338, 278, 376, 4102, 1159, 13, 1678, 26688, 584, 851, 13, 4706, 5920, 23941, 848, 29899, 1853, 304, 6088, 6262, 408, 29936, 1818, 367, 263, 1820, 297, 13, 4706, 421, 14573, 29918, 15631, 29925, 2890, 29952, 313, 21264, 630, 411, 2854, 12655, 1134, 467, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 659, 584, 938, 470, 6213, 13, 4706, 8102, 995, 310, 1602, 6797, 6262, 29889, 29871, 6213, 565, 2086, 29899, 29888, 809, 6262, 3933, 297, 13, 4706, 18203, 304, 6088, 408, 4944, 421, 29881, 1853, 1412, 13, 1678, 9995, 13, 1678, 302, 13193, 353, 679, 29918, 29876, 13193, 29898, 29881, 1853, 29897, 13, 1678, 1014, 29918, 13193, 353, 18203, 29961, 10389, 29918, 13140, 29901, 7023, 29918, 13140, 718, 302, 13193, 29962, 13, 13, 1678, 396, 2216, 3307, 6262, 304, 8341, 13, 1678, 565, 7431, 29898, 1491, 29918, 13193, 29897, 529, 302, 13193, 29901, 13, 4706, 736, 6213, 13, 13, 1678, 736, 4320, 29918, 3166, 29918, 13193, 29898, 1491, 29918, 13193, 29892, 26688, 29897, 13, 2 ]
barcode.py
kallangerard/grocery-barcode-scanner
0
2709
import logging import groceries.api as groceries import barcodescanner.scan as barcode def main(): grocy = groceries.GrocyAPIClient() while True: scanner = barcode.Scan() line = scanner.PollScanner() if line != None: response = grocy.consume_barcode(line) logging.debug(response) if __name__ == "__main__": logging.basicConfig(level=logging.DEBUG) main()
[ 1, 1053, 12183, 13, 5215, 4071, 2265, 583, 29889, 2754, 408, 4071, 2265, 583, 13, 5215, 2594, 18137, 29883, 7310, 29889, 16192, 408, 2594, 401, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 4071, 1270, 353, 4071, 2265, 583, 29889, 29954, 307, 1270, 8787, 4032, 580, 13, 1678, 1550, 5852, 29901, 13, 4706, 885, 7310, 353, 2594, 401, 29889, 29083, 580, 13, 4706, 1196, 353, 885, 7310, 29889, 29925, 3028, 4421, 7310, 580, 13, 4706, 565, 1196, 2804, 6213, 29901, 13, 9651, 2933, 353, 4071, 1270, 29889, 3200, 2017, 29918, 1646, 401, 29898, 1220, 29897, 13, 9651, 12183, 29889, 8382, 29898, 5327, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 12183, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 18525, 29897, 13, 1678, 1667, 580, 13, 2 ]