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
tests/test_persistent_object.py
samuraisam/pynamo
4
199025
<gh_stars>1-10 import unittest, random, uuid from boto.exception import DynamoDBResponseError from boto.dynamodb.table import Table from pynamo import * from .common import TestPersistentObject, TestPersistentObjectPreparedKey class PersistentObjectClassTests(unittest.TestCase): def test_no_hash_key(self): er = 'At least one field must be marked a hash_key \(even if ' \ 'hash_key_format is defined\) for \(class A\)' with self.assertRaisesRegexp(TypeError, er): class A(PersistentObject): table_name = Meta('t1') def test_too_many_hash_keys(self): er = 'Only one Field is allowed to be marked hash_key per class. ' \ '\(class A\)' with self.assertRaisesRegexp(TypeError, er): class A(PersistentObject): table_name = Meta('t1') hk1 = StringField(hash_key=True) hk2 = StringField(hash_key=True) def test_too_many_range_keys(self): er = 'Only one Field is allowed to be marked range_key per class ' \ '\(class B\)' with self.assertRaisesRegexp(TypeError, er): class B(PersistentObject): table_name = Meta('t1') rk1 = IntegerField(range_key=True) rk2 = IntegerField(range_key=True) def test_fmt_wrong_key_type(self): er = 'If defining a hash_key_format, the field marked as hash_key ' \ 'must be a StringField. \(class B\)' with self.assertRaisesRegexp(TypeError, er): class B(PersistentObject): table_name = Meta('t1') hash_key_format = Meta('{key1}:{key2}') key = IntegerField(hash_key=True) def test_fmt_missing_piece(self): er = 'hash_key_format definition requires key2 but it is not an ' \ 'attribute on the class. \(C\)' with self.assertRaisesRegexp(TypeError, er): class C(PersistentObject): table_name = Meta('t1') hash_key_format = Meta('{key1}:{key2}') key = StringField(hash_key=True) key1 = StringField() def test_no_table_name(self): er = 'Must define a table_name for class C' with self.assertRaisesRegexp(TypeError, er): class C(PersistentObject): key = StringField(hash_key=True) def test_ops_on_base_class(self): class C(PersistentObject): table_name = Meta('t1') key = StringField(hash_key=True) er = 'Can not perform that operation on the base class. ' \ 'Please subclass PersistentObject to do that.' with self.assertRaisesRegexp(TypeError, er): C.create({'key': 'lol'}) # these tests take unbearibly long to run # dynamodb takes forever to create/destroy tables class PersistentObjectTableTests(unittest.TestCase): def setUp(self): Configure.with_ini_file() def test_create_wait_drop(self): # waits for creation TestPersistentObject.create_table(wait=True) conn = Configure.get_connection() self.assertTrue(isinstance(conn.get_table( TestPersistentObject._full_table_name), Table)) TestPersistentObject.drop_table(wait=True) self.assertRaises(DynamoDBResponseError, conn.get_table, TestPersistentObject._full_table_name) def test_reset_table(self): # create a table TestPersistentObject.create_table(wait=True) # create some objects in it TestPersistentObject.create(key='lol').save() TestPersistentObject.create(key='wut').save() # make sure they're really there self.assertTrue(isinstance(TestPersistentObject.get('lol'), TestPersistentObject)) conn = Configure.get_connection() TestPersistentObject.reset_table(wait=True) # now ensure they're really gone self.assertRaises(NotFoundError, TestPersistentObject.get, 'lol') self.assertRaises(NotFoundError, TestPersistentObject.get, 'wut') # and that the table is recreated self.assertTrue(isinstance(conn.get_table( TestPersistentObject._full_table_name), Table)) TestPersistentObject.drop_table(wait=True) self.assertRaises(DynamoDBResponseError, conn.get_table, TestPersistentObject._full_table_name) class PersistentObjectTests(unittest.TestCase): @staticmethod def setUpClass(): Configure.with_ini_file() return TestPersistentObject.create_table(wait=True) TestPersistentObjectPreparedKey.create_table(wait=True) @staticmethod def tearDownClass(): return TestPersistentObject.drop_table(wait=True) TestPersistentObjectPreparedKey.drop_table(wait=True) def test_prepare_key(self): # first test that prepare_key does not do anything if it's not set up self.assertEquals(TestPersistentObject.prepare_key('lol'), 'lol') # then test that prepare_key works with all the attribtues self.assertEquals(TestPersistentObjectPreparedKey.prepare_key( dict(key_1='hello', key_2=1, key_3='wut')), 'hello:1') # and test that it throws the proper error when they aren't there with self.assertRaises(ValueError): TestPersistentObjectPreparedKey.prepare_key( dict(key_1='hello', key_string='wut')) # and test that it works if you just provide the key self.assertEquals(TestPersistentObjectPreparedKey.prepare_key( {'key': 'key111'}), 'key111') # test that it throws a ValidationError if it's the wrong key type with self.assertRaises(ValidationError): TestPersistentObject.prepare_key({'key': 1}) def test_creation(self): le_id1 = uuid.uuid1().hex r1 = TestPersistentObject.create(key=le_id1).save() self.assertEquals(TestPersistentObject.get(le_id1).key, le_id1) d2 = { # this is only a subset of the keys 'key_1': uuid.uuid1().hex, 'key_2': random.randint(50000, 500000000), 'key_string': uuid.uuid1().hex, } r2 = TestPersistentObjectPreparedKey.create(d2).save() self.assertEquals(d2['key_1'], r2.key_1) self.assertEquals(d2['key_2'], r2.key_2) self.assertEquals(d2['key_string'], r2.key_string) res2 = TestPersistentObjectPreparedKey.get(d2) self.assertEquals(r2.key_1, res2.key_1) self.assertEquals(r2.key_2, res2.key_2) self.assertEquals(r2.key_string, res2.key_string) # throws the corect error when not creating it with the right args with self.assertRaises(ValueError): TestPersistentObjectPreparedKey.create(key_1='lolomg', key_string='hay so') def test_get(self): le_id1 = uuid.uuid1().hex def d(): return dict(key_1=uuid.uuid1().hex, key_2=random.randint(500000,500000000)) # works normally, with keyword arguments d1 = d() r1 = TestPersistentObjectPreparedKey.create(**d1).save() self.assertEquals(r1.key_1, d1['key_1']) # throws the proper error if not ixists with self.assertRaises(NotFoundError): TestPersistentObject.get(uuid.uuid1().hex) def test_get_or_create(self): def d(): return dict(key_1=uuid.uuid1().hex, key_2=random.randint(500000,500000000), key_list=[1,2,3]) # normal d1 = d() c1 = TestPersistentObjectPreparedKey.get_or_create(d1).save() self.assertEquals(c1.key_list, [1,2,3]) r1 = TestPersistentObjectPreparedKey.get(d1) self.assertEquals(r1.key_list, [1,2,3]) # keywords d2 = d() c2 = TestPersistentObjectPreparedKey.get_or_create(**d2).save() self.assertEquals(c2.key_1, d2['key_1']) r2 = TestPersistentObjectPreparedKey.get(d2) self.assertEquals(r2.key_list, [1,2,3]) # existing r3 = TestPersistentObjectPreparedKey.get_or_create(**d2).save() self.assertEquals(c3.key_list, [1,2,3])
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 443, 27958, 29892, 4036, 29892, 318, 5416, 13, 3166, 289, 3747, 29889, 11739, 1053, 22554, 29877, 4051, 5103, 2392, 13, 3166, 289, 3747, 29889, 29881, 2926, 10396, 29889, 2371, 1053, 6137, 13, 3166, 282, 2926, 29877, 1053, 334, 13, 3166, 869, 9435, 1053, 4321, 15136, 9696, 2061, 29892, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 13, 13, 13, 1990, 9034, 9696, 2061, 2385, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 1217, 29918, 8568, 29918, 1989, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 4178, 3203, 697, 1746, 1818, 367, 10902, 263, 6608, 29918, 1989, 4269, 11884, 565, 525, 320, 13, 632, 525, 8568, 29918, 1989, 29918, 4830, 338, 3342, 7244, 363, 4269, 1990, 319, 7244, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 319, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 308, 13, 1678, 822, 1243, 29918, 517, 29877, 29918, 13011, 29918, 8568, 29918, 8149, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 11730, 697, 8989, 338, 6068, 304, 367, 10902, 6608, 29918, 1989, 639, 770, 29889, 525, 320, 13, 632, 11297, 29898, 1990, 319, 7244, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 319, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 18884, 298, 29895, 29896, 353, 1714, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 18884, 298, 29895, 29906, 353, 1714, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 517, 29877, 29918, 13011, 29918, 3881, 29918, 8149, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 11730, 697, 8989, 338, 6068, 304, 367, 10902, 3464, 29918, 1989, 639, 770, 525, 320, 13, 632, 11297, 29898, 1990, 350, 7244, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 350, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 18884, 364, 29895, 29896, 353, 8102, 3073, 29898, 3881, 29918, 1989, 29922, 5574, 29897, 13, 18884, 364, 29895, 29906, 353, 8102, 3073, 29898, 3881, 29918, 1989, 29922, 5574, 29897, 13, 13, 1678, 822, 1243, 29918, 23479, 29918, 15866, 549, 29918, 1989, 29918, 1853, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 3644, 16184, 263, 6608, 29918, 1989, 29918, 4830, 29892, 278, 1746, 10902, 408, 6608, 29918, 1989, 525, 320, 13, 632, 525, 21969, 367, 263, 1714, 3073, 29889, 4269, 1990, 350, 7244, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 350, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 18884, 6608, 29918, 1989, 29918, 4830, 353, 20553, 877, 29912, 1989, 29896, 6177, 29912, 1989, 29906, 29913, 1495, 13, 18884, 1820, 353, 8102, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 23479, 29918, 27259, 29918, 12343, 346, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 8568, 29918, 1989, 29918, 4830, 5023, 6858, 1820, 29906, 541, 372, 338, 451, 385, 525, 320, 13, 632, 525, 12715, 373, 278, 770, 29889, 4269, 29907, 7244, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 315, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 18884, 6608, 29918, 1989, 29918, 4830, 353, 20553, 877, 29912, 1989, 29896, 6177, 29912, 1989, 29906, 29913, 1495, 13, 18884, 1820, 353, 1714, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 18884, 1820, 29896, 353, 1714, 3073, 580, 13, 268, 13, 1678, 822, 1243, 29918, 1217, 29918, 2371, 29918, 978, 29898, 1311, 1125, 13, 4706, 604, 353, 525, 29924, 504, 4529, 263, 1591, 29918, 978, 363, 770, 315, 29915, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 770, 315, 29898, 15136, 9696, 2061, 1125, 13, 18884, 1820, 353, 1714, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 3554, 29918, 265, 29918, 3188, 29918, 1990, 29898, 1311, 1125, 13, 4706, 770, 315, 29898, 15136, 9696, 2061, 1125, 13, 9651, 1591, 29918, 978, 353, 20553, 877, 29873, 29896, 1495, 13, 9651, 1820, 353, 1714, 3073, 29898, 8568, 29918, 1989, 29922, 5574, 29897, 13, 4706, 604, 353, 525, 6028, 451, 2189, 393, 5858, 373, 278, 2967, 770, 29889, 525, 320, 13, 632, 525, 12148, 19481, 9034, 9696, 2061, 304, 437, 393, 6169, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 4597, 4548, 29898, 1542, 2392, 29892, 604, 1125, 13, 9651, 315, 29889, 3258, 3319, 29915, 1989, 2396, 525, 29880, 324, 29915, 1800, 13, 13, 13, 13, 29937, 1438, 6987, 2125, 443, 29890, 799, 14981, 1472, 304, 1065, 13, 29937, 4292, 10396, 4893, 22296, 304, 1653, 29914, 20524, 6131, 13, 1990, 9034, 9696, 2061, 3562, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1281, 4532, 29889, 2541, 29918, 2172, 29918, 1445, 580, 13, 268, 13, 1678, 822, 1243, 29918, 3258, 29918, 10685, 29918, 8865, 29898, 1311, 1125, 396, 11324, 1169, 363, 11265, 13, 4706, 4321, 15136, 9696, 2061, 29889, 3258, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 308, 13, 4706, 11009, 353, 1281, 4532, 29889, 657, 29918, 9965, 580, 13, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 13082, 29889, 657, 29918, 2371, 29898, 13, 9651, 4321, 15136, 9696, 2061, 3032, 8159, 29918, 2371, 29918, 978, 511, 6137, 876, 13, 13, 4706, 4321, 15136, 9696, 2061, 29889, 8865, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 29928, 2926, 29877, 4051, 5103, 2392, 29892, 11009, 29889, 657, 29918, 2371, 29892, 29871, 13, 462, 3986, 4321, 15136, 9696, 2061, 3032, 8159, 29918, 2371, 29918, 978, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 12071, 29918, 2371, 29898, 1311, 1125, 13, 4706, 396, 1653, 263, 1591, 13, 4706, 4321, 15136, 9696, 2061, 29889, 3258, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 308, 13, 4706, 396, 1653, 777, 3618, 297, 372, 13, 4706, 4321, 15136, 9696, 2061, 29889, 3258, 29898, 1989, 2433, 29880, 324, 2824, 7620, 580, 13, 4706, 4321, 15136, 9696, 2061, 29889, 3258, 29898, 1989, 2433, 29893, 329, 2824, 7620, 580, 13, 308, 13, 4706, 396, 1207, 1854, 896, 29915, 276, 2289, 727, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 3057, 15136, 9696, 2061, 29889, 657, 877, 29880, 324, 5477, 29871, 13, 9651, 4321, 15136, 9696, 2061, 876, 13, 308, 13, 4706, 11009, 353, 1281, 4532, 29889, 657, 29918, 9965, 580, 13, 13, 4706, 4321, 15136, 9696, 2061, 29889, 12071, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 13, 4706, 396, 1286, 9801, 896, 29915, 276, 2289, 7695, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 17413, 2392, 29892, 4321, 15136, 9696, 2061, 29889, 657, 29892, 525, 29880, 324, 1495, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 17413, 2392, 29892, 4321, 15136, 9696, 2061, 29889, 657, 29892, 525, 29893, 329, 1495, 13, 13, 4706, 396, 322, 393, 278, 1591, 338, 337, 11600, 13, 4706, 1583, 29889, 9294, 5574, 29898, 275, 8758, 29898, 13082, 29889, 657, 29918, 2371, 29898, 13, 9651, 4321, 15136, 9696, 2061, 3032, 8159, 29918, 2371, 29918, 978, 511, 6137, 876, 13, 13, 4706, 4321, 15136, 9696, 2061, 29889, 8865, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 29928, 2926, 29877, 4051, 5103, 2392, 29892, 11009, 29889, 657, 29918, 2371, 29892, 29871, 13, 462, 3986, 4321, 15136, 9696, 2061, 3032, 8159, 29918, 2371, 29918, 978, 29897, 13, 13, 13, 1990, 9034, 9696, 2061, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 731, 3373, 2385, 7295, 13, 4706, 1281, 4532, 29889, 2541, 29918, 2172, 29918, 1445, 580, 13, 4706, 736, 13, 4706, 4321, 15136, 9696, 2061, 29889, 3258, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 4706, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 3258, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 268, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 734, 279, 6767, 2385, 7295, 13, 4706, 736, 13, 4706, 4321, 15136, 9696, 2061, 29889, 8865, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 4706, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 8865, 29918, 2371, 29898, 10685, 29922, 5574, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 19125, 29918, 1989, 29898, 1311, 1125, 13, 4706, 396, 937, 1243, 393, 19012, 29918, 1989, 947, 451, 437, 3099, 565, 372, 29915, 29879, 451, 731, 701, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3057, 15136, 9696, 2061, 29889, 19125, 29918, 1989, 877, 29880, 324, 5477, 525, 29880, 324, 1495, 13, 4706, 396, 769, 1243, 393, 19012, 29918, 1989, 1736, 411, 599, 278, 1098, 1091, 29873, 1041, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3057, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 19125, 29918, 1989, 29898, 13, 9651, 9657, 29898, 1989, 29918, 29896, 2433, 12199, 742, 1820, 29918, 29906, 29922, 29896, 29892, 1820, 29918, 29941, 2433, 29893, 329, 1495, 511, 525, 12199, 29901, 29896, 1495, 13, 4706, 396, 322, 1243, 393, 372, 8026, 278, 1571, 1059, 746, 896, 9455, 29915, 29873, 727, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 29871, 13, 9651, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 19125, 29918, 1989, 29898, 29871, 13, 18884, 9657, 29898, 1989, 29918, 29896, 2433, 12199, 742, 1820, 29918, 1807, 2433, 29893, 329, 8785, 13, 4706, 396, 322, 1243, 393, 372, 1736, 565, 366, 925, 3867, 278, 1820, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3057, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 19125, 29918, 1989, 29898, 13, 9651, 11117, 1989, 2396, 525, 1989, 29896, 29896, 29896, 29915, 9594, 525, 1989, 29896, 29896, 29896, 1495, 13, 4706, 396, 1243, 393, 372, 8026, 263, 15758, 362, 2392, 565, 372, 29915, 29879, 278, 2743, 1820, 1134, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 19448, 2392, 1125, 13, 9651, 4321, 15136, 9696, 2061, 29889, 19125, 29918, 1989, 3319, 29915, 1989, 2396, 29871, 29896, 1800, 13, 268, 13, 1678, 822, 1243, 29918, 1037, 362, 29898, 1311, 1125, 13, 4706, 454, 29918, 333, 29896, 353, 318, 5416, 29889, 25118, 29896, 2141, 20970, 13, 4706, 364, 29896, 353, 4321, 15136, 9696, 2061, 29889, 3258, 29898, 1989, 29922, 280, 29918, 333, 29896, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 3057, 15136, 9696, 2061, 29889, 657, 29898, 280, 29918, 333, 29896, 467, 1989, 29892, 454, 29918, 333, 29896, 29897, 13, 268, 13, 4706, 270, 29906, 353, 426, 396, 445, 338, 871, 263, 11306, 310, 278, 6611, 13, 9651, 525, 1989, 29918, 29896, 2396, 318, 5416, 29889, 25118, 29896, 2141, 20970, 29892, 13, 9651, 525, 1989, 29918, 29906, 2396, 4036, 29889, 9502, 524, 29898, 29945, 29900, 29900, 29900, 29900, 29892, 29871, 29945, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 511, 13, 9651, 525, 1989, 29918, 1807, 2396, 318, 5416, 29889, 25118, 29896, 2141, 20970, 29892, 13, 4706, 500, 13, 4706, 364, 29906, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 3258, 29898, 29881, 29906, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29881, 29906, 1839, 1989, 29918, 29896, 7464, 364, 29906, 29889, 1989, 29918, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29881, 29906, 1839, 1989, 29918, 29906, 7464, 364, 29906, 29889, 1989, 29918, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29881, 29906, 1839, 1989, 29918, 1807, 7464, 364, 29906, 29889, 1989, 29918, 1807, 29897, 13, 4706, 620, 29906, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29898, 29881, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29906, 29889, 1989, 29918, 29896, 29892, 620, 29906, 29889, 1989, 29918, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29906, 29889, 1989, 29918, 29906, 29892, 620, 29906, 29889, 1989, 29918, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29906, 29889, 1989, 29918, 1807, 29892, 620, 29906, 29889, 1989, 29918, 1807, 29897, 13, 4706, 396, 8026, 278, 7136, 312, 1059, 746, 451, 4969, 372, 411, 278, 1492, 6389, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 3258, 29898, 1989, 29918, 29896, 2433, 29880, 324, 290, 29887, 742, 29871, 13, 462, 462, 462, 259, 1820, 29918, 1807, 2433, 29882, 388, 577, 1495, 13, 13, 1678, 822, 1243, 29918, 657, 29898, 1311, 1125, 13, 4706, 454, 29918, 333, 29896, 353, 318, 5416, 29889, 25118, 29896, 2141, 20970, 13, 4706, 822, 270, 7295, 13, 9651, 736, 9657, 29898, 1989, 29918, 29896, 29922, 25118, 29889, 25118, 29896, 2141, 20970, 29892, 29871, 13, 462, 4706, 1820, 29918, 29906, 29922, 8172, 29889, 9502, 524, 29898, 29945, 29900, 29900, 29900, 29900, 29900, 29892, 29945, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 876, 13, 4706, 396, 1736, 12891, 29892, 411, 13553, 6273, 13, 4706, 270, 29896, 353, 270, 580, 13, 4706, 364, 29896, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 3258, 29898, 1068, 29881, 29896, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29896, 29889, 1989, 29918, 29896, 29892, 270, 29896, 1839, 1989, 29918, 29896, 11287, 13, 4706, 396, 8026, 278, 1571, 1059, 565, 451, 474, 29916, 2879, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 17413, 2392, 1125, 13, 9651, 4321, 15136, 9696, 2061, 29889, 657, 29898, 25118, 29889, 25118, 29896, 2141, 20970, 29897, 13, 268, 13, 1678, 822, 1243, 29918, 657, 29918, 272, 29918, 3258, 29898, 1311, 1125, 13, 4706, 822, 270, 7295, 13, 9651, 736, 9657, 29898, 1989, 29918, 29896, 29922, 25118, 29889, 25118, 29896, 2141, 20970, 29892, 29871, 13, 462, 4706, 1820, 29918, 29906, 29922, 8172, 29889, 9502, 524, 29898, 29945, 29900, 29900, 29900, 29900, 29900, 29892, 29945, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 29900, 511, 13, 462, 4706, 1820, 29918, 1761, 11759, 29896, 29892, 29906, 29892, 29941, 2314, 13, 4706, 396, 4226, 13, 4706, 270, 29896, 353, 270, 580, 13, 4706, 274, 29896, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29918, 272, 29918, 3258, 29898, 29881, 29896, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29883, 29896, 29889, 1989, 29918, 1761, 29892, 518, 29896, 29892, 29906, 29892, 29941, 2314, 13, 4706, 364, 29896, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29898, 29881, 29896, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29896, 29889, 1989, 29918, 1761, 29892, 518, 29896, 29892, 29906, 29892, 29941, 2314, 13, 4706, 396, 29361, 13, 4706, 270, 29906, 353, 270, 580, 13, 4706, 274, 29906, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29918, 272, 29918, 3258, 29898, 1068, 29881, 29906, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29883, 29906, 29889, 1989, 29918, 29896, 29892, 270, 29906, 1839, 1989, 29918, 29896, 11287, 13, 4706, 364, 29906, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29898, 29881, 29906, 29897, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29878, 29906, 29889, 1989, 29918, 1761, 29892, 518, 29896, 29892, 29906, 29892, 29941, 2314, 13, 4706, 396, 5923, 13, 4706, 364, 29941, 353, 4321, 15136, 9696, 2061, 29925, 3445, 1965, 2558, 29889, 657, 29918, 272, 29918, 3258, 29898, 1068, 29881, 29906, 467, 7620, 580, 13, 4706, 1583, 29889, 9294, 14776, 29898, 29883, 29941, 29889, 1989, 29918, 1761, 29892, 518, 29896, 29892, 29906, 29892, 29941, 2314, 13, 13, 13, 308, 13, 13, 2 ]
codes/train.py
mengzhu0308/Text-emotion-classification-based-on-CNN
0
108582
#! -*- coding:utf-8 -*- ''' @Author: ZM @Date and Time: 2020/12/13 16:28 @File: train.py ''' import math import numpy as np import pandas as pd from gensim import corpora from keras.layers import Input from keras import Model from keras.callbacks import Callback from keras.optimizers import Adam from keras import backend as K from Dataset import Dataset from get_dataset import get_dataset from generator import generator from utils import str2id, sequence_padding from Loss import Loss from ToOneHot import ToOneHot from CNN_model import CNN_Model class CrossEntropy(Loss): def compute_loss(self, inputs): y_true, y_pred = inputs loss = K.categorical_crossentropy(y_true, K.softmax(y_pred)) return K.mean(loss) if __name__ == '__main__': num_classes = 4 vocab_size = 33106 max_length = 181 hidden_dim = 64 train_batch_size = 128 val_batch_size = 500 (X_train, Y_train), (X_val, Y_val) = get_dataset() dictionary = corpora.Dictionary(pd.concat([X_train, X_val])) X_train = [str2id(x, dictionary.token2id) for x in X_train] X_val = [str2id(x, dictionary.token2id) for x in X_val] X_train = sequence_padding(X_train, max_length=max_length) Y_train = np.array(Y_train, dtype='int32') X_val = sequence_padding(X_val, max_length=max_length) Y_val = np.array(Y_val, dtype='int32') train_dataset = Dataset(X_train, Y_train, label_transform=ToOneHot(num_classes)) val_dataset = Dataset(X_val, Y_val, label_transform=ToOneHot(num_classes)) train_generator = generator(train_dataset, batch_size=train_batch_size, shuffle=True) val_generator = generator(val_dataset, batch_size=val_batch_size, shuffle=False) text_input = Input(shape=(max_length, ), name='text_input', dtype='int32') y_true = Input(shape=(num_classes, ), dtype='int32') out = CNN_Model(text_input, vocab_size, max_length, hidden_dim=hidden_dim, num_classes=num_classes) out = CrossEntropy(-1)([y_true, out]) model = Model([y_true, text_input], out) opt = Adam() model.compile(opt) num_train_batches = math.ceil(len(Y_train) / train_batch_size) num_val_examples = len(Y_val) num_val_batches = math.ceil(num_val_examples / val_batch_size) def evaluate(model): total_loss = 0. total_corrects = 0 for _ in range(num_val_batches): batch_data, _ = next(val_generator) val_loss, predict = model.test_on_batch(batch_data, y=None), model.predict_on_batch(batch_data) total_loss += val_loss total_corrects += np.sum(np.argmax(batch_data[0], axis=-1) == np.argmax(predict, axis=-1)) val_loss = total_loss / num_val_batches val_acc = (total_corrects / num_val_examples) * 100 return val_loss, val_acc class Evaluator(Callback): def __init__(self): super(Evaluator, self).__init__() def on_epoch_end(self, epoch, logs=None): val_loss, val_acc = evaluate(self.model) print(f'val_loss = {val_loss:.5f}, val_acc = {val_acc:.2f}') evaluator = Evaluator() model.fit_generator( train_generator, steps_per_epoch=num_train_batches, epochs=10, callbacks=[evaluator], shuffle=False, initial_epoch=0 )
[ 1, 396, 29991, 448, 29930, 29899, 14137, 29901, 9420, 29899, 29947, 448, 29930, 29899, 13, 13, 12008, 13, 29992, 13720, 29901, 4706, 796, 29924, 13, 29992, 2539, 322, 5974, 29901, 29871, 29906, 29900, 29906, 29900, 29914, 29896, 29906, 29914, 29896, 29941, 29871, 29896, 29953, 29901, 29906, 29947, 13, 29992, 2283, 29901, 3986, 7945, 29889, 2272, 13, 12008, 13, 13, 5215, 5844, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 3166, 26943, 326, 1053, 17266, 29874, 13, 3166, 13023, 294, 29889, 29277, 1053, 10567, 13, 3166, 13023, 294, 1053, 8125, 13, 3166, 13023, 294, 29889, 14035, 29879, 1053, 8251, 1627, 13, 3166, 13023, 294, 29889, 20640, 19427, 1053, 11783, 13, 3166, 13023, 294, 1053, 14998, 408, 476, 13, 13, 3166, 13373, 24541, 1053, 13373, 24541, 13, 3166, 679, 29918, 24713, 1053, 679, 29918, 24713, 13, 3166, 15299, 1053, 15299, 13, 3166, 3667, 29879, 1053, 851, 29906, 333, 29892, 5665, 29918, 12791, 13, 3166, 365, 2209, 1053, 365, 2209, 13, 3166, 1763, 6716, 28917, 1053, 1763, 6716, 28917, 13, 3166, 29696, 29918, 4299, 1053, 29696, 29918, 3195, 13, 13, 1990, 11189, 5292, 14441, 29898, 29931, 2209, 1125, 13, 1678, 822, 10272, 29918, 6758, 29898, 1311, 29892, 10970, 1125, 13, 4706, 343, 29918, 3009, 29892, 343, 29918, 11965, 353, 10970, 13, 4706, 6410, 353, 476, 29889, 29883, 20440, 936, 29918, 19128, 296, 14441, 29898, 29891, 29918, 3009, 29892, 476, 29889, 2695, 3317, 29898, 29891, 29918, 11965, 876, 13, 4706, 736, 476, 29889, 12676, 29898, 6758, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 954, 29918, 13203, 353, 29871, 29946, 13, 1678, 7931, 370, 29918, 2311, 353, 29871, 29941, 29941, 29896, 29900, 29953, 13, 1678, 4236, 29918, 2848, 353, 29871, 29896, 29947, 29896, 13, 1678, 7934, 29918, 6229, 353, 29871, 29953, 29946, 13, 1678, 7945, 29918, 16175, 29918, 2311, 353, 29871, 29896, 29906, 29947, 13, 1678, 659, 29918, 16175, 29918, 2311, 353, 29871, 29945, 29900, 29900, 13, 13, 1678, 313, 29990, 29918, 14968, 29892, 612, 29918, 14968, 511, 313, 29990, 29918, 791, 29892, 612, 29918, 791, 29897, 353, 679, 29918, 24713, 580, 13, 1678, 8600, 353, 17266, 29874, 29889, 11513, 29898, 15926, 29889, 17685, 4197, 29990, 29918, 14968, 29892, 1060, 29918, 791, 12622, 13, 13, 1678, 1060, 29918, 14968, 353, 518, 710, 29906, 333, 29898, 29916, 29892, 8600, 29889, 6979, 29906, 333, 29897, 363, 921, 297, 1060, 29918, 14968, 29962, 13, 1678, 1060, 29918, 791, 353, 518, 710, 29906, 333, 29898, 29916, 29892, 8600, 29889, 6979, 29906, 333, 29897, 363, 921, 297, 1060, 29918, 791, 29962, 13, 13, 1678, 1060, 29918, 14968, 353, 5665, 29918, 12791, 29898, 29990, 29918, 14968, 29892, 4236, 29918, 2848, 29922, 3317, 29918, 2848, 29897, 13, 1678, 612, 29918, 14968, 353, 7442, 29889, 2378, 29898, 29979, 29918, 14968, 29892, 26688, 2433, 524, 29941, 29906, 1495, 13, 1678, 1060, 29918, 791, 353, 5665, 29918, 12791, 29898, 29990, 29918, 791, 29892, 4236, 29918, 2848, 29922, 3317, 29918, 2848, 29897, 13, 1678, 612, 29918, 791, 353, 7442, 29889, 2378, 29898, 29979, 29918, 791, 29892, 26688, 2433, 524, 29941, 29906, 1495, 13, 13, 1678, 7945, 29918, 24713, 353, 13373, 24541, 29898, 29990, 29918, 14968, 29892, 612, 29918, 14968, 29892, 3858, 29918, 9067, 29922, 1762, 6716, 28917, 29898, 1949, 29918, 13203, 876, 13, 1678, 659, 29918, 24713, 353, 13373, 24541, 29898, 29990, 29918, 791, 29892, 612, 29918, 791, 29892, 3858, 29918, 9067, 29922, 1762, 6716, 28917, 29898, 1949, 29918, 13203, 876, 13, 1678, 7945, 29918, 27959, 353, 15299, 29898, 14968, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 14968, 29918, 16175, 29918, 2311, 29892, 528, 21897, 29922, 5574, 29897, 13, 1678, 659, 29918, 27959, 353, 15299, 29898, 791, 29918, 24713, 29892, 9853, 29918, 2311, 29922, 791, 29918, 16175, 29918, 2311, 29892, 528, 21897, 29922, 8824, 29897, 13, 13, 1678, 1426, 29918, 2080, 353, 10567, 29898, 12181, 7607, 3317, 29918, 2848, 29892, 10353, 1024, 2433, 726, 29918, 2080, 742, 26688, 2433, 524, 29941, 29906, 1495, 13, 1678, 343, 29918, 3009, 353, 10567, 29898, 12181, 7607, 1949, 29918, 13203, 29892, 10353, 26688, 2433, 524, 29941, 29906, 1495, 13, 1678, 714, 353, 29696, 29918, 3195, 29898, 726, 29918, 2080, 29892, 7931, 370, 29918, 2311, 29892, 4236, 29918, 2848, 29892, 7934, 29918, 6229, 29922, 10892, 29918, 6229, 29892, 954, 29918, 13203, 29922, 1949, 29918, 13203, 29897, 13, 1678, 714, 353, 11189, 5292, 14441, 6278, 29896, 29897, 4197, 29891, 29918, 3009, 29892, 714, 2314, 13, 1678, 1904, 353, 8125, 4197, 29891, 29918, 3009, 29892, 1426, 29918, 2080, 1402, 714, 29897, 13, 1678, 3523, 353, 11783, 580, 13, 1678, 1904, 29889, 12198, 29898, 3670, 29897, 13, 13, 1678, 954, 29918, 14968, 29918, 16175, 267, 353, 5844, 29889, 27696, 29898, 2435, 29898, 29979, 29918, 14968, 29897, 847, 7945, 29918, 16175, 29918, 2311, 29897, 13, 1678, 954, 29918, 791, 29918, 19057, 353, 7431, 29898, 29979, 29918, 791, 29897, 13, 1678, 954, 29918, 791, 29918, 16175, 267, 353, 5844, 29889, 27696, 29898, 1949, 29918, 791, 29918, 19057, 847, 659, 29918, 16175, 29918, 2311, 29897, 13, 13, 1678, 822, 14707, 29898, 4299, 1125, 13, 4706, 3001, 29918, 6758, 353, 29871, 29900, 29889, 13, 4706, 3001, 29918, 15728, 29879, 353, 29871, 29900, 13, 13, 4706, 363, 903, 297, 3464, 29898, 1949, 29918, 791, 29918, 16175, 267, 1125, 13, 9651, 9853, 29918, 1272, 29892, 903, 353, 2446, 29898, 791, 29918, 27959, 29897, 13, 9651, 659, 29918, 6758, 29892, 8500, 353, 1904, 29889, 1688, 29918, 265, 29918, 16175, 29898, 16175, 29918, 1272, 29892, 343, 29922, 8516, 511, 1904, 29889, 27711, 29918, 265, 29918, 16175, 29898, 16175, 29918, 1272, 29897, 13, 13, 9651, 3001, 29918, 6758, 4619, 659, 29918, 6758, 13, 9651, 3001, 29918, 15728, 29879, 4619, 7442, 29889, 2083, 29898, 9302, 29889, 1191, 3317, 29898, 16175, 29918, 1272, 29961, 29900, 1402, 9685, 10457, 29896, 29897, 1275, 7442, 29889, 1191, 3317, 29898, 27711, 29892, 9685, 10457, 29896, 876, 13, 13, 4706, 659, 29918, 6758, 353, 3001, 29918, 6758, 847, 954, 29918, 791, 29918, 16175, 267, 13, 4706, 659, 29918, 5753, 353, 313, 7827, 29918, 15728, 29879, 847, 954, 29918, 791, 29918, 19057, 29897, 334, 29871, 29896, 29900, 29900, 13, 13, 4706, 736, 659, 29918, 6758, 29892, 659, 29918, 5753, 13, 13, 1678, 770, 382, 4387, 1061, 29898, 10717, 1125, 13, 4706, 822, 4770, 2344, 12035, 1311, 1125, 13, 9651, 2428, 29898, 29923, 4387, 1061, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 822, 373, 29918, 1022, 2878, 29918, 355, 29898, 1311, 29892, 21502, 305, 29892, 10748, 29922, 8516, 1125, 13, 9651, 659, 29918, 6758, 29892, 659, 29918, 5753, 353, 14707, 29898, 1311, 29889, 4299, 29897, 13, 13, 9651, 1596, 29898, 29888, 29915, 791, 29918, 6758, 353, 426, 791, 29918, 6758, 29901, 29889, 29945, 29888, 1118, 659, 29918, 5753, 353, 426, 791, 29918, 5753, 29901, 29889, 29906, 29888, 29913, 1495, 13, 13, 1678, 6161, 1061, 353, 382, 4387, 1061, 580, 13, 13, 1678, 1904, 29889, 9202, 29918, 27959, 29898, 13, 4706, 7945, 29918, 27959, 29892, 13, 4706, 6576, 29918, 546, 29918, 1022, 2878, 29922, 1949, 29918, 14968, 29918, 16175, 267, 29892, 13, 4706, 21502, 12168, 29922, 29896, 29900, 29892, 13, 4706, 6939, 29879, 11759, 24219, 1061, 1402, 13, 4706, 528, 21897, 29922, 8824, 29892, 13, 4706, 2847, 29918, 1022, 2878, 29922, 29900, 13, 1678, 1723, 13, 2 ]
lib/dataset/InterHandDataset.py
ZJULiHongxin/two-hand-pose-est
0
72931
# Copyright (c) Facebook, Inc. and its affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # import sys import os import time currentUrl = os.path.dirname(__file__) parentUrl = os.path.abspath(os.path.join(currentUrl, os.pardir)) sys.path.append(parentUrl) import argparse import numpy as np import torch import torch.utils.data from torch.utils.data import DataLoader from torchvision.transforms import functional as F import matplotlib.pyplot as plt import cv2 from glob import glob import os.path as osp from utils.preprocessing import load_img, load_skeleton, get_bbox, process_bbox, augmentation, transform_input_to_output_space, trans_point2d from utils.transforms import world2cam, cam2pixel, pixel2cam from utils.vis import vis_keypoints, vis_3d_keypoints, plot_hand from utils.standard_legends import idx_InterHand from PIL import Image, ImageDraw import random import json import math from pycocotools.coco import COCO import scipy.io as sio class InterHandDataset(torch.utils.data.Dataset): def __init__(self, cfg, transforms, mode): self.cfg = cfg self.name = 'InterHand' self.mode = mode # train, test, val self.img_path = osp.join(cfg.DATASET.DATA_DIR, 'images') # '../data/InterHand2.6M/images' self.annot_path = osp.join(cfg.DATASET.DATA_DIR, 'annotations') # '../data/InterHand2.6M/annotations' # if self.mode == 'val': # self.rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_val.json' # else: # self.rootnet_output_path = '../data/InterHand2.6M/rootnet_output/rootnet_interhand2.6m_output_test.json' self.transform = transforms self.joint_num = cfg.DATASET.NUM_JOINTS # 21 # single hand self.root_joint_idx = {'right': 0, 'left': 21} # Please modify this idx after changing the order of joints self.joint_type = {'right': np.arange(0,self.joint_num), 'left': np.arange(self.joint_num,self.joint_num*2)} self.skeleton = load_skeleton(osp.join(self.annot_path, 'skeleton.txt'), self.joint_num*2) self.datalist = [] self.datalist_sh = [] self.datalist_ih = [] self.sequence_names = [] # load annotation print("Load annotation from " + osp.join(self.annot_path, self.mode)) t1 = time.time() prefix = 'simple_' db = COCO(osp.join(self.annot_path, self.mode, prefix+'InterHand2.6M_' + self.mode + '_data.json')) with open(osp.join(self.annot_path, self.mode, 'InterHand2.6M_' + self.mode + '_camera.json')) as f: cameras = json.load(f) with open(osp.join(self.annot_path, self.mode, 'InterHand2.6M_' + self.mode + '_joint_3d.json')) as f: joints = json.load(f) print("Annotation loading spent {}s".format(time.time()-t1)) # if (self.mode == 'val' or self.mode == 'test') and cfg.trans_test == 'rootnet': # print("Get bbox and root depth from " + self.rootnet_output_path) # rootnet_result = {} # with open(self.rootnet_output_path) as f: # annot = json.load(f) # for i in range(len(annot)): # rootnet_result[str(annot[i]['annot_id'])] = annot[i] # else: # print("Get bbox and root depth from groundtruth annotation") for aid in db.anns.keys(): ann = db.anns[aid] image_id = ann['image_id'] img = db.loadImgs(image_id)[0] capture_id = img['capture'] seq_name = img['seq_name'] cam = img['camera'] frame_idx = img['frame_idx'] img_path = osp.join(self.img_path, self.mode, img['file_name']) campos, camrot = np.array(cameras[str(capture_id)]['campos'][str(cam)], dtype=np.float32), np.array(cameras[str(capture_id)]['camrot'][str(cam)], dtype=np.float32) focal, princpt = np.array(cameras[str(capture_id)]['focal'][str(cam)], dtype=np.float32), np.array(cameras[str(capture_id)]['princpt'][str(cam)], dtype=np.float32) # get the groundtruth pose and reorder it joint_world = np.array(joints[str(capture_id)][str(frame_idx)]['world_coord'], dtype=np.float32)[idx_InterHand] # 42 x 3 joint_cam = world2cam(joint_world.transpose(1,0), camrot, campos.reshape(3,1)).transpose(1,0) joint_img = cam2pixel(joint_cam, focal, princpt) # 42 x 2 [u,v] # 1 if a joint is annotated and inside of image. 0 otherwise joint_valid = np.array(ann['joint_valid'],dtype=np.float32).reshape(self.joint_num*2) # if root is not valid -> root-relative 3D pose is also not valid. Therefore, mark all joints as invalid joint_valid[self.joint_type['right']] *= joint_valid[self.root_joint_idx['right']] joint_valid[self.joint_type['left']] *= joint_valid[self.root_joint_idx['left']] hand_type = ann['hand_type'] # 1 if hand_type in ('right', 'left') or hand_type == 'interacting' and np.sum(joint_valid) > 30, 0 otherwise hand_type_valid = np.array((ann['hand_type_valid']), dtype=np.float32) # if (self.mode == 'val' or self.mode == 'test') and cfg.trans_test == 'rootnet': # bbox = np.array(rootnet_result[str(aid)]['bbox'],dtype=np.float32) # abs_depth = {'right': rootnet_result[str(aid)]['abs_depth'][0], 'left': rootnet_result[str(aid)]['abs_depth'][1]} # else: img_width, img_height = img['width'], img['height'] # original image size 344(w) x 512(h) bbox = np.array(ann['bbox'],dtype=np.float32) # x,y,w,h bbox = process_bbox(bbox, (img_height, img_width)) abs_depth = {'right': joint_cam[self.root_joint_idx['right'],2], 'left': joint_cam[self.root_joint_idx['left'],2]} cam_param = {'focal': focal, 'princpt': princpt} joint = {'cam_coord': joint_cam, 'img_coord': joint_img, 'valid': joint_valid} data = {'img_path': img_path, 'seq_name': seq_name, 'cam_param': cam_param, 'bbox': bbox, 'joint': joint, 'hand_type': hand_type, 'hand_type_valid': hand_type_valid, 'abs_depth': abs_depth, 'file_name': img['file_name'], 'capture': capture_id, 'cam': cam, 'frame': frame_idx} if hand_type == 'right' or hand_type == 'left': self.datalist_sh.append(data) else: self.datalist_ih.append(data) if seq_name not in self.sequence_names: self.sequence_names.append(seq_name) self.datalist = self.datalist_sh + self.datalist_ih print('Number of annotations in single hand sequences: ' + str(len(self.datalist_sh))) print('Number of annotations in interacting hand sequences: ' + str(len(self.datalist_ih))) def handtype_str2array(self, hand_type): if hand_type == 'right': return np.array([1,0], dtype=np.float32) elif hand_type == 'left': return np.array([0,1], dtype=np.float32) elif hand_type == 'interacting': return np.array([1,1], dtype=np.float32) else: assert 0, print('Not supported hand type: ' + hand_type) def __len__(self): return len(self.datalist) def __getitem__(self, idx): data = self.datalist[idx] img_path, bbox, joint, hand_type, hand_type_valid = data['img_path'], data['bbox'], data['joint'], data['hand_type'], data['hand_type_valid'] joint_cam = joint['cam_coord'].copy() joint_img = joint['img_coord'].copy() joint_valid = joint['valid'].copy() # 1 if inside the image, o other wise. # 42 hand_type_vec = self.handtype_str2array(hand_type) joint_coord = np.concatenate((joint_img, joint_cam[:,2,None]),1) # 42 x 3 [u,v,z] # input(joint_valid) # input(joint_coord) # image load try: img = cv2.cvtColor(cv2.imread(img_path, cv2.IMREAD_COLOR | cv2.IMREAD_IGNORE_ORIENTATION), cv2.COLOR_BGR2RGB) # 512 x 334 x 3 except: print('[Warning] Invalid image path:', img_path) # DEBUG # f = plt.figure() # ax1 = f.add_subplot(1,1,1) # ax1.imshow(img) # for k in range(joint_coord.shape[0]): # print('[{:.4f}, {:.4f}, {:.4f}],'.format(*joint_coord[k])) # print(hand_type_vec) # if hand_type_vec[0] == 1: # plot_hand(ax1, joint_coord[0:21,0:2], vis=joint_valid[0:21], order = 'uv') # elif hand_type_vec[1] == 1: # plot_hand(ax1, joint_coord[21:42,0:2], vis=joint_valid[21:42], order = 'uv') # ax1.set_title(hand_type) # plt.show() # augmentation img, joint_coord, joint_valid, hand_type_vec, inv_trans = augmentation(img, bbox, joint_coord, joint_valid, hand_type_vec, self.mode, self.joint_type, self.cfg.MODEL.INPUT_SIZE) # f1 = plt.figure() # ax1 = f1.add_subplot(1,1,1) # ax1.imshow(img.astype(int)) # for k in range(joint_coord.shape[0]): # print('[{:.4f}, {:.4f}, {:.4f}],'.format(*joint_coord[k])) # print(joint_coord) # if hand_type_vec[0] == 1: # plot_hand(ax1, joint_coord[0:21,0:2], vis=joint_valid[0:21], order = 'uv') # elif hand_type_vec[1] == 1: # plot_hand(ax1, joint_coord[21:42,0:2], vis=joint_valid[21:42], order = 'uv') # ax1.set_title(hand_type) # plt.show() #rel_root_depth = np.array([joint_coord[self.root_joint_idx['left'],2] - joint_coord[self.root_joint_idx['right'],2]],dtype=np.float32).reshape(1) #root_valid = np.array([joint_valid[self.root_joint_idx['right']] * joint_valid[self.root_joint_idx['left']]],dtype=np.float32).reshape(1) if hand_type_vec[0]*hand_type_vec[1] == 1 else np.zeros((1),dtype=np.float32) # transform to output heatmap space (this line of code is useless for anchor-based estimation) #joint_coord, joint_valid, rel_root_depth, root_valid = transform_input_to_output_space(self.cfg, joint_coord, joint_valid, rel_root_depth, root_valid, self.root_joint_idx, self.joint_type) img = self.transform(img.astype(np.float32) / 255.) # inputs = {'img': img} # targets = {'pose2d_gt': joint_coord, 'rel_root_depth': rel_root_depth, 'hand_type': hand_type_vec} # meta_info = {'joint_valid': joint_valid, 'root_valid': root_valid, 'hand_type_valid': hand_type_valid, 'inv_trans': inv_trans, 'capture': int(data['capture']), 'cam': int(data['cam']), 'frame': int(data['frame'])} return {'imgs': img, 'pose2d_gt': joint_coord, 'joint_valid': joint_valid, 'hand_type': hand_type_vec} #return inputs, targets, meta_info def evaluate(self, preds): print() print('Evaluation start...') gts = self.datalist preds_joint_coord, preds_rel_root_depth, preds_hand_type, inv_trans = preds['joint_coord'], preds['rel_root_depth'], preds['hand_type'], preds['inv_trans'] assert len(gts) == len(preds_joint_coord) sample_num = len(gts) mpjpe_sh = [[] for _ in range(self.joint_num*2)] mpjpe_ih = [[] for _ in range(self.joint_num*2)] mrrpe = [] acc_hand_cls = 0 hand_cls_cnt = 0 for n in range(sample_num): data = gts[n] bbox, cam_param, joint, gt_hand_type, hand_type_valid = data['bbox'], data['cam_param'], data['joint'], data['hand_type'], data['hand_type_valid'] focal = cam_param['focal'] princpt = cam_param['princpt'] gt_joint_coord = joint['cam_coord'] joint_valid = joint['valid'] # restore xy coordinates to original image space pred_joint_coord_img = preds_joint_coord[n].copy() pred_joint_coord_img[:,0] = pred_joint_coord_img[:,0]/cfg.output_hm_shape[2]*cfg.input_img_shape[1] pred_joint_coord_img[:,1] = pred_joint_coord_img[:,1]/cfg.output_hm_shape[1]*cfg.input_img_shape[0] for j in range(self.joint_num*2): pred_joint_coord_img[j,:2] = trans_point2d(pred_joint_coord_img[j,:2],inv_trans[n]) # restore depth to original camera space pred_joint_coord_img[:,2] = (pred_joint_coord_img[:,2]/cfg.output_hm_shape[0] * 2 - 1) * (cfg.bbox_3d_size/2) # mrrpe if gt_hand_type == 'interacting' and joint_valid[self.root_joint_idx['left']] and joint_valid[self.root_joint_idx['right']]: pred_rel_root_depth = (preds_rel_root_depth[n]/cfg.output_root_hm_shape * 2 - 1) * (cfg.bbox_3d_size_root/2) pred_left_root_img = pred_joint_coord_img[self.root_joint_idx['left']].copy() pred_left_root_img[2] += data['abs_depth']['right'] + pred_rel_root_depth pred_left_root_cam = pixel2cam(pred_left_root_img[None,:], focal, princpt)[0] pred_right_root_img = pred_joint_coord_img[self.root_joint_idx['right']].copy() pred_right_root_img[2] += data['abs_depth']['right'] pred_right_root_cam = pixel2cam(pred_right_root_img[None,:], focal, princpt)[0] pred_rel_root = pred_left_root_cam - pred_right_root_cam gt_rel_root = gt_joint_coord[self.root_joint_idx['left']] - gt_joint_coord[self.root_joint_idx['right']] mrrpe.append(float(np.sqrt(np.sum((pred_rel_root - gt_rel_root)**2)))) # add root joint depth pred_joint_coord_img[self.joint_type['right'],2] += data['abs_depth']['right'] pred_joint_coord_img[self.joint_type['left'],2] += data['abs_depth']['left'] # back project to camera coordinate system pred_joint_coord_cam = pixel2cam(pred_joint_coord_img, focal, princpt) # root joint alignment for h in ('right', 'left'): pred_joint_coord_cam[self.joint_type[h]] = pred_joint_coord_cam[self.joint_type[h]] - pred_joint_coord_cam[self.root_joint_idx[h],None,:] gt_joint_coord[self.joint_type[h]] = gt_joint_coord[self.joint_type[h]] - gt_joint_coord[self.root_joint_idx[h],None,:] # mpjpe for j in range(self.joint_num*2): if joint_valid[j]: if gt_hand_type == 'right' or gt_hand_type == 'left': mpjpe_sh[j].append(np.sqrt(np.sum((pred_joint_coord_cam[j] - gt_joint_coord[j])**2))) else: mpjpe_ih[j].append(np.sqrt(np.sum((pred_joint_coord_cam[j] - gt_joint_coord[j])**2))) # handedness accuray if hand_type_valid: if gt_hand_type == 'right' and preds_hand_type[n][0] > 0.5 and preds_hand_type[n][1] < 0.5: acc_hand_cls += 1 elif gt_hand_type == 'left' and preds_hand_type[n][0] < 0.5 and preds_hand_type[n][1] > 0.5: acc_hand_cls += 1 elif gt_hand_type == 'interacting' and preds_hand_type[n][0] > 0.5 and preds_hand_type[n][1] > 0.5: acc_hand_cls += 1 hand_cls_cnt += 1 vis = False if vis: img_path = data['img_path'] cvimg = cv2.imread(img_path, cv2.IMREAD_COLOR | cv2.IMREAD_IGNORE_ORIENTATION) _img = cvimg[:,:,::-1].transpose(2,0,1) vis_kps = pred_joint_coord_img.copy() vis_valid = joint_valid.copy() capture = str(data['capture']) cam = str(data['cam']) frame = str(data['frame']) filename = 'out_' + str(n) + '_' + gt_hand_type + '.jpg' vis_keypoints(_img, vis_kps, vis_valid, self.skeleton, filename) vis = False if vis: filename = 'out_' + str(n) + '_3d.jpg' vis_3d_keypoints(pred_joint_coord_cam, joint_valid, self.skeleton, filename) if hand_cls_cnt > 0: print('Handedness accuracy: ' + str(acc_hand_cls / hand_cls_cnt)) if len(mrrpe) > 0: print('MRRPE: ' + str(sum(mrrpe)/len(mrrpe))) print() tot_err = [] eval_summary = 'MPJPE for each joint: \n' for j in range(self.joint_num*2): tot_err_j = np.mean(np.concatenate((np.stack(mpjpe_sh[j]), np.stack(mpjpe_ih[j])))) joint_name = self.skeleton[j]['name'] eval_summary += (joint_name + ': %.2f, ' % tot_err_j) tot_err.append(tot_err_j) print(eval_summary) print('MPJPE for all hand sequences: %.2f' % (np.mean(tot_err))) print() eval_summary = 'MPJPE for each joint: \n' for j in range(self.joint_num*2): mpjpe_sh[j] = np.mean(np.stack(mpjpe_sh[j])) joint_name = self.skeleton[j]['name'] eval_summary += (joint_name + ': %.2f, ' % mpjpe_sh[j]) print(eval_summary) print('MPJPE for single hand sequences: %.2f' % (np.mean(mpjpe_sh))) print() eval_summary = 'MPJPE for each joint: \n' for j in range(self.joint_num*2): mpjpe_ih[j] = np.mean(np.stack(mpjpe_ih[j])) joint_name = self.skeleton[j]['name'] eval_summary += (joint_name + ': %.2f, ' % mpjpe_ih[j]) print(eval_summary) print('MPJPE for interacting hand sequences: %.2f' % (np.mean(mpjpe_ih))) if __name__ == "__main__": def add_path(path): if path not in sys.path: sys.path.insert(0, path) this_dir = osp.dirname(__file__) lib_path = osp.join(this_dir, '..', '..','lib') add_path(lib_path) mm_path = osp.join(this_dir, '..', 'lib/poseeval/py-motmetrics') add_path(mm_path) from torchvision import transforms from config.default import _C as cfg from config.default import update_config from utils.vis import plot_hand parser = argparse.ArgumentParser(description='Train keypoints network') parser.add_argument('--cfg', help='experiment configure file name', default='../../experiments/exp_test.yaml', type=str) parser.add_argument('opts', help="Modify config options using the command-line", default=None, nargs=argparse.REMAINDER) args = parser.parse_args() args.cfg = "../../experiments/exp_test.yaml" update_config(cfg, args) cfg.defrost() dataset = InterHandDataset(cfg, transforms.ToTensor(), "train") batch_generator = DataLoader(dataset=dataset, batch_size=1, shuffle=False, num_workers=0, pin_memory=True) for itr, (inputs, targets, meta_info) in enumerate(batch_generator): img = inputs['imgs'].numpy().squeeze()*255 # 1 x 3 x 256 x 256 joint_coord = targets['pose2d_gt'].numpy().squeeze() # [42, 3] # u,v pixel, z root-relative discretized depth joint_valid = meta_info['joint_valid'].numpy().squeeze() # [42] filename = 'result_2d.jpg' for k in range(joint_coord.shape[0]): print('[{},{}],'.format(joint_coord[k,0],joint_coord[k,1])) vis_img = vis_keypoints(img, joint_coord, joint_valid, dataset.skeleton, filename, save_path='.') filename = 'result_3d' vis_3d_keypoints(joint_coord, joint_valid, dataset.skeleton, filename)
[ 1, 396, 14187, 1266, 313, 29883, 29897, 13327, 29892, 9266, 29889, 322, 967, 23736, 1078, 29889, 13, 29937, 2178, 10462, 21676, 29889, 13, 29937, 13, 29937, 910, 2752, 775, 338, 7794, 21144, 1090, 278, 19405, 1476, 297, 278, 13, 29937, 365, 2965, 1430, 1660, 934, 297, 278, 3876, 3884, 310, 445, 2752, 5447, 29889, 13, 29937, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 931, 13, 3784, 5983, 353, 2897, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 29897, 13, 3560, 5983, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 3784, 5983, 29892, 2897, 29889, 29886, 538, 381, 876, 13, 9675, 29889, 2084, 29889, 4397, 29898, 3560, 5983, 29897, 13, 13, 5215, 1852, 5510, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 13239, 29889, 1272, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 13, 3166, 4842, 305, 4924, 29889, 9067, 29879, 1053, 13303, 408, 383, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 13850, 29906, 13, 3166, 13149, 1053, 13149, 13, 5215, 2897, 29889, 2084, 408, 288, 1028, 13, 13, 13, 3166, 3667, 29879, 29889, 1457, 19170, 1053, 2254, 29918, 2492, 29892, 2254, 29918, 26050, 11285, 29892, 679, 29918, 29890, 1884, 29892, 1889, 29918, 29890, 1884, 29892, 18765, 362, 29892, 4327, 29918, 2080, 29918, 517, 29918, 4905, 29918, 3493, 29892, 1301, 29918, 3149, 29906, 29881, 13, 3166, 3667, 29879, 29889, 9067, 29879, 1053, 3186, 29906, 11108, 29892, 3949, 29906, 29886, 15711, 29892, 15526, 29906, 11108, 13, 3166, 3667, 29879, 29889, 1730, 1053, 1998, 29918, 1989, 9748, 29892, 1998, 29918, 29941, 29881, 29918, 1989, 9748, 29892, 6492, 29918, 3179, 13, 3166, 3667, 29879, 29889, 15770, 29918, 1397, 1975, 1053, 22645, 29918, 4074, 3481, 13, 3166, 349, 6227, 1053, 7084, 29892, 7084, 8537, 13, 5215, 4036, 13, 5215, 4390, 13, 5215, 5844, 13, 3166, 282, 11078, 542, 327, 8789, 29889, 29883, 6235, 1053, 4810, 3217, 13, 5215, 4560, 2272, 29889, 601, 408, 269, 601, 13, 13, 13, 13, 13, 1990, 4124, 3481, 16390, 24541, 29898, 7345, 305, 29889, 13239, 29889, 1272, 29889, 16390, 24541, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 274, 16434, 29892, 4327, 29879, 29892, 4464, 1125, 13, 4706, 1583, 29889, 16859, 353, 274, 16434, 13, 4706, 1583, 29889, 978, 353, 525, 4074, 3481, 29915, 13, 4706, 1583, 29889, 8513, 353, 4464, 396, 7945, 29892, 1243, 29892, 659, 13, 4706, 1583, 29889, 2492, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 16859, 29889, 25832, 8127, 29911, 29889, 14573, 29918, 9464, 29892, 525, 8346, 1495, 396, 525, 6995, 1272, 29914, 4074, 3481, 29906, 29889, 29953, 29924, 29914, 8346, 29915, 13, 4706, 1583, 29889, 6735, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 16859, 29889, 25832, 8127, 29911, 29889, 14573, 29918, 9464, 29892, 525, 6735, 800, 1495, 396, 525, 6995, 1272, 29914, 4074, 3481, 29906, 29889, 29953, 29924, 29914, 6735, 800, 29915, 13, 4706, 396, 565, 1583, 29889, 8513, 1275, 525, 791, 2396, 13, 4706, 396, 268, 1583, 29889, 4632, 1212, 29918, 4905, 29918, 2084, 353, 525, 6995, 1272, 29914, 4074, 3481, 29906, 29889, 29953, 29924, 29914, 4632, 1212, 29918, 4905, 29914, 4632, 1212, 29918, 1639, 3179, 29906, 29889, 29953, 29885, 29918, 4905, 29918, 791, 29889, 3126, 29915, 13, 4706, 396, 1683, 29901, 13, 4706, 396, 268, 1583, 29889, 4632, 1212, 29918, 4905, 29918, 2084, 353, 525, 6995, 1272, 29914, 4074, 3481, 29906, 29889, 29953, 29924, 29914, 4632, 1212, 29918, 4905, 29914, 4632, 1212, 29918, 1639, 3179, 29906, 29889, 29953, 29885, 29918, 4905, 29918, 1688, 29889, 3126, 29915, 13, 4706, 1583, 29889, 9067, 353, 4327, 29879, 13, 13, 4706, 1583, 29889, 12090, 29918, 1949, 353, 274, 16434, 29889, 25832, 8127, 29911, 29889, 13967, 29918, 29967, 6992, 9375, 396, 29871, 29906, 29896, 396, 2323, 1361, 13, 4706, 1583, 29889, 4632, 29918, 12090, 29918, 13140, 353, 11117, 1266, 2396, 29871, 29900, 29892, 525, 1563, 2396, 29871, 29906, 29896, 29913, 396, 3529, 6623, 445, 22645, 1156, 6480, 278, 1797, 310, 14002, 29879, 13, 4706, 1583, 29889, 12090, 29918, 1853, 353, 11117, 1266, 2396, 7442, 29889, 279, 927, 29898, 29900, 29892, 1311, 29889, 12090, 29918, 1949, 511, 525, 1563, 2396, 7442, 29889, 279, 927, 29898, 1311, 29889, 12090, 29918, 1949, 29892, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 2915, 13, 4706, 1583, 29889, 26050, 11285, 353, 2254, 29918, 26050, 11285, 29898, 4705, 29889, 7122, 29898, 1311, 29889, 6735, 29918, 2084, 29892, 525, 26050, 11285, 29889, 3945, 5477, 1583, 29889, 12090, 29918, 1949, 29930, 29906, 29897, 13, 308, 13, 4706, 1583, 29889, 29881, 2075, 391, 353, 5159, 13, 4706, 1583, 29889, 29881, 2075, 391, 29918, 845, 353, 5159, 13, 4706, 1583, 29889, 29881, 2075, 391, 29918, 4861, 353, 5159, 13, 4706, 1583, 29889, 16506, 29918, 7039, 353, 5159, 29871, 13, 308, 13, 4706, 396, 2254, 17195, 13, 4706, 1596, 703, 5896, 17195, 515, 29871, 376, 718, 288, 1028, 29889, 7122, 29898, 1311, 29889, 6735, 29918, 2084, 29892, 1583, 29889, 8513, 876, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 4706, 10944, 353, 525, 12857, 29918, 29915, 13, 4706, 4833, 353, 4810, 3217, 29898, 4705, 29889, 7122, 29898, 1311, 29889, 6735, 29918, 2084, 29892, 1583, 29889, 8513, 29892, 10944, 23097, 4074, 3481, 29906, 29889, 29953, 29924, 29918, 29915, 718, 1583, 29889, 8513, 718, 22868, 1272, 29889, 3126, 8785, 13, 4706, 411, 1722, 29898, 4705, 29889, 7122, 29898, 1311, 29889, 6735, 29918, 2084, 29892, 1583, 29889, 8513, 29892, 525, 4074, 3481, 29906, 29889, 29953, 29924, 29918, 29915, 718, 1583, 29889, 8513, 718, 22868, 26065, 29889, 3126, 8785, 408, 285, 29901, 13, 9651, 3949, 18464, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 4706, 411, 1722, 29898, 4705, 29889, 7122, 29898, 1311, 29889, 6735, 29918, 2084, 29892, 1583, 29889, 8513, 29892, 525, 4074, 3481, 29906, 29889, 29953, 29924, 29918, 29915, 718, 1583, 29889, 8513, 718, 22868, 12090, 29918, 29941, 29881, 29889, 3126, 8785, 408, 285, 29901, 13, 9651, 14002, 29879, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 4706, 1596, 703, 21978, 8363, 10398, 6571, 29879, 1642, 4830, 29898, 2230, 29889, 2230, 580, 29899, 29873, 29896, 876, 13, 4706, 396, 565, 313, 1311, 29889, 8513, 1275, 525, 791, 29915, 470, 1583, 29889, 8513, 1275, 525, 1688, 1495, 322, 274, 16434, 29889, 3286, 29918, 1688, 1275, 525, 4632, 1212, 2396, 13, 4706, 396, 268, 1596, 703, 2577, 289, 1884, 322, 3876, 10809, 515, 376, 718, 1583, 29889, 4632, 1212, 29918, 4905, 29918, 2084, 29897, 13, 4706, 396, 268, 3876, 1212, 29918, 2914, 353, 6571, 13, 4706, 396, 268, 411, 1722, 29898, 1311, 29889, 4632, 1212, 29918, 4905, 29918, 2084, 29897, 408, 285, 29901, 13, 4706, 396, 308, 9732, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 4706, 396, 268, 363, 474, 297, 3464, 29898, 2435, 29898, 6735, 22164, 13, 4706, 396, 308, 3876, 1212, 29918, 2914, 29961, 710, 29898, 6735, 29961, 29875, 22322, 6735, 29918, 333, 2033, 4638, 353, 9732, 29961, 29875, 29962, 13, 4706, 396, 1683, 29901, 13, 4706, 396, 268, 1596, 703, 2577, 289, 1884, 322, 3876, 10809, 515, 5962, 509, 2806, 17195, 1159, 13, 308, 13, 4706, 363, 16226, 297, 4833, 29889, 812, 29879, 29889, 8149, 7295, 13, 9651, 2889, 353, 4833, 29889, 812, 29879, 29961, 29874, 333, 29962, 13, 9651, 1967, 29918, 333, 353, 2889, 1839, 3027, 29918, 333, 2033, 13, 9651, 10153, 353, 4833, 29889, 1359, 1888, 3174, 29898, 3027, 29918, 333, 9601, 29900, 29962, 13, 29871, 13, 9651, 10446, 29918, 333, 353, 10153, 1839, 17885, 545, 2033, 13, 9651, 19359, 29918, 978, 353, 10153, 1839, 11762, 29918, 978, 2033, 13, 9651, 3949, 353, 10153, 1839, 26065, 2033, 13, 9651, 3515, 29918, 13140, 353, 10153, 1839, 2557, 29918, 13140, 2033, 13, 9651, 10153, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 1311, 29889, 2492, 29918, 2084, 29892, 1583, 29889, 8513, 29892, 10153, 1839, 1445, 29918, 978, 11287, 13, 632, 13, 9651, 3949, 1066, 29892, 3949, 5450, 353, 7442, 29889, 2378, 29898, 29883, 4183, 294, 29961, 710, 29898, 17885, 545, 29918, 333, 4638, 1839, 11108, 1066, 2033, 29961, 710, 29898, 11108, 29897, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 511, 7442, 29889, 2378, 29898, 29883, 4183, 294, 29961, 710, 29898, 17885, 545, 29918, 333, 4638, 1839, 11108, 5450, 2033, 29961, 710, 29898, 11108, 29897, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 9651, 12789, 284, 29892, 544, 3742, 415, 353, 7442, 29889, 2378, 29898, 29883, 4183, 294, 29961, 710, 29898, 17885, 545, 29918, 333, 4638, 1839, 29888, 18642, 2033, 29961, 710, 29898, 11108, 29897, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 511, 7442, 29889, 2378, 29898, 29883, 4183, 294, 29961, 710, 29898, 17885, 545, 29918, 333, 4638, 1839, 558, 3742, 415, 2033, 29961, 710, 29898, 11108, 29897, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 9651, 396, 679, 278, 5962, 509, 2806, 18593, 322, 337, 2098, 372, 13, 9651, 14002, 29918, 11526, 353, 7442, 29889, 2378, 29898, 2212, 9466, 29961, 710, 29898, 17885, 545, 29918, 333, 29897, 3816, 710, 29898, 2557, 29918, 13140, 4638, 1839, 11526, 29918, 1111, 536, 7464, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 9601, 13140, 29918, 4074, 3481, 29962, 396, 29871, 29946, 29906, 921, 29871, 29941, 418, 13, 9651, 14002, 29918, 11108, 353, 3186, 29906, 11108, 29898, 12090, 29918, 11526, 29889, 3286, 4220, 29898, 29896, 29892, 29900, 511, 3949, 5450, 29892, 3949, 1066, 29889, 690, 14443, 29898, 29941, 29892, 29896, 8106, 3286, 4220, 29898, 29896, 29892, 29900, 29897, 13, 9651, 14002, 29918, 2492, 353, 3949, 29906, 29886, 15711, 29898, 12090, 29918, 11108, 29892, 12789, 284, 29892, 544, 3742, 415, 29897, 396, 29871, 29946, 29906, 921, 29871, 29906, 518, 29884, 29892, 29894, 29962, 13, 13, 9651, 396, 29871, 29896, 565, 263, 14002, 338, 9732, 630, 322, 2768, 310, 1967, 29889, 29871, 29900, 6467, 13, 9651, 14002, 29918, 3084, 353, 7442, 29889, 2378, 29898, 812, 1839, 12090, 29918, 3084, 7464, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 467, 690, 14443, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 29897, 13, 9651, 396, 565, 3876, 338, 451, 2854, 1599, 3876, 29899, 22925, 29871, 29941, 29928, 18593, 338, 884, 451, 2854, 29889, 7857, 29892, 2791, 599, 14002, 29879, 408, 8340, 13, 9651, 14002, 29918, 3084, 29961, 1311, 29889, 12090, 29918, 1853, 1839, 1266, 2033, 29962, 334, 29922, 14002, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 2033, 29962, 13, 9651, 14002, 29918, 3084, 29961, 1311, 29889, 12090, 29918, 1853, 1839, 1563, 2033, 29962, 334, 29922, 14002, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 2033, 29962, 13, 9651, 1361, 29918, 1853, 353, 2889, 1839, 3179, 29918, 1853, 2033, 13, 13, 9651, 396, 29871, 29896, 565, 1361, 29918, 1853, 297, 6702, 1266, 742, 525, 1563, 1495, 470, 1361, 29918, 1853, 1275, 525, 1639, 627, 292, 29915, 322, 7442, 29889, 2083, 29898, 12090, 29918, 3084, 29897, 1405, 29871, 29941, 29900, 29892, 29871, 29900, 6467, 13, 9651, 1361, 29918, 1853, 29918, 3084, 353, 7442, 29889, 2378, 3552, 812, 1839, 3179, 29918, 1853, 29918, 3084, 2033, 511, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 632, 13, 9651, 396, 565, 313, 1311, 29889, 8513, 1275, 525, 791, 29915, 470, 1583, 29889, 8513, 1275, 525, 1688, 1495, 322, 274, 16434, 29889, 3286, 29918, 1688, 1275, 525, 4632, 1212, 2396, 13, 9651, 396, 268, 289, 1884, 353, 7442, 29889, 2378, 29898, 4632, 1212, 29918, 2914, 29961, 710, 29898, 29874, 333, 4638, 1839, 29890, 1884, 7464, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 9651, 396, 268, 6425, 29918, 19488, 353, 11117, 1266, 2396, 3876, 1212, 29918, 2914, 29961, 710, 29898, 29874, 333, 4638, 1839, 6897, 29918, 19488, 2033, 29961, 29900, 1402, 525, 1563, 2396, 3876, 1212, 29918, 2914, 29961, 710, 29898, 29874, 333, 4638, 1839, 6897, 29918, 19488, 2033, 29961, 29896, 12258, 13, 9651, 396, 1683, 29901, 13, 9651, 10153, 29918, 2103, 29892, 10153, 29918, 3545, 353, 10153, 1839, 2103, 7464, 10153, 1839, 3545, 2033, 396, 2441, 1967, 2159, 29871, 29941, 29946, 29946, 29898, 29893, 29897, 921, 29871, 29945, 29896, 29906, 29898, 29882, 29897, 13, 13, 9651, 289, 1884, 353, 7442, 29889, 2378, 29898, 812, 1839, 29890, 1884, 7464, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 396, 921, 29892, 29891, 29892, 29893, 29892, 29882, 13, 9651, 289, 1884, 353, 1889, 29918, 29890, 1884, 29898, 29890, 1884, 29892, 313, 2492, 29918, 3545, 29892, 10153, 29918, 2103, 876, 13, 9651, 6425, 29918, 19488, 353, 11117, 1266, 2396, 14002, 29918, 11108, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 7464, 29906, 1402, 525, 1563, 2396, 14002, 29918, 11108, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 7464, 29906, 12258, 13, 13, 9651, 3949, 29918, 3207, 353, 11117, 29888, 18642, 2396, 12789, 284, 29892, 525, 558, 3742, 415, 2396, 544, 3742, 415, 29913, 13, 9651, 14002, 353, 11117, 11108, 29918, 1111, 536, 2396, 14002, 29918, 11108, 29892, 525, 2492, 29918, 1111, 536, 2396, 14002, 29918, 2492, 29892, 525, 3084, 2396, 14002, 29918, 3084, 29913, 13, 9651, 848, 353, 11117, 2492, 29918, 2084, 2396, 10153, 29918, 2084, 29892, 525, 11762, 29918, 978, 2396, 19359, 29918, 978, 29892, 525, 11108, 29918, 3207, 2396, 3949, 29918, 3207, 29892, 525, 29890, 1884, 2396, 289, 1884, 29892, 525, 12090, 2396, 14002, 29892, 525, 3179, 29918, 1853, 2396, 1361, 29918, 1853, 29892, 525, 3179, 29918, 1853, 29918, 3084, 2396, 1361, 29918, 1853, 29918, 3084, 29892, 525, 6897, 29918, 19488, 2396, 6425, 29918, 19488, 29892, 525, 1445, 29918, 978, 2396, 10153, 1839, 1445, 29918, 978, 7464, 525, 17885, 545, 2396, 10446, 29918, 333, 29892, 525, 11108, 2396, 3949, 29892, 525, 2557, 2396, 3515, 29918, 13140, 29913, 13, 9651, 565, 1361, 29918, 1853, 1275, 525, 1266, 29915, 470, 1361, 29918, 1853, 1275, 525, 1563, 2396, 13, 18884, 1583, 29889, 29881, 2075, 391, 29918, 845, 29889, 4397, 29898, 1272, 29897, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 29881, 2075, 391, 29918, 4861, 29889, 4397, 29898, 1272, 29897, 13, 9651, 565, 19359, 29918, 978, 451, 297, 1583, 29889, 16506, 29918, 7039, 29901, 13, 18884, 1583, 29889, 16506, 29918, 7039, 29889, 4397, 29898, 11762, 29918, 978, 29897, 13, 13, 4706, 1583, 29889, 29881, 2075, 391, 353, 1583, 29889, 29881, 2075, 391, 29918, 845, 718, 1583, 29889, 29881, 2075, 391, 29918, 4861, 13, 4706, 1596, 877, 4557, 310, 25495, 297, 2323, 1361, 15602, 29901, 525, 718, 851, 29898, 2435, 29898, 1311, 29889, 29881, 2075, 391, 29918, 845, 4961, 13, 4706, 1596, 877, 4557, 310, 25495, 297, 16254, 292, 1361, 15602, 29901, 525, 718, 851, 29898, 2435, 29898, 1311, 29889, 29881, 2075, 391, 29918, 4861, 4961, 13, 13, 1678, 822, 1361, 1853, 29918, 710, 29906, 2378, 29898, 1311, 29892, 1361, 29918, 1853, 1125, 13, 4706, 565, 1361, 29918, 1853, 1275, 525, 1266, 2396, 13, 9651, 736, 7442, 29889, 2378, 4197, 29896, 29892, 29900, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 25342, 1361, 29918, 1853, 1275, 525, 1563, 2396, 13, 9651, 736, 7442, 29889, 2378, 4197, 29900, 29892, 29896, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 25342, 1361, 29918, 1853, 1275, 525, 1639, 627, 292, 2396, 13, 9651, 736, 7442, 29889, 2378, 4197, 29896, 29892, 29896, 1402, 26688, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 1683, 29901, 13, 9651, 4974, 29871, 29900, 29892, 1596, 877, 3664, 6969, 1361, 1134, 29901, 525, 718, 1361, 29918, 1853, 29897, 13, 268, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 7431, 29898, 1311, 29889, 29881, 2075, 391, 29897, 13, 268, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 22645, 1125, 13, 4706, 848, 353, 1583, 29889, 29881, 2075, 391, 29961, 13140, 29962, 13, 4706, 10153, 29918, 2084, 29892, 289, 1884, 29892, 14002, 29892, 1361, 29918, 1853, 29892, 1361, 29918, 1853, 29918, 3084, 353, 848, 1839, 2492, 29918, 2084, 7464, 848, 1839, 29890, 1884, 7464, 848, 1839, 12090, 7464, 848, 1839, 3179, 29918, 1853, 7464, 848, 1839, 3179, 29918, 1853, 29918, 3084, 2033, 13, 4706, 14002, 29918, 11108, 353, 14002, 1839, 11108, 29918, 1111, 536, 13359, 8552, 580, 13, 4706, 14002, 29918, 2492, 353, 14002, 1839, 2492, 29918, 1111, 536, 13359, 8552, 580, 13, 4706, 14002, 29918, 3084, 353, 14002, 1839, 3084, 13359, 8552, 580, 396, 29871, 29896, 565, 2768, 278, 1967, 29892, 288, 916, 19396, 29889, 396, 29871, 29946, 29906, 13, 4706, 1361, 29918, 1853, 29918, 2003, 353, 1583, 29889, 3179, 1853, 29918, 710, 29906, 2378, 29898, 3179, 29918, 1853, 29897, 13, 4706, 14002, 29918, 1111, 536, 353, 7442, 29889, 535, 29883, 2579, 403, 3552, 12090, 29918, 2492, 29892, 14002, 29918, 11108, 7503, 29892, 29906, 29892, 8516, 11724, 29896, 29897, 396, 29871, 29946, 29906, 921, 29871, 29941, 518, 29884, 29892, 29894, 29892, 29920, 29962, 13, 4706, 396, 1881, 29898, 12090, 29918, 3084, 29897, 13, 4706, 396, 1881, 29898, 12090, 29918, 1111, 536, 29897, 13, 4706, 396, 1967, 2254, 13, 4706, 1018, 29901, 13, 9651, 10153, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 11023, 29906, 29889, 326, 949, 29898, 2492, 29918, 2084, 29892, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 891, 13850, 29906, 29889, 7833, 16310, 29918, 6259, 6632, 1525, 29918, 1955, 29902, 3919, 8098, 511, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 28212, 29897, 396, 29871, 29945, 29896, 29906, 921, 29871, 29941, 29941, 29946, 921, 29871, 29941, 13, 4706, 5174, 29901, 13, 9651, 1596, 877, 29961, 22709, 29962, 21403, 1967, 2224, 29901, 742, 10153, 29918, 2084, 29897, 13, 13, 4706, 396, 21681, 13, 13, 4706, 396, 285, 353, 14770, 29889, 4532, 580, 13, 4706, 396, 4853, 29896, 353, 285, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29896, 29892, 29896, 29897, 13, 4706, 396, 4853, 29896, 29889, 326, 4294, 29898, 2492, 29897, 13, 4706, 396, 363, 413, 297, 3464, 29898, 12090, 29918, 1111, 536, 29889, 12181, 29961, 29900, 29962, 1125, 13, 4706, 396, 268, 1596, 877, 19660, 29901, 29889, 29946, 29888, 1118, 12365, 29889, 29946, 29888, 1118, 12365, 29889, 29946, 29888, 29913, 1402, 4286, 4830, 10456, 12090, 29918, 1111, 536, 29961, 29895, 12622, 13, 4706, 396, 1596, 29898, 3179, 29918, 1853, 29918, 2003, 29897, 13, 4706, 396, 565, 1361, 29918, 1853, 29918, 2003, 29961, 29900, 29962, 1275, 29871, 29896, 29901, 13, 4706, 396, 268, 6492, 29918, 3179, 29898, 1165, 29896, 29892, 14002, 29918, 1111, 536, 29961, 29900, 29901, 29906, 29896, 29892, 29900, 29901, 29906, 1402, 1998, 29922, 12090, 29918, 3084, 29961, 29900, 29901, 29906, 29896, 1402, 1797, 353, 525, 4090, 1495, 13, 4706, 396, 25342, 1361, 29918, 1853, 29918, 2003, 29961, 29896, 29962, 1275, 29871, 29896, 29901, 13, 4706, 396, 268, 6492, 29918, 3179, 29898, 1165, 29896, 29892, 14002, 29918, 1111, 536, 29961, 29906, 29896, 29901, 29946, 29906, 29892, 29900, 29901, 29906, 1402, 1998, 29922, 12090, 29918, 3084, 29961, 29906, 29896, 29901, 29946, 29906, 1402, 1797, 353, 525, 4090, 1495, 13, 4706, 396, 4853, 29896, 29889, 842, 29918, 3257, 29898, 3179, 29918, 1853, 29897, 13, 4706, 396, 14770, 29889, 4294, 580, 13, 13, 4706, 396, 18765, 362, 13, 4706, 10153, 29892, 14002, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 1361, 29918, 1853, 29918, 2003, 29892, 2437, 29918, 3286, 353, 18765, 362, 29898, 2492, 29892, 289, 1884, 29892, 14002, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 1361, 29918, 1853, 29918, 2003, 29892, 1583, 29889, 8513, 29892, 1583, 29889, 12090, 29918, 1853, 29892, 1583, 29889, 16859, 29889, 20387, 29931, 29889, 1177, 12336, 29918, 14226, 29897, 13, 13, 4706, 396, 285, 29896, 353, 14770, 29889, 4532, 580, 13, 4706, 396, 4853, 29896, 353, 285, 29896, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29892, 29896, 29892, 29896, 29897, 13, 4706, 396, 4853, 29896, 29889, 326, 4294, 29898, 2492, 29889, 579, 668, 29898, 524, 876, 13, 13, 4706, 396, 363, 413, 297, 3464, 29898, 12090, 29918, 1111, 536, 29889, 12181, 29961, 29900, 29962, 1125, 13, 4706, 396, 268, 1596, 877, 19660, 29901, 29889, 29946, 29888, 1118, 12365, 29889, 29946, 29888, 1118, 12365, 29889, 29946, 29888, 29913, 1402, 4286, 4830, 10456, 12090, 29918, 1111, 536, 29961, 29895, 12622, 13, 4706, 396, 1596, 29898, 12090, 29918, 1111, 536, 29897, 13, 4706, 396, 565, 1361, 29918, 1853, 29918, 2003, 29961, 29900, 29962, 1275, 29871, 29896, 29901, 13, 4706, 396, 268, 6492, 29918, 3179, 29898, 1165, 29896, 29892, 14002, 29918, 1111, 536, 29961, 29900, 29901, 29906, 29896, 29892, 29900, 29901, 29906, 1402, 1998, 29922, 12090, 29918, 3084, 29961, 29900, 29901, 29906, 29896, 1402, 1797, 353, 525, 4090, 1495, 13, 4706, 396, 25342, 1361, 29918, 1853, 29918, 2003, 29961, 29896, 29962, 1275, 29871, 29896, 29901, 13, 4706, 396, 268, 6492, 29918, 3179, 29898, 1165, 29896, 29892, 14002, 29918, 1111, 536, 29961, 29906, 29896, 29901, 29946, 29906, 29892, 29900, 29901, 29906, 1402, 1998, 29922, 12090, 29918, 3084, 29961, 29906, 29896, 29901, 29946, 29906, 1402, 1797, 353, 525, 4090, 1495, 13, 4706, 396, 4853, 29896, 29889, 842, 29918, 3257, 29898, 3179, 29918, 1853, 29897, 13, 4706, 396, 14770, 29889, 4294, 580, 13, 308, 13, 4706, 396, 2674, 29918, 4632, 29918, 19488, 353, 7442, 29889, 2378, 4197, 12090, 29918, 1111, 536, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 7464, 29906, 29962, 448, 14002, 29918, 1111, 536, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 7464, 29906, 20526, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 467, 690, 14443, 29898, 29896, 29897, 13, 4706, 396, 4632, 29918, 3084, 353, 7442, 29889, 2378, 4197, 12090, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 2033, 29962, 334, 14002, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 2033, 20526, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 467, 690, 14443, 29898, 29896, 29897, 565, 1361, 29918, 1853, 29918, 2003, 29961, 29900, 14178, 3179, 29918, 1853, 29918, 2003, 29961, 29896, 29962, 1275, 29871, 29896, 1683, 7442, 29889, 3298, 359, 3552, 29896, 511, 29881, 1853, 29922, 9302, 29889, 7411, 29941, 29906, 29897, 13, 308, 13, 4706, 396, 4327, 304, 1962, 12871, 1958, 2913, 313, 1366, 1196, 310, 775, 338, 19315, 363, 17360, 29899, 6707, 23248, 29897, 13, 4706, 396, 12090, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 1104, 29918, 4632, 29918, 19488, 29892, 3876, 29918, 3084, 353, 4327, 29918, 2080, 29918, 517, 29918, 4905, 29918, 3493, 29898, 1311, 29889, 16859, 29892, 14002, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 1104, 29918, 4632, 29918, 19488, 29892, 3876, 29918, 3084, 29892, 1583, 29889, 4632, 29918, 12090, 29918, 13140, 29892, 1583, 29889, 12090, 29918, 1853, 29897, 13, 4706, 10153, 353, 1583, 29889, 9067, 29898, 2492, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 847, 29871, 29906, 29945, 29945, 1846, 13, 13, 4706, 396, 10970, 353, 11117, 2492, 2396, 10153, 29913, 13, 4706, 396, 22525, 353, 11117, 4220, 29906, 29881, 29918, 4141, 2396, 14002, 29918, 1111, 536, 29892, 525, 2674, 29918, 4632, 29918, 19488, 2396, 1104, 29918, 4632, 29918, 19488, 29892, 525, 3179, 29918, 1853, 2396, 1361, 29918, 1853, 29918, 2003, 29913, 13, 4706, 396, 12700, 29918, 3888, 353, 11117, 12090, 29918, 3084, 2396, 14002, 29918, 3084, 29892, 525, 4632, 29918, 3084, 2396, 3876, 29918, 3084, 29892, 525, 3179, 29918, 1853, 29918, 3084, 2396, 1361, 29918, 1853, 29918, 3084, 29892, 525, 11569, 29918, 3286, 2396, 2437, 29918, 3286, 29892, 525, 17885, 545, 2396, 938, 29898, 1272, 1839, 17885, 545, 2033, 511, 525, 11108, 2396, 938, 29898, 1272, 1839, 11108, 2033, 511, 525, 2557, 2396, 938, 29898, 1272, 1839, 2557, 2033, 2915, 13, 308, 13, 4706, 736, 29871, 11117, 2492, 29879, 2396, 10153, 29892, 525, 4220, 29906, 29881, 29918, 4141, 2396, 14002, 29918, 1111, 536, 29892, 525, 12090, 29918, 3084, 2396, 14002, 29918, 3084, 29892, 525, 3179, 29918, 1853, 2396, 1361, 29918, 1853, 29918, 2003, 29913, 13, 4706, 396, 2457, 10970, 29892, 22525, 29892, 12700, 29918, 3888, 13, 13, 1678, 822, 14707, 29898, 1311, 29892, 4450, 29879, 1125, 13, 13, 4706, 1596, 580, 29871, 13, 4706, 1596, 877, 29923, 4387, 362, 1369, 856, 1495, 13, 13, 4706, 330, 1372, 353, 1583, 29889, 29881, 2075, 391, 13, 4706, 4450, 29879, 29918, 12090, 29918, 1111, 536, 29892, 4450, 29879, 29918, 2674, 29918, 4632, 29918, 19488, 29892, 4450, 29879, 29918, 3179, 29918, 1853, 29892, 2437, 29918, 3286, 353, 4450, 29879, 1839, 12090, 29918, 1111, 536, 7464, 4450, 29879, 1839, 2674, 29918, 4632, 29918, 19488, 7464, 4450, 29879, 1839, 3179, 29918, 1853, 7464, 4450, 29879, 1839, 11569, 29918, 3286, 2033, 13, 4706, 4974, 7431, 29898, 29887, 1372, 29897, 1275, 7431, 29898, 11965, 29879, 29918, 12090, 29918, 1111, 536, 29897, 13, 4706, 4559, 29918, 1949, 353, 7431, 29898, 29887, 1372, 29897, 13, 308, 13, 4706, 22326, 29926, 412, 29918, 845, 353, 518, 2636, 363, 903, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 4638, 13, 4706, 22326, 29926, 412, 29918, 4861, 353, 518, 2636, 363, 903, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 4638, 13, 4706, 286, 21478, 412, 353, 5159, 13, 4706, 1035, 29918, 3179, 29918, 25932, 353, 29871, 29900, 13, 4706, 1361, 29918, 25932, 29918, 20047, 353, 29871, 29900, 13, 4706, 363, 302, 297, 3464, 29898, 11249, 29918, 1949, 1125, 13, 9651, 848, 353, 330, 1372, 29961, 29876, 29962, 13, 9651, 289, 1884, 29892, 3949, 29918, 3207, 29892, 14002, 29892, 330, 29873, 29918, 3179, 29918, 1853, 29892, 1361, 29918, 1853, 29918, 3084, 353, 848, 1839, 29890, 1884, 7464, 848, 1839, 11108, 29918, 3207, 7464, 848, 1839, 12090, 7464, 848, 1839, 3179, 29918, 1853, 7464, 848, 1839, 3179, 29918, 1853, 29918, 3084, 2033, 13, 9651, 12789, 284, 353, 3949, 29918, 3207, 1839, 29888, 18642, 2033, 13, 9651, 544, 3742, 415, 353, 3949, 29918, 3207, 1839, 558, 3742, 415, 2033, 13, 9651, 330, 29873, 29918, 12090, 29918, 1111, 536, 353, 14002, 1839, 11108, 29918, 1111, 536, 2033, 13, 9651, 14002, 29918, 3084, 353, 14002, 1839, 3084, 2033, 13, 632, 13, 9651, 396, 17749, 921, 29891, 10350, 304, 2441, 1967, 2913, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 353, 4450, 29879, 29918, 12090, 29918, 1111, 536, 29961, 29876, 1822, 8552, 580, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29900, 29962, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29900, 16261, 16859, 29889, 4905, 29918, 7184, 29918, 12181, 29961, 29906, 14178, 16859, 29889, 2080, 29918, 2492, 29918, 12181, 29961, 29896, 29962, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29896, 29962, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29896, 16261, 16859, 29889, 4905, 29918, 7184, 29918, 12181, 29961, 29896, 14178, 16859, 29889, 2080, 29918, 2492, 29918, 12181, 29961, 29900, 29962, 13, 9651, 363, 432, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 1125, 13, 18884, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 29926, 29892, 29901, 29906, 29962, 353, 1301, 29918, 3149, 29906, 29881, 29898, 11965, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 29926, 29892, 29901, 29906, 1402, 11569, 29918, 3286, 29961, 29876, 2314, 13, 9651, 396, 17749, 10809, 304, 2441, 10656, 2913, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29906, 29962, 353, 313, 11965, 29918, 12090, 29918, 1111, 536, 29918, 2492, 7503, 29892, 29906, 16261, 16859, 29889, 4905, 29918, 7184, 29918, 12181, 29961, 29900, 29962, 334, 29871, 29906, 448, 29871, 29896, 29897, 334, 313, 16859, 29889, 29890, 1884, 29918, 29941, 29881, 29918, 2311, 29914, 29906, 29897, 13, 29871, 13, 9651, 396, 286, 21478, 412, 13, 9651, 565, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1639, 627, 292, 29915, 322, 14002, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 2033, 29962, 322, 14002, 29918, 3084, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 2033, 5387, 13, 18884, 4450, 29918, 2674, 29918, 4632, 29918, 19488, 353, 313, 11965, 29879, 29918, 2674, 29918, 4632, 29918, 19488, 29961, 29876, 16261, 16859, 29889, 4905, 29918, 4632, 29918, 7184, 29918, 12181, 334, 29871, 29906, 448, 29871, 29896, 29897, 334, 313, 16859, 29889, 29890, 1884, 29918, 29941, 29881, 29918, 2311, 29918, 4632, 29914, 29906, 29897, 13, 13, 18884, 4450, 29918, 1563, 29918, 4632, 29918, 2492, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 2033, 1822, 8552, 580, 13, 18884, 4450, 29918, 1563, 29918, 4632, 29918, 2492, 29961, 29906, 29962, 4619, 848, 1839, 6897, 29918, 19488, 16215, 1266, 2033, 718, 4450, 29918, 2674, 29918, 4632, 29918, 19488, 13, 18884, 4450, 29918, 1563, 29918, 4632, 29918, 11108, 353, 15526, 29906, 11108, 29898, 11965, 29918, 1563, 29918, 4632, 29918, 2492, 29961, 8516, 29892, 29901, 1402, 12789, 284, 29892, 544, 3742, 415, 9601, 29900, 29962, 13, 13, 18884, 4450, 29918, 1266, 29918, 4632, 29918, 2492, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 2033, 1822, 8552, 580, 13, 18884, 4450, 29918, 1266, 29918, 4632, 29918, 2492, 29961, 29906, 29962, 4619, 848, 1839, 6897, 29918, 19488, 16215, 1266, 2033, 13, 18884, 4450, 29918, 1266, 29918, 4632, 29918, 11108, 353, 15526, 29906, 11108, 29898, 11965, 29918, 1266, 29918, 4632, 29918, 2492, 29961, 8516, 29892, 29901, 1402, 12789, 284, 29892, 544, 3742, 415, 9601, 29900, 29962, 13, 462, 13, 18884, 4450, 29918, 2674, 29918, 4632, 353, 4450, 29918, 1563, 29918, 4632, 29918, 11108, 448, 4450, 29918, 1266, 29918, 4632, 29918, 11108, 13, 18884, 330, 29873, 29918, 2674, 29918, 4632, 353, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1563, 2033, 29962, 448, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 1839, 1266, 2033, 29962, 13, 18884, 286, 21478, 412, 29889, 4397, 29898, 7411, 29898, 9302, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 11965, 29918, 2674, 29918, 4632, 448, 330, 29873, 29918, 2674, 29918, 4632, 29897, 1068, 29906, 13697, 13, 13, 9651, 13, 9651, 396, 788, 3876, 14002, 10809, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 1311, 29889, 12090, 29918, 1853, 1839, 1266, 7464, 29906, 29962, 4619, 848, 1839, 6897, 29918, 19488, 16215, 1266, 2033, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29961, 1311, 29889, 12090, 29918, 1853, 1839, 1563, 7464, 29906, 29962, 4619, 848, 1839, 6897, 29918, 19488, 16215, 1563, 2033, 13, 13, 9651, 396, 1250, 2060, 304, 10656, 14821, 1788, 13, 9651, 4450, 29918, 12090, 29918, 1111, 536, 29918, 11108, 353, 15526, 29906, 11108, 29898, 11965, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29892, 12789, 284, 29892, 544, 3742, 415, 29897, 13, 13, 9651, 396, 3876, 14002, 22239, 13, 9651, 363, 298, 297, 6702, 1266, 742, 525, 1563, 29374, 13, 18884, 4450, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29961, 1311, 29889, 12090, 29918, 1853, 29961, 29882, 5262, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29961, 1311, 29889, 12090, 29918, 1853, 29961, 29882, 5262, 448, 4450, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 29961, 29882, 1402, 8516, 29892, 17531, 13, 18884, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 1311, 29889, 12090, 29918, 1853, 29961, 29882, 5262, 353, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 1311, 29889, 12090, 29918, 1853, 29961, 29882, 5262, 448, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 1311, 29889, 4632, 29918, 12090, 29918, 13140, 29961, 29882, 1402, 8516, 29892, 17531, 13, 632, 13, 9651, 396, 22326, 29926, 412, 13, 9651, 363, 432, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 1125, 13, 18884, 565, 14002, 29918, 3084, 29961, 29926, 5387, 13, 462, 1678, 565, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1266, 29915, 470, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1563, 2396, 13, 462, 4706, 22326, 29926, 412, 29918, 845, 29961, 29926, 1822, 4397, 29898, 9302, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 11965, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29961, 29926, 29962, 448, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 29926, 2314, 1068, 29906, 4961, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 22326, 29926, 412, 29918, 4861, 29961, 29926, 1822, 4397, 29898, 9302, 29889, 3676, 29898, 9302, 29889, 2083, 3552, 11965, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29961, 29926, 29962, 448, 330, 29873, 29918, 12090, 29918, 1111, 536, 29961, 29926, 2314, 1068, 29906, 4961, 13, 13, 9651, 396, 29692, 2264, 7913, 388, 13, 9651, 565, 1361, 29918, 1853, 29918, 3084, 29901, 13, 18884, 565, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1266, 29915, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29900, 29962, 1405, 29871, 29900, 29889, 29945, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29896, 29962, 529, 29871, 29900, 29889, 29945, 29901, 13, 462, 1678, 1035, 29918, 3179, 29918, 25932, 4619, 29871, 29896, 13, 18884, 25342, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1563, 29915, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29900, 29962, 529, 29871, 29900, 29889, 29945, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29896, 29962, 1405, 29871, 29900, 29889, 29945, 29901, 13, 462, 1678, 1035, 29918, 3179, 29918, 25932, 4619, 29871, 29896, 13, 18884, 25342, 330, 29873, 29918, 3179, 29918, 1853, 1275, 525, 1639, 627, 292, 29915, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29900, 29962, 1405, 29871, 29900, 29889, 29945, 322, 4450, 29879, 29918, 3179, 29918, 1853, 29961, 29876, 3816, 29896, 29962, 1405, 29871, 29900, 29889, 29945, 29901, 13, 462, 1678, 1035, 29918, 3179, 29918, 25932, 4619, 29871, 29896, 13, 18884, 1361, 29918, 25932, 29918, 20047, 4619, 29871, 29896, 13, 13, 9651, 1998, 353, 7700, 13, 9651, 565, 1998, 29901, 13, 18884, 10153, 29918, 2084, 353, 848, 1839, 2492, 29918, 2084, 2033, 13, 18884, 13850, 2492, 353, 13850, 29906, 29889, 326, 949, 29898, 2492, 29918, 2084, 29892, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 891, 13850, 29906, 29889, 7833, 16310, 29918, 6259, 6632, 1525, 29918, 1955, 29902, 3919, 8098, 29897, 13, 18884, 903, 2492, 353, 13850, 2492, 7503, 29892, 29901, 29892, 1057, 29899, 29896, 1822, 3286, 4220, 29898, 29906, 29892, 29900, 29892, 29896, 29897, 13, 18884, 1998, 29918, 29895, 567, 353, 4450, 29918, 12090, 29918, 1111, 536, 29918, 2492, 29889, 8552, 580, 13, 18884, 1998, 29918, 3084, 353, 14002, 29918, 3084, 29889, 8552, 580, 13, 18884, 10446, 353, 851, 29898, 1272, 1839, 17885, 545, 11287, 13, 18884, 3949, 353, 851, 29898, 1272, 1839, 11108, 11287, 13, 18884, 3515, 353, 851, 29898, 1272, 1839, 2557, 11287, 13, 18884, 10422, 353, 525, 449, 29918, 29915, 718, 851, 29898, 29876, 29897, 718, 22868, 29915, 718, 330, 29873, 29918, 3179, 29918, 1853, 718, 15300, 6173, 29915, 13, 18884, 1998, 29918, 1989, 9748, 7373, 2492, 29892, 1998, 29918, 29895, 567, 29892, 1998, 29918, 3084, 29892, 1583, 29889, 26050, 11285, 29892, 10422, 29897, 13, 13, 9651, 1998, 353, 7700, 13, 9651, 565, 1998, 29901, 13, 18884, 10422, 353, 525, 449, 29918, 29915, 718, 851, 29898, 29876, 29897, 718, 22868, 29941, 29881, 29889, 6173, 29915, 13, 18884, 1998, 29918, 29941, 29881, 29918, 1989, 9748, 29898, 11965, 29918, 12090, 29918, 1111, 536, 29918, 11108, 29892, 14002, 29918, 3084, 29892, 1583, 29889, 26050, 11285, 29892, 10422, 29897, 13, 308, 13, 13, 4706, 565, 1361, 29918, 25932, 29918, 20047, 1405, 29871, 29900, 29901, 1596, 877, 3481, 287, 2264, 13600, 29901, 525, 718, 851, 29898, 5753, 29918, 3179, 29918, 25932, 847, 1361, 29918, 25932, 29918, 20047, 876, 13, 4706, 565, 7431, 29898, 29885, 21478, 412, 29897, 1405, 29871, 29900, 29901, 1596, 877, 21055, 29934, 4162, 29901, 525, 718, 851, 29898, 2083, 29898, 29885, 21478, 412, 6802, 2435, 29898, 29885, 21478, 412, 4961, 13, 4706, 1596, 580, 13, 29871, 13, 4706, 2025, 29918, 3127, 353, 5159, 13, 4706, 19745, 29918, 7727, 353, 525, 3580, 29967, 4162, 363, 1269, 14002, 29901, 320, 29876, 29915, 13, 4706, 363, 432, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 1125, 13, 9651, 2025, 29918, 3127, 29918, 29926, 353, 7442, 29889, 12676, 29898, 9302, 29889, 535, 29883, 2579, 403, 3552, 9302, 29889, 1429, 29898, 1526, 29926, 412, 29918, 845, 29961, 29926, 11724, 7442, 29889, 1429, 29898, 1526, 29926, 412, 29918, 4861, 29961, 29926, 12622, 876, 13, 9651, 14002, 29918, 978, 353, 1583, 29889, 26050, 11285, 29961, 29926, 22322, 978, 2033, 13, 9651, 19745, 29918, 7727, 4619, 313, 12090, 29918, 978, 718, 525, 29901, 18695, 29906, 29888, 29892, 525, 1273, 2025, 29918, 3127, 29918, 29926, 29897, 13, 9651, 2025, 29918, 3127, 29889, 4397, 29898, 4260, 29918, 3127, 29918, 29926, 29897, 13, 4706, 1596, 29898, 14513, 29918, 7727, 29897, 13, 4706, 1596, 877, 3580, 29967, 4162, 363, 599, 1361, 15602, 29901, 18695, 29906, 29888, 29915, 1273, 313, 9302, 29889, 12676, 29898, 4260, 29918, 3127, 4961, 13, 4706, 1596, 580, 13, 13, 4706, 19745, 29918, 7727, 353, 525, 3580, 29967, 4162, 363, 1269, 14002, 29901, 320, 29876, 29915, 13, 4706, 363, 432, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 1125, 13, 9651, 22326, 29926, 412, 29918, 845, 29961, 29926, 29962, 353, 7442, 29889, 12676, 29898, 9302, 29889, 1429, 29898, 1526, 29926, 412, 29918, 845, 29961, 29926, 12622, 13, 9651, 14002, 29918, 978, 353, 1583, 29889, 26050, 11285, 29961, 29926, 22322, 978, 2033, 13, 9651, 19745, 29918, 7727, 4619, 313, 12090, 29918, 978, 718, 525, 29901, 18695, 29906, 29888, 29892, 525, 1273, 22326, 29926, 412, 29918, 845, 29961, 29926, 2314, 13, 4706, 1596, 29898, 14513, 29918, 7727, 29897, 13, 4706, 1596, 877, 3580, 29967, 4162, 363, 2323, 1361, 15602, 29901, 18695, 29906, 29888, 29915, 1273, 313, 9302, 29889, 12676, 29898, 1526, 29926, 412, 29918, 845, 4961, 13, 4706, 1596, 580, 13, 13, 4706, 19745, 29918, 7727, 353, 525, 3580, 29967, 4162, 363, 1269, 14002, 29901, 320, 29876, 29915, 13, 4706, 363, 432, 297, 3464, 29898, 1311, 29889, 12090, 29918, 1949, 29930, 29906, 1125, 13, 9651, 22326, 29926, 412, 29918, 4861, 29961, 29926, 29962, 353, 7442, 29889, 12676, 29898, 9302, 29889, 1429, 29898, 1526, 29926, 412, 29918, 4861, 29961, 29926, 12622, 13, 9651, 14002, 29918, 978, 353, 1583, 29889, 26050, 11285, 29961, 29926, 22322, 978, 2033, 13, 9651, 19745, 29918, 7727, 4619, 313, 12090, 29918, 978, 718, 525, 29901, 18695, 29906, 29888, 29892, 525, 1273, 22326, 29926, 412, 29918, 4861, 29961, 29926, 2314, 13, 4706, 1596, 29898, 14513, 29918, 7727, 29897, 13, 4706, 1596, 877, 3580, 29967, 4162, 363, 16254, 292, 1361, 15602, 29901, 18695, 29906, 29888, 29915, 1273, 313, 9302, 29889, 12676, 29898, 1526, 29926, 412, 29918, 4861, 4961, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 822, 788, 29918, 2084, 29898, 2084, 1125, 13, 4706, 565, 2224, 451, 297, 10876, 29889, 2084, 29901, 13, 9651, 10876, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 2224, 29897, 13, 13, 1678, 445, 29918, 3972, 353, 288, 1028, 29889, 25721, 22168, 1445, 1649, 29897, 13, 13, 1678, 4303, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 1366, 29918, 3972, 29892, 525, 636, 742, 525, 636, 3788, 1982, 1495, 13, 1678, 788, 29918, 2084, 29898, 1982, 29918, 2084, 29897, 13, 13, 1678, 5654, 29918, 2084, 353, 288, 1028, 29889, 7122, 29898, 1366, 29918, 3972, 29892, 525, 636, 742, 525, 1982, 29914, 4220, 14513, 29914, 2272, 29899, 14817, 2527, 10817, 1495, 13, 1678, 788, 29918, 2084, 29898, 4317, 29918, 2084, 29897, 13, 268, 13, 1678, 515, 4842, 305, 4924, 1053, 4327, 29879, 13, 1678, 515, 2295, 29889, 4381, 1053, 903, 29907, 408, 274, 16434, 13, 1678, 515, 2295, 29889, 4381, 1053, 2767, 29918, 2917, 13, 1678, 515, 3667, 29879, 29889, 1730, 1053, 6492, 29918, 3179, 13, 268, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 5323, 262, 1820, 9748, 3564, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 16859, 742, 13, 462, 4706, 1371, 2433, 735, 15362, 10822, 934, 1024, 742, 13, 462, 4706, 2322, 2433, 21546, 735, 546, 7862, 29914, 4548, 29918, 1688, 29889, 25162, 742, 13, 462, 4706, 1134, 29922, 710, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 25707, 742, 13, 462, 4706, 1371, 543, 2111, 1598, 2295, 3987, 773, 278, 1899, 29899, 1220, 613, 13, 462, 4706, 2322, 29922, 8516, 29892, 13, 462, 4706, 302, 5085, 29922, 1191, 5510, 29889, 1525, 29032, 8032, 29897, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 6389, 29889, 16859, 353, 376, 21546, 735, 546, 7862, 29914, 4548, 29918, 1688, 29889, 25162, 29908, 13, 13, 1678, 2767, 29918, 2917, 29898, 16859, 29892, 6389, 29897, 13, 1678, 274, 16434, 29889, 1753, 17627, 580, 13, 268, 13, 1678, 8783, 353, 4124, 3481, 16390, 24541, 29898, 16859, 29892, 4327, 29879, 29889, 1762, 29911, 6073, 3285, 376, 14968, 1159, 13, 1678, 9853, 29918, 27959, 353, 3630, 10036, 29898, 24713, 29922, 24713, 29892, 9853, 29918, 2311, 29922, 29896, 29892, 528, 21897, 29922, 8824, 29892, 954, 29918, 1287, 414, 29922, 29900, 29892, 12534, 29918, 14834, 29922, 5574, 29897, 13, 13, 1678, 363, 372, 29878, 29892, 313, 2080, 29879, 29892, 22525, 29892, 12700, 29918, 3888, 29897, 297, 26985, 29898, 16175, 29918, 27959, 1125, 13, 4706, 10153, 353, 10970, 1839, 2492, 29879, 13359, 23749, 2141, 29879, 802, 29872, 911, 580, 29930, 29906, 29945, 29945, 396, 29871, 29896, 921, 29871, 29941, 921, 29871, 29906, 29945, 29953, 921, 29871, 29906, 29945, 29953, 13, 13, 4706, 14002, 29918, 1111, 536, 353, 22525, 1839, 4220, 29906, 29881, 29918, 4141, 13359, 23749, 2141, 29879, 802, 29872, 911, 580, 396, 518, 29946, 29906, 29892, 29871, 29941, 29962, 396, 318, 29892, 29894, 15526, 29892, 503, 3876, 29899, 22925, 766, 4838, 1891, 10809, 13, 4706, 14002, 29918, 3084, 353, 12700, 29918, 3888, 1839, 12090, 29918, 3084, 13359, 23749, 2141, 29879, 802, 29872, 911, 580, 396, 518, 29946, 29906, 29962, 13, 4706, 10422, 353, 525, 2914, 29918, 29906, 29881, 29889, 6173, 29915, 13, 13, 4706, 363, 413, 297, 3464, 29898, 12090, 29918, 1111, 536, 29889, 12181, 29961, 29900, 29962, 1125, 13, 9651, 1596, 877, 19660, 1118, 8875, 1402, 4286, 4830, 29898, 12090, 29918, 1111, 536, 29961, 29895, 29892, 29900, 1402, 12090, 29918, 1111, 536, 29961, 29895, 29892, 29896, 12622, 13, 13, 4706, 1998, 29918, 2492, 353, 1998, 29918, 1989, 9748, 29898, 2492, 29892, 14002, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 8783, 29889, 26050, 11285, 29892, 10422, 29892, 4078, 29918, 2084, 2433, 29889, 1495, 13, 4706, 10422, 353, 525, 2914, 29918, 29941, 29881, 29915, 13, 4706, 1998, 29918, 29941, 29881, 29918, 1989, 9748, 29898, 12090, 29918, 1111, 536, 29892, 14002, 29918, 3084, 29892, 8783, 29889, 26050, 11285, 29892, 10422, 29897, 13, 2 ]
inventory/categories/api/tests/test_categories_api.py
cnobile2012/inventory
10
133364
# -*- coding: utf-8 -*- # # inventory/categories/api/tests/test_categories_api.py # from django.contrib.auth import get_user_model from rest_framework.reverse import reverse from rest_framework import status from rest_framework.test import APITestCase from inventory.categories.models import Category from inventory.common.api.tests.base_test import BaseTest from inventory.projects.models import Membership UserModel = get_user_model() class TestCategoryAPI(BaseTest, APITestCase): DEFAULT_USER = UserModel.ROLE_MAP[UserModel.DEFAULT_USER] PROJECT_USER = Membership.ROLE_MAP[Membership.PROJECT_USER] def __init__(self, name): super().__init__(name) def setUp(self): super().setUp() # Create an InventoryType and Project. self.in_type = self._create_inventory_type() members = [ {'user': self.user, 'role_text': self.PROJECT_USER} ] self.project = self._create_project(self.in_type, members=members) kwargs = {'public_id': self.project.public_id} self.project_uri = reverse('project-detail', kwargs=kwargs) def get_category_field(self, uri, field): """ Get a category and return the value of the provided field. """ response = self.client.get(uri, format='json') return response.data.get(field) def test_GET_category_list_with_invalid_permissions(self): """ Test the category_list endpoint with no permissions. """ #self.skipTest("Temporarily skipped") method = 'get' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-list') self._test_users_with_invalid_permissions(uri, method) self._test_project_users_with_invalid_permissions(uri, method) def test_GET_category_list_with_valid_permissions(self): """ Test the category_list endpoint with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'get' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-list') self._test_users_with_valid_permissions( uri, method, default_user=False) self._test_project_users_with_valid_permissions(uri, method) def test_POST_category_list_with_invalid_permissions(self): """ Test that a POST to category_list fails with invalid permissions. """ #self.skipTest("Temporarily skipped") method = 'post' uri = reverse('category-list') data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) def test_POST_category_list_with_valid_permissions(self): """ Test that a POST to category_list passes with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'post' uri = reverse('category-list') data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri ad = data.setdefault('AD', su.copy()) ad['name'] = 'TestCategory-02' du = data.setdefault('DU', su.copy()) du['name'] = 'TestCategory-03' self._test_users_with_valid_permissions( uri, method, request_data=data) pow = data.setdefault('POW', su.copy()) pow['name'] = 'TestCategory-04' pma = data.setdefault('PMA', su.copy()) pma['name'] = 'TestCategory-05' pdu = data.setdefault('PDU', su.copy()) pdu['name'] = 'TestCategory-06' self._test_project_users_with_valid_permissions( uri, method, project_user=False, request_data=data) def test_OPTIONS_category_list_with_invalid_permissions(self): """ Test that the method OPTIONS fails with invald permissions. """ #self.skipTest("Temporarily skipped") method = 'options' uri = reverse('category-list') self._test_users_with_invalid_permissions(uri, method) self._test_project_users_with_invalid_permissions(uri, method) def test_OPTIONS_category_list_with_valid_permissions(self): """ Test that the method OPTIONS brings back the correct data. """ method = 'options' uri = reverse('category-list') self._test_users_with_valid_permissions(uri, method) self._test_project_users_with_valid_permissions(uri, method) def test_GET_category_detail_with_invalid_permissions(self): """ Test that a GET on the category_detail fails with invalid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'get' self._test_users_with_invalid_permissions(uri, method) self._test_project_users_with_invalid_permissions(uri, method) def test_GET_category_detail_with_valid_permissions(self): """ Test that a GET to category_detail passes with valid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'get' self._test_users_with_valid_permissions(uri, method) self._test_project_users_with_valid_permissions(uri, method) def test_PUT_category_detail_with_invalid_permissions(self): """ Test that a PUT to category_detail fails with invalid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'put' data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) def test_PUT_category_detail_with_valid_permissions(self): """ Test that a PUT to category_detail passes with valid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'put' data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri ad = data.setdefault('AD', su.copy()) ad['name'] = 'TestCategory-02' du = data.setdefault('DU', su.copy()) du['name'] = 'TestCategory-03' self._test_users_with_valid_permissions( uri, method, request_data=data) pow = data.setdefault('POW', su.copy()) pow['name'] = 'TestCategory-04' pma = data.setdefault('PMA', su.copy()) pma['name'] = 'TestCategory-05' pdu = data.setdefault('PDU', su.copy()) pdu['name'] = 'TestCategory-06' self._test_project_users_with_valid_permissions( uri, method, project_user=False, request_data=data) def test_PATCH_category_detail_with_invalid_permissions(self): """ Test that a PATCH to category_detail fails with invalid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'patch' data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) def test_PATCH_category_detail_with_valid_permissions(self): """ Test that a PATCH to category_detail passes with valid permissions. """ #self.skipTest("Temporarily skipped") category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) method = 'patch' data = {} su = data.setdefault('SU', {}) su['name'] = 'TestCategory-01' su['project'] = self.project_uri ad = data.setdefault('AD', {}) ad['name'] = 'TestCategory-02' du = data.setdefault('DU', {}) du['name'] = 'TestCategory-03' self._test_users_with_valid_permissions( uri, method, request_data=data) pow = data.setdefault('POW', {}) pow['name'] = 'TestCategory-04' pma = data.setdefault('PMA', {}) pma['name'] = 'TestCategory-05' pdu = data.setdefault('PDU', {}) pdu['name'] = 'TestCategory-06' self._test_project_users_with_valid_permissions( uri, method, project_user=False, request_data=data) def test_DELETE_category_detail_with_invalid_permissions(self): """ Test that a DELETE to category_detail fails with invalid permissions. """ #self.skipTest("Temporarily skipped") method = 'delete' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_users_with_invalid_permissions(uri, method) self._test_project_users_with_invalid_permissions(uri, method) def test_DELETE_category_detail_with_valid_permissions(self): """ Test that a DELETE to category_detail pass' with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'delete' # Test SUPERUSER category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_superuser_with_valid_permissions(uri, method) self._test_valid_GET_with_errors(uri) # Test ADMINISTRATOR category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_administrator_with_valid_permissions(uri, method) self._test_valid_GET_with_errors(uri) # Test DEFAULT_USER ## This is an invalid test since the DEFAULT_USER has no access. # Test PROJECT_OWNER category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_project_owner_with_valid_permissions(uri, method) self._test_valid_GET_with_errors(uri) # Test PROJECT_MANAGER category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_project_manager_with_valid_permissions(uri, method) self._test_valid_GET_with_errors(uri) # Test PROJECT_USER ## This is an invalid test since the PROJECT_USER has no access. def test_OPTIONS_category_detail_with_invalid_permissions(self): """ Test that the method OPTIONS fails with invald permissions. """ #self.skipTest("Temporarily skipped") method = 'options' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_users_with_invalid_permissions(uri, method) self._test_project_users_with_invalid_permissions(uri, method) def test_OPTIONS_category_detail_with_valid_permissions(self): """ Test that the method OPTIONS brings back the correct data. """ method = 'options' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-detail', kwargs={'public_id': category.public_id}) self._test_users_with_valid_permissions(uri, method) self._test_project_users_with_valid_permissions(uri, method) def test_create_category_twice_to_same_parent(self): """ Test that a category is not created twice with the same composite key. """ #self.skipTest("Temporarily skipped") # Create Category one. uri = reverse('category-list') new_data = {'name': 'TestCategory-1', 'project': self.project_uri} response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_201_CREATED, response.data) self.assertEqual(response.status_code, status.HTTP_201_CREATED, msg) # Create Category two. parent_uri = response.data.get('href') uri = reverse('category-list') new_data = {'name': 'TestCategory-2', 'parent': parent_uri, 'project': self.project_uri} response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_201_CREATED, response.data) self.assertEqual(response.status_code, status.HTTP_201_CREATED, msg) # Create Category two again--should fail. uri = reverse('category-list') new_data = {'name': 'TestCategory-2', 'parent': parent_uri, 'project': self.project_uri} response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, msg) def test_delimitor_in_category_name(self): """ Test that the delimitor is not in the category name. """ #self.skipTest("Temporarily skipped") # Create Category one. uri = reverse('category-list') new_data = {'name': 'Test{}Category-1'.format( Category.DEFAULT_SEPARATOR), 'project': self.project_uri} response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, msg) self.assertTrue(self._has_error(response, 'name'), msg) self._test_errors(response, tests={ 'name': u"A category name cannot ", }) def test_category_is_not_parent(self): """ Test that this category does not exist in the current tree. """ #self.skipTest("Temporarily skipped") # Create three catagories. name = "Test Category 1" cat0 = self._create_category(self.project, name=name) name = "Test Category 2" cat1 = self._create_category(self.project, name=name, parent=cat0) name = "Test Category 3" cat2 = self._create_category(self.project, name=name, parent=cat1) # Try adding 'Test Category 2' to the tree using the API. uri = reverse('category-list') cat2_uri = reverse('category-detail', kwargs={'public_id': cat2.public_id}) new_data = {'name': "Test Category 2", 'project': self.project_uri, 'parent': cat2_uri} response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, msg) self.assertTrue(self._has_error(response, 'name'), msg) self._test_errors(response, tests={ 'name': u"A category in this tree ", }) def test_root_level_category_exists(self): """ Test that there are no root level categories with this name that already exist for this owner. """ #self.skipTest("Temporarily skipped") # Create a catagory. name = "Duplicate Name" cat = self._create_category(self.project, name=name) # Create a category through the API. new_data = {'name': name, 'project': self.project_uri} uri = reverse('category-list') response = self.client.post(uri, new_data, format='json') msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, msg) self.assertTrue(self._has_error(response, 'name'), msg) self._test_errors(response, tests={ 'name': u"A root level category name ", }) def test_wrong_user_gets_no_results(self): """ Test that the request user gets no results of categories that are in a different project. This test determines that a user of one project does not have access to another project's objects. """ #self.skipTest("Temporarily skipped") # Create new user user, client = self._create_user( username="SecondUser", password="<PASSWORD>") # Create a new project p_name = "Test Project_1" project = self._create_project(self.in_type, name=p_name) # Create a category c_name = "Test Category 1" category = self._create_category(project, name=c_name) # GET category on the API uri = reverse('category-list') response = client.get(uri, format='json', **self.HEADERS) msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_403_FORBIDDEN, response.data) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, msg) self.assertTrue(self._has_error(response), msg) self._test_errors(response, tests={ 'detail': "You do not have permission to perform this action.", }) # Test GET on a category detail uri = reverse('category-detail', kwargs={'public_id': category.public_id}) response = client.get(uri, format='json', **self.HEADERS) msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_403_FORBIDDEN, response.data) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, msg) self.assertTrue(self._has_error(response), msg) self._test_errors(response, tests={ 'detail': "You do not have permission to perform this action.", }) # Test PUT to a specific category data = {'name': 'Changed Category'} response = client.patch(uri, data=data, format='json', **self.HEADERS) msg = ("Response: {} should be {}, content: {}, user: {}, " "project creator: {}").format( response.status_code, status.HTTP_403_FORBIDDEN, response.data, user, project.creator) self.assertEqual(response.status_code, status.HTTP_403_FORBIDDEN, msg) self.assertTrue(self._has_error(response), msg) self._test_errors(response, tests={ 'detail': "You do not have permission to perform this action.", }) class TestCategoryCloneAPI(BaseTest): def __init__(self, name): super().__init__(name) def setUp(self): super().setUp() # Create an InventoryType and Project. self.in_type = self._create_inventory_type() self.project = self._create_project(self.in_type, members=[self.user]) kwargs = {'public_id': self.project.public_id} self.project_uri = reverse('project-detail', kwargs=kwargs) def flatten(self, items): """ Given a list, possibly nested to any level, return it flattened. http://code.activestate.com/recipes/578948-flattening-an-arbitrarily-nested-list-in-python/ """ flattened = [] for item in items: if isinstance(item, list): flattened.extend(self.flatten(item)) else: flattened.append(item) return flattened def test_GET_category_clone_with_invalid_permissions(self): """ Test the category_clone endpoint with no permissions. """ #self.skipTest("Temporarily skipped") method = 'get' category = self._create_category(self.project, "Test Root Category") uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = [category.public_id] su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) def test_GET_category_clone_with_valid_permissions(self): """ Test the category_clone endpoint with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'get' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = [categories[0][0].public_id] # 'TestLevel-0' su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_valid_permissions( uri, method, request_data=data, default_user=False) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_valid_permissions( uri, method, request_data=data) def test_GET_category_clone_with_parameters(self): """ Test the location_clone endpoint with various parameters. """ #self.skipTest("Temporarily skipped") method = 'get' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} data['categories'] = [categories[0][0].public_id] # 'TestLevel-0' data['project'] = self.project.public_id # Test with default arguments. response = self.client.get(uri, data=data, format='json', **self.HEADERS) res_data = self.flatten(response.data) msg = ("data: {}, found '{}' records , should be 5 records" ).format(res_data, len(res_data)) self.assertEqual(len(res_data), 5, msg) # Test with with_root=False data['with_root'] = False response = self.client.get(uri, data=data, format='json', **self.HEADERS) res_data = self.flatten(response.data) msg = ("data: {}, found '{}' records , should be 4 records" ).format(res_data, len(res_data)) self.assertEqual(len(res_data), 4, msg) def test_POST_category_clone_with_invalid_permissions(self): """ Test the category_clone endpoint with no permissions. """ #self.skipTest("Temporarily skipped") method = 'post' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = create_list su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) categories = Category.objects.all() msg = "categories: {}, count: {}, should be 0".format( categories, categories.count()) self.assertEqual(categories.count(), 0, msg) def test_POST_category_clone_with_valid_permissions(self): """ Test the category_clone endpoint with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'post' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = create_list su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_valid_permissions( uri, method, request_data=data, default_user=False) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_valid_permissions( uri, method, request_data=data, project_user=False) categories = Category.objects.all() msg = "categories: {}, count: {}, should be 5".format( categories, categories.count()) self.assertEqual(categories.count(), 5, msg) def test_DELETE_category_clone_with_invalid_permissions(self): """ Test the category_clone endpoint with no permissions. """ #self.skipTest("Temporarily skipped") method = 'delete' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = [categories[0][0].public_id] su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_invalid_permissions( uri, method, request_data=data) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_invalid_permissions( uri, method, request_data=data) categories = Category.objects.all() msg = "categories: {}, count: {}, should be 5".format( categories, categories.count()) self.assertEqual(categories.count(), 5, msg) def test_DELETE_category_clone_with_valid_permissions(self): """ Test the category_clone endpoint with valid permissions. """ #self.skipTest("Temporarily skipped") method = 'delete' create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} su = data.setdefault('SU', {}) su['categories'] = [categories[0][0].public_id] su['project'] = self.project.public_id data.setdefault('AD', su.copy()) data.setdefault('DU', su.copy()) self._test_users_with_valid_permissions( uri, method, request_data=data, default_user=False) data.setdefault('POW', su.copy()) data.setdefault('PMA', su.copy()) data.setdefault('PDU', su.copy()) self._test_project_users_with_valid_permissions( uri, method, request_data=data, project_user=False) categories = Category.objects.all() msg = "categories: {}, count: {}, should be 0".format( categories, categories.count()) self.assertEqual(categories.count(), 0, msg) def test_category_clone_serializer_validation_errors_on_project(self): """ Test that invalid data causes validation errors. """ #self.skipTest("Temporarily skipped") create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} data['categories'] = [categories[0][0].public_id] data['project'] = 'junk' kwargs = self._setup_user_credentials() kwargs['login'] = True kwargs['is_superuser'] = False kwargs['role'] = self.DEFAULT_USER user, client = self._create_user(**kwargs) self.project.process_members([self.user, user]) self.project.set_role(user, self.PROJECT_USER) response = client.get(uri, data=data, format='json', **self.HEADERS) msg = "Response: {} should be {}, content: {}".format( response.status_code, status.HTTP_400_BAD_REQUEST, response.data) self.assertEqual( response.status_code, status.HTTP_400_BAD_REQUEST, msg) self.assertTrue(self._has_error(response, error_key='project'), msg) self._test_errors(response, tests={ 'project': "A project with the public_id 'junk' does not exist.", }) def test_category_clone_serializer_validation_errors_on_categories(self): """ Test that invalid data causes validation errors. """ #self.skipTest("Temporarily skipped") create_list = [['TestLevel-0', (('TestLevel-1', 'TestLevel-2',), ('TestLevel-1a', 'TestLevel-2a',))]] categories = Category.objects.create_category_tree( self.project, create_list) uri = reverse('category-clone') data = {} data['categories'] = [] data['project'] = self.project.public_id kwargs = self._setup_user_credentials() kwargs['login'] = True kwargs['is_superuser'] = False kwargs['role'] = self.DEFAULT_USER user, client = self._create_user(**kwargs) self.project.process_members([self.user, user]) self.project.set_role(user, self.PROJECT_USER) status_code = status.HTTP_400_BAD_REQUEST response = client.get(uri, data=data, **self.HEADERS) msg = "Response: {} should be {}, content: {}".format( response.status_code, status_code, response.data) self.assertEqual(response.status_code, status_code, msg) self.assertTrue(self._has_error(response, error_key='categories'), msg) self._test_errors(response, tests={ 'categories': "This field is required.", })
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 13, 29937, 11817, 706, 29914, 20683, 29914, 2754, 29914, 21150, 29914, 1688, 29918, 20683, 29918, 2754, 29889, 2272, 13, 29937, 13, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 679, 29918, 1792, 29918, 4299, 13, 13, 3166, 1791, 29918, 4468, 29889, 24244, 1053, 11837, 13, 3166, 1791, 29918, 4468, 1053, 4660, 13, 3166, 1791, 29918, 4468, 29889, 1688, 1053, 12279, 1806, 342, 8259, 13, 13, 3166, 11817, 706, 29889, 20683, 29889, 9794, 1053, 17943, 13, 3166, 11817, 706, 29889, 9435, 29889, 2754, 29889, 21150, 29889, 3188, 29918, 1688, 1053, 7399, 3057, 13, 3166, 11817, 706, 29889, 16418, 29889, 9794, 1053, 341, 1590, 10475, 13, 13, 2659, 3195, 353, 679, 29918, 1792, 29918, 4299, 580, 13, 13, 13, 1990, 4321, 10900, 8787, 29898, 5160, 3057, 29892, 12279, 1806, 342, 8259, 1125, 13, 1678, 22236, 29918, 11889, 353, 4911, 3195, 29889, 1672, 1307, 29918, 23827, 29961, 2659, 3195, 29889, 23397, 29918, 11889, 29962, 13, 1678, 13756, 17637, 29918, 11889, 353, 341, 1590, 10475, 29889, 1672, 1307, 29918, 23827, 29961, 29924, 1590, 10475, 29889, 8618, 17637, 29918, 11889, 29962, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29897, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 2141, 842, 3373, 580, 13, 4706, 396, 6204, 385, 512, 23886, 1542, 322, 8010, 29889, 13, 4706, 1583, 29889, 262, 29918, 1853, 353, 1583, 3032, 3258, 29918, 262, 23886, 29918, 1853, 580, 13, 4706, 5144, 353, 518, 13, 9651, 11117, 1792, 2396, 1583, 29889, 1792, 29892, 525, 12154, 29918, 726, 2396, 1583, 29889, 8618, 17637, 29918, 11889, 29913, 13, 9651, 4514, 13, 4706, 1583, 29889, 4836, 353, 1583, 3032, 3258, 29918, 4836, 29898, 1311, 29889, 262, 29918, 1853, 29892, 5144, 29922, 28109, 29897, 13, 4706, 9049, 5085, 353, 11117, 3597, 29918, 333, 2396, 1583, 29889, 4836, 29889, 3597, 29918, 333, 29913, 13, 4706, 1583, 29889, 4836, 29918, 5338, 353, 11837, 877, 4836, 29899, 16432, 742, 9049, 5085, 29922, 19290, 29897, 13, 13, 1678, 822, 679, 29918, 7320, 29918, 2671, 29898, 1311, 29892, 21333, 29892, 1746, 1125, 13, 4706, 9995, 13, 4706, 3617, 263, 7663, 322, 736, 278, 995, 310, 278, 4944, 1746, 29889, 13, 4706, 9995, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 5338, 29892, 3402, 2433, 3126, 1495, 13, 4706, 736, 2933, 29889, 1272, 29889, 657, 29898, 2671, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 1761, 16248, 411, 694, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 1761, 16248, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2322, 29918, 1792, 29922, 8824, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 5438, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 11971, 304, 7663, 29918, 1761, 8465, 411, 8340, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 2490, 29915, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 5438, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 11971, 304, 7663, 29918, 1761, 14517, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 2490, 29915, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 594, 353, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 594, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29906, 29915, 13, 4706, 868, 353, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 868, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29941, 29915, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 4764, 353, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 4764, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29946, 29915, 13, 4706, 282, 655, 353, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 282, 655, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29945, 29915, 13, 4706, 282, 700, 353, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 282, 700, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29953, 29915, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2060, 29918, 1792, 29922, 8824, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 14094, 27946, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 1158, 6418, 29911, 27946, 8465, 411, 297, 791, 29881, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 6768, 29915, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 14094, 27946, 29918, 7320, 29918, 1761, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 1158, 6418, 29911, 27946, 23522, 1250, 278, 1959, 848, 29889, 13, 4706, 9995, 13, 4706, 1158, 353, 525, 6768, 29915, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 12354, 373, 278, 7663, 29918, 16432, 8465, 411, 8340, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 12354, 304, 7663, 29918, 16432, 14517, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 12336, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 349, 2692, 304, 7663, 29918, 16432, 8465, 411, 8340, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 649, 29915, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 12336, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 349, 2692, 304, 7663, 29918, 16432, 14517, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 649, 29915, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 594, 353, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 594, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29906, 29915, 13, 4706, 868, 353, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 868, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29941, 29915, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 4764, 353, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 4764, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29946, 29915, 13, 4706, 282, 655, 353, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 282, 655, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29945, 29915, 13, 4706, 282, 700, 353, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 282, 700, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29953, 29915, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2060, 29918, 1792, 29922, 8824, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 29925, 14789, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 349, 14789, 304, 7663, 29918, 16432, 8465, 411, 8340, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 5041, 29915, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 29925, 14789, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 349, 14789, 304, 7663, 29918, 16432, 14517, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1158, 353, 525, 5041, 29915, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29896, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29918, 5338, 13, 4706, 594, 353, 848, 29889, 842, 4381, 877, 3035, 742, 426, 1800, 13, 4706, 594, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29906, 29915, 13, 4706, 868, 353, 848, 29889, 842, 4381, 877, 14849, 742, 426, 1800, 13, 4706, 868, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29941, 29915, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 4764, 353, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 426, 1800, 13, 4706, 4764, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29946, 29915, 13, 4706, 282, 655, 353, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 426, 1800, 13, 4706, 282, 655, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29945, 29915, 13, 4706, 282, 700, 353, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 426, 1800, 13, 4706, 282, 700, 1839, 978, 2033, 353, 525, 3057, 10900, 29899, 29900, 29953, 29915, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2060, 29918, 1792, 29922, 8824, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 2287, 18476, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 5012, 18476, 304, 7663, 29918, 16432, 8465, 411, 8340, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 8143, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 2287, 18476, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 5012, 18476, 304, 7663, 29918, 16432, 1209, 29915, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 8143, 29915, 13, 4706, 396, 4321, 317, 4897, 1001, 11889, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 9136, 1792, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 3084, 29918, 7194, 29918, 2541, 29918, 12523, 29898, 5338, 29897, 13, 4706, 396, 4321, 11033, 16173, 9047, 29934, 1299, 1955, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 6406, 2132, 1061, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 3084, 29918, 7194, 29918, 2541, 29918, 12523, 29898, 5338, 29897, 13, 4706, 396, 4321, 22236, 29918, 11889, 13, 4706, 444, 910, 338, 385, 8340, 1243, 1951, 278, 22236, 29918, 11889, 756, 694, 2130, 29889, 13, 4706, 396, 4321, 13756, 17637, 29918, 9806, 13865, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 20348, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 3084, 29918, 7194, 29918, 2541, 29918, 12523, 29898, 5338, 29897, 13, 4706, 396, 4321, 13756, 17637, 29918, 1529, 3521, 17070, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 12847, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 3084, 29918, 7194, 29918, 2541, 29918, 12523, 29898, 5338, 29897, 13, 4706, 396, 4321, 13756, 17637, 29918, 11889, 13, 4706, 444, 910, 338, 385, 8340, 1243, 1951, 278, 13756, 17637, 29918, 11889, 756, 694, 2130, 29889, 13, 13, 1678, 822, 1243, 29918, 14094, 27946, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 1158, 6418, 29911, 27946, 8465, 411, 297, 791, 29881, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 6768, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 14094, 27946, 29918, 7320, 29918, 16432, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 1158, 6418, 29911, 27946, 23522, 1250, 278, 1959, 848, 29889, 13, 4706, 9995, 13, 4706, 1158, 353, 525, 6768, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 5338, 29892, 1158, 29897, 13, 13, 1678, 822, 1243, 29918, 3258, 29918, 7320, 29918, 7516, 625, 29918, 517, 29918, 17642, 29918, 3560, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 263, 7663, 338, 451, 2825, 8951, 411, 278, 1021, 20842, 1820, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 396, 6204, 17943, 697, 29889, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 525, 3057, 10900, 29899, 29896, 742, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29913, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29892, 10191, 29897, 13, 4706, 396, 6204, 17943, 1023, 29889, 13, 4706, 3847, 29918, 5338, 353, 2933, 29889, 1272, 29889, 657, 877, 12653, 1495, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 525, 3057, 10900, 29899, 29906, 742, 13, 462, 1678, 525, 3560, 2396, 3847, 29918, 5338, 29892, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29913, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 29892, 10191, 29897, 13, 4706, 396, 6204, 17943, 1023, 1449, 489, 9344, 4418, 29889, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 525, 3057, 10900, 29899, 29906, 742, 13, 462, 1678, 525, 3560, 2396, 3847, 29918, 5338, 29892, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29913, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 6144, 326, 2105, 29918, 262, 29918, 7320, 29918, 978, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 628, 326, 2105, 338, 451, 297, 278, 7663, 1024, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 396, 6204, 17943, 697, 29889, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 525, 3057, 8875, 10900, 29899, 29896, 4286, 4830, 29898, 13, 9651, 17943, 29889, 23397, 29918, 1660, 16320, 1299, 1955, 511, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29913, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 29892, 525, 978, 5477, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 978, 2396, 318, 29908, 29909, 7663, 1024, 2609, 9162, 13, 9651, 5615, 13, 13, 1678, 822, 1243, 29918, 7320, 29918, 275, 29918, 1333, 29918, 3560, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 445, 7663, 947, 451, 1863, 297, 278, 1857, 5447, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 396, 6204, 2211, 6635, 351, 3842, 29889, 13, 4706, 1024, 353, 376, 3057, 17943, 29871, 29896, 29908, 13, 4706, 6635, 29900, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 1024, 29922, 978, 29897, 13, 4706, 1024, 353, 376, 3057, 17943, 29871, 29906, 29908, 13, 4706, 6635, 29896, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 1024, 29922, 978, 29892, 3847, 29922, 4117, 29900, 29897, 13, 4706, 1024, 353, 376, 3057, 17943, 29871, 29941, 29908, 13, 4706, 6635, 29906, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 1024, 29922, 978, 29892, 3847, 29922, 4117, 29896, 29897, 13, 4706, 396, 3967, 4417, 525, 3057, 17943, 29871, 29906, 29915, 304, 278, 5447, 773, 278, 3450, 29889, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 6635, 29906, 29918, 5338, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 965, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 6635, 29906, 29889, 3597, 29918, 333, 1800, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 376, 3057, 17943, 29871, 29906, 613, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29892, 13, 462, 1678, 525, 3560, 2396, 6635, 29906, 29918, 5338, 29913, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 29892, 525, 978, 5477, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 978, 2396, 318, 29908, 29909, 7663, 297, 445, 5447, 9162, 13, 9651, 5615, 13, 13, 1678, 822, 1243, 29918, 4632, 29918, 5563, 29918, 7320, 29918, 9933, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 727, 526, 694, 3876, 3233, 13997, 411, 445, 1024, 393, 13, 4706, 2307, 1863, 363, 445, 12271, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 396, 6204, 263, 6635, 351, 706, 29889, 13, 4706, 1024, 353, 376, 29928, 786, 5926, 4408, 29908, 13, 4706, 6635, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 1024, 29922, 978, 29897, 13, 4706, 396, 6204, 263, 7663, 1549, 278, 3450, 29889, 13, 4706, 716, 29918, 1272, 353, 11117, 978, 2396, 1024, 29892, 13, 462, 1678, 525, 4836, 2396, 1583, 29889, 4836, 29918, 5338, 29913, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 2490, 29898, 5338, 29892, 716, 29918, 1272, 29892, 3402, 2433, 3126, 1495, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 29892, 525, 978, 5477, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 978, 2396, 318, 29908, 29909, 3876, 3233, 7663, 1024, 9162, 13, 9651, 5615, 13, 13, 1678, 822, 1243, 29918, 15866, 549, 29918, 1792, 29918, 20078, 29918, 1217, 29918, 9902, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 2009, 1404, 4947, 694, 2582, 310, 13997, 393, 526, 13, 4706, 297, 263, 1422, 2060, 29889, 910, 1243, 3683, 1475, 393, 263, 1404, 310, 697, 13, 4706, 2060, 947, 451, 505, 2130, 304, 1790, 2060, 29915, 29879, 3618, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 396, 6204, 716, 1404, 13, 4706, 1404, 29892, 3132, 353, 1583, 3032, 3258, 29918, 1792, 29898, 13, 9651, 8952, 543, 11863, 2659, 613, 4800, 543, 29966, 25711, 17013, 29958, 1159, 13, 4706, 396, 6204, 263, 716, 2060, 13, 4706, 282, 29918, 978, 353, 376, 3057, 8010, 29918, 29896, 29908, 13, 4706, 2060, 353, 1583, 3032, 3258, 29918, 4836, 29898, 1311, 29889, 262, 29918, 1853, 29892, 1024, 29922, 29886, 29918, 978, 29897, 13, 4706, 396, 6204, 263, 7663, 13, 4706, 274, 29918, 978, 353, 376, 3057, 17943, 29871, 29896, 29908, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 4836, 29892, 1024, 29922, 29883, 29918, 978, 29897, 13, 4706, 396, 12354, 7663, 373, 278, 3450, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 1761, 1495, 13, 4706, 2933, 353, 3132, 29889, 657, 29898, 5338, 29892, 3402, 2433, 3126, 742, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 511, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 16432, 2396, 376, 3492, 437, 451, 505, 10751, 304, 2189, 445, 3158, 19602, 13, 9651, 5615, 13, 4706, 396, 4321, 12354, 373, 263, 7663, 9493, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16432, 742, 13, 462, 418, 9049, 5085, 3790, 29915, 3597, 29918, 333, 2396, 7663, 29889, 3597, 29918, 333, 1800, 13, 4706, 2933, 353, 3132, 29889, 657, 29898, 5338, 29892, 3402, 2433, 3126, 742, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 511, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 16432, 2396, 376, 3492, 437, 451, 505, 10751, 304, 2189, 445, 3158, 19602, 13, 9651, 5615, 13, 4706, 396, 4321, 349, 2692, 304, 263, 2702, 7663, 13, 4706, 848, 353, 11117, 978, 2396, 525, 7590, 17943, 10827, 13, 4706, 2933, 353, 3132, 29889, 5041, 29898, 5338, 29892, 848, 29922, 1272, 29892, 3402, 2433, 3126, 742, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 10191, 353, 4852, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 24335, 1404, 29901, 24335, 376, 13, 1669, 376, 4836, 907, 1061, 29901, 6571, 2564, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 2933, 29889, 1272, 29892, 13, 9651, 1404, 29892, 2060, 29889, 1037, 1061, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29941, 29918, 22051, 29933, 1367, 29928, 1430, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 511, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 16432, 2396, 376, 3492, 437, 451, 505, 10751, 304, 2189, 445, 3158, 19602, 13, 9651, 5615, 13, 13, 13, 1990, 4321, 10900, 6821, 650, 8787, 29898, 5160, 3057, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1024, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 978, 29897, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 2141, 842, 3373, 580, 13, 4706, 396, 6204, 385, 512, 23886, 1542, 322, 8010, 29889, 13, 4706, 1583, 29889, 262, 29918, 1853, 353, 1583, 3032, 3258, 29918, 262, 23886, 29918, 1853, 580, 13, 4706, 1583, 29889, 4836, 353, 1583, 3032, 3258, 29918, 4836, 29898, 1311, 29889, 262, 29918, 1853, 29892, 5144, 11759, 1311, 29889, 1792, 2314, 13, 4706, 9049, 5085, 353, 11117, 3597, 29918, 333, 2396, 1583, 29889, 4836, 29889, 3597, 29918, 333, 29913, 13, 4706, 1583, 29889, 4836, 29918, 5338, 353, 11837, 877, 4836, 29899, 16432, 742, 9049, 5085, 29922, 19290, 29897, 13, 13, 1678, 822, 1652, 8606, 29898, 1311, 29892, 4452, 1125, 13, 4706, 9995, 13, 4706, 11221, 263, 1051, 29892, 10075, 9322, 304, 738, 3233, 29892, 736, 372, 1652, 8606, 287, 29889, 13, 4706, 1732, 597, 401, 29889, 11236, 342, 403, 29889, 510, 29914, 4361, 5547, 29914, 29945, 29955, 29947, 29929, 29946, 29947, 29899, 1579, 8606, 292, 29899, 273, 29899, 279, 8844, 6275, 29899, 27420, 29899, 1761, 29899, 262, 29899, 4691, 29914, 13, 4706, 9995, 13, 4706, 1652, 8606, 287, 353, 5159, 13, 13, 4706, 363, 2944, 297, 4452, 29901, 13, 9651, 565, 338, 8758, 29898, 667, 29892, 1051, 1125, 13, 18884, 1652, 8606, 287, 29889, 21843, 29898, 1311, 29889, 1579, 8606, 29898, 667, 876, 13, 9651, 1683, 29901, 13, 18884, 1652, 8606, 287, 29889, 4397, 29898, 667, 29897, 13, 13, 4706, 736, 1652, 8606, 287, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 694, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 7663, 353, 1583, 3032, 3258, 29918, 7320, 29898, 1311, 29889, 4836, 29892, 376, 3057, 28272, 17943, 1159, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 518, 7320, 29889, 3597, 29918, 333, 29962, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 518, 20683, 29961, 29900, 3816, 29900, 1822, 3597, 29918, 333, 29962, 396, 525, 3057, 10108, 29899, 29900, 29915, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29892, 2322, 29918, 1792, 29922, 8824, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 13, 1678, 822, 1243, 29918, 7194, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 16744, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 4423, 29918, 16513, 16248, 411, 5164, 4128, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 657, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 848, 1839, 20683, 2033, 353, 518, 20683, 29961, 29900, 3816, 29900, 1822, 3597, 29918, 333, 29962, 396, 525, 3057, 10108, 29899, 29900, 29915, 13, 4706, 848, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 396, 4321, 411, 2322, 6273, 29889, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 5338, 29892, 848, 29922, 1272, 29892, 3402, 2433, 3126, 742, 13, 462, 462, 259, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 620, 29918, 1272, 353, 1583, 29889, 1579, 8606, 29898, 5327, 29889, 1272, 29897, 13, 4706, 10191, 353, 4852, 1272, 29901, 24335, 1476, 525, 8875, 29915, 6475, 1919, 881, 367, 29871, 29945, 6475, 29908, 13, 1669, 13742, 4830, 29898, 690, 29918, 1272, 29892, 7431, 29898, 690, 29918, 1272, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 690, 29918, 1272, 511, 29871, 29945, 29892, 10191, 29897, 13, 4706, 396, 4321, 411, 411, 29918, 4632, 29922, 8824, 13, 4706, 848, 1839, 2541, 29918, 4632, 2033, 353, 7700, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 5338, 29892, 848, 29922, 1272, 29892, 3402, 2433, 3126, 742, 13, 462, 462, 259, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 620, 29918, 1272, 353, 1583, 29889, 1579, 8606, 29898, 5327, 29889, 1272, 29897, 13, 4706, 10191, 353, 4852, 1272, 29901, 24335, 1476, 525, 8875, 29915, 6475, 1919, 881, 367, 29871, 29946, 6475, 29908, 13, 1669, 13742, 4830, 29898, 690, 29918, 1272, 29892, 7431, 29898, 690, 29918, 1272, 876, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2435, 29898, 690, 29918, 1272, 511, 29871, 29946, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 5438, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 694, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 2490, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 1653, 29918, 1761, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 497, 580, 13, 4706, 10191, 353, 376, 20683, 29901, 24335, 2302, 29901, 24335, 881, 367, 29871, 29900, 1642, 4830, 29898, 13, 9651, 13997, 29892, 13997, 29889, 2798, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 20683, 29889, 2798, 3285, 29871, 29900, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 5438, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 2490, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 1653, 29918, 1761, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29892, 2322, 29918, 1792, 29922, 8824, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29892, 2060, 29918, 1792, 29922, 8824, 29897, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 497, 580, 13, 4706, 10191, 353, 376, 20683, 29901, 24335, 2302, 29901, 24335, 881, 367, 29871, 29945, 1642, 4830, 29898, 13, 9651, 13997, 29892, 13997, 29889, 2798, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 20683, 29889, 2798, 3285, 29871, 29945, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 2287, 18476, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 694, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 8143, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 518, 20683, 29961, 29900, 3816, 29900, 1822, 3597, 29918, 333, 29962, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 20965, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29897, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 497, 580, 13, 4706, 10191, 353, 376, 20683, 29901, 24335, 2302, 29901, 24335, 881, 367, 29871, 29945, 1642, 4830, 29898, 13, 9651, 13997, 29892, 13997, 29889, 2798, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 20683, 29889, 2798, 3285, 29871, 29945, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 2287, 18476, 29918, 7320, 29918, 16513, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 278, 7663, 29918, 16513, 16248, 411, 2854, 11239, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1158, 353, 525, 8143, 29915, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 480, 353, 848, 29889, 842, 4381, 877, 14605, 742, 426, 1800, 13, 4706, 480, 1839, 20683, 2033, 353, 518, 20683, 29961, 29900, 3816, 29900, 1822, 3597, 29918, 333, 29962, 13, 4706, 480, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 848, 29889, 842, 4381, 877, 3035, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29892, 2322, 29918, 1792, 29922, 8824, 29897, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 9806, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 1529, 742, 480, 29889, 8552, 3101, 13, 4706, 848, 29889, 842, 4381, 877, 29925, 14849, 742, 480, 29889, 8552, 3101, 13, 4706, 1583, 3032, 1688, 29918, 4836, 29918, 7193, 29918, 2541, 29918, 3084, 29918, 17858, 6847, 29898, 13, 9651, 21333, 29892, 1158, 29892, 2009, 29918, 1272, 29922, 1272, 29892, 2060, 29918, 1792, 29922, 8824, 29897, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 497, 580, 13, 4706, 10191, 353, 376, 20683, 29901, 24335, 2302, 29901, 24335, 881, 367, 29871, 29900, 1642, 4830, 29898, 13, 9651, 13997, 29892, 13997, 29889, 2798, 3101, 13, 4706, 1583, 29889, 9294, 9843, 29898, 20683, 29889, 2798, 3285, 29871, 29900, 29892, 10191, 29897, 13, 13, 1678, 822, 1243, 29918, 7320, 29918, 16513, 29918, 15550, 3950, 29918, 18157, 29918, 12523, 29918, 265, 29918, 4836, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 8340, 848, 9946, 8845, 4436, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 848, 1839, 20683, 2033, 353, 518, 20683, 29961, 29900, 3816, 29900, 1822, 3597, 29918, 333, 29962, 13, 4706, 848, 1839, 4836, 2033, 353, 525, 29926, 2960, 29915, 13, 4706, 9049, 5085, 353, 1583, 3032, 14669, 29918, 1792, 29918, 11944, 9409, 580, 13, 4706, 9049, 5085, 1839, 7507, 2033, 353, 5852, 13, 4706, 9049, 5085, 1839, 275, 29918, 9136, 1792, 2033, 353, 7700, 13, 4706, 9049, 5085, 1839, 12154, 2033, 353, 1583, 29889, 23397, 29918, 11889, 13, 4706, 1404, 29892, 3132, 353, 1583, 3032, 3258, 29918, 1792, 29898, 1068, 19290, 29897, 13, 4706, 1583, 29889, 4836, 29889, 5014, 29918, 28109, 4197, 1311, 29889, 1792, 29892, 1404, 2314, 13, 4706, 1583, 29889, 4836, 29889, 842, 29918, 12154, 29898, 1792, 29892, 1583, 29889, 8618, 17637, 29918, 11889, 29897, 13, 4706, 2933, 353, 3132, 29889, 657, 29898, 5338, 29892, 848, 29922, 1272, 29892, 3402, 2433, 3126, 742, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 29892, 1059, 29918, 1989, 2433, 4836, 5477, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 4836, 2396, 376, 29909, 2060, 411, 278, 970, 29918, 333, 525, 29926, 2960, 29915, 947, 451, 1863, 19602, 13, 9651, 5615, 13, 13, 1678, 822, 1243, 29918, 7320, 29918, 16513, 29918, 15550, 3950, 29918, 18157, 29918, 12523, 29918, 265, 29918, 20683, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 8340, 848, 9946, 8845, 4436, 29889, 13, 4706, 9995, 13, 4706, 396, 1311, 29889, 11014, 3057, 703, 5776, 1971, 6275, 14993, 2986, 1159, 13, 4706, 1653, 29918, 1761, 353, 518, 1839, 3057, 10108, 29899, 29900, 742, 313, 877, 3057, 10108, 29899, 29896, 742, 525, 3057, 10108, 29899, 29906, 742, 511, 13, 462, 462, 4706, 6702, 3057, 10108, 29899, 29896, 29874, 742, 525, 3057, 10108, 29899, 29906, 29874, 742, 876, 5262, 13, 4706, 13997, 353, 17943, 29889, 12650, 29889, 3258, 29918, 7320, 29918, 8336, 29898, 13, 9651, 1583, 29889, 4836, 29892, 1653, 29918, 1761, 29897, 13, 4706, 21333, 353, 11837, 877, 7320, 29899, 16513, 1495, 13, 4706, 848, 353, 6571, 13, 4706, 848, 1839, 20683, 2033, 353, 5159, 13, 4706, 848, 1839, 4836, 2033, 353, 1583, 29889, 4836, 29889, 3597, 29918, 333, 13, 4706, 9049, 5085, 353, 1583, 3032, 14669, 29918, 1792, 29918, 11944, 9409, 580, 13, 4706, 9049, 5085, 1839, 7507, 2033, 353, 5852, 13, 4706, 9049, 5085, 1839, 275, 29918, 9136, 1792, 2033, 353, 7700, 13, 4706, 9049, 5085, 1839, 12154, 2033, 353, 1583, 29889, 23397, 29918, 11889, 13, 4706, 1404, 29892, 3132, 353, 1583, 3032, 3258, 29918, 1792, 29898, 1068, 19290, 29897, 13, 4706, 1583, 29889, 4836, 29889, 5014, 29918, 28109, 4197, 1311, 29889, 1792, 29892, 1404, 2314, 13, 4706, 1583, 29889, 4836, 29889, 842, 29918, 12154, 29898, 1792, 29892, 1583, 29889, 8618, 17637, 29918, 11889, 29897, 13, 4706, 4660, 29918, 401, 353, 4660, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 13, 4706, 2933, 353, 3132, 29889, 657, 29898, 5338, 29892, 848, 29922, 1272, 29892, 3579, 1311, 29889, 23252, 23598, 29897, 13, 4706, 10191, 353, 376, 5103, 29901, 6571, 881, 367, 24335, 2793, 29901, 6571, 1642, 4830, 29898, 13, 9651, 2933, 29889, 4882, 29918, 401, 29892, 4660, 29918, 401, 29892, 2933, 29889, 1272, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 4660, 29918, 401, 29892, 10191, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 1311, 3032, 5349, 29918, 2704, 29898, 5327, 29892, 1059, 29918, 1989, 2433, 20683, 5477, 10191, 29897, 13, 4706, 1583, 3032, 1688, 29918, 12523, 29898, 5327, 29892, 6987, 3790, 13, 9651, 525, 20683, 2396, 376, 4013, 1746, 338, 3734, 19602, 13, 9651, 5615, 13, 2 ]
src/features/build_features.py
weasysolutions/skin-lesion-dataset-cookiecutter
0
39475
# -*- coding: utf-8 -*- import click import os import logging import sys import pandas as pd import os, sys, inspect cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"images_in_features_subdirs"))) if cmd_subfolder not in sys.path: sys.path.append(cmd_subfolder) cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"non_duplicate_lesion_id"))) if cmd_subfolder not in sys.path: sys.path.append(cmd_subfolder) cmd_subfolder = os.path.realpath(os.path.abspath(os.path.join(os.path.split(inspect.getfile( inspect.currentframe() ))[0],"training_and_validation_sets"))) if cmd_subfolder not in sys.path: sys.path.append(cmd_subfolder) from images_in_features_subdirs import images_in_features_subdirs from non_duplicate_lesion_id import non_duplicate_lesion_id from training_and_validation_sets import training_and_validation_sets def build_features(**kwargs): metadata_csv = kwargs['metadata_csv'] train_dir = kwargs['train_dir'] images_dir = kwargs['images_dir'] val_dir = kwargs['val_dir'] """ Takes data in ../data/interim. Splits training and validation data. Stores splitted sets in ../data/processed/base_dir/train_dir and ../data/processed/base_dir/val_dir """ #load meta-data-set df = pd.read_csv(metadata_csv) #Create non_duplicate column. # Make a new df with unique_ids df, df_unique_id = non_duplicate_lesion_id(df) #split in training and validation dataframes df, df_train, df_val = training_and_validation_sets(df,df_unique_id) #place images in named attributes directories images_in_features_subdirs(df, images_dir = images_dir, train_dir = train_dir, val_dir = val_dir \ ) logger = logging.getLogger(__name__) logger.info('Features added. Data is ready for modelling.') if __name__ == '__main__': import json log_fmt = '%(asctime)s - %(name)s - %(levelname)s - %(message)s' logging.basicConfig(level=logging.INFO, format=log_fmt) data=json.loads(argv[1]) build_features(data)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 5215, 2828, 13, 5215, 2897, 13, 5215, 12183, 13, 5215, 10876, 13, 5215, 11701, 408, 10518, 13, 13, 5215, 2897, 29892, 10876, 29892, 16096, 13, 13, 9006, 29918, 1491, 12083, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 29898, 1144, 1103, 29889, 657, 1445, 29898, 16096, 29889, 3784, 2557, 580, 29871, 876, 29961, 29900, 1402, 29908, 8346, 29918, 262, 29918, 22100, 29918, 1491, 3972, 29879, 29908, 4961, 13, 361, 9920, 29918, 1491, 12083, 451, 297, 10876, 29889, 2084, 29901, 13, 268, 10876, 29889, 2084, 29889, 4397, 29898, 9006, 29918, 1491, 12083, 29897, 13, 308, 13, 9006, 29918, 1491, 12083, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 29898, 1144, 1103, 29889, 657, 1445, 29898, 16096, 29889, 3784, 2557, 580, 29871, 876, 29961, 29900, 1402, 29908, 5464, 29918, 20908, 5926, 29918, 793, 291, 29918, 333, 29908, 4961, 13, 361, 9920, 29918, 1491, 12083, 451, 297, 10876, 29889, 2084, 29901, 13, 268, 10876, 29889, 2084, 29889, 4397, 29898, 9006, 29918, 1491, 12083, 29897, 13, 308, 13, 9006, 29918, 1491, 12083, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 29898, 1144, 1103, 29889, 657, 1445, 29898, 16096, 29889, 3784, 2557, 580, 29871, 876, 29961, 29900, 1402, 29908, 26495, 29918, 392, 29918, 18157, 29918, 7224, 29908, 4961, 13, 361, 9920, 29918, 1491, 12083, 451, 297, 10876, 29889, 2084, 29901, 13, 268, 10876, 29889, 2084, 29889, 4397, 29898, 9006, 29918, 1491, 12083, 29897, 13, 462, 462, 13, 13, 3166, 4558, 29918, 262, 29918, 22100, 29918, 1491, 3972, 29879, 1053, 4558, 29918, 262, 29918, 22100, 29918, 1491, 3972, 29879, 29871, 13, 3166, 1661, 29918, 20908, 5926, 29918, 793, 291, 29918, 333, 1053, 1661, 29918, 20908, 5926, 29918, 793, 291, 29918, 333, 13, 3166, 6694, 29918, 392, 29918, 18157, 29918, 7224, 1053, 6694, 29918, 392, 29918, 18157, 29918, 7224, 13, 13, 13, 1753, 2048, 29918, 22100, 29898, 1068, 19290, 1125, 13, 268, 13, 268, 13, 1678, 15562, 29918, 7638, 353, 9049, 5085, 1839, 19635, 29918, 7638, 2033, 13, 1678, 7945, 29918, 3972, 353, 9049, 5085, 1839, 14968, 29918, 3972, 2033, 13, 1678, 4558, 29918, 3972, 353, 9049, 5085, 1839, 8346, 29918, 3972, 2033, 13, 1678, 659, 29918, 3972, 353, 9049, 5085, 1839, 791, 29918, 3972, 2033, 13, 268, 13, 308, 13, 1678, 9995, 29871, 13, 268, 323, 6926, 848, 297, 29772, 1272, 29914, 1639, 326, 29889, 317, 572, 1169, 6694, 322, 8845, 848, 29889, 13, 268, 624, 2361, 8536, 4430, 6166, 297, 29772, 1272, 29914, 5014, 287, 29914, 3188, 29918, 3972, 29914, 14968, 29918, 3972, 29871, 13, 268, 322, 29772, 1272, 29914, 5014, 287, 29914, 3188, 29918, 3972, 29914, 791, 29918, 3972, 13, 1678, 9995, 13, 1678, 396, 1359, 12700, 29899, 1272, 29899, 842, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 29898, 19635, 29918, 7638, 29897, 13, 268, 13, 1678, 396, 4391, 1661, 29918, 20908, 5926, 1897, 29889, 29871, 13, 1678, 396, 8561, 263, 716, 4489, 411, 5412, 29918, 4841, 13, 1678, 13, 1678, 4489, 29892, 4489, 29918, 13092, 29918, 333, 29871, 353, 1661, 29918, 20908, 5926, 29918, 793, 291, 29918, 333, 29898, 2176, 29897, 13, 268, 13, 1678, 396, 5451, 297, 6694, 322, 8845, 848, 19935, 13, 1678, 4489, 29892, 4489, 29918, 14968, 29892, 4489, 29918, 791, 353, 6694, 29918, 392, 29918, 18157, 29918, 7224, 29898, 2176, 29892, 2176, 29918, 13092, 29918, 333, 29897, 13, 268, 13, 1678, 396, 6689, 4558, 297, 4257, 8393, 17525, 29871, 13, 268, 13, 1678, 4558, 29918, 262, 29918, 22100, 29918, 1491, 3972, 29879, 29898, 2176, 29892, 13, 462, 18884, 4558, 29918, 3972, 353, 4558, 29918, 3972, 29892, 29871, 13, 462, 18884, 7945, 29918, 3972, 353, 7945, 29918, 3972, 29892, 13, 462, 18884, 659, 29918, 3972, 353, 659, 29918, 3972, 320, 13, 462, 795, 1723, 13, 268, 13, 418, 13, 1678, 17927, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 1678, 17927, 29889, 3888, 877, 8263, 3698, 2715, 29889, 3630, 338, 7960, 363, 878, 7807, 29889, 1495, 13, 13, 268, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 268, 13, 1678, 1053, 4390, 29871, 13, 268, 13, 1678, 1480, 29918, 23479, 353, 14210, 29898, 294, 312, 603, 29897, 29879, 448, 1273, 29898, 978, 29897, 29879, 448, 1273, 29898, 5563, 978, 29897, 29879, 448, 1273, 29898, 4906, 29897, 29879, 29915, 13, 1678, 12183, 29889, 16121, 3991, 29898, 5563, 29922, 21027, 29889, 11690, 29892, 3402, 29922, 1188, 29918, 23479, 29897, 13, 268, 13, 1678, 848, 29922, 3126, 29889, 18132, 29898, 19218, 29961, 29896, 2314, 13, 13, 1678, 2048, 29918, 22100, 29898, 1272, 29897, 2 ]
test/com/facebook/buck/parser/testdata/load_twice_from_bzl/b.bzl
jasonnam/buck
0
68113
<filename>test/com/facebook/buck/parser/testdata/load_twice_from_bzl/b.bzl z = 3 w = 4
[ 1, 529, 9507, 29958, 1688, 29914, 510, 29914, 15445, 29914, 2423, 384, 29914, 16680, 29914, 1688, 1272, 29914, 1359, 29918, 7516, 625, 29918, 3166, 29918, 29890, 29920, 29880, 29914, 29890, 29889, 29890, 29920, 29880, 13, 29920, 353, 29871, 29941, 13, 29893, 353, 29871, 29946, 13, 2 ]
python/src/problem/leetcode/easy/leetcode_189.py
yipwinghong/Algorithm
9
22684
# coding=utf-8 from typing import List class Solution: """ 旋转数组 """ def reverse(self, nums: List[int], i: int, j: int) -> None: """ :param nums: :param i: :param j: :return: """ while i < j: nums[i], nums[j] = nums[j], nums[i] i += 1 j -= 1 def rotate(self, nums: List[int], k: int) -> None: """ Time: O(n), Space: O(1) :param nums: :param k: :return: """ if not nums or k <= 0: return n, m = len(nums), k % len(nums) self.reverse(nums, 0, n - 1) self.reverse(nums, 0, m - 1) self.reverse(nums, m, n - 1)
[ 1, 396, 14137, 29922, 9420, 29899, 29947, 13, 3166, 19229, 1053, 2391, 13, 13, 13, 1990, 24380, 29901, 13, 1678, 9995, 13, 268, 233, 154, 142, 31415, 30354, 31263, 13, 1678, 9995, 13, 13, 1678, 822, 11837, 29898, 1311, 29892, 954, 29879, 29901, 2391, 29961, 524, 1402, 474, 29901, 938, 29892, 432, 29901, 938, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 13, 4706, 584, 3207, 954, 29879, 29901, 13, 4706, 584, 3207, 474, 29901, 13, 4706, 584, 3207, 432, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1550, 474, 529, 432, 29901, 13, 9651, 954, 29879, 29961, 29875, 1402, 954, 29879, 29961, 29926, 29962, 353, 954, 29879, 29961, 29926, 1402, 954, 29879, 29961, 29875, 29962, 13, 9651, 474, 4619, 29871, 29896, 13, 9651, 432, 22361, 29871, 29896, 13, 13, 1678, 822, 16734, 29898, 1311, 29892, 954, 29879, 29901, 2391, 29961, 524, 1402, 413, 29901, 938, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 5974, 29901, 438, 29898, 29876, 511, 14121, 29901, 438, 29898, 29896, 29897, 13, 4706, 584, 3207, 954, 29879, 29901, 13, 4706, 584, 3207, 413, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 565, 451, 954, 29879, 470, 413, 5277, 29871, 29900, 29901, 13, 9651, 736, 13, 13, 4706, 302, 29892, 286, 353, 7431, 29898, 1949, 29879, 511, 413, 1273, 7431, 29898, 1949, 29879, 29897, 13, 13, 4706, 1583, 29889, 24244, 29898, 1949, 29879, 29892, 29871, 29900, 29892, 302, 448, 29871, 29896, 29897, 13, 4706, 1583, 29889, 24244, 29898, 1949, 29879, 29892, 29871, 29900, 29892, 286, 448, 29871, 29896, 29897, 13, 4706, 1583, 29889, 24244, 29898, 1949, 29879, 29892, 286, 29892, 302, 448, 29871, 29896, 29897, 13, 13, 2 ]
doomrnn/model.py
yumaloop/predwm
494
67920
<gh_stars>100-1000 import numpy as np import random #from scipy.fftpack import dct import json import sys import config from env import make_env import time final_mode = True render_mode = True RENDER_DELAY = False def make_model(game): # can be extended in the future. model = Model(game) return model def sigmoid(x): return 1 / (1 + np.exp(-x)) def relu(x): return np.maximum(x, 0) def passthru(x): return x def softmax(x): e_x = np.exp(x - np.max(x)) return e_x / e_x.sum(axis=0) def sample(p): return np.argmax(np.random.multinomial(1, p)) class Model: ''' simple feedforward model ''' def __init__(self, game): self.noise_level = 0.0 self.env_name = game.env_name self.input_size = game.input_size self.output_size = game.output_size self.shapes = [ (game.input_size, game.output_size) ] self.sample_output = False if game.activation == 'relu': self.activations = [relu] elif game.activation == 'sigmoid': self.activations = [sigmoid] elif game.activation == 'passthru': self.activations = [np.tanh] else: self.activations = [np.tanh] self.weight = [] self.param_count = game.input_size * game.output_size for shape in self.shapes: self.weight.append(np.zeros(shape=shape)) self.render_mode = False def make_env(self, seed=-1, render_mode=False, load_model=True): self.render_mode = render_mode self.env = make_env(self.env_name, seed=seed, render_mode=render_mode, load_model=load_model) def get_action(self, x): # if mean_mode = True, ignore sampling. h = np.array(x).flatten() num_layers = len(self.weight) for i in range(num_layers): w = self.weight[i] h = np.matmul(h, w) h = self.activations[i](h + np.random.randn()*self.noise_level) return h def set_model_params(self, model_params): pointer = 0 for i in range(len(self.shapes)): w_shape = self.shapes[i] s_w = np.product(w_shape) s = s_w chunk = np.array(model_params[pointer:pointer+s]) self.weight[i] = chunk[:s_w].reshape(w_shape) pointer += s def load_model(self, filename): with open(filename) as f: data = json.load(f) print('loading file %s' % (filename)) self.data = data model_params = np.array(data[0]) # assuming other stuff is in data self.set_model_params(model_params) # also load the vae and rnn self.env.vae.load_json('tf_models/vae.json') self.env.rnn.load_json('tf_models/rnn.json') def get_random_model_params(self, stdev=0.1): #return np.random.randn(self.param_count)*stdev return np.random.standard_cauchy(self.param_count)*stdev # spice things up! def init_random_model_params(self, stdev=0.1): params = self.get_random_model_params(stdev=stdev) self.set_model_params(params) vae_params = self.env.vae.get_random_model_params(stdev=stdev) self.env.vae.set_model_params(vae_params) rnn_params = self.env.rnn.get_random_model_params(stdev=stdev) self.env.rnn.set_model_params(rnn_params) def evaluate(model): # run 100 times and average score, according to the reles. model.env.seed(0) total_reward = 0.0 N = 100 for i in range(N): reward, t = simulate(model, train_mode=False, render_mode=False, num_episode=1) total_reward += reward[0] return (total_reward / float(N)) def simulate(model, train_mode=False, render_mode=True, num_episode=5, seed=-1, max_len=-1): reward_list = [] t_list = [] max_episode_length = 2100 if train_mode and max_len > 0: max_episode_length = max_len if (seed >= 0): random.seed(seed) np.random.seed(seed) model.env.seed(seed) for episode in range(num_episode): obs = model.env.reset() if obs is None: obs = np.zeros(model.input_size) total_reward = 0.0 for t in range(max_episode_length): if render_mode: model.env.render("human") if RENDER_DELAY: time.sleep(0.01) action = model.get_action(obs) prev_obs = obs obs, reward, done, info = model.env.step(action) if (render_mode): pass #print("action", action, "step reward", reward) #print("step reward", reward) total_reward += reward if done: break if render_mode: print("reward", total_reward, "timesteps", t) model.env.close() reward_list.append(total_reward) t_list.append(t) return reward_list, t_list def main(): global RENDER_DELAY global final_mode assert len(sys.argv) > 2, 'python model.py gamename render/norender path_to_model.json [seed]' gamename = sys.argv[1] game = config.games[gamename] final_mode_string = str(sys.argv[2]) if (final_mode_string == "render"): final_mode = False # don't run 100 times, just visualize results. use_model = False if (len(sys.argv) > 3): use_model = True filename = sys.argv[3] print("filename", filename) the_seed = np.random.randint(10000) if len(sys.argv) > 4: the_seed = int(sys.argv[4]) print("seed", the_seed) model = make_model(game) print('model size', model.param_count) if (use_model): model.make_env(render_mode=render_mode) model.load_model(filename) else: model.make_env(render_mode=render_mode, load_model=False) model.init_random_model_params(stdev=np.random.rand()*0.01) if final_mode: total_reward = 0.0 np.random.seed(the_seed) model.env.seed(the_seed) reward_list = [] for i in range(100): reward, steps_taken = simulate(model, train_mode=False, render_mode=False, num_episode=1) print("iteration", i, "reward", reward[0]) total_reward += reward[0] reward_list.append(reward[0]) print("seed", the_seed, "average_reward", total_reward/100, "stdev", np.std(reward_list)) else: reward, steps_taken = simulate(model, train_mode=False, render_mode=render_mode, num_episode=1) print ("terminal reward", reward, "average steps taken", np.mean(steps_taken)+1) if __name__ == "__main__": main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 5215, 12655, 408, 7442, 13, 5215, 4036, 13, 29937, 3166, 4560, 2272, 29889, 600, 29873, 4058, 1053, 270, 312, 13, 5215, 4390, 13, 5215, 10876, 13, 5215, 2295, 13, 3166, 8829, 1053, 1207, 29918, 6272, 13, 5215, 931, 13, 13, 8394, 29918, 8513, 353, 5852, 13, 9482, 29918, 8513, 353, 5852, 13, 29934, 1430, 8032, 29918, 2287, 18799, 353, 7700, 13, 13, 1753, 1207, 29918, 4299, 29898, 11802, 1125, 13, 29871, 396, 508, 367, 10410, 297, 278, 5434, 29889, 13, 29871, 1904, 353, 8125, 29898, 11802, 29897, 13, 29871, 736, 1904, 13, 13, 1753, 4365, 29885, 3398, 29898, 29916, 1125, 13, 29871, 736, 29871, 29896, 847, 313, 29896, 718, 7442, 29889, 4548, 6278, 29916, 876, 13, 13, 1753, 1104, 29884, 29898, 29916, 1125, 13, 29871, 736, 7442, 29889, 27525, 398, 29898, 29916, 29892, 29871, 29900, 29897, 13, 13, 1753, 2331, 303, 29882, 582, 29898, 29916, 1125, 13, 29871, 736, 921, 13, 13, 1753, 4964, 3317, 29898, 29916, 1125, 13, 29871, 321, 29918, 29916, 353, 7442, 29889, 4548, 29898, 29916, 448, 7442, 29889, 3317, 29898, 29916, 876, 13, 29871, 736, 321, 29918, 29916, 847, 321, 29918, 29916, 29889, 2083, 29898, 8990, 29922, 29900, 29897, 13, 13, 1753, 4559, 29898, 29886, 1125, 13, 29871, 736, 7442, 29889, 1191, 3317, 29898, 9302, 29889, 8172, 29889, 4713, 262, 7615, 29898, 29896, 29892, 282, 876, 13, 13, 1990, 8125, 29901, 13, 29871, 14550, 2560, 8343, 11333, 1904, 14550, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 3748, 1125, 13, 1678, 1583, 29889, 1217, 895, 29918, 5563, 353, 29871, 29900, 29889, 29900, 13, 1678, 1583, 29889, 6272, 29918, 978, 353, 3748, 29889, 6272, 29918, 978, 13, 13, 1678, 1583, 29889, 2080, 29918, 2311, 353, 3748, 29889, 2080, 29918, 2311, 13, 1678, 1583, 29889, 4905, 29918, 2311, 353, 3748, 29889, 4905, 29918, 2311, 13, 13, 1678, 1583, 29889, 845, 11603, 353, 518, 313, 11802, 29889, 2080, 29918, 2311, 29892, 3748, 29889, 4905, 29918, 2311, 29897, 4514, 13, 13, 1678, 1583, 29889, 11249, 29918, 4905, 353, 7700, 13, 1678, 565, 3748, 29889, 11236, 362, 1275, 525, 2674, 29884, 2396, 13, 418, 1583, 29889, 11236, 800, 353, 518, 2674, 29884, 29962, 13, 1678, 25342, 3748, 29889, 11236, 362, 1275, 525, 18816, 29885, 3398, 2396, 13, 418, 1583, 29889, 11236, 800, 353, 518, 18816, 29885, 3398, 29962, 13, 1678, 25342, 3748, 29889, 11236, 362, 1275, 525, 18182, 303, 29882, 582, 2396, 13, 418, 1583, 29889, 11236, 800, 353, 518, 9302, 29889, 13161, 29882, 29962, 13, 1678, 1683, 29901, 13, 418, 1583, 29889, 11236, 800, 353, 518, 9302, 29889, 13161, 29882, 29962, 13, 13, 1678, 1583, 29889, 7915, 353, 5159, 13, 1678, 1583, 29889, 3207, 29918, 2798, 353, 3748, 29889, 2080, 29918, 2311, 334, 3748, 29889, 4905, 29918, 2311, 13, 13, 1678, 363, 8267, 297, 1583, 29889, 845, 11603, 29901, 13, 418, 1583, 29889, 7915, 29889, 4397, 29898, 9302, 29889, 3298, 359, 29898, 12181, 29922, 12181, 876, 13, 13, 1678, 1583, 29889, 9482, 29918, 8513, 353, 7700, 13, 13, 29871, 822, 1207, 29918, 6272, 29898, 1311, 29892, 16717, 10457, 29896, 29892, 4050, 29918, 8513, 29922, 8824, 29892, 2254, 29918, 4299, 29922, 5574, 1125, 13, 1678, 1583, 29889, 9482, 29918, 8513, 353, 4050, 29918, 8513, 13, 1678, 1583, 29889, 6272, 353, 1207, 29918, 6272, 29898, 1311, 29889, 6272, 29918, 978, 29892, 16717, 29922, 26776, 29892, 4050, 29918, 8513, 29922, 9482, 29918, 8513, 29892, 2254, 29918, 4299, 29922, 1359, 29918, 4299, 29897, 13, 13, 29871, 822, 679, 29918, 2467, 29898, 1311, 29892, 921, 1125, 13, 1678, 396, 565, 2099, 29918, 8513, 353, 5852, 29892, 11455, 23460, 29889, 13, 1678, 298, 353, 7442, 29889, 2378, 29898, 29916, 467, 1579, 8606, 580, 13, 13, 1678, 954, 29918, 29277, 353, 7431, 29898, 1311, 29889, 7915, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 1949, 29918, 29277, 1125, 13, 418, 281, 353, 1583, 29889, 7915, 29961, 29875, 29962, 13, 418, 298, 353, 7442, 29889, 2922, 16109, 29898, 29882, 29892, 281, 29897, 13, 418, 298, 353, 1583, 29889, 11236, 800, 29961, 29875, 850, 29882, 718, 7442, 29889, 8172, 29889, 9502, 29876, 580, 29930, 1311, 29889, 1217, 895, 29918, 5563, 29897, 13, 13, 1678, 736, 298, 13, 13, 29871, 822, 731, 29918, 4299, 29918, 7529, 29898, 1311, 29892, 1904, 29918, 7529, 1125, 13, 1678, 4879, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 1311, 29889, 845, 11603, 22164, 13, 418, 281, 29918, 12181, 353, 1583, 29889, 845, 11603, 29961, 29875, 29962, 13, 418, 269, 29918, 29893, 353, 7442, 29889, 4704, 29898, 29893, 29918, 12181, 29897, 13, 418, 269, 353, 269, 29918, 29893, 13, 418, 19875, 353, 7442, 29889, 2378, 29898, 4299, 29918, 7529, 29961, 17226, 29901, 17226, 29974, 29879, 2314, 13, 418, 1583, 29889, 7915, 29961, 29875, 29962, 353, 19875, 7503, 29879, 29918, 29893, 1822, 690, 14443, 29898, 29893, 29918, 12181, 29897, 13, 418, 4879, 4619, 269, 13, 13, 29871, 822, 2254, 29918, 4299, 29898, 1311, 29892, 10422, 1125, 13, 1678, 411, 1722, 29898, 9507, 29897, 408, 285, 29901, 268, 13, 418, 848, 353, 4390, 29889, 1359, 29898, 29888, 29897, 13, 1678, 1596, 877, 13234, 934, 1273, 29879, 29915, 1273, 313, 9507, 876, 13, 1678, 1583, 29889, 1272, 353, 848, 13, 1678, 1904, 29918, 7529, 353, 7442, 29889, 2378, 29898, 1272, 29961, 29900, 2314, 396, 10241, 916, 6433, 338, 297, 848, 13, 1678, 1583, 29889, 842, 29918, 4299, 29918, 7529, 29898, 4299, 29918, 7529, 29897, 13, 1678, 396, 884, 2254, 278, 2947, 29872, 322, 364, 15755, 13, 1678, 1583, 29889, 6272, 29889, 1564, 29872, 29889, 1359, 29918, 3126, 877, 13264, 29918, 9794, 29914, 1564, 29872, 29889, 3126, 1495, 13, 1678, 1583, 29889, 6272, 29889, 29878, 15755, 29889, 1359, 29918, 3126, 877, 13264, 29918, 9794, 29914, 29878, 15755, 29889, 3126, 1495, 13, 13, 29871, 822, 679, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 1311, 29892, 380, 3359, 29922, 29900, 29889, 29896, 1125, 13, 1678, 396, 2457, 7442, 29889, 8172, 29889, 9502, 29876, 29898, 1311, 29889, 3207, 29918, 2798, 11877, 303, 3359, 13, 1678, 736, 7442, 29889, 8172, 29889, 15770, 29918, 29883, 13989, 29891, 29898, 1311, 29889, 3207, 29918, 2798, 11877, 303, 3359, 396, 805, 625, 2712, 701, 29991, 13, 13, 29871, 822, 2069, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 1311, 29892, 380, 3359, 29922, 29900, 29889, 29896, 1125, 13, 1678, 8636, 353, 1583, 29889, 657, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 303, 3359, 29922, 303, 3359, 29897, 13, 1678, 1583, 29889, 842, 29918, 4299, 29918, 7529, 29898, 7529, 29897, 13, 1678, 2947, 29872, 29918, 7529, 353, 1583, 29889, 6272, 29889, 1564, 29872, 29889, 657, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 303, 3359, 29922, 303, 3359, 29897, 13, 1678, 1583, 29889, 6272, 29889, 1564, 29872, 29889, 842, 29918, 4299, 29918, 7529, 29898, 1564, 29872, 29918, 7529, 29897, 13, 1678, 364, 15755, 29918, 7529, 353, 1583, 29889, 6272, 29889, 29878, 15755, 29889, 657, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 303, 3359, 29922, 303, 3359, 29897, 13, 1678, 1583, 29889, 6272, 29889, 29878, 15755, 29889, 842, 29918, 4299, 29918, 7529, 29898, 29878, 15755, 29918, 7529, 29897, 13, 13, 1753, 14707, 29898, 4299, 1125, 13, 29871, 396, 1065, 29871, 29896, 29900, 29900, 3064, 322, 6588, 8158, 29892, 5034, 304, 278, 337, 793, 29889, 13, 29871, 1904, 29889, 6272, 29889, 26776, 29898, 29900, 29897, 13, 29871, 3001, 29918, 276, 1328, 353, 29871, 29900, 29889, 29900, 13, 29871, 405, 353, 29871, 29896, 29900, 29900, 13, 29871, 363, 474, 297, 3464, 29898, 29940, 1125, 13, 1678, 20751, 29892, 260, 353, 29611, 29898, 4299, 29892, 7945, 29918, 8513, 29922, 8824, 29892, 4050, 29918, 8513, 29922, 8824, 29892, 954, 29918, 1022, 275, 356, 29922, 29896, 29897, 13, 1678, 3001, 29918, 276, 1328, 4619, 20751, 29961, 29900, 29962, 13, 29871, 736, 313, 7827, 29918, 276, 1328, 847, 5785, 29898, 29940, 876, 13, 13, 1753, 29611, 29898, 4299, 29892, 7945, 29918, 8513, 29922, 8824, 29892, 4050, 29918, 8513, 29922, 5574, 29892, 954, 29918, 1022, 275, 356, 29922, 29945, 29892, 16717, 10457, 29896, 29892, 4236, 29918, 2435, 10457, 29896, 1125, 13, 13, 29871, 20751, 29918, 1761, 353, 5159, 13, 29871, 260, 29918, 1761, 353, 5159, 13, 13, 29871, 4236, 29918, 1022, 275, 356, 29918, 2848, 353, 29871, 29906, 29896, 29900, 29900, 13, 13, 29871, 565, 7945, 29918, 8513, 322, 4236, 29918, 2435, 1405, 29871, 29900, 29901, 13, 1678, 4236, 29918, 1022, 275, 356, 29918, 2848, 353, 4236, 29918, 2435, 13, 13, 29871, 565, 313, 26776, 6736, 29871, 29900, 1125, 13, 1678, 4036, 29889, 26776, 29898, 26776, 29897, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 26776, 29897, 13, 1678, 1904, 29889, 6272, 29889, 26776, 29898, 26776, 29897, 13, 13, 29871, 363, 12720, 297, 3464, 29898, 1949, 29918, 1022, 275, 356, 1125, 13, 13, 1678, 20881, 353, 1904, 29889, 6272, 29889, 12071, 580, 13, 13, 1678, 565, 20881, 338, 6213, 29901, 13, 418, 20881, 353, 7442, 29889, 3298, 359, 29898, 4299, 29889, 2080, 29918, 2311, 29897, 13, 13, 1678, 3001, 29918, 276, 1328, 353, 29871, 29900, 29889, 29900, 13, 13, 1678, 363, 260, 297, 3464, 29898, 3317, 29918, 1022, 275, 356, 29918, 2848, 1125, 13, 13, 418, 565, 4050, 29918, 8513, 29901, 13, 4706, 1904, 29889, 6272, 29889, 9482, 703, 26029, 1159, 13, 4706, 565, 390, 1430, 8032, 29918, 2287, 18799, 29901, 13, 3986, 931, 29889, 17059, 29898, 29900, 29889, 29900, 29896, 29897, 13, 13, 418, 3158, 353, 1904, 29889, 657, 29918, 2467, 29898, 26290, 29897, 13, 13, 418, 12379, 29918, 26290, 353, 20881, 13, 13, 418, 20881, 29892, 20751, 29892, 2309, 29892, 5235, 353, 1904, 29889, 6272, 29889, 10568, 29898, 2467, 29897, 13, 13, 418, 565, 313, 9482, 29918, 8513, 1125, 13, 4706, 1209, 13, 4706, 396, 2158, 703, 2467, 613, 3158, 29892, 376, 10568, 20751, 613, 20751, 29897, 13, 4706, 396, 2158, 703, 10568, 20751, 613, 20751, 29897, 13, 418, 3001, 29918, 276, 1328, 4619, 20751, 13, 13, 418, 565, 2309, 29901, 13, 4706, 2867, 13, 13, 1678, 565, 4050, 29918, 8513, 29901, 13, 418, 1596, 703, 276, 1328, 613, 3001, 29918, 276, 1328, 29892, 376, 9346, 4196, 567, 613, 260, 29897, 13, 418, 1904, 29889, 6272, 29889, 5358, 580, 13, 13, 1678, 20751, 29918, 1761, 29889, 4397, 29898, 7827, 29918, 276, 1328, 29897, 13, 1678, 260, 29918, 1761, 29889, 4397, 29898, 29873, 29897, 13, 13, 29871, 736, 20751, 29918, 1761, 29892, 260, 29918, 1761, 13, 13, 1753, 1667, 7295, 13, 13, 29871, 5534, 390, 1430, 8032, 29918, 2287, 18799, 13, 29871, 5534, 2186, 29918, 8513, 13, 13, 29871, 4974, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29906, 29892, 525, 4691, 1904, 29889, 2272, 24988, 3871, 4050, 29914, 15459, 1581, 2224, 29918, 517, 29918, 4299, 29889, 3126, 518, 26776, 29962, 29915, 13, 13, 29871, 24988, 3871, 353, 10876, 29889, 19218, 29961, 29896, 29962, 13, 13, 29871, 3748, 353, 2295, 29889, 29887, 1280, 29961, 29887, 314, 3871, 29962, 13, 13, 29871, 2186, 29918, 8513, 29918, 1807, 353, 851, 29898, 9675, 29889, 19218, 29961, 29906, 2314, 13, 29871, 565, 313, 8394, 29918, 8513, 29918, 1807, 1275, 376, 9482, 29908, 1125, 13, 1678, 2186, 29918, 8513, 353, 7700, 396, 1016, 29915, 29873, 1065, 29871, 29896, 29900, 29900, 3064, 29892, 925, 7604, 675, 2582, 29889, 13, 13, 29871, 671, 29918, 4299, 353, 7700, 13, 29871, 565, 313, 2435, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29941, 1125, 13, 1678, 671, 29918, 4299, 353, 5852, 13, 1678, 10422, 353, 10876, 29889, 19218, 29961, 29941, 29962, 13, 1678, 1596, 703, 9507, 613, 10422, 29897, 13, 13, 29871, 278, 29918, 26776, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29896, 29900, 29900, 29900, 29900, 29897, 13, 29871, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29946, 29901, 13, 1678, 278, 29918, 26776, 353, 938, 29898, 9675, 29889, 19218, 29961, 29946, 2314, 13, 1678, 1596, 703, 26776, 613, 278, 29918, 26776, 29897, 13, 13, 29871, 1904, 353, 1207, 29918, 4299, 29898, 11802, 29897, 13, 29871, 1596, 877, 4299, 2159, 742, 1904, 29889, 3207, 29918, 2798, 29897, 13, 13, 13, 29871, 565, 313, 1509, 29918, 4299, 1125, 13, 1678, 1904, 29889, 5675, 29918, 6272, 29898, 9482, 29918, 8513, 29922, 9482, 29918, 8513, 29897, 13, 1678, 1904, 29889, 1359, 29918, 4299, 29898, 9507, 29897, 13, 29871, 1683, 29901, 13, 1678, 1904, 29889, 5675, 29918, 6272, 29898, 9482, 29918, 8513, 29922, 9482, 29918, 8513, 29892, 2254, 29918, 4299, 29922, 8824, 29897, 13, 1678, 1904, 29889, 2344, 29918, 8172, 29918, 4299, 29918, 7529, 29898, 303, 3359, 29922, 9302, 29889, 8172, 29889, 9502, 580, 29930, 29900, 29889, 29900, 29896, 29897, 13, 13, 29871, 565, 2186, 29918, 8513, 29901, 13, 1678, 3001, 29918, 276, 1328, 353, 29871, 29900, 29889, 29900, 13, 1678, 7442, 29889, 8172, 29889, 26776, 29898, 1552, 29918, 26776, 29897, 13, 1678, 1904, 29889, 6272, 29889, 26776, 29898, 1552, 29918, 26776, 29897, 13, 1678, 20751, 29918, 1761, 353, 5159, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29896, 29900, 29900, 1125, 13, 418, 20751, 29892, 6576, 29918, 29873, 9424, 353, 29611, 29898, 4299, 29892, 7945, 29918, 8513, 29922, 8824, 29892, 4050, 29918, 8513, 29922, 8824, 29892, 954, 29918, 1022, 275, 356, 29922, 29896, 29897, 13, 418, 1596, 703, 1524, 362, 613, 474, 29892, 376, 276, 1328, 613, 20751, 29961, 29900, 2314, 13, 418, 3001, 29918, 276, 1328, 4619, 20751, 29961, 29900, 29962, 13, 418, 20751, 29918, 1761, 29889, 4397, 29898, 276, 1328, 29961, 29900, 2314, 13, 1678, 1596, 703, 26776, 613, 278, 29918, 26776, 29892, 376, 12483, 482, 29918, 276, 1328, 613, 3001, 29918, 276, 1328, 29914, 29896, 29900, 29900, 29892, 376, 303, 3359, 613, 7442, 29889, 4172, 29898, 276, 1328, 29918, 1761, 876, 13, 13, 29871, 1683, 29901, 13, 13, 1678, 20751, 29892, 6576, 29918, 29873, 9424, 353, 29611, 29898, 4299, 29892, 13, 418, 7945, 29918, 8513, 29922, 8824, 29892, 4050, 29918, 8513, 29922, 9482, 29918, 8513, 29892, 954, 29918, 1022, 275, 356, 29922, 29896, 29897, 13, 1678, 1596, 4852, 8489, 979, 20751, 613, 20751, 29892, 376, 12483, 482, 6576, 4586, 613, 7442, 29889, 12676, 29898, 24530, 29918, 29873, 9424, 7240, 29896, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 1667, 580, 13, 2 ]
test-simple-searcher.py
t83714/test-bert
0
188893
<reponame>t83714/test-bert import torch import pandas as pd from transformers import BertTokenizer, BertModel from SimpleSearcher import SimpleSearcher from format_attn_tuple import format_attn_tuple torch.set_printoptions(profile="full") gth_file = 'gth_part1' sentences = pd.read_csv('{0}.csv'.format(gth_file))[ 'Sentences'].values.tolist() tokenizer = BertTokenizer.from_pretrained('bert-base-uncased') model = BertModel.from_pretrained('bert-base-uncased') def process_sentence(sentence): print("Receive sentence: ", sentence) inputs = tokenizer(sentence, return_tensors="pt", add_special_tokens=False) outputs = model(**inputs, output_attentions=True, return_dict=False) searcher = SimpleSearcher(tokenizer, inputs.input_ids, outputs[-1]) fact = searcher.search() print("Found fact: ", " -> ".join(map(lambda item: str(item[0]) + "("+str(item[1])+")", list(fact))), "\n") for s in sentences: process_sentence(s)
[ 1, 529, 276, 1112, 420, 29958, 29873, 29947, 29941, 29955, 29896, 29946, 29914, 1688, 29899, 2151, 13, 5215, 4842, 305, 13, 5215, 11701, 408, 10518, 13, 3166, 4327, 414, 1053, 16662, 6066, 3950, 29892, 16662, 3195, 13, 3166, 12545, 7974, 261, 1053, 12545, 7974, 261, 13, 3166, 3402, 29918, 1131, 29876, 29918, 23583, 1053, 3402, 29918, 1131, 29876, 29918, 23583, 13, 13, 7345, 305, 29889, 842, 29918, 558, 8941, 1980, 29898, 10185, 543, 8159, 1159, 13, 13, 29887, 386, 29918, 1445, 353, 525, 29887, 386, 29918, 1595, 29896, 29915, 13, 18616, 2063, 353, 10518, 29889, 949, 29918, 7638, 877, 29912, 29900, 1836, 7638, 4286, 4830, 29898, 29887, 386, 29918, 1445, 876, 29961, 13, 1678, 525, 29903, 296, 2063, 13359, 5975, 29889, 25027, 391, 580, 13, 13, 6979, 3950, 353, 16662, 6066, 3950, 29889, 3166, 29918, 1457, 3018, 1312, 877, 2151, 29899, 3188, 29899, 4661, 1463, 1495, 13, 4299, 353, 16662, 3195, 29889, 3166, 29918, 1457, 3018, 1312, 877, 2151, 29899, 3188, 29899, 4661, 1463, 1495, 13, 13, 13, 1753, 1889, 29918, 18616, 663, 29898, 18616, 663, 1125, 13, 1678, 1596, 703, 24131, 10541, 29901, 9162, 10541, 29897, 13, 13, 1678, 10970, 353, 5993, 3950, 29898, 18616, 663, 29892, 736, 29918, 29873, 575, 943, 543, 415, 613, 788, 29918, 18732, 29918, 517, 12360, 29922, 8824, 29897, 13, 1678, 14391, 353, 1904, 29898, 1068, 2080, 29879, 29892, 1962, 29918, 1131, 296, 1080, 29922, 5574, 29892, 736, 29918, 8977, 29922, 8824, 29897, 13, 13, 1678, 2740, 261, 353, 12545, 7974, 261, 29898, 6979, 3950, 29892, 10970, 29889, 2080, 29918, 4841, 29892, 14391, 14352, 29896, 2314, 13, 13, 1678, 2114, 353, 2740, 261, 29889, 4478, 580, 13, 13, 1678, 1596, 703, 9692, 2114, 29901, 9162, 13, 3986, 376, 1599, 11393, 7122, 29898, 1958, 29898, 2892, 2944, 29901, 851, 29898, 667, 29961, 29900, 2314, 718, 376, 703, 29974, 710, 29898, 667, 29961, 29896, 2314, 29974, 1159, 613, 1051, 29898, 17028, 876, 511, 6634, 29876, 1159, 13, 13, 13, 1454, 269, 297, 25260, 29901, 13, 1678, 1889, 29918, 18616, 663, 29898, 29879, 29897, 13, 2 ]
dassh/correlations/flowsplit_ctd.py
khurrumsaleem/dassh
11
25771
######################################################################## # Copyright 2021, UChicago Argonne, LLC # # Licensed under the BSD-3 License (the "License"); you may not use # this file except in compliance with the License. You may obtain a # copy of the License at # # https://opensource.org/licenses/BSD-3-Clause # # 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. ######################################################################## """ date: 2021-08-12 author: matz Cheng-Todreas correlation for flow split (1986) """ ######################################################################## import numpy as np from . import friction_ctd as ctd applicability = ctd.applicability ######################################################################## # MODULE-WIDE CONSTANTS _GAMMA = 1 / 3.0 _M = ctd._m _EXP1 = {} _EXP2 = {} for regime in ctd._m.keys(): _EXP1[regime] = (1 + ctd._m[regime]) / (2 - ctd._m[regime]) _EXP2[regime] = 1 / (2 - ctd._m[regime]) ######################################################################## def calculate_flow_split(asm_obj, regime=None, beta=1.0): """Calculate the flow split into the different types of subchannels based on the Cheng-Todreas model Parameters ---------- asm_obj : DASSH Assembly object Contains the geometric description of the assembly regime : str or NoneType Indicate flow regime for which to calculate flow split {'turbulent', 'laminar', None}; default = None beta : float Beta is a factor used to combine the laminar and turbulent flowpslit terms in the transition region. It comes from Cheng's 1984 thesis in which he recommends a value of 0.05. There, Figure 4.19 shows the edge flowsplit assuming beta=0.05. However, in reality beta=0.05 gives weird results and beta=1.0 matches what's shown in the figure. Therefore, it'set to 1.0 here by default. Returns ------- numpy.ndarray Flow split between interior, edge, and corner coolant subchannels """ try: Re_bnds = asm_obj.corr_constants['fs']['Re_bnds'] except (KeyError, AttributeError): Re_bnds = ctd.calculate_Re_bounds(asm_obj) try: Cf = asm_obj.corr_constants['fs']['Cf_sc'] except (KeyError, AttributeError): Cf = ctd.calculate_subchannel_friction_factor_const(asm_obj) if regime is not None: return _calculate_flow_split(asm_obj, Cf, regime, Re_bnds, beta=beta) elif asm_obj.coolant_int_params['Re'] <= Re_bnds[0]: return _calculate_flow_split(asm_obj, Cf, 'laminar') elif asm_obj.coolant_int_params['Re'] >= Re_bnds[1]: return _calculate_flow_split(asm_obj, Cf, 'turbulent') else: return _calculate_flow_split(asm_obj, Cf, 'transition', Re_bnds, beta) def _calculate_flow_split(asm_obj, Cf_dict, regime, Re_bnds=None, beta=1.0): """Worker function to calculate the flow split into the different types of subchannels based on the Cheng-Todreas model. Parameters ---------- asm_obj : DASSH Assembly object Contains the geometric description of the assembly Cf_dict : dict Dictionary containing subchannel friction factor constants; keys: ['laminar', 'turbulent'] regime : str {'laminar', 'turbulent', 'transition'} Flow regime with which to evaluate flow split ratios Re_bnds : list (optional) Reynolds number flow regime boundaries for calculating intermittency factor in transition regime beta : float Beta is a factor used to combine the laminar and turbulent flowpslit terms in the transition region. It comes from Cheng's 1984 thesis in which he recommends a value of 0.05. There, Figure 4.19 shows the edge flowsplit assuming beta=0.05. However, in reality beta=0.05 gives weird results and beta=1.0 matches what's shown in the figure. Therefore, it'set to 1.0 here by default. Returns ------- numpy.ndarray Flow split between interior, edge, and corner coolant subchannels Notes ----- This method is imported by the flow split model in the Upgraded Cheng-Todreas correlation (flowsplit_uctd) """ if regime == 'transition': try: na = asm_obj.corr_constants['fs']['na'] except (KeyError, AttributeError): na = [asm_obj.subchannel.n_sc['coolant']['interior'] * asm_obj.params['area'][0], asm_obj.subchannel.n_sc['coolant']['edge'] * asm_obj.params['area'][1], asm_obj.subchannel.n_sc['coolant']['corner'] * asm_obj.params['area'][2]] flow_split = np.zeros(3) intf_b = ctd.calc_intermittency_factor( asm_obj, Re_bnds[0], Re_bnds[1]) xratio_t = asm_obj.corr_constants['fs']['xr']['transition'].copy() xratio_t[0] = (xratio_t[0] * (1 - intf_b)**_GAMMA / asm_obj.coolant_int_params['Re']) xratio_t[1] = (xratio_t[1] * intf_b**_GAMMA / asm_obj.coolant_int_params['Re']**_M['turbulent'] )**_EXP2['turbulent'] # xratio = xratio_t1 + beta * xratio_t2 xratio = xratio_t[0] + beta * xratio_t[1] x1x2 = xratio[1] / xratio[0] # Equation 4.51 in Cheng 1984 x3x2 = xratio[1] / xratio[2] # Equation 4.51 in Cheng 1984 flow_split[1] = (asm_obj.bundle_params['area'] / (na[1] + x1x2 * na[0] + x3x2 * na[2])) flow_split[0] = x1x2 * flow_split[1] flow_split[2] = x3x2 * flow_split[1] else: flow_split = asm_obj.corr_constants['fs']['fs'][regime] # x1x2 = asm_obj.corr_constants['fs']['xr'][regime][0] # x3x2 = asm_obj.corr_constants['fs']['xr'][regime][1] # # # Flow split to subchannel type 2 # flow_split[1] = (asm_obj.bundle_params['area'] # / (na[1] + x1x2 * na[0] + x3x2 * na[2])) # flow_split[0] = x1x2 * flow_split[1] # flow_split[2] = x3x2 * flow_split[1] return flow_split def calc_constants(asm_obj): """Calculate constants needed by the CTD flowsplit calculation""" const = ctd.calc_constants(asm_obj) del const['Cf_b'] # Total subchannel area for each subchannel type const['na'] = [asm_obj.subchannel.n_sc['coolant']['interior'] * asm_obj.params['area'][0], asm_obj.subchannel.n_sc['coolant']['edge'] * asm_obj.params['area'][1], asm_obj.subchannel.n_sc['coolant']['corner'] * asm_obj.params['area'][2]] # REGIME RATIO CONSTANTS const['xr'] = _calc_regime_ratio_constants(asm_obj, const['Cf_sc']) # # Transition regime # const['xr'] = {} # const['xr']['transition'] = np.array([ # (const['Cf_sc']['laminar'] # * asm_obj.bundle_params['de'] # / asm_obj.params['de']**2), # (const['Cf_sc']['turbulent'] # * asm_obj.bundle_params['de']**_M['turbulent'] # / asm_obj.params['de']**(_M['turbulent'] + 1)) # ]) # # # Laminar/turbulent regime # for k in ['laminar', 'turbulent']: # const['xr'][k] = np.array([ # ((asm_obj.params['de'][0] / asm_obj.params['de'][1])**_EXP1[k] # * (const['Cf_sc'][k][1] / const['Cf_sc'][k][0])**_EXP2[k]), # ((asm_obj.params['de'][2] / asm_obj.params['de'][1])**_EXP1[k] # * (const['Cf_sc'][k][1] / const['Cf_sc'][k][2])**_EXP2[k]) # ]) # Laminar/turbulent: constant flow split! const['fs'] = _calc_constant_flowsplits(asm_obj, const) # const['fs'] = {} # for k in ['laminar', 'turbulent']: # const['fs'][k] = np.zeros(3) # const['fs'][k][1] = (asm_obj.bundle_params['area'] # / (const['na'][1] # + const['xr'][k][0] * const['na'][0] # + const['xr'][k][1] * const['na'][2])) # const['fs'][k][0] = const['xr'][k][0] * const['fs'][k][1] # const['fs'][k][2] = const['xr'][k][1] * const['fs'][k][1] return const def _calc_regime_ratio_constants(asm_obj, Cf_sc): """Constant ratios for laminar, turbulent, and transition regimes""" xr = {} xr['transition'] = np.array([ (Cf_sc['laminar'] * asm_obj.bundle_params['de'] / asm_obj.params['de']**2), (Cf_sc['turbulent'] * asm_obj.bundle_params['de']**_M['turbulent'] / asm_obj.params['de']**(_M['turbulent'] + 1)) ]) # Laminar/turbulent regime for k in ['laminar', 'turbulent']: xr[k] = np.array([ ((asm_obj.params['de'][0] / asm_obj.params['de'][1])**_EXP1[k] * (Cf_sc[k][1] / Cf_sc[k][0])**_EXP2[k]), ((asm_obj.params['de'][2] / asm_obj.params['de'][1])**_EXP1[k] * (Cf_sc[k][1] / Cf_sc[k][2])**_EXP2[k]) ]) return xr def _calc_constant_flowsplits(asm_obj, const): """Laminar and turbulent flowsplits are constant""" fs = {} for k in ['laminar', 'turbulent']: fs[k] = np.zeros(3) fs[k][1] = (asm_obj.bundle_params['area'] / (const['na'][1] + const['xr'][k][0] * const['na'][0] + const['xr'][k][1] * const['na'][2])) fs[k][0] = const['xr'][k][0] * fs[k][1] fs[k][2] = const['xr'][k][1] * fs[k][1] return fs
[ 1, 835, 13383, 13383, 13383, 13383, 4136, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29906, 29896, 29892, 501, 1451, 9384, 11842, 7293, 29892, 365, 12182, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 350, 7230, 29899, 29941, 19245, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 13, 29937, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 263, 13, 29937, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 2045, 597, 22156, 1167, 29889, 990, 29914, 506, 11259, 29914, 29933, 7230, 29899, 29941, 29899, 20216, 1509, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 13, 29937, 2411, 2957, 29889, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 13, 29937, 11239, 322, 27028, 1090, 278, 19245, 29889, 13, 13383, 13383, 13383, 13383, 7346, 13, 15945, 29908, 13, 1256, 29901, 29871, 29906, 29900, 29906, 29896, 29899, 29900, 29947, 29899, 29896, 29906, 13, 8921, 29901, 1775, 29920, 13, 1451, 996, 29899, 29911, 397, 12588, 19869, 363, 4972, 6219, 313, 29896, 29929, 29947, 29953, 29897, 13, 15945, 29908, 13, 13383, 13383, 13383, 13383, 7346, 13, 5215, 12655, 408, 7442, 13, 3166, 869, 1053, 1424, 2463, 29918, 312, 29881, 408, 274, 1594, 13, 13, 13, 932, 506, 3097, 353, 274, 1594, 29889, 932, 506, 3097, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 29937, 341, 13668, 29965, 1307, 29899, 19292, 29923, 8707, 1254, 2190, 9375, 13, 29918, 29954, 5194, 1529, 353, 29871, 29896, 847, 29871, 29941, 29889, 29900, 13, 29918, 29924, 353, 274, 1594, 3032, 29885, 13, 29918, 5746, 29925, 29896, 353, 6571, 13, 29918, 5746, 29925, 29906, 353, 6571, 13, 1454, 22384, 297, 274, 1594, 3032, 29885, 29889, 8149, 7295, 13, 1678, 903, 5746, 29925, 29896, 29961, 1727, 603, 29962, 353, 313, 29896, 718, 274, 1594, 3032, 29885, 29961, 1727, 603, 2314, 847, 313, 29906, 448, 274, 1594, 3032, 29885, 29961, 1727, 603, 2314, 13, 1678, 903, 5746, 29925, 29906, 29961, 1727, 603, 29962, 353, 29871, 29896, 847, 313, 29906, 448, 274, 1594, 3032, 29885, 29961, 1727, 603, 2314, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 13, 13, 13, 1753, 8147, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 22384, 29922, 8516, 29892, 21762, 29922, 29896, 29889, 29900, 1125, 13, 1678, 9995, 27065, 403, 278, 4972, 6219, 964, 278, 1422, 4072, 310, 13, 1678, 1014, 305, 12629, 2729, 373, 278, 678, 996, 29899, 29911, 397, 12588, 1904, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 408, 29885, 29918, 5415, 584, 21330, 1799, 29950, 13266, 1203, 13, 4706, 2866, 2708, 278, 26224, 6139, 310, 278, 11470, 13, 1678, 22384, 584, 851, 470, 6213, 1542, 13, 4706, 1894, 9593, 4972, 22384, 363, 607, 304, 8147, 4972, 6219, 13, 4706, 11117, 29873, 332, 8645, 296, 742, 525, 5288, 18220, 742, 6213, 3400, 2322, 353, 6213, 13, 1678, 21762, 584, 5785, 13, 4706, 350, 1187, 338, 263, 7329, 1304, 304, 14405, 278, 301, 9103, 279, 322, 7013, 8645, 296, 13, 4706, 4972, 567, 19411, 4958, 297, 278, 9558, 5120, 29889, 739, 5304, 515, 13, 4706, 678, 996, 29915, 29879, 29871, 29896, 29929, 29947, 29946, 266, 6656, 297, 607, 540, 5052, 1975, 263, 995, 310, 13, 308, 29900, 29889, 29900, 29945, 29889, 1670, 29892, 11479, 29871, 29946, 29889, 29896, 29929, 3697, 278, 7636, 4972, 5451, 10241, 13, 4706, 21762, 29922, 29900, 29889, 29900, 29945, 29889, 2398, 29892, 297, 16832, 21762, 29922, 29900, 29889, 29900, 29945, 4076, 13543, 2582, 13, 4706, 322, 21762, 29922, 29896, 29889, 29900, 7087, 825, 29915, 29879, 4318, 297, 278, 4377, 29889, 7857, 29892, 13, 4706, 372, 29915, 842, 304, 29871, 29896, 29889, 29900, 1244, 491, 2322, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 12655, 29889, 299, 2378, 13, 4706, 22787, 6219, 1546, 13290, 29892, 7636, 29892, 322, 11155, 12528, 424, 13, 4706, 1014, 305, 12629, 13, 1678, 9995, 13, 1678, 1018, 29901, 13, 4706, 830, 29918, 29890, 299, 29879, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 1123, 29918, 29890, 299, 29879, 2033, 13, 1678, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 4706, 830, 29918, 29890, 299, 29879, 353, 274, 1594, 29889, 15807, 403, 29918, 1123, 29918, 23687, 29898, 11625, 29918, 5415, 29897, 13, 13, 1678, 1018, 29901, 13, 4706, 315, 29888, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 29907, 29888, 29918, 1557, 2033, 13, 1678, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 4706, 315, 29888, 353, 274, 1594, 29889, 15807, 403, 29918, 1491, 12719, 29918, 1341, 2463, 29918, 19790, 29918, 3075, 29898, 11625, 29918, 5415, 29897, 13, 13, 1678, 565, 22384, 338, 451, 6213, 29901, 13, 4706, 736, 903, 15807, 403, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29892, 22384, 29892, 830, 29918, 29890, 299, 29879, 29892, 21762, 29922, 3571, 29897, 13, 1678, 25342, 408, 29885, 29918, 5415, 29889, 1111, 324, 424, 29918, 524, 29918, 7529, 1839, 1123, 2033, 5277, 830, 29918, 29890, 299, 29879, 29961, 29900, 5387, 13, 4706, 736, 903, 15807, 403, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29892, 525, 5288, 18220, 1495, 13, 1678, 25342, 408, 29885, 29918, 5415, 29889, 1111, 324, 424, 29918, 524, 29918, 7529, 1839, 1123, 2033, 6736, 830, 29918, 29890, 299, 29879, 29961, 29896, 5387, 13, 4706, 736, 903, 15807, 403, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29892, 525, 29873, 332, 8645, 296, 1495, 13, 1678, 1683, 29901, 13, 4706, 736, 903, 15807, 403, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29892, 525, 20543, 742, 830, 29918, 29890, 299, 29879, 29892, 21762, 29897, 13, 13, 13, 1753, 903, 15807, 403, 29918, 1731, 29918, 5451, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29918, 8977, 29892, 22384, 29892, 830, 29918, 29890, 299, 29879, 29922, 8516, 29892, 21762, 29922, 29896, 29889, 29900, 1125, 13, 1678, 9995, 16164, 740, 304, 8147, 278, 4972, 6219, 964, 278, 13, 1678, 1422, 4072, 310, 1014, 305, 12629, 2729, 373, 278, 678, 996, 29899, 29911, 397, 12588, 13, 1678, 1904, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 408, 29885, 29918, 5415, 584, 21330, 1799, 29950, 13266, 1203, 13, 4706, 2866, 2708, 278, 26224, 6139, 310, 278, 11470, 13, 1678, 315, 29888, 29918, 8977, 584, 9657, 13, 4706, 13343, 6943, 1014, 12719, 1424, 2463, 7329, 17727, 29936, 13, 4706, 6611, 29901, 6024, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 2033, 13, 1678, 22384, 584, 851, 11117, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 742, 525, 20543, 10827, 13, 4706, 22787, 22384, 411, 607, 304, 14707, 4972, 6219, 364, 2219, 359, 13, 1678, 830, 29918, 29890, 299, 29879, 584, 1051, 313, 25253, 29897, 13, 4706, 28555, 3361, 1353, 4972, 22384, 24371, 363, 25202, 13, 4706, 1006, 2415, 841, 1270, 7329, 297, 9558, 22384, 13, 1678, 21762, 584, 5785, 13, 4706, 350, 1187, 338, 263, 7329, 1304, 304, 14405, 278, 301, 9103, 279, 322, 7013, 8645, 296, 13, 4706, 4972, 567, 19411, 4958, 297, 278, 9558, 5120, 29889, 739, 5304, 515, 13, 4706, 678, 996, 29915, 29879, 29871, 29896, 29929, 29947, 29946, 266, 6656, 297, 607, 540, 5052, 1975, 263, 995, 310, 13, 308, 29900, 29889, 29900, 29945, 29889, 1670, 29892, 11479, 29871, 29946, 29889, 29896, 29929, 3697, 278, 7636, 4972, 5451, 10241, 13, 4706, 21762, 29922, 29900, 29889, 29900, 29945, 29889, 2398, 29892, 297, 16832, 21762, 29922, 29900, 29889, 29900, 29945, 4076, 13543, 2582, 13, 4706, 322, 21762, 29922, 29896, 29889, 29900, 7087, 825, 29915, 29879, 4318, 297, 278, 4377, 29889, 7857, 29892, 13, 4706, 372, 29915, 842, 304, 29871, 29896, 29889, 29900, 1244, 491, 2322, 29889, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 12655, 29889, 299, 2378, 13, 4706, 22787, 6219, 1546, 13290, 29892, 7636, 29892, 322, 11155, 12528, 424, 13, 4706, 1014, 305, 12629, 13, 13, 1678, 8695, 13, 1678, 448, 807, 13, 1678, 910, 1158, 338, 19673, 491, 278, 4972, 6219, 1904, 297, 278, 13, 1678, 5020, 5105, 287, 678, 996, 29899, 29911, 397, 12588, 19869, 313, 1731, 5451, 29918, 5313, 29881, 29897, 13, 13, 1678, 9995, 13, 13, 1678, 565, 22384, 1275, 525, 20543, 2396, 13, 4706, 1018, 29901, 13, 9651, 1055, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 1056, 2033, 13, 4706, 5174, 313, 2558, 2392, 29892, 23833, 2392, 1125, 13, 9651, 1055, 353, 518, 11625, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 1639, 1611, 2033, 13, 462, 29871, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29900, 1402, 13, 462, 29871, 408, 29885, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 12864, 2033, 13, 462, 29871, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29896, 1402, 13, 462, 29871, 408, 29885, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 2616, 1089, 2033, 13, 462, 29871, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29906, 5262, 13, 4706, 4972, 29918, 5451, 353, 7442, 29889, 3298, 359, 29898, 29941, 29897, 13, 4706, 938, 29888, 29918, 29890, 353, 274, 1594, 29889, 28667, 29918, 1639, 2415, 841, 1270, 29918, 19790, 29898, 13, 9651, 408, 29885, 29918, 5415, 29892, 830, 29918, 29890, 299, 29879, 29961, 29900, 1402, 830, 29918, 29890, 299, 29879, 29961, 29896, 2314, 13, 4706, 921, 3605, 601, 29918, 29873, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 29916, 29878, 16215, 20543, 13359, 8552, 580, 13, 4706, 921, 3605, 601, 29918, 29873, 29961, 29900, 29962, 353, 313, 29916, 3605, 601, 29918, 29873, 29961, 29900, 29962, 13, 462, 539, 334, 313, 29896, 448, 938, 29888, 29918, 29890, 29897, 1068, 29918, 29954, 5194, 1529, 13, 462, 539, 847, 408, 29885, 29918, 5415, 29889, 1111, 324, 424, 29918, 524, 29918, 7529, 1839, 1123, 11287, 13, 4706, 921, 3605, 601, 29918, 29873, 29961, 29896, 29962, 353, 313, 29916, 3605, 601, 29918, 29873, 29961, 29896, 29962, 13, 462, 539, 334, 938, 29888, 29918, 29890, 1068, 29918, 29954, 5194, 1529, 13, 462, 539, 847, 408, 29885, 29918, 5415, 29889, 1111, 324, 424, 29918, 524, 29918, 7529, 1839, 1123, 2033, 1068, 29918, 29924, 1839, 29873, 332, 8645, 296, 2033, 13, 462, 539, 1723, 1068, 29918, 5746, 29925, 29906, 1839, 29873, 332, 8645, 296, 2033, 13, 4706, 396, 921, 3605, 601, 353, 921, 3605, 601, 29918, 29873, 29896, 718, 21762, 334, 921, 3605, 601, 29918, 29873, 29906, 13, 4706, 921, 3605, 601, 353, 921, 3605, 601, 29918, 29873, 29961, 29900, 29962, 718, 21762, 334, 921, 3605, 601, 29918, 29873, 29961, 29896, 29962, 13, 4706, 921, 29896, 29916, 29906, 353, 921, 3605, 601, 29961, 29896, 29962, 847, 921, 3605, 601, 29961, 29900, 29962, 29871, 396, 11243, 362, 29871, 29946, 29889, 29945, 29896, 297, 678, 996, 29871, 29896, 29929, 29947, 29946, 13, 4706, 921, 29941, 29916, 29906, 353, 921, 3605, 601, 29961, 29896, 29962, 847, 921, 3605, 601, 29961, 29906, 29962, 29871, 396, 11243, 362, 29871, 29946, 29889, 29945, 29896, 297, 678, 996, 29871, 29896, 29929, 29947, 29946, 13, 4706, 4972, 29918, 5451, 29961, 29896, 29962, 353, 313, 11625, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 6203, 2033, 13, 462, 308, 847, 313, 1056, 29961, 29896, 29962, 718, 921, 29896, 29916, 29906, 334, 1055, 29961, 29900, 29962, 718, 921, 29941, 29916, 29906, 334, 1055, 29961, 29906, 12622, 13, 4706, 4972, 29918, 5451, 29961, 29900, 29962, 353, 921, 29896, 29916, 29906, 334, 4972, 29918, 5451, 29961, 29896, 29962, 13, 4706, 4972, 29918, 5451, 29961, 29906, 29962, 353, 921, 29941, 29916, 29906, 334, 4972, 29918, 5451, 29961, 29896, 29962, 13, 1678, 1683, 29901, 13, 4706, 4972, 29918, 5451, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 5847, 2033, 29961, 1727, 603, 29962, 13, 1678, 396, 268, 921, 29896, 29916, 29906, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 29916, 29878, 2033, 29961, 1727, 603, 3816, 29900, 29962, 13, 1678, 396, 268, 921, 29941, 29916, 29906, 353, 408, 29885, 29918, 5415, 29889, 29725, 29918, 3075, 1934, 1839, 5847, 16215, 29916, 29878, 2033, 29961, 1727, 603, 3816, 29896, 29962, 13, 1678, 396, 13, 1678, 396, 396, 22787, 6219, 304, 1014, 12719, 1134, 29871, 29906, 13, 1678, 396, 4972, 29918, 5451, 29961, 29896, 29962, 353, 313, 11625, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 6203, 2033, 13, 1678, 396, 462, 29871, 847, 313, 1056, 29961, 29896, 29962, 718, 921, 29896, 29916, 29906, 334, 1055, 29961, 29900, 29962, 718, 921, 29941, 29916, 29906, 334, 1055, 29961, 29906, 12622, 13, 1678, 396, 4972, 29918, 5451, 29961, 29900, 29962, 353, 921, 29896, 29916, 29906, 334, 4972, 29918, 5451, 29961, 29896, 29962, 13, 1678, 396, 4972, 29918, 5451, 29961, 29906, 29962, 353, 921, 29941, 29916, 29906, 334, 4972, 29918, 5451, 29961, 29896, 29962, 13, 1678, 736, 4972, 29918, 5451, 13, 13, 13, 1753, 22235, 29918, 3075, 1934, 29898, 11625, 29918, 5415, 1125, 13, 1678, 9995, 27065, 403, 17727, 4312, 491, 278, 315, 24495, 4972, 5451, 13944, 15945, 29908, 13, 1678, 1040, 353, 274, 1594, 29889, 28667, 29918, 3075, 1934, 29898, 11625, 29918, 5415, 29897, 13, 1678, 628, 1040, 1839, 29907, 29888, 29918, 29890, 2033, 13, 13, 1678, 396, 14990, 1014, 12719, 4038, 363, 1269, 1014, 12719, 1134, 13, 1678, 1040, 1839, 1056, 2033, 353, 518, 11625, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 1639, 1611, 2033, 13, 462, 259, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29900, 1402, 13, 462, 259, 408, 29885, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 12864, 2033, 13, 462, 259, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29896, 1402, 13, 462, 259, 408, 29885, 29918, 5415, 29889, 1491, 12719, 29889, 29876, 29918, 1557, 1839, 1111, 324, 424, 16215, 2616, 1089, 2033, 13, 462, 259, 334, 408, 29885, 29918, 5415, 29889, 7529, 1839, 6203, 2033, 29961, 29906, 5262, 13, 13, 1678, 396, 5195, 29954, 8890, 390, 1299, 5971, 8707, 1254, 2190, 9375, 13, 1678, 1040, 1839, 29916, 29878, 2033, 353, 903, 28667, 29918, 1727, 603, 29918, 3605, 601, 29918, 3075, 1934, 29898, 11625, 29918, 5415, 29892, 1040, 1839, 29907, 29888, 29918, 1557, 11287, 13, 13, 1678, 396, 396, 4103, 654, 22384, 13, 1678, 396, 1040, 1839, 29916, 29878, 2033, 353, 6571, 13, 1678, 396, 1040, 1839, 29916, 29878, 16215, 20543, 2033, 353, 7442, 29889, 2378, 4197, 13, 1678, 396, 268, 313, 3075, 1839, 29907, 29888, 29918, 1557, 16215, 5288, 18220, 2033, 13, 1678, 396, 418, 334, 408, 29885, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 311, 2033, 13, 1678, 396, 418, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 1068, 29906, 511, 13, 1678, 396, 268, 313, 3075, 1839, 29907, 29888, 29918, 1557, 16215, 29873, 332, 8645, 296, 2033, 13, 1678, 396, 418, 334, 408, 29885, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 311, 2033, 1068, 29918, 29924, 1839, 29873, 332, 8645, 296, 2033, 13, 1678, 396, 418, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 1068, 7373, 29924, 1839, 29873, 332, 8645, 296, 2033, 718, 29871, 29896, 876, 13, 1678, 396, 29871, 2314, 13, 1678, 396, 13, 1678, 396, 396, 365, 9103, 279, 29914, 29873, 332, 8645, 296, 22384, 13, 1678, 396, 363, 413, 297, 6024, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 2033, 29901, 13, 1678, 396, 268, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 29962, 353, 7442, 29889, 2378, 4197, 13, 1678, 396, 308, 5135, 11625, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29900, 29962, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29896, 2314, 1068, 29918, 5746, 29925, 29896, 29961, 29895, 29962, 13, 1678, 396, 3986, 334, 313, 3075, 1839, 29907, 29888, 29918, 1557, 2033, 29961, 29895, 3816, 29896, 29962, 847, 1040, 1839, 29907, 29888, 29918, 1557, 2033, 29961, 29895, 3816, 29900, 2314, 1068, 29918, 5746, 29925, 29906, 29961, 29895, 11724, 13, 1678, 396, 308, 5135, 11625, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29906, 29962, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29896, 2314, 1068, 29918, 5746, 29925, 29896, 29961, 29895, 29962, 13, 1678, 396, 3986, 334, 313, 3075, 1839, 29907, 29888, 29918, 1557, 2033, 29961, 29895, 3816, 29896, 29962, 847, 1040, 1839, 29907, 29888, 29918, 1557, 2033, 29961, 29895, 3816, 29906, 2314, 1068, 29918, 5746, 29925, 29906, 29961, 29895, 2314, 13, 1678, 396, 418, 2314, 13, 13, 1678, 396, 365, 9103, 279, 29914, 29873, 332, 8645, 296, 29901, 4868, 4972, 6219, 29991, 13, 1678, 1040, 1839, 5847, 2033, 353, 903, 28667, 29918, 23362, 29918, 1731, 23579, 1169, 29898, 11625, 29918, 5415, 29892, 1040, 29897, 13, 1678, 396, 1040, 1839, 5847, 2033, 353, 6571, 13, 1678, 396, 363, 413, 297, 6024, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 2033, 29901, 13, 1678, 396, 268, 1040, 1839, 5847, 2033, 29961, 29895, 29962, 353, 7442, 29889, 3298, 359, 29898, 29941, 29897, 13, 1678, 396, 268, 1040, 1839, 5847, 2033, 29961, 29895, 3816, 29896, 29962, 353, 313, 11625, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 6203, 2033, 13, 1678, 396, 462, 3986, 847, 313, 3075, 1839, 1056, 2033, 29961, 29896, 29962, 13, 1678, 396, 462, 632, 718, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29900, 29962, 334, 1040, 1839, 1056, 2033, 29961, 29900, 29962, 13, 1678, 396, 462, 632, 718, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29896, 29962, 334, 1040, 1839, 1056, 2033, 29961, 29906, 12622, 13, 1678, 396, 268, 1040, 1839, 5847, 2033, 29961, 29895, 3816, 29900, 29962, 353, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29900, 29962, 334, 1040, 1839, 5847, 2033, 29961, 29895, 3816, 29896, 29962, 13, 1678, 396, 268, 1040, 1839, 5847, 2033, 29961, 29895, 3816, 29906, 29962, 353, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29896, 29962, 334, 1040, 1839, 5847, 2033, 29961, 29895, 3816, 29896, 29962, 13, 1678, 736, 1040, 13, 13, 13, 1753, 903, 28667, 29918, 1727, 603, 29918, 3605, 601, 29918, 3075, 1934, 29898, 11625, 29918, 5415, 29892, 315, 29888, 29918, 1557, 1125, 13, 1678, 9995, 12075, 424, 364, 2219, 359, 363, 301, 9103, 279, 29892, 7013, 8645, 296, 29892, 322, 9558, 1072, 1355, 15945, 29908, 13, 1678, 921, 29878, 353, 6571, 13, 1678, 921, 29878, 1839, 20543, 2033, 353, 7442, 29889, 2378, 4197, 13, 4706, 313, 29907, 29888, 29918, 1557, 1839, 5288, 18220, 2033, 13, 308, 334, 408, 29885, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 311, 2033, 13, 308, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 1068, 29906, 511, 13, 4706, 313, 29907, 29888, 29918, 1557, 1839, 29873, 332, 8645, 296, 2033, 13, 308, 334, 408, 29885, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 311, 2033, 1068, 29918, 29924, 1839, 29873, 332, 8645, 296, 2033, 13, 308, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 1068, 7373, 29924, 1839, 29873, 332, 8645, 296, 2033, 718, 29871, 29896, 876, 13, 268, 2314, 13, 1678, 396, 365, 9103, 279, 29914, 29873, 332, 8645, 296, 22384, 13, 1678, 363, 413, 297, 6024, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 2033, 29901, 13, 4706, 921, 29878, 29961, 29895, 29962, 353, 7442, 29889, 2378, 4197, 13, 9651, 5135, 11625, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29900, 29962, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29896, 2314, 1068, 29918, 5746, 29925, 29896, 29961, 29895, 29962, 13, 632, 334, 313, 29907, 29888, 29918, 1557, 29961, 29895, 3816, 29896, 29962, 847, 315, 29888, 29918, 1557, 29961, 29895, 3816, 29900, 2314, 1068, 29918, 5746, 29925, 29906, 29961, 29895, 11724, 13, 9651, 5135, 11625, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29906, 29962, 847, 408, 29885, 29918, 5415, 29889, 7529, 1839, 311, 2033, 29961, 29896, 2314, 1068, 29918, 5746, 29925, 29896, 29961, 29895, 29962, 13, 632, 334, 313, 29907, 29888, 29918, 1557, 29961, 29895, 3816, 29896, 29962, 847, 315, 29888, 29918, 1557, 29961, 29895, 3816, 29906, 2314, 1068, 29918, 5746, 29925, 29906, 29961, 29895, 2314, 13, 308, 2314, 13, 1678, 736, 921, 29878, 13, 13, 13, 1753, 903, 28667, 29918, 23362, 29918, 1731, 23579, 1169, 29898, 11625, 29918, 5415, 29892, 1040, 1125, 13, 1678, 9995, 29931, 9103, 279, 322, 7013, 8645, 296, 4972, 23579, 1169, 526, 4868, 15945, 29908, 13, 1678, 18920, 353, 6571, 13, 1678, 363, 413, 297, 6024, 5288, 18220, 742, 525, 29873, 332, 8645, 296, 2033, 29901, 13, 4706, 18920, 29961, 29895, 29962, 353, 7442, 29889, 3298, 359, 29898, 29941, 29897, 13, 4706, 18920, 29961, 29895, 3816, 29896, 29962, 353, 313, 11625, 29918, 5415, 29889, 16718, 29918, 7529, 1839, 6203, 2033, 13, 462, 1678, 847, 313, 3075, 1839, 1056, 2033, 29961, 29896, 29962, 13, 462, 539, 718, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29900, 29962, 334, 1040, 1839, 1056, 2033, 29961, 29900, 29962, 13, 462, 539, 718, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29896, 29962, 334, 1040, 1839, 1056, 2033, 29961, 29906, 12622, 13, 4706, 18920, 29961, 29895, 3816, 29900, 29962, 353, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29900, 29962, 334, 18920, 29961, 29895, 3816, 29896, 29962, 13, 4706, 18920, 29961, 29895, 3816, 29906, 29962, 353, 1040, 1839, 29916, 29878, 2033, 29961, 29895, 3816, 29896, 29962, 334, 18920, 29961, 29895, 3816, 29896, 29962, 13, 1678, 736, 18920, 13, 2 ]
scripts/geo/geo_process_LCDB.py
mdmeadows/DSM-to-DTM
36
189742
<gh_stars>10-100 # Process: Manaaki Whenua Land Cover Database (LCDB v5.0) # Import required packages import sys, subprocess import numpy as np import pandas as pd import matplotlib.pyplot as plt # Import helper functions relevant to this script sys.path.append('E:/mdm123/D/scripts/geo/') from geo_helpers import extract_projection_info # List paths to GDAL scripts ogr2ogr = 'C:/Anaconda3/envs/geo/Library/bin/ogr2ogr.exe' gdal_warp = 'C:/Anaconda3/envs/geo/Library/bin/gdalwarp.exe' gdal_rasterise = 'C:/Anaconda3/envs/geo/Library/bin/gdal_rasterize.exe' # Define paths to SRTM & LCDB folders folder_srtm = 'E:/mdm123/D/data/DSM/SRTM/' folder_lcdb = 'E:/mdm123/D/data/LRIS/lris-lcdb-v50' folder_inputs = 'E:/mdm123/D/ML/inputs/1D' folder_fig = 'E:/mdm123/D/figures' # Define list of zones to be processed (separate LiDAR coverage areas) zones = ['MRL18_WPE', 'MRL18_WVL', 'MRL18_WKW', 'MRL18_FGA', 'TSM17_STA', 'TSM17_LDM', 'TSM17_GLB', 'TSM16_ATG'] # Define dictionary to hold information relating to each zone covered by the Marlborough (2018) survey dtm_dict = {'MRL18_WPE':{'label':'Wairau Plains East (Marlborough 2018)', 'year':'2018'}, 'MRL18_WVL':{'label':'Wairau Valley (Marlborough 2018)', 'year':'2018'}, 'MRL18_WKW':{'label':'Picton - Waikawa (Marlborough 2018)', 'year':'2018'}, 'MRL18_FGA':{'label':'Flaxbourne, Grassmere & Lower Awatere (Marlborough 2018)', 'year':'2018'}, 'TSM17_STA':{'label':'St Arnaud (Tasman 2017)', 'year':'2017'}, 'TSM17_LDM':{'label':'Lee Dam (Tasman 2017)', 'year':'2017'}, 'TSM17_GLB':{'label':'Golden Bay & Farewell Spit (Tasman 2017)', 'year':'2017'}, 'TSM16_ATG':{'label':'Abel Tasman & Golden Bay (Tasman 2016)', 'year':'2016'}} # Define the number of cells of padding to add along each raster boundary pad = 44 ############################################################################### # 1. Reproject LCDB SHP (from NZTM2000 to WGS84) # ############################################################################### # Reproject the Manaaki Whenua land cover SHP from NZTM2000 to WGS84 (EPSG:4326) LCDB_shp_NZTM2000 = '{}/raw/lcdb-v50-land-cover-database-version-50-mainland-new-zealand.shp'.format(folder_lcdb) LCDB_shp_WGS84 = '{}/proc/LCDB_v50_WGS84.shp'.format(folder_lcdb) WGS84 = 'EPSG:4326' reproject_command = [ogr2ogr, LCDB_shp_WGS84, LCDB_shp_NZTM2000, '-t_srs', WGS84, '-overwrite'] reproject_result = subprocess.run(reproject_command, stdout=subprocess.PIPE) if reproject_result.returncode != 0: print(reproject_result.stdout) ############################################################################### # 2. ArcMap codeblocks for reclassification of sub-classes to main groupings # ############################################################################### # Used for Python codeblock of field calculation in ArcMap (based on LCDB v4+ definitions of CLASS & NAME) def classify_group(c): # Artificial surfaces if c in [1, 2, 5, 6]: return 'Artificial Surfaces' # Bare or Lightly-vegetated Surfaces elif c in [10, 12, 14, 15, 16]: return 'Bare or Lightly-vegetated Surfaces' # Water Bodies elif c in [20, 21, 22]: return 'Water Bodies' # Cropland elif c in [30, 33]: return 'Cropland' # Grassland, Sedgeland and Marshland elif c in [40, 41, 43, 44, 45, 46, 47]: return 'Grassland, Sedgeland and Marshland' # Scrub and Shrubland elif c in [50, 51, 52, 54, 55, 56, 58, 80, 81]: return 'Scrub and Shrubland' # Forest elif c in [64, 68, 69, 70, 71]: return 'Forest' # Other else: return 'Other' # Used for Python codeblock of field calculation in ArcMap (based on LCDB v4+ definitions of CLASS & NAME) def classify_ID(c): # Artificial surfaces = 1 if c in [1, 2, 5, 6]: return 1 # Bare or Lightly-vegetated Surfaces = 2 elif c in [10, 12, 14, 15, 16]: return 2 # Water Bodies = 3 elif c in [20, 21, 22]: return 3 # Cropland = 4 elif c in [30, 33]: return 4 # Grassland, Sedgeland and Marshland = 5 elif c in [40, 41, 43, 44, 45, 46, 47]: return 5 # Scrub and Shrubland = 6 elif c in [50, 51, 52, 54, 55, 56, 58, 80, 81]: return 6 # Forest = 7 elif c in [64, 68, 69, 70, 71]: return 7 # Other = 8 else: return 8 ############################################################################### # 3. Resample LCDB rasters to match padded SRTM grids for each zone # ############################################################################### # Loop through all available DTM survey zones for zone in zones: print('\nProcessing {} zone:'.format(zone)) # Open a template raster (DEM for that zone, with pad=44) & extract its properties print(' - Analysing zonal SRTM raster to align grids...') srtm_filename = '{}proc/{}/SRTM_{}_Z.tif'.format(folder_srtm, zone, zone) srtm_proj, srtm_res_x, srtm_res_y, srtm_x_min, srtm_x_max, srtm_y_min, srtm_y_max, srtm_width, srtm_height = extract_projection_info(srtm_filename) # Define a new bounding box, including the padding required for the 2D convnet data pre-processing pad_x_min = srtm_x_min - pad*srtm_res_x pad_x_max = srtm_x_max + pad*srtm_res_x pad_y_min = srtm_y_min - pad*-srtm_res_y pad_y_max = srtm_y_max + pad*-srtm_res_y pad_width = srtm_width + 2*pad pad_height = srtm_height + 2*pad # Rasterise the Manaaki Whenua land cover SHP to a raster (aligning it with the others, in terms of resolution & extent) print(' - Rasterising land cover SHP to zone GeoTIFF...') LCDB_shp = '{}/proc/LCDB_v50_WGS84.shp'.format(folder_lcdb) LCDB_tif = '{}/proc/LCDB_GroupID_{}_Pad44.tif'.format(folder_lcdb, zone) rasterise_command = [gdal_rasterise, '-a', 'GrpID_2018', '-l', LCDB_shp.split('/')[-1][:-4], LCDB_shp, LCDB_tif, '-a_nodata', '-9999', '-tr', str(srtm_res_x), str(-srtm_res_y), '-te', str(pad_x_min), str(pad_y_min), str(pad_x_max), str(pad_y_max)] rasterise_result = subprocess.run(rasterise_command, stdout=subprocess.PIPE) if rasterise_result.returncode != 0: print('\nProcess failed, with error message: {}\n'.format(rasterise_result.stdout)) break ############################################################################### # 4. More processing of LCDB rasters within the geo_process_LiDAR_SRTM script # ############################################################################### # Further processing & visualisation of the LCDB raster data was done in the "geo_process_LiDAR_SRTM.py" script ############################################################################### # 5. Generate thumbnail histograms for each zone, to include in LCDB map # ############################################################################### # Set up a dictionary of properties for each Manaaki Whenua landclass type present lcdb_dict = {1:{'label':'Artificial\nsurfaces', 'colour':(78/255, 78/255, 78/255)}, 2:{'label':'Bare or Lightly-\nvegetated Surfaces', 'colour':(255/255, 235/255, 190/255)}, 3:{'label':'Water\nBodies', 'colour':(0/255, 197/255, 255/255)}, 4:{'label':'Cropland', 'colour':(255/255, 170/255, 0/255)}, 5:{'label':'Grassland, Sedgeland\nand Marshland', 'colour':(255/255, 255/255, 115/255)}, 6:{'label':'Scrub and\nShrubland', 'colour':(137/255, 205/255, 102/255)}, 7:{'label':'Forest', 'colour':(38/255, 115/255, 0/255)}, 8:{'label':'Other', 'colour':'red'}} # Set up list of bin edges & colours lcdb_bins = np.linspace(0.5, 7.5, num=8) lcdb_colours = [lcdb_dict[l]['colour'] for l in range(1,8)] # Loop through each zone, generating a very simple histogram (colours only) of the land cover classes present for zone in zones: # Read 1D vector of processed input data for that zone df = pd.read_csv('{}/Input1D_ByZone_{}.csv'.format(folder_inputs, zone)) # Get a list of LCDB class codes for all valid pixels lcdb_list = df['lcdb'].loc[df['diff'] != -9999].tolist() lcdb_list = [l for l in lcdb_list if (not np.isnan(l) and l != None and l != -9999)] # Generate histogram manually, to ensure all classes covered (even if not present in that zone) fig, axes = plt.subplots(figsize=(2,0.8)) _,_,patches = axes.hist(lcdb_list, bins=lcdb_bins, edgecolor='dimgrey', linewidth=0.3) for patch, colour in zip(patches, lcdb_colours): patch.set_facecolor(colour) # Tidy up figure & save [axes.spines[edge].set_visible(False) for edge in ['left','top','right']] axes.spines['bottom'].set_color('black') axes.spines['bottom'].set_linewidth(0.5) axes.yaxis.set_visible(False) axes.set_xticklabels([]) axes.set_xticks([]) fig.tight_layout() fig.savefig('{}/All/Distributions/LCDB/landcover_hist_{}.png'.format(folder_fig, zone), dpi=150, transparent=True, bbox='tight') plt.close()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 29937, 10554, 29901, 341, 1648, 9940, 1932, 3357, 3172, 26428, 5470, 313, 12182, 4051, 325, 29945, 29889, 29900, 29897, 13, 13, 29937, 16032, 3734, 9741, 13, 5215, 10876, 29892, 1014, 5014, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 29937, 16032, 16876, 3168, 8018, 304, 445, 2471, 13, 9675, 29889, 2084, 29889, 4397, 877, 29923, 8419, 3487, 29885, 29896, 29906, 29941, 29914, 29928, 29914, 16713, 29914, 24756, 29914, 1495, 13, 3166, 1737, 29877, 29918, 3952, 6774, 1053, 6597, 29918, 771, 6929, 29918, 3888, 13, 13, 29937, 2391, 10898, 304, 402, 29928, 1964, 12078, 13, 468, 29878, 29906, 468, 29878, 353, 525, 29907, 8419, 29909, 1056, 18050, 29941, 29914, 264, 4270, 29914, 24756, 29914, 12284, 29914, 2109, 29914, 468, 29878, 29906, 468, 29878, 29889, 8097, 29915, 13, 29887, 12293, 29918, 4495, 29886, 353, 525, 29907, 8419, 29909, 1056, 18050, 29941, 29914, 264, 4270, 29914, 24756, 29914, 12284, 29914, 2109, 29914, 29887, 12293, 4495, 29886, 29889, 8097, 29915, 13, 29887, 12293, 29918, 29878, 1901, 895, 353, 525, 29907, 8419, 29909, 1056, 18050, 29941, 29914, 264, 4270, 29914, 24756, 29914, 12284, 29914, 2109, 29914, 29887, 12293, 29918, 29878, 1901, 675, 29889, 8097, 29915, 13, 13, 29937, 22402, 10898, 304, 317, 13079, 29924, 669, 365, 29907, 4051, 16495, 13, 12083, 29918, 29879, 2273, 29885, 353, 525, 29923, 8419, 3487, 29885, 29896, 29906, 29941, 29914, 29928, 29914, 1272, 29914, 8452, 29924, 29914, 29903, 13079, 29924, 22208, 13, 12083, 29918, 29880, 2252, 29890, 353, 525, 29923, 8419, 3487, 29885, 29896, 29906, 29941, 29914, 29928, 29914, 1272, 29914, 29519, 3235, 29914, 29880, 3780, 29899, 29880, 2252, 29890, 29899, 29894, 29945, 29900, 29915, 13, 12083, 29918, 2080, 29879, 353, 525, 29923, 8419, 3487, 29885, 29896, 29906, 29941, 29914, 29928, 29914, 1988, 29914, 2080, 29879, 29914, 29896, 29928, 29915, 13, 12083, 29918, 1003, 353, 525, 29923, 8419, 3487, 29885, 29896, 29906, 29941, 29914, 29928, 29914, 1003, 1973, 29915, 13, 13, 29937, 22402, 1051, 310, 20542, 304, 367, 19356, 313, 25048, 403, 2718, 29928, 1718, 23746, 10161, 29897, 13, 29920, 2873, 353, 6024, 29924, 2241, 29896, 29947, 29918, 29956, 4162, 742, 525, 29924, 2241, 29896, 29947, 29918, 29956, 29963, 29931, 742, 525, 29924, 2241, 29896, 29947, 29918, 29956, 29968, 29956, 742, 525, 29924, 2241, 29896, 29947, 29918, 29943, 12739, 742, 525, 9375, 29924, 29896, 29955, 29918, 1254, 29909, 742, 525, 9375, 29924, 29896, 29955, 29918, 10249, 29924, 742, 525, 9375, 29924, 29896, 29955, 29918, 7239, 29933, 742, 525, 9375, 29924, 29896, 29953, 29918, 1299, 29954, 2033, 13, 13, 29937, 22402, 8600, 304, 4808, 2472, 1104, 1218, 304, 1269, 10640, 10664, 491, 278, 1085, 29880, 22187, 313, 29906, 29900, 29896, 29947, 29897, 18994, 13, 6008, 29885, 29918, 8977, 353, 11117, 29924, 2241, 29896, 29947, 29918, 29956, 4162, 2396, 10998, 1643, 22099, 29956, 1794, 336, 29884, 13494, 1144, 6932, 313, 7083, 29880, 22187, 29871, 29906, 29900, 29896, 29947, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29947, 16675, 13, 9651, 525, 29924, 2241, 29896, 29947, 29918, 29956, 29963, 29931, 2396, 10998, 1643, 22099, 29956, 1794, 336, 29884, 13939, 313, 7083, 29880, 22187, 29871, 29906, 29900, 29896, 29947, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29947, 16675, 13, 9651, 525, 29924, 2241, 29896, 29947, 29918, 29956, 29968, 29956, 2396, 10998, 1643, 22099, 29925, 293, 880, 448, 22552, 638, 10011, 313, 7083, 29880, 22187, 29871, 29906, 29900, 29896, 29947, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29947, 16675, 13, 9651, 525, 29924, 2241, 29896, 29947, 29918, 29943, 12739, 2396, 10998, 1643, 22099, 29943, 21222, 17418, 29892, 1632, 465, 29885, 406, 669, 27723, 22886, 271, 406, 313, 7083, 29880, 22187, 29871, 29906, 29900, 29896, 29947, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29947, 16675, 13, 9651, 525, 9375, 29924, 29896, 29955, 29918, 1254, 29909, 2396, 10998, 1643, 22099, 855, 826, 1056, 566, 313, 29911, 294, 1171, 29871, 29906, 29900, 29896, 29955, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29955, 16675, 13, 9651, 525, 9375, 29924, 29896, 29955, 29918, 10249, 29924, 2396, 10998, 1643, 22099, 3226, 29872, 9865, 313, 29911, 294, 1171, 29871, 29906, 29900, 29896, 29955, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29955, 16675, 13, 9651, 525, 9375, 29924, 29896, 29955, 29918, 7239, 29933, 2396, 10998, 1643, 22099, 29954, 1025, 264, 6211, 669, 383, 598, 5872, 1706, 277, 313, 29911, 294, 1171, 29871, 29906, 29900, 29896, 29955, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29955, 16675, 13, 9651, 525, 9375, 29924, 29896, 29953, 29918, 1299, 29954, 2396, 10998, 1643, 22099, 4920, 295, 23793, 1171, 669, 16108, 6211, 313, 29911, 294, 1171, 29871, 29906, 29900, 29896, 29953, 29897, 742, 525, 6360, 22099, 29906, 29900, 29896, 29953, 29915, 930, 13, 13, 29937, 22402, 278, 1353, 310, 9101, 310, 7164, 304, 788, 3412, 1269, 364, 1901, 10452, 13, 8305, 353, 29871, 29946, 29946, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 29871, 29896, 29889, 830, 4836, 365, 29907, 4051, 317, 3954, 313, 3166, 405, 29999, 23081, 29906, 29900, 29900, 29900, 304, 399, 10749, 29947, 29946, 29897, 462, 795, 396, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 29937, 830, 4836, 278, 341, 1648, 9940, 1932, 3357, 2982, 4612, 317, 3954, 515, 405, 29999, 23081, 29906, 29900, 29900, 29900, 304, 399, 10749, 29947, 29946, 313, 29923, 7024, 29954, 29901, 29946, 29941, 29906, 29953, 29897, 13, 12182, 4051, 29918, 845, 29886, 29918, 29940, 29999, 23081, 29906, 29900, 29900, 29900, 353, 22372, 6822, 1610, 29914, 29880, 2252, 29890, 29899, 29894, 29945, 29900, 29899, 1049, 29899, 11911, 29899, 9803, 29899, 3259, 29899, 29945, 29900, 29899, 3396, 1049, 29899, 1482, 29899, 911, 11627, 29889, 845, 29886, 4286, 4830, 29898, 12083, 29918, 29880, 2252, 29890, 29897, 13, 12182, 4051, 29918, 845, 29886, 29918, 29956, 10749, 29947, 29946, 353, 22372, 6822, 15439, 29914, 12182, 4051, 29918, 29894, 29945, 29900, 29918, 29956, 10749, 29947, 29946, 29889, 845, 29886, 4286, 4830, 29898, 12083, 29918, 29880, 2252, 29890, 29897, 13, 29956, 10749, 29947, 29946, 353, 525, 29923, 7024, 29954, 29901, 29946, 29941, 29906, 29953, 29915, 13, 276, 4836, 29918, 6519, 353, 518, 468, 29878, 29906, 468, 29878, 29892, 365, 29907, 4051, 29918, 845, 29886, 29918, 29956, 10749, 29947, 29946, 29892, 365, 29907, 4051, 29918, 845, 29886, 29918, 29940, 29999, 23081, 29906, 29900, 29900, 29900, 29892, 17411, 29873, 29918, 29879, 2288, 742, 399, 10749, 29947, 29946, 29892, 17411, 957, 3539, 2033, 13, 276, 4836, 29918, 2914, 353, 1014, 5014, 29889, 3389, 29898, 276, 4836, 29918, 6519, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 361, 337, 4836, 29918, 2914, 29889, 2457, 401, 2804, 29871, 29900, 29901, 1596, 29898, 276, 4836, 29918, 2914, 29889, 25393, 29897, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 29871, 29906, 29889, 22711, 3388, 775, 1271, 29879, 363, 1162, 605, 2450, 310, 1014, 29899, 13203, 304, 1667, 2318, 886, 29871, 396, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 29937, 501, 8485, 363, 5132, 775, 1271, 310, 1746, 13944, 297, 22711, 3388, 313, 6707, 373, 365, 29907, 4051, 325, 29946, 29974, 15848, 310, 315, 4375, 1799, 669, 27085, 29897, 13, 1753, 770, 1598, 29918, 2972, 29898, 29883, 1125, 13, 1678, 396, 3012, 928, 616, 28001, 13, 1678, 565, 274, 297, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29945, 29892, 29871, 29953, 5387, 13, 4706, 736, 525, 9986, 928, 616, 6298, 8726, 29915, 13, 1678, 396, 350, 598, 470, 12790, 368, 29899, 345, 657, 630, 6298, 8726, 13, 1678, 25342, 274, 297, 518, 29896, 29900, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 5387, 13, 4706, 736, 525, 29933, 598, 470, 12790, 368, 29899, 345, 657, 630, 6298, 8726, 29915, 13, 1678, 396, 13062, 19929, 583, 13, 1678, 25342, 274, 297, 518, 29906, 29900, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29906, 5387, 13, 4706, 736, 525, 29956, 1008, 19929, 583, 29915, 13, 1678, 396, 8764, 572, 392, 13, 1678, 25342, 274, 297, 518, 29941, 29900, 29892, 29871, 29941, 29941, 5387, 13, 4706, 736, 525, 29907, 307, 572, 392, 29915, 13, 1678, 396, 1632, 465, 1049, 29892, 20951, 7467, 392, 322, 13216, 1049, 13, 1678, 25342, 274, 297, 518, 29946, 29900, 29892, 29871, 29946, 29896, 29892, 29871, 29946, 29941, 29892, 29871, 29946, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 29946, 29953, 29892, 29871, 29946, 29955, 5387, 13, 4706, 736, 525, 3338, 465, 1049, 29892, 20951, 7467, 392, 322, 13216, 1049, 29915, 13, 1678, 396, 2522, 29878, 431, 322, 317, 1092, 431, 1049, 13, 1678, 25342, 274, 297, 518, 29945, 29900, 29892, 29871, 29945, 29896, 29892, 29871, 29945, 29906, 29892, 29871, 29945, 29946, 29892, 29871, 29945, 29945, 29892, 29871, 29945, 29953, 29892, 29871, 29945, 29947, 29892, 29871, 29947, 29900, 29892, 29871, 29947, 29896, 5387, 13, 4706, 736, 525, 4421, 29878, 431, 322, 317, 1092, 431, 1049, 29915, 13, 1678, 396, 17300, 13, 1678, 25342, 274, 297, 518, 29953, 29946, 29892, 29871, 29953, 29947, 29892, 29871, 29953, 29929, 29892, 29871, 29955, 29900, 29892, 29871, 29955, 29896, 5387, 13, 4706, 736, 525, 2831, 342, 29915, 13, 1678, 396, 5901, 13, 1678, 1683, 29901, 13, 4706, 736, 525, 16107, 29915, 13, 13, 29937, 501, 8485, 363, 5132, 775, 1271, 310, 1746, 13944, 297, 22711, 3388, 313, 6707, 373, 365, 29907, 4051, 325, 29946, 29974, 15848, 310, 315, 4375, 1799, 669, 27085, 29897, 13, 1753, 770, 1598, 29918, 1367, 29898, 29883, 1125, 13, 1678, 396, 3012, 928, 616, 28001, 353, 29871, 29896, 13, 1678, 565, 274, 297, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29945, 29892, 29871, 29953, 5387, 13, 4706, 736, 29871, 29896, 13, 1678, 396, 350, 598, 470, 12790, 368, 29899, 345, 657, 630, 6298, 8726, 353, 29871, 29906, 13, 1678, 25342, 274, 297, 518, 29896, 29900, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29953, 5387, 13, 4706, 736, 29871, 29906, 13, 1678, 396, 13062, 19929, 583, 353, 29871, 29941, 13, 1678, 25342, 274, 297, 518, 29906, 29900, 29892, 29871, 29906, 29896, 29892, 29871, 29906, 29906, 5387, 13, 4706, 736, 29871, 29941, 13, 1678, 396, 8764, 572, 392, 353, 29871, 29946, 13, 1678, 25342, 274, 297, 518, 29941, 29900, 29892, 29871, 29941, 29941, 5387, 13, 4706, 736, 29871, 29946, 13, 1678, 396, 1632, 465, 1049, 29892, 20951, 7467, 392, 322, 13216, 1049, 353, 29871, 29945, 13, 1678, 25342, 274, 297, 518, 29946, 29900, 29892, 29871, 29946, 29896, 29892, 29871, 29946, 29941, 29892, 29871, 29946, 29946, 29892, 29871, 29946, 29945, 29892, 29871, 29946, 29953, 29892, 29871, 29946, 29955, 5387, 13, 4706, 736, 29871, 29945, 13, 1678, 396, 2522, 29878, 431, 322, 317, 1092, 431, 1049, 353, 29871, 29953, 13, 1678, 25342, 274, 297, 518, 29945, 29900, 29892, 29871, 29945, 29896, 29892, 29871, 29945, 29906, 29892, 29871, 29945, 29946, 29892, 29871, 29945, 29945, 29892, 29871, 29945, 29953, 29892, 29871, 29945, 29947, 29892, 29871, 29947, 29900, 29892, 29871, 29947, 29896, 5387, 13, 4706, 736, 29871, 29953, 13, 1678, 396, 17300, 353, 29871, 29955, 13, 1678, 25342, 274, 297, 518, 29953, 29946, 29892, 29871, 29953, 29947, 29892, 29871, 29953, 29929, 29892, 29871, 29955, 29900, 29892, 29871, 29955, 29896, 5387, 13, 4706, 736, 29871, 29955, 13, 1678, 396, 5901, 353, 29871, 29947, 13, 1678, 1683, 29901, 13, 4706, 736, 29871, 29947, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 29871, 29941, 29889, 2538, 981, 365, 29907, 4051, 364, 1901, 29879, 304, 1993, 282, 23959, 317, 13079, 29924, 867, 4841, 363, 1269, 10640, 965, 396, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 29937, 21493, 1549, 599, 3625, 360, 23081, 18994, 20542, 13, 1454, 10640, 297, 20542, 29901, 13, 268, 13, 1678, 1596, 28909, 29876, 7032, 292, 6571, 10640, 29901, 4286, 4830, 29898, 8028, 876, 13, 268, 13, 1678, 396, 4673, 263, 4472, 364, 1901, 313, 2287, 29924, 363, 393, 10640, 29892, 411, 17132, 29922, 29946, 29946, 29897, 669, 6597, 967, 4426, 13, 1678, 1596, 877, 448, 11597, 952, 292, 503, 7177, 317, 13079, 29924, 364, 1901, 304, 7595, 867, 4841, 856, 1495, 13, 1678, 269, 2273, 29885, 29918, 9507, 353, 525, 8875, 15439, 19248, 6822, 29903, 13079, 29924, 648, 2403, 29999, 29889, 29873, 361, 4286, 4830, 29898, 12083, 29918, 29879, 2273, 29885, 29892, 10640, 29892, 10640, 29897, 13, 1678, 269, 2273, 29885, 29918, 20865, 29892, 269, 2273, 29885, 29918, 690, 29918, 29916, 29892, 269, 2273, 29885, 29918, 690, 29918, 29891, 29892, 269, 2273, 29885, 29918, 29916, 29918, 1195, 29892, 269, 2273, 29885, 29918, 29916, 29918, 3317, 29892, 269, 2273, 29885, 29918, 29891, 29918, 1195, 29892, 269, 2273, 29885, 29918, 29891, 29918, 3317, 29892, 269, 2273, 29885, 29918, 2103, 29892, 269, 2273, 29885, 29918, 3545, 353, 6597, 29918, 771, 6929, 29918, 3888, 29898, 29879, 2273, 29885, 29918, 9507, 29897, 13, 268, 13, 1678, 396, 22402, 263, 716, 3216, 292, 3800, 29892, 3704, 278, 7164, 3734, 363, 278, 29871, 29906, 29928, 7602, 1212, 848, 758, 29899, 19170, 13, 1678, 17132, 29918, 29916, 29918, 1195, 353, 269, 2273, 29885, 29918, 29916, 29918, 1195, 448, 17132, 29930, 29879, 2273, 29885, 29918, 690, 29918, 29916, 13, 1678, 17132, 29918, 29916, 29918, 3317, 353, 269, 2273, 29885, 29918, 29916, 29918, 3317, 718, 17132, 29930, 29879, 2273, 29885, 29918, 690, 29918, 29916, 13, 1678, 17132, 29918, 29891, 29918, 1195, 353, 269, 2273, 29885, 29918, 29891, 29918, 1195, 448, 17132, 29930, 29899, 29879, 2273, 29885, 29918, 690, 29918, 29891, 13, 1678, 17132, 29918, 29891, 29918, 3317, 353, 269, 2273, 29885, 29918, 29891, 29918, 3317, 718, 17132, 29930, 29899, 29879, 2273, 29885, 29918, 690, 29918, 29891, 13, 1678, 17132, 29918, 2103, 353, 269, 2273, 29885, 29918, 2103, 718, 29871, 29906, 29930, 8305, 13, 1678, 17132, 29918, 3545, 353, 269, 2273, 29885, 29918, 3545, 718, 29871, 29906, 29930, 8305, 13, 268, 13, 1678, 396, 390, 1901, 895, 278, 341, 1648, 9940, 1932, 3357, 2982, 4612, 317, 3954, 304, 263, 364, 1901, 313, 2520, 292, 372, 411, 278, 4045, 29892, 297, 4958, 310, 10104, 669, 15834, 29897, 13, 1678, 1596, 877, 448, 390, 1901, 5921, 2982, 4612, 317, 3954, 304, 10640, 1879, 29877, 24301, 4198, 856, 1495, 13, 1678, 365, 29907, 4051, 29918, 845, 29886, 353, 22372, 6822, 15439, 29914, 12182, 4051, 29918, 29894, 29945, 29900, 29918, 29956, 10749, 29947, 29946, 29889, 845, 29886, 4286, 4830, 29898, 12083, 29918, 29880, 2252, 29890, 29897, 13, 1678, 365, 29907, 4051, 29918, 29873, 361, 353, 22372, 6822, 15439, 29914, 12182, 4051, 29918, 4782, 1367, 648, 2403, 20369, 29946, 29946, 29889, 29873, 361, 4286, 4830, 29898, 12083, 29918, 29880, 2252, 29890, 29892, 10640, 29897, 13, 1678, 364, 1901, 895, 29918, 6519, 353, 518, 29887, 12293, 29918, 29878, 1901, 895, 29892, 17411, 29874, 742, 525, 3338, 29886, 1367, 29918, 29906, 29900, 29896, 29947, 742, 17411, 29880, 742, 365, 29907, 4051, 29918, 845, 29886, 29889, 5451, 11219, 1495, 14352, 29896, 3816, 13018, 29946, 1402, 365, 29907, 4051, 29918, 845, 29886, 29892, 365, 29907, 4051, 29918, 29873, 361, 29892, 17411, 29874, 29918, 29876, 397, 532, 742, 17411, 29929, 29929, 29929, 29929, 742, 17411, 509, 742, 851, 29898, 29879, 2273, 29885, 29918, 690, 29918, 29916, 511, 851, 6278, 29879, 2273, 29885, 29918, 690, 29918, 29891, 511, 17411, 371, 742, 851, 29898, 8305, 29918, 29916, 29918, 1195, 511, 851, 29898, 8305, 29918, 29891, 29918, 1195, 511, 851, 29898, 8305, 29918, 29916, 29918, 3317, 511, 851, 29898, 8305, 29918, 29891, 29918, 3317, 4638, 13, 1678, 364, 1901, 895, 29918, 2914, 353, 1014, 5014, 29889, 3389, 29898, 29878, 1901, 895, 29918, 6519, 29892, 27591, 29922, 1491, 5014, 29889, 2227, 4162, 29897, 13, 1678, 565, 364, 1901, 895, 29918, 2914, 29889, 2457, 401, 2804, 29871, 29900, 29901, 13, 4706, 1596, 28909, 29876, 7032, 5229, 29892, 411, 1059, 2643, 29901, 426, 1012, 29876, 4286, 4830, 29898, 29878, 1901, 895, 29918, 2914, 29889, 25393, 876, 13, 4706, 2867, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 29871, 29946, 29889, 5853, 9068, 310, 365, 29907, 4051, 364, 1901, 29879, 2629, 278, 1737, 29877, 29918, 5014, 29918, 23410, 29928, 1718, 29918, 29903, 13079, 29924, 2471, 396, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 29937, 8725, 9068, 669, 7604, 4371, 310, 278, 365, 29907, 4051, 364, 1901, 848, 471, 2309, 297, 278, 376, 24756, 29918, 5014, 29918, 23410, 29928, 1718, 29918, 29903, 13079, 29924, 29889, 2272, 29908, 2471, 13, 13, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 29937, 29871, 29945, 29889, 3251, 403, 266, 21145, 9825, 468, 25402, 363, 1269, 10640, 29892, 304, 3160, 297, 365, 29907, 4051, 2910, 418, 396, 13, 13383, 13383, 13383, 13383, 7346, 4136, 2277, 29937, 13, 13, 29937, 3789, 701, 263, 8600, 310, 4426, 363, 1269, 341, 1648, 9940, 1932, 3357, 2982, 1990, 1134, 2198, 13, 29880, 2252, 29890, 29918, 8977, 353, 426, 29896, 29901, 10998, 1643, 22099, 9986, 928, 616, 29905, 1983, 332, 8726, 742, 525, 1054, 473, 2396, 29898, 29955, 29947, 29914, 29906, 29945, 29945, 29892, 29871, 29955, 29947, 29914, 29906, 29945, 29945, 29892, 29871, 29955, 29947, 29914, 29906, 29945, 29945, 19230, 13, 795, 29906, 29901, 10998, 1643, 22099, 29933, 598, 470, 12790, 368, 2612, 29876, 345, 657, 630, 6298, 8726, 742, 525, 1054, 473, 2396, 29898, 29906, 29945, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29906, 29941, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29929, 29900, 29914, 29906, 29945, 29945, 19230, 13, 795, 29941, 29901, 10998, 1643, 22099, 29956, 1008, 29905, 29876, 29933, 397, 583, 742, 525, 1054, 473, 2396, 29898, 29900, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29929, 29955, 29914, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29914, 29906, 29945, 29945, 19230, 13, 795, 29946, 29901, 10998, 1643, 22099, 29907, 307, 572, 392, 742, 525, 1054, 473, 2396, 29898, 29906, 29945, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29955, 29900, 29914, 29906, 29945, 29945, 29892, 29871, 29900, 29914, 29906, 29945, 29945, 19230, 13, 795, 29945, 29901, 10998, 1643, 22099, 3338, 465, 1049, 29892, 20951, 7467, 392, 29905, 29876, 392, 13216, 1049, 742, 525, 1054, 473, 2396, 29898, 29906, 29945, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29906, 29945, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29896, 29945, 29914, 29906, 29945, 29945, 19230, 13, 795, 29953, 29901, 10998, 1643, 22099, 4421, 29878, 431, 322, 29905, 29876, 29903, 1092, 431, 1049, 742, 525, 1054, 473, 2396, 29898, 29896, 29941, 29955, 29914, 29906, 29945, 29945, 29892, 29871, 29906, 29900, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29900, 29906, 29914, 29906, 29945, 29945, 19230, 13, 795, 29955, 29901, 10998, 1643, 22099, 2831, 342, 742, 525, 1054, 473, 2396, 29898, 29941, 29947, 29914, 29906, 29945, 29945, 29892, 29871, 29896, 29896, 29945, 29914, 29906, 29945, 29945, 29892, 29871, 29900, 29914, 29906, 29945, 29945, 19230, 13, 795, 29947, 29901, 10998, 1643, 22099, 16107, 742, 525, 1054, 473, 22099, 1127, 29915, 930, 13, 13, 29937, 3789, 701, 1051, 310, 9016, 12770, 669, 28061, 13, 29880, 2252, 29890, 29918, 29890, 1144, 353, 7442, 29889, 1915, 3493, 29898, 29900, 29889, 29945, 29892, 29871, 29955, 29889, 29945, 29892, 954, 29922, 29947, 29897, 13, 29880, 2252, 29890, 29918, 1054, 2470, 353, 518, 29880, 2252, 29890, 29918, 8977, 29961, 29880, 22322, 1054, 473, 2033, 363, 301, 297, 3464, 29898, 29896, 29892, 29947, 4638, 13, 13, 29937, 21493, 1549, 1269, 10640, 29892, 14655, 263, 1407, 2560, 9825, 13342, 313, 1054, 2470, 871, 29897, 310, 278, 2982, 4612, 4413, 2198, 13, 1454, 10640, 297, 20542, 29901, 13, 268, 13, 1678, 396, 7523, 29871, 29896, 29928, 4608, 310, 19356, 1881, 848, 363, 393, 10640, 13, 1678, 4489, 353, 10518, 29889, 949, 29918, 7638, 877, 29912, 6822, 4290, 29896, 29928, 29918, 2059, 18482, 648, 1836, 7638, 4286, 4830, 29898, 12083, 29918, 2080, 29879, 29892, 10640, 876, 13, 268, 13, 1678, 396, 3617, 263, 1051, 310, 365, 29907, 4051, 770, 11561, 363, 599, 2854, 17036, 13, 1678, 301, 2252, 29890, 29918, 1761, 353, 4489, 1839, 29880, 2252, 29890, 13359, 2029, 29961, 2176, 1839, 12765, 2033, 2804, 448, 29929, 29929, 29929, 29929, 1822, 25027, 391, 580, 13, 1678, 301, 2252, 29890, 29918, 1761, 353, 518, 29880, 363, 301, 297, 301, 2252, 29890, 29918, 1761, 565, 313, 1333, 7442, 29889, 275, 13707, 29898, 29880, 29897, 322, 301, 2804, 6213, 322, 301, 2804, 448, 29929, 29929, 29929, 29929, 4638, 13, 268, 13, 1678, 396, 3251, 403, 9825, 13342, 7522, 29892, 304, 9801, 599, 4413, 10664, 313, 11884, 565, 451, 2198, 297, 393, 10640, 29897, 13, 1678, 2537, 29892, 27815, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29906, 29892, 29900, 29889, 29947, 876, 13, 1678, 17117, 3383, 5041, 267, 353, 27815, 29889, 29882, 391, 29898, 29880, 2252, 29890, 29918, 1761, 29892, 289, 1144, 29922, 29880, 2252, 29890, 29918, 29890, 1144, 29892, 7636, 2780, 2433, 29881, 2492, 8903, 742, 1196, 2103, 29922, 29900, 29889, 29941, 29897, 13, 1678, 363, 13261, 29892, 12384, 297, 14319, 29898, 5041, 267, 29892, 301, 2252, 29890, 29918, 1054, 2470, 1125, 13, 4706, 13261, 29889, 842, 29918, 2161, 2780, 29898, 1054, 473, 29897, 13, 1678, 396, 323, 333, 29891, 701, 4377, 669, 4078, 13, 1678, 518, 1165, 267, 29889, 1028, 1475, 29961, 12864, 1822, 842, 29918, 12872, 29898, 8824, 29897, 363, 7636, 297, 6024, 1563, 3788, 3332, 3788, 1266, 2033, 29962, 13, 1678, 27815, 29889, 1028, 1475, 1839, 8968, 13359, 842, 29918, 2780, 877, 8517, 1495, 13, 1678, 27815, 29889, 1028, 1475, 1839, 8968, 13359, 842, 29918, 16292, 29898, 29900, 29889, 29945, 29897, 13, 1678, 27815, 29889, 29891, 8990, 29889, 842, 29918, 12872, 29898, 8824, 29897, 13, 1678, 27815, 29889, 842, 29918, 486, 860, 21134, 4197, 2314, 13, 1678, 27815, 29889, 842, 29918, 486, 7358, 4197, 2314, 13, 1678, 2537, 29889, 29873, 523, 29918, 2680, 580, 13, 1678, 2537, 29889, 7620, 1003, 877, 29912, 6822, 3596, 29914, 13398, 3224, 29879, 29914, 12182, 4051, 29914, 1049, 11911, 29918, 29882, 391, 648, 1836, 2732, 4286, 4830, 29898, 12083, 29918, 1003, 29892, 10640, 511, 270, 1631, 29922, 29896, 29945, 29900, 29892, 17772, 29922, 5574, 29892, 289, 1884, 2433, 29873, 523, 1495, 13, 1678, 14770, 29889, 5358, 580, 2 ]
jms_oidc_rp/utils.py
BaiJiangJie/jumpserver-django-oidc-rp
1
129610
""" OpenID Connect relying party (RP) utilities =========================================== This modules defines utilities allowing to manipulate ID tokens and other common helpers. """ import logging import datetime as dt from calendar import timegm from urllib.parse import urlparse, urljoin from django.core.exceptions import SuspiciousOperation from django.utils.encoding import force_bytes, smart_bytes from jwkest import JWKESTException from jwkest.jwk import KEYS from jwkest.jws import JWS from .conf.settings import dynamic_setting as oidc_rp_settings def get_logger(name=''): return logging.getLogger('jumpserver.{}'.format(name)) logger = get_logger(__file__) def validate_and_return_id_token(jws, nonce=None, validate_nonce=True): """ Validates the id_token according to the OpenID Connect specification. """ log_prompt = "Validate ID Token: {}" logger.debug(log_prompt.format('Get shared key')) shared_key = oidc_rp_settings.CLIENT_SECRET \ if oidc_rp_settings.PROVIDER_SIGNATURE_ALG == 'HS256' \ else oidc_rp_settings.PROVIDER_SIGNATURE_KEY # RS256 try: # Decodes the JSON Web Token and raise an error if the signature is invalid. logger.debug(log_prompt.format('Verify compact jwk')) id_token = JWS().verify_compact(force_bytes(jws), _get_jwks_keys(shared_key)) except JWKESTException as e: logger.debug(log_prompt.format('Verify compact jwkest exception: {}'.format(str(e)))) return # Validates the claims embedded in the id_token. logger.debug(log_prompt.format('Validate claims')) _validate_claims(id_token, nonce=nonce, validate_nonce=validate_nonce) return id_token def _get_jwks_keys(shared_key): """ Returns JWKS keys used to decrypt id_token values. """ # The OpenID Connect Provider (OP) uses RSA keys to sign/enrypt ID tokens and generate public # keys allowing to decrypt them. These public keys are exposed through the 'jwks_uri' and should # be used to decrypt the JWS - JSON Web Signature. log_prompt = "Get jwks keys: {}" logger.debug(log_prompt.format('Start')) jwks_keys = KEYS() logger.debug(log_prompt.format('Load from provider jwks endpoint')) jwks_keys.load_from_url(oidc_rp_settings.PROVIDER_JWKS_ENDPOINT) # Adds the shared key (which can correspond to the client_secret) as an oct key so it can be # used for HMAC signatures. logger.debug(log_prompt.format('Add key')) jwks_keys.add({'key': smart_bytes(shared_key), 'kty': 'oct'}) logger.debug(log_prompt.format('End')) return jwks_keys def _validate_claims(id_token, nonce=None, validate_nonce=True): """ Validates the claims embedded in the JSON Web Token. """ log_prompt = "Validate claims: {}" logger.debug(log_prompt.format('Start')) iss_parsed_url = urlparse(id_token['iss']) provider_parsed_url = urlparse(oidc_rp_settings.PROVIDER_ENDPOINT) if iss_parsed_url.netloc != provider_parsed_url.netloc: logger.debug(log_prompt.format('Invalid issuer')) raise SuspiciousOperation('Invalid issuer') if isinstance(id_token['aud'], str): id_token['aud'] = [id_token['aud']] if oidc_rp_settings.CLIENT_ID not in id_token['aud']: logger.debug(log_prompt.format('Invalid audience')) raise SuspiciousOperation('Invalid audience') if len(id_token['aud']) > 1 and 'azp' not in id_token: logger.debug(log_prompt.format('Incorrect id_token: azp')) raise SuspiciousOperation('Incorrect id_token: azp') if 'azp' in id_token and id_token['azp'] != oidc_rp_settings.CLIENT_ID: raise SuspiciousOperation('Incorrect id_token: azp') utc_timestamp = timegm(dt.datetime.utcnow().utctimetuple()) if utc_timestamp > id_token['exp']: logger.debug(log_prompt.format('Signature has expired')) raise SuspiciousOperation('Signature has expired') if 'nbf' in id_token and utc_timestamp < id_token['nbf']: logger.debug(log_prompt.format('Incorrect id_token: nbf')) raise SuspiciousOperation('Incorrect id_token: nbf') # Verifies that the token was issued in the allowed timeframe. if utc_timestamp > id_token['iat'] + oidc_rp_settings.ID_TOKEN_MAX_AGE: logger.debug(log_prompt.format('Incorrect id_token: iat')) raise SuspiciousOperation('Incorrect id_token: iat') # Validate the nonce to ensure the request was not modified if applicable. id_token_nonce = id_token.get('nonce', None) if validate_nonce and oidc_rp_settings.USE_NONCE and id_token_nonce != nonce: logger.debug(log_prompt.format('Incorrect id_token: nonce')) raise SuspiciousOperation('Incorrect id_token: nonce') logger.debug(log_prompt.format('End')) def build_absolute_uri(request, path=None): """ Build absolute redirect uri """ if path is None: path = '/' if oidc_rp_settings.BASE_SITE_URL: redirect_uri = urljoin(oidc_rp_settings.BASE_SITE_URL, path) else: redirect_uri = request.build_absolute_uri(path) return redirect_uri
[ 1, 9995, 13, 1678, 4673, 1367, 14971, 337, 5890, 6263, 313, 29934, 29925, 29897, 3667, 1907, 13, 1678, 1275, 9166, 9166, 4936, 29922, 13, 13, 1678, 910, 10585, 17645, 3667, 1907, 14372, 304, 26749, 3553, 18897, 322, 916, 3619, 1371, 414, 29889, 13, 13, 15945, 29908, 13, 13, 5215, 12183, 13, 5215, 12865, 408, 11636, 13, 3166, 17684, 1053, 5335, 387, 29885, 13, 3166, 3142, 1982, 29889, 5510, 1053, 3142, 5510, 29892, 3142, 7122, 13, 13, 3166, 9557, 29889, 3221, 29889, 11739, 29879, 1053, 9511, 29886, 14803, 10925, 13, 3166, 9557, 29889, 13239, 29889, 22331, 1053, 4889, 29918, 13193, 29892, 15040, 29918, 13193, 13, 3166, 432, 29893, 29895, 342, 1053, 435, 29956, 6059, 1254, 2451, 13, 3166, 432, 29893, 29895, 342, 29889, 29926, 29893, 29895, 1053, 14636, 29903, 13, 3166, 432, 29893, 29895, 342, 29889, 29926, 5652, 1053, 435, 7811, 13, 13, 3166, 869, 5527, 29889, 11027, 1053, 7343, 29918, 26740, 408, 288, 333, 29883, 29918, 19080, 29918, 11027, 13, 13, 13, 1753, 679, 29918, 21707, 29898, 978, 2433, 29374, 13, 1678, 736, 12183, 29889, 657, 16363, 877, 29926, 17204, 261, 369, 29889, 8875, 4286, 4830, 29898, 978, 876, 13, 13, 13, 21707, 353, 679, 29918, 21707, 22168, 1445, 1649, 29897, 13, 13, 13, 1753, 12725, 29918, 392, 29918, 2457, 29918, 333, 29918, 6979, 29898, 29926, 5652, 29892, 1661, 346, 29922, 8516, 29892, 12725, 29918, 5464, 346, 29922, 5574, 1125, 13, 1678, 9995, 15758, 1078, 278, 1178, 29918, 6979, 5034, 304, 278, 4673, 1367, 14971, 21992, 29889, 9995, 13, 1678, 1480, 29918, 14032, 415, 353, 376, 7211, 403, 3553, 25159, 29901, 426, 5038, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 2577, 7258, 1820, 8785, 13, 1678, 7258, 29918, 1989, 353, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 27205, 3919, 29918, 1660, 22245, 29911, 320, 13, 4706, 565, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 8618, 13044, 1001, 29918, 5425, 20728, 1299, 11499, 29918, 1964, 29954, 1275, 525, 14851, 29906, 29945, 29953, 29915, 320, 13, 4706, 1683, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 8618, 13044, 1001, 29918, 5425, 20728, 1299, 11499, 29918, 10818, 29871, 396, 390, 29903, 29906, 29945, 29953, 13, 13, 1678, 1018, 29901, 13, 4706, 396, 3826, 2631, 278, 4663, 2563, 25159, 322, 12020, 385, 1059, 565, 278, 12608, 338, 8340, 29889, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 6565, 1598, 11071, 432, 29893, 29895, 8785, 13, 4706, 1178, 29918, 6979, 353, 435, 7811, 2141, 27902, 29918, 2388, 627, 29898, 10118, 29918, 13193, 29898, 29926, 5652, 511, 903, 657, 29918, 29926, 29893, 2039, 29918, 8149, 29898, 12366, 29918, 1989, 876, 13, 1678, 5174, 435, 29956, 6059, 1254, 2451, 408, 321, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 6565, 1598, 11071, 432, 29893, 29895, 342, 3682, 29901, 6571, 4286, 4830, 29898, 710, 29898, 29872, 13697, 13, 4706, 736, 13, 13, 1678, 396, 15758, 1078, 278, 16726, 15685, 297, 278, 1178, 29918, 6979, 29889, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 7211, 403, 16726, 8785, 13, 1678, 903, 15480, 29918, 29883, 8342, 29879, 29898, 333, 29918, 6979, 29892, 1661, 346, 29922, 5464, 346, 29892, 12725, 29918, 5464, 346, 29922, 15480, 29918, 5464, 346, 29897, 13, 13, 1678, 736, 1178, 29918, 6979, 13, 13, 13, 1753, 903, 657, 29918, 29926, 29893, 2039, 29918, 8149, 29898, 12366, 29918, 1989, 1125, 13, 1678, 9995, 16969, 435, 29956, 17557, 6611, 1304, 304, 1602, 4641, 1178, 29918, 6979, 1819, 29889, 9995, 13, 1678, 396, 450, 4673, 1367, 14971, 1019, 5489, 313, 4590, 29897, 3913, 390, 8132, 6611, 304, 1804, 29914, 264, 4641, 3553, 18897, 322, 5706, 970, 13, 1678, 396, 6611, 14372, 304, 1602, 4641, 963, 29889, 4525, 970, 6611, 526, 19884, 1549, 278, 525, 29926, 29893, 2039, 29918, 5338, 29915, 322, 881, 13, 1678, 396, 367, 1304, 304, 1602, 4641, 278, 435, 7811, 448, 4663, 2563, 9954, 1535, 29889, 13, 1678, 1480, 29918, 14032, 415, 353, 376, 2577, 432, 29893, 2039, 6611, 29901, 426, 5038, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 4763, 8785, 13, 1678, 432, 29893, 2039, 29918, 8149, 353, 14636, 29903, 580, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 5896, 515, 13113, 432, 29893, 2039, 16248, 8785, 13, 1678, 432, 29893, 2039, 29918, 8149, 29889, 1359, 29918, 3166, 29918, 2271, 29898, 3398, 29883, 29918, 19080, 29918, 11027, 29889, 8618, 13044, 1001, 29918, 29967, 29956, 17557, 29918, 1430, 11191, 6992, 29911, 29897, 13, 1678, 396, 3462, 29879, 278, 7258, 1820, 313, 4716, 508, 3928, 304, 278, 3132, 29918, 19024, 29897, 408, 385, 4725, 1820, 577, 372, 508, 367, 13, 1678, 396, 1304, 363, 379, 1529, 29907, 1804, 3698, 29889, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 2528, 1820, 8785, 13, 1678, 432, 29893, 2039, 29918, 8149, 29889, 1202, 3319, 29915, 1989, 2396, 15040, 29918, 13193, 29898, 12366, 29918, 1989, 511, 525, 29895, 1017, 2396, 525, 20082, 29915, 1800, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 5044, 8785, 13, 1678, 736, 432, 29893, 2039, 29918, 8149, 13, 13, 13, 1753, 903, 15480, 29918, 29883, 8342, 29879, 29898, 333, 29918, 6979, 29892, 1661, 346, 29922, 8516, 29892, 12725, 29918, 5464, 346, 29922, 5574, 1125, 13, 1678, 9995, 15758, 1078, 278, 16726, 15685, 297, 278, 4663, 2563, 25159, 29889, 9995, 13, 1678, 1480, 29918, 14032, 415, 353, 376, 7211, 403, 16726, 29901, 426, 5038, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 4763, 8785, 13, 13, 1678, 1721, 29918, 862, 8485, 29918, 2271, 353, 3142, 5510, 29898, 333, 29918, 6979, 1839, 790, 11287, 13, 1678, 13113, 29918, 862, 8485, 29918, 2271, 353, 3142, 5510, 29898, 3398, 29883, 29918, 19080, 29918, 11027, 29889, 8618, 13044, 1001, 29918, 1430, 11191, 6992, 29911, 29897, 13, 1678, 565, 1721, 29918, 862, 8485, 29918, 2271, 29889, 1212, 2029, 2804, 13113, 29918, 862, 8485, 29918, 2271, 29889, 1212, 2029, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 13919, 1721, 2853, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 13919, 1721, 2853, 1495, 13, 13, 1678, 565, 338, 8758, 29898, 333, 29918, 6979, 1839, 15052, 7464, 851, 1125, 13, 4706, 1178, 29918, 6979, 1839, 15052, 2033, 353, 518, 333, 29918, 6979, 1839, 15052, 2033, 29962, 13, 13, 1678, 565, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 27205, 3919, 29918, 1367, 451, 297, 1178, 29918, 6979, 1839, 15052, 2033, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 13919, 20026, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 13919, 20026, 1495, 13, 13, 1678, 565, 7431, 29898, 333, 29918, 6979, 1839, 15052, 11287, 1405, 29871, 29896, 322, 525, 834, 29886, 29915, 451, 297, 1178, 29918, 6979, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 797, 15728, 1178, 29918, 6979, 29901, 2698, 29886, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 797, 15728, 1178, 29918, 6979, 29901, 2698, 29886, 1495, 13, 13, 1678, 565, 525, 834, 29886, 29915, 297, 1178, 29918, 6979, 322, 1178, 29918, 6979, 1839, 834, 29886, 2033, 2804, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 27205, 3919, 29918, 1367, 29901, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 797, 15728, 1178, 29918, 6979, 29901, 2698, 29886, 1495, 13, 13, 1678, 3477, 29883, 29918, 16394, 353, 5335, 387, 29885, 29898, 6008, 29889, 12673, 29889, 329, 29883, 3707, 2141, 329, 312, 17528, 29884, 552, 3101, 13, 1678, 565, 3477, 29883, 29918, 16394, 1405, 1178, 29918, 6979, 1839, 4548, 2033, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 10140, 1535, 756, 1518, 2859, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 10140, 1535, 756, 1518, 2859, 1495, 13, 13, 1678, 565, 525, 29876, 1635, 29915, 297, 1178, 29918, 6979, 322, 3477, 29883, 29918, 16394, 529, 1178, 29918, 6979, 1839, 29876, 1635, 2033, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 797, 15728, 1178, 29918, 6979, 29901, 302, 1635, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 797, 15728, 1178, 29918, 6979, 29901, 302, 1635, 1495, 13, 13, 1678, 396, 1798, 11057, 393, 278, 5993, 471, 16610, 297, 278, 6068, 931, 2557, 29889, 13, 1678, 565, 3477, 29883, 29918, 16394, 1405, 1178, 29918, 6979, 1839, 7163, 2033, 718, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 1367, 29918, 4986, 29968, 1430, 29918, 12648, 29918, 10461, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 797, 15728, 1178, 29918, 6979, 29901, 474, 271, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 797, 15728, 1178, 29918, 6979, 29901, 474, 271, 1495, 13, 13, 1678, 396, 15758, 403, 278, 1661, 346, 304, 9801, 278, 2009, 471, 451, 9120, 565, 22903, 29889, 13, 1678, 1178, 29918, 6979, 29918, 5464, 346, 353, 1178, 29918, 6979, 29889, 657, 877, 5464, 346, 742, 6213, 29897, 13, 1678, 565, 12725, 29918, 5464, 346, 322, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 17171, 29918, 29940, 1164, 4741, 322, 1178, 29918, 6979, 29918, 5464, 346, 2804, 1661, 346, 29901, 13, 4706, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 797, 15728, 1178, 29918, 6979, 29901, 1661, 346, 8785, 13, 4706, 12020, 9511, 29886, 14803, 10925, 877, 797, 15728, 1178, 29918, 6979, 29901, 1661, 346, 1495, 13, 13, 1678, 17927, 29889, 8382, 29898, 1188, 29918, 14032, 415, 29889, 4830, 877, 5044, 8785, 13, 13, 13, 1753, 2048, 29918, 23552, 29918, 5338, 29898, 3827, 29892, 2224, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 8878, 8380, 6684, 21333, 13, 1678, 9995, 13, 1678, 565, 2224, 338, 6213, 29901, 13, 4706, 2224, 353, 8207, 29915, 13, 13, 1678, 565, 288, 333, 29883, 29918, 19080, 29918, 11027, 29889, 25416, 29918, 29903, 9094, 29918, 4219, 29901, 13, 4706, 6684, 29918, 5338, 353, 3142, 7122, 29898, 3398, 29883, 29918, 19080, 29918, 11027, 29889, 25416, 29918, 29903, 9094, 29918, 4219, 29892, 2224, 29897, 13, 1678, 1683, 29901, 13, 4706, 6684, 29918, 5338, 353, 2009, 29889, 4282, 29918, 23552, 29918, 5338, 29898, 2084, 29897, 13, 1678, 736, 6684, 29918, 5338, 13, 2 ]
plot_maps.py
denadai2/A-Tale-of-Cities---code
1
111210
__author__ = '<NAME>' __license__ = "MIT" import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from math import sqrt import datetime from mpl_toolkits.basemap import Basemap from matplotlib.colors import LinearSegmentedColormap # Set the plot styles parse = lambda x: datetime.datetime.fromtimestamp(float(x)/1000) fig_width_pt = 345 # Get this from LaTeX using \showthe\columnwidth inches_per_pt = 1.0/72.27 # Convert pt to inches golden_mean = (sqrt(5)-1.0)/2.0 # Aesthetic ratio fig_width = fig_width_pt*inches_per_pt # width in inches fig_height = fig_width*golden_mean # height in inches fig_size = [fig_width, fig_height] sns.set_style("ticks") sns.set_context("paper") # Import the dataset Telecommunications sliceSum = pd.DataFrame({}) for index in range(4,11): sliceSum2 = pd.read_csv('nature/sms-call-internet-tn-2013-11-'+str(index).zfill(2) +'.txt', sep='\t', encoding="utf-8-sig", names=['CellID', 'datetime', 'countrycode', 'smsin', 'smsout', 'callin', 'callout', 'internet'], parse_dates=['datetime'], date_parser=parse)#, parse_dates=['datetime']) sliceSum2 = sliceSum2.set_index('datetime') sliceSum2['hour'] = sliceSum2.index.hour sliceSum2['weekday'] = sliceSum2.index.weekday sliceSum2 = sliceSum2.groupby(['hour','weekday', 'CellID'], as_index=False).sum() sliceSum = sliceSum.append(sliceSum2) sliceSum['idx'] = sliceSum['hour'] + (sliceSum['weekday']*24) sliceSum.head() # Import the dataset - precipitations precipitation_df = pd.read_csv('nature/precipitation-trentino.csv', sep=',', names=['datetime','CellID','intensity'], encoding="utf-8-sig", parse_dates=['datetime'], date_parser=parse) precipitation_df = precipitation_df.set_index(['datetime'], drop=False) precipitation_df = precipitation_df.groupby(['CellID'], as_index=False).mean() precipitation_df.head() # Import the dataset - news news_df = pd.read_csv('nature/news.csv', sep=',', encoding="utf-8-sig", parse_dates=['date']) news_df.head() # Import the grid, obtained from the geojson. The CSV has X, Y coordinates and CellID csv_df = pd.read_csv('nature/grid_trentino.csv') # Merge csv_df with Telecommunications, grouped by cellID merge = pd.merge(sliceSum.groupby(['CellID'], as_index=False).sum(), csv_df, on='CellID') # Extract the points for hexbin points_x = np.array([x['X'] for i,x in merge.iterrows()]) points_y = np.array([x['Y'] for i,x in merge.iterrows()]) c = np.array([x['internet'] for i,x in merge.iterrows()]) # Trentino's boundingbox a = (45.6730682227551, 10.4521594968354) b = (46.5327699992773, 11.9627133503828) # Trentino shapefile # http://dati.trentino.it/dataset/limite-comprensoriale-027140/resource/ff1f1687-3f8f-427e-84d9-cf40c8b9b98a m = Basemap(lat_0 = (a[0]+b[0])/2, lon_0 = (a[1]+b[1])/2, epsg=4326, llcrnrlon=a[1],llcrnrlat=a[0],urcrnrlon=b[1],urcrnrlat=b[0],) m.readshapefile('nature/amm','Trentino_shapefile', color='0.35') cmap = LinearSegmentedColormap.from_list("skil", sns.color_palette("RdBu_r", 7)[1:]) plt.register_cmap(cmap=cmap) m.hexbin(points_x, points_y, cmap="skil", gridsize=50, C=c, bins='log', mincnt=1) sns.despine(left=True, bottom=True) plt.savefig('map.pdf', format='pdf', dpi=330, bbox_inches='tight') # Import the dataset - social pulse, obtained from the geojson social_df = pd.read_csv('nature/result2.csv', sep=',', encoding="utf-8-sig", parse_dates=['created']) points_x = np.array([x['geomPoint.geom/coordinates/0'] for i,x in social_df.iterrows()]) points_y = np.array([x['geomPoint.geom/coordinates/1'] for i,x in social_df.iterrows()]) m = Basemap(lat_0 = (a[0]+b[0])/2, lon_0 = (a[1]+b[1])/2, epsg=4326, llcrnrlon=a[1], llcrnrlat=a[0], urcrnrlon=b[1], urcrnrlat=b[0],) m.readshapefile('nature/amm', 'Trentino_shapefile', color='0.35') m.hexbin(points_x, points_y, cmap="skil", gridsize=50, bins='log', mincnt=1) sns.despine(left=True, bottom=True) plt.savefig('map_social.pdf', format='pdf', dpi=330,bbox_inches='tight') # Energy map line_df = pd.read_csv('nature/line.csv', sep=',', encoding="utf-8-sig") line_df['CellID'] = line_df['SQUAREID'] merge = pd.merge(line_df.groupby(['CellID'], as_index=False).sum(), csv_df, on='CellID') points_x = np.array([x['X'] for i,x in merge.iterrows()]) points_y = np.array([x['Y'] for i,x in merge.iterrows()]) c = np.array([x['NR_UBICAZIONI'] for i,x in merge.iterrows()]) m = Basemap(lat_0 = (a[0]+b[0])/2, lon_0 = (a[1]+b[1])/2, epsg=4326, llcrnrlon=a[1],llcrnrlat=a[0],urcrnrlon=b[1],urcrnrlat=b[0],) m.readshapefile('nature/amm','Trentino_shapefile', color='0.35') m.hexbin(points_x, points_y, cmap="skil", gridsize=50, bins='log', C=c, mincnt=1) sns.despine(left=True, bottom=True) plt.savefig('map_line.pdf', format='pdf', dpi=330,bbox_inches='tight') # Precipitation map merge = pd.merge(precipitation_df, csv_df, on='CellID') points_x = np.array([x['X'] for i,x in merge.iterrows()]) points_y = np.array([x['Y'] for i,x in merge.iterrows()]) c = np.array([x['intensity'] for i,x in merge.iterrows()]) m = Basemap(lat_0 = (a[0]+b[0])/2, lon_0 = (a[1]+b[1])/2, epsg=4326, llcrnrlon=a[1], llcrnrlat=a[0], urcrnrlon=b[1], urcrnrlat=b[0],) m.readshapefile('nature/amm', 'Trentino_shapefile', color='0.35') m.hexbin(points_x, points_y, cmap="skil", gridsize=50, bins='log', C=c, mincnt=1) sns.despine(left=True, bottom=True) plt.savefig('map_precipitation.pdf', format='pdf', dpi=330, bbox_inches='tight') # News map points_x = np.array([x['geomPoint.geom/coordinates/0'] for i,x in news_df.iterrows()]) points_y = np.array([x['geomPoint.geom/coordinates/1'] for i,x in news_df.iterrows()]) m = Basemap(lat_0 = (a[0]+b[0])/2, lon_0 = (a[1]+b[1])/2, epsg=4326, llcrnrlon=a[1],llcrnrlat=a[0],urcrnrlon=b[1],urcrnrlat=b[0],) m.readshapefile('nature/amm','Trentino_shapefile', color='0.35') m.hexbin(points_x, points_y, cmap="skil", gridsize=35, bins='log', mincnt=1) sns.despine(left=True, bottom=True) plt.savefig('map_news.pdf', format='pdf', dpi=330,bbox_inches='tight')
[ 1, 4770, 8921, 1649, 353, 12801, 5813, 16299, 13, 1649, 506, 1947, 1649, 353, 376, 26349, 29908, 13, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 3166, 5844, 1053, 18074, 2273, 13, 5215, 12865, 13, 3166, 286, 572, 29918, 10154, 29895, 1169, 29889, 6500, 331, 481, 1053, 4886, 331, 481, 13, 3166, 22889, 29889, 27703, 1053, 22985, 17669, 358, 287, 1625, 555, 481, 13, 13, 13, 29937, 3789, 278, 6492, 11949, 13, 5510, 353, 14013, 921, 29901, 12865, 29889, 12673, 29889, 3166, 16394, 29898, 7411, 29898, 29916, 6802, 29896, 29900, 29900, 29900, 29897, 13, 13, 1003, 29918, 2103, 29918, 415, 353, 29871, 29941, 29946, 29945, 29871, 396, 3617, 445, 515, 29186, 773, 320, 4294, 1552, 29905, 4914, 2103, 13, 262, 6609, 29918, 546, 29918, 415, 353, 29871, 29896, 29889, 29900, 29914, 29955, 29906, 29889, 29906, 29955, 1669, 396, 14806, 19592, 304, 22831, 13, 29887, 1025, 264, 29918, 12676, 353, 313, 3676, 29898, 29945, 6817, 29896, 29889, 29900, 6802, 29906, 29889, 29900, 308, 396, 319, 342, 29882, 7492, 11959, 13, 1003, 29918, 2103, 353, 2537, 29918, 2103, 29918, 415, 29930, 262, 6609, 29918, 546, 29918, 415, 29871, 396, 2920, 297, 22831, 13, 1003, 29918, 3545, 353, 2537, 29918, 2103, 29930, 29887, 1025, 264, 29918, 12676, 539, 396, 3171, 297, 22831, 13, 1003, 29918, 2311, 353, 518, 1003, 29918, 2103, 29892, 2537, 29918, 3545, 29962, 13, 13, 29879, 1983, 29889, 842, 29918, 3293, 703, 29873, 7358, 1159, 13, 29879, 1983, 29889, 842, 29918, 4703, 703, 19773, 1159, 13, 13, 29937, 16032, 278, 8783, 9699, 27820, 800, 13, 18337, 11139, 353, 10518, 29889, 17271, 3319, 1800, 13, 1454, 2380, 297, 3464, 29898, 29946, 29892, 29896, 29896, 1125, 13, 1678, 22780, 11139, 29906, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 29879, 1516, 29899, 4804, 29899, 14168, 300, 29899, 6277, 29899, 29906, 29900, 29896, 29941, 29899, 29896, 29896, 29899, 18717, 710, 29898, 2248, 467, 29920, 5589, 29898, 29906, 29897, 718, 4286, 3945, 742, 16345, 2433, 29905, 29873, 742, 8025, 543, 9420, 29899, 29947, 29899, 18816, 613, 2983, 29922, 1839, 4617, 1367, 742, 525, 12673, 742, 525, 13509, 401, 742, 525, 29879, 1516, 262, 742, 525, 29879, 1516, 449, 742, 525, 4804, 262, 742, 525, 4804, 449, 742, 525, 14168, 300, 7464, 6088, 29918, 15190, 29922, 1839, 12673, 7464, 2635, 29918, 16680, 29922, 5510, 29897, 6552, 6088, 29918, 15190, 29922, 1839, 12673, 11287, 13, 1678, 22780, 11139, 29906, 353, 22780, 11139, 29906, 29889, 842, 29918, 2248, 877, 12673, 1495, 13, 1678, 22780, 11139, 29906, 1839, 18721, 2033, 353, 22780, 11139, 29906, 29889, 2248, 29889, 18721, 13, 1678, 22780, 11139, 29906, 1839, 18448, 3250, 2033, 353, 22780, 11139, 29906, 29889, 2248, 29889, 18448, 3250, 13, 1678, 22780, 11139, 29906, 353, 22780, 11139, 29906, 29889, 27789, 18959, 18721, 3788, 18448, 3250, 742, 525, 4617, 1367, 7464, 408, 29918, 2248, 29922, 8824, 467, 2083, 580, 13, 13, 1678, 22780, 11139, 353, 22780, 11139, 29889, 4397, 29898, 18337, 11139, 29906, 29897, 13, 13, 18337, 11139, 1839, 13140, 2033, 353, 22780, 11139, 1839, 18721, 2033, 718, 313, 18337, 11139, 1839, 18448, 3250, 2033, 29930, 29906, 29946, 29897, 13, 18337, 11139, 29889, 2813, 580, 13, 13, 29937, 16032, 278, 8783, 448, 25720, 24182, 13, 1457, 7334, 7018, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 1457, 7334, 7018, 29899, 509, 296, 1789, 29889, 7638, 742, 16345, 29922, 742, 742, 2983, 29922, 1839, 12673, 3788, 4617, 1367, 3788, 524, 575, 537, 7464, 8025, 543, 9420, 29899, 29947, 29899, 18816, 613, 6088, 29918, 15190, 29922, 1839, 12673, 7464, 2635, 29918, 16680, 29922, 5510, 29897, 13, 13, 1457, 7334, 7018, 29918, 2176, 353, 25720, 7018, 29918, 2176, 29889, 842, 29918, 2248, 18959, 12673, 7464, 5768, 29922, 8824, 29897, 13, 1457, 7334, 7018, 29918, 2176, 353, 25720, 7018, 29918, 2176, 29889, 27789, 18959, 4617, 1367, 7464, 408, 29918, 2248, 29922, 8824, 467, 12676, 580, 13, 1457, 7334, 7018, 29918, 2176, 29889, 2813, 580, 13, 13, 29937, 16032, 278, 8783, 448, 9763, 13, 15753, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 15753, 29889, 7638, 742, 16345, 29922, 742, 742, 8025, 543, 9420, 29899, 29947, 29899, 18816, 613, 6088, 29918, 15190, 29922, 1839, 1256, 11287, 13, 15753, 29918, 2176, 29889, 2813, 580, 13, 13, 29937, 16032, 278, 6856, 29892, 7625, 515, 278, 1737, 29877, 3126, 29889, 450, 16874, 756, 1060, 29892, 612, 10350, 322, 19413, 1367, 13, 7638, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 7720, 29918, 509, 296, 1789, 29889, 7638, 1495, 13, 13, 29937, 4702, 479, 11799, 29918, 2176, 411, 9699, 27820, 800, 29892, 27831, 491, 3038, 1367, 13, 14634, 353, 10518, 29889, 14634, 29898, 18337, 11139, 29889, 27789, 18959, 4617, 1367, 7464, 408, 29918, 2248, 29922, 8824, 467, 2083, 3285, 11799, 29918, 2176, 29892, 373, 2433, 4617, 1367, 1495, 13, 13, 29937, 7338, 1461, 278, 3291, 363, 15090, 2109, 13, 9748, 29918, 29916, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29990, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 9748, 29918, 29891, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29979, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 29883, 353, 7442, 29889, 2378, 4197, 29916, 1839, 14168, 300, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 13, 29937, 1605, 296, 1789, 29915, 29879, 3216, 292, 1884, 13, 29874, 353, 313, 29946, 29945, 29889, 29953, 29955, 29941, 29900, 29953, 29947, 29906, 29906, 29906, 29955, 29945, 29945, 29896, 29892, 29871, 29896, 29900, 29889, 29946, 29945, 29906, 29896, 29945, 29929, 29946, 29929, 29953, 29947, 29941, 29945, 29946, 29897, 13, 29890, 353, 313, 29946, 29953, 29889, 29945, 29941, 29906, 29955, 29953, 29929, 29929, 29929, 29929, 29906, 29955, 29955, 29941, 29892, 29871, 29896, 29896, 29889, 29929, 29953, 29906, 29955, 29896, 29941, 29941, 29945, 29900, 29941, 29947, 29906, 29947, 29897, 13, 13, 29937, 1605, 296, 1789, 8267, 1445, 13, 29937, 1732, 597, 29881, 2219, 29889, 509, 296, 1789, 29889, 277, 29914, 24713, 29914, 2576, 568, 29899, 510, 558, 575, 4108, 280, 29899, 29900, 29906, 29955, 29896, 29946, 29900, 29914, 10314, 29914, 600, 29896, 29888, 29896, 29953, 29947, 29955, 29899, 29941, 29888, 29947, 29888, 29899, 29946, 29906, 29955, 29872, 29899, 29947, 29946, 29881, 29929, 29899, 6854, 29946, 29900, 29883, 29947, 29890, 29929, 29890, 29929, 29947, 29874, 13, 29885, 353, 4886, 331, 481, 29898, 5066, 29918, 29900, 353, 313, 29874, 29961, 29900, 10062, 29890, 29961, 29900, 2314, 29914, 29906, 29892, 23123, 29918, 29900, 353, 313, 29874, 29961, 29896, 10062, 29890, 29961, 29896, 2314, 29914, 29906, 29892, 321, 567, 29887, 29922, 29946, 29941, 29906, 29953, 29892, 11148, 7283, 29876, 2096, 265, 29922, 29874, 29961, 29896, 1402, 645, 7283, 29876, 2096, 271, 29922, 29874, 29961, 29900, 1402, 332, 7283, 29876, 2096, 265, 29922, 29890, 29961, 29896, 1402, 332, 7283, 29876, 2096, 271, 29922, 29890, 29961, 29900, 1402, 29897, 13, 29885, 29889, 949, 12181, 1445, 877, 29876, 1535, 29914, 4850, 3788, 2308, 296, 1789, 29918, 12181, 1445, 742, 2927, 2433, 29900, 29889, 29941, 29945, 1495, 13, 13, 29883, 1958, 353, 22985, 17669, 358, 287, 1625, 555, 481, 29889, 3166, 29918, 1761, 703, 808, 309, 613, 269, 1983, 29889, 2780, 29918, 29886, 26456, 703, 29934, 29881, 3727, 29918, 29878, 613, 29871, 29955, 9601, 29896, 29901, 2314, 13, 572, 29873, 29889, 9573, 29918, 29883, 1958, 29898, 29883, 1958, 29922, 29883, 1958, 29897, 13, 29885, 29889, 20970, 2109, 29898, 9748, 29918, 29916, 29892, 3291, 29918, 29891, 29892, 274, 1958, 543, 808, 309, 613, 6856, 2311, 29922, 29945, 29900, 29892, 315, 29922, 29883, 29892, 289, 1144, 2433, 1188, 742, 1375, 20047, 29922, 29896, 29897, 13, 29879, 1983, 29889, 2783, 26215, 29898, 1563, 29922, 5574, 29892, 5970, 29922, 5574, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 1958, 29889, 5140, 742, 3402, 2433, 5140, 742, 270, 1631, 29922, 29941, 29941, 29900, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 13, 13, 29937, 16032, 278, 8783, 448, 5264, 9505, 344, 29892, 7625, 515, 278, 1737, 29877, 3126, 13, 24911, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 2914, 29906, 29889, 7638, 742, 16345, 29922, 742, 742, 8025, 543, 9420, 29899, 29947, 29899, 18816, 613, 6088, 29918, 15190, 29922, 1839, 11600, 11287, 13, 9748, 29918, 29916, 353, 7442, 29889, 2378, 4197, 29916, 1839, 479, 290, 5228, 29889, 479, 290, 29914, 1111, 24266, 29914, 29900, 2033, 363, 474, 29892, 29916, 297, 5264, 29918, 2176, 29889, 1524, 5727, 580, 2314, 13, 9748, 29918, 29891, 353, 7442, 29889, 2378, 4197, 29916, 1839, 479, 290, 5228, 29889, 479, 290, 29914, 1111, 24266, 29914, 29896, 2033, 363, 474, 29892, 29916, 297, 5264, 29918, 2176, 29889, 1524, 5727, 580, 2314, 13, 13, 29885, 353, 4886, 331, 481, 29898, 5066, 29918, 29900, 353, 313, 29874, 29961, 29900, 10062, 29890, 29961, 29900, 2314, 29914, 29906, 29892, 23123, 29918, 29900, 353, 313, 29874, 29961, 29896, 10062, 29890, 29961, 29896, 2314, 29914, 29906, 29892, 321, 567, 29887, 29922, 29946, 29941, 29906, 29953, 29892, 11148, 7283, 29876, 2096, 265, 29922, 29874, 29961, 29896, 1402, 11148, 7283, 29876, 2096, 271, 29922, 29874, 29961, 29900, 1402, 318, 2214, 27539, 2096, 265, 29922, 29890, 29961, 29896, 1402, 318, 2214, 27539, 2096, 271, 29922, 29890, 29961, 29900, 1402, 29897, 13, 29885, 29889, 949, 12181, 1445, 877, 29876, 1535, 29914, 4850, 742, 525, 2308, 296, 1789, 29918, 12181, 1445, 742, 2927, 2433, 29900, 29889, 29941, 29945, 1495, 13, 13, 29885, 29889, 20970, 2109, 29898, 9748, 29918, 29916, 29892, 3291, 29918, 29891, 29892, 274, 1958, 543, 808, 309, 613, 6856, 2311, 29922, 29945, 29900, 29892, 289, 1144, 2433, 1188, 742, 1375, 20047, 29922, 29896, 29897, 13, 29879, 1983, 29889, 2783, 26215, 29898, 1563, 29922, 5574, 29892, 5970, 29922, 5574, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 1958, 29918, 24911, 29889, 5140, 742, 3402, 2433, 5140, 742, 270, 1631, 29922, 29941, 29941, 29900, 29892, 29890, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 13, 29937, 24836, 2910, 13, 1220, 29918, 2176, 353, 10518, 29889, 949, 29918, 7638, 877, 29876, 1535, 29914, 1220, 29889, 7638, 742, 16345, 29922, 742, 742, 8025, 543, 9420, 29899, 29947, 29899, 18816, 1159, 13, 1220, 29918, 2176, 1839, 4617, 1367, 2033, 353, 1196, 29918, 2176, 1839, 29903, 13356, 29909, 1525, 1367, 2033, 13, 14634, 353, 10518, 29889, 14634, 29898, 1220, 29918, 2176, 29889, 27789, 18959, 4617, 1367, 7464, 408, 29918, 2248, 29922, 8824, 467, 2083, 3285, 11799, 29918, 2176, 29892, 373, 2433, 4617, 1367, 1495, 13, 9748, 29918, 29916, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29990, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 9748, 29918, 29891, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29979, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 29883, 353, 7442, 29889, 2378, 4197, 29916, 1839, 16514, 29918, 7466, 2965, 29909, 29999, 2725, 29902, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 13, 29885, 353, 4886, 331, 481, 29898, 5066, 29918, 29900, 353, 313, 29874, 29961, 29900, 10062, 29890, 29961, 29900, 2314, 29914, 29906, 29892, 23123, 29918, 29900, 353, 313, 29874, 29961, 29896, 10062, 29890, 29961, 29896, 2314, 29914, 29906, 29892, 321, 567, 29887, 29922, 29946, 29941, 29906, 29953, 29892, 11148, 7283, 29876, 2096, 265, 29922, 29874, 29961, 29896, 1402, 645, 7283, 29876, 2096, 271, 29922, 29874, 29961, 29900, 1402, 332, 7283, 29876, 2096, 265, 29922, 29890, 29961, 29896, 1402, 332, 7283, 29876, 2096, 271, 29922, 29890, 29961, 29900, 1402, 29897, 13, 29885, 29889, 949, 12181, 1445, 877, 29876, 1535, 29914, 4850, 3788, 2308, 296, 1789, 29918, 12181, 1445, 742, 2927, 2433, 29900, 29889, 29941, 29945, 1495, 13, 13, 29885, 29889, 20970, 2109, 29898, 9748, 29918, 29916, 29892, 3291, 29918, 29891, 29892, 274, 1958, 543, 808, 309, 613, 6856, 2311, 29922, 29945, 29900, 29892, 289, 1144, 2433, 1188, 742, 315, 29922, 29883, 29892, 1375, 20047, 29922, 29896, 29897, 13, 29879, 1983, 29889, 2783, 26215, 29898, 1563, 29922, 5574, 29892, 5970, 29922, 5574, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 1958, 29918, 1220, 29889, 5140, 742, 3402, 2433, 5140, 742, 270, 1631, 29922, 29941, 29941, 29900, 29892, 29890, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 13, 13, 29937, 349, 4361, 29886, 7018, 2910, 13, 14634, 353, 10518, 29889, 14634, 29898, 1457, 7334, 7018, 29918, 2176, 29892, 11799, 29918, 2176, 29892, 373, 2433, 4617, 1367, 1495, 13, 9748, 29918, 29916, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29990, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 9748, 29918, 29891, 353, 7442, 29889, 2378, 4197, 29916, 1839, 29979, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 29883, 353, 7442, 29889, 2378, 4197, 29916, 1839, 524, 575, 537, 2033, 363, 474, 29892, 29916, 297, 10366, 29889, 1524, 5727, 580, 2314, 13, 13, 29885, 353, 4886, 331, 481, 29898, 5066, 29918, 29900, 353, 313, 29874, 29961, 29900, 10062, 29890, 29961, 29900, 2314, 29914, 29906, 29892, 23123, 29918, 29900, 353, 313, 29874, 29961, 29896, 10062, 29890, 29961, 29896, 2314, 29914, 29906, 29892, 321, 567, 29887, 29922, 29946, 29941, 29906, 29953, 29892, 11148, 7283, 29876, 2096, 265, 29922, 29874, 29961, 29896, 1402, 11148, 7283, 29876, 2096, 271, 29922, 29874, 29961, 29900, 1402, 318, 2214, 27539, 2096, 265, 29922, 29890, 29961, 29896, 1402, 318, 2214, 27539, 2096, 271, 29922, 29890, 29961, 29900, 1402, 29897, 13, 29885, 29889, 949, 12181, 1445, 877, 29876, 1535, 29914, 4850, 742, 525, 2308, 296, 1789, 29918, 12181, 1445, 742, 2927, 2433, 29900, 29889, 29941, 29945, 1495, 13, 13, 29885, 29889, 20970, 2109, 29898, 9748, 29918, 29916, 29892, 3291, 29918, 29891, 29892, 274, 1958, 543, 808, 309, 613, 6856, 2311, 29922, 29945, 29900, 29892, 289, 1144, 2433, 1188, 742, 315, 29922, 29883, 29892, 1375, 20047, 29922, 29896, 29897, 13, 29879, 1983, 29889, 2783, 26215, 29898, 1563, 29922, 5574, 29892, 5970, 29922, 5574, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 1958, 29918, 1457, 7334, 7018, 29889, 5140, 742, 3402, 2433, 5140, 742, 270, 1631, 29922, 29941, 29941, 29900, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 13, 13, 29937, 10130, 2910, 13, 9748, 29918, 29916, 353, 7442, 29889, 2378, 4197, 29916, 1839, 479, 290, 5228, 29889, 479, 290, 29914, 1111, 24266, 29914, 29900, 2033, 363, 474, 29892, 29916, 297, 9763, 29918, 2176, 29889, 1524, 5727, 580, 2314, 13, 9748, 29918, 29891, 353, 7442, 29889, 2378, 4197, 29916, 1839, 479, 290, 5228, 29889, 479, 290, 29914, 1111, 24266, 29914, 29896, 2033, 363, 474, 29892, 29916, 297, 9763, 29918, 2176, 29889, 1524, 5727, 580, 2314, 13, 13, 29885, 353, 4886, 331, 481, 29898, 5066, 29918, 29900, 353, 313, 29874, 29961, 29900, 10062, 29890, 29961, 29900, 2314, 29914, 29906, 29892, 23123, 29918, 29900, 353, 313, 29874, 29961, 29896, 10062, 29890, 29961, 29896, 2314, 29914, 29906, 29892, 321, 567, 29887, 29922, 29946, 29941, 29906, 29953, 29892, 11148, 7283, 29876, 2096, 265, 29922, 29874, 29961, 29896, 1402, 645, 7283, 29876, 2096, 271, 29922, 29874, 29961, 29900, 1402, 332, 7283, 29876, 2096, 265, 29922, 29890, 29961, 29896, 1402, 332, 7283, 29876, 2096, 271, 29922, 29890, 29961, 29900, 1402, 29897, 13, 29885, 29889, 949, 12181, 1445, 877, 29876, 1535, 29914, 4850, 3788, 2308, 296, 1789, 29918, 12181, 1445, 742, 2927, 2433, 29900, 29889, 29941, 29945, 1495, 13, 13, 29885, 29889, 20970, 2109, 29898, 9748, 29918, 29916, 29892, 3291, 29918, 29891, 29892, 274, 1958, 543, 808, 309, 613, 6856, 2311, 29922, 29941, 29945, 29892, 289, 1144, 2433, 1188, 742, 1375, 20047, 29922, 29896, 29897, 13, 29879, 1983, 29889, 2783, 26215, 29898, 1563, 29922, 5574, 29892, 5970, 29922, 5574, 29897, 13, 572, 29873, 29889, 7620, 1003, 877, 1958, 29918, 15753, 29889, 5140, 742, 3402, 2433, 5140, 742, 270, 1631, 29922, 29941, 29941, 29900, 29892, 29890, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 13, 13, 13, 13, 2 ]
scripts/extract_user_sudo_privileges.py
worr/sysops-api
40
27665
#!/usr/bin/python2.6 # (c) [2013] LinkedIn Corp. All rights reserved. # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. from optparse import OptionParser import sys sys.path.append("/usr/local/admin") import sysopsapi.cache_extractor ########################################################################## def main(): parser = OptionParser(usage="usage: %prog [options]", version="%prog 1.0") parser.add_option("--verbose", action="store_true", dest="verbose", default=False, help="Enable verbose execution") parser.add_option("--range-query", action="store", dest="range_query", help="Specify a range cluster of hosts you which to use to use to make queries against.") parser.add_option("--user", action="store", dest="user", help="Specify a unix user uid or id that you are interested in searching for.") (options, args) = parser.parse_args() ina_groups = [] ina_group_file = open( '/etc/sudo.d/sudoers-USERS_GROUP_WORLD_READABLE', 'r').readlines() for line in ina_group_file: if options.user in line: ina_groups.append(line.split()[1]) sudoers_rules = {} sudoers_file = open('/etc/sudo.d/sudoers_WORLD_READABLE', 'r').readlines() for line in sudoers_file: if " = " in line: ina_group = line.split()[0].strip() machine_group = line.split()[1].strip() privs = line.split('=')[1].strip() if ina_group in ina_groups: sudoers_rules[machine_group] = privs cache_results = sysopsapi.cache_extractor.CacheExtractor(verbose=options.verbose, scope='global', contents=True, range_query=options.range_query, search_string='sudoers-MACHINE_GROUP') for key in cache_results._gold.iterkeys(): host = key.split('#')[0] for line in cache_results._gold[key].splitlines(): if "Host_Alias" in line: system_machine_group = line.split()[1] if sudoers_rules.get(system_machine_group): print ("user: " + options.user).ljust(0) + \ ("privs: " + sudoers_rules.get(system_machine_group)).center(40) + \ ("host: " + host).center(40) + \ ("machine_group: " + system_machine_group).rjust(10) ########################################################################## if __name__ == '__main__': main()
[ 1, 18787, 4855, 29914, 2109, 29914, 4691, 29906, 29889, 29953, 13, 13, 29937, 313, 29883, 29897, 518, 29906, 29900, 29896, 29941, 29962, 28547, 797, 2994, 29886, 29889, 2178, 10462, 21676, 29889, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 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, 29871, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 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, 13, 3166, 3523, 5510, 1053, 10831, 11726, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 11974, 4855, 29914, 2997, 29914, 6406, 1159, 13, 5215, 10876, 3554, 2754, 29889, 8173, 29918, 21111, 272, 13, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 10831, 11726, 29898, 21125, 543, 21125, 29901, 1273, 29097, 518, 6768, 29962, 613, 13, 462, 3986, 1873, 543, 29995, 29097, 29871, 29896, 29889, 29900, 1159, 13, 1678, 13812, 29889, 1202, 29918, 3385, 703, 489, 369, 15828, 613, 13, 462, 418, 3158, 543, 8899, 29918, 3009, 613, 13, 462, 418, 2731, 543, 369, 15828, 613, 13, 462, 418, 2322, 29922, 8824, 29892, 13, 462, 418, 1371, 543, 20701, 26952, 8225, 1159, 13, 1678, 13812, 29889, 1202, 29918, 3385, 703, 489, 3881, 29899, 1972, 613, 13, 462, 418, 3158, 543, 8899, 613, 13, 462, 418, 2731, 543, 3881, 29918, 1972, 613, 13, 462, 418, 1371, 543, 10299, 1598, 263, 3464, 9867, 310, 18982, 366, 607, 304, 671, 304, 671, 304, 1207, 9365, 2750, 23157, 13, 1678, 13812, 29889, 1202, 29918, 3385, 703, 489, 1792, 613, 13, 462, 418, 3158, 543, 8899, 613, 13, 462, 418, 2731, 543, 1792, 613, 13, 462, 418, 1371, 543, 10299, 1598, 263, 28167, 1404, 318, 333, 470, 1178, 393, 366, 526, 8852, 297, 11975, 363, 23157, 13, 13, 1678, 313, 6768, 29892, 6389, 29897, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 297, 29874, 29918, 13155, 353, 5159, 13, 1678, 297, 29874, 29918, 2972, 29918, 1445, 353, 1722, 29898, 13, 4706, 8207, 7070, 29914, 15360, 29889, 29881, 29914, 15360, 414, 29899, 11889, 29903, 29918, 26284, 29918, 11686, 10249, 29918, 16310, 6181, 742, 525, 29878, 2824, 949, 9012, 580, 13, 1678, 363, 1196, 297, 297, 29874, 29918, 2972, 29918, 1445, 29901, 13, 4706, 565, 3987, 29889, 1792, 297, 1196, 29901, 13, 9651, 297, 29874, 29918, 13155, 29889, 4397, 29898, 1220, 29889, 5451, 580, 29961, 29896, 2314, 13, 13, 1678, 9196, 414, 29918, 19238, 353, 6571, 13, 1678, 9196, 414, 29918, 1445, 353, 1722, 11219, 7070, 29914, 15360, 29889, 29881, 29914, 15360, 414, 29918, 11686, 10249, 29918, 16310, 6181, 742, 525, 29878, 2824, 949, 9012, 580, 13, 1678, 363, 1196, 297, 9196, 414, 29918, 1445, 29901, 13, 4706, 565, 376, 353, 376, 297, 1196, 29901, 13, 9651, 297, 29874, 29918, 2972, 353, 1196, 29889, 5451, 580, 29961, 29900, 1822, 17010, 580, 13, 9651, 4933, 29918, 2972, 353, 1196, 29889, 5451, 580, 29961, 29896, 1822, 17010, 580, 13, 9651, 5999, 29879, 353, 1196, 29889, 5451, 877, 29922, 29861, 29896, 1822, 17010, 580, 13, 13, 9651, 565, 297, 29874, 29918, 2972, 297, 297, 29874, 29918, 13155, 29901, 13, 18884, 9196, 414, 29918, 19238, 29961, 23523, 29918, 2972, 29962, 353, 5999, 29879, 13, 13, 1678, 7090, 29918, 9902, 353, 10876, 3554, 2754, 29889, 8173, 29918, 21111, 272, 29889, 10408, 5647, 28891, 29898, 369, 15828, 29922, 6768, 29889, 369, 15828, 29892, 13, 462, 462, 462, 29871, 6874, 2433, 10945, 742, 13, 462, 462, 462, 29871, 8118, 29922, 5574, 29892, 13, 462, 462, 462, 29871, 3464, 29918, 1972, 29922, 6768, 29889, 3881, 29918, 1972, 29892, 13, 462, 462, 462, 29871, 2740, 29918, 1807, 2433, 15360, 414, 29899, 1529, 3210, 8895, 29918, 26284, 1495, 13, 13, 1678, 363, 1820, 297, 7090, 29918, 9902, 3032, 29887, 1025, 29889, 1524, 8149, 7295, 13, 4706, 3495, 353, 1820, 29889, 5451, 14237, 29861, 29900, 29962, 13, 4706, 363, 1196, 297, 7090, 29918, 9902, 3032, 29887, 1025, 29961, 1989, 1822, 5451, 9012, 7295, 13, 9651, 565, 376, 8514, 29918, 29909, 18849, 29908, 297, 1196, 29901, 13, 18884, 1788, 29918, 23523, 29918, 2972, 353, 1196, 29889, 5451, 580, 29961, 29896, 29962, 13, 18884, 565, 9196, 414, 29918, 19238, 29889, 657, 29898, 5205, 29918, 23523, 29918, 2972, 1125, 13, 462, 1678, 1596, 4852, 1792, 29901, 376, 718, 3987, 29889, 1792, 467, 29880, 5143, 29898, 29900, 29897, 718, 320, 13, 462, 3986, 4852, 22534, 29879, 29901, 376, 718, 9196, 414, 29918, 19238, 29889, 657, 29898, 5205, 29918, 23523, 29918, 2972, 8106, 5064, 29898, 29946, 29900, 29897, 718, 320, 13, 462, 3986, 4852, 3069, 29901, 376, 718, 3495, 467, 5064, 29898, 29946, 29900, 29897, 718, 320, 13, 462, 3986, 4852, 23523, 29918, 2972, 29901, 376, 718, 1788, 29918, 23523, 29918, 2972, 467, 29878, 5143, 29898, 29896, 29900, 29897, 13, 13, 13383, 13383, 13383, 13383, 7346, 2277, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
tests/unit/test_validate.py
DavidBakerEffendi/nlapi-python
36
196859
<reponame>DavidBakerEffendi/nlapi-python<filename>tests/unit/test_validate.py # Copyright (c) 2020 original authors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an \"AS IS\" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. from unittest.mock import patch from expertai.nlapi.common.errors import ParameterError from expertai.nlapi.cloud.validate import ExpertAiValidation from tests import BaseTestCase class ValidationTests(BaseTestCase): def setUp(self): super().setUp() self.validation_klass = ExpertAiValidation() def test_the_language_code_is_not_among_those_permitted(self): """ ...then the value should not be considered correct """ self.assertFalse( self.validation_klass.language_value_is_correct(language="sv") ) def test_the_resource_is_not_among_those_permitted(self): """ ...then the value should not be considered correct """ self.assertFalse( self.validation_klass.resource_value_is_correct( resource="document" ) ) @patch("expertai.nlapi.cloud.validate.ExpertAiValidation.language_value_is_correct") def test_the_parameter_to_be_validated_is_the_language( self, patched_method ): """ ...then verify language_value_is_correct() is called """ self.validation_klass.check_value(param_name="language", value="it") patched_method.assert_called_once_with(language="it") @patch("expertai.nlapi.cloud.validate.ExpertAiValidation.resource_value_is_correct") def test_the_parameter_to_be_validated_is_the_resource( self, patched_method ): """ ...then verify resource_value_is_correct() is called """ self.validation_klass.check_value( param_name="resource", value="disambiguation" ) patched_method.assert_called_once_with(resource="disambiguation") def test_parameter_name_is_wrong(self): """ ...then the validation should fail immediately """ self.assertRaises( ParameterError, self.validation_klass.check_name, param_name="lang" ) def test_when_parameter_name_is_correct_but_the_value_is_wrong(self): """ ...then the validation should still fail This test implicitly verifies that the two check_name and check_value methods are sequentially invoked """ self.assertRaises( ParameterError, self.validation_klass.check_value, param_name="language", value="sv", )
[ 1, 529, 276, 1112, 420, 29958, 19504, 29933, 5790, 29923, 600, 26464, 29914, 29876, 433, 1631, 29899, 4691, 29966, 9507, 29958, 21150, 29914, 5441, 29914, 1688, 29918, 15480, 29889, 2272, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29900, 2441, 15717, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 2045, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 13218, 3289, 8519, 5931, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 3166, 443, 27958, 29889, 17640, 1053, 13261, 13, 13, 3166, 2902, 941, 29875, 29889, 29876, 433, 1631, 29889, 9435, 29889, 12523, 1053, 24953, 2392, 13, 3166, 2902, 941, 29875, 29889, 29876, 433, 1631, 29889, 9274, 29889, 15480, 1053, 1222, 10700, 29909, 29875, 19448, 13, 3166, 6987, 1053, 7399, 3057, 8259, 13, 13, 13, 1990, 15758, 362, 24376, 29898, 5160, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 2428, 2141, 842, 3373, 580, 13, 4706, 1583, 29889, 18157, 29918, 29895, 605, 353, 1222, 10700, 29909, 29875, 19448, 580, 13, 13, 1678, 822, 1243, 29918, 1552, 29918, 11675, 29918, 401, 29918, 275, 29918, 1333, 29918, 314, 549, 29918, 386, 852, 29918, 17858, 4430, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 278, 995, 881, 451, 367, 5545, 1959, 13, 4706, 9995, 13, 4706, 1583, 29889, 9294, 8824, 29898, 13, 9651, 1583, 29889, 18157, 29918, 29895, 605, 29889, 11675, 29918, 1767, 29918, 275, 29918, 15728, 29898, 11675, 543, 4501, 1159, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 1552, 29918, 10314, 29918, 275, 29918, 1333, 29918, 314, 549, 29918, 386, 852, 29918, 17858, 4430, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 278, 995, 881, 451, 367, 5545, 1959, 13, 4706, 9995, 13, 4706, 1583, 29889, 9294, 8824, 29898, 13, 9651, 1583, 29889, 18157, 29918, 29895, 605, 29889, 10314, 29918, 1767, 29918, 275, 29918, 15728, 29898, 13, 18884, 6503, 543, 3225, 29908, 13, 9651, 1723, 13, 4706, 1723, 13, 13, 1678, 732, 5041, 703, 735, 546, 941, 29875, 29889, 29876, 433, 1631, 29889, 9274, 29889, 15480, 29889, 1252, 10700, 29909, 29875, 19448, 29889, 11675, 29918, 1767, 29918, 275, 29918, 15728, 1159, 13, 1678, 822, 1243, 29918, 1552, 29918, 15501, 29918, 517, 29918, 915, 29918, 3084, 630, 29918, 275, 29918, 1552, 29918, 11675, 29898, 13, 4706, 1583, 29892, 13261, 287, 29918, 5696, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 11539, 4086, 29918, 1767, 29918, 275, 29918, 15728, 580, 338, 2000, 13, 4706, 9995, 13, 4706, 1583, 29889, 18157, 29918, 29895, 605, 29889, 3198, 29918, 1767, 29898, 3207, 29918, 978, 543, 11675, 613, 995, 543, 277, 1159, 13, 4706, 13261, 287, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 11675, 543, 277, 1159, 13, 13, 1678, 732, 5041, 703, 735, 546, 941, 29875, 29889, 29876, 433, 1631, 29889, 9274, 29889, 15480, 29889, 1252, 10700, 29909, 29875, 19448, 29889, 10314, 29918, 1767, 29918, 275, 29918, 15728, 1159, 13, 1678, 822, 1243, 29918, 1552, 29918, 15501, 29918, 517, 29918, 915, 29918, 3084, 630, 29918, 275, 29918, 1552, 29918, 10314, 29898, 13, 4706, 1583, 29892, 13261, 287, 29918, 5696, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 11539, 6503, 29918, 1767, 29918, 275, 29918, 15728, 580, 338, 2000, 13, 4706, 9995, 13, 4706, 1583, 29889, 18157, 29918, 29895, 605, 29889, 3198, 29918, 1767, 29898, 13, 9651, 1828, 29918, 978, 543, 10314, 613, 995, 543, 18383, 29908, 13, 4706, 1723, 13, 4706, 13261, 287, 29918, 5696, 29889, 9294, 29918, 13998, 29918, 10646, 29918, 2541, 29898, 10314, 543, 18383, 1159, 13, 13, 1678, 822, 1243, 29918, 15501, 29918, 978, 29918, 275, 29918, 15866, 549, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 278, 8845, 881, 4418, 7389, 13, 4706, 9995, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 13, 9651, 24953, 2392, 29892, 1583, 29889, 18157, 29918, 29895, 605, 29889, 3198, 29918, 978, 29892, 1828, 29918, 978, 543, 3893, 29908, 13, 4706, 1723, 13, 13, 1678, 822, 1243, 29918, 8256, 29918, 15501, 29918, 978, 29918, 275, 29918, 15728, 29918, 4187, 29918, 1552, 29918, 1767, 29918, 275, 29918, 15866, 549, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 2023, 6098, 278, 8845, 881, 1603, 4418, 13, 13, 4706, 910, 1243, 27063, 1147, 11057, 393, 278, 1023, 1423, 29918, 978, 322, 1423, 29918, 1767, 13, 4706, 3519, 526, 8617, 9247, 22336, 13, 4706, 9995, 13, 4706, 1583, 29889, 9294, 29934, 1759, 267, 29898, 13, 9651, 24953, 2392, 29892, 13, 9651, 1583, 29889, 18157, 29918, 29895, 605, 29889, 3198, 29918, 1767, 29892, 13, 9651, 1828, 29918, 978, 543, 11675, 613, 13, 9651, 995, 543, 4501, 613, 13, 4706, 1723, 13, 2 ]
python/chronos/test/bigdl/chronos/data/experimental/test_xshardstsdataset.py
sgwhat/BigDL
0
6322
<reponame>sgwhat/BigDL # # Copyright 2016 The BigDL Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import pytest import numpy as np import pandas as pd import random import os from unittest import TestCase from bigdl.chronos.data import TSDataset from bigdl.chronos.data.experimental import XShardsTSDataset from bigdl.orca.data.pandas import read_csv from bigdl.orca.common import init_orca_context, stop_orca_context, OrcaContext from pandas.testing import assert_frame_equal from numpy.testing import assert_array_almost_equal def generate_spark_df(): init_orca_context(cores=8) sc = OrcaContext.get_spark_context() rdd = sc.range(0, 100) from pyspark.ml.linalg import DenseVector df = rdd.map(lambda x: (DenseVector(np.random.randn(1, ).astype(np.float)), int(np.random.randint(0, 2, size=())), int(x))).toDF(["feature", "id", "date"]) return df def get_ugly_ts_df(): data = np.random.random_sample((100, 5)) mask = np.random.random_sample((100, 5)) newmask = mask.copy() mask[newmask >= 0.4] = 2 mask[newmask < 0.4] = 1 mask[newmask < 0.2] = 0 data[mask == 0] = None data[mask == 1] = np.nan df = pd.DataFrame(data, columns=['a', 'b', 'c', 'd', 'e']) df['a'][0] = np.nan # make sure column 'a' has a N/A df["datetime"] = pd.date_range('1/1/2019', periods=100) df.loc[50:100, "datetime"] = pd.date_range('1/1/2019', periods=50) df["id"] = np.array(['00']*50 + ['01']*50) return df class TestXShardsTSDataset(TestCase): def setUp(self): self.resource_path = os.path.join(os.path.split(__file__)[0], "../../resources/") def tearDown(self): pass @classmethod def tearDownClass(cls): # stop possible active_spark_context from pyspark import SparkContext from bigdl.orca.ray import OrcaRayContext if SparkContext._active_spark_context is not None: print("Stopping spark_orca context") sc = SparkContext.getOrCreate() if sc.getConf().get("spark.master").startswith("spark://"): from bigdl.dllib.nncontext import stop_spark_standalone stop_spark_standalone() sc.stop() def test_xshardstsdataset_initialization(self): shards_single = read_csv(os.path.join(self.resource_path, "single.csv")) tsdata = XShardsTSDataset.from_xshards(shards_single, dt_col="datetime", target_col="value", extra_feature_col=["extra feature"], id_col="id") assert tsdata._id_list == [0] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 1 tsdata = XShardsTSDataset.from_xshards(shards_single, dt_col="datetime", target_col=["value"], extra_feature_col="extra feature", id_col="id") assert tsdata._id_list == [0] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 1 tsdata = XShardsTSDataset.from_xshards(shards_single, dt_col="datetime", target_col=["value"], extra_feature_col="extra feature") assert tsdata._id_list == ["0"] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 1 def test_xshardstsdataset_initialization_multiple(self): shards_multiple = read_csv(os.path.join(self.resource_path, "multiple.csv")) # legal input tsdata = XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col="value", extra_feature_col=["extra feature"], id_col="id") assert tsdata._id_list == [0, 1] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 2 tsdata = XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col=["value"], extra_feature_col="extra feature", id_col="id") assert tsdata._id_list == [0, 1] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 2 tsdata = XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col=["value"], extra_feature_col="extra feature") assert tsdata._id_list == ['0'] assert tsdata.feature_col == ["extra feature"] assert tsdata.target_col == ["value"] assert tsdata.dt_col == "datetime" assert tsdata.shards.num_partitions() == 1 def test_xshardstsdataset_split(self): shards_multiple = read_csv(os.path.join(self.resource_path, "multiple.csv")) # only train and test tsdata_train, tsdata_valid, tsdata_test =\ XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col="value", extra_feature_col=["extra feature"], id_col="id", with_split=True, val_ratio=0, test_ratio=0.1) # standard split with all three sets tsdata_train, tsdata_valid, tsdata_test =\ XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col="value", extra_feature_col=["extra feature"], id_col="id", with_split=True, val_ratio=0.1, test_ratio=0.1, largest_look_back=5, largest_horizon=2) tsdata_train.feature_col.append("new extra feature") assert len(tsdata_train.feature_col) == 2 assert len(tsdata_valid.feature_col) == 1 assert len(tsdata_test.feature_col) == 1 tsdata_train.target_col[0] = "new value" assert tsdata_train.target_col[0] == "new value" assert tsdata_valid.target_col[0] != "new value" assert tsdata_test.target_col[0] != "new value" def test_xshardstsdataset_roll_multiple_id(self): shards_multiple = read_csv(os.path.join(self.resource_path, "multiple.csv")) horizon = random.randint(1, 10) lookback = random.randint(1, 20) tsdata = XShardsTSDataset.from_xshards(shards_multiple, dt_col="datetime", target_col="value", extra_feature_col=["extra feature"], id_col="id") with pytest.raises(RuntimeError): tsdata.to_xshards() # roll train tsdata.roll(lookback=lookback, horizon=horizon) shards_numpy = tsdata.to_xshards() collected_numpy = shards_numpy.collect() # collect and valid x = np.concatenate([collected_numpy[i]['x'] for i in range(len(collected_numpy))], axis=0) y = np.concatenate([collected_numpy[i]['y'] for i in range(len(collected_numpy))], axis=0) assert x.shape == ((50-lookback-horizon+1)*2, lookback, 2) assert y.shape == ((50-lookback-horizon+1)*2, horizon, 1) tsdata.roll(lookback=lookback, horizon=horizon, feature_col=["extra feature"], target_col="value") shards_numpy = tsdata.to_xshards() collected_numpy = shards_numpy.collect() # collect and valid x = np.concatenate([collected_numpy[i]['x'] for i in range(len(collected_numpy))], axis=0) y = np.concatenate([collected_numpy[i]['y'] for i in range(len(collected_numpy))], axis=0) assert x.shape == ((50-lookback-horizon+1)*2, lookback, 2) assert y.shape == ((50-lookback-horizon+1)*2, horizon, 1) tsdata.roll(lookback=lookback, horizon=horizon, feature_col=[], target_col="value") shards_numpy = tsdata.to_xshards() collected_numpy = shards_numpy.collect() # collect and valid x = np.concatenate([collected_numpy[i]['x'] for i in range(len(collected_numpy))], axis=0) y = np.concatenate([collected_numpy[i]['y'] for i in range(len(collected_numpy))], axis=0) assert x.shape == ((50-lookback-horizon+1)*2, lookback, 1) assert y.shape == ((50-lookback-horizon+1)*2, horizon, 1) # roll test horizon = 0 lookback = random.randint(1, 20) tsdata.roll(lookback=lookback, horizon=horizon) shards_numpy = tsdata.to_xshards() collected_numpy = shards_numpy.collect() # collect and valid x = np.concatenate([collected_numpy[i]['x'] for i in range(len(collected_numpy))], axis=0) assert x.shape == ((50-lookback-horizon+1)*2, lookback, 2) def test_xshardstsdataset_impute(self): from tempfile import TemporaryDirectory tmp_df = get_ugly_ts_df() with TemporaryDirectory() as tmpdir: file_name = os.path.join(tmpdir, 'impute.csv') tmp_df.to_csv(file_name, index=False) shards_tmp = read_csv(file_name) for val in ["last", "const", "linear"]: tsdata = XShardsTSDataset.from_xshards(shards_tmp, dt_col="datetime", target_col="e", extra_feature_col=["a", "b", "c", "d"], id_col="id") tsdata.impute(mode=val) collected_df = tsdata.shards.collect() collected_df = pd.concat(collected_df, axis=0) assert collected_df.isna().sum().sum() == 0 assert len(collected_df) == 100 def test_xshardstsdataset_sparkdf(self): df = generate_spark_df() # with id tsdata = XShardsTSDataset.from_sparkdf(df, dt_col="date", target_col="feature", id_col="id") tsdata.roll(lookback=4, horizon=2) data = tsdata.to_xshards().collect() assert data[0]['x'].shape[1] == 4 assert data[0]['x'].shape[2] == 1 assert data[0]['y'].shape[1] == 2 assert data[0]['y'].shape[2] == 1 assert tsdata.shards.num_partitions() == 2 # with only 1 id tsdata = XShardsTSDataset.from_sparkdf(df, dt_col="date", target_col="feature") tsdata.roll(lookback=4, horizon=2) data = tsdata.to_xshards().collect() assert data[0]['x'].shape[1] == 4 assert data[0]['x'].shape[2] == 1 assert data[0]['y'].shape[1] == 2 assert data[0]['y'].shape[2] == 1 assert tsdata.shards.num_partitions() == 1
[ 1, 529, 276, 1112, 420, 29958, 5311, 5816, 29914, 6970, 19558, 13, 29937, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29953, 450, 7997, 19558, 13189, 943, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 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, 13, 5215, 11451, 1688, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 5215, 4036, 13, 5215, 2897, 13, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 3166, 4802, 11671, 29889, 5904, 359, 29889, 1272, 1053, 323, 7230, 271, 24541, 13, 3166, 4802, 11671, 29889, 5904, 359, 29889, 1272, 29889, 735, 27910, 1053, 1060, 2713, 3163, 29911, 7230, 271, 24541, 13, 3166, 4802, 11671, 29889, 272, 1113, 29889, 1272, 29889, 15112, 1053, 1303, 29918, 7638, 13, 3166, 4802, 11671, 29889, 272, 1113, 29889, 9435, 1053, 2069, 29918, 272, 1113, 29918, 4703, 29892, 5040, 29918, 272, 1113, 29918, 4703, 29892, 1394, 1113, 2677, 13, 13, 3166, 11701, 29889, 13424, 1053, 4974, 29918, 2557, 29918, 11745, 13, 3166, 12655, 29889, 13424, 1053, 4974, 29918, 2378, 29918, 284, 3242, 29918, 11745, 13, 13, 13, 1753, 5706, 29918, 12597, 29918, 2176, 7295, 13, 1678, 2069, 29918, 272, 1113, 29918, 4703, 29898, 29883, 2361, 29922, 29947, 29897, 13, 1678, 885, 353, 1394, 1113, 2677, 29889, 657, 29918, 12597, 29918, 4703, 580, 13, 1678, 364, 1289, 353, 885, 29889, 3881, 29898, 29900, 29892, 29871, 29896, 29900, 29900, 29897, 13, 1678, 515, 282, 952, 6378, 29889, 828, 29889, 29880, 979, 29887, 1053, 360, 1947, 12877, 13, 1678, 4489, 353, 364, 1289, 29889, 1958, 29898, 2892, 921, 29901, 313, 29928, 1947, 12877, 29898, 9302, 29889, 8172, 29889, 9502, 29876, 29898, 29896, 29892, 13742, 579, 668, 29898, 9302, 29889, 7411, 8243, 13, 462, 9651, 938, 29898, 9302, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 29871, 29906, 29892, 2159, 29922, 3101, 511, 13, 462, 9651, 938, 29898, 29916, 876, 467, 517, 4037, 29898, 3366, 14394, 613, 376, 333, 613, 376, 1256, 20068, 13, 1678, 736, 4489, 13, 13, 1753, 679, 29918, 688, 368, 29918, 1372, 29918, 2176, 7295, 13, 1678, 848, 353, 7442, 29889, 8172, 29889, 8172, 29918, 11249, 3552, 29896, 29900, 29900, 29892, 29871, 29945, 876, 13, 1678, 11105, 353, 7442, 29889, 8172, 29889, 8172, 29918, 11249, 3552, 29896, 29900, 29900, 29892, 29871, 29945, 876, 13, 1678, 716, 13168, 353, 11105, 29889, 8552, 580, 13, 1678, 11105, 29961, 1482, 13168, 6736, 29871, 29900, 29889, 29946, 29962, 353, 29871, 29906, 13, 1678, 11105, 29961, 1482, 13168, 529, 29871, 29900, 29889, 29946, 29962, 353, 29871, 29896, 13, 1678, 11105, 29961, 1482, 13168, 529, 29871, 29900, 29889, 29906, 29962, 353, 29871, 29900, 13, 1678, 848, 29961, 13168, 1275, 29871, 29900, 29962, 353, 6213, 13, 1678, 848, 29961, 13168, 1275, 29871, 29896, 29962, 353, 7442, 29889, 13707, 13, 1678, 4489, 353, 10518, 29889, 17271, 29898, 1272, 29892, 4341, 29922, 1839, 29874, 742, 525, 29890, 742, 525, 29883, 742, 525, 29881, 742, 525, 29872, 11287, 13, 1678, 4489, 1839, 29874, 2033, 29961, 29900, 29962, 353, 7442, 29889, 13707, 29871, 396, 1207, 1854, 1897, 525, 29874, 29915, 756, 263, 405, 29914, 29909, 13, 1678, 4489, 3366, 12673, 3108, 353, 10518, 29889, 1256, 29918, 3881, 877, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29929, 742, 23704, 29922, 29896, 29900, 29900, 29897, 13, 1678, 4489, 29889, 2029, 29961, 29945, 29900, 29901, 29896, 29900, 29900, 29892, 376, 12673, 3108, 353, 10518, 29889, 1256, 29918, 3881, 877, 29896, 29914, 29896, 29914, 29906, 29900, 29896, 29929, 742, 23704, 29922, 29945, 29900, 29897, 13, 1678, 4489, 3366, 333, 3108, 353, 7442, 29889, 2378, 18959, 29900, 29900, 2033, 29930, 29945, 29900, 718, 6024, 29900, 29896, 2033, 29930, 29945, 29900, 29897, 13, 1678, 736, 4489, 13, 13, 1990, 4321, 29990, 2713, 3163, 29911, 7230, 271, 24541, 29898, 3057, 8259, 1125, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 10314, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 22168, 1445, 1649, 9601, 29900, 1402, 376, 21546, 13237, 29914, 1159, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 268, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 734, 279, 6767, 2385, 29898, 25932, 1125, 13, 4706, 396, 5040, 1950, 6136, 29918, 12597, 29918, 4703, 13, 4706, 515, 282, 952, 6378, 1053, 20814, 2677, 13, 4706, 515, 4802, 11671, 29889, 272, 1113, 29889, 764, 1053, 1394, 1113, 29934, 388, 2677, 13, 4706, 565, 20814, 2677, 3032, 4925, 29918, 12597, 29918, 4703, 338, 451, 6213, 29901, 13, 9651, 1596, 703, 20754, 3262, 16267, 29918, 272, 1113, 3030, 1159, 13, 9651, 885, 353, 20814, 2677, 29889, 657, 2816, 4391, 580, 13, 9651, 565, 885, 29889, 657, 16376, 2141, 657, 703, 12597, 29889, 6207, 2564, 27382, 2541, 703, 12597, 597, 29908, 1125, 13, 18884, 515, 4802, 11671, 29889, 11671, 1982, 29889, 15755, 4703, 1053, 5040, 29918, 12597, 29918, 1689, 18785, 13, 18884, 5040, 29918, 12597, 29918, 1689, 18785, 580, 13, 9651, 885, 29889, 9847, 580, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 11228, 2133, 29898, 1311, 1125, 13, 4706, 528, 3163, 29918, 14369, 353, 1303, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 10314, 29918, 2084, 29892, 376, 14369, 29889, 7638, 5783, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 14369, 29892, 11636, 29918, 1054, 543, 12673, 613, 3646, 29918, 1054, 543, 1767, 613, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 1178, 29918, 1054, 543, 333, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 518, 29900, 29962, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29896, 13, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 14369, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 29922, 3366, 1767, 12436, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 543, 17833, 4682, 613, 1178, 29918, 1054, 543, 333, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 518, 29900, 29962, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29896, 13, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 14369, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 29922, 3366, 1767, 12436, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 543, 17833, 4682, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 6796, 29900, 3108, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29896, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 11228, 2133, 29918, 20787, 29898, 1311, 1125, 13, 4706, 528, 3163, 29918, 20787, 353, 1303, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 10314, 29918, 2084, 29892, 376, 20787, 29889, 7638, 5783, 13, 4706, 396, 11706, 1881, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 543, 1767, 613, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 1178, 29918, 1054, 543, 333, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 518, 29900, 29892, 29871, 29896, 29962, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29906, 13, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 29922, 3366, 1767, 12436, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 543, 17833, 4682, 613, 1178, 29918, 1054, 543, 333, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 518, 29900, 29892, 29871, 29896, 29962, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29906, 13, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 29922, 3366, 1767, 12436, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 543, 17833, 4682, 1159, 13, 4706, 4974, 18696, 1272, 3032, 333, 29918, 1761, 1275, 6024, 29900, 2033, 13, 4706, 4974, 18696, 1272, 29889, 14394, 29918, 1054, 1275, 6796, 17833, 4682, 3108, 13, 4706, 4974, 18696, 1272, 29889, 5182, 29918, 1054, 1275, 6796, 1767, 3108, 13, 4706, 4974, 18696, 1272, 29889, 6008, 29918, 1054, 1275, 376, 12673, 29908, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29896, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 5451, 29898, 1311, 1125, 13, 4706, 528, 3163, 29918, 20787, 353, 1303, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 10314, 29918, 2084, 29892, 376, 20787, 29889, 7638, 5783, 13, 4706, 396, 871, 7945, 322, 1243, 13, 4706, 18696, 1272, 29918, 14968, 29892, 18696, 1272, 29918, 3084, 29892, 18696, 1272, 29918, 1688, 17313, 13, 9651, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 3646, 29918, 1054, 543, 1767, 613, 13, 462, 462, 3986, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 1178, 29918, 1054, 543, 333, 613, 13, 462, 462, 3986, 411, 29918, 5451, 29922, 5574, 29892, 659, 29918, 3605, 601, 29922, 29900, 29892, 1243, 29918, 3605, 601, 29922, 29900, 29889, 29896, 29897, 13, 4706, 396, 3918, 6219, 411, 599, 2211, 6166, 13, 4706, 18696, 1272, 29918, 14968, 29892, 18696, 1272, 29918, 3084, 29892, 18696, 1272, 29918, 1688, 17313, 13, 9651, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 3646, 29918, 1054, 543, 1767, 613, 13, 462, 462, 3986, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 1178, 29918, 1054, 543, 333, 613, 13, 462, 462, 3986, 411, 29918, 5451, 29922, 5574, 29892, 659, 29918, 3605, 601, 29922, 29900, 29889, 29896, 29892, 1243, 29918, 3605, 601, 29922, 29900, 29889, 29896, 29892, 13, 462, 462, 3986, 10150, 29918, 6914, 29918, 1627, 29922, 29945, 29892, 10150, 29918, 2015, 18162, 29922, 29906, 29897, 13, 13, 4706, 18696, 1272, 29918, 14968, 29889, 14394, 29918, 1054, 29889, 4397, 703, 1482, 4805, 4682, 1159, 13, 4706, 4974, 7431, 29898, 1372, 1272, 29918, 14968, 29889, 14394, 29918, 1054, 29897, 1275, 29871, 29906, 13, 4706, 4974, 7431, 29898, 1372, 1272, 29918, 3084, 29889, 14394, 29918, 1054, 29897, 1275, 29871, 29896, 13, 4706, 4974, 7431, 29898, 1372, 1272, 29918, 1688, 29889, 14394, 29918, 1054, 29897, 1275, 29871, 29896, 13, 13, 4706, 18696, 1272, 29918, 14968, 29889, 5182, 29918, 1054, 29961, 29900, 29962, 353, 376, 1482, 995, 29908, 13, 4706, 4974, 18696, 1272, 29918, 14968, 29889, 5182, 29918, 1054, 29961, 29900, 29962, 1275, 376, 1482, 995, 29908, 13, 4706, 4974, 18696, 1272, 29918, 3084, 29889, 5182, 29918, 1054, 29961, 29900, 29962, 2804, 376, 1482, 995, 29908, 13, 4706, 4974, 18696, 1272, 29918, 1688, 29889, 5182, 29918, 1054, 29961, 29900, 29962, 2804, 376, 1482, 995, 29908, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 1245, 29918, 20787, 29918, 333, 29898, 1311, 1125, 13, 4706, 528, 3163, 29918, 20787, 353, 1303, 29918, 7638, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1311, 29889, 10314, 29918, 2084, 29892, 376, 20787, 29889, 7638, 5783, 13, 4706, 28205, 353, 4036, 29889, 9502, 524, 29898, 29896, 29892, 29871, 29896, 29900, 29897, 13, 4706, 1106, 1627, 353, 4036, 29889, 9502, 524, 29898, 29896, 29892, 29871, 29906, 29900, 29897, 13, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 20787, 29892, 11636, 29918, 1054, 543, 12673, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 543, 1767, 613, 13, 462, 462, 1669, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 1178, 29918, 1054, 543, 333, 1159, 13, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 9651, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 580, 13, 13, 4706, 396, 9679, 7945, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 6914, 1627, 29892, 28205, 29922, 2015, 18162, 29897, 13, 4706, 528, 3163, 29918, 23749, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 580, 13, 4706, 16531, 29918, 23749, 353, 528, 3163, 29918, 23749, 29889, 15914, 580, 29871, 396, 6314, 322, 2854, 13, 4706, 921, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29916, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 343, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29891, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 4974, 921, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 1106, 1627, 29892, 29871, 29906, 29897, 13, 4706, 4974, 343, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 28205, 29892, 29871, 29896, 29897, 13, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 6914, 1627, 29892, 28205, 29922, 2015, 18162, 29892, 13, 462, 1678, 4682, 29918, 1054, 29922, 3366, 17833, 4682, 12436, 3646, 29918, 1054, 543, 1767, 1159, 13, 4706, 528, 3163, 29918, 23749, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 580, 13, 4706, 16531, 29918, 23749, 353, 528, 3163, 29918, 23749, 29889, 15914, 580, 29871, 396, 6314, 322, 2854, 13, 4706, 921, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29916, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 343, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29891, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 4974, 921, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 1106, 1627, 29892, 29871, 29906, 29897, 13, 4706, 4974, 343, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 28205, 29892, 29871, 29896, 29897, 13, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 6914, 1627, 29892, 28205, 29922, 2015, 18162, 29892, 13, 462, 1678, 4682, 29918, 1054, 11759, 1402, 3646, 29918, 1054, 543, 1767, 1159, 13, 4706, 528, 3163, 29918, 23749, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 580, 13, 4706, 16531, 29918, 23749, 353, 528, 3163, 29918, 23749, 29889, 15914, 580, 29871, 396, 6314, 322, 2854, 13, 4706, 921, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29916, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 343, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29891, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 4974, 921, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 1106, 1627, 29892, 29871, 29896, 29897, 13, 4706, 4974, 343, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 28205, 29892, 29871, 29896, 29897, 13, 13, 4706, 396, 9679, 1243, 13, 4706, 28205, 353, 29871, 29900, 13, 4706, 1106, 1627, 353, 4036, 29889, 9502, 524, 29898, 29896, 29892, 29871, 29906, 29900, 29897, 13, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 6914, 1627, 29892, 28205, 29922, 2015, 18162, 29897, 13, 4706, 528, 3163, 29918, 23749, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 580, 13, 4706, 16531, 29918, 23749, 353, 528, 3163, 29918, 23749, 29889, 15914, 580, 29871, 396, 6314, 322, 2854, 13, 4706, 921, 353, 7442, 29889, 535, 29883, 2579, 403, 4197, 15914, 287, 29918, 23749, 29961, 29875, 22322, 29916, 2033, 363, 474, 297, 3464, 29898, 2435, 29898, 15914, 287, 29918, 23749, 876, 1402, 9685, 29922, 29900, 29897, 13, 4706, 4974, 921, 29889, 12181, 1275, 5135, 29945, 29900, 29899, 6914, 1627, 29899, 2015, 18162, 29974, 29896, 11877, 29906, 29892, 1106, 1627, 29892, 29871, 29906, 29897, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 326, 649, 29872, 29898, 1311, 1125, 13, 4706, 515, 5694, 1445, 1053, 6789, 1971, 653, 9882, 13, 4706, 13128, 29918, 2176, 353, 679, 29918, 688, 368, 29918, 1372, 29918, 2176, 580, 13, 4706, 411, 6789, 1971, 653, 9882, 580, 408, 13128, 3972, 29901, 13, 9651, 934, 29918, 978, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7050, 3972, 29892, 525, 326, 649, 29872, 29889, 7638, 1495, 13, 9651, 13128, 29918, 2176, 29889, 517, 29918, 7638, 29898, 1445, 29918, 978, 29892, 2380, 29922, 8824, 29897, 13, 9651, 528, 3163, 29918, 7050, 353, 1303, 29918, 7638, 29898, 1445, 29918, 978, 29897, 13, 308, 13, 9651, 363, 659, 297, 6796, 4230, 613, 376, 3075, 613, 376, 10660, 3108, 29901, 13, 18884, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 29916, 845, 3163, 29898, 845, 3163, 29918, 7050, 29892, 29871, 13, 462, 462, 462, 1678, 11636, 29918, 1054, 543, 12673, 613, 3646, 29918, 1054, 543, 29872, 613, 13, 462, 462, 9651, 4805, 29918, 14394, 29918, 1054, 29922, 3366, 29874, 613, 376, 29890, 613, 376, 29883, 613, 376, 29881, 12436, 1178, 29918, 1054, 543, 333, 1159, 13, 18884, 18696, 1272, 29889, 326, 649, 29872, 29898, 8513, 29922, 791, 29897, 13, 18884, 16531, 29918, 2176, 353, 18696, 1272, 29889, 845, 3163, 29889, 15914, 580, 13, 18884, 16531, 29918, 2176, 353, 10518, 29889, 17685, 29898, 15914, 287, 29918, 2176, 29892, 9685, 29922, 29900, 29897, 13, 462, 13, 18884, 4974, 16531, 29918, 2176, 29889, 275, 1056, 2141, 2083, 2141, 2083, 580, 1275, 29871, 29900, 13, 18884, 4974, 7431, 29898, 15914, 287, 29918, 2176, 29897, 1275, 29871, 29896, 29900, 29900, 13, 13, 1678, 822, 1243, 29918, 29916, 845, 538, 303, 29879, 24713, 29918, 12597, 2176, 29898, 1311, 1125, 13, 4706, 4489, 353, 5706, 29918, 12597, 29918, 2176, 580, 13, 13, 4706, 396, 411, 1178, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 12597, 2176, 29898, 2176, 29892, 11636, 29918, 1054, 543, 1256, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 543, 14394, 613, 13, 462, 462, 1669, 1178, 29918, 1054, 543, 333, 1159, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 29946, 29892, 28205, 29922, 29906, 29897, 13, 4706, 848, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 2141, 15914, 580, 13, 4706, 4974, 848, 29961, 29900, 22322, 29916, 13359, 12181, 29961, 29896, 29962, 1275, 29871, 29946, 13, 4706, 4974, 848, 29961, 29900, 22322, 29916, 13359, 12181, 29961, 29906, 29962, 1275, 29871, 29896, 13, 4706, 4974, 848, 29961, 29900, 22322, 29891, 13359, 12181, 29961, 29896, 29962, 1275, 29871, 29906, 13, 4706, 4974, 848, 29961, 29900, 22322, 29891, 13359, 12181, 29961, 29906, 29962, 1275, 29871, 29896, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29906, 13, 13, 4706, 396, 411, 871, 29871, 29896, 1178, 13, 4706, 18696, 1272, 353, 1060, 2713, 3163, 29911, 7230, 271, 24541, 29889, 3166, 29918, 12597, 2176, 29898, 2176, 29892, 11636, 29918, 1054, 543, 1256, 613, 13, 462, 462, 1669, 3646, 29918, 1054, 543, 14394, 1159, 13, 4706, 18696, 1272, 29889, 1245, 29898, 6914, 1627, 29922, 29946, 29892, 28205, 29922, 29906, 29897, 13, 4706, 848, 353, 18696, 1272, 29889, 517, 29918, 29916, 845, 3163, 2141, 15914, 580, 13, 4706, 4974, 848, 29961, 29900, 22322, 29916, 13359, 12181, 29961, 29896, 29962, 1275, 29871, 29946, 13, 4706, 4974, 848, 29961, 29900, 22322, 29916, 13359, 12181, 29961, 29906, 29962, 1275, 29871, 29896, 13, 4706, 4974, 848, 29961, 29900, 22322, 29891, 13359, 12181, 29961, 29896, 29962, 1275, 29871, 29906, 13, 4706, 4974, 848, 29961, 29900, 22322, 29891, 13359, 12181, 29961, 29906, 29962, 1275, 29871, 29896, 13, 4706, 4974, 18696, 1272, 29889, 845, 3163, 29889, 1949, 29918, 1595, 2187, 580, 1275, 29871, 29896, 13, 2 ]
shopkit/order/app.py
sakkada/django-shopkit
0
160295
from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404, render from django.utils.decorators import method_decorator from django.conf.urls import url from ..core.app import ShopKitApp class OrderApp(ShopKitApp): app_name = 'order' namespace = 'order' Order = None DeliveryGroup = None OrderLine = None order_list_templates = [ 'shopkit/order/list.html', ] order_details_templates = [ 'shopkit/order/view.html', ] def __init__(self, **kwargs): super(OrderApp, self).__init__(**kwargs) assert self.Order and self.DeliveryGroup and self.OrderLine, ( 'You need to subclass OrderApp and provide Order,' ' DeliveryGroup and OrderLine.' ) def get_order(self, request, order_token): orders = self.Order.objects.filter( user=request.user if request.user.is_authenticated else None) return get_object_or_404(orders, token=order_token) # Views methods section # --------------------- def get_urls(self): return [ url(r'^$', self.index, name='index'), url(r'^(?P<order_token>[\w-]+)/$', self.details, name='details'), ] @method_decorator(login_required) def index(self, request, **kwargs): orders = self.Order.objects.filter(user=request.user) context = self.get_context_data(request, orders=orders) return render(request, self.order_list_templates, context) def details(self, request, order_token, **kwargs): order = self.get_order(request, order_token=order_token) context = self.get_context_data(request, order=order) return render(request, self.order_details_templates, context)
[ 1, 515, 9557, 29889, 21570, 29889, 5150, 29889, 19557, 4097, 1053, 6464, 29918, 12403, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29892, 4050, 13, 3166, 9557, 29889, 13239, 29889, 19557, 4097, 1053, 1158, 29918, 19557, 1061, 13, 3166, 9557, 29889, 5527, 29889, 26045, 1053, 3142, 13, 3166, 6317, 3221, 29889, 932, 1053, 1383, 459, 13117, 2052, 13, 13, 13, 1990, 8170, 2052, 29898, 2713, 459, 13117, 2052, 1125, 13, 13, 1678, 623, 29918, 978, 353, 525, 2098, 29915, 13, 1678, 7397, 353, 525, 2098, 29915, 13, 13, 1678, 8170, 353, 6213, 13, 1678, 360, 27657, 4782, 353, 6213, 13, 1678, 8170, 3542, 353, 6213, 13, 13, 1678, 1797, 29918, 1761, 29918, 20943, 353, 518, 13, 4706, 525, 19032, 7354, 29914, 2098, 29914, 1761, 29889, 1420, 742, 13, 1678, 4514, 13, 1678, 1797, 29918, 14144, 29918, 20943, 353, 518, 13, 4706, 525, 19032, 7354, 29914, 2098, 29914, 1493, 29889, 1420, 742, 13, 1678, 4514, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 7514, 2052, 29892, 1583, 467, 1649, 2344, 12035, 1068, 19290, 29897, 13, 4706, 4974, 1583, 29889, 7514, 322, 1583, 29889, 29928, 27657, 4782, 322, 1583, 29889, 7514, 3542, 29892, 313, 13, 9651, 525, 3492, 817, 304, 19481, 8170, 2052, 322, 3867, 8170, 5501, 13, 9651, 525, 360, 27657, 4782, 322, 8170, 3542, 6169, 13, 4706, 1723, 13, 13, 1678, 822, 679, 29918, 2098, 29898, 1311, 29892, 2009, 29892, 1797, 29918, 6979, 1125, 13, 4706, 11299, 353, 1583, 29889, 7514, 29889, 12650, 29889, 4572, 29898, 13, 9651, 1404, 29922, 3827, 29889, 1792, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 1683, 6213, 29897, 13, 4706, 736, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 20488, 29892, 5993, 29922, 2098, 29918, 6979, 29897, 13, 13, 1678, 396, 4533, 29879, 3519, 4004, 13, 1678, 396, 448, 2683, 807, 13, 1678, 822, 679, 29918, 26045, 29898, 1311, 1125, 13, 4706, 736, 518, 13, 9651, 3142, 29898, 29878, 29915, 29985, 29938, 742, 1583, 29889, 2248, 29892, 1024, 2433, 2248, 5477, 13, 9651, 3142, 29898, 29878, 29915, 29985, 10780, 29925, 29966, 2098, 29918, 6979, 29958, 7110, 29893, 29899, 10062, 6802, 29938, 742, 1583, 29889, 14144, 29892, 13, 18884, 1024, 2433, 14144, 5477, 13, 4706, 4514, 13, 13, 1678, 732, 5696, 29918, 19557, 1061, 29898, 7507, 29918, 12403, 29897, 13, 1678, 822, 2380, 29898, 1311, 29892, 2009, 29892, 3579, 19290, 1125, 13, 4706, 11299, 353, 1583, 29889, 7514, 29889, 12650, 29889, 4572, 29898, 1792, 29922, 3827, 29889, 1792, 29897, 13, 4706, 3030, 353, 1583, 29889, 657, 29918, 4703, 29918, 1272, 29898, 3827, 29892, 11299, 29922, 20488, 29897, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 2098, 29918, 1761, 29918, 20943, 29892, 3030, 29897, 13, 13, 1678, 822, 4902, 29898, 1311, 29892, 2009, 29892, 1797, 29918, 6979, 29892, 3579, 19290, 1125, 13, 4706, 1797, 353, 1583, 29889, 657, 29918, 2098, 29898, 3827, 29892, 1797, 29918, 6979, 29922, 2098, 29918, 6979, 29897, 13, 4706, 3030, 353, 1583, 29889, 657, 29918, 4703, 29918, 1272, 29898, 3827, 29892, 1797, 29922, 2098, 29897, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 2098, 29918, 14144, 29918, 20943, 29892, 3030, 29897, 13, 2 ]
config-server/test.py
wtsi-hgi/webhook-router
2
19778
import json from configserver import ConfigServer, get_postgres_db from configserver.errors import InvalidRouteUUIDError from flask.testing import FlaskClient import pytest from peewee import SqliteDatabase import logging from uuid import uuid4 import functools from typing import Iterable @pytest.fixture(autouse=True) def no_logs(): logging.getLogger().setLevel(logging.WARNING) @pytest.fixture() def webhook_server(): with open("config.json") as config_file: config_JSON = json.load(config_file) server = ConfigServer( use_test_auth=True, db=get_postgres_db(), config_JSON=config_JSON ) yield server server.close() @pytest.fixture() def user_auth(): return { "headers": { "user": f"test_user{uuid4()}@<EMAIL>" } } @pytest.fixture() def router_app(webhook_server, user_auth): test_client = webhook_server.app.app.test_client() # type: FlaskClient class PatchedFlaskClient: get = functools.partialmethod(test_client.get, **user_auth) delete = functools.partialmethod(test_client.delete, **user_auth) post = functools.partialmethod(test_client.post, **user_auth) patch = functools.partialmethod(test_client.patch, **user_auth) return PatchedFlaskClient @pytest.fixture() def test_route_uuid(webhook_server: ConfigServer, router_app: FlaskClient) -> Iterable[str]: create_route_resp = router_app.post( "/create-route", data=json.dumps({ "name": "route", "destination": "http://127.0.0.1" }), content_type='application/json' ) uuid = json.loads(create_route_resp.data)["uuid"] try: yield uuid finally: router_app.delete(f"/routes/{uuid}") def test_create_route(router_app: FlaskClient): create_route_resp = router_app.post( "/create-route", data=json.dumps({ "name": "route", "destination": "http://127.0.0.1" }), content_type='application/json' ) assert create_route_resp.status_code == 201 def test_get(router_app: FlaskClient, test_route_uuid: str): assert router_app.get(f"/routes/{test_route_uuid}").status_code == 200 def test_get_by_token(router_app: FlaskClient, test_route_uuid: str): token = json.loads(router_app.get(f"/routes/{test_route_uuid}").data)["token"] assert router_app.get(f"/routes/token/{token}").status_code == 200 def test_patch(router_app: FlaskClient, test_route_uuid: str): assert router_app.patch( f"/routes/{test_route_uuid}", data=json.dumps({ "name": "new-name" }), content_type='application/json', ).status_code == 204 assert json.loads(router_app.get(f"/routes/{test_route_uuid}").data)["name"] == "new-name" @pytest.mark.usefixtures("test_route_uuid") def test_get_all(router_app: FlaskClient): all_routes_resp = router_app.get("/routes") assert all_routes_resp.status_code == 200 data = json.loads(all_routes_resp.data) assert len(data) == 1 and data[0]["name"] == "route" def test_delete(router_app: FlaskClient, test_route_uuid: str): assert router_app.delete(f"/routes/{test_route_uuid}").status_code == 204 assert router_app.get(f"/routes/{test_route_uuid}").status_code == 404 def test_regenerate(router_app: FlaskClient, test_route_uuid: str): prev_token = json.loads(router_app.get(f"/routes/{test_route_uuid}").data)["token"] resp = router_app.post(f"/routes/{test_route_uuid}/regenerate") assert resp.status_code == 200 assert json.loads(resp.data)["token"] != prev_token def test_add_user_link(router_app: FlaskClient, test_route_uuid: str): test_auth = { "headers": { "user": "<EMAIL>" } } assert router_app.post(f"/links/{test_route_uuid}", **test_auth).status_code == 201 assert len(json.loads(router_app.get("/routes", **test_auth).data)) == 1 def test_get_user_link(router_app: FlaskClient, test_route_uuid: str): test_auth = { "headers": { "user": "<EMAIL>" } } assert router_app.get(f"/links/{test_route_uuid}", **test_auth).status_code == 404 assert router_app.get(f"/links/{test_route_uuid}").status_code == 200 def test_remove_user_link(router_app: FlaskClient, test_route_uuid: str): test_auth = { "headers": { "user": "<EMAIL>" } } test_add_user_link(router_app, test_route_uuid) assert router_app.delete(f"/links/{test_route_uuid}", **test_auth).status_code == 204 assert len(json.loads(router_app.get("/routes", **test_auth).data)) == 0 def test_get_route_stats(router_app: FlaskClient, test_route_uuid: str): assert router_app.get(f"/routes/{test_route_uuid}/statistics").status_code == 200 def test_get_route_logs(router_app: FlaskClient, test_route_uuid: str): assert router_app.get(f"/routes/{test_route_uuid}/logs").status_code == 200 @pytest.mark.usefixtures("test_route_uuid") def test_all_routes_stats(router_app: FlaskClient): assert router_app.get(f"/routes/statistics").status_code == 200 def test_all_routes_stats_with_no_stats(router_app: FlaskClient): assert router_app.get(f"/routes/statistics").status_code == 200
[ 1, 1053, 4390, 13, 13, 3166, 2295, 2974, 1053, 12782, 6004, 29892, 679, 29918, 2490, 7201, 29918, 2585, 13, 3166, 2295, 2974, 29889, 12523, 1053, 21403, 12085, 29965, 11150, 2392, 13, 3166, 29784, 29889, 13424, 1053, 2379, 1278, 4032, 13, 5215, 11451, 1688, 13, 3166, 1236, 29872, 705, 29872, 1053, 13093, 568, 9112, 13, 5215, 12183, 13, 3166, 318, 5416, 1053, 318, 5416, 29946, 13, 5215, 2090, 312, 8789, 13, 3166, 19229, 1053, 20504, 519, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 29898, 1300, 1709, 29922, 5574, 29897, 13, 1753, 694, 29918, 20756, 7295, 13, 1678, 12183, 29889, 657, 16363, 2141, 842, 10108, 29898, 21027, 29889, 29956, 25614, 29897, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 1856, 20849, 29918, 2974, 7295, 13, 1678, 411, 1722, 703, 2917, 29889, 3126, 1159, 408, 2295, 29918, 1445, 29901, 13, 4706, 2295, 29918, 7249, 353, 4390, 29889, 1359, 29898, 2917, 29918, 1445, 29897, 13, 13, 1678, 1923, 353, 12782, 6004, 29898, 13, 4706, 671, 29918, 1688, 29918, 5150, 29922, 5574, 29892, 13, 4706, 4833, 29922, 657, 29918, 2490, 7201, 29918, 2585, 3285, 13, 4706, 2295, 29918, 7249, 29922, 2917, 29918, 7249, 13, 1678, 1723, 13, 1678, 7709, 1923, 13, 1678, 1923, 29889, 5358, 580, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 1404, 29918, 5150, 7295, 13, 1678, 736, 426, 13, 4706, 376, 13662, 1115, 426, 13, 9651, 376, 1792, 1115, 285, 29908, 1688, 29918, 1792, 29912, 25118, 29946, 28296, 29992, 29966, 26862, 6227, 11903, 13, 4706, 500, 13, 1678, 500, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 12876, 29918, 932, 29898, 2676, 20849, 29918, 2974, 29892, 1404, 29918, 5150, 1125, 13, 1678, 1243, 29918, 4645, 353, 1856, 20849, 29918, 2974, 29889, 932, 29889, 932, 29889, 1688, 29918, 4645, 580, 29871, 396, 1134, 29901, 2379, 1278, 4032, 13, 1678, 770, 349, 905, 287, 8754, 1278, 4032, 29901, 13, 4706, 679, 353, 2090, 312, 8789, 29889, 3846, 5696, 29898, 1688, 29918, 4645, 29889, 657, 29892, 3579, 1792, 29918, 5150, 29897, 13, 4706, 5217, 353, 2090, 312, 8789, 29889, 3846, 5696, 29898, 1688, 29918, 4645, 29889, 8143, 29892, 3579, 1792, 29918, 5150, 29897, 13, 4706, 1400, 353, 2090, 312, 8789, 29889, 3846, 5696, 29898, 1688, 29918, 4645, 29889, 2490, 29892, 3579, 1792, 29918, 5150, 29897, 13, 4706, 13261, 353, 2090, 312, 8789, 29889, 3846, 5696, 29898, 1688, 29918, 4645, 29889, 5041, 29892, 3579, 1792, 29918, 5150, 29897, 13, 13, 1678, 736, 349, 905, 287, 8754, 1278, 4032, 13, 13, 29992, 2272, 1688, 29889, 7241, 15546, 580, 13, 1753, 1243, 29918, 13134, 29918, 25118, 29898, 2676, 20849, 29918, 2974, 29901, 12782, 6004, 29892, 12876, 29918, 932, 29901, 2379, 1278, 4032, 29897, 1599, 20504, 519, 29961, 710, 5387, 13, 1678, 1653, 29918, 13134, 29918, 13713, 353, 12876, 29918, 932, 29889, 2490, 29898, 13, 4706, 5591, 3258, 29899, 13134, 613, 13, 4706, 848, 29922, 3126, 29889, 29881, 17204, 3319, 13, 9651, 376, 978, 1115, 376, 13134, 613, 13, 9651, 376, 23848, 1115, 376, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29908, 13, 4706, 500, 511, 13, 4706, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 29915, 13, 1678, 1723, 13, 13, 1678, 318, 5416, 353, 4390, 29889, 18132, 29898, 3258, 29918, 13134, 29918, 13713, 29889, 1272, 29897, 3366, 25118, 3108, 13, 13, 1678, 1018, 29901, 13, 4706, 7709, 318, 5416, 13, 1678, 7146, 29901, 13, 4706, 12876, 29918, 932, 29889, 8143, 29898, 29888, 23901, 27894, 19248, 25118, 27195, 13, 13, 1753, 1243, 29918, 3258, 29918, 13134, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 1125, 13, 1678, 1653, 29918, 13134, 29918, 13713, 353, 12876, 29918, 932, 29889, 2490, 29898, 13, 4706, 5591, 3258, 29899, 13134, 613, 13, 4706, 848, 29922, 3126, 29889, 29881, 17204, 3319, 13, 9651, 376, 978, 1115, 376, 13134, 613, 13, 9651, 376, 23848, 1115, 376, 1124, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29908, 13, 4706, 500, 511, 13, 4706, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 29915, 13, 1678, 1723, 13, 13, 1678, 4974, 1653, 29918, 13134, 29918, 13713, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29896, 13, 13, 1753, 1243, 29918, 657, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 657, 29918, 1609, 29918, 6979, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 5993, 353, 4390, 29889, 18132, 29898, 15140, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 1272, 29897, 3366, 6979, 3108, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 29914, 6979, 19248, 6979, 29913, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 13, 1753, 1243, 29918, 5041, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 5041, 29898, 13, 4706, 285, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 17671, 13, 4706, 848, 29922, 3126, 29889, 29881, 17204, 3319, 13, 9651, 376, 978, 1115, 376, 1482, 29899, 978, 29908, 13, 4706, 500, 511, 13, 4706, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 1678, 13742, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 1678, 4974, 4390, 29889, 18132, 29898, 15140, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 1272, 29897, 3366, 978, 3108, 1275, 376, 1482, 29899, 978, 29908, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 1509, 7241, 486, 1973, 703, 1688, 29918, 13134, 29918, 25118, 1159, 13, 1753, 1243, 29918, 657, 29918, 497, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 1125, 13, 1678, 599, 29918, 27894, 29918, 13713, 353, 12876, 29918, 932, 29889, 657, 11974, 27894, 1159, 13, 13, 1678, 4974, 599, 29918, 27894, 29918, 13713, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1678, 848, 353, 4390, 29889, 18132, 29898, 497, 29918, 27894, 29918, 13713, 29889, 1272, 29897, 13, 1678, 4974, 7431, 29898, 1272, 29897, 1275, 29871, 29896, 322, 848, 29961, 29900, 29962, 3366, 978, 3108, 1275, 376, 13134, 29908, 13, 13, 13, 1753, 1243, 29918, 8143, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 8143, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 13, 13, 13, 1753, 1243, 29918, 1727, 759, 403, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 12379, 29918, 6979, 353, 4390, 29889, 18132, 29898, 15140, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 1272, 29897, 3366, 6979, 3108, 13, 13, 1678, 4613, 353, 12876, 29918, 932, 29889, 2490, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 6822, 1727, 759, 403, 1159, 13, 13, 1678, 4974, 4613, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 1678, 4974, 4390, 29889, 18132, 29898, 13713, 29889, 1272, 29897, 3366, 6979, 3108, 2804, 12379, 29918, 6979, 13, 13, 1753, 1243, 29918, 1202, 29918, 1792, 29918, 2324, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 1243, 29918, 5150, 353, 426, 13, 4706, 376, 13662, 1115, 426, 13, 9651, 376, 1792, 1115, 9872, 26862, 6227, 11903, 13, 4706, 500, 13, 1678, 500, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 2490, 29898, 29888, 23901, 4965, 19248, 1688, 29918, 13134, 29918, 25118, 17671, 3579, 1688, 29918, 5150, 467, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29896, 13, 13, 1678, 4974, 7431, 29898, 3126, 29889, 18132, 29898, 15140, 29918, 932, 29889, 657, 11974, 27894, 613, 3579, 1688, 29918, 5150, 467, 1272, 876, 1275, 29871, 29896, 13, 13, 1753, 1243, 29918, 657, 29918, 1792, 29918, 2324, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 1243, 29918, 5150, 353, 426, 13, 4706, 376, 13662, 1115, 426, 13, 9651, 376, 1792, 1115, 9872, 26862, 6227, 11903, 13, 4706, 500, 13, 1678, 500, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 4965, 19248, 1688, 29918, 13134, 29918, 25118, 17671, 3579, 1688, 29918, 5150, 467, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 4965, 19248, 1688, 29918, 13134, 29918, 25118, 29913, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 5992, 29918, 1792, 29918, 2324, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 1243, 29918, 5150, 353, 426, 13, 4706, 376, 13662, 1115, 426, 13, 9651, 376, 1792, 1115, 9872, 26862, 6227, 11903, 13, 4706, 500, 13, 1678, 500, 13, 13, 1678, 1243, 29918, 1202, 29918, 1792, 29918, 2324, 29898, 15140, 29918, 932, 29892, 1243, 29918, 13134, 29918, 25118, 29897, 13, 13, 1678, 4974, 12876, 29918, 932, 29889, 8143, 29898, 29888, 23901, 4965, 19248, 1688, 29918, 13134, 29918, 25118, 17671, 3579, 1688, 29918, 5150, 467, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29946, 13, 13, 1678, 4974, 7431, 29898, 3126, 29889, 18132, 29898, 15140, 29918, 932, 29889, 657, 11974, 27894, 613, 3579, 1688, 29918, 5150, 467, 1272, 876, 1275, 29871, 29900, 13, 13, 1753, 1243, 29918, 657, 29918, 13134, 29918, 16202, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 6822, 6112, 6765, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 657, 29918, 13134, 29918, 20756, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 29892, 1243, 29918, 13134, 29918, 25118, 29901, 851, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 19248, 1688, 29918, 13134, 29918, 25118, 6822, 20756, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 1509, 7241, 486, 1973, 703, 1688, 29918, 13134, 29918, 25118, 1159, 13, 1753, 1243, 29918, 497, 29918, 27894, 29918, 16202, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 29914, 6112, 6765, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 13, 13, 1753, 1243, 29918, 497, 29918, 27894, 29918, 16202, 29918, 2541, 29918, 1217, 29918, 16202, 29898, 15140, 29918, 932, 29901, 2379, 1278, 4032, 1125, 13, 1678, 4974, 12876, 29918, 932, 29889, 657, 29898, 29888, 23901, 27894, 29914, 6112, 6765, 2564, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 2 ]
Bidding/forms.py
Ishikashah2510/nirvaas_main
0
114737
<reponame>Ishikashah2510/nirvaas_main from django import forms from welcome.models import Users from django.contrib.auth.models import User from Bidding.models import * class Sell_Form(forms.Form): item_name = forms.CharField(label='Item Name') item_description = forms.CharField(max_length=1000, default='',label='Item Description') item_photo = forms.ImageField(label='Upload Photo of Item') threshold_value = forms.FloatField(label='Base Value') class Make_Bid(forms.Form): bid_value = forms.FloatField(label='Enter Bid Value')
[ 1, 529, 276, 1112, 420, 29958, 29902, 845, 638, 1161, 801, 29906, 29945, 29896, 29900, 29914, 29876, 381, 1564, 294, 29918, 3396, 13, 3166, 9557, 1053, 7190, 13, 3166, 12853, 29889, 9794, 1053, 23861, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 13, 3166, 350, 2205, 292, 29889, 9794, 1053, 334, 13, 13, 1990, 317, 514, 29918, 2500, 29898, 9514, 29889, 2500, 1125, 13, 1678, 2944, 29918, 978, 353, 7190, 29889, 27890, 29898, 1643, 2433, 2001, 4408, 1495, 13, 1678, 2944, 29918, 8216, 353, 7190, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 29900, 29892, 2322, 2433, 742, 1643, 2433, 2001, 12953, 1495, 13, 1678, 2944, 29918, 21596, 353, 7190, 29889, 2940, 3073, 29898, 1643, 2433, 17553, 1963, 3747, 310, 10976, 1495, 13, 1678, 16897, 29918, 1767, 353, 7190, 29889, 11031, 3073, 29898, 1643, 2433, 5160, 7865, 1495, 13, 13, 1990, 8561, 29918, 29933, 333, 29898, 9514, 29889, 2500, 1125, 13, 1678, 21000, 29918, 1767, 353, 7190, 29889, 11031, 3073, 29898, 1643, 2433, 10399, 350, 333, 7865, 1495, 2 ]
pytools/unit.py
ry-shika/Geister-cpp-lib
8
26743
<gh_stars>1-10 #!/usr/bin/env python # -*- coding: utf-8 -*- class Unit: def __init__(self, x, y, color, name): self.x = x self.y = y self.color = color self.name = name self.taken = False class OpUnit(Unit): def __init__(self, x, y, color, name): super().__init__(x, y, color, name) self.blue = 0.0
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 13, 1990, 13223, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 921, 29892, 343, 29892, 2927, 29892, 1024, 1125, 13, 4706, 1583, 29889, 29916, 353, 921, 13, 4706, 1583, 29889, 29891, 353, 343, 13, 4706, 1583, 29889, 2780, 353, 2927, 13, 4706, 1583, 29889, 978, 353, 1024, 13, 4706, 1583, 29889, 29873, 9424, 353, 7700, 13, 13, 1990, 6461, 8325, 29898, 8325, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 921, 29892, 343, 29892, 2927, 29892, 1024, 1125, 13, 4706, 2428, 2141, 1649, 2344, 12035, 29916, 29892, 343, 29892, 2927, 29892, 1024, 29897, 13, 4706, 1583, 29889, 9539, 353, 29871, 29900, 29889, 29900, 2 ]
tools/get_rig_info.py
bionicles/neuromax
0
119446
from subprocess import check_output from collections import Iterable from pprint import pprint import itertools import platform import inspect GPU_QUERIES = [ 'gpu_name', 'driver_version', # 'vbios_version', # 'pstate', 'memory.total', 'temperature.gpu', # 'temperature.memory', # 'power.draw', 'power.limit', 'clocks.gr', 'clocks.sm', 'clocks.mem', 'clocks.video' ] COMMANDS = { q: f'nvidia-smi --query-gpu={q} --format=csv,noheader' for q in GPU_QUERIES} BLACKLIST = [ 'linux_distribution', 'python_version_tuple', 'java_ver', 'uname', 'version', 'dist' ] # https://stackoverflow.com/questions/9727688/how-to-get-the-cuda-version def get_cuda_version(): return open('/usr/local/cuda/version.txt').readlines()[0][13:-2] def get_numbers(S): return [int(s) for s in S.split() if s.isdigit()] # https://stackoverflow.com/questions/31326015/how-to-verify-cudnn-installation def get_cudnn_version(): # cudnn_h_path = '/usr/local/cuda/include/cudnn.h' cudnn_h_path = '/usr/include/cudnn.h' N = get_numbers( check_output( f'cat {cudnn_h_path} | grep CUDNN_MAJOR -A 2', shell=True)) V = f'{N[0]}.{N[1]}.{N[2]}' return V def get_ubuntu_version(): return ' '.join( check_output('lsb_release -sdc', shell=True).decode().split()) def get_memory_info(): S = check_output('head -1 /proc/meminfo', shell=True).decode() return f'{get_numbers(S)[0] / 1e6} GB' def get_cpu_info(): cpu_info = {} for key in ['model name', 'cpu cores', 'cache size']: cpu_info[key] = decode(check_output( f"cat /proc/cpuinfo | grep '{key}' | head -n 1 | cut -d' ' -f 3-", shell=True)) return cpu_info def no_underscore(string): try: return '_' not in list(string[:2]) except Exception as e: print(e, string) return '_' not in list(string) def _flatten(l): for el in l: if isinstance(el, Iterable) and not isinstance(el, (str, bytes)): yield from flatten(el) else: yield el def flatten(l): if isinstance(l, Iterable) and not isinstance(l, str): return " ".join(list(filter(None, _flatten(l)))) else: return l def drop_falsy(l): return list(itertools.filterfalse(True, flatten(l))) def empty(x): if isinstance(x, str) and x: return False elif isinstance(x, Iterable): return len(drop_falsy(x)) else: return False def decode(bytes): return bytes.decode().rstrip("\n") def invoke(key, module_or_command): if inspect.ismodule(module_or_command): module_or_command = getattr(module_or_command, key) if isinstance(module_or_command, str): if no_underscore(module_or_command): output = check_output(module_or_command, shell=True) if isinstance(output, bytes): output = decode(output) # print("invoke output", output) return output elif callable(module_or_command): return module_or_command() # print(f"INVOKE FAILED ON {key}") return None def try_to_set(key, info, module_or_command): if key not in BLACKLIST and no_underscore(key): try: value = invoke(key, module_or_command) # print('invoke output type', type(value)) value = flatten(value) if value: info[key] = value except Exception as e: print('exception in try_to_set', key, module_or_command, e) return info def remove_redundant_values(d): d2 = {} for key, value in d.items(): if value not in d2.values(): d2[key] = value return d2 def delete_stuff_in_platform_string(d): d2 = {k: v for k, v in d.items() if v not in d['platform']} d2['platform'] = d['platform'] return d2 def get_rig_info(): platform_info = {} for key in dir(platform): platform_info = try_to_set(key, platform_info, platform) platform_info = remove_redundant_values(platform_info) platform_info = delete_stuff_in_platform_string(platform_info) platform_info['os'] = get_ubuntu_version(), gpu_info = {'cuda': get_cuda_version(), 'cudnn': get_cudnn_version()} for key, command in COMMANDS.items(): gpu_info = try_to_set(key, gpu_info, command) info = { 'ram': get_memory_info(), 'cpu': get_cpu_info(), 'platform': platform_info, 'gpu': remove_redundant_values(gpu_info)} pprint(info) return info get_rig_info() # get_memory_info() # get_cpu_info() # get_ubuntu_version() # get_cudnn_version()
[ 1, 515, 1014, 5014, 1053, 1423, 29918, 4905, 13, 3166, 16250, 1053, 20504, 519, 13, 3166, 282, 2158, 1053, 282, 2158, 13, 5215, 4256, 8504, 13, 5215, 7481, 13, 5215, 16096, 13, 13, 29954, 7056, 29918, 13356, 1001, 29059, 353, 518, 13, 1678, 525, 29887, 3746, 29918, 978, 742, 13, 1678, 525, 9465, 29918, 3259, 742, 13, 1678, 396, 525, 24666, 2363, 29918, 3259, 742, 13, 1678, 396, 525, 29886, 3859, 742, 13, 1678, 525, 14834, 29889, 7827, 742, 13, 1678, 525, 12863, 1535, 29889, 29887, 3746, 742, 13, 1678, 396, 525, 12863, 1535, 29889, 14834, 742, 13, 1678, 396, 525, 13519, 29889, 4012, 742, 13, 1678, 525, 13519, 29889, 13400, 742, 13, 1678, 525, 13058, 29879, 29889, 629, 742, 13, 1678, 525, 13058, 29879, 29889, 3844, 742, 13, 1678, 525, 13058, 29879, 29889, 6954, 742, 13, 1678, 525, 13058, 29879, 29889, 9641, 29915, 13, 29962, 13, 13, 19795, 1529, 2797, 29903, 353, 426, 13, 1678, 3855, 29901, 285, 29915, 29876, 28584, 29899, 29879, 2460, 1192, 1972, 29899, 29887, 3746, 3790, 29939, 29913, 1192, 4830, 29922, 7638, 29892, 1217, 6672, 29915, 13, 1678, 363, 3855, 297, 22796, 29918, 13356, 1001, 29059, 29913, 13, 13, 13367, 11375, 24360, 353, 518, 13, 1678, 525, 9389, 29918, 27691, 742, 13, 1678, 525, 4691, 29918, 3259, 29918, 23583, 742, 13, 1678, 525, 1645, 29918, 369, 742, 13, 1678, 525, 348, 420, 742, 13, 1678, 525, 3259, 742, 13, 1678, 525, 5721, 29915, 13, 29962, 13, 13, 13, 29937, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29929, 29955, 29906, 29955, 29953, 29947, 29947, 29914, 3525, 29899, 517, 29899, 657, 29899, 1552, 29899, 29883, 6191, 29899, 3259, 13, 1753, 679, 29918, 29883, 6191, 29918, 3259, 7295, 13, 1678, 736, 1722, 11219, 4855, 29914, 2997, 29914, 29883, 6191, 29914, 3259, 29889, 3945, 2824, 949, 9012, 580, 29961, 29900, 3816, 29896, 29941, 13018, 29906, 29962, 13, 13, 13, 1753, 679, 29918, 20326, 29898, 29903, 1125, 13, 1678, 736, 518, 524, 29898, 29879, 29897, 363, 269, 297, 317, 29889, 5451, 580, 565, 269, 29889, 275, 26204, 580, 29962, 13, 13, 13, 29937, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29941, 29896, 29941, 29906, 29953, 29900, 29896, 29945, 29914, 3525, 29899, 517, 29899, 27902, 29899, 29883, 566, 15755, 29899, 6252, 362, 13, 1753, 679, 29918, 29883, 566, 15755, 29918, 3259, 7295, 13, 1678, 396, 274, 566, 15755, 29918, 29882, 29918, 2084, 353, 8207, 4855, 29914, 2997, 29914, 29883, 6191, 29914, 2856, 29914, 29883, 566, 15755, 29889, 29882, 29915, 13, 1678, 274, 566, 15755, 29918, 29882, 29918, 2084, 353, 8207, 4855, 29914, 2856, 29914, 29883, 566, 15755, 29889, 29882, 29915, 13, 1678, 405, 353, 679, 29918, 20326, 29898, 13, 9651, 1423, 29918, 4905, 29898, 13, 18884, 285, 29915, 4117, 426, 29883, 566, 15755, 29918, 29882, 29918, 2084, 29913, 891, 12680, 315, 15789, 10262, 29918, 1529, 29967, 1955, 448, 29909, 29871, 29906, 742, 6473, 29922, 5574, 876, 13, 1678, 478, 353, 285, 29915, 29912, 29940, 29961, 29900, 29962, 1836, 29912, 29940, 29961, 29896, 29962, 1836, 29912, 29940, 29961, 29906, 29962, 10162, 13, 1678, 736, 478, 13, 13, 13, 1753, 679, 29918, 8767, 29918, 3259, 7295, 13, 1678, 736, 525, 15300, 7122, 29898, 13, 4706, 1423, 29918, 4905, 877, 3137, 29890, 29918, 14096, 448, 4928, 29883, 742, 6473, 29922, 5574, 467, 13808, 2141, 5451, 3101, 13, 13, 13, 1753, 679, 29918, 14834, 29918, 3888, 7295, 13, 1678, 317, 353, 1423, 29918, 4905, 877, 2813, 448, 29896, 847, 15439, 29914, 6954, 3888, 742, 6473, 29922, 5574, 467, 13808, 580, 13, 1678, 736, 285, 29915, 29912, 657, 29918, 20326, 29898, 29903, 9601, 29900, 29962, 847, 29871, 29896, 29872, 29953, 29913, 19289, 29915, 13, 13, 13, 1753, 679, 29918, 21970, 29918, 3888, 7295, 13, 1678, 26403, 29918, 3888, 353, 6571, 13, 1678, 363, 1820, 297, 6024, 4299, 1024, 742, 525, 21970, 28337, 742, 525, 8173, 2159, 2033, 29901, 13, 4706, 26403, 29918, 3888, 29961, 1989, 29962, 353, 21822, 29898, 3198, 29918, 4905, 29898, 13, 9651, 285, 29908, 4117, 847, 15439, 29914, 21970, 3888, 891, 12680, 22372, 1989, 10162, 891, 2343, 448, 29876, 29871, 29896, 891, 5700, 448, 29881, 29915, 525, 448, 29888, 29871, 29941, 29899, 613, 13, 9651, 6473, 29922, 5574, 876, 13, 1678, 736, 26403, 29918, 3888, 13, 13, 13, 1753, 694, 29918, 870, 414, 3221, 29898, 1807, 1125, 13, 1678, 1018, 29901, 13, 4706, 736, 22868, 29915, 451, 297, 1051, 29898, 1807, 7503, 29906, 2314, 13, 1678, 5174, 8960, 408, 321, 29901, 13, 4706, 1596, 29898, 29872, 29892, 1347, 29897, 13, 4706, 736, 22868, 29915, 451, 297, 1051, 29898, 1807, 29897, 13, 13, 13, 1753, 903, 1579, 8606, 29898, 29880, 1125, 13, 1678, 363, 560, 297, 301, 29901, 13, 4706, 565, 338, 8758, 29898, 295, 29892, 20504, 519, 29897, 322, 451, 338, 8758, 29898, 295, 29892, 313, 710, 29892, 6262, 22164, 13, 9651, 7709, 515, 1652, 8606, 29898, 295, 29897, 13, 4706, 1683, 29901, 13, 9651, 7709, 560, 13, 13, 13, 1753, 1652, 8606, 29898, 29880, 1125, 13, 1678, 565, 338, 8758, 29898, 29880, 29892, 20504, 519, 29897, 322, 451, 338, 8758, 29898, 29880, 29892, 851, 1125, 13, 4706, 736, 376, 11393, 7122, 29898, 1761, 29898, 4572, 29898, 8516, 29892, 903, 1579, 8606, 29898, 29880, 13697, 13, 1678, 1683, 29901, 13, 4706, 736, 301, 13, 13, 13, 1753, 5768, 29918, 29888, 1338, 29891, 29898, 29880, 1125, 13, 1678, 736, 1051, 29898, 1524, 8504, 29889, 4572, 4541, 29898, 5574, 29892, 1652, 8606, 29898, 29880, 4961, 13, 13, 13, 1753, 4069, 29898, 29916, 1125, 13, 1678, 565, 338, 8758, 29898, 29916, 29892, 851, 29897, 322, 921, 29901, 13, 4706, 736, 7700, 13, 1678, 25342, 338, 8758, 29898, 29916, 29892, 20504, 519, 1125, 13, 4706, 736, 7431, 29898, 8865, 29918, 29888, 1338, 29891, 29898, 29916, 876, 13, 1678, 1683, 29901, 13, 4706, 736, 7700, 13, 13, 13, 1753, 21822, 29898, 13193, 1125, 13, 1678, 736, 6262, 29889, 13808, 2141, 29878, 17010, 14182, 29876, 1159, 13, 13, 13, 1753, 15928, 29898, 1989, 29892, 3883, 29918, 272, 29918, 6519, 1125, 13, 1678, 565, 16096, 29889, 275, 5453, 29898, 5453, 29918, 272, 29918, 6519, 1125, 13, 4706, 3883, 29918, 272, 29918, 6519, 353, 679, 5552, 29898, 5453, 29918, 272, 29918, 6519, 29892, 1820, 29897, 13, 1678, 565, 338, 8758, 29898, 5453, 29918, 272, 29918, 6519, 29892, 851, 1125, 13, 4706, 565, 694, 29918, 870, 414, 3221, 29898, 5453, 29918, 272, 29918, 6519, 1125, 13, 9651, 1962, 353, 1423, 29918, 4905, 29898, 5453, 29918, 272, 29918, 6519, 29892, 6473, 29922, 5574, 29897, 13, 9651, 565, 338, 8758, 29898, 4905, 29892, 6262, 1125, 13, 18884, 1962, 353, 21822, 29898, 4905, 29897, 13, 9651, 396, 1596, 703, 9772, 1962, 613, 1962, 29897, 13, 9651, 736, 1962, 13, 1678, 25342, 1246, 519, 29898, 5453, 29918, 272, 29918, 6519, 1125, 13, 4706, 736, 3883, 29918, 272, 29918, 6519, 580, 13, 1678, 396, 1596, 29898, 29888, 29908, 1177, 24898, 6059, 13515, 29902, 20566, 6732, 426, 1989, 27195, 13, 1678, 736, 6213, 13, 13, 13, 1753, 1018, 29918, 517, 29918, 842, 29898, 1989, 29892, 5235, 29892, 3883, 29918, 272, 29918, 6519, 1125, 13, 1678, 565, 1820, 451, 297, 350, 29931, 11375, 24360, 322, 694, 29918, 870, 414, 3221, 29898, 1989, 1125, 13, 4706, 1018, 29901, 13, 9651, 995, 353, 15928, 29898, 1989, 29892, 3883, 29918, 272, 29918, 6519, 29897, 13, 9651, 396, 1596, 877, 9772, 1962, 1134, 742, 1134, 29898, 1767, 876, 13, 9651, 995, 353, 1652, 8606, 29898, 1767, 29897, 13, 9651, 565, 995, 29901, 13, 18884, 5235, 29961, 1989, 29962, 353, 995, 13, 4706, 5174, 8960, 408, 321, 29901, 13, 9651, 1596, 877, 11739, 297, 1018, 29918, 517, 29918, 842, 742, 1820, 29892, 3883, 29918, 272, 29918, 6519, 29892, 321, 29897, 13, 1678, 736, 5235, 13, 13, 13, 1753, 3349, 29918, 9313, 299, 424, 29918, 5975, 29898, 29881, 1125, 13, 1678, 270, 29906, 353, 6571, 13, 1678, 363, 1820, 29892, 995, 297, 270, 29889, 7076, 7295, 13, 4706, 565, 995, 451, 297, 270, 29906, 29889, 5975, 7295, 13, 9651, 270, 29906, 29961, 1989, 29962, 353, 995, 13, 1678, 736, 270, 29906, 13, 13, 13, 1753, 5217, 29918, 303, 3096, 29918, 262, 29918, 12120, 29918, 1807, 29898, 29881, 1125, 13, 1678, 270, 29906, 353, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 270, 29889, 7076, 580, 565, 325, 451, 297, 270, 1839, 12120, 2033, 29913, 13, 1678, 270, 29906, 1839, 12120, 2033, 353, 270, 1839, 12120, 2033, 13, 1678, 736, 270, 29906, 13, 13, 13, 1753, 679, 29918, 8966, 29918, 3888, 7295, 13, 1678, 7481, 29918, 3888, 353, 6571, 13, 1678, 363, 1820, 297, 4516, 29898, 12120, 1125, 13, 4706, 7481, 29918, 3888, 353, 1018, 29918, 517, 29918, 842, 29898, 1989, 29892, 7481, 29918, 3888, 29892, 7481, 29897, 13, 1678, 7481, 29918, 3888, 353, 3349, 29918, 9313, 299, 424, 29918, 5975, 29898, 12120, 29918, 3888, 29897, 13, 1678, 7481, 29918, 3888, 353, 5217, 29918, 303, 3096, 29918, 262, 29918, 12120, 29918, 1807, 29898, 12120, 29918, 3888, 29897, 13, 1678, 7481, 29918, 3888, 1839, 359, 2033, 353, 679, 29918, 8767, 29918, 3259, 3285, 13, 1678, 330, 3746, 29918, 3888, 353, 11117, 29883, 6191, 2396, 679, 29918, 29883, 6191, 29918, 3259, 3285, 525, 29883, 566, 15755, 2396, 679, 29918, 29883, 566, 15755, 29918, 3259, 28296, 13, 1678, 363, 1820, 29892, 1899, 297, 23353, 1529, 2797, 29903, 29889, 7076, 7295, 13, 4706, 330, 3746, 29918, 3888, 353, 1018, 29918, 517, 29918, 842, 29898, 1989, 29892, 330, 3746, 29918, 3888, 29892, 1899, 29897, 13, 1678, 5235, 353, 426, 13, 4706, 525, 2572, 2396, 679, 29918, 14834, 29918, 3888, 3285, 13, 4706, 525, 21970, 2396, 679, 29918, 21970, 29918, 3888, 3285, 13, 4706, 525, 12120, 2396, 7481, 29918, 3888, 29892, 13, 4706, 525, 29887, 3746, 2396, 3349, 29918, 9313, 299, 424, 29918, 5975, 29898, 29887, 3746, 29918, 3888, 2915, 13, 1678, 282, 2158, 29898, 3888, 29897, 13, 1678, 736, 5235, 13, 13, 13, 657, 29918, 8966, 29918, 3888, 580, 13, 29937, 679, 29918, 14834, 29918, 3888, 580, 13, 29937, 679, 29918, 21970, 29918, 3888, 580, 13, 29937, 679, 29918, 8767, 29918, 3259, 580, 13, 29937, 679, 29918, 29883, 566, 15755, 29918, 3259, 580, 13, 2 ]
criterion.py
ash368/FaceParsing
138
76936
# -*- coding: utf-8 -*- # @Author: luoling # @Date: 2019-12-06 10:41:34 # @Last Modified by: luoling # @Last Modified time: 2019-12-18 17:52:49 import torch import torch.nn.functional as F import torch.nn as nn def cross_entropy2d(input, target, weight=None, reduction='none'): n, c, h, w = input.size() nt, ht, wt = target.size() # Handle inconsistent size between input and target if h != ht or w != wt: input = F.interpolate(input, size=( ht, wt), mode="bilinear", align_corners=True) # https://zhuanlan.zhihu.com/p/76583143 input = input.transpose(1, 2).transpose(2, 3).contiguous().view(-1, c) target = target.view(-1) # https://www.cnblogs.com/marsggbo/p/10401215.html loss = F.cross_entropy( input, target, weight=weight, reduction=reduction, ignore_index=250 ) return loss def bootstrapped_cross_entropy2d(input, target, K=100000, weight=None, size_average=True): """High-performance semantic segmentation using very deep fully convolutional networks""" batch_size = input.size()[0] def _bootstrap_xentropy_single(input, target, K, weight=None, size_average=True): n, c, h, w = input.size() input = input.transpose(1, 2).transpose(2, 3).contiguous().view(-1, c) target = target.view(-1) loss = F.cross_entropy( input, target, weight=weight, reduce=False, size_average=False, ignore_index=250 ) topk_loss, _ = loss.topk(K) reduced_topk_loss = topk_loss.sum() / K return reduced_topk_loss loss = 0.0 # Bootstrap from each image not entire batch for i in range(batch_size): loss += _bootstrap_xentropy_single( input=torch.unsqueeze(input[i], 0), target=torch.unsqueeze(target[i], 0), K=K, weight=weight, size_average=size_average, ) return loss / float(batch_size) class DiceLoss(nn.Module): def __init__(self, smooth=1., ignore_index=255): super(DiceLoss, self).__init__() self.ignore_index = ignore_index self.smooth = smooth @staticmethod def make_one_hot(labels, classes): one_hot = torch.cuda.FloatTensor(labels.size()[0], classes, labels.size()[ 2], labels.size()[3]).zero_() target = one_hot.scatter_(1, labels.data, 1) return target def forward(self, output, target): if self.ignore_index not in range(target.min(), target.max()): if (target == self.ignore_index).sum() > 0: target[target == self.ignore_index] = target.min() target = self.make_one_hot( target.unsqueeze(dim=1), classes=output.size()[1]) output = F.softmax(output, dim=1) output_flat = output.contiguous().view(-1) target_flat = target.contiguous().view(-1) intersection = (output_flat * target_flat).sum() loss = 1 - ((2. * intersection + self.smooth) / (output_flat.sum() + target_flat.sum() + self.smooth)) return loss class CriterionAll(nn.Module): """Segmentation aware and Edge aware loss.""" def __init__(self, alpha=50, ignore_index=255): super(CriterionAll, self).__init__() self.ignore_index = ignore_index self.criterion = nn.CrossEntropyLoss(ignore_index=ignore_index) self.weighted_criterion = nn.CrossEntropyLoss( ignore_index=ignore_index, reduction='none') self.alpha = alpha def parsing_loss(self, preds, target): h, w = target[0].size(1), target[0].size(2) pos_num = torch.sum(target[1] == 1, dtype=torch.float) neg_num = torch.sum(target[1] == 0, dtype=torch.float) weight_pos = neg_num / (pos_num + neg_num) weight_neg = pos_num / (pos_num + neg_num) weights = torch.tensor([weight_neg, weight_pos]) loss = 0 # Edge-aware branch preds_edge = preds[1][0] scale_pred = F.interpolate(input=preds_edge, size=(h, w), mode='bilinear', align_corners=True) loss += F.cross_entropy(scale_pred, target[1], weights.cuda(), ignore_index=self.ignore_index) # Segmentation-aware branch preds_parsing = preds[0] if isinstance(preds_parsing, list): for idx, pred_parsing in enumerate(preds_parsing): scale_pred = F.interpolate(input=pred_parsing, size=(h, w), mode='bilinear', align_corners=True) if idx == len(preds_parsing) - 1: # Is that the last term ? loss += (torch.mul(self.weighted_criterion(scale_pred, target[0]), torch.where( target[1] == 0, torch.Tensor([1]).cuda(), torch.Tensor([1 + self.alpha]).cuda()))).mean() else: loss += self.criterion(scale_pred, target[0]) else: scale_pred = F.interpolate(input=preds_parsing, size=(h, w), mode='bilinear', align_corners=True) loss += self.criterion(scale_pred, target[0]) return loss def forward(self, preds, target): loss = self.parsing_loss(preds, target) return loss
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 732, 13720, 29901, 8092, 324, 292, 13, 29937, 732, 2539, 29901, 1678, 29906, 29900, 29896, 29929, 29899, 29896, 29906, 29899, 29900, 29953, 29871, 29896, 29900, 29901, 29946, 29896, 29901, 29941, 29946, 13, 29937, 732, 8897, 3382, 2164, 491, 29901, 259, 8092, 324, 292, 13, 29937, 732, 8897, 3382, 2164, 931, 29901, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29906, 29899, 29896, 29947, 29871, 29896, 29955, 29901, 29945, 29906, 29901, 29946, 29929, 13, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 29889, 2220, 284, 408, 383, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 13, 13, 1753, 4891, 29918, 296, 14441, 29906, 29881, 29898, 2080, 29892, 3646, 29892, 7688, 29922, 8516, 29892, 20376, 2433, 9290, 29374, 13, 1678, 302, 29892, 274, 29892, 298, 29892, 281, 353, 1881, 29889, 2311, 580, 13, 1678, 302, 29873, 29892, 298, 29873, 29892, 281, 29873, 353, 3646, 29889, 2311, 580, 13, 13, 1678, 396, 29273, 22435, 9696, 2159, 1546, 1881, 322, 3646, 13, 1678, 565, 298, 2804, 298, 29873, 470, 281, 2804, 281, 29873, 29901, 13, 4706, 1881, 353, 383, 29889, 1639, 3733, 403, 29898, 2080, 29892, 2159, 7607, 13, 9651, 298, 29873, 29892, 281, 29873, 511, 4464, 543, 18152, 457, 279, 613, 7595, 29918, 29883, 1398, 414, 29922, 5574, 29897, 13, 13, 1678, 396, 2045, 597, 29920, 6905, 273, 6468, 29889, 29920, 2918, 6905, 29889, 510, 29914, 29886, 29914, 29955, 29953, 29945, 29947, 29941, 29896, 29946, 29941, 13, 1678, 1881, 353, 1881, 29889, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 467, 3286, 4220, 29898, 29906, 29892, 29871, 29941, 467, 1285, 5526, 681, 2141, 1493, 6278, 29896, 29892, 274, 29897, 13, 1678, 3646, 353, 3646, 29889, 1493, 6278, 29896, 29897, 13, 1678, 396, 2045, 597, 1636, 29889, 18038, 25762, 29889, 510, 29914, 29885, 1503, 1505, 833, 29914, 29886, 29914, 29896, 29900, 29946, 29900, 29896, 29906, 29896, 29945, 29889, 1420, 13, 1678, 6410, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 13, 4706, 1881, 29892, 3646, 29892, 7688, 29922, 7915, 29892, 20376, 29922, 9313, 428, 29892, 11455, 29918, 2248, 29922, 29906, 29945, 29900, 13, 1678, 1723, 13, 13, 1678, 736, 6410, 13, 13, 13, 1753, 6579, 4151, 2986, 29918, 19128, 29918, 296, 14441, 29906, 29881, 29898, 2080, 29892, 3646, 29892, 476, 29922, 29896, 29900, 29900, 29900, 29900, 29900, 29892, 7688, 29922, 8516, 29892, 2159, 29918, 12483, 482, 29922, 5574, 1125, 13, 1678, 9995, 16382, 29899, 546, 13390, 28837, 10768, 362, 773, 1407, 6483, 8072, 26851, 284, 14379, 15945, 29908, 13, 1678, 9853, 29918, 2311, 353, 1881, 29889, 2311, 580, 29961, 29900, 29962, 13, 13, 1678, 822, 903, 8704, 29918, 29916, 296, 14441, 29918, 14369, 29898, 2080, 29892, 3646, 29892, 476, 29892, 7688, 29922, 8516, 29892, 2159, 29918, 12483, 482, 29922, 5574, 1125, 13, 4706, 302, 29892, 274, 29892, 298, 29892, 281, 353, 1881, 29889, 2311, 580, 13, 4706, 1881, 353, 1881, 29889, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 467, 3286, 4220, 29898, 29906, 29892, 29871, 29941, 467, 1285, 5526, 681, 2141, 1493, 6278, 29896, 29892, 274, 29897, 13, 4706, 3646, 353, 3646, 29889, 1493, 6278, 29896, 29897, 13, 4706, 6410, 353, 383, 29889, 19128, 29918, 296, 14441, 29898, 13, 9651, 1881, 29892, 3646, 29892, 7688, 29922, 7915, 29892, 10032, 29922, 8824, 29892, 2159, 29918, 12483, 482, 29922, 8824, 29892, 11455, 29918, 2248, 29922, 29906, 29945, 29900, 13, 4706, 1723, 13, 13, 4706, 2246, 29895, 29918, 6758, 29892, 903, 353, 6410, 29889, 3332, 29895, 29898, 29968, 29897, 13, 4706, 12212, 29918, 3332, 29895, 29918, 6758, 353, 2246, 29895, 29918, 6758, 29889, 2083, 580, 847, 476, 13, 13, 4706, 736, 12212, 29918, 3332, 29895, 29918, 6758, 13, 13, 1678, 6410, 353, 29871, 29900, 29889, 29900, 13, 1678, 396, 25746, 515, 1269, 1967, 451, 4152, 9853, 13, 1678, 363, 474, 297, 3464, 29898, 16175, 29918, 2311, 1125, 13, 4706, 6410, 4619, 903, 8704, 29918, 29916, 296, 14441, 29918, 14369, 29898, 13, 9651, 1881, 29922, 7345, 305, 29889, 6948, 802, 29872, 911, 29898, 2080, 29961, 29875, 1402, 29871, 29900, 511, 13, 9651, 3646, 29922, 7345, 305, 29889, 6948, 802, 29872, 911, 29898, 5182, 29961, 29875, 1402, 29871, 29900, 511, 13, 9651, 476, 29922, 29968, 29892, 13, 9651, 7688, 29922, 7915, 29892, 13, 9651, 2159, 29918, 12483, 482, 29922, 2311, 29918, 12483, 482, 29892, 13, 4706, 1723, 13, 13, 1678, 736, 6410, 847, 5785, 29898, 16175, 29918, 2311, 29897, 13, 13, 13, 1990, 360, 625, 29931, 2209, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10597, 29922, 29896, 1696, 11455, 29918, 2248, 29922, 29906, 29945, 29945, 1125, 13, 4706, 2428, 29898, 29928, 625, 29931, 2209, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 4706, 1583, 29889, 3844, 6983, 353, 10597, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1207, 29918, 650, 29918, 8711, 29898, 21134, 29892, 4413, 1125, 13, 4706, 697, 29918, 8711, 353, 4842, 305, 29889, 29883, 6191, 29889, 11031, 29911, 6073, 29898, 21134, 29889, 2311, 580, 29961, 29900, 1402, 4413, 29892, 11073, 29889, 2311, 580, 29961, 13, 462, 462, 3986, 29906, 1402, 11073, 29889, 2311, 580, 29961, 29941, 14664, 9171, 29918, 580, 13, 4706, 3646, 353, 697, 29918, 8711, 29889, 1557, 2620, 23538, 29896, 29892, 11073, 29889, 1272, 29892, 29871, 29896, 29897, 13, 4706, 736, 3646, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 1962, 29892, 3646, 1125, 13, 4706, 565, 1583, 29889, 17281, 29918, 2248, 451, 297, 3464, 29898, 5182, 29889, 1195, 3285, 3646, 29889, 3317, 580, 1125, 13, 9651, 565, 313, 5182, 1275, 1583, 29889, 17281, 29918, 2248, 467, 2083, 580, 1405, 29871, 29900, 29901, 13, 18884, 3646, 29961, 5182, 1275, 1583, 29889, 17281, 29918, 2248, 29962, 353, 3646, 29889, 1195, 580, 13, 4706, 3646, 353, 1583, 29889, 5675, 29918, 650, 29918, 8711, 29898, 13, 9651, 3646, 29889, 6948, 802, 29872, 911, 29898, 6229, 29922, 29896, 511, 4413, 29922, 4905, 29889, 2311, 580, 29961, 29896, 2314, 13, 4706, 1962, 353, 383, 29889, 2695, 3317, 29898, 4905, 29892, 3964, 29922, 29896, 29897, 13, 4706, 1962, 29918, 20620, 353, 1962, 29889, 1285, 5526, 681, 2141, 1493, 6278, 29896, 29897, 13, 4706, 3646, 29918, 20620, 353, 3646, 29889, 1285, 5526, 681, 2141, 1493, 6278, 29896, 29897, 13, 4706, 17686, 353, 313, 4905, 29918, 20620, 334, 3646, 29918, 20620, 467, 2083, 580, 13, 4706, 6410, 353, 29871, 29896, 448, 5135, 29906, 29889, 334, 17686, 718, 1583, 29889, 3844, 6983, 29897, 847, 13, 462, 1678, 313, 4905, 29918, 20620, 29889, 2083, 580, 718, 3646, 29918, 20620, 29889, 2083, 580, 718, 1583, 29889, 3844, 6983, 876, 13, 4706, 736, 6410, 13, 13, 13, 1990, 315, 5385, 291, 3596, 29898, 15755, 29889, 7355, 1125, 13, 1678, 9995, 17669, 358, 362, 9543, 322, 21086, 9543, 6410, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 15595, 29922, 29945, 29900, 29892, 11455, 29918, 2248, 29922, 29906, 29945, 29945, 1125, 13, 4706, 2428, 29898, 29907, 5385, 291, 3596, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 17281, 29918, 2248, 353, 11455, 29918, 2248, 13, 4706, 1583, 29889, 29883, 5385, 291, 353, 302, 29876, 29889, 29907, 2124, 5292, 14441, 29931, 2209, 29898, 17281, 29918, 2248, 29922, 17281, 29918, 2248, 29897, 13, 4706, 1583, 29889, 7915, 287, 29918, 29883, 5385, 291, 353, 302, 29876, 29889, 29907, 2124, 5292, 14441, 29931, 2209, 29898, 13, 9651, 11455, 29918, 2248, 29922, 17281, 29918, 2248, 29892, 20376, 2433, 9290, 1495, 13, 4706, 1583, 29889, 2312, 353, 15595, 13, 13, 1678, 822, 13755, 29918, 6758, 29898, 1311, 29892, 4450, 29879, 29892, 3646, 1125, 13, 4706, 298, 29892, 281, 353, 3646, 29961, 29900, 1822, 2311, 29898, 29896, 511, 3646, 29961, 29900, 1822, 2311, 29898, 29906, 29897, 13, 13, 4706, 926, 29918, 1949, 353, 4842, 305, 29889, 2083, 29898, 5182, 29961, 29896, 29962, 1275, 29871, 29896, 29892, 26688, 29922, 7345, 305, 29889, 7411, 29897, 13, 4706, 3480, 29918, 1949, 353, 4842, 305, 29889, 2083, 29898, 5182, 29961, 29896, 29962, 1275, 29871, 29900, 29892, 26688, 29922, 7345, 305, 29889, 7411, 29897, 13, 13, 4706, 7688, 29918, 1066, 353, 3480, 29918, 1949, 847, 313, 1066, 29918, 1949, 718, 3480, 29918, 1949, 29897, 13, 4706, 7688, 29918, 10052, 353, 926, 29918, 1949, 847, 313, 1066, 29918, 1949, 718, 3480, 29918, 1949, 29897, 13, 4706, 18177, 353, 4842, 305, 29889, 20158, 4197, 7915, 29918, 10052, 29892, 7688, 29918, 1066, 2314, 13, 4706, 6410, 353, 29871, 29900, 13, 13, 4706, 396, 21086, 29899, 28327, 5443, 13, 4706, 4450, 29879, 29918, 12864, 353, 4450, 29879, 29961, 29896, 3816, 29900, 29962, 13, 4706, 6287, 29918, 11965, 353, 383, 29889, 1639, 3733, 403, 29898, 2080, 29922, 11965, 29879, 29918, 12864, 29892, 2159, 7607, 29882, 29892, 281, 511, 13, 462, 462, 259, 4464, 2433, 18152, 457, 279, 742, 7595, 29918, 29883, 1398, 414, 29922, 5574, 29897, 13, 4706, 6410, 4619, 383, 29889, 19128, 29918, 296, 14441, 29898, 7052, 29918, 11965, 29892, 3646, 29961, 29896, 1402, 13, 462, 18884, 18177, 29889, 29883, 6191, 3285, 11455, 29918, 2248, 29922, 1311, 29889, 17281, 29918, 2248, 29897, 13, 13, 4706, 396, 6667, 358, 362, 29899, 28327, 5443, 13, 4706, 4450, 29879, 29918, 862, 2976, 353, 4450, 29879, 29961, 29900, 29962, 13, 4706, 565, 338, 8758, 29898, 11965, 29879, 29918, 862, 2976, 29892, 1051, 1125, 13, 9651, 363, 22645, 29892, 4450, 29918, 862, 2976, 297, 26985, 29898, 11965, 29879, 29918, 862, 2976, 1125, 13, 18884, 6287, 29918, 11965, 353, 383, 29889, 1639, 3733, 403, 29898, 2080, 29922, 11965, 29918, 862, 2976, 29892, 2159, 7607, 29882, 29892, 281, 511, 13, 462, 462, 965, 4464, 2433, 18152, 457, 279, 742, 7595, 29918, 29883, 1398, 414, 29922, 5574, 29897, 13, 13, 18884, 565, 22645, 1275, 7431, 29898, 11965, 29879, 29918, 862, 2976, 29897, 448, 29871, 29896, 29901, 29871, 396, 1317, 393, 278, 1833, 1840, 1577, 13, 462, 1678, 6410, 4619, 313, 7345, 305, 29889, 16109, 29898, 1311, 29889, 7915, 287, 29918, 29883, 5385, 291, 29898, 7052, 29918, 11965, 29892, 3646, 29961, 29900, 11724, 4842, 305, 29889, 3062, 29898, 13, 462, 4706, 3646, 29961, 29896, 29962, 1275, 29871, 29900, 29892, 4842, 305, 29889, 29911, 6073, 4197, 29896, 14664, 29883, 6191, 3285, 4842, 305, 29889, 29911, 6073, 4197, 29896, 718, 1583, 29889, 2312, 14664, 29883, 6191, 22130, 467, 12676, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 6410, 4619, 1583, 29889, 29883, 5385, 291, 29898, 7052, 29918, 11965, 29892, 3646, 29961, 29900, 2314, 13, 4706, 1683, 29901, 13, 9651, 6287, 29918, 11965, 353, 383, 29889, 1639, 3733, 403, 29898, 2080, 29922, 11965, 29879, 29918, 862, 2976, 29892, 2159, 7607, 29882, 29892, 281, 511, 13, 462, 462, 539, 4464, 2433, 18152, 457, 279, 742, 7595, 29918, 29883, 1398, 414, 29922, 5574, 29897, 13, 9651, 6410, 4619, 1583, 29889, 29883, 5385, 291, 29898, 7052, 29918, 11965, 29892, 3646, 29961, 29900, 2314, 13, 4706, 736, 6410, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 4450, 29879, 29892, 3646, 1125, 13, 4706, 6410, 353, 1583, 29889, 862, 2976, 29918, 6758, 29898, 11965, 29879, 29892, 3646, 29897, 13, 4706, 736, 6410, 13, 2 ]
config/constants.py
flopezag/fiware-tsc-dashboard
0
11779
#!/usr/bin/env python # -*- encoding: utf-8 -*- ## # Copyright 2017 FIWARE Foundation, e.V. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. ## __author__ = 'fla' GOOGLE_ACCOUNTS_BASE_URL = 'https://accounts.google.com' APPLICATION_NAME = 'TSC Enablers Dashboard' CREDENTIAL_DIR = '.credentials' CREDENTIAL_FILE = 'sheets.googleapis.com.json' DB_NAME = 'enablers-dashboard.db' DB_FOLDER = 'dbase' LOG_FILE = 'tsc-dashboard.log' # We need to add 16 rows in the number of enablers list corresponding to: # - Title # - Report date # - Data sources updated on # - Source # - Units # - Enabler Impl # - INCUBATED # - DEVELOPMENT # - SUPPORT # - DEPRECATED # - And 6 extra blank rows between them FIXED_ROWS = 16 # We keep the firsts row without change in the sheet (sheet title) INITIAL_ROW = 2 # The number of columns to delete corresponds to: # Source, Catalogue, ReadTheDocs, Docker, GitHub, Coverall, Academy, HelpDesk, Backlog, GitHub_Open_Issues, # GitHub_Closed_Issues, GitHub_Adopters, GitHub_Adopters_Open_Issues, GitHub_Adopters_Closed_Issues, # GitHub_Comits, GitHub_Forks, GitHub_Watchers, GitHub_Stars, Jira_WorkItem_Not_Closed, Jira_WorkItem_Closed # + Extra 2 = 22 FIXED_COLUMNS = 22 # We start to delete from the initial column INITIAL_COLUMN = 1
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 448, 29930, 29899, 8025, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 2277, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29955, 9338, 12982, 1525, 10606, 29892, 321, 29889, 29963, 29889, 13, 29937, 2178, 26863, 2538, 9841, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 366, 1122, 13, 29937, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 887, 1122, 4017, 13, 29937, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 308, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 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, 399, 1806, 8187, 2692, 13, 29937, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 2823, 278, 13, 29937, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1090, 278, 19245, 29889, 13, 2277, 13, 13, 1649, 8921, 1649, 353, 525, 29888, 433, 29915, 13, 13, 17080, 29949, 29954, 1307, 29918, 2477, 3217, 3904, 9375, 29918, 25416, 29918, 4219, 353, 525, 991, 597, 10149, 29879, 29889, 3608, 29889, 510, 29915, 13, 3301, 7390, 28541, 29918, 5813, 353, 525, 29911, 7187, 1174, 370, 9306, 360, 1161, 3377, 29915, 13, 29907, 19386, 3919, 25758, 29918, 9464, 353, 15300, 11944, 9409, 29915, 13, 29907, 19386, 3919, 25758, 29918, 7724, 353, 525, 19360, 29889, 15947, 29889, 510, 29889, 3126, 29915, 13, 4051, 29918, 5813, 353, 525, 264, 370, 9306, 29899, 14592, 3377, 29889, 2585, 29915, 13, 4051, 29918, 29943, 5607, 8032, 353, 525, 2585, 559, 29915, 13, 14480, 29918, 7724, 353, 525, 1372, 29883, 29899, 14592, 3377, 29889, 1188, 29915, 13, 13, 29937, 1334, 817, 304, 788, 29871, 29896, 29953, 4206, 297, 278, 1353, 310, 427, 370, 9306, 1051, 6590, 304, 29901, 13, 29937, 448, 18527, 13, 29937, 448, 13969, 2635, 13, 29937, 448, 3630, 8974, 4784, 373, 13, 29937, 448, 7562, 13, 29937, 448, 28386, 13, 29937, 448, 1174, 370, 1358, 1954, 572, 13, 29937, 448, 2672, 29907, 7466, 3040, 29928, 13, 29937, 448, 5012, 12064, 3927, 13427, 3919, 13, 29937, 448, 317, 4897, 15082, 13, 29937, 448, 5012, 15094, 29907, 3040, 29928, 13, 29937, 448, 1126, 29871, 29953, 4805, 9654, 4206, 1546, 963, 13, 25634, 3352, 29918, 1672, 7811, 353, 29871, 29896, 29953, 13, 13, 29937, 1334, 3013, 278, 937, 29879, 1948, 1728, 1735, 297, 278, 9869, 313, 9855, 3611, 29897, 13, 26019, 25758, 29918, 25180, 353, 29871, 29906, 13, 13, 29937, 450, 1353, 310, 4341, 304, 5217, 16161, 304, 29901, 13, 29937, 7562, 29892, 6706, 29892, 7523, 1576, 29928, 12332, 29892, 20868, 29892, 25492, 29892, 26428, 497, 29892, 10355, 29892, 22305, 4002, 29895, 29892, 7437, 1188, 29892, 25492, 29918, 6585, 29918, 29902, 893, 1041, 29892, 13, 29937, 25492, 29918, 6821, 2662, 29918, 29902, 893, 1041, 29892, 25492, 29918, 3253, 459, 2153, 29892, 25492, 29918, 3253, 459, 2153, 29918, 6585, 29918, 29902, 893, 1041, 29892, 25492, 29918, 3253, 459, 2153, 29918, 6821, 2662, 29918, 29902, 893, 1041, 29892, 13, 29937, 25492, 29918, 1523, 1169, 29892, 25492, 29918, 29943, 548, 29879, 29892, 25492, 29918, 24709, 414, 29892, 25492, 29918, 855, 1503, 29892, 435, 3055, 29918, 5531, 2001, 29918, 3664, 29918, 6821, 2662, 29892, 435, 3055, 29918, 5531, 2001, 29918, 6821, 2662, 13, 29937, 29871, 718, 7338, 336, 29871, 29906, 353, 29871, 29906, 29906, 13, 25634, 3352, 29918, 15032, 5005, 3059, 353, 29871, 29906, 29906, 13, 13, 29937, 1334, 1369, 304, 5217, 515, 278, 2847, 1897, 13, 26019, 25758, 29918, 15032, 29127, 353, 29871, 29896, 13, 2 ]
data/datasets.py
shirgur/UMIS
67
172635
import torch from torch.utils.data import Dataset import glob import tifffile as T from libtiff import TIFF import numpy as np def range_normalize(v): v = (v - v.mean(axis=(1, 2), keepdims=True)) / (v.std(axis=(1, 2), keepdims=True) + 1e-12) v_min, v_max = v.min(axis=(1, 2), keepdims=True), v.max(axis=(1, 2), keepdims=True) v = (v - v_min) / (v_max - v_min + 1e-5) return v def smart_padding(img, data_shape, lables_shape, stride): if img.shape[0] < data_shape[0]: img = np.pad(img, ((0, data_shape[0] - img.shape[0]), (0, 0), (0, 0)), mode='reflect') if img.shape[1] < data_shape[1]: img = np.pad(img, ((0, 0), (0, data_shape[1] - img.shape[1]), (0, 0)), mode='reflect') if img.shape[2] < data_shape[2]: img = np.pad(img, ((0, 0), (0, 0), (0, data_shape[2] - img.shape[1])), mode='reflect') dz = int(np.floor((img.shape[0] - data_shape[0]) / stride[0] + 1)) dy = int(np.floor((img.shape[1] - data_shape[1]) / stride[1] + 1)) dx = int(np.floor((img.shape[2] - data_shape[2]) / stride[2] + 1)) effective_data_shape = ( data_shape[0] * dz - (data_shape[0] - stride[0]) * (dz - 1), data_shape[1] * dy - (data_shape[1] - stride[1]) * (dy - 1), data_shape[2] * dx - (data_shape[2] - stride[2]) * (dx - 1) ) if effective_data_shape[0] < img.shape[0]: img = np.pad(img, ( (0, (data_shape[0] * (dz + 1) - (data_shape[0] - stride[0]) * dz) - img.shape[0]), (0, 0), (0, 0)), mode='reflect') if effective_data_shape[1] < img.shape[1]: img = np.pad(img, ( (0, 0), (0, (data_shape[1] * (dy + 1) - (data_shape[1] - stride[1]) * dy) - img.shape[1]), (0, 0)), mode='reflect') if effective_data_shape[2] < img.shape[2]: img = np.pad(img, ( (0, 0), (0, 0), (0, (data_shape[2] * (dx + 1) - (data_shape[2] - stride[2]) * dx) - img.shape[2])), mode='reflect') effective_data_shape = img.shape effective_lable_shape = ( effective_data_shape[0] - (data_shape[0] - lables_shape[0]), effective_data_shape[1] - (data_shape[1] - lables_shape[1]), effective_data_shape[2] - (data_shape[2] - lables_shape[2]) ) if effective_lable_shape[0] < img.shape[0]: img = np.pad(img, (((data_shape[0] - lables_shape[0]) // 2, (data_shape[0] - lables_shape[0]) // 2 + (data_shape[0] - lables_shape[0]) % 2), (0, 0), (0, 0)), mode='reflect') if effective_lable_shape[1] < img.shape[1]: img = np.pad(img, ((0, 0), ((data_shape[1] - lables_shape[1]) // 2, (data_shape[1] - lables_shape[1]) // 2 + (data_shape[1] - lables_shape[1]) % 2), (0, 0)), mode='reflect') if effective_lable_shape[2] < img.shape[2]: img = np.pad(img, ((0, 0), (0, 0), ((data_shape[2] - lables_shape[2]) // 2, (data_shape[2] - lables_shape[2]) // 2 + ( data_shape[2] - lables_shape[2]) % 2)), mode='reflect') return img class Single_Image_Eval(Dataset): def __init__(self, image_path='HaftJavaherian_DeepVess2018_GroundTruthImage.tif', label_path='HaftJavaherian_DeepVess2018_GroundTruthLabel.tif', data_shape=(7, 33, 33), lables_shape=(1, 4, 4), stride=(1, 1, 1), range_norm=False): self.range_norm = range_norm try: img = T.imread(image_path) except: img = [] tif = TIFF.open(image_path) for _image in tif.iter_images(): img.append(_image) img = np.stack(img, 0) try: lbl = T.imread(label_path) except: lbl = [] tif = TIFF.open(label_path) for _lable in tif.iter_images(): lbl.append(_lable) lbl = np.stack(lbl, 0) img = smart_padding(img, data_shape, lables_shape, stride) lbl = smart_padding(lbl, data_shape, lables_shape, stride) self.org_shape = img.shape self.img = img.astype(np.float32) self.lbl = lbl.astype(np.float32) self.shape = self.img.shape self.data_shape = data_shape self.lables_shape = lables_shape self.stride = stride self.dz = int(np.floor((self.shape[0] - data_shape[0]) / stride[0] + 1)) self.dy = int(np.floor((self.shape[1] - data_shape[1]) / stride[1] + 1)) self.dx = int(np.floor((self.shape[2] - data_shape[2]) / stride[2] + 1)) self.effective_data_shape = ( data_shape[0] * self.dz - (data_shape[0] - stride[0]) * (self.dz - 1), data_shape[1] * self.dy - (data_shape[1] - stride[1]) * (self.dy - 1), data_shape[2] * self.dx - (data_shape[2] - stride[2]) * (self.dx - 1) ) self.effective_lable_shape = ( self.effective_data_shape[0] - (data_shape[0] - lables_shape[0]), self.effective_data_shape[1] - (data_shape[1] - lables_shape[1]), self.effective_data_shape[2] - (data_shape[2] - lables_shape[2]) ) self.effective_lable_idx = ( ((data_shape[0] - lables_shape[0]) // 2, self.effective_data_shape[0] - ( (data_shape[0] - lables_shape[0]) // 2 + (data_shape[0] - lables_shape[0]) % 2)), ((data_shape[1] - lables_shape[1]) // 2, self.effective_data_shape[1] - ( (data_shape[1] - lables_shape[1]) // 2 + (data_shape[1] - lables_shape[1]) % 2)), ((data_shape[2] - lables_shape[2]) // 2, self.effective_data_shape[2] - ( (data_shape[2] - lables_shape[2]) // 2 + (data_shape[2] - lables_shape[2]) % 2)) ) self.lbl_z = ((data_shape[0] - lables_shape[0]) // 2, (data_shape[0] - lables_shape[0]) // 2 + lables_shape[0]) self.lbl_y = ((data_shape[1] - lables_shape[1]) // 2, (data_shape[1] - lables_shape[1]) // 2 + lables_shape[1]) self.lbl_x = ((data_shape[2] - lables_shape[2]) // 2, (data_shape[2] - lables_shape[2]) // 2 + lables_shape[2]) self.max_iter = self.dz * self.dy * self.dx def __len__(self): return self.max_iter def __getitem__(self, index): z, y, x = np.unravel_index(index, (self.dz, self.dy, self.dx)) z = z * self.stride[0] y = y * self.stride[1] x = x * self.stride[2] v = self.img[z: z + self.data_shape[0], y: y + self.data_shape[1], x: x + self.data_shape[2]] lbl = self.lbl[z: z + self.data_shape[0], y: y + self.data_shape[1], x: x + self.data_shape[2]] lbl = lbl[self.lbl_z[0]: self.lbl_z[1], self.lbl_y[0]: self.lbl_y[1], self.lbl_x[0]: self.lbl_x[1]] # Normalize if self.range_norm: v = range_normalize(v) else: v = (v - v.mean(axis=(1, 2), keepdims=True)) / (v.std(axis=(1, 2), keepdims=True) + 1e-12) # To Tensor data = torch.Tensor(v).unsqueeze(0) lables = torch.Tensor(lbl // self.lbl.max()).long() return data, lables class Directory_Image_Train(Dataset): def __init__(self, images_path, labels_path, max_iter=1000, data_shape=(7, 33, 33), lables_shape=(1, 4, 4), stride=(1, 1, 1), range_norm=False): self.range_norm = range_norm images = sorted(glob.glob(images_path + '/*tif')) labels = sorted(glob.glob(labels_path + '/*tif')) self.org_shape = [] self.shape = [] self.img = [] self.lbl = [] self.data_shape = data_shape self.lables_shape = lables_shape self.stride = stride self.dz = [] self.dy = [] self.dx = [] self.effective_data_shape = [] self.effective_lable_shape = [] self.effective_lable_idx = [] self.lbl_z = [] self.lbl_y = [] self.lbl_x = [] for img_path, lbl_path in zip(images, labels): try: img = T.imread(img_path) except: img = [] tif = TIFF.open(img_path) for _image in tif.iter_images(): img.append(_image) img = np.stack(img, 0) try: lbl = T.imread(lbl_path) except: lbl = [] tif = TIFF.open(lbl_path) for _lable in tif.iter_images(): lbl.append(_lable) lbl = np.stack(lbl, 0) img = smart_padding(img, data_shape, lables_shape, stride) lbl = smart_padding(lbl, data_shape, lables_shape, stride) self.org_shape.append(img.shape) self.img.append(img.astype(np.float32)) self.lbl.append(lbl.astype(np.float32)) shape = img.shape self.shape.append(shape) dz = int(np.floor((shape[0] - data_shape[0]) / stride[0] + 1)) dy = int(np.floor((shape[1] - data_shape[1]) / stride[1] + 1)) dx = int(np.floor((shape[2] - data_shape[2]) / stride[2] + 1)) effective_data_shape = ( data_shape[0] * dz - (data_shape[0] - stride[0]) * (dz - 1), data_shape[1] * dy - (data_shape[1] - stride[1]) * (dy - 1), data_shape[2] * dx - (data_shape[2] - stride[2]) * (dx - 1) ) effective_lable_shape = ( effective_data_shape[0] - (data_shape[0] - lables_shape[0]), effective_data_shape[1] - (data_shape[1] - lables_shape[1]), effective_data_shape[2] - (data_shape[2] - lables_shape[2]) ) effective_lable_idx = ( ((data_shape[0] - lables_shape[0]) // 2, effective_data_shape[0] - ( (data_shape[0] - lables_shape[0]) // 2 + (data_shape[0] - lables_shape[0]) % 2)), ((data_shape[1] - lables_shape[1]) // 2, effective_data_shape[1] - ( (data_shape[1] - lables_shape[1]) // 2 + (data_shape[1] - lables_shape[1]) % 2)), ((data_shape[2] - lables_shape[2]) // 2, effective_data_shape[2] - ( (data_shape[2] - lables_shape[2]) // 2 + (data_shape[2] - lables_shape[2]) % 2)) ) lbl_z = ((data_shape[0] - lables_shape[0]) // 2, (data_shape[0] - lables_shape[0]) // 2 + lables_shape[0]) lbl_y = ((data_shape[1] - lables_shape[1]) // 2, (data_shape[1] - lables_shape[1]) // 2 + lables_shape[1]) lbl_x = ((data_shape[2] - lables_shape[2]) // 2, (data_shape[2] - lables_shape[2]) // 2 + lables_shape[2]) self.dz.append(dz) self.dy.append(dy) self.dx.append(dx) self.effective_data_shape.append(effective_data_shape) self.effective_lable_shape.append(effective_lable_shape) self.effective_lable_idx.append(effective_lable_idx) self.lbl_z.append(lbl_z) self.lbl_y.append(lbl_y) self.lbl_x.append(lbl_x) self.max_iter = max_iter def __len__(self): return self.max_iter def __getitem__(self, index): i = np.random.randint(0, len(self.img)) z = np.random.randint(0, self.dz[i]) y = np.random.randint(0, self.dy[i]) x = np.random.randint(0, self.dx[i]) z = z * self.stride[0] y = y * self.stride[1] x = x * self.stride[2] v = self.img[i][z: z + self.data_shape[0], y: y + self.data_shape[1], x: x + self.data_shape[2]] lbl = self.lbl[i][z: z + self.data_shape[0], y: y + self.data_shape[1], x: x + self.data_shape[2]] lbl = lbl[self.lbl_z[i][0]: self.lbl_z[i][1], self.lbl_y[i][0]: self.lbl_y[i][1], self.lbl_x[i][0]: self.lbl_x[i][1]] # Normalize if self.range_norm: v = range_normalize(v) else: v = (v - v.mean(axis=(1, 2), keepdims=True)) / (v.std(axis=(1, 2), keepdims=True) + 1e-12) # To Tensor data = torch.Tensor(v).unsqueeze(0) lables = torch.Tensor(lbl // 255).long() return data, lables
[ 1, 1053, 4842, 305, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 13373, 24541, 13, 5215, 13149, 13, 5215, 260, 361, 600, 488, 408, 323, 13, 3166, 619, 3116, 2593, 1053, 323, 29902, 4198, 13, 5215, 12655, 408, 7442, 13, 13, 13, 1753, 3464, 29918, 8945, 675, 29898, 29894, 1125, 13, 1678, 325, 353, 313, 29894, 448, 325, 29889, 12676, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 876, 847, 313, 29894, 29889, 4172, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 29897, 718, 29871, 29896, 29872, 29899, 29896, 29906, 29897, 13, 1678, 325, 29918, 1195, 29892, 325, 29918, 3317, 353, 325, 29889, 1195, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 511, 325, 29889, 3317, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 29897, 13, 1678, 325, 353, 313, 29894, 448, 325, 29918, 1195, 29897, 847, 313, 29894, 29918, 3317, 448, 325, 29918, 1195, 718, 29871, 29896, 29872, 29899, 29945, 29897, 13, 13, 1678, 736, 325, 13, 13, 13, 1753, 15040, 29918, 12791, 29898, 2492, 29892, 848, 29918, 12181, 29892, 301, 1849, 29918, 12181, 29892, 380, 2426, 1125, 13, 1678, 565, 10153, 29889, 12181, 29961, 29900, 29962, 529, 848, 29918, 12181, 29961, 29900, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 5135, 29900, 29892, 848, 29918, 12181, 29961, 29900, 29962, 448, 10153, 29889, 12181, 29961, 29900, 11724, 313, 29900, 29892, 29871, 29900, 511, 313, 29900, 29892, 29871, 29900, 8243, 4464, 2433, 13191, 1495, 13, 1678, 565, 10153, 29889, 12181, 29961, 29896, 29962, 529, 848, 29918, 12181, 29961, 29896, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 5135, 29900, 29892, 29871, 29900, 511, 313, 29900, 29892, 848, 29918, 12181, 29961, 29896, 29962, 448, 10153, 29889, 12181, 29961, 29896, 11724, 313, 29900, 29892, 29871, 29900, 8243, 4464, 2433, 13191, 1495, 13, 1678, 565, 10153, 29889, 12181, 29961, 29906, 29962, 529, 848, 29918, 12181, 29961, 29906, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 5135, 29900, 29892, 29871, 29900, 511, 313, 29900, 29892, 29871, 29900, 511, 313, 29900, 29892, 848, 29918, 12181, 29961, 29906, 29962, 448, 10153, 29889, 12181, 29961, 29896, 2314, 511, 4464, 2433, 13191, 1495, 13, 13, 1678, 9275, 353, 938, 29898, 9302, 29889, 14939, 3552, 2492, 29889, 12181, 29961, 29900, 29962, 448, 848, 29918, 12181, 29961, 29900, 2314, 847, 380, 2426, 29961, 29900, 29962, 718, 29871, 29896, 876, 13, 1678, 13475, 353, 938, 29898, 9302, 29889, 14939, 3552, 2492, 29889, 12181, 29961, 29896, 29962, 448, 848, 29918, 12181, 29961, 29896, 2314, 847, 380, 2426, 29961, 29896, 29962, 718, 29871, 29896, 876, 13, 1678, 15414, 353, 938, 29898, 9302, 29889, 14939, 3552, 2492, 29889, 12181, 29961, 29906, 29962, 448, 848, 29918, 12181, 29961, 29906, 2314, 847, 380, 2426, 29961, 29906, 29962, 718, 29871, 29896, 876, 13, 1678, 11828, 29918, 1272, 29918, 12181, 353, 313, 13, 4706, 848, 29918, 12181, 29961, 29900, 29962, 334, 9275, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 380, 2426, 29961, 29900, 2314, 334, 313, 5601, 448, 29871, 29896, 511, 13, 4706, 848, 29918, 12181, 29961, 29896, 29962, 334, 13475, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 380, 2426, 29961, 29896, 2314, 334, 313, 4518, 448, 29871, 29896, 511, 13, 4706, 848, 29918, 12181, 29961, 29906, 29962, 334, 15414, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 380, 2426, 29961, 29906, 2314, 334, 313, 8235, 448, 29871, 29896, 29897, 13, 1678, 1723, 13, 13, 1678, 565, 11828, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 529, 10153, 29889, 12181, 29961, 29900, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 13, 462, 268, 313, 13, 462, 308, 313, 29900, 29892, 313, 1272, 29918, 12181, 29961, 29900, 29962, 334, 313, 5601, 718, 29871, 29896, 29897, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 380, 2426, 29961, 29900, 2314, 334, 9275, 29897, 448, 10153, 29889, 12181, 29961, 29900, 11724, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 8243, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 1678, 565, 11828, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 529, 10153, 29889, 12181, 29961, 29896, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 13, 462, 268, 313, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 308, 313, 29900, 29892, 313, 1272, 29918, 12181, 29961, 29896, 29962, 334, 313, 4518, 718, 29871, 29896, 29897, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 380, 2426, 29961, 29896, 2314, 334, 13475, 29897, 448, 10153, 29889, 12181, 29961, 29896, 11724, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 8243, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 1678, 565, 11828, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 529, 10153, 29889, 12181, 29961, 29906, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 13, 462, 268, 313, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 308, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 308, 313, 29900, 29892, 313, 1272, 29918, 12181, 29961, 29906, 29962, 334, 313, 8235, 718, 29871, 29896, 29897, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 380, 2426, 29961, 29906, 2314, 334, 15414, 29897, 448, 10153, 29889, 12181, 29961, 29906, 2314, 511, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 13, 1678, 11828, 29918, 1272, 29918, 12181, 353, 10153, 29889, 12181, 13, 1678, 11828, 29918, 29880, 519, 29918, 12181, 353, 313, 13, 4706, 11828, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 11724, 13, 4706, 11828, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 11724, 13, 4706, 11828, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 13, 1678, 1723, 13, 1678, 565, 11828, 29918, 29880, 519, 29918, 12181, 29961, 29900, 29962, 529, 10153, 29889, 12181, 29961, 29900, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 313, 3552, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 29892, 13, 462, 9651, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 1273, 29871, 29906, 511, 13, 462, 965, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 965, 313, 29900, 29892, 29871, 29900, 8243, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 1678, 565, 11828, 29918, 29880, 519, 29918, 12181, 29961, 29896, 29962, 529, 10153, 29889, 12181, 29961, 29896, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 5135, 29900, 29892, 29871, 29900, 511, 13, 462, 965, 5135, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 13, 462, 9651, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 1273, 29871, 29906, 511, 13, 462, 965, 313, 29900, 29892, 29871, 29900, 8243, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 1678, 565, 11828, 29918, 29880, 519, 29918, 12181, 29961, 29906, 29962, 529, 10153, 29889, 12181, 29961, 29906, 5387, 13, 4706, 10153, 353, 7442, 29889, 8305, 29898, 2492, 29892, 5135, 29900, 29892, 29871, 29900, 511, 13, 462, 965, 313, 29900, 29892, 29871, 29900, 511, 13, 462, 965, 5135, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 29892, 13, 462, 9651, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 718, 313, 13, 462, 462, 1678, 848, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 1273, 29871, 29906, 8243, 13, 462, 268, 4464, 2433, 13191, 1495, 13, 13, 1678, 736, 10153, 13, 13, 13, 1990, 16740, 29918, 2940, 29918, 29923, 791, 29898, 16390, 24541, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 1967, 29918, 2084, 2433, 29950, 2051, 29967, 485, 801, 261, 713, 29918, 2772, 1022, 29963, 404, 29906, 29900, 29896, 29947, 29918, 3338, 618, 2308, 2806, 2940, 29889, 29873, 361, 742, 13, 462, 3858, 29918, 2084, 2433, 29950, 2051, 29967, 485, 801, 261, 713, 29918, 2772, 1022, 29963, 404, 29906, 29900, 29896, 29947, 29918, 3338, 618, 2308, 2806, 4775, 29889, 29873, 361, 742, 13, 462, 848, 29918, 12181, 7607, 29955, 29892, 29871, 29941, 29941, 29892, 29871, 29941, 29941, 511, 13, 462, 301, 1849, 29918, 12181, 7607, 29896, 29892, 29871, 29946, 29892, 29871, 29946, 511, 13, 462, 380, 2426, 7607, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 511, 13, 462, 3464, 29918, 12324, 29922, 8824, 1125, 13, 4706, 1583, 29889, 3881, 29918, 12324, 353, 3464, 29918, 12324, 13, 4706, 1018, 29901, 13, 9651, 10153, 353, 323, 29889, 326, 949, 29898, 3027, 29918, 2084, 29897, 13, 4706, 5174, 29901, 13, 9651, 10153, 353, 5159, 13, 9651, 260, 361, 353, 323, 29902, 4198, 29889, 3150, 29898, 3027, 29918, 2084, 29897, 13, 9651, 363, 903, 3027, 297, 260, 361, 29889, 1524, 29918, 8346, 7295, 13, 18884, 10153, 29889, 4397, 7373, 3027, 29897, 13, 9651, 10153, 353, 7442, 29889, 1429, 29898, 2492, 29892, 29871, 29900, 29897, 13, 4706, 1018, 29901, 13, 9651, 301, 2204, 353, 323, 29889, 326, 949, 29898, 1643, 29918, 2084, 29897, 13, 4706, 5174, 29901, 13, 9651, 301, 2204, 353, 5159, 13, 9651, 260, 361, 353, 323, 29902, 4198, 29889, 3150, 29898, 1643, 29918, 2084, 29897, 13, 9651, 363, 903, 29880, 519, 297, 260, 361, 29889, 1524, 29918, 8346, 7295, 13, 18884, 301, 2204, 29889, 4397, 7373, 29880, 519, 29897, 13, 9651, 301, 2204, 353, 7442, 29889, 1429, 29898, 26648, 29892, 29871, 29900, 29897, 13, 13, 4706, 10153, 353, 15040, 29918, 12791, 29898, 2492, 29892, 848, 29918, 12181, 29892, 301, 1849, 29918, 12181, 29892, 380, 2426, 29897, 13, 4706, 301, 2204, 353, 15040, 29918, 12791, 29898, 26648, 29892, 848, 29918, 12181, 29892, 301, 1849, 29918, 12181, 29892, 380, 2426, 29897, 13, 4706, 1583, 29889, 990, 29918, 12181, 353, 10153, 29889, 12181, 13, 13, 4706, 1583, 29889, 2492, 353, 10153, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 1583, 29889, 26648, 353, 301, 2204, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 29897, 13, 4706, 1583, 29889, 12181, 353, 1583, 29889, 2492, 29889, 12181, 13, 4706, 1583, 29889, 1272, 29918, 12181, 353, 848, 29918, 12181, 13, 4706, 1583, 29889, 29880, 1849, 29918, 12181, 353, 301, 1849, 29918, 12181, 13, 4706, 1583, 29889, 303, 2426, 353, 380, 2426, 13, 13, 4706, 1583, 29889, 5601, 353, 938, 29898, 9302, 29889, 14939, 3552, 1311, 29889, 12181, 29961, 29900, 29962, 448, 848, 29918, 12181, 29961, 29900, 2314, 847, 380, 2426, 29961, 29900, 29962, 718, 29871, 29896, 876, 13, 4706, 1583, 29889, 4518, 353, 938, 29898, 9302, 29889, 14939, 3552, 1311, 29889, 12181, 29961, 29896, 29962, 448, 848, 29918, 12181, 29961, 29896, 2314, 847, 380, 2426, 29961, 29896, 29962, 718, 29871, 29896, 876, 13, 4706, 1583, 29889, 8235, 353, 938, 29898, 9302, 29889, 14939, 3552, 1311, 29889, 12181, 29961, 29906, 29962, 448, 848, 29918, 12181, 29961, 29906, 2314, 847, 380, 2426, 29961, 29906, 29962, 718, 29871, 29896, 876, 13, 4706, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 353, 313, 13, 9651, 848, 29918, 12181, 29961, 29900, 29962, 334, 1583, 29889, 5601, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 380, 2426, 29961, 29900, 2314, 334, 313, 1311, 29889, 5601, 448, 29871, 29896, 511, 13, 9651, 848, 29918, 12181, 29961, 29896, 29962, 334, 1583, 29889, 4518, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 380, 2426, 29961, 29896, 2314, 334, 313, 1311, 29889, 4518, 448, 29871, 29896, 511, 13, 9651, 848, 29918, 12181, 29961, 29906, 29962, 334, 1583, 29889, 8235, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 380, 2426, 29961, 29906, 2314, 334, 313, 1311, 29889, 8235, 448, 29871, 29896, 29897, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 12181, 353, 313, 13, 9651, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 11724, 13, 9651, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 11724, 13, 9651, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 13140, 353, 313, 13, 9651, 5135, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 29892, 13, 632, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 448, 313, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 1273, 29871, 29906, 8243, 13, 9651, 5135, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 13, 632, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 448, 313, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 1273, 29871, 29906, 8243, 13, 9651, 5135, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 29892, 13, 632, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 448, 313, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 1273, 29871, 29906, 876, 13, 4706, 1723, 13, 13, 4706, 1583, 29889, 26648, 29918, 29920, 353, 5135, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 29892, 13, 462, 418, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29900, 2314, 13, 4706, 1583, 29889, 26648, 29918, 29891, 353, 5135, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 13, 462, 418, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29896, 2314, 13, 4706, 1583, 29889, 26648, 29918, 29916, 353, 5135, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 29892, 13, 462, 418, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29906, 2314, 13, 13, 4706, 1583, 29889, 3317, 29918, 1524, 353, 1583, 29889, 5601, 334, 1583, 29889, 4518, 334, 1583, 29889, 8235, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 3317, 29918, 1524, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 2380, 1125, 13, 4706, 503, 29892, 343, 29892, 921, 353, 7442, 29889, 348, 336, 955, 29918, 2248, 29898, 2248, 29892, 313, 1311, 29889, 5601, 29892, 1583, 29889, 4518, 29892, 1583, 29889, 8235, 876, 13, 4706, 503, 353, 503, 334, 1583, 29889, 303, 2426, 29961, 29900, 29962, 13, 4706, 343, 353, 343, 334, 1583, 29889, 303, 2426, 29961, 29896, 29962, 13, 4706, 921, 353, 921, 334, 1583, 29889, 303, 2426, 29961, 29906, 29962, 13, 13, 4706, 325, 353, 1583, 29889, 2492, 29961, 29920, 29901, 503, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29900, 1402, 13, 9651, 343, 29901, 343, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29896, 1402, 13, 9651, 921, 29901, 921, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29906, 5262, 13, 4706, 301, 2204, 353, 1583, 29889, 26648, 29961, 29920, 29901, 503, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29900, 1402, 13, 795, 343, 29901, 343, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29896, 1402, 13, 795, 921, 29901, 921, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29906, 5262, 13, 4706, 301, 2204, 353, 301, 2204, 29961, 1311, 29889, 26648, 29918, 29920, 29961, 29900, 5387, 1583, 29889, 26648, 29918, 29920, 29961, 29896, 1402, 13, 795, 1583, 29889, 26648, 29918, 29891, 29961, 29900, 5387, 1583, 29889, 26648, 29918, 29891, 29961, 29896, 1402, 13, 795, 1583, 29889, 26648, 29918, 29916, 29961, 29900, 5387, 1583, 29889, 26648, 29918, 29916, 29961, 29896, 5262, 13, 13, 4706, 396, 21981, 675, 13, 4706, 565, 1583, 29889, 3881, 29918, 12324, 29901, 13, 9651, 325, 353, 3464, 29918, 8945, 675, 29898, 29894, 29897, 13, 4706, 1683, 29901, 13, 9651, 325, 353, 313, 29894, 448, 325, 29889, 12676, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 876, 847, 313, 29894, 29889, 4172, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 29897, 718, 29871, 29896, 29872, 29899, 29896, 29906, 29897, 13, 13, 4706, 396, 1763, 323, 6073, 13, 4706, 848, 353, 4842, 305, 29889, 29911, 6073, 29898, 29894, 467, 6948, 802, 29872, 911, 29898, 29900, 29897, 13, 4706, 301, 1849, 353, 4842, 305, 29889, 29911, 6073, 29898, 26648, 849, 1583, 29889, 26648, 29889, 3317, 16655, 5426, 580, 13, 13, 4706, 736, 848, 29892, 301, 1849, 13, 13, 13, 1990, 18862, 29918, 2940, 29918, 5323, 262, 29898, 16390, 24541, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 13, 462, 4558, 29918, 2084, 29892, 13, 462, 11073, 29918, 2084, 29892, 13, 462, 4236, 29918, 1524, 29922, 29896, 29900, 29900, 29900, 29892, 13, 462, 848, 29918, 12181, 7607, 29955, 29892, 29871, 29941, 29941, 29892, 29871, 29941, 29941, 511, 13, 462, 301, 1849, 29918, 12181, 7607, 29896, 29892, 29871, 29946, 29892, 29871, 29946, 511, 13, 462, 380, 2426, 7607, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 511, 13, 462, 3464, 29918, 12324, 29922, 8824, 1125, 13, 4706, 1583, 29889, 3881, 29918, 12324, 353, 3464, 29918, 12324, 13, 4706, 4558, 353, 12705, 29898, 23705, 29889, 23705, 29898, 8346, 29918, 2084, 718, 525, 5515, 29873, 361, 8785, 13, 4706, 11073, 353, 12705, 29898, 23705, 29889, 23705, 29898, 21134, 29918, 2084, 718, 525, 5515, 29873, 361, 8785, 13, 13, 4706, 1583, 29889, 990, 29918, 12181, 353, 5159, 13, 4706, 1583, 29889, 12181, 353, 5159, 13, 4706, 1583, 29889, 2492, 353, 5159, 13, 4706, 1583, 29889, 26648, 353, 5159, 13, 4706, 1583, 29889, 1272, 29918, 12181, 353, 848, 29918, 12181, 13, 4706, 1583, 29889, 29880, 1849, 29918, 12181, 353, 301, 1849, 29918, 12181, 13, 4706, 1583, 29889, 303, 2426, 353, 380, 2426, 13, 4706, 1583, 29889, 5601, 353, 5159, 13, 4706, 1583, 29889, 4518, 353, 5159, 13, 4706, 1583, 29889, 8235, 353, 5159, 13, 4706, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 353, 5159, 13, 4706, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 12181, 353, 5159, 13, 4706, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 13140, 353, 5159, 13, 4706, 1583, 29889, 26648, 29918, 29920, 353, 5159, 13, 4706, 1583, 29889, 26648, 29918, 29891, 353, 5159, 13, 4706, 1583, 29889, 26648, 29918, 29916, 353, 5159, 13, 13, 4706, 363, 10153, 29918, 2084, 29892, 301, 2204, 29918, 2084, 297, 14319, 29898, 8346, 29892, 11073, 1125, 13, 9651, 1018, 29901, 13, 18884, 10153, 353, 323, 29889, 326, 949, 29898, 2492, 29918, 2084, 29897, 13, 9651, 5174, 29901, 13, 18884, 10153, 353, 5159, 13, 18884, 260, 361, 353, 323, 29902, 4198, 29889, 3150, 29898, 2492, 29918, 2084, 29897, 13, 18884, 363, 903, 3027, 297, 260, 361, 29889, 1524, 29918, 8346, 7295, 13, 462, 1678, 10153, 29889, 4397, 7373, 3027, 29897, 13, 18884, 10153, 353, 7442, 29889, 1429, 29898, 2492, 29892, 29871, 29900, 29897, 13, 9651, 1018, 29901, 13, 18884, 301, 2204, 353, 323, 29889, 326, 949, 29898, 26648, 29918, 2084, 29897, 13, 9651, 5174, 29901, 13, 18884, 301, 2204, 353, 5159, 13, 18884, 260, 361, 353, 323, 29902, 4198, 29889, 3150, 29898, 26648, 29918, 2084, 29897, 13, 18884, 363, 903, 29880, 519, 297, 260, 361, 29889, 1524, 29918, 8346, 7295, 13, 462, 1678, 301, 2204, 29889, 4397, 7373, 29880, 519, 29897, 13, 18884, 301, 2204, 353, 7442, 29889, 1429, 29898, 26648, 29892, 29871, 29900, 29897, 13, 13, 9651, 10153, 353, 15040, 29918, 12791, 29898, 2492, 29892, 848, 29918, 12181, 29892, 301, 1849, 29918, 12181, 29892, 380, 2426, 29897, 13, 9651, 301, 2204, 353, 15040, 29918, 12791, 29898, 26648, 29892, 848, 29918, 12181, 29892, 301, 1849, 29918, 12181, 29892, 380, 2426, 29897, 13, 13, 9651, 1583, 29889, 990, 29918, 12181, 29889, 4397, 29898, 2492, 29889, 12181, 29897, 13, 13, 9651, 1583, 29889, 2492, 29889, 4397, 29898, 2492, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 9651, 1583, 29889, 26648, 29889, 4397, 29898, 26648, 29889, 579, 668, 29898, 9302, 29889, 7411, 29941, 29906, 876, 13, 13, 9651, 8267, 353, 10153, 29889, 12181, 13, 9651, 1583, 29889, 12181, 29889, 4397, 29898, 12181, 29897, 13, 13, 9651, 9275, 353, 938, 29898, 9302, 29889, 14939, 3552, 12181, 29961, 29900, 29962, 448, 848, 29918, 12181, 29961, 29900, 2314, 847, 380, 2426, 29961, 29900, 29962, 718, 29871, 29896, 876, 13, 9651, 13475, 353, 938, 29898, 9302, 29889, 14939, 3552, 12181, 29961, 29896, 29962, 448, 848, 29918, 12181, 29961, 29896, 2314, 847, 380, 2426, 29961, 29896, 29962, 718, 29871, 29896, 876, 13, 9651, 15414, 353, 938, 29898, 9302, 29889, 14939, 3552, 12181, 29961, 29906, 29962, 448, 848, 29918, 12181, 29961, 29906, 2314, 847, 380, 2426, 29961, 29906, 29962, 718, 29871, 29896, 876, 13, 9651, 11828, 29918, 1272, 29918, 12181, 353, 313, 13, 18884, 848, 29918, 12181, 29961, 29900, 29962, 334, 9275, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 380, 2426, 29961, 29900, 2314, 334, 313, 5601, 448, 29871, 29896, 511, 13, 18884, 848, 29918, 12181, 29961, 29896, 29962, 334, 13475, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 380, 2426, 29961, 29896, 2314, 334, 313, 4518, 448, 29871, 29896, 511, 13, 18884, 848, 29918, 12181, 29961, 29906, 29962, 334, 15414, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 380, 2426, 29961, 29906, 2314, 334, 313, 8235, 448, 29871, 29896, 29897, 13, 9651, 1723, 13, 13, 9651, 11828, 29918, 29880, 519, 29918, 12181, 353, 313, 13, 18884, 11828, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 448, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 11724, 13, 18884, 11828, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 448, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 11724, 13, 18884, 11828, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 448, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 13, 9651, 1723, 13, 13, 9651, 11828, 29918, 29880, 519, 29918, 13140, 353, 313, 13, 18884, 5135, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 29892, 13, 462, 11828, 29918, 1272, 29918, 12181, 29961, 29900, 29962, 448, 313, 13, 462, 308, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 1273, 29871, 29906, 8243, 13, 18884, 5135, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 13, 462, 11828, 29918, 1272, 29918, 12181, 29961, 29896, 29962, 448, 313, 13, 462, 308, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 1273, 29871, 29906, 8243, 13, 18884, 5135, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 29892, 13, 462, 11828, 29918, 1272, 29918, 12181, 29961, 29906, 29962, 448, 313, 13, 462, 308, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 718, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 1273, 29871, 29906, 876, 13, 9651, 1723, 13, 13, 9651, 301, 2204, 29918, 29920, 353, 5135, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 29892, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29900, 29962, 448, 301, 1849, 29918, 12181, 29961, 29900, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29900, 2314, 13, 9651, 301, 2204, 29918, 29891, 353, 5135, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 29892, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29896, 29962, 448, 301, 1849, 29918, 12181, 29961, 29896, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29896, 2314, 13, 9651, 301, 2204, 29918, 29916, 353, 5135, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 29892, 13, 462, 268, 313, 1272, 29918, 12181, 29961, 29906, 29962, 448, 301, 1849, 29918, 12181, 29961, 29906, 2314, 849, 29871, 29906, 718, 301, 1849, 29918, 12181, 29961, 29906, 2314, 13, 13, 9651, 1583, 29889, 5601, 29889, 4397, 29898, 5601, 29897, 13, 9651, 1583, 29889, 4518, 29889, 4397, 29898, 4518, 29897, 13, 9651, 1583, 29889, 8235, 29889, 4397, 29898, 8235, 29897, 13, 9651, 1583, 29889, 15987, 573, 29918, 1272, 29918, 12181, 29889, 4397, 29898, 15987, 573, 29918, 1272, 29918, 12181, 29897, 13, 9651, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 12181, 29889, 4397, 29898, 15987, 573, 29918, 29880, 519, 29918, 12181, 29897, 13, 9651, 1583, 29889, 15987, 573, 29918, 29880, 519, 29918, 13140, 29889, 4397, 29898, 15987, 573, 29918, 29880, 519, 29918, 13140, 29897, 13, 9651, 1583, 29889, 26648, 29918, 29920, 29889, 4397, 29898, 26648, 29918, 29920, 29897, 13, 9651, 1583, 29889, 26648, 29918, 29891, 29889, 4397, 29898, 26648, 29918, 29891, 29897, 13, 9651, 1583, 29889, 26648, 29918, 29916, 29889, 4397, 29898, 26648, 29918, 29916, 29897, 13, 13, 4706, 1583, 29889, 3317, 29918, 1524, 353, 4236, 29918, 1524, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 3317, 29918, 1524, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 2380, 1125, 13, 4706, 474, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 7431, 29898, 1311, 29889, 2492, 876, 13, 4706, 503, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 1583, 29889, 5601, 29961, 29875, 2314, 13, 4706, 343, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 1583, 29889, 4518, 29961, 29875, 2314, 13, 4706, 921, 353, 7442, 29889, 8172, 29889, 9502, 524, 29898, 29900, 29892, 1583, 29889, 8235, 29961, 29875, 2314, 13, 4706, 503, 353, 503, 334, 1583, 29889, 303, 2426, 29961, 29900, 29962, 13, 4706, 343, 353, 343, 334, 1583, 29889, 303, 2426, 29961, 29896, 29962, 13, 4706, 921, 353, 921, 334, 1583, 29889, 303, 2426, 29961, 29906, 29962, 13, 13, 4706, 325, 353, 1583, 29889, 2492, 29961, 29875, 3816, 29920, 29901, 503, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29900, 1402, 13, 9651, 343, 29901, 343, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29896, 1402, 13, 9651, 921, 29901, 921, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29906, 5262, 13, 4706, 301, 2204, 353, 1583, 29889, 26648, 29961, 29875, 3816, 29920, 29901, 503, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29900, 1402, 13, 795, 343, 29901, 343, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29896, 1402, 13, 795, 921, 29901, 921, 718, 1583, 29889, 1272, 29918, 12181, 29961, 29906, 5262, 13, 4706, 301, 2204, 353, 301, 2204, 29961, 1311, 29889, 26648, 29918, 29920, 29961, 29875, 3816, 29900, 5387, 1583, 29889, 26648, 29918, 29920, 29961, 29875, 3816, 29896, 1402, 13, 795, 1583, 29889, 26648, 29918, 29891, 29961, 29875, 3816, 29900, 5387, 1583, 29889, 26648, 29918, 29891, 29961, 29875, 3816, 29896, 1402, 13, 795, 1583, 29889, 26648, 29918, 29916, 29961, 29875, 3816, 29900, 5387, 1583, 29889, 26648, 29918, 29916, 29961, 29875, 3816, 29896, 5262, 13, 13, 4706, 396, 21981, 675, 13, 4706, 565, 1583, 29889, 3881, 29918, 12324, 29901, 13, 9651, 325, 353, 3464, 29918, 8945, 675, 29898, 29894, 29897, 13, 4706, 1683, 29901, 13, 9651, 325, 353, 313, 29894, 448, 325, 29889, 12676, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 876, 847, 313, 29894, 29889, 4172, 29898, 8990, 7607, 29896, 29892, 29871, 29906, 511, 3013, 6229, 29879, 29922, 5574, 29897, 718, 29871, 29896, 29872, 29899, 29896, 29906, 29897, 13, 13, 4706, 396, 1763, 323, 6073, 13, 4706, 848, 353, 4842, 305, 29889, 29911, 6073, 29898, 29894, 467, 6948, 802, 29872, 911, 29898, 29900, 29897, 13, 4706, 301, 1849, 353, 4842, 305, 29889, 29911, 6073, 29898, 26648, 849, 29871, 29906, 29945, 29945, 467, 5426, 580, 13, 13, 4706, 736, 848, 29892, 301, 1849, 13, 2 ]
src/scripts/merge_pandas_conll.py
acoli-repo/OpenIE_Stanovsky_Dagan
117
117220
""" Usage: merge_pandas_conll --out=OUTPUT_FN <filenames>... Merge a list of data frames in csv format and print to output file. """ from docopt import docopt import pandas as pd import logging logging.basicConfig(level = logging.DEBUG) if __name__ == "__main__": args = docopt(__doc__) logging.debug(args) input_fns = args["<filenames>"] out_fn = args["--out"] pd.concat([pd.read_csv(fn, sep = '\t', header = 0) for fn in input_fns]).to_csv(out_fn, sep = '\t', header = True, index = False)
[ 1, 9995, 10783, 482, 29901, 13, 1678, 10366, 29918, 15112, 29918, 535, 645, 1192, 449, 29922, 12015, 12336, 29918, 29943, 29940, 529, 1777, 264, 1280, 29958, 856, 13, 13, 15836, 479, 263, 1051, 310, 848, 16608, 297, 11799, 3402, 322, 1596, 304, 1962, 934, 29889, 13, 15945, 29908, 13, 3166, 437, 1111, 415, 1053, 437, 1111, 415, 13, 5215, 11701, 408, 10518, 13, 5215, 12183, 13, 21027, 29889, 16121, 3991, 29898, 5563, 353, 12183, 29889, 18525, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 6389, 353, 437, 1111, 415, 22168, 1514, 1649, 29897, 13, 1678, 12183, 29889, 8382, 29898, 5085, 29897, 13, 1678, 1881, 29918, 29888, 1983, 353, 6389, 3366, 29966, 1777, 264, 1280, 29958, 3108, 13, 1678, 714, 29918, 9144, 353, 6389, 3366, 489, 449, 3108, 13, 1678, 10518, 29889, 17685, 4197, 15926, 29889, 949, 29918, 7638, 29898, 9144, 29892, 13, 462, 965, 16345, 353, 11297, 29873, 742, 13, 462, 965, 4839, 353, 29871, 29900, 29897, 13, 1669, 363, 7876, 297, 1881, 29918, 29888, 1983, 14664, 517, 29918, 7638, 29898, 449, 29918, 9144, 29892, 13, 462, 462, 9651, 16345, 353, 11297, 29873, 742, 13, 462, 462, 9651, 4839, 353, 5852, 29892, 13, 462, 462, 9651, 2380, 353, 7700, 29897, 13, 2 ]
nixui/utils/store.py
yater/nix-gui
254
177322
<gh_stars>100-1000 import os def get_store_path(): if 'XDG_CONFIG_HOME' in os.environ: config_home = os.environ['XDG_CONFIG_HOME'] else: config_home = os.path.join( os.getenv("HOME"), '.config' ) return os.path.join( config_home, 'nixgui' )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29899, 29896, 29900, 29900, 29900, 13, 5215, 2897, 13, 13, 13, 1753, 679, 29918, 8899, 29918, 2084, 7295, 13, 1678, 565, 525, 29990, 29928, 29954, 29918, 25903, 29918, 17353, 29915, 297, 2897, 29889, 21813, 29901, 13, 4706, 2295, 29918, 5184, 353, 2897, 29889, 21813, 1839, 29990, 29928, 29954, 29918, 25903, 29918, 17353, 2033, 13, 1678, 1683, 29901, 13, 4706, 2295, 29918, 5184, 353, 2897, 29889, 2084, 29889, 7122, 29898, 13, 9651, 2897, 29889, 657, 6272, 703, 17353, 4968, 13, 9651, 15300, 2917, 29915, 13, 4706, 1723, 13, 1678, 736, 2897, 29889, 2084, 29889, 7122, 29898, 13, 4706, 2295, 29918, 5184, 29892, 13, 4706, 525, 29876, 861, 23569, 29915, 13, 1678, 1723, 13, 2 ]
apps/useradmin/src/useradmin/models.py
ajay25/hue
0
129303
#!/usr/bin/env python # Licensed to Cloudera, Inc. under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. Cloudera, Inc. 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. """ The core of this module adds permissions functionality to Hue applications. A "Hue Permission" (colloquially, appname.action, but stored in the HuePermission model) is a way to specify some action whose control may be restricted. Every Hue application, by default, has an "access" action. To specify extra actions, applications can specify them in appname.settings.PERMISSION_ACTIONS, as pairs of (action_name, description). Several mechanisms enforce permission. First of all, the "access" permission is controlled by LoginAndPermissionMiddleware. For eligible views within an application, the access permission is checked. Second, views may use @desktop.decorators.hue_permission_required("action", "app") to annotate their function, and this decorator will check a permission. Thirdly, you may wish to do so manually, by using something akin to: app = desktop.lib.apputil.get_current_app() # a string dp = HuePermission.objects.get(app=pp, action=action) request.user.has_hue_permission(dp) Permissions may be granted to groups, but not, currently, to users. A user's abilities is the union of all permissions the group has access to. Note that Django itself has a notion of users, groups, and permissions. We re-use Django's notion of users and groups, but ignore its notion of permissions. The permissions notion in Django is strongly tied to what models you may or may not edit, and there are elaborations (especially in Django 1.2) to manipulate this row by row. This does not map nicely onto actions which may not relate to database models. """ import collections import json import logging from datetime import datetime from enum import Enum from django.db import connection, models, transaction from django.contrib.auth import models as auth_models from django.contrib.auth.models import AbstractUser, BaseUserManager from django.core.cache import cache from django.utils import timezone as dtz from django.utils.translation import ugettext_lazy as _t from desktop import appmanager from desktop.conf import ENABLE_ORGANIZATIONS, ENABLE_CONNECTORS from desktop.lib.connectors.models import _get_installed_connectors from desktop.lib.exceptions_renderable import PopupException from desktop.lib.idbroker.conf import is_idbroker_enabled from desktop.monkey_patches import monkey_patch_username_validator from useradmin.conf import DEFAULT_USER_GROUP if ENABLE_ORGANIZATIONS.get(): from useradmin.models2 import OrganizationUser as User, OrganizationGroup as Group, Organization, default_organization, get_organization else: from django.contrib.auth.models import User, Group class Organization(): pass def default_organization(): pass def get_organization(): pass monkey_patch_username_validator() LOG = logging.getLogger(__name__) class UserProfile(models.Model): """ Extra settings / properties to store for each user. """ class CreationMethod(Enum): HUE = 1 EXTERNAL = 2 user = models.OneToOneField(User, unique=True) home_directory = models.CharField(editable=True, max_length=1024, null=True) creation_method = models.CharField(editable=True, null=False, max_length=64, default=CreationMethod.HUE.name) first_login = models.BooleanField(default=True, verbose_name=_t('First Login'), help_text=_t('If this is users first login.')) last_activity = models.DateTimeField(auto_now=True, db_index=True) json_data = models.TextField(default='{}') def get_groups(self): return self.user.groups.all() def _lookup_permission(self, app, action): # We cache it instead of doing HuePermission.objects.get(app=app, action=action). To revert with Django 1.6 perms = cache.get('perms') if not perms: perms = dict([('%s:%s' % (p.app, p.action), p) for p in HuePermission.objects.all()]) cache.set('perms', perms, 60 * 60) return perms.get('%s:%s' % (app, action)) def has_hue_permission(self, action=None, app=None, perm=None): if perm is None: try: perm = self._lookup_permission(app, action) except HuePermission.DoesNotExist: LOG.exception("Permission object %s - %s not available. Was Django migrate command run after installation?" % (app, action)) return self.user.is_superuser if self.user.is_superuser: return True if ENABLE_CONNECTORS.get() and app in ('jobbrowser', 'metastore', 'filebrowser', 'indexer'): return True group_ids = self.user.groups.values_list('id', flat=True) return GroupPermission.objects.filter(group__id__in=group_ids, hue_permission=perm).exists() def get_permissions(self): return HuePermission.objects.filter(groups__user=self.user) def check_hue_permission(self, perm=None, app=None, action=None): """ Raises a PopupException if permission is denied. Either perm or both app and action are required. """ if perm is None: perm = self._lookup_permission(app, action) if self.has_hue_permission(perm): return else: raise PopupException(_t("You do not have permissions to %(description)s.") % {'description': perm.description}) @property def data(self): if not self.json_data: self.json_data = json.dumps({}) return json.loads(self.json_data) def update_data(self, val): data_dict = self.data data_dict.update(val) self.json_data = json.dumps(data_dict) def get_profile(user): """ Caches the profile, to avoid DB queries at every call. """ if hasattr(user, "_cached_userman_profile"): return user._cached_userman_profile else: # Lazily create profile. try: profile = UserProfile.objects.get(user=user) except UserProfile.DoesNotExist as e: profile = create_profile_for_user(user) user._cached_userman_profile = profile return profile def group_has_permission(group, perm): return GroupPermission.objects.filter(group=group, hue_permission=perm).exists() def group_permissions(group): return HuePermission.objects.filter(grouppermission__group=group).all() # Create a user profile for the given user def create_profile_for_user(user): p = UserProfile() p.user = user p.last_activity = dtz.now() p.home_directory = "/user/%s" % p.user.username try: p.save() return p except: LOG.exception("Failed to automatically create user profile.") return None class LdapGroup(models.Model): """ Groups that come from LDAP originally will have an LdapGroup record generated at creation time. """ group = models.ForeignKey(Group, related_name="group") class GroupPermission(models.Model): """ Represents the permissions a group has. """ group = models.ForeignKey(Group) hue_permission = models.ForeignKey("HuePermission") class HuePermission(models.Model): """ Set of non-object specific permissions that an app supports. Currently only assign permissions to groups (not users or roles). Could be move to support Apache Ranger permissions, AWS IAM... for Hue and connector access. """ app = models.CharField(max_length=30) action = models.CharField(max_length=100) description = models.CharField(max_length=255) groups = models.ManyToManyField(Group, through=GroupPermission) def __str__(self): return "%s.%s:%s(%d)" % (self.app, self.action, self.description, self.pk) @classmethod def get_app_permission(cls, hue_app, action): return HuePermission.objects.get(app=hue_app, action=action) def get_default_user_group(**kwargs): default_user_group = DEFAULT_USER_GROUP.get() if default_user_group is None: return None if ENABLE_ORGANIZATIONS.get(): group, created = Group.objects.get_or_create(name=default_user_group, organization=default_organization()) else: group, created = Group.objects.get_or_create(name=default_user_group) if created: group.save() return group def update_app_permissions(**kwargs): """ Keep in sync apps and connectors permissions into the database table. Map app + action to a HuePermission. v2 Based on the connectors. Permissions are either based on connectors instances or Hue specific actions. Permissions can be deleted or added dynamically. v1 This is a 'migrate' callback. We never delete permissions automatically, because apps might come and go. Note that signing up to the "migrate" signal is not necessarily the best thing we can do, since some apps might not have models, but nonetheless, "migrate" is typically run when apps are installed. """ created_tables = connection.introspection.table_names() if u'useradmin_huepermission' in created_tables: # Check if Useradmin has been installed. current = {} try: for dp in HuePermission.objects.all(): current.setdefault(dp.app, {})[dp.action] = dp except: LOG.exception('failed to get permissions') return updated = 0 uptodate = 0 added = [] if ENABLE_CONNECTORS.get(): old_apps = list(current.keys()) ConnectorPerm = collections.namedtuple('ConnectorPerm', 'name nice_name settings') apps = [ ConnectorPerm(name=connector['name'], nice_name=connector['nice_name'], settings=[]) for connector in _get_installed_connectors() ] else: old_apps = [] apps = appmanager.DESKTOP_APPS for app in apps: app_name = app.name permission_description = "Access the %s connection" % app.nice_name if ENABLE_CONNECTORS.get() else "Launch this application" actions = set([("access", permission_description)]) actions.update(getattr(app.settings, "PERMISSION_ACTIONS", [])) if app_name not in current: current[app_name] = {} if app_name in old_apps: old_apps.remove(app_name) for action, description in actions: c = current[app_name].get(action) if c: if c.description != description: c.description = description c.save() updated += 1 else: uptodate += 1 else: new_dp = HuePermission(app=app_name, action=action, description=description) new_dp.save() added.append(new_dp) # Only with v2 deleted, _ = HuePermission.objects.filter(app__in=old_apps).delete() # Add all permissions to default group except some. default_group = get_default_user_group() if default_group: for new_dp in added: if not (new_dp.app == 'useradmin' and new_dp.action == 'access') and \ not (new_dp.app == 'useradmin' and new_dp.action == 'superuser') and \ not (new_dp.app == 'metastore' and new_dp.action == 'write') and \ not (new_dp.app == 'hbase' and new_dp.action == 'write') and \ not (new_dp.app == 'security' and new_dp.action == 'impersonate') and \ not (new_dp.app == 'filebrowser' and new_dp.action == 's3_access' and not is_idbroker_enabled('s3a')) and \ not (new_dp.app == 'filebrowser' and new_dp.action == 'gs_access' and not is_idbroker_enabled('gs')) and \ not (new_dp.app == 'filebrowser' and new_dp.action == 'adls_access') and \ not (new_dp.app == 'filebrowser' and new_dp.action == 'abfs_access') and \ not (new_dp.app == 'oozie' and new_dp.action == 'disable_editor_access'): GroupPermission.objects.create(group=default_group, hue_permission=new_dp) available = HuePermission.objects.count() stale = available - len(added) - updated - uptodate if len(added) or updated or stale or deleted: LOG.info("HuePermissions: %d added, %d updated, %d up to date, %d stale, %d deleted" % ( len(added), updated, uptodate, stale, deleted ) ) models.signals.post_migrate.connect(update_app_permissions) # models.signals.post_migrate.connect(get_default_user_group) def install_sample_user(django_user=None): """ Setup the de-activated sample user with a certain id. Do not create a user profile. """ from desktop.models import SAMPLE_USER_ID, get_sample_user_install from hadoop import cluster user = None django_username = get_sample_user_install(django_user) if ENABLE_ORGANIZATIONS.get(): lookup = {'email': django_username} django_username_short = django_user.username_short else: lookup = {'username': django_username} django_username_short = django_username try: if User.objects.filter(id=SAMPLE_USER_ID).exists(): user = User.objects.get(id=SAMPLE_USER_ID) LOG.info('Sample user found with username "%s" and User ID: %s' % (user.username, user.id)) elif User.objects.filter(**lookup).exists(): user = User.objects.get(**lookup) LOG.info('Sample user found: %s' % lookup) else: user_attributes = lookup.copy() if ENABLE_ORGANIZATIONS.get(): user_attributes['organization'] = get_organization(user=django_user) user_attributes.update({ 'password': '!', 'is_active': False, 'is_superuser': False, 'id': SAMPLE_USER_ID, 'pk': SAMPLE_USER_ID }) user, created = User.objects.get_or_create(**user_attributes) if created: LOG.info('Installed a user "%s"' % lookup) if user.username != django_username and not ENABLE_ORGANIZATIONS.get(): LOG.warn('Sample user does not have username "%s", will attempt to modify the username.' % django_username) with transaction.atomic(): user = User.objects.get(id=SAMPLE_USER_ID) user.username = django_username user.save() except Exception as ex: LOG.exception('Failed to get or create sample user') # If sample user doesn't belong to default group, add to default group default_group = get_default_user_group() if user is not None and default_group is not None and default_group not in user.groups.all(): user.groups.add(default_group) user.save() fs = cluster.get_hdfs() # If home directory doesn't exist for sample user, create it try: if not fs.do_as_user(django_username_short, fs.get_home_dir): fs.do_as_user(django_username_short, fs.create_home_dir) LOG.info('Created home directory for user: %s' % django_username_short) else: LOG.info('Home directory already exists for user: %s' % django_username) except Exception as ex: LOG.exception('Failed to create home directory for user %s: %s' % (django_username, str(ex))) return user def orm_user_lookup(): return 'email' if ENABLE_ORGANIZATIONS.get() else 'username'
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 10413, 21144, 304, 2233, 283, 672, 29874, 29892, 9266, 29889, 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, 2233, 283, 672, 29874, 29892, 9266, 29889, 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, 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, 15945, 29908, 13, 1576, 7136, 310, 445, 3883, 12778, 11239, 9863, 304, 379, 434, 8324, 29889, 13, 13, 29909, 376, 29950, 434, 20894, 2333, 29908, 313, 1054, 417, 339, 616, 368, 29892, 623, 978, 29889, 2467, 29892, 541, 6087, 297, 278, 379, 434, 27293, 1904, 29897, 338, 263, 982, 304, 6084, 777, 3158, 5069, 13, 6451, 1122, 367, 22078, 29889, 7569, 379, 434, 2280, 29892, 491, 2322, 29892, 756, 385, 376, 5943, 29908, 3158, 29889, 1763, 6084, 4805, 8820, 29892, 8324, 13, 3068, 6084, 963, 297, 623, 978, 29889, 11027, 29889, 13171, 10403, 13507, 29918, 24705, 29903, 29892, 408, 11000, 310, 313, 2467, 29918, 978, 29892, 6139, 467, 13, 13, 29903, 1310, 284, 7208, 12903, 427, 10118, 10751, 29889, 3824, 310, 599, 29892, 278, 376, 5943, 29908, 10751, 13, 275, 20704, 491, 19130, 2855, 27293, 25411, 2519, 29889, 1152, 560, 335, 1821, 8386, 2629, 385, 2280, 29892, 278, 2130, 10751, 338, 7120, 29889, 6440, 29892, 13, 7406, 1122, 671, 732, 20858, 29889, 19557, 4097, 29889, 29882, 434, 29918, 16074, 29918, 12403, 703, 2467, 613, 376, 932, 1159, 304, 9732, 403, 1009, 740, 29892, 322, 445, 10200, 1061, 674, 13, 3198, 263, 10751, 29889, 18008, 368, 29892, 366, 1122, 6398, 304, 437, 577, 7522, 29892, 491, 773, 1554, 263, 9089, 304, 29901, 13, 13, 29871, 623, 353, 14616, 29889, 1982, 29889, 932, 4422, 29889, 657, 29918, 3784, 29918, 932, 580, 396, 263, 1347, 13, 29871, 270, 29886, 353, 379, 434, 27293, 29889, 12650, 29889, 657, 29898, 932, 29922, 407, 29892, 3158, 29922, 2467, 29897, 13, 29871, 2009, 29889, 1792, 29889, 5349, 29918, 29882, 434, 29918, 16074, 29898, 6099, 29897, 13, 13, 15737, 6847, 1122, 367, 16896, 304, 6471, 29892, 541, 451, 29892, 5279, 29892, 304, 4160, 29889, 319, 1404, 29915, 29879, 633, 9770, 338, 278, 9833, 310, 599, 11239, 278, 2318, 13, 5349, 2130, 304, 29889, 13, 13, 9842, 393, 15337, 3528, 756, 263, 17837, 310, 4160, 29892, 6471, 29892, 322, 11239, 29889, 1334, 337, 29899, 1509, 15337, 29915, 29879, 17837, 310, 4160, 322, 6471, 29892, 541, 11455, 967, 17837, 310, 13, 17858, 6847, 29889, 450, 11239, 17837, 297, 15337, 338, 13818, 21351, 304, 825, 4733, 366, 1122, 470, 1122, 451, 3863, 29892, 322, 727, 526, 13771, 800, 313, 267, 25009, 13, 262, 15337, 29871, 29896, 29889, 29906, 29897, 304, 26749, 445, 1948, 491, 1948, 29889, 910, 947, 451, 2910, 28138, 11480, 8820, 607, 1122, 451, 29279, 304, 2566, 4733, 29889, 13, 15945, 29908, 13, 5215, 16250, 13, 5215, 4390, 13, 5215, 12183, 13, 13, 3166, 12865, 1053, 12865, 13, 3166, 14115, 1053, 1174, 398, 13, 13, 3166, 9557, 29889, 2585, 1053, 3957, 29892, 4733, 29892, 10804, 13, 3166, 9557, 29889, 21570, 29889, 5150, 1053, 4733, 408, 4817, 29918, 9794, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 25513, 2659, 29892, 7399, 2659, 3260, 13, 3166, 9557, 29889, 3221, 29889, 8173, 1053, 7090, 13, 3166, 9557, 29889, 13239, 1053, 29431, 408, 11636, 29920, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 318, 657, 726, 29918, 433, 1537, 408, 903, 29873, 13, 13, 3166, 14616, 1053, 623, 12847, 13, 3166, 14616, 29889, 5527, 1053, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29892, 12524, 6181, 29918, 6007, 8186, 1783, 24125, 13, 3166, 14616, 29889, 1982, 29889, 6915, 943, 29889, 9794, 1053, 903, 657, 29918, 25537, 29918, 6915, 943, 13, 3166, 14616, 29889, 1982, 29889, 11739, 29879, 29918, 9482, 519, 1053, 6977, 786, 2451, 13, 3166, 14616, 29889, 1982, 29889, 333, 6729, 3946, 29889, 5527, 1053, 338, 29918, 333, 6729, 3946, 29918, 17590, 13, 3166, 14616, 29889, 3712, 1989, 29918, 5041, 267, 1053, 1601, 1989, 29918, 5041, 29918, 6786, 29918, 3084, 1061, 13, 13, 3166, 1404, 6406, 29889, 5527, 1053, 22236, 29918, 11889, 29918, 26284, 13, 13, 13, 361, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 7295, 13, 29871, 515, 1404, 6406, 29889, 9794, 29906, 1053, 9205, 2133, 2659, 408, 4911, 29892, 9205, 2133, 4782, 408, 6431, 29892, 9205, 2133, 29892, 2322, 29918, 6388, 2133, 29892, 679, 29918, 6388, 2133, 13, 2870, 29901, 13, 29871, 515, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 29892, 6431, 13, 29871, 770, 9205, 2133, 7295, 1209, 13, 29871, 822, 2322, 29918, 6388, 2133, 7295, 1209, 13, 29871, 822, 679, 29918, 6388, 2133, 7295, 1209, 13, 13, 29871, 1601, 1989, 29918, 5041, 29918, 6786, 29918, 3084, 1061, 580, 13, 13, 13, 14480, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 4911, 13909, 29898, 9794, 29889, 3195, 1125, 13, 29871, 9995, 13, 29871, 7338, 336, 6055, 847, 4426, 304, 3787, 363, 1269, 1404, 29889, 13, 29871, 9995, 13, 29871, 770, 6760, 362, 4062, 29898, 16854, 1125, 13, 1678, 379, 4462, 353, 29871, 29896, 13, 1678, 8528, 4945, 29940, 1964, 353, 29871, 29906, 13, 13, 29871, 1404, 353, 4733, 29889, 6716, 1762, 6716, 3073, 29898, 2659, 29892, 5412, 29922, 5574, 29897, 13, 29871, 3271, 29918, 12322, 353, 4733, 29889, 27890, 29898, 5628, 519, 29922, 5574, 29892, 4236, 29918, 2848, 29922, 29896, 29900, 29906, 29946, 29892, 1870, 29922, 5574, 29897, 13, 29871, 11265, 29918, 5696, 353, 4733, 29889, 27890, 29898, 5628, 519, 29922, 5574, 29892, 1870, 29922, 8824, 29892, 4236, 29918, 2848, 29922, 29953, 29946, 29892, 2322, 29922, 9832, 362, 4062, 29889, 29950, 4462, 29889, 978, 29897, 13, 29871, 937, 29918, 7507, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 5574, 29892, 26952, 29918, 978, 29922, 29918, 29873, 877, 6730, 19130, 5477, 1371, 29918, 726, 29922, 29918, 29873, 877, 3644, 445, 338, 4160, 937, 6464, 6169, 876, 13, 29871, 1833, 29918, 10072, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 29871, 4390, 29918, 1272, 353, 4733, 29889, 15778, 29898, 4381, 2433, 8875, 1495, 13, 13, 29871, 822, 679, 29918, 13155, 29898, 1311, 1125, 13, 1678, 736, 1583, 29889, 1792, 29889, 13155, 29889, 497, 580, 13, 13, 29871, 822, 903, 20401, 29918, 16074, 29898, 1311, 29892, 623, 29892, 3158, 1125, 13, 1678, 396, 1334, 7090, 372, 2012, 310, 2599, 379, 434, 27293, 29889, 12650, 29889, 657, 29898, 932, 29922, 932, 29892, 3158, 29922, 2467, 467, 1763, 29538, 411, 15337, 29871, 29896, 29889, 29953, 13, 1678, 639, 1516, 353, 7090, 29889, 657, 877, 546, 1516, 1495, 13, 1678, 565, 451, 639, 1516, 29901, 13, 418, 639, 1516, 353, 9657, 4197, 877, 29995, 29879, 16664, 29879, 29915, 1273, 313, 29886, 29889, 932, 29892, 282, 29889, 2467, 511, 282, 29897, 363, 282, 297, 379, 434, 27293, 29889, 12650, 29889, 497, 580, 2314, 13, 418, 7090, 29889, 842, 877, 546, 1516, 742, 639, 1516, 29892, 29871, 29953, 29900, 334, 29871, 29953, 29900, 29897, 13, 1678, 736, 639, 1516, 29889, 657, 877, 29995, 29879, 16664, 29879, 29915, 1273, 313, 932, 29892, 3158, 876, 13, 13, 29871, 822, 756, 29918, 29882, 434, 29918, 16074, 29898, 1311, 29892, 3158, 29922, 8516, 29892, 623, 29922, 8516, 29892, 3635, 29922, 8516, 1125, 13, 1678, 565, 3635, 338, 6213, 29901, 13, 418, 1018, 29901, 13, 4706, 3635, 353, 1583, 3032, 20401, 29918, 16074, 29898, 932, 29892, 3158, 29897, 13, 418, 5174, 379, 434, 27293, 29889, 25125, 3664, 1252, 391, 29901, 13, 4706, 25401, 29889, 11739, 703, 27293, 1203, 1273, 29879, 448, 1273, 29879, 451, 3625, 29889, 12547, 15337, 9725, 403, 1899, 1065, 1156, 11161, 3026, 1273, 313, 932, 29892, 3158, 876, 13, 4706, 736, 1583, 29889, 1792, 29889, 275, 29918, 9136, 1792, 13, 1678, 565, 1583, 29889, 1792, 29889, 275, 29918, 9136, 1792, 29901, 13, 418, 736, 5852, 13, 1678, 565, 12524, 6181, 29918, 6007, 8186, 1783, 24125, 29889, 657, 580, 322, 623, 297, 6702, 9057, 15965, 742, 525, 2527, 579, 487, 742, 525, 1445, 15965, 742, 525, 2248, 261, 29374, 13, 418, 736, 5852, 13, 13, 1678, 2318, 29918, 4841, 353, 1583, 29889, 1792, 29889, 13155, 29889, 5975, 29918, 1761, 877, 333, 742, 12151, 29922, 5574, 29897, 13, 1678, 736, 6431, 27293, 29889, 12650, 29889, 4572, 29898, 2972, 1649, 333, 1649, 262, 29922, 2972, 29918, 4841, 29892, 298, 434, 29918, 16074, 29922, 17858, 467, 9933, 580, 13, 13, 29871, 822, 679, 29918, 17858, 6847, 29898, 1311, 1125, 13, 1678, 736, 379, 434, 27293, 29889, 12650, 29889, 4572, 29898, 13155, 1649, 1792, 29922, 1311, 29889, 1792, 29897, 13, 13, 29871, 822, 1423, 29918, 29882, 434, 29918, 16074, 29898, 1311, 29892, 3635, 29922, 8516, 29892, 623, 29922, 8516, 29892, 3158, 29922, 8516, 1125, 13, 1678, 9995, 13, 1678, 390, 1759, 267, 263, 6977, 786, 2451, 565, 10751, 338, 17935, 29889, 13, 13, 1678, 20370, 3635, 470, 1716, 623, 322, 3158, 526, 3734, 29889, 13, 1678, 9995, 13, 1678, 565, 3635, 338, 6213, 29901, 13, 418, 3635, 353, 1583, 3032, 20401, 29918, 16074, 29898, 932, 29892, 3158, 29897, 13, 1678, 565, 1583, 29889, 5349, 29918, 29882, 434, 29918, 16074, 29898, 17858, 1125, 13, 418, 736, 13, 1678, 1683, 29901, 13, 418, 12020, 6977, 786, 2451, 7373, 29873, 703, 3492, 437, 451, 505, 11239, 304, 1273, 29898, 8216, 29897, 29879, 23157, 1273, 11117, 8216, 2396, 3635, 29889, 8216, 1800, 13, 13, 29871, 732, 6799, 13, 29871, 822, 848, 29898, 1311, 1125, 13, 1678, 565, 451, 1583, 29889, 3126, 29918, 1272, 29901, 13, 418, 1583, 29889, 3126, 29918, 1272, 353, 4390, 29889, 29881, 17204, 3319, 1800, 13, 1678, 736, 4390, 29889, 18132, 29898, 1311, 29889, 3126, 29918, 1272, 29897, 13, 13, 29871, 822, 2767, 29918, 1272, 29898, 1311, 29892, 659, 1125, 13, 1678, 848, 29918, 8977, 353, 1583, 29889, 1272, 13, 1678, 848, 29918, 8977, 29889, 5504, 29898, 791, 29897, 13, 1678, 1583, 29889, 3126, 29918, 1272, 353, 4390, 29889, 29881, 17204, 29898, 1272, 29918, 8977, 29897, 13, 13, 13, 1753, 679, 29918, 10185, 29898, 1792, 1125, 13, 29871, 9995, 13, 29871, 315, 14520, 278, 8722, 29892, 304, 4772, 6535, 9365, 472, 1432, 1246, 29889, 13, 29871, 9995, 13, 29871, 565, 756, 5552, 29898, 1792, 29892, 11119, 29883, 3791, 29918, 375, 3504, 29918, 10185, 29908, 1125, 13, 1678, 736, 1404, 3032, 29883, 3791, 29918, 375, 3504, 29918, 10185, 13, 29871, 1683, 29901, 13, 1678, 396, 19575, 2354, 1653, 8722, 29889, 13, 1678, 1018, 29901, 13, 418, 8722, 353, 4911, 13909, 29889, 12650, 29889, 657, 29898, 1792, 29922, 1792, 29897, 13, 1678, 5174, 4911, 13909, 29889, 25125, 3664, 1252, 391, 408, 321, 29901, 13, 418, 8722, 353, 1653, 29918, 10185, 29918, 1454, 29918, 1792, 29898, 1792, 29897, 13, 1678, 1404, 3032, 29883, 3791, 29918, 375, 3504, 29918, 10185, 353, 8722, 13, 1678, 736, 8722, 13, 13, 1753, 2318, 29918, 5349, 29918, 16074, 29898, 2972, 29892, 3635, 1125, 13, 29871, 736, 6431, 27293, 29889, 12650, 29889, 4572, 29898, 2972, 29922, 2972, 29892, 298, 434, 29918, 16074, 29922, 17858, 467, 9933, 580, 13, 13, 1753, 2318, 29918, 17858, 6847, 29898, 2972, 1125, 13, 29871, 736, 379, 434, 27293, 29889, 12650, 29889, 4572, 29898, 629, 283, 407, 837, 2333, 1649, 2972, 29922, 2972, 467, 497, 580, 13, 13, 29937, 6204, 263, 1404, 8722, 363, 278, 2183, 1404, 13, 1753, 1653, 29918, 10185, 29918, 1454, 29918, 1792, 29898, 1792, 1125, 13, 29871, 282, 353, 4911, 13909, 580, 13, 29871, 282, 29889, 1792, 353, 1404, 13, 29871, 282, 29889, 4230, 29918, 10072, 353, 11636, 29920, 29889, 3707, 580, 13, 29871, 282, 29889, 5184, 29918, 12322, 353, 5591, 1792, 22584, 29879, 29908, 1273, 282, 29889, 1792, 29889, 6786, 13, 29871, 1018, 29901, 13, 1678, 282, 29889, 7620, 580, 13, 1678, 736, 282, 13, 29871, 5174, 29901, 13, 1678, 25401, 29889, 11739, 703, 17776, 304, 6336, 1653, 1404, 8722, 23157, 13, 1678, 736, 6213, 13, 13, 13, 1990, 365, 29881, 481, 4782, 29898, 9794, 29889, 3195, 1125, 13, 29871, 9995, 13, 29871, 1632, 4410, 393, 2041, 515, 365, 29928, 3301, 10437, 674, 505, 385, 365, 29881, 481, 4782, 13, 29871, 2407, 5759, 472, 11265, 931, 29889, 13, 29871, 9995, 13, 29871, 2318, 353, 4733, 29889, 27755, 2558, 29898, 4782, 29892, 4475, 29918, 978, 543, 2972, 1159, 13, 13, 13, 1990, 6431, 27293, 29898, 9794, 29889, 3195, 1125, 13, 29871, 9995, 13, 29871, 830, 4569, 1237, 278, 11239, 263, 2318, 756, 29889, 13, 29871, 9995, 13, 29871, 2318, 353, 4733, 29889, 27755, 2558, 29898, 4782, 29897, 13, 29871, 298, 434, 29918, 16074, 353, 4733, 29889, 27755, 2558, 703, 29950, 434, 27293, 1159, 13, 13, 13, 1990, 379, 434, 27293, 29898, 9794, 29889, 3195, 1125, 13, 29871, 9995, 13, 29871, 3789, 310, 1661, 29899, 3318, 2702, 11239, 393, 385, 623, 11286, 29889, 13, 13, 29871, 15447, 871, 3566, 11239, 304, 6471, 313, 1333, 4160, 470, 16178, 467, 13, 29871, 6527, 367, 4337, 304, 2304, 13380, 390, 4600, 11239, 29892, 15540, 306, 5194, 856, 363, 379, 434, 322, 1826, 2801, 2130, 29889, 13, 29871, 9995, 13, 29871, 623, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29941, 29900, 29897, 13, 29871, 3158, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29900, 29900, 29897, 13, 29871, 6139, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 13, 29871, 6471, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 4782, 29892, 1549, 29922, 4782, 27293, 29897, 13, 13, 29871, 822, 4770, 710, 12035, 1311, 1125, 13, 1678, 736, 11860, 29879, 29889, 29995, 29879, 16664, 29879, 29414, 29881, 5513, 1273, 313, 1311, 29889, 932, 29892, 1583, 29889, 2467, 29892, 1583, 29889, 8216, 29892, 1583, 29889, 20571, 29897, 13, 13, 29871, 732, 1990, 5696, 13, 29871, 822, 679, 29918, 932, 29918, 16074, 29898, 25932, 29892, 298, 434, 29918, 932, 29892, 3158, 1125, 13, 1678, 736, 379, 434, 27293, 29889, 12650, 29889, 657, 29898, 932, 29922, 29882, 434, 29918, 932, 29892, 3158, 29922, 2467, 29897, 13, 13, 13, 1753, 679, 29918, 4381, 29918, 1792, 29918, 2972, 29898, 1068, 19290, 1125, 13, 29871, 2322, 29918, 1792, 29918, 2972, 353, 22236, 29918, 11889, 29918, 26284, 29889, 657, 580, 13, 29871, 565, 2322, 29918, 1792, 29918, 2972, 338, 6213, 29901, 13, 1678, 736, 6213, 13, 13, 29871, 565, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 7295, 13, 1678, 2318, 29892, 2825, 353, 6431, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 978, 29922, 4381, 29918, 1792, 29918, 2972, 29892, 13013, 29922, 4381, 29918, 6388, 2133, 3101, 13, 29871, 1683, 29901, 13, 1678, 2318, 29892, 2825, 353, 6431, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 978, 29922, 4381, 29918, 1792, 29918, 2972, 29897, 13, 13, 29871, 565, 2825, 29901, 13, 1678, 2318, 29889, 7620, 580, 13, 13, 29871, 736, 2318, 13, 13, 13, 1753, 2767, 29918, 932, 29918, 17858, 6847, 29898, 1068, 19290, 1125, 13, 29871, 9995, 13, 29871, 19152, 297, 16523, 11446, 322, 4511, 943, 11239, 964, 278, 2566, 1591, 29889, 13, 29871, 7315, 623, 718, 3158, 304, 263, 379, 434, 27293, 29889, 13, 13, 29871, 325, 29906, 13, 29871, 16564, 373, 278, 4511, 943, 29889, 13, 29871, 20894, 6847, 526, 2845, 2729, 373, 4511, 943, 8871, 470, 379, 434, 2702, 8820, 29889, 13, 29871, 20894, 6847, 508, 367, 11132, 470, 2715, 11200, 29889, 13, 13, 29871, 325, 29896, 13, 29871, 910, 338, 263, 525, 26983, 403, 29915, 6939, 29889, 13, 13, 29871, 1334, 2360, 5217, 11239, 6336, 29892, 1363, 11446, 1795, 2041, 322, 748, 29889, 13, 13, 29871, 3940, 393, 26188, 701, 304, 278, 376, 26983, 403, 29908, 7182, 338, 451, 12695, 278, 1900, 2655, 591, 508, 437, 29892, 1951, 777, 11446, 1795, 451, 13, 29871, 505, 4733, 29892, 541, 1661, 621, 6393, 29892, 376, 26983, 403, 29908, 338, 12234, 1065, 746, 11446, 526, 5130, 29889, 13, 29871, 9995, 13, 29871, 2825, 29918, 24051, 353, 3957, 29889, 524, 1883, 27988, 29889, 2371, 29918, 7039, 580, 13, 29871, 565, 318, 29915, 1792, 6406, 29918, 29882, 434, 16074, 29915, 297, 2825, 29918, 24051, 29901, 29871, 396, 5399, 565, 4911, 6406, 756, 1063, 5130, 29889, 13, 1678, 1857, 353, 6571, 13, 13, 1678, 1018, 29901, 13, 418, 363, 270, 29886, 297, 379, 434, 27293, 29889, 12650, 29889, 497, 7295, 13, 4706, 1857, 29889, 842, 4381, 29898, 6099, 29889, 932, 29892, 426, 1800, 29961, 6099, 29889, 2467, 29962, 353, 270, 29886, 13, 1678, 5174, 29901, 13, 418, 25401, 29889, 11739, 877, 26061, 304, 679, 11239, 1495, 13, 418, 736, 13, 13, 1678, 4784, 353, 29871, 29900, 13, 1678, 318, 415, 397, 403, 353, 29871, 29900, 13, 1678, 2715, 353, 5159, 13, 13, 1678, 565, 12524, 6181, 29918, 6007, 8186, 1783, 24125, 29889, 657, 7295, 13, 418, 2030, 29918, 13371, 353, 1051, 29898, 3784, 29889, 8149, 3101, 13, 418, 1281, 484, 2801, 15737, 353, 16250, 29889, 17514, 23583, 877, 20971, 2801, 15737, 742, 525, 978, 7575, 29918, 978, 6055, 1495, 13, 418, 11446, 353, 518, 13, 4706, 1281, 484, 2801, 15737, 29898, 978, 29922, 11958, 2801, 1839, 978, 7464, 7575, 29918, 978, 29922, 11958, 2801, 1839, 16533, 29918, 978, 7464, 6055, 11759, 2314, 13, 4706, 363, 1826, 2801, 297, 903, 657, 29918, 25537, 29918, 6915, 943, 580, 13, 418, 4514, 13, 1678, 1683, 29901, 13, 418, 2030, 29918, 13371, 353, 5159, 13, 418, 11446, 353, 623, 12847, 29889, 2287, 16033, 29911, 4590, 29918, 3301, 7024, 13, 13, 1678, 363, 623, 297, 11446, 29901, 13, 418, 623, 29918, 978, 353, 623, 29889, 978, 13, 418, 10751, 29918, 8216, 353, 376, 6638, 278, 1273, 29879, 3957, 29908, 1273, 623, 29889, 16533, 29918, 978, 565, 12524, 6181, 29918, 6007, 8186, 1783, 24125, 29889, 657, 580, 1683, 376, 17641, 445, 2280, 29908, 13, 418, 8820, 353, 731, 4197, 703, 5943, 613, 10751, 29918, 8216, 29897, 2314, 13, 418, 8820, 29889, 5504, 29898, 657, 5552, 29898, 932, 29889, 11027, 29892, 376, 13171, 10403, 13507, 29918, 24705, 29903, 613, 5159, 876, 13, 13, 418, 565, 623, 29918, 978, 451, 297, 1857, 29901, 13, 4706, 1857, 29961, 932, 29918, 978, 29962, 353, 6571, 13, 418, 565, 623, 29918, 978, 297, 2030, 29918, 13371, 29901, 13, 4706, 2030, 29918, 13371, 29889, 5992, 29898, 932, 29918, 978, 29897, 13, 13, 418, 363, 3158, 29892, 6139, 297, 8820, 29901, 13, 4706, 274, 353, 1857, 29961, 932, 29918, 978, 1822, 657, 29898, 2467, 29897, 13, 4706, 565, 274, 29901, 13, 3986, 565, 274, 29889, 8216, 2804, 6139, 29901, 13, 9651, 274, 29889, 8216, 353, 6139, 13, 9651, 274, 29889, 7620, 580, 13, 9651, 4784, 4619, 29871, 29896, 13, 3986, 1683, 29901, 13, 9651, 318, 415, 397, 403, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 3986, 716, 29918, 6099, 353, 379, 434, 27293, 29898, 932, 29922, 932, 29918, 978, 29892, 3158, 29922, 2467, 29892, 6139, 29922, 8216, 29897, 13, 3986, 716, 29918, 6099, 29889, 7620, 580, 13, 3986, 2715, 29889, 4397, 29898, 1482, 29918, 6099, 29897, 13, 13, 1678, 396, 9333, 411, 325, 29906, 13, 1678, 11132, 29892, 903, 353, 379, 434, 27293, 29889, 12650, 29889, 4572, 29898, 932, 1649, 262, 29922, 1025, 29918, 13371, 467, 8143, 580, 13, 13, 1678, 396, 3462, 599, 11239, 304, 2322, 2318, 5174, 777, 29889, 13, 1678, 2322, 29918, 2972, 353, 679, 29918, 4381, 29918, 1792, 29918, 2972, 580, 13, 1678, 565, 2322, 29918, 2972, 29901, 13, 418, 363, 716, 29918, 6099, 297, 2715, 29901, 13, 4706, 565, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1792, 6406, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 5943, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1792, 6406, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 9136, 1792, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 2527, 579, 487, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 3539, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 29882, 3188, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 3539, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 8926, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 6574, 1330, 403, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1445, 15965, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 29879, 29941, 29918, 5943, 29915, 322, 451, 338, 29918, 333, 6729, 3946, 29918, 17590, 877, 29879, 29941, 29874, 8785, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1445, 15965, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 3174, 29918, 5943, 29915, 322, 451, 338, 29918, 333, 6729, 3946, 29918, 17590, 877, 3174, 8785, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1445, 15965, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 328, 3137, 29918, 5943, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 1445, 15965, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 370, 5847, 29918, 5943, 1495, 322, 320, 13, 9651, 451, 313, 1482, 29918, 6099, 29889, 932, 1275, 525, 29877, 2112, 347, 29915, 322, 716, 29918, 6099, 29889, 2467, 1275, 525, 20472, 29918, 15204, 29918, 5943, 29374, 13, 3986, 6431, 27293, 29889, 12650, 29889, 3258, 29898, 2972, 29922, 4381, 29918, 2972, 29892, 298, 434, 29918, 16074, 29922, 1482, 29918, 6099, 29897, 13, 13, 1678, 3625, 353, 379, 434, 27293, 29889, 12650, 29889, 2798, 580, 13, 1678, 380, 744, 353, 3625, 448, 7431, 29898, 23959, 29897, 448, 4784, 448, 318, 415, 397, 403, 13, 13, 1678, 565, 7431, 29898, 23959, 29897, 470, 4784, 470, 380, 744, 470, 11132, 29901, 13, 418, 25401, 29889, 3888, 703, 29950, 434, 15737, 6847, 29901, 1273, 29881, 2715, 29892, 1273, 29881, 4784, 29892, 1273, 29881, 701, 304, 2635, 29892, 1273, 29881, 380, 744, 29892, 1273, 29881, 11132, 29908, 1273, 313, 13, 3986, 7431, 29898, 23959, 511, 4784, 29892, 318, 415, 397, 403, 29892, 380, 744, 29892, 11132, 13, 4706, 1723, 13, 418, 1723, 13, 13, 13, 9794, 29889, 4530, 1338, 29889, 2490, 29918, 26983, 403, 29889, 6915, 29898, 5504, 29918, 932, 29918, 17858, 6847, 29897, 13, 29937, 4733, 29889, 4530, 1338, 29889, 2490, 29918, 26983, 403, 29889, 6915, 29898, 657, 29918, 4381, 29918, 1792, 29918, 2972, 29897, 13, 13, 13, 1753, 2601, 29918, 11249, 29918, 1792, 29898, 14095, 29918, 1792, 29922, 8516, 1125, 13, 29871, 9995, 13, 29871, 3789, 786, 278, 316, 29899, 11236, 630, 4559, 1404, 411, 263, 3058, 1178, 29889, 1938, 451, 1653, 263, 1404, 8722, 29889, 13, 29871, 9995, 13, 29871, 515, 14616, 29889, 9794, 1053, 16698, 3580, 1307, 29918, 11889, 29918, 1367, 29892, 679, 29918, 11249, 29918, 1792, 29918, 6252, 13, 29871, 515, 750, 26793, 1053, 9867, 13, 13, 29871, 1404, 353, 6213, 13, 29871, 9557, 29918, 6786, 353, 679, 29918, 11249, 29918, 1792, 29918, 6252, 29898, 14095, 29918, 1792, 29897, 13, 13, 29871, 565, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 7295, 13, 1678, 16280, 353, 11117, 5269, 2396, 9557, 29918, 6786, 29913, 13, 1678, 9557, 29918, 6786, 29918, 12759, 353, 9557, 29918, 1792, 29889, 6786, 29918, 12759, 13, 29871, 1683, 29901, 13, 1678, 16280, 353, 11117, 6786, 2396, 9557, 29918, 6786, 29913, 13, 1678, 9557, 29918, 6786, 29918, 12759, 353, 9557, 29918, 6786, 13, 13, 29871, 1018, 29901, 13, 1678, 565, 4911, 29889, 12650, 29889, 4572, 29898, 333, 29922, 8132, 3580, 1307, 29918, 11889, 29918, 1367, 467, 9933, 7295, 13, 418, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 333, 29922, 8132, 3580, 1307, 29918, 11889, 29918, 1367, 29897, 13, 418, 25401, 29889, 3888, 877, 17708, 1404, 1476, 411, 8952, 11860, 29879, 29908, 322, 4911, 3553, 29901, 1273, 29879, 29915, 1273, 313, 1792, 29889, 6786, 29892, 1404, 29889, 333, 876, 13, 1678, 25342, 4911, 29889, 12650, 29889, 4572, 29898, 1068, 20401, 467, 9933, 7295, 13, 418, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 1068, 20401, 29897, 13, 418, 25401, 29889, 3888, 877, 17708, 1404, 1476, 29901, 1273, 29879, 29915, 1273, 16280, 29897, 13, 1678, 1683, 29901, 13, 418, 1404, 29918, 15697, 353, 16280, 29889, 8552, 580, 13, 418, 565, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 7295, 13, 4706, 1404, 29918, 15697, 1839, 6388, 2133, 2033, 353, 679, 29918, 6388, 2133, 29898, 1792, 29922, 14095, 29918, 1792, 29897, 13, 418, 1404, 29918, 15697, 29889, 5504, 3319, 13, 4706, 525, 5630, 2396, 525, 29991, 742, 13, 4706, 525, 275, 29918, 4925, 2396, 7700, 29892, 13, 4706, 525, 275, 29918, 9136, 1792, 2396, 7700, 29892, 13, 4706, 525, 333, 2396, 16698, 3580, 1307, 29918, 11889, 29918, 1367, 29892, 13, 4706, 525, 20571, 2396, 16698, 3580, 1307, 29918, 11889, 29918, 1367, 13, 418, 5615, 13, 418, 1404, 29892, 2825, 353, 4911, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 1068, 1792, 29918, 15697, 29897, 13, 13, 418, 565, 2825, 29901, 13, 4706, 25401, 29889, 3888, 877, 3379, 4212, 263, 1404, 11860, 29879, 29908, 29915, 1273, 16280, 29897, 13, 13, 1678, 565, 1404, 29889, 6786, 2804, 9557, 29918, 6786, 322, 451, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 7295, 13, 418, 25401, 29889, 25442, 877, 17708, 1404, 947, 451, 505, 8952, 11860, 29879, 613, 674, 4218, 304, 6623, 278, 8952, 6169, 1273, 9557, 29918, 6786, 29897, 13, 418, 411, 10804, 29889, 21641, 7295, 13, 4706, 1404, 353, 4911, 29889, 12650, 29889, 657, 29898, 333, 29922, 8132, 3580, 1307, 29918, 11889, 29918, 1367, 29897, 13, 4706, 1404, 29889, 6786, 353, 9557, 29918, 6786, 13, 4706, 1404, 29889, 7620, 580, 13, 29871, 5174, 8960, 408, 429, 29901, 13, 1678, 25401, 29889, 11739, 877, 17776, 304, 679, 470, 1653, 4559, 1404, 1495, 13, 13, 29871, 396, 960, 4559, 1404, 1838, 29915, 29873, 6852, 304, 2322, 2318, 29892, 788, 304, 2322, 2318, 13, 29871, 2322, 29918, 2972, 353, 679, 29918, 4381, 29918, 1792, 29918, 2972, 580, 13, 29871, 565, 1404, 338, 451, 6213, 322, 2322, 29918, 2972, 338, 451, 6213, 322, 2322, 29918, 2972, 451, 297, 1404, 29889, 13155, 29889, 497, 7295, 13, 1678, 1404, 29889, 13155, 29889, 1202, 29898, 4381, 29918, 2972, 29897, 13, 1678, 1404, 29889, 7620, 580, 13, 13, 29871, 18920, 353, 9867, 29889, 657, 29918, 29882, 29069, 580, 13, 29871, 396, 960, 3271, 3884, 1838, 29915, 29873, 1863, 363, 4559, 1404, 29892, 1653, 372, 13, 29871, 1018, 29901, 13, 1678, 565, 451, 18920, 29889, 1867, 29918, 294, 29918, 1792, 29898, 14095, 29918, 6786, 29918, 12759, 29892, 18920, 29889, 657, 29918, 5184, 29918, 3972, 1125, 13, 418, 18920, 29889, 1867, 29918, 294, 29918, 1792, 29898, 14095, 29918, 6786, 29918, 12759, 29892, 18920, 29889, 3258, 29918, 5184, 29918, 3972, 29897, 13, 418, 25401, 29889, 3888, 877, 20399, 3271, 3884, 363, 1404, 29901, 1273, 29879, 29915, 1273, 9557, 29918, 6786, 29918, 12759, 29897, 13, 1678, 1683, 29901, 13, 418, 25401, 29889, 3888, 877, 11184, 3884, 2307, 4864, 363, 1404, 29901, 1273, 29879, 29915, 1273, 9557, 29918, 6786, 29897, 13, 29871, 5174, 8960, 408, 429, 29901, 13, 1678, 25401, 29889, 11739, 877, 17776, 304, 1653, 3271, 3884, 363, 1404, 1273, 29879, 29901, 1273, 29879, 29915, 1273, 313, 14095, 29918, 6786, 29892, 851, 29898, 735, 4961, 13, 13, 29871, 736, 1404, 13, 13, 13, 1753, 470, 29885, 29918, 1792, 29918, 20401, 7295, 13, 29871, 736, 525, 5269, 29915, 565, 12524, 6181, 29918, 1955, 29954, 2190, 26664, 8098, 29903, 29889, 657, 580, 1683, 525, 6786, 29915, 13, 2 ]
app/concat_unmask.py
torond/unmasking
0
197571
<filename>app/concat_unmask.py import os import subprocess import time import yaml import argparse """ Given a directory of PAN20 formatted datasets, runs `unmask.py run` on all of them. Inputs: - job.yml with <output_dir> and <transcription> placeholders - path to directory with PAN20 formatted datasets """ def now(): return time.strftime("%Y-%m-%d_%H-%M-%S") def main(): parser = argparse.ArgumentParser( prog="concat_unmask", description="Automate unmasking for multiple datasets", add_help=True) parser.add_argument('--input', '-i', help='Path to directory of PAN20 formatted datasets') args = parser.parse_args() directory = [d for d in os.scandir(args.input)] print(f'Found {len(directory)} PAN20 data files.') output_folder = f'unmasking_curves_{now()}/' for i, dir_entry in enumerate(directory): print(f'Unmasking {dir_entry.name}... ({i+1}/{len(directory)})') # Workaround, as there is no --input option for `unmask.py run` with open(os.path.join('app', 'job.yml')) as f: doc = yaml.load(f, Loader=yaml.FullLoader) doc['job%']['input']['parser']['parameters']['corpus_path'] = dir_entry.path with open(os.path.join('app', 'temp_job.yml'), 'w') as f: yaml.dump(doc, f) # Trigger Unmasking subprocess.run(['./unmask', 'run', '-o', os.path.join('..', 'data', output_folder, dir_entry.name), os.path.join('app', 'temp_job.yml')]) os.remove(os.path.join('app', 'temp_job.yml')) if __name__ == "__main__": main()
[ 1, 529, 9507, 29958, 932, 29914, 17685, 29918, 348, 13168, 29889, 2272, 13, 5215, 2897, 13, 5215, 1014, 5014, 13, 5215, 931, 13, 5215, 343, 8807, 13, 5215, 1852, 5510, 13, 13, 15945, 29908, 13, 29954, 5428, 263, 3884, 310, 349, 2190, 29906, 29900, 20917, 20035, 29892, 6057, 421, 348, 13168, 29889, 2272, 1065, 29952, 373, 13, 497, 310, 963, 29889, 13, 4290, 29879, 29901, 13, 29899, 4982, 29889, 21053, 411, 529, 4905, 29918, 3972, 29958, 322, 529, 3286, 3395, 29958, 2058, 8948, 414, 13, 29899, 2224, 304, 3884, 411, 349, 2190, 29906, 29900, 20917, 20035, 13, 15945, 29908, 13, 13, 13, 1753, 1286, 7295, 736, 931, 29889, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 29918, 29995, 29950, 19222, 29924, 19222, 29903, 1159, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 410, 29887, 543, 17685, 29918, 348, 13168, 613, 13, 4706, 6139, 543, 28451, 403, 443, 13168, 292, 363, 2999, 20035, 613, 13, 4706, 788, 29918, 8477, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 877, 489, 2080, 742, 13, 462, 4706, 17411, 29875, 742, 13, 462, 4706, 1371, 2433, 2605, 304, 3884, 310, 349, 2190, 29906, 29900, 20917, 20035, 1495, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 3884, 353, 518, 29881, 363, 270, 297, 2897, 29889, 1557, 392, 381, 29898, 5085, 29889, 2080, 4638, 13, 1678, 1596, 29898, 29888, 29915, 9692, 426, 2435, 29898, 12322, 2915, 349, 2190, 29906, 29900, 848, 2066, 29889, 1495, 13, 1678, 1962, 29918, 12083, 353, 285, 29915, 348, 13168, 292, 29918, 2764, 1960, 648, 3707, 580, 6822, 29915, 13, 13, 1678, 363, 474, 29892, 4516, 29918, 8269, 297, 26985, 29898, 12322, 1125, 13, 4706, 1596, 29898, 29888, 29915, 2525, 13168, 292, 426, 3972, 29918, 8269, 29889, 978, 29913, 856, 21313, 29875, 29974, 29896, 6822, 29912, 2435, 29898, 12322, 26972, 1495, 13, 4706, 396, 5244, 11316, 29892, 408, 727, 338, 694, 1192, 2080, 2984, 363, 421, 348, 13168, 29889, 2272, 1065, 29952, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 877, 932, 742, 525, 9057, 29889, 21053, 8785, 408, 285, 29901, 13, 9651, 1574, 353, 343, 8807, 29889, 1359, 29898, 29888, 29892, 4309, 1664, 29922, 25162, 29889, 13658, 10036, 29897, 13, 13, 4706, 1574, 1839, 9057, 29995, 16215, 2080, 16215, 16680, 16215, 16744, 16215, 2616, 13364, 29918, 2084, 2033, 353, 4516, 29918, 8269, 29889, 2084, 13, 13, 4706, 411, 1722, 29898, 359, 29889, 2084, 29889, 7122, 877, 932, 742, 525, 7382, 29918, 9057, 29889, 21053, 5477, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 343, 8807, 29889, 15070, 29898, 1514, 29892, 285, 29897, 13, 13, 4706, 396, 1605, 3567, 853, 13168, 292, 13, 4706, 1014, 5014, 29889, 3389, 18959, 6904, 348, 13168, 742, 525, 3389, 742, 13, 462, 4706, 17411, 29877, 742, 2897, 29889, 2084, 29889, 7122, 877, 636, 742, 13, 462, 462, 965, 525, 1272, 742, 13, 462, 462, 965, 1962, 29918, 12083, 29892, 13, 462, 462, 965, 4516, 29918, 8269, 29889, 978, 511, 13, 462, 4706, 2897, 29889, 2084, 29889, 7122, 877, 932, 742, 525, 7382, 29918, 9057, 29889, 21053, 1495, 2314, 13, 13, 1678, 2897, 29889, 5992, 29898, 359, 29889, 2084, 29889, 7122, 877, 932, 742, 525, 7382, 29918, 9057, 29889, 21053, 8785, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
ftd_main/forms.py
meatware/FixedTermDepositGrapher
0
71687
from flask_wtf import FlaskForm from wtforms import StringField, SelectField, DecimalField, IntegerField, SubmitField, PasswordField, BooleanField, DateField from wtforms.validators import DataRequired, NumberRange, Length, ValidationError, DataRequired, Email, EqualTo from ftd_main.models import User #from ftd_main import date_pick #def picker(self, id=".datepicker", # identifier will be passed to Jquery to select element # dateFormat='yy-mm-dd', # can't be explained more ! # maxDate='2018-12-90', # maximum date to select from. Make sure to follow the same format yy-mm-dd # minDate='2017-12-01', # btnsId='.btnId'): # minimum date # id assigned to instigating buttons if needed # return #TODO: fix form flashing class AddFixedDepositForm(FlaskForm): ischemes = [('Monthly', 'Monthly'), ('Quarterly', 'Quarterly'), ('Yearly', 'Yearly')] ac_no = StringField('Acc No', validators=[DataRequired(), Length(5, 50, "Length range from 5 to 50")]) # TODO: Fix so autoincrements for user start_date = DateField('Start Date dd/mm/yyyy', validators=[DataRequired()], format='%d-%m-%Y') #, widget=DatePickerWidget()) #TODO: add validators end_date = StringField('End Date dd/mm/yyyy') #TODO: Calculate end_date interest_rate = DecimalField('Interest Rate (%)', validators=[DataRequired(), NumberRange(0, 100, "Please enter percentage range 0 to 100%")]) interest_scheme = SelectField('Interest Scheme', choices=ischemes, validators=[DataRequired()]) period = IntegerField('Deposit time period (days for now)') initial_deposit = DecimalField('Initial Deposit') final_deposit = DecimalField('Final Deposit') #TODO: Calculate final_deposit submit = SubmitField('Submits') def create_deposit(deposit, form, new=False): """ Save the changes to the database """ # Get data from form and assign it to the correct attributes # of the SQLAlchemy table object deposit.ac_no = form.ac_no.data deposit.start_date = form.start_date.data deposit.end_date = form.end_date.data deposit.interest_rate = form.interest_rate.data deposit.interest_scheme = form.interest_scheme.data deposit.period = form.period.data deposit.initial_deposit = form.initial_deposit.data deposit.final_deposit = form.final_deposit.data return deposit class Loginform(FlaskForm) : username = StringField('Username', validators=[DataRequired()]) password = PasswordField('Password', validators=[DataRequired()]) remember_me = BooleanField('Remember Me') submit = SubmitField('Sign In') class RegistrationForm(FlaskForm): username = StringField('Username', validators=[DataRequired()]) email = StringField('Email', validators=[DataRequired(), Email()]) password = PasswordField('Password', validators=[DataRequired()]) password2 = PasswordField( 'Repeat Password', validators=[DataRequired(), EqualTo('password')]) submit = SubmitField('Register') def validate_username(self, username): user = User.query.filter_by(username=username.data).first() if user is not None: raise ValidationError('Please use a different username.') def validate_email(self, email): user = User.query.filter_by(email=email.data).first() if user is not None: raise ValidationError('Please use a different email address.')
[ 1, 515, 29784, 29918, 29893, 13264, 1053, 2379, 1278, 2500, 13, 3166, 281, 29873, 9514, 1053, 1714, 3073, 29892, 7605, 3073, 29892, 3826, 3039, 3073, 29892, 8102, 3073, 29892, 3323, 2415, 3073, 29892, 25280, 3073, 29892, 11185, 3073, 29892, 4712, 3073, 13, 3166, 281, 29873, 9514, 29889, 3084, 4097, 1053, 3630, 19347, 29892, 9681, 6069, 29892, 365, 1477, 29892, 15758, 362, 2392, 29892, 3630, 19347, 29892, 22608, 29892, 11243, 284, 1762, 13, 3166, 285, 1594, 29918, 3396, 29889, 9794, 1053, 4911, 13, 29937, 3166, 285, 1594, 29918, 3396, 1053, 2635, 29918, 23945, 13, 13, 13, 29937, 1753, 5839, 261, 29898, 1311, 29892, 1178, 29569, 1256, 13908, 613, 396, 15882, 674, 367, 4502, 304, 435, 1972, 304, 1831, 1543, 13, 1678, 396, 632, 2635, 5809, 2433, 8071, 29899, 4317, 29899, 1289, 742, 396, 508, 29915, 29873, 367, 10824, 901, 1738, 13, 1678, 396, 1669, 4236, 2539, 2433, 29906, 29900, 29896, 29947, 29899, 29896, 29906, 29899, 29929, 29900, 742, 396, 7472, 2635, 304, 1831, 515, 29889, 8561, 1854, 304, 1101, 278, 1021, 3402, 343, 29891, 29899, 4317, 29899, 1289, 13, 1678, 396, 1669, 1375, 2539, 2433, 29906, 29900, 29896, 29955, 29899, 29896, 29906, 29899, 29900, 29896, 742, 13, 1678, 396, 1669, 289, 29873, 1983, 1204, 2433, 29889, 7290, 1204, 29374, 396, 9212, 2635, 396, 1178, 9859, 304, 832, 335, 1218, 9828, 565, 4312, 13, 1678, 396, 736, 13, 13, 13, 29937, 4986, 3970, 29901, 2329, 883, 11013, 292, 13, 1990, 3462, 26262, 8498, 359, 277, 2500, 29898, 8754, 1278, 2500, 1125, 13, 1678, 338, 305, 13826, 353, 518, 877, 13953, 368, 742, 525, 13953, 368, 5477, 13, 1669, 6702, 2182, 4254, 368, 742, 525, 2182, 4254, 368, 5477, 13, 1669, 6702, 12883, 368, 742, 525, 12883, 368, 1495, 29962, 13, 13, 1678, 1274, 29918, 1217, 353, 1714, 3073, 877, 7504, 1939, 742, 2854, 4097, 11759, 1469, 19347, 3285, 365, 1477, 29898, 29945, 29892, 29871, 29945, 29900, 29892, 376, 6513, 3464, 515, 29871, 29945, 304, 29871, 29945, 29900, 1159, 2314, 396, 14402, 29901, 24778, 577, 4469, 262, 1037, 1860, 363, 1404, 13, 1678, 1369, 29918, 1256, 353, 4712, 3073, 877, 4763, 4712, 24488, 29914, 4317, 29914, 18855, 742, 2854, 4097, 11759, 1469, 19347, 580, 1402, 3402, 2433, 29995, 29881, 19222, 29885, 19222, 29979, 1495, 396, 29892, 11109, 29922, 2539, 13954, 8801, 3101, 396, 4986, 3970, 29901, 788, 2854, 4097, 13, 1678, 1095, 29918, 1256, 353, 1714, 3073, 877, 5044, 4712, 24488, 29914, 4317, 29914, 18855, 1495, 396, 4986, 3970, 29901, 20535, 403, 1095, 29918, 1256, 13, 1678, 4066, 29918, 10492, 353, 3826, 3039, 3073, 877, 4074, 342, 390, 403, 313, 10997, 742, 2854, 4097, 11759, 1469, 19347, 3285, 9681, 6069, 29898, 29900, 29892, 29871, 29896, 29900, 29900, 29892, 376, 12148, 3896, 19649, 3464, 29871, 29900, 304, 29871, 29896, 29900, 29900, 29995, 1159, 2314, 13, 1678, 4066, 29918, 816, 2004, 353, 7605, 3073, 877, 4074, 342, 1102, 2004, 742, 19995, 29922, 783, 13826, 29892, 2854, 4097, 11759, 1469, 19347, 580, 2314, 13, 1678, 3785, 353, 8102, 3073, 877, 8498, 359, 277, 931, 3785, 313, 16700, 363, 1286, 29897, 1495, 13, 1678, 2847, 29918, 311, 1066, 277, 353, 3826, 3039, 3073, 877, 15514, 897, 1066, 277, 1495, 13, 1678, 2186, 29918, 311, 1066, 277, 353, 3826, 3039, 3073, 877, 15790, 897, 1066, 277, 1495, 396, 4986, 3970, 29901, 20535, 403, 2186, 29918, 311, 1066, 277, 13, 1678, 9752, 353, 3323, 2415, 3073, 877, 4035, 29885, 1169, 1495, 13, 13, 1753, 1653, 29918, 311, 1066, 277, 29898, 311, 1066, 277, 29892, 883, 29892, 716, 29922, 8824, 1125, 13, 1678, 9995, 13, 1678, 16913, 278, 3620, 304, 278, 2566, 13, 1678, 9995, 13, 1678, 396, 3617, 848, 515, 883, 322, 3566, 372, 304, 278, 1959, 8393, 13, 1678, 396, 310, 278, 3758, 2499, 305, 6764, 1591, 1203, 13, 13, 1678, 19754, 277, 29889, 562, 29918, 1217, 353, 883, 29889, 562, 29918, 1217, 29889, 1272, 13, 1678, 19754, 277, 29889, 2962, 29918, 1256, 353, 883, 29889, 2962, 29918, 1256, 29889, 1272, 13, 1678, 19754, 277, 29889, 355, 29918, 1256, 353, 883, 29889, 355, 29918, 1256, 29889, 1272, 13, 1678, 19754, 277, 29889, 1639, 342, 29918, 10492, 353, 883, 29889, 1639, 342, 29918, 10492, 29889, 1272, 13, 1678, 19754, 277, 29889, 1639, 342, 29918, 816, 2004, 353, 883, 29889, 1639, 342, 29918, 816, 2004, 29889, 1272, 13, 1678, 19754, 277, 29889, 19145, 353, 883, 29889, 19145, 29889, 1272, 13, 1678, 19754, 277, 29889, 11228, 29918, 311, 1066, 277, 353, 883, 29889, 11228, 29918, 311, 1066, 277, 29889, 1272, 13, 1678, 19754, 277, 29889, 8394, 29918, 311, 1066, 277, 353, 883, 29889, 8394, 29918, 311, 1066, 277, 29889, 1272, 13, 13, 1678, 736, 19754, 277, 13, 13, 1990, 19130, 689, 29898, 8754, 1278, 2500, 29897, 1678, 584, 13, 1678, 8952, 353, 1714, 3073, 877, 20249, 742, 2854, 4097, 11759, 1469, 19347, 580, 2314, 13, 1678, 4800, 353, 25280, 3073, 877, 10048, 742, 2854, 4097, 11759, 1469, 19347, 580, 2314, 13, 1678, 6456, 29918, 1004, 353, 11185, 3073, 877, 7301, 1096, 2191, 1495, 13, 1678, 9752, 353, 3323, 2415, 3073, 877, 10140, 512, 1495, 13, 13, 13, 1990, 2169, 8306, 2500, 29898, 8754, 1278, 2500, 1125, 13, 1678, 8952, 353, 1714, 3073, 877, 20249, 742, 2854, 4097, 11759, 1469, 19347, 580, 2314, 13, 1678, 4876, 353, 1714, 3073, 877, 9823, 742, 2854, 4097, 11759, 1469, 19347, 3285, 22608, 580, 2314, 13, 1678, 4800, 353, 25280, 3073, 877, 10048, 742, 2854, 4097, 11759, 1469, 19347, 580, 2314, 13, 1678, 4800, 29906, 353, 25280, 3073, 29898, 13, 4706, 525, 1123, 11666, 25280, 742, 2854, 4097, 11759, 1469, 19347, 3285, 11243, 284, 1762, 877, 5630, 1495, 2314, 13, 1678, 9752, 353, 3323, 2415, 3073, 877, 15213, 1495, 13, 13, 1678, 822, 12725, 29918, 6786, 29898, 1311, 29892, 8952, 1125, 13, 4706, 1404, 353, 4911, 29889, 1972, 29889, 4572, 29918, 1609, 29898, 6786, 29922, 6786, 29889, 1272, 467, 4102, 580, 13, 4706, 565, 1404, 338, 451, 6213, 29901, 13, 9651, 12020, 15758, 362, 2392, 877, 12148, 671, 263, 1422, 8952, 29889, 1495, 13, 13, 1678, 822, 12725, 29918, 5269, 29898, 1311, 29892, 4876, 1125, 13, 4706, 1404, 353, 4911, 29889, 1972, 29889, 4572, 29918, 1609, 29898, 5269, 29922, 5269, 29889, 1272, 467, 4102, 580, 13, 4706, 565, 1404, 338, 451, 6213, 29901, 13, 9651, 12020, 15758, 362, 2392, 877, 12148, 671, 263, 1422, 4876, 3211, 29889, 1495, 13, 13, 13, 13, 2 ]
vizsgaremek/test_conduit_logged_in.py
femese/conduit
0
34011
from selenium import webdriver from selenium.webdriver.chrome.options import Options from webdriver_manager.chrome import ChromeDriverManager from pages.home_page import HomePage from pages.profile_page import ProfilePage from pages.login_page import LoginPage from pages.registration_page import RegistrationPage from pages.article_page import ArticlePage from pages.new_article_page import NewArticlePage from pages.navigation_bar import NavigationBar import pytest import csv browser_options = Options() browser_options.add_experimental_option("excludeSwitches", ["enable-logging"]) browser_options.headless = True URL = 'http://localhost:1667' class Test_Conduit_Logged_In: def setup_method(self, method): self.browser = webdriver.Chrome(ChromeDriverManager().install(), options=browser_options) self.browser.maximize_window() self.browser.get(URL) self.homepage = HomePage(driver=self.browser) self.homepage.login_button.click() login_page = LoginPage(driver=self.browser) login_page.fill_login_details('<EMAIL>', 'Teszt1teszt') login_page.signin_button.click() def teardown_method(self, method): self.browser.close() def test_one_article(self): self.homepage = HomePage(driver=self.browser) self.homepage.logout_button.find() self.homepage.article_button.click() new_article_page = NewArticlePage(driver=self.browser) new_article_page.title_input.send_text_to_input("Title") new_article_page.summary_input.send_text_to_input("Summary") new_article_page.main_body_input.send_text_to_input("Main article") new_article_page.tags_input.send_text_to_input("nonsense") new_article_page.publish_button.click() article_page = ArticlePage(driver=self.browser) assert article_page.main_textfield.text() == "Main article" def test_new_articles(self): number_of_paginator = len(self.homepage.page_list_buttons) reader = csv.reader(open('./vizsgaremek/articles.csv', 'r'), delimiter=';') for row in reader: navigation_bar = NavigationBar(driver=self.browser) navigation_bar.logout_button.find() navigation_bar.article_button.click() new_article_page = NewArticlePage(driver=self.browser) new_article_page.title_input.send_text_to_input(row[0]) new_article_page.summary_input.send_text_to_input(row[1]) new_article_page.main_body_input.send_text_to_input(row[2]) new_article_page.tags_input.send_text_to_input(row[3]) new_article_page.publish_button.click() navigation_bar.home_button.click() assert len(self.homepage.page_list_buttons) > number_of_paginator def test_page_list(self): self.homepage = HomePage(driver=self.browser) for x in self.homepage.page_list_buttons: x.click() self.homepage = HomePage(driver=self.browser) assert self.homepage.is_last_page_active() def test_list_articles(self): assert len(self.homepage.article_list) > 0 def test_change_article(self): article_page = self.create_article() txt_to_change = article_page.main_textfield.text() article_page.edit_button.find() article_page.edit_button.click() article_edit_page = NewArticlePage(self.browser) article_edit_page.main_body_input.send_text_to_input(txt_to_change[:len(txt_to_change)//2].strip() + "changed") article_edit_page.publish_button.click() assert article_page.main_textfield.text() == txt_to_change[:len(txt_to_change)//2].strip() + "changed" def test_save_to_file(self): self.homepage.profile_button.click() profile_page = ProfilePage(self.browser) self.homepage.article_list[0].click() article_page = ArticlePage(self.browser) txt_to_save = article_page.main_textfield.text() txt_file = open("./vizsgaremek/test.txt", "w") txt_file.write(txt_to_save) txt_file.close() txt_file = open("./vizsgaremek/test.txt", "r") assert txt_file.read() == txt_to_save txt_file.close() def test_delete_article(self): article_page = self.create_article() article_page.delete_button.find() article_page.delete_button.click() assert (article_page.delete_popup.text() == "Deleted the article. Going home...") def test_logout(self): self.homepage.logout_button.click() assert self.homepage.login_button.text().strip() == "Sign in" def create_article(self): self.homepage.logout_button.find() self.homepage.article_button.click() new_article_page = NewArticlePage(driver=self.browser) new_article_page.title_input.send_text_to_input("Test article title") new_article_page.summary_input.send_text_to_input("Test article summary") new_article_page.main_body_input.send_text_to_input("Test article main text") new_article_page.tags_input.send_text_to_input("test, article, tags") new_article_page.publish_button.click() return ArticlePage(driver=self.browser)
[ 1, 515, 18866, 1053, 1856, 9465, 13, 3166, 18866, 29889, 29813, 29889, 18114, 29889, 6768, 1053, 25186, 13, 3166, 1856, 9465, 29918, 12847, 29889, 18114, 1053, 10228, 12376, 3260, 13, 3166, 6515, 29889, 5184, 29918, 3488, 1053, 8778, 5074, 13, 3166, 6515, 29889, 10185, 29918, 3488, 1053, 20802, 5074, 13, 3166, 6515, 29889, 7507, 29918, 3488, 1053, 19130, 5074, 13, 3166, 6515, 29889, 1727, 8306, 29918, 3488, 1053, 2169, 8306, 5074, 13, 3166, 6515, 29889, 7914, 29918, 3488, 1053, 21746, 5074, 13, 3166, 6515, 29889, 1482, 29918, 7914, 29918, 3488, 1053, 1570, 9986, 2512, 5074, 13, 3166, 6515, 29889, 15466, 29918, 1646, 1053, 23001, 4297, 13, 5215, 11451, 1688, 13, 5215, 11799, 13, 13, 15965, 29918, 6768, 353, 25186, 580, 13, 15965, 29918, 6768, 29889, 1202, 29918, 735, 27910, 29918, 3385, 703, 735, 2325, 24995, 267, 613, 6796, 12007, 29899, 21027, 20068, 13, 15965, 29918, 6768, 29889, 2813, 2222, 353, 5852, 13, 4219, 353, 525, 1124, 597, 7640, 29901, 29896, 29953, 29953, 29955, 29915, 13, 13, 1990, 4321, 29918, 1168, 700, 277, 29918, 3403, 3192, 29918, 797, 29901, 13, 13, 1678, 822, 6230, 29918, 5696, 29898, 1311, 29892, 1158, 1125, 13, 4706, 1583, 29889, 15965, 353, 1856, 9465, 29889, 1451, 4871, 29898, 1451, 4871, 12376, 3260, 2141, 6252, 3285, 3987, 29922, 15965, 29918, 6768, 29897, 13, 4706, 1583, 29889, 15965, 29889, 27525, 675, 29918, 7165, 580, 13, 4706, 1583, 29889, 15965, 29889, 657, 29898, 4219, 29897, 13, 4706, 1583, 29889, 5184, 3488, 353, 8778, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 1583, 29889, 5184, 3488, 29889, 7507, 29918, 3092, 29889, 3808, 580, 13, 4706, 6464, 29918, 3488, 353, 19130, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 6464, 29918, 3488, 29889, 5589, 29918, 7507, 29918, 14144, 877, 29966, 26862, 6227, 29958, 742, 525, 29911, 23293, 29896, 2167, 2065, 1495, 13, 4706, 6464, 29918, 3488, 29889, 4530, 262, 29918, 3092, 29889, 3808, 580, 13, 13, 1678, 822, 734, 538, 776, 29918, 5696, 29898, 1311, 29892, 1158, 1125, 13, 4706, 1583, 29889, 15965, 29889, 5358, 580, 13, 308, 13, 1678, 822, 1243, 29918, 650, 29918, 7914, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5184, 3488, 353, 8778, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 1583, 29889, 5184, 3488, 29889, 1188, 449, 29918, 3092, 29889, 2886, 580, 13, 4706, 1583, 29889, 5184, 3488, 29889, 7914, 29918, 3092, 29889, 3808, 580, 13, 4706, 716, 29918, 7914, 29918, 3488, 353, 1570, 9986, 2512, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 3257, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 7030, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 7727, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 26289, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 3396, 29918, 2587, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 6330, 4274, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 11338, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 29876, 787, 1947, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 23679, 29918, 3092, 29889, 3808, 580, 13, 4706, 4274, 29918, 3488, 353, 21746, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 4974, 4274, 29918, 3488, 29889, 3396, 29918, 726, 2671, 29889, 726, 580, 1275, 376, 6330, 4274, 29908, 13, 13, 1678, 822, 1243, 29918, 1482, 29918, 18569, 29898, 1311, 1125, 13, 4706, 1353, 29918, 974, 29918, 13573, 262, 1061, 353, 7431, 29898, 1311, 29889, 5184, 3488, 29889, 3488, 29918, 1761, 29918, 4187, 7453, 29897, 13, 4706, 9591, 353, 11799, 29889, 16950, 29898, 3150, 877, 6904, 29894, 466, 5311, 598, 1004, 29895, 29914, 18569, 29889, 7638, 742, 525, 29878, 5477, 28552, 2433, 29936, 1495, 13, 4706, 363, 1948, 297, 9591, 29901, 13, 9651, 11322, 29918, 1646, 353, 23001, 4297, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 9651, 11322, 29918, 1646, 29889, 1188, 449, 29918, 3092, 29889, 2886, 580, 13, 9651, 11322, 29918, 1646, 29889, 7914, 29918, 3092, 29889, 3808, 580, 13, 9651, 716, 29918, 7914, 29918, 3488, 353, 1570, 9986, 2512, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 9651, 716, 29918, 7914, 29918, 3488, 29889, 3257, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 29898, 798, 29961, 29900, 2314, 13, 9651, 716, 29918, 7914, 29918, 3488, 29889, 7727, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 29898, 798, 29961, 29896, 2314, 13, 9651, 716, 29918, 7914, 29918, 3488, 29889, 3396, 29918, 2587, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 29898, 798, 29961, 29906, 2314, 13, 9651, 716, 29918, 7914, 29918, 3488, 29889, 11338, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 29898, 798, 29961, 29941, 2314, 13, 9651, 716, 29918, 7914, 29918, 3488, 29889, 23679, 29918, 3092, 29889, 3808, 580, 13, 4706, 11322, 29918, 1646, 29889, 5184, 29918, 3092, 29889, 3808, 580, 13, 4706, 4974, 7431, 29898, 1311, 29889, 5184, 3488, 29889, 3488, 29918, 1761, 29918, 4187, 7453, 29897, 1405, 1353, 29918, 974, 29918, 13573, 262, 1061, 13, 13, 1678, 822, 1243, 29918, 3488, 29918, 1761, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5184, 3488, 353, 8778, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 363, 921, 297, 1583, 29889, 5184, 3488, 29889, 3488, 29918, 1761, 29918, 4187, 7453, 29901, 13, 9651, 921, 29889, 3808, 580, 13, 9651, 1583, 29889, 5184, 3488, 353, 8778, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 4974, 1583, 29889, 5184, 3488, 29889, 275, 29918, 4230, 29918, 3488, 29918, 4925, 580, 13, 13, 1678, 822, 1243, 29918, 1761, 29918, 18569, 29898, 1311, 1125, 308, 13, 4706, 4974, 7431, 29898, 1311, 29889, 5184, 3488, 29889, 7914, 29918, 1761, 29897, 1405, 29871, 29900, 13, 13, 1678, 822, 1243, 29918, 3167, 29918, 7914, 29898, 1311, 1125, 308, 13, 4706, 4274, 29918, 3488, 353, 1583, 29889, 3258, 29918, 7914, 580, 13, 4706, 13872, 29918, 517, 29918, 3167, 353, 4274, 29918, 3488, 29889, 3396, 29918, 726, 2671, 29889, 726, 580, 13, 4706, 4274, 29918, 3488, 29889, 5628, 29918, 3092, 29889, 2886, 580, 13, 4706, 4274, 29918, 3488, 29889, 5628, 29918, 3092, 29889, 3808, 580, 13, 4706, 4274, 29918, 5628, 29918, 3488, 353, 1570, 9986, 2512, 5074, 29898, 1311, 29889, 15965, 29897, 13, 4706, 4274, 29918, 5628, 29918, 3488, 29889, 3396, 29918, 2587, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 29898, 3945, 29918, 517, 29918, 3167, 7503, 2435, 29898, 3945, 29918, 517, 29918, 3167, 29897, 458, 29906, 1822, 17010, 580, 718, 376, 15033, 1159, 13, 4706, 4274, 29918, 5628, 29918, 3488, 29889, 23679, 29918, 3092, 29889, 3808, 580, 13, 4706, 4974, 4274, 29918, 3488, 29889, 3396, 29918, 726, 2671, 29889, 726, 580, 1275, 13872, 29918, 517, 29918, 3167, 7503, 2435, 29898, 3945, 29918, 517, 29918, 3167, 29897, 458, 29906, 1822, 17010, 580, 718, 376, 15033, 29908, 13, 308, 13, 1678, 822, 1243, 29918, 7620, 29918, 517, 29918, 1445, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5184, 3488, 29889, 10185, 29918, 3092, 29889, 3808, 580, 13, 4706, 8722, 29918, 3488, 353, 20802, 5074, 29898, 1311, 29889, 15965, 29897, 13, 4706, 1583, 29889, 5184, 3488, 29889, 7914, 29918, 1761, 29961, 29900, 1822, 3808, 580, 13, 4706, 4274, 29918, 3488, 353, 21746, 5074, 29898, 1311, 29889, 15965, 29897, 13, 4706, 13872, 29918, 517, 29918, 7620, 353, 4274, 29918, 3488, 29889, 3396, 29918, 726, 2671, 29889, 726, 580, 13, 4706, 13872, 29918, 1445, 353, 1722, 703, 6904, 29894, 466, 5311, 598, 1004, 29895, 29914, 1688, 29889, 3945, 613, 376, 29893, 1159, 13, 4706, 13872, 29918, 1445, 29889, 3539, 29898, 3945, 29918, 517, 29918, 7620, 29897, 13, 4706, 13872, 29918, 1445, 29889, 5358, 580, 13, 4706, 13872, 29918, 1445, 353, 1722, 703, 6904, 29894, 466, 5311, 598, 1004, 29895, 29914, 1688, 29889, 3945, 613, 376, 29878, 1159, 13, 4706, 4974, 13872, 29918, 1445, 29889, 949, 580, 1275, 13872, 29918, 517, 29918, 7620, 13, 4706, 13872, 29918, 1445, 29889, 5358, 580, 13, 13, 1678, 822, 1243, 29918, 8143, 29918, 7914, 29898, 1311, 1125, 13, 4706, 4274, 29918, 3488, 353, 1583, 29889, 3258, 29918, 7914, 580, 13, 4706, 4274, 29918, 3488, 29889, 8143, 29918, 3092, 29889, 2886, 580, 13, 4706, 4274, 29918, 3488, 29889, 8143, 29918, 3092, 29889, 3808, 580, 13, 4706, 4974, 313, 7914, 29918, 3488, 29889, 8143, 29918, 7323, 786, 29889, 726, 580, 1275, 376, 2772, 22742, 278, 4274, 29889, 2921, 292, 3271, 856, 1159, 13, 308, 13, 1678, 822, 1243, 29918, 1188, 449, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5184, 3488, 29889, 1188, 449, 29918, 3092, 29889, 3808, 580, 13, 4706, 4974, 1583, 29889, 5184, 3488, 29889, 7507, 29918, 3092, 29889, 726, 2141, 17010, 580, 1275, 376, 10140, 297, 29908, 13, 308, 13, 1678, 822, 1653, 29918, 7914, 29898, 1311, 1125, 13, 4706, 1583, 29889, 5184, 3488, 29889, 1188, 449, 29918, 3092, 29889, 2886, 580, 13, 4706, 1583, 29889, 5184, 3488, 29889, 7914, 29918, 3092, 29889, 3808, 580, 13, 4706, 716, 29918, 7914, 29918, 3488, 353, 1570, 9986, 2512, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 3257, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 3057, 4274, 3611, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 7727, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 3057, 4274, 15837, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 3396, 29918, 2587, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 3057, 4274, 1667, 1426, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 11338, 29918, 2080, 29889, 6717, 29918, 726, 29918, 517, 29918, 2080, 703, 1688, 29892, 4274, 29892, 8282, 1159, 13, 4706, 716, 29918, 7914, 29918, 3488, 29889, 23679, 29918, 3092, 29889, 3808, 580, 13, 4706, 736, 21746, 5074, 29898, 9465, 29922, 1311, 29889, 15965, 29897, 2 ]
models/spach/spach.py
ritwikraha/SPACH
104
60160
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from functools import partial import torch from torch import nn from timm.models.layers import DropPath from einops.layers.torch import Reduce from .layers import DWConv, SPATIAL_FUNC, ChannelMLP, STEM_LAYER from .misc import reshape2n class MixingBlock(nn.Module): def __init__(self, dim, spatial_func=None, scaled=True, init_values=1e-4, shared_spatial_func=False, norm_layer=partial(nn.LayerNorm, eps=1e-6), act_layer=nn.GELU, drop_path=0., cpe=True, num_heads=None, qkv_bias=False, qk_scale=None, attn_drop=0., proj_drop=0., # attn in_features=None, hidden_features=None, drop=0., # mlp channel_ratio=2.0 ): super(MixingBlock, self).__init__() spatial_kwargs = dict(act_layer=act_layer, in_features=in_features, hidden_features=hidden_features, drop=drop, # mlp dim=dim, num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale, attn_drop=attn_drop, proj_drop=proj_drop # attn ) self.valid_spatial_func = True if spatial_func is not None: if shared_spatial_func: self.spatial_func = spatial_func else: self.spatial_func = spatial_func(**spatial_kwargs) self.norm1 = norm_layer(dim) if scaled: self.gamma_1 = nn.Parameter(init_values * torch.ones(1, 1, dim), requires_grad=True) else: self.gamma_1 = 1. else: self.valid_spatial_func = False self.channel_func = ChannelMLP(in_features=dim, hidden_features=int(dim*channel_ratio), act_layer=act_layer, drop=drop) self.norm2 = norm_layer(dim) self.drop_path = DropPath(drop_path) if drop_path > 0. else nn.Identity() self.cpe = cpe if cpe: self.cpe_net = DWConv(dim) def forward(self, x): in_x = x if self.valid_spatial_func: x = x + self.drop_path(self.gamma_1 * self.spatial_func(self.norm1(in_x))) if self.cpe: x = x + self.cpe_net(in_x) x = x + self.drop_path(self.channel_func(self.norm2(x))) return x def flops(self, input_shape): _, N, C = input_shape flops = 0 if self.valid_spatial_func: flops += self.spatial_func.flops(input_shape) flops += N * C * 2 # norm + skip if self.cpe: flops += self.cpe_net.flops(input_shape) flops += self.channel_func.flops(input_shape) flops += N * C * 2 return flops class Spach(nn.Module): def __init__(self, num_classes=1000, img_size=224, in_chans=3, hidden_dim=384, patch_size=16, net_arch=None, act_layer=nn.GELU, norm_layer=partial(nn.LayerNorm, eps=1e-6), stem_type='conv1', scaled=True, init_values=1e-4, drop_path_rate=0., cpe=True, shared_spatial_func=False, # mixing block num_heads=12, qkv_bias=True, qk_scale=None, attn_drop=0., proj_drop=0., # attn token_ratio=0.5, channel_ratio=2.0, drop_rate=0., # mlp downstream=False, **kwargs ): super(Spach, self).__init__() self.num_classes = num_classes self.hidden_dim = hidden_dim self.downstream = downstream self.stem = STEM_LAYER[stem_type]( img_size=img_size, patch_size=patch_size, in_chans=in_chans, embed_dim=hidden_dim, downstream=downstream) self.norm1 = norm_layer(hidden_dim) block_kwargs = dict(dim=hidden_dim, scaled=scaled, init_values=init_values, cpe=cpe, shared_spatial_func=shared_spatial_func, norm_layer=norm_layer, act_layer=act_layer, num_heads=num_heads, qkv_bias=qkv_bias, qk_scale=qk_scale, attn_drop=attn_drop, proj_drop=proj_drop, # attn in_features=self.stem.num_patches, hidden_features=int(self.stem.num_patches * token_ratio), channel_ratio=channel_ratio, drop=drop_rate) # mlp self.blocks = self.make_blocks(net_arch, block_kwargs, drop_path_rate, shared_spatial_func) self.norm2 = norm_layer(hidden_dim) if not downstream: self.pool = Reduce('b n c -> b c', reduction='mean') self.head = nn.Linear(hidden_dim, self.num_classes) self.init_weights() def make_blocks(self, net_arch, block_kwargs, drop_path, shared_spatial_func): if shared_spatial_func: assert len(net_arch) == 1, '`shared_spatial_func` only support unitary spatial function' assert net_arch[0][0] != 'pass', '`shared_spatial_func` do not support pass' spatial_func = SPATIAL_FUNC[net_arch[0][0]](**block_kwargs) else: spatial_func = None blocks = [] for func_type, depth in net_arch: for i in range(depth): blocks.append(MixingBlock(spatial_func=spatial_func or SPATIAL_FUNC[func_type], drop_path=drop_path, **block_kwargs)) return nn.Sequential(*blocks) def init_weights(self): for n, m in self.named_modules(): _init_weights(m, n) def forward_features(self, x): x = self.stem(x) x = reshape2n(x) x = self.norm1(x) x = self.blocks(x) x = self.norm2(x) return x def forward(self, x): x = self.forward_features(x) x = self.pool(x) x = self.head(x) return x def flops(self): flops = 0 shape = (1, self.stem.num_patches, self.hidden_dim) # stem flops += self.stem.flops() flops += sum(shape) # blocks flops += sum([i.flops(shape) for i in self.blocks]) flops += sum(shape) # head flops += self.hidden_dim * self.num_classes return flops def _init_weights(m, n: str): if isinstance(m, nn.Linear): if n.startswith('head'): nn.init.zeros_(m.weight) nn.init.zeros_(m.bias) else: nn.init.xavier_uniform_(m.weight) if m.bias is not None: if 'mlp' in n: nn.init.normal_(m.bias, std=1e-6) else: nn.init.zeros_(m.bias) elif isinstance(m, nn.Conv2d): nn.init.kaiming_normal_(m.weight, mode='fan_out', nonlinearity='relu') if m.bias is not None: nn.init.zeros_(m.bias) elif isinstance(m, (nn.LayerNorm, nn.BatchNorm2d, nn.GroupNorm)): nn.init.ones_(m.weight) nn.init.zeros_(m.bias)
[ 1, 396, 14187, 1266, 313, 29883, 29897, 7783, 15025, 22993, 13, 29937, 10413, 21144, 1090, 278, 341, 1806, 19245, 22993, 13, 3166, 2090, 312, 8789, 1053, 7687, 30004, 13, 30004, 13, 5215, 4842, 305, 30004, 13, 3166, 4842, 305, 1053, 302, 29876, 30004, 13, 3166, 5335, 29885, 29889, 9794, 29889, 29277, 1053, 20724, 2605, 30004, 13, 3166, 1011, 3554, 29889, 29277, 29889, 7345, 305, 1053, 4367, 24551, 30004, 13, 30004, 13, 3166, 869, 29277, 1053, 360, 29956, 1168, 29894, 29892, 10937, 1299, 25758, 29918, 29943, 3904, 29907, 29892, 17368, 1988, 29925, 29892, 317, 4330, 29924, 29918, 18799, 1001, 30004, 13, 3166, 869, 29885, 10669, 1053, 620, 14443, 29906, 29876, 30004, 13, 30004, 13, 30004, 13, 1990, 23478, 292, 7445, 29898, 15755, 29889, 7355, 1125, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3964, 11167, 13, 462, 18652, 29918, 9891, 29922, 8516, 29892, 6287, 29881, 29922, 5574, 29892, 2069, 29918, 5975, 29922, 29896, 29872, 29899, 29946, 29892, 7258, 29918, 1028, 15238, 29918, 9891, 29922, 8824, 11167, 13, 462, 6056, 29918, 13148, 29922, 3846, 29898, 15755, 29889, 14420, 29940, 555, 29892, 321, 567, 29922, 29896, 29872, 29899, 29953, 511, 1044, 29918, 13148, 29922, 15755, 29889, 1692, 29931, 29965, 29892, 5768, 29918, 2084, 29922, 29900, 1696, 274, 412, 29922, 5574, 11167, 13, 462, 954, 29918, 2813, 29879, 29922, 8516, 29892, 3855, 27049, 29918, 29890, 3173, 29922, 8824, 29892, 3855, 29895, 29918, 7052, 29922, 8516, 29892, 1098, 29876, 29918, 8865, 29922, 29900, 1696, 410, 29926, 29918, 8865, 29922, 29900, 1696, 29871, 396, 1098, 29876, 30004, 13, 462, 297, 29918, 22100, 29922, 8516, 29892, 7934, 29918, 22100, 29922, 8516, 29892, 5768, 29922, 29900, 1696, 29871, 396, 286, 22833, 30004, 13, 462, 8242, 29918, 3605, 601, 29922, 29906, 29889, 29900, 30004, 13, 462, 29871, 1125, 30004, 13, 4706, 2428, 29898, 29924, 861, 292, 7445, 29892, 1583, 467, 1649, 2344, 1649, 26471, 13, 30004, 13, 4706, 18652, 29918, 19290, 353, 9657, 29898, 627, 29918, 13148, 29922, 627, 29918, 13148, 11167, 13, 462, 795, 297, 29918, 22100, 29922, 262, 29918, 22100, 29892, 7934, 29918, 22100, 29922, 10892, 29918, 22100, 29892, 5768, 29922, 8865, 29892, 29871, 396, 286, 22833, 30004, 13, 462, 795, 3964, 29922, 6229, 29892, 954, 29918, 2813, 29879, 29922, 1949, 29918, 2813, 29879, 29892, 3855, 27049, 29918, 29890, 3173, 29922, 29939, 27049, 29918, 29890, 3173, 29892, 3855, 29895, 29918, 7052, 29922, 29939, 29895, 29918, 7052, 29892, 1098, 29876, 29918, 8865, 29922, 1131, 29876, 29918, 8865, 29892, 410, 29926, 29918, 8865, 29922, 20865, 29918, 8865, 29871, 396, 1098, 29876, 30004, 13, 462, 795, 1723, 30004, 13, 30004, 13, 4706, 1583, 29889, 3084, 29918, 1028, 15238, 29918, 9891, 353, 5852, 30004, 13, 30004, 13, 4706, 565, 18652, 29918, 9891, 338, 451, 6213, 29901, 30004, 13, 9651, 565, 7258, 29918, 1028, 15238, 29918, 9891, 29901, 30004, 13, 18884, 1583, 29889, 1028, 15238, 29918, 9891, 353, 18652, 29918, 9891, 30004, 13, 9651, 1683, 29901, 30004, 13, 18884, 1583, 29889, 1028, 15238, 29918, 9891, 353, 18652, 29918, 9891, 29898, 1068, 1028, 15238, 29918, 19290, 8443, 13, 9651, 1583, 29889, 12324, 29896, 353, 6056, 29918, 13148, 29898, 6229, 8443, 13, 9651, 565, 6287, 29881, 29901, 30004, 13, 18884, 1583, 29889, 4283, 29918, 29896, 353, 302, 29876, 29889, 9329, 29898, 2344, 29918, 5975, 334, 4842, 305, 29889, 2873, 29898, 29896, 29892, 29871, 29896, 29892, 3964, 511, 6858, 29918, 5105, 29922, 5574, 8443, 13, 9651, 1683, 29901, 30004, 13, 18884, 1583, 29889, 4283, 29918, 29896, 353, 29871, 29896, 22993, 13, 4706, 1683, 29901, 30004, 13, 9651, 1583, 29889, 3084, 29918, 1028, 15238, 29918, 9891, 353, 7700, 30004, 13, 30004, 13, 4706, 1583, 29889, 12719, 29918, 9891, 353, 17368, 1988, 29925, 29898, 262, 29918, 22100, 29922, 6229, 29892, 7934, 29918, 22100, 29922, 524, 29898, 6229, 29930, 12719, 29918, 3605, 601, 511, 1044, 29918, 13148, 29922, 627, 29918, 13148, 11167, 13, 462, 462, 539, 5768, 29922, 8865, 8443, 13, 30004, 13, 4706, 1583, 29889, 12324, 29906, 353, 6056, 29918, 13148, 29898, 6229, 8443, 13, 4706, 1583, 29889, 8865, 29918, 2084, 353, 20724, 2605, 29898, 8865, 29918, 2084, 29897, 565, 5768, 29918, 2084, 1405, 29871, 29900, 29889, 1683, 302, 29876, 29889, 18415, 26471, 13, 30004, 13, 30004, 13, 4706, 1583, 29889, 29883, 412, 353, 274, 412, 30004, 13, 4706, 565, 274, 412, 29901, 30004, 13, 9651, 1583, 29889, 29883, 412, 29918, 1212, 353, 360, 29956, 1168, 29894, 29898, 6229, 8443, 13, 30004, 13, 30004, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 297, 29918, 29916, 353, 921, 30004, 13, 4706, 565, 1583, 29889, 3084, 29918, 1028, 15238, 29918, 9891, 29901, 30004, 13, 9651, 921, 353, 921, 718, 1583, 29889, 8865, 29918, 2084, 29898, 1311, 29889, 4283, 29918, 29896, 334, 1583, 29889, 1028, 15238, 29918, 9891, 29898, 1311, 29889, 12324, 29896, 29898, 262, 29918, 29916, 4961, 30004, 13, 4706, 565, 1583, 29889, 29883, 412, 29901, 30004, 13, 9651, 921, 353, 921, 718, 1583, 29889, 29883, 412, 29918, 1212, 29898, 262, 29918, 29916, 8443, 13, 30004, 13, 4706, 921, 353, 921, 718, 1583, 29889, 8865, 29918, 2084, 29898, 1311, 29889, 12719, 29918, 9891, 29898, 1311, 29889, 12324, 29906, 29898, 29916, 4961, 30004, 13, 30004, 13, 4706, 736, 921, 30004, 13, 30004, 13, 1678, 822, 5685, 567, 29898, 1311, 29892, 1881, 29918, 12181, 1125, 30004, 13, 4706, 17117, 405, 29892, 315, 353, 1881, 29918, 12181, 30004, 13, 4706, 5685, 567, 353, 29871, 29900, 30004, 13, 4706, 565, 1583, 29889, 3084, 29918, 1028, 15238, 29918, 9891, 29901, 30004, 13, 9651, 5685, 567, 4619, 1583, 29889, 1028, 15238, 29918, 9891, 29889, 29888, 417, 567, 29898, 2080, 29918, 12181, 8443, 13, 9651, 5685, 567, 4619, 405, 334, 315, 334, 29871, 29906, 29871, 396, 6056, 718, 14383, 30004, 13, 4706, 565, 1583, 29889, 29883, 412, 29901, 30004, 13, 9651, 5685, 567, 4619, 1583, 29889, 29883, 412, 29918, 1212, 29889, 29888, 417, 567, 29898, 2080, 29918, 12181, 8443, 13, 30004, 13, 4706, 5685, 567, 4619, 1583, 29889, 12719, 29918, 9891, 29889, 29888, 417, 567, 29898, 2080, 29918, 12181, 8443, 13, 4706, 5685, 567, 4619, 405, 334, 315, 334, 29871, 29906, 30004, 13, 4706, 736, 5685, 567, 30004, 13, 30004, 13, 30004, 13, 1990, 1706, 496, 29898, 15755, 29889, 7355, 1125, 30004, 13, 1678, 822, 4770, 2344, 12035, 1311, 11167, 13, 462, 954, 29918, 13203, 29922, 29896, 29900, 29900, 29900, 11167, 13, 462, 10153, 29918, 2311, 29922, 29906, 29906, 29946, 11167, 13, 462, 297, 29918, 305, 550, 29922, 29941, 11167, 13, 462, 7934, 29918, 6229, 29922, 29941, 29947, 29946, 11167, 13, 462, 13261, 29918, 2311, 29922, 29896, 29953, 11167, 13, 462, 7787, 29918, 1279, 29922, 8516, 11167, 13, 462, 1044, 29918, 13148, 29922, 15755, 29889, 1692, 29931, 29965, 11167, 13, 462, 6056, 29918, 13148, 29922, 3846, 29898, 15755, 29889, 14420, 29940, 555, 29892, 321, 567, 29922, 29896, 29872, 29899, 29953, 511, 30004, 13, 462, 20805, 29918, 1853, 2433, 20580, 29896, 23592, 13, 462, 6287, 29881, 29922, 5574, 29892, 2069, 29918, 5975, 29922, 29896, 29872, 29899, 29946, 29892, 5768, 29918, 2084, 29918, 10492, 29922, 29900, 1696, 274, 412, 29922, 5574, 29892, 7258, 29918, 1028, 15238, 29918, 9891, 29922, 8824, 29892, 29871, 396, 24907, 2908, 30004, 13, 462, 954, 29918, 2813, 29879, 29922, 29896, 29906, 29892, 3855, 27049, 29918, 29890, 3173, 29922, 5574, 29892, 3855, 29895, 29918, 7052, 29922, 8516, 29892, 1098, 29876, 29918, 8865, 29922, 29900, 1696, 410, 29926, 29918, 8865, 29922, 29900, 1696, 29871, 396, 1098, 29876, 30004, 13, 462, 5993, 29918, 3605, 601, 29922, 29900, 29889, 29945, 29892, 8242, 29918, 3605, 601, 29922, 29906, 29889, 29900, 29892, 5768, 29918, 10492, 29922, 29900, 1696, 29871, 396, 286, 22833, 30004, 13, 462, 1623, 5461, 29922, 8824, 11167, 13, 462, 3579, 19290, 30004, 13, 462, 29871, 1125, 30004, 13, 4706, 2428, 29898, 5592, 496, 29892, 1583, 467, 1649, 2344, 1649, 26471, 13, 4706, 1583, 29889, 1949, 29918, 13203, 353, 954, 29918, 13203, 30004, 13, 4706, 1583, 29889, 10892, 29918, 6229, 353, 7934, 29918, 6229, 30004, 13, 4706, 1583, 29889, 3204, 5461, 353, 1623, 5461, 30004, 13, 30004, 13, 4706, 1583, 29889, 303, 331, 353, 317, 4330, 29924, 29918, 18799, 1001, 29961, 303, 331, 29918, 1853, 850, 30004, 13, 9651, 10153, 29918, 2311, 29922, 2492, 29918, 2311, 29892, 13261, 29918, 2311, 29922, 5041, 29918, 2311, 29892, 297, 29918, 305, 550, 29922, 262, 29918, 305, 550, 29892, 8297, 29918, 6229, 29922, 10892, 29918, 6229, 29892, 1623, 5461, 29922, 3204, 5461, 8443, 13, 4706, 1583, 29889, 12324, 29896, 353, 6056, 29918, 13148, 29898, 10892, 29918, 6229, 8443, 13, 30004, 13, 4706, 2908, 29918, 19290, 353, 9657, 29898, 6229, 29922, 10892, 29918, 6229, 29892, 6287, 29881, 29922, 7052, 29881, 29892, 2069, 29918, 5975, 29922, 2344, 29918, 5975, 29892, 274, 412, 29922, 29883, 412, 11167, 13, 462, 9651, 7258, 29918, 1028, 15238, 29918, 9891, 29922, 12366, 29918, 1028, 15238, 29918, 9891, 29892, 6056, 29918, 13148, 29922, 12324, 29918, 13148, 29892, 1044, 29918, 13148, 29922, 627, 29918, 13148, 11167, 13, 462, 9651, 954, 29918, 2813, 29879, 29922, 1949, 29918, 2813, 29879, 29892, 3855, 27049, 29918, 29890, 3173, 29922, 29939, 27049, 29918, 29890, 3173, 29892, 3855, 29895, 29918, 7052, 29922, 29939, 29895, 29918, 7052, 29892, 1098, 29876, 29918, 8865, 29922, 1131, 29876, 29918, 8865, 29892, 410, 29926, 29918, 8865, 29922, 20865, 29918, 8865, 29892, 29871, 396, 1098, 29876, 30004, 13, 462, 9651, 297, 29918, 22100, 29922, 1311, 29889, 303, 331, 29889, 1949, 29918, 5041, 267, 29892, 7934, 29918, 22100, 29922, 524, 29898, 1311, 29889, 303, 331, 29889, 1949, 29918, 5041, 267, 334, 5993, 29918, 3605, 601, 511, 8242, 29918, 3605, 601, 29922, 12719, 29918, 3605, 601, 29892, 5768, 29922, 8865, 29918, 10492, 29897, 29871, 396, 286, 22833, 30004, 13, 30004, 13, 4706, 1583, 29889, 1271, 29879, 353, 1583, 29889, 5675, 29918, 1271, 29879, 29898, 1212, 29918, 1279, 29892, 2908, 29918, 19290, 29892, 5768, 29918, 2084, 29918, 10492, 29892, 7258, 29918, 1028, 15238, 29918, 9891, 8443, 13, 4706, 1583, 29889, 12324, 29906, 353, 6056, 29918, 13148, 29898, 10892, 29918, 6229, 8443, 13, 30004, 13, 4706, 565, 451, 1623, 5461, 29901, 30004, 13, 9651, 1583, 29889, 10109, 353, 4367, 24551, 877, 29890, 302, 274, 1599, 289, 274, 742, 20376, 2433, 12676, 1495, 30004, 13, 9651, 1583, 29889, 2813, 353, 302, 29876, 29889, 12697, 29898, 10892, 29918, 6229, 29892, 1583, 29889, 1949, 29918, 13203, 8443, 13, 30004, 13, 4706, 1583, 29889, 2344, 29918, 705, 5861, 26471, 13, 30004, 13, 1678, 822, 1207, 29918, 1271, 29879, 29898, 1311, 29892, 7787, 29918, 1279, 29892, 2908, 29918, 19290, 29892, 5768, 29918, 2084, 29892, 7258, 29918, 1028, 15238, 29918, 9891, 1125, 30004, 13, 4706, 565, 7258, 29918, 1028, 15238, 29918, 9891, 29901, 30004, 13, 9651, 4974, 7431, 29898, 1212, 29918, 1279, 29897, 1275, 29871, 29896, 29892, 525, 29952, 12366, 29918, 1028, 15238, 29918, 9891, 29952, 871, 2304, 5190, 653, 18652, 740, 29915, 30004, 13, 9651, 4974, 7787, 29918, 1279, 29961, 29900, 3816, 29900, 29962, 2804, 525, 3364, 742, 525, 29952, 12366, 29918, 1028, 15238, 29918, 9891, 29952, 437, 451, 2304, 1209, 29915, 30004, 13, 9651, 18652, 29918, 9891, 353, 10937, 1299, 25758, 29918, 29943, 3904, 29907, 29961, 1212, 29918, 1279, 29961, 29900, 3816, 29900, 29962, 850, 1068, 1271, 29918, 19290, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 18652, 29918, 9891, 353, 6213, 30004, 13, 4706, 10930, 353, 5159, 30004, 13, 4706, 363, 3653, 29918, 1853, 29892, 10809, 297, 7787, 29918, 1279, 29901, 30004, 13, 9651, 363, 474, 297, 3464, 29898, 19488, 1125, 30004, 13, 18884, 10930, 29889, 4397, 29898, 29924, 861, 292, 7445, 29898, 1028, 15238, 29918, 9891, 29922, 1028, 15238, 29918, 9891, 470, 10937, 1299, 25758, 29918, 29943, 3904, 29907, 29961, 9891, 29918, 1853, 1402, 5768, 29918, 2084, 29922, 8865, 29918, 2084, 11167, 13, 462, 462, 3986, 3579, 1271, 29918, 19290, 876, 30004, 13, 4706, 736, 302, 29876, 29889, 16941, 2556, 10456, 1271, 29879, 8443, 13, 30004, 13, 1678, 822, 2069, 29918, 705, 5861, 29898, 1311, 1125, 30004, 13, 4706, 363, 302, 29892, 286, 297, 1583, 29889, 17514, 29918, 7576, 7295, 30004, 13, 9651, 903, 2344, 29918, 705, 5861, 29898, 29885, 29892, 302, 8443, 13, 30004, 13, 1678, 822, 6375, 29918, 22100, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 921, 353, 1583, 29889, 303, 331, 29898, 29916, 8443, 13, 4706, 921, 353, 620, 14443, 29906, 29876, 29898, 29916, 8443, 13, 4706, 921, 353, 1583, 29889, 12324, 29896, 29898, 29916, 8443, 13, 30004, 13, 4706, 921, 353, 1583, 29889, 1271, 29879, 29898, 29916, 8443, 13, 4706, 921, 353, 1583, 29889, 12324, 29906, 29898, 29916, 8443, 13, 30004, 13, 4706, 736, 921, 30004, 13, 30004, 13, 1678, 822, 6375, 29898, 1311, 29892, 921, 1125, 30004, 13, 4706, 921, 353, 1583, 29889, 11333, 29918, 22100, 29898, 29916, 8443, 13, 4706, 921, 353, 1583, 29889, 10109, 29898, 29916, 8443, 13, 4706, 921, 353, 1583, 29889, 2813, 29898, 29916, 8443, 13, 4706, 736, 921, 30004, 13, 30004, 13, 1678, 822, 5685, 567, 29898, 1311, 1125, 30004, 13, 4706, 5685, 567, 353, 29871, 29900, 30004, 13, 4706, 8267, 353, 313, 29896, 29892, 1583, 29889, 303, 331, 29889, 1949, 29918, 5041, 267, 29892, 1583, 29889, 10892, 29918, 6229, 8443, 13, 4706, 396, 20805, 30004, 13, 4706, 5685, 567, 4619, 1583, 29889, 303, 331, 29889, 29888, 417, 567, 26471, 13, 4706, 5685, 567, 4619, 2533, 29898, 12181, 8443, 13, 4706, 396, 10930, 30004, 13, 4706, 5685, 567, 4619, 2533, 4197, 29875, 29889, 29888, 417, 567, 29898, 12181, 29897, 363, 474, 297, 1583, 29889, 1271, 29879, 2314, 30004, 13, 4706, 5685, 567, 4619, 2533, 29898, 12181, 8443, 13, 4706, 396, 2343, 30004, 13, 4706, 5685, 567, 4619, 1583, 29889, 10892, 29918, 6229, 334, 1583, 29889, 1949, 29918, 13203, 30004, 13, 4706, 736, 5685, 567, 30004, 13, 30004, 13, 30004, 13, 1753, 903, 2344, 29918, 705, 5861, 29898, 29885, 29892, 302, 29901, 851, 1125, 30004, 13, 1678, 565, 338, 8758, 29898, 29885, 29892, 302, 29876, 29889, 12697, 1125, 30004, 13, 4706, 565, 302, 29889, 27382, 2541, 877, 2813, 29374, 30004, 13, 9651, 302, 29876, 29889, 2344, 29889, 3298, 359, 23538, 29885, 29889, 7915, 8443, 13, 9651, 302, 29876, 29889, 2344, 29889, 3298, 359, 23538, 29885, 29889, 29890, 3173, 8443, 13, 4706, 1683, 29901, 30004, 13, 9651, 302, 29876, 29889, 2344, 29889, 29916, 18852, 29918, 29590, 23538, 29885, 29889, 7915, 8443, 13, 9651, 565, 286, 29889, 29890, 3173, 338, 451, 6213, 29901, 30004, 13, 18884, 565, 525, 828, 29886, 29915, 297, 302, 29901, 30004, 13, 462, 1678, 302, 29876, 29889, 2344, 29889, 8945, 23538, 29885, 29889, 29890, 3173, 29892, 3659, 29922, 29896, 29872, 29899, 29953, 8443, 13, 18884, 1683, 29901, 30004, 13, 462, 1678, 302, 29876, 29889, 2344, 29889, 3298, 359, 23538, 29885, 29889, 29890, 3173, 8443, 13, 1678, 25342, 338, 8758, 29898, 29885, 29892, 302, 29876, 29889, 1168, 29894, 29906, 29881, 1125, 30004, 13, 4706, 302, 29876, 29889, 2344, 29889, 1335, 326, 292, 29918, 8945, 23538, 29885, 29889, 7915, 29892, 4464, 2433, 12963, 29918, 449, 742, 1661, 10660, 537, 2433, 2674, 29884, 1495, 30004, 13, 4706, 565, 286, 29889, 29890, 3173, 338, 451, 6213, 29901, 30004, 13, 9651, 302, 29876, 29889, 2344, 29889, 3298, 359, 23538, 29885, 29889, 29890, 3173, 8443, 13, 1678, 25342, 338, 8758, 29898, 29885, 29892, 313, 15755, 29889, 14420, 29940, 555, 29892, 302, 29876, 29889, 23145, 29940, 555, 29906, 29881, 29892, 302, 29876, 29889, 4782, 29940, 555, 22164, 30004, 13, 4706, 302, 29876, 29889, 2344, 29889, 2873, 23538, 29885, 29889, 7915, 8443, 13, 4706, 302, 29876, 29889, 2344, 29889, 3298, 359, 23538, 29885, 29889, 29890, 3173, 29897, 2 ]
apertools/log.py
scottstanie/apertools
8
32333
""" This module exports a Log class that wraps the logging python package Uses the standard python logging utilities, just provides nice formatting out of the box. Usage: from apertools.log import get_log logger = get_log() logger.info("Something happened") logger.warning("Something concerning happened") logger.error("Something bad happened") logger.critical("Something just awful happened") logger.debug("Extra printing we often don't need to see.") # Custom output for this module: logger.success("Something great happened: highlight this success") """ import logging import time from functools import wraps try: from colorlog import ColoredFormatter COLORS = True except ImportError: from logging import Formatter COLORS = False def get_log(debug=False, name=__file__, verbose=False): """Creates a nice log format for use across multiple files. Default logging level is INFO Args: name (Optional[str]): The name the logger will use when printing statements debug (Optional[bool]): If true, sets logging level to DEBUG """ logger = logging.getLogger(name) return format_log(logger, debug=debug, verbose=verbose) def format_log(logger, debug=False, verbose=False): """Makes the logging output pretty and colored with times""" log_level = logging.DEBUG if debug else logging.INFO log_colors = { "DEBUG": "blue", "INFO": "cyan", "WARNING": "yellow", "ERROR": "red", "CRITICAL": "black,bg_red", "SUCCESS": "white,bg_blue", } if COLORS: format_ = "[%(asctime)s] [%(log_color)s%(levelname)s %(filename)s%(reset)s] %(message)s%(reset)s" formatter = ColoredFormatter( format_, datefmt="%m/%d %H:%M:%S", log_colors=log_colors ) else: format_ = "[%(asctime)s] [%(levelname)s %(filename)s] %(message)s" formatter = Formatter(format_, datefmt="%m/%d %H:%M:%S") handler = logging.StreamHandler() handler.setFormatter(formatter) logging.SUCCESS = 25 # between WARNING and INFO logging.addLevelName(logging.SUCCESS, "SUCCESS") setattr( logger, "success", lambda message, *args: logger._log(logging.SUCCESS, message, args), ) if not logger.handlers: logger.addHandler(handler) logger.setLevel(log_level) if verbose: logger.info("Logger initialized: %s" % (logger.name,)) if debug: logger.setLevel(debug) return logger logger = get_log() def log_runtime(f): """ Logs how long a decorated function takes to run Args: f (function): The function to wrap Returns: function: The wrapped function Example: >>> @log_runtime ... def test_func(): ... return 2 + 4 >>> test_func() 6 This prints out to stderr the following in addition to the answer: [05/26 10:05:51] [INFO log.py] Total elapsed time for test_func (minutes): 0.00 """ @wraps(f) def wrapper(*args, **kwargs): t1 = time.time() result = f(*args, **kwargs) t2 = time.time() elapsed_time = t2 - t1 time_string = "Total elapsed time for {} : {} minutes ({} seconds)".format( f.__name__, "{0:.2f}".format(elapsed_time / 60.0), "{0:.2f}".format(elapsed_time), ) logger.info(time_string) return result return wrapper
[ 1, 9995, 13, 4013, 3883, 29586, 263, 4522, 770, 393, 11463, 567, 278, 12183, 3017, 3577, 13, 13, 15922, 267, 278, 3918, 3017, 12183, 3667, 1907, 29892, 925, 8128, 13, 16533, 15998, 714, 310, 278, 3800, 29889, 13, 13, 27573, 29901, 13, 13, 1678, 515, 29271, 8504, 29889, 1188, 1053, 679, 29918, 1188, 13, 1678, 17927, 353, 679, 29918, 1188, 580, 13, 13, 1678, 17927, 29889, 3888, 703, 16804, 9559, 1159, 13, 1678, 17927, 29889, 27392, 703, 16804, 19813, 9559, 1159, 13, 1678, 17927, 29889, 2704, 703, 16804, 4319, 9559, 1159, 13, 1678, 17927, 29889, 9695, 936, 703, 16804, 925, 28893, 9559, 1159, 13, 1678, 17927, 29889, 8382, 703, 18126, 14010, 591, 4049, 1016, 29915, 29873, 817, 304, 1074, 23157, 13, 1678, 396, 8701, 1962, 363, 445, 3883, 29901, 13, 1678, 17927, 29889, 8698, 703, 16804, 2107, 9559, 29901, 12141, 445, 2551, 1159, 13, 15945, 29908, 13, 5215, 12183, 13, 5215, 931, 13, 3166, 2090, 312, 8789, 1053, 11463, 567, 13, 13, 2202, 29901, 13, 1678, 515, 2927, 1188, 1053, 1530, 4395, 18522, 13, 13, 1678, 23958, 24125, 353, 5852, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 12183, 1053, 3812, 2620, 13, 13, 1678, 23958, 24125, 353, 7700, 13, 13, 13, 1753, 679, 29918, 1188, 29898, 8382, 29922, 8824, 29892, 1024, 29922, 1649, 1445, 1649, 29892, 26952, 29922, 8824, 1125, 13, 1678, 9995, 9832, 1078, 263, 7575, 1480, 3402, 363, 671, 4822, 2999, 2066, 29889, 13, 13, 1678, 13109, 12183, 3233, 338, 15233, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 1024, 313, 27636, 29961, 710, 29962, 1125, 450, 1024, 278, 17927, 674, 671, 746, 14010, 9506, 13, 4706, 4744, 313, 27636, 29961, 11227, 29962, 1125, 960, 1565, 29892, 6166, 12183, 3233, 304, 21681, 13, 13, 1678, 9995, 13, 1678, 17927, 353, 12183, 29889, 657, 16363, 29898, 978, 29897, 13, 1678, 736, 3402, 29918, 1188, 29898, 21707, 29892, 4744, 29922, 8382, 29892, 26952, 29922, 369, 15828, 29897, 13, 13, 13, 1753, 3402, 29918, 1188, 29898, 21707, 29892, 4744, 29922, 8824, 29892, 26952, 29922, 8824, 1125, 13, 1678, 9995, 29924, 6926, 278, 12183, 1962, 5051, 322, 28684, 411, 3064, 15945, 29908, 13, 1678, 1480, 29918, 5563, 353, 12183, 29889, 18525, 565, 4744, 1683, 12183, 29889, 11690, 13, 1678, 1480, 29918, 27703, 353, 426, 13, 4706, 376, 18525, 1115, 376, 9539, 613, 13, 4706, 376, 11690, 1115, 376, 1270, 273, 613, 13, 4706, 376, 29956, 25614, 1115, 376, 29136, 613, 13, 4706, 376, 11432, 1115, 376, 1127, 613, 13, 4706, 376, 11341, 1806, 2965, 1964, 1115, 376, 8517, 29892, 16264, 29918, 1127, 613, 13, 4706, 376, 14605, 26925, 1115, 376, 10921, 29892, 16264, 29918, 9539, 613, 13, 1678, 500, 13, 13, 1678, 565, 23958, 24125, 29901, 13, 4706, 3402, 29918, 353, 14704, 29995, 29898, 294, 312, 603, 29897, 29879, 29962, 518, 29995, 29898, 1188, 29918, 2780, 29897, 29879, 29995, 29898, 5563, 978, 29897, 29879, 1273, 29898, 9507, 29897, 29879, 29995, 29898, 12071, 29897, 29879, 29962, 1273, 29898, 4906, 29897, 29879, 29995, 29898, 12071, 29897, 29879, 29908, 13, 4706, 883, 2620, 353, 1530, 4395, 18522, 29898, 13, 9651, 3402, 3383, 2635, 23479, 543, 29995, 29885, 22584, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 613, 1480, 29918, 27703, 29922, 1188, 29918, 27703, 13, 4706, 1723, 13, 1678, 1683, 29901, 13, 4706, 3402, 29918, 353, 14704, 29995, 29898, 294, 312, 603, 29897, 29879, 29962, 518, 29995, 29898, 5563, 978, 29897, 29879, 1273, 29898, 9507, 29897, 29879, 29962, 1273, 29898, 4906, 29897, 29879, 29908, 13, 4706, 883, 2620, 353, 3812, 2620, 29898, 4830, 3383, 2635, 23479, 543, 29995, 29885, 22584, 29881, 1273, 29950, 16664, 29924, 16664, 29903, 1159, 13, 13, 1678, 7834, 353, 12183, 29889, 3835, 4598, 580, 13, 1678, 7834, 29889, 842, 18522, 29898, 689, 2620, 29897, 13, 1678, 12183, 29889, 14605, 26925, 353, 29871, 29906, 29945, 29871, 396, 1546, 399, 25614, 322, 15233, 13, 1678, 12183, 29889, 1202, 10108, 1170, 29898, 21027, 29889, 14605, 26925, 29892, 376, 14605, 26925, 1159, 13, 1678, 731, 5552, 29898, 13, 4706, 17927, 29892, 13, 4706, 376, 8698, 613, 13, 4706, 14013, 2643, 29892, 334, 5085, 29901, 17927, 3032, 1188, 29898, 21027, 29889, 14605, 26925, 29892, 2643, 29892, 6389, 511, 13, 1678, 1723, 13, 13, 1678, 565, 451, 17927, 29889, 3179, 9306, 29901, 13, 4706, 17927, 29889, 1202, 4598, 29898, 13789, 29897, 13, 4706, 17927, 29889, 842, 10108, 29898, 1188, 29918, 5563, 29897, 13, 13, 4706, 565, 26952, 29901, 13, 9651, 17927, 29889, 3888, 703, 16363, 16601, 29901, 1273, 29879, 29908, 1273, 313, 21707, 29889, 978, 29892, 876, 13, 13, 1678, 565, 4744, 29901, 13, 4706, 17927, 29889, 842, 10108, 29898, 8382, 29897, 13, 13, 1678, 736, 17927, 13, 13, 13, 21707, 353, 679, 29918, 1188, 580, 13, 13, 13, 1753, 1480, 29918, 15634, 29898, 29888, 1125, 13, 1678, 9995, 13, 1678, 4522, 29879, 920, 1472, 263, 10200, 630, 740, 4893, 304, 1065, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 285, 313, 2220, 1125, 450, 740, 304, 12244, 13, 13, 1678, 16969, 29901, 13, 4706, 740, 29901, 450, 21021, 740, 13, 13, 1678, 8741, 29901, 13, 4706, 8653, 732, 1188, 29918, 15634, 13, 4706, 2023, 822, 1243, 29918, 9891, 7295, 13, 4706, 2023, 1678, 736, 29871, 29906, 718, 29871, 29946, 13, 4706, 8653, 1243, 29918, 9891, 580, 13, 308, 29953, 13, 13, 1678, 910, 14677, 714, 304, 380, 20405, 278, 1494, 297, 6124, 304, 278, 1234, 29901, 13, 1678, 518, 29900, 29945, 29914, 29906, 29953, 29871, 29896, 29900, 29901, 29900, 29945, 29901, 29945, 29896, 29962, 518, 11690, 1480, 29889, 2272, 29962, 14990, 560, 28170, 931, 363, 1243, 29918, 9891, 313, 1195, 2667, 1125, 29871, 29900, 29889, 29900, 29900, 13, 13, 1678, 9995, 13, 13, 1678, 732, 29893, 336, 567, 29898, 29888, 29897, 13, 1678, 822, 14476, 10456, 5085, 29892, 3579, 19290, 1125, 13, 4706, 260, 29896, 353, 931, 29889, 2230, 580, 13, 13, 4706, 1121, 353, 285, 10456, 5085, 29892, 3579, 19290, 29897, 13, 13, 4706, 260, 29906, 353, 931, 29889, 2230, 580, 13, 4706, 560, 28170, 29918, 2230, 353, 260, 29906, 448, 260, 29896, 13, 4706, 931, 29918, 1807, 353, 376, 11536, 560, 28170, 931, 363, 6571, 584, 6571, 6233, 313, 8875, 6923, 29897, 1642, 4830, 29898, 13, 9651, 285, 17255, 978, 1649, 29892, 13, 9651, 29850, 29900, 29901, 29889, 29906, 29888, 29913, 1642, 4830, 29898, 295, 28170, 29918, 2230, 847, 29871, 29953, 29900, 29889, 29900, 511, 13, 9651, 29850, 29900, 29901, 29889, 29906, 29888, 29913, 1642, 4830, 29898, 295, 28170, 29918, 2230, 511, 13, 4706, 1723, 13, 13, 4706, 17927, 29889, 3888, 29898, 2230, 29918, 1807, 29897, 13, 4706, 736, 1121, 13, 13, 1678, 736, 14476, 13, 2 ]
mymodule/menu.py
Alex-quickcoder/Notebook
0
84385
<gh_stars>0 """Work with a notebook with an interface.""" import sys from notebook import Notebook, Note from time import sleep from os.path import isfile class Menu: """Display a menu and respond to choices when run. :var file_name: a file name where to store notes. """ file_name = "notes.txt" def __init__(self): """Initialize a notebook and menu choices.""" self.notebook = Notebook() self.choices = {"1": self.show_notes, "2": self.search_notes, "3": self.add_note, "4": self.modify_note, "5": self.clear, "6": self.save, "7": self.quit} def display_menu(self): """Display the choices to the user.""" print("Menu Choices:") for key in self.choices: choice = self.choices[key].__name__ choice = choice.replace("_", " ").title() print(f"{key}: {choice}") def run(self): """Display the menu and respond to the choices.""" choice_quant = len(self.choices) if isfile(self.file_name): notes = self.notebook.notes with open("notes.txt") as file: for line in file: line = line.split("\t\t") line[1] = line[1][1:-1].replace("'", "") line[1] = line[1].split(", ") if line[1][0] == "": notes.append(Note(line[0], [])) else: notes.append(Note(line[0], line[1])) notes[-1].creation_date = line[2][:-1] print("Added saved notes.") self.show_notes() sleep(0.5) while True: self.display_menu() choice = input(f"Enter a valid option(1-{choice_quant}): ") action = self.choices.get(choice) if action: action() sleep(0.5) else: print(f"'{choice}' is invalid, try again...") def show_notes(self, notes: list =None): """Show all stored notes. :param notes: notes to show if available (if None shows all notes) """ if notes is None: notes = self.notebook.notes elif not notes: print("Search didn't return anything.") for note in notes: print(note) def search_notes(self): """Search for a note by memo and tags.""" search_filter = input("Search for (enter separated tags " "or memo fragment): ") notes = self.notebook.search(search_filter) self.show_notes(notes) def add_note(self): """Add a note to the notebook.""" memo = input("Enter a memo: ") tags = input("Enter comma-separated tags or press Enter to skip: ") if tags: self.notebook.new_note(memo, tags.split(",")) else: self.notebook.new_note(memo) print("Your note has been added.") def modify_note(self): """Modify a note.""" try: n_id = int(input("Enter a note id: ")) except (TypeError, ValueError): print("Operation has failed.") return None while True: delete = input("Enter whether to delete a note(y/n): ").lower() if delete in {"y", "yes", "1", "true"}: if self.notebook.modify(n_id, delete=True): print("Operation successful.") else: print("Note with this id doesn't exist.") return None elif delete in {"n", "no", "0", "false"}: break print("Response unclear, try again...") memo = input("Enter a memo (press Enter to skip): ") tags = input("Enter tags (press Enter to skip): ") oper1, oper2 = None, None if memo: oper1 = self.notebook.modify(n_id, n_memo=memo) if tags: oper2 = self.notebook.modify(n_id, n_tags=tags.split(",")) if oper1 or oper2: print("Operation successful.") else: print("Note with this id not found or not modified.") def clear(self): """Delete all notes.""" while True: clear = input("Are you sure you want " "to clear all notes(y/n): ").lower() if clear in {"y", "yes", "1", "true"}: self.notebook.notes = [] Note._id = 1 break elif clear in {"n", "no", "0", "false"}: break else: print("Response unclear, try again...") def save(self): """Save notes into a file.""" with open(self.file_name, mode="w+") as file: for note in self.notebook.notes: file.write(f"{note.memo}\t\t{note.tags}" f"\t\t{note.creation_date}\n") print("Notes saved in notes.txt.") def quit(self): """Quit the program.""" print("Thank you for using your notebook today.") sys.exit(0) if __name__ == "__main__": Menu().run()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 5531, 411, 263, 451, 19273, 411, 385, 5067, 1213, 15945, 13, 5215, 10876, 13, 3166, 451, 19273, 1053, 2216, 19273, 29892, 3940, 13, 3166, 931, 1053, 8709, 13, 3166, 2897, 29889, 2084, 1053, 338, 1445, 13, 13, 13, 1990, 20019, 29901, 13, 1678, 9995, 9323, 263, 6143, 322, 10049, 304, 19995, 746, 1065, 29889, 13, 13, 1678, 584, 1707, 934, 29918, 978, 29901, 263, 934, 1024, 988, 304, 3787, 11486, 29889, 13, 1678, 9995, 13, 1678, 934, 29918, 978, 353, 376, 16953, 29889, 3945, 29908, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 9995, 6644, 6646, 263, 451, 19273, 322, 6143, 19995, 1213, 15945, 13, 4706, 1583, 29889, 1333, 19273, 353, 2216, 19273, 580, 13, 4706, 1583, 29889, 1859, 1575, 353, 8853, 29896, 1115, 1583, 29889, 4294, 29918, 16953, 29892, 13, 462, 4706, 376, 29906, 1115, 1583, 29889, 4478, 29918, 16953, 29892, 13, 462, 4706, 376, 29941, 1115, 1583, 29889, 1202, 29918, 6812, 29892, 13, 462, 4706, 376, 29946, 1115, 1583, 29889, 1545, 1598, 29918, 6812, 29892, 13, 462, 4706, 376, 29945, 1115, 1583, 29889, 8551, 29892, 13, 462, 4706, 376, 29953, 1115, 1583, 29889, 7620, 29892, 13, 462, 4706, 376, 29955, 1115, 1583, 29889, 28358, 29913, 13, 13, 1678, 822, 2479, 29918, 6510, 29898, 1311, 1125, 13, 4706, 9995, 9323, 278, 19995, 304, 278, 1404, 1213, 15945, 13, 4706, 1596, 703, 6823, 14542, 1575, 29901, 1159, 13, 4706, 363, 1820, 297, 1583, 29889, 1859, 1575, 29901, 13, 9651, 7348, 353, 1583, 29889, 1859, 1575, 29961, 1989, 1822, 1649, 978, 1649, 13, 9651, 7348, 353, 7348, 29889, 6506, 703, 29918, 613, 376, 376, 467, 3257, 580, 13, 9651, 1596, 29898, 29888, 29908, 29912, 1989, 6177, 426, 16957, 27195, 13, 13, 1678, 822, 1065, 29898, 1311, 1125, 13, 4706, 9995, 9323, 278, 6143, 322, 10049, 304, 278, 19995, 1213, 15945, 13, 4706, 7348, 29918, 12150, 353, 7431, 29898, 1311, 29889, 1859, 1575, 29897, 13, 13, 4706, 565, 338, 1445, 29898, 1311, 29889, 1445, 29918, 978, 1125, 13, 9651, 11486, 353, 1583, 29889, 1333, 19273, 29889, 16953, 13, 9651, 411, 1722, 703, 16953, 29889, 3945, 1159, 408, 934, 29901, 13, 18884, 363, 1196, 297, 934, 29901, 13, 462, 1678, 1196, 353, 1196, 29889, 5451, 14182, 29873, 29905, 29873, 1159, 13, 462, 1678, 1196, 29961, 29896, 29962, 353, 1196, 29961, 29896, 3816, 29896, 13018, 29896, 1822, 6506, 703, 29915, 613, 20569, 13, 462, 1678, 1196, 29961, 29896, 29962, 353, 1196, 29961, 29896, 1822, 5451, 28165, 16521, 13, 462, 1678, 565, 1196, 29961, 29896, 3816, 29900, 29962, 1275, 376, 1115, 13, 462, 4706, 11486, 29889, 4397, 29898, 9842, 29898, 1220, 29961, 29900, 1402, 5159, 876, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 11486, 29889, 4397, 29898, 9842, 29898, 1220, 29961, 29900, 1402, 1196, 29961, 29896, 12622, 13, 462, 1678, 11486, 14352, 29896, 1822, 1037, 362, 29918, 1256, 353, 1196, 29961, 29906, 3816, 13018, 29896, 29962, 13, 9651, 1596, 703, 2528, 287, 7160, 11486, 23157, 13, 9651, 1583, 29889, 4294, 29918, 16953, 580, 13, 9651, 8709, 29898, 29900, 29889, 29945, 29897, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 1583, 29889, 4990, 29918, 6510, 580, 13, 9651, 7348, 353, 1881, 29898, 29888, 29908, 10399, 263, 2854, 2984, 29898, 29896, 29899, 29912, 16957, 29918, 12150, 29913, 1125, 16521, 13, 9651, 3158, 353, 1583, 29889, 1859, 1575, 29889, 657, 29898, 16957, 29897, 13, 9651, 565, 3158, 29901, 13, 18884, 3158, 580, 13, 18884, 8709, 29898, 29900, 29889, 29945, 29897, 13, 9651, 1683, 29901, 13, 18884, 1596, 29898, 29888, 29908, 29915, 29912, 16957, 10162, 338, 8340, 29892, 1018, 1449, 856, 1159, 13, 13, 1678, 822, 1510, 29918, 16953, 29898, 1311, 29892, 11486, 29901, 1051, 353, 8516, 1125, 13, 4706, 9995, 8964, 599, 6087, 11486, 29889, 13, 13, 4706, 584, 3207, 11486, 29901, 11486, 304, 1510, 565, 3625, 13, 4706, 313, 361, 6213, 3697, 599, 11486, 29897, 13, 4706, 9995, 13, 4706, 565, 11486, 338, 6213, 29901, 13, 9651, 11486, 353, 1583, 29889, 1333, 19273, 29889, 16953, 13, 4706, 25342, 451, 11486, 29901, 13, 9651, 1596, 703, 7974, 3282, 29915, 29873, 736, 3099, 23157, 13, 4706, 363, 4443, 297, 11486, 29901, 13, 9651, 1596, 29898, 6812, 29897, 13, 13, 1678, 822, 2740, 29918, 16953, 29898, 1311, 1125, 13, 4706, 9995, 7974, 363, 263, 4443, 491, 2626, 29877, 322, 8282, 1213, 15945, 13, 4706, 2740, 29918, 4572, 353, 1881, 703, 7974, 363, 313, 5893, 13055, 8282, 376, 13, 462, 795, 376, 272, 2626, 29877, 9376, 1125, 16521, 13, 4706, 11486, 353, 1583, 29889, 1333, 19273, 29889, 4478, 29898, 4478, 29918, 4572, 29897, 13, 4706, 1583, 29889, 4294, 29918, 16953, 29898, 16953, 29897, 13, 13, 1678, 822, 788, 29918, 6812, 29898, 1311, 1125, 13, 4706, 9995, 2528, 263, 4443, 304, 278, 451, 19273, 1213, 15945, 13, 4706, 2626, 29877, 353, 1881, 703, 10399, 263, 2626, 29877, 29901, 16521, 13, 4706, 8282, 353, 1881, 703, 10399, 16694, 29899, 25048, 630, 8282, 470, 3965, 9041, 304, 14383, 29901, 16521, 13, 4706, 565, 8282, 29901, 13, 9651, 1583, 29889, 1333, 19273, 29889, 1482, 29918, 6812, 29898, 6954, 29877, 29892, 8282, 29889, 5451, 29898, 3284, 876, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 1333, 19273, 29889, 1482, 29918, 6812, 29898, 6954, 29877, 29897, 13, 4706, 1596, 703, 10858, 4443, 756, 1063, 2715, 23157, 13, 13, 1678, 822, 6623, 29918, 6812, 29898, 1311, 1125, 13, 4706, 9995, 2111, 1598, 263, 4443, 1213, 15945, 13, 4706, 1018, 29901, 13, 9651, 302, 29918, 333, 353, 938, 29898, 2080, 703, 10399, 263, 4443, 1178, 29901, 376, 876, 13, 4706, 5174, 313, 1542, 2392, 29892, 7865, 2392, 1125, 13, 9651, 1596, 703, 10925, 756, 5229, 23157, 13, 9651, 736, 6213, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 5217, 353, 1881, 703, 10399, 3692, 304, 5217, 263, 4443, 29898, 29891, 29914, 29876, 1125, 376, 467, 13609, 580, 13, 9651, 565, 5217, 297, 8853, 29891, 613, 376, 3582, 613, 376, 29896, 613, 376, 3009, 29908, 6177, 13, 18884, 565, 1583, 29889, 1333, 19273, 29889, 1545, 1598, 29898, 29876, 29918, 333, 29892, 5217, 29922, 5574, 1125, 13, 462, 1678, 1596, 703, 10925, 9150, 23157, 13, 18884, 1683, 29901, 13, 462, 1678, 1596, 703, 9842, 411, 445, 1178, 1838, 29915, 29873, 1863, 23157, 13, 18884, 736, 6213, 13, 9651, 25342, 5217, 297, 8853, 29876, 613, 376, 1217, 613, 376, 29900, 613, 376, 4541, 29908, 6177, 13, 18884, 2867, 13, 9651, 1596, 703, 5103, 20871, 29892, 1018, 1449, 856, 1159, 13, 13, 4706, 2626, 29877, 353, 1881, 703, 10399, 263, 2626, 29877, 313, 2139, 9041, 304, 14383, 1125, 16521, 13, 4706, 8282, 353, 1881, 703, 10399, 8282, 313, 2139, 9041, 304, 14383, 1125, 16521, 13, 4706, 1751, 29896, 29892, 1751, 29906, 353, 6213, 29892, 6213, 13, 4706, 565, 2626, 29877, 29901, 13, 9651, 1751, 29896, 353, 1583, 29889, 1333, 19273, 29889, 1545, 1598, 29898, 29876, 29918, 333, 29892, 302, 29918, 6954, 29877, 29922, 6954, 29877, 29897, 13, 4706, 565, 8282, 29901, 13, 9651, 1751, 29906, 353, 1583, 29889, 1333, 19273, 29889, 1545, 1598, 29898, 29876, 29918, 333, 29892, 302, 29918, 11338, 29922, 11338, 29889, 5451, 29898, 3284, 876, 13, 13, 4706, 565, 1751, 29896, 470, 1751, 29906, 29901, 13, 9651, 1596, 703, 10925, 9150, 23157, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 9842, 411, 445, 1178, 451, 1476, 470, 451, 9120, 23157, 13, 13, 1678, 822, 2821, 29898, 1311, 1125, 13, 4706, 9995, 12498, 599, 11486, 1213, 15945, 13, 4706, 1550, 5852, 29901, 13, 9651, 2821, 353, 1881, 703, 17506, 366, 1854, 366, 864, 376, 13, 462, 3986, 376, 517, 2821, 599, 11486, 29898, 29891, 29914, 29876, 1125, 376, 467, 13609, 580, 13, 9651, 565, 2821, 297, 8853, 29891, 613, 376, 3582, 613, 376, 29896, 613, 376, 3009, 29908, 6177, 13, 18884, 1583, 29889, 1333, 19273, 29889, 16953, 353, 5159, 13, 18884, 3940, 3032, 333, 353, 29871, 29896, 13, 18884, 2867, 13, 9651, 25342, 2821, 297, 8853, 29876, 613, 376, 1217, 613, 376, 29900, 613, 376, 4541, 29908, 6177, 13, 18884, 2867, 13, 9651, 1683, 29901, 13, 18884, 1596, 703, 5103, 20871, 29892, 1018, 1449, 856, 1159, 13, 13, 1678, 822, 4078, 29898, 1311, 1125, 13, 4706, 9995, 11371, 11486, 964, 263, 934, 1213, 15945, 13, 4706, 411, 1722, 29898, 1311, 29889, 1445, 29918, 978, 29892, 4464, 543, 29893, 29974, 1159, 408, 934, 29901, 13, 9651, 363, 4443, 297, 1583, 29889, 1333, 19273, 29889, 16953, 29901, 13, 18884, 934, 29889, 3539, 29898, 29888, 29908, 29912, 6812, 29889, 6954, 29877, 1012, 29873, 29905, 29873, 29912, 6812, 29889, 11338, 5038, 13, 462, 965, 285, 26732, 29873, 29905, 29873, 29912, 6812, 29889, 1037, 362, 29918, 1256, 1012, 29876, 1159, 13, 4706, 1596, 703, 3664, 267, 7160, 297, 11486, 29889, 3945, 23157, 13, 13, 1678, 822, 23283, 29898, 1311, 1125, 13, 4706, 9995, 2182, 277, 278, 1824, 1213, 15945, 13, 4706, 1596, 703, 25271, 366, 363, 773, 596, 451, 19273, 9826, 23157, 13, 4706, 10876, 29889, 13322, 29898, 29900, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 20019, 2141, 3389, 580, 13, 2 ]
setup.py
CWE0/rainflow
0
149348
from setuptools import setup import os this_dir = os.path.dirname(__file__) with open(os.path.join(this_dir, "README.md"), "rb") as fo: long_description = fo.read().decode("utf8") setup( name='rainflow', package_dir={"": "src"}, py_modules=['rainflow'], description='Implementation of ASTM E1049-85 rainflow cycle counting algorithm', install_requires=["importlib_metadata ; python_version < '3.8'"], extras_require={"dev": ["pytest ~= 4.6"]}, python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4", setup_requires=["setuptools_scm"], use_scm_version=True, long_description=long_description, long_description_content_type='text/markdown', author='<NAME>', url='https://github.com/iamlikeme/rainflow/', license="MIT", classifiers=[ "Development Status :: 5 - Production/Stable", "Intended Audience :: Science/Research", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Scientific/Engineering", "Topic :: Software Development :: Libraries :: Python Modules", ], )
[ 1, 515, 731, 21245, 8789, 1053, 6230, 13, 5215, 2897, 13, 13, 1366, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 22168, 1445, 1649, 29897, 13, 13, 2541, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 1366, 29918, 3972, 29892, 376, 16310, 2303, 29889, 3487, 4968, 376, 6050, 1159, 408, 1701, 29901, 13, 1678, 1472, 29918, 8216, 353, 1701, 29889, 949, 2141, 13808, 703, 9420, 29947, 1159, 13, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 6038, 1731, 742, 13, 1678, 3577, 29918, 3972, 3790, 29908, 1115, 376, 4351, 10758, 13, 1678, 11451, 29918, 7576, 29922, 1839, 6038, 1731, 7464, 13, 1678, 6139, 2433, 1888, 14607, 310, 319, 1254, 29924, 382, 29896, 29900, 29946, 29929, 29899, 29947, 29945, 17251, 1731, 11412, 21248, 5687, 742, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 3366, 5215, 1982, 29918, 19635, 2056, 3017, 29918, 3259, 529, 525, 29941, 29889, 29947, 11838, 1402, 13, 1678, 429, 10678, 29918, 12277, 3790, 29908, 3359, 1115, 6796, 2272, 1688, 3695, 29922, 29871, 29946, 29889, 29953, 3108, 1118, 13, 1678, 3017, 29918, 276, 339, 2658, 543, 18572, 29906, 29889, 29955, 29892, 2804, 29941, 29889, 29900, 5575, 29892, 2804, 29941, 29889, 29896, 5575, 29892, 2804, 29941, 29889, 29906, 5575, 29892, 2804, 29941, 29889, 29941, 5575, 29892, 529, 29946, 613, 13, 1678, 6230, 29918, 276, 339, 2658, 29922, 3366, 842, 21245, 8789, 29918, 1557, 29885, 12436, 13, 1678, 671, 29918, 1557, 29885, 29918, 3259, 29922, 5574, 29892, 13, 1678, 1472, 29918, 8216, 29922, 5426, 29918, 8216, 29892, 13, 1678, 1472, 29918, 8216, 29918, 3051, 29918, 1853, 2433, 726, 29914, 3502, 3204, 742, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 2829, 5081, 2004, 29914, 6038, 1731, 29914, 742, 13, 1678, 19405, 543, 26349, 613, 13, 1678, 770, 14903, 11759, 13, 4706, 376, 21956, 358, 16034, 4761, 29871, 29945, 448, 19561, 29914, 855, 519, 613, 13, 4706, 376, 2928, 2760, 319, 4749, 663, 4761, 9327, 29914, 1666, 2842, 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, 4706, 376, 9283, 4056, 17088, 4761, 5132, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29906, 29889, 29955, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29946, 613, 13, 4706, 376, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29945, 613, 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, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29947, 613, 13, 4706, 376, 7031, 293, 4761, 23753, 928, 29914, 12412, 3241, 613, 13, 4706, 376, 7031, 293, 4761, 18540, 14650, 4761, 365, 4626, 4314, 4761, 5132, 3382, 2540, 613, 13, 1678, 21251, 13, 29897, 13, 2 ]
sample-apps/statsd/webserver.py
alanwest/aws-otel-test-framework
0
159241
from http.server import HTTPServer, BaseHTTPRequestHandler import os import socket import logging import json class httpHandler(BaseHTTPRequestHandler): def do_GET(self): if self.path == '/a': self.wfile.write('Helloa! '.encode()) elif self.path == '/statsd': send_statsd_metrics() self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() self.wfile.write(json.dumps({'traceId': 'dummy'}).encode()) elif self.path == '/': self.send_response(200) self.end_headers() else: self.wfile.write('Hello! '.encode()) def send_statsd_metrics(): INSTANCE_ID = os.getenv('INSTANCE_ID') RECEIVER_ADDRESS = os.getenv('COLLECTOR_UDP_ADDRESS') logging.warning(INSTANCE_ID) logging.warning(RECEIVER_ADDRESS) if INSTANCE_ID is not None and RECEIVER_ADDRESS is not None: statsD_metric = bytes('statsdTestMetric1g_%s:1|g|#mykey1:myvalue1,mykey2:myvalue2\nstatsdTestMetric1c_%s:1|c|#mykey3:myvalue3' % (INSTANCE_ID, INSTANCE_ID),'utf-8') opened_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) opened_socket.sendto(statsD_metric, (RECEIVER_ADDRESS.split(':')[0], int(RECEIVER_ADDRESS.split(':')[1]))) return def main(): ADDRESS = os.getenv('LISTEN_ADDRESS') if ADDRESS is not None: HOST = ADDRESS.split(':')[0] PORT = int(ADDRESS.split(':')[1]) else: HOST = '0.0.0.0' PORT = 4321 server = HTTPServer((HOST, PORT), httpHandler) server.serve_forever() if __name__ == '__main__': main()
[ 1, 515, 1732, 29889, 2974, 1053, 7331, 6004, 29892, 7399, 10493, 3089, 4598, 13, 5215, 2897, 13, 5215, 9909, 13, 5215, 12183, 13, 5215, 4390, 13, 13, 1990, 1732, 4598, 29898, 5160, 10493, 3089, 4598, 1125, 13, 1678, 822, 437, 29918, 7194, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 2084, 1275, 8207, 29874, 2396, 13, 9651, 1583, 29889, 29893, 1445, 29889, 3539, 877, 10994, 29874, 29991, 15300, 12508, 3101, 13, 4706, 25342, 1583, 29889, 2084, 1275, 8207, 16202, 29881, 2396, 13, 9651, 3638, 29918, 16202, 29881, 29918, 2527, 10817, 580, 13, 9651, 1583, 29889, 6717, 29918, 5327, 29898, 29906, 29900, 29900, 29897, 13, 9651, 1583, 29889, 6717, 29918, 6672, 877, 3916, 29899, 1853, 742, 525, 6214, 29914, 3126, 1495, 13, 9651, 1583, 29889, 355, 29918, 13662, 580, 13, 9651, 1583, 29889, 29893, 1445, 29889, 3539, 29898, 3126, 29889, 29881, 17204, 3319, 29915, 15003, 1204, 2396, 525, 29881, 11770, 29915, 7690, 12508, 3101, 13, 4706, 25342, 1583, 29889, 2084, 1275, 8207, 2396, 13, 9651, 1583, 29889, 6717, 29918, 5327, 29898, 29906, 29900, 29900, 29897, 13, 9651, 1583, 29889, 355, 29918, 13662, 580, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29893, 1445, 29889, 3539, 877, 10994, 29991, 15300, 12508, 3101, 13, 13, 1753, 3638, 29918, 16202, 29881, 29918, 2527, 10817, 7295, 13, 1678, 2672, 1254, 23219, 29918, 1367, 353, 2897, 29889, 657, 6272, 877, 25580, 23219, 29918, 1367, 1495, 13, 1678, 5195, 4741, 29902, 5348, 29918, 17744, 26785, 353, 2897, 29889, 657, 6272, 877, 15032, 3281, 1955, 29918, 29965, 11191, 29918, 17744, 26785, 1495, 13, 1678, 12183, 29889, 27392, 29898, 25580, 23219, 29918, 1367, 29897, 13, 1678, 12183, 29889, 27392, 29898, 1525, 4741, 29902, 5348, 29918, 17744, 26785, 29897, 13, 1678, 565, 2672, 1254, 23219, 29918, 1367, 338, 451, 6213, 322, 5195, 4741, 29902, 5348, 29918, 17744, 26785, 338, 451, 6213, 29901, 13, 4706, 22663, 29928, 29918, 16414, 353, 6262, 877, 16202, 29881, 3057, 10095, 2200, 29896, 29887, 29918, 29995, 29879, 29901, 29896, 29989, 29887, 29989, 29937, 1357, 1989, 29896, 29901, 1357, 1767, 29896, 29892, 1357, 1989, 29906, 29901, 1357, 1767, 29906, 29905, 29876, 16202, 29881, 3057, 10095, 2200, 29896, 29883, 29918, 29995, 29879, 29901, 29896, 29989, 29883, 29989, 29937, 1357, 1989, 29941, 29901, 1357, 1767, 29941, 29915, 1273, 313, 25580, 23219, 29918, 1367, 29892, 2672, 1254, 23219, 29918, 1367, 511, 29915, 9420, 29899, 29947, 1495, 13, 4706, 6496, 29918, 11514, 353, 9909, 29889, 11514, 29898, 11514, 29889, 5098, 29918, 1177, 2544, 29892, 9909, 29889, 6156, 7077, 29918, 29928, 29954, 25058, 29897, 13, 4706, 6496, 29918, 11514, 29889, 6717, 517, 29898, 16202, 29928, 29918, 16414, 29892, 313, 1525, 4741, 29902, 5348, 29918, 17744, 26785, 29889, 5451, 877, 29901, 29861, 29900, 1402, 938, 29898, 1525, 4741, 29902, 5348, 29918, 17744, 26785, 29889, 5451, 877, 29901, 29861, 29896, 29962, 4961, 13, 1678, 736, 13, 13, 1753, 1667, 7295, 13, 1678, 27827, 26785, 353, 2897, 29889, 657, 6272, 877, 24360, 1430, 29918, 17744, 26785, 1495, 13, 1678, 565, 27827, 26785, 338, 451, 6213, 29901, 13, 4706, 379, 3718, 353, 27827, 26785, 29889, 5451, 877, 29901, 29861, 29900, 29962, 13, 4706, 349, 8476, 353, 938, 29898, 17744, 26785, 29889, 5451, 877, 29901, 29861, 29896, 2314, 13, 1678, 1683, 29901, 13, 4706, 379, 3718, 353, 525, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 29915, 13, 4706, 349, 8476, 353, 29871, 29946, 29941, 29906, 29896, 13, 1678, 1923, 353, 7331, 6004, 3552, 20832, 29892, 349, 8476, 511, 1732, 4598, 29897, 13, 1678, 1923, 29889, 16349, 29918, 1079, 369, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 2 ]
src/util/error.py
aYukiYoshida/xisscfeffect
0
79541
<reponame>aYukiYoshida/xisscfeffect<filename>src/util/error.py # -*- coding: utf-8 -*- class InsufficientInputError(Exception): """入力が不足していることを知らせる例外クラス""" pass class InvalidInputError(Exception): """入力が相応しくないことを知らせる例外クラス""" pass
[ 1, 529, 276, 1112, 420, 29958, 29874, 29979, 19267, 29979, 10578, 1458, 29914, 29916, 790, 29883, 1725, 7161, 29966, 9507, 29958, 4351, 29914, 4422, 29914, 2704, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 1990, 512, 2146, 4543, 4290, 2392, 29898, 2451, 1125, 13, 1678, 9995, 30752, 31074, 30458, 30413, 31722, 30326, 30466, 30298, 30332, 30589, 30364, 30396, 31043, 30513, 31095, 30332, 31507, 31066, 30305, 30281, 30255, 15945, 29908, 13, 1678, 1209, 13, 13, 13, 1990, 21403, 4290, 2392, 29898, 2451, 1125, 13, 1678, 9995, 30752, 31074, 30458, 30990, 232, 194, 159, 30326, 30568, 30371, 30298, 30589, 30364, 30396, 31043, 30513, 31095, 30332, 31507, 31066, 30305, 30281, 30255, 15945, 29908, 13, 1678, 1209, 13, 2 ]
basic/Pyshop/products/models.py
IsAlbertLiu/Python-basics
0
22827
<filename>basic/Pyshop/products/models.py from django.db import models # Create your models here. class Product(models.Model): name = models.CharField(max_length=255) price = models.FloatField() stack = models.IntegerField() image_url = models.CharField(2083)
[ 1, 529, 9507, 29958, 16121, 29914, 19737, 19032, 29914, 14456, 29914, 9794, 29889, 2272, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 13, 29937, 6204, 596, 4733, 1244, 29889, 13, 1990, 10969, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 1678, 8666, 353, 4733, 29889, 11031, 3073, 580, 13, 1678, 5096, 353, 4733, 29889, 7798, 3073, 580, 13, 1678, 1967, 29918, 2271, 353, 4733, 29889, 27890, 29898, 29906, 29900, 29947, 29941, 29897, 13, 2 ]
tests/predictors/relation_classifier_predictor_test.py
DFKI-NLP/RelEx
16
123755
# pylint: disable=no-self-use,invalid-name,unused-import from unittest import TestCase from pytest import approx from allennlp.models.archival import load_archive from allennlp.predictors import Predictor import relex class RelationClassifierPredictorTest(TestCase): def test_uses_named_inputs(self): inputs = { "text": ( "The system as described above has its greatest " "application in an arrayed configuration of antenna elements ." ), "head": [12, 13], "tail": [15, 16], } archive = load_archive("tests/fixtures/model.tar.gz") predictor = Predictor.from_archive(archive, "relation_classifier") result = predictor.predict_json(inputs) label = result.get("label") assert label in { "Other", "Entity-Destination(e1,e2)", "Component-Whole(e2,e1)", "Instrument-Agency(e2,e1)", "Member-Collection(e1,e2)", "Cause-Effect(e2,e1)", "Content-Container(e1,e2)", } class_probabilities = result.get("class_probabilities") assert class_probabilities is not None assert all(cp > 0 for cp in class_probabilities) assert sum(class_probabilities) == approx(1.0)
[ 1, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 1311, 29899, 1509, 29892, 20965, 29899, 978, 29892, 348, 3880, 29899, 5215, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 13, 3166, 11451, 1688, 1053, 2134, 29916, 13, 3166, 599, 2108, 22833, 29889, 9794, 29889, 1279, 2561, 1053, 2254, 29918, 10867, 13, 3166, 599, 2108, 22833, 29889, 27711, 943, 1053, 21099, 919, 272, 13, 13, 5215, 337, 2506, 13, 13, 13, 1990, 6376, 362, 2385, 3709, 23084, 919, 272, 3057, 29898, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 6394, 29918, 17514, 29918, 2080, 29879, 29898, 1311, 1125, 13, 4706, 10970, 353, 426, 13, 9651, 376, 726, 1115, 313, 13, 18884, 376, 1576, 1788, 408, 5439, 2038, 756, 967, 14176, 376, 13, 18884, 376, 6214, 297, 385, 1409, 287, 5285, 310, 25504, 1056, 3161, 869, 29908, 13, 9651, 10353, 13, 9651, 376, 2813, 1115, 518, 29896, 29906, 29892, 29871, 29896, 29941, 1402, 13, 9651, 376, 18237, 1115, 518, 29896, 29945, 29892, 29871, 29896, 29953, 1402, 13, 4706, 500, 13, 13, 4706, 18871, 353, 2254, 29918, 10867, 703, 21150, 29914, 7241, 486, 1973, 29914, 4299, 29889, 12637, 29889, 18828, 1159, 13, 4706, 8500, 272, 353, 21099, 919, 272, 29889, 3166, 29918, 10867, 29898, 10867, 29892, 376, 23445, 29918, 1990, 3709, 1159, 13, 13, 4706, 1121, 353, 8500, 272, 29889, 27711, 29918, 3126, 29898, 2080, 29879, 29897, 13, 13, 4706, 3858, 353, 1121, 29889, 657, 703, 1643, 1159, 13, 4706, 4974, 3858, 297, 426, 13, 9651, 376, 16107, 613, 13, 9651, 376, 6691, 29899, 14994, 3381, 29898, 29872, 29896, 29892, 29872, 29906, 19123, 13, 9651, 376, 5308, 29899, 22110, 280, 29898, 29872, 29906, 29892, 29872, 29896, 19123, 13, 9651, 376, 3379, 15461, 29899, 29909, 14703, 29898, 29872, 29906, 29892, 29872, 29896, 19123, 13, 9651, 376, 13404, 29899, 7196, 29898, 29872, 29896, 29892, 29872, 29906, 19123, 13, 9651, 376, 29907, 1071, 29899, 13971, 29898, 29872, 29906, 29892, 29872, 29896, 19123, 13, 9651, 376, 3916, 29899, 7895, 29898, 29872, 29896, 29892, 29872, 29906, 19123, 13, 4706, 500, 13, 13, 4706, 770, 29918, 22795, 11614, 353, 1121, 29889, 657, 703, 1990, 29918, 22795, 11614, 1159, 13, 4706, 4974, 770, 29918, 22795, 11614, 338, 451, 6213, 13, 4706, 4974, 599, 29898, 6814, 1405, 29871, 29900, 363, 21447, 297, 770, 29918, 22795, 11614, 29897, 13, 4706, 4974, 2533, 29898, 1990, 29918, 22795, 11614, 29897, 1275, 2134, 29916, 29898, 29896, 29889, 29900, 29897, 13, 2 ]
hsf_website_helpers/bin/hsf_reformat_training_events.py
HSF/website-helpers
0
26148
#!/usr/bin/env python3 """ Quick script to read all training schools from data file and write them out again to e.g. update the formatting. """ import argparse from hsf_website_helpers.events.event import EventDatabase from hsf_website_helpers.util.cli import add_website_home_option def get_parser() -> argparse.ArgumentParser: d = ( "Quick script to read all training schools from data file and write " "them out again to e.g. update the formatting." ) parser = argparse.ArgumentParser(description=d) add_website_home_option(parser) return parser if __name__ == "__main__": parser = get_parser() args = parser.parse_args() path = args.home / "_data" / "training-schools.yml" if path.is_file(): edb = EventDatabase.from_file(path) print(f"Loaded {len(edb.events)} events from database.") else: print(f"Did not find database at {path}. Initializing empty one.") edb = EventDatabase() edb.write(path) print( "Reformated database. Please commit and submit a PR to add it to " "the webpage." )
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 15945, 29908, 13, 2182, 860, 2471, 304, 1303, 599, 6694, 12462, 515, 848, 934, 322, 2436, 963, 714, 13, 351, 475, 304, 321, 29889, 29887, 29889, 2767, 278, 15998, 29889, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 13, 13, 3166, 298, 4668, 29918, 22942, 29918, 3952, 6774, 29889, 13604, 29889, 3696, 1053, 6864, 9112, 13, 3166, 298, 4668, 29918, 22942, 29918, 3952, 6774, 29889, 4422, 29889, 11303, 1053, 788, 29918, 22942, 29918, 5184, 29918, 3385, 13, 13, 13, 1753, 679, 29918, 16680, 580, 1599, 1852, 5510, 29889, 15730, 11726, 29901, 13, 1678, 270, 353, 313, 13, 4706, 376, 2182, 860, 2471, 304, 1303, 599, 6694, 12462, 515, 848, 934, 322, 2436, 376, 13, 4706, 376, 386, 331, 714, 1449, 304, 321, 29889, 29887, 29889, 2767, 278, 15998, 1213, 13, 1678, 1723, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 29922, 29881, 29897, 13, 1678, 788, 29918, 22942, 29918, 5184, 29918, 3385, 29898, 16680, 29897, 13, 1678, 736, 13812, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 13812, 353, 679, 29918, 16680, 580, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 2224, 353, 6389, 29889, 5184, 847, 11119, 1272, 29908, 847, 376, 26495, 29899, 816, 8789, 29889, 21053, 29908, 13, 1678, 565, 2224, 29889, 275, 29918, 1445, 7295, 13, 4706, 1226, 29890, 353, 6864, 9112, 29889, 3166, 29918, 1445, 29898, 2084, 29897, 13, 4706, 1596, 29898, 29888, 29908, 29147, 426, 2435, 29898, 287, 29890, 29889, 13604, 2915, 4959, 515, 2566, 23157, 13, 1678, 1683, 29901, 13, 4706, 1596, 29898, 29888, 29908, 9260, 451, 1284, 2566, 472, 426, 2084, 1836, 17250, 5281, 4069, 697, 23157, 13, 4706, 1226, 29890, 353, 6864, 9112, 580, 13, 1678, 1226, 29890, 29889, 3539, 29898, 2084, 29897, 13, 1678, 1596, 29898, 13, 4706, 376, 1123, 689, 630, 2566, 29889, 3529, 9063, 322, 9752, 263, 12089, 304, 788, 372, 304, 376, 13, 4706, 376, 1552, 24499, 1213, 13, 1678, 1723, 13, 2 ]
Sudoku Solver/sudoku.py
Ch-V3nU/Projects
0
64479
#!/usr/bin/py2 import cv2 import imutils import numpy as np from solver import Solver from Recognizer import OCR from skimage.segmentation import clear_border from imutils.perspective import four_point_transform class Sudoku(object): def __init__(self, image): self.image = image self.gray = None def initialize_image(self): self.image = cv2.imread(self.image) self.image = imutils.resize(self.image, width=600) return def fetch_rectangle(self): self.gray = cv2.cvtColor(self.image, cv2.COLOR_BGR2GRAY) blurred = cv2.GaussianBlur(self.gray, (7, 7), 3) thresh = cv2.adaptiveThreshold(blurred, 255,cv2.ADAPTIVE_THRESH_GAUSSIAN_C, cv2.THRESH_BINARY, 11, 2) thresh = cv2.bitwise_not(thresh) cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL,cv2.CHAIN_APPROX_SIMPLE) cnts = imutils.grab_contours(cnts) cnts = sorted(cnts, key=cv2.contourArea, reverse=True) puzzleCnt = None for c in cnts: peri = cv2.arcLength(c, True) approx = cv2.approxPolyDP(c, 0.02 * peri, True) if len(approx) == 4: puzzleCnt = approx break return puzzleCnt def extract_sudoku_board(self,board): original_image = four_point_transform(self.image, board.reshape(4, 2)) gray_image = four_point_transform(self.gray, board.reshape(4, 2)) return gray_image def split_board(self,board): return board.shape[1] // 9, board.shape[0] // 9 def extract_digit(self,cell): thresh = cv2.threshold(cell, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1] thresh = clear_border(thresh) cnts = cv2.findContours(thresh.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) cnts = imutils.grab_contours(cnts) if len(cnts) == 0: return None c = max(cnts, key=cv2.contourArea) mask = np.zeros(thresh.shape, dtype="uint8") cv2.drawContours(mask, [c], -1, 255, -1) (h, w) = thresh.shape percentFilled = cv2.countNonZero(mask) / float(w * h) if percentFilled < 0.03: return None digit = cv2.bitwise_and(thresh, thresh, mask=mask) return digit def process_cells(self,stepX,stepY,board): ocr = OCR() sudoku_array = np.zeros((9, 9), dtype="int") cellLocs = [] boolean = True for y in range(0, 9): row = [] for x in range(0, 9): startX = x * stepX startY = y * stepY endX = (x + 1) * stepX endY = (y + 1) * stepY row.append((startX, startY, endX, endY)) cell = board[startY:endY, startX:endX] digit = self.extract_digit(cell) if (digit is not None): cv2.imwrite("img-"+str(y)+str(x)+".png",digit) sudoku_array[y][x] = ocr.prediction(digit) return sudoku_array def solve(self): self.initialize_image() board = self.fetch_rectangle() if board is None: return board = self.extract_sudoku_board(board) x,y = self.split_board(board) final_board = self.process_cells(x,y,board) return final_board def manipulate(board): canShow = True while (canShow): decision = raw_input("\nWanna make any corrections to the board? Press y if yes:-") if (decision and decision[0].lower() == "y"): canShow = False break values = raw_input("\nEnter Row,Column and Value. Ex: 2,2,3: ").split(",") try: row,col,val = list(map(int,values[:3])) check = lambda x: x>0 and x<10 if (all([check(i) for i in [row,col,val]])): board[row-1][col-1] = val print("\nUpdated Board\n") print(board) else: print("\nInvalid input") except: print("\nInvalid input") return board sudoku_board = Sudoku("Images/sudoku.jpg").solve() print(sudoku_board) updated_board = manipulate(sudoku_board) Solver().solution(updated_board)
[ 1, 18787, 4855, 29914, 2109, 29914, 2272, 29906, 13, 13, 5215, 13850, 29906, 13, 5215, 527, 13239, 13, 5215, 12655, 408, 7442, 13, 3166, 899, 369, 1053, 4956, 369, 13, 3166, 3599, 3811, 3950, 1053, 438, 11341, 13, 3166, 2071, 3027, 29889, 28192, 362, 1053, 2821, 29918, 11466, 13, 3166, 527, 13239, 29889, 6774, 12645, 1053, 3023, 29918, 3149, 29918, 9067, 13, 13, 13, 1990, 8383, 9154, 29898, 3318, 1125, 13, 12, 1753, 4770, 2344, 12035, 1311, 29892, 1967, 1125, 13, 12, 12, 1311, 29889, 3027, 353, 1967, 13, 12, 12, 1311, 29889, 21012, 353, 6213, 13, 12, 12, 13, 13, 12, 1753, 11905, 29918, 3027, 29898, 1311, 1125, 13, 13, 12, 12, 1311, 29889, 3027, 353, 13850, 29906, 29889, 326, 949, 29898, 1311, 29889, 3027, 29897, 13, 12, 12, 1311, 29889, 3027, 353, 527, 13239, 29889, 21476, 29898, 1311, 29889, 3027, 29892, 2920, 29922, 29953, 29900, 29900, 29897, 13, 13, 12, 12, 2457, 29871, 13, 13, 13, 12, 1753, 6699, 29918, 1621, 2521, 29898, 1311, 1125, 13, 13, 12, 12, 1311, 29889, 21012, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 1311, 29889, 3027, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 29897, 13, 12, 12, 2204, 332, 1127, 353, 13850, 29906, 29889, 29954, 17019, 10358, 332, 29898, 1311, 29889, 21012, 29892, 313, 29955, 29892, 29871, 29955, 511, 29871, 29941, 29897, 13, 13, 12, 12, 386, 3781, 353, 13850, 29906, 29889, 1114, 415, 573, 1349, 12268, 29898, 2204, 332, 1127, 29892, 29871, 29906, 29945, 29945, 29892, 11023, 29906, 29889, 3035, 3301, 29911, 18474, 29918, 4690, 1525, 7068, 29918, 12739, 29965, 1799, 29902, 2190, 29918, 29907, 29892, 13850, 29906, 29889, 4690, 1525, 7068, 29918, 29933, 1177, 19926, 29892, 29871, 29896, 29896, 29892, 29871, 29906, 29897, 13, 12, 12, 386, 3781, 353, 13850, 29906, 29889, 2966, 3538, 29918, 1333, 29898, 386, 3781, 29897, 13, 13, 13, 12, 12, 20047, 29879, 353, 13850, 29906, 29889, 2886, 1323, 2470, 29898, 386, 3781, 29889, 8552, 3285, 13850, 29906, 29889, 1525, 5659, 29918, 5746, 4945, 29940, 1964, 29892, 11023, 29906, 29889, 3210, 29909, 1177, 29918, 3301, 8618, 29990, 29918, 5425, 3580, 1307, 29897, 13, 12, 12, 20047, 29879, 353, 527, 13239, 29889, 3874, 29890, 29918, 1285, 2470, 29898, 20047, 29879, 29897, 13, 13, 12, 12, 20047, 29879, 353, 12705, 29898, 20047, 29879, 29892, 1820, 29922, 11023, 29906, 29889, 1285, 473, 13799, 29892, 11837, 29922, 5574, 29897, 13, 13, 12, 12, 29886, 18813, 280, 29907, 593, 353, 6213, 13, 13, 12, 12, 1454, 274, 297, 274, 593, 29879, 29901, 13, 13, 12, 12, 12, 546, 29875, 353, 13850, 29906, 29889, 5666, 6513, 29898, 29883, 29892, 5852, 29897, 13, 12, 12, 12, 14850, 353, 13850, 29906, 29889, 14850, 7713, 29891, 11191, 29898, 29883, 29892, 29871, 29900, 29889, 29900, 29906, 334, 23603, 29892, 5852, 29897, 13, 13, 12, 12, 12, 361, 7431, 29898, 14850, 29897, 1275, 29871, 29946, 29901, 13, 12, 12, 12, 12, 29886, 18813, 280, 29907, 593, 353, 2134, 29916, 13, 12, 12, 12, 12, 8690, 13, 13, 12, 12, 2457, 20285, 280, 29907, 593, 13, 13, 13, 12, 1753, 6597, 29918, 29879, 566, 9154, 29918, 3377, 29898, 1311, 29892, 3377, 1125, 13, 13, 12, 12, 13492, 29918, 3027, 353, 3023, 29918, 3149, 29918, 9067, 29898, 1311, 29889, 3027, 29892, 7613, 29889, 690, 14443, 29898, 29946, 29892, 29871, 29906, 876, 13, 12, 12, 21012, 29918, 3027, 353, 3023, 29918, 3149, 29918, 9067, 29898, 1311, 29889, 21012, 29892, 7613, 29889, 690, 14443, 29898, 29946, 29892, 29871, 29906, 876, 13, 13, 13, 12, 12, 2457, 16749, 29918, 3027, 13, 13, 12, 1753, 6219, 29918, 3377, 29898, 1311, 29892, 3377, 1125, 13, 13, 12, 12, 2457, 7613, 29889, 12181, 29961, 29896, 29962, 849, 29871, 29929, 29892, 7613, 29889, 12181, 29961, 29900, 29962, 849, 29871, 29929, 13, 13, 12, 1753, 6597, 29918, 26204, 29898, 1311, 29892, 3729, 1125, 13, 13, 12, 12, 386, 3781, 353, 13850, 29906, 29889, 386, 12268, 29898, 3729, 29892, 29871, 29900, 29892, 29871, 29906, 29945, 29945, 29892, 13, 12, 12, 12, 11023, 29906, 29889, 4690, 1525, 7068, 29918, 29933, 1177, 19926, 29918, 1177, 29963, 891, 13850, 29906, 29889, 4690, 1525, 7068, 29918, 2891, 14605, 9601, 29896, 29962, 13, 12, 12, 386, 3781, 353, 2821, 29918, 11466, 29898, 386, 3781, 29897, 13, 13, 13, 12, 12, 20047, 29879, 353, 13850, 29906, 29889, 2886, 1323, 2470, 29898, 386, 3781, 29889, 8552, 3285, 13850, 29906, 29889, 1525, 5659, 29918, 5746, 4945, 29940, 1964, 29892, 13, 12, 12, 12, 11023, 29906, 29889, 3210, 29909, 1177, 29918, 3301, 8618, 29990, 29918, 5425, 3580, 1307, 29897, 13, 12, 12, 20047, 29879, 353, 527, 13239, 29889, 3874, 29890, 29918, 1285, 2470, 29898, 20047, 29879, 29897, 13, 13, 12, 12, 361, 7431, 29898, 20047, 29879, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 2457, 6213, 13, 13, 12, 12, 29883, 353, 4236, 29898, 20047, 29879, 29892, 1820, 29922, 11023, 29906, 29889, 1285, 473, 13799, 29897, 13, 12, 12, 13168, 353, 7442, 29889, 3298, 359, 29898, 386, 3781, 29889, 12181, 29892, 26688, 543, 13470, 29947, 1159, 13, 12, 12, 11023, 29906, 29889, 4012, 1323, 2470, 29898, 13168, 29892, 518, 29883, 1402, 448, 29896, 29892, 29871, 29906, 29945, 29945, 29892, 448, 29896, 29897, 13, 13, 12, 12, 29898, 29882, 29892, 281, 29897, 353, 266, 3781, 29889, 12181, 13, 12, 12, 25376, 3434, 839, 353, 13850, 29906, 29889, 2798, 12283, 24214, 29898, 13168, 29897, 847, 5785, 29898, 29893, 334, 298, 29897, 13, 13, 12, 12, 361, 10151, 3434, 839, 529, 29871, 29900, 29889, 29900, 29941, 29901, 13, 12, 12, 12, 2457, 6213, 13, 13, 12, 12, 26204, 353, 13850, 29906, 29889, 2966, 3538, 29918, 392, 29898, 386, 3781, 29892, 266, 3781, 29892, 11105, 29922, 13168, 29897, 13, 13, 12, 12, 2457, 13615, 13, 13, 12, 1753, 1889, 29918, 3729, 29879, 29898, 1311, 29892, 10568, 29990, 29892, 10568, 29979, 29892, 3377, 1125, 13, 13, 12, 12, 8415, 353, 438, 11341, 580, 13, 13, 12, 12, 29879, 566, 9154, 29918, 2378, 353, 7442, 29889, 3298, 359, 3552, 29929, 29892, 29871, 29929, 511, 26688, 543, 524, 1159, 13, 13, 12, 12, 3729, 3524, 29879, 353, 5159, 13, 12, 12, 20054, 353, 5852, 13, 13, 12, 12, 1454, 343, 297, 3464, 29898, 29900, 29892, 29871, 29929, 1125, 13, 13, 12, 12, 12, 798, 353, 5159, 13, 12, 12, 12, 1454, 921, 297, 3464, 29898, 29900, 29892, 29871, 29929, 1125, 13, 13, 12, 12, 12, 12, 2962, 29990, 353, 921, 334, 4331, 29990, 13, 12, 12, 12, 12, 2962, 29979, 353, 343, 334, 4331, 29979, 13, 12, 12, 12, 12, 355, 29990, 353, 313, 29916, 718, 29871, 29896, 29897, 334, 4331, 29990, 13, 12, 12, 12, 12, 355, 29979, 353, 313, 29891, 718, 29871, 29896, 29897, 334, 4331, 29979, 13, 13, 12, 12, 12, 12, 798, 29889, 4397, 3552, 2962, 29990, 29892, 1369, 29979, 29892, 1095, 29990, 29892, 1095, 29979, 876, 13, 13, 12, 12, 12, 12, 3729, 353, 7613, 29961, 2962, 29979, 29901, 355, 29979, 29892, 1369, 29990, 29901, 355, 29990, 29962, 13, 12, 12, 12, 12, 26204, 353, 1583, 29889, 21111, 29918, 26204, 29898, 3729, 29897, 13, 13, 12, 12, 12, 12, 361, 313, 26204, 338, 451, 6213, 1125, 13, 12, 12, 12, 12, 12, 11023, 29906, 29889, 326, 3539, 703, 2492, 29899, 17969, 710, 29898, 29891, 7240, 710, 29898, 29916, 7240, 1642, 2732, 613, 26204, 29897, 13, 12, 12, 12, 12, 12, 29879, 566, 9154, 29918, 2378, 29961, 29891, 3816, 29916, 29962, 353, 288, 7283, 29889, 11965, 2463, 29898, 26204, 29897, 13, 13, 13, 12, 12, 2457, 5053, 9154, 29918, 2378, 13, 13, 13, 12, 1753, 4505, 29898, 1311, 1125, 13, 13, 12, 12, 1311, 29889, 24926, 29918, 3027, 580, 13, 12, 12, 3377, 353, 1583, 29889, 9155, 29918, 1621, 2521, 580, 13, 13, 12, 12, 361, 7613, 338, 6213, 29901, 13, 12, 12, 12, 2457, 29871, 13, 13, 12, 12, 3377, 353, 1583, 29889, 21111, 29918, 29879, 566, 9154, 29918, 3377, 29898, 3377, 29897, 13, 12, 12, 29916, 29892, 29891, 353, 1583, 29889, 5451, 29918, 3377, 29898, 3377, 29897, 13, 12, 12, 8394, 29918, 3377, 353, 1583, 29889, 5014, 29918, 3729, 29879, 29898, 29916, 29892, 29891, 29892, 3377, 29897, 13, 13, 12, 12, 2457, 2186, 29918, 3377, 13, 13, 1753, 26749, 29898, 3377, 1125, 13, 13, 12, 3068, 8964, 353, 5852, 13, 13, 12, 8000, 313, 3068, 8964, 1125, 13, 13, 12, 12, 7099, 2459, 353, 10650, 29918, 2080, 14182, 29876, 29956, 9713, 1207, 738, 14515, 1953, 304, 278, 7613, 29973, 5254, 343, 565, 4874, 13018, 1159, 13, 13, 12, 12, 361, 313, 7099, 2459, 322, 10608, 29961, 29900, 1822, 13609, 580, 1275, 376, 29891, 29908, 1125, 13, 12, 12, 12, 3068, 8964, 353, 7700, 13, 12, 12, 12, 8690, 13, 13, 12, 12, 5975, 353, 10650, 29918, 2080, 14182, 29876, 10399, 11438, 29892, 4409, 322, 7865, 29889, 1222, 29901, 29871, 29906, 29892, 29906, 29892, 29941, 29901, 376, 467, 5451, 28165, 1159, 13, 13, 12, 12, 2202, 29901, 13, 13, 12, 12, 12, 798, 29892, 1054, 29892, 791, 353, 1051, 29898, 1958, 29898, 524, 29892, 5975, 7503, 29941, 12622, 13, 13, 12, 12, 12, 3198, 353, 14013, 921, 29901, 29871, 921, 29958, 29900, 322, 921, 29966, 29896, 29900, 13, 13, 12, 12, 12, 361, 313, 497, 4197, 3198, 29898, 29875, 29897, 363, 474, 297, 518, 798, 29892, 1054, 29892, 791, 5262, 22164, 13, 13, 12, 12, 12, 12, 3377, 29961, 798, 29899, 29896, 3816, 1054, 29899, 29896, 29962, 353, 659, 13, 12, 12, 12, 12, 2158, 14182, 29876, 29248, 12590, 29905, 29876, 1159, 13, 12, 12, 12, 12, 2158, 29898, 3377, 29897, 13, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 12, 2158, 14182, 29876, 13919, 1881, 1159, 13, 13, 12, 12, 19499, 29901, 13, 12, 12, 12, 2158, 14182, 29876, 13919, 1881, 1159, 13, 13, 12, 2457, 7613, 13, 13, 13, 13, 29879, 566, 9154, 29918, 3377, 353, 8383, 9154, 703, 20163, 29914, 29879, 566, 9154, 29889, 6173, 2564, 2929, 345, 580, 13, 2158, 29898, 29879, 566, 9154, 29918, 3377, 29897, 13, 21402, 29918, 3377, 353, 26749, 29898, 29879, 566, 9154, 29918, 3377, 29897, 13, 13296, 369, 2141, 2929, 918, 29898, 21402, 29918, 3377, 29897, 13, 2 ]
discovery/zenodo/zenodo_discovery.py
VIDA-NYU/auctus
15
103615
import asyncio import elasticsearch import json import logging import requests import time from urllib.parse import urlencode from datamart_core import Discoverer from datamart_core.common import setup_logging logger = logging.getLogger(__name__) class ZenodoDiscoverer(Discoverer): EXTENSIONS = ('.xls', '.xlsx', '.csv', '.sav') FILE_TYPES = ['csv', 'xlsx', 'sav'] def __init__(self, *args, **kwargs): super(ZenodoDiscoverer, self).__init__(*args, **kwargs) with open('zenodo.json') as fp: obj = json.load(fp) self.keyword_query = obj.pop('keyword_query', '') if obj: logger.warning("Unknown keys in configuration: %s", ', '.join(obj)) logger.info("Loaded keyword from zenodo.json: %s", self.keyword_query) def discover_datasets(self): seen = set() url = ( 'https://zenodo.org/api/records/' '?' + urlencode( dict( page=1, size=200, q=self.keyword_query, file_type=self.FILE_TYPES, type='dataset', ), doseq=True ) ) while url: logger.info("Getting %s", url) headers = {'Accept': 'application/json'} response = requests.get(url, headers=headers) response.raise_for_status() obj = response.json() for record in obj: self.process_record(record) seen.add(record['id']) if 'next' in response.links: url = response.links['next']['url'] time.sleep(2) else: url = None # Clean up the datasets we didn't see deleted = 0 size = 10000 query = { 'query': { 'term': { 'materialize.identifier': self.identifier, }, }, } hits = self.elasticsearch.scan( index='datasets,pending', query=query, size=size, _source=['materialize.zenodo_record_id'], ) for h in hits: if h['_source']['materialize']['zenodo_record_id'] not in seen: self.delete_dataset(full_id=h['_id']) deleted += 1 if deleted: logger.info("Deleted %d missing datasets", deleted) def process_record(self, record): # Get metadata common for the whole deposit record_metadata = dict( name=record['title'], source='zenodo.org', source_url='https://zenodo.org/record/%d' % record['id'], ) if 'license' in record['metadata']: record_metadata['license'] = record['metadata']['license'] description = '' if record['metadata'].get('description'): description += record['metadata']['description'] if record['metadata'].get('keywords'): description += '\n\n' + ', '.join(record['metadata']['keywords']) if description: record_metadata['description'] = description logger.info("Processing record %s %r", record['id'], record['title']) # Process each file for file in record['files']: if not file['filename'].lower().endswith(self.EXTENSIONS): continue dataset_id = '%s.%s' % (record['id'], file['id']) # See if we've ingested this file try: self.elasticsearch.get( 'datasets', '%s.%s' % (self.identifier, dataset_id), _source=False, ) except elasticsearch.NotFoundError: pass else: logger.info("Dataset already in index") return try: hit = self.elasticsearch.get( 'pending', '%s.%s' % (self.identifier, dataset_id), _source=['status'], )['_source'] except elasticsearch.NotFoundError: pass else: logger.info( "Dataset already in pending index, status=%s", hit.get('status'), ) return logger.info("File %s", file['filename']) file_metadata = dict( record_metadata, name='%s - %s' % ( record_metadata['name'], file['filename'], ), size=file['filesize'], ) direct_url = file['links']['download'] # Discover this dataset self.record_dataset( dict( zenodo_record_id=record['id'], zenodo_file_id=file['id'], zenodo_record_updated=record['modified'], direct_url=direct_url, ), file_metadata, dataset_id=dataset_id, ) if __name__ == '__main__': setup_logging() asyncio.get_event_loop().run_until_complete( ZenodoDiscoverer('datamart.zenodo').run() )
[ 1, 1053, 408, 948, 3934, 13, 5215, 560, 20291, 13, 5215, 4390, 13, 5215, 12183, 13, 5215, 7274, 13, 5215, 931, 13, 3166, 3142, 1982, 29889, 5510, 1053, 3142, 12508, 13, 13, 3166, 1418, 314, 442, 29918, 3221, 1053, 8565, 957, 261, 13, 3166, 1418, 314, 442, 29918, 3221, 29889, 9435, 1053, 6230, 29918, 21027, 13, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1990, 796, 264, 8144, 4205, 11911, 261, 29898, 4205, 11911, 261, 1125, 13, 1678, 8528, 29911, 1430, 13381, 29903, 353, 313, 4286, 20267, 742, 15300, 20267, 29916, 742, 15300, 7638, 742, 15300, 29879, 485, 1495, 13, 1678, 24080, 29918, 15631, 29925, 2890, 353, 6024, 7638, 742, 525, 20267, 29916, 742, 525, 29879, 485, 2033, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 2428, 29898, 29999, 264, 8144, 4205, 11911, 261, 29892, 1583, 467, 1649, 2344, 1649, 10456, 5085, 29892, 3579, 19290, 29897, 13, 4706, 411, 1722, 877, 2256, 8144, 29889, 3126, 1495, 408, 285, 29886, 29901, 13, 9651, 5446, 353, 4390, 29889, 1359, 29898, 18091, 29897, 13, 4706, 1583, 29889, 26766, 29918, 1972, 353, 5446, 29889, 7323, 877, 26766, 29918, 1972, 742, 27255, 13, 4706, 565, 5446, 29901, 13, 9651, 17927, 29889, 27392, 703, 14148, 6611, 297, 5285, 29901, 1273, 29879, 613, 13, 462, 965, 13420, 15300, 7122, 29898, 5415, 876, 13, 4706, 17927, 29889, 3888, 703, 29147, 13553, 515, 503, 264, 8144, 29889, 3126, 29901, 1273, 29879, 613, 13, 462, 1678, 1583, 29889, 26766, 29918, 1972, 29897, 13, 13, 1678, 822, 6523, 29918, 14538, 1691, 29898, 1311, 1125, 13, 4706, 3595, 353, 731, 580, 13, 4706, 3142, 353, 313, 13, 9651, 525, 991, 597, 2256, 8144, 29889, 990, 29914, 2754, 29914, 3757, 4339, 22208, 13, 9651, 525, 17901, 718, 3142, 12508, 29898, 13, 18884, 9657, 29898, 13, 462, 1678, 1813, 29922, 29896, 29892, 13, 462, 1678, 2159, 29922, 29906, 29900, 29900, 29892, 13, 462, 1678, 3855, 29922, 1311, 29889, 26766, 29918, 1972, 29892, 13, 462, 1678, 934, 29918, 1853, 29922, 1311, 29889, 7724, 29918, 15631, 29925, 2890, 29892, 13, 462, 1678, 1134, 2433, 24713, 742, 13, 18884, 10353, 13, 18884, 437, 11762, 29922, 5574, 13, 9651, 1723, 13, 4706, 1723, 13, 4706, 1550, 3142, 29901, 13, 9651, 17927, 29889, 3888, 703, 2577, 1259, 1273, 29879, 613, 3142, 29897, 13, 9651, 9066, 353, 11117, 23965, 2396, 525, 6214, 29914, 3126, 10827, 13, 9651, 2933, 353, 7274, 29889, 657, 29898, 2271, 29892, 9066, 29922, 13662, 29897, 13, 9651, 2933, 29889, 22692, 29918, 1454, 29918, 4882, 580, 13, 9651, 5446, 353, 2933, 29889, 3126, 580, 13, 13, 9651, 363, 2407, 297, 5446, 29901, 13, 18884, 1583, 29889, 5014, 29918, 11651, 29898, 11651, 29897, 13, 18884, 3595, 29889, 1202, 29898, 11651, 1839, 333, 11287, 13, 13, 9651, 565, 525, 4622, 29915, 297, 2933, 29889, 4965, 29901, 13, 18884, 3142, 353, 2933, 29889, 4965, 1839, 4622, 16215, 2271, 2033, 13, 18884, 931, 29889, 17059, 29898, 29906, 29897, 13, 9651, 1683, 29901, 13, 18884, 3142, 353, 6213, 13, 13, 4706, 396, 315, 14044, 701, 278, 20035, 591, 3282, 29915, 29873, 1074, 13, 4706, 11132, 353, 29871, 29900, 13, 4706, 2159, 353, 29871, 29896, 29900, 29900, 29900, 29900, 13, 4706, 2346, 353, 426, 13, 9651, 525, 1972, 2396, 426, 13, 18884, 525, 8489, 2396, 426, 13, 462, 1678, 525, 15388, 675, 29889, 25378, 2396, 1583, 29889, 25378, 29892, 13, 18884, 2981, 13, 9651, 2981, 13, 4706, 500, 13, 4706, 19572, 353, 1583, 29889, 295, 20291, 29889, 16192, 29898, 13, 9651, 2380, 2433, 14538, 1691, 29892, 29886, 2548, 742, 13, 9651, 2346, 29922, 1972, 29892, 13, 9651, 2159, 29922, 2311, 29892, 13, 9651, 903, 4993, 29922, 1839, 15388, 675, 29889, 2256, 8144, 29918, 11651, 29918, 333, 7464, 13, 4706, 1723, 13, 4706, 363, 298, 297, 19572, 29901, 13, 9651, 565, 298, 1839, 29918, 4993, 16215, 15388, 675, 16215, 2256, 8144, 29918, 11651, 29918, 333, 2033, 451, 297, 3595, 29901, 13, 18884, 1583, 29889, 8143, 29918, 24713, 29898, 8159, 29918, 333, 29922, 29882, 1839, 29918, 333, 11287, 13, 18884, 11132, 4619, 29871, 29896, 13, 13, 4706, 565, 11132, 29901, 13, 9651, 17927, 29889, 3888, 703, 2772, 22742, 1273, 29881, 4567, 20035, 613, 11132, 29897, 13, 13, 1678, 822, 1889, 29918, 11651, 29898, 1311, 29892, 2407, 1125, 13, 4706, 396, 3617, 15562, 3619, 363, 278, 3353, 19754, 277, 13, 4706, 2407, 29918, 19635, 353, 9657, 29898, 13, 9651, 1024, 29922, 11651, 1839, 3257, 7464, 13, 9651, 2752, 2433, 2256, 8144, 29889, 990, 742, 13, 9651, 2752, 29918, 2271, 2433, 991, 597, 2256, 8144, 29889, 990, 29914, 11651, 22584, 29881, 29915, 1273, 2407, 1839, 333, 7464, 13, 4706, 1723, 13, 4706, 565, 525, 506, 1947, 29915, 297, 2407, 1839, 19635, 2033, 29901, 13, 9651, 2407, 29918, 19635, 1839, 506, 1947, 2033, 353, 2407, 1839, 19635, 16215, 506, 1947, 2033, 13, 4706, 6139, 353, 6629, 13, 4706, 565, 2407, 1839, 19635, 13359, 657, 877, 8216, 29374, 13, 9651, 6139, 4619, 2407, 1839, 19635, 16215, 8216, 2033, 13, 4706, 565, 2407, 1839, 19635, 13359, 657, 877, 1989, 9303, 29374, 13, 9651, 6139, 4619, 11297, 29876, 29905, 29876, 29915, 718, 13420, 15300, 7122, 29898, 11651, 1839, 19635, 16215, 1989, 9303, 11287, 13, 4706, 565, 6139, 29901, 13, 9651, 2407, 29918, 19635, 1839, 8216, 2033, 353, 6139, 13, 13, 4706, 17927, 29889, 3888, 703, 7032, 292, 2407, 1273, 29879, 1273, 29878, 613, 2407, 1839, 333, 7464, 2407, 1839, 3257, 11287, 13, 13, 4706, 396, 10554, 1269, 934, 13, 4706, 363, 934, 297, 2407, 1839, 5325, 2033, 29901, 13, 9651, 565, 451, 934, 1839, 9507, 13359, 13609, 2141, 1975, 2541, 29898, 1311, 29889, 12194, 1430, 13381, 29903, 1125, 13, 18884, 6773, 13, 13, 9651, 8783, 29918, 333, 353, 14210, 29879, 29889, 29995, 29879, 29915, 1273, 313, 11651, 1839, 333, 7464, 934, 1839, 333, 11287, 13, 13, 9651, 396, 2823, 565, 591, 29915, 345, 2348, 2868, 445, 934, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 295, 20291, 29889, 657, 29898, 13, 462, 1678, 525, 14538, 1691, 742, 13, 462, 1678, 14210, 29879, 29889, 29995, 29879, 29915, 1273, 313, 1311, 29889, 25378, 29892, 8783, 29918, 333, 511, 13, 462, 1678, 903, 4993, 29922, 8824, 29892, 13, 18884, 1723, 13, 9651, 5174, 560, 20291, 29889, 17413, 2392, 29901, 13, 18884, 1209, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 3888, 703, 16390, 24541, 2307, 297, 2380, 1159, 13, 18884, 736, 13, 13, 9651, 1018, 29901, 13, 18884, 7124, 353, 1583, 29889, 295, 20291, 29889, 657, 29898, 13, 462, 1678, 525, 29886, 2548, 742, 13, 462, 1678, 14210, 29879, 29889, 29995, 29879, 29915, 1273, 313, 1311, 29889, 25378, 29892, 8783, 29918, 333, 511, 13, 462, 1678, 903, 4993, 29922, 1839, 4882, 7464, 13, 18884, 1723, 1839, 29918, 4993, 2033, 13, 9651, 5174, 560, 20291, 29889, 17413, 2392, 29901, 13, 18884, 1209, 13, 9651, 1683, 29901, 13, 18884, 17927, 29889, 3888, 29898, 13, 462, 1678, 376, 16390, 24541, 2307, 297, 28235, 2380, 29892, 4660, 16328, 29879, 613, 13, 462, 1678, 7124, 29889, 657, 877, 4882, 5477, 13, 18884, 1723, 13, 18884, 736, 13, 13, 9651, 17927, 29889, 3888, 703, 2283, 1273, 29879, 613, 934, 1839, 9507, 11287, 13, 13, 9651, 934, 29918, 19635, 353, 9657, 29898, 13, 18884, 2407, 29918, 19635, 29892, 13, 18884, 1024, 2433, 29995, 29879, 448, 1273, 29879, 29915, 1273, 313, 13, 462, 1678, 2407, 29918, 19635, 1839, 978, 7464, 934, 1839, 9507, 7464, 13, 18884, 10353, 13, 18884, 2159, 29922, 1445, 1839, 5325, 675, 7464, 13, 9651, 1723, 13, 9651, 1513, 29918, 2271, 353, 934, 1839, 4965, 16215, 10382, 2033, 13, 13, 9651, 396, 8565, 957, 445, 8783, 13, 9651, 1583, 29889, 11651, 29918, 24713, 29898, 13, 18884, 9657, 29898, 13, 462, 1678, 503, 264, 8144, 29918, 11651, 29918, 333, 29922, 11651, 1839, 333, 7464, 13, 462, 1678, 503, 264, 8144, 29918, 1445, 29918, 333, 29922, 1445, 1839, 333, 7464, 13, 462, 1678, 503, 264, 8144, 29918, 11651, 29918, 21402, 29922, 11651, 1839, 1545, 2164, 7464, 13, 462, 1678, 1513, 29918, 2271, 29922, 11851, 29918, 2271, 29892, 13, 18884, 10353, 13, 18884, 934, 29918, 19635, 29892, 13, 18884, 8783, 29918, 333, 29922, 24713, 29918, 333, 29892, 13, 9651, 1723, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 6230, 29918, 21027, 580, 13, 1678, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 2141, 3389, 29918, 29305, 29918, 8835, 29898, 13, 4706, 796, 264, 8144, 4205, 11911, 261, 877, 4130, 314, 442, 29889, 2256, 8144, 2824, 3389, 580, 13, 1678, 1723, 13, 2 ]
tools/extract_from_multialign.py
dvalenzu/vcf2multialign
2
67277
<filename>tools/extract_from_multialign.py # # Copyright (c) 2017 <NAME> # This code is licensed under MIT license (see LICENSE for details). # import argparse import codecs import os import sys # Read from file into a buffer. # Used the idea from https://stackoverflow.com/a/26209275/856976 def chunks(fp, bufsize): while True: chunk = fp.read(bufsize) if not chunk: break yield chunk def chars(fp, bufsize = 4096): for chunk in chunks(fp, bufsize): for char in chunk: yield char def handle_ref_input(src, offset, length): """Find the offset of the given gene in the reference input.""" src.seek(0, 0) i = 0 j = 0 outputting = False for char in chars(src): if char != '-': if i == offset: return j i += 1 j += 1 return None def write_sequence(src, dst, fname, file_offset, length): k = 0 src.seek(file_offset, 0) for char in chars(src): if '-' == char: continue dst.write(char) k += 1 if k == length: break def handle_files(ref_input, co_ordinate_input, seq_file_names): write_flags = os.O_CREAT | os.O_EXCL | os.O_WRONLY for line in co_ordinate_input: fields = line.strip().split("\t") fields = fields[0:6] (chrom, chrom_start, chrom_end, name, score, strand) = fields chrom_start = int(chrom_start) chrom_end = int(chrom_end) length = chrom_end - chrom_start print("Handling sequence '%s'…" % name, file = sys.stderr) # Find the offset from the reference file. file_offset = handle_ref_input(ref_input, chrom_start, length) print("Found the requested substring at file offset %d" % file_offset, file = sys.stderr) # Handle the source files. fd = os.open("%s.fa" % name, write_flags) with os.fdopen(fd, 'w') as dst: for fname in seq_file_names: with open(fname, 'r') as src: print("\tHandling source file '%s'…" % fname, file = sys.stderr) dst.write(">%s\n" % fname) write_sequence(src, dst, fname, file_offset, length) dst.write("\n") if __name__ == "__main__": parser = argparse.ArgumentParser("Extract subsequences from vcf2multialign output.") parser.add_argument('--aligned-reference', type = argparse.FileType('rU'), required = True) parser.add_argument('--extracted-co-ordinates', type = argparse.FileType('rU'), required = True) parser.add_argument('source-files', nargs = '*') args = parser.parse_args() # Output UTF-8, https://stackoverflow.com/a/4374457/856976 #sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) #sys.stderr = codecs.getwriter("utf-8")(sys.stderr.detach()) handle_files( args.aligned_reference, args.extracted_co_ordinates, vars(args)['source-files'], )
[ 1, 529, 9507, 29958, 8504, 29914, 21111, 29918, 3166, 29918, 4713, 616, 647, 29889, 2272, 13, 29937, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29955, 529, 5813, 29958, 13, 29937, 910, 775, 338, 7794, 21144, 1090, 341, 1806, 19405, 313, 4149, 365, 2965, 1430, 1660, 363, 4902, 467, 13, 29937, 29871, 13, 13, 5215, 1852, 5510, 13, 5215, 775, 2395, 13, 5215, 2897, 13, 5215, 10876, 13, 13, 29937, 7523, 515, 934, 964, 263, 6835, 29889, 13, 29937, 501, 8485, 278, 2969, 515, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29906, 29953, 29906, 29900, 29929, 29906, 29955, 29945, 29914, 29947, 29945, 29953, 29929, 29955, 29953, 13, 1753, 521, 18801, 29898, 18091, 29892, 18392, 2311, 1125, 13, 12, 8000, 5852, 29901, 13, 12, 12, 29812, 353, 285, 29886, 29889, 949, 29898, 9721, 2311, 29897, 13, 12, 12, 361, 451, 19875, 29901, 13, 12, 12, 12, 8690, 13, 12, 12, 13, 12, 12, 29891, 969, 19875, 13, 13, 13, 1753, 22524, 29898, 18091, 29892, 18392, 2311, 353, 29871, 29946, 29900, 29929, 29953, 1125, 13, 12, 1454, 19875, 297, 521, 18801, 29898, 18091, 29892, 18392, 2311, 1125, 13, 12, 12, 1454, 1373, 297, 19875, 29901, 13, 12, 12, 12, 29891, 969, 1373, 13, 13, 13, 1753, 4386, 29918, 999, 29918, 2080, 29898, 4351, 29892, 9210, 29892, 3309, 1125, 13, 12, 15945, 29908, 12542, 278, 9210, 310, 278, 2183, 18530, 297, 278, 3407, 1881, 1213, 15945, 13, 12, 4351, 29889, 344, 1416, 29898, 29900, 29892, 29871, 29900, 29897, 13, 12, 29875, 353, 29871, 29900, 13, 12, 29926, 353, 29871, 29900, 13, 12, 4905, 1259, 353, 7700, 13, 12, 1454, 1373, 297, 22524, 29898, 4351, 1125, 13, 12, 12, 361, 1373, 2804, 17411, 2396, 13, 12, 12, 12, 361, 474, 1275, 9210, 29901, 13, 12, 12, 12, 12, 2457, 432, 13, 12, 12, 12, 29875, 4619, 29871, 29896, 13, 12, 12, 29926, 4619, 29871, 29896, 13, 12, 2457, 6213, 13, 13, 13, 1753, 2436, 29918, 16506, 29898, 4351, 29892, 29743, 29892, 285, 978, 29892, 934, 29918, 10289, 29892, 3309, 1125, 13, 12, 29895, 353, 29871, 29900, 13, 12, 4351, 29889, 344, 1416, 29898, 1445, 29918, 10289, 29892, 29871, 29900, 29897, 13, 12, 1454, 1373, 297, 22524, 29898, 4351, 1125, 13, 12, 12, 361, 17411, 29915, 1275, 1373, 29901, 13, 12, 12, 12, 19878, 13, 13, 12, 12, 22992, 29889, 3539, 29898, 3090, 29897, 13, 12, 12, 29895, 4619, 29871, 29896, 13, 12, 12, 361, 413, 1275, 3309, 29901, 13, 12, 12, 12, 8690, 13, 12, 12, 12, 13, 13, 1753, 4386, 29918, 5325, 29898, 999, 29918, 2080, 29892, 1302, 29918, 16065, 29918, 2080, 29892, 19359, 29918, 1445, 29918, 7039, 1125, 13, 12, 3539, 29918, 15764, 353, 2897, 29889, 29949, 29918, 22245, 1299, 891, 2897, 29889, 29949, 29918, 5746, 6154, 891, 2897, 29889, 29949, 29918, 9980, 1164, 16786, 13, 12, 1454, 1196, 297, 1302, 29918, 16065, 29918, 2080, 29901, 13, 12, 12, 9621, 353, 1196, 29889, 17010, 2141, 5451, 14182, 29873, 1159, 13, 12, 12, 9621, 353, 4235, 29961, 29900, 29901, 29953, 29962, 13, 12, 12, 29898, 27433, 29892, 25173, 29918, 2962, 29892, 25173, 29918, 355, 29892, 1024, 29892, 8158, 29892, 851, 392, 29897, 353, 4235, 13, 12, 12, 27433, 29918, 2962, 353, 938, 29898, 27433, 29918, 2962, 29897, 13, 12, 12, 27433, 29918, 355, 353, 938, 29898, 27433, 29918, 355, 29897, 13, 12, 12, 2848, 353, 25173, 29918, 355, 448, 25173, 29918, 2962, 13, 12, 12, 2158, 703, 3481, 1847, 5665, 14210, 29879, 29915, 30098, 29908, 1273, 1024, 29892, 934, 353, 10876, 29889, 303, 20405, 29897, 13, 13, 12, 12, 29937, 10987, 278, 9210, 515, 278, 3407, 934, 29889, 13, 12, 12, 1445, 29918, 10289, 353, 4386, 29918, 999, 29918, 2080, 29898, 999, 29918, 2080, 29892, 25173, 29918, 2962, 29892, 3309, 29897, 13, 12, 12, 2158, 703, 9692, 278, 13877, 28228, 472, 934, 9210, 1273, 29881, 29908, 1273, 934, 29918, 10289, 29892, 934, 353, 10876, 29889, 303, 20405, 29897, 13, 13, 12, 12, 29937, 29273, 278, 2752, 2066, 29889, 13, 12, 12, 11512, 353, 2897, 29889, 3150, 11702, 29879, 29889, 5444, 29908, 1273, 1024, 29892, 2436, 29918, 15764, 29897, 13, 12, 12, 2541, 2897, 29889, 11512, 3150, 29898, 11512, 29892, 525, 29893, 1495, 408, 29743, 29901, 13, 12, 12, 12, 1454, 285, 978, 297, 19359, 29918, 1445, 29918, 7039, 29901, 13, 12, 12, 12, 12, 2541, 1722, 29898, 29888, 978, 29892, 525, 29878, 1495, 408, 4765, 29901, 13, 12, 12, 12, 12, 12, 2158, 14182, 29873, 3481, 1847, 2752, 934, 14210, 29879, 29915, 30098, 29908, 1273, 285, 978, 29892, 934, 353, 10876, 29889, 303, 20405, 29897, 13, 12, 12, 12, 12, 12, 22992, 29889, 3539, 703, 29958, 29995, 29879, 29905, 29876, 29908, 1273, 285, 978, 29897, 13, 12, 12, 12, 12, 12, 3539, 29918, 16506, 29898, 4351, 29892, 29743, 29892, 285, 978, 29892, 934, 29918, 10289, 29892, 3309, 29897, 13, 12, 12, 12, 12, 12, 22992, 29889, 3539, 14182, 29876, 1159, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 16680, 353, 1852, 5510, 29889, 15730, 11726, 703, 5647, 1461, 9602, 2063, 515, 325, 6854, 29906, 4713, 616, 647, 1962, 23157, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 489, 13671, 29899, 5679, 742, 1134, 353, 1852, 5510, 29889, 2283, 1542, 877, 29878, 29965, 5477, 3734, 353, 5852, 29897, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 489, 21111, 287, 29899, 1111, 29899, 24266, 742, 1134, 353, 1852, 5510, 29889, 2283, 1542, 877, 29878, 29965, 5477, 3734, 353, 5852, 29897, 13, 12, 16680, 29889, 1202, 29918, 23516, 877, 4993, 29899, 5325, 742, 302, 5085, 353, 525, 29930, 1495, 13, 12, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 12, 29937, 10604, 18351, 29899, 29947, 29892, 2045, 597, 2417, 29889, 510, 29914, 29874, 29914, 29946, 29941, 29955, 29946, 29946, 29945, 29955, 29914, 29947, 29945, 29953, 29929, 29955, 29953, 13, 12, 29937, 9675, 29889, 25393, 353, 775, 2395, 29889, 657, 13236, 703, 9420, 29899, 29947, 1159, 29898, 9675, 29889, 25393, 29889, 4801, 496, 3101, 13, 12, 29937, 9675, 29889, 303, 20405, 353, 775, 2395, 29889, 657, 13236, 703, 9420, 29899, 29947, 1159, 29898, 9675, 29889, 303, 20405, 29889, 4801, 496, 3101, 13, 13, 12, 8411, 29918, 5325, 29898, 13, 12, 12, 5085, 29889, 13671, 29918, 5679, 29892, 13, 12, 12, 5085, 29889, 21111, 287, 29918, 1111, 29918, 24266, 29892, 13, 12, 12, 16908, 29898, 5085, 29897, 1839, 4993, 29899, 5325, 7464, 13, 12, 29897, 13, 2 ]
utils/imutils.py
Youwang-Kim/sds-dataset
0
139679
<gh_stars>0 import numpy as np from skimage.transform import resize import cv2 import math import torch import torchvision import torchvision.transforms as transforms def read_cv2_img(path): """ Read color images :param path: Path to image :return: Only returns color images """ img = cv2.imread(path, 1) img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) return img def random_crop_range(crop_min=0.5, crop_max=0.7): while True: rand_nums = torch.rand(2) crop_range = torch.abs(rand_nums[0]-rand_nums[1]) if crop_min <= crop_range <= crop_max: break return crop_range def random_crop(img): h,w,_ = np.shape(img) h_crop_range = random_crop_range() h_size = math.ceil(h*h_crop_range) w_crop_range = random_crop_range() w_size = math.ceil(w * w_crop_range) i,j,h,w = transforms.RandomCrop.get_params(transforms.ToPILImage()(img), output_size=(h_size, w_size)) cropped_img = torchvision.transforms.functional.crop(transforms.ToPILImage()(img),i,j,h,w) #crop_oper = transforms.RandomCrop((h_size, w_size)) #cropped_img = crop_oper(transforms.ToPILImage()(img)) cropped_img = transforms.ToTensor()(cropped_img) return cropped_img, [i,j,h,w] def flip_img(img): """Flip rgb images or masks. channels come last, e.g. (256,256,3). """ img = np.fliplr(img) return img def get_transform(center, scale, res, rot=0): """Generate transformation matrix.""" h = 200 * scale t = np.zeros((3, 3)) t[0, 0] = float(res[1]) / h t[1, 1] = float(res[0]) / h t[0, 2] = res[1] * (-float(center[0]) / h + .5) t[1, 2] = res[0] * (-float(center[1]) / h + .5) t[2, 2] = 1 if not rot == 0: rot = -rot # To match direction of rotation from cropping rot_mat = np.zeros((3, 3)) rot_rad = rot * np.pi / 180 sn, cs = np.sin(rot_rad), np.cos(rot_rad) rot_mat[0, :2] = [cs, -sn] rot_mat[1, :2] = [sn, cs] rot_mat[2, 2] = 1 # Need to rotate around center t_mat = np.eye(3) t_mat[0, 2] = -res[1] / 2 t_mat[1, 2] = -res[0] / 2 t_inv = t_mat.copy() t_inv[:2, 2] *= -1 t = np.dot(t_inv, np.dot(rot_mat, np.dot(t_mat, t))) return t def transform(pt, center, scale, res, invert=0, rot=0): """Transform pixel location to different reference.""" t = get_transform(center, scale, res, rot=rot) if invert: t = np.linalg.inv(t) new_pt = np.array([pt[0] - 1, pt[1] - 1, 1.]).T new_pt = np.dot(t, new_pt) return new_pt[:2].astype(int) + 1 def crop(img, center, scale, res, rot=0): """Crop image according to the supplied bounding box.""" # Upper left point ul = np.array(transform([1, 1], center, scale, res, invert=1)) - 1 # Bottom right point br = np.array(transform([res[0] + 1, res[1] + 1], center, scale, res, invert=1)) - 1 # Padding so that when rotated proper amount of context is included pad = int(np.linalg.norm(br - ul) / 2 - float(br[1] - ul[1]) / 2) if not rot == 0: ul -= pad br += pad new_shape = [br[1] - ul[1], br[0] - ul[0]] if len(img.shape) > 2: new_shape += [img.shape[2]] new_img = np.zeros(new_shape) # Range to fill new array new_x = max(0, -ul[0]), min(br[0], len(img[0])) - ul[0] new_y = max(0, -ul[1]), min(br[1], len(img)) - ul[1] # Range to sample from original image old_x = max(0, ul[0]), min(len(img[0]), br[0]) old_y = max(0, ul[1]), min(len(img), br[1]) new_img[new_y[0]:new_y[1], new_x[0]:new_x[1]] = img[old_y[0]:old_y[1], old_x[0]:old_x[1]] # if not rot == 0: # # Remove padding # #new_img = scipy.misc.imrotate(new_img, rot) # new_img = rotate(new_img, rot) # new_img = new_img[pad:-pad, pad:-pad] # new_img = scipy.misc.imresize(new_img, res) new_img = resize(new_img, res) return new_img def rgb_processing(rgb_img, center, scale, flip, rot=0): """"Process rgb image and do augmentation.""" img_res = [224, 224] rgb_img = crop(rgb_img, center, scale, img_res, rot=rot) # flip the image if flip: rgb_img = flip_img(rgb_img) # in the rgb image we add pixel noise in a channel-wise manner # (3,224,224),float,[0,1] rgb_img = np.transpose(rgb_img.astype('float32'), (2, 0, 1)) / 255.0 return rgb_img
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12655, 408, 7442, 13, 3166, 2071, 3027, 29889, 9067, 1053, 19490, 13, 5215, 13850, 29906, 13, 5215, 5844, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 4924, 13, 5215, 4842, 305, 4924, 29889, 9067, 29879, 408, 4327, 29879, 13, 13, 1753, 1303, 29918, 11023, 29906, 29918, 2492, 29898, 2084, 1125, 13, 1678, 9995, 13, 1678, 7523, 2927, 4558, 13, 1678, 584, 3207, 2224, 29901, 10802, 304, 1967, 13, 1678, 584, 2457, 29901, 9333, 3639, 2927, 4558, 13, 1678, 9995, 13, 1678, 10153, 353, 13850, 29906, 29889, 326, 949, 29898, 2084, 29892, 29871, 29896, 29897, 13, 13, 1678, 10153, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2492, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 28212, 29897, 13, 13, 1678, 736, 10153, 13, 13, 1753, 4036, 29918, 29883, 1336, 29918, 3881, 29898, 29883, 1336, 29918, 1195, 29922, 29900, 29889, 29945, 29892, 274, 1336, 29918, 3317, 29922, 29900, 29889, 29955, 1125, 13, 1678, 1550, 5852, 29901, 13, 4706, 20088, 29918, 1949, 29879, 353, 4842, 305, 29889, 9502, 29898, 29906, 29897, 13, 4706, 274, 1336, 29918, 3881, 353, 4842, 305, 29889, 6897, 29898, 9502, 29918, 1949, 29879, 29961, 29900, 29962, 29899, 9502, 29918, 1949, 29879, 29961, 29896, 2314, 13, 4706, 565, 274, 1336, 29918, 1195, 5277, 274, 1336, 29918, 3881, 5277, 274, 1336, 29918, 3317, 29901, 13, 9651, 2867, 13, 1678, 736, 274, 1336, 29918, 3881, 13, 13, 1753, 4036, 29918, 29883, 1336, 29898, 2492, 1125, 13, 1678, 298, 29892, 29893, 29892, 29918, 353, 7442, 29889, 12181, 29898, 2492, 29897, 13, 1678, 298, 29918, 29883, 1336, 29918, 3881, 353, 4036, 29918, 29883, 1336, 29918, 3881, 580, 13, 1678, 298, 29918, 2311, 353, 5844, 29889, 27696, 29898, 29882, 29930, 29882, 29918, 29883, 1336, 29918, 3881, 29897, 13, 1678, 281, 29918, 29883, 1336, 29918, 3881, 353, 4036, 29918, 29883, 1336, 29918, 3881, 580, 13, 1678, 281, 29918, 2311, 353, 5844, 29889, 27696, 29898, 29893, 334, 281, 29918, 29883, 1336, 29918, 3881, 29897, 13, 1678, 474, 29892, 29926, 29892, 29882, 29892, 29893, 353, 4327, 29879, 29889, 17875, 29907, 1336, 29889, 657, 29918, 7529, 29898, 9067, 29879, 29889, 1762, 2227, 29931, 2940, 580, 29898, 2492, 511, 1962, 29918, 2311, 7607, 29882, 29918, 2311, 29892, 281, 29918, 2311, 876, 13, 1678, 8182, 2986, 29918, 2492, 353, 4842, 305, 4924, 29889, 9067, 29879, 29889, 2220, 284, 29889, 29883, 1336, 29898, 9067, 29879, 29889, 1762, 2227, 29931, 2940, 580, 29898, 2492, 511, 29875, 29892, 29926, 29892, 29882, 29892, 29893, 29897, 13, 1678, 396, 29883, 1336, 29918, 3372, 353, 4327, 29879, 29889, 17875, 29907, 1336, 3552, 29882, 29918, 2311, 29892, 281, 29918, 2311, 876, 13, 1678, 396, 24077, 2986, 29918, 2492, 353, 274, 1336, 29918, 3372, 29898, 9067, 29879, 29889, 1762, 2227, 29931, 2940, 580, 29898, 2492, 876, 13, 1678, 8182, 2986, 29918, 2492, 353, 4327, 29879, 29889, 1762, 29911, 6073, 580, 29898, 24077, 2986, 29918, 2492, 29897, 13, 1678, 736, 8182, 2986, 29918, 2492, 29892, 518, 29875, 29892, 29926, 29892, 29882, 29892, 29893, 29962, 13, 13, 1753, 285, 3466, 29918, 2492, 29898, 2492, 1125, 13, 1678, 9995, 29943, 3466, 15552, 29890, 4558, 470, 11105, 29879, 29889, 13, 1678, 18196, 2041, 1833, 29892, 321, 29889, 29887, 29889, 313, 29906, 29945, 29953, 29892, 29906, 29945, 29953, 29892, 29941, 467, 13, 1678, 9995, 13, 1678, 10153, 353, 7442, 29889, 20157, 572, 29878, 29898, 2492, 29897, 13, 1678, 736, 10153, 13, 13, 13, 1753, 679, 29918, 9067, 29898, 5064, 29892, 6287, 29892, 620, 29892, 5731, 29922, 29900, 1125, 13, 1678, 9995, 5631, 403, 13852, 4636, 1213, 15945, 13, 1678, 298, 353, 29871, 29906, 29900, 29900, 334, 6287, 13, 1678, 260, 353, 7442, 29889, 3298, 359, 3552, 29941, 29892, 29871, 29941, 876, 13, 1678, 260, 29961, 29900, 29892, 29871, 29900, 29962, 353, 5785, 29898, 690, 29961, 29896, 2314, 847, 298, 13, 1678, 260, 29961, 29896, 29892, 29871, 29896, 29962, 353, 5785, 29898, 690, 29961, 29900, 2314, 847, 298, 13, 1678, 260, 29961, 29900, 29892, 29871, 29906, 29962, 353, 620, 29961, 29896, 29962, 334, 8521, 7411, 29898, 5064, 29961, 29900, 2314, 847, 298, 718, 869, 29945, 29897, 13, 1678, 260, 29961, 29896, 29892, 29871, 29906, 29962, 353, 620, 29961, 29900, 29962, 334, 8521, 7411, 29898, 5064, 29961, 29896, 2314, 847, 298, 718, 869, 29945, 29897, 13, 1678, 260, 29961, 29906, 29892, 29871, 29906, 29962, 353, 29871, 29896, 13, 1678, 565, 451, 5731, 1275, 29871, 29900, 29901, 13, 4706, 5731, 353, 448, 5450, 29871, 396, 1763, 1993, 5305, 310, 13733, 515, 8182, 3262, 13, 4706, 5731, 29918, 2922, 353, 7442, 29889, 3298, 359, 3552, 29941, 29892, 29871, 29941, 876, 13, 4706, 5731, 29918, 3665, 353, 5731, 334, 7442, 29889, 1631, 847, 29871, 29896, 29947, 29900, 13, 4706, 5807, 29892, 5939, 353, 7442, 29889, 5223, 29898, 5450, 29918, 3665, 511, 7442, 29889, 3944, 29898, 5450, 29918, 3665, 29897, 13, 4706, 5731, 29918, 2922, 29961, 29900, 29892, 584, 29906, 29962, 353, 518, 2395, 29892, 448, 16586, 29962, 13, 4706, 5731, 29918, 2922, 29961, 29896, 29892, 584, 29906, 29962, 353, 518, 16586, 29892, 5939, 29962, 13, 4706, 5731, 29918, 2922, 29961, 29906, 29892, 29871, 29906, 29962, 353, 29871, 29896, 13, 4706, 396, 20768, 304, 16734, 2820, 4818, 13, 4706, 260, 29918, 2922, 353, 7442, 29889, 1032, 29872, 29898, 29941, 29897, 13, 4706, 260, 29918, 2922, 29961, 29900, 29892, 29871, 29906, 29962, 353, 448, 690, 29961, 29896, 29962, 847, 29871, 29906, 13, 4706, 260, 29918, 2922, 29961, 29896, 29892, 29871, 29906, 29962, 353, 448, 690, 29961, 29900, 29962, 847, 29871, 29906, 13, 4706, 260, 29918, 11569, 353, 260, 29918, 2922, 29889, 8552, 580, 13, 4706, 260, 29918, 11569, 7503, 29906, 29892, 29871, 29906, 29962, 334, 29922, 448, 29896, 13, 4706, 260, 353, 7442, 29889, 6333, 29898, 29873, 29918, 11569, 29892, 7442, 29889, 6333, 29898, 5450, 29918, 2922, 29892, 7442, 29889, 6333, 29898, 29873, 29918, 2922, 29892, 260, 4961, 13, 1678, 736, 260, 13, 13, 13, 1753, 4327, 29898, 415, 29892, 4818, 29892, 6287, 29892, 620, 29892, 21292, 29922, 29900, 29892, 5731, 29922, 29900, 1125, 13, 1678, 9995, 13372, 15526, 4423, 304, 1422, 3407, 1213, 15945, 13, 1678, 260, 353, 679, 29918, 9067, 29898, 5064, 29892, 6287, 29892, 620, 29892, 5731, 29922, 5450, 29897, 13, 1678, 565, 21292, 29901, 13, 4706, 260, 353, 7442, 29889, 29880, 979, 29887, 29889, 11569, 29898, 29873, 29897, 13, 1678, 716, 29918, 415, 353, 7442, 29889, 2378, 4197, 415, 29961, 29900, 29962, 448, 29871, 29896, 29892, 19592, 29961, 29896, 29962, 448, 29871, 29896, 29892, 29871, 29896, 5586, 467, 29911, 13, 1678, 716, 29918, 415, 353, 7442, 29889, 6333, 29898, 29873, 29892, 716, 29918, 415, 29897, 13, 1678, 736, 716, 29918, 415, 7503, 29906, 1822, 579, 668, 29898, 524, 29897, 718, 29871, 29896, 13, 13, 13, 1753, 274, 1336, 29898, 2492, 29892, 4818, 29892, 6287, 29892, 620, 29892, 5731, 29922, 29900, 1125, 13, 1678, 9995, 29907, 1336, 1967, 5034, 304, 278, 19056, 3216, 292, 3800, 1213, 15945, 13, 1678, 396, 24929, 2175, 1298, 13, 1678, 9238, 353, 7442, 29889, 2378, 29898, 9067, 4197, 29896, 29892, 29871, 29896, 1402, 4818, 29892, 6287, 29892, 620, 29892, 21292, 29922, 29896, 876, 448, 29871, 29896, 13, 1678, 396, 350, 3570, 1492, 1298, 13, 1678, 1506, 353, 7442, 29889, 2378, 29898, 9067, 4197, 690, 29961, 29900, 29962, 718, 29871, 29896, 29892, 13, 462, 632, 620, 29961, 29896, 29962, 718, 29871, 29896, 1402, 4818, 29892, 6287, 29892, 620, 29892, 21292, 29922, 29896, 876, 448, 29871, 29896, 13, 13, 1678, 396, 349, 4676, 577, 393, 746, 5731, 630, 1571, 5253, 310, 3030, 338, 5134, 13, 1678, 17132, 353, 938, 29898, 9302, 29889, 29880, 979, 29887, 29889, 12324, 29898, 1182, 448, 9238, 29897, 847, 29871, 29906, 448, 5785, 29898, 1182, 29961, 29896, 29962, 448, 9238, 29961, 29896, 2314, 847, 29871, 29906, 29897, 13, 1678, 565, 451, 5731, 1275, 29871, 29900, 29901, 13, 4706, 9238, 22361, 17132, 13, 4706, 1506, 4619, 17132, 13, 13, 1678, 716, 29918, 12181, 353, 518, 1182, 29961, 29896, 29962, 448, 9238, 29961, 29896, 1402, 1506, 29961, 29900, 29962, 448, 9238, 29961, 29900, 5262, 13, 1678, 565, 7431, 29898, 2492, 29889, 12181, 29897, 1405, 29871, 29906, 29901, 13, 4706, 716, 29918, 12181, 4619, 518, 2492, 29889, 12181, 29961, 29906, 5262, 13, 1678, 716, 29918, 2492, 353, 7442, 29889, 3298, 359, 29898, 1482, 29918, 12181, 29897, 13, 13, 1678, 396, 12146, 304, 5445, 716, 1409, 13, 1678, 716, 29918, 29916, 353, 4236, 29898, 29900, 29892, 448, 352, 29961, 29900, 11724, 1375, 29898, 1182, 29961, 29900, 1402, 7431, 29898, 2492, 29961, 29900, 12622, 448, 9238, 29961, 29900, 29962, 13, 1678, 716, 29918, 29891, 353, 4236, 29898, 29900, 29892, 448, 352, 29961, 29896, 11724, 1375, 29898, 1182, 29961, 29896, 1402, 7431, 29898, 2492, 876, 448, 9238, 29961, 29896, 29962, 13, 1678, 396, 12146, 304, 4559, 515, 2441, 1967, 13, 1678, 2030, 29918, 29916, 353, 4236, 29898, 29900, 29892, 9238, 29961, 29900, 11724, 1375, 29898, 2435, 29898, 2492, 29961, 29900, 11724, 1506, 29961, 29900, 2314, 13, 1678, 2030, 29918, 29891, 353, 4236, 29898, 29900, 29892, 9238, 29961, 29896, 11724, 1375, 29898, 2435, 29898, 2492, 511, 1506, 29961, 29896, 2314, 13, 1678, 716, 29918, 2492, 29961, 1482, 29918, 29891, 29961, 29900, 5387, 1482, 29918, 29891, 29961, 29896, 1402, 716, 29918, 29916, 29961, 29900, 5387, 1482, 29918, 29916, 29961, 29896, 5262, 353, 10153, 29961, 1025, 29918, 29891, 29961, 29900, 5387, 1025, 29918, 29891, 29961, 29896, 1402, 2030, 29918, 29916, 29961, 29900, 5387, 1025, 29918, 29916, 29961, 29896, 5262, 13, 13, 1678, 396, 565, 451, 5731, 1275, 29871, 29900, 29901, 13, 1678, 396, 268, 396, 15154, 7164, 13, 1678, 396, 268, 396, 1482, 29918, 2492, 353, 4560, 2272, 29889, 29885, 10669, 29889, 326, 23361, 29898, 1482, 29918, 2492, 29892, 5731, 29897, 13, 1678, 396, 268, 716, 29918, 2492, 353, 16734, 29898, 1482, 29918, 2492, 29892, 5731, 29897, 13, 1678, 396, 268, 716, 29918, 2492, 353, 716, 29918, 2492, 29961, 8305, 13018, 8305, 29892, 17132, 13018, 8305, 29962, 13, 13, 1678, 396, 716, 29918, 2492, 353, 4560, 2272, 29889, 29885, 10669, 29889, 326, 21476, 29898, 1482, 29918, 2492, 29892, 620, 29897, 13, 1678, 716, 29918, 2492, 353, 19490, 29898, 1482, 29918, 2492, 29892, 620, 29897, 13, 1678, 736, 716, 29918, 2492, 13, 13, 13, 1753, 15552, 29890, 29918, 19170, 29898, 23973, 29918, 2492, 29892, 4818, 29892, 6287, 29892, 285, 3466, 29892, 5731, 29922, 29900, 1125, 13, 1678, 9995, 29908, 7032, 15552, 29890, 1967, 322, 437, 18765, 362, 1213, 15945, 13, 1678, 10153, 29918, 690, 353, 518, 29906, 29906, 29946, 29892, 29871, 29906, 29906, 29946, 29962, 13, 1678, 15552, 29890, 29918, 2492, 353, 274, 1336, 29898, 23973, 29918, 2492, 29892, 4818, 29892, 6287, 29892, 10153, 29918, 690, 29892, 5731, 29922, 5450, 29897, 13, 1678, 396, 285, 3466, 278, 1967, 13, 1678, 565, 285, 3466, 29901, 13, 4706, 15552, 29890, 29918, 2492, 353, 285, 3466, 29918, 2492, 29898, 23973, 29918, 2492, 29897, 13, 4706, 396, 297, 278, 15552, 29890, 1967, 591, 788, 15526, 11462, 297, 263, 8242, 29899, 3538, 8214, 13, 1678, 396, 313, 29941, 29892, 29906, 29906, 29946, 29892, 29906, 29906, 29946, 511, 7411, 17094, 29900, 29892, 29896, 29962, 13, 1678, 15552, 29890, 29918, 2492, 353, 7442, 29889, 3286, 4220, 29898, 23973, 29918, 2492, 29889, 579, 668, 877, 7411, 29941, 29906, 5477, 313, 29906, 29892, 29871, 29900, 29892, 29871, 29896, 876, 847, 29871, 29906, 29945, 29945, 29889, 29900, 13, 1678, 736, 15552, 29890, 29918, 2492, 13, 2 ]
exercicios/PythonExercicios/ex059.py
Roberto-Sartore/Python
0
74199
from time import sleep n1 = int(input('Primeiro número:')) n2 = int(input('Segundo número')) opcao = 0 while opcao != 5: print(''' [ 1 ] Somar [ 2 ] Multiplicar [ 3 ] Maior [ 4 ] Novos números [ 5 ] Sair do programa''') opcao = int(input('\033[33m Qual é a sua opção? \033[m')) if opcao == 1: soma = n1 + n2 print('\033[34m A soma entre {} e {} é {} \033[m'.format(n1, n2, soma)) elif opcao == 2: produto = n1 * n2 print('\033[34m O produto de {} X {} é {} \033[m'.format(n1, n2, produto)) elif opcao == 3: if n1 > n2: maior = n1 else: maior = n2 print('\033[34m Entre {} e {} o maior valor é {} \033[m'.format(n1, n2, maior)) elif opcao == 4: print('\033[34m Informe os números novamente:\033[m') n1 = int(input('Primeiro valor:')) n2 = int(input('Segundo valor:')) elif opcao == 5: print('\033[32m Finalizando...\033[m') else: print('\033[31m Opção inválida. Tente novamente. \033[m') print('=-=' * 12) sleep(2) print('\033[33m Fim do programa! Volte sempre! \033[m')
[ 1, 515, 931, 1053, 8709, 13, 29876, 29896, 353, 938, 29898, 2080, 877, 4040, 603, 3350, 13831, 29901, 8785, 13, 29876, 29906, 353, 938, 29898, 2080, 877, 17669, 6201, 13831, 8785, 13, 459, 1113, 29877, 353, 29871, 29900, 13, 8000, 1015, 1113, 29877, 2804, 29871, 29945, 29901, 13, 1678, 1596, 877, 4907, 1678, 518, 29871, 29896, 4514, 6254, 279, 13, 1678, 518, 29871, 29906, 4514, 9683, 666, 506, 279, 13, 1678, 518, 29871, 29941, 4514, 3219, 1611, 13, 1678, 518, 29871, 29946, 4514, 2864, 359, 12158, 359, 13, 1678, 518, 29871, 29945, 4514, 317, 1466, 437, 16914, 4907, 1495, 13, 1678, 1015, 1113, 29877, 353, 938, 29898, 2080, 28909, 29900, 29941, 29941, 29961, 29941, 29941, 29885, 15146, 904, 263, 4171, 1015, 2340, 29973, 320, 29900, 29941, 29941, 29961, 29885, 8785, 13, 1678, 565, 1015, 1113, 29877, 1275, 29871, 29896, 29901, 13, 4706, 1047, 29874, 353, 302, 29896, 718, 302, 29906, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29946, 29885, 319, 1047, 29874, 2637, 6571, 321, 6571, 904, 6571, 320, 29900, 29941, 29941, 29961, 29885, 4286, 4830, 29898, 29876, 29896, 29892, 302, 29906, 29892, 1047, 29874, 876, 13, 1678, 25342, 1015, 1113, 29877, 1275, 29871, 29906, 29901, 13, 4706, 11859, 3066, 353, 302, 29896, 334, 302, 29906, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29946, 29885, 438, 11859, 3066, 316, 6571, 1060, 6571, 904, 6571, 320, 29900, 29941, 29941, 29961, 29885, 4286, 4830, 29898, 29876, 29896, 29892, 302, 29906, 29892, 11859, 3066, 876, 13, 1678, 25342, 1015, 1113, 29877, 1275, 29871, 29941, 29901, 13, 4706, 565, 302, 29896, 1405, 302, 29906, 29901, 13, 9651, 17136, 353, 302, 29896, 13, 4706, 1683, 29901, 13, 9651, 17136, 353, 302, 29906, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29946, 29885, 14447, 6571, 321, 6571, 288, 17136, 16497, 904, 6571, 320, 29900, 29941, 29941, 29961, 29885, 4286, 4830, 29898, 29876, 29896, 29892, 302, 29906, 29892, 17136, 876, 13, 1678, 25342, 1015, 1113, 29877, 1275, 29871, 29946, 29901, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29946, 29885, 15162, 29872, 2897, 12158, 359, 2420, 2503, 3583, 29900, 29941, 29941, 29961, 29885, 1495, 13, 4706, 302, 29896, 353, 938, 29898, 2080, 877, 4040, 603, 3350, 16497, 29901, 8785, 13, 4706, 302, 29906, 353, 938, 29898, 2080, 877, 17669, 6201, 16497, 29901, 8785, 13, 1678, 25342, 1015, 1113, 29877, 1275, 29871, 29945, 29901, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29906, 29885, 9550, 466, 1743, 856, 29905, 29900, 29941, 29941, 29961, 29885, 1495, 13, 1678, 1683, 29901, 13, 4706, 1596, 28909, 29900, 29941, 29941, 29961, 29941, 29896, 29885, 6461, 2340, 2437, 2464, 1458, 29889, 323, 2016, 2420, 2503, 29889, 320, 29900, 29941, 29941, 29961, 29885, 1495, 13, 1678, 1596, 877, 10457, 2433, 334, 29871, 29896, 29906, 29897, 13, 1678, 8709, 29898, 29906, 29897, 13, 2158, 28909, 29900, 29941, 29941, 29961, 29941, 29941, 29885, 383, 326, 437, 16914, 29991, 3684, 371, 14472, 29991, 320, 29900, 29941, 29941, 29961, 29885, 1495, 13, 13, 13, 13, 13, 2 ]
RLBotPack/Beast from the East/behaviour.py
DaCoolOne/RLBotPack
0
182769
import predict import render from info import Field, Ball from moves import AimCone from plans import DodgePlan from rlmath import * class Carry: def __init__(self): self.is_dribbling = False self.flick_timer = 0 # Constants self.extra_utility_bias = 0.2 self.wait_before_flick = 0.26 self.flick_init_jump_duration = 0.07 self.required_distance_to_ball_for_flick = 173 self.offset_bias = 36 def utility(self, bot): car = bot.info.my_car ball = bot.info.ball car_to_ball = car.pos - ball.pos bouncing_b = ball.pos.z > 130 or abs(ball.vel.z) > 300 if not bouncing_b: return 0 dist_01 = clip01(1 - norm(car_to_ball) / 3000) head_dir = lerp(Vec3(0, 0, 1), car.forward(), 0.1) ang = angle_between(head_dir, car_to_ball) ang_01 = clip01(1 - ang / (math.pi / 2)) return clip01(0.6 * ang_01 + 0.4 * dist_01 # - 0.3 * bot.analyzer.team_mate_has_ball_01 + self.is_dribbling * self.extra_utility_bias) def execute(self, bot): self.is_dribbling = True car = bot.info.my_car ball = bot.info.ball ball_landing = predict.next_ball_landing(bot) ball_to_goal = bot.info.enemy_goal - ball.pos # Decide on target pos and speed target = ball_landing.data["obj"].pos - self.offset_bias * normalize(ball_to_goal) dist = norm(target - bot.info.my_car.pos) speed = 1400 if ball_landing.time == 0 else dist / ball_landing.time # Do a flick? car_to_ball = ball.pos - car.pos dist = norm(car_to_ball) if dist <= self.required_distance_to_ball_for_flick: self.flick_timer += 0.016666 if self.flick_timer > self.wait_before_flick: bot.plan = DodgePlan(bot.info.enemy_goal) # use flick_init_jump_duration? else: self.flick_timer = 0 # dodge on far distances if dist > 2450 and speed > 1410: ctt_n = normalize(target - car.pos) vtt = dot(bot.info.my_car.vel, ctt_n) / dot(ctt_n, ctt_n) if vtt > 750: bot.plan = DodgePlan(target) controls = bot.drive.go_towards_point(bot, target, target_vel=speed, slide=False, boost=False, can_keep_speed=False, can_dodge=True, wall_offset_allowed=0) bot.controls = controls if bot.do_rendering: bot.renderer.draw_line_3d(car.pos, target, bot.renderer.pink()) def reset(self): self.is_dribbling = False self.flick_timer = 0 class ShootAtGoal: def __init__(self): self.aim_cone = None self.ball_to_goal_right = None self.ball_to_goal_left = None def utility(self, bot): ball_soon = predict.ball_predict(bot, 1) arena_length2 = bot.info.team_sign * Field.LENGTH / 2 own_half_01 = clip01(remap(arena_length2, -arena_length2, 0.0, 1.1, ball_soon.pos.y)) reachable_ball = predict.ball_predict(bot, predict.time_till_reach_ball(bot.info.my_car, bot.info.ball)) self.ball_to_goal_right = bot.info.enemy_goal_right - reachable_ball.pos self.ball_to_goal_left = bot.info.enemy_goal_left - reachable_ball.pos self.aim_cone = AimCone(self.ball_to_goal_right, self.ball_to_goal_left) car_to_ball = reachable_ball.pos - bot.info.my_car.pos in_position = self.aim_cone.contains_direction(car_to_ball) return clip01(own_half_01 + 0.1 * in_position) def execute(self, bot): car = bot.info.my_car ball = bot.info.ball shoot_controls = bot.shoot.with_aiming(bot, self.aim_cone, predict.time_till_reach_ball(car, ball)) if bot.do_rendering: self.aim_cone.draw(bot, bot.shoot.ball_when_hit.pos, b=0) hit_pos = bot.shoot.ball_when_hit.pos dist = norm(car.pos - hit_pos) closest_enemy, enemy_dist = bot.info.closest_enemy(0.5 * (hit_pos + ball.pos)) if not bot.shoot.can_shoot and is_closer_to_goal_than(car.pos, hit_pos, bot.info.team): # Can't shoot but or at least on the right side: Chase goal_to_ball = normalize(hit_pos - bot.info.enemy_goal) offset_ball = hit_pos + goal_to_ball * Ball.RADIUS * 0.9 bot.controls = bot.drive.go_towards_point(bot, offset_ball, target_vel=2200, slide=False, boost=True) if bot.do_rendering: bot.renderer.draw_line_3d(car.pos, offset_ball, bot.renderer.yellow()) elif not bot.shoot.aim_is_ok and hit_pos.y * -bot.info.team_sign > 4350 and abs(hit_pos.x) > 900 and not dist < 450: # hit_pos is an enemy corner and we are not close: Avoid enemy corners and just wait enemy_to_ball = normalize(hit_pos - closest_enemy.pos) wait_point = hit_pos + enemy_to_ball * enemy_dist # a point 50% closer to the center of the field wait_point = lerp(wait_point, ball.pos + Vec3(0, bot.info.team_sign * 3000, 0), 0.5) bot.controls = bot.drive.go_towards_point(bot, wait_point, norm(car.pos - wait_point), slide=False, boost=False, can_keep_speed=True, can_dodge=False) if bot.do_rendering: bot.renderer.draw_line_3d(car.pos, wait_point, bot.renderer.yellow()) elif not bot.shoot.can_shoot: # return home bot.controls = bot.drive.go_home(bot) else: # Shoot ! bot.controls = shoot_controls if bot.shoot.using_curve and bot.do_rendering: render.draw_bezier(bot, [car.pos, bot.shoot.curve_point, hit_pos]) class ClearBall: def __init__(self, bot): if bot.team == 0: # blue self.aim_cone = AimCone(.8 * math.pi, .2 * math.pi) else: # orange self.aim_cone = AimCone(-.1 * math.pi, -.9 * math.pi) def utility(self, bot): team_sign = bot.info.team_sign length = team_sign * Field.LENGTH / 2 ball_own_half_01 = clip01(remap(-length, length, -0.2, 1.2, bot.info.ball.pos.y)) reachable_ball = predict.ball_predict(bot, predict.time_till_reach_ball(bot.info.my_car, bot.info.ball)) car_to_ball = reachable_ball.pos - bot.info.my_car.pos in_position = self.aim_cone.contains_direction(car_to_ball, math.pi / 8) return ball_own_half_01 * in_position def execute(self, bot): car = bot.info.my_car shoot_controls = bot.shoot.with_aiming(bot, self.aim_cone, predict.time_till_reach_ball(bot.info.my_car, bot.info.ball)) hit_pos = bot.shoot.ball_when_hit.pos if bot.do_rendering: self.aim_cone.draw(bot, hit_pos, r=0, g=170, b=255) if bot.shoot.can_shoot: bot.controls = shoot_controls if bot.shoot.using_curve and bot.do_rendering: render.draw_bezier(bot, [car.pos, bot.shoot.curve_point, hit_pos]) else: # go home-ish own_goal = lerp(bot.info.own_goal, bot.info.ball.pos, 0.5) bot.controls = bot.drive.go_towards_point(bot, own_goal, target_vel=1460, slide=True, boost=True, can_keep_speed=True) class SaveGoal: def __init__(self, bot): team_sign = bot.info.team_sign self.own_goal_right = Vec3(-820 * team_sign, 5120 * team_sign, 0) self.own_goal_left = Vec3(820 * team_sign, 5120 * team_sign, 0) self.aim_cone = None self.ball_to_goal_right = None self.ball_to_goal_left = None def utility(self, bot): team_sign = bot.info.team_sign ball = bot.info.ball ball_to_goal = bot.info.own_goal - ball.pos too_close = norm(ball_to_goal) < Field.GOAL_WIDTH / 2 + Ball.RADIUS hits_goal_prediction = predict.will_ball_hit_goal(bot) hits_goal = hits_goal_prediction.happens and sign(ball.vel.y) == team_sign and hits_goal_prediction.time < 3 return hits_goal or too_close def execute(self, bot): car = bot.info.my_car ball = bot.info.ball hits_goal_prediction = predict.will_ball_hit_goal(bot) reach_time = clip(predict.time_till_reach_ball(car, ball), 0, hits_goal_prediction.time - 0.5) reachable_ball = predict.ball_predict(bot, reach_time) self.ball_to_goal_right = self.own_goal_right - reachable_ball.pos self.ball_to_goal_left = self.own_goal_left - reachable_ball.pos self.aim_cone = AimCone(self.ball_to_goal_left, self.ball_to_goal_right) self.aim_cone.draw(bot, reachable_ball.pos, r=200, g=0, b=160) shoot_controls = bot.shoot.with_aiming(bot, self.aim_cone, reach_time) if not bot.shoot.can_shoot: # Go home bot.controls = bot.drive.go_home(bot) else: bot.controls = shoot_controls
[ 1, 1053, 8500, 13, 5215, 4050, 13, 3166, 5235, 1053, 8989, 29892, 13402, 13, 3166, 16229, 1053, 319, 326, 29907, 650, 13, 3166, 13900, 1053, 360, 17979, 20334, 13, 3166, 364, 29880, 755, 1053, 334, 13, 13, 13, 1990, 1704, 719, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 275, 29918, 29881, 1091, 21435, 353, 7700, 13, 4706, 1583, 29889, 29888, 1406, 29918, 20404, 353, 29871, 29900, 13, 13, 4706, 396, 5798, 1934, 13, 4706, 1583, 29889, 17833, 29918, 329, 1793, 29918, 29890, 3173, 353, 29871, 29900, 29889, 29906, 13, 4706, 1583, 29889, 10685, 29918, 11083, 29918, 29888, 1406, 353, 29871, 29900, 29889, 29906, 29953, 13, 4706, 1583, 29889, 29888, 1406, 29918, 2344, 29918, 29926, 3427, 29918, 19708, 353, 29871, 29900, 29889, 29900, 29955, 13, 4706, 1583, 29889, 12403, 29918, 19244, 29918, 517, 29918, 2135, 29918, 1454, 29918, 29888, 1406, 353, 29871, 29896, 29955, 29941, 13, 4706, 1583, 29889, 10289, 29918, 29890, 3173, 353, 29871, 29941, 29953, 13, 13, 1678, 822, 19725, 29898, 1311, 29892, 9225, 1125, 13, 4706, 1559, 353, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 13, 4706, 8287, 353, 9225, 29889, 3888, 29889, 2135, 13, 13, 4706, 1559, 29918, 517, 29918, 2135, 353, 1559, 29889, 1066, 448, 8287, 29889, 1066, 13, 13, 4706, 289, 1309, 3277, 29918, 29890, 353, 8287, 29889, 1066, 29889, 29920, 1405, 29871, 29896, 29941, 29900, 470, 6425, 29898, 2135, 29889, 955, 29889, 29920, 29897, 1405, 29871, 29941, 29900, 29900, 13, 4706, 565, 451, 289, 1309, 3277, 29918, 29890, 29901, 13, 9651, 736, 29871, 29900, 13, 13, 4706, 1320, 29918, 29900, 29896, 353, 20102, 29900, 29896, 29898, 29896, 448, 6056, 29898, 4287, 29918, 517, 29918, 2135, 29897, 847, 29871, 29941, 29900, 29900, 29900, 29897, 13, 13, 4706, 2343, 29918, 3972, 353, 301, 261, 29886, 29898, 25987, 29941, 29898, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 511, 1559, 29889, 11333, 3285, 29871, 29900, 29889, 29896, 29897, 13, 4706, 2614, 353, 10696, 29918, 14811, 29898, 2813, 29918, 3972, 29892, 1559, 29918, 517, 29918, 2135, 29897, 13, 4706, 2614, 29918, 29900, 29896, 353, 20102, 29900, 29896, 29898, 29896, 448, 2614, 847, 313, 755, 29889, 1631, 847, 29871, 29906, 876, 13, 13, 4706, 736, 20102, 29900, 29896, 29898, 29900, 29889, 29953, 334, 2614, 29918, 29900, 29896, 13, 462, 795, 718, 29871, 29900, 29889, 29946, 334, 1320, 29918, 29900, 29896, 13, 462, 795, 396, 29871, 448, 29871, 29900, 29889, 29941, 334, 9225, 29889, 24209, 3298, 29889, 14318, 29918, 25046, 29918, 5349, 29918, 2135, 29918, 29900, 29896, 13, 462, 795, 718, 1583, 29889, 275, 29918, 29881, 1091, 21435, 334, 1583, 29889, 17833, 29918, 329, 1793, 29918, 29890, 3173, 29897, 13, 13, 1678, 822, 6222, 29898, 1311, 29892, 9225, 1125, 13, 4706, 1583, 29889, 275, 29918, 29881, 1091, 21435, 353, 5852, 13, 13, 4706, 1559, 353, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 13, 4706, 8287, 353, 9225, 29889, 3888, 29889, 2135, 13, 4706, 8287, 29918, 1049, 292, 353, 8500, 29889, 4622, 29918, 2135, 29918, 1049, 292, 29898, 7451, 29897, 13, 4706, 8287, 29918, 517, 29918, 28111, 353, 9225, 29889, 3888, 29889, 264, 6764, 29918, 28111, 448, 8287, 29889, 1066, 13, 13, 4706, 396, 897, 8204, 373, 3646, 926, 322, 6210, 13, 4706, 3646, 353, 8287, 29918, 1049, 292, 29889, 1272, 3366, 5415, 16862, 1066, 448, 1583, 29889, 10289, 29918, 29890, 3173, 334, 4226, 675, 29898, 2135, 29918, 517, 29918, 28111, 29897, 13, 4706, 1320, 353, 6056, 29898, 5182, 448, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 29889, 1066, 29897, 13, 4706, 6210, 353, 29871, 29896, 29946, 29900, 29900, 565, 8287, 29918, 1049, 292, 29889, 2230, 1275, 29871, 29900, 1683, 1320, 847, 8287, 29918, 1049, 292, 29889, 2230, 13, 13, 4706, 396, 1938, 263, 285, 1406, 29973, 13, 4706, 1559, 29918, 517, 29918, 2135, 353, 8287, 29889, 1066, 448, 1559, 29889, 1066, 13, 4706, 1320, 353, 6056, 29898, 4287, 29918, 517, 29918, 2135, 29897, 13, 4706, 565, 1320, 5277, 1583, 29889, 12403, 29918, 19244, 29918, 517, 29918, 2135, 29918, 1454, 29918, 29888, 1406, 29901, 13, 9651, 1583, 29889, 29888, 1406, 29918, 20404, 4619, 29871, 29900, 29889, 29900, 29896, 29953, 29953, 29953, 29953, 13, 9651, 565, 1583, 29889, 29888, 1406, 29918, 20404, 1405, 1583, 29889, 10685, 29918, 11083, 29918, 29888, 1406, 29901, 13, 18884, 9225, 29889, 9018, 353, 360, 17979, 20334, 29898, 7451, 29889, 3888, 29889, 264, 6764, 29918, 28111, 29897, 29871, 396, 671, 285, 1406, 29918, 2344, 29918, 29926, 3427, 29918, 19708, 29973, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 29888, 1406, 29918, 20404, 353, 29871, 29900, 13, 13, 9651, 396, 270, 17979, 373, 2215, 24610, 13, 9651, 565, 1320, 1405, 29871, 29906, 29946, 29945, 29900, 322, 6210, 1405, 29871, 29896, 29946, 29896, 29900, 29901, 13, 18884, 274, 698, 29918, 29876, 353, 4226, 675, 29898, 5182, 448, 1559, 29889, 1066, 29897, 13, 18884, 325, 698, 353, 8329, 29898, 7451, 29889, 3888, 29889, 1357, 29918, 4287, 29889, 955, 29892, 274, 698, 29918, 29876, 29897, 847, 8329, 29898, 312, 29873, 29918, 29876, 29892, 274, 698, 29918, 29876, 29897, 13, 18884, 565, 325, 698, 1405, 29871, 29955, 29945, 29900, 29901, 13, 462, 1678, 9225, 29889, 9018, 353, 360, 17979, 20334, 29898, 5182, 29897, 13, 13, 4706, 11761, 353, 9225, 29889, 21594, 29889, 1484, 29918, 29873, 340, 3163, 29918, 3149, 29898, 7451, 29892, 3646, 29892, 3646, 29918, 955, 29922, 19322, 29892, 20343, 29922, 8824, 29892, 14505, 29922, 8824, 29892, 508, 29918, 17462, 29918, 19322, 29922, 8824, 29892, 508, 29918, 29881, 17979, 29922, 5574, 29892, 10090, 29918, 10289, 29918, 24622, 29922, 29900, 29897, 13, 4706, 9225, 29889, 26255, 353, 11761, 13, 13, 4706, 565, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 9651, 9225, 29889, 9482, 261, 29889, 4012, 29918, 1220, 29918, 29941, 29881, 29898, 4287, 29889, 1066, 29892, 3646, 29892, 9225, 29889, 9482, 261, 29889, 29886, 682, 3101, 13, 13, 1678, 822, 10092, 29898, 1311, 1125, 13, 4706, 1583, 29889, 275, 29918, 29881, 1091, 21435, 353, 7700, 13, 4706, 1583, 29889, 29888, 1406, 29918, 20404, 353, 29871, 29900, 13, 13, 13, 1990, 17550, 327, 4178, 8120, 284, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 6213, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 353, 6213, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 353, 6213, 13, 13, 1678, 822, 19725, 29898, 1311, 29892, 9225, 1125, 13, 4706, 8287, 29918, 578, 265, 353, 8500, 29889, 2135, 29918, 27711, 29898, 7451, 29892, 29871, 29896, 29897, 13, 13, 4706, 564, 2386, 29918, 2848, 29906, 353, 9225, 29889, 3888, 29889, 14318, 29918, 4530, 334, 8989, 29889, 19433, 847, 29871, 29906, 13, 4706, 1914, 29918, 24498, 29918, 29900, 29896, 353, 20102, 29900, 29896, 29898, 1745, 481, 29898, 279, 2386, 29918, 2848, 29906, 29892, 448, 279, 2386, 29918, 2848, 29906, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29896, 29892, 8287, 29918, 578, 265, 29889, 1066, 29889, 29891, 876, 13, 13, 4706, 6159, 519, 29918, 2135, 353, 8500, 29889, 2135, 29918, 27711, 29898, 7451, 29892, 8500, 29889, 2230, 29918, 29873, 453, 29918, 276, 496, 29918, 2135, 29898, 7451, 29889, 3888, 29889, 1357, 29918, 4287, 29892, 9225, 29889, 3888, 29889, 2135, 876, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 353, 9225, 29889, 3888, 29889, 264, 6764, 29918, 28111, 29918, 1266, 448, 6159, 519, 29918, 2135, 29889, 1066, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 353, 9225, 29889, 3888, 29889, 264, 6764, 29918, 28111, 29918, 1563, 448, 6159, 519, 29918, 2135, 29889, 1066, 13, 4706, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 319, 326, 29907, 650, 29898, 1311, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 29892, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 29897, 13, 4706, 1559, 29918, 517, 29918, 2135, 353, 6159, 519, 29918, 2135, 29889, 1066, 448, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 29889, 1066, 13, 4706, 297, 29918, 3283, 353, 1583, 29889, 29874, 326, 29918, 535, 29872, 29889, 11516, 29918, 20845, 29898, 4287, 29918, 517, 29918, 2135, 29897, 13, 13, 4706, 736, 20102, 29900, 29896, 29898, 776, 29918, 24498, 29918, 29900, 29896, 718, 29871, 29900, 29889, 29896, 334, 297, 29918, 3283, 29897, 13, 13, 1678, 822, 6222, 29898, 1311, 29892, 9225, 1125, 13, 13, 4706, 1559, 353, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 13, 4706, 8287, 353, 9225, 29889, 3888, 29889, 2135, 13, 13, 4706, 15049, 29918, 26255, 353, 9225, 29889, 845, 3155, 29889, 2541, 29918, 29874, 326, 292, 29898, 7451, 29892, 1583, 29889, 29874, 326, 29918, 535, 29872, 29892, 8500, 29889, 2230, 29918, 29873, 453, 29918, 276, 496, 29918, 2135, 29898, 4287, 29892, 8287, 876, 13, 4706, 565, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 9651, 1583, 29889, 29874, 326, 29918, 535, 29872, 29889, 4012, 29898, 7451, 29892, 9225, 29889, 845, 3155, 29889, 2135, 29918, 8256, 29918, 27342, 29889, 1066, 29892, 289, 29922, 29900, 29897, 13, 13, 4706, 7124, 29918, 1066, 353, 9225, 29889, 845, 3155, 29889, 2135, 29918, 8256, 29918, 27342, 29889, 1066, 13, 4706, 1320, 353, 6056, 29898, 4287, 29889, 1066, 448, 7124, 29918, 1066, 29897, 13, 4706, 21438, 29918, 264, 6764, 29892, 11103, 29918, 5721, 353, 9225, 29889, 3888, 29889, 11291, 342, 29918, 264, 6764, 29898, 29900, 29889, 29945, 334, 313, 27342, 29918, 1066, 718, 8287, 29889, 1066, 876, 13, 13, 4706, 565, 451, 9225, 29889, 845, 3155, 29889, 3068, 29918, 845, 3155, 322, 338, 29918, 11291, 261, 29918, 517, 29918, 28111, 29918, 27603, 29898, 4287, 29889, 1066, 29892, 7124, 29918, 1066, 29892, 9225, 29889, 3888, 29889, 14318, 1125, 13, 9651, 396, 1815, 29915, 29873, 15049, 541, 470, 472, 3203, 373, 278, 1492, 2625, 29901, 678, 559, 13, 13, 9651, 7306, 29918, 517, 29918, 2135, 353, 4226, 675, 29898, 27342, 29918, 1066, 448, 9225, 29889, 3888, 29889, 264, 6764, 29918, 28111, 29897, 13, 9651, 9210, 29918, 2135, 353, 7124, 29918, 1066, 718, 7306, 29918, 517, 29918, 2135, 334, 13402, 29889, 29934, 3035, 29902, 3308, 334, 29871, 29900, 29889, 29929, 13, 9651, 9225, 29889, 26255, 353, 9225, 29889, 21594, 29889, 1484, 29918, 29873, 340, 3163, 29918, 3149, 29898, 7451, 29892, 9210, 29918, 2135, 29892, 3646, 29918, 955, 29922, 29906, 29906, 29900, 29900, 29892, 20343, 29922, 8824, 29892, 14505, 29922, 5574, 29897, 13, 13, 9651, 565, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 18884, 9225, 29889, 9482, 261, 29889, 4012, 29918, 1220, 29918, 29941, 29881, 29898, 4287, 29889, 1066, 29892, 9210, 29918, 2135, 29892, 9225, 29889, 9482, 261, 29889, 29136, 3101, 13, 13, 4706, 25342, 451, 9225, 29889, 845, 3155, 29889, 29874, 326, 29918, 275, 29918, 554, 322, 7124, 29918, 1066, 29889, 29891, 334, 448, 7451, 29889, 3888, 29889, 14318, 29918, 4530, 1405, 29871, 29946, 29941, 29945, 29900, 322, 6425, 29898, 27342, 29918, 1066, 29889, 29916, 29897, 1405, 29871, 29929, 29900, 29900, 322, 451, 1320, 529, 29871, 29946, 29945, 29900, 29901, 13, 9651, 396, 7124, 29918, 1066, 338, 385, 11103, 11155, 322, 591, 526, 451, 3802, 29901, 319, 5405, 11103, 26995, 322, 925, 4480, 13, 13, 9651, 11103, 29918, 517, 29918, 2135, 353, 4226, 675, 29898, 27342, 29918, 1066, 448, 21438, 29918, 264, 6764, 29889, 1066, 29897, 13, 9651, 4480, 29918, 3149, 353, 7124, 29918, 1066, 718, 11103, 29918, 517, 29918, 2135, 334, 11103, 29918, 5721, 29871, 396, 263, 1298, 29871, 29945, 29900, 29995, 17649, 304, 278, 4818, 310, 278, 1746, 13, 9651, 4480, 29918, 3149, 353, 301, 261, 29886, 29898, 10685, 29918, 3149, 29892, 8287, 29889, 1066, 718, 26393, 29941, 29898, 29900, 29892, 9225, 29889, 3888, 29889, 14318, 29918, 4530, 334, 29871, 29941, 29900, 29900, 29900, 29892, 29871, 29900, 511, 29871, 29900, 29889, 29945, 29897, 13, 9651, 9225, 29889, 26255, 353, 9225, 29889, 21594, 29889, 1484, 29918, 29873, 340, 3163, 29918, 3149, 29898, 7451, 29892, 4480, 29918, 3149, 29892, 6056, 29898, 4287, 29889, 1066, 448, 4480, 29918, 3149, 511, 20343, 29922, 8824, 29892, 14505, 29922, 8824, 29892, 508, 29918, 17462, 29918, 19322, 29922, 5574, 29892, 508, 29918, 29881, 17979, 29922, 8824, 29897, 13, 13, 9651, 565, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 18884, 9225, 29889, 9482, 261, 29889, 4012, 29918, 1220, 29918, 29941, 29881, 29898, 4287, 29889, 1066, 29892, 4480, 29918, 3149, 29892, 9225, 29889, 9482, 261, 29889, 29136, 3101, 13, 13, 4706, 25342, 451, 9225, 29889, 845, 3155, 29889, 3068, 29918, 845, 3155, 29901, 13, 9651, 396, 736, 3271, 13, 9651, 9225, 29889, 26255, 353, 9225, 29889, 21594, 29889, 1484, 29918, 5184, 29898, 7451, 29897, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 17550, 327, 1738, 13, 9651, 9225, 29889, 26255, 353, 15049, 29918, 26255, 13, 13, 9651, 565, 9225, 29889, 845, 3155, 29889, 4746, 29918, 2764, 345, 322, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 18884, 4050, 29889, 4012, 29918, 15325, 631, 29898, 7451, 29892, 518, 4287, 29889, 1066, 29892, 9225, 29889, 845, 3155, 29889, 2764, 345, 29918, 3149, 29892, 7124, 29918, 1066, 2314, 13, 13, 13, 1990, 17732, 29933, 497, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 1125, 13, 4706, 565, 9225, 29889, 14318, 1275, 29871, 29900, 29901, 13, 9651, 396, 7254, 13, 9651, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 319, 326, 29907, 650, 11891, 29947, 334, 5844, 29889, 1631, 29892, 869, 29906, 334, 5844, 29889, 1631, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 24841, 13, 9651, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 319, 326, 29907, 650, 6278, 29889, 29896, 334, 5844, 29889, 1631, 29892, 448, 29889, 29929, 334, 5844, 29889, 1631, 29897, 13, 13, 1678, 822, 19725, 29898, 1311, 29892, 9225, 1125, 13, 4706, 3815, 29918, 4530, 353, 9225, 29889, 3888, 29889, 14318, 29918, 4530, 13, 13, 4706, 3309, 353, 3815, 29918, 4530, 334, 8989, 29889, 19433, 847, 29871, 29906, 13, 4706, 8287, 29918, 776, 29918, 24498, 29918, 29900, 29896, 353, 20102, 29900, 29896, 29898, 1745, 481, 6278, 2848, 29892, 3309, 29892, 448, 29900, 29889, 29906, 29892, 29871, 29896, 29889, 29906, 29892, 9225, 29889, 3888, 29889, 2135, 29889, 1066, 29889, 29891, 876, 13, 13, 4706, 6159, 519, 29918, 2135, 353, 8500, 29889, 2135, 29918, 27711, 29898, 7451, 29892, 8500, 29889, 2230, 29918, 29873, 453, 29918, 276, 496, 29918, 2135, 29898, 7451, 29889, 3888, 29889, 1357, 29918, 4287, 29892, 9225, 29889, 3888, 29889, 2135, 876, 13, 4706, 1559, 29918, 517, 29918, 2135, 353, 6159, 519, 29918, 2135, 29889, 1066, 448, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 29889, 1066, 13, 4706, 297, 29918, 3283, 353, 1583, 29889, 29874, 326, 29918, 535, 29872, 29889, 11516, 29918, 20845, 29898, 4287, 29918, 517, 29918, 2135, 29892, 5844, 29889, 1631, 847, 29871, 29947, 29897, 13, 13, 4706, 736, 8287, 29918, 776, 29918, 24498, 29918, 29900, 29896, 334, 297, 29918, 3283, 13, 13, 1678, 822, 6222, 29898, 1311, 29892, 9225, 1125, 13, 4706, 1559, 353, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 13, 4706, 15049, 29918, 26255, 353, 9225, 29889, 845, 3155, 29889, 2541, 29918, 29874, 326, 292, 29898, 7451, 29892, 1583, 29889, 29874, 326, 29918, 535, 29872, 29892, 8500, 29889, 2230, 29918, 29873, 453, 29918, 276, 496, 29918, 2135, 29898, 7451, 29889, 3888, 29889, 1357, 29918, 4287, 29892, 9225, 29889, 3888, 29889, 2135, 876, 13, 4706, 7124, 29918, 1066, 353, 9225, 29889, 845, 3155, 29889, 2135, 29918, 8256, 29918, 27342, 29889, 1066, 13, 13, 4706, 565, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 9651, 1583, 29889, 29874, 326, 29918, 535, 29872, 29889, 4012, 29898, 7451, 29892, 7124, 29918, 1066, 29892, 364, 29922, 29900, 29892, 330, 29922, 29896, 29955, 29900, 29892, 289, 29922, 29906, 29945, 29945, 29897, 13, 13, 4706, 565, 9225, 29889, 845, 3155, 29889, 3068, 29918, 845, 3155, 29901, 13, 9651, 9225, 29889, 26255, 353, 15049, 29918, 26255, 13, 13, 9651, 565, 9225, 29889, 845, 3155, 29889, 4746, 29918, 2764, 345, 322, 9225, 29889, 1867, 29918, 9482, 292, 29901, 13, 18884, 4050, 29889, 4012, 29918, 15325, 631, 29898, 7451, 29892, 518, 4287, 29889, 1066, 29892, 9225, 29889, 845, 3155, 29889, 2764, 345, 29918, 3149, 29892, 7124, 29918, 1066, 2314, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 748, 3271, 29899, 728, 13, 9651, 1914, 29918, 28111, 353, 301, 261, 29886, 29898, 7451, 29889, 3888, 29889, 776, 29918, 28111, 29892, 9225, 29889, 3888, 29889, 2135, 29889, 1066, 29892, 29871, 29900, 29889, 29945, 29897, 13, 9651, 9225, 29889, 26255, 353, 9225, 29889, 21594, 29889, 1484, 29918, 29873, 340, 3163, 29918, 3149, 29898, 7451, 29892, 1914, 29918, 28111, 29892, 3646, 29918, 955, 29922, 29896, 29946, 29953, 29900, 29892, 20343, 29922, 5574, 29892, 14505, 29922, 5574, 29892, 508, 29918, 17462, 29918, 19322, 29922, 5574, 29897, 13, 13, 13, 1990, 16913, 8120, 284, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9225, 1125, 13, 4706, 3815, 29918, 4530, 353, 9225, 29889, 3888, 29889, 14318, 29918, 4530, 13, 4706, 1583, 29889, 776, 29918, 28111, 29918, 1266, 353, 26393, 29941, 6278, 29947, 29906, 29900, 334, 3815, 29918, 4530, 29892, 29871, 29945, 29896, 29906, 29900, 334, 3815, 29918, 4530, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 776, 29918, 28111, 29918, 1563, 353, 26393, 29941, 29898, 29947, 29906, 29900, 334, 3815, 29918, 4530, 29892, 29871, 29945, 29896, 29906, 29900, 334, 3815, 29918, 4530, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 6213, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 353, 6213, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 353, 6213, 13, 13, 1678, 822, 19725, 29898, 1311, 29892, 9225, 1125, 13, 4706, 3815, 29918, 4530, 353, 9225, 29889, 3888, 29889, 14318, 29918, 4530, 13, 4706, 8287, 353, 9225, 29889, 3888, 29889, 2135, 13, 13, 4706, 8287, 29918, 517, 29918, 28111, 353, 9225, 29889, 3888, 29889, 776, 29918, 28111, 448, 8287, 29889, 1066, 13, 4706, 2086, 29918, 5358, 353, 6056, 29898, 2135, 29918, 517, 29918, 28111, 29897, 529, 8989, 29889, 17080, 1964, 29918, 22574, 847, 29871, 29906, 718, 13402, 29889, 29934, 3035, 29902, 3308, 13, 13, 4706, 19572, 29918, 28111, 29918, 11965, 2463, 353, 8500, 29889, 14043, 29918, 2135, 29918, 27342, 29918, 28111, 29898, 7451, 29897, 13, 4706, 19572, 29918, 28111, 353, 19572, 29918, 28111, 29918, 11965, 2463, 29889, 29882, 932, 575, 322, 1804, 29898, 2135, 29889, 955, 29889, 29891, 29897, 1275, 3815, 29918, 4530, 322, 19572, 29918, 28111, 29918, 11965, 2463, 29889, 2230, 529, 29871, 29941, 13, 13, 4706, 736, 19572, 29918, 28111, 470, 2086, 29918, 5358, 13, 13, 1678, 822, 6222, 29898, 1311, 29892, 9225, 1125, 13, 13, 4706, 1559, 353, 9225, 29889, 3888, 29889, 1357, 29918, 4287, 13, 4706, 8287, 353, 9225, 29889, 3888, 29889, 2135, 13, 13, 4706, 19572, 29918, 28111, 29918, 11965, 2463, 353, 8500, 29889, 14043, 29918, 2135, 29918, 27342, 29918, 28111, 29898, 7451, 29897, 13, 4706, 6159, 29918, 2230, 353, 20102, 29898, 27711, 29889, 2230, 29918, 29873, 453, 29918, 276, 496, 29918, 2135, 29898, 4287, 29892, 8287, 511, 29871, 29900, 29892, 19572, 29918, 28111, 29918, 11965, 2463, 29889, 2230, 448, 29871, 29900, 29889, 29945, 29897, 13, 4706, 6159, 519, 29918, 2135, 353, 8500, 29889, 2135, 29918, 27711, 29898, 7451, 29892, 6159, 29918, 2230, 29897, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 353, 1583, 29889, 776, 29918, 28111, 29918, 1266, 448, 6159, 519, 29918, 2135, 29889, 1066, 13, 4706, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 353, 1583, 29889, 776, 29918, 28111, 29918, 1563, 448, 6159, 519, 29918, 2135, 29889, 1066, 13, 4706, 1583, 29889, 29874, 326, 29918, 535, 29872, 353, 319, 326, 29907, 650, 29898, 1311, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1563, 29892, 1583, 29889, 2135, 29918, 517, 29918, 28111, 29918, 1266, 29897, 13, 13, 4706, 1583, 29889, 29874, 326, 29918, 535, 29872, 29889, 4012, 29898, 7451, 29892, 6159, 519, 29918, 2135, 29889, 1066, 29892, 364, 29922, 29906, 29900, 29900, 29892, 330, 29922, 29900, 29892, 289, 29922, 29896, 29953, 29900, 29897, 13, 13, 4706, 15049, 29918, 26255, 353, 9225, 29889, 845, 3155, 29889, 2541, 29918, 29874, 326, 292, 29898, 7451, 29892, 1583, 29889, 29874, 326, 29918, 535, 29872, 29892, 6159, 29918, 2230, 29897, 13, 13, 4706, 565, 451, 9225, 29889, 845, 3155, 29889, 3068, 29918, 845, 3155, 29901, 13, 9651, 396, 2921, 3271, 13, 9651, 9225, 29889, 26255, 353, 9225, 29889, 21594, 29889, 1484, 29918, 5184, 29898, 7451, 29897, 13, 4706, 1683, 29901, 13, 9651, 9225, 29889, 26255, 353, 15049, 29918, 26255, 13, 2 ]
Code/Alestle.py
SIUE-Library/alestleMetadata
0
87622
<reponame>SIUE-Library/alestleMetadata import datetime import re class Alestle(): def __init__(self, fileURL): #Title := "The Alestle, <Month> <Day>, <Year>" self.title = "" self.url = fileURL self.author = "Southern Illinois University Edwardsville" self.publisher = "Southern Illinois University Edwardsville" self.city = "Edwardsville" self.docType = "book" self.abstract = "" self.pubdate = "" self.fillClass() #return the object with its comma delineated values, including needed default values #for the columns not included here. A collection alestle.toString()'s should be a valid csv def toString(self): t="" d="" if self.pubdate == "": t += "Error: Date is wrong at:\n" if self.abstract == "": t += "Error: Edition is wrong at:\n" try: d = datetime.datetime.strptime(self.pubdate, "%B%d,%Y").strftime("%Y-%m-%d") t += "The Alestle, "+d self.title = "The Alestle, "+d self.pubdate = d except: t += "Error AT: "+self.url+"\n" print("EVERYTHING IS ON FIRE") url = "192.168.3.11/alestle/"+self.url[16:-3]+"pdf" return self.title+"|"+url+"||"+self.abstract+"|Southern Illinois University Edwardsville||||||FALSE|||||||FALSE|||||||FALSE|||||||FALSE||||||"+self.pubdate+"|\n" def fillClass(self): #Fils in the variables for the alestle class, given a string containing the entire newspaper. testString = open(self.url, "r") testString = testString.read() testString = testString.replace(" ", "") testString = testString.replace("\n", "") testString = testString.replace("\r", "") dateMatch = re.search("(January|February|March|April|May|June|July|August|September|October|November|December)(\d|\d\d,)(\d\d\d\d)",testString) if(dateMatch): self.pubdate = dateMatch.group(0) issueMatch = re.search("Vol(,|\.)(\d\d|\d)(,|\.)No(,|\.)(\d\d|\d)",testString) if(issueMatch): self.abstract = issueMatch.group(0) self.abstract = self.abstract.replace(",", " ") print("UPDATED")
[ 1, 529, 276, 1112, 420, 29958, 5425, 4462, 29899, 12284, 29914, 284, 342, 280, 18417, 13, 5215, 12865, 13, 5215, 337, 13, 1990, 838, 342, 280, 7295, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 4219, 1125, 13, 4706, 396, 7030, 3490, 376, 1576, 838, 342, 280, 29892, 529, 13953, 29958, 529, 12742, 10202, 529, 12883, 11903, 13, 4706, 1583, 29889, 3257, 353, 5124, 13, 4706, 1583, 29889, 2271, 353, 934, 4219, 13, 4706, 1583, 29889, 8921, 353, 376, 29903, 283, 5063, 17066, 3014, 29174, 4909, 29908, 13, 4706, 1583, 29889, 23679, 261, 353, 376, 29903, 283, 5063, 17066, 3014, 29174, 4909, 29908, 13, 4706, 1583, 29889, 12690, 353, 376, 3853, 2935, 4909, 29908, 13, 4706, 1583, 29889, 1514, 1542, 353, 376, 2909, 29908, 13, 4706, 1583, 29889, 16595, 353, 5124, 13, 4706, 1583, 29889, 5467, 1256, 353, 5124, 13, 13, 4706, 1583, 29889, 5589, 2385, 580, 13, 13, 1678, 396, 2457, 278, 1203, 411, 967, 16694, 628, 457, 630, 1819, 29892, 3704, 4312, 2322, 1819, 13, 1678, 396, 1454, 278, 4341, 451, 5134, 1244, 29889, 29871, 319, 4333, 394, 342, 280, 29889, 7711, 580, 29915, 29879, 881, 367, 263, 2854, 11799, 13, 1678, 822, 304, 1231, 29898, 1311, 1125, 13, 4706, 260, 13776, 13, 4706, 270, 13776, 13, 4706, 565, 1583, 29889, 5467, 1256, 1275, 376, 1115, 13, 9651, 260, 4619, 376, 2392, 29901, 4712, 338, 2743, 472, 3583, 29876, 29908, 13, 4706, 565, 1583, 29889, 16595, 1275, 376, 1115, 13, 9651, 260, 4619, 376, 2392, 29901, 17138, 338, 2743, 472, 3583, 29876, 29908, 13, 4706, 1018, 29901, 13, 9651, 270, 353, 12865, 29889, 12673, 29889, 710, 415, 603, 29898, 1311, 29889, 5467, 1256, 29892, 11860, 29933, 29995, 29881, 24163, 29979, 2564, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 1159, 13, 9651, 260, 4619, 376, 1576, 838, 342, 280, 29892, 15691, 29881, 13, 9651, 1583, 29889, 3257, 353, 376, 1576, 838, 342, 280, 29892, 15691, 29881, 13, 9651, 1583, 29889, 5467, 1256, 353, 270, 13, 4706, 5174, 29901, 13, 9651, 260, 4619, 376, 2392, 15531, 29901, 15691, 1311, 29889, 2271, 13578, 29905, 29876, 29908, 13, 9651, 1596, 703, 29923, 5348, 29979, 4690, 4214, 8519, 6732, 9338, 1525, 1159, 13, 13, 4706, 3142, 353, 376, 29896, 29929, 29906, 29889, 29896, 29953, 29947, 29889, 29941, 29889, 29896, 29896, 29914, 284, 342, 280, 12975, 29974, 1311, 29889, 2271, 29961, 29896, 29953, 13018, 29941, 10062, 29908, 5140, 29908, 13, 4706, 736, 1583, 29889, 3257, 13578, 29989, 17969, 2271, 13578, 8876, 17969, 1311, 29889, 16595, 13578, 29989, 29903, 283, 5063, 17066, 3014, 29174, 4909, 8876, 8876, 8876, 25717, 8876, 8876, 8876, 29989, 25717, 8876, 8876, 8876, 29989, 25717, 8876, 8876, 8876, 29989, 25717, 8876, 8876, 8876, 17969, 1311, 29889, 5467, 1256, 13578, 4295, 29876, 29908, 13, 4706, 13, 1678, 822, 5445, 2385, 29898, 1311, 1125, 13, 4706, 396, 29943, 2719, 297, 278, 3651, 363, 278, 394, 342, 280, 770, 29892, 2183, 263, 1347, 6943, 278, 4152, 19656, 29889, 13, 4706, 1243, 1231, 353, 1722, 29898, 1311, 29889, 2271, 29892, 376, 29878, 1159, 13, 4706, 1243, 1231, 353, 1243, 1231, 29889, 949, 580, 13, 4706, 1243, 1231, 353, 1243, 1231, 29889, 6506, 703, 9162, 20569, 13, 4706, 1243, 1231, 353, 1243, 1231, 29889, 6506, 14182, 29876, 613, 20569, 13, 4706, 1243, 1231, 353, 1243, 1231, 29889, 6506, 14182, 29878, 613, 20569, 13, 308, 13, 4706, 2635, 9652, 353, 337, 29889, 4478, 703, 29898, 29967, 15623, 653, 29989, 29943, 3205, 653, 29989, 29924, 1279, 29989, 29909, 3193, 29989, 12703, 29989, 29967, 1540, 29989, 29967, 11850, 29989, 26197, 29989, 2008, 3266, 29989, 25375, 4950, 29989, 25363, 1096, 29989, 6185, 1096, 29897, 1194, 29881, 4295, 29881, 29905, 29881, 29892, 29897, 1194, 29881, 29905, 29881, 29905, 29881, 29905, 29881, 19123, 1688, 1231, 29897, 13, 4706, 565, 29898, 1256, 9652, 1125, 13, 9651, 1583, 29889, 5467, 1256, 353, 2635, 9652, 29889, 2972, 29898, 29900, 29897, 13, 4706, 2228, 9652, 353, 337, 29889, 4478, 703, 13072, 29898, 29892, 4295, 1846, 1194, 29881, 29905, 29881, 4295, 29881, 5033, 29892, 4295, 1846, 3782, 29898, 29892, 4295, 1846, 1194, 29881, 29905, 29881, 4295, 29881, 19123, 1688, 1231, 29897, 13, 4706, 565, 29898, 15118, 9652, 1125, 13, 9651, 1583, 29889, 16595, 353, 2228, 9652, 29889, 2972, 29898, 29900, 29897, 13, 9651, 1583, 29889, 16595, 353, 1583, 29889, 16595, 29889, 6506, 28165, 613, 376, 16521, 13, 9651, 1596, 703, 14474, 29928, 1159, 13, 2 ]
tests/test_stackimages.py
BodenmillerGroup/ImcPluginsCP
10
108231
<reponame>BodenmillerGroup/ImcPluginsCP """test_stackimages.py - test the stackimages module """ import unittest import numpy as np from cellprofiler_core.preferences import set_headless set_headless() import cellprofiler_core.workspace as cpw import cellprofiler_core.image as cpi import cellprofiler_core.object as cpo import cellprofiler_core.pipeline as cpp import cellprofiler_core.measurement as cpmeas import plugins.stackimages as S INPUT_IMAGE_BASENAME = "myimage" OUTPUT_IMAGE_NAME = "mystackedimage" class TestStackImages(unittest.TestCase): def make_workspace(self, images): """Make a workspace """ module = S.StackImages() pipeline = cpp.Pipeline() object_set = cpo.ObjectSet() image_set_list = cpi.ImageSetList() image_set = image_set_list.get_image_set(0) workspace = cpw.Workspace( pipeline, module, image_set, object_set, cpmeas.Measurements(), image_set_list, ) # setup the input images names = [INPUT_IMAGE_BASENAME + str(i) for i, img in enumerate(images)] for img, nam in zip(images, names): image_set.add(nam, cpi.Image(img)) # setup the input images settings module.stack_image_name.value = OUTPUT_IMAGE_NAME nimgs = len(images) while len(module.stack_channels) < nimgs: module.add_stack_channel_cb() for sc, imname in zip(module.stack_channels, names): sc.image_name.value = imname return workspace, module def assert_stack(self, images, result): # test if this is equal to the stacked images lb = 0 for im in images: if len(im.shape) > 2: offset = im.shape[2] else: offset = 1 ub = lb + offset np.testing.assert_equal(np.squeeze(result.pixel_data[:, :, lb:ub]), im) lb = ub def assert_shape(self, images, result): new_shape = list(images[0].shape)[:2] c = 0 for im in images: if len(im.shape) > 2: c += im.shape[2] else: c += 1 new_shape += [c] np.testing.assert_equal(result.pixel_data.shape, new_shape) def test_stack_multichannel(self): img_shape = (10, 10, 5) image1 = np.zeros(img_shape) image2 = np.copy(image1) image2[:] = 1 input_imgs = [image1, image2] workspace, module = self.make_workspace(input_imgs) module.run(workspace) result = workspace.image_set.get_image(OUTPUT_IMAGE_NAME) self.assert_stack(input_imgs, result) self.assert_shape(input_imgs, result) def test_stack_multi_gray(self): img_shape = (10, 10, 5) image1 = np.zeros(img_shape) image1[:] = 1 img_shape2 = (10, 10) image2 = np.zeros(img_shape2) input_imgs = [image1, image2] workspace, module = self.make_workspace(input_imgs) module.run(workspace) result = workspace.image_set.get_image(OUTPUT_IMAGE_NAME) self.assert_stack(input_imgs, result) self.assert_shape(input_imgs, result) def test_stack_gray(self): img_shape = (10, 10) image1 = np.zeros(img_shape) image2 = np.copy(image1) image2[:] = 1 input_imgs = [image1, image2] workspace, module = self.make_workspace(input_imgs) module.run(workspace) result = workspace.image_set.get_image(OUTPUT_IMAGE_NAME) self.assert_stack(input_imgs, result) self.assert_shape(input_imgs, result) def test_stack_3multichannel(self): nimgs = 5 img_shape = (10, 10, 5) image = np.zeros(img_shape) input_imgs = [] for i in range(nimgs): img = np.copy(image) img[:] = i input_imgs.append(img) workspace, module = self.make_workspace(input_imgs) module.run(workspace) result = workspace.image_set.get_image(OUTPUT_IMAGE_NAME) self.assert_stack(input_imgs, result) self.assert_shape(input_imgs, result)
[ 1, 529, 276, 1112, 420, 29958, 29933, 13183, 29885, 5495, 4782, 29914, 1888, 29883, 3247, 8385, 6271, 13, 15945, 29908, 1688, 29918, 1429, 8346, 29889, 2272, 448, 1243, 278, 5096, 8346, 3883, 13, 15945, 29908, 13, 13, 5215, 443, 27958, 13, 13, 5215, 12655, 408, 7442, 13, 13, 3166, 3038, 771, 1777, 261, 29918, 3221, 29889, 1457, 10662, 1053, 731, 29918, 2813, 2222, 13, 13, 842, 29918, 2813, 2222, 580, 13, 13, 5215, 3038, 771, 1777, 261, 29918, 3221, 29889, 1287, 3493, 408, 21447, 29893, 13, 5215, 3038, 771, 1777, 261, 29918, 3221, 29889, 3027, 408, 274, 1631, 13, 5215, 3038, 771, 1777, 261, 29918, 3221, 29889, 3318, 408, 274, 1129, 13, 5215, 3038, 771, 1777, 261, 29918, 3221, 29889, 13096, 5570, 408, 274, 407, 13, 5215, 3038, 771, 1777, 261, 29918, 3221, 29889, 26658, 358, 408, 21447, 1004, 294, 13, 13, 5215, 18224, 29889, 1429, 8346, 408, 317, 13, 13, 1177, 12336, 29918, 2382, 29918, 29933, 3289, 1430, 25797, 353, 376, 1357, 3027, 29908, 13, 13, 12015, 12336, 29918, 2382, 29918, 5813, 353, 376, 29885, 858, 547, 287, 3027, 29908, 13, 13, 13, 1990, 4321, 7264, 20163, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 1678, 822, 1207, 29918, 1287, 3493, 29898, 1311, 29892, 4558, 1125, 13, 4706, 9995, 9984, 263, 664, 3493, 9995, 13, 4706, 3883, 353, 317, 29889, 7264, 20163, 580, 13, 4706, 16439, 353, 274, 407, 29889, 29925, 23828, 580, 13, 4706, 1203, 29918, 842, 353, 274, 1129, 29889, 2061, 2697, 580, 13, 4706, 1967, 29918, 842, 29918, 1761, 353, 274, 1631, 29889, 2940, 2697, 1293, 580, 13, 4706, 1967, 29918, 842, 353, 1967, 29918, 842, 29918, 1761, 29889, 657, 29918, 3027, 29918, 842, 29898, 29900, 29897, 13, 4706, 664, 3493, 353, 21447, 29893, 29889, 5531, 3493, 29898, 13, 9651, 16439, 29892, 13, 9651, 3883, 29892, 13, 9651, 1967, 29918, 842, 29892, 13, 9651, 1203, 29918, 842, 29892, 13, 9651, 21447, 1004, 294, 29889, 6816, 3745, 1860, 3285, 13, 9651, 1967, 29918, 842, 29918, 1761, 29892, 13, 4706, 1723, 13, 13, 4706, 396, 6230, 278, 1881, 4558, 13, 4706, 2983, 353, 518, 1177, 12336, 29918, 2382, 29918, 29933, 3289, 1430, 25797, 718, 851, 29898, 29875, 29897, 363, 474, 29892, 10153, 297, 26985, 29898, 8346, 4638, 13, 4706, 363, 10153, 29892, 6869, 297, 14319, 29898, 8346, 29892, 2983, 1125, 13, 9651, 1967, 29918, 842, 29889, 1202, 29898, 8588, 29892, 274, 1631, 29889, 2940, 29898, 2492, 876, 13, 13, 4706, 396, 6230, 278, 1881, 4558, 6055, 13, 4706, 3883, 29889, 1429, 29918, 3027, 29918, 978, 29889, 1767, 353, 19474, 12336, 29918, 2382, 29918, 5813, 13, 4706, 302, 2492, 29879, 353, 7431, 29898, 8346, 29897, 13, 4706, 1550, 7431, 29898, 5453, 29889, 1429, 29918, 305, 12629, 29897, 529, 302, 2492, 29879, 29901, 13, 9651, 3883, 29889, 1202, 29918, 1429, 29918, 12719, 29918, 10702, 580, 13, 4706, 363, 885, 29892, 527, 978, 297, 14319, 29898, 5453, 29889, 1429, 29918, 305, 12629, 29892, 2983, 1125, 13, 9651, 885, 29889, 3027, 29918, 978, 29889, 1767, 353, 527, 978, 13, 13, 4706, 736, 664, 3493, 29892, 3883, 13, 13, 1678, 822, 4974, 29918, 1429, 29898, 1311, 29892, 4558, 29892, 1121, 1125, 13, 4706, 396, 1243, 565, 445, 338, 5186, 304, 278, 5096, 287, 4558, 13, 4706, 27981, 353, 29871, 29900, 13, 4706, 363, 527, 297, 4558, 29901, 13, 9651, 565, 7431, 29898, 326, 29889, 12181, 29897, 1405, 29871, 29906, 29901, 13, 18884, 9210, 353, 527, 29889, 12181, 29961, 29906, 29962, 13, 9651, 1683, 29901, 13, 18884, 9210, 353, 29871, 29896, 13, 9651, 13069, 353, 27981, 718, 9210, 13, 9651, 7442, 29889, 13424, 29889, 9294, 29918, 11745, 29898, 9302, 29889, 29879, 802, 29872, 911, 29898, 2914, 29889, 29886, 15711, 29918, 1272, 7503, 29892, 584, 29892, 27981, 29901, 431, 11724, 527, 29897, 13, 9651, 27981, 353, 13069, 13, 13, 1678, 822, 4974, 29918, 12181, 29898, 1311, 29892, 4558, 29892, 1121, 1125, 13, 4706, 716, 29918, 12181, 353, 1051, 29898, 8346, 29961, 29900, 1822, 12181, 29897, 7503, 29906, 29962, 13, 4706, 274, 353, 29871, 29900, 13, 4706, 363, 527, 297, 4558, 29901, 13, 9651, 565, 7431, 29898, 326, 29889, 12181, 29897, 1405, 29871, 29906, 29901, 13, 18884, 274, 4619, 527, 29889, 12181, 29961, 29906, 29962, 13, 9651, 1683, 29901, 13, 18884, 274, 4619, 29871, 29896, 13, 4706, 716, 29918, 12181, 4619, 518, 29883, 29962, 13, 4706, 7442, 29889, 13424, 29889, 9294, 29918, 11745, 29898, 2914, 29889, 29886, 15711, 29918, 1272, 29889, 12181, 29892, 716, 29918, 12181, 29897, 13, 13, 1678, 822, 1243, 29918, 1429, 29918, 4713, 436, 4143, 29898, 1311, 1125, 13, 4706, 10153, 29918, 12181, 353, 313, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29945, 29897, 13, 4706, 1967, 29896, 353, 7442, 29889, 3298, 359, 29898, 2492, 29918, 12181, 29897, 13, 4706, 1967, 29906, 353, 7442, 29889, 8552, 29898, 3027, 29896, 29897, 13, 4706, 1967, 29906, 7503, 29962, 353, 29871, 29896, 13, 4706, 1881, 29918, 2492, 29879, 353, 518, 3027, 29896, 29892, 1967, 29906, 29962, 13, 4706, 664, 3493, 29892, 3883, 353, 1583, 29889, 5675, 29918, 1287, 3493, 29898, 2080, 29918, 2492, 29879, 29897, 13, 4706, 3883, 29889, 3389, 29898, 1287, 3493, 29897, 13, 4706, 1121, 353, 664, 3493, 29889, 3027, 29918, 842, 29889, 657, 29918, 3027, 29898, 12015, 12336, 29918, 2382, 29918, 5813, 29897, 13, 4706, 1583, 29889, 9294, 29918, 1429, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 4706, 1583, 29889, 9294, 29918, 12181, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 13, 1678, 822, 1243, 29918, 1429, 29918, 9910, 29918, 21012, 29898, 1311, 1125, 13, 4706, 10153, 29918, 12181, 353, 313, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29945, 29897, 13, 4706, 1967, 29896, 353, 7442, 29889, 3298, 359, 29898, 2492, 29918, 12181, 29897, 13, 4706, 1967, 29896, 7503, 29962, 353, 29871, 29896, 13, 4706, 10153, 29918, 12181, 29906, 353, 313, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 4706, 1967, 29906, 353, 7442, 29889, 3298, 359, 29898, 2492, 29918, 12181, 29906, 29897, 13, 4706, 1881, 29918, 2492, 29879, 353, 518, 3027, 29896, 29892, 1967, 29906, 29962, 13, 4706, 664, 3493, 29892, 3883, 353, 1583, 29889, 5675, 29918, 1287, 3493, 29898, 2080, 29918, 2492, 29879, 29897, 13, 4706, 3883, 29889, 3389, 29898, 1287, 3493, 29897, 13, 4706, 1121, 353, 664, 3493, 29889, 3027, 29918, 842, 29889, 657, 29918, 3027, 29898, 12015, 12336, 29918, 2382, 29918, 5813, 29897, 13, 4706, 1583, 29889, 9294, 29918, 1429, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 4706, 1583, 29889, 9294, 29918, 12181, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 13, 1678, 822, 1243, 29918, 1429, 29918, 21012, 29898, 1311, 1125, 13, 4706, 10153, 29918, 12181, 353, 313, 29896, 29900, 29892, 29871, 29896, 29900, 29897, 13, 4706, 1967, 29896, 353, 7442, 29889, 3298, 359, 29898, 2492, 29918, 12181, 29897, 13, 4706, 1967, 29906, 353, 7442, 29889, 8552, 29898, 3027, 29896, 29897, 13, 4706, 1967, 29906, 7503, 29962, 353, 29871, 29896, 13, 4706, 1881, 29918, 2492, 29879, 353, 518, 3027, 29896, 29892, 1967, 29906, 29962, 13, 4706, 664, 3493, 29892, 3883, 353, 1583, 29889, 5675, 29918, 1287, 3493, 29898, 2080, 29918, 2492, 29879, 29897, 13, 4706, 3883, 29889, 3389, 29898, 1287, 3493, 29897, 13, 4706, 1121, 353, 664, 3493, 29889, 3027, 29918, 842, 29889, 657, 29918, 3027, 29898, 12015, 12336, 29918, 2382, 29918, 5813, 29897, 13, 4706, 1583, 29889, 9294, 29918, 1429, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 4706, 1583, 29889, 9294, 29918, 12181, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 13, 1678, 822, 1243, 29918, 1429, 29918, 29941, 4713, 436, 4143, 29898, 1311, 1125, 13, 4706, 302, 2492, 29879, 353, 29871, 29945, 13, 4706, 10153, 29918, 12181, 353, 313, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29945, 29897, 13, 4706, 1967, 353, 7442, 29889, 3298, 359, 29898, 2492, 29918, 12181, 29897, 13, 4706, 1881, 29918, 2492, 29879, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 29876, 2492, 29879, 1125, 13, 9651, 10153, 353, 7442, 29889, 8552, 29898, 3027, 29897, 13, 9651, 10153, 7503, 29962, 353, 474, 13, 9651, 1881, 29918, 2492, 29879, 29889, 4397, 29898, 2492, 29897, 13, 4706, 664, 3493, 29892, 3883, 353, 1583, 29889, 5675, 29918, 1287, 3493, 29898, 2080, 29918, 2492, 29879, 29897, 13, 4706, 3883, 29889, 3389, 29898, 1287, 3493, 29897, 13, 4706, 1121, 353, 664, 3493, 29889, 3027, 29918, 842, 29889, 657, 29918, 3027, 29898, 12015, 12336, 29918, 2382, 29918, 5813, 29897, 13, 4706, 1583, 29889, 9294, 29918, 1429, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 4706, 1583, 29889, 9294, 29918, 12181, 29898, 2080, 29918, 2492, 29879, 29892, 1121, 29897, 13, 2 ]
bin/validate_plug_ins.py
warp5tw/openbmc-test-automation
0
67783
<gh_stars>0 #!/usr/bin/env python import sys try: import __builtin__ except ImportError: import builtins as __builtin__ import os # python puts the program's directory path in sys.path[0]. In other words, the user ordinarily has no way # to override python's choice of a module from its own dir. We want to have that ability in our environment. # However, we don't want to break any established python modules that depend on this behavior. So, we'll # save the value from sys.path[0], delete it, import our modules and then restore sys.path to its original # value. save_path_0 = sys.path[0] del sys.path[0] from gen_print import * from gen_arg import * from gen_plug_in import * # Restore sys.path[0]. sys.path.insert(0, save_path_0) # Create parser object to process command line parameters and args. # Create parser object. parser = argparse.ArgumentParser( usage='%(prog)s [OPTIONS] [PLUG_IN_DIR_PATHS]', description="%(prog)s will validate the plug-in packages passed to it." + " It will also print a list of the absolute plug-in" + " directory paths for use by the calling program.", formatter_class=argparse.ArgumentDefaultsHelpFormatter, prefix_chars='-+') # Create arguments. parser.add_argument( 'plug_in_dir_paths', nargs='?', default="", help=plug_in_dir_paths_help_text + default_string) parser.add_argument( '--mch_class', default="obmc", help=mch_class_help_text + default_string) # The stock_list will be passed to gen_get_options. We populate it with the names of stock parm options we # want. These stock parms are pre-defined by gen_get_options. stock_list = [("test_mode", 0), ("quiet", 1), ("debug", 0)] def exit_function(signal_number=0, frame=None): r""" Execute whenever the program ends normally or with the signals that we catch (i.e. TERM, INT). """ dprint_executing() dprint_var(signal_number) qprint_pgm_footer() def signal_handler(signal_number, frame): r""" Handle signals. Without a function to catch a SIGTERM or SIGINT, our program would terminate immediately with return code 143 and without calling our exit_function. """ # Our convention is to set up exit_function with atexit.registr() so there is no need to explicitly call # exit_function from here. dprint_executing() # Calling exit prevents us from returning to the code that was running when we received the signal. exit(0) def validate_parms(): r""" Validate program parameters, etc. Return True or False accordingly. """ gen_post_validation(exit_function, signal_handler) return True def main(): r""" This is the "main" function. The advantage of having this function vs just doing this in the true mainline is that you can: - Declare local variables - Use "return" instead of "exit". - Indent 4 chars like you would in any function. This makes coding more consistent, i.e. it's easy to move code from here into a function and vice versa. """ if not gen_get_options(parser, stock_list): return False if not validate_parms(): return False qprint_pgm_header() # Access program parameter globals. global plug_in_dir_paths global mch_class plug_in_packages_list = return_plug_in_packages_list(plug_in_dir_paths, mch_class) qprint_var(plug_in_packages_list) # As stated in the help text, this program must print the full paths of each selected plug in. for plug_in_dir_path in plug_in_packages_list: print(plug_in_dir_path) return True # Main if not main(): exit(1)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 5215, 10876, 13, 2202, 29901, 13, 1678, 1053, 4770, 16145, 262, 1649, 13, 19499, 16032, 2392, 29901, 13, 1678, 1053, 4240, 1144, 408, 4770, 16145, 262, 1649, 13, 13, 5215, 2897, 13, 13, 29937, 3017, 15223, 278, 1824, 29915, 29879, 3884, 2224, 297, 10876, 29889, 2084, 29961, 29900, 1822, 29871, 512, 916, 3838, 29892, 278, 1404, 22420, 6275, 756, 694, 982, 13, 29937, 304, 5712, 3017, 29915, 29879, 7348, 310, 263, 3883, 515, 967, 1914, 4516, 29889, 29871, 1334, 864, 304, 505, 393, 11509, 297, 1749, 5177, 29889, 13, 29937, 2398, 29892, 591, 1016, 29915, 29873, 864, 304, 2867, 738, 7841, 3017, 10585, 393, 8839, 373, 445, 6030, 29889, 29871, 1105, 29892, 591, 29915, 645, 13, 29937, 4078, 278, 995, 515, 10876, 29889, 2084, 29961, 29900, 1402, 5217, 372, 29892, 1053, 1749, 10585, 322, 769, 17749, 10876, 29889, 2084, 304, 967, 2441, 13, 29937, 995, 29889, 13, 13, 7620, 29918, 2084, 29918, 29900, 353, 10876, 29889, 2084, 29961, 29900, 29962, 13, 6144, 10876, 29889, 2084, 29961, 29900, 29962, 13, 13, 3166, 2531, 29918, 2158, 1053, 334, 13, 3166, 2531, 29918, 1191, 1053, 334, 13, 3166, 2531, 29918, 572, 688, 29918, 262, 1053, 334, 13, 13, 29937, 11654, 487, 10876, 29889, 2084, 29961, 29900, 1822, 13, 9675, 29889, 2084, 29889, 7851, 29898, 29900, 29892, 4078, 29918, 2084, 29918, 29900, 29897, 13, 13, 13, 29937, 6204, 13812, 1203, 304, 1889, 1899, 1196, 4128, 322, 6389, 29889, 13, 13, 29937, 6204, 13812, 1203, 29889, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 1678, 8744, 2433, 29995, 29898, 29097, 29897, 29879, 518, 14094, 27946, 29962, 518, 7390, 23338, 29918, 1177, 29918, 9464, 29918, 10145, 29903, 29962, 742, 13, 1678, 6139, 543, 29995, 29898, 29097, 29897, 29879, 674, 12725, 278, 18665, 29899, 262, 9741, 4502, 304, 372, 1213, 13, 18884, 718, 376, 29871, 739, 674, 884, 1596, 263, 1051, 310, 278, 8380, 18665, 29899, 262, 29908, 13, 18884, 718, 376, 3884, 10898, 363, 671, 491, 278, 5432, 1824, 19602, 13, 1678, 883, 2620, 29918, 1990, 29922, 1191, 5510, 29889, 15730, 24863, 29648, 18522, 29892, 13, 1678, 10944, 29918, 305, 1503, 2433, 11793, 1495, 13, 13, 29937, 6204, 6273, 29889, 13, 16680, 29889, 1202, 29918, 23516, 29898, 13, 1678, 525, 572, 688, 29918, 262, 29918, 3972, 29918, 24772, 742, 13, 1678, 302, 5085, 2433, 29973, 742, 13, 1678, 2322, 543, 613, 13, 1678, 1371, 29922, 572, 688, 29918, 262, 29918, 3972, 29918, 24772, 29918, 8477, 29918, 726, 718, 2322, 29918, 1807, 29897, 13, 13, 16680, 29889, 1202, 29918, 23516, 29898, 13, 1678, 525, 489, 29885, 305, 29918, 1990, 742, 13, 1678, 2322, 543, 711, 14047, 613, 13, 1678, 1371, 29922, 29885, 305, 29918, 1990, 29918, 8477, 29918, 726, 718, 2322, 29918, 1807, 29897, 13, 13, 29937, 450, 10961, 29918, 1761, 674, 367, 4502, 304, 2531, 29918, 657, 29918, 6768, 29889, 29871, 1334, 19450, 372, 411, 278, 2983, 310, 10961, 610, 29885, 3987, 591, 13, 29937, 864, 29889, 29871, 4525, 10961, 610, 1516, 526, 758, 29899, 12119, 491, 2531, 29918, 657, 29918, 6768, 29889, 13, 17712, 29918, 1761, 353, 518, 703, 1688, 29918, 8513, 613, 29871, 29900, 511, 4852, 339, 2035, 613, 29871, 29896, 511, 4852, 8382, 613, 29871, 29900, 4638, 13, 13, 13, 1753, 6876, 29918, 2220, 29898, 25436, 29918, 4537, 29922, 29900, 29892, 13, 462, 29871, 3515, 29922, 8516, 1125, 13, 1678, 364, 15945, 29908, 13, 1678, 11080, 1082, 10940, 278, 1824, 10614, 12891, 470, 411, 278, 18470, 393, 591, 4380, 313, 29875, 29889, 29872, 29889, 323, 1001, 29924, 29892, 19578, 467, 13, 1678, 9995, 13, 13, 1678, 270, 2158, 29918, 4258, 17068, 580, 13, 1678, 270, 2158, 29918, 1707, 29898, 25436, 29918, 4537, 29897, 13, 13, 1678, 3855, 2158, 29918, 4061, 29885, 29918, 21720, 580, 13, 13, 13, 1753, 7182, 29918, 13789, 29898, 25436, 29918, 4537, 29892, 3515, 1125, 13, 1678, 364, 15945, 29908, 13, 1678, 29273, 18470, 29889, 29871, 13932, 263, 740, 304, 4380, 263, 317, 6259, 4945, 29924, 470, 317, 6259, 10192, 29892, 1749, 1824, 723, 29504, 7389, 13, 1678, 411, 736, 775, 29871, 29896, 29946, 29941, 322, 1728, 5432, 1749, 6876, 29918, 2220, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 8680, 15687, 338, 304, 731, 701, 6876, 29918, 2220, 411, 263, 4776, 277, 29889, 29238, 580, 577, 727, 338, 694, 817, 304, 9479, 1246, 13, 1678, 396, 6876, 29918, 2220, 515, 1244, 29889, 13, 13, 1678, 270, 2158, 29918, 4258, 17068, 580, 13, 13, 1678, 396, 8251, 292, 6876, 28057, 502, 515, 7863, 304, 278, 775, 393, 471, 2734, 746, 591, 4520, 278, 7182, 29889, 13, 1678, 6876, 29898, 29900, 29897, 13, 13, 13, 1753, 12725, 29918, 862, 1516, 7295, 13, 1678, 364, 15945, 29908, 13, 1678, 15758, 403, 1824, 4128, 29892, 2992, 29889, 29871, 7106, 5852, 470, 7700, 16205, 29889, 13, 1678, 9995, 13, 13, 1678, 2531, 29918, 2490, 29918, 18157, 29898, 13322, 29918, 2220, 29892, 7182, 29918, 13789, 29897, 13, 13, 1678, 736, 5852, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 364, 15945, 29908, 13, 1678, 910, 338, 278, 376, 3396, 29908, 740, 29889, 29871, 450, 10631, 310, 2534, 445, 740, 7186, 925, 2599, 445, 297, 278, 1565, 13, 1678, 1667, 1220, 338, 393, 366, 508, 29901, 13, 1678, 448, 3826, 8663, 1887, 3651, 13, 1678, 448, 4803, 376, 2457, 29908, 2012, 310, 376, 13322, 1642, 13, 1678, 448, 1894, 296, 29871, 29946, 22524, 763, 366, 723, 297, 738, 740, 29889, 13, 1678, 910, 3732, 14137, 901, 13747, 29892, 474, 29889, 29872, 29889, 372, 29915, 29879, 4780, 304, 4337, 775, 515, 1244, 964, 263, 740, 322, 11289, 1224, 29874, 29889, 13, 1678, 9995, 13, 13, 1678, 565, 451, 2531, 29918, 657, 29918, 6768, 29898, 16680, 29892, 10961, 29918, 1761, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 565, 451, 12725, 29918, 862, 1516, 7295, 13, 4706, 736, 7700, 13, 13, 1678, 3855, 2158, 29918, 4061, 29885, 29918, 6672, 580, 13, 13, 1678, 396, 11028, 1824, 3443, 13149, 1338, 29889, 13, 1678, 5534, 18665, 29918, 262, 29918, 3972, 29918, 24772, 13, 1678, 5534, 286, 305, 29918, 1990, 13, 13, 1678, 18665, 29918, 262, 29918, 8318, 29918, 1761, 353, 736, 29918, 572, 688, 29918, 262, 29918, 8318, 29918, 1761, 29898, 572, 688, 29918, 262, 29918, 3972, 29918, 24772, 29892, 13, 462, 462, 462, 308, 286, 305, 29918, 1990, 29897, 13, 1678, 3855, 2158, 29918, 1707, 29898, 572, 688, 29918, 262, 29918, 8318, 29918, 1761, 29897, 13, 13, 1678, 396, 1094, 8703, 297, 278, 1371, 1426, 29892, 445, 1824, 1818, 1596, 278, 2989, 10898, 310, 1269, 4629, 18665, 297, 29889, 13, 1678, 363, 18665, 29918, 262, 29918, 3972, 29918, 2084, 297, 18665, 29918, 262, 29918, 8318, 29918, 1761, 29901, 13, 4706, 1596, 29898, 572, 688, 29918, 262, 29918, 3972, 29918, 2084, 29897, 13, 13, 1678, 736, 5852, 13, 13, 13, 29937, 4241, 13, 13, 361, 451, 1667, 7295, 13, 1678, 6876, 29898, 29896, 29897, 13, 2 ]
tests/bicep/graph/graph_builder/test_local_graph.py
pmalkki/checkov
0
188859
from collections import Counter from pathlib import Path from checkov.bicep.graph_builder.graph_components.block_types import BlockType from checkov.bicep.graph_builder.local_graph import BicepLocalGraph from checkov.bicep.parser import Parser EXAMPLES_DIR = Path(__file__).parent.parent.parent / "examples" def test_build_graph(): # given test_file = EXAMPLES_DIR / "playground.bicep" template, _ = Parser().parse(test_file) local_graph = BicepLocalGraph(definitions={test_file: template}) # when local_graph.build_graph(render_variables=False) # then assert len(local_graph.vertices) == 24 assert len(local_graph.edges) == 29 assert len(local_graph.vertices_by_block_type[BlockType.TARGET_SCOPE]) == 1 assert len(local_graph.vertices_by_block_type[BlockType.PARAM]) == 5 assert len(local_graph.vertices_by_block_type[BlockType.VAR]) == 10 assert len(local_graph.vertices_by_block_type[BlockType.RESOURCE]) == 8 assert len(local_graph.vertices_by_block_type[BlockType.MODULE]) == 0 assert len(local_graph.vertices_by_block_type[BlockType.OUTPUT]) == 0 out_edge_counts = Counter([e.origin for e in local_graph.edges]) in_edge_counts = Counter([e.dest for e in local_graph.edges]) assert out_edge_counts == Counter( { 16: 9, 19: 5, 20: 4, 17: 3, 18: 2, 21: 2, 22: 2, 23: 2, } ) assert in_edge_counts == Counter( { 5: 8, 6: 2, 2: 1, 3: 1, 1: 1, 20: 1, 21: 1, 17: 1, 13: 1, 4: 1, 15: 1, 9: 1, 10: 1, 11: 1, 18: 1, 7: 1, 22: 1, 23: 1, 8: 1, 12: 1, 14: 1, } )
[ 1, 515, 16250, 1053, 315, 5336, 13, 3166, 2224, 1982, 1053, 10802, 13, 13, 3166, 1423, 586, 29889, 29890, 625, 29886, 29889, 4262, 29918, 16409, 29889, 4262, 29918, 14036, 29889, 1271, 29918, 8768, 1053, 15658, 1542, 13, 3166, 1423, 586, 29889, 29890, 625, 29886, 29889, 4262, 29918, 16409, 29889, 2997, 29918, 4262, 1053, 350, 625, 29886, 7717, 9527, 13, 3166, 1423, 586, 29889, 29890, 625, 29886, 29889, 16680, 1053, 1459, 643, 13, 13, 5746, 19297, 17101, 29918, 9464, 353, 10802, 22168, 1445, 1649, 467, 3560, 29889, 3560, 29889, 3560, 847, 376, 19057, 29908, 13, 13, 13, 1753, 1243, 29918, 4282, 29918, 4262, 7295, 13, 1678, 396, 2183, 13, 1678, 1243, 29918, 1445, 353, 8528, 19297, 17101, 29918, 9464, 847, 376, 1456, 2057, 29889, 29890, 625, 29886, 29908, 13, 1678, 4472, 29892, 903, 353, 1459, 643, 2141, 5510, 29898, 1688, 29918, 1445, 29897, 13, 1678, 1887, 29918, 4262, 353, 350, 625, 29886, 7717, 9527, 29898, 25476, 2187, 3790, 1688, 29918, 1445, 29901, 4472, 1800, 13, 13, 1678, 396, 746, 13, 1678, 1887, 29918, 4262, 29889, 4282, 29918, 4262, 29898, 9482, 29918, 20897, 29922, 8824, 29897, 13, 13, 1678, 396, 769, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29897, 1275, 29871, 29906, 29946, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 287, 2710, 29897, 1275, 29871, 29906, 29929, 13, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 29911, 1718, 7194, 29918, 29903, 3217, 4162, 2314, 1275, 29871, 29896, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 16320, 5194, 2314, 1275, 29871, 29945, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 26865, 2314, 1275, 29871, 29896, 29900, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 1525, 27839, 4741, 2314, 1275, 29871, 29947, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 6720, 14849, 1307, 2314, 1275, 29871, 29900, 13, 1678, 4974, 7431, 29898, 2997, 29918, 4262, 29889, 1765, 1575, 29918, 1609, 29918, 1271, 29918, 1853, 29961, 7445, 1542, 29889, 12015, 12336, 2314, 1275, 29871, 29900, 13, 13, 1678, 714, 29918, 12864, 29918, 2798, 29879, 353, 315, 5336, 4197, 29872, 29889, 12574, 363, 321, 297, 1887, 29918, 4262, 29889, 287, 2710, 2314, 13, 1678, 297, 29918, 12864, 29918, 2798, 29879, 353, 315, 5336, 4197, 29872, 29889, 7854, 363, 321, 297, 1887, 29918, 4262, 29889, 287, 2710, 2314, 13, 13, 1678, 4974, 714, 29918, 12864, 29918, 2798, 29879, 1275, 315, 5336, 29898, 13, 4706, 426, 13, 632, 29896, 29953, 29901, 29871, 29929, 29892, 13, 632, 29896, 29929, 29901, 29871, 29945, 29892, 13, 632, 29906, 29900, 29901, 29871, 29946, 29892, 13, 632, 29896, 29955, 29901, 29871, 29941, 29892, 13, 632, 29896, 29947, 29901, 29871, 29906, 29892, 13, 632, 29906, 29896, 29901, 29871, 29906, 29892, 13, 632, 29906, 29906, 29901, 29871, 29906, 29892, 13, 632, 29906, 29941, 29901, 29871, 29906, 29892, 13, 4706, 500, 13, 1678, 1723, 13, 1678, 4974, 297, 29918, 12864, 29918, 2798, 29879, 1275, 315, 5336, 29898, 13, 4706, 426, 13, 632, 29945, 29901, 29871, 29947, 29892, 13, 632, 29953, 29901, 29871, 29906, 29892, 13, 632, 29906, 29901, 29871, 29896, 29892, 13, 632, 29941, 29901, 29871, 29896, 29892, 13, 632, 29896, 29901, 29871, 29896, 29892, 13, 632, 29906, 29900, 29901, 29871, 29896, 29892, 13, 632, 29906, 29896, 29901, 29871, 29896, 29892, 13, 632, 29896, 29955, 29901, 29871, 29896, 29892, 13, 632, 29896, 29941, 29901, 29871, 29896, 29892, 13, 632, 29946, 29901, 29871, 29896, 29892, 13, 632, 29896, 29945, 29901, 29871, 29896, 29892, 13, 632, 29929, 29901, 29871, 29896, 29892, 13, 632, 29896, 29900, 29901, 29871, 29896, 29892, 13, 632, 29896, 29896, 29901, 29871, 29896, 29892, 13, 632, 29896, 29947, 29901, 29871, 29896, 29892, 13, 632, 29955, 29901, 29871, 29896, 29892, 13, 632, 29906, 29906, 29901, 29871, 29896, 29892, 13, 632, 29906, 29941, 29901, 29871, 29896, 29892, 13, 632, 29947, 29901, 29871, 29896, 29892, 13, 632, 29896, 29906, 29901, 29871, 29896, 29892, 13, 632, 29896, 29946, 29901, 29871, 29896, 29892, 13, 4706, 500, 13, 1678, 1723, 13, 2 ]
utils/nlp.py
splovyt/SFPython-Project-Night
1
6500
import ssl import nltk from textblob import TextBlob from nltk.corpus import stopwords # set SSL try: _create_unverified_https_context = ssl._create_unverified_context except AttributeError: pass else: ssl._create_default_https_context = _create_unverified_https_context # download noun data (if required) nltk.download('brown') nltk.download('punkt') nltk.download('stopwords') def extract_nouns(sentence): """Extract the nouns from a sentence using the 'textblob' library.""" blob = TextBlob(sentence) return blob.noun_phrases def remove_stopwords(sentence): """Remove stopwords from a sentence and return the list of words.""" blob = TextBlob(sentence) return [word for word in blob.words if word not in stopwords.words('english') and len(word)>2]
[ 1, 1053, 24250, 13, 13, 5215, 302, 1896, 29895, 13, 3166, 1426, 10054, 1053, 3992, 29933, 2127, 13, 3166, 302, 1896, 29895, 29889, 2616, 13364, 1053, 5040, 9303, 13, 13, 13, 29937, 731, 17122, 13, 2202, 29901, 13, 1678, 903, 3258, 29918, 348, 369, 2164, 29918, 991, 29918, 4703, 353, 24250, 3032, 3258, 29918, 348, 369, 2164, 29918, 4703, 13, 19499, 23833, 2392, 29901, 13, 1678, 1209, 13, 2870, 29901, 13, 1678, 24250, 3032, 3258, 29918, 4381, 29918, 991, 29918, 4703, 353, 903, 3258, 29918, 348, 369, 2164, 29918, 991, 29918, 4703, 13, 13, 29937, 5142, 302, 1309, 848, 313, 361, 3734, 29897, 13, 29876, 1896, 29895, 29889, 10382, 877, 29890, 4708, 1495, 13, 29876, 1896, 29895, 29889, 10382, 877, 19294, 1495, 13, 29876, 1896, 29895, 29889, 10382, 877, 9847, 9303, 1495, 13, 13, 1753, 6597, 29918, 29876, 1309, 29879, 29898, 18616, 663, 1125, 13, 1678, 9995, 5647, 1461, 278, 302, 1309, 29879, 515, 263, 10541, 773, 278, 525, 726, 10054, 29915, 3489, 1213, 15945, 13, 1678, 23755, 353, 3992, 29933, 2127, 29898, 18616, 663, 29897, 13, 1678, 736, 23755, 29889, 29876, 1309, 29918, 24588, 2129, 13, 13, 1753, 3349, 29918, 9847, 9303, 29898, 18616, 663, 1125, 13, 1678, 9995, 15941, 5040, 9303, 515, 263, 10541, 322, 736, 278, 1051, 310, 3838, 1213, 15945, 13, 1678, 23755, 353, 3992, 29933, 2127, 29898, 18616, 663, 29897, 13, 1678, 736, 518, 1742, 363, 1734, 297, 23755, 29889, 9303, 565, 1734, 451, 297, 5040, 9303, 29889, 9303, 877, 996, 1674, 1495, 322, 7431, 29898, 1742, 15410, 29906, 29962, 13, 2 ]
interface/python/test.py
gaubert/nessDB
1
27667
<reponame>gaubert/nessDB #!/usr/bin/env python #-*- coding:utf-8 -*- # author : KDr2 # BohuTANG @2012 # import sys import random import string import time import nessdb def gen_random_str(len): return ''.join([random.choice('abcdefghijklmnoprstuvwyxzABCDEFGHIJKLMNOPRSTUVWXYZ') for i in range(len)]) def ness_open(db_name): return nessdb.NessDB(db_name) def ness_write(db, c): s_time = time.time() for i in range(0, c): key = gen_random_str(16) db.db_add(key, "abcd") if (i % 10000) == 0: sys.stdout.write("\r\x1b[K ....write finished " + i.__str__()) sys.stdout.flush() e_time = time.time() print "" print "---->count:<%i>,cost time:<%i>, %i/sec\n" %(c, e_time - s_time, c / (e_time - s_time)) if __name__ == '__main__': if (len(sys.argv) > 2): if (sys.argv[1] == "write"): db = ness_open("test") ness_write(db, int(sys.argv[2])) db.db_close() else: print "test.py write <count>"
[ 1, 529, 276, 1112, 420, 29958, 3249, 431, 814, 29914, 2264, 4051, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 29899, 29930, 29899, 14137, 29901, 9420, 29899, 29947, 448, 29930, 29899, 13, 29937, 4148, 584, 476, 25639, 29906, 13, 29937, 17966, 29884, 29911, 19453, 732, 29906, 29900, 29896, 29906, 13, 29937, 13, 13, 5215, 10876, 13, 5215, 4036, 13, 5215, 1347, 13, 5215, 931, 13, 5215, 302, 404, 2585, 13, 13, 1753, 2531, 29918, 8172, 29918, 710, 29898, 2435, 1125, 13, 12, 2457, 525, 4286, 7122, 4197, 8172, 29889, 16957, 877, 10736, 1753, 12443, 823, 6321, 23521, 459, 29878, 303, 4090, 12822, 29916, 29920, 19658, 24405, 29954, 17628, 29967, 29968, 26369, 29940, 4590, 29934, 1254, 29965, 29963, 29956, 18454, 29999, 1495, 363, 474, 297, 3464, 29898, 2435, 29897, 2314, 13, 13, 1753, 302, 404, 29918, 3150, 29898, 2585, 29918, 978, 1125, 13, 12, 2457, 302, 404, 2585, 29889, 29940, 404, 4051, 29898, 2585, 29918, 978, 29897, 13, 13, 1753, 302, 404, 29918, 3539, 29898, 2585, 29892, 274, 1125, 13, 12, 29879, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 12, 1454, 474, 297, 3464, 29898, 29900, 29892, 274, 1125, 13, 12, 12, 1989, 353, 2531, 29918, 8172, 29918, 710, 29898, 29896, 29953, 29897, 13, 12, 12, 2585, 29889, 2585, 29918, 1202, 29898, 1989, 29892, 376, 370, 2252, 1159, 13, 12, 12, 361, 313, 29875, 1273, 29871, 29896, 29900, 29900, 29900, 29900, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 12, 9675, 29889, 25393, 29889, 3539, 14182, 29878, 29905, 29916, 29896, 29890, 29961, 29968, 13035, 3539, 7743, 376, 718, 474, 17255, 710, 1649, 3101, 13, 12, 29871, 12, 12, 9675, 29889, 25393, 29889, 23126, 580, 13, 13, 12, 29872, 29918, 2230, 353, 931, 29889, 2230, 580, 13, 12, 2158, 5124, 13, 12, 2158, 376, 807, 29958, 2798, 29901, 29966, 29995, 29875, 10202, 18253, 931, 29901, 29966, 29995, 29875, 10202, 1273, 29875, 29914, 3471, 29905, 29876, 29908, 29871, 1273, 29898, 29883, 29892, 321, 29918, 2230, 448, 269, 29918, 2230, 29892, 274, 847, 313, 29872, 29918, 2230, 448, 269, 29918, 2230, 876, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 12, 361, 313, 2435, 29898, 9675, 29889, 19218, 29897, 1405, 29871, 29906, 1125, 13, 12, 12, 361, 313, 9675, 29889, 19218, 29961, 29896, 29962, 1275, 376, 3539, 29908, 1125, 13, 12, 12, 12, 2585, 353, 302, 404, 29918, 3150, 703, 1688, 1159, 13, 12, 12, 12, 2264, 29918, 3539, 29898, 2585, 29892, 938, 29898, 9675, 29889, 19218, 29961, 29906, 12622, 13, 12, 12, 12, 2585, 29889, 2585, 29918, 5358, 580, 13, 12, 2870, 29901, 13, 12, 12, 2158, 376, 1688, 29889, 2272, 2436, 529, 2798, 11903, 13, 13, 2 ]
app/run.py
bollwyvl/blockd3
33
101699
<filename>app/run.py #!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import logging from ghost import GhostTestCase, Ghost from app import make_app app = make_app("test") PORT = 5000 base_url = "http://localhost:%s/dist/" % PORT class Blockd3GhostTest(GhostTestCase): port = PORT display = False log_level = logging.INFO def __new__(cls, *args, **kwargs): """Creates Ghost instance.""" if not hasattr(cls, 'ghost'): cls.ghost = Ghost(display=cls.display, wait_timeout=10, viewport_size=cls.viewport_size, log_level=cls.log_level) return super(Blockd3GhostTest, cls).__new__(cls, *args, **kwargs) @classmethod def create_app(cls): return app def test_open(self): """ Test that the page loads """ page, resources = self.ghost.open(base_url) self.assertEqual(page.url, base_url) self.ghost.click("#run") if __name__ == "__main__": unittest.main()
[ 1, 529, 9507, 29958, 932, 29914, 3389, 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, 5215, 443, 27958, 13, 5215, 12183, 13, 13, 3166, 330, 3069, 1053, 28484, 3057, 8259, 29892, 28484, 13, 3166, 623, 1053, 1207, 29918, 932, 13, 13, 932, 353, 1207, 29918, 932, 703, 1688, 1159, 13, 13, 15082, 353, 29871, 29945, 29900, 29900, 29900, 13, 13, 3188, 29918, 2271, 353, 376, 1124, 597, 7640, 16664, 29879, 29914, 5721, 12975, 1273, 349, 8476, 13, 13, 1990, 15658, 29881, 29941, 29954, 3069, 3057, 29898, 29954, 3069, 3057, 8259, 1125, 13, 1678, 2011, 353, 349, 8476, 13, 1678, 2479, 353, 7700, 13, 1678, 1480, 29918, 5563, 353, 12183, 29889, 11690, 13, 13, 1678, 822, 4770, 1482, 12035, 25932, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 4706, 9995, 9832, 1078, 28484, 2777, 1213, 15945, 13, 4706, 565, 451, 756, 5552, 29898, 25932, 29892, 525, 29887, 3069, 29374, 13, 9651, 1067, 29879, 29889, 29887, 3069, 353, 28484, 29898, 4990, 29922, 25932, 29889, 4990, 29892, 13, 18884, 4480, 29918, 15619, 29922, 29896, 29900, 29892, 13, 18884, 1776, 637, 29918, 2311, 29922, 25932, 29889, 1493, 637, 29918, 2311, 29892, 13, 18884, 1480, 29918, 5563, 29922, 25932, 29889, 1188, 29918, 5563, 29897, 13, 4706, 736, 2428, 29898, 7445, 29881, 29941, 29954, 3069, 3057, 29892, 1067, 29879, 467, 1649, 1482, 12035, 25932, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1653, 29918, 932, 29898, 25932, 1125, 13, 4706, 736, 623, 13, 13, 1678, 822, 1243, 29918, 3150, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 4321, 393, 278, 1813, 15376, 13, 4706, 9995, 13, 4706, 1813, 29892, 7788, 353, 1583, 29889, 29887, 3069, 29889, 3150, 29898, 3188, 29918, 2271, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 3488, 29889, 2271, 29892, 2967, 29918, 2271, 29897, 13, 308, 13, 4706, 1583, 29889, 29887, 3069, 29889, 3808, 14822, 3389, 1159, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 443, 27958, 29889, 3396, 580, 2 ]
preprocessing/generate_landmarks.py
huangjiadidi/dfdc_deepfake_challenge
499
1614671
import argparse import os from functools import partial from multiprocessing.pool import Pool os.environ["MKL_NUM_THREADS"] = "1" os.environ["NUMEXPR_NUM_THREADS"] = "1" os.environ["OMP_NUM_THREADS"] = "1" from tqdm import tqdm import cv2 cv2.ocl.setUseOpenCL(False) cv2.setNumThreads(0) from preprocessing.utils import get_original_video_paths from PIL import Image from facenet_pytorch.models.mtcnn import MTCNN import numpy as np detector = MTCNN(margin=0, thresholds=[0.65, 0.75, 0.75], device="cpu") def save_landmarks(ori_id, root_dir): ori_id = ori_id[:-4] ori_dir = os.path.join(root_dir, "crops", ori_id) landmark_dir = os.path.join(root_dir, "landmarks", ori_id) os.makedirs(landmark_dir, exist_ok=True) for frame in range(320): if frame % 10 != 0: continue for actor in range(2): image_id = "{}_{}.png".format(frame, actor) landmarks_id = "{}_{}".format(frame, actor) ori_path = os.path.join(ori_dir, image_id) landmark_path = os.path.join(landmark_dir, landmarks_id) if os.path.exists(ori_path): try: image_ori = cv2.imread(ori_path, cv2.IMREAD_COLOR)[...,::-1] frame_img = Image.fromarray(image_ori) batch_boxes, conf, landmarks = detector.detect(frame_img, landmarks=True) if landmarks is not None: landmarks = np.around(landmarks[0]).astype(np.int16) np.save(landmark_path, landmarks) except Exception as e: print(e) pass def parse_args(): parser = argparse.ArgumentParser( description="Extract image landmarks") parser.add_argument("--root-dir", help="root directory", default="/mnt/sota/datasets/deepfake") args = parser.parse_args() return args def main(): args = parse_args() ids = get_original_video_paths(args.root_dir, basename=True) os.makedirs(os.path.join(args.root_dir, "landmarks"), exist_ok=True) with Pool(processes=os.cpu_count()) as p: with tqdm(total=len(ids)) as pbar: func = partial(save_landmarks, root_dir=args.root_dir) for v in p.imap_unordered(func, ids): pbar.update() if __name__ == '__main__': main()
[ 1, 1053, 1852, 5510, 13, 5215, 2897, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 3166, 6674, 307, 985, 292, 29889, 10109, 1053, 28625, 13, 13, 13, 13, 359, 29889, 21813, 3366, 29924, 29968, 29931, 29918, 13967, 29918, 4690, 16310, 29903, 3108, 353, 376, 29896, 29908, 13, 359, 29889, 21813, 3366, 11601, 2303, 29990, 10593, 29918, 13967, 29918, 4690, 16310, 29903, 3108, 353, 376, 29896, 29908, 13, 359, 29889, 21813, 3366, 29949, 3580, 29918, 13967, 29918, 4690, 16310, 29903, 3108, 353, 376, 29896, 29908, 13, 13, 3166, 260, 29939, 18933, 1053, 260, 29939, 18933, 13, 13, 13, 5215, 13850, 29906, 13, 13, 11023, 29906, 29889, 542, 29880, 29889, 842, 11403, 6585, 6154, 29898, 8824, 29897, 13, 11023, 29906, 29889, 842, 8009, 4899, 29879, 29898, 29900, 29897, 13, 3166, 758, 19170, 29889, 13239, 1053, 679, 29918, 13492, 29918, 9641, 29918, 24772, 13, 13, 3166, 349, 6227, 1053, 7084, 13, 3166, 4024, 264, 300, 29918, 2272, 7345, 305, 29889, 9794, 29889, 4378, 29883, 15755, 1053, 341, 9472, 10262, 13, 5215, 12655, 408, 7442, 13, 13, 4801, 3019, 353, 341, 9472, 10262, 29898, 9264, 29922, 29900, 29892, 266, 3781, 3361, 11759, 29900, 29889, 29953, 29945, 29892, 29871, 29900, 29889, 29955, 29945, 29892, 29871, 29900, 29889, 29955, 29945, 1402, 4742, 543, 21970, 1159, 13, 13, 13, 1753, 4078, 29918, 1049, 22848, 29898, 4170, 29918, 333, 29892, 3876, 29918, 3972, 1125, 13, 1678, 470, 29875, 29918, 333, 353, 470, 29875, 29918, 333, 7503, 29899, 29946, 29962, 13, 1678, 470, 29875, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29918, 3972, 29892, 376, 24077, 567, 613, 470, 29875, 29918, 333, 29897, 13, 1678, 2982, 3502, 29918, 3972, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4632, 29918, 3972, 29892, 376, 1049, 22848, 613, 470, 29875, 29918, 333, 29897, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 1049, 3502, 29918, 3972, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 363, 3515, 297, 3464, 29898, 29941, 29906, 29900, 1125, 13, 4706, 565, 3515, 1273, 29871, 29896, 29900, 2804, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 363, 11339, 297, 3464, 29898, 29906, 1125, 13, 9651, 1967, 29918, 333, 353, 29850, 3227, 1836, 2732, 1642, 4830, 29898, 2557, 29892, 11339, 29897, 13, 9651, 2982, 22848, 29918, 333, 353, 29850, 3227, 29913, 1642, 4830, 29898, 2557, 29892, 11339, 29897, 13, 9651, 470, 29875, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4170, 29918, 3972, 29892, 1967, 29918, 333, 29897, 13, 9651, 2982, 3502, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1049, 3502, 29918, 3972, 29892, 2982, 22848, 29918, 333, 29897, 13, 13, 9651, 565, 2897, 29889, 2084, 29889, 9933, 29898, 4170, 29918, 2084, 1125, 13, 18884, 1018, 29901, 13, 462, 1678, 1967, 29918, 4170, 353, 13850, 29906, 29889, 326, 949, 29898, 4170, 29918, 2084, 29892, 13850, 29906, 29889, 7833, 16310, 29918, 15032, 1955, 9601, 16361, 1057, 29899, 29896, 29962, 13, 462, 1678, 3515, 29918, 2492, 353, 7084, 29889, 3166, 2378, 29898, 3027, 29918, 4170, 29897, 13, 462, 1678, 9853, 29918, 1884, 267, 29892, 1970, 29892, 2982, 22848, 353, 1439, 3019, 29889, 4801, 522, 29898, 2557, 29918, 2492, 29892, 2982, 22848, 29922, 5574, 29897, 13, 462, 1678, 565, 2982, 22848, 338, 451, 6213, 29901, 13, 462, 4706, 2982, 22848, 353, 7442, 29889, 11316, 29898, 1049, 22848, 29961, 29900, 14664, 579, 668, 29898, 9302, 29889, 524, 29896, 29953, 29897, 13, 462, 4706, 7442, 29889, 7620, 29898, 1049, 3502, 29918, 2084, 29892, 2982, 22848, 29897, 13, 18884, 5174, 8960, 408, 321, 29901, 13, 462, 1678, 1596, 29898, 29872, 29897, 13, 462, 1678, 1209, 13, 13, 13, 1753, 6088, 29918, 5085, 7295, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 13, 4706, 6139, 543, 5647, 1461, 1967, 2982, 22848, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 4632, 29899, 3972, 613, 1371, 543, 4632, 3884, 613, 2322, 13802, 29885, 593, 29914, 29879, 4616, 29914, 14538, 1691, 29914, 24535, 29888, 1296, 1159, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 736, 6389, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 6389, 353, 6088, 29918, 5085, 580, 13, 1678, 18999, 353, 679, 29918, 13492, 29918, 9641, 29918, 24772, 29898, 5085, 29889, 4632, 29918, 3972, 29892, 2362, 3871, 29922, 5574, 29897, 13, 1678, 2897, 29889, 29885, 12535, 12935, 29898, 359, 29889, 2084, 29889, 7122, 29898, 5085, 29889, 4632, 29918, 3972, 29892, 376, 1049, 22848, 4968, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 411, 28625, 29898, 5014, 267, 29922, 359, 29889, 21970, 29918, 2798, 3101, 408, 282, 29901, 13, 4706, 411, 260, 29939, 18933, 29898, 7827, 29922, 2435, 29898, 4841, 876, 408, 282, 1646, 29901, 13, 9651, 3653, 353, 7687, 29898, 7620, 29918, 1049, 22848, 29892, 3876, 29918, 3972, 29922, 5085, 29889, 4632, 29918, 3972, 29897, 13, 9651, 363, 325, 297, 282, 29889, 326, 481, 29918, 348, 21693, 29898, 9891, 29892, 18999, 1125, 13, 18884, 282, 1646, 29889, 5504, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
run.py
jonasstenling/bumper
0
90593
''' This module is used to test the project implementation from the command line ''' from ruleset import RuleSet from ciscoconfparse import CiscoConfParse def load_config(config_file): '''Returns parse configuration as CiscoConfParse object.''' return CiscoConfParse(config_file) def main(): '''Main entry point for module.''' config = load_config('test.conf') myrules = RuleSet() myrules.load_rules('syntax.yml') myresult = [] for rule in myrules.rules: result = rule.apply(config) for element in result: if element.result == False: print "Rule evaluation failed:\n Cfgline: '{}'\n Rule: {}".format( element.cfgline.text, element.rule) myresult.append(result) return myresult if __name__ == '__main__': main()
[ 1, 14550, 13, 4013, 3883, 338, 1304, 304, 1243, 278, 2060, 5314, 515, 278, 1899, 13, 1220, 13, 12008, 13, 3166, 6865, 300, 1053, 27308, 2697, 13, 3166, 274, 275, 1111, 5527, 5510, 1053, 315, 275, 1111, 16376, 12914, 13, 13, 1753, 2254, 29918, 2917, 29898, 2917, 29918, 1445, 1125, 13, 1678, 14550, 11609, 29879, 6088, 5285, 408, 315, 275, 1111, 16376, 12914, 1203, 29889, 12008, 13, 1678, 736, 315, 275, 1111, 16376, 12914, 29898, 2917, 29918, 1445, 29897, 13, 13, 1753, 1667, 7295, 13, 1678, 14550, 6330, 6251, 1298, 363, 3883, 29889, 12008, 13, 13, 1678, 2295, 353, 2254, 29918, 2917, 877, 1688, 29889, 5527, 1495, 13, 1678, 590, 19238, 353, 27308, 2697, 580, 13, 1678, 590, 19238, 29889, 1359, 29918, 19238, 877, 29562, 29889, 21053, 1495, 13, 1678, 590, 2914, 353, 5159, 13, 13, 1678, 363, 5751, 297, 590, 19238, 29889, 19238, 29901, 13, 4706, 1121, 353, 5751, 29889, 7302, 29898, 2917, 29897, 13, 4706, 363, 1543, 297, 1121, 29901, 13, 9651, 565, 1543, 29889, 2914, 1275, 7700, 29901, 13, 18884, 1596, 376, 10740, 17983, 5229, 3583, 29876, 315, 16434, 1220, 29901, 525, 8875, 12764, 29876, 27308, 29901, 6571, 1642, 4830, 29898, 13, 462, 1678, 1543, 29889, 16859, 1220, 29889, 726, 29892, 13, 462, 1678, 1543, 29889, 7491, 29897, 13, 4706, 590, 2914, 29889, 4397, 29898, 2914, 29897, 13, 1678, 736, 590, 2914, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
sandbox/lib/jumpscale/JumpScale9Lib/clients/atyourservice/setup.py
Jumpscale/sandbox_linux
2
158923
from setuptools import setup, find_packages # To use a consistent encoding from codecs import open from os import path here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.md'), encoding='utf-8') as f: long_description = f.read() setup ( name='ays', version='0.9', description='Python client for the AYS RESTful API', long_description=long_description, url='https://github.com/jumpscale/lib9', author='<NAME>', author_email='<EMAIL>', license='Apache 2.0', packages=['ays'], install_requires=[], )
[ 1, 515, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 29937, 1763, 671, 263, 13747, 8025, 13, 3166, 775, 2395, 1053, 1722, 13, 3166, 2897, 1053, 2224, 13, 13, 4150, 353, 2224, 29889, 370, 1028, 493, 29898, 2084, 29889, 25721, 22168, 1445, 1649, 876, 13, 13, 29937, 3617, 278, 1472, 6139, 515, 278, 5195, 3035, 2303, 934, 13, 2541, 1722, 29898, 2084, 29889, 7122, 29898, 4150, 29892, 525, 16310, 2303, 29889, 3487, 5477, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 1678, 1472, 29918, 8216, 353, 285, 29889, 949, 580, 13, 13, 14669, 313, 13, 1678, 1024, 2433, 1036, 742, 13, 1678, 1873, 2433, 29900, 29889, 29929, 742, 13, 1678, 6139, 2433, 11980, 3132, 363, 278, 319, 21554, 16759, 1319, 3450, 742, 13, 1678, 1472, 29918, 8216, 29922, 5426, 29918, 8216, 29892, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29926, 17204, 29883, 744, 29914, 1982, 29929, 742, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 1678, 19405, 2433, 17396, 1829, 29871, 29906, 29889, 29900, 742, 13, 1678, 9741, 29922, 1839, 1036, 7464, 13, 1678, 2601, 29918, 276, 339, 2658, 11759, 1402, 13, 29897, 13, 2 ]
stroylux/main/export_import/__init__.py
vladkoblynsky/shop
0
131952
class ExportObjStatus: SUCCESS = 'success' ERROR = 'error' IN_PROGRESS = 'in_progress' CHOICES = [ (SUCCESS, 'Success'), (ERROR, 'Error'), (IN_PROGRESS, 'In progress'), ]
[ 1, 770, 1222, 637, 9930, 5709, 29901, 13, 1678, 20134, 26925, 353, 525, 8698, 29915, 13, 1678, 14431, 353, 525, 2704, 29915, 13, 1678, 2672, 29918, 8618, 29954, 26785, 353, 525, 262, 29918, 18035, 29915, 13, 13, 1678, 5868, 29949, 2965, 2890, 353, 518, 13, 4706, 313, 14605, 26925, 29892, 525, 14191, 5477, 13, 4706, 313, 11432, 29892, 525, 2392, 5477, 13, 4706, 313, 1177, 29918, 8618, 29954, 26785, 29892, 525, 797, 6728, 5477, 13, 1678, 4514, 13, 2 ]
hello/migrations/0002_auto_20201116_1409.py
chenyuan99/OwlSavesCats
0
24542
# Generated by Django 3.0.8 on 2020-11-16 19:09 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('hello', '0001_initial'), ] operations = [ migrations.CreateModel( name='Author', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('realname', models.CharField(max_length=64)), ('phone', models.CharField(max_length=16)), ('email', models.EmailField(max_length=254)), ('sign', models.BooleanField()), ('create_time', models.DateTimeField(auto_now=True)), ], options={ 'ordering': ['-id'], }, ), migrations.CreateModel( name='paperclip', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=200)), ('abstract', models.CharField(max_length=200)), ('publish_time', models.DateTimeField()), ('create_time', models.DateTimeField(auto_now=True)), ('pid', models.CharField(max_length=16)), ], ), migrations.AlterUniqueTogether( name='guest', unique_together=None, ), migrations.RemoveField( model_name='guest', name='event', ), migrations.DeleteModel( name='Event', ), migrations.DeleteModel( name='Guest', ), migrations.AddField( model_name='author', name='paperclip', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='hello.paperclip'), ), migrations.AlterUniqueTogether( name='author', unique_together={('phone', 'paperclip')}, ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29941, 29889, 29900, 29889, 29947, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29896, 29896, 29899, 29896, 29953, 29871, 29896, 29929, 29901, 29900, 29929, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 12199, 742, 525, 29900, 29900, 29900, 29896, 29918, 11228, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 13720, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 6370, 978, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29953, 29946, 8243, 13, 18884, 6702, 6710, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29953, 8243, 13, 18884, 6702, 5269, 742, 4733, 29889, 9823, 3073, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29946, 8243, 13, 18884, 6702, 4530, 742, 4733, 29889, 18146, 3073, 25739, 13, 18884, 6702, 3258, 29918, 2230, 742, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 8243, 13, 9651, 21251, 13, 9651, 3987, 3790, 13, 18884, 525, 2098, 292, 2396, 6024, 29899, 333, 7464, 13, 9651, 2981, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 29886, 481, 6269, 3466, 742, 13, 9651, 4235, 11759, 13, 18884, 6702, 333, 742, 4733, 29889, 12300, 3073, 29898, 6921, 29918, 11600, 29922, 5574, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 29892, 26952, 29918, 978, 2433, 1367, 1495, 511, 13, 18884, 6702, 3257, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 8243, 13, 18884, 6702, 16595, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 8243, 13, 18884, 6702, 23679, 29918, 2230, 742, 4733, 29889, 11384, 3073, 25739, 13, 18884, 6702, 3258, 29918, 2230, 742, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 8243, 13, 18884, 6702, 5935, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29953, 8243, 13, 9651, 21251, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 8110, 802, 29911, 12966, 29898, 13, 9651, 1024, 2433, 2543, 342, 742, 13, 9651, 5412, 29918, 29873, 12966, 29922, 8516, 29892, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 15941, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 2543, 342, 742, 13, 9651, 1024, 2433, 3696, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 12498, 3195, 29898, 13, 9651, 1024, 2433, 2624, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 12498, 3195, 29898, 13, 9651, 1024, 2433, 9485, 342, 742, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2528, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 8921, 742, 13, 9651, 1024, 2433, 29886, 481, 6269, 3466, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 265, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 12199, 29889, 29886, 481, 6269, 3466, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 8110, 802, 29911, 12966, 29898, 13, 9651, 1024, 2433, 8921, 742, 13, 9651, 5412, 29918, 29873, 12966, 3790, 877, 6710, 742, 525, 29886, 481, 6269, 3466, 1495, 1118, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
Chapter08/example3.py
jpgacrama/Mastering-Concurrency-in-Python
0
170972
<filename>Chapter08/example3.py # ch8/example3.py import cv2 import os # define our clear function def clear(): # for windows if os.name == 'nt': _ = os.system('cls') # for mac and linux(here, os.name is 'posix') else: _ = os.system('clear') if __name__ == '__main__': clear() cwd = os.getcwd() if os.name == 'nt': im = cv2.imread(os.path.join(cwd, 'Chapter08\input\ship.jpg')) else: im = cv2.imread(os.path.join(cwd, 'Chapter08/input/ship.jpg')) gray_im = cv2.cvtColor(im, cv2.COLOR_BGR2GRAY) ret, custom_thresh_im = cv2.threshold(gray_im, 127, 255, cv2.THRESH_BINARY) cv2.imwrite('output/custom_thresh_ship.jpg', custom_thresh_im) print('Done.')
[ 1, 529, 9507, 29958, 1451, 3314, 29900, 29947, 29914, 4773, 29941, 29889, 2272, 13, 29937, 521, 29947, 29914, 4773, 29941, 29889, 2272, 13, 13, 5215, 13850, 29906, 13, 5215, 2897, 13, 13, 29937, 4529, 1749, 2821, 740, 13, 1753, 2821, 7295, 13, 259, 13, 1678, 396, 363, 5417, 13, 1678, 565, 2897, 29889, 978, 1275, 525, 593, 2396, 13, 4706, 903, 353, 2897, 29889, 5205, 877, 25932, 1495, 13, 259, 13, 1678, 396, 363, 5825, 322, 10542, 29898, 4150, 29892, 2897, 29889, 978, 338, 525, 1066, 861, 1495, 13, 1678, 1683, 29901, 13, 4706, 903, 353, 2897, 29889, 5205, 877, 8551, 1495, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 2821, 580, 13, 1678, 274, 9970, 353, 2897, 29889, 657, 29883, 9970, 580, 13, 268, 13, 1678, 565, 2897, 29889, 978, 1275, 525, 593, 2396, 13, 4706, 527, 353, 13850, 29906, 29889, 326, 949, 29898, 359, 29889, 2084, 29889, 7122, 29898, 29883, 9970, 29892, 525, 1451, 3314, 29900, 29947, 29905, 2080, 29905, 3527, 29889, 6173, 8785, 13, 1678, 1683, 29901, 13, 4706, 527, 353, 13850, 29906, 29889, 326, 949, 29898, 359, 29889, 2084, 29889, 7122, 29898, 29883, 9970, 29892, 525, 1451, 3314, 29900, 29947, 29914, 2080, 29914, 3527, 29889, 6173, 8785, 13, 268, 13, 1678, 16749, 29918, 326, 353, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 326, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 29933, 14345, 29906, 29954, 22800, 29897, 13, 13, 1678, 3240, 29892, 2888, 29918, 386, 3781, 29918, 326, 353, 13850, 29906, 29889, 386, 12268, 29898, 21012, 29918, 326, 29892, 29871, 29896, 29906, 29955, 29892, 29871, 29906, 29945, 29945, 29892, 13850, 29906, 29889, 4690, 1525, 7068, 29918, 29933, 1177, 19926, 29897, 13, 1678, 13850, 29906, 29889, 326, 3539, 877, 4905, 29914, 6341, 29918, 386, 3781, 29918, 3527, 29889, 6173, 742, 2888, 29918, 386, 3781, 29918, 326, 29897, 13, 13, 1678, 1596, 877, 25632, 29889, 1495, 13, 2 ]
ACM ICPC/Math/gcd/gcd.py
shreejitverma/GeeksforGeeks
2
174727
<filename>ACM ICPC/Math/gcd/gcd.py def gcd(a,b): if a==0: return b else: return gcd(b%a,a) c = gcd(100,35) # c = 5 print(c)
[ 1, 529, 9507, 29958, 2477, 29924, 306, 6271, 29907, 29914, 11309, 29914, 29887, 2252, 29914, 29887, 2252, 29889, 2272, 13, 1753, 330, 2252, 29898, 29874, 29892, 29890, 1125, 13, 29871, 565, 263, 1360, 29900, 29901, 13, 1678, 736, 289, 13, 29871, 1683, 29901, 13, 1678, 736, 330, 2252, 29898, 29890, 29995, 29874, 29892, 29874, 29897, 13, 13, 29883, 353, 330, 2252, 29898, 29896, 29900, 29900, 29892, 29941, 29945, 29897, 396, 274, 353, 29871, 29945, 13, 2158, 29898, 29883, 29897, 1678, 13, 2 ]
validation.py
Jianxiang-Wang/Pytorch-code-for-time-series-classification
2
25149
from sklearn import metrics import torch from models import * import torch.backends.cudnn as cudnn import seaborn as sns import matplotlib.pyplot as plt from dataset import load #define the net device = 'cuda' if torch.cuda.is_available() else 'cpu' net = LSTM(3, 10, 2, 3) net = net.to(device) if device == 'cuda': net = torch.nn.DataParallel(net) cudnn.benchmark = True net.load_state_dict(torch.load('./checkpoint/ckpt.pth')) net = net.module #loading data _, _, valloader, classes = load() def validation(): print(net.classifier) #print(net) net.eval() correct = 0 total = 0 for batch_idx, (inputs, targets) in enumerate(valloader): inputs, targets = inputs.to(device).float(), targets.to(device) inputs = inputs.view(-1,300,3) outputs = net(inputs) # Confusion Matrix print("Confusion Matrix...") _, predicted = outputs.max(1) total += targets.size(0) correct += predicted.eq(targets).sum().item() Accuracy = 100.*correct/total predicted = predicted.cpu().numpy() targets = targets.data.cpu().numpy() cm = metrics.confusion_matrix(targets, predicted) print(cm) print('Accuracy=',Accuracy,"%") figure = plt.figure(figsize=(8, 8)) sns.heatmap(cm, annot=True, cmap='Blues') plt.ylim(0, 10) plt.xlabel('Predicted labels') plt.ylabel('True labels') plt.show() if __name__=='__main__': validation()
[ 1, 515, 2071, 19668, 1053, 21556, 13, 5215, 4842, 305, 13, 3166, 4733, 1053, 334, 13, 5215, 4842, 305, 29889, 1627, 1975, 29889, 29883, 566, 15755, 408, 274, 566, 15755, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 8783, 1053, 2254, 13, 13, 29937, 7922, 278, 7787, 13, 10141, 353, 525, 29883, 6191, 29915, 565, 4842, 305, 29889, 29883, 6191, 29889, 275, 29918, 16515, 580, 1683, 525, 21970, 29915, 13, 13, 1212, 353, 365, 1254, 29924, 29898, 29941, 29892, 29871, 29896, 29900, 29892, 29871, 29906, 29892, 29871, 29941, 29897, 13, 13, 1212, 353, 7787, 29889, 517, 29898, 10141, 29897, 13, 361, 4742, 1275, 525, 29883, 6191, 2396, 13, 1678, 7787, 353, 4842, 305, 29889, 15755, 29889, 1469, 2177, 6553, 29898, 1212, 29897, 13, 1678, 274, 566, 15755, 29889, 1785, 16580, 353, 5852, 13, 1212, 29889, 1359, 29918, 3859, 29918, 8977, 29898, 7345, 305, 29889, 1359, 877, 6904, 3198, 3149, 29914, 384, 415, 29889, 29886, 386, 8785, 13, 1212, 353, 7787, 29889, 5453, 13, 13, 13, 29937, 13234, 848, 13, 3383, 17117, 659, 12657, 29892, 4413, 353, 2254, 580, 13, 13, 13, 1753, 8845, 7295, 13, 1678, 1596, 29898, 1212, 29889, 1990, 3709, 29897, 13, 1678, 396, 2158, 29898, 1212, 29897, 13, 1678, 7787, 29889, 14513, 580, 13, 1678, 1959, 353, 29871, 29900, 13, 1678, 3001, 353, 29871, 29900, 13, 1678, 363, 9853, 29918, 13140, 29892, 313, 2080, 29879, 29892, 22525, 29897, 297, 26985, 29898, 791, 12657, 1125, 13, 4706, 10970, 29892, 22525, 353, 10970, 29889, 517, 29898, 10141, 467, 7411, 3285, 22525, 29889, 517, 29898, 10141, 29897, 13, 4706, 10970, 353, 10970, 29889, 1493, 6278, 29896, 29892, 29941, 29900, 29900, 29892, 29941, 29897, 13, 4706, 14391, 353, 7787, 29898, 2080, 29879, 29897, 13, 1678, 396, 10811, 3958, 22513, 13, 1678, 1596, 703, 16376, 3958, 22513, 856, 1159, 13, 1678, 17117, 25383, 353, 14391, 29889, 3317, 29898, 29896, 29897, 13, 1678, 3001, 4619, 22525, 29889, 2311, 29898, 29900, 29897, 13, 1678, 1959, 4619, 25383, 29889, 1837, 29898, 5182, 29879, 467, 2083, 2141, 667, 580, 13, 1678, 4831, 332, 4135, 353, 29871, 29896, 29900, 29900, 5575, 15728, 29914, 7827, 13, 13, 1678, 25383, 353, 25383, 29889, 21970, 2141, 23749, 580, 13, 1678, 22525, 353, 22525, 29889, 1272, 29889, 21970, 2141, 23749, 580, 13, 1678, 7477, 353, 21556, 29889, 5527, 3958, 29918, 5344, 29898, 5182, 29879, 29892, 25383, 29897, 13, 1678, 1596, 29898, 4912, 29897, 13, 1678, 1596, 877, 7504, 332, 4135, 29922, 742, 7504, 332, 4135, 1699, 29995, 1159, 13, 1678, 4377, 353, 14770, 29889, 4532, 29898, 1003, 2311, 7607, 29947, 29892, 29871, 29947, 876, 13, 1678, 269, 1983, 29889, 354, 271, 1958, 29898, 4912, 29892, 9732, 29922, 5574, 29892, 274, 1958, 2433, 10358, 1041, 1495, 13, 13, 1678, 14770, 29889, 29891, 2576, 29898, 29900, 29892, 29871, 29896, 29900, 29897, 13, 1678, 14770, 29889, 29916, 1643, 877, 23084, 18186, 11073, 1495, 13, 1678, 14770, 29889, 29891, 1643, 877, 5574, 11073, 1495, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 361, 4770, 978, 1649, 1360, 29915, 1649, 3396, 1649, 2396, 13, 1678, 8845, 580, 13, 13, 13, 2 ]
tests/test_agents.py
RamanKishoreSingh/pyriad
1
1604124
import torch from . import factories def test_base_agent_initialize(): agent = factories.PSOAgentFactory.create() swarm = factories.SwarmFactory.create() data = torch.tensor([ [3.0, 3.0, 3.0], [1.0, 1.0, 1.0], [2.0, 2.0, 2.0], ]) agent.initialize(data=data, swarm=swarm) if not agent.swarm == swarm: raise AssertionError() if not len(agent.centroids) == agent.n_clusters: raise AssertionError() def test_base_agent_memorize(): agent = factories.PSOAgentFactory.create() tensor = torch.tensor([3.0, 3.0, 3.0]) agent.memorize(score=1, position=tensor) if not torch.all(torch.eq(tensor, agent.memory.memory[0][1])) == True: raise AssertionError() def test_base_agent_topk(): agent = factories.PSOAgentFactory.create() tensor = torch.tensor([3.0, 3.0, 3.0]) agent.memorize(score=1, position=tensor) topk = agent.topk(k=1)[0] if not torch.all(torch.eq(tensor, topk)) == True: raise AssertionError()
[ 1, 1053, 4842, 305, 13, 3166, 869, 1053, 2114, 3842, 13, 13, 13, 1753, 1243, 29918, 3188, 29918, 14748, 29918, 24926, 7295, 13, 1678, 10823, 353, 2114, 3842, 29889, 29925, 6156, 19661, 5126, 29889, 3258, 580, 13, 1678, 2381, 2817, 353, 2114, 3842, 29889, 10840, 2817, 5126, 29889, 3258, 580, 13, 13, 1678, 848, 353, 4842, 305, 29889, 20158, 4197, 13, 4706, 518, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 1402, 13, 4706, 518, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 1402, 13, 4706, 518, 29906, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 29892, 29871, 29906, 29889, 29900, 1402, 13, 268, 2314, 13, 13, 1678, 10823, 29889, 24926, 29898, 1272, 29922, 1272, 29892, 2381, 2817, 29922, 2774, 2817, 29897, 13, 13, 1678, 565, 451, 10823, 29889, 2774, 2817, 1275, 2381, 2817, 29901, 13, 4706, 12020, 16499, 291, 2392, 580, 13, 1678, 565, 451, 7431, 29898, 14748, 29889, 1760, 1007, 29879, 29897, 1275, 10823, 29889, 29876, 29918, 695, 504, 414, 29901, 13, 4706, 12020, 16499, 291, 2392, 580, 13, 13, 13, 1753, 1243, 29918, 3188, 29918, 14748, 29918, 6954, 272, 675, 7295, 13, 1678, 10823, 353, 2114, 3842, 29889, 29925, 6156, 19661, 5126, 29889, 3258, 580, 13, 13, 1678, 12489, 353, 4842, 305, 29889, 20158, 4197, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 2314, 13, 1678, 10823, 29889, 6954, 272, 675, 29898, 13628, 29922, 29896, 29892, 2602, 29922, 20158, 29897, 13, 13, 1678, 565, 451, 4842, 305, 29889, 497, 29898, 7345, 305, 29889, 1837, 29898, 20158, 29892, 10823, 29889, 14834, 29889, 14834, 29961, 29900, 3816, 29896, 12622, 1275, 5852, 29901, 13, 4706, 12020, 16499, 291, 2392, 580, 13, 13, 13, 1753, 1243, 29918, 3188, 29918, 14748, 29918, 3332, 29895, 7295, 13, 1678, 10823, 353, 2114, 3842, 29889, 29925, 6156, 19661, 5126, 29889, 3258, 580, 13, 13, 1678, 12489, 353, 4842, 305, 29889, 20158, 4197, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 29892, 29871, 29941, 29889, 29900, 2314, 13, 1678, 10823, 29889, 6954, 272, 675, 29898, 13628, 29922, 29896, 29892, 2602, 29922, 20158, 29897, 13, 1678, 2246, 29895, 353, 10823, 29889, 3332, 29895, 29898, 29895, 29922, 29896, 9601, 29900, 29962, 13, 13, 1678, 565, 451, 4842, 305, 29889, 497, 29898, 7345, 305, 29889, 1837, 29898, 20158, 29892, 2246, 29895, 876, 1275, 5852, 29901, 13, 4706, 12020, 16499, 291, 2392, 580, 13, 13, 13, 2 ]
sdk/luminesce/models/background_query_cancel_response.py
finbourne/luminesce-sdk-python-preview
0
130961
# coding: utf-8 """ FINBOURNE Honeycomb Web API FINBOURNE Technology # noqa: E501 The version of the OpenAPI document: 1.9.129 Contact: <EMAIL> Generated by: https://openapi-generator.tech """ try: from inspect import getfullargspec except ImportError: from inspect import getargspec as getfullargspec import pprint import re # noqa: F401 import six from luminesce.configuration import Configuration class BackgroundQueryCancelResponse(object): """NOTE: This class is auto generated by OpenAPI Generator. Ref: https://openapi-generator.tech Do not edit the class manually. """ """ Attributes: openapi_types (dict): The key is attribute name and the value is attribute type. attribute_map (dict): The key is attribute name and the value is json key in definition. required_map (dict): The key is attribute name and the value is whether it is 'required' or 'optional'. """ openapi_types = { 'had_data': 'bool', 'previous_status': 'TaskStatus', 'previous_state': 'BackgroundQueryState', 'progress': 'str' } attribute_map = { 'had_data': 'hadData', 'previous_status': 'previousStatus', 'previous_state': 'previousState', 'progress': 'progress' } required_map = { 'had_data': 'optional', 'previous_status': 'optional', 'previous_state': 'optional', 'progress': 'optional' } def __init__(self, had_data=None, previous_status=None, previous_state=None, progress=None, local_vars_configuration=None): # noqa: E501 """BackgroundQueryCancelResponse - a model defined in OpenAPI" :param had_data: :type had_data: bool :param previous_status: :type previous_status: luminesce.TaskStatus :param previous_state: :type previous_state: luminesce.BackgroundQueryState :param progress: :type progress: str """ # noqa: E501 if local_vars_configuration is None: local_vars_configuration = Configuration.get_default_copy() self.local_vars_configuration = local_vars_configuration self._had_data = None self._previous_status = None self._previous_state = None self._progress = None self.discriminator = None if had_data is not None: self.had_data = had_data if previous_status is not None: self.previous_status = previous_status if previous_state is not None: self.previous_state = previous_state self.progress = progress @property def had_data(self): """Gets the had_data of this BackgroundQueryCancelResponse. # noqa: E501 :return: The had_data of this BackgroundQueryCancelResponse. # noqa: E501 :rtype: bool """ return self._had_data @had_data.setter def had_data(self, had_data): """Sets the had_data of this BackgroundQueryCancelResponse. :param had_data: The had_data of this BackgroundQueryCancelResponse. # noqa: E501 :type had_data: bool """ self._had_data = had_data @property def previous_status(self): """Gets the previous_status of this BackgroundQueryCancelResponse. # noqa: E501 :return: The previous_status of this BackgroundQueryCancelResponse. # noqa: E501 :rtype: luminesce.TaskStatus """ return self._previous_status @previous_status.setter def previous_status(self, previous_status): """Sets the previous_status of this BackgroundQueryCancelResponse. :param previous_status: The previous_status of this BackgroundQueryCancelResponse. # noqa: E501 :type previous_status: luminesce.TaskStatus """ self._previous_status = previous_status @property def previous_state(self): """Gets the previous_state of this BackgroundQueryCancelResponse. # noqa: E501 :return: The previous_state of this BackgroundQueryCancelResponse. # noqa: E501 :rtype: luminesce.BackgroundQueryState """ return self._previous_state @previous_state.setter def previous_state(self, previous_state): """Sets the previous_state of this BackgroundQueryCancelResponse. :param previous_state: The previous_state of this BackgroundQueryCancelResponse. # noqa: E501 :type previous_state: luminesce.BackgroundQueryState """ self._previous_state = previous_state @property def progress(self): """Gets the progress of this BackgroundQueryCancelResponse. # noqa: E501 :return: The progress of this BackgroundQueryCancelResponse. # noqa: E501 :rtype: str """ return self._progress @progress.setter def progress(self, progress): """Sets the progress of this BackgroundQueryCancelResponse. :param progress: The progress of this BackgroundQueryCancelResponse. # noqa: E501 :type progress: str """ self._progress = progress def to_dict(self, serialize=False): """Returns the model properties as a dict""" result = {} def convert(x): if hasattr(x, "to_dict"): args = getfullargspec(x.to_dict).args if len(args) == 1: return x.to_dict() else: return x.to_dict(serialize) else: return x for attr, _ in six.iteritems(self.openapi_types): value = getattr(self, attr) attr = self.attribute_map.get(attr, attr) if serialize else attr if isinstance(value, list): result[attr] = list(map( lambda x: convert(x), value )) elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], convert(item[1])), value.items() )) else: result[attr] = convert(value) return result def to_str(self): """Returns the string representation of the model""" return pprint.pformat(self.to_dict()) def __repr__(self): """For `print` and `pprint`""" return self.to_str() def __eq__(self, other): """Returns true if both objects are equal""" if not isinstance(other, BackgroundQueryCancelResponse): return False return self.to_dict() == other.to_dict() def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, BackgroundQueryCancelResponse): return True return self.to_dict() != other.to_dict()
[ 1, 396, 14137, 29901, 23616, 29899, 29947, 13, 13, 15945, 29908, 13, 1678, 383, 1177, 8456, 4574, 8186, 379, 4992, 17743, 2563, 3450, 13, 13, 1678, 383, 1177, 8456, 4574, 8186, 17968, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 1678, 450, 1873, 310, 278, 4673, 8787, 1842, 29901, 29871, 29896, 29889, 29929, 29889, 29896, 29906, 29929, 13, 1678, 22387, 29901, 529, 26862, 6227, 29958, 13, 1678, 3251, 630, 491, 29901, 2045, 597, 3150, 2754, 29899, 27959, 29889, 11345, 13, 15945, 29908, 13, 13, 13, 2202, 29901, 13, 1678, 515, 16096, 1053, 679, 8159, 5085, 3135, 13, 19499, 16032, 2392, 29901, 13, 1678, 515, 16096, 1053, 679, 5085, 3135, 408, 679, 8159, 5085, 3135, 13, 5215, 282, 2158, 13, 5215, 337, 29871, 396, 694, 25621, 29901, 383, 29946, 29900, 29896, 13, 5215, 4832, 13, 13, 3166, 19703, 1475, 346, 29889, 13305, 1053, 20999, 13, 13, 13, 1990, 16585, 3010, 19420, 5103, 29898, 3318, 1125, 13, 1678, 9995, 12256, 29923, 29901, 910, 770, 338, 4469, 5759, 491, 4673, 8787, 3251, 1061, 29889, 13, 1678, 9897, 29901, 2045, 597, 3150, 2754, 29899, 27959, 29889, 11345, 13, 13, 1678, 1938, 451, 3863, 278, 770, 7522, 29889, 13, 1678, 9995, 13, 13, 1678, 9995, 13, 1678, 6212, 5026, 29901, 13, 418, 1722, 2754, 29918, 8768, 313, 8977, 1125, 450, 1820, 338, 5352, 1024, 13, 462, 9651, 322, 278, 995, 338, 5352, 1134, 29889, 13, 418, 5352, 29918, 1958, 313, 8977, 1125, 450, 1820, 338, 5352, 1024, 13, 462, 9651, 322, 278, 995, 338, 4390, 1820, 297, 5023, 29889, 13, 418, 3734, 29918, 1958, 313, 8977, 1125, 450, 1820, 338, 5352, 1024, 13, 462, 965, 322, 278, 995, 338, 3692, 372, 338, 525, 12403, 29915, 470, 525, 25253, 4286, 13, 1678, 9995, 13, 1678, 1722, 2754, 29918, 8768, 353, 426, 13, 4706, 525, 21312, 29918, 1272, 2396, 525, 11227, 742, 13, 4706, 525, 24957, 29918, 4882, 2396, 525, 5398, 5709, 742, 13, 4706, 525, 24957, 29918, 3859, 2396, 525, 10581, 3010, 2792, 742, 13, 4706, 525, 18035, 2396, 525, 710, 29915, 13, 1678, 500, 13, 13, 1678, 5352, 29918, 1958, 353, 426, 13, 4706, 525, 21312, 29918, 1272, 2396, 525, 21312, 1469, 742, 13, 4706, 525, 24957, 29918, 4882, 2396, 525, 24957, 5709, 742, 13, 4706, 525, 24957, 29918, 3859, 2396, 525, 24957, 2792, 742, 13, 4706, 525, 18035, 2396, 525, 18035, 29915, 13, 1678, 500, 13, 13, 1678, 3734, 29918, 1958, 353, 426, 13, 4706, 525, 21312, 29918, 1272, 2396, 525, 25253, 742, 13, 4706, 525, 24957, 29918, 4882, 2396, 525, 25253, 742, 13, 4706, 525, 24957, 29918, 3859, 2396, 525, 25253, 742, 13, 4706, 525, 18035, 2396, 525, 25253, 29915, 13, 1678, 500, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 750, 29918, 1272, 29922, 8516, 29892, 3517, 29918, 4882, 29922, 8516, 29892, 3517, 29918, 3859, 29922, 8516, 29892, 6728, 29922, 8516, 29892, 1887, 29918, 16908, 29918, 13305, 29922, 8516, 1125, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 9995, 10581, 3010, 19420, 5103, 448, 263, 1904, 3342, 297, 4673, 8787, 29908, 13, 308, 13, 4706, 584, 3207, 750, 29918, 1272, 29901, 29871, 13, 4706, 584, 1853, 750, 29918, 1272, 29901, 6120, 13, 4706, 584, 3207, 3517, 29918, 4882, 29901, 29871, 13, 4706, 584, 1853, 3517, 29918, 4882, 29901, 19703, 1475, 346, 29889, 5398, 5709, 13, 4706, 584, 3207, 3517, 29918, 3859, 29901, 29871, 13, 4706, 584, 1853, 3517, 29918, 3859, 29901, 19703, 1475, 346, 29889, 10581, 3010, 2792, 13, 4706, 584, 3207, 6728, 29901, 29871, 13, 4706, 584, 1853, 6728, 29901, 851, 13, 13, 4706, 9995, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 565, 1887, 29918, 16908, 29918, 13305, 338, 6213, 29901, 13, 9651, 1887, 29918, 16908, 29918, 13305, 353, 20999, 29889, 657, 29918, 4381, 29918, 8552, 580, 13, 4706, 1583, 29889, 2997, 29918, 16908, 29918, 13305, 353, 1887, 29918, 16908, 29918, 13305, 13, 13, 4706, 1583, 3032, 21312, 29918, 1272, 353, 6213, 13, 4706, 1583, 3032, 24957, 29918, 4882, 353, 6213, 13, 4706, 1583, 3032, 24957, 29918, 3859, 353, 6213, 13, 4706, 1583, 3032, 18035, 353, 6213, 13, 4706, 1583, 29889, 2218, 29883, 20386, 1061, 353, 6213, 13, 13, 4706, 565, 750, 29918, 1272, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 21312, 29918, 1272, 353, 750, 29918, 1272, 13, 4706, 565, 3517, 29918, 4882, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 24957, 29918, 4882, 353, 3517, 29918, 4882, 13, 4706, 565, 3517, 29918, 3859, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 24957, 29918, 3859, 353, 3517, 29918, 3859, 13, 4706, 1583, 29889, 18035, 353, 6728, 13, 13, 1678, 732, 6799, 13, 1678, 822, 750, 29918, 1272, 29898, 1311, 1125, 13, 4706, 9995, 29954, 1691, 278, 750, 29918, 1272, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 13, 4706, 584, 2457, 29901, 450, 750, 29918, 1272, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 29878, 1853, 29901, 6120, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 21312, 29918, 1272, 13, 13, 1678, 732, 21312, 29918, 1272, 29889, 842, 357, 13, 1678, 822, 750, 29918, 1272, 29898, 1311, 29892, 750, 29918, 1272, 1125, 13, 4706, 9995, 29903, 1691, 278, 750, 29918, 1272, 310, 445, 16585, 3010, 19420, 5103, 29889, 13, 13, 13, 4706, 584, 3207, 750, 29918, 1272, 29901, 450, 750, 29918, 1272, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 1853, 750, 29918, 1272, 29901, 6120, 13, 4706, 9995, 13, 13, 4706, 1583, 3032, 21312, 29918, 1272, 353, 750, 29918, 1272, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3517, 29918, 4882, 29898, 1311, 1125, 13, 4706, 9995, 29954, 1691, 278, 3517, 29918, 4882, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 13, 4706, 584, 2457, 29901, 450, 3517, 29918, 4882, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 29878, 1853, 29901, 19703, 1475, 346, 29889, 5398, 5709, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 24957, 29918, 4882, 13, 13, 1678, 732, 24957, 29918, 4882, 29889, 842, 357, 13, 1678, 822, 3517, 29918, 4882, 29898, 1311, 29892, 3517, 29918, 4882, 1125, 13, 4706, 9995, 29903, 1691, 278, 3517, 29918, 4882, 310, 445, 16585, 3010, 19420, 5103, 29889, 13, 13, 13, 4706, 584, 3207, 3517, 29918, 4882, 29901, 450, 3517, 29918, 4882, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 1853, 3517, 29918, 4882, 29901, 19703, 1475, 346, 29889, 5398, 5709, 13, 4706, 9995, 13, 13, 4706, 1583, 3032, 24957, 29918, 4882, 353, 3517, 29918, 4882, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3517, 29918, 3859, 29898, 1311, 1125, 13, 4706, 9995, 29954, 1691, 278, 3517, 29918, 3859, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 13, 4706, 584, 2457, 29901, 450, 3517, 29918, 3859, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 29878, 1853, 29901, 19703, 1475, 346, 29889, 10581, 3010, 2792, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 24957, 29918, 3859, 13, 13, 1678, 732, 24957, 29918, 3859, 29889, 842, 357, 13, 1678, 822, 3517, 29918, 3859, 29898, 1311, 29892, 3517, 29918, 3859, 1125, 13, 4706, 9995, 29903, 1691, 278, 3517, 29918, 3859, 310, 445, 16585, 3010, 19420, 5103, 29889, 13, 13, 13, 4706, 584, 3207, 3517, 29918, 3859, 29901, 450, 3517, 29918, 3859, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 1853, 3517, 29918, 3859, 29901, 19703, 1475, 346, 29889, 10581, 3010, 2792, 13, 4706, 9995, 13, 13, 4706, 1583, 3032, 24957, 29918, 3859, 353, 3517, 29918, 3859, 13, 13, 1678, 732, 6799, 13, 1678, 822, 6728, 29898, 1311, 1125, 13, 4706, 9995, 29954, 1691, 278, 6728, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 13, 13, 4706, 584, 2457, 29901, 450, 6728, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 29878, 1853, 29901, 851, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 18035, 13, 13, 1678, 732, 18035, 29889, 842, 357, 13, 1678, 822, 6728, 29898, 1311, 29892, 6728, 1125, 13, 4706, 9995, 29903, 1691, 278, 6728, 310, 445, 16585, 3010, 19420, 5103, 29889, 13, 13, 13, 4706, 584, 3207, 6728, 29901, 450, 6728, 310, 445, 16585, 3010, 19420, 5103, 29889, 29871, 396, 694, 25621, 29901, 382, 29945, 29900, 29896, 13, 4706, 584, 1853, 6728, 29901, 851, 13, 4706, 9995, 13, 13, 4706, 1583, 3032, 18035, 353, 6728, 13, 13, 1678, 822, 304, 29918, 8977, 29898, 1311, 29892, 28755, 29922, 8824, 1125, 13, 4706, 9995, 11609, 29879, 278, 1904, 4426, 408, 263, 9657, 15945, 29908, 13, 4706, 1121, 353, 6571, 13, 13, 4706, 822, 3588, 29898, 29916, 1125, 13, 9651, 565, 756, 5552, 29898, 29916, 29892, 376, 517, 29918, 8977, 29908, 1125, 13, 18884, 6389, 353, 679, 8159, 5085, 3135, 29898, 29916, 29889, 517, 29918, 8977, 467, 5085, 13, 18884, 565, 7431, 29898, 5085, 29897, 1275, 29871, 29896, 29901, 13, 462, 1678, 736, 921, 29889, 517, 29918, 8977, 580, 13, 18884, 1683, 29901, 13, 462, 1678, 736, 921, 29889, 517, 29918, 8977, 29898, 643, 6646, 29897, 13, 9651, 1683, 29901, 13, 18884, 736, 921, 13, 13, 4706, 363, 12421, 29892, 903, 297, 4832, 29889, 1524, 7076, 29898, 1311, 29889, 3150, 2754, 29918, 8768, 1125, 13, 9651, 995, 353, 679, 5552, 29898, 1311, 29892, 12421, 29897, 13, 9651, 12421, 353, 1583, 29889, 12715, 29918, 1958, 29889, 657, 29898, 5552, 29892, 12421, 29897, 565, 28755, 1683, 12421, 13, 9651, 565, 338, 8758, 29898, 1767, 29892, 1051, 1125, 13, 18884, 1121, 29961, 5552, 29962, 353, 1051, 29898, 1958, 29898, 13, 462, 1678, 14013, 921, 29901, 3588, 29898, 29916, 511, 13, 462, 1678, 995, 13, 462, 876, 13, 9651, 25342, 338, 8758, 29898, 1767, 29892, 9657, 1125, 13, 18884, 1121, 29961, 5552, 29962, 353, 9657, 29898, 1958, 29898, 13, 462, 1678, 14013, 2944, 29901, 313, 667, 29961, 29900, 1402, 3588, 29898, 667, 29961, 29896, 2314, 511, 13, 462, 1678, 995, 29889, 7076, 580, 13, 462, 876, 13, 9651, 1683, 29901, 13, 18884, 1121, 29961, 5552, 29962, 353, 3588, 29898, 1767, 29897, 13, 13, 4706, 736, 1121, 13, 13, 1678, 822, 304, 29918, 710, 29898, 1311, 1125, 13, 4706, 9995, 11609, 29879, 278, 1347, 8954, 310, 278, 1904, 15945, 29908, 13, 4706, 736, 282, 2158, 29889, 29886, 4830, 29898, 1311, 29889, 517, 29918, 8977, 3101, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 9995, 2831, 421, 2158, 29952, 322, 421, 407, 29878, 524, 29952, 15945, 29908, 13, 4706, 736, 1583, 29889, 517, 29918, 710, 580, 13, 13, 1678, 822, 4770, 1837, 12035, 1311, 29892, 916, 1125, 13, 4706, 9995, 11609, 29879, 1565, 565, 1716, 3618, 526, 5186, 15945, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1228, 29892, 16585, 3010, 19420, 5103, 1125, 13, 9651, 736, 7700, 13, 13, 4706, 736, 1583, 29889, 517, 29918, 8977, 580, 1275, 916, 29889, 517, 29918, 8977, 580, 13, 13, 1678, 822, 4770, 484, 12035, 1311, 29892, 916, 1125, 13, 4706, 9995, 11609, 29879, 1565, 565, 1716, 3618, 526, 451, 5186, 15945, 29908, 13, 4706, 565, 451, 338, 8758, 29898, 1228, 29892, 16585, 3010, 19420, 5103, 1125, 13, 9651, 736, 5852, 13, 13, 4706, 736, 1583, 29889, 517, 29918, 8977, 580, 2804, 916, 29889, 517, 29918, 8977, 580, 13, 2 ]
main_app/needs/__init__.py
sashalavrus/cost_app
0
43350
from flask import Blueprint needs = Blueprint('needs', __name__) from . import views from ..models import Permission @needs.app_context_processor def inject_permissions(): return dict(Permission=Permission)
[ 1, 515, 29784, 1053, 10924, 2158, 13, 13, 484, 5779, 353, 10924, 2158, 877, 484, 5779, 742, 4770, 978, 1649, 29897, 13, 13, 3166, 869, 1053, 8386, 13, 3166, 6317, 9794, 1053, 20894, 2333, 13, 13, 13, 29992, 484, 5779, 29889, 932, 29918, 4703, 29918, 26482, 13, 1753, 11658, 29918, 17858, 6847, 7295, 13, 1678, 736, 9657, 29898, 27293, 29922, 27293, 29897, 13, 2 ]
include/visualize.py
MLI-lab/overparameterized_convolutional_generators
13
80083
<filename>include/visualize.py<gh_stars>10-100 import matplotlib.pyplot as plt from torch.autograd import Variable import torch import torch.optim import numpy as np from collections import Iterable dtype = torch.cuda.FloatTensor #dtype = torch.FloatTensor def save_np_img(img,filename): if(img.shape[0] == 1): plt.imshow(np.clip(img[0],0,1)) else: plt.imshow(np.clip(img.transpose(1, 2, 0),0,1)) plt.axis('off') plt.savefig(filename, bbox_inches='tight') plt.close() def apply_until(net_input,net,n = 100): # applies function by funtion of a network for i,fun in enumerate(net): if i>=n: break if i==0: out = fun(net_input.type(dtype)) else: out = fun(out) print(i, "last func. applied:", net[i-1]) if n == 0: return net_input else: return out from math import ceil # given a lists of images as np-arrays, plot them as a row# given def plot_image_grid(imgs,nrows=10): ncols = ceil( len(imgs)/nrows ) nrows = min(nrows,len(imgs)) fig, axes = plt.subplots(nrows=nrows, ncols=ncols, sharex=True, sharey=True,figsize=(ncols,nrows),squeeze=False) for i, row in enumerate(axes): for j, ax in enumerate(row): ax.imshow(imgs[j*nrows+i], cmap='Greys_r', interpolation='none') ax.get_xaxis().set_visible(False) ax.get_yaxis().set_visible(False) fig.tight_layout(pad=0.1) return fig def save_tensor(out,filename,nrows=8): imgs = [img for img in out.data.cpu().numpy()[0]] fig = plot_image_grid(imgs,nrows=nrows) plt.savefig(filename) plt.close() def plot_kernels(tensor): if not len(tensor.shape)==4: raise Exception("assumes a 4D tensor") num_kernels = tensor.shape[0] fig = plt.figure(figsize=(tensor.shape[0],tensor.shape[1])) for i in range(tensor.shape[0]): for j in range(tensor.shape[1]): ax1 = fig.add_subplot(tensor.shape[0],tensor.shape[1],1+i*tensor.shape[0]+j) ax1.imshow(tensor[i][j]) ax1.axis('off') ax1.set_xticklabels([]) ax1.set_yticklabels([]) plt.subplots_adjust(wspace=0.1, hspace=0.1) plt.show() def plot_tensor(out,nrows=8): imgs = [img for img in out.data.cpu().numpy()[0]] fig = plot_image_grid(imgs,nrows=nrows) plt.show()
[ 1, 529, 9507, 29958, 2856, 29914, 20119, 675, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 4842, 305, 29889, 1300, 468, 3665, 1053, 28736, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 20640, 13, 5215, 12655, 408, 7442, 13, 3166, 16250, 1053, 20504, 519, 13, 13, 13, 29881, 1853, 353, 4842, 305, 29889, 29883, 6191, 29889, 11031, 29911, 6073, 13, 29937, 29881, 1853, 353, 4842, 305, 29889, 11031, 29911, 6073, 13, 13, 1753, 4078, 29918, 9302, 29918, 2492, 29898, 2492, 29892, 9507, 1125, 13, 1678, 565, 29898, 2492, 29889, 12181, 29961, 29900, 29962, 1275, 29871, 29896, 1125, 13, 4706, 14770, 29889, 326, 4294, 29898, 9302, 29889, 24049, 29898, 2492, 29961, 29900, 1402, 29900, 29892, 29896, 876, 13, 1678, 1683, 29901, 13, 4706, 14770, 29889, 326, 4294, 29898, 9302, 29889, 24049, 29898, 2492, 29889, 3286, 4220, 29898, 29896, 29892, 29871, 29906, 29892, 29871, 29900, 511, 29900, 29892, 29896, 876, 13, 1678, 14770, 29889, 8990, 877, 2696, 1495, 13, 1678, 14770, 29889, 7620, 1003, 29898, 9507, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 13, 1678, 14770, 29889, 5358, 580, 13, 13, 1753, 3394, 29918, 29305, 29898, 1212, 29918, 2080, 29892, 1212, 29892, 29876, 353, 29871, 29896, 29900, 29900, 1125, 13, 1678, 396, 16058, 740, 491, 285, 1657, 291, 310, 263, 3564, 13, 1678, 363, 474, 29892, 7692, 297, 26985, 29898, 1212, 1125, 13, 4706, 565, 474, 18572, 29876, 29901, 13, 9651, 2867, 13, 4706, 565, 474, 1360, 29900, 29901, 13, 9651, 714, 353, 2090, 29898, 1212, 29918, 2080, 29889, 1853, 29898, 29881, 1853, 876, 13, 4706, 1683, 29901, 13, 9651, 714, 353, 2090, 29898, 449, 29897, 13, 1678, 1596, 29898, 29875, 29892, 376, 4230, 3653, 29889, 7436, 29901, 613, 7787, 29961, 29875, 29899, 29896, 2314, 13, 1678, 565, 302, 1275, 29871, 29900, 29901, 13, 4706, 736, 7787, 29918, 2080, 13, 1678, 1683, 29901, 13, 4706, 736, 714, 13, 13, 13, 3166, 5844, 1053, 2257, 309, 13, 13, 13, 29937, 2183, 263, 8857, 310, 4558, 408, 7442, 29899, 2378, 29879, 29892, 6492, 963, 408, 263, 1948, 29937, 2183, 29871, 13, 1753, 6492, 29918, 3027, 29918, 7720, 29898, 2492, 29879, 29892, 29876, 5727, 29922, 29896, 29900, 1125, 13, 1678, 302, 22724, 353, 2257, 309, 29898, 7431, 29898, 2492, 29879, 6802, 29876, 5727, 1723, 13, 1678, 302, 5727, 353, 1375, 29898, 29876, 5727, 29892, 2435, 29898, 2492, 29879, 876, 13, 1678, 2537, 29892, 27815, 353, 14770, 29889, 1491, 26762, 29898, 29876, 5727, 29922, 29876, 5727, 29892, 302, 22724, 29922, 29876, 22724, 29892, 6232, 29916, 29922, 5574, 29892, 6232, 29891, 29922, 5574, 29892, 1003, 2311, 7607, 29876, 22724, 29892, 29876, 5727, 511, 29879, 802, 29872, 911, 29922, 8824, 29897, 13, 1678, 363, 474, 29892, 1948, 297, 26985, 29898, 1165, 267, 1125, 13, 4706, 363, 432, 29892, 4853, 297, 26985, 29898, 798, 1125, 13, 9651, 4853, 29889, 326, 4294, 29898, 2492, 29879, 29961, 29926, 29930, 29876, 5727, 29974, 29875, 1402, 274, 1958, 2433, 25120, 952, 29918, 29878, 742, 29694, 2433, 9290, 1495, 13, 9651, 4853, 29889, 657, 29918, 29916, 8990, 2141, 842, 29918, 12872, 29898, 8824, 29897, 13, 9651, 4853, 29889, 657, 29918, 29891, 8990, 2141, 842, 29918, 12872, 29898, 8824, 29897, 13, 1678, 2537, 29889, 29873, 523, 29918, 2680, 29898, 8305, 29922, 29900, 29889, 29896, 29897, 13, 1678, 736, 2537, 13, 13, 1753, 4078, 29918, 20158, 29898, 449, 29892, 9507, 29892, 29876, 5727, 29922, 29947, 1125, 13, 1678, 527, 3174, 353, 518, 2492, 363, 10153, 297, 714, 29889, 1272, 29889, 21970, 2141, 23749, 580, 29961, 29900, 5262, 13, 1678, 2537, 353, 6492, 29918, 3027, 29918, 7720, 29898, 2492, 29879, 29892, 29876, 5727, 29922, 29876, 5727, 29897, 13, 1678, 14770, 29889, 7620, 1003, 29898, 9507, 29897, 13, 1678, 14770, 29889, 5358, 580, 13, 13, 1753, 6492, 29918, 22178, 1379, 29898, 20158, 1125, 13, 1678, 565, 451, 7431, 29898, 20158, 29889, 12181, 29897, 1360, 29946, 29901, 13, 4706, 12020, 8960, 703, 465, 9351, 263, 29871, 29946, 29928, 12489, 1159, 13, 1678, 954, 29918, 22178, 1379, 353, 12489, 29889, 12181, 29961, 29900, 29962, 13, 1678, 2537, 353, 14770, 29889, 4532, 29898, 1003, 2311, 7607, 20158, 29889, 12181, 29961, 29900, 1402, 20158, 29889, 12181, 29961, 29896, 12622, 13, 1678, 363, 474, 297, 3464, 29898, 20158, 29889, 12181, 29961, 29900, 29962, 1125, 13, 4706, 363, 432, 297, 3464, 29898, 20158, 29889, 12181, 29961, 29896, 29962, 1125, 13, 9651, 4853, 29896, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 20158, 29889, 12181, 29961, 29900, 1402, 20158, 29889, 12181, 29961, 29896, 1402, 29896, 29974, 29875, 29930, 20158, 29889, 12181, 29961, 29900, 10062, 29926, 29897, 13, 9651, 4853, 29896, 29889, 326, 4294, 29898, 20158, 29961, 29875, 3816, 29926, 2314, 13, 9651, 4853, 29896, 29889, 8990, 877, 2696, 1495, 13, 9651, 4853, 29896, 29889, 842, 29918, 486, 860, 21134, 4197, 2314, 13, 9651, 4853, 29896, 29889, 842, 29918, 3637, 860, 21134, 4197, 2314, 13, 13, 1678, 14770, 29889, 1491, 26762, 29918, 328, 5143, 29898, 29893, 3493, 29922, 29900, 29889, 29896, 29892, 298, 3493, 29922, 29900, 29889, 29896, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 1753, 6492, 29918, 20158, 29898, 449, 29892, 29876, 5727, 29922, 29947, 1125, 13, 1678, 527, 3174, 353, 518, 2492, 363, 10153, 297, 714, 29889, 1272, 29889, 21970, 2141, 23749, 580, 29961, 29900, 5262, 13, 1678, 2537, 353, 6492, 29918, 3027, 29918, 7720, 29898, 2492, 29879, 29892, 29876, 5727, 29922, 29876, 5727, 29897, 13, 1678, 14770, 29889, 4294, 580, 13, 2 ]
postman1.py
Natalia1957/stepik-auto-test-course_
0
111699
import requests URL_AUTH = 'https://developers.lingvolive.com/api/v1.1/authenticate' URL_TRANSLATE = 'https://developers.lingvolive.com/api/v1/Minicard' KEY = "<KEY>" headers_auth = {'Authorization': "Basic" + " " + KEY} auth = requests.post(URL_AUTH, headers=headers_auth) print(auth.status_code) print(auth.text) if auth.status_code == 200: token = auth.text while True: word = input("input word for translate: ") if word: headers_translate = { 'Authorization': "Bearer " + " " + token } params = { "text": word, "srcLang": 1033, "dstLang": 1049 } r = requests.get(URL_TRANSLATE, headers=headers_translate, params=params) res = r.json() try: print(res["Translation"] ["Translation"]) except: print("net word") else: print("Error")
[ 1, 1053, 7274, 13, 13, 4219, 29918, 20656, 29950, 353, 525, 991, 597, 17426, 29889, 1847, 1555, 573, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29889, 29896, 29914, 27218, 403, 29915, 13, 4219, 29918, 26813, 12750, 3040, 353, 525, 991, 597, 17426, 29889, 1847, 1555, 573, 29889, 510, 29914, 2754, 29914, 29894, 29896, 29914, 8140, 293, 538, 29915, 13, 10818, 353, 9872, 10818, 11903, 13, 13662, 29918, 5150, 353, 11117, 25471, 2396, 376, 16616, 29908, 718, 376, 376, 718, 14636, 29913, 13, 5150, 353, 7274, 29889, 2490, 29898, 4219, 29918, 20656, 29950, 29892, 9066, 29922, 13662, 29918, 5150, 29897, 13, 2158, 29898, 5150, 29889, 4882, 29918, 401, 29897, 13, 2158, 29898, 5150, 29889, 726, 29897, 13, 361, 4817, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 1678, 5993, 353, 4817, 29889, 726, 13, 1678, 1550, 5852, 29901, 13, 4706, 1734, 353, 1881, 703, 2080, 1734, 363, 14240, 29901, 16521, 13, 4706, 565, 1734, 29901, 13, 9651, 9066, 29918, 21652, 353, 426, 13, 18884, 525, 25471, 2396, 376, 29933, 799, 261, 376, 718, 376, 376, 718, 5993, 13, 9651, 500, 13, 9651, 8636, 353, 426, 13, 18884, 376, 726, 1115, 1734, 29892, 13, 18884, 376, 4351, 29931, 574, 1115, 29871, 29896, 29900, 29941, 29941, 29892, 13, 18884, 376, 22992, 29931, 574, 1115, 29871, 29896, 29900, 29946, 29929, 13, 9651, 500, 13, 9651, 364, 353, 7274, 29889, 657, 29898, 4219, 29918, 26813, 12750, 3040, 29892, 9066, 29922, 13662, 29918, 21652, 29892, 8636, 29922, 7529, 29897, 13, 9651, 620, 353, 364, 29889, 3126, 580, 13, 9651, 1018, 29901, 13, 18884, 1596, 29898, 690, 3366, 4300, 18411, 3108, 6796, 4300, 18411, 20068, 13, 9651, 5174, 29901, 13, 18884, 1596, 703, 1212, 1734, 1159, 13, 4706, 1683, 29901, 13, 9651, 1596, 703, 2392, 1159, 13, 2 ]
src/rez/utils/graph_utils.py
maxnbk/rez
0
197575
<reponame>maxnbk/rez # Copyright Contributors to the Rez project # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """ Functions for manipulating dot-based resolve graphs. """ from __future__ import print_function import os.path import sys import tempfile from ast import literal_eval from rez.config import config from rez.vendor.pydot import pydot from rez.utils.execution import Popen from rez.utils.formatting import PackageRequest from rez.exceptions import PackageRequestError from rez.vendor.pygraph.readwrite.dot import read as read_dot from rez.vendor.pygraph.algorithms.accessibility import accessibility from rez.vendor.pygraph.classes.digraph import digraph from rez.vendor.six import six basestring = six.string_types[0] def read_graph_from_string(txt): """Read a graph from a string, either in dot format, or our own compressed format. Returns: `pygraph.digraph`: Graph object. """ if not txt.startswith('{'): return read_dot(txt) # standard dot format def conv(value): if isinstance(value, basestring): return '"' + value + '"' else: return value # our compacted format doc = literal_eval(txt) g = digraph() for attrs, values in doc.get("nodes", []): attrs = [(k, conv(v)) for k, v in attrs] for value in values: if isinstance(value, basestring): node_name = value attrs_ = attrs else: node_name, label = value attrs_ = attrs + [("label", conv(label))] g.add_node(node_name, attrs=attrs_) for attrs, values in doc.get("edges", []): attrs_ = [(k, conv(v)) for k, v in attrs] for value in values: if len(value) == 3: edge = value[:2] label = value[-1] else: edge = value label = '' g.add_edge(edge, label=label, attrs=attrs_) return g def write_compacted(g): """Write a graph in our own compacted format. Returns: str. """ d_nodes = {} d_edges = {} def conv(value): if isinstance(value, basestring): return value.strip('"') else: return value for node in g.nodes(): label = None attrs = [] for k, v in sorted(g.node_attributes(node)): v_ = conv(v) if k == "label": label = v_ else: attrs.append((k, v_)) value = (node, label) if label else node d_nodes.setdefault(tuple(attrs), []).append(value) for edge in g.edges(): attrs = [(k, conv(v)) for k, v in sorted(g.edge_attributes(edge))] label = str(g.edge_label(edge)) value = tuple(list(edge) + [label]) if label else edge d_edges.setdefault(tuple(attrs), []).append(tuple(value)) doc = dict(nodes=list(d_nodes.items()), edges=list(d_edges.items())) contents = str(doc) return contents def write_dot(g): """Replacement for pygraph.readwrite.dot.write, which is dog slow. Note: This isn't a general replacement. It will work for the graphs that Rez generates, but there are no guarantees beyond that. Args: g (`pygraph.digraph`): Input graph. Returns: str: Graph in dot format. """ lines = ["digraph g {"] def attrs_txt(items): if items: txt = ", ".join(('%s="%s"' % (k, str(v).strip('"'))) for k, v in items) return '[' + txt + ']' else: return '' for node in g.nodes(): atxt = attrs_txt(g.node_attributes(node)) txt = "%s %s;" % (node, atxt) lines.append(txt) for e in g.edges(): edge_from, edge_to = e attrs = g.edge_attributes(e) label = str(g.edge_label(e)) if label: attrs.append(("label", label)) atxt = attrs_txt(attrs) txt = "%s -> %s %s;" % (edge_from, edge_to, atxt) lines.append(txt) lines.append("}") return '\n'.join(lines) def prune_graph(graph_str, package_name): """Prune a package graph so it only contains nodes accessible from the given package. Args: graph_str (str): Dot-language graph string. package_name (str): Name of package of interest. Returns: Pruned graph, as a string. """ # find nodes of interest g = read_dot(graph_str) nodes = set() for node, attrs in g.node_attr.items(): attr = [x for x in attrs if x[0] == "label"] if attr: label = attr[0][1] try: req_str = _request_from_label(label) request = PackageRequest(req_str) except PackageRequestError: continue if request.name == package_name: nodes.add(node) if not nodes: raise ValueError("The package %r does not appear in the graph." % package_name) # find nodes upstream from these nodes g_rev = g.reverse() accessible_nodes = set() access = accessibility(g_rev) for node in nodes: nodes_ = access.get(node, []) accessible_nodes |= set(nodes_) # remove inaccessible nodes inaccessible_nodes = set(g.nodes()) - accessible_nodes for node in inaccessible_nodes: g.del_node(node) return write_dot(g) def save_graph(graph_str, dest_file, fmt=None, image_ratio=None): """Render a graph to an image file. Args: graph_str (str): Dot-language graph string. dest_file (str): Filepath to save the graph to. fmt (str): Format, eg "png", "jpg". image_ratio (float): Image ratio. Returns: String representing format that was written, such as 'png'. """ # Disconnected edges can result in multiple graphs. We should never see # this - it's a bug in graph generation if we do. # graphs = pydot.graph_from_dot_data(graph_str) if not graphs: raise RuntimeError("No graph generated") if len(graphs) > 1: path, ext = os.path.splitext(dest_file) dest_files = [] for i, g in enumerate(graphs): try: dest_file_ = "%s.%d%s" % (path, i + 1, ext) save_graph_object(g, dest_file_, fmt, image_ratio) dest_files.append(dest_file_) except: pass raise RuntimeError( "More than one graph was generated; this probably indicates a bug " "in graph generation. Graphs were written to %r" % dest_files ) # write the graph return save_graph_object(graphs[0], dest_file, fmt, image_ratio) def save_graph_object(g, dest_file, fmt=None, image_ratio=None): """Like `save_graph`, but takes a pydot Dot object. """ # determine the dest format if fmt is None: fmt = os.path.splitext(dest_file)[1].lower().strip('.') or "png" if hasattr(g, "write_" + fmt): write_fn = getattr(g, "write_" + fmt) else: raise RuntimeError("Unsupported graph format: '%s'" % fmt) if image_ratio: g.set_ratio(str(image_ratio)) write_fn(dest_file) return fmt def view_graph(graph_str, dest_file=None): """View a dot graph in an image viewer.""" from rez.system import system from rez.config import config if (system.platform == "linux") and (not os.getenv("DISPLAY")): print("Unable to open display.", file=sys.stderr) sys.exit(1) dest_file = _write_graph(graph_str, dest_file=dest_file) # view graph viewed = False prog = config.image_viewer or 'browser' print("loading image viewer (%s)..." % prog) if config.image_viewer: with Popen([config.image_viewer, dest_file]) as p: p.wait() viewed = not bool(p.returncode) if not viewed: import webbrowser webbrowser.open_new("file://" + dest_file) def _write_graph(graph_str, dest_file=None): if not dest_file: tmpf = tempfile.mkstemp(prefix='resolve-dot-', suffix='.' + config.dot_image_format) os.close(tmpf[0]) dest_file = tmpf[1] print("rendering image to " + dest_file + "...") save_graph(graph_str, dest_file) return dest_file # converts string like '"PyQt-4.8.0[1]"' to 'PyQt-4.8.0' def _request_from_label(label): return label.strip('"').strip("'").rsplit('[', 1)[0]
[ 1, 529, 276, 1112, 420, 29958, 3317, 9877, 29895, 29914, 15749, 13, 29937, 14187, 1266, 2866, 1091, 29560, 304, 278, 830, 29920, 2060, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 13, 13, 15945, 29908, 13, 6678, 29879, 363, 11525, 18099, 8329, 29899, 6707, 8814, 18445, 29889, 13, 15945, 29908, 13, 3166, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 13, 5215, 2897, 29889, 2084, 13, 5215, 10876, 13, 5215, 5694, 1445, 13, 3166, 8717, 1053, 16333, 29918, 14513, 13, 3166, 29194, 29889, 2917, 1053, 2295, 13, 3166, 29194, 29889, 19167, 29889, 2272, 6333, 1053, 282, 2941, 327, 13, 3166, 29194, 29889, 13239, 29889, 22256, 1053, 349, 3150, 13, 3166, 29194, 29889, 13239, 29889, 689, 23980, 1053, 22029, 3089, 13, 3166, 29194, 29889, 11739, 29879, 1053, 22029, 3089, 2392, 13, 3166, 29194, 29889, 19167, 29889, 2272, 4262, 29889, 949, 3539, 29889, 6333, 1053, 1303, 408, 1303, 29918, 6333, 13, 3166, 29194, 29889, 19167, 29889, 2272, 4262, 29889, 9564, 12404, 29889, 5943, 4127, 1053, 2130, 4127, 13, 3166, 29194, 29889, 19167, 29889, 2272, 4262, 29889, 13203, 29889, 7501, 1140, 1053, 4697, 1140, 13, 3166, 29194, 29889, 19167, 29889, 28319, 1053, 4832, 13, 13, 13, 6500, 342, 5393, 353, 4832, 29889, 1807, 29918, 8768, 29961, 29900, 29962, 13, 13, 13, 1753, 1303, 29918, 4262, 29918, 3166, 29918, 1807, 29898, 3945, 1125, 13, 1678, 9995, 6359, 263, 3983, 515, 263, 1347, 29892, 2845, 297, 8329, 3402, 29892, 470, 1749, 1914, 13, 1678, 419, 13120, 3402, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 421, 2272, 4262, 29889, 7501, 1140, 6998, 12367, 1203, 29889, 13, 1678, 9995, 13, 1678, 565, 451, 13872, 29889, 27382, 2541, 877, 10998, 1125, 13, 4706, 736, 1303, 29918, 6333, 29898, 3945, 29897, 29871, 396, 3918, 8329, 3402, 13, 13, 1678, 822, 7602, 29898, 1767, 1125, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 2362, 342, 5393, 1125, 13, 9651, 736, 18793, 29915, 718, 995, 718, 18793, 29915, 13, 4706, 1683, 29901, 13, 9651, 736, 995, 13, 13, 1678, 396, 1749, 11071, 287, 3402, 13, 1678, 1574, 353, 16333, 29918, 14513, 29898, 3945, 29897, 13, 1678, 330, 353, 4697, 1140, 580, 13, 13, 1678, 363, 12421, 29879, 29892, 1819, 297, 1574, 29889, 657, 703, 18010, 613, 5159, 1125, 13, 4706, 12421, 29879, 353, 17288, 29895, 29892, 7602, 29898, 29894, 876, 363, 413, 29892, 325, 297, 12421, 29879, 29962, 13, 13, 4706, 363, 995, 297, 1819, 29901, 13, 9651, 565, 338, 8758, 29898, 1767, 29892, 2362, 342, 5393, 1125, 13, 18884, 2943, 29918, 978, 353, 995, 13, 18884, 12421, 29879, 29918, 353, 12421, 29879, 13, 9651, 1683, 29901, 13, 18884, 2943, 29918, 978, 29892, 3858, 353, 995, 13, 18884, 12421, 29879, 29918, 353, 12421, 29879, 718, 518, 703, 1643, 613, 7602, 29898, 1643, 28166, 13, 13, 9651, 330, 29889, 1202, 29918, 3177, 29898, 3177, 29918, 978, 29892, 12421, 29879, 29922, 5552, 29879, 19925, 13, 13, 1678, 363, 12421, 29879, 29892, 1819, 297, 1574, 29889, 657, 703, 287, 2710, 613, 5159, 1125, 13, 4706, 12421, 29879, 29918, 353, 17288, 29895, 29892, 7602, 29898, 29894, 876, 363, 413, 29892, 325, 297, 12421, 29879, 29962, 13, 13, 4706, 363, 995, 297, 1819, 29901, 13, 9651, 565, 7431, 29898, 1767, 29897, 1275, 29871, 29941, 29901, 13, 18884, 7636, 353, 995, 7503, 29906, 29962, 13, 18884, 3858, 353, 995, 14352, 29896, 29962, 13, 9651, 1683, 29901, 13, 18884, 7636, 353, 995, 13, 18884, 3858, 353, 6629, 13, 13, 9651, 330, 29889, 1202, 29918, 12864, 29898, 12864, 29892, 3858, 29922, 1643, 29892, 12421, 29879, 29922, 5552, 29879, 19925, 13, 13, 1678, 736, 330, 13, 13, 13, 1753, 2436, 29918, 2388, 627, 287, 29898, 29887, 1125, 13, 1678, 9995, 6113, 263, 3983, 297, 1749, 1914, 11071, 287, 3402, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 851, 29889, 13, 1678, 9995, 13, 1678, 270, 29918, 18010, 353, 6571, 13, 1678, 270, 29918, 287, 2710, 353, 6571, 13, 13, 1678, 822, 7602, 29898, 1767, 1125, 13, 4706, 565, 338, 8758, 29898, 1767, 29892, 2362, 342, 5393, 1125, 13, 9651, 736, 995, 29889, 17010, 877, 29908, 1495, 13, 4706, 1683, 29901, 13, 9651, 736, 995, 13, 13, 1678, 363, 2943, 297, 330, 29889, 18010, 7295, 13, 4706, 3858, 353, 6213, 13, 4706, 12421, 29879, 353, 5159, 13, 13, 4706, 363, 413, 29892, 325, 297, 12705, 29898, 29887, 29889, 3177, 29918, 15697, 29898, 3177, 22164, 13, 9651, 325, 29918, 353, 7602, 29898, 29894, 29897, 13, 9651, 565, 413, 1275, 376, 1643, 1115, 13, 18884, 3858, 353, 325, 29918, 13, 9651, 1683, 29901, 13, 18884, 12421, 29879, 29889, 4397, 3552, 29895, 29892, 325, 29918, 876, 13, 13, 4706, 995, 353, 313, 3177, 29892, 3858, 29897, 565, 3858, 1683, 2943, 13, 4706, 270, 29918, 18010, 29889, 842, 4381, 29898, 23583, 29898, 5552, 29879, 511, 5159, 467, 4397, 29898, 1767, 29897, 13, 13, 1678, 363, 7636, 297, 330, 29889, 287, 2710, 7295, 13, 4706, 12421, 29879, 353, 17288, 29895, 29892, 7602, 29898, 29894, 876, 363, 413, 29892, 325, 297, 12705, 29898, 29887, 29889, 12864, 29918, 15697, 29898, 12864, 28166, 13, 4706, 3858, 353, 851, 29898, 29887, 29889, 12864, 29918, 1643, 29898, 12864, 876, 13, 4706, 995, 353, 18761, 29898, 1761, 29898, 12864, 29897, 718, 518, 1643, 2314, 565, 3858, 1683, 7636, 13, 4706, 270, 29918, 287, 2710, 29889, 842, 4381, 29898, 23583, 29898, 5552, 29879, 511, 5159, 467, 4397, 29898, 23583, 29898, 1767, 876, 13, 13, 1678, 1574, 353, 9657, 29898, 18010, 29922, 1761, 29898, 29881, 29918, 18010, 29889, 7076, 25739, 12770, 29922, 1761, 29898, 29881, 29918, 287, 2710, 29889, 7076, 22130, 13, 1678, 8118, 353, 851, 29898, 1514, 29897, 13, 1678, 736, 8118, 13, 13, 13, 1753, 2436, 29918, 6333, 29898, 29887, 1125, 13, 1678, 9995, 5612, 9552, 363, 11451, 4262, 29889, 949, 3539, 29889, 6333, 29889, 3539, 29892, 607, 338, 11203, 5232, 29889, 13, 13, 1678, 3940, 29901, 13, 4706, 910, 3508, 29915, 29873, 263, 2498, 16920, 29889, 739, 674, 664, 363, 278, 18445, 393, 13, 4706, 830, 29920, 16785, 29892, 541, 727, 526, 694, 10509, 267, 8724, 393, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 330, 6695, 2272, 4262, 29889, 7501, 1140, 29952, 1125, 10567, 3983, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 851, 29901, 12367, 297, 8329, 3402, 29889, 13, 1678, 9995, 13, 1678, 3454, 353, 6796, 7501, 1140, 330, 426, 3108, 13, 13, 1678, 822, 12421, 29879, 29918, 3945, 29898, 7076, 1125, 13, 4706, 565, 4452, 29901, 13, 9651, 13872, 353, 9162, 11393, 7122, 29898, 877, 29995, 29879, 543, 29995, 29879, 29908, 29915, 1273, 313, 29895, 29892, 851, 29898, 29894, 467, 17010, 877, 29908, 29915, 4961, 13, 462, 9651, 363, 413, 29892, 325, 297, 4452, 29897, 13, 9651, 736, 525, 1839, 718, 13872, 718, 525, 29962, 29915, 13, 4706, 1683, 29901, 13, 9651, 736, 6629, 13, 13, 1678, 363, 2943, 297, 330, 29889, 18010, 7295, 13, 4706, 472, 486, 353, 12421, 29879, 29918, 3945, 29898, 29887, 29889, 3177, 29918, 15697, 29898, 3177, 876, 13, 4706, 13872, 353, 11860, 29879, 1273, 29879, 15458, 1273, 313, 3177, 29892, 472, 486, 29897, 13, 4706, 3454, 29889, 4397, 29898, 3945, 29897, 13, 13, 1678, 363, 321, 297, 330, 29889, 287, 2710, 7295, 13, 4706, 7636, 29918, 3166, 29892, 7636, 29918, 517, 353, 321, 13, 4706, 12421, 29879, 353, 330, 29889, 12864, 29918, 15697, 29898, 29872, 29897, 13, 13, 4706, 3858, 353, 851, 29898, 29887, 29889, 12864, 29918, 1643, 29898, 29872, 876, 13, 4706, 565, 3858, 29901, 13, 9651, 12421, 29879, 29889, 4397, 29898, 703, 1643, 613, 3858, 876, 13, 13, 4706, 472, 486, 353, 12421, 29879, 29918, 3945, 29898, 5552, 29879, 29897, 13, 4706, 13872, 353, 11860, 29879, 1599, 1273, 29879, 1273, 29879, 15458, 1273, 313, 12864, 29918, 3166, 29892, 7636, 29918, 517, 29892, 472, 486, 29897, 13, 4706, 3454, 29889, 4397, 29898, 3945, 29897, 13, 13, 1678, 3454, 29889, 4397, 703, 27195, 13, 1678, 736, 11297, 29876, 4286, 7122, 29898, 9012, 29897, 13, 13, 13, 1753, 544, 1540, 29918, 4262, 29898, 4262, 29918, 710, 29892, 3577, 29918, 978, 1125, 13, 1678, 9995, 4040, 1540, 263, 3577, 3983, 577, 372, 871, 3743, 7573, 15579, 515, 278, 13, 1678, 2183, 3577, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3983, 29918, 710, 313, 710, 1125, 360, 327, 29899, 11675, 3983, 1347, 29889, 13, 4706, 3577, 29918, 978, 313, 710, 1125, 4408, 310, 3577, 310, 4066, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 1588, 348, 287, 3983, 29892, 408, 263, 1347, 29889, 13, 1678, 9995, 13, 1678, 396, 1284, 7573, 310, 4066, 13, 1678, 330, 353, 1303, 29918, 6333, 29898, 4262, 29918, 710, 29897, 13, 1678, 7573, 353, 731, 580, 13, 13, 1678, 363, 2943, 29892, 12421, 29879, 297, 330, 29889, 3177, 29918, 5552, 29889, 7076, 7295, 13, 4706, 12421, 353, 518, 29916, 363, 921, 297, 12421, 29879, 565, 921, 29961, 29900, 29962, 1275, 376, 1643, 3108, 13, 4706, 565, 12421, 29901, 13, 9651, 3858, 353, 12421, 29961, 29900, 3816, 29896, 29962, 13, 9651, 1018, 29901, 13, 18884, 12428, 29918, 710, 353, 903, 3827, 29918, 3166, 29918, 1643, 29898, 1643, 29897, 13, 18884, 2009, 353, 22029, 3089, 29898, 7971, 29918, 710, 29897, 13, 9651, 5174, 22029, 3089, 2392, 29901, 13, 18884, 6773, 13, 13, 9651, 565, 2009, 29889, 978, 1275, 3577, 29918, 978, 29901, 13, 18884, 7573, 29889, 1202, 29898, 3177, 29897, 13, 13, 1678, 565, 451, 7573, 29901, 13, 4706, 12020, 7865, 2392, 703, 1576, 3577, 1273, 29878, 947, 451, 2615, 297, 278, 3983, 1213, 13, 462, 308, 1273, 3577, 29918, 978, 29897, 13, 13, 1678, 396, 1284, 7573, 701, 5461, 515, 1438, 7573, 13, 1678, 330, 29918, 13478, 353, 330, 29889, 24244, 580, 13, 1678, 15579, 29918, 18010, 353, 731, 580, 13, 1678, 2130, 353, 2130, 4127, 29898, 29887, 29918, 13478, 29897, 13, 1678, 363, 2943, 297, 7573, 29901, 13, 4706, 7573, 29918, 353, 2130, 29889, 657, 29898, 3177, 29892, 518, 2314, 13, 4706, 15579, 29918, 18010, 891, 29922, 731, 29898, 18010, 19925, 13, 13, 1678, 396, 3349, 297, 5943, 1821, 7573, 13, 1678, 297, 5943, 1821, 29918, 18010, 353, 731, 29898, 29887, 29889, 18010, 3101, 448, 15579, 29918, 18010, 13, 1678, 363, 2943, 297, 297, 5943, 1821, 29918, 18010, 29901, 13, 4706, 330, 29889, 6144, 29918, 3177, 29898, 3177, 29897, 13, 13, 1678, 736, 2436, 29918, 6333, 29898, 29887, 29897, 13, 13, 13, 1753, 4078, 29918, 4262, 29898, 4262, 29918, 710, 29892, 2731, 29918, 1445, 29892, 19200, 29922, 8516, 29892, 1967, 29918, 3605, 601, 29922, 8516, 1125, 13, 1678, 9995, 10716, 263, 3983, 304, 385, 1967, 934, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 3983, 29918, 710, 313, 710, 1125, 360, 327, 29899, 11675, 3983, 1347, 29889, 13, 4706, 2731, 29918, 1445, 313, 710, 1125, 3497, 2084, 304, 4078, 278, 3983, 304, 29889, 13, 4706, 19200, 313, 710, 1125, 19191, 29892, 8087, 376, 2732, 613, 376, 6173, 1642, 13, 4706, 1967, 29918, 3605, 601, 313, 7411, 1125, 7084, 11959, 29889, 13, 13, 1678, 16969, 29901, 13, 4706, 1714, 15783, 3402, 393, 471, 3971, 29892, 1316, 408, 525, 2732, 4286, 13, 1678, 9995, 13, 13, 1678, 396, 3295, 18045, 12770, 508, 1121, 297, 2999, 18445, 29889, 1334, 881, 2360, 1074, 13, 1678, 396, 445, 448, 372, 29915, 29879, 263, 6494, 297, 3983, 12623, 565, 591, 437, 29889, 13, 1678, 396, 13, 1678, 18445, 353, 282, 2941, 327, 29889, 4262, 29918, 3166, 29918, 6333, 29918, 1272, 29898, 4262, 29918, 710, 29897, 13, 13, 1678, 565, 451, 18445, 29901, 13, 4706, 12020, 24875, 2392, 703, 3782, 3983, 5759, 1159, 13, 13, 1678, 565, 7431, 29898, 4262, 29879, 29897, 1405, 29871, 29896, 29901, 13, 4706, 2224, 29892, 1294, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 7854, 29918, 1445, 29897, 13, 4706, 2731, 29918, 5325, 353, 5159, 13, 13, 4706, 363, 474, 29892, 330, 297, 26985, 29898, 4262, 29879, 1125, 13, 9651, 1018, 29901, 13, 18884, 2731, 29918, 1445, 29918, 353, 11860, 29879, 29889, 29995, 29881, 29995, 29879, 29908, 1273, 313, 2084, 29892, 474, 718, 29871, 29896, 29892, 1294, 29897, 13, 18884, 4078, 29918, 4262, 29918, 3318, 29898, 29887, 29892, 2731, 29918, 1445, 3383, 19200, 29892, 1967, 29918, 3605, 601, 29897, 13, 18884, 2731, 29918, 5325, 29889, 4397, 29898, 7854, 29918, 1445, 19925, 13, 9651, 5174, 29901, 13, 18884, 1209, 13, 13, 4706, 12020, 24875, 2392, 29898, 13, 9651, 376, 20761, 1135, 697, 3983, 471, 5759, 29936, 445, 3117, 14088, 263, 6494, 376, 13, 9651, 376, 262, 3983, 12623, 29889, 12367, 29879, 892, 3971, 304, 1273, 29878, 29908, 1273, 2731, 29918, 5325, 13, 4706, 1723, 13, 13, 1678, 396, 2436, 278, 3983, 13, 1678, 736, 4078, 29918, 4262, 29918, 3318, 29898, 4262, 29879, 29961, 29900, 1402, 2731, 29918, 1445, 29892, 19200, 29892, 1967, 29918, 3605, 601, 29897, 13, 13, 13, 1753, 4078, 29918, 4262, 29918, 3318, 29898, 29887, 29892, 2731, 29918, 1445, 29892, 19200, 29922, 8516, 29892, 1967, 29918, 3605, 601, 29922, 8516, 1125, 13, 1678, 9995, 27552, 421, 7620, 29918, 4262, 1673, 541, 4893, 263, 282, 2941, 327, 360, 327, 1203, 29889, 13, 1678, 9995, 13, 13, 1678, 396, 8161, 278, 2731, 3402, 13, 1678, 565, 19200, 338, 6213, 29901, 13, 4706, 19200, 353, 2897, 29889, 2084, 29889, 23579, 568, 486, 29898, 7854, 29918, 1445, 9601, 29896, 1822, 13609, 2141, 17010, 12839, 1495, 470, 376, 2732, 29908, 13, 13, 1678, 565, 756, 5552, 29898, 29887, 29892, 376, 3539, 27508, 718, 19200, 1125, 13, 4706, 2436, 29918, 9144, 353, 679, 5552, 29898, 29887, 29892, 376, 3539, 27508, 718, 19200, 29897, 13, 1678, 1683, 29901, 13, 4706, 12020, 24875, 2392, 703, 25807, 29884, 3016, 287, 3983, 3402, 29901, 14210, 29879, 11838, 1273, 19200, 29897, 13, 13, 1678, 565, 1967, 29918, 3605, 601, 29901, 13, 4706, 330, 29889, 842, 29918, 3605, 601, 29898, 710, 29898, 3027, 29918, 3605, 601, 876, 13, 1678, 2436, 29918, 9144, 29898, 7854, 29918, 1445, 29897, 13, 1678, 736, 19200, 13, 13, 13, 1753, 1776, 29918, 4262, 29898, 4262, 29918, 710, 29892, 2731, 29918, 1445, 29922, 8516, 1125, 13, 1678, 9995, 1043, 263, 8329, 3983, 297, 385, 1967, 6316, 556, 1213, 15945, 13, 1678, 515, 29194, 29889, 5205, 1053, 1788, 13, 1678, 515, 29194, 29889, 2917, 1053, 2295, 13, 13, 1678, 565, 313, 5205, 29889, 12120, 1275, 376, 9389, 1159, 322, 313, 1333, 2897, 29889, 657, 6272, 703, 23711, 29925, 18799, 5783, 29901, 13, 4706, 1596, 703, 2525, 519, 304, 1722, 2479, 19602, 934, 29922, 9675, 29889, 303, 20405, 29897, 13, 4706, 10876, 29889, 13322, 29898, 29896, 29897, 13, 13, 1678, 2731, 29918, 1445, 353, 903, 3539, 29918, 4262, 29898, 4262, 29918, 710, 29892, 2731, 29918, 1445, 29922, 7854, 29918, 1445, 29897, 13, 13, 1678, 396, 1776, 3983, 13, 1678, 24774, 353, 7700, 13, 1678, 410, 29887, 353, 2295, 29889, 3027, 29918, 29894, 15580, 470, 525, 15965, 29915, 13, 1678, 1596, 703, 13234, 1967, 6316, 556, 313, 29995, 29879, 467, 636, 29908, 1273, 410, 29887, 29897, 13, 13, 1678, 565, 2295, 29889, 3027, 29918, 29894, 15580, 29901, 13, 4706, 411, 349, 3150, 4197, 2917, 29889, 3027, 29918, 29894, 15580, 29892, 2731, 29918, 1445, 2314, 408, 282, 29901, 13, 9651, 282, 29889, 10685, 580, 13, 4706, 24774, 353, 451, 6120, 29898, 29886, 29889, 2457, 401, 29897, 13, 13, 1678, 565, 451, 24774, 29901, 13, 4706, 1053, 591, 1327, 8777, 13, 4706, 591, 1327, 8777, 29889, 3150, 29918, 1482, 703, 1445, 597, 29908, 718, 2731, 29918, 1445, 29897, 13, 13, 13, 1753, 903, 3539, 29918, 4262, 29898, 4262, 29918, 710, 29892, 2731, 29918, 1445, 29922, 8516, 1125, 13, 1678, 565, 451, 2731, 29918, 1445, 29901, 13, 4706, 13128, 29888, 353, 5694, 1445, 29889, 11256, 303, 3451, 29898, 13506, 2433, 17863, 29899, 6333, 29899, 742, 13, 462, 18884, 25557, 2433, 6169, 718, 2295, 29889, 6333, 29918, 3027, 29918, 4830, 29897, 13, 4706, 2897, 29889, 5358, 29898, 7050, 29888, 29961, 29900, 2314, 13, 4706, 2731, 29918, 1445, 353, 13128, 29888, 29961, 29896, 29962, 13, 13, 1678, 1596, 703, 9482, 292, 1967, 304, 376, 718, 2731, 29918, 1445, 718, 29804, 1159, 13, 1678, 4078, 29918, 4262, 29898, 4262, 29918, 710, 29892, 2731, 29918, 1445, 29897, 13, 1678, 736, 2731, 29918, 1445, 13, 13, 13, 29937, 29436, 1347, 763, 18793, 19737, 17303, 29899, 29946, 29889, 29947, 29889, 29900, 29961, 29896, 18017, 29915, 304, 525, 19737, 17303, 29899, 29946, 29889, 29947, 29889, 29900, 29915, 13, 1753, 903, 3827, 29918, 3166, 29918, 1643, 29898, 1643, 1125, 13, 1678, 736, 3858, 29889, 17010, 877, 29908, 2824, 17010, 703, 29915, 2564, 2288, 2830, 877, 29961, 742, 29871, 29896, 9601, 29900, 29962, 13, 2 ]
model.py
DishantIsrani/SmartCCTV
0
116995
<reponame>DishantIsrani/SmartCCTV from sklearn.svm import LinearSVC import numpy as np import cv2 import PIL import camera class Model: def __init__(self): self.model = LinearSVC() def train_model(self, counters): img_list = np.array([]) class_list = np.array([]) for i in range(1, counters[0]): img = cv2.imread(f"1/frame{i}.jpg")[:,:,0] img = img.reshape(16950) img_list = np.append(img_list, [img]) class_list = np.append(class_list, 1) for i in range(1, counters[1]): img = cv2.imread(f"2/frame{i}.jpg")[:,:,0] img = img.reshape(16950) img_list = np.append(img_list, [img]) class_list = np.append(class_list, 2) img_list = img_list.reshape(counters[0]-1 + counters[1]-1, 16950) self.model.fit(img_list, class_list) print("Model successfully Trained!") def predict(self, frame): frame = frame[1] cv2.imwrite('frame.jpg', cv2.cvtColor(frame, cv2.COLOR_RGB2GRAY)) img = PIL.Image.open('frame.jpg') img.thumbnail((150, 150), PIL.Image.ANTIALIAS) img.save("frame.jpg") img = cv2.imread('frame.jpg')[:,:,0] img = img.reshape(16950) prediction = self.model.predict([img]) return prediction[0]
[ 1, 529, 276, 1112, 420, 29958, 29928, 728, 424, 3624, 661, 29875, 29914, 12636, 442, 29907, 1783, 29963, 13, 3166, 2071, 19668, 29889, 4501, 29885, 1053, 22985, 7597, 29907, 13, 5215, 12655, 408, 7442, 29871, 13, 5215, 13850, 29906, 13, 5215, 349, 6227, 13, 5215, 10656, 13, 13, 1990, 8125, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1583, 29889, 4299, 353, 22985, 7597, 29907, 580, 13, 13, 1678, 822, 7945, 29918, 4299, 29898, 1311, 29892, 2613, 2153, 1125, 13, 4706, 10153, 29918, 1761, 353, 7442, 29889, 2378, 4197, 2314, 13, 4706, 770, 29918, 1761, 353, 7442, 29889, 2378, 4197, 2314, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 2613, 2153, 29961, 29900, 29962, 1125, 13, 9651, 10153, 353, 13850, 29906, 29889, 326, 949, 29898, 29888, 29908, 29896, 29914, 2557, 29912, 29875, 1836, 6173, 1159, 7503, 29892, 29901, 29892, 29900, 29962, 13, 9651, 10153, 353, 10153, 29889, 690, 14443, 29898, 29896, 29953, 29929, 29945, 29900, 29897, 13, 9651, 10153, 29918, 1761, 353, 7442, 29889, 4397, 29898, 2492, 29918, 1761, 29892, 518, 2492, 2314, 13, 9651, 770, 29918, 1761, 353, 7442, 29889, 4397, 29898, 1990, 29918, 1761, 29892, 29871, 29896, 29897, 13, 13, 4706, 363, 474, 297, 3464, 29898, 29896, 29892, 2613, 2153, 29961, 29896, 29962, 1125, 13, 9651, 10153, 353, 13850, 29906, 29889, 326, 949, 29898, 29888, 29908, 29906, 29914, 2557, 29912, 29875, 1836, 6173, 1159, 7503, 29892, 29901, 29892, 29900, 29962, 13, 9651, 10153, 353, 10153, 29889, 690, 14443, 29898, 29896, 29953, 29929, 29945, 29900, 29897, 13, 9651, 10153, 29918, 1761, 353, 7442, 29889, 4397, 29898, 2492, 29918, 1761, 29892, 518, 2492, 2314, 13, 9651, 770, 29918, 1761, 353, 7442, 29889, 4397, 29898, 1990, 29918, 1761, 29892, 29871, 29906, 29897, 13, 13, 4706, 10153, 29918, 1761, 353, 10153, 29918, 1761, 29889, 690, 14443, 29898, 29883, 1309, 2153, 29961, 29900, 29962, 29899, 29896, 718, 2613, 2153, 29961, 29896, 29962, 29899, 29896, 29892, 29871, 29896, 29953, 29929, 29945, 29900, 29897, 13, 4706, 1583, 29889, 4299, 29889, 9202, 29898, 2492, 29918, 1761, 29892, 770, 29918, 1761, 29897, 13, 4706, 1596, 703, 3195, 8472, 3201, 1312, 29991, 1159, 13, 13, 1678, 822, 8500, 29898, 1311, 29892, 3515, 1125, 13, 4706, 3515, 353, 3515, 29961, 29896, 29962, 13, 4706, 13850, 29906, 29889, 326, 3539, 877, 2557, 29889, 6173, 742, 13850, 29906, 29889, 11023, 29873, 3306, 29898, 2557, 29892, 13850, 29906, 29889, 15032, 1955, 29918, 28212, 29906, 29954, 22800, 876, 13, 4706, 10153, 353, 349, 6227, 29889, 2940, 29889, 3150, 877, 2557, 29889, 6173, 1495, 13, 4706, 10153, 29889, 386, 21145, 3552, 29896, 29945, 29900, 29892, 29871, 29896, 29945, 29900, 511, 349, 6227, 29889, 2940, 29889, 13566, 25758, 29902, 3289, 29897, 13, 4706, 10153, 29889, 7620, 703, 2557, 29889, 6173, 1159, 13, 4706, 10153, 353, 13850, 29906, 29889, 326, 949, 877, 2557, 29889, 6173, 1495, 7503, 29892, 29901, 29892, 29900, 29962, 13, 4706, 10153, 353, 10153, 29889, 690, 14443, 29898, 29896, 29953, 29929, 29945, 29900, 29897, 13, 4706, 18988, 353, 1583, 29889, 4299, 29889, 27711, 4197, 2492, 2314, 13, 13, 4706, 736, 18988, 29961, 29900, 29962, 13, 13, 13, 13, 13, 13, 13, 13, 13, 2 ]
core.py
iBug/OmniAE
0
28131
# LOL. Hope you're not fooled by the name of this file import sys import os from configparser import ConfigParser # Note: All classes here have N801 (CapWords naming convention) disabled. # They're intended to be singletons class Object(object): def __init__(self, _default=None, **kwargs): self.__dict__["_data"] = dict(kwargs) self.__dict__["_default"] = _default def __getattr__(self, attr): try: return self._data[attr] except KeyError: if self._default: self._data[attr] = self._default() return self._data[attr] raise AttributeError("Object has no attribute {!r}".format(attr)) from None def __setattr__(self, attr, value): self._data[attr] = value return value def __getitem__(self, index): return self._data[index] def __setitem__(self, index, value): self._data[index] = value return value def set_default(self, default=None): if default is True: default = Object self._default = default config = Object(_default=type(None)) class obj: # noqa: N801 site_list = None sews = None tasker = None post_storage = None class worker: # noqa: N801 sews = None scanner = None handler = None check = Object( development=None, ) config_parser = ConfigParser() def load(): global config_parser if "pytest" in sys.modules: config_parser.read("config.ci", encoding="utf-8") elif os.path.isfile("config"): config_parser.read("config", encoding="utf-8") else: config_parser.read("config.sample", encoding="utf-8") conf = config_parser['Config'] config.read_key = conf.get('read_key', "<KEY>) config.write_key = conf.get('write_key') config.write_token = conf.get('write_token') config.site = conf.get('site', "android.stackexchange.com") config.log_level = int(conf.get('log_level', 1)) config.file_log_level = int(conf.get('file_log_level', 3)) config.log_file = conf.get('log_file', "log.txt") config.db_file = conf.get('db_file', "androidoverflow.db") config.repo_slug = conf.get('repo_slug', "iBug/AndroidOverflow")
[ 1, 396, 365, 5607, 29889, 7963, 366, 29915, 276, 451, 7953, 839, 491, 278, 1024, 310, 445, 934, 13, 13, 13, 5215, 10876, 13, 5215, 2897, 13, 3166, 2295, 16680, 1053, 12782, 11726, 13, 13, 13, 29937, 3940, 29901, 2178, 4413, 1244, 505, 405, 29947, 29900, 29896, 313, 12415, 29956, 4339, 22006, 15687, 29897, 12708, 29889, 13, 29937, 2688, 29915, 276, 9146, 304, 367, 1809, 1026, 787, 13, 13, 13, 1990, 4669, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 903, 4381, 29922, 8516, 29892, 3579, 19290, 1125, 13, 4706, 1583, 17255, 8977, 1649, 3366, 29918, 1272, 3108, 353, 9657, 29898, 19290, 29897, 13, 4706, 1583, 17255, 8977, 1649, 3366, 29918, 4381, 3108, 353, 903, 4381, 13, 13, 1678, 822, 4770, 657, 5552, 12035, 1311, 29892, 12421, 1125, 13, 4706, 1018, 29901, 13, 9651, 736, 1583, 3032, 1272, 29961, 5552, 29962, 13, 4706, 5174, 7670, 2392, 29901, 13, 9651, 565, 1583, 3032, 4381, 29901, 13, 18884, 1583, 3032, 1272, 29961, 5552, 29962, 353, 1583, 3032, 4381, 580, 13, 18884, 736, 1583, 3032, 1272, 29961, 5552, 29962, 13, 9651, 12020, 23833, 2392, 703, 2061, 756, 694, 5352, 426, 29991, 29878, 29913, 1642, 4830, 29898, 5552, 876, 515, 6213, 13, 13, 1678, 822, 4770, 842, 5552, 12035, 1311, 29892, 12421, 29892, 995, 1125, 13, 4706, 1583, 3032, 1272, 29961, 5552, 29962, 353, 995, 13, 4706, 736, 995, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 2380, 1125, 13, 4706, 736, 1583, 3032, 1272, 29961, 2248, 29962, 13, 13, 1678, 822, 4770, 842, 667, 12035, 1311, 29892, 2380, 29892, 995, 1125, 13, 4706, 1583, 3032, 1272, 29961, 2248, 29962, 353, 995, 13, 4706, 736, 995, 13, 13, 1678, 822, 731, 29918, 4381, 29898, 1311, 29892, 2322, 29922, 8516, 1125, 13, 4706, 565, 2322, 338, 5852, 29901, 13, 9651, 2322, 353, 4669, 13, 4706, 1583, 3032, 4381, 353, 2322, 13, 13, 13, 2917, 353, 4669, 7373, 4381, 29922, 1853, 29898, 8516, 876, 13, 13, 13, 1990, 5446, 29901, 29871, 396, 694, 25621, 29901, 405, 29947, 29900, 29896, 13, 1678, 3268, 29918, 1761, 353, 6213, 13, 1678, 409, 5652, 353, 6213, 13, 1678, 3414, 261, 353, 6213, 13, 1678, 1400, 29918, 12925, 353, 6213, 13, 13, 13, 1990, 15645, 29901, 29871, 396, 694, 25621, 29901, 405, 29947, 29900, 29896, 13, 1678, 409, 5652, 353, 6213, 13, 1678, 885, 7310, 353, 6213, 13, 1678, 7834, 353, 6213, 13, 13, 13, 3198, 353, 4669, 29898, 13, 1678, 5849, 29922, 8516, 29892, 13, 29897, 13, 13, 13, 2917, 29918, 16680, 353, 12782, 11726, 580, 13, 13, 13, 1753, 2254, 7295, 13, 1678, 5534, 2295, 29918, 16680, 13, 13, 1678, 565, 376, 2272, 1688, 29908, 297, 10876, 29889, 7576, 29901, 13, 4706, 2295, 29918, 16680, 29889, 949, 703, 2917, 29889, 455, 613, 8025, 543, 9420, 29899, 29947, 1159, 13, 1678, 25342, 2897, 29889, 2084, 29889, 275, 1445, 703, 2917, 29908, 1125, 13, 4706, 2295, 29918, 16680, 29889, 949, 703, 2917, 613, 8025, 543, 9420, 29899, 29947, 1159, 13, 1678, 1683, 29901, 13, 4706, 2295, 29918, 16680, 29889, 949, 703, 2917, 29889, 11249, 613, 8025, 543, 9420, 29899, 29947, 1159, 13, 1678, 1970, 353, 2295, 29918, 16680, 1839, 3991, 2033, 13, 13, 1678, 2295, 29889, 949, 29918, 1989, 353, 1970, 29889, 657, 877, 949, 29918, 1989, 742, 9872, 10818, 12948, 13, 1678, 2295, 29889, 3539, 29918, 1989, 353, 1970, 29889, 657, 877, 3539, 29918, 1989, 1495, 13, 1678, 2295, 29889, 3539, 29918, 6979, 353, 1970, 29889, 657, 877, 3539, 29918, 6979, 1495, 13, 13, 1678, 2295, 29889, 2746, 353, 1970, 29889, 657, 877, 2746, 742, 376, 2843, 29889, 7041, 29889, 510, 1159, 13, 13, 1678, 2295, 29889, 1188, 29918, 5563, 353, 938, 29898, 5527, 29889, 657, 877, 1188, 29918, 5563, 742, 29871, 29896, 876, 13, 1678, 2295, 29889, 1445, 29918, 1188, 29918, 5563, 353, 938, 29898, 5527, 29889, 657, 877, 1445, 29918, 1188, 29918, 5563, 742, 29871, 29941, 876, 13, 1678, 2295, 29889, 1188, 29918, 1445, 353, 1970, 29889, 657, 877, 1188, 29918, 1445, 742, 376, 1188, 29889, 3945, 1159, 13, 13, 1678, 2295, 29889, 2585, 29918, 1445, 353, 1970, 29889, 657, 877, 2585, 29918, 1445, 742, 376, 2843, 2262, 29889, 2585, 1159, 13, 1678, 2295, 29889, 20095, 29918, 29517, 353, 1970, 29889, 657, 877, 20095, 29918, 29517, 742, 376, 29875, 29933, 688, 29914, 8136, 23773, 1159, 13, 2 ]
test_memory.py
dbstein/python_examples
0
32652
import numpy as np from numexpr_kernel import numexpr_kernel from numba_kernel import numba_kernel N = 10000 x = np.random.rand(N) y = np.random.rand(N) z = np.random.rand(N) tau = np.random.rand(N) r1 = numexpr_kernel(x, y, z, tau) r1 = numexpr_kernel(x, y, z, tau) r2 = np.zeros(N, dtype=float) numba_kernel(x, y, z, tau, r2, N) numba_kernel(x, y, z, tau, r2, N)
[ 1, 1053, 12655, 408, 7442, 13, 3166, 954, 13338, 29918, 17460, 1053, 954, 13338, 29918, 17460, 13, 3166, 954, 2291, 29918, 17460, 1053, 954, 2291, 29918, 17460, 13, 13, 29940, 353, 29871, 29896, 29900, 29900, 29900, 29900, 13, 29916, 353, 7442, 29889, 8172, 29889, 9502, 29898, 29940, 29897, 13, 29891, 353, 7442, 29889, 8172, 29889, 9502, 29898, 29940, 29897, 13, 29920, 353, 7442, 29889, 8172, 29889, 9502, 29898, 29940, 29897, 13, 4722, 353, 7442, 29889, 8172, 29889, 9502, 29898, 29940, 29897, 13, 13, 29878, 29896, 353, 954, 13338, 29918, 17460, 29898, 29916, 29892, 343, 29892, 503, 29892, 260, 585, 29897, 13, 29878, 29896, 353, 954, 13338, 29918, 17460, 29898, 29916, 29892, 343, 29892, 503, 29892, 260, 585, 29897, 13, 29878, 29906, 353, 7442, 29889, 3298, 359, 29898, 29940, 29892, 26688, 29922, 7411, 29897, 13, 1949, 2291, 29918, 17460, 29898, 29916, 29892, 343, 29892, 503, 29892, 260, 585, 29892, 364, 29906, 29892, 405, 29897, 13, 1949, 2291, 29918, 17460, 29898, 29916, 29892, 343, 29892, 503, 29892, 260, 585, 29892, 364, 29906, 29892, 405, 29897, 13, 2 ]
bostaSDK/delivery/create/CreateDeliveryRequest.py
bostaapp/bosta-python
0
77483
import json from bostaSDK.utils.Address import Address from bostaSDK.utils.Receiver import Receiver from bostaSDK.utils.DeliverySpecs import DeliverySpecs class CreateDeliveryRequest: def __init__( self, deliveryType, cod, dropOffAddress: Address, receiver: Receiver, deliverySpecs=None, notes=None, businessReference=None, ): """ Initialize new instance from CreateDeliveryRequest class Parameters: deliveryType (int) cod (int): Cash on delivery amount dropOffAddress (Address) cashOnDelivery (int): Cash on delivery amount receiver (Receiver) deliverySpecs (DeliverySpecs) notes (str) businessReference (str) Returns: instance from CreateDeliveryRequest """ self.type = deliveryType self.cod = cod self.dropOffAddress = dropOffAddress self.receiver = receiver def toJSONPayload(self): """ Returns: JSON object from current instance """ return json.dumps({ "type": self.type, "cod": self.cod, "dropOffAddress": self.dropOffAddress.toJSON(), "receiver": self.receiver.toJSON() })
[ 1, 1053, 4390, 13, 13, 3166, 289, 16233, 26912, 29889, 13239, 29889, 7061, 1053, 16428, 13, 3166, 289, 16233, 26912, 29889, 13239, 29889, 22068, 1053, 24328, 2147, 13, 3166, 289, 16233, 26912, 29889, 13239, 29889, 29928, 27657, 10649, 2395, 1053, 360, 27657, 10649, 2395, 13, 13, 13, 1990, 6204, 29928, 27657, 3089, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 28289, 1542, 29892, 15234, 29892, 13, 4706, 5768, 6880, 7061, 29901, 16428, 29892, 19870, 29901, 24328, 2147, 29892, 13, 4706, 28289, 10649, 2395, 29922, 8516, 29892, 11486, 29922, 8516, 29892, 13, 4706, 5381, 7422, 29922, 8516, 29892, 13, 308, 1125, 13, 4706, 9995, 25455, 716, 2777, 515, 6204, 29928, 27657, 3089, 770, 13, 13, 4706, 12662, 2699, 29901, 13, 4706, 28289, 1542, 313, 524, 29897, 13, 4706, 15234, 313, 524, 1125, 315, 1161, 373, 28289, 5253, 13, 4706, 5768, 6880, 7061, 313, 7061, 29897, 13, 4706, 274, 1161, 2951, 29928, 27657, 313, 524, 1125, 315, 1161, 373, 28289, 5253, 13, 4706, 19870, 313, 22068, 29897, 13, 4706, 28289, 10649, 2395, 313, 29928, 27657, 10649, 2395, 29897, 13, 4706, 11486, 313, 710, 29897, 13, 4706, 5381, 7422, 313, 710, 29897, 13, 13, 4706, 16969, 29901, 2777, 515, 6204, 29928, 27657, 3089, 13, 13, 4706, 9995, 13, 4706, 1583, 29889, 1853, 353, 28289, 1542, 13, 4706, 1583, 29889, 19284, 353, 15234, 13, 4706, 1583, 29889, 8865, 6880, 7061, 353, 5768, 6880, 7061, 13, 4706, 1583, 29889, 13556, 2147, 353, 19870, 13, 13, 1678, 822, 304, 7249, 15467, 1359, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 16969, 29901, 13, 4706, 4663, 1203, 515, 1857, 2777, 13, 13, 4706, 9995, 13, 4706, 736, 4390, 29889, 29881, 17204, 3319, 13, 9651, 376, 1853, 1115, 1583, 29889, 1853, 29892, 13, 9651, 376, 19284, 1115, 1583, 29889, 19284, 29892, 13, 9651, 376, 8865, 6880, 7061, 1115, 1583, 29889, 8865, 6880, 7061, 29889, 517, 7249, 3285, 13, 9651, 376, 13556, 2147, 1115, 1583, 29889, 13556, 2147, 29889, 517, 7249, 580, 13, 4706, 5615, 13, 2 ]
Important_data/Thesis figure scripts/six_sigmoids.py
haakonvt/LearningTensorFlow
5
21290
<gh_stars>1-10 from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['Helvetica']}) rc('text', usetex=True) rc('legend',**{'fontsize':11}) # Font size for legend from mpl_toolkits.axes_grid.axislines import SubplotZero import matplotlib as mpl mpl.rcParams['lines.linewidth'] = 2.5 import matplotlib.pyplot as plt from math import erf,sqrt import numpy as np xmin = -4; xmax = 4 x = np.linspace(xmin,xmax,1001) y1 = lambda x: np.array([erf(0.5*i*sqrt(np.pi)) for i in x]) y2 = lambda x: np.tanh(x) y3 = lambda x: 4./np.pi*np.arctan(np.tanh(np.pi*x/4.)) y4 = lambda x: x/np.sqrt(1.+x**2) y5 = lambda x: 2.0/np.pi*np.arctan(np.pi/2.0 * x) y6 = lambda x: x/(1+np.abs(x)) fig = plt.figure(1) ax = SubplotZero(fig, 111) fig.add_subplot(ax) plt.subplots_adjust(left = 0.125, # the left side of the subplots of the figure right = 0.9, # the right side of the subplots of the figure bottom = 0.1, # the bottom of the subplots of the figure top = 0.9, # the top of the subplots of the figure wspace = 0., # the amount of width reserved for blank space between subplots hspace = 0.) # the amount of height reserved for white space between subplots plt.setp(ax, xticks=[-3,-2,-1,1,2,3], xticklabels=[" "," "," "," "," "," ",], yticks=[-1,1], yticklabels=[" "," ",]) # Make coordinate axes with "arrows" for direction in ["xzero", "yzero"]: ax.axis[direction].set_visible(True) # Coordinate axes with arrow (guess what, these are the arrows) plt.arrow(2.65, 0.0, 0.5, 0.0, color="k", clip_on=False, head_length=0.06, head_width=0.08) plt.arrow(0.0, 1.03, 0.0, 0.1, color="k", clip_on=False, head_length=0.06, head_width=0.08) # Remove edge around the entire plot for direction in ["left", "right", "bottom", "top"]: ax.axis[direction].set_visible(False) plt.rc('text', usetex=True) plt.rc('font', family='serif') colormap = plt.cm.Spectral #nipy_spectral # Other possible colormaps: Set1, Accent, nipy_spectral, Paired colors = [colormap(i) for i in np.linspace(0, 1, 6)] plt.title("Six sigmoid functions", fontsize=18, y=1.08) leg_list = [r"$\mathrm{erf}\left(\frac{\sqrt{\pi}}{2}x \right)$", r"$\tanh(x)$", r"$\frac{2}{\pi}\mathrm{gd}\left( \frac{\pi}{2}x \right)$", r"$x\left(1+x^2\right)^{-\frac{1}{2}}$", r"$\frac{2}{\pi}\mathrm{arctan}\left( \frac{\pi}{2}x \right)$", r"$x\left(1+|x|\right)^{-1}$"] for i in range(1,7): s = "ax.plot(x,y%s(x),color=colors[i-1])" %(str(i)) eval(s) ax.legend(leg_list,loc="best", ncol=2, fancybox=True) # title="Legend", fontsize=12 # ax.grid(True, which='both') ax.set_aspect('equal') ax.set_xlim([-3.1,3.1]) ax.set_ylim([-1.1,1.1]) ax.annotate('1', xy=(0.08, 1-0.02)) ax.annotate('0', xy=(0.08, -0.2)) ax.annotate('-1', xy=(0.08, -1-0.03)) for i in [-3,-2,-1,1,2,3]: ax.annotate('%s' %str(i), xy=(i-0.03, -0.2)) maybe = raw_input("\nUpdate figure directly in master thesis?\nEnter 'YES' (anything else = ONLY show to screen) ") if maybe == "YES": # Only save to disc if need to be updated filenameWithPath = "/Users/haakonvt/Dropbox/uio/master/latex-master/Illustrations/six_sigmoids.pdf" plt.savefig(filenameWithPath, bbox_inches='tight') #, pad_inches=0.2) print 'Saved over previous file in location:\n "%s"' %filenameWithPath else: print 'Figure was only shown on screen.' plt.show()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 22889, 1053, 364, 29883, 13, 2214, 877, 5657, 742, 1068, 10998, 11922, 22099, 29879, 550, 29899, 643, 361, 3788, 29879, 550, 29899, 643, 361, 2396, 1839, 7658, 5990, 983, 2033, 1800, 13, 2214, 877, 726, 742, 502, 300, 735, 29922, 5574, 29897, 13, 2214, 877, 26172, 742, 1068, 10998, 5657, 2311, 2396, 29896, 29896, 1800, 396, 10928, 2159, 363, 15983, 13, 13, 3166, 286, 572, 29918, 10154, 29895, 1169, 29889, 1165, 267, 29918, 7720, 29889, 1165, 7497, 1475, 1053, 3323, 5317, 24214, 13, 5215, 22889, 408, 286, 572, 13, 29885, 572, 29889, 2214, 9629, 1839, 9012, 29889, 16292, 2033, 353, 29871, 29906, 29889, 29945, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 5844, 1053, 23467, 29892, 3676, 13, 5215, 12655, 408, 7442, 13, 13, 29916, 1195, 353, 448, 29946, 29936, 921, 3317, 353, 29871, 29946, 13, 29916, 353, 7442, 29889, 1915, 3493, 29898, 29916, 1195, 29892, 29916, 3317, 29892, 29896, 29900, 29900, 29896, 29897, 13, 13, 29891, 29896, 353, 14013, 921, 29901, 7442, 29889, 2378, 4197, 261, 29888, 29898, 29900, 29889, 29945, 29930, 29875, 29930, 3676, 29898, 9302, 29889, 1631, 876, 363, 474, 297, 921, 2314, 13, 29891, 29906, 353, 14013, 921, 29901, 7442, 29889, 13161, 29882, 29898, 29916, 29897, 13, 29891, 29941, 353, 14013, 921, 29901, 29871, 29946, 6904, 9302, 29889, 1631, 29930, 9302, 29889, 27014, 273, 29898, 9302, 29889, 13161, 29882, 29898, 9302, 29889, 1631, 29930, 29916, 29914, 29946, 29889, 876, 13, 29891, 29946, 353, 14013, 921, 29901, 921, 29914, 9302, 29889, 3676, 29898, 29896, 29889, 29974, 29916, 1068, 29906, 29897, 13, 29891, 29945, 353, 14013, 921, 29901, 29871, 29906, 29889, 29900, 29914, 9302, 29889, 1631, 29930, 9302, 29889, 27014, 273, 29898, 9302, 29889, 1631, 29914, 29906, 29889, 29900, 334, 921, 29897, 13, 29891, 29953, 353, 14013, 921, 29901, 921, 14571, 29896, 29974, 9302, 29889, 6897, 29898, 29916, 876, 13, 13, 1003, 353, 14770, 29889, 4532, 29898, 29896, 29897, 13, 1165, 353, 3323, 5317, 24214, 29898, 1003, 29892, 29871, 29896, 29896, 29896, 29897, 13, 1003, 29889, 1202, 29918, 1491, 5317, 29898, 1165, 29897, 13, 572, 29873, 29889, 1491, 26762, 29918, 328, 5143, 29898, 1563, 29871, 353, 29871, 29900, 29889, 29896, 29906, 29945, 29892, 29871, 396, 278, 2175, 2625, 310, 278, 1014, 26762, 310, 278, 4377, 13, 462, 1678, 1492, 353, 29871, 29900, 29889, 29929, 29892, 1678, 396, 278, 1492, 2625, 310, 278, 1014, 26762, 310, 278, 4377, 13, 462, 1678, 5970, 353, 29871, 29900, 29889, 29896, 29892, 259, 396, 278, 5970, 310, 278, 1014, 26762, 310, 278, 4377, 13, 462, 1678, 2246, 353, 29871, 29900, 29889, 29929, 29892, 418, 396, 278, 2246, 310, 278, 1014, 26762, 310, 278, 4377, 13, 462, 1678, 281, 3493, 353, 29871, 29900, 1696, 259, 396, 278, 5253, 310, 2920, 21676, 363, 9654, 2913, 1546, 1014, 26762, 13, 462, 1678, 298, 3493, 353, 29871, 29900, 1846, 259, 396, 278, 5253, 310, 3171, 21676, 363, 4796, 2913, 1546, 1014, 26762, 13, 13, 572, 29873, 29889, 842, 29886, 29898, 1165, 29892, 29871, 486, 7358, 11759, 29899, 29941, 6653, 29906, 6653, 29896, 29892, 29896, 29892, 29906, 29892, 29941, 1402, 29871, 486, 860, 21134, 29922, 3366, 28796, 28796, 28796, 28796, 28796, 9162, 1402, 343, 29873, 7358, 11759, 29899, 29896, 29892, 29896, 1402, 343, 24667, 21134, 29922, 3366, 28796, 9162, 2314, 13, 13, 29937, 8561, 14821, 27815, 411, 376, 2936, 29879, 29908, 13, 1454, 5305, 297, 6796, 29916, 9171, 613, 376, 29891, 9171, 3108, 29901, 13, 1678, 4853, 29889, 8990, 29961, 20845, 1822, 842, 29918, 12872, 29898, 5574, 29897, 13, 13, 29937, 3189, 16065, 27815, 411, 16578, 313, 2543, 404, 825, 29892, 1438, 526, 278, 564, 5727, 29897, 13, 572, 29873, 29889, 2936, 29898, 29906, 29889, 29953, 29945, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29945, 29892, 29871, 29900, 29889, 29900, 29892, 2927, 543, 29895, 613, 20102, 29918, 265, 29922, 8824, 29892, 2343, 29918, 2848, 29922, 29900, 29889, 29900, 29953, 29892, 2343, 29918, 2103, 29922, 29900, 29889, 29900, 29947, 29897, 13, 572, 29873, 29889, 2936, 29898, 29900, 29889, 29900, 29892, 29871, 29896, 29889, 29900, 29941, 29892, 29871, 29900, 29889, 29900, 29892, 29871, 29900, 29889, 29896, 29892, 2927, 543, 29895, 613, 20102, 29918, 265, 29922, 8824, 29892, 2343, 29918, 2848, 29922, 29900, 29889, 29900, 29953, 29892, 2343, 29918, 2103, 29922, 29900, 29889, 29900, 29947, 29897, 13, 13, 29937, 15154, 7636, 2820, 278, 4152, 6492, 13, 1454, 5305, 297, 6796, 1563, 613, 376, 1266, 613, 376, 8968, 613, 376, 3332, 3108, 29901, 13, 1678, 4853, 29889, 8990, 29961, 20845, 1822, 842, 29918, 12872, 29898, 8824, 29897, 13, 13, 572, 29873, 29889, 2214, 877, 726, 742, 502, 300, 735, 29922, 5574, 29897, 13, 572, 29873, 29889, 2214, 877, 5657, 742, 3942, 2433, 643, 361, 1495, 13, 1054, 555, 481, 353, 14770, 29889, 4912, 29889, 29903, 1103, 1705, 396, 29876, 666, 29891, 29918, 21494, 1705, 396, 5901, 1950, 784, 555, 2547, 29901, 3789, 29896, 29892, 4831, 296, 29892, 302, 666, 29891, 29918, 21494, 1705, 29892, 2621, 2859, 13, 27703, 259, 353, 518, 1054, 555, 481, 29898, 29875, 29897, 363, 474, 297, 7442, 29889, 1915, 3493, 29898, 29900, 29892, 29871, 29896, 29892, 29871, 29953, 4638, 13, 13, 572, 29873, 29889, 3257, 703, 29903, 861, 4365, 29885, 3398, 3168, 613, 4079, 2311, 29922, 29896, 29947, 29892, 343, 29922, 29896, 29889, 29900, 29947, 29897, 13, 13, 1397, 29918, 1761, 353, 518, 29878, 29908, 4535, 3141, 29912, 261, 29888, 1012, 1563, 1194, 1154, 741, 3676, 741, 1631, 7585, 29906, 29913, 29916, 320, 1266, 1262, 613, 13, 9651, 364, 29908, 4535, 13161, 29882, 29898, 29916, 1262, 613, 13, 9651, 364, 29908, 4535, 1154, 29912, 29906, 3331, 1631, 1012, 3141, 29912, 29887, 29881, 1012, 1563, 29898, 320, 1154, 741, 1631, 1157, 29906, 29913, 29916, 320, 1266, 1262, 613, 13, 9651, 364, 29908, 29938, 29916, 29905, 1563, 29898, 29896, 29974, 29916, 29985, 29906, 29905, 1266, 8940, 2612, 1154, 29912, 29896, 1157, 29906, 7920, 613, 13, 9651, 364, 29908, 4535, 1154, 29912, 29906, 3331, 1631, 1012, 3141, 29912, 27014, 273, 1012, 1563, 29898, 320, 1154, 741, 1631, 1157, 29906, 29913, 29916, 320, 1266, 1262, 613, 13, 9651, 364, 29908, 29938, 29916, 29905, 1563, 29898, 29896, 29974, 29989, 29916, 4295, 1266, 21604, 29896, 1042, 3108, 13, 13, 1454, 474, 297, 3464, 29898, 29896, 29892, 29955, 1125, 13, 1678, 269, 353, 376, 1165, 29889, 5317, 29898, 29916, 29892, 29891, 29995, 29879, 29898, 29916, 511, 2780, 29922, 27703, 29961, 29875, 29899, 29896, 2314, 29908, 1273, 29898, 710, 29898, 29875, 876, 13, 1678, 19745, 29898, 29879, 29897, 13, 1165, 29889, 26172, 29898, 1397, 29918, 1761, 29892, 2029, 543, 13318, 613, 302, 1054, 29922, 29906, 29892, 19231, 1884, 29922, 5574, 29897, 396, 3611, 543, 22988, 355, 613, 4079, 2311, 29922, 29896, 29906, 13, 29937, 4853, 29889, 7720, 29898, 5574, 29892, 607, 2433, 20313, 1495, 13, 1165, 29889, 842, 29918, 294, 1103, 877, 11745, 1495, 13, 1165, 29889, 842, 29918, 29916, 2576, 4197, 29899, 29941, 29889, 29896, 29892, 29941, 29889, 29896, 2314, 13, 1165, 29889, 842, 29918, 29891, 2576, 4197, 29899, 29896, 29889, 29896, 29892, 29896, 29889, 29896, 2314, 13, 13, 1165, 29889, 6735, 403, 877, 29896, 742, 921, 29891, 7607, 29900, 29889, 29900, 29947, 29892, 29871, 29896, 29899, 29900, 29889, 29900, 29906, 876, 13, 1165, 29889, 6735, 403, 877, 29900, 742, 921, 29891, 7607, 29900, 29889, 29900, 29947, 29892, 448, 29900, 29889, 29906, 876, 13, 1165, 29889, 6735, 403, 877, 29899, 29896, 742, 921, 29891, 7607, 29900, 29889, 29900, 29947, 29892, 448, 29896, 29899, 29900, 29889, 29900, 29941, 876, 13, 13, 1454, 474, 297, 21069, 29941, 6653, 29906, 6653, 29896, 29892, 29896, 29892, 29906, 29892, 29941, 5387, 13, 1678, 4853, 29889, 6735, 403, 877, 29995, 29879, 29915, 1273, 710, 29898, 29875, 511, 921, 29891, 7607, 29875, 29899, 29900, 29889, 29900, 29941, 29892, 448, 29900, 29889, 29906, 876, 13, 13, 26026, 353, 10650, 29918, 2080, 14182, 29876, 6422, 4377, 4153, 297, 5835, 266, 6656, 29973, 29905, 29876, 10399, 525, 21143, 29915, 313, 1384, 1918, 1683, 353, 6732, 16786, 1510, 304, 4315, 29897, 16521, 13, 361, 5505, 1275, 376, 21143, 1115, 396, 9333, 4078, 304, 2313, 565, 817, 304, 367, 4784, 13, 1678, 10422, 3047, 2605, 353, 5591, 5959, 29914, 2350, 557, 265, 21908, 29914, 15063, 1884, 29914, 29884, 601, 29914, 6207, 29914, 25694, 29899, 6207, 29914, 10002, 4627, 800, 29914, 28319, 29918, 18816, 29885, 3398, 29879, 29889, 5140, 29908, 13, 1678, 14770, 29889, 7620, 1003, 29898, 9507, 3047, 2605, 29892, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 1495, 396, 29892, 17132, 29918, 262, 6609, 29922, 29900, 29889, 29906, 29897, 13, 1678, 1596, 525, 29903, 10511, 975, 3517, 934, 297, 4423, 3583, 29876, 11860, 29879, 29908, 29915, 1273, 9507, 3047, 2605, 13, 2870, 29901, 13, 1678, 1596, 525, 13080, 545, 471, 871, 4318, 373, 4315, 6169, 13, 1678, 14770, 29889, 4294, 580, 13, 2 ]
nbx/cli/client.py
dalejung/nbx
2
83294
<filename>nbx/cli/client.py import requests class IPythonService(object): def __init__(self, host, port, token=None): self.host = host self.port = port self.token = token def _get(self, path, **kwargs): token = self.token if token: kwargs['headers'] = {'Authorization': f'token {token}'} url = 'http://{host}:{port}/{path}'.format(path=path, **self.__dict__) r = requests.get(url, **kwargs) return r.json() def sessions(self): return self._get('api/sessions') def server_info(self): return self._get('server-info') def kernel_info(self, kernel_id): return self._get('api/kernel-info/{kernel_id}'.format(kernel_id=kernel_id)) class IPythonClient(object): def __init__(self, service): self.service = service self.sessions_cache = None def _list_sessions(self): sessions = self.service.sessions() self.sessions_cache = sessions lines = [self._format_session(i, session) for i, session in enumerate(sessions)] return lines def list_sessions(self): lines = [] lines.append("Active Kernels:") lines.append("====================") lines.extend(self._list_sessions()) print('\n'.join(lines)) def _format_session(self, i, session): name = session['notebook']['path'].rsplit('/')[-1] return "[{i}] {name}".format(i=i, name=name) def _get_session(self, pos): session = self.sessions_cache[pos] return session def attach(self, pos): info = self.service.server_info() profile = info['profile'] pos = int(pos) session = self._get_session(pos) print("=" * 80) name = session['notebook']['path'].rsplit('/')[-1] print("Attaching to {name}".format(name=name)) print("=" * 80) return attach_session(session, profile=profile) def kernel_path(self, pos): info = self.service.server_info() profile = info['profile'] pos = int(pos) session = self._get_session(pos) kernel_id = session['kernel']['id'] kernel_info = self.service.kernel_info(kernel_id) kernel_path = kernel_info['kernel_path'] return kernel_path def attach_session(session, profile='default'): """ Start a terminal app attached to a notebook """ from jupyter_console import app kernel = 'kernel-{0}.json'.format(session['kernel']['id']) # TODO support other submodules like qtconsole argv = ['console', '--existing', kernel, '--profile={0}'.format(profile)] return app.launch_new_instance(argv=argv) def client(host="127.0.0.1", port="8888", token=None): service = IPythonService(host, port, token) client = IPythonClient(service) return client
[ 1, 529, 9507, 29958, 9877, 29916, 29914, 11303, 29914, 4645, 29889, 2272, 13, 5215, 7274, 13, 13, 1990, 5641, 1656, 3170, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3495, 29892, 2011, 29892, 5993, 29922, 8516, 1125, 13, 4706, 1583, 29889, 3069, 353, 3495, 13, 4706, 1583, 29889, 637, 353, 2011, 13, 4706, 1583, 29889, 6979, 353, 5993, 13, 13, 1678, 822, 903, 657, 29898, 1311, 29892, 2224, 29892, 3579, 19290, 1125, 13, 4706, 5993, 353, 1583, 29889, 6979, 13, 4706, 565, 5993, 29901, 13, 9651, 9049, 5085, 1839, 13662, 2033, 353, 11117, 25471, 2396, 285, 29915, 6979, 426, 6979, 10162, 29913, 13, 4706, 3142, 353, 525, 1124, 597, 29912, 3069, 6177, 29912, 637, 6822, 29912, 2084, 29913, 4286, 4830, 29898, 2084, 29922, 2084, 29892, 3579, 1311, 17255, 8977, 1649, 29897, 13, 4706, 364, 353, 7274, 29889, 657, 29898, 2271, 29892, 3579, 19290, 29897, 13, 4706, 736, 364, 29889, 3126, 580, 13, 13, 1678, 822, 21396, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 657, 877, 2754, 29914, 29879, 10964, 1495, 13, 13, 1678, 822, 1923, 29918, 3888, 29898, 1311, 1125, 13, 4706, 736, 1583, 3032, 657, 877, 2974, 29899, 3888, 1495, 13, 13, 1678, 822, 8466, 29918, 3888, 29898, 1311, 29892, 8466, 29918, 333, 1125, 13, 4706, 736, 1583, 3032, 657, 877, 2754, 29914, 17460, 29899, 3888, 19248, 17460, 29918, 333, 29913, 4286, 4830, 29898, 17460, 29918, 333, 29922, 17460, 29918, 333, 876, 13, 13, 1990, 5641, 1656, 4032, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 2669, 1125, 13, 4706, 1583, 29889, 5509, 353, 2669, 13, 4706, 1583, 29889, 29879, 10964, 29918, 8173, 353, 6213, 13, 13, 1678, 822, 903, 1761, 29918, 29879, 10964, 29898, 1311, 1125, 13, 4706, 21396, 353, 1583, 29889, 5509, 29889, 29879, 10964, 580, 13, 4706, 1583, 29889, 29879, 10964, 29918, 8173, 353, 21396, 13, 4706, 3454, 353, 518, 1311, 3032, 4830, 29918, 7924, 29898, 29875, 29892, 4867, 29897, 363, 474, 29892, 4867, 297, 26985, 29898, 29879, 10964, 4638, 13, 4706, 736, 3454, 13, 13, 1678, 822, 1051, 29918, 29879, 10964, 29898, 1311, 1125, 13, 4706, 3454, 353, 5159, 13, 4706, 3454, 29889, 4397, 703, 9966, 476, 824, 1379, 29901, 1159, 13, 4706, 3454, 29889, 4397, 703, 9166, 25512, 543, 29897, 13, 4706, 3454, 29889, 21843, 29898, 1311, 3032, 1761, 29918, 29879, 10964, 3101, 13, 4706, 1596, 28909, 29876, 4286, 7122, 29898, 9012, 876, 13, 13, 1678, 822, 903, 4830, 29918, 7924, 29898, 1311, 29892, 474, 29892, 4867, 1125, 13, 4706, 1024, 353, 4867, 1839, 1333, 19273, 16215, 2084, 13359, 2288, 2830, 11219, 1495, 14352, 29896, 29962, 13, 4706, 736, 14704, 29912, 29875, 6525, 426, 978, 29913, 1642, 4830, 29898, 29875, 29922, 29875, 29892, 1024, 29922, 978, 29897, 13, 13, 1678, 822, 903, 657, 29918, 7924, 29898, 1311, 29892, 926, 1125, 13, 4706, 4867, 353, 1583, 29889, 29879, 10964, 29918, 8173, 29961, 1066, 29962, 13, 4706, 736, 4867, 13, 13, 1678, 822, 10641, 29898, 1311, 29892, 926, 1125, 13, 4706, 5235, 353, 1583, 29889, 5509, 29889, 2974, 29918, 3888, 580, 13, 4706, 8722, 353, 5235, 1839, 10185, 2033, 13, 4706, 926, 353, 938, 29898, 1066, 29897, 13, 4706, 4867, 353, 1583, 3032, 657, 29918, 7924, 29898, 1066, 29897, 13, 4706, 1596, 703, 543, 334, 29871, 29947, 29900, 29897, 13, 4706, 1024, 353, 4867, 1839, 1333, 19273, 16215, 2084, 13359, 2288, 2830, 11219, 1495, 14352, 29896, 29962, 13, 4706, 1596, 703, 4165, 9733, 304, 426, 978, 29913, 1642, 4830, 29898, 978, 29922, 978, 876, 13, 4706, 1596, 703, 543, 334, 29871, 29947, 29900, 29897, 13, 4706, 736, 10641, 29918, 7924, 29898, 7924, 29892, 8722, 29922, 10185, 29897, 13, 13, 1678, 822, 8466, 29918, 2084, 29898, 1311, 29892, 926, 1125, 13, 4706, 5235, 353, 1583, 29889, 5509, 29889, 2974, 29918, 3888, 580, 13, 4706, 8722, 353, 5235, 1839, 10185, 2033, 13, 4706, 926, 353, 938, 29898, 1066, 29897, 13, 4706, 4867, 353, 1583, 3032, 657, 29918, 7924, 29898, 1066, 29897, 13, 4706, 8466, 29918, 333, 353, 4867, 1839, 17460, 16215, 333, 2033, 13, 4706, 8466, 29918, 3888, 353, 1583, 29889, 5509, 29889, 17460, 29918, 3888, 29898, 17460, 29918, 333, 29897, 13, 4706, 8466, 29918, 2084, 353, 8466, 29918, 3888, 1839, 17460, 29918, 2084, 2033, 13, 4706, 736, 8466, 29918, 2084, 13, 13, 1753, 10641, 29918, 7924, 29898, 7924, 29892, 8722, 2433, 4381, 29374, 13, 1678, 9995, 13, 4706, 7370, 263, 8638, 623, 10959, 304, 263, 451, 19273, 13, 1678, 9995, 13, 1678, 515, 432, 786, 25547, 29918, 11058, 1053, 623, 13, 1678, 8466, 353, 525, 17460, 29899, 29912, 29900, 1836, 3126, 4286, 4830, 29898, 7924, 1839, 17460, 16215, 333, 11287, 13, 1678, 396, 14402, 2304, 916, 1014, 7576, 763, 3855, 29873, 11058, 13, 1678, 1852, 29894, 353, 6024, 11058, 742, 525, 489, 735, 15423, 742, 8466, 29892, 525, 489, 10185, 3790, 29900, 29913, 4286, 4830, 29898, 10185, 4638, 13, 1678, 736, 623, 29889, 15343, 29918, 1482, 29918, 8758, 29898, 19218, 29922, 19218, 29897, 13, 13, 1753, 3132, 29898, 3069, 543, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 613, 2011, 543, 29947, 29947, 29947, 29947, 613, 5993, 29922, 8516, 1125, 13, 1678, 2669, 353, 5641, 1656, 3170, 29898, 3069, 29892, 2011, 29892, 5993, 29897, 13, 1678, 3132, 353, 5641, 1656, 4032, 29898, 5509, 29897, 13, 1678, 736, 3132, 13, 2 ]
viewer/bitmap_from_array.py
TiankunZhou/dials
2
12196
from __future__ import absolute_import, division, print_function import numpy as np import wx from dials.array_family import flex from dials_viewer_ext import rgb_img class wxbmp_from_np_array(object): def __init__( self, lst_data_in, show_nums=True, palette="black2white", lst_data_mask_in=None ): self.wx_bmp_arr = rgb_img() if lst_data_in is None and lst_data_mask_in is None: self._ini_wx_bmp_lst = None else: self._ini_wx_bmp_lst = [] for lst_pos in range(len(lst_data_in)): data_3d_in = lst_data_in[lst_pos] xmax = data_3d_in.shape[1] ymax = data_3d_in.shape[2] # remember to put here some assertion to check that # both arrays have the same shape if lst_data_mask_in is not None: data_3d_in_mask = lst_data_mask_in[lst_pos] self.vl_max = float(np.amax(data_3d_in)) self.vl_min = float(np.amin(data_3d_in)) tmp_data2d = np.zeros((xmax, ymax), "double") tmp_data2d_mask = np.zeros((xmax, ymax), "double") z_dp = data_3d_in.shape[0] single_block_lst_01 = [] for z in range(z_dp): # print "z =", z tmp_data2d[:, :] = data_3d_in[z : z + 1, :, :] if lst_data_mask_in is not None: tmp_data2d_mask[:, :] = data_3d_in_mask[z : z + 1, :, :] else: tmp_data2d_mask = None data_sigle_img = self._wx_img_w_cpp( tmp_data2d, show_nums, palette, tmp_data2d_mask ) single_block_lst_01.append(data_sigle_img) self._ini_wx_bmp_lst.append(single_block_lst_01) def bmp_lst_scaled(self, scale=1.0): if self._ini_wx_bmp_lst is None: NewW = 350 wx_image = wx.Image(NewW, NewW) wxBitmap = wx_image.ConvertToBitmap() dc = wx.MemoryDC(wxBitmap) text = "No Shoebox data" w, h = dc.GetSize() tw, th = dc.GetTextExtent(text) dc.Clear() dc.DrawText(text, (w - tw) / 2, (h - th) / 2) # display text in center dc.SelectObject(wxBitmap) del dc wx_bmp_lst = [[wxBitmap]] else: wx_bmp_lst = [] for data_3d in self._ini_wx_bmp_lst: single_block_lst = [] for sigle_img_data in data_3d: single_block_lst.append(self._wx_bmp_scaled(sigle_img_data, scale)) wx_bmp_lst.append(single_block_lst) return wx_bmp_lst def _wx_img_w_cpp(self, np_2d_tmp, show_nums, palette, np_2d_mask=None): xmax = np_2d_tmp.shape[1] ymax = np_2d_tmp.shape[0] if np_2d_mask is None: np_2d_mask = np.zeros((ymax, xmax), "double") transposed_data = np.zeros((ymax, xmax), "double") transposed_mask = np.zeros((ymax, xmax), "double") transposed_data[:, :] = np_2d_tmp transposed_mask[:, :] = np_2d_mask flex_data_in = flex.double(transposed_data) flex_mask_in = flex.double(transposed_mask) if palette == "black2white": palette_num = 1 elif palette == "white2black": palette_num = 2 elif palette == "hot ascend": palette_num = 3 else: # assuming "hot descend" palette_num = 4 img_array_tmp = self.wx_bmp_arr.gen_bmp( flex_data_in, flex_mask_in, show_nums, palette_num ) np_img_array = img_array_tmp.as_numpy_array() height = np.size(np_img_array[:, 0:1, 0:1]) width = np.size(np_img_array[0:1, :, 0:1]) img_array = np.empty((height, width, 3), "uint8") img_array[:, :, :] = np_img_array[:, :, :] self._wx_image = wx.Image(width, height) self._wx_image.SetData(img_array.tostring()) data_to_become_bmp = (self._wx_image, width, height) return data_to_become_bmp def _wx_bmp_scaled(self, data_to_become_bmp, scale): to_become_bmp = data_to_become_bmp[0] width = data_to_become_bmp[1] height = data_to_become_bmp[2] NewW = int(width * scale) NewH = int(height * scale) to_become_bmp = to_become_bmp.Scale(NewW, NewH, wx.IMAGE_QUALITY_NORMAL) wxBitmap = to_become_bmp.ConvertToBitmap() return wxBitmap
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 29892, 1596, 29918, 2220, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 26437, 13, 13, 3166, 270, 616, 29879, 29889, 2378, 29918, 11922, 1053, 8525, 13, 3166, 270, 616, 29879, 29918, 29894, 15580, 29918, 1062, 1053, 15552, 29890, 29918, 2492, 13, 13, 13, 1990, 26437, 29890, 1526, 29918, 3166, 29918, 9302, 29918, 2378, 29898, 3318, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 4706, 1583, 29892, 24471, 29918, 1272, 29918, 262, 29892, 1510, 29918, 1949, 29879, 29922, 5574, 29892, 282, 26456, 543, 8517, 29906, 10921, 613, 24471, 29918, 1272, 29918, 13168, 29918, 262, 29922, 8516, 13, 268, 1125, 13, 4706, 1583, 29889, 23310, 29918, 29890, 1526, 29918, 2749, 353, 15552, 29890, 29918, 2492, 580, 13, 4706, 565, 24471, 29918, 1272, 29918, 262, 338, 6213, 322, 24471, 29918, 1272, 29918, 13168, 29918, 262, 338, 6213, 29901, 13, 9651, 1583, 3032, 2172, 29918, 23310, 29918, 29890, 1526, 29918, 20155, 353, 6213, 13, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 2172, 29918, 23310, 29918, 29890, 1526, 29918, 20155, 353, 5159, 13, 9651, 363, 24471, 29918, 1066, 297, 3464, 29898, 2435, 29898, 20155, 29918, 1272, 29918, 262, 22164, 13, 18884, 848, 29918, 29941, 29881, 29918, 262, 353, 24471, 29918, 1272, 29918, 262, 29961, 20155, 29918, 1066, 29962, 13, 18884, 921, 3317, 353, 848, 29918, 29941, 29881, 29918, 262, 29889, 12181, 29961, 29896, 29962, 13, 18884, 343, 3317, 353, 848, 29918, 29941, 29881, 29918, 262, 29889, 12181, 29961, 29906, 29962, 13, 13, 18884, 396, 6456, 304, 1925, 1244, 777, 28306, 304, 1423, 393, 13, 18884, 396, 1716, 7049, 505, 278, 1021, 8267, 13, 13, 18884, 565, 24471, 29918, 1272, 29918, 13168, 29918, 262, 338, 451, 6213, 29901, 13, 462, 1678, 848, 29918, 29941, 29881, 29918, 262, 29918, 13168, 353, 24471, 29918, 1272, 29918, 13168, 29918, 262, 29961, 20155, 29918, 1066, 29962, 13, 13, 18884, 1583, 29889, 20901, 29918, 3317, 353, 5785, 29898, 9302, 29889, 314, 1165, 29898, 1272, 29918, 29941, 29881, 29918, 262, 876, 13, 18884, 1583, 29889, 20901, 29918, 1195, 353, 5785, 29898, 9302, 29889, 9103, 29898, 1272, 29918, 29941, 29881, 29918, 262, 876, 13, 18884, 13128, 29918, 1272, 29906, 29881, 353, 7442, 29889, 3298, 359, 3552, 29916, 3317, 29892, 343, 3317, 511, 376, 8896, 1159, 13, 18884, 13128, 29918, 1272, 29906, 29881, 29918, 13168, 353, 7442, 29889, 3298, 359, 3552, 29916, 3317, 29892, 343, 3317, 511, 376, 8896, 1159, 13, 18884, 503, 29918, 6099, 353, 848, 29918, 29941, 29881, 29918, 262, 29889, 12181, 29961, 29900, 29962, 13, 18884, 2323, 29918, 1271, 29918, 20155, 29918, 29900, 29896, 353, 5159, 13, 18884, 363, 503, 297, 3464, 29898, 29920, 29918, 6099, 1125, 13, 462, 1678, 396, 1596, 376, 29920, 353, 613, 503, 13, 462, 1678, 13128, 29918, 1272, 29906, 29881, 7503, 29892, 584, 29962, 353, 848, 29918, 29941, 29881, 29918, 262, 29961, 29920, 584, 503, 718, 29871, 29896, 29892, 584, 29892, 584, 29962, 13, 462, 1678, 565, 24471, 29918, 1272, 29918, 13168, 29918, 262, 338, 451, 6213, 29901, 13, 462, 4706, 13128, 29918, 1272, 29906, 29881, 29918, 13168, 7503, 29892, 584, 29962, 353, 848, 29918, 29941, 29881, 29918, 262, 29918, 13168, 29961, 29920, 584, 503, 718, 29871, 29896, 29892, 584, 29892, 584, 29962, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 13128, 29918, 1272, 29906, 29881, 29918, 13168, 353, 6213, 13, 13, 462, 1678, 848, 29918, 18816, 280, 29918, 2492, 353, 1583, 3032, 23310, 29918, 2492, 29918, 29893, 29918, 8223, 29898, 13, 462, 4706, 13128, 29918, 1272, 29906, 29881, 29892, 1510, 29918, 1949, 29879, 29892, 282, 26456, 29892, 13128, 29918, 1272, 29906, 29881, 29918, 13168, 13, 462, 1678, 1723, 13, 13, 462, 1678, 2323, 29918, 1271, 29918, 20155, 29918, 29900, 29896, 29889, 4397, 29898, 1272, 29918, 18816, 280, 29918, 2492, 29897, 13, 13, 18884, 1583, 3032, 2172, 29918, 23310, 29918, 29890, 1526, 29918, 20155, 29889, 4397, 29898, 14369, 29918, 1271, 29918, 20155, 29918, 29900, 29896, 29897, 13, 13, 1678, 822, 289, 1526, 29918, 20155, 29918, 7052, 29881, 29898, 1311, 29892, 6287, 29922, 29896, 29889, 29900, 1125, 13, 4706, 565, 1583, 3032, 2172, 29918, 23310, 29918, 29890, 1526, 29918, 20155, 338, 6213, 29901, 13, 13, 9651, 1570, 29956, 353, 29871, 29941, 29945, 29900, 13, 13, 9651, 26437, 29918, 3027, 353, 26437, 29889, 2940, 29898, 4373, 29956, 29892, 1570, 29956, 29897, 13, 9651, 26437, 15184, 353, 26437, 29918, 3027, 29889, 18455, 1762, 15184, 580, 13, 13, 9651, 270, 29883, 353, 26437, 29889, 16015, 12696, 29898, 23310, 15184, 29897, 13, 9651, 1426, 353, 376, 3782, 17550, 774, 2251, 848, 29908, 13, 9651, 281, 29892, 298, 353, 270, 29883, 29889, 2577, 3505, 580, 13, 9651, 3252, 29892, 266, 353, 270, 29883, 29889, 2577, 1626, 5647, 296, 29898, 726, 29897, 13, 9651, 270, 29883, 29889, 18759, 580, 13, 9651, 270, 29883, 29889, 8537, 1626, 29898, 726, 29892, 313, 29893, 448, 3252, 29897, 847, 29871, 29906, 29892, 313, 29882, 448, 266, 29897, 847, 29871, 29906, 29897, 29871, 396, 2479, 1426, 297, 4818, 13, 9651, 270, 29883, 29889, 3549, 2061, 29898, 23310, 15184, 29897, 13, 9651, 628, 270, 29883, 13, 9651, 26437, 29918, 29890, 1526, 29918, 20155, 353, 5519, 23310, 15184, 5262, 13, 13, 4706, 1683, 29901, 13, 9651, 26437, 29918, 29890, 1526, 29918, 20155, 353, 5159, 13, 9651, 363, 848, 29918, 29941, 29881, 297, 1583, 3032, 2172, 29918, 23310, 29918, 29890, 1526, 29918, 20155, 29901, 13, 18884, 2323, 29918, 1271, 29918, 20155, 353, 5159, 13, 18884, 363, 4365, 280, 29918, 2492, 29918, 1272, 297, 848, 29918, 29941, 29881, 29901, 13, 462, 1678, 2323, 29918, 1271, 29918, 20155, 29889, 4397, 29898, 1311, 3032, 23310, 29918, 29890, 1526, 29918, 7052, 29881, 29898, 18816, 280, 29918, 2492, 29918, 1272, 29892, 6287, 876, 13, 13, 18884, 26437, 29918, 29890, 1526, 29918, 20155, 29889, 4397, 29898, 14369, 29918, 1271, 29918, 20155, 29897, 13, 13, 4706, 736, 26437, 29918, 29890, 1526, 29918, 20155, 13, 13, 1678, 822, 903, 23310, 29918, 2492, 29918, 29893, 29918, 8223, 29898, 1311, 29892, 7442, 29918, 29906, 29881, 29918, 7050, 29892, 1510, 29918, 1949, 29879, 29892, 282, 26456, 29892, 7442, 29918, 29906, 29881, 29918, 13168, 29922, 8516, 1125, 13, 13, 4706, 921, 3317, 353, 7442, 29918, 29906, 29881, 29918, 7050, 29889, 12181, 29961, 29896, 29962, 13, 4706, 343, 3317, 353, 7442, 29918, 29906, 29881, 29918, 7050, 29889, 12181, 29961, 29900, 29962, 13, 13, 4706, 565, 7442, 29918, 29906, 29881, 29918, 13168, 338, 6213, 29901, 13, 9651, 7442, 29918, 29906, 29881, 29918, 13168, 353, 7442, 29889, 3298, 359, 3552, 29891, 3317, 29892, 921, 3317, 511, 376, 8896, 1159, 13, 13, 4706, 1301, 4752, 29918, 1272, 353, 7442, 29889, 3298, 359, 3552, 29891, 3317, 29892, 921, 3317, 511, 376, 8896, 1159, 13, 4706, 1301, 4752, 29918, 13168, 353, 7442, 29889, 3298, 359, 3552, 29891, 3317, 29892, 921, 3317, 511, 376, 8896, 1159, 13, 13, 4706, 1301, 4752, 29918, 1272, 7503, 29892, 584, 29962, 353, 7442, 29918, 29906, 29881, 29918, 7050, 13, 4706, 1301, 4752, 29918, 13168, 7503, 29892, 584, 29962, 353, 7442, 29918, 29906, 29881, 29918, 13168, 13, 13, 4706, 8525, 29918, 1272, 29918, 262, 353, 8525, 29889, 8896, 29898, 3286, 4752, 29918, 1272, 29897, 13, 4706, 8525, 29918, 13168, 29918, 262, 353, 8525, 29889, 8896, 29898, 3286, 4752, 29918, 13168, 29897, 13, 13, 4706, 565, 282, 26456, 1275, 376, 8517, 29906, 10921, 1115, 13, 9651, 282, 26456, 29918, 1949, 353, 29871, 29896, 13, 4706, 25342, 282, 26456, 1275, 376, 10921, 29906, 8517, 1115, 13, 9651, 282, 26456, 29918, 1949, 353, 29871, 29906, 13, 4706, 25342, 282, 26456, 1275, 376, 8711, 12066, 355, 1115, 13, 9651, 282, 26456, 29918, 1949, 353, 29871, 29941, 13, 4706, 1683, 29901, 29871, 396, 10241, 376, 8711, 17086, 29908, 13, 9651, 282, 26456, 29918, 1949, 353, 29871, 29946, 13, 13, 4706, 10153, 29918, 2378, 29918, 7050, 353, 1583, 29889, 23310, 29918, 29890, 1526, 29918, 2749, 29889, 1885, 29918, 29890, 1526, 29898, 13, 9651, 8525, 29918, 1272, 29918, 262, 29892, 8525, 29918, 13168, 29918, 262, 29892, 1510, 29918, 1949, 29879, 29892, 282, 26456, 29918, 1949, 13, 4706, 1723, 13, 13, 4706, 7442, 29918, 2492, 29918, 2378, 353, 10153, 29918, 2378, 29918, 7050, 29889, 294, 29918, 23749, 29918, 2378, 580, 13, 13, 4706, 3171, 353, 7442, 29889, 2311, 29898, 9302, 29918, 2492, 29918, 2378, 7503, 29892, 29871, 29900, 29901, 29896, 29892, 29871, 29900, 29901, 29896, 2314, 13, 4706, 2920, 353, 7442, 29889, 2311, 29898, 9302, 29918, 2492, 29918, 2378, 29961, 29900, 29901, 29896, 29892, 584, 29892, 29871, 29900, 29901, 29896, 2314, 13, 4706, 10153, 29918, 2378, 353, 7442, 29889, 6310, 3552, 3545, 29892, 2920, 29892, 29871, 29941, 511, 376, 13470, 29947, 1159, 13, 4706, 10153, 29918, 2378, 7503, 29892, 584, 29892, 584, 29962, 353, 7442, 29918, 2492, 29918, 2378, 7503, 29892, 584, 29892, 584, 29962, 13, 13, 4706, 1583, 3032, 23310, 29918, 3027, 353, 26437, 29889, 2940, 29898, 2103, 29892, 3171, 29897, 13, 4706, 1583, 3032, 23310, 29918, 3027, 29889, 2697, 1469, 29898, 2492, 29918, 2378, 29889, 517, 1807, 3101, 13, 13, 4706, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 353, 313, 1311, 3032, 23310, 29918, 3027, 29892, 2920, 29892, 3171, 29897, 13, 13, 4706, 736, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 13, 13, 1678, 822, 903, 23310, 29918, 29890, 1526, 29918, 7052, 29881, 29898, 1311, 29892, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 29892, 6287, 1125, 13, 4706, 304, 29918, 915, 2763, 29918, 29890, 1526, 353, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 29961, 29900, 29962, 13, 4706, 2920, 353, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 29961, 29896, 29962, 13, 4706, 3171, 353, 848, 29918, 517, 29918, 915, 2763, 29918, 29890, 1526, 29961, 29906, 29962, 13, 13, 4706, 1570, 29956, 353, 938, 29898, 2103, 334, 6287, 29897, 13, 4706, 1570, 29950, 353, 938, 29898, 3545, 334, 6287, 29897, 13, 4706, 304, 29918, 915, 2763, 29918, 29890, 1526, 353, 304, 29918, 915, 2763, 29918, 29890, 1526, 29889, 17185, 29898, 4373, 29956, 29892, 1570, 29950, 29892, 26437, 29889, 2382, 29918, 13356, 1964, 11937, 29918, 29940, 1955, 1529, 29931, 29897, 13, 13, 4706, 26437, 15184, 353, 304, 29918, 915, 2763, 29918, 29890, 1526, 29889, 18455, 1762, 15184, 580, 13, 13, 4706, 736, 26437, 15184, 13, 2 ]
ibeis/viz/viz_name.py
brmscheiner/ibeis
0
73428
# -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function, unicode_literals import plottool.draw_func2 as df2 import numpy as np from ibeis.other import ibsfuncs from plottool import plot_helpers as ph import plottool as pt import utool as ut from ibeis.viz import viz_chip (print, rrr, profile) = ut.inject2(__name__) def show_name_of(ibs, aid, **kwargs): nid = ibs.get_annot_names(aid) show_name(ibs, nid, sel_aids=[aid], **kwargs) def testdata_showname(): import ibeis ibs = ibeis.opendb(defaultdb='testdb1') default = None if ibs.dbname == 'testdb1': default = 'easy' name_text = ut.get_argval('--name', type_=str, default=default) if name_text is None: nid = 1 else: nid = ibs.get_name_rowids_from_text(name_text) in_image = not ut.get_argflag('--no-inimage') index_list = ut.get_argval('--index_list', type_=list, default=None) return ibs, nid, in_image, index_list def testdata_multichips(): import ibeis ibs = ibeis.opendb(defaultdb='testdb1') nid = ut.get_argval('--nid', type_=int, default=None) tags = ut.get_argval('--tags', type_=list, default=None) if nid is not None: aid_list = ibs.get_name_aids(nid) elif tags is not None: index = ut.get_argval('--index', default=0) aid_list = ibs.filter_aidpairs_by_tags(any_tags=tags)[index] else: #aid_list = ut.get_argval('--aids', type_=list, default=[1, 2, 3]) aid_list = ibeis.testdata_aids(default_aids=[1, 2, 3], ibs=ibs) in_image = not ut.get_argflag('--no-inimage') return ibs, aid_list, in_image #9108 and 9180 def show_multiple_chips(ibs, aid_list, in_image=True, fnum=0, sel_aids=[], subtitle='', annote=False, **kwargs): """ CommandLine: python -m ibeis.viz.viz_name --test-show_multiple_chips --show --no-inimage python -m ibeis.viz.viz_name --test-show_multiple_chips --show --db NNP_Master3 --aids=6435,9861,137,6563,9167,12547,9332,12598,13285 --no-inimage --notitle python -m ibeis.viz.viz_name --test-show_multiple_chips --show --db NNP_Master3 --aids=137,6563,12547,9332,12598,13285 --no-inimage --notitle --adjust=.05 python -m ibeis.viz.viz_name --test-show_multiple_chips --show --db NNP_Master3 --aids=6563,9332,13285,12598 --no-inimage --notitle --adjust=.05 --rc=1,4 python -m ibeis.viz.viz_name --test-show_multiple_chips --show --db PZ_Master0 --aids=1288 --no-inimage --notitle --adjust=.05 python -m ibeis.viz.viz_name --test-show_multiple_chips --show --db PZ_Master0 --aids=4020,4839 --no-inimage --notitle --adjust=.05 python -m ibeis.viz.viz_name --test-show_multiple_chips --db NNP_Master3 --aids=6524,6540,6571,6751 --no-inimage --notitle --adjust=.05 --diskshow python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST -a default:index=0:4 --show --aids=1 --doboth --show --no-inimage python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST --aids=1 --doboth --show --no-inimage python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST --aids=1 --doboth --rc=2,1 --show --no-inimage python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST --aids=1 --doboth --rc=2,1 --show --notitle --trydrawline --no-draw_lbls python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST --aids=1,2 --doboth --show --notitle --trydrawline python -m ibeis.viz.viz_name --test-show_multiple_chips --db PZ_MTEST --aids=1,2,3,4,5 --doboth --rc=2,5 --show --chrlbl --trydrawline --qualtitle --no-figtitle --notitle --doboth --doboth --show python -m ibeis.viz.viz_name --test-show_multiple_chips --db NNP_Master3 --aids=15419 --doboth --rc=2,1 --show --notitle --trydrawline --no-draw_lbls Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.viz_name import * # NOQA >>> import ibeis >>> ibs, aid_list, in_image = testdata_multichips() >>> if True: >>> import matplotlib as mpl >>> from ibeis.scripts.thesis import TMP_RC >>> mpl.rcParams.update(TMP_RC) >>> fnum = 0 >>> sel_aids = [] >>> subtitle = '' >>> annote = False >>> fig = show_multiple_chips(ibs, aid_list, in_image, fnum, sel_aids, subtitle, annote) >>> ut.quit_if_noshow() >>> fig.canvas.draw() >>> ut.show_if_requested() """ fnum = pt.ensure_fnum(fnum) nAids = len(aid_list) if nAids == 0: fig = df2.figure(fnum=fnum, pnum=(1, 1, 1), **kwargs) df2.imshow_null(fnum=fnum, **kwargs) return fig # Trigger computation of all chips in parallel ibsfuncs.ensure_annotation_data(ibs, aid_list, chips=(not in_image or annote), feats=annote) print('[viz_name] * annot_vuuid=%r' % ((ibs.get_annot_visual_uuids(aid_list),))) print('[viz_name] * aid_list=%r' % ((aid_list,))) DOBOTH = ut.get_argflag('--doboth') rc = ut.get_argval('--rc', type_=list, default=None) if rc is None: nRows, nCols = ph.get_square_row_cols(nAids * (2 if DOBOTH else 1)) else: nRows, nCols = rc notitle = ut.get_argflag('--notitle') draw_lbls = not ut.get_argflag('--no-draw_lbls') show_chip_kw = dict(annote=annote, in_image=in_image, notitle=notitle, draw_lbls=draw_lbls) #print('[viz_name] * r=%r, c=%r' % (nRows, nCols)) #gs2 = gridspec.GridSpec(nRows, nCols) pnum_ = df2.get_pnum_func(nRows, nCols) fig = df2.figure(fnum=fnum, pnum=pnum_(0), **kwargs) fig.clf() ax_list1 = [] for px, aid in enumerate(aid_list): print('px = %r' % (px,)) _fig, _ax1 = viz_chip.show_chip(ibs, aid=aid, pnum=pnum_(px), **show_chip_kw) print('other_aids = %r' % (ibs.get_annot_contact_aids(aid),)) ax = df2.gca() ax_list1.append(_ax1) if aid in sel_aids: df2.draw_border(ax, df2.GREEN, 4) if ut.get_argflag('--chrlbl') and not DOBOTH: ax.set_xlabel('(' + chr(ord('a') - 1 + px) + ')') elif ut.get_argflag('--numlbl') and not DOBOTH: ax.set_xlabel('(' + str(px + 1) + ')') #plot_aid3(ibs, aid) # HACK to show in image and not in image if DOBOTH: #ut.embed() #ph.get_plotdat_dict(ax_list1[1]) #ph.get_plotdat_dict(ax_list2[1]) ax_list2 = [] show_chip_kw['in_image'] = not show_chip_kw['in_image'] start = px + 1 for px, aid in enumerate(aid_list, start=start): _fig, _ax2 = viz_chip.show_chip(ibs, aid=aid, pnum=pnum_(px), **show_chip_kw) ax = df2.gca() ax_list2.append(_ax2) if ut.get_argflag('--chrlbl'): ax.set_xlabel('(' + chr(ord('a') - start + px) + ')') elif ut.get_argflag('--numlbl'): ax.set_xlabel('(' + str(px - start + 1) + ')') if ut.get_argflag('--qualtitle'): qualtext = ibs.get_annot_quality_texts(aid) ax.set_title(qualtext) if aid in sel_aids: df2.draw_border(ax, df2.GREEN, 4) if in_image: ax_list1, ax_list2 = ax_list2, ax_list1 if ut.get_argflag('--trydrawline'): # Unfinished #ut.embed() # Draw lines between corresponding axes # References: # http://stackoverflow.com/questions/17543359/drawing-lines-between-two-plots-in-matplotlib import matplotlib as mpl import vtool as vt # !!! #http://matplotlib.org/users/transforms_tutorial.html #invTransFigure_fn1 = fig.transFigure.inverted().transform #invTransFigure_fn2 = fig.transFigure.inverted().transform #print(ax_list1) #print(ax_list2) assert len(ax_list1) == len(ax_list2) for ax1, ax2 in zip(ax_list1, ax_list2): #_ = ax1.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) #bbox1 = (0, 0, _.width * fig.dpi, _.height * fig.dpi) # returns in figure coordinates #bbox1 = df2.get_axis_bbox(ax=ax1) #if bbox1[-1] < 0: # # Weird bug # bbox1 = bbox1[1] print('--') print('ax1 = %r' % (ax1,)) print('ax2 = %r' % (ax2,)) chipshape = ph.get_plotdat(ax1, 'chipshape') #_bbox1 = ax1.get_window_extent().transformed(fig.dpi_scale_trans.inverted()) #bbox1 = (0, 0, _bbox1.width * fig.dpi, _bbox1.height * fig.dpi) bbox1 = (0, 0, chipshape[1], chipshape[0]) aid_ = ph.get_plotdat(ax2, 'aid') aid_list_ = ph.get_plotdat(ax2, 'aid_list') index = aid_list_.index(aid_) annotation_bbox_list = ph.get_plotdat(ax2, 'annotation_bbox_list') bbox2 = annotation_bbox_list[index] print('bbox1 = %r' % (bbox1,)) print('bbox2 = %r' % (bbox2,)) vert_list1 = np.array(vt.verts_from_bbox(bbox1)) vert_list2 = np.array(vt.verts_from_bbox(bbox2)) print('vert_list1 = %r' % (vert_list1,)) print('vert_list2 = %r' % (vert_list2,)) #for vx in [0, 1, 2, 3]: for vx in [0, 1]: vert1 = vert_list1[vx].tolist() vert2 = vert_list2[vx].tolist() print(' ***') print(' * vert1 = %r' % (vert1,)) print(' * vert2 = %r' % (vert2,)) coordsA = coordsB = 'data' #coords = 'axes points' #'axes fraction' #'axes pixels' #coordsA = 'axes pixels' #coordsB = 'data' #'figure fraction' #'figure pixels' #'figure pixels' #'figure points' #'polar' #'offset points' con = mpl.patches.ConnectionPatch( xyA=vert1, xyB=vert2, coordsA=coordsA, coordsB=coordsB, axesA=ax1, axesB=ax2, linewidth=1, color='k') #, arrowstyle="-") #ut.embed() #con.set_zorder(None) ax1.add_artist(con) #ax2.add_artist(con) #ut.embed() #verts2.T[1] -= bbox2[-1] #bottom_left1, bottom_right1 = verts1[1:3].tolist() #bottom_left2, bottom_right2 = verts2[1:3].tolist() ##transAxes1 = ax1.transData.inverted() #transAxes1_fn = ax1.transData.transform #transAxes2_fn = ax2.transData.transform #transAxes1_fn = ut.identity #transAxes2_fn = ut.identity #coord_bl1 = transFigure.transform(transAxes1.transform(bottom_left1)) #coord_br1 = transFigure.transform(transAxes1.transform(bottom_right1)) #coord_bl1 = invTransFigure_fn1(transAxes1_fn(bottom_left1)) #print('bottom_left2 = %r' % (bottom_left2,)) #coord_bl1 = (5, 5) #coord_bl2 = invTransFigure_fn2(transAxes2_fn(bottom_left2)) #print('coord_bl2 = %r' % (coord_bl2,)) #coord_br1 = invTransFigure_fn1(transAxes1_fn(bottom_right1)) #coord_br2 = invTransFigure_fn2(transAxes2_fn(bottom_right2)) ##print('coord_bl1 = %r' % (coord_bl1,)) #line_coords1 = np.vstack([coord_bl1, coord_bl2]) #line_coords2 = np.vstack([coord_br1, coord_br2]) #print('line_coords1 = %r' % (line_coords1,)) #line1 = mpl.lines.Line2D((line_coords1[0]), (line_coords1[1]), transform=fig.transFigure) #line2 = mpl.lines.Line2D((line_coords2[0]), (line_coords2[1]), transform=fig.transFigure) #xs1, ys1 = line_coords1.T #xs2, ys2 = line_coords2.T #linekw = dict(transform=fig.transFigure) #linekw = dict() #print('xs1 = %r' % (xs1,)) #print('ys1 = %r' % (ys1,)) #line1 = mpl.lines.Line2D(xs1, ys1, **linekw) #line2 = mpl.lines.Line2D(xs2, ys2, **linekw) # NOQA #shrinkA=5, shrinkB=5, mutation_scale=20, fc="w") #ax2.add_artist(con) #fig.lines.append(line1) #fig.lines.append(line2) pass return fig <EMAIL> def show_name(ibs, nid, in_image=True, fnum=0, sel_aids=[], subtitle='', annote=False, aid_list=None, index_list=None, **kwargs): r""" Args: ibs (IBEISController): ibeis controller object nid (?): in_image (bool): fnum (int): figure number sel_aids (list): subtitle (str): annote (bool): CommandLine: python -m ibeis.viz.viz_name --test-show_name --dpath ~/latex/crall-candidacy-2015 --save 'figures/{name}.jpg' --no-figtitle --notitle --db NNP_Master3 --figsize=9,4 --clipwhite --dpi=180 --adjust=.05 --index_list=[0,1,2,3] --rc=2,4 --append temp_out_figure.tex --name=IBEIS_PZ_0739 --no-draw_lbls --doboth --no-inimage --diskshow python -m ibeis.viz.viz_name --test-show_name --no-figtitle --notitle --db NNP_Master3 --figsize=9,4 --clipwhite --dpi=180 --adjust=.05 --index_list=[0,1,2,3] --rc=2,4 --append temp_out_figure.tex --name=IBEIS_PZ_0739 --no-draw_lbls --doboth --no-inimage --show python -m ibeis.viz.viz_name --test-show_name --show Example: >>> # DISABLE_DOCTEST >>> from ibeis.viz.viz_name import * # NOQA >>> ibs, nid, in_image, index_list = testdata_showname() >>> fnum = 0 >>> sel_aids = [] >>> subtitle = '' >>> annote = False >>> # execute function >>> show_name(ibs, nid, in_image, fnum, sel_aids, subtitle, annote, index_list=index_list) >>> ut.show_if_requested() """ print('[viz_name] show_name nid=%r, index_list=%r, aid_list=%r' % (nid, index_list, aid_list)) if aid_list is None: aid_list = ibs.get_name_aids(nid) else: assert ut.list_all_eq_to(ibs.get_annot_nids(aid_list), nid) if index_list is not None: aid_list = ut.take(aid_list, index_list) name = ibs.get_name_texts((nid,)) print('[viz_name] * name=%r aid_list=%r' % (name, aid_list)) show_multiple_chips(ibs, aid_list, in_image=in_image, fnum=fnum, sel_aids=sel_aids, annote=annote, **kwargs) if isinstance(nid, np.ndarray): nid = nid[0] if isinstance(name, np.ndarray): name = name[0] use_figtitle = not ut.get_argflag('--no-figtitle') if use_figtitle: figtitle = 'Name View nid=%r name=%r' % (nid, name) df2.set_figtitle(figtitle) #if not annote: # title += ' noannote' #gs2.tight_layout(fig) #gs2.update(top=df2.TOP_SUBPLOT_ADJUST) #df2.set_figtitle(title, subtitle) if __name__ == '__main__': """ CommandLine: python -m ibeis.viz.viz_name python -m ibeis.viz.viz_name --allexamples python -m ibeis.viz.viz_name --allexamples --noface --nosrc """ import multiprocessing multiprocessing.freeze_support() # for win32 import utool as ut # NOQA ut.doctest_funcs()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8380, 29918, 5215, 29892, 8542, 29892, 1596, 29918, 2220, 29892, 29104, 29918, 20889, 1338, 13, 5215, 6492, 10154, 29889, 4012, 29918, 9891, 29906, 408, 4489, 29906, 13, 5215, 12655, 408, 7442, 13, 3166, 474, 915, 275, 29889, 1228, 1053, 474, 29890, 4668, 348, 2395, 13, 3166, 6492, 10154, 1053, 6492, 29918, 3952, 6774, 408, 1374, 13, 5215, 6492, 10154, 408, 19592, 13, 5215, 318, 10154, 408, 3477, 13, 3166, 474, 915, 275, 29889, 29894, 466, 1053, 25294, 29918, 305, 666, 13, 13, 29898, 2158, 29892, 364, 21478, 29892, 8722, 29897, 353, 3477, 29889, 21920, 29906, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 1510, 29918, 978, 29918, 974, 29898, 747, 29879, 29892, 16226, 29892, 3579, 19290, 1125, 13, 1678, 302, 333, 353, 474, 5824, 29889, 657, 29918, 6735, 29918, 7039, 29898, 29874, 333, 29897, 13, 1678, 1510, 29918, 978, 29898, 747, 29879, 29892, 302, 333, 29892, 5535, 29918, 29874, 4841, 11759, 29874, 333, 1402, 3579, 19290, 29897, 13, 13, 13, 1753, 1243, 1272, 29918, 845, 776, 420, 7295, 13, 1678, 1053, 474, 915, 275, 13, 1678, 474, 5824, 353, 474, 915, 275, 29889, 459, 355, 29890, 29898, 4381, 2585, 2433, 1688, 2585, 29896, 1495, 13, 1678, 2322, 353, 6213, 13, 1678, 565, 474, 5824, 29889, 2585, 978, 1275, 525, 1688, 2585, 29896, 2396, 13, 4706, 2322, 353, 525, 29872, 8995, 29915, 13, 13, 1678, 1024, 29918, 726, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 978, 742, 1134, 29918, 29922, 710, 29892, 2322, 29922, 4381, 29897, 13, 1678, 565, 1024, 29918, 726, 338, 6213, 29901, 13, 4706, 302, 333, 353, 29871, 29896, 13, 1678, 1683, 29901, 13, 4706, 302, 333, 353, 474, 5824, 29889, 657, 29918, 978, 29918, 798, 4841, 29918, 3166, 29918, 726, 29898, 978, 29918, 726, 29897, 13, 1678, 297, 29918, 3027, 353, 451, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1217, 29899, 262, 3027, 1495, 13, 1678, 2380, 29918, 1761, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 2248, 29918, 1761, 742, 1134, 29918, 29922, 1761, 29892, 2322, 29922, 8516, 29897, 13, 1678, 736, 474, 5824, 29892, 302, 333, 29892, 297, 29918, 3027, 29892, 2380, 29918, 1761, 13, 13, 13, 1753, 1243, 1272, 29918, 4713, 436, 4512, 7295, 13, 1678, 1053, 474, 915, 275, 13, 1678, 474, 5824, 353, 474, 915, 275, 29889, 459, 355, 29890, 29898, 4381, 2585, 2433, 1688, 2585, 29896, 1495, 13, 1678, 302, 333, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 29876, 333, 742, 1134, 29918, 29922, 524, 29892, 2322, 29922, 8516, 29897, 13, 1678, 8282, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 11338, 742, 1134, 29918, 29922, 1761, 29892, 2322, 29922, 8516, 29897, 13, 13, 1678, 565, 302, 333, 338, 451, 6213, 29901, 13, 4706, 16226, 29918, 1761, 353, 474, 5824, 29889, 657, 29918, 978, 29918, 29874, 4841, 29898, 29876, 333, 29897, 13, 1678, 25342, 8282, 338, 451, 6213, 29901, 13, 4706, 2380, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 2248, 742, 2322, 29922, 29900, 29897, 13, 4706, 16226, 29918, 1761, 353, 474, 5824, 29889, 4572, 29918, 29874, 333, 29886, 7121, 29918, 1609, 29918, 11338, 29898, 1384, 29918, 11338, 29922, 11338, 9601, 2248, 29962, 13, 1678, 1683, 29901, 13, 4706, 396, 29874, 333, 29918, 1761, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 29874, 4841, 742, 1134, 29918, 29922, 1761, 29892, 2322, 11759, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 2314, 13, 4706, 16226, 29918, 1761, 353, 474, 915, 275, 29889, 1688, 1272, 29918, 29874, 4841, 29898, 4381, 29918, 29874, 4841, 11759, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 1402, 474, 5824, 29922, 747, 29879, 29897, 13, 13, 1678, 297, 29918, 3027, 353, 451, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1217, 29899, 262, 3027, 1495, 13, 1678, 736, 474, 5824, 29892, 16226, 29918, 1761, 29892, 297, 29918, 3027, 13, 13, 29937, 29929, 29896, 29900, 29947, 322, 29871, 29929, 29896, 29947, 29900, 13, 13, 13, 1753, 1510, 29918, 20787, 29918, 4161, 567, 29898, 747, 29879, 29892, 16226, 29918, 1761, 29892, 297, 29918, 3027, 29922, 5574, 29892, 285, 1949, 29922, 29900, 29892, 5535, 29918, 29874, 4841, 11759, 1402, 13, 462, 4706, 1014, 3257, 2433, 742, 2889, 866, 29922, 8824, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 10516, 3542, 29901, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 1217, 29899, 262, 3027, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 29874, 4841, 29922, 29953, 29946, 29941, 29945, 29892, 29929, 29947, 29953, 29896, 29892, 29896, 29941, 29955, 29892, 29953, 29945, 29953, 29941, 29892, 29929, 29896, 29953, 29955, 29892, 29896, 29906, 29945, 29946, 29955, 29892, 29929, 29941, 29941, 29906, 29892, 29896, 29906, 29945, 29929, 29947, 29892, 29896, 29941, 29906, 29947, 29945, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 29874, 4841, 29922, 29896, 29941, 29955, 29892, 29953, 29945, 29953, 29941, 29892, 29896, 29906, 29945, 29946, 29955, 29892, 29929, 29941, 29941, 29906, 29892, 29896, 29906, 29945, 29929, 29947, 29892, 29896, 29941, 29906, 29947, 29945, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 1192, 328, 5143, 21098, 29900, 29945, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 29874, 4841, 29922, 29953, 29945, 29953, 29941, 29892, 29929, 29941, 29941, 29906, 29892, 29896, 29941, 29906, 29947, 29945, 29892, 29896, 29906, 29945, 29929, 29947, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 1192, 328, 5143, 21098, 29900, 29945, 1192, 2214, 29922, 29896, 29892, 29946, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 2585, 349, 29999, 29918, 19203, 29900, 1192, 29874, 4841, 29922, 29896, 29906, 29947, 29947, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 1192, 328, 5143, 21098, 29900, 29945, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 4294, 1192, 2585, 349, 29999, 29918, 19203, 29900, 1192, 29874, 4841, 29922, 29946, 29900, 29906, 29900, 29892, 29946, 29947, 29941, 29929, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 1192, 328, 5143, 21098, 29900, 29945, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 29874, 4841, 29922, 29953, 29945, 29906, 29946, 29892, 29953, 29945, 29946, 29900, 29892, 29953, 29945, 29955, 29896, 29892, 29953, 29955, 29945, 29896, 1192, 1217, 29899, 262, 3027, 1192, 1333, 1740, 1192, 328, 5143, 21098, 29900, 29945, 1192, 20960, 4294, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 448, 29874, 2322, 29901, 2248, 29922, 29900, 29901, 29946, 1192, 4294, 13, 4706, 1192, 29874, 4841, 29922, 29896, 1192, 11152, 720, 1192, 4294, 1192, 1217, 29899, 262, 3027, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 29874, 4841, 29922, 29896, 1192, 11152, 720, 1192, 4294, 1192, 1217, 29899, 262, 3027, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 29874, 4841, 29922, 29896, 1192, 11152, 720, 1192, 2214, 29922, 29906, 29892, 29896, 1192, 4294, 1192, 1217, 29899, 262, 3027, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 29874, 4841, 29922, 29896, 1192, 11152, 720, 1192, 2214, 29922, 29906, 29892, 29896, 1192, 4294, 1192, 1333, 1740, 1192, 2202, 4012, 1220, 1192, 1217, 29899, 4012, 29918, 26648, 29879, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 29874, 4841, 29922, 29896, 29892, 29906, 1192, 11152, 720, 29871, 1192, 4294, 1192, 1333, 1740, 1192, 2202, 4012, 1220, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 349, 29999, 29918, 29924, 18267, 1192, 29874, 4841, 29922, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 1192, 11152, 720, 1192, 2214, 29922, 29906, 29892, 29945, 1192, 4294, 1192, 305, 2096, 2204, 1192, 2202, 4012, 1220, 1192, 339, 1997, 1740, 1192, 1217, 29899, 1003, 3257, 1192, 1333, 1740, 13, 4706, 1192, 11152, 720, 13, 4706, 1192, 11152, 720, 1192, 4294, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 20787, 29918, 4161, 567, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 29874, 4841, 29922, 29896, 29945, 29946, 29896, 29929, 1192, 11152, 720, 1192, 2214, 29922, 29906, 29892, 29896, 1192, 4294, 1192, 1333, 1740, 1192, 2202, 4012, 1220, 1192, 1217, 29899, 4012, 29918, 26648, 29879, 13, 13, 1678, 8741, 29901, 13, 4706, 8653, 396, 28657, 6181, 29918, 3970, 1783, 29923, 1254, 13, 4706, 8653, 515, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1053, 334, 29871, 396, 11698, 29984, 29909, 13, 4706, 8653, 1053, 474, 915, 275, 13, 4706, 8653, 474, 5824, 29892, 16226, 29918, 1761, 29892, 297, 29918, 3027, 353, 1243, 1272, 29918, 4713, 436, 4512, 580, 13, 4706, 8653, 565, 5852, 29901, 13, 4706, 8653, 268, 1053, 22889, 408, 286, 572, 13, 4706, 8653, 268, 515, 474, 915, 275, 29889, 16713, 29889, 26533, 1053, 323, 3580, 29918, 10363, 13, 4706, 8653, 268, 286, 572, 29889, 2214, 9629, 29889, 5504, 29898, 29911, 3580, 29918, 10363, 29897, 13, 4706, 8653, 285, 1949, 353, 29871, 29900, 13, 4706, 8653, 5535, 29918, 29874, 4841, 353, 5159, 13, 4706, 8653, 1014, 3257, 353, 6629, 13, 4706, 8653, 2889, 866, 353, 7700, 13, 4706, 8653, 2537, 353, 1510, 29918, 20787, 29918, 4161, 567, 29898, 747, 29879, 29892, 16226, 29918, 1761, 29892, 297, 29918, 3027, 29892, 285, 1949, 29892, 5535, 29918, 29874, 4841, 29892, 1014, 3257, 29892, 2889, 866, 29897, 13, 4706, 8653, 3477, 29889, 28358, 29918, 361, 29918, 17639, 3525, 580, 13, 4706, 8653, 2537, 29889, 15257, 29889, 4012, 580, 13, 4706, 8653, 3477, 29889, 4294, 29918, 361, 29918, 3827, 287, 580, 13, 1678, 9995, 13, 1678, 285, 1949, 353, 19592, 29889, 7469, 29918, 29888, 1949, 29898, 29888, 1949, 29897, 13, 1678, 302, 29909, 4841, 353, 7431, 29898, 29874, 333, 29918, 1761, 29897, 13, 1678, 565, 302, 29909, 4841, 1275, 29871, 29900, 29901, 13, 4706, 2537, 353, 4489, 29906, 29889, 4532, 29898, 29888, 1949, 29922, 29888, 1949, 29892, 282, 1949, 7607, 29896, 29892, 29871, 29896, 29892, 29871, 29896, 511, 3579, 19290, 29897, 13, 4706, 4489, 29906, 29889, 326, 4294, 29918, 4304, 29898, 29888, 1949, 29922, 29888, 1949, 29892, 3579, 19290, 29897, 13, 4706, 736, 2537, 13, 1678, 396, 1605, 3567, 16287, 310, 599, 521, 4512, 297, 8943, 13, 1678, 474, 29890, 4668, 348, 2395, 29889, 7469, 29918, 18317, 29918, 1272, 29898, 747, 29879, 29892, 16226, 29918, 1761, 29892, 521, 4512, 7607, 1333, 297, 29918, 3027, 470, 2889, 866, 511, 1238, 1446, 29922, 812, 866, 29897, 13, 13, 1678, 1596, 877, 29961, 29894, 466, 29918, 978, 29962, 334, 9732, 29918, 24845, 5416, 16328, 29878, 29915, 1273, 5135, 747, 29879, 29889, 657, 29918, 6735, 29918, 20119, 29918, 29884, 29884, 4841, 29898, 29874, 333, 29918, 1761, 511, 4961, 13, 1678, 1596, 877, 29961, 29894, 466, 29918, 978, 29962, 334, 16226, 29918, 1761, 16328, 29878, 29915, 1273, 5135, 29874, 333, 29918, 1761, 29892, 4961, 13, 13, 1678, 11662, 29933, 2891, 29950, 353, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 11152, 720, 1495, 13, 13, 1678, 364, 29883, 353, 3477, 29889, 657, 29918, 1191, 791, 877, 489, 2214, 742, 1134, 29918, 29922, 1761, 29892, 2322, 29922, 8516, 29897, 13, 1678, 565, 364, 29883, 338, 6213, 29901, 13, 4706, 302, 10661, 29892, 302, 1625, 29879, 353, 1374, 29889, 657, 29918, 17619, 29918, 798, 29918, 22724, 29898, 29876, 29909, 4841, 334, 313, 29906, 565, 11662, 29933, 2891, 29950, 1683, 29871, 29896, 876, 13, 1678, 1683, 29901, 13, 4706, 302, 10661, 29892, 302, 1625, 29879, 353, 364, 29883, 13, 1678, 451, 1740, 353, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1333, 1740, 1495, 13, 1678, 4216, 29918, 26648, 29879, 353, 451, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1217, 29899, 4012, 29918, 26648, 29879, 1495, 13, 1678, 1510, 29918, 305, 666, 29918, 11022, 353, 9657, 29898, 812, 866, 29922, 812, 866, 29892, 297, 29918, 3027, 29922, 262, 29918, 3027, 29892, 451, 1740, 29922, 1333, 1740, 29892, 4216, 29918, 26648, 29879, 29922, 4012, 29918, 26648, 29879, 29897, 13, 1678, 396, 2158, 877, 29961, 29894, 466, 29918, 978, 29962, 334, 364, 16328, 29878, 29892, 274, 16328, 29878, 29915, 1273, 313, 29876, 10661, 29892, 302, 1625, 29879, 876, 13, 1678, 396, 3174, 29906, 353, 867, 4841, 3135, 29889, 5756, 10299, 29898, 29876, 10661, 29892, 302, 1625, 29879, 29897, 13, 1678, 282, 1949, 29918, 353, 4489, 29906, 29889, 657, 29918, 29886, 1949, 29918, 9891, 29898, 29876, 10661, 29892, 302, 1625, 29879, 29897, 13, 1678, 2537, 353, 4489, 29906, 29889, 4532, 29898, 29888, 1949, 29922, 29888, 1949, 29892, 282, 1949, 29922, 29886, 1949, 23538, 29900, 511, 3579, 19290, 29897, 13, 1678, 2537, 29889, 695, 29888, 580, 13, 1678, 4853, 29918, 1761, 29896, 353, 5159, 13, 1678, 363, 282, 29916, 29892, 16226, 297, 26985, 29898, 29874, 333, 29918, 1761, 1125, 13, 4706, 1596, 877, 1756, 353, 1273, 29878, 29915, 1273, 313, 1756, 29892, 876, 13, 4706, 903, 1003, 29892, 903, 1165, 29896, 353, 25294, 29918, 305, 666, 29889, 4294, 29918, 305, 666, 29898, 747, 29879, 29892, 16226, 29922, 29874, 333, 29892, 282, 1949, 29922, 29886, 1949, 23538, 1756, 511, 3579, 4294, 29918, 305, 666, 29918, 11022, 29897, 13, 4706, 1596, 877, 1228, 29918, 29874, 4841, 353, 1273, 29878, 29915, 1273, 313, 747, 29879, 29889, 657, 29918, 6735, 29918, 12346, 29918, 29874, 4841, 29898, 29874, 333, 511, 876, 13, 4706, 4853, 353, 4489, 29906, 29889, 29887, 1113, 580, 13, 4706, 4853, 29918, 1761, 29896, 29889, 4397, 7373, 1165, 29896, 29897, 13, 4706, 565, 16226, 297, 5535, 29918, 29874, 4841, 29901, 13, 9651, 4489, 29906, 29889, 4012, 29918, 11466, 29898, 1165, 29892, 4489, 29906, 29889, 29954, 1525, 1430, 29892, 29871, 29946, 29897, 13, 4706, 565, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 305, 2096, 2204, 1495, 322, 451, 11662, 29933, 2891, 29950, 29901, 13, 9651, 4853, 29889, 842, 29918, 29916, 1643, 877, 877, 718, 18460, 29898, 536, 877, 29874, 1495, 448, 29871, 29896, 718, 282, 29916, 29897, 718, 25710, 1495, 13, 4706, 25342, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1949, 26648, 1495, 322, 451, 11662, 29933, 2891, 29950, 29901, 13, 9651, 4853, 29889, 842, 29918, 29916, 1643, 877, 877, 718, 851, 29898, 1756, 718, 29871, 29896, 29897, 718, 25710, 1495, 13, 4706, 396, 5317, 29918, 29874, 333, 29941, 29898, 747, 29879, 29892, 16226, 29897, 13, 13, 1678, 396, 379, 11375, 304, 1510, 297, 1967, 322, 451, 297, 1967, 13, 1678, 565, 11662, 29933, 2891, 29950, 29901, 13, 4706, 396, 329, 29889, 17987, 580, 13, 4706, 396, 561, 29889, 657, 29918, 5317, 4130, 29918, 8977, 29898, 1165, 29918, 1761, 29896, 29961, 29896, 2314, 13, 4706, 396, 561, 29889, 657, 29918, 5317, 4130, 29918, 8977, 29898, 1165, 29918, 1761, 29906, 29961, 29896, 2314, 13, 4706, 4853, 29918, 1761, 29906, 353, 5159, 13, 13, 4706, 1510, 29918, 305, 666, 29918, 11022, 1839, 262, 29918, 3027, 2033, 353, 451, 1510, 29918, 305, 666, 29918, 11022, 1839, 262, 29918, 3027, 2033, 13, 4706, 1369, 353, 282, 29916, 718, 29871, 29896, 13, 4706, 363, 282, 29916, 29892, 16226, 297, 26985, 29898, 29874, 333, 29918, 1761, 29892, 1369, 29922, 2962, 1125, 13, 9651, 903, 1003, 29892, 903, 1165, 29906, 353, 25294, 29918, 305, 666, 29889, 4294, 29918, 305, 666, 29898, 747, 29879, 29892, 16226, 29922, 29874, 333, 29892, 282, 1949, 29922, 29886, 1949, 23538, 1756, 511, 3579, 4294, 29918, 305, 666, 29918, 11022, 29897, 13, 9651, 4853, 353, 4489, 29906, 29889, 29887, 1113, 580, 13, 9651, 4853, 29918, 1761, 29906, 29889, 4397, 7373, 1165, 29906, 29897, 13, 13, 9651, 565, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 305, 2096, 2204, 29374, 13, 18884, 4853, 29889, 842, 29918, 29916, 1643, 877, 877, 718, 18460, 29898, 536, 877, 29874, 1495, 448, 1369, 718, 282, 29916, 29897, 718, 25710, 1495, 13, 9651, 25342, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1949, 26648, 29374, 13, 18884, 4853, 29889, 842, 29918, 29916, 1643, 877, 877, 718, 851, 29898, 1756, 448, 1369, 718, 29871, 29896, 29897, 718, 25710, 1495, 13, 13, 9651, 565, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 339, 1997, 1740, 29374, 13, 18884, 4021, 726, 353, 474, 5824, 29889, 657, 29918, 6735, 29918, 29567, 29918, 726, 29879, 29898, 29874, 333, 29897, 13, 18884, 4853, 29889, 842, 29918, 3257, 29898, 15380, 726, 29897, 13, 13, 9651, 565, 16226, 297, 5535, 29918, 29874, 4841, 29901, 13, 18884, 4489, 29906, 29889, 4012, 29918, 11466, 29898, 1165, 29892, 4489, 29906, 29889, 29954, 1525, 1430, 29892, 29871, 29946, 29897, 13, 13, 4706, 565, 297, 29918, 3027, 29901, 13, 9651, 4853, 29918, 1761, 29896, 29892, 4853, 29918, 1761, 29906, 353, 4853, 29918, 1761, 29906, 29892, 4853, 29918, 1761, 29896, 13, 13, 4706, 565, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 2202, 4012, 1220, 29374, 13, 9651, 396, 853, 4951, 3276, 13, 9651, 396, 329, 29889, 17987, 580, 13, 9651, 396, 18492, 3454, 1546, 6590, 27815, 13, 9651, 396, 28318, 29901, 13, 9651, 396, 1732, 597, 2417, 29889, 510, 29914, 2619, 29914, 29896, 29955, 29945, 29946, 29941, 29941, 29945, 29929, 29914, 4012, 292, 29899, 9012, 29899, 14811, 29899, 10184, 29899, 26762, 29899, 262, 29899, 2922, 17357, 13, 9651, 1053, 22889, 408, 286, 572, 13, 9651, 1053, 325, 10154, 408, 325, 29873, 13, 9651, 396, 1738, 6824, 13, 9651, 396, 1124, 597, 2922, 17357, 29889, 990, 29914, 7193, 29914, 9067, 29879, 29918, 12631, 29889, 1420, 13, 13, 9651, 396, 11569, 4300, 13080, 545, 29918, 9144, 29896, 353, 2537, 29889, 3286, 13080, 545, 29889, 262, 1765, 287, 2141, 9067, 13, 9651, 396, 11569, 4300, 13080, 545, 29918, 9144, 29906, 353, 2537, 29889, 3286, 13080, 545, 29889, 262, 1765, 287, 2141, 9067, 13, 9651, 396, 2158, 29898, 1165, 29918, 1761, 29896, 29897, 13, 9651, 396, 2158, 29898, 1165, 29918, 1761, 29906, 29897, 13, 9651, 4974, 7431, 29898, 1165, 29918, 1761, 29896, 29897, 1275, 7431, 29898, 1165, 29918, 1761, 29906, 29897, 13, 13, 9651, 363, 4853, 29896, 29892, 4853, 29906, 297, 14319, 29898, 1165, 29918, 1761, 29896, 29892, 4853, 29918, 1761, 29906, 1125, 13, 18884, 396, 29918, 353, 4853, 29896, 29889, 657, 29918, 7165, 29918, 1062, 296, 2141, 9067, 287, 29898, 1003, 29889, 29881, 1631, 29918, 7052, 29918, 3286, 29889, 262, 1765, 287, 3101, 13, 18884, 396, 29890, 1884, 29896, 353, 313, 29900, 29892, 29871, 29900, 29892, 903, 29889, 2103, 334, 2537, 29889, 29881, 1631, 29892, 903, 29889, 3545, 334, 2537, 29889, 29881, 1631, 29897, 13, 13, 18884, 396, 3639, 297, 4377, 10350, 13, 18884, 396, 29890, 1884, 29896, 353, 4489, 29906, 29889, 657, 29918, 8990, 29918, 29890, 1884, 29898, 1165, 29922, 1165, 29896, 29897, 13, 18884, 396, 361, 289, 1884, 29896, 14352, 29896, 29962, 529, 29871, 29900, 29901, 13, 18884, 396, 1678, 396, 1334, 1823, 6494, 13, 18884, 396, 1678, 289, 1884, 29896, 353, 289, 1884, 29896, 29961, 29896, 29962, 13, 18884, 1596, 877, 489, 1495, 13, 18884, 1596, 877, 1165, 29896, 353, 1273, 29878, 29915, 1273, 313, 1165, 29896, 29892, 876, 13, 18884, 1596, 877, 1165, 29906, 353, 1273, 29878, 29915, 1273, 313, 1165, 29906, 29892, 876, 13, 18884, 521, 4512, 14443, 353, 1374, 29889, 657, 29918, 5317, 4130, 29898, 1165, 29896, 29892, 525, 4161, 567, 14443, 1495, 13, 18884, 396, 29918, 29890, 1884, 29896, 353, 4853, 29896, 29889, 657, 29918, 7165, 29918, 1062, 296, 2141, 9067, 287, 29898, 1003, 29889, 29881, 1631, 29918, 7052, 29918, 3286, 29889, 262, 1765, 287, 3101, 13, 18884, 396, 29890, 1884, 29896, 353, 313, 29900, 29892, 29871, 29900, 29892, 903, 29890, 1884, 29896, 29889, 2103, 334, 2537, 29889, 29881, 1631, 29892, 903, 29890, 1884, 29896, 29889, 3545, 334, 2537, 29889, 29881, 1631, 29897, 13, 18884, 289, 1884, 29896, 353, 313, 29900, 29892, 29871, 29900, 29892, 521, 4512, 14443, 29961, 29896, 1402, 521, 4512, 14443, 29961, 29900, 2314, 13, 13, 18884, 16226, 29918, 353, 1374, 29889, 657, 29918, 5317, 4130, 29898, 1165, 29906, 29892, 525, 29874, 333, 1495, 13, 18884, 16226, 29918, 1761, 29918, 353, 1374, 29889, 657, 29918, 5317, 4130, 29898, 1165, 29906, 29892, 525, 29874, 333, 29918, 1761, 1495, 13, 18884, 2380, 353, 16226, 29918, 1761, 5396, 2248, 29898, 29874, 333, 19925, 13, 18884, 17195, 29918, 29890, 1884, 29918, 1761, 353, 1374, 29889, 657, 29918, 5317, 4130, 29898, 1165, 29906, 29892, 525, 18317, 29918, 29890, 1884, 29918, 1761, 1495, 13, 18884, 289, 1884, 29906, 353, 17195, 29918, 29890, 1884, 29918, 1761, 29961, 2248, 29962, 13, 13, 18884, 1596, 877, 29890, 1884, 29896, 353, 1273, 29878, 29915, 1273, 313, 29890, 1884, 29896, 29892, 876, 13, 18884, 1596, 877, 29890, 1884, 29906, 353, 1273, 29878, 29915, 1273, 313, 29890, 1884, 29906, 29892, 876, 13, 13, 18884, 4837, 29918, 1761, 29896, 353, 7442, 29889, 2378, 29898, 21908, 29889, 369, 1372, 29918, 3166, 29918, 29890, 1884, 29898, 29890, 1884, 29896, 876, 13, 18884, 4837, 29918, 1761, 29906, 353, 7442, 29889, 2378, 29898, 21908, 29889, 369, 1372, 29918, 3166, 29918, 29890, 1884, 29898, 29890, 1884, 29906, 876, 13, 13, 18884, 1596, 877, 1765, 29918, 1761, 29896, 353, 1273, 29878, 29915, 1273, 313, 1765, 29918, 1761, 29896, 29892, 876, 13, 18884, 1596, 877, 1765, 29918, 1761, 29906, 353, 1273, 29878, 29915, 1273, 313, 1765, 29918, 1761, 29906, 29892, 876, 13, 18884, 396, 1454, 325, 29916, 297, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29941, 5387, 13, 18884, 363, 325, 29916, 297, 518, 29900, 29892, 29871, 29896, 5387, 13, 462, 1678, 4837, 29896, 353, 4837, 29918, 1761, 29896, 29961, 29894, 29916, 1822, 25027, 391, 580, 13, 462, 1678, 4837, 29906, 353, 4837, 29918, 1761, 29906, 29961, 29894, 29916, 1822, 25027, 391, 580, 13, 462, 1678, 1596, 877, 29871, 18610, 1495, 13, 462, 1678, 1596, 877, 29871, 334, 4837, 29896, 353, 1273, 29878, 29915, 1273, 313, 1765, 29896, 29892, 876, 13, 462, 1678, 1596, 877, 29871, 334, 4837, 29906, 353, 1273, 29878, 29915, 1273, 313, 1765, 29906, 29892, 876, 13, 13, 462, 1678, 1302, 4339, 29909, 353, 1302, 4339, 29933, 353, 525, 1272, 29915, 13, 462, 1678, 396, 1111, 4339, 353, 525, 1165, 267, 3291, 29915, 13, 462, 1678, 396, 29915, 1165, 267, 15958, 29915, 13, 462, 1678, 396, 29915, 1165, 267, 17036, 29915, 13, 462, 1678, 396, 1111, 4339, 29909, 353, 525, 1165, 267, 17036, 29915, 13, 462, 1678, 396, 1111, 4339, 29933, 353, 525, 1272, 29915, 13, 462, 1678, 396, 29915, 4532, 15958, 29915, 13, 462, 1678, 396, 29915, 4532, 17036, 29915, 13, 462, 1678, 396, 29915, 4532, 17036, 29915, 13, 462, 1678, 396, 29915, 4532, 3291, 29915, 13, 462, 1678, 396, 29915, 3733, 279, 29915, 13, 462, 1678, 396, 29915, 10289, 3291, 29915, 13, 13, 462, 1678, 378, 353, 286, 572, 29889, 5041, 267, 29889, 5350, 29925, 905, 29898, 13, 462, 4706, 921, 29891, 29909, 29922, 1765, 29896, 29892, 921, 29891, 29933, 29922, 1765, 29906, 29892, 1302, 4339, 29909, 29922, 1111, 4339, 29909, 29892, 13, 462, 4706, 1302, 4339, 29933, 29922, 1111, 4339, 29933, 29892, 13, 462, 4706, 27815, 29909, 29922, 1165, 29896, 29892, 27815, 29933, 29922, 1165, 29906, 29892, 13, 462, 4706, 1196, 2103, 29922, 29896, 29892, 2927, 2433, 29895, 1495, 13, 462, 1678, 396, 29892, 16578, 3293, 543, 29899, 1159, 13, 13, 462, 1678, 396, 329, 29889, 17987, 580, 13, 462, 1678, 396, 535, 29889, 842, 29918, 29920, 2098, 29898, 8516, 29897, 13, 462, 1678, 4853, 29896, 29889, 1202, 29918, 442, 391, 29898, 535, 29897, 13, 462, 1678, 396, 1165, 29906, 29889, 1202, 29918, 442, 391, 29898, 535, 29897, 13, 13, 462, 1678, 396, 329, 29889, 17987, 580, 13, 13, 462, 1678, 396, 369, 1372, 29906, 29889, 29911, 29961, 29896, 29962, 22361, 289, 1884, 29906, 14352, 29896, 29962, 13, 462, 1678, 396, 8968, 29918, 1563, 29896, 29892, 5970, 29918, 1266, 29896, 353, 4837, 29879, 29896, 29961, 29896, 29901, 29941, 1822, 25027, 391, 580, 13, 462, 1678, 396, 8968, 29918, 1563, 29906, 29892, 5970, 29918, 1266, 29906, 353, 4837, 29879, 29906, 29961, 29896, 29901, 29941, 1822, 25027, 391, 580, 13, 13, 18884, 444, 3286, 29909, 9100, 29896, 353, 4853, 29896, 29889, 3286, 1469, 29889, 262, 1765, 287, 580, 13, 18884, 396, 3286, 29909, 9100, 29896, 29918, 9144, 353, 4853, 29896, 29889, 3286, 1469, 29889, 9067, 13, 18884, 396, 3286, 29909, 9100, 29906, 29918, 9144, 353, 4853, 29906, 29889, 3286, 1469, 29889, 9067, 13, 13, 18884, 396, 3286, 29909, 9100, 29896, 29918, 9144, 353, 3477, 29889, 22350, 13, 18884, 396, 3286, 29909, 9100, 29906, 29918, 9144, 353, 3477, 29889, 22350, 13, 13, 18884, 396, 1111, 536, 29918, 2204, 29896, 353, 1301, 13080, 545, 29889, 9067, 29898, 3286, 29909, 9100, 29896, 29889, 9067, 29898, 8968, 29918, 1563, 29896, 876, 13, 18884, 396, 1111, 536, 29918, 1182, 29896, 353, 1301, 13080, 545, 29889, 9067, 29898, 3286, 29909, 9100, 29896, 29889, 9067, 29898, 8968, 29918, 1266, 29896, 876, 13, 18884, 396, 1111, 536, 29918, 2204, 29896, 353, 2437, 4300, 13080, 545, 29918, 9144, 29896, 29898, 3286, 29909, 9100, 29896, 29918, 9144, 29898, 8968, 29918, 1563, 29896, 876, 13, 18884, 396, 2158, 877, 8968, 29918, 1563, 29906, 353, 1273, 29878, 29915, 1273, 313, 8968, 29918, 1563, 29906, 29892, 876, 13, 18884, 396, 1111, 536, 29918, 2204, 29896, 353, 313, 29945, 29892, 29871, 29945, 29897, 13, 18884, 396, 1111, 536, 29918, 2204, 29906, 353, 2437, 4300, 13080, 545, 29918, 9144, 29906, 29898, 3286, 29909, 9100, 29906, 29918, 9144, 29898, 8968, 29918, 1563, 29906, 876, 13, 18884, 396, 2158, 877, 1111, 536, 29918, 2204, 29906, 353, 1273, 29878, 29915, 1273, 313, 1111, 536, 29918, 2204, 29906, 29892, 876, 13, 13, 18884, 396, 1111, 536, 29918, 1182, 29896, 353, 2437, 4300, 13080, 545, 29918, 9144, 29896, 29898, 3286, 29909, 9100, 29896, 29918, 9144, 29898, 8968, 29918, 1266, 29896, 876, 13, 18884, 396, 1111, 536, 29918, 1182, 29906, 353, 2437, 4300, 13080, 545, 29918, 9144, 29906, 29898, 3286, 29909, 9100, 29906, 29918, 9144, 29898, 8968, 29918, 1266, 29906, 876, 13, 18884, 444, 2158, 877, 1111, 536, 29918, 2204, 29896, 353, 1273, 29878, 29915, 1273, 313, 1111, 536, 29918, 2204, 29896, 29892, 876, 13, 13, 18884, 396, 1220, 29918, 1111, 4339, 29896, 353, 7442, 29889, 29894, 1429, 4197, 1111, 536, 29918, 2204, 29896, 29892, 29311, 29918, 2204, 29906, 2314, 13, 18884, 396, 1220, 29918, 1111, 4339, 29906, 353, 7442, 29889, 29894, 1429, 4197, 1111, 536, 29918, 1182, 29896, 29892, 29311, 29918, 1182, 29906, 2314, 13, 18884, 396, 2158, 877, 1220, 29918, 1111, 4339, 29896, 353, 1273, 29878, 29915, 1273, 313, 1220, 29918, 1111, 4339, 29896, 29892, 876, 13, 13, 18884, 396, 1220, 29896, 353, 286, 572, 29889, 9012, 29889, 3542, 29906, 29928, 3552, 1220, 29918, 1111, 4339, 29896, 29961, 29900, 11724, 313, 1220, 29918, 1111, 4339, 29896, 29961, 29896, 11724, 4327, 29922, 1003, 29889, 3286, 13080, 545, 29897, 13, 18884, 396, 1220, 29906, 353, 286, 572, 29889, 9012, 29889, 3542, 29906, 29928, 3552, 1220, 29918, 1111, 4339, 29906, 29961, 29900, 11724, 313, 1220, 29918, 1111, 4339, 29906, 29961, 29896, 11724, 4327, 29922, 1003, 29889, 3286, 13080, 545, 29897, 13, 13, 18884, 396, 10351, 29896, 29892, 343, 29879, 29896, 353, 1196, 29918, 1111, 4339, 29896, 29889, 29911, 13, 18884, 396, 10351, 29906, 29892, 343, 29879, 29906, 353, 1196, 29918, 1111, 4339, 29906, 29889, 29911, 13, 13, 18884, 396, 1220, 11022, 353, 9657, 29898, 9067, 29922, 1003, 29889, 3286, 13080, 545, 29897, 13, 18884, 396, 1220, 11022, 353, 9657, 580, 13, 13, 18884, 396, 2158, 877, 10351, 29896, 353, 1273, 29878, 29915, 1273, 313, 10351, 29896, 29892, 876, 13, 18884, 396, 2158, 877, 952, 29896, 353, 1273, 29878, 29915, 1273, 313, 952, 29896, 29892, 876, 13, 13, 18884, 396, 1220, 29896, 353, 286, 572, 29889, 9012, 29889, 3542, 29906, 29928, 29898, 10351, 29896, 29892, 343, 29879, 29896, 29892, 3579, 1220, 11022, 29897, 13, 18884, 396, 1220, 29906, 353, 286, 572, 29889, 9012, 29889, 3542, 29906, 29928, 29898, 10351, 29906, 29892, 343, 29879, 29906, 29892, 3579, 1220, 11022, 29897, 29871, 396, 11698, 29984, 29909, 13, 18884, 396, 845, 29878, 682, 29909, 29922, 29945, 29892, 14653, 682, 29933, 29922, 29945, 29892, 5478, 362, 29918, 7052, 29922, 29906, 29900, 29892, 285, 29883, 543, 29893, 1159, 13, 13, 18884, 396, 1165, 29906, 29889, 1202, 29918, 442, 391, 29898, 535, 29897, 13, 13, 18884, 396, 1003, 29889, 9012, 29889, 4397, 29898, 1220, 29896, 29897, 13, 18884, 396, 1003, 29889, 9012, 29889, 4397, 29898, 1220, 29906, 29897, 13, 13, 4706, 1209, 13, 1678, 736, 2537, 13, 13, 13, 29966, 26862, 6227, 29958, 13, 1753, 1510, 29918, 978, 29898, 747, 29879, 29892, 302, 333, 29892, 297, 29918, 3027, 29922, 5574, 29892, 285, 1949, 29922, 29900, 29892, 5535, 29918, 29874, 4841, 11759, 1402, 1014, 3257, 2433, 742, 13, 795, 2889, 866, 29922, 8824, 29892, 16226, 29918, 1761, 29922, 8516, 29892, 2380, 29918, 1761, 29922, 8516, 29892, 29871, 3579, 19290, 1125, 13, 1678, 364, 15945, 29908, 13, 1678, 826, 3174, 29901, 13, 4706, 474, 5824, 313, 8979, 29923, 3235, 2956, 1125, 29871, 474, 915, 275, 4701, 1203, 13, 4706, 302, 333, 22308, 1125, 13, 4706, 297, 29918, 3027, 313, 11227, 1125, 13, 4706, 285, 1949, 313, 524, 1125, 29871, 4377, 1353, 13, 4706, 5535, 29918, 29874, 4841, 313, 1761, 1125, 13, 4706, 1014, 3257, 313, 710, 1125, 13, 4706, 2889, 866, 313, 11227, 1125, 13, 13, 1678, 10516, 3542, 29901, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 978, 1192, 29881, 2084, 3695, 29914, 25694, 29914, 7283, 497, 29899, 29883, 5380, 4135, 29899, 29906, 29900, 29896, 29945, 1192, 7620, 525, 1003, 1973, 19248, 978, 1836, 6173, 29915, 1192, 1217, 29899, 1003, 3257, 1192, 1333, 1740, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 1003, 2311, 29922, 29929, 29892, 29946, 1192, 24049, 10921, 1192, 29881, 1631, 29922, 29896, 29947, 29900, 1192, 328, 5143, 21098, 29900, 29945, 1192, 2248, 29918, 1761, 11759, 29900, 29892, 29896, 29892, 29906, 29892, 29941, 29962, 1192, 2214, 29922, 29906, 29892, 29946, 1192, 4397, 5694, 29918, 449, 29918, 4532, 29889, 4776, 1192, 978, 29922, 8979, 29923, 3235, 29918, 29925, 29999, 29918, 29900, 29955, 29941, 29929, 1192, 1217, 29899, 4012, 29918, 26648, 29879, 1192, 11152, 720, 1192, 1217, 29899, 262, 3027, 29871, 1192, 20960, 4294, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 978, 1192, 1217, 29899, 1003, 3257, 1192, 1333, 1740, 1192, 2585, 405, 25500, 29918, 19203, 29941, 1192, 1003, 2311, 29922, 29929, 29892, 29946, 1192, 24049, 10921, 1192, 29881, 1631, 29922, 29896, 29947, 29900, 1192, 328, 5143, 21098, 29900, 29945, 1192, 2248, 29918, 1761, 11759, 29900, 29892, 29896, 29892, 29906, 29892, 29941, 29962, 1192, 2214, 29922, 29906, 29892, 29946, 1192, 4397, 5694, 29918, 449, 29918, 4532, 29889, 4776, 1192, 978, 29922, 8979, 29923, 3235, 29918, 29925, 29999, 29918, 29900, 29955, 29941, 29929, 1192, 1217, 29899, 4012, 29918, 26648, 29879, 1192, 11152, 720, 1192, 1217, 29899, 262, 3027, 29871, 1192, 4294, 13, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 1688, 29899, 4294, 29918, 978, 1192, 4294, 13, 13, 1678, 8741, 29901, 13, 4706, 8653, 396, 28657, 6181, 29918, 3970, 1783, 29923, 1254, 13, 4706, 8653, 515, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1053, 334, 29871, 396, 11698, 29984, 29909, 13, 4706, 8653, 474, 5824, 29892, 302, 333, 29892, 297, 29918, 3027, 29892, 2380, 29918, 1761, 353, 1243, 1272, 29918, 845, 776, 420, 580, 13, 4706, 8653, 285, 1949, 353, 29871, 29900, 13, 4706, 8653, 5535, 29918, 29874, 4841, 353, 5159, 13, 4706, 8653, 1014, 3257, 353, 6629, 13, 4706, 8653, 2889, 866, 353, 7700, 13, 4706, 8653, 396, 6222, 740, 13, 4706, 8653, 1510, 29918, 978, 29898, 747, 29879, 29892, 302, 333, 29892, 297, 29918, 3027, 29892, 285, 1949, 29892, 5535, 29918, 29874, 4841, 29892, 1014, 3257, 29892, 2889, 866, 29892, 2380, 29918, 1761, 29922, 2248, 29918, 1761, 29897, 13, 4706, 8653, 3477, 29889, 4294, 29918, 361, 29918, 3827, 287, 580, 13, 1678, 9995, 13, 1678, 1596, 877, 29961, 29894, 466, 29918, 978, 29962, 1510, 29918, 978, 302, 333, 16328, 29878, 29892, 2380, 29918, 1761, 16328, 29878, 29892, 16226, 29918, 1761, 16328, 29878, 29915, 1273, 313, 29876, 333, 29892, 2380, 29918, 1761, 29892, 16226, 29918, 1761, 876, 13, 1678, 565, 16226, 29918, 1761, 338, 6213, 29901, 13, 4706, 16226, 29918, 1761, 353, 474, 5824, 29889, 657, 29918, 978, 29918, 29874, 4841, 29898, 29876, 333, 29897, 13, 1678, 1683, 29901, 13, 4706, 4974, 3477, 29889, 1761, 29918, 497, 29918, 1837, 29918, 517, 29898, 747, 29879, 29889, 657, 29918, 6735, 29918, 29876, 4841, 29898, 29874, 333, 29918, 1761, 511, 302, 333, 29897, 13, 13, 1678, 565, 2380, 29918, 1761, 338, 451, 6213, 29901, 13, 4706, 16226, 29918, 1761, 353, 3477, 29889, 19730, 29898, 29874, 333, 29918, 1761, 29892, 2380, 29918, 1761, 29897, 13, 13, 1678, 1024, 353, 474, 5824, 29889, 657, 29918, 978, 29918, 726, 29879, 3552, 29876, 333, 29892, 876, 13, 1678, 1596, 877, 29961, 29894, 466, 29918, 978, 29962, 334, 1024, 16328, 29878, 16226, 29918, 1761, 16328, 29878, 29915, 1273, 313, 978, 29892, 16226, 29918, 1761, 876, 13, 13, 1678, 1510, 29918, 20787, 29918, 4161, 567, 29898, 747, 29879, 29892, 16226, 29918, 1761, 29892, 297, 29918, 3027, 29922, 262, 29918, 3027, 29892, 285, 1949, 29922, 29888, 1949, 29892, 13, 462, 4706, 5535, 29918, 29874, 4841, 29922, 2838, 29918, 29874, 4841, 29892, 2889, 866, 29922, 812, 866, 29892, 3579, 19290, 29897, 13, 13, 1678, 565, 338, 8758, 29898, 29876, 333, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 302, 333, 353, 302, 333, 29961, 29900, 29962, 13, 1678, 565, 338, 8758, 29898, 978, 29892, 7442, 29889, 299, 2378, 1125, 13, 4706, 1024, 353, 1024, 29961, 29900, 29962, 13, 13, 1678, 671, 29918, 1003, 3257, 353, 451, 3477, 29889, 657, 29918, 1191, 15581, 877, 489, 1217, 29899, 1003, 3257, 1495, 13, 13, 1678, 565, 671, 29918, 1003, 3257, 29901, 13, 4706, 2537, 3257, 353, 525, 1170, 4533, 302, 333, 16328, 29878, 1024, 16328, 29878, 29915, 1273, 313, 29876, 333, 29892, 1024, 29897, 13, 4706, 4489, 29906, 29889, 842, 29918, 1003, 3257, 29898, 1003, 3257, 29897, 13, 1678, 396, 361, 451, 2889, 866, 29901, 13, 1678, 396, 1678, 3611, 4619, 525, 694, 812, 866, 29915, 13, 1678, 396, 3174, 29906, 29889, 29873, 523, 29918, 2680, 29898, 1003, 29897, 13, 1678, 396, 3174, 29906, 29889, 5504, 29898, 3332, 29922, 2176, 29906, 29889, 29911, 4590, 29918, 20633, 7390, 2891, 29918, 3035, 29967, 17321, 29897, 13, 1678, 396, 2176, 29906, 29889, 842, 29918, 1003, 3257, 29898, 3257, 29892, 1014, 3257, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 9995, 13, 1678, 10516, 3542, 29901, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 284, 2506, 9422, 13, 4706, 3017, 448, 29885, 474, 915, 275, 29889, 29894, 466, 29889, 29894, 466, 29918, 978, 1192, 284, 2506, 9422, 1192, 3998, 815, 1192, 17639, 2214, 13, 1678, 9995, 13, 1678, 1053, 6674, 307, 985, 292, 13, 1678, 6674, 307, 985, 292, 29889, 9021, 911, 29918, 5924, 580, 29871, 396, 363, 5401, 29941, 29906, 13, 1678, 1053, 318, 10154, 408, 3477, 29871, 396, 11698, 29984, 29909, 13, 1678, 3477, 29889, 1867, 312, 342, 29918, 7692, 2395, 580, 13, 2 ]
predict_traffic.py
clankster99/NN_project
0
54397
<filename>predict_traffic.py from PIL import Image import numpy as np import os def show_masked_img(roads_tensor, cars_tensor, raw_img, img_name): # Convert to numpy roads_pred = roads_tensor.cpu().detach().numpy() cars_pred = cars_tensor.cpu().detach().numpy() # Extract roads roads_img_r = roads_pred[1] roads_img_b = roads_pred[0] # Extract cars cars_img_r = cars_pred[1] cars_img_b = cars_pred[0] # Setting true valeus where the pixel is more likely to be a road roads_pred = roads_img_r > roads_img_b # Setting true valeus where the pixel is more likely to be a car cars_pred = cars_img_r > cars_img_b # Only care about the cars predicted on roads cars_pred *= roads_pred # Remove car pixels from road pixels roads_pred *= np.logical_not(cars_pred) # Convert raw_img to numpy array img_array = np.array(raw_img).astype(np.uint8) # Make the image more opaque img_array //= 2 # img_array *= 2 # Create array of 255 colored_array = np.zeros_like(img_array[:,:,0]) + 255 # Creating masks roads_mask = colored_array - img_array[:,:,0] cars_mask = colored_array - img_array[:,:,2] roads_mask *= roads_pred.astype(np.uint8) cars_mask *= cars_pred.astype(np.uint8) # Create image img_array[:,:,0] += roads_mask img_array[:,:,2] += cars_mask image = Image.fromarray(img_array, 'RGB') image.save('dataset/traffic/' + img_name) image.show() def get_traffic_level(roads_tensor, cars_tensor): # Convert to numpy roads_pred = roads_tensor.cpu().detach().numpy() cars_pred = cars_tensor.cpu().detach().numpy() # Extract roads roads_img_r = roads_pred[1] roads_img_b = roads_pred[0] # Extract cars cars_img_r = cars_pred[1] cars_img_b = cars_pred[0] # Setting true valeus where the pixel is more likely to be a road roads_pred = roads_img_r > roads_img_b # Setting true valeus where the pixel is more likely to be a car cars_pred = cars_img_r > cars_img_b # Only care about the cars predicted on roads cars_pred *= roads_pred # Check if enough roads road_pixels = np.sum(roads_pred) total_pixels = roads_pred.shape[0] * roads_pred.shape[1] if road_pixels / total_pixels < 0.1: return "Not enough roads" #Check number of car pixels car_pixels = np.sum(cars_pred) traffic = car_pixels / road_pixels # print("Traffic", traffic) return traffic # if traffic < 0.2: # return "No traffic" # if traffic < 0.5: # return "Moderate traffic" # if traffic < 0.8: # return "Traffic" # return "Heavy traffic" if __name__ == "__main__": import pickle directory = 'dataset/car_preds' num_of_files = len([name for name in os.listdir(directory) if os.path.isfile(os.path.join(directory, name))]) for idx in range(1, num_of_files + 1): str_idx = str(idx) with open('dataset/car_preds/prediction_' + str_idx + '.pred', 'rb') as handle: cars_pred, _ = pickle.load(handle) with open('dataset/road_preds/prediction_' + str_idx + '.pred', 'rb') as handle: roads_pred, raw_img = pickle.load(handle) img_name = ('0' * (7 - len(str_idx) + 1)) + str_idx + '.png' show_masked_img(roads_pred, cars_pred, raw_img, img_name) print(get_traffic_level(roads_pred, cars_pred))
[ 1, 529, 9507, 29958, 27711, 29918, 3018, 2416, 29889, 2272, 13, 3166, 349, 6227, 1053, 7084, 13, 5215, 12655, 408, 7442, 13, 5215, 2897, 13, 13, 1753, 1510, 29918, 13168, 287, 29918, 2492, 29898, 307, 7925, 29918, 20158, 29892, 18647, 29918, 20158, 29892, 10650, 29918, 2492, 29892, 10153, 29918, 978, 1125, 13, 1678, 396, 14806, 304, 12655, 13, 1678, 25320, 29918, 11965, 353, 25320, 29918, 20158, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 18647, 29918, 11965, 353, 18647, 29918, 20158, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 396, 7338, 1461, 25320, 13, 1678, 25320, 29918, 2492, 29918, 29878, 353, 25320, 29918, 11965, 29961, 29896, 29962, 13, 1678, 25320, 29918, 2492, 29918, 29890, 353, 25320, 29918, 11965, 29961, 29900, 29962, 13, 1678, 396, 7338, 1461, 18647, 13, 1678, 18647, 29918, 2492, 29918, 29878, 353, 18647, 29918, 11965, 29961, 29896, 29962, 13, 1678, 18647, 29918, 2492, 29918, 29890, 353, 18647, 29918, 11965, 29961, 29900, 29962, 13, 13, 1678, 396, 21605, 1565, 20368, 375, 988, 278, 15526, 338, 901, 5517, 304, 367, 263, 6520, 13, 1678, 25320, 29918, 11965, 353, 25320, 29918, 2492, 29918, 29878, 1405, 25320, 29918, 2492, 29918, 29890, 13, 1678, 396, 21605, 1565, 20368, 375, 988, 278, 15526, 338, 901, 5517, 304, 367, 263, 1559, 13, 1678, 18647, 29918, 11965, 353, 18647, 29918, 2492, 29918, 29878, 1405, 18647, 29918, 2492, 29918, 29890, 13, 1678, 396, 9333, 2562, 1048, 278, 18647, 25383, 373, 25320, 13, 1678, 18647, 29918, 11965, 334, 29922, 25320, 29918, 11965, 13, 1678, 396, 15154, 1559, 17036, 515, 6520, 17036, 13, 1678, 25320, 29918, 11965, 334, 29922, 7442, 29889, 1188, 936, 29918, 1333, 29898, 29883, 1503, 29918, 11965, 29897, 13, 13, 1678, 396, 14806, 10650, 29918, 2492, 304, 12655, 1409, 13, 1678, 10153, 29918, 2378, 353, 7442, 29889, 2378, 29898, 1610, 29918, 2492, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 1678, 396, 8561, 278, 1967, 901, 1015, 19772, 13, 1678, 10153, 29918, 2378, 849, 29922, 29871, 29906, 13, 1678, 396, 10153, 29918, 2378, 334, 29922, 29871, 29906, 13, 1678, 396, 6204, 1409, 310, 29871, 29906, 29945, 29945, 13, 1678, 28684, 29918, 2378, 353, 7442, 29889, 3298, 359, 29918, 4561, 29898, 2492, 29918, 2378, 7503, 29892, 29901, 29892, 29900, 2314, 718, 29871, 29906, 29945, 29945, 13, 13, 1678, 396, 26221, 11105, 29879, 13, 1678, 25320, 29918, 13168, 353, 28684, 29918, 2378, 448, 10153, 29918, 2378, 7503, 29892, 29901, 29892, 29900, 29962, 13, 1678, 18647, 29918, 13168, 353, 28684, 29918, 2378, 448, 10153, 29918, 2378, 7503, 29892, 29901, 29892, 29906, 29962, 13, 1678, 25320, 29918, 13168, 334, 29922, 25320, 29918, 11965, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 1678, 18647, 29918, 13168, 334, 29922, 18647, 29918, 11965, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 29897, 13, 13, 1678, 396, 6204, 1967, 13, 1678, 10153, 29918, 2378, 7503, 29892, 29901, 29892, 29900, 29962, 4619, 25320, 29918, 13168, 13, 1678, 10153, 29918, 2378, 7503, 29892, 29901, 29892, 29906, 29962, 4619, 18647, 29918, 13168, 13, 1678, 1967, 353, 7084, 29889, 3166, 2378, 29898, 2492, 29918, 2378, 29892, 525, 28212, 1495, 13, 1678, 1967, 29889, 7620, 877, 24713, 29914, 3018, 2416, 22208, 718, 10153, 29918, 978, 29897, 13, 1678, 1967, 29889, 4294, 580, 13, 13, 1753, 679, 29918, 3018, 2416, 29918, 5563, 29898, 307, 7925, 29918, 20158, 29892, 18647, 29918, 20158, 1125, 13, 1678, 396, 14806, 304, 12655, 13, 1678, 25320, 29918, 11965, 353, 25320, 29918, 20158, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 18647, 29918, 11965, 353, 18647, 29918, 20158, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 396, 7338, 1461, 25320, 13, 1678, 25320, 29918, 2492, 29918, 29878, 353, 25320, 29918, 11965, 29961, 29896, 29962, 13, 1678, 25320, 29918, 2492, 29918, 29890, 353, 25320, 29918, 11965, 29961, 29900, 29962, 13, 1678, 396, 7338, 1461, 18647, 13, 1678, 18647, 29918, 2492, 29918, 29878, 353, 18647, 29918, 11965, 29961, 29896, 29962, 13, 1678, 18647, 29918, 2492, 29918, 29890, 353, 18647, 29918, 11965, 29961, 29900, 29962, 13, 13, 1678, 396, 21605, 1565, 20368, 375, 988, 278, 15526, 338, 901, 5517, 304, 367, 263, 6520, 13, 1678, 25320, 29918, 11965, 353, 25320, 29918, 2492, 29918, 29878, 1405, 25320, 29918, 2492, 29918, 29890, 13, 1678, 396, 21605, 1565, 20368, 375, 988, 278, 15526, 338, 901, 5517, 304, 367, 263, 1559, 13, 1678, 18647, 29918, 11965, 353, 18647, 29918, 2492, 29918, 29878, 1405, 18647, 29918, 2492, 29918, 29890, 13, 1678, 396, 9333, 2562, 1048, 278, 18647, 25383, 373, 25320, 13, 1678, 18647, 29918, 11965, 334, 29922, 25320, 29918, 11965, 13, 13, 1678, 396, 5399, 565, 3307, 25320, 13, 1678, 6520, 29918, 29886, 861, 1379, 353, 7442, 29889, 2083, 29898, 307, 7925, 29918, 11965, 29897, 13, 1678, 3001, 29918, 29886, 861, 1379, 353, 25320, 29918, 11965, 29889, 12181, 29961, 29900, 29962, 334, 25320, 29918, 11965, 29889, 12181, 29961, 29896, 29962, 13, 13, 1678, 565, 6520, 29918, 29886, 861, 1379, 847, 3001, 29918, 29886, 861, 1379, 529, 29871, 29900, 29889, 29896, 29901, 13, 4706, 736, 376, 3664, 3307, 25320, 29908, 13, 268, 13, 1678, 396, 5596, 1353, 310, 1559, 17036, 13, 1678, 1559, 29918, 29886, 861, 1379, 353, 7442, 29889, 2083, 29898, 29883, 1503, 29918, 11965, 29897, 13, 1678, 12469, 353, 1559, 29918, 29886, 861, 1379, 847, 6520, 29918, 29886, 861, 1379, 13, 1678, 396, 1596, 703, 5323, 2416, 613, 12469, 29897, 13, 1678, 736, 12469, 13, 1678, 396, 565, 12469, 529, 29871, 29900, 29889, 29906, 29901, 13, 1678, 396, 268, 736, 376, 3782, 12469, 29908, 13, 1678, 396, 565, 12469, 529, 29871, 29900, 29889, 29945, 29901, 13, 1678, 396, 268, 736, 376, 2111, 261, 403, 12469, 29908, 13, 1678, 396, 565, 12469, 529, 29871, 29900, 29889, 29947, 29901, 13, 1678, 396, 268, 736, 376, 5323, 2416, 29908, 13, 1678, 396, 736, 376, 3868, 5301, 12469, 29908, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 5839, 280, 13, 1678, 3884, 353, 525, 24713, 29914, 4287, 29918, 11965, 29879, 29915, 13, 1678, 954, 29918, 974, 29918, 5325, 353, 7431, 4197, 978, 363, 1024, 297, 2897, 29889, 1761, 3972, 29898, 12322, 29897, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 359, 29889, 2084, 29889, 7122, 29898, 12322, 29892, 1024, 876, 2314, 13, 268, 13, 1678, 363, 22645, 297, 3464, 29898, 29896, 29892, 954, 29918, 974, 29918, 5325, 718, 29871, 29896, 1125, 13, 4706, 851, 29918, 13140, 353, 851, 29898, 13140, 29897, 13, 13, 4706, 411, 1722, 877, 24713, 29914, 4287, 29918, 11965, 29879, 29914, 11965, 2463, 29918, 29915, 718, 851, 29918, 13140, 718, 15300, 11965, 742, 525, 6050, 1495, 408, 4386, 29901, 13, 9651, 18647, 29918, 11965, 29892, 903, 353, 5839, 280, 29889, 1359, 29898, 8411, 29897, 13, 13, 4706, 411, 1722, 877, 24713, 29914, 9972, 29918, 11965, 29879, 29914, 11965, 2463, 29918, 29915, 718, 851, 29918, 13140, 718, 15300, 11965, 742, 525, 6050, 1495, 408, 4386, 29901, 13, 9651, 25320, 29918, 11965, 29892, 10650, 29918, 2492, 353, 5839, 280, 29889, 1359, 29898, 8411, 29897, 13, 308, 13, 4706, 10153, 29918, 978, 353, 6702, 29900, 29915, 334, 313, 29955, 448, 7431, 29898, 710, 29918, 13140, 29897, 718, 29871, 29896, 876, 718, 851, 29918, 13140, 718, 15300, 2732, 29915, 13, 4706, 1510, 29918, 13168, 287, 29918, 2492, 29898, 307, 7925, 29918, 11965, 29892, 18647, 29918, 11965, 29892, 10650, 29918, 2492, 29892, 10153, 29918, 978, 29897, 13, 4706, 1596, 29898, 657, 29918, 3018, 2416, 29918, 5563, 29898, 307, 7925, 29918, 11965, 29892, 18647, 29918, 11965, 876, 2 ]
Image/Histrogram.py
pection/InternshipProject
0
170138
import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('C:\Code_python\Image\Picture\Tiger.jpg',0) # img2 = cv2.equalizeHist(img) hist,bins = np.histogram(img.flatten(),256,[0,256]) cdf = hist.cumsum() cdf_normalized = cdf * hist.max()/ cdf.max() cdf_m = np.ma.masked_equal(cdf,0) cdf_m = (cdf_m - cdf_m.min())*255/(cdf_m.max()-cdf_m.min()) cdf = np.ma.filled(cdf_m,0).astype('uint8') img2 = cdf[img] cv2.namedWindow('before') cv2.imshow('before',img) cv2.namedWindow('after') cv2.imshow('after',img2) cv2.waitKey(0) cv2.destroyAllWindows()
[ 1, 1053, 13850, 29906, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 30004, 13, 2492, 353, 13850, 29906, 29889, 326, 949, 877, 29907, 3583, 3399, 29918, 4691, 29905, 2940, 29905, 28210, 29905, 29911, 4087, 29889, 6173, 742, 29900, 8443, 13, 29937, 10153, 29906, 353, 13850, 29906, 29889, 11745, 675, 29950, 391, 29898, 2492, 8443, 13, 29882, 391, 29892, 29890, 1144, 353, 7442, 29889, 29882, 391, 13342, 29898, 2492, 29889, 1579, 8606, 3285, 29906, 29945, 29953, 17094, 29900, 29892, 29906, 29945, 29953, 2314, 30004, 13, 29883, 2176, 353, 9825, 29889, 29883, 398, 2083, 26471, 13, 29883, 2176, 29918, 8945, 1891, 353, 274, 2176, 334, 9825, 29889, 3317, 580, 29914, 274, 2176, 29889, 3317, 26471, 13, 29883, 2176, 29918, 29885, 353, 7442, 29889, 655, 29889, 13168, 287, 29918, 11745, 29898, 29883, 2176, 29892, 29900, 8443, 13, 29883, 2176, 29918, 29885, 353, 313, 29883, 2176, 29918, 29885, 448, 274, 2176, 29918, 29885, 29889, 1195, 3101, 29930, 29906, 29945, 29945, 14571, 29883, 2176, 29918, 29885, 29889, 3317, 580, 29899, 29883, 2176, 29918, 29885, 29889, 1195, 3101, 30004, 13, 29883, 2176, 353, 7442, 29889, 655, 29889, 26940, 29898, 29883, 2176, 29918, 29885, 29892, 29900, 467, 579, 668, 877, 13470, 29947, 1495, 30004, 13, 2492, 29906, 353, 274, 2176, 29961, 2492, 29962, 1678, 6756, 13, 11023, 29906, 29889, 17514, 5907, 877, 11083, 1495, 30004, 13, 11023, 29906, 29889, 326, 4294, 877, 11083, 742, 2492, 8443, 13, 11023, 29906, 29889, 17514, 5907, 877, 7045, 1495, 30004, 13, 11023, 29906, 29889, 326, 4294, 877, 7045, 742, 2492, 29906, 8443, 13, 11023, 29906, 29889, 10685, 2558, 29898, 29900, 8443, 13, 11023, 29906, 29889, 20524, 3596, 7685, 580, 2 ]
mysite/models.py
zurawiki/thecrimsom
1
103790
<filename>mysite/models.py from django.core.urlresolvers import reverse from django.db import models from django.template.loader import render_to_string from django.utils.html import strip_tags from solo.models import SingletonModel class Section(models.Model): name = models.CharField(blank=False, max_length=50, db_index=True) def __str__(self): return self.name class Author(models.Model): first_name = models.CharField(blank=False, null=True, max_length=70) last_name = models.CharField(blank=False, null=True, max_length=100) middle_name = models.CharField(blank=True, null=True, max_length=70) created_on = models.DateField(auto_now_add=True) def get_absolute_url(self): return reverse('mysite.views.writer_detail', args=[self.pk, self.first_name, self.middle_name, self.last_name]) def __unicode__(self): if self.middle_name: return "%s %s. %s" % (self.first_name, self.middle_name[0], self.last_name) else: return "%s %s" % (self.first_name, self.last_name) class Article(models.Model): PUB_CHOICES = ( (0, 'Draft'), (1, 'Published'), (-1, 'Deleted'), ) fake = models.BooleanField(default=False) title = models.CharField(max_length=200, blank=False, null=False, default='') subtitle = models.CharField(max_length=255, blank=True, null=False, default='') authors = models.ManyToManyField(Author, null=True, related_name='content') section = models.ForeignKey(Section, null=False, related_name='content') image = models.ImageField(null=True, blank=True, upload_to='images') content = models.TextField(blank=True, null=False, default='') slug = models.SlugField(max_length=70, unique=True, db_index=True, help_text=""" The text that will be displayed in the URL of this article. Can only contain letters, numbers, and dashes (-). """ ) pub_status = models.IntegerField(null=False, choices=PUB_CHOICES, default=0, db_index=True) created_on = models.DateTimeField(auto_now_add=True, db_index=True) modified_on = models.DateTimeField(auto_now=True) def list_preview(self): return render_to_string('article/list_preview.html', {'article': self}) def __unicode__(self): if self.fake: return "(FAKE) %s" % self.title else: return self.title def __str__(self): return "".join([x if ord(x) < 128 else '?' for x in unicode(self)]) def get_absolute_url(self): if self.fake: return '#' year = self.created_on.year month = self.created_on.month day = self.created_on.day return reverse('mysite.views.article_detail', args=[year, month, day, self.slug]) def teaser(self): if self.subtitle: return self.subtitle else: return strip_tags(self.content) class BreakingNews(SingletonModel): description = models.TextField(blank=False, null=False, default='') link = models.CharField(max_length=255, blank=False, null=False, default='#') active = models.BooleanField() when = models.DateTimeField() class HomePage(SingletonModel): primary1 = models.ForeignKey(Article, null=True, related_name='+') primary2 = models.ForeignKey(Article, null=True, related_name='+') primary3 = models.ForeignKey(Article, null=True, related_name='+') primary4 = models.ForeignKey(Article, null=True, related_name='+') primary5 = models.ForeignKey(Article, null=True, related_name='+') primary6 = models.ForeignKey(Article, null=True, related_name='+') def __unicode__(self): return u"The Home Page" # something like this will make admin message strings more coherent class Meta: verbose_name = "Home Page" # once again this will make sure your admin UI doesn't have illogical text verbose_name_plural = "Home Page" class NewsSection(SingletonModel): featured = models.ForeignKey(Article, null=True, related_name='+') image1 = models.ForeignKey(Article, null=True, related_name='+') image2 = models.ForeignKey(Article, null=True, related_name='+') image3 = models.ForeignKey(Article, null=True, related_name='+') image4 = models.ForeignKey(Article, null=True, related_name='+') image5 = models.ForeignKey(Article, null=True, related_name='+') def __unicode__(self): return u"News Section" # something like this will make admin message strings more coherent class Meta: verbose_name = u"News Section" # once again this will make sure your admin UI doesn't have illogical text verbose_name_plural = u"News Section" class OpinionSection(SingletonModel): comic = models.ImageField(upload_to='images') ed1 = models.ForeignKey(Article, null=True, related_name='+') ed2 = models.ForeignKey(Article, null=True, related_name='+') ed3 = models.ForeignKey(Article, null=True, related_name='+') ed4 = models.ForeignKey(Article, null=True, related_name='+') oped1 = models.ForeignKey(Article, null=True, related_name='+') oped2 = models.ForeignKey(Article, null=True, related_name='+') oped3 = models.ForeignKey(Article, null=True, related_name='+') oped4 = models.ForeignKey(Article, null=True, related_name='+') def __unicode__(self): return u"Opinion Section" # something like this will make admin message strings more coherent class Meta: verbose_name = u"Opinion Section" # once again this will make sure your admin UI doesn't have illogical text verbose_name_plural = u"Opinion Section" class MostRead(SingletonModel): n1 = models.ForeignKey(Article, null=True, related_name='+') n2 = models.ForeignKey(Article, null=True, related_name='+') n3 = models.ForeignKey(Article, null=True, related_name='+') n4 = models.ForeignKey(Article, null=True, related_name='+') n5 = models.ForeignKey(Article, null=True, related_name='+') def __unicode__(self): return u"Most Read" # something like this will make admin message strings more coherent class Meta: verbose_name = "Most Read" # once again this will make sure your admin UI doesn't have illogical text verbose_name_plural = "Most Read"
[ 1, 529, 9507, 29958, 5781, 568, 29914, 9794, 29889, 2272, 13, 3166, 9557, 29889, 3221, 29889, 2271, 9778, 874, 1053, 11837, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 6886, 29889, 12657, 1053, 4050, 29918, 517, 29918, 1807, 13, 3166, 9557, 29889, 13239, 29889, 1420, 1053, 17820, 29918, 11338, 13, 3166, 6651, 29889, 9794, 1053, 6106, 11285, 3195, 13, 13, 1990, 9779, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 19465, 29922, 8824, 29892, 4236, 29918, 2848, 29922, 29945, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 1583, 29889, 978, 13, 13, 13, 1990, 13361, 29898, 9794, 29889, 3195, 1125, 13, 1678, 937, 29918, 978, 353, 4733, 29889, 27890, 29898, 19465, 29922, 8824, 29892, 1870, 29922, 5574, 29892, 4236, 29918, 2848, 29922, 29955, 29900, 29897, 13, 1678, 1833, 29918, 978, 353, 4733, 29889, 27890, 29898, 19465, 29922, 8824, 29892, 1870, 29922, 5574, 29892, 4236, 29918, 2848, 29922, 29896, 29900, 29900, 29897, 13, 1678, 7256, 29918, 978, 353, 4733, 29889, 27890, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 4236, 29918, 2848, 29922, 29955, 29900, 29897, 13, 1678, 2825, 29918, 265, 353, 4733, 29889, 2539, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 29897, 13, 13, 1678, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 1125, 13, 4706, 736, 11837, 877, 5781, 568, 29889, 7406, 29889, 13236, 29918, 16432, 742, 6389, 11759, 1311, 29889, 20571, 29892, 1583, 29889, 4102, 29918, 978, 29892, 1583, 29889, 17662, 29918, 978, 29892, 1583, 29889, 4230, 29918, 978, 2314, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 565, 1583, 29889, 17662, 29918, 978, 29901, 13, 9651, 736, 11860, 29879, 1273, 29879, 29889, 1273, 29879, 29908, 1273, 313, 1311, 29889, 4102, 29918, 978, 29892, 1583, 29889, 17662, 29918, 978, 29961, 29900, 1402, 1583, 29889, 4230, 29918, 978, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 11860, 29879, 1273, 29879, 29908, 1273, 313, 1311, 29889, 4102, 29918, 978, 29892, 1583, 29889, 4230, 29918, 978, 29897, 13, 13, 13, 1990, 21746, 29898, 9794, 29889, 3195, 1125, 13, 1678, 349, 7466, 29918, 3210, 29949, 2965, 2890, 353, 313, 13, 4706, 313, 29900, 29892, 525, 29928, 4154, 5477, 13, 4706, 313, 29896, 29892, 525, 21076, 3726, 5477, 13, 4706, 8521, 29896, 29892, 525, 2772, 22742, 5477, 13, 1678, 1723, 13, 13, 1678, 25713, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 29897, 13, 13, 1678, 3611, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29900, 29900, 29892, 9654, 29922, 8824, 29892, 1870, 29922, 8824, 29892, 2322, 2433, 1495, 13, 1678, 1014, 3257, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29892, 9654, 29922, 5574, 29892, 1870, 29922, 8824, 29892, 2322, 2433, 1495, 13, 1678, 15717, 353, 4733, 29889, 14804, 1762, 14804, 3073, 29898, 13720, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 3051, 1495, 13, 1678, 4004, 353, 4733, 29889, 27755, 2558, 29898, 13438, 29892, 1870, 29922, 8824, 29892, 4475, 29918, 978, 2433, 3051, 1495, 13, 1678, 1967, 353, 4733, 29889, 2940, 3073, 29898, 4304, 29922, 5574, 29892, 9654, 29922, 5574, 29892, 6441, 29918, 517, 2433, 8346, 1495, 13, 13, 1678, 2793, 353, 4733, 29889, 15778, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 8824, 29892, 2322, 2433, 1495, 13, 13, 1678, 2243, 688, 353, 4733, 29889, 16973, 688, 3073, 29898, 3317, 29918, 2848, 29922, 29955, 29900, 29892, 5412, 29922, 5574, 29892, 4833, 29918, 2248, 29922, 5574, 29892, 1371, 29918, 726, 13776, 29908, 13, 9651, 450, 1426, 393, 674, 367, 8833, 297, 278, 3988, 310, 445, 4274, 29889, 13, 9651, 1815, 871, 1712, 8721, 29892, 3694, 29892, 322, 12569, 267, 8521, 467, 13, 9651, 9995, 13, 1678, 1723, 13, 13, 1678, 2529, 29918, 4882, 353, 4733, 29889, 7798, 3073, 29898, 4304, 29922, 8824, 29892, 19995, 29922, 7056, 29933, 29918, 3210, 29949, 2965, 2890, 29892, 13, 462, 462, 268, 2322, 29922, 29900, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 1678, 2825, 29918, 265, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29918, 1202, 29922, 5574, 29892, 4833, 29918, 2248, 29922, 5574, 29897, 13, 1678, 9120, 29918, 265, 353, 4733, 29889, 11384, 3073, 29898, 6921, 29918, 3707, 29922, 5574, 29897, 13, 13, 1678, 822, 1051, 29918, 25347, 29898, 1311, 1125, 13, 4706, 736, 4050, 29918, 517, 29918, 1807, 877, 7914, 29914, 1761, 29918, 25347, 29889, 1420, 742, 11117, 7914, 2396, 1583, 1800, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 565, 1583, 29889, 29888, 1296, 29901, 13, 9651, 736, 18227, 4519, 6059, 29897, 1273, 29879, 29908, 1273, 1583, 29889, 3257, 13, 4706, 1683, 29901, 13, 9651, 736, 1583, 29889, 3257, 13, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 376, 1642, 7122, 4197, 29916, 565, 4356, 29898, 29916, 29897, 529, 29871, 29896, 29906, 29947, 1683, 525, 17901, 363, 921, 297, 29104, 29898, 1311, 29897, 2314, 13, 13, 1678, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 29888, 1296, 29901, 13, 9651, 736, 16321, 29915, 13, 4706, 1629, 353, 1583, 29889, 11600, 29918, 265, 29889, 6360, 13, 4706, 4098, 353, 1583, 29889, 11600, 29918, 265, 29889, 10874, 13, 4706, 2462, 353, 1583, 29889, 11600, 29918, 265, 29889, 3250, 13, 13, 4706, 736, 11837, 877, 5781, 568, 29889, 7406, 29889, 7914, 29918, 16432, 742, 6389, 11759, 6360, 29892, 4098, 29892, 2462, 29892, 1583, 29889, 29517, 2314, 13, 13, 13, 1678, 822, 734, 29440, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 1491, 3257, 29901, 13, 9651, 736, 1583, 29889, 1491, 3257, 13, 4706, 1683, 29901, 13, 9651, 736, 17820, 29918, 11338, 29898, 1311, 29889, 3051, 29897, 13, 13, 13, 1990, 5826, 5086, 29328, 29898, 10873, 11285, 3195, 1125, 13, 1678, 6139, 353, 4733, 29889, 15778, 29898, 19465, 29922, 8824, 29892, 1870, 29922, 8824, 29892, 2322, 2433, 1495, 13, 1678, 1544, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29892, 9654, 29922, 8824, 29892, 1870, 29922, 8824, 29892, 2322, 2433, 29937, 1495, 13, 1678, 6136, 353, 4733, 29889, 18146, 3073, 580, 13, 1678, 746, 353, 4733, 29889, 11384, 3073, 580, 13, 13, 13, 1990, 8778, 5074, 29898, 10873, 11285, 3195, 1125, 13, 1678, 7601, 29896, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 7601, 29906, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 7601, 29941, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 7601, 29946, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 7601, 29945, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 7601, 29953, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 736, 318, 29908, 1576, 8778, 9305, 29908, 29871, 396, 1554, 763, 445, 674, 1207, 4113, 2643, 6031, 901, 16165, 261, 296, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 376, 11184, 9305, 29908, 29871, 396, 2748, 1449, 445, 674, 1207, 1854, 596, 4113, 3740, 1838, 29915, 29873, 505, 980, 1188, 936, 1426, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 376, 11184, 9305, 29908, 13, 13, 13, 1990, 10130, 13438, 29898, 10873, 11285, 3195, 1125, 13, 1678, 15000, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1967, 29896, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1967, 29906, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1967, 29941, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1967, 29946, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1967, 29945, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 736, 318, 29908, 29328, 9779, 29908, 29871, 396, 1554, 763, 445, 674, 1207, 4113, 2643, 6031, 901, 16165, 261, 296, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 318, 29908, 29328, 9779, 29908, 29871, 396, 2748, 1449, 445, 674, 1207, 1854, 596, 4113, 3740, 1838, 29915, 29873, 505, 980, 1188, 936, 1426, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 318, 29908, 29328, 9779, 29908, 13, 13, 13, 1990, 6461, 262, 291, 13438, 29898, 10873, 11285, 3195, 1125, 13, 1678, 419, 293, 353, 4733, 29889, 2940, 3073, 29898, 9009, 29918, 517, 2433, 8346, 1495, 13, 1678, 1226, 29896, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1226, 29906, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1226, 29941, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1226, 29946, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1015, 287, 29896, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1015, 287, 29906, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1015, 287, 29941, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 1015, 287, 29946, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 736, 318, 29908, 11746, 262, 291, 9779, 29908, 29871, 396, 1554, 763, 445, 674, 1207, 4113, 2643, 6031, 901, 16165, 261, 296, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 318, 29908, 11746, 262, 291, 9779, 29908, 29871, 396, 2748, 1449, 445, 674, 1207, 1854, 596, 4113, 3740, 1838, 29915, 29873, 505, 980, 1188, 936, 1426, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 318, 29908, 11746, 262, 291, 9779, 29908, 13, 13, 13, 1990, 7849, 6359, 29898, 10873, 11285, 3195, 1125, 13, 1678, 302, 29896, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 302, 29906, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 302, 29941, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 302, 29946, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 1678, 302, 29945, 353, 4733, 29889, 27755, 2558, 29898, 9986, 2512, 29892, 1870, 29922, 5574, 29892, 4475, 29918, 978, 2433, 29974, 1495, 13, 13, 1678, 822, 4770, 2523, 356, 12035, 1311, 1125, 13, 4706, 736, 318, 29908, 29924, 520, 7523, 29908, 29871, 396, 1554, 763, 445, 674, 1207, 4113, 2643, 6031, 901, 16165, 261, 296, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 376, 29924, 520, 7523, 29908, 29871, 396, 2748, 1449, 445, 674, 1207, 1854, 596, 4113, 3740, 1838, 29915, 29873, 505, 980, 1188, 936, 1426, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 376, 29924, 520, 7523, 29908, 2 ]
day06/python/mschlund/solution.py
jamhocken/aoc-2020
16
171627
<gh_stars>10-100 import re def get_answers_of_group(group): answers = {x for x in group if re.match('[a-z]', x)} return answers def get_unanimously_answered_questions(group): persons = group.split('\n') questions_answered = [{q for q in person} for person in persons] return set.intersection(*questions_answered) def main(): input_filename = 'input.txt' with open(input_filename, 'r') as input: all_custom_forms = input.read() groups_answers = re.split('\n\n', all_custom_forms) nr_answered = [len(get_answers_of_group(g)) for g in groups_answers] print('Sum of # of questions answered: {}'.format(sum(nr_answered))) unanimously_answered = [len(get_unanimously_answered_questions(g)) for g in groups_answers] print('Sum of questions answered unanimously: {}'.format(sum(unanimously_answered))) if __name__ == "__main__": main()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 337, 13, 13, 1753, 679, 29918, 550, 17538, 29918, 974, 29918, 2972, 29898, 2972, 1125, 13, 1678, 6089, 353, 426, 29916, 363, 921, 297, 2318, 565, 337, 29889, 4352, 877, 29961, 29874, 29899, 29920, 29962, 742, 921, 2915, 13, 1678, 736, 6089, 13, 13, 1753, 679, 29918, 348, 11576, 5794, 29918, 12011, 287, 29918, 2619, 29898, 2972, 1125, 13, 1678, 12407, 353, 2318, 29889, 5451, 28909, 29876, 1495, 13, 1678, 5155, 29918, 12011, 287, 353, 15974, 29939, 363, 3855, 297, 2022, 29913, 363, 2022, 297, 12407, 29962, 13, 1678, 736, 731, 29889, 1639, 2042, 10456, 2619, 29918, 12011, 287, 29897, 13, 13, 1753, 1667, 7295, 13, 29871, 1881, 29918, 9507, 353, 525, 2080, 29889, 3945, 29915, 13, 29871, 411, 1722, 29898, 2080, 29918, 9507, 29892, 525, 29878, 1495, 408, 1881, 29901, 13, 1678, 599, 29918, 6341, 29918, 9514, 353, 1881, 29889, 949, 580, 13, 1678, 6471, 29918, 550, 17538, 353, 337, 29889, 5451, 28909, 29876, 29905, 29876, 742, 599, 29918, 6341, 29918, 9514, 29897, 13, 1678, 17114, 29918, 12011, 287, 353, 518, 2435, 29898, 657, 29918, 550, 17538, 29918, 974, 29918, 2972, 29898, 29887, 876, 363, 330, 297, 6471, 29918, 550, 17538, 29962, 13, 1678, 1596, 877, 11139, 310, 396, 310, 5155, 7699, 29901, 6571, 4286, 4830, 29898, 2083, 29898, 22230, 29918, 12011, 287, 4961, 13, 1678, 443, 11576, 5794, 29918, 12011, 287, 353, 518, 2435, 29898, 657, 29918, 348, 11576, 5794, 29918, 12011, 287, 29918, 2619, 29898, 29887, 876, 363, 330, 297, 6471, 29918, 550, 17538, 29962, 13, 1678, 1596, 877, 11139, 310, 5155, 7699, 443, 11576, 5794, 29901, 6571, 4286, 4830, 29898, 2083, 29898, 348, 11576, 5794, 29918, 12011, 287, 4961, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29871, 1667, 580, 2 ]
ninjia/transformers/category_group.py
taohu88/ninjia
0
185819
from collections import defaultdict from sklearn.base import BaseEstimator, TransformerMixin class CategoryGrouper(BaseEstimator, TransformerMixin): """A tranformer for combining low count observations for categorical features. This transformer will preserve category values that are above a certain threshold, while bucketing together all the other values. This will fix issues where new data may have an unobserved category value that the training data did not have. """ def __init__(self, threshold=0.05): """Initialize method. Args: threshold (float): The threshold to apply the bucketing when categorical values drop below that threshold. """ self.d = defaultdict(list) self.threshold = threshold def transform(self, X, **transform_params): """Transforms X with new buckets. Args: X (obj): The dataset to pass to the transformer. Returns: The transformed X with grouped buckets. """ X_copy = X.copy() for col in X_copy.columns: X_copy[col] = X_copy[col].apply(lambda x: x if x in self.d[col] else 'CategoryGrouperOther') return X_copy def fit(self, X, y=None, **fit_params): """Fits transformer over X. Builds a dictionary of lists where the lists are category values of the column key for preserving, since they meet the threshold. """ df_rows = len(X.index) for col in X.columns: calc_col = X.groupby(col)[col].agg(lambda x: (len(x) * 1.0) / df_rows) self.d[col] = calc_col[calc_col >= self.threshold].index.tolist() return self if __name__ == "__main__": import pandas as pd cgr = CategoryGrouper(threshold=0.1) colors = 3*['red'] + 11 * ['green'] + 5 *['blue'] + ['yellow'] print(f"Colors = {colors}") df = pd.DataFrame.from_dict({'color': colors}) print(df.head()) X = cgr.fit_transform(df) print(X)
[ 1, 515, 16250, 1053, 2322, 8977, 13, 3166, 2071, 19668, 29889, 3188, 1053, 7399, 12787, 326, 1061, 29892, 4103, 24784, 29924, 861, 262, 13, 13, 13, 1990, 17943, 3338, 283, 546, 29898, 5160, 12787, 326, 1061, 29892, 4103, 24784, 29924, 861, 262, 1125, 13, 1678, 9995, 29909, 22024, 24784, 363, 29299, 4482, 2302, 13917, 363, 11608, 936, 5680, 29889, 13, 13, 1678, 910, 4327, 261, 674, 19905, 7663, 1819, 393, 526, 2038, 263, 3058, 13, 1678, 16897, 29892, 1550, 20968, 292, 4208, 599, 278, 916, 1819, 29889, 910, 674, 2329, 5626, 13, 1678, 988, 716, 848, 1122, 505, 385, 443, 711, 643, 1490, 7663, 995, 393, 278, 6694, 848, 13, 1678, 1258, 451, 505, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 16897, 29922, 29900, 29889, 29900, 29945, 1125, 13, 4706, 9995, 6644, 6646, 1158, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 16897, 313, 7411, 1125, 450, 16897, 304, 3394, 278, 20968, 292, 746, 13, 18884, 11608, 936, 1819, 5768, 2400, 393, 16897, 29889, 13, 4706, 9995, 13, 4706, 1583, 29889, 29881, 353, 2322, 8977, 29898, 1761, 29897, 13, 4706, 1583, 29889, 386, 12268, 353, 16897, 13, 13, 1678, 822, 4327, 29898, 1311, 29892, 1060, 29892, 3579, 9067, 29918, 7529, 1125, 13, 4706, 9995, 4300, 9514, 1060, 411, 716, 1321, 9737, 29889, 13, 13, 4706, 826, 3174, 29901, 13, 9651, 1060, 313, 5415, 1125, 450, 8783, 304, 1209, 304, 278, 4327, 261, 29889, 13, 13, 4706, 16969, 29901, 13, 9651, 450, 27615, 1060, 411, 27831, 1321, 9737, 29889, 13, 4706, 9995, 13, 4706, 1060, 29918, 8552, 353, 1060, 29889, 8552, 580, 13, 4706, 363, 784, 297, 1060, 29918, 8552, 29889, 13099, 29901, 13, 9651, 1060, 29918, 8552, 29961, 1054, 29962, 353, 1060, 29918, 8552, 29961, 1054, 1822, 7302, 29898, 2892, 921, 29901, 921, 565, 921, 297, 1583, 29889, 29881, 29961, 1054, 29962, 1683, 525, 10900, 3338, 283, 546, 16107, 1495, 13, 4706, 736, 1060, 29918, 8552, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 1060, 29892, 343, 29922, 8516, 29892, 3579, 9202, 29918, 7529, 1125, 13, 4706, 9995, 29943, 1169, 4327, 261, 975, 1060, 29889, 13, 13, 4706, 8878, 29879, 263, 8600, 310, 8857, 988, 278, 8857, 526, 7663, 1819, 310, 278, 13, 4706, 1897, 1820, 363, 2225, 29530, 29892, 1951, 896, 5870, 278, 16897, 29889, 13, 4706, 9995, 13, 4706, 4489, 29918, 5727, 353, 7431, 29898, 29990, 29889, 2248, 29897, 13, 4706, 363, 784, 297, 1060, 29889, 13099, 29901, 13, 9651, 22235, 29918, 1054, 353, 1060, 29889, 27789, 29898, 1054, 9601, 1054, 1822, 16170, 29898, 2892, 921, 29901, 313, 2435, 29898, 29916, 29897, 334, 29871, 29896, 29889, 29900, 29897, 847, 4489, 29918, 5727, 29897, 13, 9651, 1583, 29889, 29881, 29961, 1054, 29962, 353, 22235, 29918, 1054, 29961, 28667, 29918, 1054, 6736, 1583, 29889, 386, 12268, 1822, 2248, 29889, 25027, 391, 580, 13, 4706, 736, 1583, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1053, 11701, 408, 10518, 13, 13, 1678, 274, 629, 353, 17943, 3338, 283, 546, 29898, 386, 12268, 29922, 29900, 29889, 29896, 29897, 13, 1678, 11955, 353, 29871, 29941, 29930, 1839, 1127, 2033, 718, 29871, 29896, 29896, 334, 6024, 12692, 2033, 718, 29871, 29945, 334, 1839, 9539, 2033, 718, 6024, 29136, 2033, 13, 1678, 1596, 29898, 29888, 29908, 1625, 943, 353, 426, 27703, 27195, 13, 1678, 4489, 353, 10518, 29889, 17271, 29889, 3166, 29918, 8977, 3319, 29915, 2780, 2396, 11955, 1800, 13, 1678, 1596, 29898, 2176, 29889, 2813, 3101, 13, 13, 1678, 1060, 353, 274, 629, 29889, 9202, 29918, 9067, 29898, 2176, 29897, 13, 1678, 1596, 29898, 29990, 29897, 2 ]
dfm/net.py
127t6937/chainer-gan-lib
449
147917
<filename>dfm/net.py import chainer.functions as F import chainer.links as L import numpy as np import chainer class Discriminator(chainer.Chain): def __init__(self, bottom_width=2, ch=512, wscale=0.02): w = chainer.initializers.Normal(wscale) super(Discriminator, self).__init__() with self.init_scope(): self.c0 = L.Convolution2D(3, ch // 16, 3, 1, 1, initialW=w) self.c1 = L.Convolution2D(ch // 16, ch // 8, 4, 2, 1, initialW=w) self.c2 = L.Convolution2D(ch // 8, ch // 4, 4, 2, 1, initialW=w) self.c3 = L.Convolution2D(ch // 4, ch // 2, 4, 2, 1, initialW=w) self.c4 = L.Convolution2D(ch // 2, ch // 1, 4, 2, 1, initialW=w) self.l5 = L.Linear(bottom_width * bottom_width * ch, 1, initialW=w) self.bn1 = L.BatchNormalization(ch // 8) self.bn2 = L.BatchNormalization(ch // 4) self.bn3 = L.BatchNormalization(ch // 2) self.bn4 = L.BatchNormalization(ch // 1, use_gamma=False) def __call__(self, x): h = x h = F.leaky_relu(self.c0(h)) h = F.leaky_relu(self.bn1(self.c1(h))) h = F.leaky_relu(self.bn2(self.c2(h))) h = F.leaky_relu(self.bn3(self.c3(h))) feature = self.bn4(self.c4(h)) h = F.leaky_relu(feature) return feature, self.l5(h) class Denoiser(chainer.Chain): def __init__(self): super(Denoiser, self).__init__() with self.init_scope(): self.l0 = L.Linear(2048, 2048) self.l1 = L.Linear(2048, 2048) self.l2 = L.Linear(2048, 2048) self.l3 = L.Linear(2048, 2048) self.l4 = L.Linear(2048, 2048) self.l5 = L.Linear(2048, 2048) self.l6 = L.Linear(2048, 2048) self.l7 = L.Linear(2048, 2048) self.l8 = L.Linear(2048, 2048) self.l9 = L.Linear(2048, 2048) self.bn0 = L.BatchNormalization(2048) self.bn1 = L.BatchNormalization(2048) self.bn2 = L.BatchNormalization(2048) self.bn3 = L.BatchNormalization(2048) self.bn4 = L.BatchNormalization(2048) self.bn5 = L.BatchNormalization(2048) self.bn6 = L.BatchNormalization(2048) self.bn7 = L.BatchNormalization(2048) self.bn8 = L.BatchNormalization(2048) def __call__(self, x): h = F.reshape(x, (len(x), 2048)) h = F.leaky_relu(self.bn0(self.l0(h))) h = F.leaky_relu(self.bn1(self.l1(h))) h = F.leaky_relu(self.bn2(self.l2(h))) h = F.leaky_relu(self.bn3(self.l3(h))) h = F.leaky_relu(self.bn4(self.l4(h))) h = F.leaky_relu(self.bn5(self.l5(h))) h = F.leaky_relu(self.bn6(self.l6(h))) h = F.leaky_relu(self.bn7(self.l7(h))) h = F.leaky_relu(self.bn8(self.l8(h))) return F.reshape(self.l9(h), (len(x), 512, 2, 2))
[ 1, 529, 9507, 29958, 2176, 29885, 29914, 1212, 29889, 2272, 13, 5215, 521, 4008, 29889, 12171, 408, 383, 13, 5215, 521, 4008, 29889, 4965, 408, 365, 13, 5215, 12655, 408, 7442, 13, 5215, 521, 4008, 13, 13, 13, 1990, 8565, 20386, 1061, 29898, 305, 4008, 29889, 14688, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 5970, 29918, 2103, 29922, 29906, 29892, 521, 29922, 29945, 29896, 29906, 29892, 281, 7052, 29922, 29900, 29889, 29900, 29906, 1125, 13, 4706, 281, 353, 521, 4008, 29889, 11228, 19427, 29889, 19077, 29898, 29893, 7052, 29897, 13, 4706, 2428, 29898, 4205, 29883, 20386, 1061, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 411, 1583, 29889, 2344, 29918, 6078, 7295, 13, 9651, 1583, 29889, 29883, 29900, 353, 365, 29889, 1168, 4068, 29906, 29928, 29898, 29941, 29892, 521, 849, 29871, 29896, 29953, 29892, 29871, 29941, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 29883, 29896, 353, 365, 29889, 1168, 4068, 29906, 29928, 29898, 305, 849, 29871, 29896, 29953, 29892, 521, 849, 29871, 29947, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 29883, 29906, 353, 365, 29889, 1168, 4068, 29906, 29928, 29898, 305, 849, 29871, 29947, 29892, 521, 849, 29871, 29946, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 29883, 29941, 353, 365, 29889, 1168, 4068, 29906, 29928, 29898, 305, 849, 29871, 29946, 29892, 521, 849, 29871, 29906, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 29883, 29946, 353, 365, 29889, 1168, 4068, 29906, 29928, 29898, 305, 849, 29871, 29906, 29892, 521, 849, 29871, 29896, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 29880, 29945, 353, 365, 29889, 12697, 29898, 8968, 29918, 2103, 334, 5970, 29918, 2103, 334, 521, 29892, 29871, 29896, 29892, 2847, 29956, 29922, 29893, 29897, 13, 9651, 1583, 29889, 11197, 29896, 353, 365, 29889, 23145, 19077, 2133, 29898, 305, 849, 29871, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29906, 353, 365, 29889, 23145, 19077, 2133, 29898, 305, 849, 29871, 29946, 29897, 13, 9651, 1583, 29889, 11197, 29941, 353, 365, 29889, 23145, 19077, 2133, 29898, 305, 849, 29871, 29906, 29897, 13, 9651, 1583, 29889, 11197, 29946, 353, 365, 29889, 23145, 19077, 2133, 29898, 305, 849, 29871, 29896, 29892, 671, 29918, 4283, 29922, 8824, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 921, 1125, 13, 4706, 298, 353, 921, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 29883, 29900, 29898, 29882, 876, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29896, 29898, 1311, 29889, 29883, 29896, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29906, 29898, 1311, 29889, 29883, 29906, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29941, 29898, 1311, 29889, 29883, 29941, 29898, 29882, 4961, 13, 4706, 4682, 353, 1583, 29889, 11197, 29946, 29898, 1311, 29889, 29883, 29946, 29898, 29882, 876, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 14394, 29897, 13, 4706, 736, 4682, 29892, 1583, 29889, 29880, 29945, 29898, 29882, 29897, 13, 13, 13, 1990, 3384, 29877, 7608, 29898, 305, 4008, 29889, 14688, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 29928, 8154, 7608, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 411, 1583, 29889, 2344, 29918, 6078, 7295, 13, 9651, 1583, 29889, 29880, 29900, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29896, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29906, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29941, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29946, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29945, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29953, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29955, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29947, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 29880, 29929, 353, 365, 29889, 12697, 29898, 29906, 29900, 29946, 29947, 29892, 29871, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29900, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29896, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29906, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29941, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29946, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29945, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29953, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29955, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 9651, 1583, 29889, 11197, 29947, 353, 365, 29889, 23145, 19077, 2133, 29898, 29906, 29900, 29946, 29947, 29897, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 921, 1125, 13, 4706, 298, 353, 383, 29889, 690, 14443, 29898, 29916, 29892, 313, 2435, 29898, 29916, 511, 29871, 29906, 29900, 29946, 29947, 876, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29900, 29898, 1311, 29889, 29880, 29900, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29896, 29898, 1311, 29889, 29880, 29896, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29906, 29898, 1311, 29889, 29880, 29906, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29941, 29898, 1311, 29889, 29880, 29941, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29946, 29898, 1311, 29889, 29880, 29946, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29945, 29898, 1311, 29889, 29880, 29945, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29953, 29898, 1311, 29889, 29880, 29953, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29955, 29898, 1311, 29889, 29880, 29955, 29898, 29882, 4961, 13, 4706, 298, 353, 383, 29889, 280, 557, 29891, 29918, 2674, 29884, 29898, 1311, 29889, 11197, 29947, 29898, 1311, 29889, 29880, 29947, 29898, 29882, 4961, 13, 4706, 736, 383, 29889, 690, 14443, 29898, 1311, 29889, 29880, 29929, 29898, 29882, 511, 313, 2435, 29898, 29916, 511, 29871, 29945, 29896, 29906, 29892, 29871, 29906, 29892, 29871, 29906, 876, 13, 2 ]
unet/generatePatches.py
MartimChaves/ret_detect
0
54945
<filename>unet/generatePatches.py # this needs to be in the previous directory import cv2.cv2 as cv2 import numpy as np import os from skimage.measure import label, regionprops os.chdir('C:/Users/Martim_Pc/Desktop/DACO/PROJECT_DACO/convNet/Unet') def myShowImage(img,name = "from_show_function"): cv2.imshow(name, img) cv2.waitKey(0) # waits until a key is pressed cv2.destroyAllWindows() # destroys the window showing image return def getBBox(img_mask): labels, numRegs = label(img_mask, neighbors=8, background = 0, return_num = True) regionsLog = regionprops(labels) bbxs = [regionsLog[x]['bbox'] for x in range(numRegs)] return bbxs def getLargestAreaEcentroid(img_pred_Log): # returns mask with the regions with the largest area, coords of centroid and radius labelsLog, numLog = label(img_pred_Log, neighbors=8, background = 0, return_num = True) regionsLog = regionprops(labelsLog) areasLog = [region['area'] for region in regionsLog] areasLogArr = np.array(areasLog) maxIndex = np.argmax(areasLogArr) value = labelsLog[regionsLog[maxIndex]['coords'][0][0],regionsLog[maxIndex]['coords'][0][1]] labelsLog[labelsLog != value] = 0 labelsLog[labelsLog == value] = 1 centreCoords = np.round(regionsLog[maxIndex]['centroid']) centreCoords = centreCoords.astype(np.uint) radius = (regionsLog[maxIndex]['major_axis_length'] + regionsLog[maxIndex]['minor_axis_length']) / 4 colsCoord = [regionsLog[maxIndex]['bbox'][1],regionsLog[maxIndex]['bbox'][3]] labelsArr = np.array(labelsLog) return labelsArr, centreCoords, radius, colsCoord testImage = [17,18,19]#20,21,22] testRun = True imageNumberName = 1 testImgNumber = 1 for i in range(1,41): if testRun: if i not in testImage: continue imgPath = 'Datasets/IDRID training/IDRiD_' + str(i).zfill(2) + '.jpg' imgPathOD_Masks = 'Datasets/IDRID training/IDRiD_' + str(i).zfill(2) + '_OD.tif' imgPathEX_Masks = 'Datasets/IDRID training/IDRiD_' + str(i).zfill(2) + '_EX.tif' img = cv2.imread(imgPath)#, cv2.CV_8UC1) Od_mask = cv2.imread(imgPathOD_Masks, cv2.CV_8UC1) Ex_mask = cv2.imread(imgPathEX_Masks, cv2.CV_8UC1) maskRed = img[...,0]>30 maskGreen = img[...,1]>30 maskBlue = img[...,2]>30 mask1 = np.logical_or(maskRed,maskGreen) maskFinal = np.logical_or(mask1,maskBlue) zeros = np.zeros(img.shape) zeros[maskFinal] = img[maskFinal] zeros = zeros.astype(np.uint8) img = np.copy(zeros) firstCol = np.min(np.where(img!=0)[1]) lastCol = np.max(np.where(img!=0)[1]) #print(np.max(img)) #myShowImage(cv2.resize(img, (416,416), interpolation = cv2.INTER_AREA)) finalWidth = int(lastCol-firstCol) offsetRows = int(round((finalWidth-img.shape[0])/2)) #Get a squared image #Retina image squareToBePatched = np.zeros([finalWidth,finalWidth,3]) squareToBePatched[offsetRows:img.shape[0]+offsetRows,::] = np.copy(img[::,firstCol:lastCol]) #OD mask ODsquareToBePatched = np.zeros([finalWidth,finalWidth]) ODsquareToBePatched[offsetRows:img.shape[0]+offsetRows,::] = np.copy(Od_mask[::,firstCol:lastCol]) _, centreCoords, radius, _ = getLargestAreaEcentroid(ODsquareToBePatched) print(radius) #Ex mask EXsquareToBePatched = np.zeros([finalWidth,finalWidth]) EXsquareToBePatched[offsetRows:img.shape[0]+offsetRows,::] = np.copy(Ex_mask[::,firstCol:lastCol]) # Defining patch size patchSize = int(finalWidth/7) createGeneralPatches = False if createGeneralPatches: if not testRun: if i not in testImage: for j in range(7): for k in range(7): # build patch print("Creating patch: ",str(imageNumberName)) # select region patchImg = np.copy(squareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) patchOD = np.copy(ODsquareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) patchEX = np.copy(EXsquareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) # resize to 416x416 patchImg = cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA) patchEX = cv2.resize(patchEX, (416,416), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) patchEX = np.multiply(patchEX,255/np.max(patchEX)) patchEX[patchEX>220] = 255 patchEX[patchEX<=220] = 0 patchEX = patchEX.astype(np.uint8) # if black -> remove indxsBlack = np.where(patchImg < 5) if len(indxsBlack[0]) > 259584: continue #get bboxs bbxsOd = getBBox(patchOD) bbxsEx = getBBox(patchEX) #save img and info to annot file # if a lot of stuff - data augment seenClasses = False if len(bbxsOd) > 0: seenClasses = True # do more of these # 4 crops for each flip, 3 flips - 16 cropAssistValues = {0:[-30,-30],1:[-30,+30],2:[+30,-30],3:[+30,+30], 4:[0,-30],5:[-30,0],6:[0,+30],7:[+30,0]} #cropAssistValues[c][0 ou 1] for c in range(8): # crops try: patchImg = np.copy(squareToBePatched[(j*patchSize)+cropAssistValues[c][0]:((j+1)*patchSize)+cropAssistValues[c][0], (k*patchSize+cropAssistValues[c][1]):((k+1)*patchSize)+cropAssistValues[c][0]]) patchOD = np.copy(ODsquareToBePatched[(j*patchSize)+cropAssistValues[c][0]:((j+1)*patchSize)+cropAssistValues[c][0], (k*patchSize+cropAssistValues[c][1]):((k+1)*patchSize)+cropAssistValues[c][0]]) for f in range(4): # flips patchImg = np.rot90(patchImg,axes=(0,1)) patchOD = np.rot90(patchOD,axes=(0,1)) patchImg = cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) bbxsOd = getBBox(patchOD) if len(bbxsOd) > 0: image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/train", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg) annotation = image_path for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n") imageNumberName += 1 except: print("Error croping.") if len(bbxsEx) > 0: seenClasses = True # do more of these # do more of these # 4 crops for each flip, 3 flips - 16 cropAssistValues = {0:[-30,-30],1:[-30,+30],2:[+30,-30],3:[+30,+30]} #cropAssistValues[c][0 ou 1] for c in range(4): # crops try: patchImg = np.copy(squareToBePatched[(j*patchSize)+cropAssistValues[c][0]:((j+1)*patchSize)+cropAssistValues[c][0], (k*patchSize+cropAssistValues[c][1]):((k+1)*patchSize)+cropAssistValues[c][0]]) patchOD = np.copy(EXsquareToBePatched[(j*patchSize)+cropAssistValues[c][0]:((j+1)*patchSize)+cropAssistValues[c][0], (k*patchSize+cropAssistValues[c][1]):((k+1)*patchSize)+cropAssistValues[c][0]]) for f in range(4): # flips patchImg = np.rot90(patchImg,axes=(0,1)) patchOD = np.rot90(patchOD,axes=(0,1)) patchImg = cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) bbxsOd = getBBox(patchOD) if len(bbxsOd) > 0: image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/train", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg) annotation = image_path for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(1) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n") imageNumberName += 1 except: print("Error croping.") if seenClasses: continue image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/train", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg) annotation = image_path for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) for k in range(len(bbxsEx)): xmin = str(bbxsEx[k][1]) ymin = str(bbxsEx[k][0]) xmax = str(bbxsEx[k][3]) ymax = str(bbxsEx[k][2]) class_ind = str(1) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n") imageNumberName += 1 else: if i in testImage: for j in range(7): for k in range(7): #build patch print("Creating patch.") #select region patchImg = np.copy(squareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) patchOD = np.copy(ODsquareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) patchEX = np.copy(EXsquareToBePatched[j*patchSize:(j+1)*patchSize,k*patchSize:(k+1)*patchSize]) # resize to 416x416 patchImg = cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA) patchEX = cv2.resize(patchEX, (416,416), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) patchEX = np.multiply(patchEX,255/np.max(patchEX)) patchEX[patchEX>220] = 255 patchEX[patchEX<=220] = 0 patchEX = patchEX.astype(np.uint8) # if black -> remove indxsBlack = np.where(patchImg < 5) if len(indxsBlack[0]) > 259584: continue #get bboxs bbxsOd = getBBox(patchOD) bbxsEx = getBBox(patchEX) #save img and info to annot file image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/test", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg) annotation = image_path for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) for k in range(len(bbxsEx)): xmin = str(bbxsEx[k][1]) ymin = str(bbxsEx[k][0]) xmax = str(bbxsEx[k][3]) ymax = str(bbxsEx[k][2]) class_ind = str(1) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n") imageNumberName += 1 createODPatches = True if createODPatches: if not testRun: if i not in testImage: cropAssistValues = {0:[0,-296],1:[0,-592],2:[0,-888],3:[0,-1184],4:[0,-1480], 5:[-296,-296],6:[-296,-592],7:[-296,-888],8:[-296,-1184],9:[-296,-1480], 10:[-592,-296],11:[-592,-592],12:[-592,-888],13:[-592,-1184],14:[-592,-1480], 15:[-888,-296],16:[-888,-592],17:[-888,-888],18:[-888,-1184],19:[-888,-1480], 20:[-1184,-296],21:[-1184,-592],22:[-1184,-888],23:[-1184,-1184],24:[-1184,-1480], 25:[-1480,-296],26:[-1480,-592],27:[-1480,-888],28:[-1480,-1184],29:[-1480,-1480], 30:[-148,-296],31:[-148,-592],32:[-148,-888],33:[-148,-1184],34:[-148,-1480], 35:[-700,-296],36:[-700,-592],37:[-700,-888],38:[-700,-1184],39:[-700,-1480]} #cropAssistValues[c][0 ou 1] for w in range(40): try: patchImg = np.copy(squareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) patchOD = np.copy(ODsquareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) if patchImg.shape[0] != 1480 or patchImg.shape[1] != 1480: continue #myShowImage(cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA).astype(np.uint8)) for f in range(4): # flips patchImg = np.rot90(patchImg,axes=(0,1)) patchOD = np.rot90(patchOD,axes=(0,1)) patchImg = cv2.resize(patchImg, (256,256), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (256,256), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) bbxsOd = getBBox(patchOD) '''image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/train", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg.astype(np.uint8))''' if len(bbxsOd) > 0: #image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/train", "%06d.jpg" %(imageNumberName))) image_path = os.path.realpath(os.path.join("train/images", str(imageNumberName)+".jpg")) cv2.imwrite(image_path,patchImg.astype(np.uint8)) label_path = os.path.realpath(os.path.join("train/labels", str(imageNumberName)+".jpg")) cv2.imwrite(label_path,patchOD) annotation = image_path '''for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n")''' print("Generating patch: ",str(imageNumberName)) imageNumberName += 1 except: print("Failed to crop.") else: if i in testImage: cropAssistValues = {0:[0,-296],1:[0,-592],2:[0,-888],3:[0,-1184],4:[0,-1480], 5:[-296,-296],6:[-296,-592],7:[-296,-888],8:[-296,-1184],9:[-296,-1480], 10:[-592,-296],11:[-592,-592],12:[-592,-888],13:[-592,-1184],14:[-592,-1480], 15:[-888,-296],16:[-888,-592],17:[-888,-888],18:[-888,-1184],19:[-888,-1480], 20:[-1184,-296],21:[-1184,-592],22:[-1184,-888],23:[-1184,-1184],24:[-1184,-1480], 25:[-1480,-296],26:[-1480,-592],27:[-1480,-888],28:[-1480,-1184],29:[-1480,-1480], 30:[-148,-296],31:[-148,-592],32:[-148,-888],33:[-148,-1184],34:[-148,-1480], 35:[-700,-296],36:[-700,-592],37:[-700,-888],38:[-700,-1184],39:[-700,-1480]} #cropAssistValues[c][0 ou 1] for w in range(40): try: patchImg = np.copy(squareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) patchOD = np.copy(ODsquareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) if patchImg.shape[0] != 1480 or patchImg.shape[1] != 1480: continue #myShowImage(cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA).astype(np.uint8)) for f in range(4): # flips patchImg = np.rot90(patchImg,axes=(0,1)) patchOD = np.rot90(patchOD,axes=(0,1)) patchImg = cv2.resize(patchImg, (256,256), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (256,256), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) bbxsOd = getBBox(patchOD) if len(bbxsOd) > 0: #image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/test", "%06d.jpg" %(imageNumberName))) image_path = os.path.realpath(os.path.join("test/images", str(imageNumberName)+".jpg")) cv2.imwrite(image_path,patchImg.astype(np.uint8)) label_path = os.path.realpath(os.path.join("test/labels", str(imageNumberName)+".jpg")) cv2.imwrite(label_path,patchOD) annotation = image_path '''for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n")''' print("Generating patch: ",str(imageNumberName)) imageNumberName += 1 except: print("Failed to crop.") # Divide image in 4x3 regions # check if in each region there are exudates # if there are, get largest one and do data aug based on that one - crops and rotations createExPatches = False kernel_ones = np.ones([25,25]) if createExPatches: for g in range(4): for t in range(3): #get patch: patchImg = np.copy(squareToBePatched[int(round(g*finalWidth/4)):int(round((g+1)*finalWidth/4)),int(round(t*finalWidth/3)):int(round((t+1)*finalWidth/3))]) patchEX = np.copy(EXsquareToBePatched[int(round(g*finalWidth/4)):int(round((g+1)*finalWidth/4)),int(round(t*finalWidth/3)):int(round((t+1)*finalWidth/3))]) patchEX = cv2.morphologyEx(patchEX, cv2.MORPH_CLOSE, kernel_ones) bbxsEx = getBBox(patchEX) if len(bbxsEx) > 0: _, centreCoords, radius, _ = getLargestAreaEcentroid(patchEX) else: continue cropAssistValues = {0:[0,-296],1:[0,-592],2:[0,-888],3:[0,-1184],4:[0,-1480], 5:[-296,-296],6:[-296,-592],7:[-296,-888],8:[-296,-1184],9:[-296,-1480], 10:[-592,-296],11:[-592,-592],12:[-592,-888],13:[-592,-1184],14:[-592,-1480], 15:[-888,-296],16:[-888,-592],17:[-888,-888],18:[-888,-1184],19:[-888,-1480], 20:[-1184,-296],21:[-1184,-592],22:[-1184,-888],23:[-1184,-1184],24:[-1184,-1480], 25:[-1480,-296],26:[-1480,-592],27:[-1480,-888],28:[-1480,-1184],29:[-1480,-1480], 30:[-148,-296],31:[-148,-592],32:[-148,-888],33:[-148,-1184],34:[-148,-1480], 35:[-700,-296],36:[-700,-592],37:[-700,-888],38:[-700,-1184],39:[-700,-1480]} #cropAssistValues[c][0 ou 1] for w in range(40): try: patchImg = np.copy(squareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) patchEX = np.copy(EXsquareToBePatched[centreCoords[0]+cropAssistValues[w][0]:centreCoords[0]+1480+cropAssistValues[w][0], (centreCoords[1]+cropAssistValues[w][1]):(centreCoords[1]+1480+cropAssistValues[w][1])]) if patchImg.shape[0] != 1480 or patchImg.shape[1] != 1480: continue #myShowImage(cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA).astype(np.uint8)) #myShowImage(cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA).astype(np.uint8)) patchEX = cv2.morphologyEx(patchEX, cv2.MORPH_CLOSE, kernel_ones) for f in range(4): # flips patchImg = np.rot90(patchImg,axes=(0,1)) patchOD = np.rot90(patchEX,axes=(0,1)) patchImg = cv2.resize(patchImg, (416,416), interpolation = cv2.INTER_AREA) patchOD = cv2.resize(patchOD, (416,416), interpolation = cv2.INTER_AREA) # threshold patchOD = np.multiply(patchOD,255/np.max(patchOD)) patchOD[patchOD>220] = 255 patchOD[patchOD<=220] = 0 patchOD = patchOD.astype(np.uint8) bbxsOd = getBBox(patchOD) if len(bbxsOd) > 0: image_path = os.path.realpath(os.path.join("YOLOV3/data/dataset/test", "%06d.jpg" %(imageNumberName))) cv2.imwrite(image_path,patchImg.astype(np.uint8)) annotation = image_path for k in range(len(bbxsOd)): xmin = str(bbxsOd[k][1]) ymin = str(bbxsOd[k][0]) xmax = str(bbxsOd[k][3]) ymax = str(bbxsOd[k][2]) class_ind = str(0) annotation += ' ' + ','.join([xmin, ymin, xmax, ymax, str(class_ind)]) wf.write(annotation + "\n") print("Generating patch: ",str(imageNumberName)) imageNumberName += 1 except: print("Failed to crop.")
[ 1, 529, 9507, 29958, 348, 300, 29914, 17158, 29925, 905, 267, 29889, 2272, 13, 29937, 445, 4225, 304, 367, 297, 278, 3517, 3884, 30004, 13, 30004, 13, 5215, 13850, 29906, 29889, 11023, 29906, 408, 13850, 29906, 30004, 13, 5215, 12655, 408, 7442, 30004, 13, 5215, 2897, 30004, 13, 30004, 13, 3166, 2071, 3027, 29889, 26658, 1053, 3858, 29892, 5120, 11030, 30004, 13, 30004, 13, 359, 29889, 305, 3972, 877, 29907, 8419, 5959, 29914, 15838, 326, 29918, 29925, 29883, 29914, 17600, 29914, 29928, 2477, 29949, 29914, 8618, 17637, 29918, 29928, 2477, 29949, 29914, 20580, 6779, 29914, 29965, 1212, 1495, 30004, 13, 30004, 13, 1753, 590, 8964, 2940, 29898, 2492, 29892, 978, 353, 376, 3166, 29918, 4294, 29918, 2220, 29908, 1125, 30004, 13, 1678, 13850, 29906, 29889, 326, 4294, 29898, 978, 29892, 10153, 29897, 6756, 13, 30004, 13, 1678, 13850, 29906, 29889, 10685, 2558, 29898, 29900, 29897, 396, 11324, 1169, 2745, 263, 1820, 338, 15385, 30004, 13, 1678, 13850, 29906, 29889, 20524, 3596, 7685, 580, 396, 2731, 307, 952, 278, 3474, 6445, 1967, 30004, 13, 30004, 13, 1678, 736, 30004, 13, 30004, 13, 1753, 679, 29933, 3313, 29898, 2492, 29918, 13168, 1125, 30004, 13, 30004, 13, 1678, 11073, 29892, 954, 4597, 29879, 353, 3858, 29898, 2492, 29918, 13168, 29892, 22092, 943, 29922, 29947, 29892, 3239, 353, 29871, 29900, 29892, 736, 29918, 1949, 353, 5852, 8443, 13, 1678, 12786, 3403, 353, 5120, 11030, 29898, 21134, 8443, 13, 30004, 13, 1678, 289, 29890, 10351, 353, 518, 1727, 1080, 3403, 29961, 29916, 22322, 29890, 1884, 2033, 363, 921, 297, 3464, 29898, 1949, 4597, 29879, 4638, 30004, 13, 30004, 13, 1678, 736, 289, 29890, 10351, 30004, 13, 30004, 13, 30004, 13, 1753, 679, 29931, 1191, 342, 13799, 29923, 1760, 1007, 29898, 2492, 29918, 11965, 29918, 3403, 1125, 30004, 13, 1678, 396, 3639, 11105, 411, 278, 12786, 411, 278, 10150, 4038, 29892, 1302, 4339, 310, 1644, 1007, 322, 11855, 30004, 13, 30004, 13, 1678, 11073, 3403, 29892, 954, 3403, 353, 3858, 29898, 2492, 29918, 11965, 29918, 3403, 29892, 22092, 943, 29922, 29947, 29892, 3239, 353, 29871, 29900, 29892, 736, 29918, 1949, 353, 5852, 8443, 13, 1678, 12786, 3403, 353, 5120, 11030, 29898, 21134, 3403, 8443, 13, 30004, 13, 1678, 10161, 3403, 353, 518, 12803, 1839, 6203, 2033, 363, 5120, 297, 12786, 3403, 29962, 30004, 13, 1678, 10161, 3403, 16401, 353, 7442, 29889, 2378, 29898, 598, 294, 3403, 8443, 13, 1678, 4236, 3220, 353, 7442, 29889, 1191, 3317, 29898, 598, 294, 3403, 16401, 8443, 13, 30004, 13, 1678, 995, 353, 11073, 3403, 29961, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 1111, 4339, 2033, 29961, 29900, 3816, 29900, 1402, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 1111, 4339, 2033, 29961, 29900, 3816, 29896, 5262, 30004, 13, 1678, 11073, 3403, 29961, 21134, 3403, 2804, 995, 29962, 353, 29871, 29900, 30004, 13, 1678, 11073, 3403, 29961, 21134, 3403, 1275, 995, 29962, 353, 29871, 29896, 30004, 13, 30004, 13, 1678, 8442, 7967, 4339, 353, 7442, 29889, 14486, 29898, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 1760, 1007, 2033, 8443, 13, 1678, 8442, 7967, 4339, 353, 8442, 7967, 4339, 29889, 579, 668, 29898, 9302, 29889, 13470, 8443, 13, 30004, 13, 1678, 11855, 353, 313, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 21355, 29918, 8990, 29918, 2848, 2033, 718, 12786, 3403, 29961, 3317, 3220, 22322, 1195, 272, 29918, 8990, 29918, 2848, 11287, 847, 29871, 29946, 30004, 13, 1678, 28730, 7967, 536, 353, 518, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 29890, 1884, 2033, 29961, 29896, 1402, 1727, 1080, 3403, 29961, 3317, 3220, 22322, 29890, 1884, 2033, 29961, 29941, 5262, 30004, 13, 30004, 13, 1678, 11073, 16401, 353, 7442, 29889, 2378, 29898, 21134, 3403, 8443, 13, 30004, 13, 1678, 736, 11073, 16401, 29892, 8442, 7967, 4339, 29892, 11855, 29892, 28730, 7967, 536, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 1688, 2940, 353, 518, 29896, 29955, 29892, 29896, 29947, 29892, 29896, 29929, 29962, 29937, 29906, 29900, 29892, 29906, 29896, 29892, 29906, 29906, 29962, 30004, 13, 1688, 6558, 353, 5852, 30004, 13, 3027, 4557, 1170, 353, 29871, 29896, 30004, 13, 1688, 25518, 4557, 353, 29871, 29896, 30004, 13, 30004, 13, 30004, 13, 30004, 13, 1454, 474, 297, 3464, 29898, 29896, 29892, 29946, 29896, 1125, 30004, 13, 30004, 13, 1678, 565, 1243, 6558, 29901, 30004, 13, 4706, 565, 474, 451, 297, 1243, 2940, 29901, 30004, 13, 9651, 6773, 30004, 13, 30004, 13, 1678, 10153, 2605, 353, 525, 16390, 294, 1691, 29914, 1367, 29934, 1367, 6694, 29914, 1367, 29934, 29875, 29928, 29918, 29915, 718, 851, 29898, 29875, 467, 29920, 5589, 29898, 29906, 29897, 718, 15300, 6173, 29915, 6756, 13, 1678, 10153, 2605, 13668, 29918, 19832, 29879, 353, 525, 16390, 294, 1691, 29914, 1367, 29934, 1367, 6694, 29914, 1367, 29934, 29875, 29928, 29918, 29915, 718, 851, 29898, 29875, 467, 29920, 5589, 29898, 29906, 29897, 718, 22868, 13668, 29889, 29873, 361, 29915, 6756, 13, 1678, 10153, 2605, 5746, 29918, 19832, 29879, 353, 525, 16390, 294, 1691, 29914, 1367, 29934, 1367, 6694, 29914, 1367, 29934, 29875, 29928, 29918, 29915, 718, 851, 29898, 29875, 467, 29920, 5589, 29898, 29906, 29897, 718, 22868, 5746, 29889, 29873, 361, 29915, 6756, 13, 30004, 13, 1678, 10153, 353, 13850, 29906, 29889, 326, 949, 29898, 2492, 2605, 29897, 6552, 13850, 29906, 29889, 15633, 29918, 29947, 23129, 29896, 8443, 13, 1678, 6715, 29918, 13168, 353, 13850, 29906, 29889, 326, 949, 29898, 2492, 2605, 13668, 29918, 19832, 29879, 29892, 13850, 29906, 29889, 15633, 29918, 29947, 23129, 29896, 8443, 13, 1678, 1222, 29918, 13168, 353, 13850, 29906, 29889, 326, 949, 29898, 2492, 2605, 5746, 29918, 19832, 29879, 29892, 13850, 29906, 29889, 15633, 29918, 29947, 23129, 29896, 8443, 13, 30004, 13, 1678, 11105, 9039, 353, 10153, 29961, 16361, 29900, 29962, 29958, 29941, 29900, 30004, 13, 1678, 11105, 24599, 353, 10153, 29961, 16361, 29896, 29962, 29958, 29941, 29900, 30004, 13, 1678, 11105, 21319, 353, 10153, 29961, 16361, 29906, 29962, 29958, 29941, 29900, 30004, 13, 1678, 11105, 29896, 353, 7442, 29889, 1188, 936, 29918, 272, 29898, 13168, 9039, 29892, 13168, 24599, 8443, 13, 1678, 11105, 15790, 353, 7442, 29889, 1188, 936, 29918, 272, 29898, 13168, 29896, 29892, 13168, 21319, 8443, 13, 1678, 24786, 353, 7442, 29889, 3298, 359, 29898, 2492, 29889, 12181, 8443, 13, 1678, 24786, 29961, 13168, 15790, 29962, 353, 10153, 29961, 13168, 15790, 29962, 30004, 13, 1678, 24786, 353, 24786, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 1678, 6756, 13, 1678, 10153, 353, 7442, 29889, 8552, 29898, 3298, 359, 8443, 13, 1678, 937, 1625, 353, 7442, 29889, 1195, 29898, 9302, 29889, 3062, 29898, 2492, 19216, 29900, 9601, 29896, 2314, 30004, 13, 1678, 1833, 1625, 353, 7442, 29889, 3317, 29898, 9302, 29889, 3062, 29898, 2492, 19216, 29900, 9601, 29896, 2314, 30004, 13, 30004, 13, 1678, 396, 2158, 29898, 9302, 29889, 3317, 29898, 2492, 876, 30004, 13, 1678, 396, 1357, 8964, 2940, 29898, 11023, 29906, 29889, 21476, 29898, 2492, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 876, 30004, 13, 30004, 13, 1678, 2186, 6110, 353, 938, 29898, 4230, 1625, 29899, 4102, 1625, 8443, 13, 1678, 9210, 10661, 353, 938, 29898, 14486, 3552, 8394, 6110, 29899, 2492, 29889, 12181, 29961, 29900, 2314, 29914, 29906, 876, 30004, 13, 30004, 13, 1678, 396, 2577, 263, 10674, 1965, 1967, 30004, 13, 1678, 396, 8015, 1099, 1967, 6756, 13, 1678, 6862, 1762, 3629, 29925, 905, 287, 353, 7442, 29889, 3298, 359, 4197, 8394, 6110, 29892, 8394, 6110, 29892, 29941, 2314, 30004, 13, 1678, 6862, 1762, 3629, 29925, 905, 287, 29961, 10289, 10661, 29901, 2492, 29889, 12181, 29961, 29900, 10062, 10289, 10661, 29892, 1057, 29962, 353, 7442, 29889, 8552, 29898, 2492, 29961, 1057, 29892, 4102, 1625, 29901, 4230, 1625, 2314, 30004, 13, 30004, 13, 1678, 396, 13668, 11105, 30004, 13, 1678, 438, 29928, 17619, 1762, 3629, 29925, 905, 287, 353, 7442, 29889, 3298, 359, 4197, 8394, 6110, 29892, 8394, 6110, 2314, 30004, 13, 1678, 438, 29928, 17619, 1762, 3629, 29925, 905, 287, 29961, 10289, 10661, 29901, 2492, 29889, 12181, 29961, 29900, 10062, 10289, 10661, 29892, 1057, 29962, 353, 7442, 29889, 8552, 29898, 29949, 29881, 29918, 13168, 29961, 1057, 29892, 4102, 1625, 29901, 4230, 1625, 2314, 30004, 13, 30004, 13, 30004, 13, 1678, 17117, 8442, 7967, 4339, 29892, 11855, 29892, 903, 353, 679, 29931, 1191, 342, 13799, 29923, 1760, 1007, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 8443, 13, 1678, 1596, 29898, 13471, 8443, 13, 30004, 13, 1678, 396, 1252, 11105, 30004, 13, 1678, 8528, 17619, 1762, 3629, 29925, 905, 287, 353, 7442, 29889, 3298, 359, 4197, 8394, 6110, 29892, 8394, 6110, 2314, 30004, 13, 1678, 8528, 17619, 1762, 3629, 29925, 905, 287, 29961, 10289, 10661, 29901, 2492, 29889, 12181, 29961, 29900, 10062, 10289, 10661, 29892, 1057, 29962, 353, 7442, 29889, 8552, 29898, 1252, 29918, 13168, 29961, 1057, 29892, 4102, 1625, 29901, 4230, 1625, 2314, 30004, 13, 30004, 13, 1678, 396, 5282, 2827, 13261, 2159, 30004, 13, 1678, 13261, 3505, 353, 938, 29898, 8394, 6110, 29914, 29955, 8443, 13, 30004, 13, 1678, 1653, 15263, 29925, 905, 267, 353, 7700, 30004, 13, 1678, 565, 1653, 15263, 29925, 905, 267, 29901, 6756, 13, 4706, 565, 451, 1243, 6558, 29901, 30004, 13, 9651, 565, 474, 451, 297, 1243, 2940, 29901, 30004, 13, 30004, 13, 18884, 363, 432, 297, 3464, 29898, 29955, 1125, 30004, 13, 462, 1678, 363, 413, 297, 3464, 29898, 29955, 1125, 30004, 13, 462, 4706, 396, 2048, 13261, 30004, 13, 462, 4706, 1596, 703, 9832, 1218, 13261, 29901, 9162, 710, 29898, 3027, 4557, 1170, 876, 30004, 13, 462, 4706, 396, 1831, 5120, 30004, 13, 462, 4706, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 8552, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 13261, 5746, 353, 7442, 29889, 8552, 29898, 5746, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 396, 19490, 304, 29871, 29946, 29896, 29953, 29916, 29946, 29896, 29953, 30004, 13, 462, 4706, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 13261, 5746, 353, 13850, 29906, 29889, 21476, 29898, 5041, 5746, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 396, 16897, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 4706, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 4706, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 4706, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 462, 4706, 13261, 5746, 353, 7442, 29889, 18056, 368, 29898, 5041, 5746, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 5746, 876, 30004, 13, 462, 4706, 13261, 5746, 29961, 5041, 5746, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 4706, 13261, 5746, 29961, 5041, 5746, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 4706, 13261, 5746, 353, 13261, 5746, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 462, 4706, 396, 565, 4628, 1599, 3349, 30004, 13, 462, 4706, 1399, 10351, 18700, 353, 7442, 29889, 3062, 29898, 5041, 25518, 529, 29871, 29945, 8443, 13, 462, 4706, 565, 7431, 29898, 513, 10351, 18700, 29961, 29900, 2314, 1405, 29871, 29906, 29945, 29929, 29945, 29947, 29946, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 462, 4706, 396, 657, 289, 1884, 29879, 30004, 13, 462, 4706, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 462, 4706, 289, 29890, 10351, 1252, 353, 679, 29933, 3313, 29898, 5041, 5746, 8443, 13, 462, 4706, 396, 7620, 10153, 322, 5235, 304, 9732, 934, 30004, 13, 30004, 13, 462, 4706, 396, 565, 263, 3287, 310, 6433, 448, 848, 18765, 30004, 13, 462, 4706, 3595, 27403, 353, 7700, 30004, 13, 462, 4706, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 30004, 13, 462, 9651, 3595, 27403, 353, 5852, 30004, 13, 462, 9651, 396, 437, 901, 310, 1438, 30004, 13, 462, 9651, 396, 29871, 29946, 8182, 567, 363, 1269, 285, 3466, 29892, 29871, 29941, 285, 492, 567, 448, 29871, 29896, 29953, 30004, 13, 462, 9651, 274, 1336, 7900, 391, 9065, 353, 426, 29900, 10834, 29899, 29941, 29900, 6653, 29941, 29900, 1402, 29896, 10834, 29899, 29941, 29900, 29892, 29974, 29941, 29900, 1402, 29906, 10834, 29974, 29941, 29900, 6653, 29941, 29900, 1402, 29941, 10834, 29974, 29941, 29900, 29892, 29974, 29941, 29900, 1402, 30004, 13, 462, 462, 462, 29946, 10834, 29900, 6653, 29941, 29900, 1402, 29945, 10834, 29899, 29941, 29900, 29892, 29900, 1402, 29953, 10834, 29900, 29892, 29974, 29941, 29900, 1402, 29955, 10834, 29974, 29941, 29900, 29892, 29900, 12258, 396, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 2123, 29871, 29896, 29962, 30004, 13, 462, 9651, 363, 274, 297, 3464, 29898, 29947, 1125, 396, 8182, 567, 30004, 13, 462, 18884, 1018, 29901, 6756, 13, 462, 462, 1678, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 15625, 29926, 29930, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 5387, 3552, 29926, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 462, 4706, 313, 29895, 29930, 5041, 3505, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29896, 29962, 1125, 3552, 29895, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 24960, 29871, 6756, 13, 30004, 13, 462, 462, 1678, 13261, 13668, 353, 7442, 29889, 8552, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 15625, 29926, 29930, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 5387, 3552, 29926, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 462, 4706, 313, 29895, 29930, 5041, 3505, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29896, 29962, 1125, 3552, 29895, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 24960, 29871, 6756, 13, 30004, 13, 462, 462, 1678, 363, 285, 297, 3464, 29898, 29946, 1125, 396, 285, 492, 567, 30004, 13, 462, 462, 4706, 13261, 25518, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 25518, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 13668, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 30004, 13, 462, 462, 4706, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 462, 4706, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 30004, 13, 462, 462, 4706, 396, 16897, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 462, 4706, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 462, 4706, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 462, 462, 4706, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 30004, 13, 462, 462, 4706, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 6756, 13, 30004, 13, 462, 462, 9651, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 14968, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 462, 9651, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 8443, 13, 462, 462, 9651, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 462, 9651, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 462, 18884, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 462, 18884, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 462, 18884, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 462, 18884, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 462, 18884, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 462, 18884, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 462, 9651, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 30004, 13, 462, 462, 9651, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 462, 18884, 5174, 29901, 30004, 13, 462, 462, 1678, 1596, 703, 2392, 274, 1336, 292, 23157, 30004, 13, 462, 462, 1678, 6756, 13, 462, 4706, 565, 7431, 29898, 1327, 10351, 1252, 29897, 1405, 29871, 29900, 29901, 30004, 13, 462, 9651, 3595, 27403, 353, 5852, 30004, 13, 462, 9651, 396, 437, 901, 310, 1438, 30004, 13, 462, 9651, 396, 437, 901, 310, 1438, 30004, 13, 462, 9651, 396, 29871, 29946, 8182, 567, 363, 1269, 285, 3466, 29892, 29871, 29941, 285, 492, 567, 448, 29871, 29896, 29953, 30004, 13, 462, 9651, 274, 1336, 7900, 391, 9065, 353, 426, 29900, 10834, 29899, 29941, 29900, 6653, 29941, 29900, 1402, 29896, 10834, 29899, 29941, 29900, 29892, 29974, 29941, 29900, 1402, 29906, 10834, 29974, 29941, 29900, 6653, 29941, 29900, 1402, 29941, 10834, 29974, 29941, 29900, 29892, 29974, 29941, 29900, 12258, 396, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 2123, 29871, 29896, 29962, 30004, 13, 462, 9651, 363, 274, 297, 3464, 29898, 29946, 1125, 396, 8182, 567, 30004, 13, 462, 18884, 1018, 29901, 30004, 13, 462, 462, 1678, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 15625, 29926, 29930, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 5387, 3552, 29926, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 462, 4706, 313, 29895, 29930, 5041, 3505, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29896, 29962, 1125, 3552, 29895, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 24960, 29871, 6756, 13, 30004, 13, 462, 462, 1678, 13261, 13668, 353, 7442, 29889, 8552, 29898, 5746, 17619, 1762, 3629, 29925, 905, 287, 15625, 29926, 29930, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 5387, 3552, 29926, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 462, 4706, 313, 29895, 29930, 5041, 3505, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29896, 29962, 1125, 3552, 29895, 29974, 29896, 11877, 5041, 3505, 7240, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 24960, 29871, 6756, 13, 30004, 13, 462, 462, 1678, 363, 285, 297, 3464, 29898, 29946, 1125, 396, 285, 492, 567, 30004, 13, 462, 462, 4706, 13261, 25518, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 25518, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 13668, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 30004, 13, 462, 462, 4706, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 462, 4706, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 30004, 13, 462, 462, 4706, 396, 16897, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 462, 4706, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 462, 4706, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 462, 4706, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 462, 462, 4706, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 30004, 13, 462, 462, 4706, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 30004, 13, 30004, 13, 462, 462, 9651, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 14968, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 462, 9651, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 8443, 13, 462, 462, 9651, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 462, 9651, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 462, 18884, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 462, 18884, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 462, 18884, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 462, 18884, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 462, 18884, 770, 29918, 513, 353, 851, 29898, 29896, 8443, 13, 462, 462, 18884, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 462, 9651, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 30004, 13, 462, 462, 9651, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 462, 18884, 5174, 29901, 6756, 13, 462, 462, 1678, 1596, 703, 2392, 274, 1336, 292, 23157, 30004, 13, 30004, 13, 462, 4706, 565, 3595, 27403, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 30004, 13, 462, 4706, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 14968, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 4706, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 8443, 13, 462, 4706, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 4706, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 9651, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 9651, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 9651, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 9651, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 9651, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 9651, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 4706, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 1252, 22164, 30004, 13, 462, 9651, 921, 1195, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 9651, 343, 1195, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 9651, 921, 3317, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 9651, 343, 3317, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 9651, 770, 29918, 513, 353, 851, 29898, 29896, 8443, 13, 462, 9651, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 4706, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 30004, 13, 462, 4706, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 565, 474, 297, 1243, 2940, 29901, 30004, 13, 18884, 363, 432, 297, 3464, 29898, 29955, 1125, 30004, 13, 462, 1678, 363, 413, 297, 3464, 29898, 29955, 1125, 30004, 13, 462, 4706, 396, 4282, 13261, 30004, 13, 462, 4706, 1596, 703, 9832, 1218, 13261, 23157, 30004, 13, 462, 4706, 396, 2622, 5120, 30004, 13, 462, 4706, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 8552, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 13261, 5746, 353, 7442, 29889, 8552, 29898, 5746, 17619, 1762, 3629, 29925, 905, 287, 29961, 29926, 29930, 5041, 3505, 5919, 29926, 29974, 29896, 11877, 5041, 3505, 29892, 29895, 29930, 5041, 3505, 5919, 29895, 29974, 29896, 11877, 5041, 3505, 2314, 30004, 13, 462, 4706, 396, 19490, 304, 29871, 29946, 29896, 29953, 29916, 29946, 29896, 29953, 30004, 13, 462, 4706, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 13261, 5746, 353, 13850, 29906, 29889, 21476, 29898, 5041, 5746, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 4706, 396, 16897, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 4706, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 4706, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 4706, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 462, 4706, 13261, 5746, 353, 7442, 29889, 18056, 368, 29898, 5041, 5746, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 5746, 876, 30004, 13, 462, 4706, 13261, 5746, 29961, 5041, 5746, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 4706, 13261, 5746, 29961, 5041, 5746, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 4706, 13261, 5746, 353, 13261, 5746, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 462, 4706, 396, 565, 4628, 1599, 3349, 30004, 13, 462, 4706, 1399, 10351, 18700, 353, 7442, 29889, 3062, 29898, 5041, 25518, 529, 29871, 29945, 8443, 13, 462, 4706, 565, 7431, 29898, 513, 10351, 18700, 29961, 29900, 2314, 1405, 29871, 29906, 29945, 29929, 29945, 29947, 29946, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 462, 4706, 396, 657, 289, 1884, 29879, 30004, 13, 462, 4706, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 462, 4706, 289, 29890, 10351, 1252, 353, 679, 29933, 3313, 29898, 5041, 5746, 8443, 13, 462, 4706, 396, 7620, 10153, 322, 5235, 304, 9732, 934, 30004, 13, 462, 4706, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 1688, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 4706, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 8443, 13, 462, 4706, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 4706, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 9651, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 9651, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 9651, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 9651, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 9651, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 9651, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 4706, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 1252, 22164, 30004, 13, 462, 9651, 921, 1195, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 9651, 343, 1195, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 9651, 921, 3317, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 9651, 343, 3317, 353, 851, 29898, 1327, 10351, 1252, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 9651, 770, 29918, 513, 353, 851, 29898, 29896, 8443, 13, 462, 9651, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 4706, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 30004, 13, 462, 4706, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 30004, 13, 1678, 1653, 29949, 11191, 905, 267, 353, 5852, 30004, 13, 30004, 13, 1678, 565, 1653, 29949, 11191, 905, 267, 29901, 30004, 13, 30004, 13, 4706, 565, 451, 1243, 6558, 29901, 30004, 13, 9651, 565, 474, 451, 297, 1243, 2940, 29901, 30004, 13, 30004, 13, 18884, 274, 1336, 7900, 391, 9065, 353, 426, 29900, 10834, 29900, 6653, 29906, 29929, 29953, 1402, 29896, 10834, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 10834, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 10834, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29946, 10834, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29945, 10834, 29899, 29906, 29929, 29953, 6653, 29906, 29929, 29953, 1402, 29953, 10834, 29899, 29906, 29929, 29953, 6653, 29945, 29929, 29906, 1402, 29955, 10834, 29899, 29906, 29929, 29953, 6653, 29947, 29947, 29947, 1402, 29947, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29896, 29947, 29946, 1402, 29929, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29896, 29900, 10834, 29899, 29945, 29929, 29906, 6653, 29906, 29929, 29953, 1402, 29896, 29896, 10834, 29899, 29945, 29929, 29906, 6653, 29945, 29929, 29906, 1402, 29896, 29906, 10834, 29899, 29945, 29929, 29906, 6653, 29947, 29947, 29947, 1402, 29896, 29941, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29946, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29896, 29945, 10834, 29899, 29947, 29947, 29947, 6653, 29906, 29929, 29953, 1402, 29896, 29953, 10834, 29899, 29947, 29947, 29947, 6653, 29945, 29929, 29906, 1402, 29896, 29955, 10834, 29899, 29947, 29947, 29947, 6653, 29947, 29947, 29947, 1402, 29896, 29947, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29929, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29906, 29900, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29906, 29929, 29953, 1402, 29906, 29896, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29945, 29929, 29906, 1402, 29906, 29906, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29947, 29947, 29947, 1402, 29906, 29941, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29946, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29906, 29945, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29906, 29929, 29953, 1402, 29906, 29953, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 29955, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29947, 29947, 29947, 1402, 29906, 29947, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29929, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29941, 29900, 10834, 29899, 29896, 29946, 29947, 6653, 29906, 29929, 29953, 1402, 29941, 29896, 10834, 29899, 29896, 29946, 29947, 6653, 29945, 29929, 29906, 1402, 29941, 29906, 10834, 29899, 29896, 29946, 29947, 6653, 29947, 29947, 29947, 1402, 29941, 29941, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29946, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29941, 29945, 10834, 29899, 29955, 29900, 29900, 6653, 29906, 29929, 29953, 1402, 29941, 29953, 10834, 29899, 29955, 29900, 29900, 6653, 29945, 29929, 29906, 1402, 29941, 29955, 10834, 29899, 29955, 29900, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 29947, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29929, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29946, 29947, 29900, 12258, 396, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 2123, 29871, 29896, 29962, 30004, 13, 18884, 363, 281, 297, 3464, 29898, 29946, 29900, 1125, 30004, 13, 462, 1678, 1018, 29901, 6756, 13, 462, 4706, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 29871, 6756, 13, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 8552, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 6756, 13, 30004, 13, 462, 4706, 565, 13261, 25518, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 470, 13261, 25518, 29889, 12181, 29961, 29896, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 30004, 13, 462, 4706, 396, 1357, 8964, 2940, 29898, 11023, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 462, 4706, 6756, 13, 462, 4706, 363, 285, 297, 3464, 29898, 29946, 1125, 396, 285, 492, 567, 30004, 13, 462, 9651, 13261, 25518, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 25518, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 13668, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 30004, 13, 462, 9651, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29906, 29945, 29953, 29892, 29906, 29945, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 9651, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29906, 29945, 29953, 29892, 29906, 29945, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 30004, 13, 462, 9651, 396, 16897, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 9651, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 462, 9651, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 30004, 13, 462, 9651, 14550, 3027, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 14968, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 9651, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 12008, 30004, 13, 30004, 13, 462, 9651, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 6756, 13, 30004, 13, 462, 18884, 396, 3027, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 14968, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 18884, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 14968, 29914, 8346, 613, 851, 29898, 3027, 4557, 1170, 7240, 1642, 6173, 5783, 30004, 13, 462, 18884, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 30004, 13, 462, 18884, 3858, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 14968, 29914, 21134, 613, 851, 29898, 3027, 4557, 1170, 7240, 1642, 6173, 5783, 30004, 13, 462, 18884, 13850, 29906, 29889, 326, 3539, 29898, 1643, 29918, 2084, 29892, 5041, 13668, 8443, 13, 462, 18884, 6756, 13, 462, 18884, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 18884, 14550, 1454, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 462, 1678, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 462, 1678, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 462, 1678, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 462, 1678, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 462, 1678, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 462, 1678, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 18884, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 12008, 30004, 13, 462, 18884, 1596, 703, 5631, 1218, 13261, 29901, 9162, 710, 29898, 3027, 4557, 1170, 876, 30004, 13, 462, 18884, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 462, 1678, 5174, 29901, 30004, 13, 462, 4706, 1596, 703, 17776, 304, 274, 1336, 23157, 30004, 13, 4706, 1683, 29901, 30004, 13, 9651, 565, 474, 297, 1243, 2940, 29901, 30004, 13, 30004, 13, 18884, 274, 1336, 7900, 391, 9065, 353, 426, 29900, 10834, 29900, 6653, 29906, 29929, 29953, 1402, 29896, 10834, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 10834, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 10834, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29946, 10834, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29945, 10834, 29899, 29906, 29929, 29953, 6653, 29906, 29929, 29953, 1402, 29953, 10834, 29899, 29906, 29929, 29953, 6653, 29945, 29929, 29906, 1402, 29955, 10834, 29899, 29906, 29929, 29953, 6653, 29947, 29947, 29947, 1402, 29947, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29896, 29947, 29946, 1402, 29929, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29896, 29900, 10834, 29899, 29945, 29929, 29906, 6653, 29906, 29929, 29953, 1402, 29896, 29896, 10834, 29899, 29945, 29929, 29906, 6653, 29945, 29929, 29906, 1402, 29896, 29906, 10834, 29899, 29945, 29929, 29906, 6653, 29947, 29947, 29947, 1402, 29896, 29941, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29946, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29896, 29945, 10834, 29899, 29947, 29947, 29947, 6653, 29906, 29929, 29953, 1402, 29896, 29953, 10834, 29899, 29947, 29947, 29947, 6653, 29945, 29929, 29906, 1402, 29896, 29955, 10834, 29899, 29947, 29947, 29947, 6653, 29947, 29947, 29947, 1402, 29896, 29947, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29929, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29906, 29900, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29906, 29929, 29953, 1402, 29906, 29896, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29945, 29929, 29906, 1402, 29906, 29906, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29947, 29947, 29947, 1402, 29906, 29941, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29946, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29906, 29945, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29906, 29929, 29953, 1402, 29906, 29953, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 29955, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29947, 29947, 29947, 1402, 29906, 29947, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29929, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29941, 29900, 10834, 29899, 29896, 29946, 29947, 6653, 29906, 29929, 29953, 1402, 29941, 29896, 10834, 29899, 29896, 29946, 29947, 6653, 29945, 29929, 29906, 1402, 29941, 29906, 10834, 29899, 29896, 29946, 29947, 6653, 29947, 29947, 29947, 1402, 29941, 29941, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29946, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 268, 29941, 29945, 10834, 29899, 29955, 29900, 29900, 6653, 29906, 29929, 29953, 1402, 29941, 29953, 10834, 29899, 29955, 29900, 29900, 6653, 29945, 29929, 29906, 1402, 29941, 29955, 10834, 29899, 29955, 29900, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 29947, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29929, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29946, 29947, 29900, 12258, 396, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 2123, 29871, 29896, 29962, 30004, 13, 18884, 363, 281, 297, 3464, 29898, 29946, 29900, 1125, 30004, 13, 462, 1678, 1018, 29901, 6756, 13, 462, 4706, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 29871, 6756, 13, 30004, 13, 462, 4706, 13261, 13668, 353, 7442, 29889, 8552, 29898, 13668, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 6756, 13, 30004, 13, 462, 4706, 565, 13261, 25518, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 470, 13261, 25518, 29889, 12181, 29961, 29896, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 30004, 13, 462, 4706, 396, 1357, 8964, 2940, 29898, 11023, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 462, 4706, 6756, 13, 462, 4706, 363, 285, 297, 3464, 29898, 29946, 1125, 396, 285, 492, 567, 30004, 13, 462, 9651, 13261, 25518, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 25518, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 13668, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 30004, 13, 462, 9651, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29906, 29945, 29953, 29892, 29906, 29945, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 9651, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29906, 29945, 29953, 29892, 29906, 29945, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 30004, 13, 462, 9651, 396, 16897, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 9651, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 462, 9651, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 30004, 13, 462, 9651, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 6756, 13, 30004, 13, 462, 18884, 396, 3027, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 1688, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 18884, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 1688, 29914, 8346, 613, 851, 29898, 3027, 4557, 1170, 7240, 1642, 6173, 5783, 30004, 13, 462, 18884, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 30004, 13, 462, 18884, 3858, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 1688, 29914, 21134, 613, 851, 29898, 3027, 4557, 1170, 7240, 1642, 6173, 5783, 30004, 13, 462, 18884, 13850, 29906, 29889, 326, 3539, 29898, 1643, 29918, 2084, 29892, 5041, 13668, 8443, 13, 30004, 13, 462, 18884, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 18884, 14550, 1454, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 462, 1678, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 462, 1678, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 462, 1678, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 462, 1678, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 462, 1678, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 462, 1678, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 18884, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 12008, 30004, 13, 462, 18884, 1596, 703, 5631, 1218, 13261, 29901, 9162, 710, 29898, 3027, 4557, 1170, 876, 30004, 13, 462, 18884, 1967, 4557, 1170, 4619, 29871, 29896, 30004, 13, 462, 1678, 5174, 29901, 30004, 13, 462, 4706, 1596, 703, 17776, 304, 274, 1336, 23157, 30004, 13, 30004, 13, 1678, 396, 4910, 680, 1967, 297, 29871, 29946, 29916, 29941, 12786, 30004, 13, 1678, 396, 1423, 565, 297, 1269, 5120, 727, 526, 429, 566, 1078, 30004, 13, 1678, 396, 565, 727, 526, 29892, 679, 10150, 697, 322, 437, 848, 11307, 2729, 373, 393, 697, 448, 8182, 567, 322, 5731, 800, 30004, 13, 1678, 1653, 1252, 29925, 905, 267, 353, 7700, 30004, 13, 1678, 8466, 29918, 2873, 353, 7442, 29889, 2873, 4197, 29906, 29945, 29892, 29906, 29945, 2314, 30004, 13, 30004, 13, 1678, 565, 1653, 1252, 29925, 905, 267, 29901, 30004, 13, 4706, 363, 330, 297, 3464, 29898, 29946, 1125, 30004, 13, 9651, 363, 260, 297, 3464, 29898, 29941, 1125, 30004, 13, 18884, 396, 657, 13261, 29901, 30004, 13, 18884, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 524, 29898, 14486, 29898, 29887, 29930, 8394, 6110, 29914, 29946, 22164, 524, 29898, 14486, 3552, 29887, 29974, 29896, 11877, 8394, 6110, 29914, 29946, 8243, 524, 29898, 14486, 29898, 29873, 29930, 8394, 6110, 29914, 29941, 22164, 524, 29898, 14486, 3552, 29873, 29974, 29896, 11877, 8394, 6110, 29914, 29941, 876, 2314, 30004, 13, 18884, 13261, 5746, 353, 7442, 29889, 8552, 29898, 5746, 17619, 1762, 3629, 29925, 905, 287, 29961, 524, 29898, 14486, 29898, 29887, 29930, 8394, 6110, 29914, 29946, 22164, 524, 29898, 14486, 3552, 29887, 29974, 29896, 11877, 8394, 6110, 29914, 29946, 8243, 524, 29898, 14486, 29898, 29873, 29930, 8394, 6110, 29914, 29941, 22164, 524, 29898, 14486, 3552, 29873, 29974, 29896, 11877, 8394, 6110, 29914, 29941, 876, 2314, 30004, 13, 30004, 13, 18884, 13261, 5746, 353, 13850, 29906, 29889, 29885, 5676, 3002, 1252, 29898, 5041, 5746, 29892, 13850, 29906, 29889, 29924, 1955, 19689, 29918, 29907, 3927, 1660, 29892, 8466, 29918, 2873, 8443, 13, 30004, 13, 18884, 289, 29890, 10351, 1252, 353, 679, 29933, 3313, 29898, 5041, 5746, 8443, 13, 30004, 13, 18884, 565, 7431, 29898, 1327, 10351, 1252, 29897, 1405, 29871, 29900, 29901, 30004, 13, 462, 1678, 17117, 8442, 7967, 4339, 29892, 11855, 29892, 903, 353, 679, 29931, 1191, 342, 13799, 29923, 1760, 1007, 29898, 5041, 5746, 8443, 13, 18884, 1683, 29901, 6756, 13, 462, 1678, 6773, 30004, 13, 30004, 13, 18884, 274, 1336, 7900, 391, 9065, 353, 426, 29900, 10834, 29900, 6653, 29906, 29929, 29953, 1402, 29896, 10834, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 10834, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 10834, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29946, 10834, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29945, 10834, 29899, 29906, 29929, 29953, 6653, 29906, 29929, 29953, 1402, 29953, 10834, 29899, 29906, 29929, 29953, 6653, 29945, 29929, 29906, 1402, 29955, 10834, 29899, 29906, 29929, 29953, 6653, 29947, 29947, 29947, 1402, 29947, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29896, 29947, 29946, 1402, 29929, 10834, 29899, 29906, 29929, 29953, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29896, 29900, 10834, 29899, 29945, 29929, 29906, 6653, 29906, 29929, 29953, 1402, 29896, 29896, 10834, 29899, 29945, 29929, 29906, 6653, 29945, 29929, 29906, 1402, 29896, 29906, 10834, 29899, 29945, 29929, 29906, 6653, 29947, 29947, 29947, 1402, 29896, 29941, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29946, 10834, 29899, 29945, 29929, 29906, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29896, 29945, 10834, 29899, 29947, 29947, 29947, 6653, 29906, 29929, 29953, 1402, 29896, 29953, 10834, 29899, 29947, 29947, 29947, 6653, 29945, 29929, 29906, 1402, 29896, 29955, 10834, 29899, 29947, 29947, 29947, 6653, 29947, 29947, 29947, 1402, 29896, 29947, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29896, 29929, 10834, 29899, 29947, 29947, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29906, 29900, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29906, 29929, 29953, 1402, 29906, 29896, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29945, 29929, 29906, 1402, 29906, 29906, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29947, 29947, 29947, 1402, 29906, 29941, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29946, 10834, 29899, 29896, 29896, 29947, 29946, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29906, 29945, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29906, 29929, 29953, 1402, 29906, 29953, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29945, 29929, 29906, 1402, 29906, 29955, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29947, 29947, 29947, 1402, 29906, 29947, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29906, 29929, 10834, 29899, 29896, 29946, 29947, 29900, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29941, 29900, 10834, 29899, 29896, 29946, 29947, 6653, 29906, 29929, 29953, 1402, 29941, 29896, 10834, 29899, 29896, 29946, 29947, 6653, 29945, 29929, 29906, 1402, 29941, 29906, 10834, 29899, 29896, 29946, 29947, 6653, 29947, 29947, 29947, 1402, 29941, 29941, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29946, 10834, 29899, 29896, 29946, 29947, 6653, 29896, 29946, 29947, 29900, 1402, 30004, 13, 462, 462, 308, 29941, 29945, 10834, 29899, 29955, 29900, 29900, 6653, 29906, 29929, 29953, 1402, 29941, 29953, 10834, 29899, 29955, 29900, 29900, 6653, 29945, 29929, 29906, 1402, 29941, 29955, 10834, 29899, 29955, 29900, 29900, 6653, 29947, 29947, 29947, 1402, 29941, 29947, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29896, 29947, 29946, 1402, 29941, 29929, 10834, 29899, 29955, 29900, 29900, 6653, 29896, 29946, 29947, 29900, 12258, 396, 29883, 1336, 7900, 391, 9065, 29961, 29883, 3816, 29900, 2123, 29871, 29896, 29962, 30004, 13, 30004, 13, 18884, 363, 281, 297, 3464, 29898, 29946, 29900, 1125, 30004, 13, 462, 1678, 1018, 29901, 6756, 13, 462, 4706, 13261, 25518, 353, 7442, 29889, 8552, 29898, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 29871, 6756, 13, 30004, 13, 462, 4706, 13261, 5746, 353, 7442, 29889, 8552, 29898, 5746, 17619, 1762, 3629, 29925, 905, 287, 29961, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 5387, 1760, 276, 7967, 4339, 29961, 29900, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29900, 1402, 30004, 13, 462, 462, 462, 9651, 313, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 29962, 1125, 29898, 1760, 276, 7967, 4339, 29961, 29896, 10062, 29896, 29946, 29947, 29900, 29974, 29883, 1336, 7900, 391, 9065, 29961, 29893, 3816, 29896, 2314, 2314, 6756, 13, 30004, 13, 462, 4706, 565, 13261, 25518, 29889, 12181, 29961, 29900, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 470, 13261, 25518, 29889, 12181, 29961, 29896, 29962, 2804, 29871, 29896, 29946, 29947, 29900, 29901, 30004, 13, 462, 9651, 6773, 30004, 13, 30004, 13, 462, 4706, 396, 1357, 8964, 2940, 29898, 11023, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 462, 4706, 396, 1357, 8964, 2940, 29898, 11023, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 467, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 30004, 13, 462, 4706, 13261, 5746, 353, 13850, 29906, 29889, 29885, 5676, 3002, 1252, 29898, 5041, 5746, 29892, 13850, 29906, 29889, 29924, 1955, 19689, 29918, 29907, 3927, 1660, 29892, 8466, 29918, 2873, 29897, 308, 6756, 13, 30004, 13, 462, 4706, 363, 285, 297, 3464, 29898, 29946, 1125, 396, 285, 492, 567, 30004, 13, 462, 9651, 13261, 25518, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 25518, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 5450, 29929, 29900, 29898, 5041, 5746, 29892, 1165, 267, 7607, 29900, 29892, 29896, 876, 30004, 13, 30004, 13, 462, 9651, 13261, 25518, 353, 13850, 29906, 29889, 21476, 29898, 5041, 25518, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 462, 9651, 13261, 13668, 353, 13850, 29906, 29889, 21476, 29898, 5041, 13668, 29892, 313, 29946, 29896, 29953, 29892, 29946, 29896, 29953, 511, 29694, 353, 13850, 29906, 29889, 23845, 29918, 29909, 1525, 29909, 8443, 13, 30004, 13, 462, 9651, 396, 16897, 30004, 13, 462, 9651, 13261, 13668, 353, 7442, 29889, 18056, 368, 29898, 5041, 13668, 29892, 29906, 29945, 29945, 29914, 9302, 29889, 3317, 29898, 5041, 13668, 876, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 29958, 29906, 29906, 29900, 29962, 353, 29871, 29906, 29945, 29945, 30004, 13, 462, 9651, 13261, 13668, 29961, 5041, 13668, 14065, 29906, 29906, 29900, 29962, 353, 29871, 29900, 30004, 13, 462, 9651, 13261, 13668, 353, 13261, 13668, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 8443, 13, 30004, 13, 462, 9651, 289, 29890, 10351, 29949, 29881, 353, 679, 29933, 3313, 29898, 5041, 13668, 8443, 13, 30004, 13, 462, 9651, 565, 7431, 29898, 1327, 10351, 29949, 29881, 29897, 1405, 29871, 29900, 29901, 6756, 13, 30004, 13, 462, 18884, 1967, 29918, 2084, 353, 2897, 29889, 2084, 29889, 6370, 2084, 29898, 359, 29889, 2084, 29889, 7122, 703, 29979, 29949, 3927, 29963, 29941, 29914, 1272, 29914, 24713, 29914, 1688, 613, 11860, 29900, 29953, 29881, 29889, 6173, 29908, 1273, 29898, 3027, 4557, 1170, 4961, 30004, 13, 462, 18884, 13850, 29906, 29889, 326, 3539, 29898, 3027, 29918, 2084, 29892, 5041, 25518, 29889, 579, 668, 29898, 9302, 29889, 13470, 29947, 876, 30004, 13, 462, 18884, 17195, 353, 1967, 29918, 2084, 30004, 13, 30004, 13, 462, 18884, 363, 413, 297, 3464, 29898, 2435, 29898, 1327, 10351, 29949, 29881, 22164, 30004, 13, 462, 462, 1678, 921, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29896, 2314, 30004, 13, 462, 462, 1678, 343, 1195, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29900, 2314, 30004, 13, 462, 462, 1678, 921, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29941, 2314, 30004, 13, 462, 462, 1678, 343, 3317, 353, 851, 29898, 1327, 10351, 29949, 29881, 29961, 29895, 3816, 29906, 2314, 30004, 13, 462, 462, 1678, 770, 29918, 513, 353, 851, 29898, 29900, 8443, 13, 462, 462, 1678, 17195, 4619, 525, 525, 718, 13420, 4286, 7122, 4197, 29916, 1195, 29892, 343, 1195, 29892, 921, 3317, 29892, 343, 3317, 29892, 851, 29898, 1990, 29918, 513, 29897, 2314, 30004, 13, 30004, 13, 462, 18884, 281, 29888, 29889, 3539, 29898, 18317, 718, 6634, 29876, 1159, 30004, 13, 462, 18884, 1596, 703, 5631, 1218, 13261, 29901, 9162, 710, 29898, 3027, 4557, 1170, 876, 30004, 13, 462, 18884, 1967, 4557, 1170, 4619, 29871, 29896, 1669, 6756, 13, 30004, 13, 462, 1678, 5174, 29901, 30004, 13, 462, 4706, 1596, 703, 17776, 304, 274, 1336, 23157, 30004, 13, 30004, 13, 30004, 13, 2 ]
nxontology_data/commands.py
related-sciences/nxontology-data
0
69641
import logging import fire from nxontology import NXOntology from nxontology_data.mesh.mesh import MeshLoader from nxontology_data.pubchem.classifications import export_all_heirarchies from nxontology_data.utils import get_output_dir, write_ontology def write_test_output() -> None: """Export an empty test ontology, useful for testing CI deployment.""" output_dir = get_output_dir().joinpath("test") output_dir.mkdir(parents=True, exist_ok=True) nxo: NXOntology[str] = NXOntology() nxo.graph.graph["name"] = "test" write_ontology(nxo, output_dir) def cli() -> None: """ Run like `poetry run nxontology_data` """ logging.basicConfig() logging.getLogger().setLevel(logging.INFO) commands = { "mesh": MeshLoader.export_mesh_outputs, "pubchem": export_all_heirarchies, "test": write_test_output, } fire.Fire(commands)
[ 1, 1053, 12183, 13, 13, 5215, 3974, 13, 3166, 302, 29916, 609, 3002, 1053, 405, 29990, 29949, 593, 3002, 13, 13, 3166, 302, 29916, 609, 3002, 29918, 1272, 29889, 4467, 29882, 29889, 4467, 29882, 1053, 341, 12094, 10036, 13, 3166, 302, 29916, 609, 3002, 29918, 1272, 29889, 5467, 14969, 29889, 1990, 8232, 1053, 5609, 29918, 497, 29918, 354, 381, 1279, 583, 13, 3166, 302, 29916, 609, 3002, 29918, 1272, 29889, 13239, 1053, 679, 29918, 4905, 29918, 3972, 29892, 2436, 29918, 609, 3002, 13, 13, 13, 1753, 2436, 29918, 1688, 29918, 4905, 580, 1599, 6213, 29901, 13, 1678, 9995, 26382, 385, 4069, 1243, 4625, 3002, 29892, 5407, 363, 6724, 25781, 18209, 1213, 15945, 13, 1678, 1962, 29918, 3972, 353, 679, 29918, 4905, 29918, 3972, 2141, 7122, 2084, 703, 1688, 1159, 13, 1678, 1962, 29918, 3972, 29889, 11256, 3972, 29898, 862, 1237, 29922, 5574, 29892, 1863, 29918, 554, 29922, 5574, 29897, 13, 1678, 302, 29916, 29877, 29901, 405, 29990, 29949, 593, 3002, 29961, 710, 29962, 353, 405, 29990, 29949, 593, 3002, 580, 13, 1678, 302, 29916, 29877, 29889, 4262, 29889, 4262, 3366, 978, 3108, 353, 376, 1688, 29908, 13, 1678, 2436, 29918, 609, 3002, 29898, 23818, 29877, 29892, 1962, 29918, 3972, 29897, 13, 13, 13, 1753, 9335, 580, 1599, 6213, 29901, 13, 1678, 9995, 13, 1678, 7525, 763, 421, 1129, 27184, 1065, 302, 29916, 609, 3002, 29918, 1272, 29952, 13, 1678, 9995, 13, 1678, 12183, 29889, 16121, 3991, 580, 13, 1678, 12183, 29889, 657, 16363, 2141, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 1678, 8260, 353, 426, 13, 4706, 376, 4467, 29882, 1115, 341, 12094, 10036, 29889, 15843, 29918, 4467, 29882, 29918, 4905, 29879, 29892, 13, 4706, 376, 5467, 14969, 1115, 5609, 29918, 497, 29918, 354, 381, 1279, 583, 29892, 13, 4706, 376, 1688, 1115, 2436, 29918, 1688, 29918, 4905, 29892, 13, 1678, 500, 13, 1678, 3974, 29889, 18654, 29898, 26381, 29897, 13, 2 ]
log/use_handl_format.py
nkzmsb/howto
0
174507
<reponame>nkzmsb/howto<gh_stars>0 import logging logger=logging.getLogger(__name__) logger.setLevel(logging.INFO) # create formatter formatter = logging.Formatter('%(asctime)s\t%(name)-12s\t%(funcName)s\t%(levelname)-8s\t%(message)s' # , datefmt='%y%m%d_%H:%M:%S' # asftimeの形式を指定することも可能 ) # create console handler handler = logging.StreamHandler() # add formatter to ch handler.setFormatter(formatter) # add handler to logger logger.addHandler(handler) logger.info("info!!")
[ 1, 529, 276, 1112, 420, 29958, 29876, 29895, 29920, 1516, 29890, 29914, 3525, 517, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12183, 13, 13, 21707, 29922, 21027, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 21707, 29889, 842, 10108, 29898, 21027, 29889, 11690, 29897, 13, 13, 29937, 1653, 883, 2620, 13, 689, 2620, 353, 12183, 29889, 18522, 877, 29995, 29898, 294, 312, 603, 29897, 29879, 29905, 29873, 29995, 29898, 978, 6817, 29896, 29906, 29879, 29905, 29873, 29995, 29898, 9891, 1170, 29897, 29879, 29905, 29873, 29995, 29898, 5563, 978, 6817, 29947, 29879, 29905, 29873, 29995, 29898, 4906, 29897, 29879, 29915, 13, 462, 795, 396, 1919, 2635, 23479, 2433, 29995, 29891, 29995, 29885, 29995, 29881, 29918, 29995, 29950, 16664, 29924, 16664, 29903, 29915, 396, 408, 615, 603, 30199, 31305, 30607, 30396, 31084, 30495, 30427, 30332, 30589, 30364, 30723, 30682, 30815, 13, 462, 795, 1723, 13, 13, 29937, 1653, 2991, 7834, 13, 13789, 353, 12183, 29889, 3835, 4598, 580, 13, 13, 29937, 788, 883, 2620, 304, 521, 13, 13789, 29889, 842, 18522, 29898, 689, 2620, 29897, 13, 13, 29937, 788, 7834, 304, 17927, 13, 21707, 29889, 1202, 4598, 29898, 13789, 29897, 13, 13, 21707, 29889, 3888, 703, 3888, 6824, 1159, 2 ]
george/basic.py
kastnerkyle/george
1
46525
# -*- coding: utf-8 -*- from __future__ import division, print_function __all__ = ["GP"] try: from itertools import izip except ImportError: izip = zip import numpy as np import scipy.optimize as op from scipy.linalg import cho_factor, cho_solve, LinAlgError from .utils import multivariate_gaussian_samples, nd_sort_samples # MAGIC: tiny epsilon to add on the diagonal of the matrices in the absence # of observational uncertainties. Needed for computational stability. TINY = 1.25e-12 class GP(object): """ The basic Gaussian Process object. :param kernel: An instance of a subclass of :class:`kernels.Kernel`. :param mean: (optional) A description of the mean function; can be a callable or a scalar. If scalar, the mean is assumed constant. Otherwise, the function will be called with the array of independent coordinates as the only argument. (default: ``0.0``) """ def __init__(self, kernel, mean=None): self.kernel = kernel self._computed = False if mean is None: self.mean = _default_mean(0.) else: try: val = float(mean) except TypeError: self.mean = mean else: self.mean = _default_mean(val) @property def computed(self): """ Has the processes been computed since the last update of the kernel? """ return self._computed and not self.kernel.dirty @computed.setter def computed(self, v): self._computed = v if v: self.kernel.dirty = False def parse_samples(self, t, sort=False): """ Parse a list of samples to make sure that it has the correct dimensions and optionally sort it. In one dimension, the samples will be sorted in the logical order. In higher dimensions, a kd-tree is built and the samples are sorted in increasing distance from the *first* sample. :param t: ``(nsamples,)`` or ``(nsamples, ndim)`` The list of samples. If 1-D, this is assumed to be a list of one-dimensional samples otherwise, the size of the second dimension is assumed to be the dimension of the input space. :param sort: A boolean flag indicating whether or not the samples should be sorted. Returns a tuple ``(samples, inds)`` where * **samples** is an array with shape ``(nsamples, ndim)`` and if ``sort`` was ``True``, it will also be sorted, and * **inds** is an ``(nsamples,)`` list of integer permutations used to sort the list of samples. Raises a ``RuntimeError`` if the input dimension doesn't match the dimension of the kernel. """ t = np.atleast_1d(t) if len(t.shape) == 1: # Deal with one-dimensional data. if sort: inds = np.argsort(t) else: inds = np.arange(len(t), dtype=int) t = np.atleast_2d(t).T elif sort: # Sort the data using a KD-tree. inds = nd_sort_samples(t) else: # Otherwise, assume that the samples are sorted. inds = np.arange(t.shape[0], dtype=int) # Double check the dimensions against the kernel. if len(t.shape) != 2 or t.shape[1] != self.kernel.ndim: raise ValueError("Dimension mismatch") return t[inds], inds def _check_dimensions(self, y): n, ndim = self._x.shape y = np.atleast_1d(y) if len(y.shape) > 1: raise ValueError("The predicted dimension must be 1-D") if len(y) != n: raise ValueError("Dimension mismatch") return y def compute(self, x, yerr=TINY, sort=True, **kwargs): """ Pre-compute the covariance matrix and factorize it for a set of times and uncertainties. :param x: ``(nsamples,)`` or ``(nsamples, ndim)`` The independent coordinates of the data points. :param yerr: (optional) ``(nsamples,)`` or scalar The Gaussian uncertainties on the data points at coordinates ``x``. These values will be added in quadrature to the diagonal of the covariance matrix. :param sort: (optional) Should the samples be sorted before computing the covariance matrix? This can lead to more numerically stable results and with some linear algebra libraries this can more computationally efficient. Either way, this flag is passed directly to :func:`parse_samples`. (default: ``True``) """ # Parse the input coordinates. self._x, self.inds = self.parse_samples(x, sort) try: self._yerr = float(yerr) * np.ones(len(x)) except TypeError: self._yerr = self._check_dimensions(yerr)[self.inds] self._do_compute(**kwargs) def _do_compute(self, _scale=0.5*np.log(2*np.pi)): # Compute the kernel matrix. K = self.kernel(self._x[:, None], self._x[None, :]) K[np.diag_indices_from(K)] += self._yerr ** 2 # Factor the matrix and compute the log-determinant. factor, _ = self._factor = cho_factor(K, overwrite_a=True) self._const = -(np.sum(np.log(np.diag(factor))) + _scale*len(self._x)) # Save the computed state. self.computed = True def recompute(self, sort=False, **kwargs): """ Re-compute a previously computed model. You might want to do this if the kernel parameters change and the kernel is labeled as ``dirty``. :params sort: (optional) Should the samples be sorted before computing the covariance matrix? (default: ``False``) """ if not (hasattr(self, "_x") and hasattr(self, "_yerr")): raise RuntimeError("You need to compute the model first") return self.compute(self._x, self._yerr, sort=sort, **kwargs) def _compute_lnlike(self, r): return self._const - 0.5*np.dot(r.T, cho_solve(self._factor, r)) def lnlikelihood(self, y, quiet=False): """ Compute the ln-likelihood of a set of observations under the Gaussian process model. You must call ``compute`` before this function. :param y: ``(nsamples, )`` The observations at the coordinates provided in the ``compute`` step. :param quiet: If ``True`` return negative infinity instead of raising an exception when there is an invalid kernel or linear algebra failure. (default: ``False``) """ if not self.computed: try: self.recompute() except (ValueError, LinAlgError): if quiet: return -np.inf raise r = self._check_dimensions(y)[self.inds] - self.mean(self._x) ll = self._compute_lnlike(r) return ll if np.isfinite(ll) else -np.inf def grad_lnlikelihood(self, y, dims=None, quiet=False): """ Compute the gradient of the ln-likelihood function as a function of the kernel parameters. :param y: ``(nsamples,)`` The list of observations at coordinates ``x`` provided to the :func:`compute` function. :param dims: (optional) If you only want to compute the gradient in some dimensions, list them here. :param quiet: If ``True`` return a gradient of zero instead of raising an exception when there is an invalid kernel or linear algebra failure. (default: ``False``) """ # By default, compute the gradient in all dimensions. if dims is None: dims = np.ones(len(self.kernel), dtype=bool) # Make sure that the model is computed and try to recompute it if it's # dirty. if not self.computed: try: self.recompute() except (ValueError, LinAlgError): if quiet: return np.zeros_like(dims, dtype=float) raise # Parse the input sample list. r = self._check_dimensions(y)[self.inds] - self.mean(self._x) # Pre-compute some factors. alpha = cho_solve(self._factor, r) Kg = self.kernel.grad(self._x[:, None], self._x[None, :])[dims] # Loop over dimensions and compute the gradient in each one. g = np.empty(len(Kg)) for i, k in enumerate(Kg): d = sum(map(lambda r: np.dot(alpha, r), alpha[:, None] * k)) d -= np.sum(np.diag(cho_solve(self._factor, k))) g[i] = 0.5 * d return g def predict(self, y, t): """ Compute the conditional predictive distribution of the model. :param y: ``(nsamples,)`` The observations to condition the model on. :param t: ``(ntest,)`` or ``(ntest, ndim)`` The coordinates where the predictive distribution should be computed. Returns a tuple ``(mu, cov)`` where * **mu** ``(ntest,)`` is the mean of the predictive distribution, and * **cov** ``(ntest, ntest)`` is the predictive covariance. """ if not self.computed: self.recompute() r = self._check_dimensions(y)[self.inds] - self.mean(self._x) xs, i = self.parse_samples(t, False) alpha = cho_solve(self._factor, r) # Compute the predictive mean. Kxs = self.kernel(self._x[None, :], xs[:, None]) mu = np.dot(Kxs, alpha) + self.mean(xs) # Compute the predictive covariance. cov = self.kernel(xs[:, None], xs[None, :]) cov -= np.dot(Kxs, cho_solve(self._factor, Kxs.T)) return mu, cov def sample_conditional(self, y, t, size=1): """ Draw samples from the predictive conditional distribution. :param y: ``(nsamples, )`` The observations to condition the model on. :param t: ``(ntest, )`` or ``(ntest, ndim)`` The coordinates where the predictive distribution should be computed. :param size: (optional) The number of samples to draw. (default: ``1``) Returns **samples** ``(N, ntest)``, a list of predictions at coordinates given by ``t``. """ mu, cov = self.predict(y, t) return multivariate_gaussian_samples(cov, size, mean=mu) def sample(self, t, size=1): """ Draw samples from the prior distribution. :param t: ``(ntest, )`` or ``(ntest, ndim)`` The coordinates where the model should be sampled. :param size: (optional) The number of samples to draw. (default: ``1``) Returns **samples** ``(N, ntest)``, a list of predictions at coordinates given by ``t``. """ x, _ = self.parse_samples(t, False) cov = self.get_matrix(x) return multivariate_gaussian_samples(cov, size, mean=self.mean(x)) def get_matrix(self, t): """ Get the covariance matrix at a given set of independent coordinates. :param t: ``(nsamples,)`` or ``(nsamples, ndim)`` The list of samples. """ r, _ = self.parse_samples(t, False) return self.kernel(r[:, None], r[None, :]) def optimize(self, x, y, yerr=TINY, sort=True, dims=None, in_log=True, verbose=True, **kwargs): """ A simple and not terribly robust non-linear optimization algorithm for the kernel hyperpararmeters. :param x: ``(nsamples,)`` or ``(nsamples, ndim)`` The independent coordinates of the data points. :param y: ``(nsamples, )`` The observations at the coordinates ``x``. :param yerr: (optional) ``(nsamples,)`` or scalar The Gaussian uncertainties on the data points at coordinates ``x``. These values will be added in quadrature to the diagonal of the covariance matrix. :param sort: (optional) Should the samples be sorted before computing the covariance matrix? :param dims: (optional) If you only want to optimize over some parameters, list their indices here. :param in_log: (optional) ``(len(kernel),)``, ``(len(dims),)`` or bool If you want to fit the parameters in the log (this can be useful for parameters that shouldn't go negative) specify that here. This can be a single boolean---in which case it is assumed to apply to every dimension---or it can be an array of booleans, one for each dimension. :param verbose: (optional) Display the results of the call to :func:`scipy.optimize.minimize`? (default: ``True``) Returns ``(pars, results)`` where ``pars`` is the list of optimized parameters and ``results`` is the results object returned by :func:`scipy.optimize.minimize`. """ self.compute(x, yerr, sort=sort) # By default, optimize all the hyperparameters. if dims is None: dims = np.ones(len(self.kernel), dtype=bool) dims = np.arange(len(self.kernel))[dims] # Deal with conversion functions. try: len(in_log) except TypeError: in_log = in_log * np.ones_like(dims, dtype=bool) else: if len(in_log) != len(dims): raise RuntimeError("Dimension list and log mask mismatch") # Build the conversion functions. conv = np.array([lambda x: x for i in range(len(dims))]) iconv = np.array([lambda x: x for i in range(len(dims))]) conv[in_log] = np.exp iconv[in_log] = np.log # Define the objective function and gradient. def nll(pars): for i, f, p in izip(dims, conv, pars): self.kernel[i] = f(p) ll = self.lnlikelihood(y, quiet=True) if not np.isfinite(ll): return 1e25 # The optimizers can't deal with infinities. return -ll def grad_nll(pars): for i, f, p in izip(dims, conv, pars): self.kernel[i] = f(p) return -self.grad_lnlikelihood(y, dims=dims, quiet=True) # Run the optimization. p0 = [f(p) for f, p in izip(iconv, self.kernel.pars[dims])] results = op.minimize(nll, p0, jac=grad_nll, **kwargs) if verbose: print(results.message) # Update the kernel. for i, f, p in izip(dims, conv, results.x): self.kernel[i] = f(p) return self.kernel.pars[dims], results class _default_mean(object): def __init__(self, value): self.value = value def __call__(self, t): return self.value + np.zeros(len(t), dtype=float)
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 3166, 4770, 29888, 9130, 1649, 1053, 8542, 29892, 1596, 29918, 2220, 13, 13, 1649, 497, 1649, 353, 6796, 19903, 3108, 13, 13, 2202, 29901, 13, 1678, 515, 4256, 8504, 1053, 5951, 666, 13, 19499, 16032, 2392, 29901, 13, 1678, 5951, 666, 353, 14319, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4560, 2272, 29889, 20640, 675, 408, 1015, 13, 3166, 4560, 2272, 29889, 29880, 979, 29887, 1053, 3060, 29918, 19790, 29892, 3060, 29918, 2929, 345, 29892, 4342, 22461, 2392, 13, 13, 3166, 869, 13239, 1053, 1773, 27432, 403, 29918, 29887, 17019, 29918, 27736, 29892, 29871, 299, 29918, 6605, 29918, 27736, 13, 13, 13, 29937, 341, 10051, 2965, 29901, 21577, 321, 3232, 304, 788, 373, 278, 19640, 310, 278, 13516, 297, 278, 18070, 13, 29937, 310, 5820, 1288, 443, 6327, 2365, 583, 29889, 2448, 19226, 363, 26845, 25806, 29889, 13, 29911, 1177, 29979, 353, 29871, 29896, 29889, 29906, 29945, 29872, 29899, 29896, 29906, 13, 13, 13, 1990, 28258, 29898, 3318, 1125, 13, 1678, 9995, 13, 1678, 450, 6996, 22477, 10554, 1203, 29889, 13, 13, 1678, 584, 3207, 8466, 29901, 13, 4706, 530, 2777, 310, 263, 19481, 310, 584, 1990, 18078, 22178, 1379, 29889, 29968, 5851, 1412, 13, 13, 1678, 584, 3207, 2099, 29901, 313, 25253, 29897, 13, 4706, 319, 6139, 310, 278, 2099, 740, 29936, 508, 367, 263, 1246, 519, 470, 263, 17336, 29889, 960, 13, 4706, 17336, 29892, 278, 2099, 338, 12023, 4868, 29889, 13466, 29892, 278, 740, 674, 367, 13, 4706, 2000, 411, 278, 1409, 310, 7417, 10350, 408, 278, 871, 2980, 29889, 13, 4706, 313, 4381, 29901, 4954, 29900, 29889, 29900, 29952, 6348, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 8466, 29892, 2099, 29922, 8516, 1125, 13, 4706, 1583, 29889, 17460, 353, 8466, 13, 4706, 1583, 3032, 12097, 287, 353, 7700, 13, 4706, 565, 2099, 338, 6213, 29901, 13, 9651, 1583, 29889, 12676, 353, 903, 4381, 29918, 12676, 29898, 29900, 1846, 13, 4706, 1683, 29901, 13, 9651, 1018, 29901, 13, 18884, 659, 353, 5785, 29898, 12676, 29897, 13, 9651, 5174, 20948, 29901, 13, 18884, 1583, 29889, 12676, 353, 2099, 13, 9651, 1683, 29901, 13, 18884, 1583, 29889, 12676, 353, 903, 4381, 29918, 12676, 29898, 791, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 15712, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 11699, 278, 10174, 1063, 15712, 1951, 278, 1833, 2767, 310, 278, 8466, 29973, 13, 13, 4706, 9995, 13, 4706, 736, 1583, 3032, 12097, 287, 322, 451, 1583, 29889, 17460, 29889, 3972, 1017, 13, 13, 1678, 732, 12097, 287, 29889, 842, 357, 13, 1678, 822, 15712, 29898, 1311, 29892, 325, 1125, 13, 4706, 1583, 3032, 12097, 287, 353, 325, 13, 4706, 565, 325, 29901, 13, 9651, 1583, 29889, 17460, 29889, 3972, 1017, 353, 7700, 13, 13, 1678, 822, 6088, 29918, 27736, 29898, 1311, 29892, 260, 29892, 2656, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 20969, 263, 1051, 310, 11916, 304, 1207, 1854, 393, 372, 756, 278, 1959, 13, 4706, 13391, 322, 2984, 635, 2656, 372, 29889, 512, 697, 9927, 29892, 278, 11916, 674, 13, 4706, 367, 12705, 297, 278, 16667, 1797, 29889, 512, 6133, 13391, 29892, 263, 413, 29881, 29899, 8336, 338, 13, 4706, 4240, 322, 278, 11916, 526, 12705, 297, 10231, 5418, 515, 278, 13, 4706, 334, 4102, 29930, 4559, 29889, 13, 13, 4706, 584, 3207, 260, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 4954, 29898, 1983, 9422, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 1051, 310, 11916, 29889, 960, 29871, 29896, 29899, 29928, 29892, 445, 338, 12023, 304, 367, 263, 1051, 310, 13, 9651, 697, 29899, 12531, 11916, 6467, 29892, 278, 2159, 310, 278, 1473, 13, 9651, 9927, 338, 12023, 304, 367, 278, 9927, 310, 278, 1881, 2913, 29889, 13, 13, 4706, 584, 3207, 2656, 29901, 13, 9651, 319, 7223, 7353, 23941, 3692, 470, 451, 278, 11916, 881, 367, 13, 9651, 12705, 29889, 13, 13, 4706, 16969, 263, 18761, 4954, 29898, 27736, 29892, 1399, 29879, 3569, 29952, 988, 13, 13, 4706, 334, 3579, 27736, 1068, 338, 385, 1409, 411, 8267, 4954, 29898, 1983, 9422, 29892, 29871, 299, 326, 3569, 29952, 322, 565, 13, 3986, 4954, 6605, 16159, 471, 4954, 5574, 29952, 1673, 372, 674, 884, 367, 12705, 29892, 322, 13, 4706, 334, 3579, 12772, 1068, 338, 385, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 1051, 310, 6043, 20005, 800, 1304, 304, 13, 3986, 2656, 278, 1051, 310, 11916, 29889, 13, 13, 4706, 390, 1759, 267, 263, 4954, 7944, 2392, 16159, 565, 278, 1881, 9927, 1838, 29915, 29873, 1993, 278, 13, 4706, 9927, 310, 278, 8466, 29889, 13, 13, 4706, 9995, 13, 4706, 260, 353, 7442, 29889, 271, 280, 579, 29918, 29896, 29881, 29898, 29873, 29897, 13, 4706, 565, 7431, 29898, 29873, 29889, 12181, 29897, 1275, 29871, 29896, 29901, 13, 9651, 396, 897, 284, 411, 697, 29899, 12531, 848, 29889, 13, 9651, 565, 2656, 29901, 13, 18884, 1399, 29879, 353, 7442, 29889, 5085, 441, 29898, 29873, 29897, 13, 9651, 1683, 29901, 13, 18884, 1399, 29879, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 29873, 511, 26688, 29922, 524, 29897, 13, 9651, 260, 353, 7442, 29889, 271, 280, 579, 29918, 29906, 29881, 29898, 29873, 467, 29911, 13, 4706, 25342, 2656, 29901, 13, 9651, 396, 20025, 278, 848, 773, 263, 476, 29928, 29899, 8336, 29889, 13, 9651, 1399, 29879, 353, 29871, 299, 29918, 6605, 29918, 27736, 29898, 29873, 29897, 13, 4706, 1683, 29901, 13, 9651, 396, 13466, 29892, 5251, 393, 278, 11916, 526, 12705, 29889, 13, 9651, 1399, 29879, 353, 7442, 29889, 279, 927, 29898, 29873, 29889, 12181, 29961, 29900, 1402, 26688, 29922, 524, 29897, 13, 13, 4706, 396, 11599, 1423, 278, 13391, 2750, 278, 8466, 29889, 13, 4706, 565, 7431, 29898, 29873, 29889, 12181, 29897, 2804, 29871, 29906, 470, 260, 29889, 12181, 29961, 29896, 29962, 2804, 1583, 29889, 17460, 29889, 299, 326, 29901, 13, 9651, 12020, 7865, 2392, 703, 16142, 2673, 29635, 1159, 13, 13, 4706, 736, 260, 29961, 12772, 1402, 1399, 29879, 13, 13, 1678, 822, 903, 3198, 29918, 6229, 5580, 29898, 1311, 29892, 343, 1125, 13, 4706, 302, 29892, 29871, 299, 326, 353, 1583, 3032, 29916, 29889, 12181, 13, 4706, 343, 353, 7442, 29889, 271, 280, 579, 29918, 29896, 29881, 29898, 29891, 29897, 13, 4706, 565, 7431, 29898, 29891, 29889, 12181, 29897, 1405, 29871, 29896, 29901, 13, 9651, 12020, 7865, 2392, 703, 1576, 25383, 9927, 1818, 367, 29871, 29896, 29899, 29928, 1159, 13, 4706, 565, 7431, 29898, 29891, 29897, 2804, 302, 29901, 13, 9651, 12020, 7865, 2392, 703, 16142, 2673, 29635, 1159, 13, 4706, 736, 343, 13, 13, 1678, 822, 10272, 29898, 1311, 29892, 921, 29892, 343, 3127, 29922, 29911, 1177, 29979, 29892, 2656, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 4721, 29899, 26017, 278, 18838, 279, 8837, 4636, 322, 7329, 675, 372, 363, 263, 731, 310, 3064, 13, 4706, 322, 443, 6327, 2365, 583, 29889, 13, 13, 4706, 584, 3207, 921, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 4954, 29898, 1983, 9422, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 7417, 10350, 310, 278, 848, 3291, 29889, 13, 13, 4706, 584, 3207, 343, 3127, 29901, 313, 25253, 29897, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 17336, 13, 9651, 450, 22477, 443, 6327, 2365, 583, 373, 278, 848, 3291, 472, 10350, 13, 9651, 4954, 29916, 29952, 1412, 4525, 1819, 674, 367, 2715, 297, 15448, 1535, 304, 278, 19640, 310, 13, 9651, 278, 18838, 279, 8837, 4636, 29889, 13, 13, 4706, 584, 3207, 2656, 29901, 313, 25253, 29897, 13, 9651, 10575, 278, 11916, 367, 12705, 1434, 20602, 278, 18838, 279, 8837, 13, 9651, 4636, 29973, 910, 508, 3275, 304, 901, 4825, 1711, 13714, 2582, 322, 411, 13, 9651, 777, 5608, 9623, 9562, 445, 508, 901, 16287, 635, 13, 9651, 8543, 29889, 20370, 982, 29892, 445, 7353, 338, 4502, 4153, 304, 13, 9651, 584, 9891, 18078, 5510, 29918, 27736, 1412, 313, 4381, 29901, 4954, 5574, 29952, 6348, 13, 13, 4706, 9995, 13, 4706, 396, 20969, 278, 1881, 10350, 29889, 13, 4706, 1583, 3032, 29916, 29892, 1583, 29889, 12772, 353, 1583, 29889, 5510, 29918, 27736, 29898, 29916, 29892, 2656, 29897, 13, 4706, 1018, 29901, 13, 9651, 1583, 3032, 29891, 3127, 353, 5785, 29898, 29891, 3127, 29897, 334, 7442, 29889, 2873, 29898, 2435, 29898, 29916, 876, 13, 4706, 5174, 20948, 29901, 13, 9651, 1583, 3032, 29891, 3127, 353, 1583, 3032, 3198, 29918, 6229, 5580, 29898, 29891, 3127, 9601, 1311, 29889, 12772, 29962, 13, 4706, 1583, 3032, 1867, 29918, 26017, 29898, 1068, 19290, 29897, 13, 13, 1678, 822, 903, 1867, 29918, 26017, 29898, 1311, 29892, 903, 7052, 29922, 29900, 29889, 29945, 29930, 9302, 29889, 1188, 29898, 29906, 29930, 9302, 29889, 1631, 22164, 13, 4706, 396, 11796, 29872, 278, 8466, 4636, 29889, 13, 4706, 476, 353, 1583, 29889, 17460, 29898, 1311, 3032, 29916, 7503, 29892, 6213, 1402, 1583, 3032, 29916, 29961, 8516, 29892, 584, 2314, 13, 4706, 476, 29961, 9302, 29889, 6051, 351, 29918, 513, 1575, 29918, 3166, 29898, 29968, 4638, 4619, 1583, 3032, 29891, 3127, 3579, 29871, 29906, 13, 13, 4706, 396, 383, 7168, 278, 4636, 322, 10272, 278, 1480, 29899, 4801, 837, 262, 424, 29889, 13, 4706, 7329, 29892, 903, 353, 1583, 3032, 19790, 353, 3060, 29918, 19790, 29898, 29968, 29892, 26556, 29918, 29874, 29922, 5574, 29897, 13, 4706, 1583, 3032, 3075, 353, 19691, 9302, 29889, 2083, 29898, 9302, 29889, 1188, 29898, 9302, 29889, 6051, 351, 29898, 19790, 4961, 718, 903, 7052, 29930, 2435, 29898, 1311, 3032, 29916, 876, 13, 13, 4706, 396, 16913, 278, 15712, 2106, 29889, 13, 4706, 1583, 29889, 12097, 287, 353, 5852, 13, 13, 1678, 822, 337, 26017, 29898, 1311, 29892, 2656, 29922, 8824, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 830, 29899, 26017, 263, 9251, 15712, 1904, 29889, 887, 1795, 864, 304, 437, 445, 565, 13, 4706, 278, 8466, 4128, 1735, 322, 278, 8466, 338, 301, 24025, 408, 4954, 3972, 1017, 29952, 1412, 13, 13, 4706, 584, 7529, 2656, 29901, 313, 25253, 29897, 13, 9651, 10575, 278, 11916, 367, 12705, 1434, 20602, 278, 18838, 279, 8837, 13, 9651, 4636, 29973, 313, 4381, 29901, 4954, 8824, 29952, 6348, 13, 13, 4706, 9995, 13, 4706, 565, 451, 313, 5349, 5552, 29898, 1311, 29892, 11119, 29916, 1159, 322, 756, 5552, 29898, 1311, 29892, 11119, 29891, 3127, 5783, 29901, 13, 9651, 12020, 24875, 2392, 703, 3492, 817, 304, 10272, 278, 1904, 937, 1159, 13, 4706, 736, 1583, 29889, 26017, 29898, 1311, 3032, 29916, 29892, 1583, 3032, 29891, 3127, 29892, 2656, 29922, 6605, 29892, 3579, 19290, 29897, 13, 13, 1678, 822, 903, 26017, 29918, 3083, 4561, 29898, 1311, 29892, 364, 1125, 13, 4706, 736, 1583, 3032, 3075, 448, 29871, 29900, 29889, 29945, 29930, 9302, 29889, 6333, 29898, 29878, 29889, 29911, 29892, 3060, 29918, 2929, 345, 29898, 1311, 3032, 19790, 29892, 364, 876, 13, 13, 1678, 822, 301, 29876, 5081, 22342, 29898, 1311, 29892, 343, 29892, 11813, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 11796, 29872, 278, 301, 29876, 29899, 5081, 22342, 310, 263, 731, 310, 13917, 1090, 278, 22477, 13, 4706, 1889, 1904, 29889, 887, 1818, 1246, 4954, 26017, 16159, 1434, 445, 740, 29889, 13, 13, 4706, 584, 3207, 343, 29901, 4954, 29898, 1983, 9422, 29892, 1723, 16159, 13, 9651, 450, 13917, 472, 278, 10350, 4944, 297, 278, 4954, 26017, 16159, 13, 9651, 4331, 29889, 13, 13, 4706, 584, 3207, 11813, 29901, 13, 9651, 960, 4954, 5574, 16159, 736, 8178, 27971, 2012, 310, 29263, 385, 13, 9651, 3682, 746, 727, 338, 385, 8340, 8466, 470, 5608, 9623, 13, 9651, 10672, 29889, 313, 4381, 29901, 4954, 8824, 29952, 6348, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 12097, 287, 29901, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 276, 26017, 580, 13, 9651, 5174, 313, 1917, 2392, 29892, 4342, 22461, 2392, 1125, 13, 18884, 565, 11813, 29901, 13, 462, 1678, 736, 448, 9302, 29889, 7192, 13, 18884, 12020, 13, 4706, 364, 353, 1583, 3032, 3198, 29918, 6229, 5580, 29898, 29891, 9601, 1311, 29889, 12772, 29962, 448, 1583, 29889, 12676, 29898, 1311, 3032, 29916, 29897, 13, 4706, 11148, 353, 1583, 3032, 26017, 29918, 3083, 4561, 29898, 29878, 29897, 13, 4706, 736, 11148, 565, 7442, 29889, 4492, 262, 568, 29898, 645, 29897, 1683, 448, 9302, 29889, 7192, 13, 13, 1678, 822, 4656, 29918, 3083, 5081, 22342, 29898, 1311, 29892, 343, 29892, 3964, 29879, 29922, 8516, 29892, 11813, 29922, 8824, 1125, 13, 4706, 9995, 13, 4706, 11796, 29872, 278, 16030, 310, 278, 301, 29876, 29899, 5081, 22342, 740, 408, 263, 740, 310, 13, 4706, 278, 8466, 4128, 29889, 13, 13, 4706, 584, 3207, 343, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 13, 9651, 450, 1051, 310, 13917, 472, 10350, 4954, 29916, 16159, 4944, 304, 278, 13, 9651, 584, 9891, 18078, 26017, 29952, 740, 29889, 13, 13, 4706, 584, 3207, 3964, 29879, 29901, 313, 25253, 29897, 13, 9651, 960, 366, 871, 864, 304, 10272, 278, 16030, 297, 777, 13391, 29892, 13, 9651, 1051, 963, 1244, 29889, 13, 13, 4706, 584, 3207, 11813, 29901, 13, 9651, 960, 4954, 5574, 16159, 736, 263, 16030, 310, 5225, 2012, 310, 29263, 385, 13, 9651, 3682, 746, 727, 338, 385, 8340, 8466, 470, 5608, 9623, 13, 9651, 10672, 29889, 313, 4381, 29901, 4954, 8824, 29952, 6348, 13, 13, 4706, 9995, 13, 4706, 396, 2648, 2322, 29892, 10272, 278, 16030, 297, 599, 13391, 29889, 13, 4706, 565, 3964, 29879, 338, 6213, 29901, 13, 9651, 3964, 29879, 353, 7442, 29889, 2873, 29898, 2435, 29898, 1311, 29889, 17460, 511, 26688, 29922, 11227, 29897, 13, 13, 4706, 396, 8561, 1854, 393, 278, 1904, 338, 15712, 322, 1018, 304, 337, 26017, 372, 565, 372, 29915, 29879, 13, 4706, 396, 26616, 29889, 13, 4706, 565, 451, 1583, 29889, 12097, 287, 29901, 13, 9651, 1018, 29901, 13, 18884, 1583, 29889, 276, 26017, 580, 13, 9651, 5174, 313, 1917, 2392, 29892, 4342, 22461, 2392, 1125, 13, 18884, 565, 11813, 29901, 13, 462, 1678, 736, 7442, 29889, 3298, 359, 29918, 4561, 29898, 6229, 29879, 29892, 26688, 29922, 7411, 29897, 13, 18884, 12020, 13, 13, 4706, 396, 20969, 278, 1881, 4559, 1051, 29889, 13, 4706, 364, 353, 1583, 3032, 3198, 29918, 6229, 5580, 29898, 29891, 9601, 1311, 29889, 12772, 29962, 448, 1583, 29889, 12676, 29898, 1311, 3032, 29916, 29897, 13, 13, 4706, 396, 4721, 29899, 26017, 777, 13879, 29889, 13, 4706, 15595, 353, 3060, 29918, 2929, 345, 29898, 1311, 3032, 19790, 29892, 364, 29897, 13, 4706, 476, 29887, 353, 1583, 29889, 17460, 29889, 5105, 29898, 1311, 3032, 29916, 7503, 29892, 6213, 1402, 1583, 3032, 29916, 29961, 8516, 29892, 584, 2314, 29961, 6229, 29879, 29962, 13, 13, 4706, 396, 21493, 975, 13391, 322, 10272, 278, 16030, 297, 1269, 697, 29889, 13, 4706, 330, 353, 7442, 29889, 6310, 29898, 2435, 29898, 29968, 29887, 876, 13, 4706, 363, 474, 29892, 413, 297, 26985, 29898, 29968, 29887, 1125, 13, 9651, 270, 353, 2533, 29898, 1958, 29898, 2892, 364, 29901, 7442, 29889, 6333, 29898, 2312, 29892, 364, 511, 15595, 7503, 29892, 6213, 29962, 334, 413, 876, 13, 9651, 270, 22361, 7442, 29889, 2083, 29898, 9302, 29889, 6051, 351, 29898, 1859, 29918, 2929, 345, 29898, 1311, 3032, 19790, 29892, 413, 4961, 13, 9651, 330, 29961, 29875, 29962, 353, 29871, 29900, 29889, 29945, 334, 270, 13, 13, 4706, 736, 330, 13, 13, 1678, 822, 8500, 29898, 1311, 29892, 343, 29892, 260, 1125, 13, 4706, 9995, 13, 4706, 11796, 29872, 278, 15047, 8500, 573, 4978, 310, 278, 1904, 29889, 13, 13, 4706, 584, 3207, 343, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 13, 9651, 450, 13917, 304, 4195, 278, 1904, 373, 29889, 13, 13, 4706, 584, 3207, 260, 29901, 4954, 29898, 593, 342, 29892, 3569, 29952, 470, 4954, 29898, 593, 342, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 10350, 988, 278, 8500, 573, 4978, 881, 367, 13, 9651, 15712, 29889, 13, 13, 4706, 16969, 263, 18761, 4954, 29898, 2589, 29892, 18838, 3569, 29952, 988, 13, 13, 4706, 334, 3579, 2589, 1068, 4954, 29898, 593, 342, 29892, 3569, 29952, 338, 278, 2099, 310, 278, 8500, 573, 4978, 29892, 322, 13, 4706, 334, 3579, 24542, 1068, 4954, 29898, 593, 342, 29892, 302, 1688, 3569, 29952, 338, 278, 8500, 573, 18838, 279, 8837, 29889, 13, 13, 4706, 9995, 13, 4706, 565, 451, 1583, 29889, 12097, 287, 29901, 13, 9651, 1583, 29889, 276, 26017, 580, 13, 13, 4706, 364, 353, 1583, 3032, 3198, 29918, 6229, 5580, 29898, 29891, 9601, 1311, 29889, 12772, 29962, 448, 1583, 29889, 12676, 29898, 1311, 3032, 29916, 29897, 13, 4706, 14492, 29892, 474, 353, 1583, 29889, 5510, 29918, 27736, 29898, 29873, 29892, 7700, 29897, 13, 4706, 15595, 353, 3060, 29918, 2929, 345, 29898, 1311, 3032, 19790, 29892, 364, 29897, 13, 13, 4706, 396, 11796, 29872, 278, 8500, 573, 2099, 29889, 13, 4706, 476, 10351, 353, 1583, 29889, 17460, 29898, 1311, 3032, 29916, 29961, 8516, 29892, 584, 1402, 14492, 7503, 29892, 6213, 2314, 13, 4706, 3887, 353, 7442, 29889, 6333, 29898, 29968, 10351, 29892, 15595, 29897, 718, 1583, 29889, 12676, 29898, 10351, 29897, 13, 13, 4706, 396, 11796, 29872, 278, 8500, 573, 18838, 279, 8837, 29889, 13, 4706, 18838, 353, 1583, 29889, 17460, 29898, 10351, 7503, 29892, 6213, 1402, 14492, 29961, 8516, 29892, 584, 2314, 13, 4706, 18838, 22361, 7442, 29889, 6333, 29898, 29968, 10351, 29892, 3060, 29918, 2929, 345, 29898, 1311, 3032, 19790, 29892, 476, 10351, 29889, 29911, 876, 13, 13, 4706, 736, 3887, 29892, 18838, 13, 13, 1678, 822, 4559, 29918, 1116, 3245, 29898, 1311, 29892, 343, 29892, 260, 29892, 2159, 29922, 29896, 1125, 13, 4706, 9995, 13, 4706, 18492, 11916, 515, 278, 8500, 573, 15047, 4978, 29889, 13, 13, 4706, 584, 3207, 343, 29901, 4954, 29898, 1983, 9422, 29892, 1723, 16159, 13, 9651, 450, 13917, 304, 4195, 278, 1904, 373, 29889, 13, 13, 4706, 584, 3207, 260, 29901, 4954, 29898, 593, 342, 29892, 1723, 16159, 470, 4954, 29898, 593, 342, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 10350, 988, 278, 8500, 573, 4978, 881, 367, 13, 9651, 15712, 29889, 13, 13, 4706, 584, 3207, 2159, 29901, 313, 25253, 29897, 13, 9651, 450, 1353, 310, 11916, 304, 4216, 29889, 313, 4381, 29901, 4954, 29896, 29952, 6348, 13, 13, 4706, 16969, 3579, 27736, 1068, 4954, 29898, 29940, 29892, 302, 1688, 3569, 1673, 263, 1051, 310, 27303, 472, 13, 4706, 10350, 2183, 491, 4954, 29873, 29952, 1412, 13, 13, 4706, 9995, 13, 4706, 3887, 29892, 18838, 353, 1583, 29889, 27711, 29898, 29891, 29892, 260, 29897, 13, 4706, 736, 1773, 27432, 403, 29918, 29887, 17019, 29918, 27736, 29898, 24542, 29892, 2159, 29892, 2099, 29922, 2589, 29897, 13, 13, 1678, 822, 4559, 29898, 1311, 29892, 260, 29892, 2159, 29922, 29896, 1125, 13, 4706, 9995, 13, 4706, 18492, 11916, 515, 278, 7536, 4978, 29889, 13, 13, 4706, 584, 3207, 260, 29901, 4954, 29898, 593, 342, 29892, 1723, 16159, 470, 4954, 29898, 593, 342, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 10350, 988, 278, 1904, 881, 367, 4559, 29881, 29889, 13, 13, 4706, 584, 3207, 2159, 29901, 313, 25253, 29897, 13, 9651, 450, 1353, 310, 11916, 304, 4216, 29889, 313, 4381, 29901, 4954, 29896, 29952, 6348, 13, 13, 4706, 16969, 3579, 27736, 1068, 4954, 29898, 29940, 29892, 302, 1688, 3569, 1673, 263, 1051, 310, 27303, 472, 13, 4706, 10350, 2183, 491, 4954, 29873, 29952, 1412, 13, 13, 4706, 9995, 13, 4706, 921, 29892, 903, 353, 1583, 29889, 5510, 29918, 27736, 29898, 29873, 29892, 7700, 29897, 13, 4706, 18838, 353, 1583, 29889, 657, 29918, 5344, 29898, 29916, 29897, 13, 4706, 736, 1773, 27432, 403, 29918, 29887, 17019, 29918, 27736, 29898, 24542, 29892, 2159, 29892, 2099, 29922, 1311, 29889, 12676, 29898, 29916, 876, 13, 13, 1678, 822, 679, 29918, 5344, 29898, 1311, 29892, 260, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 18838, 279, 8837, 4636, 472, 263, 2183, 731, 310, 7417, 10350, 29889, 13, 13, 4706, 584, 3207, 260, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 4954, 29898, 1983, 9422, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 1051, 310, 11916, 29889, 13, 13, 4706, 9995, 13, 4706, 364, 29892, 903, 353, 1583, 29889, 5510, 29918, 27736, 29898, 29873, 29892, 7700, 29897, 13, 4706, 736, 1583, 29889, 17460, 29898, 29878, 7503, 29892, 6213, 1402, 364, 29961, 8516, 29892, 584, 2314, 13, 13, 1678, 822, 24656, 29898, 1311, 29892, 921, 29892, 343, 29892, 343, 3127, 29922, 29911, 1177, 29979, 29892, 2656, 29922, 5574, 29892, 3964, 29879, 29922, 8516, 29892, 297, 29918, 1188, 29922, 5574, 29892, 13, 462, 26952, 29922, 5574, 29892, 3579, 19290, 1125, 13, 4706, 9995, 13, 4706, 319, 2560, 322, 451, 1935, 1091, 368, 16424, 1661, 29899, 10660, 13883, 5687, 363, 13, 4706, 278, 8466, 11266, 862, 279, 2527, 414, 29889, 13, 13, 4706, 584, 3207, 921, 29901, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 4954, 29898, 1983, 9422, 29892, 29871, 299, 326, 3569, 29952, 13, 9651, 450, 7417, 10350, 310, 278, 848, 3291, 29889, 13, 13, 4706, 584, 3207, 343, 29901, 4954, 29898, 1983, 9422, 29892, 1723, 16159, 13, 9651, 450, 13917, 472, 278, 10350, 4954, 29916, 29952, 1412, 13, 13, 4706, 584, 3207, 343, 3127, 29901, 313, 25253, 29897, 4954, 29898, 1983, 9422, 29892, 3569, 29952, 470, 17336, 13, 9651, 450, 22477, 443, 6327, 2365, 583, 373, 278, 848, 3291, 472, 10350, 13, 9651, 4954, 29916, 29952, 1412, 4525, 1819, 674, 367, 2715, 297, 15448, 1535, 304, 278, 19640, 310, 13, 9651, 278, 18838, 279, 8837, 4636, 29889, 13, 13, 4706, 584, 3207, 2656, 29901, 313, 25253, 29897, 13, 9651, 10575, 278, 11916, 367, 12705, 1434, 20602, 278, 18838, 279, 8837, 13, 9651, 4636, 29973, 13, 13, 4706, 584, 3207, 3964, 29879, 29901, 313, 25253, 29897, 13, 9651, 960, 366, 871, 864, 304, 24656, 975, 777, 4128, 29892, 1051, 1009, 13, 9651, 16285, 1244, 29889, 13, 13, 4706, 584, 3207, 297, 29918, 1188, 29901, 313, 25253, 29897, 4954, 29898, 2435, 29898, 17460, 511, 3569, 1673, 4954, 29898, 2435, 29898, 6229, 29879, 511, 3569, 29952, 470, 6120, 13, 9651, 960, 366, 864, 304, 6216, 278, 4128, 297, 278, 1480, 313, 1366, 508, 367, 5407, 13, 9651, 363, 4128, 393, 9273, 29915, 29873, 748, 8178, 29897, 6084, 393, 1244, 29889, 910, 13, 9651, 508, 367, 263, 2323, 7223, 5634, 262, 607, 1206, 372, 338, 12023, 304, 3394, 304, 13, 9651, 1432, 9927, 5634, 272, 372, 508, 367, 385, 1409, 310, 1045, 1772, 550, 29892, 697, 363, 1269, 13, 9651, 9927, 29889, 13, 13, 4706, 584, 3207, 26952, 29901, 313, 25253, 29897, 13, 9651, 17440, 278, 2582, 310, 278, 1246, 304, 584, 9891, 18078, 26167, 2272, 29889, 20640, 675, 29889, 1195, 326, 675, 6522, 13, 9651, 313, 4381, 29901, 4954, 5574, 29952, 6348, 13, 13, 4706, 16969, 4954, 29898, 862, 29879, 29892, 2582, 3569, 29952, 988, 4954, 862, 29879, 16159, 338, 278, 1051, 310, 27545, 13, 4706, 4128, 322, 4954, 9902, 16159, 338, 278, 2582, 1203, 4133, 491, 13, 4706, 584, 9891, 18078, 26167, 2272, 29889, 20640, 675, 29889, 1195, 326, 675, 1412, 13, 13, 4706, 9995, 13, 4706, 1583, 29889, 26017, 29898, 29916, 29892, 343, 3127, 29892, 2656, 29922, 6605, 29897, 13, 13, 4706, 396, 2648, 2322, 29892, 24656, 599, 278, 11266, 16744, 29889, 13, 4706, 565, 3964, 29879, 338, 6213, 29901, 13, 9651, 3964, 29879, 353, 7442, 29889, 2873, 29898, 2435, 29898, 1311, 29889, 17460, 511, 26688, 29922, 11227, 29897, 13, 4706, 3964, 29879, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 1311, 29889, 17460, 876, 29961, 6229, 29879, 29962, 13, 13, 4706, 396, 897, 284, 411, 11301, 3168, 29889, 13, 4706, 1018, 29901, 13, 9651, 7431, 29898, 262, 29918, 1188, 29897, 13, 4706, 5174, 20948, 29901, 13, 9651, 297, 29918, 1188, 353, 297, 29918, 1188, 334, 7442, 29889, 2873, 29918, 4561, 29898, 6229, 29879, 29892, 26688, 29922, 11227, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 7431, 29898, 262, 29918, 1188, 29897, 2804, 7431, 29898, 6229, 29879, 1125, 13, 18884, 12020, 24875, 2392, 703, 16142, 2673, 1051, 322, 1480, 11105, 29635, 1159, 13, 13, 4706, 396, 8878, 278, 11301, 3168, 29889, 13, 4706, 7602, 353, 7442, 29889, 2378, 4197, 2892, 921, 29901, 921, 363, 474, 297, 3464, 29898, 2435, 29898, 6229, 29879, 876, 2314, 13, 4706, 9849, 29894, 353, 7442, 29889, 2378, 4197, 2892, 921, 29901, 921, 363, 474, 297, 3464, 29898, 2435, 29898, 6229, 29879, 876, 2314, 13, 4706, 7602, 29961, 262, 29918, 1188, 29962, 353, 7442, 29889, 4548, 13, 4706, 9849, 29894, 29961, 262, 29918, 1188, 29962, 353, 7442, 29889, 1188, 13, 13, 4706, 396, 22402, 278, 12091, 740, 322, 16030, 29889, 13, 4706, 822, 302, 645, 29898, 862, 29879, 1125, 13, 9651, 363, 474, 29892, 285, 29892, 282, 297, 5951, 666, 29898, 6229, 29879, 29892, 7602, 29892, 610, 29879, 1125, 13, 18884, 1583, 29889, 17460, 29961, 29875, 29962, 353, 285, 29898, 29886, 29897, 13, 13, 9651, 11148, 353, 1583, 29889, 3083, 5081, 22342, 29898, 29891, 29892, 11813, 29922, 5574, 29897, 13, 9651, 565, 451, 7442, 29889, 4492, 262, 568, 29898, 645, 1125, 13, 18884, 736, 29871, 29896, 29872, 29906, 29945, 29871, 396, 450, 5994, 19427, 508, 29915, 29873, 5376, 411, 8275, 1907, 29889, 13, 9651, 736, 448, 645, 13, 13, 4706, 822, 4656, 29918, 29876, 645, 29898, 862, 29879, 1125, 13, 9651, 363, 474, 29892, 285, 29892, 282, 297, 5951, 666, 29898, 6229, 29879, 29892, 7602, 29892, 610, 29879, 1125, 13, 18884, 1583, 29889, 17460, 29961, 29875, 29962, 353, 285, 29898, 29886, 29897, 13, 9651, 736, 448, 1311, 29889, 5105, 29918, 3083, 5081, 22342, 29898, 29891, 29892, 3964, 29879, 29922, 6229, 29879, 29892, 11813, 29922, 5574, 29897, 13, 13, 4706, 396, 7525, 278, 13883, 29889, 13, 4706, 282, 29900, 353, 518, 29888, 29898, 29886, 29897, 363, 285, 29892, 282, 297, 5951, 666, 29898, 4144, 29894, 29892, 1583, 29889, 17460, 29889, 862, 29879, 29961, 6229, 29879, 2314, 29962, 13, 4706, 2582, 353, 1015, 29889, 1195, 326, 675, 29898, 29876, 645, 29892, 282, 29900, 29892, 432, 562, 29922, 5105, 29918, 29876, 645, 29892, 3579, 19290, 29897, 13, 13, 4706, 565, 26952, 29901, 13, 9651, 1596, 29898, 9902, 29889, 4906, 29897, 13, 13, 4706, 396, 10318, 278, 8466, 29889, 13, 4706, 363, 474, 29892, 285, 29892, 282, 297, 5951, 666, 29898, 6229, 29879, 29892, 7602, 29892, 2582, 29889, 29916, 1125, 13, 9651, 1583, 29889, 17460, 29961, 29875, 29962, 353, 285, 29898, 29886, 29897, 13, 13, 4706, 736, 1583, 29889, 17460, 29889, 862, 29879, 29961, 6229, 29879, 1402, 2582, 13, 13, 13, 1990, 903, 4381, 29918, 12676, 29898, 3318, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 995, 1125, 13, 4706, 1583, 29889, 1767, 353, 995, 13, 13, 1678, 822, 4770, 4804, 12035, 1311, 29892, 260, 1125, 13, 4706, 736, 1583, 29889, 1767, 718, 7442, 29889, 3298, 359, 29898, 2435, 29898, 29873, 511, 26688, 29922, 7411, 29897, 13, 2 ]
scaffoldgraph/vis/base.py
UCLCheminformatics/ScaffoldGraph
121
92361
<filename>scaffoldgraph/vis/base.py """ scaffoldgraph.vis.base """ import networkx as nx from abc import ABC from scaffoldgraph.core import ScaffoldGraph from scaffoldgraph.utils import canonize_smiles from .utils import remove_node_mol_images class Visualizer(ABC): """Base class for ScaffoldGraph visualizers. A Visualizer contains functions for creating visualizations of ScaffoldGraphs. See Also -------- scaffoldgraph.vis.notebook.cytoscape.CytoscapeVisualizer """ def __init__(self, graph, requires_tree=False, refresh_images=False): """Initialize the visualizer. Parameters ---------- graph : ScaffoldGraph ScaffoldGraph to visualize requires_tree : bool, optional Whether the visualizer requires a tree structure to create a visualization. refresh_images: bool, optional If True remove all embeded images from the input graph and regenerate when required. The default is False. """ self._requires_tree = requires_tree self._refresh = refresh_images self._graph = self._validate_graph(graph) @property def graph(self): """ScaffoldGraph: return the graph associated with the visualizer.""" return self._graph @graph.setter def graph(self, graph): self._graph = self._validate_graph(graph) def _validate_graph(self, graph): """Private: Validate a graph is suitable for visualizer.""" if not issubclass(type(graph), ScaffoldGraph): raise ValueError( f'{graph} must be a subclass of ScaffoldGraph' ) if self._requires_tree: if not nx.is_tree(graph) or nx.is_forest(graph): msg = '{} requires a tree/forest structured graph' msg.format(self.__class__.__name__) raise ValueError(msg) if self._refresh is True: remove_node_mol_images(graph) return graph def _subgraph_from_mol(self, molecule): """Private: Select a subgraph starting at a molecule node. Parameters ---------- molecule : str Molecule node identifier. Returns ------- subgraph : ScaffoldGraph A subgraph starting at `molecule`. """ G = self._graph if not G.molecule_in_graph(molecule): raise ValueError(f'molecule: {molecule} not in graph {G}') scaffolds = G.get_scaffolds_for_molecule(molecule) subgraph = G.subgraph([molecule] + scaffolds) return subgraph def _subgraph_from_scf(self, scaffold, traversal): """Private: Select a subgraph starting at a scaffold node. Parameters ---------- scaffold : str Scaffold node identifier. traversal : str {'parent', 'child', 'bidirectional'} The direction of traversal to create the subgraph. If 'bidirectional' both directions are considered. Returns ------- subgraph : ScaffoldGraph A subgraph starting at `scaffold`. """ G = self._graph query = canonize_smiles(scaffold) if not G.scaffold_in_graph(query): raise ValueError(f'scaffold: {query} not in graph {G}') if traversal == 'parent': nodes = G.get_parent_scaffolds(query) elif traversal == 'child': nodes = list(nx.descendants(G, query)) elif traversal == 'bidirectional': nodes = G.get_parent_scaffolds(query) nodes += list(nx.descendants(G, query)) else: msg = 'traversal must be one of {child, parent, bidirectional}' raise ValueError(msg) subgraph = G.subgraph([query] + nodes) return subgraph def __repr__(self): return '<{_cls} at {address}>'.format( _cls=self.__class__.__name__, address=hex(id(self)) )
[ 1, 529, 9507, 29958, 29879, 1113, 600, 1025, 4262, 29914, 1730, 29914, 3188, 29889, 2272, 13, 15945, 29908, 13, 29879, 1113, 600, 1025, 4262, 29889, 1730, 29889, 3188, 13, 15945, 29908, 13, 13, 5215, 3564, 29916, 408, 302, 29916, 13, 13, 3166, 25638, 1053, 16417, 13, 13, 3166, 885, 3470, 1025, 4262, 29889, 3221, 1053, 317, 1113, 600, 1025, 9527, 13, 3166, 885, 3470, 1025, 4262, 29889, 13239, 1053, 15355, 675, 29918, 3844, 5475, 13, 13, 3166, 869, 13239, 1053, 3349, 29918, 3177, 29918, 29885, 324, 29918, 8346, 13, 13, 13, 1990, 9249, 3950, 29898, 19658, 1125, 13, 1678, 9995, 5160, 770, 363, 317, 1113, 600, 1025, 9527, 7604, 19427, 29889, 13, 13, 1678, 319, 9249, 3950, 3743, 3168, 363, 4969, 7604, 17063, 13, 1678, 310, 317, 1113, 600, 1025, 9527, 29879, 29889, 13, 13, 1678, 2823, 3115, 13, 1678, 448, 26589, 13, 1678, 885, 3470, 1025, 4262, 29889, 1730, 29889, 1333, 19273, 29889, 1270, 29873, 359, 5738, 29889, 29907, 3637, 359, 5738, 16227, 3950, 13, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3983, 29892, 6858, 29918, 8336, 29922, 8824, 29892, 11086, 29918, 8346, 29922, 8824, 1125, 13, 4706, 9995, 6644, 6646, 278, 7604, 3950, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 3983, 584, 317, 1113, 600, 1025, 9527, 13, 9651, 317, 1113, 600, 1025, 9527, 304, 7604, 675, 13, 4706, 6858, 29918, 8336, 584, 6120, 29892, 13136, 13, 9651, 26460, 278, 7604, 3950, 6858, 263, 5447, 13, 9651, 3829, 304, 1653, 263, 7604, 2133, 29889, 13, 4706, 11086, 29918, 8346, 29901, 6120, 29892, 13136, 13, 9651, 960, 5852, 3349, 599, 8297, 287, 4558, 515, 278, 13, 9651, 1881, 3983, 322, 1072, 759, 403, 746, 3734, 29889, 13, 9651, 450, 2322, 338, 7700, 29889, 13, 13, 4706, 9995, 13, 4706, 1583, 3032, 276, 339, 2658, 29918, 8336, 353, 6858, 29918, 8336, 13, 4706, 1583, 3032, 22379, 353, 11086, 29918, 8346, 13, 4706, 1583, 3032, 4262, 353, 1583, 3032, 15480, 29918, 4262, 29898, 4262, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3983, 29898, 1311, 1125, 13, 4706, 9995, 29903, 1113, 600, 1025, 9527, 29901, 736, 278, 3983, 6942, 411, 278, 7604, 3950, 1213, 15945, 13, 4706, 736, 1583, 3032, 4262, 13, 13, 1678, 732, 4262, 29889, 842, 357, 13, 1678, 822, 3983, 29898, 1311, 29892, 3983, 1125, 13, 4706, 1583, 3032, 4262, 353, 1583, 3032, 15480, 29918, 4262, 29898, 4262, 29897, 13, 13, 1678, 822, 903, 15480, 29918, 4262, 29898, 1311, 29892, 3983, 1125, 13, 4706, 9995, 25207, 29901, 15758, 403, 263, 3983, 338, 13907, 363, 7604, 3950, 1213, 15945, 13, 4706, 565, 451, 338, 1491, 1990, 29898, 1853, 29898, 4262, 511, 317, 1113, 600, 1025, 9527, 1125, 13, 9651, 12020, 7865, 2392, 29898, 13, 18884, 285, 29915, 29912, 4262, 29913, 1818, 367, 263, 19481, 310, 317, 1113, 600, 1025, 9527, 29915, 13, 9651, 1723, 13, 4706, 565, 1583, 3032, 276, 339, 2658, 29918, 8336, 29901, 13, 9651, 565, 451, 302, 29916, 29889, 275, 29918, 8336, 29898, 4262, 29897, 470, 302, 29916, 29889, 275, 29918, 1454, 342, 29898, 4262, 1125, 13, 18884, 10191, 353, 525, 8875, 6858, 263, 5447, 29914, 1454, 342, 2281, 2955, 3983, 29915, 13, 18884, 10191, 29889, 4830, 29898, 1311, 17255, 1990, 1649, 17255, 978, 1649, 29897, 13, 18884, 12020, 7865, 2392, 29898, 7645, 29897, 13, 4706, 565, 1583, 3032, 22379, 338, 5852, 29901, 13, 9651, 3349, 29918, 3177, 29918, 29885, 324, 29918, 8346, 29898, 4262, 29897, 13, 4706, 736, 3983, 13, 13, 1678, 822, 903, 1491, 4262, 29918, 3166, 29918, 29885, 324, 29898, 1311, 29892, 13206, 29883, 1297, 1125, 13, 4706, 9995, 25207, 29901, 7605, 263, 1014, 4262, 6257, 472, 263, 13206, 29883, 1297, 2943, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 13206, 29883, 1297, 584, 851, 13, 9651, 341, 1772, 29883, 1297, 2943, 15882, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1014, 4262, 584, 317, 1113, 600, 1025, 9527, 13, 9651, 319, 1014, 4262, 6257, 472, 421, 29885, 1772, 29883, 1297, 1412, 13, 13, 4706, 9995, 13, 4706, 402, 353, 1583, 3032, 4262, 13, 4706, 565, 451, 402, 29889, 29885, 1772, 29883, 1297, 29918, 262, 29918, 4262, 29898, 29885, 1772, 29883, 1297, 1125, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29915, 29885, 1772, 29883, 1297, 29901, 426, 29885, 1772, 29883, 1297, 29913, 451, 297, 3983, 426, 29954, 29913, 1495, 13, 4706, 885, 3470, 3361, 353, 402, 29889, 657, 29918, 29879, 1113, 600, 3361, 29918, 1454, 29918, 29885, 1772, 29883, 1297, 29898, 29885, 1772, 29883, 1297, 29897, 13, 4706, 1014, 4262, 353, 402, 29889, 1491, 4262, 4197, 29885, 1772, 29883, 1297, 29962, 718, 885, 3470, 3361, 29897, 13, 4706, 736, 1014, 4262, 13, 13, 1678, 822, 903, 1491, 4262, 29918, 3166, 29918, 1557, 29888, 29898, 1311, 29892, 885, 3470, 1025, 29892, 13310, 284, 1125, 13, 4706, 9995, 25207, 29901, 7605, 263, 1014, 4262, 6257, 472, 263, 885, 3470, 1025, 2943, 29889, 13, 13, 4706, 12662, 2699, 13, 4706, 448, 1378, 29899, 13, 4706, 885, 3470, 1025, 584, 851, 13, 9651, 317, 1113, 600, 1025, 2943, 15882, 29889, 13, 4706, 13310, 284, 584, 851, 11117, 3560, 742, 525, 5145, 742, 525, 23883, 8684, 284, 10827, 13, 9651, 450, 5305, 310, 13310, 284, 304, 1653, 278, 1014, 4262, 29889, 13, 9651, 960, 525, 23883, 8684, 284, 29915, 1716, 18112, 526, 5545, 29889, 13, 13, 4706, 16969, 13, 4706, 448, 22158, 13, 4706, 1014, 4262, 584, 317, 1113, 600, 1025, 9527, 13, 9651, 319, 1014, 4262, 6257, 472, 421, 29879, 1113, 600, 1025, 1412, 13, 13, 4706, 9995, 13, 4706, 402, 353, 1583, 3032, 4262, 13, 4706, 2346, 353, 15355, 675, 29918, 3844, 5475, 29898, 29879, 1113, 600, 1025, 29897, 13, 4706, 565, 451, 402, 29889, 29879, 1113, 600, 1025, 29918, 262, 29918, 4262, 29898, 1972, 1125, 13, 9651, 12020, 7865, 2392, 29898, 29888, 29915, 29879, 1113, 600, 1025, 29901, 426, 1972, 29913, 451, 297, 3983, 426, 29954, 29913, 1495, 13, 4706, 565, 13310, 284, 1275, 525, 3560, 2396, 13, 9651, 7573, 353, 402, 29889, 657, 29918, 3560, 29918, 29879, 1113, 600, 3361, 29898, 1972, 29897, 13, 4706, 25342, 13310, 284, 1275, 525, 5145, 2396, 13, 9651, 7573, 353, 1051, 29898, 23818, 29889, 14273, 355, 1934, 29898, 29954, 29892, 2346, 876, 13, 4706, 25342, 13310, 284, 1275, 525, 23883, 8684, 284, 2396, 13, 9651, 7573, 353, 402, 29889, 657, 29918, 3560, 29918, 29879, 1113, 600, 3361, 29898, 1972, 29897, 13, 9651, 7573, 4619, 1051, 29898, 23818, 29889, 14273, 355, 1934, 29898, 29954, 29892, 2346, 876, 13, 4706, 1683, 29901, 13, 9651, 10191, 353, 525, 3018, 874, 284, 1818, 367, 697, 310, 426, 5145, 29892, 3847, 29892, 21000, 8684, 284, 10162, 13, 9651, 12020, 7865, 2392, 29898, 7645, 29897, 13, 4706, 1014, 4262, 353, 402, 29889, 1491, 4262, 4197, 1972, 29962, 718, 7573, 29897, 13, 4706, 736, 1014, 4262, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 12801, 29912, 29918, 25932, 29913, 472, 426, 7328, 17428, 4286, 4830, 29898, 13, 9651, 903, 25932, 29922, 1311, 17255, 1990, 1649, 17255, 978, 1649, 29892, 13, 9651, 3211, 29922, 20970, 29898, 333, 29898, 1311, 876, 13, 4706, 1723, 13, 2 ]
xicam/core/tests/test_workflow.py
mrakitin/Xi-cam.core
0
176108
<gh_stars>0 from xicam.core.execution.workflow import Workflow from xicam.core.execution.daskexecutor import DaskExecutor from xicam.plugins import Input, Output, ProcessingPlugin from pyFAI.detectors import Pilatus2M import numpy as np from pyFAI import AzimuthalIntegrator, units from scipy.ndimage import morphology import fabio class ThresholdMaskPlugin(ProcessingPlugin): data = Input(description="Frame image data", type=np.ndarray) minimum = Input(description="Threshold floor", type=int) maximum = Input(description="Threshold ceiling", type=int) neighborhood = Input( description="Neighborhood size in pixels for morphological opening. Only clusters of this size" " that fail the threshold are masked", type=int, ) mask = Output(description="Thresholded mask (1 is masked)", type=np.ndarray) def evaluate(self): self.mask.value = np.logical_or(self.data.value < self.minimum.value, self.data.value > self.maximum.value) y, x = np.ogrid[ -self.neighborhood.value : self.neighborhood.value + 1, -self.neighborhood.value : self.neighborhood.value + 1 ] kernel = x ** 2 + y ** 2 <= self.neighborhood.value ** 2 morphology.binary_opening(self.mask.value, kernel, output=self.mask.value) # write-back to mask class QIntegratePlugin(ProcessingPlugin): integrator = Input(description="A PyFAI.AzimuthalIntegrator object", type=AzimuthalIntegrator) data = Input(description="2d array representing intensity for each pixel", type=np.ndarray) npt = Input(description="Number of bins along q") polz_factor = Input(description="Polarization factor for correction", type=float) unit = Input(description="Output units for q", type=[str, units.Unit], default="q_A^-1") radial_range = Input( description="The lower and upper range of the radial unit. If not provided, range is simply " "(data.min(), data.max()). Values outside the range are ignored.", type=tuple, ) azimuth_range = Input( description="The lower and upper range of the azimuthal angle in degree. If not provided, " "range is simply (data.min(), data.max()). Values outside the range are ignored." ) mask = Input(description="Array (same size as image) with 1 for masked pixels, and 0 for valid pixels", type=np.ndarray) dark = Input(description="Dark noise image", type=np.ndarray) flat = Input(description="Flat field image", type=np.ndarray) method = Input( description='Can be "numpy", "cython", "BBox" or "splitpixel", "lut", "csr", "nosplit_csr", ' '"full_csr", "lut_ocl" and "csr_ocl" if you want to go on GPU. To Specify the device: ' '"csr_ocl_1,2"', type=str, ) normalization_factor = Input(description="Value of a normalization monitor", type=float) q = Output(description="Q bin center positions", type=np.array) I = Output(description="Binned/pixel-split integrated intensity", type=np.array) def evaluate(self): self.q.value, self.I.value = self.integrator.value().integrate1d( data=self.data.value, npt=self.npt.value, radial_range=self.radial_range.value, azimuth_range=self.azimuth_range.value, mask=self.mask.value, polarization_factor=self.polz_factor.value, dark=self.dark.value, flat=self.flat.value, method=self.method.value, unit=self.unit.value, normalization_factor=self.normalization_factor.value, ) def test_SAXSWorkflow(): # create processes thresholdmask = ThresholdMaskPlugin() qintegrate = QIntegratePlugin() # set values AI = AzimuthalIntegrator( 0.283, 5.24e-3, 4.085e-3, 0, 0, 0, 1.72e-4, 1.72e-4, detector=Pilatus2M(), wavelength=1.23984e-10 ) thresholdmask.data.value = fabio.open("/Users/hari/Downloads/AGB_5S_USE_2_2m.edf").data def AI_func(): from pyFAI.detectors import Pilatus2M from pyFAI import AzimuthalIntegrator, units return AzimuthalIntegrator( 0.283, 5.24e-3, 4.085e-3, 0, 0, 0, 1.72e-4, 1.72e-4, detector=Pilatus2M(), wavelength=1.23984e-10 ) qintegrate.integrator.value = AI_func qintegrate.npt.value = 1000 thresholdmask.minimum.value = 30 thresholdmask.maximum.value = 1e12 qintegrate.data.value = fabio.open("/Users/hari/Downloads/AGB_5S_USE_2_2m.edf").data thresholdmask.neighborhood.value = 1 qintegrate.normalization_factor.value = 0.5 qintegrate.method.value = "numpy" # connect processes thresholdmask.mask.connect(qintegrate.mask) # add processes to workflow wf = Workflow("QIntegrate") wf.addProcess(thresholdmask) wf.addProcess(qintegrate) dsk = DaskExecutor() result = dsk.execute(wf) print(result) def test_autoconnect(): # create processes thresholdmask = ThresholdMaskPlugin() qintegrate = QIntegratePlugin() # set values AI = AzimuthalIntegrator( 0.283, 5.24e-3, 4.085e-3, 0, 0, 0, 1.72e-4, 1.72e-4, detector=Pilatus2M(), wavelength=1.23984e-10 ) thresholdmask.data.value = fabio.open("/Users/hari/Downloads/AGB_5S_USE_2_2m.edf").data qintegrate.integrator.value = AI qintegrate.npt.value = 1000 thresholdmask.minimum.value = 30 thresholdmask.maximum.value = 1e12 # add process to workflow
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 921, 293, 314, 29889, 3221, 29889, 22256, 29889, 1287, 1731, 1053, 5244, 1731, 13, 3166, 921, 293, 314, 29889, 3221, 29889, 22256, 29889, 17370, 446, 29916, 687, 3406, 1053, 360, 1278, 13366, 13, 13, 3166, 921, 293, 314, 29889, 12800, 1053, 10567, 29892, 10604, 29892, 10554, 292, 16288, 13, 13, 3166, 11451, 4519, 29902, 29889, 4801, 11142, 1053, 14970, 2389, 29906, 29924, 13, 5215, 12655, 408, 7442, 13, 3166, 11451, 4519, 29902, 1053, 4709, 326, 2806, 284, 23573, 1061, 29892, 10340, 13, 3166, 4560, 2272, 29889, 299, 3027, 1053, 18131, 3002, 13, 5215, 10135, 601, 13, 13, 13, 1990, 498, 12268, 19832, 16288, 29898, 7032, 292, 16288, 1125, 13, 1678, 848, 353, 10567, 29898, 8216, 543, 4308, 1967, 848, 613, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 1678, 9212, 353, 10567, 29898, 8216, 543, 1349, 12268, 11904, 613, 1134, 29922, 524, 29897, 13, 1678, 7472, 353, 10567, 29898, 8216, 543, 1349, 12268, 2257, 6504, 613, 1134, 29922, 524, 29897, 13, 1678, 18403, 353, 10567, 29898, 13, 4706, 6139, 543, 8139, 1141, 4089, 6614, 2159, 297, 17036, 363, 18131, 5996, 8718, 29889, 9333, 24554, 310, 445, 2159, 29908, 13, 4706, 376, 393, 4418, 278, 16897, 526, 11105, 287, 613, 13, 4706, 1134, 29922, 524, 29892, 13, 1678, 1723, 13, 1678, 11105, 353, 10604, 29898, 8216, 543, 1349, 12268, 287, 11105, 313, 29896, 338, 11105, 287, 19123, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 13, 1678, 822, 14707, 29898, 1311, 1125, 13, 4706, 1583, 29889, 13168, 29889, 1767, 353, 7442, 29889, 1188, 936, 29918, 272, 29898, 1311, 29889, 1272, 29889, 1767, 529, 1583, 29889, 1195, 12539, 29889, 1767, 29892, 1583, 29889, 1272, 29889, 1767, 1405, 1583, 29889, 27525, 398, 29889, 1767, 29897, 13, 13, 4706, 343, 29892, 921, 353, 7442, 29889, 468, 2429, 29961, 13, 9651, 448, 1311, 29889, 484, 1141, 4089, 6614, 29889, 1767, 584, 1583, 29889, 484, 1141, 4089, 6614, 29889, 1767, 718, 29871, 29896, 29892, 448, 1311, 29889, 484, 1141, 4089, 6614, 29889, 1767, 584, 1583, 29889, 484, 1141, 4089, 6614, 29889, 1767, 718, 29871, 29896, 13, 4706, 4514, 13, 4706, 8466, 353, 921, 3579, 29871, 29906, 718, 343, 3579, 29871, 29906, 5277, 1583, 29889, 484, 1141, 4089, 6614, 29889, 1767, 3579, 29871, 29906, 13, 13, 4706, 18131, 3002, 29889, 19541, 29918, 3150, 292, 29898, 1311, 29889, 13168, 29889, 1767, 29892, 8466, 29892, 1962, 29922, 1311, 29889, 13168, 29889, 1767, 29897, 29871, 396, 2436, 29899, 1627, 304, 11105, 13, 13, 13, 1990, 660, 23573, 403, 16288, 29898, 7032, 292, 16288, 1125, 13, 1678, 3990, 1061, 353, 10567, 29898, 8216, 543, 29909, 10772, 4519, 29902, 29889, 16748, 326, 2806, 284, 23573, 1061, 1203, 613, 1134, 29922, 16748, 326, 2806, 284, 23573, 1061, 29897, 13, 1678, 848, 353, 10567, 29898, 8216, 543, 29906, 29881, 1409, 15783, 26171, 363, 1269, 15526, 613, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 1678, 302, 415, 353, 10567, 29898, 8216, 543, 4557, 310, 289, 1144, 3412, 3855, 1159, 13, 1678, 1248, 29920, 29918, 19790, 353, 10567, 29898, 8216, 543, 7713, 279, 2133, 7329, 363, 26385, 613, 1134, 29922, 7411, 29897, 13, 1678, 5190, 353, 10567, 29898, 8216, 543, 6466, 10340, 363, 3855, 613, 1134, 11759, 710, 29892, 10340, 29889, 8325, 1402, 2322, 543, 29939, 29918, 29909, 21583, 29896, 1159, 13, 1678, 28373, 29918, 3881, 353, 10567, 29898, 13, 4706, 6139, 543, 1576, 5224, 322, 7568, 3464, 310, 278, 28373, 5190, 29889, 960, 451, 4944, 29892, 3464, 338, 3763, 376, 13, 4706, 18227, 1272, 29889, 1195, 3285, 848, 29889, 3317, 16655, 2630, 1041, 5377, 278, 3464, 526, 17262, 19602, 13, 4706, 1134, 29922, 23583, 29892, 13, 1678, 1723, 13, 1678, 2698, 326, 2806, 29918, 3881, 353, 10567, 29898, 13, 4706, 6139, 543, 1576, 5224, 322, 7568, 3464, 310, 278, 2698, 326, 2806, 284, 10696, 297, 7426, 29889, 960, 451, 4944, 29892, 376, 13, 4706, 376, 3881, 338, 3763, 313, 1272, 29889, 1195, 3285, 848, 29889, 3317, 16655, 2630, 1041, 5377, 278, 3464, 526, 17262, 1213, 13, 1678, 1723, 13, 1678, 11105, 353, 10567, 29898, 8216, 543, 2588, 313, 17642, 2159, 408, 1967, 29897, 411, 29871, 29896, 363, 11105, 287, 17036, 29892, 322, 29871, 29900, 363, 2854, 17036, 613, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 1678, 6501, 353, 10567, 29898, 8216, 543, 29928, 935, 11462, 1967, 613, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 1678, 12151, 353, 10567, 29898, 8216, 543, 29943, 5066, 1746, 1967, 613, 1134, 29922, 9302, 29889, 299, 2378, 29897, 13, 1678, 1158, 353, 10567, 29898, 13, 4706, 6139, 2433, 6028, 367, 376, 23749, 613, 376, 1270, 386, 265, 613, 376, 29933, 3313, 29908, 470, 376, 5451, 29886, 15711, 613, 376, 29880, 329, 613, 376, 2395, 29878, 613, 376, 17639, 2830, 29918, 2395, 29878, 613, 525, 13, 4706, 18793, 8159, 29918, 2395, 29878, 613, 376, 29880, 329, 29918, 542, 29880, 29908, 322, 376, 2395, 29878, 29918, 542, 29880, 29908, 565, 366, 864, 304, 748, 373, 22796, 29889, 1763, 12048, 1598, 278, 4742, 29901, 525, 13, 4706, 18793, 2395, 29878, 29918, 542, 29880, 29918, 29896, 29892, 29906, 29908, 742, 13, 4706, 1134, 29922, 710, 29892, 13, 1678, 1723, 13, 1678, 4226, 2133, 29918, 19790, 353, 10567, 29898, 8216, 543, 1917, 310, 263, 4226, 2133, 11819, 613, 1134, 29922, 7411, 29897, 13, 1678, 3855, 353, 10604, 29898, 8216, 543, 29984, 9016, 4818, 11909, 613, 1134, 29922, 9302, 29889, 2378, 29897, 13, 1678, 306, 353, 10604, 29898, 8216, 543, 29933, 27464, 29914, 29886, 15711, 29899, 5451, 23387, 26171, 613, 1134, 29922, 9302, 29889, 2378, 29897, 13, 13, 1678, 822, 14707, 29898, 1311, 1125, 13, 4706, 1583, 29889, 29939, 29889, 1767, 29892, 1583, 29889, 29902, 29889, 1767, 353, 1583, 29889, 14146, 1061, 29889, 1767, 2141, 14146, 403, 29896, 29881, 29898, 13, 9651, 848, 29922, 1311, 29889, 1272, 29889, 1767, 29892, 13, 9651, 302, 415, 29922, 1311, 29889, 29876, 415, 29889, 1767, 29892, 13, 9651, 28373, 29918, 3881, 29922, 1311, 29889, 3665, 616, 29918, 3881, 29889, 1767, 29892, 13, 9651, 2698, 326, 2806, 29918, 3881, 29922, 1311, 29889, 834, 326, 2806, 29918, 3881, 29889, 1767, 29892, 13, 9651, 11105, 29922, 1311, 29889, 13168, 29889, 1767, 29892, 13, 9651, 16755, 2133, 29918, 19790, 29922, 1311, 29889, 3733, 29920, 29918, 19790, 29889, 1767, 29892, 13, 9651, 6501, 29922, 1311, 29889, 26031, 29889, 1767, 29892, 13, 9651, 12151, 29922, 1311, 29889, 20620, 29889, 1767, 29892, 13, 9651, 1158, 29922, 1311, 29889, 5696, 29889, 1767, 29892, 13, 9651, 5190, 29922, 1311, 29889, 5441, 29889, 1767, 29892, 13, 9651, 4226, 2133, 29918, 19790, 29922, 1311, 29889, 8945, 2133, 29918, 19790, 29889, 1767, 29892, 13, 4706, 1723, 13, 13, 13, 1753, 1243, 29918, 29903, 6604, 29903, 5531, 1731, 7295, 13, 1678, 396, 1653, 10174, 13, 1678, 16897, 13168, 353, 498, 12268, 19832, 16288, 580, 13, 1678, 3855, 14146, 403, 353, 660, 23573, 403, 16288, 580, 13, 13, 1678, 396, 731, 1819, 13, 1678, 319, 29902, 353, 4709, 326, 2806, 284, 23573, 1061, 29898, 13, 308, 29900, 29889, 29906, 29947, 29941, 29892, 29871, 29945, 29889, 29906, 29946, 29872, 29899, 29941, 29892, 29871, 29946, 29889, 29900, 29947, 29945, 29872, 29899, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 1439, 3019, 29922, 29925, 309, 2389, 29906, 29924, 3285, 281, 6447, 1477, 29922, 29896, 29889, 29906, 29941, 29929, 29947, 29946, 29872, 29899, 29896, 29900, 13, 1678, 1723, 13, 1678, 16897, 13168, 29889, 1272, 29889, 1767, 353, 10135, 601, 29889, 3150, 11974, 5959, 29914, 29882, 1306, 29914, 6767, 18132, 29914, 29909, 7210, 29918, 29945, 29903, 29918, 17171, 29918, 29906, 29918, 29906, 29885, 29889, 287, 29888, 2564, 1272, 13, 13, 1678, 822, 319, 29902, 29918, 9891, 7295, 13, 4706, 515, 11451, 4519, 29902, 29889, 4801, 11142, 1053, 14970, 2389, 29906, 29924, 13, 4706, 515, 11451, 4519, 29902, 1053, 4709, 326, 2806, 284, 23573, 1061, 29892, 10340, 13, 13, 4706, 736, 4709, 326, 2806, 284, 23573, 1061, 29898, 13, 632, 29900, 29889, 29906, 29947, 29941, 29892, 29871, 29945, 29889, 29906, 29946, 29872, 29899, 29941, 29892, 29871, 29946, 29889, 29900, 29947, 29945, 29872, 29899, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 1439, 3019, 29922, 29925, 309, 2389, 29906, 29924, 3285, 281, 6447, 1477, 29922, 29896, 29889, 29906, 29941, 29929, 29947, 29946, 29872, 29899, 29896, 29900, 13, 4706, 1723, 13, 13, 1678, 3855, 14146, 403, 29889, 14146, 1061, 29889, 1767, 353, 319, 29902, 29918, 9891, 13, 1678, 3855, 14146, 403, 29889, 29876, 415, 29889, 1767, 353, 29871, 29896, 29900, 29900, 29900, 13, 1678, 16897, 13168, 29889, 1195, 12539, 29889, 1767, 353, 29871, 29941, 29900, 13, 1678, 16897, 13168, 29889, 27525, 398, 29889, 1767, 353, 29871, 29896, 29872, 29896, 29906, 13, 13, 1678, 3855, 14146, 403, 29889, 1272, 29889, 1767, 353, 10135, 601, 29889, 3150, 11974, 5959, 29914, 29882, 1306, 29914, 6767, 18132, 29914, 29909, 7210, 29918, 29945, 29903, 29918, 17171, 29918, 29906, 29918, 29906, 29885, 29889, 287, 29888, 2564, 1272, 13, 1678, 16897, 13168, 29889, 484, 1141, 4089, 6614, 29889, 1767, 353, 29871, 29896, 13, 1678, 3855, 14146, 403, 29889, 8945, 2133, 29918, 19790, 29889, 1767, 353, 29871, 29900, 29889, 29945, 13, 1678, 3855, 14146, 403, 29889, 5696, 29889, 1767, 353, 376, 23749, 29908, 13, 13, 1678, 396, 4511, 10174, 13, 1678, 16897, 13168, 29889, 13168, 29889, 6915, 29898, 29939, 14146, 403, 29889, 13168, 29897, 13, 13, 1678, 396, 788, 10174, 304, 27321, 13, 1678, 281, 29888, 353, 5244, 1731, 703, 29984, 23573, 403, 1159, 13, 1678, 281, 29888, 29889, 1202, 7032, 29898, 386, 12268, 13168, 29897, 13, 1678, 281, 29888, 29889, 1202, 7032, 29898, 29939, 14146, 403, 29897, 13, 13, 1678, 270, 808, 353, 360, 1278, 13366, 580, 13, 1678, 1121, 353, 270, 808, 29889, 7978, 29898, 29893, 29888, 29897, 13, 1678, 1596, 29898, 2914, 29897, 13, 13, 13, 1753, 1243, 29918, 6921, 6915, 7295, 13, 1678, 396, 1653, 10174, 13, 1678, 16897, 13168, 353, 498, 12268, 19832, 16288, 580, 13, 1678, 3855, 14146, 403, 353, 660, 23573, 403, 16288, 580, 13, 13, 1678, 396, 731, 1819, 13, 1678, 319, 29902, 353, 4709, 326, 2806, 284, 23573, 1061, 29898, 13, 308, 29900, 29889, 29906, 29947, 29941, 29892, 29871, 29945, 29889, 29906, 29946, 29872, 29899, 29941, 29892, 29871, 29946, 29889, 29900, 29947, 29945, 29872, 29899, 29941, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 29871, 29896, 29889, 29955, 29906, 29872, 29899, 29946, 29892, 1439, 3019, 29922, 29925, 309, 2389, 29906, 29924, 3285, 281, 6447, 1477, 29922, 29896, 29889, 29906, 29941, 29929, 29947, 29946, 29872, 29899, 29896, 29900, 13, 1678, 1723, 13, 1678, 16897, 13168, 29889, 1272, 29889, 1767, 353, 10135, 601, 29889, 3150, 11974, 5959, 29914, 29882, 1306, 29914, 6767, 18132, 29914, 29909, 7210, 29918, 29945, 29903, 29918, 17171, 29918, 29906, 29918, 29906, 29885, 29889, 287, 29888, 2564, 1272, 13, 1678, 3855, 14146, 403, 29889, 14146, 1061, 29889, 1767, 353, 319, 29902, 13, 1678, 3855, 14146, 403, 29889, 29876, 415, 29889, 1767, 353, 29871, 29896, 29900, 29900, 29900, 13, 1678, 16897, 13168, 29889, 1195, 12539, 29889, 1767, 353, 29871, 29941, 29900, 13, 1678, 16897, 13168, 29889, 27525, 398, 29889, 1767, 353, 29871, 29896, 29872, 29896, 29906, 13, 13, 1678, 396, 788, 1889, 304, 27321, 13, 2 ]
main.py
Matthewk01/Snake-AI
0
5836
import pygame from game.game_logic.game import Game import matplotlib.pyplot as plt def main(): scores_history = [] GAME_COUNT = 2 for i in range(GAME_COUNT): game = Game(400, "Snake AI") score = game.start() scores_history.append(score) print("Game:", i) plt.ylim(0, 36) plt.plot(range(len(scores_history)), scores_history) plt.ylabel('Snake length') plt.xlabel('Game count') plt.show() if __name__ == "__main__": main()
[ 1, 1053, 22028, 13, 3166, 3748, 29889, 11802, 29918, 19227, 29889, 11802, 1053, 8448, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 19435, 29918, 18434, 353, 5159, 13, 1678, 402, 25797, 29918, 18736, 353, 29871, 29906, 13, 1678, 363, 474, 297, 3464, 29898, 12739, 2303, 29918, 18736, 1125, 13, 4706, 3748, 353, 8448, 29898, 29946, 29900, 29900, 29892, 376, 29903, 21040, 319, 29902, 1159, 13, 4706, 8158, 353, 3748, 29889, 2962, 580, 13, 4706, 19435, 29918, 18434, 29889, 4397, 29898, 13628, 29897, 13, 4706, 1596, 703, 14199, 29901, 613, 474, 29897, 13, 13, 1678, 14770, 29889, 29891, 2576, 29898, 29900, 29892, 29871, 29941, 29953, 29897, 13, 1678, 14770, 29889, 5317, 29898, 3881, 29898, 2435, 29898, 1557, 2361, 29918, 18434, 8243, 19435, 29918, 18434, 29897, 13, 1678, 14770, 29889, 29891, 1643, 877, 29903, 21040, 3309, 1495, 13, 1678, 14770, 29889, 29916, 1643, 877, 14199, 2302, 1495, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
mutagen/dsf.py
lucienimmink/scanner.py
2
1609436
<filename>mutagen/dsf.py # -*- coding: utf-8 -*- # Copyright (C) 2017 <NAME> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. """Read and write DSF audio stream information and tags.""" import sys import struct from io import BytesIO from mutagen import FileType, StreamInfo from mutagen._util import cdata, MutagenError, loadfile, \ convert_error, reraise, endswith from mutagen.id3 import ID3 from mutagen.id3._util import ID3NoHeaderError, error as ID3Error __all__ = ["DSF", "Open", "delete"] class error(MutagenError): pass class DSFChunk(object): """A generic chunk of a DSFFile.""" chunk_offset = 0 chunk_header = " " chunk_size = -1 def __init__(self, fileobj, create=False): self.fileobj = fileobj if not create: self.chunk_offset = fileobj.tell() self.load() def load(self): raise NotImplementedError def write(self): raise NotImplementedError class DSDChunk(DSFChunk): """Represents the first chunk of a DSF file""" CHUNK_SIZE = 28 total_size = 0 offset_metdata_chunk = 0 def __init__(self, fileobj, create=False): super(DSDChunk, self).__init__(fileobj, create) if create: self.chunk_header = b"DSD " self.chunk_size = DSDChunk.CHUNK_SIZE def load(self): data = self.fileobj.read(DSDChunk.CHUNK_SIZE) if len(data) != DSDChunk.CHUNK_SIZE: raise error("DSF chunk truncated") self.chunk_header = data[0:4] if self.chunk_header != b"DSD ": raise error("DSF dsd header not found") self.chunk_size = cdata.ulonglong_le(data[4:12]) if self.chunk_size != DSDChunk.CHUNK_SIZE: raise error("DSF dsd header size mismatch") self.total_size = cdata.ulonglong_le(data[12:20]) self.offset_metdata_chunk = cdata.ulonglong_le(data[20:28]) def write(self): f = BytesIO() f.write(self.chunk_header) f.write(struct.pack("<Q", DSDChunk.CHUNK_SIZE)) f.write(struct.pack("<Q", self.total_size)) f.write(struct.pack("<Q", self.offset_metdata_chunk)) self.fileobj.seek(self.chunk_offset) self.fileobj.write(f.getvalue()) def pprint(self): return (u"DSD Chunk (Total file size = %d, " u"Pointer to Metadata chunk = %d)" % ( self.total_size, self.offset_metdata_chunk)) class FormatChunk(DSFChunk): CHUNK_SIZE = 52 VERSION = 1 FORMAT_DSD_RAW = 0 """Format ID: DSD Raw""" format_version = VERSION format_id = FORMAT_DSD_RAW channel_type = 1 channel_num = 1 sampling_frequency = 2822400 bits_per_sample = 1 sample_count = 0 block_size_per_channel = 4096 def __init__(self, fileobj, create=False): super(FormatChunk, self).__init__(fileobj, create) if create: self.chunk_header = b"fmt " self.chunk_size = FormatChunk.CHUNK_SIZE def load(self): data = self.fileobj.read(FormatChunk.CHUNK_SIZE) if len(data) != FormatChunk.CHUNK_SIZE: raise error("DSF chunk truncated") self.chunk_header = data[0:4] if self.chunk_header != b"fmt ": raise error("DSF fmt header not found") self.chunk_size = cdata.ulonglong_le(data[4:12]) if self.chunk_size != FormatChunk.CHUNK_SIZE: raise error("DSF dsd header size mismatch") self.format_version = cdata.uint_le(data[12:16]) if self.format_version != FormatChunk.VERSION: raise error("Unsupported format version") self.format_id = cdata.uint_le(data[16:20]) if self.format_id != FormatChunk.FORMAT_DSD_RAW: raise error("Unsupported format ID") self.channel_type = cdata.uint_le(data[20:24]) self.channel_num = cdata.uint_le(data[24:28]) self.sampling_frequency = cdata.uint_le(data[28:32]) self.bits_per_sample = cdata.uint_le(data[32:36]) self.sample_count = cdata.ulonglong_le(data[36:44]) def pprint(self): return u"fmt Chunk (Channel Type = %d, Channel Num = %d, " \ u"Sampling Frequency = %d, %.2f seconds)" % \ (self.channel_type, self.channel_num, self.sampling_frequency, self.length) class DataChunk(DSFChunk): CHUNK_SIZE = 12 data = "" def __init__(self, fileobj, create=False): super(DataChunk, self).__init__(fileobj, create) if create: self.chunk_header = b"data" self.chunk_size = DataChunk.CHUNK_SIZE def load(self): data = self.fileobj.read(DataChunk.CHUNK_SIZE) if len(data) != DataChunk.CHUNK_SIZE: raise error("DSF chunk truncated") self.chunk_header = data[0:4] if self.chunk_header != b"data": raise error("DSF data header not found") self.chunk_size = cdata.ulonglong_le(data[4:12]) if self.chunk_size < DataChunk.CHUNK_SIZE: raise error("DSF data header size mismatch") def pprint(self): return u"data Chunk (Chunk Offset = %d, Chunk Size = %d)" % ( self.chunk_offset, self.chunk_size) class _DSFID3(ID3): """A DSF file with ID3v2 tags""" @convert_error(IOError, error) def _pre_load_header(self, fileobj): fileobj.seek(0) id3_location = DSDChunk(fileobj).offset_metdata_chunk if id3_location == 0: raise ID3NoHeaderError("File has no existing ID3 tag") fileobj.seek(id3_location) @convert_error(IOError, error) @loadfile(writable=True) def save(self, filething=None, v2_version=4, v23_sep='/', padding=None): """Save ID3v2 data to the DSF file""" fileobj = filething.fileobj fileobj.seek(0) dsd_header = DSDChunk(fileobj) if dsd_header.offset_metdata_chunk == 0: # create a new ID3 chunk at the end of the file fileobj.seek(0, 2) # store reference to ID3 location dsd_header.offset_metdata_chunk = fileobj.tell() dsd_header.write() try: data = self._prepare_data( fileobj, dsd_header.offset_metdata_chunk, self.size, v2_version, v23_sep, padding) except ID3Error as e: reraise(error, e, sys.exc_info()[2]) fileobj.seek(dsd_header.offset_metdata_chunk) fileobj.write(data) fileobj.truncate() # Update total file size dsd_header.total_size = fileobj.tell() dsd_header.write() class DSFInfo(StreamInfo): """DSF audio stream information. Information is parsed from the fmt chunk of the DSF file. Attributes: length (`float`): audio length, in seconds. channels (`int`): The number of audio channels. sample_rate (`int`): Sampling frequency, in Hz. (2822400, 5644800, 11289600, or 22579200) bits_per_sample (`int`): The audio sample size. bitrate (`int`): The audio bitrate. """ def __init__(self, fmt_chunk): self.fmt_chunk = fmt_chunk @property def length(self): return float(self.fmt_chunk.sample_count) / self.sample_rate @property def channels(self): return self.fmt_chunk.channel_num @property def sample_rate(self): return self.fmt_chunk.sampling_frequency @property def bits_per_sample(self): return self.fmt_chunk.bits_per_sample @property def bitrate(self): return self.sample_rate * self.bits_per_sample * self.channels def pprint(self): return u"%d channel DSF @ %d bits, %s Hz, %.2f seconds" % ( self.channels, self.bits_per_sample, self.sample_rate, self.length) class DSFFile(object): dsd_chunk = None fmt_chunk = None data_chunk = None def __init__(self, fileobj): self.dsd_chunk = DSDChunk(fileobj) self.fmt_chunk = FormatChunk(fileobj) self.data_chunk = DataChunk(fileobj) class DSF(FileType): """An DSF audio file. Arguments: filething (filething) Attributes: info (`DSFInfo`) tags (`mutagen.id3.ID3Tags` or `None`) """ _mimes = ["audio/dsf"] @staticmethod def score(filename, fileobj, header): return header.startswith(b"DSD ") * 2 + \ endswith(filename.lower(), ".dsf") def add_tags(self): """Add a DSF tag block to the file.""" if self.tags is None: self.tags = _DSFID3() else: raise error("an ID3 tag already exists") @convert_error(IOError, error) @loadfile() def load(self, filething, **kwargs): dsf_file = DSFFile(filething.fileobj) try: self.tags = _DSFID3(filething.fileobj, **kwargs) except ID3NoHeaderError: self.tags = None except ID3Error as e: raise error(e) else: self.tags.filename = self.filename self.info = DSFInfo(dsf_file.fmt_chunk) @loadfile(writable=True) def delete(self, filething=None): self.tags = None delete(filething) @convert_error(IOError, error) @loadfile(method=False, writable=True) def delete(filething): """Remove tags from a file. Args: filething (filething) Raises: mutagen.MutagenError """ dsf_file = DSFFile(filething.fileobj) if dsf_file.dsd_chunk.offset_metdata_chunk != 0: id3_location = dsf_file.dsd_chunk.offset_metdata_chunk dsf_file.dsd_chunk.offset_metdata_chunk = 0 dsf_file.dsd_chunk.write() filething.fileobj.seek(id3_location) filething.fileobj.truncate() Open = DSF
[ 1, 529, 9507, 29958, 6149, 5370, 29914, 29881, 4668, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 14187, 1266, 313, 29907, 29897, 29871, 29906, 29900, 29896, 29955, 29871, 529, 5813, 29958, 13, 29937, 13, 29937, 910, 1824, 338, 3889, 7047, 29936, 366, 508, 2654, 391, 2666, 372, 322, 29914, 272, 6623, 13, 29937, 372, 1090, 278, 4958, 310, 278, 15143, 4593, 5236, 19245, 408, 6369, 491, 13, 29937, 278, 12362, 18540, 10606, 29936, 2845, 1873, 29871, 29906, 310, 278, 19245, 29892, 470, 13, 29937, 313, 271, 596, 2984, 29897, 738, 2678, 1873, 29889, 13, 13, 15945, 29908, 6359, 322, 2436, 360, 20322, 10348, 4840, 2472, 322, 8282, 1213, 15945, 13, 13, 13, 5215, 10876, 13, 5215, 2281, 13, 3166, 12013, 1053, 2648, 2167, 5971, 13, 13, 3166, 5478, 5370, 1053, 3497, 1542, 29892, 13763, 3401, 13, 3166, 5478, 5370, 3032, 4422, 1053, 274, 1272, 29892, 20749, 5370, 2392, 29892, 2254, 1445, 29892, 320, 13, 1678, 3588, 29918, 2704, 29892, 364, 1572, 895, 29892, 10614, 2541, 13, 3166, 5478, 5370, 29889, 333, 29941, 1053, 3553, 29941, 13, 3166, 5478, 5370, 29889, 333, 29941, 3032, 4422, 1053, 3553, 29941, 3782, 7850, 2392, 29892, 1059, 408, 3553, 29941, 2392, 13, 13, 13, 1649, 497, 1649, 353, 6796, 8452, 29943, 613, 376, 6585, 613, 376, 8143, 3108, 13, 13, 13, 1990, 1059, 29898, 29924, 329, 5370, 2392, 1125, 13, 1678, 1209, 13, 13, 13, 1990, 360, 20322, 1451, 2960, 29898, 3318, 1125, 13, 1678, 9995, 29909, 10035, 19875, 310, 263, 360, 20322, 2283, 1213, 15945, 13, 13, 1678, 19875, 29918, 10289, 353, 29871, 29900, 13, 1678, 19875, 29918, 6672, 353, 376, 1678, 376, 13, 1678, 19875, 29918, 2311, 353, 448, 29896, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 5415, 29892, 1653, 29922, 8824, 1125, 13, 4706, 1583, 29889, 1445, 5415, 353, 934, 5415, 13, 13, 4706, 565, 451, 1653, 29901, 13, 9651, 1583, 29889, 29812, 29918, 10289, 353, 934, 5415, 29889, 29873, 514, 580, 13, 9651, 1583, 29889, 1359, 580, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 1678, 822, 2436, 29898, 1311, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 13, 13, 13, 1990, 360, 7230, 1451, 2960, 29898, 8452, 29943, 1451, 2960, 1125, 13, 1678, 9995, 1123, 4569, 1237, 278, 937, 19875, 310, 263, 360, 20322, 934, 15945, 29908, 13, 13, 1678, 5868, 3904, 29968, 29918, 14226, 353, 29871, 29906, 29947, 13, 13, 1678, 3001, 29918, 2311, 353, 29871, 29900, 13, 1678, 9210, 29918, 2527, 1272, 29918, 29812, 353, 29871, 29900, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 5415, 29892, 1653, 29922, 8824, 1125, 13, 4706, 2428, 29898, 29928, 7230, 1451, 2960, 29892, 1583, 467, 1649, 2344, 12035, 1445, 5415, 29892, 1653, 29897, 13, 13, 4706, 565, 1653, 29901, 13, 9651, 1583, 29889, 29812, 29918, 6672, 353, 289, 29908, 29928, 7230, 376, 13, 9651, 1583, 29889, 29812, 29918, 2311, 353, 360, 7230, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1445, 5415, 29889, 949, 29898, 29928, 7230, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29897, 13, 4706, 565, 7431, 29898, 1272, 29897, 2804, 360, 7230, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 19875, 21022, 630, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 6672, 353, 848, 29961, 29900, 29901, 29946, 29962, 13, 4706, 565, 1583, 29889, 29812, 29918, 6672, 2804, 289, 29908, 29928, 7230, 29242, 13, 9651, 12020, 1059, 703, 8452, 29943, 270, 4928, 4839, 451, 1476, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 2311, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29946, 29901, 29896, 29906, 2314, 13, 4706, 565, 1583, 29889, 29812, 29918, 2311, 2804, 360, 7230, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 270, 4928, 4839, 2159, 29635, 1159, 13, 13, 4706, 1583, 29889, 7827, 29918, 2311, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29896, 29906, 29901, 29906, 29900, 2314, 13, 4706, 1583, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29906, 29900, 29901, 29906, 29947, 2314, 13, 13, 1678, 822, 2436, 29898, 1311, 1125, 13, 4706, 285, 353, 2648, 2167, 5971, 580, 13, 4706, 285, 29889, 3539, 29898, 1311, 29889, 29812, 29918, 6672, 29897, 13, 4706, 285, 29889, 3539, 29898, 4984, 29889, 4058, 28945, 29984, 613, 360, 7230, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 876, 13, 4706, 285, 29889, 3539, 29898, 4984, 29889, 4058, 28945, 29984, 613, 1583, 29889, 7827, 29918, 2311, 876, 13, 4706, 285, 29889, 3539, 29898, 4984, 29889, 4058, 28945, 29984, 613, 1583, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 876, 13, 13, 4706, 1583, 29889, 1445, 5415, 29889, 344, 1416, 29898, 1311, 29889, 29812, 29918, 10289, 29897, 13, 4706, 1583, 29889, 1445, 5415, 29889, 3539, 29898, 29888, 29889, 657, 1767, 3101, 13, 13, 1678, 822, 282, 2158, 29898, 1311, 1125, 13, 4706, 736, 313, 29884, 29908, 29928, 7230, 678, 2960, 313, 11536, 934, 2159, 353, 1273, 29881, 29892, 376, 13, 18884, 318, 29908, 14516, 304, 4737, 7221, 19875, 353, 1273, 29881, 5513, 1273, 313, 13, 462, 1678, 1583, 29889, 7827, 29918, 2311, 29892, 1583, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 876, 13, 13, 13, 1990, 19191, 1451, 2960, 29898, 8452, 29943, 1451, 2960, 1125, 13, 13, 1678, 5868, 3904, 29968, 29918, 14226, 353, 29871, 29945, 29906, 13, 13, 1678, 478, 1001, 13381, 353, 29871, 29896, 13, 13, 1678, 383, 12054, 1299, 29918, 29928, 7230, 29918, 4717, 29956, 353, 29871, 29900, 13, 1678, 9995, 5809, 3553, 29901, 360, 7230, 22038, 15945, 29908, 13, 13, 1678, 3402, 29918, 3259, 353, 478, 1001, 13381, 13, 1678, 3402, 29918, 333, 353, 383, 12054, 1299, 29918, 29928, 7230, 29918, 4717, 29956, 13, 1678, 8242, 29918, 1853, 353, 29871, 29896, 13, 1678, 8242, 29918, 1949, 353, 29871, 29896, 13, 1678, 23460, 29918, 10745, 23860, 353, 29871, 29906, 29947, 29906, 29906, 29946, 29900, 29900, 13, 1678, 9978, 29918, 546, 29918, 11249, 353, 29871, 29896, 13, 1678, 4559, 29918, 2798, 353, 29871, 29900, 13, 1678, 2908, 29918, 2311, 29918, 546, 29918, 12719, 353, 29871, 29946, 29900, 29929, 29953, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 5415, 29892, 1653, 29922, 8824, 1125, 13, 4706, 2428, 29898, 5809, 1451, 2960, 29892, 1583, 467, 1649, 2344, 12035, 1445, 5415, 29892, 1653, 29897, 13, 13, 4706, 565, 1653, 29901, 13, 9651, 1583, 29889, 29812, 29918, 6672, 353, 289, 29908, 23479, 376, 13, 9651, 1583, 29889, 29812, 29918, 2311, 353, 19191, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1445, 5415, 29889, 949, 29898, 5809, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29897, 13, 4706, 565, 7431, 29898, 1272, 29897, 2804, 19191, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 19875, 21022, 630, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 6672, 353, 848, 29961, 29900, 29901, 29946, 29962, 13, 4706, 565, 1583, 29889, 29812, 29918, 6672, 2804, 289, 29908, 23479, 29242, 13, 9651, 12020, 1059, 703, 8452, 29943, 19200, 4839, 451, 1476, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 2311, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29946, 29901, 29896, 29906, 2314, 13, 4706, 565, 1583, 29889, 29812, 29918, 2311, 2804, 19191, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 270, 4928, 4839, 2159, 29635, 1159, 13, 13, 4706, 1583, 29889, 4830, 29918, 3259, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29896, 29906, 29901, 29896, 29953, 2314, 13, 4706, 565, 1583, 29889, 4830, 29918, 3259, 2804, 19191, 1451, 2960, 29889, 16358, 29901, 13, 9651, 12020, 1059, 703, 25807, 29884, 3016, 287, 3402, 1873, 1159, 13, 13, 4706, 1583, 29889, 4830, 29918, 333, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29896, 29953, 29901, 29906, 29900, 2314, 13, 4706, 565, 1583, 29889, 4830, 29918, 333, 2804, 19191, 1451, 2960, 29889, 19094, 1299, 29918, 29928, 7230, 29918, 4717, 29956, 29901, 13, 9651, 12020, 1059, 703, 25807, 29884, 3016, 287, 3402, 3553, 1159, 13, 13, 4706, 1583, 29889, 12719, 29918, 1853, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29906, 29900, 29901, 29906, 29946, 2314, 13, 4706, 1583, 29889, 12719, 29918, 1949, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29906, 29946, 29901, 29906, 29947, 2314, 13, 4706, 1583, 29889, 13445, 10335, 29918, 10745, 23860, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29906, 29947, 29901, 29941, 29906, 2314, 13, 4706, 1583, 29889, 14836, 29918, 546, 29918, 11249, 353, 274, 1272, 29889, 13470, 29918, 280, 29898, 1272, 29961, 29941, 29906, 29901, 29941, 29953, 2314, 13, 4706, 1583, 29889, 11249, 29918, 2798, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29941, 29953, 29901, 29946, 29946, 2314, 13, 13, 1678, 822, 282, 2158, 29898, 1311, 1125, 13, 4706, 736, 318, 29908, 23479, 678, 2960, 313, 13599, 5167, 353, 1273, 29881, 29892, 17368, 11848, 353, 1273, 29881, 29892, 376, 320, 13, 1669, 318, 29908, 22966, 10335, 3878, 23860, 353, 1273, 29881, 29892, 18695, 29906, 29888, 6923, 5513, 1273, 320, 13, 1669, 313, 1311, 29889, 12719, 29918, 1853, 29892, 1583, 29889, 12719, 29918, 1949, 29892, 1583, 29889, 13445, 10335, 29918, 10745, 23860, 29892, 13, 18884, 1583, 29889, 2848, 29897, 13, 13, 13, 1990, 3630, 1451, 2960, 29898, 8452, 29943, 1451, 2960, 1125, 13, 13, 1678, 5868, 3904, 29968, 29918, 14226, 353, 29871, 29896, 29906, 13, 13, 1678, 848, 353, 5124, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 5415, 29892, 1653, 29922, 8824, 1125, 13, 4706, 2428, 29898, 1469, 1451, 2960, 29892, 1583, 467, 1649, 2344, 12035, 1445, 5415, 29892, 1653, 29897, 13, 13, 4706, 565, 1653, 29901, 13, 9651, 1583, 29889, 29812, 29918, 6672, 353, 289, 29908, 1272, 29908, 13, 9651, 1583, 29889, 29812, 29918, 2311, 353, 3630, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 4706, 848, 353, 1583, 29889, 1445, 5415, 29889, 949, 29898, 1469, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29897, 13, 4706, 565, 7431, 29898, 1272, 29897, 2804, 3630, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 19875, 21022, 630, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 6672, 353, 848, 29961, 29900, 29901, 29946, 29962, 13, 4706, 565, 1583, 29889, 29812, 29918, 6672, 2804, 289, 29908, 1272, 1115, 13, 9651, 12020, 1059, 703, 8452, 29943, 848, 4839, 451, 1476, 1159, 13, 13, 4706, 1583, 29889, 29812, 29918, 2311, 353, 274, 1272, 29889, 352, 549, 5426, 29918, 280, 29898, 1272, 29961, 29946, 29901, 29896, 29906, 2314, 13, 4706, 565, 1583, 29889, 29812, 29918, 2311, 529, 3630, 1451, 2960, 29889, 3210, 3904, 29968, 29918, 14226, 29901, 13, 9651, 12020, 1059, 703, 8452, 29943, 848, 4839, 2159, 29635, 1159, 13, 13, 1678, 822, 282, 2158, 29898, 1311, 1125, 13, 4706, 736, 318, 29908, 1272, 678, 2960, 313, 1451, 2960, 5947, 842, 353, 1273, 29881, 29892, 678, 2960, 21179, 353, 1273, 29881, 5513, 1273, 313, 13, 9651, 1583, 29889, 29812, 29918, 10289, 29892, 1583, 29889, 29812, 29918, 2311, 29897, 13, 13, 13, 1990, 903, 8452, 29943, 1367, 29941, 29898, 1367, 29941, 1125, 13, 1678, 9995, 29909, 360, 20322, 934, 411, 3553, 29941, 29894, 29906, 8282, 15945, 29908, 13, 13, 1678, 732, 13441, 29918, 2704, 29898, 5971, 2392, 29892, 1059, 29897, 13, 1678, 822, 903, 1457, 29918, 1359, 29918, 6672, 29898, 1311, 29892, 934, 5415, 1125, 13, 4706, 934, 5415, 29889, 344, 1416, 29898, 29900, 29897, 13, 4706, 1178, 29941, 29918, 5479, 353, 360, 7230, 1451, 2960, 29898, 1445, 5415, 467, 10289, 29918, 2527, 1272, 29918, 29812, 13, 4706, 565, 1178, 29941, 29918, 5479, 1275, 29871, 29900, 29901, 13, 9651, 12020, 3553, 29941, 3782, 7850, 2392, 703, 2283, 756, 694, 5923, 3553, 29941, 4055, 1159, 13, 13, 4706, 934, 5415, 29889, 344, 1416, 29898, 333, 29941, 29918, 5479, 29897, 13, 13, 1678, 732, 13441, 29918, 2704, 29898, 5971, 2392, 29892, 1059, 29897, 13, 1678, 732, 1359, 1445, 29898, 8231, 519, 29922, 5574, 29897, 13, 1678, 822, 4078, 29898, 1311, 29892, 934, 1918, 29922, 8516, 29892, 325, 29906, 29918, 3259, 29922, 29946, 29892, 325, 29906, 29941, 29918, 19570, 2433, 29914, 742, 7164, 29922, 8516, 1125, 13, 4706, 9995, 11371, 3553, 29941, 29894, 29906, 848, 304, 278, 360, 20322, 934, 15945, 29908, 13, 13, 4706, 934, 5415, 353, 934, 1918, 29889, 1445, 5415, 13, 4706, 934, 5415, 29889, 344, 1416, 29898, 29900, 29897, 13, 13, 4706, 270, 4928, 29918, 6672, 353, 360, 7230, 1451, 2960, 29898, 1445, 5415, 29897, 13, 4706, 565, 270, 4928, 29918, 6672, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 1275, 29871, 29900, 29901, 13, 9651, 396, 1653, 263, 716, 3553, 29941, 19875, 472, 278, 1095, 310, 278, 934, 13, 9651, 934, 5415, 29889, 344, 1416, 29898, 29900, 29892, 29871, 29906, 29897, 13, 13, 9651, 396, 3787, 3407, 304, 3553, 29941, 4423, 13, 9651, 270, 4928, 29918, 6672, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 353, 934, 5415, 29889, 29873, 514, 580, 13, 9651, 270, 4928, 29918, 6672, 29889, 3539, 580, 13, 13, 4706, 1018, 29901, 13, 9651, 848, 353, 1583, 3032, 19125, 29918, 1272, 29898, 13, 18884, 934, 5415, 29892, 270, 4928, 29918, 6672, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 29892, 1583, 29889, 2311, 29892, 13, 18884, 325, 29906, 29918, 3259, 29892, 325, 29906, 29941, 29918, 19570, 29892, 7164, 29897, 13, 4706, 5174, 3553, 29941, 2392, 408, 321, 29901, 13, 9651, 364, 1572, 895, 29898, 2704, 29892, 321, 29892, 10876, 29889, 735, 29883, 29918, 3888, 580, 29961, 29906, 2314, 13, 13, 4706, 934, 5415, 29889, 344, 1416, 29898, 29881, 4928, 29918, 6672, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 29897, 13, 4706, 934, 5415, 29889, 3539, 29898, 1272, 29897, 13, 4706, 934, 5415, 29889, 509, 4661, 403, 580, 13, 13, 4706, 396, 10318, 3001, 934, 2159, 13, 4706, 270, 4928, 29918, 6672, 29889, 7827, 29918, 2311, 353, 934, 5415, 29889, 29873, 514, 580, 13, 4706, 270, 4928, 29918, 6672, 29889, 3539, 580, 13, 13, 13, 1990, 360, 20322, 3401, 29898, 3835, 3401, 1125, 13, 1678, 9995, 8452, 29943, 10348, 4840, 2472, 29889, 13, 13, 1678, 10343, 338, 21213, 515, 278, 19200, 19875, 310, 278, 360, 20322, 934, 29889, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 3309, 6695, 7411, 29952, 1125, 10348, 3309, 29892, 297, 6923, 29889, 13, 4706, 18196, 6695, 524, 29952, 1125, 450, 1353, 310, 10348, 18196, 29889, 13, 4706, 4559, 29918, 10492, 6695, 524, 29952, 1125, 13, 9651, 3685, 10335, 10868, 29892, 297, 379, 29920, 29889, 13, 9651, 313, 29906, 29947, 29906, 29906, 29946, 29900, 29900, 29892, 29871, 29945, 29953, 29946, 29946, 29947, 29900, 29900, 29892, 29871, 29896, 29896, 29906, 29947, 29929, 29953, 29900, 29900, 29892, 470, 29871, 29906, 29906, 29945, 29955, 29929, 29906, 29900, 29900, 29897, 13, 4706, 9978, 29918, 546, 29918, 11249, 6695, 524, 29952, 1125, 450, 10348, 4559, 2159, 29889, 13, 4706, 2586, 10492, 6695, 524, 29952, 1125, 450, 10348, 2586, 10492, 29889, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19200, 29918, 29812, 1125, 13, 4706, 1583, 29889, 23479, 29918, 29812, 353, 19200, 29918, 29812, 13, 13, 1678, 732, 6799, 13, 1678, 822, 3309, 29898, 1311, 1125, 13, 4706, 736, 5785, 29898, 1311, 29889, 23479, 29918, 29812, 29889, 11249, 29918, 2798, 29897, 847, 1583, 29889, 11249, 29918, 10492, 13, 13, 1678, 732, 6799, 13, 1678, 822, 18196, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 23479, 29918, 29812, 29889, 12719, 29918, 1949, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4559, 29918, 10492, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 23479, 29918, 29812, 29889, 13445, 10335, 29918, 10745, 23860, 13, 13, 1678, 732, 6799, 13, 1678, 822, 9978, 29918, 546, 29918, 11249, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 23479, 29918, 29812, 29889, 14836, 29918, 546, 29918, 11249, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2586, 10492, 29898, 1311, 1125, 13, 4706, 736, 1583, 29889, 11249, 29918, 10492, 334, 1583, 29889, 14836, 29918, 546, 29918, 11249, 334, 1583, 29889, 305, 12629, 13, 13, 1678, 822, 282, 2158, 29898, 1311, 1125, 13, 4706, 736, 318, 29908, 29995, 29881, 8242, 360, 20322, 732, 1273, 29881, 9978, 29892, 1273, 29879, 379, 29920, 29892, 18695, 29906, 29888, 6923, 29908, 1273, 313, 13, 9651, 1583, 29889, 305, 12629, 29892, 1583, 29889, 14836, 29918, 546, 29918, 11249, 29892, 1583, 29889, 11249, 29918, 10492, 29892, 1583, 29889, 2848, 29897, 13, 13, 13, 1990, 360, 20322, 2283, 29898, 3318, 1125, 13, 13, 1678, 270, 4928, 29918, 29812, 353, 6213, 13, 1678, 19200, 29918, 29812, 353, 6213, 13, 1678, 848, 29918, 29812, 353, 6213, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 934, 5415, 1125, 13, 4706, 1583, 29889, 29881, 4928, 29918, 29812, 353, 360, 7230, 1451, 2960, 29898, 1445, 5415, 29897, 13, 4706, 1583, 29889, 23479, 29918, 29812, 353, 19191, 1451, 2960, 29898, 1445, 5415, 29897, 13, 4706, 1583, 29889, 1272, 29918, 29812, 353, 3630, 1451, 2960, 29898, 1445, 5415, 29897, 13, 13, 13, 1990, 360, 20322, 29898, 2283, 1542, 1125, 13, 1678, 9995, 2744, 360, 20322, 10348, 934, 29889, 13, 13, 1678, 11842, 9331, 29901, 13, 4706, 934, 1918, 313, 1445, 1918, 29897, 13, 13, 1678, 6212, 5026, 29901, 13, 4706, 5235, 6695, 8452, 29943, 3401, 6348, 13, 4706, 8282, 6695, 6149, 5370, 29889, 333, 29941, 29889, 1367, 29941, 28089, 29952, 470, 421, 8516, 6348, 13, 1678, 9995, 13, 13, 1678, 903, 29885, 1355, 353, 6796, 18494, 29914, 29881, 4668, 3108, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 8158, 29898, 9507, 29892, 934, 5415, 29892, 4839, 1125, 13, 4706, 736, 4839, 29889, 27382, 2541, 29898, 29890, 29908, 29928, 7230, 16521, 334, 29871, 29906, 718, 320, 13, 9651, 10614, 2541, 29898, 9507, 29889, 13609, 3285, 11393, 29881, 4668, 1159, 13, 13, 1678, 822, 788, 29918, 11338, 29898, 1311, 1125, 13, 4706, 9995, 2528, 263, 360, 20322, 4055, 2908, 304, 278, 934, 1213, 15945, 13, 13, 4706, 565, 1583, 29889, 11338, 338, 6213, 29901, 13, 9651, 1583, 29889, 11338, 353, 903, 8452, 29943, 1367, 29941, 580, 13, 4706, 1683, 29901, 13, 9651, 12020, 1059, 703, 273, 3553, 29941, 4055, 2307, 4864, 1159, 13, 13, 1678, 732, 13441, 29918, 2704, 29898, 5971, 2392, 29892, 1059, 29897, 13, 1678, 732, 1359, 1445, 580, 13, 1678, 822, 2254, 29898, 1311, 29892, 934, 1918, 29892, 3579, 19290, 1125, 13, 4706, 270, 4668, 29918, 1445, 353, 360, 20322, 2283, 29898, 1445, 1918, 29889, 1445, 5415, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 1583, 29889, 11338, 353, 903, 8452, 29943, 1367, 29941, 29898, 1445, 1918, 29889, 1445, 5415, 29892, 3579, 19290, 29897, 13, 4706, 5174, 3553, 29941, 3782, 7850, 2392, 29901, 13, 9651, 1583, 29889, 11338, 353, 6213, 13, 4706, 5174, 3553, 29941, 2392, 408, 321, 29901, 13, 9651, 12020, 1059, 29898, 29872, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 11338, 29889, 9507, 353, 1583, 29889, 9507, 13, 13, 4706, 1583, 29889, 3888, 353, 360, 20322, 3401, 29898, 29881, 4668, 29918, 1445, 29889, 23479, 29918, 29812, 29897, 13, 13, 1678, 732, 1359, 1445, 29898, 8231, 519, 29922, 5574, 29897, 13, 1678, 822, 5217, 29898, 1311, 29892, 934, 1918, 29922, 8516, 1125, 13, 4706, 1583, 29889, 11338, 353, 6213, 13, 4706, 5217, 29898, 1445, 1918, 29897, 13, 13, 13, 29992, 13441, 29918, 2704, 29898, 5971, 2392, 29892, 1059, 29897, 13, 29992, 1359, 1445, 29898, 5696, 29922, 8824, 29892, 2044, 519, 29922, 5574, 29897, 13, 1753, 5217, 29898, 1445, 1918, 1125, 13, 1678, 9995, 15941, 8282, 515, 263, 934, 29889, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 934, 1918, 313, 1445, 1918, 29897, 13, 1678, 390, 1759, 267, 29901, 13, 4706, 5478, 5370, 29889, 29924, 329, 5370, 2392, 13, 1678, 9995, 13, 13, 1678, 270, 4668, 29918, 1445, 353, 360, 20322, 2283, 29898, 1445, 1918, 29889, 1445, 5415, 29897, 13, 13, 1678, 565, 270, 4668, 29918, 1445, 29889, 29881, 4928, 29918, 29812, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 2804, 29871, 29900, 29901, 13, 4706, 1178, 29941, 29918, 5479, 353, 270, 4668, 29918, 1445, 29889, 29881, 4928, 29918, 29812, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 13, 4706, 270, 4668, 29918, 1445, 29889, 29881, 4928, 29918, 29812, 29889, 10289, 29918, 2527, 1272, 29918, 29812, 353, 29871, 29900, 13, 4706, 270, 4668, 29918, 1445, 29889, 29881, 4928, 29918, 29812, 29889, 3539, 580, 13, 13, 4706, 934, 1918, 29889, 1445, 5415, 29889, 344, 1416, 29898, 333, 29941, 29918, 5479, 29897, 13, 4706, 934, 1918, 29889, 1445, 5415, 29889, 509, 4661, 403, 580, 13, 13, 13, 6585, 353, 360, 20322, 13, 2 ]
src/python/watch-wasm.py
Dante83/A-Terra-Incognito
23
160172
import os, time cpp_directories = ['../cpp/state-engine/', '../cpp/' '../cpp/interpolation-engine/'] cpp_files = [['SkyState.cpp',\ 'autoexposure/LightingAnalyzer.cpp',\ 'world_state/AstroTime.cpp',\ 'world_state/Location.cpp',\ 'astro_bodies/SkyManager.cpp',\ 'astro_bodies/AstronomicalBody.cpp',\ 'astro_bodies/Sun.cpp',\ 'astro_bodies/Moon.cpp',\ 'astro_bodies/Planet.cpp',\ 'astro_bodies/planets/Earth.cpp',\ 'astro_bodies/OtherPlanet.cpp',\ 'astro_bodies/planets/Mercury.cpp',\ 'astro_bodies/planets/Venus.cpp',\ 'astro_bodies/planets/Mars.cpp',\ 'astro_bodies/planets/Jupiter.cpp',\ 'astro_bodies/planets/Saturn.cpp'],\ ['SkyInterpolator.cpp',\ 'color/ColorInterpolator.cpp' ]] module_file = ['state-engine.js', 'interpolation-engine.js'] exported_functions = [['_main', '_setupSky', '_updateSky', '_initializeMeteringAndLightingDependencies',\ '_updateMeteringData', '_updateDirectLighting', '_updateHemisphericalLightingData'],\ ['_main', '_setupInterpolators', '_updateFinalAstronomicalValues', '_updateAstronomicalTimeData',\ '_tick_astronomicalInterpolations', '_setSunAndMoonTimeTo', '_denormalizeSkyIntensity0', '_updateLightingValues',\ '_tick_lightingInterpolations', '_bolometricMagnitudeToLuminosity', '_luminosityToAtmosphericIntensity',\ '_initializeLightingValues']] cpp_update_date = {} def recursivelyWalkDirectories(absolute_cpp_directory, file_check_callback): for root, dirs, files in os.walk(absolute_cpp_directory): for file in files: call_back_status = file_check_callback(root, file) if call_back_status: return True for dir in dirs: call_back_status = recursivelyWalkDirectories('{}/{}'.format(absolute_cpp_directory, dir), file_check_callback) if call_back_status: return True return False for i, cpp_directory in enumerate(cpp_directories): absolute_cpp_directory = os.path.abspath(cpp_directory) def intializeFileUpdateTimes(root, file): if file.endswith('.h') or file.endswith('.cpp'): cpp_update_date[file] = os.path.getmtime('{}/{}'.format(root, file)) #Never break on this return False recursivelyWalkDirectories(absolute_cpp_directory, intializeFileUpdateTimes) def CPPWatcher(): #This should run forever, repeatedly creating our files from the updated structure every time for i, cpp_directory in enumerate(cpp_directories): os.system('clear') os.chdir(cpp_directory) os.system("emcc {} -s WASM=1 -s EXPORTED_FUNCTIONS='[{}]' -o {} -s ALLOW_MEMORY_GROWTH=1;".format(' '.join(cpp_files[i]), ', '.join(exported_functions[i]), module_file[i])) os.chdir('../../python') print 'Watching for updates...' #Watch loop while True: break_loops = True for i, cpp_directory in enumerate(cpp_directories): absolute_cpp_directory = os.path.abspath(cpp_directory) def checkForUpdates(root, file): #Only check cpp and header files and determine if the file had an update absolute_file_path = '{}/{}'.format(root, file) if (file.endswith('.h') or file.endswith('.cpp')) and (cpp_update_date[file] < os.path.getmtime(absolute_file_path)): os.system('clear') print 'Change found in file {}, updating.'.format(file) cpp_update_date[file] = os.path.getmtime(absolute_file_path) os.chdir(cpp_directory) os.system("emcc {} -s WASM=1 -s EXPORTED_FUNCTIONS='[{}]' -O3 {} -s ALLOW_MEMORY_GROWTH=1;".format(' '.join(cpp_files[i]), ', '.join(exported_functions[i]), module_file[i])) os.chdir('../../python') print "WASM update at: {}".format(time.strftime('%H:%M %Y-%m-%d')) print "-"*15 return True return False #Update our file list and check for any changes to any of our files recursivelyWalkDirectories(absolute_cpp_directory, checkForUpdates) #And we only do this every five seconds because this is a little more costly time.sleep(1) #Run the main application! :D CPPWatcher()
[ 1, 1053, 2897, 29892, 931, 13, 13, 8223, 29918, 11851, 3842, 353, 6024, 6995, 8223, 29914, 3859, 29899, 10599, 29914, 742, 525, 6995, 8223, 22208, 525, 6995, 8223, 29914, 1639, 3733, 362, 29899, 10599, 29914, 2033, 13, 8223, 29918, 5325, 353, 518, 1839, 29903, 3459, 2792, 29889, 8223, 742, 29905, 13, 525, 6921, 735, 1066, 545, 29914, 20769, 292, 2744, 14997, 3298, 29889, 8223, 742, 29905, 13, 525, 11526, 29918, 3859, 29914, 29909, 303, 307, 2481, 29889, 8223, 742, 29905, 13, 525, 11526, 29918, 3859, 29914, 6508, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 29903, 3459, 3260, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 29909, 13854, 936, 8434, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 29903, 348, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 29924, 6150, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 20334, 300, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 29923, 28696, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 16107, 20334, 300, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 15836, 2764, 29891, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 29963, 264, 375, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 29924, 1503, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 29967, 786, 1524, 29889, 8223, 742, 29905, 13, 525, 23364, 29918, 29890, 397, 583, 29914, 9018, 1691, 29914, 29903, 271, 595, 29889, 8223, 7464, 29905, 13, 6024, 29903, 3459, 4074, 3733, 1061, 29889, 8223, 742, 29905, 13, 525, 2780, 29914, 3306, 4074, 3733, 1061, 29889, 8223, 29915, 13, 29588, 13, 5453, 29918, 1445, 353, 6024, 3859, 29899, 10599, 29889, 1315, 742, 525, 1639, 3733, 362, 29899, 10599, 29889, 1315, 2033, 13, 15843, 287, 29918, 12171, 353, 518, 1839, 29918, 3396, 742, 22868, 14669, 29903, 3459, 742, 22868, 5504, 29903, 3459, 742, 22868, 24926, 29924, 1308, 292, 2855, 20769, 292, 8498, 7158, 742, 29905, 13, 15972, 5504, 29924, 1308, 292, 1469, 742, 22868, 5504, 17392, 20769, 292, 742, 22868, 5504, 29950, 331, 275, 8096, 936, 20769, 292, 1469, 7464, 29905, 13, 1839, 29918, 3396, 742, 22868, 14669, 4074, 3733, 4097, 742, 22868, 5504, 15790, 29909, 13854, 936, 9065, 742, 22868, 5504, 29909, 13854, 936, 2481, 1469, 742, 29905, 13, 15972, 24667, 29918, 7614, 4917, 936, 4074, 3733, 800, 742, 22868, 842, 29903, 348, 2855, 29924, 6150, 2481, 1762, 742, 22868, 1145, 2759, 675, 29903, 3459, 2928, 575, 537, 29900, 742, 22868, 5504, 20769, 292, 9065, 742, 29905, 13, 15972, 24667, 29918, 4366, 292, 4074, 3733, 800, 742, 22868, 2095, 14066, 29924, 4211, 4279, 1762, 29931, 398, 8226, 537, 742, 22868, 29880, 398, 8226, 537, 1762, 4178, 7681, 8096, 293, 2928, 575, 537, 742, 29905, 13, 15972, 24926, 20769, 292, 9065, 2033, 29962, 13, 8223, 29918, 5504, 29918, 1256, 353, 6571, 13, 13, 1753, 8304, 3598, 29956, 2235, 17392, 3842, 29898, 23552, 29918, 8223, 29918, 12322, 29892, 934, 29918, 3198, 29918, 14035, 1125, 13, 1678, 363, 3876, 29892, 4516, 29879, 29892, 2066, 297, 2897, 29889, 20919, 29898, 23552, 29918, 8223, 29918, 12322, 1125, 13, 4706, 363, 934, 297, 2066, 29901, 13, 9651, 1246, 29918, 1627, 29918, 4882, 353, 934, 29918, 3198, 29918, 14035, 29898, 4632, 29892, 934, 29897, 13, 9651, 565, 1246, 29918, 1627, 29918, 4882, 29901, 13, 18884, 736, 5852, 13, 4706, 363, 4516, 297, 4516, 29879, 29901, 13, 9651, 1246, 29918, 1627, 29918, 4882, 353, 8304, 3598, 29956, 2235, 17392, 3842, 877, 29912, 6822, 8875, 4286, 4830, 29898, 23552, 29918, 8223, 29918, 12322, 29892, 4516, 511, 934, 29918, 3198, 29918, 14035, 29897, 13, 9651, 565, 1246, 29918, 1627, 29918, 4882, 29901, 13, 18884, 736, 5852, 13, 1678, 736, 7700, 13, 13, 1454, 474, 29892, 274, 407, 29918, 12322, 297, 26985, 29898, 8223, 29918, 11851, 3842, 1125, 13, 1678, 8380, 29918, 8223, 29918, 12322, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 8223, 29918, 12322, 29897, 13, 1678, 822, 938, 6646, 2283, 6422, 29164, 29898, 4632, 29892, 934, 1125, 13, 4706, 565, 934, 29889, 1975, 2541, 12839, 29882, 1495, 470, 934, 29889, 1975, 2541, 12839, 8223, 29374, 13, 9651, 274, 407, 29918, 5504, 29918, 1256, 29961, 1445, 29962, 353, 2897, 29889, 2084, 29889, 657, 29885, 2230, 877, 29912, 6822, 8875, 4286, 4830, 29898, 4632, 29892, 934, 876, 13, 4706, 396, 29940, 1310, 2867, 373, 445, 13, 4706, 736, 7700, 13, 1678, 8304, 3598, 29956, 2235, 17392, 3842, 29898, 23552, 29918, 8223, 29918, 12322, 29892, 938, 6646, 2283, 6422, 29164, 29897, 13, 13, 1753, 315, 18009, 24709, 261, 7295, 13, 1678, 396, 4013, 881, 1065, 22296, 29892, 28424, 4969, 1749, 2066, 515, 278, 4784, 3829, 1432, 931, 13, 1678, 363, 474, 29892, 274, 407, 29918, 12322, 297, 26985, 29898, 8223, 29918, 11851, 3842, 1125, 13, 4706, 2897, 29889, 5205, 877, 8551, 1495, 13, 4706, 2897, 29889, 305, 3972, 29898, 8223, 29918, 12322, 29897, 13, 4706, 2897, 29889, 5205, 703, 331, 617, 6571, 448, 29879, 399, 3289, 29924, 29922, 29896, 448, 29879, 8528, 15082, 3352, 29918, 29943, 28700, 29903, 2433, 19660, 6525, 29915, 448, 29877, 6571, 448, 29879, 15149, 9806, 29918, 2303, 29924, 18929, 29918, 29954, 25180, 4690, 29922, 29896, 29936, 1642, 4830, 877, 15300, 7122, 29898, 8223, 29918, 5325, 29961, 29875, 11724, 13420, 15300, 7122, 29898, 15843, 287, 29918, 12171, 29961, 29875, 11724, 3883, 29918, 1445, 29961, 29875, 12622, 13, 4706, 2897, 29889, 305, 3972, 877, 21546, 4691, 1495, 13, 1678, 1596, 525, 24709, 292, 363, 11217, 856, 29915, 13, 13, 1678, 396, 24709, 2425, 13, 1678, 1550, 5852, 29901, 13, 4706, 2867, 29918, 417, 3554, 353, 5852, 13, 4706, 363, 474, 29892, 274, 407, 29918, 12322, 297, 26985, 29898, 8223, 29918, 11851, 3842, 1125, 13, 9651, 8380, 29918, 8223, 29918, 12322, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 8223, 29918, 12322, 29897, 13, 9651, 822, 1423, 2831, 3373, 15190, 29898, 4632, 29892, 934, 1125, 13, 18884, 396, 11730, 1423, 274, 407, 322, 4839, 2066, 322, 8161, 565, 278, 934, 750, 385, 2767, 13, 18884, 8380, 29918, 1445, 29918, 2084, 353, 22372, 6822, 8875, 4286, 4830, 29898, 4632, 29892, 934, 29897, 13, 18884, 565, 313, 1445, 29889, 1975, 2541, 12839, 29882, 1495, 470, 934, 29889, 1975, 2541, 12839, 8223, 8785, 322, 313, 8223, 29918, 5504, 29918, 1256, 29961, 1445, 29962, 529, 2897, 29889, 2084, 29889, 657, 29885, 2230, 29898, 23552, 29918, 1445, 29918, 2084, 22164, 13, 462, 1678, 2897, 29889, 5205, 877, 8551, 1495, 13, 462, 1678, 1596, 525, 7277, 1476, 297, 934, 24335, 13271, 29889, 4286, 4830, 29898, 1445, 29897, 13, 462, 1678, 274, 407, 29918, 5504, 29918, 1256, 29961, 1445, 29962, 353, 2897, 29889, 2084, 29889, 657, 29885, 2230, 29898, 23552, 29918, 1445, 29918, 2084, 29897, 13, 462, 1678, 2897, 29889, 305, 3972, 29898, 8223, 29918, 12322, 29897, 13, 462, 1678, 2897, 29889, 5205, 703, 331, 617, 6571, 448, 29879, 399, 3289, 29924, 29922, 29896, 448, 29879, 8528, 15082, 3352, 29918, 29943, 28700, 29903, 2433, 19660, 6525, 29915, 448, 29949, 29941, 6571, 448, 29879, 15149, 9806, 29918, 2303, 29924, 18929, 29918, 29954, 25180, 4690, 29922, 29896, 29936, 1642, 4830, 877, 15300, 7122, 29898, 8223, 29918, 5325, 29961, 29875, 11724, 13420, 15300, 7122, 29898, 15843, 287, 29918, 12171, 29961, 29875, 11724, 3883, 29918, 1445, 29961, 29875, 12622, 13, 462, 1678, 2897, 29889, 305, 3972, 877, 21546, 4691, 1495, 13, 462, 1678, 1596, 376, 29956, 3289, 29924, 2767, 472, 29901, 6571, 1642, 4830, 29898, 2230, 29889, 710, 615, 603, 877, 29995, 29950, 16664, 29924, 1273, 29979, 19222, 29885, 19222, 29881, 8785, 13, 462, 1678, 1596, 11663, 29908, 29930, 29896, 29945, 13, 462, 1678, 736, 5852, 13, 18884, 736, 7700, 13, 13, 9651, 396, 6422, 1749, 934, 1051, 322, 1423, 363, 738, 3620, 304, 738, 310, 1749, 2066, 13, 9651, 8304, 3598, 29956, 2235, 17392, 3842, 29898, 23552, 29918, 8223, 29918, 12322, 29892, 1423, 2831, 3373, 15190, 29897, 13, 13, 4706, 396, 2855, 591, 871, 437, 445, 1432, 5320, 6923, 1363, 445, 338, 263, 2217, 901, 3438, 368, 13, 4706, 931, 29889, 17059, 29898, 29896, 29897, 13, 13, 29937, 6558, 278, 1667, 2280, 29991, 584, 29928, 13, 6271, 29925, 24709, 261, 580, 13, 2 ]
libpmf-1.41/python/libpmf.py
zhenv5/atp
7
198405
#!/usr/bin/env python from ctypes import * from os import path libpmf = CDLL(path.join(path.dirname(__file__),'pmf_py.so.1')) def genFields(names, types): return list(zip(names, types)) def fillprototype(f, restype, argtypes): f.restype = restype f.argtypes = argtypes class parameter(Structure): _names = ["solver_type", "k", "threads", "maxiter", "maxinneriter", "lambda", "rho", "eps", "eta0", "betaup", "betadown", "lrate_method", "num_blocks", "do_predict", "verbose", "do_nmf"] _types = [c_int, c_int, c_int, c_int, c_int, c_double, c_double, c_double, c_double, c_double, c_double, c_int, c_int, c_int, c_int, c_int] _fields_ = genFields(_names, _types) fillprototype(libpmf.training_option, c_char_p, []) fillprototype(libpmf.parse_training_command_line, parameter, [c_char_p]) fillprototype(libpmf.pmf_train, None, [c_int, c_int, c_long, POINTER(c_int), POINTER(c_int), POINTER(c_double), POINTER(parameter), POINTER(c_double), POINTER(c_double)]) import numpy as np import scipy.sparse as sparse def train(A=None, param_str='', zero_as_missing = True): if A is None: print('train(A, param_str="", zero_as_missing = True)\n' ' A: a numpy array or a scipy.sparse.matrix\n' ' zero_as_missing: whether treat zero as missing (Default True)\n' ' param_str:\n' '%s' %(libpmf.training_option().split('\n',1)[-1])) return None m, n = A.shape if not zero_as_missing and isinstance(A, sparse.spmatrix): A = A.toarray() if isinstance(A, sparse.spmatrix): coo = sparse.coo_matrix(A) return train_coo(row_idx=coo.row, col_idx=coo.col, obs_val=coo.data, m=m, n=n, param_str=param_str) elif isinstance(A, np.ndarray): if zero_as_missing: row_idx, col_idx = np.nonzero(np.isfinite(A) & (A !=0)) else : row_idx, col_idx = np.nonzero(np.isfinite(A)) val = A[(row_idx, col_idx)] return train_coo(row_idx=row_idx, col_idx=col_idx, obs_val=val, m=m, n=n, param_str=param_str) else : print('type(A) = %s is not supported' % (type(A))) return None def train_coo(row_idx=None, col_idx=None, obs_val=None, obs_weight=None, m=None, n=None, param_str = ''): ''' if None in [row_idx, col_idx, obs_val, m, n]: print ( 'train_coo(row_idx, col_idx, obs_val, obs_weight, m, n, param_str="")\n' ' row_idx : a numpy.ndarray with dtype = numpy.int32\n' ' col_idx : a numpy.ndarray with dtype = numpy.int32\n' ' obs_val : a numpy.ndarray with dtype = numpy.float64\n' ' obs_weight : a numpy.ndarray with dtype = numpy.float64 (optional)\n' ' m, n : # of rows, # of cols\n' ' param_str: \n' '%s' % (libpmf.training_option().split('\n',1)[-1])) return None ''' param = libpmf.parse_training_command_line(param_str) row_idx = np.array(row_idx, dtype=np.int32, copy=False) col_idx = np.array(col_idx, dtype=np.int32, copy=False) obs_val = np.array(obs_val, dtype=np.float64, copy=False) if not (obs_weight is None): obs_weight = np.array(obs_weight, dtype=np.float64, copy=False) if row_idx.max() >= m or col_idx.max() >= n: print row_idx.max(), col_idx.max(), m, n raise ValueError('row_idx or col_idx contains an index in wrong range') W = np.zeros((param.k, m), dtype=np.float64) H = np.zeros((param.k, n), dtype=np.float64) nnz = len(row_idx) libpmf.pmf_train(m, n, nnz, row_idx.ctypes.data_as(POINTER(c_int)), col_idx.ctypes.data_as(POINTER(c_int)), obs_val.ctypes.data_as(POINTER(c_double)), param, W.ctypes.data_as(POINTER(c_double)), H.ctypes.data_as(POINTER(c_double))) return {'W':W.T, 'H':H.T}
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 13, 3166, 274, 8768, 1053, 334, 13, 3166, 2897, 1053, 2224, 13, 13, 1982, 3358, 29888, 353, 7307, 2208, 29898, 2084, 29889, 7122, 29898, 2084, 29889, 25721, 22168, 1445, 1649, 511, 29915, 3358, 29888, 29918, 2272, 29889, 578, 29889, 29896, 8785, 13, 13, 1753, 2531, 14256, 29898, 7039, 29892, 4072, 1125, 29871, 13, 12, 2457, 1051, 29898, 7554, 29898, 7039, 29892, 4072, 876, 13, 13, 1753, 5445, 16309, 29898, 29888, 29892, 1791, 668, 29892, 1852, 8768, 1125, 29871, 13, 12, 29888, 29889, 5060, 668, 353, 1791, 668, 13, 12, 29888, 29889, 1191, 8768, 353, 1852, 8768, 13, 13, 1990, 3443, 29898, 5015, 12425, 1125, 13, 12, 29918, 7039, 353, 6796, 2929, 369, 29918, 1853, 613, 376, 29895, 613, 376, 28993, 613, 376, 3317, 1524, 613, 376, 3317, 3993, 1524, 613, 13, 12, 12, 12, 29908, 2892, 613, 376, 4650, 613, 376, 8961, 613, 376, 1187, 29900, 613, 376, 6878, 585, 29886, 613, 376, 6878, 328, 776, 613, 376, 29880, 10492, 29918, 5696, 613, 13, 12, 12, 12, 29908, 1949, 29918, 1271, 29879, 613, 376, 1867, 29918, 27711, 613, 376, 369, 15828, 613, 376, 1867, 29918, 22882, 29888, 3108, 13, 12, 29918, 8768, 353, 518, 29883, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 524, 29892, 29871, 13, 12, 12, 12, 29883, 29918, 8896, 29892, 274, 29918, 8896, 29892, 274, 29918, 8896, 29892, 274, 29918, 8896, 29892, 274, 29918, 8896, 29892, 274, 29918, 8896, 29892, 274, 29918, 524, 29892, 13, 12, 12, 12, 29883, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 524, 29962, 13, 12, 29918, 9621, 29918, 353, 2531, 14256, 7373, 7039, 29892, 903, 8768, 29897, 13, 13, 5589, 16309, 29898, 1982, 3358, 29888, 29889, 26495, 29918, 3385, 29892, 274, 29918, 3090, 29918, 29886, 29892, 518, 2314, 13, 5589, 16309, 29898, 1982, 3358, 29888, 29889, 5510, 29918, 26495, 29918, 6519, 29918, 1220, 29892, 3443, 29892, 518, 29883, 29918, 3090, 29918, 29886, 2314, 13, 5589, 16309, 29898, 1982, 3358, 29888, 29889, 3358, 29888, 29918, 14968, 29892, 6213, 29892, 518, 29883, 29918, 524, 29892, 274, 29918, 524, 29892, 274, 29918, 5426, 29892, 349, 6992, 4945, 29898, 29883, 29918, 524, 511, 349, 6992, 4945, 29898, 29883, 29918, 524, 511, 349, 6992, 4945, 29898, 29883, 29918, 8896, 511, 13, 12, 29925, 6992, 4945, 29898, 15501, 511, 349, 6992, 4945, 29898, 29883, 29918, 8896, 511, 349, 6992, 4945, 29898, 29883, 29918, 8896, 29897, 2314, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 4560, 2272, 29889, 29879, 5510, 408, 29234, 13, 13, 13, 1753, 7945, 29898, 29909, 29922, 8516, 29892, 1828, 29918, 710, 2433, 742, 5225, 29918, 294, 29918, 27259, 353, 5852, 1125, 13, 12, 361, 319, 338, 6213, 29901, 13, 12, 12, 2158, 877, 14968, 29898, 29909, 29892, 1828, 29918, 710, 543, 613, 5225, 29918, 294, 29918, 27259, 353, 5852, 2144, 29876, 29915, 13, 12, 12, 12, 12, 29915, 29871, 319, 29901, 263, 12655, 1409, 470, 263, 4560, 2272, 29889, 29879, 5510, 29889, 5344, 29905, 29876, 29915, 13, 12, 12, 12, 12, 29915, 29871, 5225, 29918, 294, 29918, 27259, 29901, 3692, 7539, 5225, 408, 4567, 313, 4592, 5852, 2144, 29876, 29915, 13, 12, 12, 12, 12, 29915, 29871, 1828, 29918, 710, 3583, 29876, 29915, 13, 12, 12, 12, 12, 29915, 29995, 29879, 29915, 1273, 29898, 1982, 3358, 29888, 29889, 26495, 29918, 3385, 2141, 5451, 28909, 29876, 742, 29896, 9601, 29899, 29896, 12622, 13, 12, 12, 2457, 6213, 13, 12, 29885, 29892, 302, 353, 319, 29889, 12181, 13, 12, 361, 451, 5225, 29918, 294, 29918, 27259, 322, 338, 8758, 29898, 29909, 29892, 29234, 29889, 1028, 5344, 1125, 13, 12, 12, 29909, 353, 319, 29889, 517, 2378, 580, 13, 12, 361, 338, 8758, 29898, 29909, 29892, 29234, 29889, 1028, 5344, 1125, 13, 12, 12, 1111, 29877, 353, 29234, 29889, 1111, 29877, 29918, 5344, 29898, 29909, 29897, 13, 12, 12, 2457, 7945, 29918, 1111, 29877, 29898, 798, 29918, 13140, 29922, 1111, 29877, 29889, 798, 29892, 784, 29918, 13140, 29922, 1111, 29877, 29889, 1054, 29892, 20881, 29918, 791, 29922, 1111, 29877, 29889, 1272, 29892, 286, 29922, 29885, 29892, 302, 29922, 29876, 29892, 1828, 29918, 710, 29922, 3207, 29918, 710, 29897, 13, 12, 23681, 338, 8758, 29898, 29909, 29892, 7442, 29889, 299, 2378, 1125, 13, 12, 12, 361, 5225, 29918, 294, 29918, 27259, 29901, 13, 12, 12, 12, 798, 29918, 13140, 29892, 784, 29918, 13140, 353, 7442, 29889, 5464, 9171, 29898, 9302, 29889, 4492, 262, 568, 29898, 29909, 29897, 669, 313, 29909, 2804, 29900, 876, 13, 12, 12, 2870, 584, 13, 12, 12, 12, 798, 29918, 13140, 29892, 784, 29918, 13140, 353, 7442, 29889, 5464, 9171, 29898, 9302, 29889, 4492, 262, 568, 29898, 29909, 876, 13, 12, 12, 791, 353, 319, 15625, 798, 29918, 13140, 29892, 784, 29918, 13140, 4638, 13, 12, 12, 2457, 7945, 29918, 1111, 29877, 29898, 798, 29918, 13140, 29922, 798, 29918, 13140, 29892, 784, 29918, 13140, 29922, 1054, 29918, 13140, 29892, 20881, 29918, 791, 29922, 791, 29892, 286, 29922, 29885, 29892, 302, 29922, 29876, 29892, 1828, 29918, 710, 29922, 3207, 29918, 710, 29897, 13, 12, 2870, 584, 13, 12, 12, 2158, 877, 1853, 29898, 29909, 29897, 353, 1273, 29879, 338, 451, 6969, 29915, 1273, 313, 1853, 29898, 29909, 4961, 13, 12, 12, 2457, 6213, 13, 13, 13, 1753, 7945, 29918, 1111, 29877, 29898, 798, 29918, 13140, 29922, 8516, 29892, 784, 29918, 13140, 29922, 8516, 29892, 20881, 29918, 791, 29922, 8516, 29892, 20881, 29918, 7915, 29922, 8516, 29892, 286, 29922, 8516, 29892, 302, 29922, 8516, 29892, 1828, 29918, 710, 353, 6629, 1125, 13, 12, 12008, 13, 12, 361, 6213, 297, 518, 798, 29918, 13140, 29892, 784, 29918, 13140, 29892, 20881, 29918, 791, 29892, 286, 29892, 302, 5387, 13, 12, 12, 2158, 313, 29871, 13, 12, 12, 29915, 14968, 29918, 1111, 29877, 29898, 798, 29918, 13140, 29892, 784, 29918, 13140, 29892, 20881, 29918, 791, 29892, 20881, 29918, 7915, 29892, 286, 29892, 302, 29892, 1828, 29918, 710, 543, 1159, 29905, 29876, 29915, 13, 12, 12, 29915, 29871, 1948, 29918, 13140, 584, 263, 12655, 29889, 299, 2378, 411, 26688, 353, 12655, 29889, 524, 29941, 29906, 29905, 29876, 29915, 13, 12, 12, 29915, 29871, 784, 29918, 13140, 584, 263, 12655, 29889, 299, 2378, 411, 26688, 353, 12655, 29889, 524, 29941, 29906, 29905, 29876, 29915, 13, 12, 12, 29915, 29871, 20881, 29918, 791, 584, 263, 12655, 29889, 299, 2378, 411, 26688, 353, 12655, 29889, 7411, 29953, 29946, 29905, 29876, 29915, 13, 12, 12, 29915, 29871, 20881, 29918, 7915, 584, 263, 12655, 29889, 299, 2378, 411, 26688, 353, 12655, 29889, 7411, 29953, 29946, 313, 25253, 2144, 29876, 29915, 13, 12, 12, 29915, 29871, 286, 29892, 302, 1678, 584, 396, 310, 4206, 29892, 396, 310, 28730, 29905, 29876, 29915, 13, 12, 12, 29915, 29871, 1828, 29918, 710, 29901, 320, 29876, 29915, 13, 12, 12, 29915, 29995, 29879, 29915, 1273, 313, 1982, 3358, 29888, 29889, 26495, 29918, 3385, 2141, 5451, 28909, 29876, 742, 29896, 9601, 29899, 29896, 12622, 13, 12, 12, 2457, 6213, 13, 12, 12008, 12, 13, 12, 3207, 353, 4303, 3358, 29888, 29889, 5510, 29918, 26495, 29918, 6519, 29918, 1220, 29898, 3207, 29918, 710, 29897, 13, 12, 798, 29918, 13140, 353, 7442, 29889, 2378, 29898, 798, 29918, 13140, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 29892, 3509, 29922, 8824, 29897, 13, 12, 1054, 29918, 13140, 353, 7442, 29889, 2378, 29898, 1054, 29918, 13140, 29892, 26688, 29922, 9302, 29889, 524, 29941, 29906, 29892, 3509, 29922, 8824, 29897, 13, 12, 26290, 29918, 791, 353, 7442, 29889, 2378, 29898, 26290, 29918, 791, 29892, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29892, 3509, 29922, 8824, 29897, 13, 12, 361, 451, 313, 26290, 29918, 7915, 338, 6213, 1125, 13, 12, 12, 26290, 29918, 7915, 353, 7442, 29889, 2378, 29898, 26290, 29918, 7915, 29892, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29892, 3509, 29922, 8824, 29897, 13, 12, 361, 1948, 29918, 13140, 29889, 3317, 580, 6736, 286, 470, 784, 29918, 13140, 29889, 3317, 580, 6736, 302, 29901, 13, 12, 12, 2158, 1948, 29918, 13140, 29889, 3317, 3285, 784, 29918, 13140, 29889, 3317, 3285, 286, 29892, 302, 13, 12, 12, 22692, 7865, 2392, 877, 798, 29918, 13140, 470, 784, 29918, 13140, 3743, 385, 2380, 297, 2743, 3464, 1495, 13, 12, 29956, 353, 7442, 29889, 3298, 359, 3552, 3207, 29889, 29895, 29892, 286, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 12, 29950, 353, 7442, 29889, 3298, 359, 3552, 3207, 29889, 29895, 29892, 302, 511, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 29897, 13, 12, 15755, 29920, 353, 7431, 29898, 798, 29918, 13140, 29897, 13, 12, 1982, 3358, 29888, 29889, 3358, 29888, 29918, 14968, 29898, 29885, 29892, 302, 29892, 302, 29876, 29920, 29892, 29871, 13, 12, 12, 12, 798, 29918, 13140, 29889, 312, 7384, 29889, 1272, 29918, 294, 29898, 29925, 6992, 4945, 29898, 29883, 29918, 524, 8243, 13, 12, 12, 12, 1054, 29918, 13140, 29889, 312, 7384, 29889, 1272, 29918, 294, 29898, 29925, 6992, 4945, 29898, 29883, 29918, 524, 8243, 13, 12, 12, 12, 26290, 29918, 791, 29889, 312, 7384, 29889, 1272, 29918, 294, 29898, 29925, 6992, 4945, 29898, 29883, 29918, 8896, 8243, 13, 12, 12, 12, 3207, 29892, 29871, 13, 12, 12, 12, 29956, 29889, 312, 7384, 29889, 1272, 29918, 294, 29898, 29925, 6992, 4945, 29898, 29883, 29918, 8896, 8243, 13, 12, 12, 12, 29950, 29889, 312, 7384, 29889, 1272, 29918, 294, 29898, 29925, 6992, 4945, 29898, 29883, 29918, 8896, 4961, 13, 12, 2457, 11117, 29956, 2396, 29956, 29889, 29911, 29892, 525, 29950, 2396, 29950, 29889, 29911, 29913, 13, 2 ]
QWeb/internal/user.py
janmaterne/qweb
1
129339
# -*- coding: utf-8 -*- # -------------------------- # Copyright © 2014 - Qentinel Group. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # --------------------------- import os def is_root(): try: # Windows doesn't have getuid. We just assume that user is not root. We # most likely won't need proper Windows support here anyway. uid = os.getuid() # pylint: disable=no-member except AttributeError: return False # User id 0 is reserved for superuser aka root if uid == 0: return True return False
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 448, 2683, 1378, 29899, 13, 29937, 14187, 1266, 29871, 30211, 29871, 29906, 29900, 29896, 29946, 448, 9651, 660, 15440, 295, 6431, 29889, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 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, 448, 2683, 28400, 13, 13, 5215, 2897, 13, 13, 13, 1753, 338, 29918, 4632, 7295, 13, 1678, 1018, 29901, 13, 4706, 396, 3852, 1838, 29915, 29873, 505, 679, 5416, 29889, 1334, 925, 5251, 393, 1404, 338, 451, 3876, 29889, 1334, 13, 4706, 396, 1556, 5517, 2113, 29915, 29873, 817, 1571, 3852, 2304, 1244, 8763, 29889, 13, 4706, 318, 333, 353, 2897, 29889, 657, 5416, 580, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 1217, 29899, 14242, 13, 1678, 5174, 23833, 2392, 29901, 13, 4706, 736, 7700, 13, 1678, 396, 4911, 1178, 29871, 29900, 338, 21676, 363, 2428, 1792, 263, 1335, 3876, 13, 1678, 565, 318, 333, 1275, 29871, 29900, 29901, 13, 4706, 736, 5852, 13, 1678, 736, 7700, 13, 2 ]
Breakingtheloop ML Repository/ml_explore.py
sghoseWI/Machine-Learning
0
138755
import pandas as pd import numpy as np from matplotlib import pyplot as plt import seaborn as sns import math import re from ml_pipeline_lch import isolate_categoricals, is_category def view_dist(df, geo_columns = True, fig_size=(20,15), labels = None): ''' Plot distributions of non-categorical columns in a given dataframe Inputs: df: pandas dataframe geo_columns: list of column names corresponding to columns with numeric geographical information (ex: zipcodes) labels: list of labels to apply to plot: title, xlable, ylabel, respectively ''' non_categoricals = isolate_categoricals(df, categoricals_fcn = is_category, ret_categoricals = False, geos_indicator = geo_columns) # non_categoricals = isolate_noncategoricals(df, ret_categoricals = False, # geo_cols = geo_columns) df[non_categoricals].hist(bins = 10, figsize=fig_size, color = 'blue') if labels: plt.title(labels[0]) plt.xlabel(labels[1]) plt.ylabel(labels[2]) plt.show() def plot_value_counts(df, type_dict, category, norm = False, plot_kind = 'bar'): for col in type_dict[category]: plot_title = col + " distribution" df[col].value_counts(normalize = norm).plot(kind=plot_kind) plt.title(plot_title) plt.xlabel(col) plt.ylabel("frequency") plt.show() def check_corr(df, geo_columns = True, cat_cols = None): ''' Display heatmap of linear correlation between non-categorical columns in a given dataframe Inputs: df: pandas dataframe geo_columns: list of column names corresponding to columns with numeric geographical information (ex: zipcodes) Attribution: Colormap Attribution: adapted from gradiated dataframe at https://www.datascience.com/blog/introduction-to-correlation-learn-data-science-tutorials and correlation heatmap at https://stackoverflow.com/questions/29432629/correlation-matrix-using-pandas ''' try: non_categoricals = isolate_categoricals(df, categoricals_fcn = is_category, ret_categoricals = False, geos_indicator = geo_columns) fig, ax = plt.subplots(figsize=(12, 12)) corr = df[non_categoricals].corr(method="pearson") sns.heatmap(corr, mask=np.zeros_like(corr, dtype=np.bool), cmap=plt.get_cmap("coolwarm"), square=True, ax=ax, annot=True) ax.set_xticks(range(len(non_categoricals))) ax.set_yticks(range(len(non_categoricals))) ax.tick_params(direction='inout') ax.set_xticklabels(non_categoricals, rotation=45, ha='right') ax.set_yticklabels(non_categoricals, rotation=45, va='top') plt.title('Feature Correlation') plt.show() except: if cat_cols: cat_df = df[df.columns] for col in cat_cols: cat_df[col] = cat_df[col].astype('categorical') fig, ax = plt.subplots(figsize=(12, 12)) corr = cat_df.corr(method="pearson") sns.heatmap(corr, mask=np.zeros_like(corr, dtype=np.bool), cmap=plt.get_cmap("coolwarm"), square=True, ax=ax, annot=True) ax.set_xticks(range(len(cat_df.columns))) ax.set_yticks(range(len(cat_df.columns))) ax.tick_params(direction='inout') ax.set_xticklabels(cat_df.columns, rotation=45, ha='right') ax.set_yticklabels(cat_df.columns, rotation=45, va='top') plt.title('Feature Correlation') plt.show() def discretize_cols(df, num_bins, geo_columns=True, specific_cols = False, split = False): ''' Add columns to discretize and classify non-categorical columns in a given data frame Inputs: df: pandas dataframe geo_columns: list of column names corresponding to columns with numeric geographical information (ex: zipcodes) num_bins: number of groups into which column values should be discretized ''' if specific_cols: non_categoricals = specific_cols else: non_categoricals = isolate_categoricals(df, categoricals_fcn = is_category, ret_categoricals = False, geos_indicator = geo_columns) for col in non_categoricals: bin_col = col + "_bin" if col == "age": age_bins = math.ceil((df[col].max() - df[col].min()) / 10) if split: df[bin_col], train_bins = pd.cut(df[col], bins = age_bins, right = False, precision=0, retbins=split) else: df[bin_col] = pd.cut(df[col], bins = age_bins, right = False, precision=0, retbins=split) else: if split: df[bin_col], train_bins = pd.cut(df[col], bins = num_bins, precision=0, retbins=split) else: df[bin_col] = pd.cut(df[col], bins = num_bins, precision=0, retbins=split) if split: return train_bins def discretize_train_test(train_test_tuples, still_blanks): for i, (train, test) in enumerate(train_test_tuples): fill_cols = still_blanks[i] for col in fill_cols: grouped = col + '_bin' train[grouped], train_bins = pd.cut(train[col], bins = 4, precision = 0, retbins = True) test[grouped] = pd.cut(test[col], bins = train_bins, precision = 0) def confirm_train_test_discretization(train_test_tuples, still_blanks): for i, (train, test) in enumerate(train_test_tuples): for col in still_blanks[i]: grouped = col grouped = col + '_bin' print("set {} {} train: {}.".format(i, col, train[grouped].unique())) print() print("set {} {} test: {}.".format(i, col, test[grouped].unique())) print() def drop_tt_binned(train_test_tuples, to_drop): ''' Drop columns from both train and test sets. Inputs: train_test_tuples: list of tupled dataframes to_drop: list of columns to drop ''' for train, test in train_test_tuples: train.drop(to_drop, axis = 1, inplace = True) test.drop(to_drop, axis = 1, inplace = True) def create_binary_vars(df, cols_to_dummy, keyword_list): ''' Create columns of binary values corresponding to values above zero for selected columns in a given dataframe based on common keywords Inputs: df: pandas dataframe cols_to_dummy: (list of strings) columns in data frame to be evaluated into dummy variables keyword_list: (list of strings) words or phrases included in columns to be evaluated indicating a dummy variable should be created based on its values ''' keyword_string = ("|").join(keyword_list) for col in cols_to_dummy: colname_trunc = re.sub(keyword_string, '', col) binary_col_name = 'tf_' + colname_trunc df[binary_col_name] = df[col].apply(lambda x: x > 0) def plot_corr(df, color_category, geo_columns=True): ''' Observe distributions and correlations of features for non-categorical Inputs: df: pandas dataframe categoricals_list: list of strings corresponding to categorical columns (ex: zip codes) ''' non_categoricals = isolate_categoricals(df, categoricals_fcn = is_category, ret_categoricals = False, geos_indicator = geo_columns) plot_list = non_categoricals + [color_category] corr = sns.pairplot(df[plot_list], hue = color_category, palette = "Set2") def plot_relationship(df, feature_x, xlabel,feature_y, ylabel, xlimit = None, ylimit = None, color_cat = None, filter_col = None, filter_criteria = None, filter_param = None, filter_param2 = None): ''' Plot two features in a given data frame against each other to view relationship and outliers. Attribution: adapted from https://s3.amazonaws.com/assets.datacamp.com/blog_assets/Python_Seaborn_Cheat_Sheet.pdf ''' if filter_col and filter_criteria and filter_param: if filter_criteria == 'geq': use_df = df[df[filter_col] >= filter_param] elif filter_criteria == 'gt': use_df = df[df[filter_col] > filter_param] elif filter_criteria == 'leq': use_df = df[df[filter_col] <= filter_param] elif filter_criteria == 'lt': use_df = df[df[filter_col] < filter_param] elif filter_criteria == 'eq': use_df = df[df[filter_col] == filter_param] elif filter_criteria == 'neq': use_df = df[df[filter_col] != filter_param] elif filter_criteria == 'between': use_df = df[(df[filter_col] > filter_param) and (df[filter_col] < filter_param2)] g = sns.lmplot(x = feature_x, y = feature_y, data = use_df, aspect = 3, hue = color_cat) g = (g.set_axis_labels(xlabel,ylabel)).set(xlim = xlimit , ylim = ylimit) plot_title = ylabel + " by " + xlabel plt.title(plot_title) plt.show(g) else: g = sns.lmplot(x = feature_x, y = feature_y, data = df, aspect = 3, hue = color_cat) g = (g.set_axis_labels(xlabel,ylabel)).set(xlim = xlimit , ylim = ylimit) plot_title = ylabel + " by " + xlabel plt.title(plot_title) plt.show(g) def eval_ratios(df, include_cols, category_cols, method = "count", pct = False): ''' Evaluate specific features via grouping on one or more category Inputs: df: (dataframe) pandas dataframe include_cols: (list of strings) column names to be aggregated or grouped category_cols: (list of strings) column name(s) for variable(s) used for grouping method: (string) groupby aggregation method for column values Output: ratio_df: pandas data frame of grouped data ''' if method == "count": ratio_df = df[include_cols].groupby(category_cols).count() if pct: single_col = include_cols[-1] + " Percentage" ratio_df[single_col] = ((df[include_cols].groupby(category_cols).count() / df[include_cols].groupby(category_cols).count().sum()) * 100) elif method == "sum": ratio_df = df[include_cols].groupby(category_cols).sum() if pct: single_col = include_cols[-1] + " Percentage" ratio_df[single_col] = ((df[include_cols].groupby(category_cols).sum() / df[include_cols].groupby(category_cols).sum().sum()) * 100) return ratio_df def feature_by_geo(df, geo, expl_var, num_var, method = "median"): ''' Evaluate specific features by geography (ex: zip code) Inputs: df: (dataframe) pandas dataframe geo: (string) column name corresponding to geography used for grouping expl_var: (string) column name for exploratory variable used for grouping num_var: (string) column name for numeric variable/ feature to be aggregated method: (string) groupby aggregation method for column values Output: geo_features: pandas data frame of grouped data ''' df_geo = df[(df[geo] != 0)] groupby_list = [geo] + expl_var if method == "median": geo_features = df_geo.groupby(groupby_list)[num_var].median().unstack(level = 1) if method == "count": geo_features = df_geo.groupby(groupby_list)[num_var].count().unstack(level = 1) geo_features.fillna(value = "", inplace = True) return geo_features def plot_top_distros(train_test_tuples, var_dict, set_num): for i, col in enumerate(var_dict['tops']): train, test = train_test_tuples[set_num] plot_title = "Projects by {} for Training Set {}".format(col, set_num) train[col].value_counts().sort_index().plot(kind='bar', title = plot_title) plt.show()
[ 1, 1053, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 22889, 1053, 11451, 5317, 408, 14770, 13, 5215, 409, 370, 1398, 408, 269, 1983, 13, 5215, 5844, 13, 5215, 337, 13, 3166, 286, 29880, 29918, 13096, 5570, 29918, 29880, 305, 1053, 11695, 403, 29918, 29883, 20440, 936, 29879, 29892, 338, 29918, 7320, 13, 13, 13, 1753, 1776, 29918, 5721, 29898, 2176, 29892, 1737, 29877, 29918, 13099, 353, 5852, 29892, 2537, 29918, 2311, 7607, 29906, 29900, 29892, 29896, 29945, 511, 11073, 353, 6213, 1125, 13, 1678, 14550, 13, 1678, 18399, 18822, 310, 1661, 29899, 29883, 20440, 936, 4341, 297, 263, 2183, 12205, 13, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 11701, 12205, 13, 4706, 1737, 29877, 29918, 13099, 29901, 1051, 310, 1897, 2983, 6590, 304, 4341, 411, 16985, 1737, 19711, 2472, 313, 735, 29901, 14319, 18137, 29897, 13, 4706, 11073, 29901, 1051, 310, 11073, 304, 3394, 304, 6492, 29901, 3611, 29892, 921, 29880, 519, 29892, 343, 1643, 29892, 8307, 13, 1678, 14550, 13, 1678, 1661, 29918, 29883, 20440, 936, 29879, 353, 11695, 403, 29918, 29883, 20440, 936, 29879, 29898, 2176, 29892, 11608, 936, 29879, 29918, 13801, 29876, 353, 338, 29918, 7320, 29892, 3240, 29918, 29883, 20440, 936, 29879, 353, 7700, 29892, 1737, 359, 29918, 513, 20485, 353, 1737, 29877, 29918, 13099, 29897, 13, 1678, 396, 1661, 29918, 29883, 20440, 936, 29879, 353, 11695, 403, 29918, 5464, 29883, 20440, 936, 29879, 29898, 2176, 29892, 3240, 29918, 29883, 20440, 936, 29879, 353, 7700, 29892, 29871, 13, 1678, 396, 462, 462, 632, 1737, 29877, 29918, 22724, 353, 1737, 29877, 29918, 13099, 29897, 13, 1678, 4489, 29961, 5464, 29918, 29883, 20440, 936, 29879, 1822, 29882, 391, 29898, 29890, 1144, 353, 29871, 29896, 29900, 29892, 2537, 2311, 29922, 1003, 29918, 2311, 29892, 2927, 353, 525, 9539, 1495, 13, 1678, 565, 11073, 29901, 13, 4706, 14770, 29889, 3257, 29898, 21134, 29961, 29900, 2314, 13, 4706, 14770, 29889, 29916, 1643, 29898, 21134, 29961, 29896, 2314, 13, 4706, 14770, 29889, 29891, 1643, 29898, 21134, 29961, 29906, 2314, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 6492, 29918, 1767, 29918, 2798, 29879, 29898, 2176, 29892, 1134, 29918, 8977, 29892, 7663, 29892, 6056, 353, 7700, 29892, 6492, 29918, 14380, 353, 525, 1646, 29374, 13, 1678, 363, 784, 297, 1134, 29918, 8977, 29961, 7320, 5387, 13, 4706, 6492, 29918, 3257, 353, 784, 718, 376, 4978, 29908, 13, 4706, 4489, 29961, 1054, 1822, 1767, 29918, 2798, 29879, 29898, 8945, 675, 353, 6056, 467, 5317, 29898, 14380, 29922, 5317, 29918, 14380, 29897, 13, 4706, 14770, 29889, 3257, 29898, 5317, 29918, 3257, 29897, 13, 4706, 14770, 29889, 29916, 1643, 29898, 1054, 29897, 13, 4706, 14770, 29889, 29891, 1643, 703, 10745, 23860, 1159, 13, 4706, 14770, 29889, 4294, 580, 13, 13, 13, 1753, 1423, 29918, 29725, 29898, 2176, 29892, 1737, 29877, 29918, 13099, 353, 5852, 29892, 6635, 29918, 22724, 353, 6213, 1125, 13, 1678, 14550, 13, 259, 17440, 12871, 1958, 310, 5608, 19869, 1546, 1661, 29899, 29883, 20440, 936, 4341, 297, 263, 29871, 13, 259, 2183, 12205, 13, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 11701, 12205, 13, 4706, 1737, 29877, 29918, 13099, 29901, 1051, 310, 1897, 2983, 6590, 304, 4341, 411, 16985, 29871, 13, 9651, 1737, 19711, 2472, 313, 735, 29901, 14319, 18137, 29897, 13, 13, 1678, 6212, 3224, 29901, 1530, 555, 481, 6212, 3224, 29901, 23430, 515, 4656, 29875, 630, 12205, 472, 29871, 13, 1678, 2045, 597, 1636, 29889, 14538, 15277, 29889, 510, 29914, 7312, 29914, 524, 13210, 29899, 517, 29899, 2616, 23445, 29899, 19668, 29899, 1272, 29899, 29879, 15277, 29899, 12631, 29879, 322, 19869, 12871, 1958, 472, 2045, 597, 2417, 29889, 510, 29914, 2619, 29914, 29906, 29929, 29946, 29941, 29906, 29953, 29906, 29929, 29914, 2616, 23445, 29899, 5344, 29899, 4746, 29899, 15112, 13, 1678, 14550, 13, 1678, 1018, 29901, 13, 4706, 1661, 29918, 29883, 20440, 936, 29879, 353, 11695, 403, 29918, 29883, 20440, 936, 29879, 29898, 2176, 29892, 11608, 936, 29879, 29918, 13801, 29876, 353, 338, 29918, 7320, 29892, 29871, 13, 9651, 3240, 29918, 29883, 20440, 936, 29879, 353, 7700, 29892, 1737, 359, 29918, 513, 20485, 353, 1737, 29877, 29918, 13099, 29897, 13, 13, 4706, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29896, 29906, 29892, 29871, 29896, 29906, 876, 13, 4706, 27760, 353, 4489, 29961, 5464, 29918, 29883, 20440, 936, 29879, 1822, 29725, 29898, 5696, 543, 412, 279, 1100, 1159, 13, 4706, 269, 1983, 29889, 354, 271, 1958, 29898, 29725, 29892, 11105, 29922, 9302, 29889, 3298, 359, 29918, 4561, 29898, 29725, 29892, 26688, 29922, 9302, 29889, 11227, 511, 29871, 13, 462, 1678, 274, 1958, 29922, 572, 29873, 29889, 657, 29918, 29883, 1958, 703, 1111, 324, 29893, 2817, 4968, 6862, 29922, 5574, 29892, 4853, 29922, 1165, 29892, 9732, 29922, 5574, 29897, 13, 308, 13, 4706, 4853, 29889, 842, 29918, 486, 7358, 29898, 3881, 29898, 2435, 29898, 5464, 29918, 29883, 20440, 936, 29879, 4961, 13, 4706, 4853, 29889, 842, 29918, 3637, 7358, 29898, 3881, 29898, 2435, 29898, 5464, 29918, 29883, 20440, 936, 29879, 4961, 13, 13, 4706, 4853, 29889, 24667, 29918, 7529, 29898, 20845, 2433, 262, 449, 1495, 13, 4706, 4853, 29889, 842, 29918, 486, 860, 21134, 29898, 5464, 29918, 29883, 20440, 936, 29879, 29892, 13733, 29922, 29946, 29945, 29892, 447, 2433, 1266, 1495, 13, 4706, 4853, 29889, 842, 29918, 3637, 860, 21134, 29898, 5464, 29918, 29883, 20440, 936, 29879, 29892, 13733, 29922, 29946, 29945, 29892, 2947, 2433, 3332, 1495, 13, 4706, 14770, 29889, 3257, 877, 19132, 2994, 23445, 1495, 13, 4706, 14770, 29889, 4294, 580, 13, 268, 13, 1678, 5174, 29901, 13, 4706, 565, 6635, 29918, 22724, 29901, 13, 9651, 6635, 29918, 2176, 353, 4489, 29961, 2176, 29889, 13099, 29962, 13, 632, 13, 9651, 363, 784, 297, 6635, 29918, 22724, 29901, 13, 18884, 6635, 29918, 2176, 29961, 1054, 29962, 353, 6635, 29918, 2176, 29961, 1054, 1822, 579, 668, 877, 29883, 20440, 936, 1495, 13, 13, 9651, 2537, 29892, 4853, 353, 14770, 29889, 1491, 26762, 29898, 1003, 2311, 7607, 29896, 29906, 29892, 29871, 29896, 29906, 876, 13, 9651, 27760, 353, 6635, 29918, 2176, 29889, 29725, 29898, 5696, 543, 412, 279, 1100, 1159, 13, 9651, 269, 1983, 29889, 354, 271, 1958, 29898, 29725, 29892, 11105, 29922, 9302, 29889, 3298, 359, 29918, 4561, 29898, 29725, 29892, 26688, 29922, 9302, 29889, 11227, 511, 29871, 13, 462, 4706, 274, 1958, 29922, 572, 29873, 29889, 657, 29918, 29883, 1958, 703, 1111, 324, 29893, 2817, 4968, 6862, 29922, 5574, 29892, 4853, 29922, 1165, 29892, 9732, 29922, 5574, 29897, 13, 632, 13, 9651, 4853, 29889, 842, 29918, 486, 7358, 29898, 3881, 29898, 2435, 29898, 4117, 29918, 2176, 29889, 13099, 4961, 13, 9651, 4853, 29889, 842, 29918, 3637, 7358, 29898, 3881, 29898, 2435, 29898, 4117, 29918, 2176, 29889, 13099, 4961, 13, 13, 9651, 4853, 29889, 24667, 29918, 7529, 29898, 20845, 2433, 262, 449, 1495, 13, 9651, 4853, 29889, 842, 29918, 486, 860, 21134, 29898, 4117, 29918, 2176, 29889, 13099, 29892, 13733, 29922, 29946, 29945, 29892, 447, 2433, 1266, 1495, 13, 9651, 4853, 29889, 842, 29918, 3637, 860, 21134, 29898, 4117, 29918, 2176, 29889, 13099, 29892, 13733, 29922, 29946, 29945, 29892, 2947, 2433, 3332, 1495, 13, 9651, 14770, 29889, 3257, 877, 19132, 2994, 23445, 1495, 13, 9651, 14770, 29889, 4294, 580, 13, 13, 13, 13, 1753, 766, 4838, 675, 29918, 22724, 29898, 2176, 29892, 954, 29918, 29890, 1144, 29892, 1737, 29877, 29918, 13099, 29922, 5574, 29892, 2702, 29918, 22724, 353, 7700, 29892, 6219, 353, 7700, 1125, 13, 1678, 14550, 13, 1678, 3462, 4341, 304, 766, 4838, 675, 322, 770, 1598, 1661, 29899, 29883, 20440, 936, 4341, 297, 263, 2183, 29871, 13, 1678, 848, 3515, 13, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 11701, 12205, 13, 4706, 1737, 29877, 29918, 13099, 29901, 29871, 1051, 310, 1897, 2983, 6590, 304, 4341, 411, 29871, 13, 9651, 16985, 1737, 19711, 2472, 313, 735, 29901, 14319, 18137, 29897, 13, 4706, 954, 29918, 29890, 1144, 29901, 1353, 310, 6471, 964, 607, 1897, 1819, 881, 367, 29871, 13, 9651, 766, 4838, 1891, 13, 1678, 14550, 13, 1678, 565, 2702, 29918, 22724, 29901, 13, 4706, 1661, 29918, 29883, 20440, 936, 29879, 353, 2702, 29918, 22724, 13, 1678, 1683, 29901, 13, 4706, 1661, 29918, 29883, 20440, 936, 29879, 353, 11695, 403, 29918, 29883, 20440, 936, 29879, 29898, 2176, 29892, 29871, 13, 9651, 11608, 936, 29879, 29918, 13801, 29876, 353, 338, 29918, 7320, 29892, 3240, 29918, 29883, 20440, 936, 29879, 353, 7700, 29892, 29871, 13, 9651, 1737, 359, 29918, 513, 20485, 353, 1737, 29877, 29918, 13099, 29897, 13, 1678, 13, 1678, 363, 784, 297, 1661, 29918, 29883, 20440, 936, 29879, 29901, 13, 4706, 9016, 29918, 1054, 353, 784, 718, 11119, 2109, 29908, 13, 4706, 565, 784, 1275, 376, 482, 1115, 13, 9651, 5046, 29918, 29890, 1144, 353, 5844, 29889, 27696, 3552, 2176, 29961, 1054, 1822, 3317, 580, 448, 4489, 29961, 1054, 1822, 1195, 3101, 847, 29871, 29896, 29900, 29897, 13, 13, 9651, 565, 6219, 29901, 13, 18884, 4489, 29961, 2109, 29918, 1054, 1402, 7945, 29918, 29890, 1144, 353, 10518, 29889, 7582, 29898, 2176, 29961, 1054, 1402, 289, 1144, 353, 5046, 29918, 29890, 1144, 29892, 29871, 13, 462, 1678, 1492, 353, 7700, 29892, 16716, 29922, 29900, 29892, 3240, 29890, 1144, 29922, 5451, 29897, 13, 9651, 1683, 29901, 13, 18884, 4489, 29961, 2109, 29918, 1054, 29962, 353, 10518, 29889, 7582, 29898, 2176, 29961, 1054, 1402, 289, 1144, 353, 5046, 29918, 29890, 1144, 29892, 1492, 353, 7700, 29892, 29871, 13, 462, 1678, 16716, 29922, 29900, 29892, 3240, 29890, 1144, 29922, 5451, 29897, 13, 4706, 1683, 29901, 13, 9651, 565, 6219, 29901, 13, 18884, 4489, 29961, 2109, 29918, 1054, 1402, 7945, 29918, 29890, 1144, 353, 10518, 29889, 7582, 29898, 2176, 29961, 1054, 1402, 289, 1144, 353, 954, 29918, 29890, 1144, 29892, 29871, 13, 462, 1678, 16716, 29922, 29900, 29892, 3240, 29890, 1144, 29922, 5451, 29897, 13, 9651, 1683, 29901, 13, 18884, 4489, 29961, 2109, 29918, 1054, 29962, 353, 10518, 29889, 7582, 29898, 2176, 29961, 1054, 1402, 289, 1144, 353, 954, 29918, 29890, 1144, 29892, 16716, 29922, 29900, 29892, 29871, 13, 462, 1678, 3240, 29890, 1144, 29922, 5451, 29897, 13, 1678, 565, 6219, 29901, 13, 4706, 736, 7945, 29918, 29890, 1144, 13, 13, 13, 13, 13, 13, 1753, 766, 4838, 675, 29918, 14968, 29918, 1688, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 29892, 1603, 29918, 2204, 1331, 1125, 13, 1678, 363, 474, 29892, 313, 14968, 29892, 1243, 29897, 297, 26985, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 1125, 13, 4706, 5445, 29918, 22724, 353, 1603, 29918, 2204, 1331, 29961, 29875, 29962, 13, 4706, 363, 784, 297, 5445, 29918, 22724, 29901, 13, 9651, 27831, 353, 784, 718, 22868, 2109, 29915, 13, 9651, 7945, 29961, 2972, 287, 1402, 7945, 29918, 29890, 1144, 353, 10518, 29889, 7582, 29898, 14968, 29961, 1054, 1402, 289, 1144, 353, 29871, 29946, 29892, 16716, 353, 29871, 29900, 29892, 3240, 29890, 1144, 353, 5852, 29897, 13, 9651, 1243, 29961, 2972, 287, 29962, 353, 10518, 29889, 7582, 29898, 1688, 29961, 1054, 1402, 289, 1144, 353, 7945, 29918, 29890, 1144, 29892, 16716, 353, 29871, 29900, 29897, 13, 13, 13, 1753, 9659, 29918, 14968, 29918, 1688, 29918, 2218, 4838, 2133, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 29892, 1603, 29918, 2204, 1331, 1125, 13, 1678, 363, 474, 29892, 313, 14968, 29892, 1243, 29897, 297, 26985, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 1125, 13, 4706, 363, 784, 297, 1603, 29918, 2204, 1331, 29961, 29875, 5387, 13, 9651, 27831, 353, 784, 13, 9651, 27831, 353, 784, 718, 22868, 2109, 29915, 13, 9651, 1596, 703, 842, 6571, 6571, 7945, 29901, 6571, 1213, 29889, 4830, 29898, 29875, 29892, 784, 29892, 7945, 29961, 2972, 287, 1822, 13092, 22130, 13, 9651, 1596, 580, 13, 9651, 1596, 703, 842, 6571, 6571, 1243, 29901, 6571, 1213, 29889, 4830, 29898, 29875, 29892, 784, 29892, 1243, 29961, 2972, 287, 1822, 13092, 22130, 13, 9651, 1596, 580, 13, 308, 13, 13, 1753, 5768, 29918, 698, 29918, 2109, 9571, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 29892, 304, 29918, 8865, 1125, 13, 1678, 14550, 13, 1678, 20724, 4341, 515, 1716, 7945, 322, 1243, 6166, 29889, 13, 268, 13, 1678, 10567, 29879, 29901, 13, 4706, 7945, 29918, 1688, 29918, 9161, 2701, 29901, 1051, 310, 18761, 29881, 848, 19935, 13, 4706, 304, 29918, 8865, 29901, 1051, 310, 4341, 304, 5768, 13, 1678, 14550, 13, 1678, 363, 7945, 29892, 1243, 297, 7945, 29918, 1688, 29918, 9161, 2701, 29901, 13, 4706, 7945, 29889, 8865, 29898, 517, 29918, 8865, 29892, 9685, 353, 29871, 29896, 29892, 297, 6689, 353, 5852, 29897, 13, 4706, 1243, 29889, 8865, 29898, 517, 29918, 8865, 29892, 9685, 353, 29871, 29896, 29892, 297, 6689, 353, 5852, 29897, 13, 13, 13, 1753, 1653, 29918, 19541, 29918, 16908, 29898, 2176, 29892, 28730, 29918, 517, 29918, 29881, 11770, 29892, 13553, 29918, 1761, 1125, 13, 1678, 14550, 13, 1678, 6204, 4341, 310, 7581, 1819, 6590, 304, 1819, 2038, 5225, 363, 29871, 13, 1678, 4629, 4341, 297, 263, 2183, 12205, 2729, 373, 3619, 29361, 13, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 11701, 12205, 13, 4706, 28730, 29918, 517, 29918, 29881, 11770, 29901, 313, 1761, 310, 6031, 29897, 4341, 297, 848, 3515, 304, 367, 19030, 29871, 13, 9651, 964, 20254, 3651, 13, 4706, 13553, 29918, 1761, 29901, 313, 1761, 310, 6031, 29897, 3838, 470, 12216, 2129, 5134, 297, 4341, 29871, 13, 9651, 304, 367, 19030, 23941, 263, 20254, 2286, 881, 367, 2825, 2729, 29871, 13, 9651, 373, 967, 1819, 29871, 13, 1678, 14550, 13, 1678, 13553, 29918, 1807, 353, 4852, 29989, 2564, 7122, 29898, 26766, 29918, 1761, 29897, 13, 1678, 363, 784, 297, 28730, 29918, 517, 29918, 29881, 11770, 29901, 13, 4706, 784, 978, 29918, 509, 4661, 353, 337, 29889, 1491, 29898, 26766, 29918, 1807, 29892, 15516, 784, 29897, 13, 4706, 7581, 29918, 1054, 29918, 978, 353, 525, 13264, 29918, 29915, 718, 784, 978, 29918, 509, 4661, 13, 4706, 4489, 29961, 19541, 29918, 1054, 29918, 978, 29962, 353, 4489, 29961, 1054, 1822, 7302, 29898, 2892, 921, 29901, 921, 1405, 29871, 29900, 29897, 13, 13, 13, 13, 1753, 6492, 29918, 29725, 29898, 2176, 29892, 2927, 29918, 7320, 29892, 1737, 29877, 29918, 13099, 29922, 5574, 1125, 13, 1678, 14550, 13, 1678, 4250, 16349, 18822, 322, 8855, 800, 310, 5680, 363, 1661, 29899, 29883, 20440, 936, 29871, 13, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 11701, 12205, 13, 4706, 11608, 936, 29879, 29918, 1761, 29901, 1051, 310, 6031, 6590, 304, 11608, 936, 4341, 29871, 13, 9651, 313, 735, 29901, 14319, 11561, 29897, 13, 1678, 14550, 13, 1678, 1661, 29918, 29883, 20440, 936, 29879, 353, 11695, 403, 29918, 29883, 20440, 936, 29879, 29898, 2176, 29892, 11608, 936, 29879, 29918, 13801, 29876, 353, 338, 29918, 7320, 29892, 29871, 13, 4706, 3240, 29918, 29883, 20440, 936, 29879, 353, 7700, 29892, 1737, 359, 29918, 513, 20485, 353, 1737, 29877, 29918, 13099, 29897, 13, 1678, 13, 1678, 6492, 29918, 1761, 353, 1661, 29918, 29883, 20440, 936, 29879, 718, 518, 2780, 29918, 7320, 29962, 13, 1678, 27760, 353, 269, 1983, 29889, 18784, 5317, 29898, 2176, 29961, 5317, 29918, 1761, 1402, 298, 434, 353, 2927, 29918, 7320, 29892, 282, 26456, 353, 376, 2697, 29906, 1159, 13, 13, 13, 13, 1753, 6492, 29918, 2674, 800, 4034, 29898, 2176, 29892, 4682, 29918, 29916, 29892, 921, 1643, 29892, 14394, 29918, 29891, 29892, 343, 1643, 29892, 921, 13400, 353, 6213, 29892, 29871, 13, 462, 4706, 343, 13400, 353, 6213, 29892, 2927, 29918, 4117, 353, 6213, 29892, 4175, 29918, 1054, 353, 6213, 29892, 29871, 13, 462, 4706, 4175, 29918, 29883, 21977, 353, 6213, 29892, 4175, 29918, 3207, 353, 6213, 29892, 29871, 13, 462, 4706, 4175, 29918, 3207, 29906, 353, 6213, 1125, 13, 1678, 14550, 13, 1678, 18399, 1023, 5680, 297, 263, 2183, 848, 3515, 2750, 1269, 916, 304, 1776, 29871, 13, 1678, 9443, 322, 714, 27801, 29889, 29871, 13, 268, 13, 1678, 6212, 3224, 29901, 23430, 515, 2045, 597, 29879, 29941, 29889, 17260, 10467, 29889, 510, 29914, 16596, 29889, 1272, 24821, 29889, 510, 29914, 7312, 29918, 16596, 29914, 11980, 29918, 2008, 370, 1398, 29918, 26856, 271, 29918, 10654, 29889, 5140, 13, 1678, 14550, 13, 1678, 565, 4175, 29918, 1054, 322, 4175, 29918, 29883, 21977, 322, 4175, 29918, 3207, 29901, 13, 4706, 565, 4175, 29918, 29883, 21977, 1275, 525, 6279, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 6736, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 4141, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 1405, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 3797, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 5277, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 1896, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 529, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 1837, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 1275, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 10743, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 29961, 2176, 29961, 4572, 29918, 1054, 29962, 2804, 4175, 29918, 3207, 29962, 13, 4706, 25342, 4175, 29918, 29883, 21977, 1275, 525, 14811, 2396, 13, 9651, 671, 29918, 2176, 353, 4489, 15625, 2176, 29961, 4572, 29918, 1054, 29962, 1405, 4175, 29918, 3207, 29897, 322, 313, 2176, 29961, 4572, 29918, 1054, 29962, 529, 4175, 29918, 3207, 29906, 4638, 13, 13, 4706, 330, 353, 269, 1983, 29889, 21457, 5317, 29898, 29916, 353, 4682, 29918, 29916, 29892, 343, 353, 4682, 29918, 29891, 29892, 848, 353, 671, 29918, 2176, 29892, 9565, 353, 29871, 29941, 29892, 29871, 13, 462, 4706, 298, 434, 353, 2927, 29918, 4117, 29897, 13, 4706, 330, 353, 313, 29887, 29889, 842, 29918, 8990, 29918, 21134, 29898, 29916, 1643, 29892, 29891, 1643, 8106, 842, 29898, 29916, 2576, 353, 921, 13400, 1919, 343, 2576, 353, 343, 13400, 29897, 13, 4706, 6492, 29918, 3257, 353, 343, 1643, 718, 376, 491, 376, 718, 921, 1643, 13, 4706, 14770, 29889, 3257, 29898, 5317, 29918, 3257, 29897, 13, 4706, 14770, 29889, 4294, 29898, 29887, 29897, 13, 268, 13, 1678, 1683, 29901, 13, 4706, 330, 353, 269, 1983, 29889, 21457, 5317, 29898, 29916, 353, 4682, 29918, 29916, 29892, 343, 353, 4682, 29918, 29891, 29892, 848, 353, 4489, 29892, 9565, 353, 29871, 29941, 29892, 29871, 13, 462, 4706, 298, 434, 353, 2927, 29918, 4117, 29897, 13, 4706, 330, 353, 313, 29887, 29889, 842, 29918, 8990, 29918, 21134, 29898, 29916, 1643, 29892, 29891, 1643, 8106, 842, 29898, 29916, 2576, 353, 921, 13400, 1919, 343, 2576, 353, 343, 13400, 29897, 13, 4706, 6492, 29918, 3257, 353, 343, 1643, 718, 376, 491, 376, 718, 921, 1643, 13, 4706, 14770, 29889, 3257, 29898, 5317, 29918, 3257, 29897, 13, 4706, 14770, 29889, 4294, 29898, 29887, 29897, 13, 13, 13, 13, 13, 13, 13, 13, 1753, 19745, 29918, 29878, 2219, 359, 29898, 2176, 29892, 3160, 29918, 22724, 29892, 7663, 29918, 22724, 29892, 1158, 353, 376, 2798, 613, 29871, 13, 18884, 282, 312, 353, 7700, 1125, 13, 1678, 14550, 13, 1678, 382, 4387, 403, 2702, 5680, 3025, 27270, 373, 697, 470, 901, 7663, 29871, 13, 268, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 313, 1272, 2557, 29897, 11701, 12205, 13, 4706, 3160, 29918, 22724, 29901, 313, 1761, 310, 6031, 29897, 1897, 2983, 304, 367, 11404, 630, 470, 29871, 13, 9651, 27831, 29871, 13, 4706, 7663, 29918, 22724, 29901, 313, 1761, 310, 6031, 29897, 1897, 1024, 29898, 29879, 29897, 363, 2286, 29898, 29879, 29897, 1304, 29871, 13, 9651, 363, 27270, 13, 4706, 1158, 29901, 313, 1807, 29897, 2318, 1609, 11404, 362, 1158, 363, 1897, 1819, 13, 13, 1678, 10604, 29901, 13, 4706, 11959, 29918, 2176, 29901, 11701, 848, 3515, 310, 27831, 848, 13, 1678, 14550, 13, 1678, 565, 1158, 1275, 376, 2798, 1115, 13, 4706, 11959, 29918, 2176, 353, 4489, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2798, 580, 13, 4706, 565, 282, 312, 29901, 13, 9651, 2323, 29918, 1054, 353, 3160, 29918, 22724, 14352, 29896, 29962, 718, 376, 2431, 1760, 482, 29908, 13, 9651, 11959, 29918, 2176, 29961, 14369, 29918, 1054, 29962, 353, 5135, 2176, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2798, 580, 847, 29871, 13, 18884, 4489, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2798, 2141, 2083, 3101, 334, 29871, 29896, 29900, 29900, 29897, 13, 13, 1678, 25342, 1158, 1275, 376, 2083, 1115, 13, 4706, 11959, 29918, 2176, 353, 4489, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2083, 580, 13, 4706, 565, 282, 312, 29901, 13, 9651, 2323, 29918, 1054, 353, 3160, 29918, 22724, 14352, 29896, 29962, 718, 376, 2431, 1760, 482, 29908, 13, 9651, 11959, 29918, 2176, 29961, 14369, 29918, 1054, 29962, 353, 5135, 2176, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2083, 580, 847, 29871, 13, 18884, 4489, 29961, 2856, 29918, 22724, 1822, 27789, 29898, 7320, 29918, 22724, 467, 2083, 2141, 2083, 3101, 334, 29871, 29896, 29900, 29900, 29897, 13, 1678, 736, 11959, 29918, 2176, 13, 268, 13, 13, 13, 1753, 4682, 29918, 1609, 29918, 24756, 29898, 2176, 29892, 1737, 29877, 29892, 3902, 29918, 1707, 29892, 954, 29918, 1707, 29892, 1158, 353, 376, 2168, 713, 29908, 1125, 13, 1678, 14550, 13, 1678, 382, 4387, 403, 2702, 5680, 491, 1737, 5275, 313, 735, 29901, 14319, 775, 29897, 13, 268, 13, 1678, 10567, 29879, 29901, 13, 4706, 4489, 29901, 313, 1272, 2557, 29897, 11701, 12205, 13, 4706, 1737, 29877, 29901, 313, 1807, 29897, 1897, 1024, 6590, 304, 1737, 5275, 1304, 363, 27270, 13, 4706, 3902, 29918, 1707, 29901, 313, 1807, 29897, 1897, 1024, 363, 3902, 272, 7606, 2286, 1304, 363, 29871, 13, 9651, 27270, 13, 4706, 954, 29918, 1707, 29901, 313, 1807, 29897, 1897, 1024, 363, 16985, 2286, 29914, 4682, 304, 367, 29871, 13, 9651, 11404, 630, 13, 4706, 1158, 29901, 313, 1807, 29897, 2318, 1609, 11404, 362, 1158, 363, 1897, 1819, 13, 13, 1678, 10604, 29901, 13, 4706, 1737, 29877, 29918, 22100, 29901, 11701, 848, 3515, 310, 27831, 848, 13, 1678, 14550, 13, 1678, 4489, 29918, 24756, 353, 4489, 15625, 2176, 29961, 24756, 29962, 2804, 29871, 29900, 4638, 13, 1678, 2318, 1609, 29918, 1761, 353, 518, 24756, 29962, 718, 3902, 29918, 1707, 13, 1678, 565, 1158, 1275, 376, 2168, 713, 1115, 13, 4706, 1737, 29877, 29918, 22100, 353, 4489, 29918, 24756, 29889, 27789, 29898, 27789, 29918, 1761, 9601, 1949, 29918, 1707, 1822, 2168, 713, 2141, 348, 1429, 29898, 5563, 353, 29871, 29896, 29897, 13, 1678, 565, 1158, 1275, 376, 2798, 1115, 13, 4706, 1737, 29877, 29918, 22100, 353, 4489, 29918, 24756, 29889, 27789, 29898, 27789, 29918, 1761, 9601, 1949, 29918, 1707, 1822, 2798, 2141, 348, 1429, 29898, 5563, 353, 29871, 29896, 29897, 13, 1678, 1737, 29877, 29918, 22100, 29889, 5589, 1056, 29898, 1767, 353, 12633, 297, 6689, 353, 5852, 29897, 13, 1678, 736, 1737, 29877, 29918, 22100, 13, 13, 13, 13, 1753, 6492, 29918, 3332, 29918, 5721, 1883, 29898, 14968, 29918, 1688, 29918, 9161, 2701, 29892, 722, 29918, 8977, 29892, 731, 29918, 1949, 1125, 13, 1678, 363, 474, 29892, 784, 297, 26985, 29898, 1707, 29918, 8977, 1839, 3332, 29879, 2033, 1125, 13, 4706, 7945, 29892, 1243, 353, 7945, 29918, 1688, 29918, 9161, 2701, 29961, 842, 29918, 1949, 29962, 13, 4706, 6492, 29918, 3257, 353, 376, 25119, 491, 6571, 363, 26101, 3789, 6571, 1642, 4830, 29898, 1054, 29892, 731, 29918, 1949, 29897, 13, 4706, 7945, 29961, 1054, 1822, 1767, 29918, 2798, 29879, 2141, 6605, 29918, 2248, 2141, 5317, 29898, 14380, 2433, 1646, 742, 3611, 353, 6492, 29918, 3257, 29897, 13, 4706, 14770, 29889, 4294, 580, 13, 13, 2 ]
src/dataclay/communication/grpc/messages/logicmodule/__init__.py
kpavel/pyclay
1
14479
""" Class description goes here. """ """Package containing gRPC classes.""" __author__ = '<NAME> <<EMAIL>>' __copyright__ = '2017 Barcelona Supercomputing Center (BSC-CNS)'
[ 1, 29871, 13, 15945, 29908, 4134, 6139, 5771, 1244, 29889, 9995, 13, 13, 15945, 29908, 14459, 6943, 330, 29934, 9026, 4413, 1213, 15945, 13, 13, 1649, 8921, 1649, 353, 12801, 5813, 29958, 3532, 26862, 6227, 6778, 29915, 13, 1649, 8552, 1266, 1649, 353, 525, 29906, 29900, 29896, 29955, 12408, 5670, 12097, 292, 7817, 313, 29933, 7187, 29899, 29907, 3059, 16029, 13, 2 ]
irida_uploader_cl/parsers/nextseq/parser.py
duanjunhyq/irida_uploader_cl
0
1608448
<filename>irida_uploader_cl/parsers/nextseq/parser.py import logging import os import irida_uploader_cl.model as model import irida_uploader_cl.progress as progress from irida_uploader_cl.parsers import exceptions from irida_uploader_cl.parsers.nextseq import sample_parser, validation class Parser: SAMPLE_SHEET_FILE_NAME = 'SampleSheet.csv' UPLOAD_COMPLETE_FILE_NAME = 'RTAComplete.txt' @staticmethod def get_required_file_list(): """ Returns a list of files that are required for a run directory to be considered valid :return: [files_names] """ logging.warning("NOTE: If bcl2fastq has not finished, run may return as invalid, " "or incomplete files could be uploaded!") return [ Parser.SAMPLE_SHEET_FILE_NAME, Parser.UPLOAD_COMPLETE_FILE_NAME ] @staticmethod def _find_directory_list(directory): """Find and return all directories in the specified directory. Arguments: directory -- the directory to find directories in Returns: a list of directories including current directory """ # Checks if we can access to the given directory, return empty and log a warning if we cannot. if not os.access(directory, os.W_OK): raise exceptions.DirectoryError("The directory is not writeable, " "can not upload samples from this directory {}".format(directory), directory) dir_list = next(os.walk(directory))[1] # Gets the list of directories in the directory full_dir_list = [] for d in dir_list: full_dir_list.append(os.path.join(directory, d)) return full_dir_list @staticmethod def find_runs(directory): """ find a list of run directories in the directory given :param directory: :return: list of DirectoryStatus objects """ logging.info("looking for runs in {}".format(directory)) runs = [] directory_list = Parser._find_directory_list(directory) for d in directory_list: runs.append(progress.get_directory_status(d, Parser.get_required_file_list())) return runs @staticmethod def find_single_run(directory): """ Find a run in the base directory given :param directory: :return: DirectoryStatus object """ logging.info("looking for run in {}".format(directory)) return progress.get_directory_status(directory, Parser.get_required_file_list()) @staticmethod def get_sample_sheet(directory): """ gets the sample sheet file path from a given run directory :param directory: :return: """ logging.info("Looking for sample sheet in {}".format(directory)) # Checks if we can access to the given directory, return empty and log a warning if we cannot. if not os.access(directory, os.W_OK): logging.error(("The directory is not accessible, can not parse samples from this directory {}" "".format(directory), directory)) raise exceptions.DirectoryError("The directory is not accessible, " "can not parse samples from this directory {}".format(directory), directory) sample_sheet_file_name = Parser.SAMPLE_SHEET_FILE_NAME file_list = next(os.walk(directory))[2] # Gets the list of files in the directory if sample_sheet_file_name not in file_list: logging.error("No sample sheet file in the NextSeq format found") raise exceptions.DirectoryError("The directory {} has no sample sheet file in the NextSeq format" " with the name {}" .format(directory, sample_sheet_file_name), directory) else: logging.debug("Sample sheet found") return os.path.join(directory, sample_sheet_file_name) @staticmethod def get_sequencing_run(sample_sheet): """ Does local validation on the integrety of the run directory / sample sheet Throws a ValidationError with a valadation result attached if it cannot make a sequencing run :param sample_sheet: :return: SequencingRun """ # Try to get the sample sheet, validate that the sample sheet is valid validation_result = validation.validate_sample_sheet(sample_sheet) if not validation_result.is_valid(): logging.error("Errors occurred while getting sample sheet") raise exceptions.ValidationError("Errors occurred while getting sample sheet", validation_result) # Try to parse the meta data from the sample sheet, throw validation error if errors occur validation_result = model.ValidationResult() try: run_metadata = sample_parser.parse_metadata(sample_sheet) except exceptions.SampleSheetError as error: validation_result.add_error(error) logging.error("Errors occurred while parsing metadata") raise exceptions.ValidationError("Errors occurred while parsing metadata", validation_result) # Try to build sequencing run from sample sheet & meta data, raise validation error if errors occur try: sequencing_run = sample_parser.build_sequencing_run_from_samples(sample_sheet, run_metadata) except exceptions.SequenceFileError as error: validation_result.add_error(error) logging.error("Errors occurred while building sequence run from sample sheet") raise exceptions.ValidationError("Errors occurred while building sequence run from sample sheet", validation_result) return sequencing_run
[ 1, 529, 9507, 29958, 381, 1458, 29918, 9009, 261, 29918, 695, 29914, 862, 4253, 29914, 4622, 11762, 29914, 16680, 29889, 2272, 13, 5215, 12183, 13, 5215, 2897, 13, 13, 5215, 3805, 1458, 29918, 9009, 261, 29918, 695, 29889, 4299, 408, 1904, 13, 5215, 3805, 1458, 29918, 9009, 261, 29918, 695, 29889, 18035, 408, 6728, 13, 13, 3166, 3805, 1458, 29918, 9009, 261, 29918, 695, 29889, 862, 4253, 1053, 15283, 13, 3166, 3805, 1458, 29918, 9009, 261, 29918, 695, 29889, 862, 4253, 29889, 4622, 11762, 1053, 4559, 29918, 16680, 29892, 8845, 13, 13, 13, 1990, 1459, 643, 29901, 13, 13, 1678, 16698, 3580, 1307, 29918, 7068, 29923, 2544, 29918, 7724, 29918, 5813, 353, 525, 17708, 10654, 29889, 7638, 29915, 13, 1678, 11901, 29428, 29918, 21514, 18476, 29918, 7724, 29918, 5813, 353, 525, 29934, 6040, 17813, 29889, 3945, 29915, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 12403, 29918, 1445, 29918, 1761, 7295, 13, 4706, 9995, 13, 4706, 16969, 263, 1051, 310, 2066, 393, 526, 3734, 363, 263, 1065, 3884, 304, 367, 5545, 2854, 13, 4706, 584, 2457, 29901, 518, 5325, 29918, 7039, 29962, 13, 4706, 9995, 13, 4706, 12183, 29889, 27392, 703, 12256, 29923, 29901, 960, 289, 695, 29906, 11255, 29939, 756, 451, 7743, 29892, 1065, 1122, 736, 408, 8340, 29892, 376, 13, 462, 4706, 376, 272, 28907, 2066, 1033, 367, 20373, 29991, 1159, 13, 4706, 736, 518, 13, 9651, 1459, 643, 29889, 8132, 3580, 1307, 29918, 7068, 29923, 2544, 29918, 7724, 29918, 5813, 29892, 13, 9651, 1459, 643, 29889, 4897, 29428, 29918, 21514, 18476, 29918, 7724, 29918, 5813, 13, 4706, 4514, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 903, 2886, 29918, 12322, 29918, 1761, 29898, 12322, 1125, 13, 4706, 9995, 12542, 322, 736, 599, 17525, 297, 278, 6790, 3884, 29889, 13, 13, 4706, 11842, 9331, 29901, 13, 4706, 3884, 1192, 278, 3884, 304, 1284, 17525, 297, 13, 13, 4706, 16969, 29901, 263, 1051, 310, 17525, 3704, 1857, 3884, 13, 4706, 9995, 13, 13, 4706, 396, 5399, 29879, 565, 591, 508, 2130, 304, 278, 2183, 3884, 29892, 736, 4069, 322, 1480, 263, 9177, 565, 591, 2609, 29889, 13, 4706, 565, 451, 2897, 29889, 5943, 29898, 12322, 29892, 2897, 29889, 29956, 29918, 8949, 1125, 13, 9651, 12020, 15283, 29889, 9882, 2392, 703, 1576, 3884, 338, 451, 2436, 519, 29892, 376, 13, 462, 462, 9651, 376, 3068, 451, 6441, 11916, 515, 445, 3884, 6571, 1642, 4830, 29898, 12322, 511, 13, 462, 462, 9651, 3884, 29897, 13, 13, 4706, 4516, 29918, 1761, 353, 2446, 29898, 359, 29889, 20919, 29898, 12322, 876, 29961, 29896, 29962, 29871, 396, 402, 1691, 278, 1051, 310, 17525, 297, 278, 3884, 13, 4706, 2989, 29918, 3972, 29918, 1761, 353, 5159, 13, 4706, 363, 270, 297, 4516, 29918, 1761, 29901, 13, 9651, 2989, 29918, 3972, 29918, 1761, 29889, 4397, 29898, 359, 29889, 2084, 29889, 7122, 29898, 12322, 29892, 270, 876, 13, 4706, 736, 2989, 29918, 3972, 29918, 1761, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1284, 29918, 3389, 29879, 29898, 12322, 1125, 13, 4706, 9995, 13, 4706, 1284, 263, 1051, 310, 1065, 17525, 297, 278, 3884, 2183, 13, 13, 4706, 584, 3207, 3884, 29901, 13, 4706, 584, 2457, 29901, 1051, 310, 18862, 5709, 3618, 13, 4706, 9995, 13, 4706, 12183, 29889, 3888, 703, 23261, 363, 6057, 297, 6571, 1642, 4830, 29898, 12322, 876, 13, 13, 4706, 6057, 353, 5159, 13, 4706, 3884, 29918, 1761, 353, 1459, 643, 3032, 2886, 29918, 12322, 29918, 1761, 29898, 12322, 29897, 13, 4706, 363, 270, 297, 3884, 29918, 1761, 29901, 13, 9651, 6057, 29889, 4397, 29898, 18035, 29889, 657, 29918, 12322, 29918, 4882, 29898, 29881, 29892, 1459, 643, 29889, 657, 29918, 12403, 29918, 1445, 29918, 1761, 22130, 13, 13, 4706, 736, 6057, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1284, 29918, 14369, 29918, 3389, 29898, 12322, 1125, 13, 4706, 9995, 13, 4706, 10987, 263, 1065, 297, 278, 2967, 3884, 2183, 13, 13, 4706, 584, 3207, 3884, 29901, 13, 4706, 584, 2457, 29901, 18862, 5709, 1203, 13, 4706, 9995, 13, 4706, 12183, 29889, 3888, 703, 23261, 363, 1065, 297, 6571, 1642, 4830, 29898, 12322, 876, 13, 13, 4706, 736, 6728, 29889, 657, 29918, 12322, 29918, 4882, 29898, 12322, 29892, 1459, 643, 29889, 657, 29918, 12403, 29918, 1445, 29918, 1761, 3101, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 11249, 29918, 9855, 29898, 12322, 1125, 13, 4706, 9995, 13, 4706, 4947, 278, 4559, 9869, 934, 2224, 515, 263, 2183, 1065, 3884, 13, 13, 4706, 584, 3207, 3884, 29901, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 12183, 29889, 3888, 703, 14959, 292, 363, 4559, 9869, 297, 6571, 1642, 4830, 29898, 12322, 876, 13, 13, 4706, 396, 5399, 29879, 565, 591, 508, 2130, 304, 278, 2183, 3884, 29892, 736, 4069, 322, 1480, 263, 9177, 565, 591, 2609, 29889, 13, 4706, 565, 451, 2897, 29889, 5943, 29898, 12322, 29892, 2897, 29889, 29956, 29918, 8949, 1125, 13, 9651, 12183, 29889, 2704, 29898, 703, 1576, 3884, 338, 451, 15579, 29892, 508, 451, 6088, 11916, 515, 445, 3884, 426, 5038, 13, 462, 965, 376, 1642, 4830, 29898, 12322, 511, 3884, 876, 13, 9651, 12020, 15283, 29889, 9882, 2392, 703, 1576, 3884, 338, 451, 15579, 29892, 376, 13, 462, 462, 9651, 376, 3068, 451, 6088, 11916, 515, 445, 3884, 6571, 1642, 4830, 29898, 12322, 511, 3884, 29897, 13, 13, 4706, 4559, 29918, 9855, 29918, 1445, 29918, 978, 353, 1459, 643, 29889, 8132, 3580, 1307, 29918, 7068, 29923, 2544, 29918, 7724, 29918, 5813, 13, 4706, 934, 29918, 1761, 353, 2446, 29898, 359, 29889, 20919, 29898, 12322, 876, 29961, 29906, 29962, 29871, 396, 402, 1691, 278, 1051, 310, 2066, 297, 278, 3884, 13, 4706, 565, 4559, 29918, 9855, 29918, 1445, 29918, 978, 451, 297, 934, 29918, 1761, 29901, 13, 9651, 12183, 29889, 2704, 703, 3782, 4559, 9869, 934, 297, 278, 8084, 23718, 3402, 1476, 1159, 13, 9651, 12020, 15283, 29889, 9882, 2392, 703, 1576, 3884, 6571, 756, 694, 4559, 9869, 934, 297, 278, 8084, 23718, 3402, 29908, 13, 462, 462, 9651, 376, 411, 278, 1024, 426, 5038, 13, 462, 462, 9651, 869, 4830, 29898, 12322, 29892, 4559, 29918, 9855, 29918, 1445, 29918, 978, 511, 3884, 29897, 13, 4706, 1683, 29901, 13, 9651, 12183, 29889, 8382, 703, 17708, 9869, 1476, 1159, 13, 9651, 736, 2897, 29889, 2084, 29889, 7122, 29898, 12322, 29892, 4559, 29918, 9855, 29918, 1445, 29918, 978, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 679, 29918, 6831, 16750, 29918, 3389, 29898, 11249, 29918, 9855, 1125, 13, 4706, 9995, 13, 4706, 5538, 1887, 8845, 373, 278, 2293, 7979, 1017, 310, 278, 1065, 3884, 847, 4559, 9869, 13, 13, 4706, 498, 5727, 263, 15758, 362, 2392, 411, 263, 659, 328, 362, 1121, 10959, 565, 372, 2609, 1207, 263, 8617, 16750, 1065, 13, 13, 4706, 584, 3207, 4559, 29918, 9855, 29901, 13, 4706, 584, 2457, 29901, 922, 339, 16750, 6558, 13, 4706, 9995, 13, 13, 4706, 396, 3967, 304, 679, 278, 4559, 9869, 29892, 12725, 393, 278, 4559, 9869, 338, 2854, 13, 4706, 8845, 29918, 2914, 353, 8845, 29889, 15480, 29918, 11249, 29918, 9855, 29898, 11249, 29918, 9855, 29897, 13, 4706, 565, 451, 8845, 29918, 2914, 29889, 275, 29918, 3084, 7295, 13, 9651, 12183, 29889, 2704, 703, 22463, 10761, 1550, 2805, 4559, 9869, 1159, 13, 9651, 12020, 15283, 29889, 19448, 2392, 703, 22463, 10761, 1550, 2805, 4559, 9869, 613, 8845, 29918, 2914, 29897, 13, 13, 4706, 396, 3967, 304, 6088, 278, 12700, 848, 515, 278, 4559, 9869, 29892, 3183, 8845, 1059, 565, 4436, 6403, 13, 4706, 8845, 29918, 2914, 353, 1904, 29889, 19448, 3591, 580, 13, 4706, 1018, 29901, 13, 9651, 1065, 29918, 19635, 353, 4559, 29918, 16680, 29889, 5510, 29918, 19635, 29898, 11249, 29918, 9855, 29897, 13, 4706, 5174, 15283, 29889, 17708, 10654, 2392, 408, 1059, 29901, 13, 9651, 8845, 29918, 2914, 29889, 1202, 29918, 2704, 29898, 2704, 29897, 13, 9651, 12183, 29889, 2704, 703, 22463, 10761, 1550, 13755, 15562, 1159, 13, 9651, 12020, 15283, 29889, 19448, 2392, 703, 22463, 10761, 1550, 13755, 15562, 613, 8845, 29918, 2914, 29897, 13, 13, 4706, 396, 3967, 304, 2048, 8617, 16750, 1065, 515, 4559, 9869, 669, 12700, 848, 29892, 12020, 8845, 1059, 565, 4436, 6403, 13, 4706, 1018, 29901, 13, 9651, 8617, 16750, 29918, 3389, 353, 4559, 29918, 16680, 29889, 4282, 29918, 6831, 16750, 29918, 3389, 29918, 3166, 29918, 27736, 29898, 11249, 29918, 9855, 29892, 1065, 29918, 19635, 29897, 13, 4706, 5174, 15283, 29889, 20529, 2283, 2392, 408, 1059, 29901, 13, 9651, 8845, 29918, 2914, 29889, 1202, 29918, 2704, 29898, 2704, 29897, 13, 9651, 12183, 29889, 2704, 703, 22463, 10761, 1550, 5214, 5665, 1065, 515, 4559, 9869, 1159, 13, 9651, 12020, 15283, 29889, 19448, 2392, 703, 22463, 10761, 1550, 5214, 5665, 1065, 515, 4559, 9869, 613, 13, 462, 462, 632, 8845, 29918, 2914, 29897, 13, 13, 4706, 736, 8617, 16750, 29918, 3389, 13, 2 ]
slack_resurrect/settings.py
halkeye/slacktalker
1
1610932
import os class Config: @classmethod def toJSON(cls): import json data = dict() for item in dir(cls): if item.isupper(): data[item] = getattr(cls, item) return json.dumps(data) DEBUG = False TESTING = False DEBUG_SQL = False SQLALCHEMY_TRACK_MODIFICATIONS = False SENTRY_TOKEN = os.environ.get('SENTRY_TOKEN') SENTRY_ENVIRONMENT = None SLACK_BOT_TOKEN = os.environ.get('SLACK_BOT_TOKEN') # Webhooks token SLACK_TOKEN = os.environ.get('SLACK_TOKEN') PORT = 3000 class DevelopmentConfig(Config): DEBUG = True DEBUG_SQL = True SENTRY_ENVIRONMENT = 'development' SQLALCHEMY_DATABASE_URI = 'sqlite:///development.sqlite' class TestingConfig(DevelopmentConfig): TESTING = True DEBUG_SQL = False SQLALCHEMY_DATABASE_URI = 'sqlite://' SENTRY_TOKEN = None SENTRY_ENVIRONMENT = 'testing' SLACK_TOKEN = '3rm7Ngf57te4ncHKwSvWhseb' SLACK_BOT_TOKEN = None class ProductionConfig(Config): DEBUG = False TESTING = False SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') SENTRY_ENVIRONMENT = 'production' ENV = os.environ.get('APP_ENV', os.environ.get('FLASK_ENV', 'prod')) CONFIG = None if ENV == 'dev' or ENV == 'development': CONFIG = DevelopmentConfig elif ENV == 'test': CONFIG = TestingConfig elif ENV == 'prod': CONFIG = ProductionConfig else: raise ValueError('Invalid environment name')
[ 1, 1053, 2897, 13, 13, 13, 1990, 12782, 29901, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 304, 7249, 29898, 25932, 1125, 13, 4706, 1053, 4390, 13, 4706, 848, 353, 9657, 580, 13, 4706, 363, 2944, 297, 4516, 29898, 25932, 1125, 13, 9651, 565, 2944, 29889, 275, 21064, 7295, 13, 18884, 848, 29961, 667, 29962, 353, 679, 5552, 29898, 25932, 29892, 2944, 29897, 13, 4706, 736, 4390, 29889, 29881, 17204, 29898, 1272, 29897, 13, 13, 1678, 21681, 353, 7700, 13, 1678, 17067, 1254, 4214, 353, 7700, 13, 1678, 21681, 29918, 4176, 353, 7700, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 5659, 11375, 29918, 6720, 4571, 29943, 28541, 29903, 353, 7700, 13, 1678, 317, 3919, 13207, 29918, 4986, 29968, 1430, 353, 2897, 29889, 21813, 29889, 657, 877, 29903, 3919, 13207, 29918, 4986, 29968, 1430, 1495, 13, 1678, 317, 3919, 13207, 29918, 25838, 8193, 1164, 13780, 353, 6213, 13, 1678, 27146, 11375, 29918, 29933, 2891, 29918, 4986, 29968, 1430, 353, 2897, 29889, 21813, 29889, 657, 877, 12750, 11375, 29918, 29933, 2891, 29918, 4986, 29968, 1430, 1495, 13, 1678, 396, 2563, 1251, 12117, 5993, 13, 1678, 27146, 11375, 29918, 4986, 29968, 1430, 353, 2897, 29889, 21813, 29889, 657, 877, 12750, 11375, 29918, 4986, 29968, 1430, 1495, 13, 1678, 349, 8476, 353, 29871, 29941, 29900, 29900, 29900, 13, 13, 13, 1990, 14650, 3991, 29898, 3991, 1125, 13, 1678, 21681, 353, 5852, 13, 1678, 21681, 29918, 4176, 353, 5852, 13, 1678, 317, 3919, 13207, 29918, 25838, 8193, 1164, 13780, 353, 525, 25431, 29915, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 353, 525, 22793, 597, 29914, 25431, 29889, 22793, 29915, 13, 13, 13, 1990, 4321, 292, 3991, 29898, 21956, 358, 3991, 1125, 13, 1678, 17067, 1254, 4214, 353, 5852, 13, 1678, 21681, 29918, 4176, 353, 7700, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 353, 525, 22793, 597, 29915, 13, 1678, 317, 3919, 13207, 29918, 4986, 29968, 1430, 353, 6213, 13, 1678, 317, 3919, 13207, 29918, 25838, 8193, 1164, 13780, 353, 525, 13424, 29915, 13, 1678, 27146, 11375, 29918, 4986, 29968, 1430, 353, 525, 29941, 1758, 29955, 29940, 29887, 29888, 29945, 29955, 371, 29946, 17608, 29950, 29968, 29893, 29903, 29894, 8809, 344, 29890, 29915, 13, 1678, 27146, 11375, 29918, 29933, 2891, 29918, 4986, 29968, 1430, 353, 6213, 13, 13, 13, 1990, 19561, 3991, 29898, 3991, 1125, 13, 1678, 21681, 353, 7700, 13, 1678, 17067, 1254, 4214, 353, 7700, 13, 1678, 3758, 1964, 3210, 12665, 29979, 29918, 25832, 27982, 29918, 15551, 353, 2897, 29889, 21813, 29889, 657, 877, 25832, 27982, 29918, 4219, 1495, 13, 1678, 317, 3919, 13207, 29918, 25838, 8193, 1164, 13780, 353, 525, 24601, 29915, 13, 13, 13, 25838, 353, 2897, 29889, 21813, 29889, 657, 877, 20576, 29918, 25838, 742, 2897, 29889, 21813, 29889, 657, 877, 10536, 3289, 29968, 29918, 25838, 742, 525, 10633, 8785, 13, 25903, 353, 6213, 13, 13, 361, 12524, 29963, 1275, 525, 3359, 29915, 470, 12524, 29963, 1275, 525, 25431, 2396, 13, 1678, 8707, 18667, 353, 14650, 3991, 13, 23681, 12524, 29963, 1275, 525, 1688, 2396, 13, 1678, 8707, 18667, 353, 4321, 292, 3991, 13, 23681, 12524, 29963, 1275, 525, 10633, 2396, 13, 1678, 8707, 18667, 353, 19561, 3991, 13, 2870, 29901, 13, 1678, 12020, 7865, 2392, 877, 13919, 5177, 1024, 1495, 13, 2 ]
bindings/python/v1/empowerparser.py
Nibamot/empower-enb-proto
0
1606323
<filename>bindings/python/v1/empowerparser.py #!/usr/bin/env python3 """Empower-Parser""" # Copyright (c) 2018 FBK-CREATENET # AUTHOR- <NAME> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, # software distributed under the License is distributed on an # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. import ctypes as ct from v1 import MessageType from v1 import ActionType from v1.lte.ltemsg import LTEMsg class EmpowerParser: """Wrapper around direct python bindings""" """@staticmethod def parseversion(buf, size): #function to parse any message to be parsed by #LTEMsg or its child classes _proto = ct.CDLL("libemproto.so") parseversion = _proto.epp_ve return ltemsg.parse(buf, size)""" @staticmethod def parseevent(buf, size): """function to parse any message to be parsed by LTEMsg or its child classes""" _proto = ct.CDLL("libemproto.so") parseevent = _proto.epp_msg_type parseevent.restype = MessageType parseevent.argtypes = [ct.c_char_p, ct.c_uint] return parseevent(buf, size) @staticmethod def parseaction(buf, size): """function to parse any message to be parsed by LTEMsg or its child classes""" _proto = ct.CDLL("libemproto.so") parseaction = _proto.epp_msg_type #generic action type? parseaction.restype = ActionType parseaction.argtypes = [ct.c_char_p, ct.c_uint] return parseaction(buf, size) @staticmethod def parsedirection(buf, size): """function to parse any message to be parsed by LTEMsg or its child classes""" _proto = ct.CDLL("libemproto.so") parsedirection = _proto.epp_dir parsedirection.restype = ct.c_uint parsedirection.argtypes = [ct.c_char_p, ct.c_uint] return parsedirection(buf, size)
[ 1, 529, 9507, 29958, 5355, 886, 29914, 4691, 29914, 29894, 29896, 29914, 3451, 1680, 16680, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 15945, 29908, 10495, 1680, 29899, 11726, 15945, 29908, 13, 13, 29937, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29896, 29947, 28816, 29968, 29899, 22245, 1299, 1430, 2544, 13, 29937, 26524, 29950, 1955, 29899, 529, 5813, 29958, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 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, 2823, 278, 19245, 363, 278, 13, 29937, 2702, 4086, 14765, 1076, 11239, 322, 27028, 13, 29937, 1090, 278, 19245, 29889, 13, 5215, 274, 8768, 408, 274, 29873, 13, 3166, 325, 29896, 1053, 7777, 1542, 13, 3166, 325, 29896, 1053, 9123, 1542, 13, 3166, 325, 29896, 29889, 29880, 371, 29889, 29880, 1356, 5311, 1053, 365, 4330, 16190, 13, 13, 1990, 7361, 1680, 11726, 29901, 13, 1678, 9995, 15646, 2820, 1513, 3017, 7868, 886, 15945, 29908, 13, 13, 1678, 9995, 29992, 7959, 5696, 13, 1678, 822, 6088, 3259, 29898, 9721, 29892, 2159, 1125, 13, 4706, 396, 2220, 304, 6088, 738, 2643, 304, 367, 21213, 491, 13, 4706, 396, 29931, 4330, 16190, 470, 967, 2278, 4413, 13, 4706, 903, 17529, 353, 274, 29873, 29889, 6530, 2208, 703, 1982, 331, 17529, 29889, 578, 1159, 13, 4706, 6088, 3259, 353, 903, 17529, 29889, 29872, 407, 29918, 345, 13, 4706, 736, 301, 1356, 5311, 29889, 5510, 29898, 9721, 29892, 2159, 5513, 15945, 13, 13, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6088, 3696, 29898, 9721, 29892, 2159, 1125, 13, 4706, 9995, 2220, 304, 6088, 738, 2643, 304, 367, 21213, 491, 13, 4706, 365, 4330, 16190, 470, 967, 2278, 4413, 15945, 29908, 13, 4706, 903, 17529, 353, 274, 29873, 29889, 6530, 2208, 703, 1982, 331, 17529, 29889, 578, 1159, 13, 4706, 6088, 3696, 353, 903, 17529, 29889, 29872, 407, 29918, 7645, 29918, 1853, 13, 4706, 6088, 3696, 29889, 5060, 668, 353, 7777, 1542, 13, 4706, 6088, 3696, 29889, 1191, 8768, 353, 518, 312, 29889, 29883, 29918, 3090, 29918, 29886, 29892, 274, 29873, 29889, 29883, 29918, 13470, 29962, 13, 4706, 736, 6088, 3696, 29898, 9721, 29892, 2159, 29897, 13, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 6088, 2467, 29898, 9721, 29892, 2159, 1125, 13, 4706, 9995, 2220, 304, 6088, 738, 2643, 304, 367, 21213, 491, 13, 4706, 365, 4330, 16190, 470, 967, 2278, 4413, 15945, 29908, 13, 4706, 903, 17529, 353, 274, 29873, 29889, 6530, 2208, 703, 1982, 331, 17529, 29889, 578, 1159, 13, 4706, 6088, 2467, 353, 903, 17529, 29889, 29872, 407, 29918, 7645, 29918, 1853, 396, 19206, 3158, 1134, 29973, 13, 4706, 6088, 2467, 29889, 5060, 668, 353, 9123, 1542, 13, 4706, 6088, 2467, 29889, 1191, 8768, 353, 518, 312, 29889, 29883, 29918, 3090, 29918, 29886, 29892, 274, 29873, 29889, 29883, 29918, 13470, 29962, 13, 4706, 736, 6088, 2467, 29898, 9721, 29892, 2159, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 21213, 8684, 29898, 9721, 29892, 2159, 1125, 13, 4706, 9995, 2220, 304, 6088, 738, 2643, 304, 367, 21213, 491, 13, 4706, 365, 4330, 16190, 470, 967, 2278, 4413, 15945, 29908, 13, 4706, 903, 17529, 353, 274, 29873, 29889, 6530, 2208, 703, 1982, 331, 17529, 29889, 578, 1159, 13, 4706, 21213, 8684, 353, 903, 17529, 29889, 29872, 407, 29918, 3972, 13, 4706, 21213, 8684, 29889, 5060, 668, 353, 274, 29873, 29889, 29883, 29918, 13470, 13, 4706, 21213, 8684, 29889, 1191, 8768, 353, 518, 312, 29889, 29883, 29918, 3090, 29918, 29886, 29892, 274, 29873, 29889, 29883, 29918, 13470, 29962, 13, 4706, 736, 21213, 8684, 29898, 9721, 29892, 2159, 29897, 13, 2 ]
looker_api/__init__.py
nofeet/looker-api
1
107710
<reponame>nofeet/looker-api<filename>looker_api/__init__.py from looker_api import *
[ 1, 529, 276, 1112, 420, 29958, 3998, 29872, 300, 29914, 6914, 261, 29899, 2754, 29966, 9507, 29958, 6914, 261, 29918, 2754, 29914, 1649, 2344, 26914, 2272, 13, 3166, 1106, 261, 29918, 2754, 1053, 334, 2 ]
tools/mytools/ARIA/src/py/aria/legacy/FortranFormat.py
fmareuil/Galaxy_test_pasteur
0
56675
<filename>tools/mytools/ARIA/src/py/aria/legacy/FortranFormat.py # This module defines a class that handles I/O using # Fortran-compatible format specifications. # # # Warning: Fortran formatting is a complex business and I don't # claim that this module works for anything complicated. It knows # only the most frequent formatting options. Known limitations: # # 1) Only A, D, E, F, G, I, and X formats are supported (plus string constants # for output). # 2) No direct support for complex numbers. You have to split them into # real and imaginary parts before output, and for input you get # two float numbers anyway. # 3) No overflow check. If an output field gets too large, it will # take more space, instead of being replaced by stars. # # # Written by <NAME> <<EMAIL>> # last revision: 1996-9-27 # """Fortran-compatible input/output This module provides two classes that aid in reading and writing Fortran-formatted text files. Only a subset of formatting options is supported: A, D, E, F, G, I, and X formats, plus string constants for output. Repetition (e.g. 4I5 or 3(1X,A4)) is supported. Complex numbers are not supported; you have to treat real and imaginary parts separately. Examples: ========= Input: ------ >> s = ' 59999' >> format = FortranFormat('2I4') >> line = FortranLine(s, format) >> line[0] 5 >> line[1] 9999 Output: ------- >> format = FortranFormat('2D15.5') >> line = FortranLine([3.1415926, 2.71828], format) >> str(line) ' 3.14159D+00 2.71828D+00' The second argumet to FortranLine can be a format object or a string (that is then converted into a format object). If the same format is to be used several times, it is more efficient to convert it into a format object once - parsing the format string is a relatively expensive operation. """ import string # # The class FortranLine represents a single line of input/output, # which can be accessed as text or as a list of items. # class FortranLine: def __init__(self, line, format, length = 80): if type(line) == type(''): self.text = line self.data = None else: self.text = None self.data = line if type(format) == type(''): self.format = FortranFormat(format) else: self.format = format self.length = length if self.text is None: self._output() if self.data is None: self._input() def __len__(self): return len(self.data) def __getitem__(self, i): return self.data[i] def __getslice__(self, i, j): return self.data[i:j] def __str__(self): return self.text def isBlank(self): return len(string.strip(self.text)) == 0 def _input(self): text = self.text if len(text) < self.length: text = text + (self.length-len(text))*' ' self.data = [] for field in self.format: l = field[1] s = text[:l] text = text[l:] type = field[0] value = None if type == 'A': value = s elif type == 'I': s = string.strip(s) if len(s) == 0: value = 0 else: value = string.atoi(s) elif type == 'D' or type == 'E' or type == 'F' or type == 'G': s = string.lower(string.strip(s)) n = string.find(s, 'd') if n >= 0: s = s[:n] + 'e' + s[n+1:] if len(s) == 0: value = 0. else: value = string.atof(s) if value is not None: self.data.append(value) def _output(self): data = self.data self.text = '' for field in self.format: type = field[0] if type == "'": self.text = self.text + field[1] elif type == 'X': self.text = self.text + field[1]*' ' else: # fields that use input data length = field[1] if len(field) > 2: fraction = field[2] value = data[0] data = data[1:] if type == 'A': self.text = self.text + (value+length*' ')[:length] else: # numeric fields if type == 'I': s = `value` elif type == 'D': s = ('%'+`length`+'.'+`fraction`+'e') % value n = string.find(s, 'e') s = s[:n] + 'D' + s[n+1:] elif type == 'E': s = ('%'+`length`+'.'+`fraction`+'e') % value elif type == 'F': s = ('%'+`length`+'.'+`fraction`+'f') % value elif type == 'G': s = ('%'+`length`+'.'+`fraction`+'g') % value else: raise ValueError, 'Not yet implemented' s = string.upper(s) self.text = self.text + ((length*' ')+s)[-length:] # # The class FortranFormat represents a format specification. # It ought to work for correct specifications, but there is # little error checking. # class FortranFormat: def __init__(self, format, nested = 0): fields = [] format = string.strip(format) while format and format[0] != ')': n = 0 while format[0] in string.digits: n = 10*n + string.atoi(format[0]) format = format[1:] if n == 0: n = 1 type = string.upper(format[0]) if type == "'": eof = string.find(format, "'", 1) text = format[1:eof] format = format[eof+1:] else: format = string.strip(format[1:]) if type == '(': subformat = FortranFormat(format, 1) fields = fields + n*subformat.fields format = subformat.rest eof = string.find(format, ',') if eof >= 0: format = format[eof+1:] else: eof = string.find(format, ',') if eof >= 0: field = format[:eof] format = format[eof+1:] else: eof = string.find(format, ')') if eof >= 0: field = format[:eof] format = format[eof+1:] else: field = format format = '' if type == "'": field = (type, text) else: dot = string.find(field, '.') if dot > 0: length = string.atoi(field[:dot]) fraction = string.atoi(field[dot+1:]) field = (type, length, fraction) else: if field: length = string.atoi(field) else: length = 1 field = (type, length) fields = fields + n*[field] self.fields = fields if nested: self.rest = format def __len__(self): return len(self.fields) def __getitem__(self, i): return self.fields[i] # Test code if __name__ == '__main__': f = FortranFormat("'!!',D10.3,F10.3,G10.3,'!!'") l = FortranLine([1.5707963, 3.14159265358, 2.71828], f) print str(l) f = FortranFormat("F12.0") l = FortranLine('2.1D2', f) print l[0]
[ 1, 529, 9507, 29958, 8504, 29914, 1357, 8504, 29914, 1718, 10764, 29914, 4351, 29914, 2272, 29914, 4568, 29914, 1397, 4135, 29914, 29943, 441, 661, 5809, 29889, 2272, 13, 29937, 910, 3883, 17645, 263, 770, 393, 17766, 306, 29914, 29949, 773, 13, 29937, 7236, 661, 29899, 23712, 3402, 2702, 800, 29889, 13, 29937, 13, 29937, 13, 29937, 24412, 29901, 7236, 661, 15998, 338, 263, 4280, 5381, 322, 306, 1016, 29915, 29873, 13, 29937, 5995, 393, 445, 3883, 1736, 363, 3099, 12092, 29889, 739, 9906, 13, 29937, 871, 278, 1556, 17091, 15998, 3987, 29889, 8360, 776, 27028, 29901, 13, 29937, 13, 29937, 29871, 29896, 29897, 9333, 319, 29892, 360, 29892, 382, 29892, 383, 29892, 402, 29892, 306, 29892, 322, 1060, 21971, 526, 6969, 313, 11242, 1347, 17727, 13, 29937, 1678, 363, 1962, 467, 13, 29937, 29871, 29906, 29897, 1939, 1513, 2304, 363, 4280, 3694, 29889, 887, 505, 304, 6219, 963, 964, 13, 29937, 1678, 1855, 322, 6382, 3821, 5633, 1434, 1962, 29892, 322, 363, 1881, 366, 679, 13, 29937, 1678, 1023, 5785, 3694, 8763, 29889, 13, 29937, 29871, 29941, 29897, 1939, 11969, 1423, 29889, 960, 385, 1962, 1746, 4947, 2086, 2919, 29892, 372, 674, 13, 29937, 1678, 2125, 901, 2913, 29892, 2012, 310, 1641, 8611, 491, 10819, 29889, 13, 29937, 13, 29937, 13, 29937, 16849, 841, 491, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 29937, 1833, 26554, 29901, 29871, 29896, 29929, 29929, 29953, 29899, 29929, 29899, 29906, 29955, 13, 29937, 13, 13, 15945, 29908, 29943, 441, 661, 29899, 23712, 1881, 29914, 4905, 13, 13, 4013, 3883, 8128, 1023, 4413, 393, 16226, 297, 5183, 322, 5007, 13, 29943, 441, 661, 29899, 689, 19667, 1426, 2066, 29889, 9333, 263, 11306, 310, 15998, 3987, 13, 275, 6969, 29901, 319, 29892, 360, 29892, 382, 29892, 383, 29892, 402, 29892, 306, 29892, 322, 1060, 21971, 29892, 2298, 1347, 17727, 13, 1454, 1962, 29889, 10088, 300, 654, 313, 29872, 29889, 29887, 29889, 29871, 29946, 29902, 29945, 470, 29871, 29941, 29898, 29896, 29990, 29892, 29909, 29946, 876, 338, 6969, 29889, 26596, 13, 20326, 526, 451, 6969, 29936, 366, 505, 304, 7539, 1855, 322, 6382, 3821, 5633, 13, 25048, 2486, 29889, 13, 13, 1252, 9422, 29901, 13, 4936, 29922, 13, 13, 4290, 29901, 13, 22158, 13, 6778, 269, 353, 525, 1678, 29945, 29929, 29929, 29929, 29929, 29915, 13, 6778, 3402, 353, 7236, 661, 5809, 877, 29906, 29902, 29946, 1495, 13, 6778, 1196, 353, 7236, 661, 3542, 29898, 29879, 29892, 3402, 29897, 13, 6778, 1196, 29961, 29900, 29962, 13, 29945, 13, 6778, 1196, 29961, 29896, 29962, 13, 29929, 29929, 29929, 29929, 13, 13, 6466, 29901, 13, 26589, 13, 6778, 3402, 353, 7236, 661, 5809, 877, 29906, 29928, 29896, 29945, 29889, 29945, 1495, 13, 6778, 1196, 353, 7236, 661, 3542, 4197, 29941, 29889, 29896, 29946, 29896, 29945, 29929, 29906, 29953, 29892, 29871, 29906, 29889, 29955, 29896, 29947, 29906, 29947, 1402, 3402, 29897, 13, 6778, 851, 29898, 1220, 29897, 13, 29915, 268, 29941, 29889, 29896, 29946, 29896, 29945, 29929, 29928, 29974, 29900, 29900, 268, 29906, 29889, 29955, 29896, 29947, 29906, 29947, 29928, 29974, 29900, 29900, 29915, 13, 13, 1576, 1473, 1852, 398, 300, 304, 7236, 661, 3542, 508, 367, 263, 3402, 1203, 470, 263, 13, 1807, 313, 5747, 338, 769, 11543, 964, 263, 3402, 1203, 467, 960, 278, 13, 17642, 3402, 338, 304, 367, 1304, 3196, 3064, 29892, 372, 338, 901, 8543, 13, 517, 3588, 372, 964, 263, 3402, 1203, 2748, 448, 13755, 278, 3402, 13, 1807, 338, 263, 13774, 19390, 5858, 29889, 13, 15945, 29908, 13, 13, 5215, 1347, 13, 13, 29937, 13, 29937, 450, 770, 7236, 661, 3542, 11524, 263, 2323, 1196, 310, 1881, 29914, 4905, 29892, 13, 29937, 607, 508, 367, 20592, 408, 1426, 470, 408, 263, 1051, 310, 4452, 29889, 13, 29937, 13, 1990, 7236, 661, 3542, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1196, 29892, 3402, 29892, 3309, 353, 29871, 29947, 29900, 1125, 13, 12, 361, 1134, 29898, 1220, 29897, 1275, 1134, 877, 29374, 13, 12, 1678, 1583, 29889, 726, 353, 1196, 13, 12, 1678, 1583, 29889, 1272, 353, 6213, 13, 12, 2870, 29901, 13, 12, 1678, 1583, 29889, 726, 353, 6213, 13, 12, 1678, 1583, 29889, 1272, 353, 1196, 13, 12, 361, 1134, 29898, 4830, 29897, 1275, 1134, 877, 29374, 13, 12, 1678, 1583, 29889, 4830, 353, 7236, 661, 5809, 29898, 4830, 29897, 13, 12, 2870, 29901, 13, 12, 1678, 1583, 29889, 4830, 353, 3402, 13, 12, 1311, 29889, 2848, 353, 3309, 13, 12, 361, 1583, 29889, 726, 338, 6213, 29901, 13, 12, 1678, 1583, 3032, 4905, 580, 13, 12, 361, 1583, 29889, 1272, 338, 6213, 29901, 13, 12, 1678, 1583, 3032, 2080, 580, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 12, 2457, 7431, 29898, 1311, 29889, 1272, 29897, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 474, 1125, 13, 12, 2457, 1583, 29889, 1272, 29961, 29875, 29962, 13, 13, 1678, 822, 4770, 657, 18337, 12035, 1311, 29892, 474, 29892, 432, 1125, 13, 12, 2457, 1583, 29889, 1272, 29961, 29875, 29901, 29926, 29962, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 12, 2457, 1583, 29889, 726, 13, 13, 1678, 822, 338, 10358, 804, 29898, 1311, 1125, 13, 12, 2457, 7431, 29898, 1807, 29889, 17010, 29898, 1311, 29889, 726, 876, 1275, 29871, 29900, 13, 13, 1678, 822, 903, 2080, 29898, 1311, 1125, 13, 12, 726, 353, 1583, 29889, 726, 13, 12, 361, 7431, 29898, 726, 29897, 529, 1583, 29889, 2848, 29901, 1426, 353, 1426, 718, 313, 1311, 29889, 2848, 29899, 2435, 29898, 726, 876, 29930, 29915, 525, 13, 12, 1311, 29889, 1272, 353, 5159, 13, 12, 1454, 1746, 297, 1583, 29889, 4830, 29901, 13, 12, 1678, 301, 353, 1746, 29961, 29896, 29962, 13, 12, 1678, 269, 353, 1426, 7503, 29880, 29962, 13, 12, 1678, 1426, 353, 1426, 29961, 29880, 17531, 13, 12, 1678, 1134, 353, 1746, 29961, 29900, 29962, 13, 12, 1678, 995, 353, 6213, 13, 12, 1678, 565, 1134, 1275, 525, 29909, 2396, 13, 12, 12, 1767, 353, 269, 13, 12, 1678, 25342, 1134, 1275, 525, 29902, 2396, 13, 12, 12, 29879, 353, 1347, 29889, 17010, 29898, 29879, 29897, 13, 12, 12, 361, 7431, 29898, 29879, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 1678, 995, 353, 29871, 29900, 13, 12, 12, 2870, 29901, 13, 12, 12, 1678, 995, 353, 1347, 29889, 1219, 29875, 29898, 29879, 29897, 13, 12, 1678, 25342, 1134, 1275, 525, 29928, 29915, 470, 1134, 1275, 525, 29923, 29915, 470, 1134, 1275, 525, 29943, 29915, 470, 1134, 1275, 525, 29954, 2396, 13, 12, 12, 29879, 353, 1347, 29889, 13609, 29898, 1807, 29889, 17010, 29898, 29879, 876, 13, 12, 12, 29876, 353, 1347, 29889, 2886, 29898, 29879, 29892, 525, 29881, 1495, 13, 12, 12, 361, 302, 6736, 29871, 29900, 29901, 13, 12, 12, 1678, 269, 353, 269, 7503, 29876, 29962, 718, 525, 29872, 29915, 718, 269, 29961, 29876, 29974, 29896, 17531, 13, 12, 12, 361, 7431, 29898, 29879, 29897, 1275, 29871, 29900, 29901, 13, 12, 12, 1678, 995, 353, 29871, 29900, 29889, 13, 12, 12, 2870, 29901, 13, 12, 12, 1678, 995, 353, 1347, 29889, 271, 974, 29898, 29879, 29897, 13, 12, 1678, 565, 995, 338, 451, 6213, 29901, 13, 12, 12, 1311, 29889, 1272, 29889, 4397, 29898, 1767, 29897, 13, 13, 1678, 822, 903, 4905, 29898, 1311, 1125, 13, 12, 1272, 353, 1583, 29889, 1272, 13, 12, 1311, 29889, 726, 353, 6629, 13, 12, 1454, 1746, 297, 1583, 29889, 4830, 29901, 13, 12, 1678, 1134, 353, 1746, 29961, 29900, 29962, 13, 12, 1678, 565, 1134, 1275, 13577, 1115, 13, 12, 12, 1311, 29889, 726, 353, 1583, 29889, 726, 718, 1746, 29961, 29896, 29962, 13, 12, 1678, 25342, 1134, 1275, 525, 29990, 2396, 13, 12, 12, 1311, 29889, 726, 353, 1583, 29889, 726, 718, 1746, 29961, 29896, 14178, 29915, 525, 13, 12, 1678, 1683, 29901, 396, 4235, 393, 671, 1881, 848, 13, 12, 12, 2848, 353, 1746, 29961, 29896, 29962, 13, 12, 12, 361, 7431, 29898, 2671, 29897, 1405, 29871, 29906, 29901, 15958, 353, 1746, 29961, 29906, 29962, 13, 12, 12, 1767, 353, 848, 29961, 29900, 29962, 13, 12, 12, 1272, 353, 848, 29961, 29896, 17531, 13, 12, 12, 361, 1134, 1275, 525, 29909, 2396, 13, 12, 12, 1678, 1583, 29889, 726, 353, 1583, 29889, 726, 718, 313, 1767, 29974, 2848, 29930, 29915, 25710, 7503, 2848, 29962, 13, 12, 12, 2870, 29901, 396, 16985, 4235, 13, 12, 12, 1678, 565, 1134, 1275, 525, 29902, 2396, 13, 12, 12, 12, 29879, 353, 421, 1767, 29952, 13, 12, 12, 1678, 25342, 1134, 1275, 525, 29928, 2396, 13, 12, 12, 12, 29879, 353, 6702, 29995, 18717, 29952, 2848, 29952, 29974, 4286, 18717, 29952, 29888, 13857, 29952, 23097, 29872, 1495, 1273, 995, 13, 12, 12, 12, 29876, 353, 1347, 29889, 2886, 29898, 29879, 29892, 525, 29872, 1495, 13, 12, 12, 12, 29879, 353, 269, 7503, 29876, 29962, 718, 525, 29928, 29915, 718, 269, 29961, 29876, 29974, 29896, 17531, 13, 12, 12, 1678, 25342, 1134, 1275, 525, 29923, 2396, 13, 12, 12, 12, 29879, 353, 6702, 29995, 18717, 29952, 2848, 29952, 29974, 4286, 18717, 29952, 29888, 13857, 29952, 23097, 29872, 1495, 1273, 995, 13, 12, 12, 1678, 25342, 1134, 1275, 525, 29943, 2396, 13, 12, 12, 12, 29879, 353, 6702, 29995, 18717, 29952, 2848, 29952, 29974, 4286, 18717, 29952, 29888, 13857, 29952, 23097, 29888, 1495, 1273, 995, 13, 12, 12, 1678, 25342, 1134, 1275, 525, 29954, 2396, 13, 12, 12, 12, 29879, 353, 6702, 29995, 18717, 29952, 2848, 29952, 29974, 4286, 18717, 29952, 29888, 13857, 29952, 23097, 29887, 1495, 1273, 995, 13, 12, 12, 1678, 1683, 29901, 13, 12, 12, 12, 22692, 7865, 2392, 29892, 525, 3664, 3447, 8762, 29915, 13, 12, 12, 1678, 269, 353, 1347, 29889, 21064, 29898, 29879, 29897, 13, 12, 12, 1678, 1583, 29889, 726, 353, 1583, 29889, 726, 718, 5135, 2848, 29930, 29915, 525, 7240, 29879, 9601, 29899, 2848, 17531, 13, 13, 29937, 13, 29937, 450, 770, 7236, 661, 5809, 11524, 263, 3402, 21992, 29889, 13, 29937, 739, 12722, 304, 664, 363, 1959, 2702, 800, 29892, 541, 727, 338, 13, 29937, 2217, 1059, 8454, 29889, 13, 29937, 13, 1990, 7236, 661, 5809, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 3402, 29892, 9322, 353, 29871, 29900, 1125, 13, 12, 9621, 353, 5159, 13, 12, 4830, 353, 1347, 29889, 17010, 29898, 4830, 29897, 13, 12, 8000, 3402, 322, 3402, 29961, 29900, 29962, 2804, 25710, 2396, 13, 12, 1678, 302, 353, 29871, 29900, 13, 12, 1678, 1550, 3402, 29961, 29900, 29962, 297, 1347, 29889, 7501, 1169, 29901, 13, 12, 12, 29876, 353, 29871, 29896, 29900, 29930, 29876, 718, 1347, 29889, 1219, 29875, 29898, 4830, 29961, 29900, 2314, 13, 12, 12, 4830, 353, 3402, 29961, 29896, 17531, 13, 12, 1678, 565, 302, 1275, 29871, 29900, 29901, 302, 353, 29871, 29896, 13, 12, 1678, 1134, 353, 1347, 29889, 21064, 29898, 4830, 29961, 29900, 2314, 13, 12, 1678, 565, 1134, 1275, 13577, 1115, 13, 12, 12, 29872, 974, 353, 1347, 29889, 2886, 29898, 4830, 29892, 13577, 613, 29871, 29896, 29897, 13, 12, 12, 726, 353, 3402, 29961, 29896, 29901, 29872, 974, 29962, 13, 12, 12, 4830, 353, 3402, 29961, 29872, 974, 29974, 29896, 17531, 13, 12, 1678, 1683, 29901, 13, 12, 12, 4830, 353, 1347, 29889, 17010, 29898, 4830, 29961, 29896, 29901, 2314, 13, 12, 1678, 565, 1134, 1275, 525, 877, 29901, 13, 12, 12, 1491, 4830, 353, 7236, 661, 5809, 29898, 4830, 29892, 29871, 29896, 29897, 13, 12, 12, 9621, 353, 4235, 718, 302, 29930, 1491, 4830, 29889, 9621, 13, 12, 12, 4830, 353, 1014, 4830, 29889, 5060, 13, 12, 12, 29872, 974, 353, 1347, 29889, 2886, 29898, 4830, 29892, 13420, 1495, 13, 12, 12, 361, 321, 974, 6736, 29871, 29900, 29901, 13, 12, 12, 1678, 3402, 353, 3402, 29961, 29872, 974, 29974, 29896, 17531, 13, 12, 1678, 1683, 29901, 13, 12, 12, 29872, 974, 353, 1347, 29889, 2886, 29898, 4830, 29892, 13420, 1495, 13, 12, 12, 361, 321, 974, 6736, 29871, 29900, 29901, 13, 12, 12, 1678, 1746, 353, 3402, 7503, 29872, 974, 29962, 13, 12, 12, 1678, 3402, 353, 3402, 29961, 29872, 974, 29974, 29896, 17531, 13, 12, 12, 2870, 29901, 13, 12, 12, 1678, 321, 974, 353, 1347, 29889, 2886, 29898, 4830, 29892, 25710, 1495, 13, 12, 12, 1678, 565, 321, 974, 6736, 29871, 29900, 29901, 13, 12, 12, 12, 2671, 353, 3402, 7503, 29872, 974, 29962, 13, 12, 12, 12, 4830, 353, 3402, 29961, 29872, 974, 29974, 29896, 17531, 13, 12, 12, 1678, 1683, 29901, 13, 12, 12, 12, 2671, 353, 3402, 13, 12, 12, 12, 4830, 353, 6629, 13, 12, 12, 361, 1134, 1275, 13577, 1115, 13, 12, 12, 1678, 1746, 353, 313, 1853, 29892, 1426, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 1678, 8329, 353, 1347, 29889, 2886, 29898, 2671, 29892, 15300, 1495, 13, 12, 12, 1678, 565, 8329, 1405, 29871, 29900, 29901, 13, 12, 12, 12, 2848, 353, 1347, 29889, 1219, 29875, 29898, 2671, 7503, 6333, 2314, 13, 12, 12, 12, 29888, 13857, 353, 1347, 29889, 1219, 29875, 29898, 2671, 29961, 6333, 29974, 29896, 29901, 2314, 13, 12, 12, 12, 2671, 353, 313, 1853, 29892, 3309, 29892, 15958, 29897, 13, 12, 12, 1678, 1683, 29901, 13, 12, 12, 12, 361, 1746, 29901, 13, 12, 12, 12, 1678, 3309, 353, 1347, 29889, 1219, 29875, 29898, 2671, 29897, 13, 12, 12, 12, 2870, 29901, 13, 12, 12, 12, 1678, 3309, 353, 29871, 29896, 13, 12, 12, 12, 2671, 353, 313, 1853, 29892, 3309, 29897, 13, 12, 12, 9621, 353, 4235, 718, 302, 29930, 29961, 2671, 29962, 13, 12, 1311, 29889, 9621, 353, 4235, 13, 12, 361, 9322, 29901, 13, 12, 1678, 1583, 29889, 5060, 353, 3402, 13, 13, 1678, 822, 4770, 2435, 12035, 1311, 1125, 13, 12, 2457, 7431, 29898, 1311, 29889, 9621, 29897, 13, 13, 1678, 822, 4770, 657, 667, 12035, 1311, 29892, 474, 1125, 13, 12, 2457, 1583, 29889, 9621, 29961, 29875, 29962, 13, 13, 13, 29937, 4321, 775, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 285, 353, 7236, 661, 5809, 703, 29915, 6824, 742, 29928, 29896, 29900, 29889, 29941, 29892, 29943, 29896, 29900, 29889, 29941, 29892, 29954, 29896, 29900, 29889, 29941, 5501, 6824, 29915, 1159, 13, 1678, 301, 353, 7236, 661, 3542, 4197, 29896, 29889, 29945, 29955, 29900, 29955, 29929, 29953, 29941, 29892, 29871, 29941, 29889, 29896, 29946, 29896, 29945, 29929, 29906, 29953, 29945, 29941, 29945, 29947, 29892, 29871, 29906, 29889, 29955, 29896, 29947, 29906, 29947, 1402, 285, 29897, 13, 1678, 1596, 851, 29898, 29880, 29897, 13, 1678, 285, 353, 7236, 661, 5809, 703, 29943, 29896, 29906, 29889, 29900, 1159, 13, 1678, 301, 353, 7236, 661, 3542, 877, 29906, 29889, 29896, 29928, 29906, 742, 285, 29897, 13, 1678, 1596, 301, 29961, 29900, 29962, 13, 2 ]
src/test/resources/outputs/blueprints/openstack/lamp/wrapper/mysql/org.alien4cloud.interfaces.cfy.lifecycle/NodeInit/_a4c_NodeInit.py
alien4cloud/alien4cloud-cloudify4-provider
0
1607952
<reponame>alien4cloud/alien4cloud-cloudify4-provider<filename>src/test/resources/outputs/blueprints/openstack/lamp/wrapper/mysql/org.alien4cloud.interfaces.cfy.lifecycle/NodeInit/_a4c_NodeInit.py<gh_stars>0 from cloudify import ctx from cloudify import utils from cloudify.exceptions import NonRecoverableError from StringIO import StringIO import base64 import os import platform import re import subprocess import sys import time import threading import platform import json def convert_env_value_to_string(envDict): for key, value in envDict.items(): envDict[str(key)] = str(envDict.pop(key)) def get_attribute_user(ctx): if get_attribute_from_top_host(ctx, 'user'): return get_attribute_from_top_host(ctx, 'user') if get_attribute(ctx, 'cloudify_agent'): return get_attribute(ctx, 'cloudify_agent').get('user', None) if get_attribute(ctx, 'agent_config'): return get_attribute(ctx, 'agent_config').get('user', None) return None def get_attribute_key(ctx): if get_attribute_from_top_host(ctx, 'key'): return get_attribute_from_top_host(ctx, 'key') if get_attribute(ctx, 'cloudify_agent'): return get_attribute(ctx, 'cloudify_agent').get('key', None) if get_attribute(ctx, 'agent_config'): return get_attribute(ctx, 'agent_config').get('key', None) return None def get_host(entity): if entity.instance.relationships: for relationship in entity.instance.relationships: if 'cloudify.relationships.contained_in' in relationship.type_hierarchy: return relationship.target return None def has_attribute_mapping(entity, attribute_name): # ctx.logger.debug('Check if it exists mapping for attribute {0} in {1}'.format(attribute_name,json.dumps(entity.node.properties))) mapping_configuration = entity.node.properties.get('_a4c_att_' + attribute_name, None) if mapping_configuration is not None: if mapping_configuration['parameters'][0] == 'SELF' and mapping_configuration['parameters'][1] == attribute_name: return False else: return True return False def process_attribute_mapping(entity, attribute_name, data_retriever_function): # This is where attribute mapping is defined in the cloudify type mapping_configuration = entity.node.properties['_a4c_att_' + attribute_name] # ctx.logger.debug('Mapping configuration found for attribute {0} is {1}'.format(attribute_name, json.dumps(mapping_configuration))) # If the mapping configuration exist and if it concerns SELF then just get attribute of the mapped attribute name # Else if it concerns TARGET then follow the relationship and retrieved the mapped attribute name from the TARGET if mapping_configuration['parameters'][0] == 'SELF': return data_retriever_function(entity, mapping_configuration['parameters'][1]) elif mapping_configuration['parameters'][0] == 'TARGET' and entity.instance.relationships: for relationship in entity.instance.relationships: if mapping_configuration['parameters'][1] in relationship.type_hierarchy: return data_retriever_function(relationship.target, mapping_configuration['parameters'][2]) return "" def get_nested_attribute(entity, attribute_names): deep_properties = get_attribute(entity, attribute_names[0]) attribute_names_iter = iter(attribute_names) next(attribute_names_iter) for attribute_name in attribute_names_iter: if deep_properties is None: return "" else: deep_properties = deep_properties.get(attribute_name, None) return deep_properties def _all_instances_get_nested_attribute(entity, attribute_names): return None def get_attribute(entity, attribute_name): if has_attribute_mapping(entity, attribute_name): # First check if any mapping exist for attribute mapped_value = process_attribute_mapping(entity, attribute_name, get_attribute) # ctx.logger.debug('Mapping exists for attribute {0} with value {1}'.format(attribute_name, json.dumps(mapped_value))) return mapped_value # No mapping exist, try to get directly the attribute from the entity attribute_value = entity.instance.runtime_properties.get(attribute_name, None) if attribute_value is not None: # ctx.logger.debug('Found the attribute {0} with value {1} on the node {2}'.format(attribute_name, json.dumps(attribute_value), entity.node.id)) return attribute_value # Attribute retrieval fails, fall back to property property_value = entity.node.properties.get(attribute_name, None) if property_value is not None: return property_value # Property retrieval fails, fall back to host instance host = get_host(entity) if host is not None: # ctx.logger.debug('Attribute not found {0} go up to the parent node {1}'.format(attribute_name, host.node.id)) return get_attribute(host, attribute_name) # Nothing is found return "" def get_target_capa_or_node_attribute(entity, capability_attribute_name, attribute_name): attribute_value = entity.instance.runtime_properties.get(capability_attribute_name, None) if attribute_value is not None: # ctx.logger.debug('Found the capability attribute {0} with value {1} on the node {2}'.format(attribute_name, json.dumps(attribute_value), entity.node.id)) return attribute_value return get_attribute(entity, attribute_name) def _all_instances_get_attribute(entity, attribute_name): result_map = {} # get all instances data using cfy rest client # we have to get the node using the rest client with node_instance.node_id # then we will have the relationships node = client.nodes.get(ctx.deployment.id, entity.node.id) all_node_instances = client.node_instances.list(ctx.deployment.id, entity.node.id) for node_instance in all_node_instances: prop_value = __recursively_get_instance_data(node, node_instance, attribute_name) if prop_value is not None: # ctx.logger.debug('Found the property/attribute {0} with value {1} on the node {2} instance {3}'.format(attribute_name, json.dumps(prop_value), entity.node.id, # node_instance.id)) result_map[node_instance.id + '_'] = prop_value return result_map # Same as previous method but will first try to find the attribute on the capability. def _all_instances_get_target_capa_or_node_attribute(entity, capability_attribute_name, attribute_name): result_map = {} node = client.nodes.get(ctx.deployment.id, entity.node.id) all_node_instances = client.node_instances.list(ctx.deployment.id, entity.node.id) for node_instance in all_node_instances: attribute_value = node_instance.runtime_properties.get(capability_attribute_name, None) if attribute_value is not None: prop_value = attribute_value else: prop_value = __recursively_get_instance_data(node, node_instance, attribute_name) if prop_value is not None: # ctx.logger.debug('Found the property/attribute {0} with value {1} on the node {2} instance {3}'.format(attribute_name, json.dumps(prop_value), entity.node.id, # node_instance.id)) result_map[node_instance.id + '_'] = prop_value return result_map def get_property(entity, property_name): # Try to get the property value on the node property_value = entity.node.properties.get(property_name, None) if property_value is not None: # ctx.logger.debug('Found the property {0} with value {1} on the node {2}'.format(property_name, json.dumps(property_value), entity.node.id)) return property_value # No property found on the node, fall back to the host host = get_host(entity) if host is not None: # ctx.logger.debug('Property not found {0} go up to the parent node {1}'.format(property_name, host.node.id)) return get_property(host, property_name) return "" def get_instance_list(node_id): result = '' all_node_instances = client.node_instances.list(ctx.deployment.id, node_id) for node_instance in all_node_instances: if len(result) > 0: result += ',' result += node_instance.id return result def get_host_node_name(instance): for relationship in instance.relationships: if 'cloudify.relationships.contained_in' in relationship.type_hierarchy: return relationship.target.node.id return None def __get_relationship(node, target_name, relationship_type): for relationship in node.relationships: if relationship.get('target_id') == target_name and relationship_type in relationship.get('type_hierarchy'): return relationship return None def __has_attribute_mapping(node, attribute_name): # ctx.logger.debug('Check if it exists mapping for attribute {0} in {1}'.format(attribute_name, json.dumps(node.properties))) mapping_configuration = node.properties.get('_a4c_att_' + attribute_name, None) if mapping_configuration is not None: if mapping_configuration['parameters'][0] == 'SELF' and mapping_configuration['parameters'][1] == attribute_name: return False else: return True return False def __process_attribute_mapping(node, node_instance, attribute_name, data_retriever_function): # This is where attribute mapping is defined in the cloudify type mapping_configuration = node.properties['_a4c_att_' + attribute_name] # ctx.logger.debug('Mapping configuration found for attribute {0} is {1}'.format(attribute_name, json.dumps(mapping_configuration))) # If the mapping configuration exist and if it concerns SELF then just get attribute of the mapped attribute name # Else if it concerns TARGET then follow the relationship and retrieved the mapped attribute name from the TARGET if mapping_configuration['parameters'][0] == 'SELF': return data_retriever_function(node, node_instance, mapping_configuration['parameters'][1]) elif mapping_configuration['parameters'][0] == 'TARGET' and node_instance.relationships: for rel in node_instance.relationships: relationship = __get_relationship(node, rel.get('target_name'), rel.get('type')) if mapping_configuration['parameters'][1] in relationship.get('type_hierarchy'): target_instance = client.node_instances.get(rel.get('target_id')) target_node = client.nodes.get(ctx.deployment.id, target_instance.node_id) return data_retriever_function(target_node, target_instance, mapping_configuration['parameters'][2]) return None def __recursively_get_instance_data(node, node_instance, attribute_name): if __has_attribute_mapping(node, attribute_name): return __process_attribute_mapping(node, node_instance, attribute_name, __recursively_get_instance_data) attribute_value = node_instance.runtime_properties.get(attribute_name, None) if attribute_value is not None: return attribute_value elif node_instance.relationships: for rel in node_instance.relationships: # on rel we have target_name, target_id (instanceId), type relationship = __get_relationship(node, rel.get('target_name'), rel.get('type')) if 'cloudify.relationships.contained_in' in relationship.get('type_hierarchy'): parent_instance = client.node_instances.get(rel.get('target_id')) parent_node = client.nodes.get(ctx.deployment.id, parent_instance.node_id) return __recursively_get_instance_data(parent_node, parent_instance, attribute_name) return None else: return None def get_public_or_private_ip(entity): public_ip = get_attribute(entity, 'public_ip_address') if not public_ip: return get_attribute(entity, 'ip_address') return public_ip def get_attribute_from_top_host(entity, attribute_name): host = get_host(entity) while host is not None: entity = host host = get_host(entity) return get_attribute(entity, attribute_name) ctx.instance.runtime_properties['tosca_id'] = ctx.instance.id ctx.instance.runtime_properties['tosca_name'] = ctx.node.id ctx.instance.runtime_properties['port'] = r'3306' ctx.instance.runtime_properties['name'] = r'wordpress' ctx.instance.runtime_properties['db_user'] = r'pass' ctx.instance.runtime_properties['db_password'] = r'<PASSWORD>' ctx.instance.runtime_properties['bind_address'] = r'true' ctx.instance.runtime_properties['storage_path'] = r'/mountedStorage' ctx.instance.runtime_properties['capabilities.database_endpoint.protocol'] = r'tcp' ctx.instance.runtime_properties['capabilities.database_endpoint.secure'] = r'false' ctx.instance.runtime_properties['capabilities.database_endpoint.network_name'] = r'PRIVATE' ctx.instance.runtime_properties['capabilities.database_endpoint.initiator'] = r'source' ctx.instance.runtime_properties['capabilities.database_endpoint.ip_address'] = get_attribute(ctx, 'ip_address')
[ 1, 529, 276, 1112, 420, 29958, 284, 819, 29946, 9274, 29914, 284, 819, 29946, 9274, 29899, 9274, 1598, 29946, 29899, 18121, 29966, 9507, 29958, 4351, 29914, 1688, 29914, 13237, 29914, 4905, 29879, 29914, 9539, 2158, 29879, 29914, 3150, 1429, 29914, 29880, 1160, 29914, 17699, 29914, 7938, 29914, 990, 29889, 284, 819, 29946, 9274, 29889, 1639, 8726, 29889, 6854, 29891, 29889, 29880, 22532, 29914, 4247, 6644, 19891, 29874, 29946, 29883, 29918, 4247, 6644, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 13, 3166, 9570, 1598, 1053, 12893, 13, 3166, 9570, 1598, 1053, 3667, 29879, 13, 3166, 9570, 1598, 29889, 11739, 29879, 1053, 10050, 4789, 957, 519, 2392, 13, 3166, 1714, 5971, 1053, 1714, 5971, 13, 13, 5215, 2967, 29953, 29946, 13, 5215, 2897, 13, 5215, 7481, 13, 5215, 337, 13, 5215, 1014, 5014, 13, 5215, 10876, 13, 5215, 931, 13, 5215, 3244, 292, 13, 5215, 7481, 13, 5215, 4390, 13, 13, 1753, 3588, 29918, 6272, 29918, 1767, 29918, 517, 29918, 1807, 29898, 6272, 21533, 1125, 13, 1678, 363, 1820, 29892, 995, 297, 8829, 21533, 29889, 7076, 7295, 13, 4706, 8829, 21533, 29961, 710, 29898, 1989, 4638, 353, 851, 29898, 6272, 21533, 29889, 7323, 29898, 1989, 876, 13, 13, 1753, 679, 29918, 12715, 29918, 1792, 29898, 13073, 1125, 13, 1678, 565, 679, 29918, 12715, 29918, 3166, 29918, 3332, 29918, 3069, 29898, 13073, 29892, 525, 1792, 29374, 13, 4706, 736, 679, 29918, 12715, 29918, 3166, 29918, 3332, 29918, 3069, 29898, 13073, 29892, 525, 1792, 1495, 13, 1678, 565, 679, 29918, 12715, 29898, 13073, 29892, 525, 9274, 1598, 29918, 14748, 29374, 13, 4706, 736, 679, 29918, 12715, 29898, 13073, 29892, 525, 9274, 1598, 29918, 14748, 2824, 657, 877, 1792, 742, 6213, 29897, 13, 1678, 565, 679, 29918, 12715, 29898, 13073, 29892, 525, 14748, 29918, 2917, 29374, 13, 4706, 736, 679, 29918, 12715, 29898, 13073, 29892, 525, 14748, 29918, 2917, 2824, 657, 877, 1792, 742, 6213, 29897, 13, 1678, 736, 6213, 13, 13, 1753, 679, 29918, 12715, 29918, 1989, 29898, 13073, 1125, 13, 1678, 565, 679, 29918, 12715, 29918, 3166, 29918, 3332, 29918, 3069, 29898, 13073, 29892, 525, 1989, 29374, 13, 4706, 736, 679, 29918, 12715, 29918, 3166, 29918, 3332, 29918, 3069, 29898, 13073, 29892, 525, 1989, 1495, 13, 1678, 565, 679, 29918, 12715, 29898, 13073, 29892, 525, 9274, 1598, 29918, 14748, 29374, 13, 4706, 736, 679, 29918, 12715, 29898, 13073, 29892, 525, 9274, 1598, 29918, 14748, 2824, 657, 877, 1989, 742, 6213, 29897, 13, 1678, 565, 679, 29918, 12715, 29898, 13073, 29892, 525, 14748, 29918, 2917, 29374, 13, 4706, 736, 679, 29918, 12715, 29898, 13073, 29892, 525, 14748, 29918, 2917, 2824, 657, 877, 1989, 742, 6213, 29897, 13, 1678, 736, 6213, 13, 13, 1753, 679, 29918, 3069, 29898, 10041, 1125, 13, 1678, 565, 7855, 29889, 8758, 29889, 2674, 800, 14587, 29901, 13, 4706, 363, 9443, 297, 7855, 29889, 8758, 29889, 2674, 800, 14587, 29901, 13, 9651, 565, 525, 9274, 1598, 29889, 2674, 800, 14587, 29889, 1285, 7114, 29918, 262, 29915, 297, 9443, 29889, 1853, 29918, 29882, 631, 12040, 29901, 13, 18884, 736, 9443, 29889, 5182, 13, 1678, 736, 6213, 13, 13, 13, 1753, 756, 29918, 12715, 29918, 20698, 29898, 10041, 29892, 5352, 29918, 978, 1125, 13, 1678, 396, 12893, 29889, 21707, 29889, 8382, 877, 5596, 565, 372, 4864, 10417, 363, 5352, 426, 29900, 29913, 297, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 3126, 29889, 29881, 17204, 29898, 10041, 29889, 3177, 29889, 11330, 4961, 13, 1678, 10417, 29918, 13305, 353, 7855, 29889, 3177, 29889, 11330, 29889, 657, 877, 29918, 29874, 29946, 29883, 29918, 1131, 29918, 29915, 718, 5352, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 10417, 29918, 13305, 338, 451, 6213, 29901, 13, 4706, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 1660, 29931, 29943, 29915, 322, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 29962, 1275, 5352, 29918, 978, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 13, 13, 1753, 1889, 29918, 12715, 29918, 20698, 29898, 10041, 29892, 5352, 29918, 978, 29892, 848, 29918, 276, 509, 347, 369, 29918, 2220, 1125, 13, 1678, 396, 910, 338, 988, 5352, 10417, 338, 3342, 297, 278, 9570, 1598, 1134, 13, 1678, 10417, 29918, 13305, 353, 7855, 29889, 3177, 29889, 11330, 1839, 29918, 29874, 29946, 29883, 29918, 1131, 29918, 29915, 718, 5352, 29918, 978, 29962, 13, 1678, 396, 12893, 29889, 21707, 29889, 8382, 877, 15845, 5285, 1476, 363, 5352, 426, 29900, 29913, 338, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 20698, 29918, 13305, 4961, 13, 1678, 396, 960, 278, 10417, 5285, 1863, 322, 565, 372, 21838, 3725, 29931, 29943, 769, 925, 679, 5352, 310, 278, 20545, 5352, 1024, 13, 1678, 396, 15785, 565, 372, 21838, 323, 1718, 7194, 769, 1101, 278, 9443, 322, 27387, 278, 20545, 5352, 1024, 515, 278, 323, 1718, 7194, 13, 1678, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 1660, 29931, 29943, 2396, 13, 4706, 736, 848, 29918, 276, 509, 347, 369, 29918, 2220, 29898, 10041, 29892, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 2314, 13, 1678, 25342, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 29911, 1718, 7194, 29915, 322, 7855, 29889, 8758, 29889, 2674, 800, 14587, 29901, 13, 4706, 363, 9443, 297, 7855, 29889, 8758, 29889, 2674, 800, 14587, 29901, 13, 9651, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 29962, 297, 9443, 29889, 1853, 29918, 29882, 631, 12040, 29901, 13, 18884, 736, 848, 29918, 276, 509, 347, 369, 29918, 2220, 29898, 2674, 800, 4034, 29889, 5182, 29892, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29906, 2314, 13, 1678, 736, 5124, 13, 13, 13, 1753, 679, 29918, 27420, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 7039, 1125, 13, 1678, 6483, 29918, 11330, 353, 679, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 7039, 29961, 29900, 2314, 13, 1678, 5352, 29918, 7039, 29918, 1524, 353, 4256, 29898, 12715, 29918, 7039, 29897, 13, 1678, 2446, 29898, 12715, 29918, 7039, 29918, 1524, 29897, 13, 1678, 363, 5352, 29918, 978, 297, 5352, 29918, 7039, 29918, 1524, 29901, 13, 4706, 565, 6483, 29918, 11330, 338, 6213, 29901, 13, 9651, 736, 5124, 13, 4706, 1683, 29901, 13, 9651, 6483, 29918, 11330, 353, 6483, 29918, 11330, 29889, 657, 29898, 12715, 29918, 978, 29892, 6213, 29897, 13, 1678, 736, 6483, 29918, 11330, 13, 13, 13, 1753, 903, 497, 29918, 2611, 2925, 29918, 657, 29918, 27420, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 7039, 1125, 13, 1678, 736, 6213, 13, 13, 13, 1753, 679, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 978, 1125, 13, 1678, 565, 756, 29918, 12715, 29918, 20698, 29898, 10041, 29892, 5352, 29918, 978, 1125, 13, 4706, 396, 3824, 1423, 565, 738, 10417, 1863, 363, 5352, 13, 4706, 20545, 29918, 1767, 353, 1889, 29918, 12715, 29918, 20698, 29898, 10041, 29892, 5352, 29918, 978, 29892, 679, 29918, 12715, 29897, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 15845, 4864, 363, 5352, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 655, 2986, 29918, 1767, 4961, 13, 4706, 736, 20545, 29918, 1767, 13, 1678, 396, 1939, 10417, 1863, 29892, 1018, 304, 679, 4153, 278, 5352, 515, 278, 7855, 13, 1678, 5352, 29918, 1767, 353, 7855, 29889, 8758, 29889, 15634, 29918, 11330, 29889, 657, 29898, 12715, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 5352, 29918, 1767, 338, 451, 6213, 29901, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 9692, 278, 5352, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 373, 278, 2943, 426, 29906, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 12715, 29918, 1767, 511, 7855, 29889, 3177, 29889, 333, 876, 13, 4706, 736, 5352, 29918, 1767, 13, 1678, 396, 23833, 5663, 16837, 8465, 29892, 6416, 1250, 304, 2875, 13, 1678, 2875, 29918, 1767, 353, 7855, 29889, 3177, 29889, 11330, 29889, 657, 29898, 12715, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 2875, 29918, 1767, 338, 451, 6213, 29901, 13, 4706, 736, 2875, 29918, 1767, 13, 1678, 396, 9079, 5663, 16837, 8465, 29892, 6416, 1250, 304, 3495, 2777, 13, 1678, 3495, 353, 679, 29918, 3069, 29898, 10041, 29897, 13, 1678, 565, 3495, 338, 451, 6213, 29901, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 6708, 451, 1476, 426, 29900, 29913, 748, 701, 304, 278, 3847, 2943, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 3495, 29889, 3177, 29889, 333, 876, 13, 4706, 736, 679, 29918, 12715, 29898, 3069, 29892, 5352, 29918, 978, 29897, 13, 1678, 396, 9531, 338, 1476, 13, 1678, 736, 5124, 13, 13, 1753, 679, 29918, 5182, 29918, 5030, 29874, 29918, 272, 29918, 3177, 29918, 12715, 29898, 10041, 29892, 2117, 3097, 29918, 12715, 29918, 978, 29892, 5352, 29918, 978, 1125, 13, 1678, 5352, 29918, 1767, 353, 7855, 29889, 8758, 29889, 15634, 29918, 11330, 29889, 657, 29898, 5030, 3097, 29918, 12715, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 5352, 29918, 1767, 338, 451, 6213, 29901, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 9692, 278, 2117, 3097, 5352, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 373, 278, 2943, 426, 29906, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 12715, 29918, 1767, 511, 7855, 29889, 3177, 29889, 333, 876, 13, 4706, 736, 5352, 29918, 1767, 13, 1678, 736, 679, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 978, 29897, 13, 13, 1753, 903, 497, 29918, 2611, 2925, 29918, 657, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 978, 1125, 13, 1678, 1121, 29918, 1958, 353, 6571, 13, 1678, 396, 679, 599, 8871, 848, 773, 274, 29888, 29891, 1791, 3132, 13, 1678, 396, 591, 505, 304, 679, 278, 2943, 773, 278, 1791, 3132, 411, 2943, 29918, 8758, 29889, 3177, 29918, 333, 13, 1678, 396, 769, 591, 674, 505, 278, 21702, 13, 1678, 2943, 353, 3132, 29889, 18010, 29889, 657, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 7855, 29889, 3177, 29889, 333, 29897, 13, 1678, 599, 29918, 3177, 29918, 2611, 2925, 353, 3132, 29889, 3177, 29918, 2611, 2925, 29889, 1761, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 7855, 29889, 3177, 29889, 333, 29897, 13, 1678, 363, 2943, 29918, 8758, 297, 599, 29918, 3177, 29918, 2611, 2925, 29901, 13, 4706, 3107, 29918, 1767, 353, 4770, 3757, 1295, 3598, 29918, 657, 29918, 8758, 29918, 1272, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 5352, 29918, 978, 29897, 13, 4706, 565, 3107, 29918, 1767, 338, 451, 6213, 29901, 13, 9651, 396, 12893, 29889, 21707, 29889, 8382, 877, 9692, 278, 2875, 29914, 12715, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 373, 278, 2943, 426, 29906, 29913, 2777, 426, 29941, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 7728, 29918, 1767, 511, 7855, 29889, 3177, 29889, 333, 29892, 13, 9651, 396, 259, 2943, 29918, 8758, 29889, 333, 876, 13, 9651, 1121, 29918, 1958, 29961, 3177, 29918, 8758, 29889, 333, 718, 22868, 2033, 353, 3107, 29918, 1767, 13, 1678, 736, 1121, 29918, 1958, 13, 13, 29937, 19491, 408, 3517, 1158, 541, 674, 937, 1018, 304, 1284, 278, 5352, 373, 278, 2117, 3097, 29889, 13, 1753, 903, 497, 29918, 2611, 2925, 29918, 657, 29918, 5182, 29918, 5030, 29874, 29918, 272, 29918, 3177, 29918, 12715, 29898, 10041, 29892, 2117, 3097, 29918, 12715, 29918, 978, 29892, 5352, 29918, 978, 1125, 13, 1678, 1121, 29918, 1958, 353, 6571, 13, 1678, 2943, 353, 3132, 29889, 18010, 29889, 657, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 7855, 29889, 3177, 29889, 333, 29897, 13, 1678, 599, 29918, 3177, 29918, 2611, 2925, 353, 3132, 29889, 3177, 29918, 2611, 2925, 29889, 1761, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 7855, 29889, 3177, 29889, 333, 29897, 13, 1678, 363, 2943, 29918, 8758, 297, 599, 29918, 3177, 29918, 2611, 2925, 29901, 13, 4706, 5352, 29918, 1767, 353, 2943, 29918, 8758, 29889, 15634, 29918, 11330, 29889, 657, 29898, 5030, 3097, 29918, 12715, 29918, 978, 29892, 6213, 29897, 13, 4706, 565, 5352, 29918, 1767, 338, 451, 6213, 29901, 13, 9651, 3107, 29918, 1767, 353, 5352, 29918, 1767, 13, 4706, 1683, 29901, 13, 9651, 3107, 29918, 1767, 353, 4770, 3757, 1295, 3598, 29918, 657, 29918, 8758, 29918, 1272, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 5352, 29918, 978, 29897, 13, 4706, 565, 3107, 29918, 1767, 338, 451, 6213, 29901, 13, 9651, 396, 12893, 29889, 21707, 29889, 8382, 877, 9692, 278, 2875, 29914, 12715, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 373, 278, 2943, 426, 29906, 29913, 2777, 426, 29941, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 7728, 29918, 1767, 511, 7855, 29889, 3177, 29889, 333, 29892, 13, 9651, 396, 1678, 2943, 29918, 8758, 29889, 333, 876, 13, 9651, 1121, 29918, 1958, 29961, 3177, 29918, 8758, 29889, 333, 718, 22868, 2033, 353, 3107, 29918, 1767, 13, 1678, 736, 1121, 29918, 1958, 13, 13, 1753, 679, 29918, 6799, 29898, 10041, 29892, 2875, 29918, 978, 1125, 13, 1678, 396, 3967, 304, 679, 278, 2875, 995, 373, 278, 2943, 13, 1678, 2875, 29918, 1767, 353, 7855, 29889, 3177, 29889, 11330, 29889, 657, 29898, 6799, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 2875, 29918, 1767, 338, 451, 6213, 29901, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 9692, 278, 2875, 426, 29900, 29913, 411, 995, 426, 29896, 29913, 373, 278, 2943, 426, 29906, 29913, 4286, 4830, 29898, 6799, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 6799, 29918, 1767, 511, 7855, 29889, 3177, 29889, 333, 876, 13, 4706, 736, 2875, 29918, 1767, 13, 1678, 396, 1939, 2875, 1476, 373, 278, 2943, 29892, 6416, 1250, 304, 278, 3495, 13, 1678, 3495, 353, 679, 29918, 3069, 29898, 10041, 29897, 13, 1678, 565, 3495, 338, 451, 6213, 29901, 13, 4706, 396, 12893, 29889, 21707, 29889, 8382, 877, 4854, 451, 1476, 426, 29900, 29913, 748, 701, 304, 278, 3847, 2943, 426, 29896, 29913, 4286, 4830, 29898, 6799, 29918, 978, 29892, 3495, 29889, 3177, 29889, 333, 876, 13, 4706, 736, 679, 29918, 6799, 29898, 3069, 29892, 2875, 29918, 978, 29897, 13, 1678, 736, 5124, 13, 13, 13, 1753, 679, 29918, 8758, 29918, 1761, 29898, 3177, 29918, 333, 1125, 13, 1678, 1121, 353, 6629, 13, 1678, 599, 29918, 3177, 29918, 2611, 2925, 353, 3132, 29889, 3177, 29918, 2611, 2925, 29889, 1761, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 2943, 29918, 333, 29897, 13, 1678, 363, 2943, 29918, 8758, 297, 599, 29918, 3177, 29918, 2611, 2925, 29901, 13, 4706, 565, 7431, 29898, 2914, 29897, 1405, 29871, 29900, 29901, 13, 9651, 1121, 4619, 525, 5501, 13, 4706, 1121, 4619, 2943, 29918, 8758, 29889, 333, 13, 1678, 736, 1121, 13, 13, 1753, 679, 29918, 3069, 29918, 3177, 29918, 978, 29898, 8758, 1125, 13, 1678, 363, 9443, 297, 2777, 29889, 2674, 800, 14587, 29901, 13, 4706, 565, 525, 9274, 1598, 29889, 2674, 800, 14587, 29889, 1285, 7114, 29918, 262, 29915, 297, 9443, 29889, 1853, 29918, 29882, 631, 12040, 29901, 13, 9651, 736, 9443, 29889, 5182, 29889, 3177, 29889, 333, 13, 1678, 736, 6213, 13, 13, 1753, 4770, 657, 29918, 2674, 800, 4034, 29898, 3177, 29892, 3646, 29918, 978, 29892, 9443, 29918, 1853, 1125, 13, 1678, 363, 9443, 297, 2943, 29889, 2674, 800, 14587, 29901, 13, 4706, 565, 9443, 29889, 657, 877, 5182, 29918, 333, 1495, 1275, 3646, 29918, 978, 322, 9443, 29918, 1853, 297, 9443, 29889, 657, 877, 1853, 29918, 29882, 631, 12040, 29374, 13, 9651, 736, 9443, 13, 1678, 736, 6213, 13, 13, 13, 1753, 4770, 5349, 29918, 12715, 29918, 20698, 29898, 3177, 29892, 5352, 29918, 978, 1125, 13, 1678, 396, 12893, 29889, 21707, 29889, 8382, 877, 5596, 565, 372, 4864, 10417, 363, 5352, 426, 29900, 29913, 297, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 3177, 29889, 11330, 4961, 13, 1678, 10417, 29918, 13305, 353, 2943, 29889, 11330, 29889, 657, 877, 29918, 29874, 29946, 29883, 29918, 1131, 29918, 29915, 718, 5352, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 10417, 29918, 13305, 338, 451, 6213, 29901, 13, 4706, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 1660, 29931, 29943, 29915, 322, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 29962, 1275, 5352, 29918, 978, 29901, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 736, 5852, 13, 1678, 736, 7700, 13, 13, 1753, 4770, 5014, 29918, 12715, 29918, 20698, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 5352, 29918, 978, 29892, 848, 29918, 276, 509, 347, 369, 29918, 2220, 1125, 13, 1678, 396, 910, 338, 988, 5352, 10417, 338, 3342, 297, 278, 9570, 1598, 1134, 13, 1678, 10417, 29918, 13305, 353, 2943, 29889, 11330, 1839, 29918, 29874, 29946, 29883, 29918, 1131, 29918, 29915, 718, 5352, 29918, 978, 29962, 13, 1678, 396, 12893, 29889, 21707, 29889, 8382, 877, 15845, 5285, 1476, 363, 5352, 426, 29900, 29913, 338, 426, 29896, 29913, 4286, 4830, 29898, 12715, 29918, 978, 29892, 4390, 29889, 29881, 17204, 29898, 20698, 29918, 13305, 4961, 13, 1678, 396, 960, 278, 10417, 5285, 1863, 322, 565, 372, 21838, 3725, 29931, 29943, 769, 925, 679, 5352, 310, 278, 20545, 5352, 1024, 13, 1678, 396, 15785, 565, 372, 21838, 323, 1718, 7194, 769, 1101, 278, 9443, 322, 27387, 278, 20545, 5352, 1024, 515, 278, 323, 1718, 7194, 13, 1678, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 1660, 29931, 29943, 2396, 13, 4706, 736, 848, 29918, 276, 509, 347, 369, 29918, 2220, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 2314, 13, 1678, 25342, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29900, 29962, 1275, 525, 29911, 1718, 7194, 29915, 322, 2943, 29918, 8758, 29889, 2674, 800, 14587, 29901, 13, 4706, 363, 1104, 297, 2943, 29918, 8758, 29889, 2674, 800, 14587, 29901, 13, 9651, 9443, 353, 4770, 657, 29918, 2674, 800, 4034, 29898, 3177, 29892, 1104, 29889, 657, 877, 5182, 29918, 978, 5477, 1104, 29889, 657, 877, 1853, 8785, 13, 9651, 565, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29896, 29962, 297, 9443, 29889, 657, 877, 1853, 29918, 29882, 631, 12040, 29374, 13, 18884, 3646, 29918, 8758, 353, 3132, 29889, 3177, 29918, 2611, 2925, 29889, 657, 29898, 2674, 29889, 657, 877, 5182, 29918, 333, 8785, 13, 18884, 3646, 29918, 3177, 353, 3132, 29889, 18010, 29889, 657, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 3646, 29918, 8758, 29889, 3177, 29918, 333, 29897, 13, 18884, 736, 848, 29918, 276, 509, 347, 369, 29918, 2220, 29898, 5182, 29918, 3177, 29892, 3646, 29918, 8758, 29892, 10417, 29918, 13305, 1839, 16744, 2033, 29961, 29906, 2314, 13, 1678, 736, 6213, 13, 13, 1753, 4770, 3757, 1295, 3598, 29918, 657, 29918, 8758, 29918, 1272, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 5352, 29918, 978, 1125, 13, 1678, 565, 4770, 5349, 29918, 12715, 29918, 20698, 29898, 3177, 29892, 5352, 29918, 978, 1125, 13, 4706, 736, 4770, 5014, 29918, 12715, 29918, 20698, 29898, 3177, 29892, 2943, 29918, 8758, 29892, 5352, 29918, 978, 29892, 4770, 3757, 1295, 3598, 29918, 657, 29918, 8758, 29918, 1272, 29897, 13, 1678, 5352, 29918, 1767, 353, 2943, 29918, 8758, 29889, 15634, 29918, 11330, 29889, 657, 29898, 12715, 29918, 978, 29892, 6213, 29897, 13, 1678, 565, 5352, 29918, 1767, 338, 451, 6213, 29901, 13, 4706, 736, 5352, 29918, 1767, 13, 1678, 25342, 2943, 29918, 8758, 29889, 2674, 800, 14587, 29901, 13, 4706, 363, 1104, 297, 2943, 29918, 8758, 29889, 2674, 800, 14587, 29901, 13, 9651, 396, 373, 1104, 591, 505, 3646, 29918, 978, 29892, 3646, 29918, 333, 313, 8758, 1204, 511, 1134, 13, 9651, 9443, 353, 4770, 657, 29918, 2674, 800, 4034, 29898, 3177, 29892, 1104, 29889, 657, 877, 5182, 29918, 978, 5477, 1104, 29889, 657, 877, 1853, 8785, 13, 9651, 565, 525, 9274, 1598, 29889, 2674, 800, 14587, 29889, 1285, 7114, 29918, 262, 29915, 297, 9443, 29889, 657, 877, 1853, 29918, 29882, 631, 12040, 29374, 13, 18884, 3847, 29918, 8758, 353, 3132, 29889, 3177, 29918, 2611, 2925, 29889, 657, 29898, 2674, 29889, 657, 877, 5182, 29918, 333, 8785, 13, 18884, 3847, 29918, 3177, 353, 3132, 29889, 18010, 29889, 657, 29898, 13073, 29889, 16519, 358, 29889, 333, 29892, 3847, 29918, 8758, 29889, 3177, 29918, 333, 29897, 13, 18884, 736, 4770, 3757, 1295, 3598, 29918, 657, 29918, 8758, 29918, 1272, 29898, 3560, 29918, 3177, 29892, 3847, 29918, 8758, 29892, 5352, 29918, 978, 29897, 13, 4706, 736, 6213, 13, 1678, 1683, 29901, 13, 4706, 736, 6213, 13, 13, 1753, 679, 29918, 3597, 29918, 272, 29918, 9053, 29918, 666, 29898, 10041, 1125, 13, 1678, 970, 29918, 666, 353, 679, 29918, 12715, 29898, 10041, 29892, 525, 3597, 29918, 666, 29918, 7328, 1495, 13, 1678, 565, 451, 970, 29918, 666, 29901, 13, 4706, 736, 679, 29918, 12715, 29898, 10041, 29892, 525, 666, 29918, 7328, 1495, 13, 1678, 736, 970, 29918, 666, 13, 13, 1753, 679, 29918, 12715, 29918, 3166, 29918, 3332, 29918, 3069, 29898, 10041, 29892, 5352, 29918, 978, 1125, 13, 1678, 3495, 353, 679, 29918, 3069, 29898, 10041, 29897, 13, 1678, 1550, 3495, 338, 451, 6213, 29901, 13, 4706, 7855, 353, 3495, 13, 4706, 3495, 353, 679, 29918, 3069, 29898, 10041, 29897, 13, 1678, 736, 679, 29918, 12715, 29898, 10041, 29892, 5352, 29918, 978, 29897, 13, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 29873, 359, 1113, 29918, 333, 2033, 353, 12893, 29889, 8758, 29889, 333, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 29873, 359, 1113, 29918, 978, 2033, 353, 12893, 29889, 3177, 29889, 333, 13, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 637, 2033, 353, 364, 29915, 29941, 29941, 29900, 29953, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 978, 2033, 353, 364, 29915, 23424, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 2585, 29918, 1792, 2033, 353, 364, 29915, 3364, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 2585, 29918, 5630, 2033, 353, 364, 29915, 29966, 25711, 17013, 16299, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5355, 29918, 7328, 2033, 353, 364, 29915, 3009, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 12925, 29918, 2084, 2033, 353, 364, 29915, 29914, 16476, 287, 10486, 29915, 13, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5030, 11614, 29889, 9803, 29918, 29734, 29889, 20464, 2033, 353, 364, 29915, 23981, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5030, 11614, 29889, 9803, 29918, 29734, 29889, 24216, 2033, 353, 364, 29915, 4541, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5030, 11614, 29889, 9803, 29918, 29734, 29889, 11618, 29918, 978, 2033, 353, 364, 29915, 29829, 29963, 3040, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5030, 11614, 29889, 9803, 29918, 29734, 29889, 2344, 29875, 1061, 2033, 353, 364, 29915, 4993, 29915, 13, 13073, 29889, 8758, 29889, 15634, 29918, 11330, 1839, 5030, 11614, 29889, 9803, 29918, 29734, 29889, 666, 29918, 7328, 2033, 353, 679, 29918, 12715, 29898, 13073, 29892, 525, 666, 29918, 7328, 1495, 13, 13, 2 ]
sockfilter/real.py
cardforcoin/sockfilter
1
189695
<filename>sockfilter/real.py __all__ = ['restore', 'socket', 'socks', 'socket__socket'] import socket socket__socket = socket.socket socks__socksocket = None try: import socks socks__socksocket = socks.socksocket except ImportError: socks = None from .util import apply_attr_and_dict def restore(): apply_attr_and_dict(socket, 'socket', socket__socket) apply_attr_and_dict(socket, 'SocketType', socket__socket) apply_attr_and_dict(socket, '_socketobject', socket__socket) apply_attr_and_dict(socks, 'socksocket', socks__socksocket)
[ 1, 529, 9507, 29958, 21852, 4572, 29914, 6370, 29889, 2272, 13, 1649, 497, 1649, 353, 6024, 5060, 487, 742, 525, 11514, 742, 525, 578, 4684, 742, 525, 11514, 1649, 11514, 2033, 13, 13, 5215, 9909, 13, 13, 11514, 1649, 11514, 353, 9909, 29889, 11514, 13, 13, 578, 4684, 1649, 21852, 11514, 353, 6213, 13, 2202, 29901, 13, 1678, 1053, 577, 4684, 13, 1678, 577, 4684, 1649, 21852, 11514, 353, 577, 4684, 29889, 21852, 11514, 13, 19499, 16032, 2392, 29901, 13, 1678, 577, 4684, 353, 6213, 13, 13, 3166, 869, 4422, 1053, 3394, 29918, 5552, 29918, 392, 29918, 8977, 13, 13, 13, 1753, 17749, 7295, 13, 1678, 3394, 29918, 5552, 29918, 392, 29918, 8977, 29898, 11514, 29892, 525, 11514, 742, 9909, 1649, 11514, 29897, 13, 1678, 3394, 29918, 5552, 29918, 392, 29918, 8977, 29898, 11514, 29892, 525, 11373, 1542, 742, 9909, 1649, 11514, 29897, 13, 1678, 3394, 29918, 5552, 29918, 392, 29918, 8977, 29898, 11514, 29892, 22868, 11514, 3318, 742, 9909, 1649, 11514, 29897, 13, 1678, 3394, 29918, 5552, 29918, 392, 29918, 8977, 29898, 578, 4684, 29892, 525, 21852, 11514, 742, 577, 4684, 1649, 21852, 11514, 29897, 13, 2 ]