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
shelter/migrations/0024_auto_20201018_2225.py
kermox/schronisko-krakow
1
163450
# Generated by Django 3.0.5 on 2020-10-18 22:25 import django.db.models.deletion from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shelter', '0023_animal_adopted_by'), ] operations = [ migrations.AlterField( model_name='animal', name='adopted_by', field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='shelter.PetOwner'), ), ]
[ 1, 396, 3251, 630, 491, 15337, 29871, 29941, 29889, 29900, 29889, 29945, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29896, 29900, 29899, 29896, 29947, 29871, 29906, 29906, 29901, 29906, 29945, 13, 13, 5215, 9557, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 845, 21883, 742, 525, 29900, 29900, 29906, 29941, 29918, 273, 3039, 29918, 912, 415, 287, 29918, 1609, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 273, 3039, 742, 13, 9651, 1024, 2433, 912, 415, 287, 29918, 1609, 742, 13, 9651, 1746, 29922, 9794, 29889, 27755, 2558, 29898, 19465, 29922, 5574, 29892, 1870, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 845, 21883, 29889, 29925, 300, 28213, 5477, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
tests/test_pycolor.py
edonyzpc/toolkitem
3
30877
from __future__ import print_function import sys sys.path.append('./') from colorprinter.pycolor import PyColor from colorprinter.pycolor import cprint @PyColor('ured') def printer(string): a = 1 b = 2 print(str((a + b)**4) + string) class TestClass(object): def test_pycolor(self): printer('edony') def test_cprint(self): cprint('ugreen', 'hello edony') def test_setformat(self): py_color = PyColor('green') py_color.format = 'ucyan' cprint(py_color.format, 'this is test') def test_disableformat(self): py_color = PyColor('ured') cprint(py_color.format, 'this is test') py_color.disable() cprint(py_color.format, 'this is disable') assert py_color.format is '' def test_colorstr(self): str1 = 'this is a test' py_color = PyColor('green') str2 = py_color.colorstr(str1) str3 = py_color.colorstr(str1, 'red') assert((str2 == '\033[0;32;40mthis is a test\033[0m') and (str3 == '\033[0;31;40mthis is a test\033[0m')) #if __name__ == "__main__": # cprint('ugreen', 'hello edony') # printer('edony') # py_color = PyColor('green') # py_color.format = 'ucyan' # print(py_color.format) # cprint(py_color.format, 'this is test')
[ 1, 515, 4770, 29888, 9130, 1649, 1053, 1596, 29918, 2220, 13, 5215, 10876, 13, 9675, 29889, 2084, 29889, 4397, 877, 6904, 1495, 13, 3166, 2927, 558, 1639, 29889, 2272, 2780, 1053, 10772, 3306, 13, 3166, 2927, 558, 1639, 29889, 2272, 2780, 1053, 274, 2158, 13, 13, 29992, 19737, 3306, 877, 2955, 1495, 13, 1753, 23028, 29898, 1807, 1125, 13, 1678, 263, 353, 29871, 29896, 13, 1678, 289, 353, 29871, 29906, 13, 1678, 1596, 29898, 710, 3552, 29874, 718, 289, 29897, 1068, 29946, 29897, 718, 1347, 29897, 13, 13, 1990, 4321, 2385, 29898, 3318, 1125, 13, 1678, 822, 1243, 29918, 2272, 2780, 29898, 1311, 1125, 13, 4706, 23028, 877, 287, 2592, 1495, 13, 13, 1678, 822, 1243, 29918, 29883, 2158, 29898, 1311, 1125, 13, 4706, 274, 2158, 877, 688, 2733, 742, 525, 12199, 1226, 2592, 1495, 13, 13, 1678, 822, 1243, 29918, 842, 4830, 29898, 1311, 1125, 13, 4706, 11451, 29918, 2780, 353, 10772, 3306, 877, 12692, 1495, 13, 4706, 11451, 29918, 2780, 29889, 4830, 353, 525, 29884, 1270, 273, 29915, 13, 4706, 274, 2158, 29898, 2272, 29918, 2780, 29889, 4830, 29892, 525, 1366, 338, 1243, 1495, 13, 13, 1678, 822, 1243, 29918, 20472, 4830, 29898, 1311, 1125, 13, 4706, 11451, 29918, 2780, 353, 10772, 3306, 877, 2955, 1495, 13, 4706, 274, 2158, 29898, 2272, 29918, 2780, 29889, 4830, 29892, 525, 1366, 338, 1243, 1495, 13, 4706, 11451, 29918, 2780, 29889, 20472, 580, 13, 4706, 274, 2158, 29898, 2272, 29918, 2780, 29889, 4830, 29892, 525, 1366, 338, 11262, 1495, 13, 4706, 4974, 11451, 29918, 2780, 29889, 4830, 338, 6629, 13, 13, 1678, 822, 1243, 29918, 2780, 710, 29898, 1311, 1125, 13, 4706, 851, 29896, 353, 525, 1366, 338, 263, 1243, 29915, 13, 4706, 11451, 29918, 2780, 353, 10772, 3306, 877, 12692, 1495, 13, 4706, 851, 29906, 353, 11451, 29918, 2780, 29889, 2780, 710, 29898, 710, 29896, 29897, 13, 4706, 851, 29941, 353, 11451, 29918, 2780, 29889, 2780, 710, 29898, 710, 29896, 29892, 525, 1127, 1495, 13, 4706, 4974, 3552, 710, 29906, 1275, 11297, 29900, 29941, 29941, 29961, 29900, 29936, 29941, 29906, 29936, 29946, 29900, 29885, 1366, 338, 263, 1243, 29905, 29900, 29941, 29941, 29961, 29900, 29885, 1495, 322, 13, 1669, 313, 710, 29941, 1275, 11297, 29900, 29941, 29941, 29961, 29900, 29936, 29941, 29896, 29936, 29946, 29900, 29885, 1366, 338, 263, 1243, 29905, 29900, 29941, 29941, 29961, 29900, 29885, 8785, 13, 13, 29937, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 29937, 1678, 274, 2158, 877, 688, 2733, 742, 525, 12199, 1226, 2592, 1495, 13, 29937, 1678, 23028, 877, 287, 2592, 1495, 13, 29937, 1678, 11451, 29918, 2780, 353, 10772, 3306, 877, 12692, 1495, 13, 29937, 1678, 11451, 29918, 2780, 29889, 4830, 353, 525, 29884, 1270, 273, 29915, 13, 29937, 1678, 1596, 29898, 2272, 29918, 2780, 29889, 4830, 29897, 13, 29937, 1678, 274, 2158, 29898, 2272, 29918, 2780, 29889, 4830, 29892, 525, 1366, 338, 1243, 1495, 13, 2 ]
chat/models.py
nim65s/tutochan
0
177902
from django.conf import settings from django.db import models from ndh.models import Links, NamedModel, TimeStampedModel class Chan(TimeStampedModel, NamedModel, Links): pass class Message(TimeStampedModel): chan = models.ForeignKey(Chan, on_delete=models.CASCADE) user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) message = models.TextField() def __str__(self): return f'{self.chan} | {self.created:%x %X} - {self.user}: {self.message}'
[ 1, 515, 9557, 29889, 5527, 1053, 6055, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 13, 3166, 29871, 299, 29882, 29889, 9794, 1053, 6645, 29879, 29892, 405, 2795, 3195, 29892, 5974, 855, 1160, 287, 3195, 13, 13, 13, 1990, 22433, 29898, 2481, 855, 1160, 287, 3195, 29892, 405, 2795, 3195, 29892, 6645, 29879, 1125, 13, 1678, 1209, 13, 13, 13, 1990, 7777, 29898, 2481, 855, 1160, 287, 3195, 1125, 13, 1678, 521, 273, 353, 4733, 29889, 27755, 2558, 29898, 1451, 273, 29892, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29897, 13, 1678, 1404, 353, 4733, 29889, 27755, 2558, 29898, 11027, 29889, 20656, 29950, 29918, 11889, 29918, 20387, 29931, 29892, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29897, 13, 1678, 2643, 353, 4733, 29889, 15778, 580, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 736, 285, 29915, 29912, 1311, 29889, 5083, 29913, 891, 426, 1311, 29889, 11600, 16664, 29916, 1273, 29990, 29913, 448, 426, 1311, 29889, 1792, 6177, 426, 1311, 29889, 4906, 10162, 13, 2 ]
rbldap/accounts/uid.py
butlerx/rb-ldap-python
0
196636
<filename>rbldap/accounts/uid.py<gh_stars>0 """uid functions""" from .clients import LDAPConnection async def find_available_uid(ldap_conn: LDAPConnection) -> int: """ Seach RB ldap for next available uid Args: ldap_conn: LDAP connection to use for searching Returns: next avilable uid """ res = await ldap_conn.search( "ou=accounts,o=redbrick", "(objectclass=posixAccount)", attributes=["uidNumber"], ) uids = [entry["attributes"]["uidNumber"][0] for entry in res] uids.sort() return int(uids[-1]) + 1
[ 1, 529, 9507, 29958, 6050, 430, 481, 29914, 10149, 29879, 29914, 5416, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 5416, 3168, 15945, 29908, 13, 13, 3166, 869, 11303, 1237, 1053, 365, 29928, 3301, 5350, 13, 13, 13, 12674, 822, 1284, 29918, 16515, 29918, 5416, 29898, 430, 481, 29918, 13082, 29901, 365, 29928, 3301, 5350, 29897, 1599, 938, 29901, 13, 1678, 9995, 13, 1678, 922, 496, 390, 29933, 301, 29881, 481, 363, 2446, 3625, 318, 333, 13, 13, 1678, 826, 3174, 29901, 13, 4706, 301, 29881, 481, 29918, 13082, 29901, 365, 29928, 3301, 3957, 304, 671, 363, 11975, 13, 13, 1678, 16969, 29901, 13, 4706, 2446, 1029, 309, 519, 318, 333, 13, 1678, 9995, 13, 1678, 620, 353, 7272, 301, 29881, 481, 29918, 13082, 29889, 4478, 29898, 13, 4706, 376, 283, 29922, 10149, 29879, 29892, 29877, 29922, 1127, 1182, 860, 613, 13, 4706, 18227, 3318, 1990, 29922, 1066, 861, 10601, 19123, 13, 4706, 8393, 29922, 3366, 5416, 4557, 12436, 13, 1678, 1723, 13, 1678, 318, 4841, 353, 518, 8269, 3366, 15697, 3108, 3366, 5416, 4557, 3108, 29961, 29900, 29962, 363, 6251, 297, 620, 29962, 13, 1678, 318, 4841, 29889, 6605, 580, 13, 1678, 736, 938, 29898, 29884, 4841, 14352, 29896, 2314, 718, 29871, 29896, 13, 2 ]
tests/plugins/__init__.py
kyldery/streamlink
1
166661
from streamlink.plugin import Plugin generic_negative_matches = [ "http://example.com/", "https://example.com/", "https://example.com/index.html", ] class PluginCanHandleUrl: __plugin__ = None # A list of URLs that should match any of the plugin's URL regexes. # ["https://foo", "https://bar"] should_match = [] # A list of URL+capturegroup tuples, where capturegroup can be a dict (re.Match.groupdict()) or a tuple (re.Match.groups()). # URLs defined in this list automatically get appended to the should_match list. # Values in capturegroup dictionaries that are None get ignored when comparing and can be omitted in the test fixtures. # [("https://foo", {"foo": "foo"}), ("https://bar", ("bar", None))] should_match_groups = [] # A list of URLs that should not match any of the plugin's URL regexes. # ["https://foo", "https://bar"] should_not_match = [] def test_class_setup(self): assert issubclass(self.__plugin__, Plugin), "Test has a __plugin__ that is a subclass of streamlink.plugin.Plugin" assert len(self.should_match + self.should_match_groups) > 0, "Test has at least one positive URL" def test_matchers(self): should_match = self.should_match + [url for url, groups in self.should_match_groups] assert all( any( matcher.pattern.match(url) for url in should_match ) for matcher in self.__plugin__.matchers ), "All plugin matchers should match" # parametrized dynamically via conftest.py def test_can_handle_url_positive(self, url): assert any( # pragma: no branch matcher.pattern.match(url) for matcher in self.__plugin__.matchers ), "URL matches" # parametrized dynamically via conftest.py def test_can_handle_url_negative(self, url): assert not any( # pragma: no branch matcher.pattern.match(url) for matcher in self.__plugin__.matchers ), "URL does not match" # parametrized dynamically via conftest.py def test_capture_groups(self, url, groups): for matcher in self.__plugin__.matchers: match = matcher.pattern.match(url) if match: # pragma: no branch res = ( # ignore None values in capture group dicts {k: v for k, v in match.groupdict().items() if v is not None} if type(groups) is dict else # capture group tuples match.groups() ) assert res == groups, "URL capture groups match"
[ 1, 515, 4840, 2324, 29889, 8582, 1053, 1858, 3851, 13, 13, 13, 19206, 29918, 22198, 29918, 20317, 353, 518, 13, 1678, 376, 1124, 597, 4773, 29889, 510, 29914, 613, 13, 1678, 376, 991, 597, 4773, 29889, 510, 29914, 613, 13, 1678, 376, 991, 597, 4773, 29889, 510, 29914, 2248, 29889, 1420, 613, 13, 29962, 13, 13, 13, 1990, 1858, 3851, 6028, 13554, 5983, 29901, 13, 1678, 4770, 8582, 1649, 353, 6213, 13, 13, 1678, 396, 319, 1051, 310, 24295, 393, 881, 1993, 738, 310, 278, 7079, 29915, 29879, 3988, 6528, 267, 29889, 13, 1678, 396, 259, 6796, 991, 597, 5431, 613, 376, 991, 597, 1646, 3108, 13, 1678, 881, 29918, 4352, 353, 5159, 13, 13, 1678, 396, 319, 1051, 310, 3988, 29974, 17885, 545, 2972, 5291, 2701, 29892, 988, 10446, 2972, 508, 367, 263, 9657, 313, 276, 29889, 9652, 29889, 2972, 8977, 3101, 470, 263, 18761, 313, 276, 29889, 9652, 29889, 13155, 16655, 13, 1678, 396, 24295, 3342, 297, 445, 1051, 6336, 679, 623, 2760, 304, 278, 881, 29918, 4352, 1051, 29889, 13, 1678, 396, 2630, 1041, 297, 10446, 2972, 21503, 4314, 393, 526, 6213, 679, 17262, 746, 17420, 322, 508, 367, 25811, 297, 278, 1243, 5713, 486, 1973, 29889, 13, 1678, 396, 259, 518, 703, 991, 597, 5431, 613, 8853, 5431, 1115, 376, 5431, 9092, 511, 4852, 991, 597, 1646, 613, 4852, 1646, 613, 6213, 28166, 13, 1678, 881, 29918, 4352, 29918, 13155, 353, 5159, 13, 13, 1678, 396, 319, 1051, 310, 24295, 393, 881, 451, 1993, 738, 310, 278, 7079, 29915, 29879, 3988, 6528, 267, 29889, 13, 1678, 396, 259, 6796, 991, 597, 5431, 613, 376, 991, 597, 1646, 3108, 13, 1678, 881, 29918, 1333, 29918, 4352, 353, 5159, 13, 13, 1678, 822, 1243, 29918, 1990, 29918, 14669, 29898, 1311, 1125, 13, 4706, 4974, 338, 1491, 1990, 29898, 1311, 17255, 8582, 1649, 29892, 1858, 3851, 511, 376, 3057, 756, 263, 4770, 8582, 1649, 393, 338, 263, 19481, 310, 4840, 2324, 29889, 8582, 29889, 16288, 29908, 13, 4706, 4974, 7431, 29898, 1311, 29889, 9344, 29918, 4352, 718, 1583, 29889, 9344, 29918, 4352, 29918, 13155, 29897, 1405, 29871, 29900, 29892, 376, 3057, 756, 472, 3203, 697, 6374, 3988, 29908, 13, 13, 1678, 822, 1243, 29918, 4352, 414, 29898, 1311, 1125, 13, 4706, 881, 29918, 4352, 353, 1583, 29889, 9344, 29918, 4352, 718, 518, 2271, 363, 3142, 29892, 6471, 297, 1583, 29889, 9344, 29918, 4352, 29918, 13155, 29962, 13, 4706, 4974, 599, 29898, 13, 9651, 738, 29898, 13, 18884, 1993, 261, 29889, 11037, 29889, 4352, 29898, 2271, 29897, 13, 18884, 363, 3142, 297, 881, 29918, 4352, 13, 9651, 1723, 13, 9651, 363, 1993, 261, 297, 1583, 17255, 8582, 26914, 4352, 414, 13, 4706, 10353, 376, 3596, 7079, 1993, 414, 881, 1993, 29908, 13, 13, 1678, 396, 25011, 7485, 287, 11200, 3025, 378, 615, 342, 29889, 2272, 13, 1678, 822, 1243, 29918, 3068, 29918, 8411, 29918, 2271, 29918, 1066, 3321, 29898, 1311, 29892, 3142, 1125, 13, 4706, 4974, 738, 29898, 29871, 396, 282, 23929, 29901, 694, 5443, 13, 9651, 1993, 261, 29889, 11037, 29889, 4352, 29898, 2271, 29897, 13, 9651, 363, 1993, 261, 297, 1583, 17255, 8582, 26914, 4352, 414, 13, 4706, 10353, 376, 4219, 7087, 29908, 13, 13, 1678, 396, 25011, 7485, 287, 11200, 3025, 378, 615, 342, 29889, 2272, 13, 1678, 822, 1243, 29918, 3068, 29918, 8411, 29918, 2271, 29918, 22198, 29898, 1311, 29892, 3142, 1125, 13, 4706, 4974, 451, 738, 29898, 29871, 396, 282, 23929, 29901, 694, 5443, 13, 9651, 1993, 261, 29889, 11037, 29889, 4352, 29898, 2271, 29897, 13, 9651, 363, 1993, 261, 297, 1583, 17255, 8582, 26914, 4352, 414, 13, 4706, 10353, 376, 4219, 947, 451, 1993, 29908, 13, 13, 1678, 396, 25011, 7485, 287, 11200, 3025, 378, 615, 342, 29889, 2272, 13, 1678, 822, 1243, 29918, 17885, 545, 29918, 13155, 29898, 1311, 29892, 3142, 29892, 6471, 1125, 13, 4706, 363, 1993, 261, 297, 1583, 17255, 8582, 26914, 4352, 414, 29901, 13, 9651, 1993, 353, 1993, 261, 29889, 11037, 29889, 4352, 29898, 2271, 29897, 13, 9651, 565, 1993, 29901, 29871, 396, 282, 23929, 29901, 694, 5443, 13, 18884, 620, 353, 313, 13, 462, 1678, 396, 11455, 6213, 1819, 297, 10446, 2318, 9657, 29879, 13, 462, 1678, 426, 29895, 29901, 325, 363, 413, 29892, 325, 297, 1993, 29889, 2972, 8977, 2141, 7076, 580, 565, 325, 338, 451, 6213, 29913, 13, 462, 1678, 565, 1134, 29898, 13155, 29897, 338, 9657, 1683, 13, 462, 1678, 396, 10446, 2318, 5291, 2701, 13, 462, 1678, 1993, 29889, 13155, 580, 13, 18884, 1723, 13, 18884, 4974, 620, 1275, 6471, 29892, 376, 4219, 10446, 6471, 1993, 29908, 13, 2 ]
gtk/ch6_header.py
ykyang/org.allnix.python
0
192290
""" https://python-gtk-3-tutorial.readthedocs.io/en/latest/layout.html#headerbar @author: <NAME> <<EMAIL>> """ import gi gi.require_version("Gtk", "3.0") from gi.repository import Gtk, Gio class HeaderBarWindow(Gtk.Window): def __init__(self): Gtk.Window.__init__(self, title="HeaderBar Demo") self.set_border_width(10) self.set_default_size(400, 200) hb = Gtk.HeaderBar() hb.set_show_close_button(True) hb.props.title = "HeaderBar example" self.set_titlebar(hb) button = Gtk.Button() icon = Gio.ThemedIcon(name="mail-send-receive-symbolic") image = Gtk.Image.new_from_gicon(icon, Gtk.IconSize.BUTTON) button.add(image) hb.pack_end(button) box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) Gtk.StyleContext.add_class(box.get_style_context(), "linked") button = Gtk.Button() button.add( Gtk.Arrow(arrow_type=Gtk.ArrowType.LEFT, shadow_type=Gtk.ShadowType.NONE) ) box.add(button) button = Gtk.Button() button = Gtk.Button.new_from_icon_name("pan-end-symbolic", Gtk.IconSize.MENU) box.add(button) hb.pack_start(box) self.add(Gtk.TextView()) win = HeaderBarWindow() win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main()
[ 1, 9995, 13, 991, 597, 4691, 29899, 4141, 29895, 29899, 29941, 29899, 12631, 29889, 949, 386, 287, 12332, 29889, 601, 29914, 264, 29914, 12333, 29914, 2680, 29889, 1420, 29937, 6672, 1646, 13, 13, 29992, 8921, 29901, 529, 5813, 29958, 3532, 26862, 6227, 6778, 13, 15945, 29908, 13, 13, 5215, 4005, 13, 13, 3146, 29889, 12277, 29918, 3259, 703, 29954, 11178, 613, 376, 29941, 29889, 29900, 1159, 13, 3166, 4005, 29889, 19033, 1053, 402, 11178, 29892, 402, 601, 13, 13, 13, 1990, 19345, 4297, 5907, 29898, 29954, 11178, 29889, 5907, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 402, 11178, 29889, 5907, 17255, 2344, 12035, 1311, 29892, 3611, 543, 7850, 4297, 27819, 1159, 13, 4706, 1583, 29889, 842, 29918, 11466, 29918, 2103, 29898, 29896, 29900, 29897, 13, 4706, 1583, 29889, 842, 29918, 4381, 29918, 2311, 29898, 29946, 29900, 29900, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 298, 29890, 353, 402, 11178, 29889, 7850, 4297, 580, 13, 4706, 298, 29890, 29889, 842, 29918, 4294, 29918, 5358, 29918, 3092, 29898, 5574, 29897, 13, 4706, 298, 29890, 29889, 11030, 29889, 3257, 353, 376, 7850, 4297, 1342, 29908, 13, 4706, 1583, 29889, 842, 29918, 3257, 1646, 29898, 29882, 29890, 29897, 13, 13, 4706, 2826, 353, 402, 11178, 29889, 3125, 580, 13, 4706, 9849, 353, 402, 601, 29889, 1349, 22580, 12492, 29898, 978, 543, 2549, 29899, 6717, 29899, 13556, 573, 29899, 18098, 293, 1159, 13, 4706, 1967, 353, 402, 11178, 29889, 2940, 29889, 1482, 29918, 3166, 29918, 29887, 4144, 29898, 4144, 29892, 402, 11178, 29889, 12492, 3505, 29889, 29933, 2692, 29911, 1164, 29897, 13, 4706, 2826, 29889, 1202, 29898, 3027, 29897, 13, 4706, 298, 29890, 29889, 4058, 29918, 355, 29898, 3092, 29897, 13, 13, 4706, 3800, 353, 402, 11178, 29889, 3313, 29898, 20659, 29922, 29954, 11178, 29889, 25231, 29889, 29950, 1955, 26664, 1164, 29911, 1964, 29897, 13, 4706, 402, 11178, 29889, 5568, 2677, 29889, 1202, 29918, 1990, 29898, 1884, 29889, 657, 29918, 3293, 29918, 4703, 3285, 376, 2324, 287, 1159, 13, 13, 4706, 2826, 353, 402, 11178, 29889, 3125, 580, 13, 4706, 2826, 29889, 1202, 29898, 13, 9651, 402, 11178, 29889, 1433, 798, 29898, 2936, 29918, 1853, 29922, 29954, 11178, 29889, 1433, 798, 1542, 29889, 28024, 29892, 15504, 29918, 1853, 29922, 29954, 11178, 29889, 2713, 6986, 1542, 29889, 29940, 12413, 29897, 13, 4706, 1723, 13, 4706, 3800, 29889, 1202, 29898, 3092, 29897, 13, 13, 4706, 2826, 353, 402, 11178, 29889, 3125, 580, 13, 4706, 2826, 353, 402, 11178, 29889, 3125, 29889, 1482, 29918, 3166, 29918, 4144, 29918, 978, 703, 8357, 29899, 355, 29899, 18098, 293, 613, 402, 11178, 29889, 12492, 3505, 29889, 29924, 1430, 29965, 29897, 13, 4706, 3800, 29889, 1202, 29898, 3092, 29897, 13, 13, 4706, 298, 29890, 29889, 4058, 29918, 2962, 29898, 1884, 29897, 13, 13, 4706, 1583, 29889, 1202, 29898, 29954, 11178, 29889, 10607, 3101, 13, 13, 13, 5080, 353, 19345, 4297, 5907, 580, 13, 5080, 29889, 6915, 703, 20524, 613, 402, 11178, 29889, 3396, 29918, 28358, 29897, 13, 5080, 29889, 4294, 29918, 497, 580, 13, 29954, 11178, 29889, 3396, 580, 2 ]
OverFitting Simulation.py
escha2019/python_codes
0
71767
#!/usr/bin/env python # coding: utf-8 # In[1]: from sklearn.model_selection import train_test_split from sklearn.preprocessing import normalize from sklearn.linear_model import LinearRegression from sklearn.preprocessing import PolynomialFeatures import matplotlib.pyplot as plt import numpy as np import pandas as pd class overfitting: def __init__(self): pass def TrueTargetFunct(self): pass def AddNoiseTargetFunct(self): pass def plot(self, trueTarget, proposedTarget): pass def TrainTestSplit(self, X, y, degree, test_size = 0.20): """fit the data from exercise 4.2 using linear regression """ poly = PolynomialFeatures(degree) data = poly.fit_transform(X) data = pd.DataFrame(data, columns = poly.get_feature_names()) temp = poly.get_feature_names() # Remove Cross interactions [temp.remove(i) for i in poly.get_feature_names() if len(i.split())==2] data = data[temp] X_train, X_test, y_train, y_test = train_test_split(data, y, test_size=test_size, random_state=42) return X_train, X_test, y_train, y_test def removeDataPoints(self, data, size): """data -- a list of tuples E.g. [(x,y), (x,y), ...] """ return data.remove(np.random.Generator.choice(len(data)-1, replace=False, size = size)) def exerciseFourTwo(self, order, sigma, sampleSize): """Generate target function data with random noise using legendre polynomial PARAMS: order - order of polynomial sigma - noise sigma for yn data sampleSize - # of data points to generate """ # generate polynomical coefficient c = np.random.normal(0, 1, order).reshape(-1, 1) c = normalize(c, axis=0).flatten() # generate uniform input/feature vector x = np.random.uniform(-1, 1, sampleSize) # generate Yi's using legendre polynomial y = np.polynomial.legendre.legval(x, c = c) # add noise to label/target y = y + sigma*np.random.normal(0, 1, len(y)) return x.reshape(-1, 1), y.reshape(-1, 1) def fitExercisefourTwo(self, X, y): """fit the data from exercise 4.2 using linear regression """ # run Regression reg = LinearRegression().fit(X, y) return reg def predict(self, model, X, y): error = np.mean(np.power(model.predict(X) - y, 2)) return error def legendrePoly2(self, order, domain): terms = [1, 1 + domain] for i in range(2, order+1): terms.append(((2*i - 1)/i)*domain*terms[i-1] - ((i - 1)/i)*terms[i-2]) return sum(terms), terms # In[2]: Qf = range(1, 51) N = range(20, 125, 5) sigma = np.arange(0, 2.05, 0.05) # In[3]: v = overfitting() error = [] for leg in Qf: for n in N: for sig in sigma: # generate data X, y = v.exerciseFourTwo(order=leg, sigma=sig, sampleSize=n) # train test split X_train2, X_test2, y_train2, y_test2 = v.TrainTestSplit(X, y, 2) X_train10, X_test10, y_train10, y_test10 = v.TrainTestSplit(X, y, 10) # run two models model2, model10 = v.fitExercisefourTwo(X_train2, y_train2), v.fitExercisefourTwo(X_train10, y_train10) # get in-sample error errorTrainDeg2, errorTrainDeg10 = v.predict(model2, X_train2, y_train2), v.predict(model10, X_train10, y_train10) # get out-sample error errorTestDeg2, errorTestDeg10 = v.predict(model2, X_test2, y_test2), v.predict(model10, X_test10, y_test10) # errors dictionary error.append([errorTrainDeg2, errorTrainDeg10, errorTestDeg2, errorTestDeg10, leg, n, sig]) pd.DataFrame(error, columns=['g2Train','g10Train', 'g2Test','g10Test', 'degLegredre', 'size', 'sigma']).to_excel("overfittingSimulation.xlsx", index=False)
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 512, 29961, 29896, 5387, 13, 13, 13, 3166, 2071, 19668, 29889, 4299, 29918, 21731, 1053, 7945, 29918, 1688, 29918, 5451, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 4226, 675, 13, 3166, 2071, 19668, 29889, 10660, 29918, 4299, 1053, 22985, 4597, 23881, 13, 3166, 2071, 19668, 29889, 1457, 19170, 1053, 2043, 9222, 8263, 3698, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 5215, 11701, 408, 10518, 13, 13, 1990, 975, 29888, 5367, 29901, 13, 268, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1209, 13, 268, 13, 1678, 822, 5852, 8667, 29943, 18049, 29898, 1311, 1125, 13, 308, 13, 4706, 1209, 13, 268, 13, 1678, 822, 3462, 3782, 895, 8667, 29943, 18049, 29898, 1311, 1125, 13, 308, 13, 4706, 1209, 13, 1678, 822, 6492, 29898, 1311, 29892, 1565, 8667, 29892, 7972, 8667, 1125, 13, 4706, 1209, 13, 268, 13, 1678, 822, 28186, 3057, 18772, 29898, 1311, 29892, 1060, 29892, 343, 29892, 7426, 29892, 1243, 29918, 2311, 353, 29871, 29900, 29889, 29906, 29900, 1125, 13, 4706, 9995, 9202, 278, 848, 515, 15058, 29871, 29946, 29889, 29906, 773, 5608, 17855, 13, 4706, 9995, 13, 4706, 15680, 353, 2043, 9222, 8263, 3698, 29898, 12163, 929, 29897, 13, 13, 4706, 848, 353, 15680, 29889, 9202, 29918, 9067, 29898, 29990, 29897, 13, 308, 13, 4706, 848, 353, 10518, 29889, 17271, 29898, 1272, 29892, 4341, 353, 15680, 29889, 657, 29918, 14394, 29918, 7039, 3101, 13, 308, 13, 4706, 5694, 353, 15680, 29889, 657, 29918, 14394, 29918, 7039, 580, 13, 308, 13, 4706, 396, 15154, 11189, 22060, 13, 4706, 518, 7382, 29889, 5992, 29898, 29875, 29897, 363, 474, 297, 15680, 29889, 657, 29918, 14394, 29918, 7039, 580, 565, 7431, 29898, 29875, 29889, 5451, 3101, 1360, 29906, 29962, 13, 308, 13, 4706, 848, 353, 848, 29961, 7382, 29962, 13, 308, 13, 4706, 1060, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 14968, 29892, 343, 29918, 1688, 353, 7945, 29918, 1688, 29918, 5451, 29898, 1272, 29892, 343, 29892, 1243, 29918, 2311, 29922, 1688, 29918, 2311, 29892, 4036, 29918, 3859, 29922, 29946, 29906, 29897, 13, 308, 13, 4706, 736, 1060, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 14968, 29892, 343, 29918, 1688, 13, 268, 13, 268, 13, 1678, 822, 3349, 1469, 20325, 29898, 1311, 29892, 848, 29892, 2159, 1125, 13, 4706, 9995, 1272, 1192, 263, 1051, 310, 5291, 2701, 13, 965, 382, 29889, 29887, 29889, 17288, 29916, 29892, 29891, 511, 313, 29916, 29892, 29891, 511, 2023, 29962, 13, 4706, 9995, 13, 4706, 736, 848, 29889, 5992, 29898, 9302, 29889, 8172, 29889, 21575, 29889, 16957, 29898, 2435, 29898, 1272, 6817, 29896, 29892, 5191, 29922, 8824, 29892, 2159, 353, 2159, 876, 13, 268, 13, 1678, 822, 15058, 29943, 473, 13985, 29898, 1311, 29892, 1797, 29892, 269, 2934, 29892, 4559, 3505, 1125, 13, 4706, 9995, 5631, 403, 3646, 740, 848, 411, 4036, 11462, 773, 2814, 9030, 10159, 13, 965, 349, 1718, 29909, 4345, 29901, 13, 1669, 1797, 448, 1797, 310, 10159, 13, 1669, 269, 2934, 448, 11462, 269, 2934, 363, 343, 29876, 848, 13, 1669, 4559, 3505, 448, 396, 310, 848, 3291, 304, 5706, 13, 4706, 9995, 13, 4706, 396, 5706, 1248, 948, 290, 936, 10825, 13, 4706, 274, 353, 7442, 29889, 8172, 29889, 8945, 29898, 29900, 29892, 29871, 29896, 29892, 1797, 467, 690, 14443, 6278, 29896, 29892, 29871, 29896, 29897, 13, 4706, 274, 353, 4226, 675, 29898, 29883, 29892, 9685, 29922, 29900, 467, 1579, 8606, 580, 13, 308, 13, 4706, 396, 5706, 9090, 1881, 29914, 14394, 4608, 13, 4706, 921, 353, 7442, 29889, 8172, 29889, 29590, 6278, 29896, 29892, 29871, 29896, 29892, 4559, 3505, 29897, 13, 308, 13, 4706, 396, 5706, 612, 29875, 29915, 29879, 773, 2814, 9030, 10159, 13, 4706, 343, 353, 7442, 29889, 3733, 9222, 29889, 1397, 9030, 29889, 1397, 791, 29898, 29916, 29892, 274, 353, 274, 29897, 13, 308, 13, 4706, 396, 788, 11462, 304, 3858, 29914, 5182, 13, 4706, 343, 353, 343, 718, 269, 2934, 29930, 9302, 29889, 8172, 29889, 8945, 29898, 29900, 29892, 29871, 29896, 29892, 7431, 29898, 29891, 876, 13, 308, 13, 4706, 736, 921, 29889, 690, 14443, 6278, 29896, 29892, 29871, 29896, 511, 343, 29889, 690, 14443, 6278, 29896, 29892, 29871, 29896, 29897, 13, 268, 13, 1678, 822, 6216, 1252, 6269, 895, 17823, 13985, 29898, 1311, 29892, 1060, 29892, 343, 1125, 13, 4706, 9995, 9202, 278, 848, 515, 15058, 29871, 29946, 29889, 29906, 773, 5608, 17855, 13, 4706, 9995, 13, 4706, 396, 1065, 2169, 23881, 13, 4706, 1072, 353, 22985, 4597, 23881, 2141, 9202, 29898, 29990, 29892, 343, 29897, 13, 308, 13, 4706, 736, 1072, 13, 268, 13, 268, 13, 1678, 822, 8500, 29898, 1311, 29892, 1904, 29892, 1060, 29892, 343, 1125, 13, 308, 13, 4706, 1059, 353, 7442, 29889, 12676, 29898, 9302, 29889, 13519, 29898, 4299, 29889, 27711, 29898, 29990, 29897, 448, 343, 29892, 29871, 29906, 876, 13, 308, 13, 4706, 736, 1059, 13, 308, 13, 308, 13, 268, 13, 1678, 822, 2814, 9030, 7713, 29891, 29906, 29898, 1311, 29892, 1797, 29892, 5354, 1125, 13, 308, 13, 4706, 4958, 353, 518, 29896, 29892, 29871, 29896, 718, 5354, 29962, 13, 308, 13, 4706, 363, 474, 297, 3464, 29898, 29906, 29892, 1797, 29974, 29896, 1125, 13, 632, 13, 9651, 4958, 29889, 4397, 3552, 29898, 29906, 29930, 29875, 448, 29871, 29896, 6802, 29875, 11877, 7247, 29930, 357, 1516, 29961, 29875, 29899, 29896, 29962, 448, 5135, 29875, 448, 29871, 29896, 6802, 29875, 11877, 357, 1516, 29961, 29875, 29899, 29906, 2314, 13, 632, 13, 4706, 736, 2533, 29898, 357, 1516, 511, 4958, 13, 308, 13, 13, 13, 29937, 512, 29961, 29906, 5387, 13, 13, 13, 29984, 29888, 1678, 353, 3464, 29898, 29896, 29892, 29871, 29945, 29896, 29897, 13, 29940, 268, 353, 3464, 29898, 29906, 29900, 29892, 29871, 29896, 29906, 29945, 29892, 29871, 29945, 29897, 13, 3754, 353, 7442, 29889, 279, 927, 29898, 29900, 29892, 29871, 29906, 29889, 29900, 29945, 29892, 29871, 29900, 29889, 29900, 29945, 29897, 13, 13, 13, 29937, 512, 29961, 29941, 5387, 13, 13, 13, 29894, 539, 353, 975, 29888, 5367, 580, 13, 2704, 259, 353, 5159, 13, 13, 1454, 2814, 297, 660, 29888, 29901, 13, 1678, 363, 302, 297, 405, 29901, 13, 4706, 363, 4365, 297, 269, 2934, 29901, 13, 9651, 396, 5706, 848, 13, 9651, 1060, 29892, 343, 353, 325, 29889, 735, 6269, 895, 29943, 473, 13985, 29898, 2098, 29922, 1397, 29892, 269, 2934, 29922, 18816, 29892, 4559, 3505, 29922, 29876, 29897, 13, 13, 9651, 396, 7945, 1243, 6219, 13, 9651, 1060, 29918, 14968, 29906, 29892, 1060, 29918, 1688, 29906, 29892, 343, 29918, 14968, 29906, 29892, 343, 29918, 1688, 29906, 268, 353, 325, 29889, 5323, 262, 3057, 18772, 29898, 29990, 29892, 343, 29892, 29871, 29906, 29897, 13, 9651, 1060, 29918, 14968, 29896, 29900, 29892, 1060, 29918, 1688, 29896, 29900, 29892, 343, 29918, 14968, 29896, 29900, 29892, 343, 29918, 1688, 29896, 29900, 353, 325, 29889, 5323, 262, 3057, 18772, 29898, 29990, 29892, 343, 29892, 29871, 29896, 29900, 29897, 13, 632, 13, 9651, 396, 1065, 1023, 4733, 13, 9651, 1904, 29906, 29892, 29871, 1904, 29896, 29900, 353, 325, 29889, 9202, 1252, 6269, 895, 17823, 13985, 29898, 29990, 29918, 14968, 29906, 29892, 343, 29918, 14968, 29906, 511, 29871, 13, 462, 462, 418, 325, 29889, 9202, 1252, 6269, 895, 17823, 13985, 29898, 29990, 29918, 14968, 29896, 29900, 29892, 343, 29918, 14968, 29896, 29900, 29897, 13, 9651, 396, 679, 297, 29899, 11249, 1059, 13, 9651, 1059, 5323, 262, 29928, 387, 29906, 29892, 1059, 5323, 262, 29928, 387, 29896, 29900, 353, 325, 29889, 27711, 29898, 4299, 29906, 29892, 1060, 29918, 14968, 29906, 29892, 343, 29918, 14968, 29906, 511, 29871, 13, 462, 462, 418, 325, 29889, 27711, 29898, 4299, 29896, 29900, 29892, 1060, 29918, 14968, 29896, 29900, 29892, 343, 29918, 14968, 29896, 29900, 29897, 13, 9651, 396, 679, 714, 29899, 11249, 1059, 13, 9651, 1059, 3057, 29928, 387, 29906, 29892, 1059, 3057, 29928, 387, 29896, 29900, 353, 325, 29889, 27711, 29898, 4299, 29906, 29892, 1060, 29918, 1688, 29906, 29892, 343, 29918, 1688, 29906, 511, 29871, 13, 462, 462, 418, 325, 29889, 27711, 29898, 4299, 29896, 29900, 29892, 1060, 29918, 1688, 29896, 29900, 29892, 343, 29918, 1688, 29896, 29900, 29897, 13, 9651, 396, 4436, 8600, 13, 9651, 1059, 29889, 4397, 4197, 2704, 5323, 262, 29928, 387, 29906, 29892, 1059, 5323, 262, 29928, 387, 29896, 29900, 29892, 1059, 3057, 29928, 387, 29906, 29892, 29871, 13, 462, 3986, 1059, 3057, 29928, 387, 29896, 29900, 29892, 2814, 29892, 302, 29892, 4365, 2314, 13, 632, 13, 15926, 29889, 17271, 29898, 2704, 29892, 4341, 29922, 1839, 29887, 29906, 5323, 262, 3788, 29887, 29896, 29900, 5323, 262, 742, 525, 29887, 29906, 3057, 3788, 29887, 29896, 29900, 3057, 742, 29871, 13, 632, 525, 12163, 22988, 1127, 276, 742, 525, 2311, 742, 525, 3754, 2033, 467, 517, 29918, 24633, 703, 957, 29888, 5367, 8942, 2785, 29889, 20267, 29916, 613, 2380, 29922, 8824, 29897, 13, 13, 2 ]
setup.py
gsoft-inc/github-secret-finder
4
1615652
<gh_stars>1-10 from setuptools import setup, find_packages setup( name='github_secret_finder', version='2.0.0', description='Script to monitor commits from Github users and organizations for secrets.', url='https://github.com/gsoft-inc/github-secret-finder', author='<NAME>', author_email='<EMAIL>', license='Apache', packages=find_packages("src"), package_dir={"": "src"}, include_package_data=True, package_data={'github_secret_finder': ['data/*']}, install_requires=[ 'unidiff', 'requests', 'detect_secrets', 'sqlitedict' ], entry_points={ 'console_scripts': ['github-secret-finder = github_secret_finder.main:main'], }, )
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 3292, 29918, 19024, 29918, 2886, 261, 742, 13, 1678, 1873, 2433, 29906, 29889, 29900, 29889, 29900, 742, 13, 1678, 6139, 2433, 4081, 304, 11819, 25741, 515, 402, 2985, 4160, 322, 25700, 363, 22183, 1372, 29889, 742, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29887, 2695, 29899, 3742, 29914, 3292, 29899, 19024, 29899, 2886, 261, 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, 742, 13, 1678, 9741, 29922, 2886, 29918, 8318, 703, 4351, 4968, 13, 1678, 3577, 29918, 3972, 3790, 29908, 1115, 376, 4351, 10758, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 3577, 29918, 1272, 3790, 29915, 3292, 29918, 19024, 29918, 2886, 261, 2396, 6024, 1272, 5515, 2033, 1118, 13, 1678, 2601, 29918, 276, 339, 2658, 11759, 13, 4706, 525, 348, 333, 2593, 742, 13, 4706, 525, 24830, 742, 13, 4706, 525, 4801, 522, 29918, 344, 1037, 1372, 742, 13, 4706, 525, 2850, 1573, 919, 29915, 13, 1678, 21251, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 525, 11058, 29918, 16713, 2396, 6024, 3292, 29899, 19024, 29899, 2886, 261, 353, 18546, 29918, 19024, 29918, 2886, 261, 29889, 3396, 29901, 3396, 7464, 13, 1678, 2981, 13, 29897, 13, 2 ]
backend/boards/admin.py
LucasSantosGuedes/App-Gestao
142
108222
from django.contrib import admin from .models import Board, List, Item, Label, Comment, Attachment, Notification admin.site.register(Board) admin.site.register(List) admin.site.register(Item) admin.site.register(Label) admin.site.register(Comment) admin.site.register(Attachment) admin.site.register(Notification)
[ 1, 515, 9557, 29889, 21570, 1053, 4113, 13, 3166, 869, 9794, 1053, 12590, 29892, 2391, 29892, 10976, 29892, 15796, 29892, 461, 29892, 6212, 25117, 29892, 28578, 13, 13, 6406, 29889, 2746, 29889, 9573, 29898, 28397, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 1293, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 2001, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 4775, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 20001, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 4165, 25117, 29897, 13, 6406, 29889, 2746, 29889, 9573, 29898, 12958, 29897, 13, 2 ]
ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/spnego_kerberos_auth.py
zyclove/ambari
0
138588
<filename>ambari-metrics/ambari-metrics-host-monitoring/src/main/python/core/spnego_kerberos_auth.py #!/usr/bin/python2 ''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' import logging import httplib import os logger = logging.getLogger() try: import kerberos except ImportError: import krberr as kerberos logger.warn('import kerberos exception: %s' % str(ImportError)) pass class SPNEGOKerberosAuth: def __init__(self): self.krb_context = None def authenticate_handshake (self, connection, method, service_url, body, headers, kinit_cmd, klist_cmd): # kinit to ensure ticket valid self.execute_kinit(kinit_cmd, klist_cmd) try: # Authenticate the client request response = self.authenticate_client(connection, method, service_url, body, headers) # Authenticate the response from the server if response: self.authenticate_server(response) return response finally: # Clean the client context after the handshake self.clean_client_context() pass def execute_kinit(self, kinit_cmd, klist_cmd): exit_status = os.system(kinit_cmd) logger.debug("kinit exit_status: {0}".format(exit_status)) logger.debug(os.system(klist_cmd)) return exit_status def authenticate_client(self, connection, method, service_url, body, headers): service = "HTTP@%s" % connection.host.lower() logger.debug("connection: %s", connection) logger.debug("service: %s", service) auth_header = self.get_authorization_header(service) logger.debug("Authorization: %s" % auth_header) # Send 2nd HTTP request with authorization header headers['Authorization'] = auth_header try: connection.request(method, service_url, body, headers) response = connection.getresponse() except Exception, e: logger.warn('2nd HTTP request exception from server: %s' % str(e)) return None pass if response: logger.debug("2nd HTTP response from server: retcode = {0}, reason = {1}" .format(response.status, response.reason)) logger.debug(str(response.read())) logger.debug("response headers: {0}".format(response.getheaders())) return response def get_authorization_header(self, service): # Initialize the context object for client-side authentication with a service principal try: result, self.krb_context = kerberos.authGSSClientInit(service) if result == -1: logger.warn('authGSSClientInit result: {0}'.format(result)) return None except kerberos.GSSError, e: logger.warn('authGSSClientInit exception: %s' % str(e)) return None pass # Process the first client-side step with the context try: result = kerberos.authGSSClientStep(self.krb_context, "") if result == -1: logger.warn('authGSSClientStep result for authenticate client: {0}'.format(result)) return None except kerberos.GSSError, e: logger.warn('authGSSClientStep exception for authenticate client: %s' % str(e)) return None pass # Get the client response from the first client-side step try: negotiate_value = kerberos.authGSSClientResponse(self.krb_context) logger.debug("authGSSClientResponse response:{0}".format(negotiate_value)) except kerberos.GSSError, e: logger.warn('authGSSClientResponse exception: %s' % str(e)) return None pass # Build the authorization header return "Negotiate %s" % negotiate_value def authenticate_server(self, response): auth_header = response.getheader('www-authenticate', None) negotiate_value = self.get_negotiate_value(auth_header) if negotiate_value == None: logger.warn('www-authenticate header not found') # Process the client-side step with the context and the negotiate value from 2nd HTTP response try: result = kerberos.authGSSClientStep(self.krb_context, negotiate_value) if result == -1: logger.warn('authGSSClientStep result for authenticate server: {0}'.format(result)) except kerberos.GSSError, e: logger.warn('authGSSClientStep exception for authenticate server: %s' % str(e)) result = -1 pass return result def clean_client_context(self): # Destroy the context for client-side authentication try: result = kerberos.authGSSClientClean(self.krb_context) logger.debug("authGSSClientClean result:{0}".format(result)) except kerberos.GSSError, e: logger.warn('authGSSClientClean exception: %s' % str(e)) result = -1 pass return result def get_hadoop_auth_cookie(self, set_cookie_header): if set_cookie_header: for field in set_cookie_header.split(";"): if field.startswith('hadoop.auth='): return field else: return None return None def get_negotiate_value(self, auth_header): if auth_header: for field in auth_header.split(","): key, __, value = field.strip().partition(" ") if key.lower() == "negotiate": return value.strip() else: return None return None
[ 1, 529, 9507, 29958, 1117, 1306, 29899, 2527, 10817, 29914, 1117, 1306, 29899, 2527, 10817, 29899, 3069, 29899, 3712, 2105, 292, 29914, 4351, 29914, 3396, 29914, 4691, 29914, 3221, 29914, 1028, 10313, 29918, 3946, 495, 359, 29918, 5150, 29889, 2272, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 29906, 13, 13, 12008, 13, 29931, 293, 21144, 304, 278, 13380, 18540, 10606, 313, 3289, 29943, 29897, 1090, 697, 13, 272, 901, 17737, 3406, 19405, 8571, 4110, 29889, 29871, 2823, 278, 6058, 12107, 934, 13, 5721, 7541, 411, 445, 664, 363, 5684, 2472, 13, 1727, 20272, 3509, 1266, 27428, 29889, 29871, 450, 3339, 29943, 7794, 11259, 445, 934, 13, 517, 366, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 13, 29908, 29931, 293, 1947, 1496, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 13, 2541, 278, 19245, 29889, 29871, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 13, 1678, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 13, 2525, 2222, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 5721, 7541, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29956, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 13393, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 13400, 800, 1090, 278, 19245, 29889, 13, 12008, 13, 13, 5215, 12183, 13, 5215, 1732, 1982, 13, 5215, 2897, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 580, 13, 2202, 29901, 13, 29871, 1053, 13023, 495, 359, 13, 19499, 16032, 2392, 29901, 13, 29871, 1053, 12920, 495, 29878, 408, 13023, 495, 359, 13, 29871, 17927, 29889, 25442, 877, 5215, 13023, 495, 359, 3682, 29901, 1273, 29879, 29915, 1273, 851, 29898, 17518, 2392, 876, 13, 3364, 13, 13, 1990, 10937, 8186, 29954, 8949, 261, 495, 359, 6444, 29901, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 1583, 29889, 29895, 6050, 29918, 4703, 353, 6213, 13, 13, 29871, 822, 15585, 403, 29918, 3179, 845, 1296, 313, 1311, 29892, 3957, 29892, 1158, 29892, 2669, 29918, 2271, 29892, 3573, 29892, 9066, 29892, 413, 2344, 29918, 9006, 29892, 413, 1761, 29918, 9006, 1125, 13, 1678, 396, 413, 2344, 304, 9801, 23381, 2854, 13, 1678, 1583, 29889, 7978, 29918, 29895, 2344, 29898, 29895, 2344, 29918, 9006, 29892, 413, 1761, 29918, 9006, 29897, 13, 13, 1678, 1018, 29901, 13, 418, 396, 13189, 4173, 403, 278, 3132, 2009, 13, 418, 2933, 353, 1583, 29889, 27218, 403, 29918, 4645, 29898, 9965, 29892, 1158, 29892, 2669, 29918, 2271, 29892, 3573, 29892, 9066, 29897, 13, 13, 418, 396, 13189, 4173, 403, 278, 2933, 515, 278, 1923, 13, 418, 565, 2933, 29901, 13, 4706, 1583, 29889, 27218, 403, 29918, 2974, 29898, 5327, 29897, 13, 418, 736, 2933, 13, 1678, 7146, 29901, 13, 418, 396, 315, 14044, 278, 3132, 3030, 1156, 278, 1361, 845, 1296, 13, 418, 1583, 29889, 14941, 29918, 4645, 29918, 4703, 580, 13, 1678, 1209, 13, 13, 29871, 822, 6222, 29918, 29895, 2344, 29898, 1311, 29892, 413, 2344, 29918, 9006, 29892, 413, 1761, 29918, 9006, 1125, 13, 1678, 6876, 29918, 4882, 353, 2897, 29889, 5205, 29898, 29895, 2344, 29918, 9006, 29897, 13, 1678, 17927, 29889, 8382, 703, 29895, 2344, 6876, 29918, 4882, 29901, 426, 29900, 29913, 1642, 4830, 29898, 13322, 29918, 4882, 876, 13, 1678, 17927, 29889, 8382, 29898, 359, 29889, 5205, 29898, 29895, 1761, 29918, 9006, 876, 13, 1678, 736, 6876, 29918, 4882, 13, 13, 29871, 822, 15585, 403, 29918, 4645, 29898, 1311, 29892, 3957, 29892, 1158, 29892, 2669, 29918, 2271, 29892, 3573, 29892, 9066, 1125, 13, 1678, 2669, 353, 376, 10493, 29992, 29995, 29879, 29908, 1273, 3957, 29889, 3069, 29889, 13609, 580, 13, 1678, 17927, 29889, 8382, 703, 9965, 29901, 1273, 29879, 613, 3957, 29897, 13, 1678, 17927, 29889, 8382, 703, 5509, 29901, 1273, 29879, 613, 2669, 29897, 13, 13, 1678, 4817, 29918, 6672, 353, 1583, 29889, 657, 29918, 8921, 2133, 29918, 6672, 29898, 5509, 29897, 13, 1678, 17927, 29889, 8382, 703, 25471, 29901, 1273, 29879, 29908, 1273, 4817, 29918, 6672, 29897, 13, 13, 1678, 396, 15076, 29871, 29906, 299, 7331, 2009, 411, 28733, 4839, 13, 1678, 9066, 1839, 25471, 2033, 353, 4817, 29918, 6672, 13, 1678, 1018, 29901, 13, 418, 3957, 29889, 3827, 29898, 5696, 29892, 2669, 29918, 2271, 29892, 3573, 29892, 9066, 29897, 13, 418, 2933, 353, 3957, 29889, 657, 5327, 580, 13, 1678, 5174, 8960, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 29906, 299, 7331, 2009, 3682, 515, 1923, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 736, 6213, 13, 1678, 1209, 13, 1678, 565, 2933, 29901, 13, 418, 17927, 29889, 8382, 703, 29906, 299, 7331, 2933, 515, 1923, 29901, 3240, 401, 353, 426, 29900, 1118, 2769, 353, 426, 29896, 5038, 13, 462, 1678, 869, 4830, 29898, 5327, 29889, 4882, 29892, 2933, 29889, 23147, 876, 13, 418, 17927, 29889, 8382, 29898, 710, 29898, 5327, 29889, 949, 22130, 13, 418, 17927, 29889, 8382, 703, 5327, 9066, 29901, 426, 29900, 29913, 1642, 4830, 29898, 5327, 29889, 657, 13662, 22130, 13, 1678, 736, 2933, 13, 13, 29871, 822, 679, 29918, 8921, 2133, 29918, 6672, 29898, 1311, 29892, 2669, 1125, 13, 1678, 396, 25455, 278, 3030, 1203, 363, 3132, 29899, 2975, 10760, 411, 263, 2669, 5882, 13, 1678, 1018, 29901, 13, 418, 1121, 29892, 1583, 29889, 29895, 6050, 29918, 4703, 353, 13023, 495, 359, 29889, 5150, 29954, 1799, 4032, 6644, 29898, 5509, 29897, 13, 418, 565, 1121, 1275, 448, 29896, 29901, 13, 4706, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 6644, 1121, 29901, 426, 29900, 29913, 4286, 4830, 29898, 2914, 876, 13, 4706, 736, 6213, 13, 1678, 5174, 13023, 495, 359, 29889, 10749, 29173, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 6644, 3682, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 736, 6213, 13, 1678, 1209, 13, 13, 1678, 396, 10554, 278, 937, 3132, 29899, 2975, 4331, 411, 278, 3030, 13, 1678, 1018, 29901, 13, 418, 1121, 353, 13023, 495, 359, 29889, 5150, 29954, 1799, 4032, 14448, 29898, 1311, 29889, 29895, 6050, 29918, 4703, 29892, 20569, 13, 418, 565, 1121, 1275, 448, 29896, 29901, 13, 4706, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 14448, 1121, 363, 15585, 403, 3132, 29901, 426, 29900, 29913, 4286, 4830, 29898, 2914, 876, 13, 4706, 736, 6213, 13, 1678, 5174, 13023, 495, 359, 29889, 10749, 29173, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 14448, 3682, 363, 15585, 403, 3132, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 736, 6213, 13, 1678, 1209, 13, 13, 1678, 396, 3617, 278, 3132, 2933, 515, 278, 937, 3132, 29899, 2975, 4331, 13, 1678, 1018, 29901, 13, 418, 27214, 403, 29918, 1767, 353, 13023, 495, 359, 29889, 5150, 29954, 1799, 4032, 5103, 29898, 1311, 29889, 29895, 6050, 29918, 4703, 29897, 13, 418, 17927, 29889, 8382, 703, 5150, 29954, 1799, 4032, 5103, 2933, 26254, 29900, 29913, 1642, 4830, 29898, 10052, 15297, 403, 29918, 1767, 876, 13, 1678, 5174, 13023, 495, 359, 29889, 10749, 29173, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 5103, 3682, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 736, 6213, 13, 1678, 1209, 13, 13, 1678, 396, 8878, 278, 28733, 4839, 13, 1678, 736, 376, 29940, 387, 15297, 403, 1273, 29879, 29908, 1273, 27214, 403, 29918, 1767, 13, 13, 29871, 822, 15585, 403, 29918, 2974, 29898, 1311, 29892, 2933, 1125, 13, 1678, 4817, 29918, 6672, 353, 2933, 29889, 657, 6672, 877, 1636, 29899, 27218, 403, 742, 6213, 29897, 13, 1678, 27214, 403, 29918, 1767, 353, 1583, 29889, 657, 29918, 10052, 15297, 403, 29918, 1767, 29898, 5150, 29918, 6672, 29897, 13, 1678, 565, 27214, 403, 29918, 1767, 1275, 6213, 29901, 13, 418, 17927, 29889, 25442, 877, 1636, 29899, 27218, 403, 4839, 451, 1476, 1495, 13, 13, 1678, 396, 10554, 278, 3132, 29899, 2975, 4331, 411, 278, 3030, 322, 278, 27214, 403, 995, 515, 29871, 29906, 299, 7331, 2933, 13, 1678, 1018, 29901, 13, 418, 1121, 353, 13023, 495, 359, 29889, 5150, 29954, 1799, 4032, 14448, 29898, 1311, 29889, 29895, 6050, 29918, 4703, 29892, 27214, 403, 29918, 1767, 29897, 13, 418, 565, 1121, 1275, 448, 29896, 29901, 13, 4706, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 14448, 1121, 363, 15585, 403, 1923, 29901, 426, 29900, 29913, 4286, 4830, 29898, 2914, 876, 13, 1678, 5174, 13023, 495, 359, 29889, 10749, 29173, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 14448, 3682, 363, 15585, 403, 1923, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 1121, 353, 448, 29896, 13, 1678, 1209, 13, 1678, 736, 1121, 13, 13, 29871, 822, 5941, 29918, 4645, 29918, 4703, 29898, 1311, 1125, 13, 1678, 396, 15435, 4727, 278, 3030, 363, 3132, 29899, 2975, 10760, 13, 1678, 1018, 29901, 13, 418, 1121, 353, 13023, 495, 359, 29889, 5150, 29954, 1799, 4032, 29907, 14044, 29898, 1311, 29889, 29895, 6050, 29918, 4703, 29897, 13, 418, 17927, 29889, 8382, 703, 5150, 29954, 1799, 4032, 29907, 14044, 1121, 26254, 29900, 29913, 1642, 4830, 29898, 2914, 876, 13, 1678, 5174, 13023, 495, 359, 29889, 10749, 29173, 29892, 321, 29901, 13, 418, 17927, 29889, 25442, 877, 5150, 29954, 1799, 4032, 29907, 14044, 3682, 29901, 1273, 29879, 29915, 1273, 851, 29898, 29872, 876, 13, 418, 1121, 353, 448, 29896, 13, 1678, 1209, 13, 1678, 736, 1121, 13, 13, 29871, 822, 679, 29918, 22075, 29918, 5150, 29918, 21509, 29898, 1311, 29892, 731, 29918, 21509, 29918, 6672, 1125, 13, 1678, 565, 731, 29918, 21509, 29918, 6672, 29901, 13, 418, 363, 1746, 297, 731, 29918, 21509, 29918, 6672, 29889, 5451, 703, 15458, 1125, 13, 4706, 565, 1746, 29889, 27382, 2541, 877, 22075, 29889, 5150, 2433, 1125, 13, 3986, 736, 1746, 13, 418, 1683, 29901, 13, 4706, 736, 6213, 13, 1678, 736, 6213, 13, 13, 29871, 822, 679, 29918, 10052, 15297, 403, 29918, 1767, 29898, 1311, 29892, 4817, 29918, 6672, 1125, 13, 1678, 565, 4817, 29918, 6672, 29901, 13, 418, 363, 1746, 297, 4817, 29918, 6672, 29889, 5451, 29898, 3284, 1125, 13, 4706, 1820, 29892, 903, 3383, 995, 353, 1746, 29889, 17010, 2141, 16707, 703, 16521, 13, 4706, 565, 1820, 29889, 13609, 580, 1275, 376, 10052, 15297, 403, 1115, 13, 3986, 736, 995, 29889, 17010, 580, 13, 418, 1683, 29901, 13, 4706, 736, 6213, 13, 1678, 736, 6213, 13, 2 ]
src/os_detection/sequence_generation/sequence_generation.py
Deacllock/OSpy
0
130584
from scapy.all import * import time from os_detection.fingerprints import Result, FingerPrint from os_detection.sequence_generation.seq import get_seq from os_detection.sequence_generation.t1 import get_t1 SEQ_START = 22000 ACK_START = 44000 SPORT_START = 63000 TCP_PROBES_TIMES = [] # Send TCP probes with given parameters using scapy def send_tcp_probe(i, dst, dport, window, options): seq = SEQ_START + 10 * i ack = ACK_START + 10 * i sport = SPORT_START + i syn = IP(dst=dst) / TCP(sport=sport, dport=dport, flags=0x02, seq=seq, ack=ack, window=window, options=options) send(syn) # Send 6 TCP probes to Generate SEQ, OPS, WIN and TI tests Result. # Total time shall be 500ms so that we can reliably detect the common 2Hz # TCP timestamp sequences. def send_tcp_probes(dst, dport): timestamp = ('Timestamp', (0xFFFFFFFF, 0)) sack = ('SAckOK', '') eol = ('EOL', '') nop = ('NOP', '') t1 = (1, [('WScale', 10), nop, ('MSS', 1460), timestamp, sack]) t2 = (63, [('MSS', 1400), ('WScale', 0), sack, timestamp, eol]) t3 = (4, [timestamp, nop, nop, ('WScale', 5), nop, ('MSS', 640)]) t4 = (4, [sack, timestamp, ('WScale', 10), eol]) t5 = (16, [('MSS', 536), sack, timestamp, ('WScale', 10), eol]) t6 = (512, [('MSS', 265), sack, timestamp]) tcp_probes = [t1, t2, t3, t4, t5, t6] t0 = time.time() i = 0 while (i < len(tcp_probes)): if (time.time() - t0 >= 0.1 * i): send_tcp_probe(i, dst, dport, *tcp_probes[i]) TCP_PROBES_TIMES.append(time.time()) i += 1 # Computes OPS Result as explained by nmap.org. def get_ops(responses): category, params = 'OPS', {} opt2char = { 'EOL': 'L', 'NOP': 'N', 'MSS': 'M', 'Timestamp': 'T', 'SAckOK': 'S', 'WScale': 'W'} for i in range(len(responses)): p_name, p_val = ('O' + str(i + 1)), '' if responses[i] is not None: for opt in responses[i][TCP].options: p_val += opt2char[opt[0]] if (opt[0] == 'MSS' or opt[0] == 'WScale'): p_val += hex(opt[1])[2:].upper() if (opt[0] == 'Timestamp'): for ts_val in opt[1]: p_val += '0' if ts_val == 0 else '1' params[p_name] = p_val return Result(category, params) # Computes WIN Result as explained by nmap.org def get_win(responses): category, params = 'WIN', {} for i in range(len(responses)): current = 'W' + str(i + 1) if responses[i] is None: params[current] = '' else: params['W' + str(i + 1)] = hex(responses[i] [TCP].window)[2:].upper() return Result(category, params) # Given a TCP response list, computes SEQ, OPS, WIN and T1 Results. # Return a Result list. def parse_tcp_responses(tcp_responses, icmp_responses): results = [] #results.append(get_seq(tcp_responses, icmp_responses, TCP_PROBES_TIMES)) results.append(get_ops(tcp_responses)) results.append(get_win(tcp_responses)) results.append(get_t1(tcp_responses[0])) return results
[ 1, 515, 885, 27580, 29889, 497, 1053, 334, 13, 5215, 931, 13, 13, 3166, 2897, 29918, 29881, 2650, 428, 29889, 29888, 5621, 2158, 29879, 1053, 7867, 29892, 383, 5621, 11816, 13, 3166, 2897, 29918, 29881, 2650, 428, 29889, 16506, 29918, 4738, 362, 29889, 11762, 1053, 679, 29918, 11762, 13, 3166, 2897, 29918, 29881, 2650, 428, 29889, 16506, 29918, 4738, 362, 29889, 29873, 29896, 1053, 679, 29918, 29873, 29896, 13, 13, 1660, 29984, 29918, 25826, 353, 29871, 29906, 29906, 29900, 29900, 29900, 13, 11375, 29918, 25826, 353, 29871, 29946, 29946, 29900, 29900, 29900, 13, 5550, 8476, 29918, 25826, 353, 29871, 29953, 29941, 29900, 29900, 29900, 13, 13, 29911, 6271, 29918, 8618, 29933, 2890, 29918, 15307, 29903, 353, 5159, 13, 13, 29937, 29871, 15076, 19374, 2070, 267, 411, 2183, 4128, 773, 885, 27580, 13, 13, 13, 1753, 3638, 29918, 23981, 29918, 771, 915, 29898, 29875, 29892, 29743, 29892, 270, 637, 29892, 3474, 29892, 3987, 1125, 13, 1678, 19359, 353, 3725, 29984, 29918, 25826, 718, 29871, 29896, 29900, 334, 474, 13, 1678, 263, 384, 353, 319, 7077, 29918, 25826, 718, 29871, 29896, 29900, 334, 474, 13, 1678, 7980, 353, 10937, 8476, 29918, 25826, 718, 474, 13, 13, 1678, 5222, 353, 5641, 29898, 22992, 29922, 22992, 29897, 847, 19374, 29898, 29879, 637, 29922, 29879, 637, 29892, 270, 637, 29922, 29881, 637, 29892, 13449, 29922, 29900, 29916, 29900, 29906, 29892, 19359, 29922, 11762, 29892, 13, 462, 9651, 263, 384, 29922, 547, 29892, 3474, 29922, 7165, 29892, 3987, 29922, 6768, 29897, 13, 13, 1678, 3638, 29898, 19274, 29897, 13, 13, 29937, 15076, 29871, 29953, 19374, 2070, 267, 304, 3251, 403, 3725, 29984, 29892, 6418, 29903, 29892, 399, 1177, 322, 323, 29902, 6987, 7867, 29889, 13, 29937, 14990, 931, 4091, 367, 29871, 29945, 29900, 29900, 1516, 577, 393, 591, 508, 12536, 2197, 6459, 278, 3619, 29871, 29906, 12661, 13, 29937, 19374, 14334, 15602, 29889, 13, 13, 13, 1753, 3638, 29918, 23981, 29918, 771, 5707, 29898, 22992, 29892, 270, 637, 1125, 13, 1678, 14334, 353, 6702, 27939, 742, 313, 29900, 29916, 22098, 22098, 29892, 29871, 29900, 876, 13, 1678, 269, 547, 353, 6702, 8132, 384, 8949, 742, 27255, 13, 1678, 321, 324, 353, 6702, 29923, 5607, 742, 27255, 13, 1678, 302, 459, 353, 6702, 29940, 4590, 742, 27255, 13, 13, 1678, 260, 29896, 353, 313, 29896, 29892, 518, 877, 29956, 17185, 742, 29871, 29896, 29900, 511, 302, 459, 29892, 6702, 29924, 1799, 742, 29871, 29896, 29946, 29953, 29900, 511, 14334, 29892, 269, 547, 2314, 13, 1678, 260, 29906, 353, 313, 29953, 29941, 29892, 518, 877, 29924, 1799, 742, 29871, 29896, 29946, 29900, 29900, 511, 6702, 29956, 17185, 742, 29871, 29900, 511, 269, 547, 29892, 14334, 29892, 321, 324, 2314, 13, 1678, 260, 29941, 353, 313, 29946, 29892, 518, 16394, 29892, 302, 459, 29892, 302, 459, 29892, 6702, 29956, 17185, 742, 29871, 29945, 511, 302, 459, 29892, 6702, 29924, 1799, 742, 29871, 29953, 29946, 29900, 29897, 2314, 13, 1678, 260, 29946, 353, 313, 29946, 29892, 518, 29879, 547, 29892, 14334, 29892, 6702, 29956, 17185, 742, 29871, 29896, 29900, 511, 321, 324, 2314, 13, 1678, 260, 29945, 353, 313, 29896, 29953, 29892, 518, 877, 29924, 1799, 742, 29871, 29945, 29941, 29953, 511, 269, 547, 29892, 14334, 29892, 6702, 29956, 17185, 742, 29871, 29896, 29900, 511, 321, 324, 2314, 13, 1678, 260, 29953, 353, 313, 29945, 29896, 29906, 29892, 518, 877, 29924, 1799, 742, 29871, 29906, 29953, 29945, 511, 269, 547, 29892, 14334, 2314, 13, 13, 1678, 22729, 29918, 771, 5707, 353, 518, 29873, 29896, 29892, 260, 29906, 29892, 260, 29941, 29892, 260, 29946, 29892, 260, 29945, 29892, 260, 29953, 29962, 13, 1678, 260, 29900, 353, 931, 29889, 2230, 580, 13, 1678, 474, 353, 29871, 29900, 13, 13, 1678, 1550, 313, 29875, 529, 7431, 29898, 23981, 29918, 771, 5707, 22164, 13, 4706, 565, 313, 2230, 29889, 2230, 580, 448, 260, 29900, 6736, 29871, 29900, 29889, 29896, 334, 474, 1125, 13, 9651, 3638, 29918, 23981, 29918, 771, 915, 29898, 29875, 29892, 29743, 29892, 270, 637, 29892, 334, 23981, 29918, 771, 5707, 29961, 29875, 2314, 13, 9651, 19374, 29918, 8618, 29933, 2890, 29918, 15307, 29903, 29889, 4397, 29898, 2230, 29889, 2230, 3101, 13, 9651, 474, 4619, 29871, 29896, 13, 13, 29937, 11796, 267, 6418, 29903, 7867, 408, 10824, 491, 302, 1958, 29889, 990, 29889, 13, 13, 13, 1753, 679, 29918, 3554, 29898, 26679, 267, 1125, 13, 1678, 7663, 29892, 8636, 353, 525, 4590, 29903, 742, 6571, 13, 13, 1678, 3523, 29906, 3090, 353, 426, 13, 4706, 525, 29923, 5607, 2396, 525, 29931, 742, 13, 4706, 525, 29940, 4590, 2396, 525, 29940, 742, 13, 4706, 525, 29924, 1799, 2396, 525, 29924, 742, 13, 4706, 525, 27939, 2396, 525, 29911, 742, 13, 4706, 525, 8132, 384, 8949, 2396, 525, 29903, 742, 13, 4706, 525, 29956, 17185, 2396, 525, 29956, 10827, 13, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 26679, 267, 22164, 13, 4706, 282, 29918, 978, 29892, 282, 29918, 791, 353, 6702, 29949, 29915, 718, 851, 29898, 29875, 718, 29871, 29896, 8243, 6629, 13, 13, 4706, 565, 20890, 29961, 29875, 29962, 338, 451, 6213, 29901, 13, 9651, 363, 3523, 297, 20890, 29961, 29875, 3816, 29911, 6271, 1822, 6768, 29901, 13, 18884, 282, 29918, 791, 4619, 3523, 29906, 3090, 29961, 3670, 29961, 29900, 5262, 13, 18884, 565, 313, 3670, 29961, 29900, 29962, 1275, 525, 29924, 1799, 29915, 470, 3523, 29961, 29900, 29962, 1275, 525, 29956, 17185, 29374, 13, 462, 1678, 282, 29918, 791, 4619, 15090, 29898, 3670, 29961, 29896, 2314, 29961, 29906, 29901, 1822, 21064, 580, 13, 13, 18884, 565, 313, 3670, 29961, 29900, 29962, 1275, 525, 27939, 29374, 13, 462, 1678, 363, 18696, 29918, 791, 297, 3523, 29961, 29896, 5387, 13, 462, 4706, 282, 29918, 791, 4619, 525, 29900, 29915, 565, 18696, 29918, 791, 1275, 29871, 29900, 1683, 525, 29896, 29915, 13, 13, 4706, 8636, 29961, 29886, 29918, 978, 29962, 353, 282, 29918, 791, 13, 13, 1678, 736, 7867, 29898, 7320, 29892, 8636, 29897, 13, 13, 13, 29937, 11796, 267, 399, 1177, 7867, 408, 10824, 491, 302, 1958, 29889, 990, 13, 1753, 679, 29918, 5080, 29898, 26679, 267, 1125, 13, 1678, 7663, 29892, 8636, 353, 525, 25152, 742, 6571, 13, 1678, 363, 474, 297, 3464, 29898, 2435, 29898, 26679, 267, 22164, 13, 4706, 1857, 353, 525, 29956, 29915, 718, 851, 29898, 29875, 718, 29871, 29896, 29897, 13, 4706, 565, 20890, 29961, 29875, 29962, 338, 6213, 29901, 13, 9651, 8636, 29961, 3784, 29962, 353, 6629, 13, 4706, 1683, 29901, 13, 9651, 8636, 1839, 29956, 29915, 718, 851, 29898, 29875, 718, 29871, 29896, 4638, 353, 15090, 29898, 26679, 267, 29961, 29875, 29962, 13, 462, 462, 965, 518, 29911, 6271, 1822, 7165, 9601, 29906, 29901, 1822, 21064, 580, 13, 13, 1678, 736, 7867, 29898, 7320, 29892, 8636, 29897, 13, 13, 29937, 11221, 263, 19374, 2933, 1051, 29892, 2912, 267, 3725, 29984, 29892, 6418, 29903, 29892, 399, 1177, 322, 323, 29896, 17212, 29889, 13, 29937, 7106, 263, 7867, 1051, 29889, 13, 13, 13, 1753, 6088, 29918, 23981, 29918, 26679, 267, 29898, 23981, 29918, 26679, 267, 29892, 16077, 1526, 29918, 26679, 267, 1125, 13, 1678, 2582, 353, 5159, 13, 13, 1678, 396, 9902, 29889, 4397, 29898, 657, 29918, 11762, 29898, 23981, 29918, 26679, 267, 29892, 16077, 1526, 29918, 26679, 267, 29892, 19374, 29918, 8618, 29933, 2890, 29918, 15307, 29903, 876, 13, 1678, 2582, 29889, 4397, 29898, 657, 29918, 3554, 29898, 23981, 29918, 26679, 267, 876, 13, 1678, 2582, 29889, 4397, 29898, 657, 29918, 5080, 29898, 23981, 29918, 26679, 267, 876, 13, 1678, 2582, 29889, 4397, 29898, 657, 29918, 29873, 29896, 29898, 23981, 29918, 26679, 267, 29961, 29900, 12622, 13, 13, 1678, 736, 2582, 13, 2 ]
framework/Decorators/Parallelization.py
rinelson456/raven
1
74557
<filename>framework/Decorators/Parallelization.py # Copyright 2017 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # 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. """ Created on March 29, 2020 @author: alfoa """ #Internal Modules--------------------------------------------------------------- from utils import importerUtils as im from utils.utils import Object #Internal Modules End----------------------------------------------------------- #External Modules--------------------------------------------------------------- # for internal parallel ## TODO: REMOVE WHEN RAY AVAILABLE FOR WINDOWOS _remote = None if im.isLibAvail("ray"): from ray import remote as _remote # end internal parallel module #External Modules End----------------------------------------------------------- class Parallel(object): """ RAVEN parallel decorator It is used to mask ray parallel remote decorator and to allow for direct call of the underlying function (via _function attribute) i.e. : - if ray is available and needs to be used, the decorated function (or class) will need to be called as following: functionName.remote(*args, **kwargs) - if ray is available and direct call to the function is needed, the original function (or class) will need to be called as following: functionName._function(*args, **kwargs) - if ray is not available, the original function (or class) will need to be called as following: functionName(*args, **kwargs) """ def __init__(self): """ This is the constructor of the decorator for parallel execution @ In, None (it uses the _remote global variable) @ Out, None """ self.decorator = _remote def __call__(self, func): """ This method mimic the "decorator" method @ In, func, FunctionType or Class, the function or class to decorate @ Out, decorated, FunctionType, or Class, the decorated function or class """ if self.decorator is None: # Return the function decorated with a wrapper # this is basically not decarate but we keep the same # approach for accessing to the original underlying function # in case of multi-threading decorated = Object() else: # decorate the function decorated = self.decorator(func) decorated.__dict__['original_function'] = func return decorated
[ 1, 529, 9507, 29958, 4468, 29914, 6185, 272, 4097, 29914, 2177, 6553, 2133, 29889, 2272, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29955, 14077, 1808, 24836, 29855, 29892, 365, 12182, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 376, 29931, 293, 1947, 1496, 13, 29937, 366, 1122, 451, 671, 445, 934, 5174, 297, 752, 13036, 411, 278, 19245, 29889, 13, 29937, 887, 1122, 4017, 263, 3509, 310, 278, 19245, 472, 13, 29937, 13, 29937, 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, 29871, 6760, 630, 373, 4779, 29871, 29906, 29929, 29892, 29871, 29906, 29900, 29906, 29900, 13, 13, 29871, 732, 8921, 29901, 394, 1181, 29874, 13, 15945, 29908, 13, 29937, 16491, 3382, 2540, 2683, 2683, 2683, 9072, 5634, 13, 3166, 3667, 29879, 1053, 527, 18505, 12177, 408, 527, 13, 3166, 3667, 29879, 29889, 13239, 1053, 4669, 13, 29937, 16491, 3382, 2540, 2796, 2683, 2683, 2683, 1378, 5634, 13, 13, 29937, 25865, 3382, 2540, 2683, 2683, 2683, 9072, 5634, 13, 29937, 363, 7463, 8943, 13, 2277, 14402, 29901, 5195, 6720, 12064, 17980, 18865, 29979, 16884, 29909, 6227, 6181, 15842, 399, 1177, 3970, 29956, 3267, 13, 29918, 16674, 353, 6213, 13, 361, 527, 29889, 275, 14868, 12810, 737, 703, 764, 29908, 1125, 13, 29871, 515, 15570, 1053, 7592, 408, 903, 16674, 13, 29937, 1095, 7463, 8943, 3883, 13, 29937, 25865, 3382, 2540, 2796, 2683, 2683, 2683, 1378, 5634, 13, 13, 1990, 1459, 6553, 29898, 3318, 1125, 13, 29871, 9995, 13, 1678, 390, 7520, 1430, 8943, 10200, 1061, 13, 1678, 739, 338, 1304, 304, 11105, 15570, 8943, 7592, 13, 1678, 10200, 1061, 322, 304, 2758, 363, 1513, 1246, 310, 13, 1678, 278, 14407, 740, 313, 6071, 903, 2220, 5352, 29897, 13, 1678, 474, 29889, 29872, 29889, 584, 13, 1678, 448, 565, 15570, 338, 3625, 322, 4225, 304, 367, 1304, 29892, 13, 418, 278, 10200, 630, 740, 313, 272, 770, 29897, 674, 817, 304, 367, 2000, 408, 1494, 29901, 13, 418, 740, 1170, 29889, 16674, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 448, 565, 15570, 338, 3625, 322, 1513, 1246, 304, 278, 740, 338, 4312, 29892, 13, 418, 278, 2441, 740, 313, 272, 770, 29897, 674, 817, 304, 367, 2000, 408, 1494, 29901, 13, 418, 740, 1170, 3032, 2220, 10456, 5085, 29892, 3579, 19290, 29897, 13, 1678, 448, 565, 15570, 338, 451, 3625, 29892, 13, 418, 278, 2441, 740, 313, 272, 770, 29897, 674, 817, 304, 367, 2000, 408, 1494, 29901, 13, 418, 740, 1170, 10456, 5085, 29892, 3579, 19290, 29897, 13, 29871, 9995, 13, 29871, 822, 4770, 2344, 12035, 1311, 1125, 13, 1678, 9995, 13, 418, 910, 338, 278, 5823, 310, 278, 10200, 1061, 363, 8943, 8225, 13, 418, 732, 512, 29892, 6213, 313, 277, 3913, 278, 903, 16674, 5534, 2286, 29897, 13, 418, 732, 4451, 29892, 6213, 13, 1678, 9995, 13, 1678, 1583, 29889, 19557, 1061, 353, 903, 16674, 13, 13, 29871, 822, 4770, 4804, 12035, 1311, 29892, 3653, 1125, 13, 1678, 9995, 13, 418, 910, 1158, 286, 326, 293, 278, 376, 19557, 1061, 29908, 1158, 13, 418, 732, 512, 29892, 3653, 29892, 6680, 1542, 470, 4134, 29892, 278, 740, 470, 770, 304, 10200, 403, 13, 418, 732, 4451, 29892, 10200, 630, 29892, 6680, 1542, 29892, 470, 4134, 29892, 278, 10200, 630, 740, 470, 770, 13, 1678, 9995, 13, 1678, 565, 1583, 29889, 19557, 1061, 338, 6213, 29901, 13, 418, 396, 7106, 278, 740, 10200, 630, 411, 263, 14476, 13, 418, 396, 445, 338, 8830, 451, 1602, 279, 403, 541, 591, 3013, 278, 1021, 13, 418, 396, 2948, 363, 17378, 304, 278, 2441, 14407, 740, 13, 418, 396, 297, 1206, 310, 2473, 29899, 7097, 292, 13, 418, 10200, 630, 353, 4669, 580, 13, 1678, 1683, 29901, 13, 418, 396, 10200, 403, 278, 740, 13, 418, 10200, 630, 353, 1583, 29889, 19557, 1061, 29898, 9891, 29897, 13, 1678, 10200, 630, 17255, 8977, 1649, 1839, 13492, 29918, 2220, 2033, 353, 3653, 13, 1678, 736, 10200, 630, 13, 13, 2 ]
tests/test_parser_identifier.py
mvisat/kopyt
2
68913
<reponame>mvisat/kopyt import unittest from kopyt import node from . import TestParserBase class TestParserSimpleIdentifier(TestParserBase): def do_test(self, code: str) -> node.SimpleIdentifier: return super().do_test("parse_simple_identifier", code, node.SimpleIdentifier) def test_parser_simple_identifier(self): code = "a" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_simple_identifier_backtick(self): code = "`~!@#$`" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_simple_identifier_underscore(self): code = "_a_b_c" result = self.do_test(code) self.assertEqual(code, result.value) class TestParserIdentifier(TestParserBase): def do_test(self, code: str, test_str: bool = True) -> node.Identifier: return super().do_test("parse_identifier", code, node.Identifier, test_str=test_str) def test_parser_identifier(self): code = "a" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_identifier_multi(self): code = "a.b.c" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_identifier_backtick(self): code = "`~!@#$`._a_b" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_identifier_complex(self): code = "_a_b_c.`~!@#$`.a" result = self.do_test(code) self.assertEqual(code, result.value) def test_parser_identifier_newlines(self): from re import compile ws = compile(r"\s+") codes = [ "a\n.b", "a\r\n.b\n.c", "a\n.`b`", "`~!@#$`\r .a_b", ] for code in codes: with self.subTest(code=code): result = self.do_test(code, False) expected = ws.sub("", code) self.assertEqual(expected, result.value) if __name__ == "__main__": unittest.main()
[ 1, 529, 276, 1112, 420, 29958, 29885, 1730, 271, 29914, 29895, 2270, 29873, 13, 5215, 443, 27958, 13, 13, 3166, 413, 2270, 29873, 1053, 2943, 13, 3166, 869, 1053, 4321, 11726, 5160, 13, 13, 13, 1990, 4321, 11726, 15427, 12889, 29898, 3057, 11726, 5160, 1125, 13, 1678, 822, 437, 29918, 1688, 29898, 1311, 29892, 775, 29901, 851, 29897, 1599, 2943, 29889, 15427, 12889, 29901, 13, 4706, 736, 2428, 2141, 1867, 29918, 1688, 703, 5510, 29918, 12857, 29918, 25378, 613, 775, 29892, 13, 462, 1669, 2943, 29889, 15427, 12889, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 12857, 29918, 25378, 29898, 1311, 1125, 13, 4706, 775, 353, 376, 29874, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 12857, 29918, 25378, 29918, 1627, 24667, 29898, 1311, 1125, 13, 4706, 775, 353, 29724, 30022, 29991, 29992, 29937, 29938, 29952, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 12857, 29918, 25378, 29918, 870, 414, 3221, 29898, 1311, 1125, 13, 4706, 775, 353, 11119, 29874, 29918, 29890, 29918, 29883, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 13, 1990, 4321, 11726, 12889, 29898, 3057, 11726, 5160, 1125, 13, 1678, 822, 437, 29918, 1688, 29898, 1311, 29892, 775, 29901, 851, 29892, 1243, 29918, 710, 29901, 6120, 353, 5852, 29897, 1599, 2943, 29889, 12889, 29901, 13, 4706, 736, 2428, 2141, 1867, 29918, 1688, 703, 5510, 29918, 25378, 613, 13, 462, 1669, 775, 29892, 13, 462, 1669, 2943, 29889, 12889, 29892, 13, 462, 1669, 1243, 29918, 710, 29922, 1688, 29918, 710, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 25378, 29898, 1311, 1125, 13, 4706, 775, 353, 376, 29874, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 25378, 29918, 9910, 29898, 1311, 1125, 13, 4706, 775, 353, 376, 29874, 29889, 29890, 29889, 29883, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 25378, 29918, 1627, 24667, 29898, 1311, 1125, 13, 4706, 775, 353, 29724, 30022, 29991, 29992, 29937, 29938, 1412, 29918, 29874, 29918, 29890, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 25378, 29918, 19676, 29898, 1311, 1125, 13, 4706, 775, 353, 11119, 29874, 29918, 29890, 29918, 29883, 17580, 30022, 29991, 29992, 29937, 29938, 1412, 29874, 29908, 13, 4706, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 401, 29892, 1121, 29889, 1767, 29897, 13, 13, 1678, 822, 1243, 29918, 16680, 29918, 25378, 29918, 1482, 9012, 29898, 1311, 1125, 13, 4706, 515, 337, 1053, 6633, 13, 4706, 16904, 353, 6633, 29898, 29878, 26732, 29879, 29974, 1159, 13, 4706, 11561, 353, 518, 13, 9651, 376, 29874, 29905, 29876, 29889, 29890, 613, 13, 9651, 376, 29874, 29905, 29878, 29905, 29876, 29889, 29890, 29905, 29876, 29889, 29883, 613, 13, 9651, 376, 29874, 29905, 29876, 17580, 29890, 29952, 613, 13, 9651, 29724, 30022, 29991, 29992, 29937, 29938, 29952, 29905, 29878, 29871, 869, 29874, 29918, 29890, 613, 13, 4706, 4514, 13, 4706, 363, 775, 297, 11561, 29901, 13, 9651, 411, 1583, 29889, 1491, 3057, 29898, 401, 29922, 401, 1125, 13, 18884, 1121, 353, 1583, 29889, 1867, 29918, 1688, 29898, 401, 29892, 7700, 29897, 13, 18884, 3806, 353, 16904, 29889, 1491, 703, 613, 775, 29897, 13, 18884, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 1121, 29889, 1767, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 443, 27958, 29889, 3396, 580, 13, 2 ]
setup.py
jsdnlb/Tangelo-challenge
0
27530
from setuptools import setup, find_packages # Building and Distributing Packages with Setuptools # Documentation here: https://setuptools.pypa.io/en/latest/setuptools.html setup(name='app', version='1.0', packages=find_packages())
[ 1, 515, 731, 21245, 8789, 1053, 6230, 29892, 1284, 29918, 8318, 13, 13, 29937, 17166, 322, 6652, 1091, 17068, 18744, 1179, 411, 3789, 21245, 8789, 13, 29937, 10854, 362, 1244, 29901, 2045, 597, 842, 21245, 8789, 29889, 29886, 1478, 29874, 29889, 601, 29914, 264, 29914, 12333, 29914, 842, 21245, 8789, 29889, 1420, 13, 13, 14669, 29898, 978, 2433, 932, 742, 1873, 2433, 29896, 29889, 29900, 742, 9741, 29922, 2886, 29918, 8318, 3101, 13, 2 ]
src/operator/transformer/align.py
k-harada/abstraction-and-reasoning-challenge
3
37801
<filename>src/operator/transformer/align.py<gh_stars>1-10 from heapq import heappop, heappush import numpy as np from src.data import Problem, Case, Matter from src.operator.mapper.map_connect import MapConnect def align_xy(x0_arr: np.array, y0_arr: np.array, x1_arr: np.array, y1_arr: np.array, c_arr: np.array) -> np.array: n = x0_arr.shape[0] # x heap_x = [] for i in range(n): heappush(heap_x, (x0_arr[i], x1_arr[i], i)) x1_temp = 0 x_list_all = [] x_list_now = [] while len(heap_x): x0, x1, i = heappop(heap_x) if x0 >= x1_temp: # new group x1_temp = x1 if len(x_list_now) > 0: x_list_all.append(x_list_now) x_list_now = [i] else: x1_temp = max(x1_temp, x1) x_list_now.append(i) x_list_all.append(x_list_now) # y heap_y = [] for i in range(n): heappush(heap_y, (y0_arr[i], y1_arr[i], i)) y1_temp = 0 y_list_all = [] y_list_now = [] while len(heap_y): y0, y1, i = heappop(heap_y) if y0 >= y1_temp: # new group y1_temp = y1 if len(y_list_now) > 0: y_list_all.append(y_list_now) y_list_now = [i] else: y1_temp = max(y1_temp, y1) y_list_now.append(i) y_list_all.append(y_list_now) # find size len_x_max = max([len(x) for x in x_list_all]) len_y_max = max([len(y) for y in y_list_all]) assert 0 < len_x_max * len_y_max <= n # eval 158 is a good example # try xl, yl = 0, 0 for xl in range(len_x_max, n + 1): if n % xl != 0: continue yl = n // xl assert yl >= len_y_max # you must break before yl < len_y_max # bind until xl xl_temp = 0 for x in x_list_all: xl_temp += len(x) if xl_temp == xl: xl_temp = 0 elif xl_temp > xl: break if xl_temp > 0: continue # success for x, bind until yl yl_temp = 0 for y in y_list_all: yl_temp += len(y) if yl_temp == yl: yl_temp = 0 elif yl_temp > yl: break if yl_temp > 0: continue # success for y break assert xl * yl > 0 # assign i, j # bind until xl i_arr = np.zeros(n, dtype=np.int) row_id = 0 xl_temp = 0 for x_list in x_list_all: xl_temp += len(x_list) for i in x_list: i_arr[i] = row_id if xl_temp == xl: xl_temp = 0 row_id += 1 # bind until yl j_arr = np.zeros(n, dtype=np.int) col_id = 0 yl_temp = 0 for y_list in y_list_all: yl_temp += len(y_list) for i in y_list: j_arr[i] = col_id if yl_temp == yl: yl_temp = 0 col_id += 1 res_arr = -1 * np.ones((yl, xl), dtype=np.int) for i in range(n): assert res_arr[i_arr[i], j_arr[i]] == -1 res_arr[i_arr[i], j_arr[i]] = c_arr[i] return res_arr class Align: def __init__(self): pass @classmethod def case(cls, c: Case) -> Case: m: Matter x0_arr = np.array([m.x0 for m in c.matter_list if not m.is_mesh]) y0_arr = np.array([m.y0 for m in c.matter_list if not m.is_mesh]) x1_arr = np.array([m.x0 + m.shape[0] for m in c.matter_list if not m.is_mesh]) y1_arr = np.array([m.y0 + m.shape[1] for m in c.matter_list if not m.is_mesh]) non_mesh_list = [m for m in c.matter_list if not m.is_mesh] c_arr = np.arange(len(non_mesh_list)) # same shape assert len(non_mesh_list) >= 2 assert len({m.shape[0] for m in non_mesh_list}) == 1 assert len({m.shape[1] for m in non_mesh_list}) == 1 matter_shape = non_mesh_list[0].shape res_arr = align_xy(x0_arr, y0_arr, x1_arr, y1_arr, c_arr) new_case: Case = c.copy() new_case.shape = res_arr.shape[0] * matter_shape[0], res_arr.shape[1] * matter_shape[1] new_case.matter_list = [] for i in range(res_arr.shape[0]): for j in range(res_arr.shape[1]): m = non_mesh_list[res_arr[i, j]] m_add = m.deepcopy() m_add.x0 = i * matter_shape[0] m_add.y0 = j * matter_shape[1] new_case.matter_list.append(m_add) return new_case @classmethod def problem(cls, p: Problem) -> Problem: q: Problem = p.copy() q.train_x_list = [cls.case(c) for c in p.train_x_list] q.test_x_list = [cls.case(c) for c in p.test_x_list] return q if __name__ == "__main__": x0_ = np.array([0, 0]) x1_ = np.array([1, 1]) y0_ = np.array([0, 2]) y1_ = np.array([1, 3]) c_ = np.array([4, 5]) res_arr_ = align_xy(x0_, y0_, x1_, y1_, c_) print(res_arr_) pp = Problem.load(158, "eval") qq = MapConnect.problem(pp, allow_diagonal=True) rr = Align.problem(qq) print(rr)
[ 1, 529, 9507, 29958, 4351, 29914, 6891, 29914, 9067, 261, 29914, 2520, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 16947, 29939, 1053, 540, 932, 459, 29892, 540, 932, 1878, 13, 5215, 12655, 408, 7442, 13, 3166, 4765, 29889, 1272, 1053, 11583, 29892, 11733, 29892, 341, 2620, 13, 3166, 4765, 29889, 6891, 29889, 655, 2496, 29889, 1958, 29918, 6915, 1053, 7315, 17918, 13, 13, 13, 1753, 7595, 29918, 3594, 29898, 29916, 29900, 29918, 2749, 29901, 7442, 29889, 2378, 29892, 343, 29900, 29918, 2749, 29901, 7442, 29889, 2378, 29892, 921, 29896, 29918, 2749, 29901, 7442, 29889, 2378, 29892, 343, 29896, 29918, 2749, 29901, 7442, 29889, 2378, 29892, 274, 29918, 2749, 29901, 7442, 29889, 2378, 29897, 1599, 7442, 29889, 2378, 29901, 13, 13, 1678, 302, 353, 921, 29900, 29918, 2749, 29889, 12181, 29961, 29900, 29962, 13, 13, 1678, 396, 921, 13, 1678, 16947, 29918, 29916, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 4706, 540, 932, 1878, 29898, 354, 481, 29918, 29916, 29892, 313, 29916, 29900, 29918, 2749, 29961, 29875, 1402, 921, 29896, 29918, 2749, 29961, 29875, 1402, 474, 876, 13, 13, 1678, 921, 29896, 29918, 7382, 353, 29871, 29900, 13, 1678, 921, 29918, 1761, 29918, 497, 353, 5159, 13, 1678, 921, 29918, 1761, 29918, 3707, 353, 5159, 13, 1678, 1550, 7431, 29898, 354, 481, 29918, 29916, 1125, 13, 4706, 921, 29900, 29892, 921, 29896, 29892, 474, 353, 540, 932, 459, 29898, 354, 481, 29918, 29916, 29897, 13, 4706, 565, 921, 29900, 6736, 921, 29896, 29918, 7382, 29901, 13, 9651, 396, 716, 2318, 13, 9651, 921, 29896, 29918, 7382, 353, 921, 29896, 13, 9651, 565, 7431, 29898, 29916, 29918, 1761, 29918, 3707, 29897, 1405, 29871, 29900, 29901, 13, 18884, 921, 29918, 1761, 29918, 497, 29889, 4397, 29898, 29916, 29918, 1761, 29918, 3707, 29897, 13, 9651, 921, 29918, 1761, 29918, 3707, 353, 518, 29875, 29962, 13, 4706, 1683, 29901, 13, 9651, 921, 29896, 29918, 7382, 353, 4236, 29898, 29916, 29896, 29918, 7382, 29892, 921, 29896, 29897, 13, 9651, 921, 29918, 1761, 29918, 3707, 29889, 4397, 29898, 29875, 29897, 13, 1678, 921, 29918, 1761, 29918, 497, 29889, 4397, 29898, 29916, 29918, 1761, 29918, 3707, 29897, 13, 13, 1678, 396, 343, 13, 1678, 16947, 29918, 29891, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 4706, 540, 932, 1878, 29898, 354, 481, 29918, 29891, 29892, 313, 29891, 29900, 29918, 2749, 29961, 29875, 1402, 343, 29896, 29918, 2749, 29961, 29875, 1402, 474, 876, 13, 13, 1678, 343, 29896, 29918, 7382, 353, 29871, 29900, 13, 1678, 343, 29918, 1761, 29918, 497, 353, 5159, 13, 1678, 343, 29918, 1761, 29918, 3707, 353, 5159, 13, 1678, 1550, 7431, 29898, 354, 481, 29918, 29891, 1125, 13, 4706, 343, 29900, 29892, 343, 29896, 29892, 474, 353, 540, 932, 459, 29898, 354, 481, 29918, 29891, 29897, 13, 4706, 565, 343, 29900, 6736, 343, 29896, 29918, 7382, 29901, 13, 9651, 396, 716, 2318, 13, 9651, 343, 29896, 29918, 7382, 353, 343, 29896, 13, 9651, 565, 7431, 29898, 29891, 29918, 1761, 29918, 3707, 29897, 1405, 29871, 29900, 29901, 13, 18884, 343, 29918, 1761, 29918, 497, 29889, 4397, 29898, 29891, 29918, 1761, 29918, 3707, 29897, 13, 9651, 343, 29918, 1761, 29918, 3707, 353, 518, 29875, 29962, 13, 4706, 1683, 29901, 13, 9651, 343, 29896, 29918, 7382, 353, 4236, 29898, 29891, 29896, 29918, 7382, 29892, 343, 29896, 29897, 13, 9651, 343, 29918, 1761, 29918, 3707, 29889, 4397, 29898, 29875, 29897, 13, 1678, 343, 29918, 1761, 29918, 497, 29889, 4397, 29898, 29891, 29918, 1761, 29918, 3707, 29897, 13, 13, 1678, 396, 1284, 2159, 13, 1678, 7431, 29918, 29916, 29918, 3317, 353, 4236, 4197, 2435, 29898, 29916, 29897, 363, 921, 297, 921, 29918, 1761, 29918, 497, 2314, 13, 1678, 7431, 29918, 29891, 29918, 3317, 353, 4236, 4197, 2435, 29898, 29891, 29897, 363, 343, 297, 343, 29918, 1761, 29918, 497, 2314, 13, 13, 1678, 4974, 29871, 29900, 529, 7431, 29918, 29916, 29918, 3317, 334, 7431, 29918, 29891, 29918, 3317, 5277, 302, 13, 1678, 396, 19745, 29871, 29896, 29945, 29947, 338, 263, 1781, 1342, 13, 1678, 396, 1018, 13, 1678, 921, 29880, 29892, 343, 29880, 353, 29871, 29900, 29892, 29871, 29900, 13, 1678, 363, 921, 29880, 297, 3464, 29898, 2435, 29918, 29916, 29918, 3317, 29892, 302, 718, 29871, 29896, 1125, 13, 4706, 565, 302, 1273, 921, 29880, 2804, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 343, 29880, 353, 302, 849, 921, 29880, 13, 4706, 4974, 343, 29880, 6736, 7431, 29918, 29891, 29918, 3317, 29871, 396, 366, 1818, 2867, 1434, 343, 29880, 529, 7431, 29918, 29891, 29918, 3317, 13, 4706, 396, 7868, 2745, 921, 29880, 13, 4706, 921, 29880, 29918, 7382, 353, 29871, 29900, 13, 4706, 363, 921, 297, 921, 29918, 1761, 29918, 497, 29901, 13, 9651, 921, 29880, 29918, 7382, 4619, 7431, 29898, 29916, 29897, 13, 9651, 565, 921, 29880, 29918, 7382, 1275, 921, 29880, 29901, 13, 18884, 921, 29880, 29918, 7382, 353, 29871, 29900, 13, 9651, 25342, 921, 29880, 29918, 7382, 1405, 921, 29880, 29901, 13, 18884, 2867, 13, 4706, 565, 921, 29880, 29918, 7382, 1405, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 396, 2551, 363, 921, 29892, 7868, 2745, 343, 29880, 13, 4706, 343, 29880, 29918, 7382, 353, 29871, 29900, 13, 4706, 363, 343, 297, 343, 29918, 1761, 29918, 497, 29901, 13, 9651, 343, 29880, 29918, 7382, 4619, 7431, 29898, 29891, 29897, 13, 9651, 565, 343, 29880, 29918, 7382, 1275, 343, 29880, 29901, 13, 18884, 343, 29880, 29918, 7382, 353, 29871, 29900, 13, 9651, 25342, 343, 29880, 29918, 7382, 1405, 343, 29880, 29901, 13, 18884, 2867, 13, 4706, 565, 343, 29880, 29918, 7382, 1405, 29871, 29900, 29901, 13, 9651, 6773, 13, 4706, 396, 2551, 363, 343, 13, 4706, 2867, 13, 13, 1678, 4974, 921, 29880, 334, 343, 29880, 1405, 29871, 29900, 13, 1678, 396, 3566, 474, 29892, 432, 13, 1678, 396, 7868, 2745, 921, 29880, 13, 1678, 474, 29918, 2749, 353, 7442, 29889, 3298, 359, 29898, 29876, 29892, 26688, 29922, 9302, 29889, 524, 29897, 13, 1678, 1948, 29918, 333, 353, 29871, 29900, 13, 1678, 921, 29880, 29918, 7382, 353, 29871, 29900, 13, 1678, 363, 921, 29918, 1761, 297, 921, 29918, 1761, 29918, 497, 29901, 13, 4706, 921, 29880, 29918, 7382, 4619, 7431, 29898, 29916, 29918, 1761, 29897, 13, 4706, 363, 474, 297, 921, 29918, 1761, 29901, 13, 9651, 474, 29918, 2749, 29961, 29875, 29962, 353, 1948, 29918, 333, 13, 4706, 565, 921, 29880, 29918, 7382, 1275, 921, 29880, 29901, 13, 9651, 921, 29880, 29918, 7382, 353, 29871, 29900, 13, 9651, 1948, 29918, 333, 4619, 29871, 29896, 13, 13, 1678, 396, 7868, 2745, 343, 29880, 13, 1678, 432, 29918, 2749, 353, 7442, 29889, 3298, 359, 29898, 29876, 29892, 26688, 29922, 9302, 29889, 524, 29897, 13, 1678, 784, 29918, 333, 353, 29871, 29900, 13, 1678, 343, 29880, 29918, 7382, 353, 29871, 29900, 13, 1678, 363, 343, 29918, 1761, 297, 343, 29918, 1761, 29918, 497, 29901, 13, 4706, 343, 29880, 29918, 7382, 4619, 7431, 29898, 29891, 29918, 1761, 29897, 13, 4706, 363, 474, 297, 343, 29918, 1761, 29901, 13, 9651, 432, 29918, 2749, 29961, 29875, 29962, 353, 784, 29918, 333, 13, 4706, 565, 343, 29880, 29918, 7382, 1275, 343, 29880, 29901, 13, 9651, 343, 29880, 29918, 7382, 353, 29871, 29900, 13, 9651, 784, 29918, 333, 4619, 29871, 29896, 13, 13, 1678, 620, 29918, 2749, 353, 448, 29896, 334, 7442, 29889, 2873, 3552, 2904, 29892, 921, 29880, 511, 26688, 29922, 9302, 29889, 524, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29876, 1125, 13, 4706, 4974, 620, 29918, 2749, 29961, 29875, 29918, 2749, 29961, 29875, 1402, 432, 29918, 2749, 29961, 29875, 5262, 1275, 448, 29896, 13, 4706, 620, 29918, 2749, 29961, 29875, 29918, 2749, 29961, 29875, 1402, 432, 29918, 2749, 29961, 29875, 5262, 353, 274, 29918, 2749, 29961, 29875, 29962, 13, 13, 1678, 736, 620, 29918, 2749, 13, 13, 13, 1990, 838, 647, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1206, 29898, 25932, 29892, 274, 29901, 11733, 29897, 1599, 11733, 29901, 13, 4706, 286, 29901, 341, 2620, 13, 4706, 921, 29900, 29918, 2749, 353, 7442, 29889, 2378, 4197, 29885, 29889, 29916, 29900, 363, 286, 297, 274, 29889, 29885, 2620, 29918, 1761, 565, 451, 286, 29889, 275, 29918, 4467, 29882, 2314, 13, 4706, 343, 29900, 29918, 2749, 353, 7442, 29889, 2378, 4197, 29885, 29889, 29891, 29900, 363, 286, 297, 274, 29889, 29885, 2620, 29918, 1761, 565, 451, 286, 29889, 275, 29918, 4467, 29882, 2314, 13, 4706, 921, 29896, 29918, 2749, 353, 7442, 29889, 2378, 4197, 29885, 29889, 29916, 29900, 718, 286, 29889, 12181, 29961, 29900, 29962, 363, 286, 297, 274, 29889, 29885, 2620, 29918, 1761, 565, 451, 286, 29889, 275, 29918, 4467, 29882, 2314, 13, 4706, 343, 29896, 29918, 2749, 353, 7442, 29889, 2378, 4197, 29885, 29889, 29891, 29900, 718, 286, 29889, 12181, 29961, 29896, 29962, 363, 286, 297, 274, 29889, 29885, 2620, 29918, 1761, 565, 451, 286, 29889, 275, 29918, 4467, 29882, 2314, 13, 13, 4706, 1661, 29918, 4467, 29882, 29918, 1761, 353, 518, 29885, 363, 286, 297, 274, 29889, 29885, 2620, 29918, 1761, 565, 451, 286, 29889, 275, 29918, 4467, 29882, 29962, 13, 4706, 274, 29918, 2749, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 5464, 29918, 4467, 29882, 29918, 1761, 876, 13, 13, 4706, 396, 1021, 8267, 13, 4706, 4974, 7431, 29898, 5464, 29918, 4467, 29882, 29918, 1761, 29897, 6736, 29871, 29906, 13, 4706, 4974, 7431, 3319, 29885, 29889, 12181, 29961, 29900, 29962, 363, 286, 297, 1661, 29918, 4467, 29882, 29918, 1761, 1800, 1275, 29871, 29896, 13, 4706, 4974, 7431, 3319, 29885, 29889, 12181, 29961, 29896, 29962, 363, 286, 297, 1661, 29918, 4467, 29882, 29918, 1761, 1800, 1275, 29871, 29896, 13, 4706, 4383, 29918, 12181, 353, 1661, 29918, 4467, 29882, 29918, 1761, 29961, 29900, 1822, 12181, 13, 13, 4706, 620, 29918, 2749, 353, 7595, 29918, 3594, 29898, 29916, 29900, 29918, 2749, 29892, 343, 29900, 29918, 2749, 29892, 921, 29896, 29918, 2749, 29892, 343, 29896, 29918, 2749, 29892, 274, 29918, 2749, 29897, 13, 13, 4706, 716, 29918, 4878, 29901, 11733, 353, 274, 29889, 8552, 580, 13, 4706, 716, 29918, 4878, 29889, 12181, 353, 620, 29918, 2749, 29889, 12181, 29961, 29900, 29962, 334, 4383, 29918, 12181, 29961, 29900, 1402, 620, 29918, 2749, 29889, 12181, 29961, 29896, 29962, 334, 4383, 29918, 12181, 29961, 29896, 29962, 13, 4706, 716, 29918, 4878, 29889, 29885, 2620, 29918, 1761, 353, 5159, 13, 4706, 363, 474, 297, 3464, 29898, 690, 29918, 2749, 29889, 12181, 29961, 29900, 29962, 1125, 13, 9651, 363, 432, 297, 3464, 29898, 690, 29918, 2749, 29889, 12181, 29961, 29896, 29962, 1125, 13, 18884, 286, 353, 1661, 29918, 4467, 29882, 29918, 1761, 29961, 690, 29918, 2749, 29961, 29875, 29892, 432, 5262, 13, 18884, 286, 29918, 1202, 353, 286, 29889, 24535, 8552, 580, 13, 18884, 286, 29918, 1202, 29889, 29916, 29900, 353, 474, 334, 4383, 29918, 12181, 29961, 29900, 29962, 13, 18884, 286, 29918, 1202, 29889, 29891, 29900, 353, 432, 334, 4383, 29918, 12181, 29961, 29896, 29962, 13, 18884, 716, 29918, 4878, 29889, 29885, 2620, 29918, 1761, 29889, 4397, 29898, 29885, 29918, 1202, 29897, 13, 4706, 736, 716, 29918, 4878, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 1108, 29898, 25932, 29892, 282, 29901, 11583, 29897, 1599, 11583, 29901, 13, 4706, 3855, 29901, 11583, 353, 282, 29889, 8552, 580, 13, 4706, 3855, 29889, 14968, 29918, 29916, 29918, 1761, 353, 518, 25932, 29889, 4878, 29898, 29883, 29897, 363, 274, 297, 282, 29889, 14968, 29918, 29916, 29918, 1761, 29962, 13, 4706, 3855, 29889, 1688, 29918, 29916, 29918, 1761, 353, 518, 25932, 29889, 4878, 29898, 29883, 29897, 363, 274, 297, 282, 29889, 1688, 29918, 29916, 29918, 1761, 29962, 13, 4706, 736, 3855, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 921, 29900, 29918, 353, 7442, 29889, 2378, 4197, 29900, 29892, 29871, 29900, 2314, 13, 1678, 921, 29896, 29918, 353, 7442, 29889, 2378, 4197, 29896, 29892, 29871, 29896, 2314, 13, 1678, 343, 29900, 29918, 353, 7442, 29889, 2378, 4197, 29900, 29892, 29871, 29906, 2314, 13, 1678, 343, 29896, 29918, 353, 7442, 29889, 2378, 4197, 29896, 29892, 29871, 29941, 2314, 13, 1678, 274, 29918, 353, 7442, 29889, 2378, 4197, 29946, 29892, 29871, 29945, 2314, 13, 1678, 620, 29918, 2749, 29918, 353, 7595, 29918, 3594, 29898, 29916, 29900, 3383, 343, 29900, 3383, 921, 29896, 3383, 343, 29896, 3383, 274, 19925, 13, 1678, 1596, 29898, 690, 29918, 2749, 19925, 13, 1678, 6499, 353, 11583, 29889, 1359, 29898, 29896, 29945, 29947, 29892, 376, 14513, 1159, 13, 1678, 3855, 29939, 353, 7315, 17918, 29889, 17199, 29898, 407, 29892, 2758, 29918, 6051, 351, 7177, 29922, 5574, 29897, 13, 1678, 364, 29878, 353, 838, 647, 29889, 17199, 29898, 24349, 29897, 13, 1678, 1596, 29898, 21478, 29897, 13, 13, 2 ]
homeassistant/components/tradfri.py
automatemyhome/home-assistant-amh
1
199147
<reponame>automatemyhome/home-assistant-amh """ Support for Ikea Tradfri. For more details about this component, please refer to the documentation at https://home-assistant.io/components/ikea_tradfri/ """ import asyncio import logging from uuid import uuid4 import voluptuous as vol import homeassistant.helpers.config_validation as cv from homeassistant.helpers import discovery from homeassistant.const import CONF_HOST from homeassistant.components.discovery import SERVICE_IKEA_TRADFRI from homeassistant.util.json import load_json, save_json REQUIREMENTS = ['pytradfri==4.0.1', 'DTLSSocket==0.1.4', 'https://github.com/chrysn/aiocoap/archive/' '3286f48f0b949901c8b5c04c0719dc54ab63d431.zip' '#aiocoap==0.3'] DOMAIN = 'tradfri' GATEWAY_IDENTITY = 'homeassistant' CONFIG_FILE = '.tradfri_psk.conf' KEY_CONFIG = 'tradfri_configuring' KEY_GATEWAY = 'tradfri_gateway' KEY_API = 'tradfri_api' KEY_TRADFRI_GROUPS = 'tradfri_allow_tradfri_groups' CONF_ALLOW_TRADFRI_GROUPS = 'allow_tradfri_groups' DEFAULT_ALLOW_TRADFRI_GROUPS = True CONFIG_SCHEMA = vol.Schema({ DOMAIN: vol.Schema({ vol.Inclusive(CONF_HOST, 'gateway'): cv.string, vol.Optional(CONF_ALLOW_TRADFRI_GROUPS, default=DEFAULT_ALLOW_TRADFRI_GROUPS): cv.boolean, }) }, extra=vol.ALLOW_EXTRA) _LOGGER = logging.getLogger(__name__) def request_configuration(hass, config, host): """Request configuration steps from the user.""" configurator = hass.components.configurator hass.data.setdefault(KEY_CONFIG, {}) instance = hass.data[KEY_CONFIG].get(host) # Configuration already in progress if instance: return @asyncio.coroutine def configuration_callback(callback_data): """Handle the submitted configuration.""" try: from pytradfri.api.aiocoap_api import APIFactory from pytradfri import RequestError except ImportError: _LOGGER.exception("Looks like something isn't installed!") return identity = uuid4().hex security_code = callback_data.get('security_code') api_factory = APIFactory(host, psk_id=identity, loop=hass.loop) # Need To Fix: currently entering a wrong security code sends # pytradfri aiocoap API into an endless loop. # Should just raise a requestError or something. try: key = yield from api_factory.generate_psk(security_code) except RequestError: configurator.async_notify_errors(hass, instance, "Security Code not accepted.") return res = yield from _setup_gateway(hass, config, host, identity, key, DEFAULT_ALLOW_TRADFRI_GROUPS) if not res: configurator.async_notify_errors(hass, instance, "Unable to connect.") return def success(): """Set up was successful.""" conf = load_json(hass.config.path(CONFIG_FILE)) conf[host] = {'identity': identity, 'key': key} save_json(hass.config.path(CONFIG_FILE), conf) configurator.request_done(instance) hass.async_add_job(success) instance = configurator.request_config( "IKEA Trådfri", configuration_callback, description='Please enter the security code written at the bottom of ' 'your IKEA Trådfri Gateway.', submit_caption="Confirm", fields=[{'id': 'security_code', 'name': 'Security Code', 'type': 'password'}] ) @asyncio.coroutine def async_setup(hass, config): """Set up the Tradfri component.""" conf = config.get(DOMAIN, {}) host = conf.get(CONF_HOST) allow_tradfri_groups = conf.get(CONF_ALLOW_TRADFRI_GROUPS) known_hosts = yield from hass.async_add_job(load_json, hass.config.path(CONFIG_FILE)) @asyncio.coroutine def gateway_discovered(service, info, allow_tradfri_groups=DEFAULT_ALLOW_TRADFRI_GROUPS): """Run when a gateway is discovered.""" host = info['host'] if host in known_hosts: # use fallbacks for old config style # identity was hard coded as 'homeassistant' identity = known_hosts[host].get('identity', 'homeassistant') key = known_hosts[host].get('key') yield from _setup_gateway(hass, config, host, identity, key, allow_tradfri_groups) else: hass.async_add_job(request_configuration, hass, config, host) discovery.async_listen(hass, SERVICE_IKEA_TRADFRI, gateway_discovered) if host: yield from gateway_discovered(None, {'host': host}, allow_tradfri_groups) return True @asyncio.coroutine def _setup_gateway(hass, hass_config, host, identity, key, allow_tradfri_groups): """Create a gateway.""" from pytradfri import Gateway, RequestError try: from pytradfri.api.aiocoap_api import APIFactory except ImportError: _LOGGER.exception("Looks like something isn't installed!") return False try: factory = APIFactory(host, psk_id=identity, psk=key, loop=hass.loop) api = factory.request gateway = Gateway() gateway_info_result = yield from api(gateway.get_gateway_info()) except RequestError: _LOGGER.exception("Tradfri setup failed.") return False gateway_id = gateway_info_result.id hass.data.setdefault(KEY_API, {}) hass.data.setdefault(KEY_GATEWAY, {}) gateways = hass.data[KEY_GATEWAY] hass.data[KEY_API][gateway_id] = api hass.data.setdefault(KEY_TRADFRI_GROUPS, {}) tradfri_groups = hass.data[KEY_TRADFRI_GROUPS] tradfri_groups[gateway_id] = allow_tradfri_groups # Check if already set up if gateway_id in gateways: return True gateways[gateway_id] = gateway hass.async_add_job(discovery.async_load_platform( hass, 'light', DOMAIN, {'gateway': gateway_id}, hass_config)) hass.async_add_job(discovery.async_load_platform( hass, 'sensor', DOMAIN, {'gateway': gateway_id}, hass_config)) return True
[ 1, 529, 276, 1112, 420, 29958, 17405, 271, 6764, 5184, 29914, 5184, 29899, 465, 22137, 29899, 314, 29882, 13, 15945, 29908, 13, 14039, 363, 306, 446, 29874, 18375, 7932, 29889, 13, 13, 2831, 901, 4902, 1048, 445, 4163, 29892, 3113, 2737, 304, 278, 5106, 472, 13, 991, 597, 5184, 29899, 465, 22137, 29889, 601, 29914, 14036, 29914, 9345, 29874, 29918, 29576, 7932, 29914, 13, 15945, 29908, 13, 5215, 408, 948, 3934, 13, 5215, 12183, 13, 3166, 318, 5416, 1053, 318, 5416, 29946, 13, 13, 5215, 1700, 21245, 17269, 408, 1700, 13, 13, 5215, 3271, 465, 22137, 29889, 3952, 6774, 29889, 2917, 29918, 18157, 408, 13850, 13, 3166, 3271, 465, 22137, 29889, 3952, 6774, 1053, 20699, 13, 3166, 3271, 465, 22137, 29889, 3075, 1053, 8707, 29943, 29918, 20832, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 2218, 11911, 29891, 1053, 26996, 19059, 29918, 29902, 6059, 29909, 29918, 5659, 3035, 29943, 3960, 13, 3166, 3271, 465, 22137, 29889, 4422, 29889, 3126, 1053, 2254, 29918, 3126, 29892, 4078, 29918, 3126, 13, 13, 1525, 29984, 3120, 1525, 13780, 29903, 353, 6024, 2272, 29576, 7932, 1360, 29946, 29889, 29900, 29889, 29896, 742, 13, 18884, 525, 12972, 29931, 1799, 9749, 1360, 29900, 29889, 29896, 29889, 29946, 742, 13, 18884, 525, 991, 597, 3292, 29889, 510, 29914, 305, 719, 16586, 29914, 1794, 6235, 481, 29914, 10867, 22208, 13, 18884, 525, 29941, 29906, 29947, 29953, 29888, 29946, 29947, 29888, 29900, 29890, 29929, 29946, 29929, 29929, 29900, 29896, 29883, 29947, 29890, 29945, 29883, 29900, 29946, 29883, 29900, 29955, 29896, 29929, 13891, 29945, 29946, 370, 29953, 29941, 29881, 29946, 29941, 29896, 29889, 7554, 29915, 13, 18884, 16321, 1794, 6235, 481, 1360, 29900, 29889, 29941, 2033, 13, 13, 3970, 29032, 353, 525, 29576, 7932, 29915, 13, 29954, 3040, 12982, 29979, 29918, 1367, 3919, 11937, 353, 525, 5184, 465, 22137, 29915, 13, 25903, 29918, 7724, 353, 15300, 29576, 7932, 29918, 567, 29895, 29889, 5527, 29915, 13, 10818, 29918, 25903, 353, 525, 29576, 7932, 29918, 2917, 3864, 29915, 13, 10818, 29918, 29954, 3040, 12982, 29979, 353, 525, 29576, 7932, 29918, 17062, 1582, 29915, 13, 10818, 29918, 8787, 353, 525, 29576, 7932, 29918, 2754, 29915, 13, 10818, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 353, 525, 29576, 7932, 29918, 9536, 29918, 29576, 7932, 29918, 13155, 29915, 13, 6007, 29943, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 353, 525, 9536, 29918, 29576, 7932, 29918, 13155, 29915, 13, 23397, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 353, 5852, 13, 13, 25903, 29918, 29903, 3210, 26862, 353, 1700, 29889, 12763, 3319, 13, 1678, 11662, 29032, 29901, 1700, 29889, 12763, 3319, 13, 4706, 1700, 29889, 797, 7009, 573, 29898, 6007, 29943, 29918, 20832, 29892, 525, 17062, 1582, 29374, 13850, 29889, 1807, 29892, 13, 4706, 1700, 29889, 27636, 29898, 6007, 29943, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 29892, 13, 462, 268, 2322, 29922, 23397, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 1125, 13850, 29889, 20054, 29892, 13, 1678, 5615, 13, 1118, 4805, 29922, 1555, 29889, 1964, 27998, 29918, 12194, 4717, 29897, 13, 13, 29918, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 1753, 2009, 29918, 13305, 29898, 29882, 465, 29892, 2295, 29892, 3495, 1125, 13, 1678, 9995, 3089, 5285, 6576, 515, 278, 1404, 1213, 15945, 13, 1678, 17127, 1061, 353, 298, 465, 29889, 14036, 29889, 2917, 332, 1061, 13, 1678, 298, 465, 29889, 1272, 29889, 842, 4381, 29898, 10818, 29918, 25903, 29892, 426, 1800, 13, 1678, 2777, 353, 298, 465, 29889, 1272, 29961, 10818, 29918, 25903, 1822, 657, 29898, 3069, 29897, 13, 13, 1678, 396, 20999, 2307, 297, 6728, 13, 1678, 565, 2777, 29901, 13, 4706, 736, 13, 13, 1678, 732, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1678, 822, 5285, 29918, 14035, 29898, 14035, 29918, 1272, 1125, 13, 4706, 9995, 13554, 278, 18397, 5285, 1213, 15945, 13, 4706, 1018, 29901, 13, 9651, 515, 11451, 29576, 7932, 29889, 2754, 29889, 1794, 6235, 481, 29918, 2754, 1053, 3450, 5126, 13, 9651, 515, 11451, 29576, 7932, 1053, 10729, 2392, 13, 4706, 5174, 16032, 2392, 29901, 13, 9651, 903, 14480, 17070, 29889, 11739, 703, 14959, 29879, 763, 1554, 3508, 29915, 29873, 5130, 29991, 1159, 13, 9651, 736, 13, 13, 4706, 10110, 353, 318, 5416, 29946, 2141, 20970, 13, 4706, 6993, 29918, 401, 353, 6939, 29918, 1272, 29889, 657, 877, 8926, 29918, 401, 1495, 13, 13, 4706, 7882, 29918, 14399, 353, 3450, 5126, 29898, 3069, 29892, 282, 808, 29918, 333, 29922, 22350, 29892, 2425, 29922, 29882, 465, 29889, 7888, 29897, 13, 4706, 396, 20768, 1763, 24778, 29901, 5279, 18055, 263, 2743, 6993, 775, 16003, 13, 4706, 396, 11451, 29576, 7932, 7468, 6235, 481, 3450, 964, 385, 1095, 2222, 2425, 29889, 13, 4706, 396, 10575, 925, 12020, 263, 2009, 2392, 470, 1554, 29889, 13, 4706, 1018, 29901, 13, 9651, 1820, 353, 7709, 515, 7882, 29918, 14399, 29889, 17158, 29918, 567, 29895, 29898, 8926, 29918, 401, 29897, 13, 4706, 5174, 10729, 2392, 29901, 13, 9651, 17127, 1061, 29889, 12674, 29918, 25140, 29918, 12523, 29898, 29882, 465, 29892, 2777, 29892, 13, 462, 462, 632, 376, 13228, 5920, 451, 9259, 23157, 13, 9651, 736, 13, 13, 4706, 620, 353, 7709, 515, 903, 14669, 29918, 17062, 1582, 29898, 29882, 465, 29892, 2295, 29892, 3495, 29892, 10110, 29892, 1820, 29892, 13, 462, 462, 4706, 22236, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 29897, 13, 13, 4706, 565, 451, 620, 29901, 13, 9651, 17127, 1061, 29889, 12674, 29918, 25140, 29918, 12523, 29898, 29882, 465, 29892, 2777, 29892, 13, 462, 462, 632, 376, 2525, 519, 304, 4511, 23157, 13, 9651, 736, 13, 13, 4706, 822, 2551, 7295, 13, 9651, 9995, 2697, 701, 471, 9150, 1213, 15945, 13, 9651, 1970, 353, 2254, 29918, 3126, 29898, 29882, 465, 29889, 2917, 29889, 2084, 29898, 25903, 29918, 7724, 876, 13, 9651, 1970, 29961, 3069, 29962, 353, 11117, 22350, 2396, 10110, 29892, 13, 462, 3986, 525, 1989, 2396, 1820, 29913, 13, 9651, 4078, 29918, 3126, 29898, 29882, 465, 29889, 2917, 29889, 2084, 29898, 25903, 29918, 7724, 511, 1970, 29897, 13, 9651, 17127, 1061, 29889, 3827, 29918, 15091, 29898, 8758, 29897, 13, 13, 4706, 298, 465, 29889, 12674, 29918, 1202, 29918, 9057, 29898, 8698, 29897, 13, 13, 1678, 2777, 353, 17127, 1061, 29889, 3827, 29918, 2917, 29898, 13, 4706, 376, 29902, 6059, 29909, 1605, 30020, 2176, 374, 613, 5285, 29918, 14035, 29892, 13, 4706, 6139, 2433, 12148, 3896, 278, 6993, 775, 3971, 472, 278, 5970, 310, 525, 13, 462, 1678, 525, 8066, 306, 6059, 29909, 1605, 30020, 2176, 374, 22510, 1582, 29889, 742, 13, 4706, 9752, 29918, 6671, 543, 16376, 3568, 613, 13, 4706, 4235, 11759, 10998, 333, 2396, 525, 8926, 29918, 401, 742, 525, 978, 2396, 525, 13228, 5920, 742, 13, 462, 525, 1853, 2396, 525, 5630, 29915, 6525, 13, 1678, 1723, 13, 13, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 7465, 29918, 14669, 29898, 29882, 465, 29892, 2295, 1125, 13, 1678, 9995, 2697, 701, 278, 18375, 7932, 4163, 1213, 15945, 13, 1678, 1970, 353, 2295, 29889, 657, 29898, 3970, 29032, 29892, 426, 1800, 13, 1678, 3495, 353, 1970, 29889, 657, 29898, 6007, 29943, 29918, 20832, 29897, 13, 1678, 2758, 29918, 29576, 7932, 29918, 13155, 353, 1970, 29889, 657, 29898, 6007, 29943, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 29897, 13, 1678, 2998, 29918, 23525, 353, 7709, 515, 298, 465, 29889, 12674, 29918, 1202, 29918, 9057, 29898, 1359, 29918, 3126, 29892, 13, 462, 462, 18884, 298, 465, 29889, 2917, 29889, 2084, 29898, 25903, 29918, 7724, 876, 13, 13, 1678, 732, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1678, 822, 28646, 29918, 2218, 11911, 287, 29898, 5509, 29892, 5235, 29892, 13, 462, 965, 2758, 29918, 29576, 7932, 29918, 13155, 29922, 23397, 29918, 1964, 27998, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 1125, 13, 4706, 9995, 6558, 746, 263, 28646, 338, 10943, 1213, 15945, 13, 4706, 3495, 353, 5235, 1839, 3069, 2033, 13, 13, 4706, 565, 3495, 297, 2998, 29918, 23525, 29901, 13, 9651, 396, 671, 6416, 1627, 29879, 363, 2030, 2295, 3114, 13, 9651, 396, 10110, 471, 2898, 274, 6797, 408, 525, 5184, 465, 22137, 29915, 13, 9651, 10110, 353, 2998, 29918, 23525, 29961, 3069, 1822, 657, 877, 22350, 742, 525, 5184, 465, 22137, 1495, 13, 9651, 1820, 353, 2998, 29918, 23525, 29961, 3069, 1822, 657, 877, 1989, 1495, 13, 9651, 7709, 515, 903, 14669, 29918, 17062, 1582, 29898, 29882, 465, 29892, 2295, 29892, 3495, 29892, 10110, 29892, 1820, 29892, 13, 462, 462, 418, 2758, 29918, 29576, 7932, 29918, 13155, 29897, 13, 4706, 1683, 29901, 13, 9651, 298, 465, 29889, 12674, 29918, 1202, 29918, 9057, 29898, 3827, 29918, 13305, 29892, 298, 465, 29892, 2295, 29892, 3495, 29897, 13, 13, 1678, 20699, 29889, 12674, 29918, 20631, 29898, 29882, 465, 29892, 26996, 19059, 29918, 29902, 6059, 29909, 29918, 5659, 3035, 29943, 3960, 29892, 28646, 29918, 2218, 11911, 287, 29897, 13, 13, 1678, 565, 3495, 29901, 13, 4706, 7709, 515, 28646, 29918, 2218, 11911, 287, 29898, 8516, 29892, 13, 462, 462, 418, 11117, 3069, 2396, 3495, 1118, 13, 462, 462, 418, 2758, 29918, 29576, 7932, 29918, 13155, 29897, 13, 1678, 736, 5852, 13, 13, 13, 29992, 294, 948, 3934, 29889, 2616, 449, 457, 13, 1753, 903, 14669, 29918, 17062, 1582, 29898, 29882, 465, 29892, 298, 465, 29918, 2917, 29892, 3495, 29892, 10110, 29892, 1820, 29892, 13, 462, 259, 2758, 29918, 29576, 7932, 29918, 13155, 1125, 13, 1678, 9995, 4391, 263, 28646, 1213, 15945, 13, 1678, 515, 11451, 29576, 7932, 1053, 22510, 1582, 29892, 10729, 2392, 13, 1678, 1018, 29901, 13, 4706, 515, 11451, 29576, 7932, 29889, 2754, 29889, 1794, 6235, 481, 29918, 2754, 1053, 3450, 5126, 13, 1678, 5174, 16032, 2392, 29901, 13, 4706, 903, 14480, 17070, 29889, 11739, 703, 14959, 29879, 763, 1554, 3508, 29915, 29873, 5130, 29991, 1159, 13, 4706, 736, 7700, 13, 13, 1678, 1018, 29901, 13, 4706, 12529, 353, 3450, 5126, 29898, 3069, 29892, 282, 808, 29918, 333, 29922, 22350, 29892, 282, 808, 29922, 1989, 29892, 13, 462, 632, 2425, 29922, 29882, 465, 29889, 7888, 29897, 13, 4706, 7882, 353, 12529, 29889, 3827, 13, 4706, 28646, 353, 22510, 1582, 580, 13, 4706, 28646, 29918, 3888, 29918, 2914, 353, 7709, 515, 7882, 29898, 17062, 1582, 29889, 657, 29918, 17062, 1582, 29918, 3888, 3101, 13, 1678, 5174, 10729, 2392, 29901, 13, 4706, 903, 14480, 17070, 29889, 11739, 703, 2308, 328, 7932, 6230, 5229, 23157, 13, 4706, 736, 7700, 13, 13, 1678, 28646, 29918, 333, 353, 28646, 29918, 3888, 29918, 2914, 29889, 333, 13, 1678, 298, 465, 29889, 1272, 29889, 842, 4381, 29898, 10818, 29918, 8787, 29892, 426, 1800, 13, 1678, 298, 465, 29889, 1272, 29889, 842, 4381, 29898, 10818, 29918, 29954, 3040, 12982, 29979, 29892, 426, 1800, 13, 1678, 12417, 1994, 353, 298, 465, 29889, 1272, 29961, 10818, 29918, 29954, 3040, 12982, 29979, 29962, 13, 1678, 298, 465, 29889, 1272, 29961, 10818, 29918, 8787, 3816, 17062, 1582, 29918, 333, 29962, 353, 7882, 13, 13, 1678, 298, 465, 29889, 1272, 29889, 842, 4381, 29898, 10818, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 29892, 426, 1800, 13, 1678, 3534, 7932, 29918, 13155, 353, 298, 465, 29889, 1272, 29961, 10818, 29918, 5659, 3035, 29943, 3960, 29918, 26284, 29903, 29962, 13, 1678, 3534, 7932, 29918, 13155, 29961, 17062, 1582, 29918, 333, 29962, 353, 2758, 29918, 29576, 7932, 29918, 13155, 13, 13, 1678, 396, 5399, 565, 2307, 731, 701, 13, 1678, 565, 28646, 29918, 333, 297, 12417, 1994, 29901, 13, 4706, 736, 5852, 13, 13, 1678, 12417, 1994, 29961, 17062, 1582, 29918, 333, 29962, 353, 28646, 13, 1678, 298, 465, 29889, 12674, 29918, 1202, 29918, 9057, 29898, 2218, 11911, 29891, 29889, 12674, 29918, 1359, 29918, 12120, 29898, 13, 4706, 298, 465, 29892, 525, 4366, 742, 11662, 29032, 29892, 11117, 17062, 1582, 2396, 28646, 29918, 333, 1118, 298, 465, 29918, 2917, 876, 13, 1678, 298, 465, 29889, 12674, 29918, 1202, 29918, 9057, 29898, 2218, 11911, 29891, 29889, 12674, 29918, 1359, 29918, 12120, 29898, 13, 4706, 298, 465, 29892, 525, 29879, 6073, 742, 11662, 29032, 29892, 11117, 17062, 1582, 2396, 28646, 29918, 333, 1118, 298, 465, 29918, 2917, 876, 13, 1678, 736, 5852, 13, 2 ]
app/tasker/tasks/models.py
jaredlockhart/django-htmx-todo
4
142784
from django.db import models from django.db.models.query import QuerySet from django.urls import reverse class TaskList(models.Model): name = models.CharField(max_length=255) slug = models.CharField(max_length=255) tasks: QuerySet["Task"] class Meta: verbose_name = "Task List" verbose_name_plural = "Task Lists" def __str__(self) -> str: return self.name def get_absolute_url(self) -> str: return reverse("tasklist-detail", kwargs={"slug": self.slug}) @property def is_complete(self) -> bool: return not self.tasks.filter(is_done=False).exists() @property def complete_tasks(self) -> models.QuerySet["Task"]: return self.tasks.filter(is_done=True) @property def incomplete_tasks(self) -> models.QuerySet["Task"]: return self.tasks.filter(is_done=False) class Task(models.Model): task_list = models.ForeignKey( TaskList, related_name="tasks", on_delete=models.CASCADE, ) name = models.CharField(max_length=255) is_done = models.BooleanField(default=False) class Meta: verbose_name = "Task Item" verbose_name_plural = "Task Items" def __str__(self) -> str: return self.name
[ 1, 515, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 2585, 29889, 9794, 29889, 1972, 1053, 13641, 2697, 13, 3166, 9557, 29889, 26045, 1053, 11837, 13, 13, 13, 1990, 9330, 1293, 29898, 9794, 29889, 3195, 1125, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 1678, 2243, 688, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 13, 1678, 9595, 29901, 13641, 2697, 3366, 5398, 3108, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 376, 5398, 2391, 29908, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 376, 5398, 2391, 29879, 29908, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 1583, 29889, 978, 13, 13, 1678, 822, 679, 29918, 23552, 29918, 2271, 29898, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 11837, 703, 7662, 1761, 29899, 16432, 613, 9049, 5085, 3790, 29908, 29517, 1115, 1583, 29889, 29517, 1800, 13, 13, 1678, 732, 6799, 13, 1678, 822, 338, 29918, 8835, 29898, 1311, 29897, 1599, 6120, 29901, 13, 4706, 736, 451, 1583, 29889, 20673, 29889, 4572, 29898, 275, 29918, 15091, 29922, 8824, 467, 9933, 580, 13, 13, 1678, 732, 6799, 13, 1678, 822, 4866, 29918, 20673, 29898, 1311, 29897, 1599, 4733, 29889, 3010, 2697, 3366, 5398, 3108, 29901, 13, 4706, 736, 1583, 29889, 20673, 29889, 4572, 29898, 275, 29918, 15091, 29922, 5574, 29897, 13, 13, 1678, 732, 6799, 13, 1678, 822, 28907, 29918, 20673, 29898, 1311, 29897, 1599, 4733, 29889, 3010, 2697, 3366, 5398, 3108, 29901, 13, 4706, 736, 1583, 29889, 20673, 29889, 4572, 29898, 275, 29918, 15091, 29922, 8824, 29897, 13, 13, 13, 1990, 9330, 29898, 9794, 29889, 3195, 1125, 13, 1678, 3414, 29918, 1761, 353, 4733, 29889, 27755, 2558, 29898, 13, 4706, 9330, 1293, 29892, 13, 4706, 4475, 29918, 978, 543, 20673, 613, 13, 4706, 373, 29918, 8143, 29922, 9794, 29889, 29907, 3289, 5454, 2287, 29892, 13, 1678, 1723, 13, 1678, 1024, 353, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29906, 29945, 29945, 29897, 13, 1678, 338, 29918, 15091, 353, 4733, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 29897, 13, 13, 1678, 770, 20553, 29901, 13, 4706, 26952, 29918, 978, 353, 376, 5398, 10976, 29908, 13, 4706, 26952, 29918, 978, 29918, 572, 3631, 353, 376, 5398, 25085, 29908, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 29897, 1599, 851, 29901, 13, 4706, 736, 1583, 29889, 978, 13, 2 ]
optionstrader/script.py
Zaitsev11/Optionstrader
6
89761
# TODO # Fix the importing # import CustomName # ... # obj = CustomName() # obj.account.get_balance() # obj.parser.extract_symbols() import __init__ from __init__ import Account from __init__ import Webservice from __init__ import Database from __init__ import Parser import sys, json if __name__ == "__main__": # TODO # Rename or Depricate this code myaccount = Account() webservice = Webservice() input_data = raw_input("Function to Process > ") if input_data == "g": print(myaccount.get_balance()) if input_data == "a": money = raw_input("Amount of money > ") myaccount.add_money_to_checking(money) if input_data == "s": money = raw_input("Amount of money > ") myaccount.subtract_money_from_checking(money) if input_data =='x': parser = Parser() #symbol = raw_input("Enter Symbol > ") parser.extract_symbols() if input_data =='l': parser = Parser() #symbol = raw_input("Enter Symbol > ") parser.start_options_scan()
[ 1, 396, 14402, 13, 29937, 24778, 278, 28348, 13, 29937, 1053, 8701, 1170, 13, 29937, 2023, 13, 29937, 5446, 353, 8701, 1170, 580, 13, 29937, 5446, 29889, 10149, 29889, 657, 29918, 5521, 749, 580, 13, 29937, 5446, 29889, 16680, 29889, 21111, 29918, 18098, 29879, 580, 13, 13, 5215, 4770, 2344, 1649, 13, 3166, 4770, 2344, 1649, 1053, 16535, 13, 3166, 4770, 2344, 1649, 1053, 2563, 5509, 13, 3166, 4770, 2344, 1649, 1053, 5470, 13, 3166, 4770, 2344, 1649, 1053, 1459, 643, 13, 13, 5215, 10876, 29892, 4390, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 396, 14402, 13, 1678, 396, 390, 3871, 470, 897, 558, 9593, 445, 775, 13, 13, 1678, 590, 10149, 353, 16535, 580, 13, 1678, 1856, 5509, 353, 2563, 5509, 580, 13, 13, 1678, 1881, 29918, 1272, 353, 10650, 29918, 2080, 703, 6678, 304, 10554, 1405, 16521, 13, 13, 1678, 565, 1881, 29918, 1272, 1275, 376, 29887, 1115, 13, 4706, 1596, 29898, 1357, 10149, 29889, 657, 29918, 5521, 749, 3101, 13, 13, 1678, 565, 1881, 29918, 1272, 1275, 376, 29874, 1115, 13, 4706, 6909, 353, 10650, 29918, 2080, 703, 18087, 310, 6909, 1405, 16521, 13, 4706, 590, 10149, 29889, 1202, 29918, 29885, 4992, 29918, 517, 29918, 3198, 292, 29898, 29885, 4992, 29897, 13, 13, 1678, 565, 1881, 29918, 1272, 1275, 376, 29879, 1115, 13, 4706, 6909, 353, 10650, 29918, 2080, 703, 18087, 310, 6909, 1405, 16521, 13, 4706, 590, 10149, 29889, 1491, 29873, 1461, 29918, 29885, 4992, 29918, 3166, 29918, 3198, 292, 29898, 29885, 4992, 29897, 13, 13, 1678, 565, 1881, 29918, 1272, 1275, 29915, 29916, 2396, 13, 4706, 13812, 353, 1459, 643, 580, 13, 4706, 396, 18098, 353, 10650, 29918, 2080, 703, 10399, 23858, 1405, 16521, 13, 4706, 13812, 29889, 21111, 29918, 18098, 29879, 580, 13, 13, 1678, 565, 1881, 29918, 1272, 1275, 29915, 29880, 2396, 13, 4706, 13812, 353, 1459, 643, 580, 13, 4706, 396, 18098, 353, 10650, 29918, 2080, 703, 10399, 23858, 1405, 16521, 13, 4706, 13812, 29889, 2962, 29918, 6768, 29918, 16192, 580, 13, 2 ]
tenants/admin.py
ibowditch/polls
0
176397
<filename>tenants/admin.py from django.db import models from django.contrib import admin from django_tenants.admin import TenantAdminMixin from .models import Client, Domain @admin.register(Client) class ClientAdmin(TenantAdminMixin, admin.ModelAdmin): list_display = ('name', 'paid_until') # @admin.register(Domain) # class DomainAdmin(TenantAdminMixin, admin.ModelAdmin): # list_display = ('name', 'paid_until')
[ 1, 529, 9507, 29958, 841, 1934, 29914, 6406, 29889, 2272, 13, 3166, 9557, 29889, 2585, 1053, 4733, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 3166, 9557, 29918, 841, 1934, 29889, 6406, 1053, 12444, 424, 12754, 29924, 861, 262, 13, 13, 3166, 869, 9794, 1053, 12477, 29892, 28460, 13, 13, 29992, 6406, 29889, 9573, 29898, 4032, 29897, 13, 1990, 12477, 12754, 29898, 29911, 27153, 12754, 29924, 861, 262, 29892, 4113, 29889, 3195, 12754, 1125, 13, 4706, 1051, 29918, 4990, 353, 6702, 978, 742, 525, 3274, 333, 29918, 29305, 1495, 13, 13, 29937, 732, 6406, 29889, 9573, 29898, 15951, 29897, 13, 29937, 770, 28460, 12754, 29898, 29911, 27153, 12754, 29924, 861, 262, 29892, 4113, 29889, 3195, 12754, 1125, 13, 29937, 308, 1051, 29918, 4990, 353, 6702, 978, 742, 525, 3274, 333, 29918, 29305, 1495, 13, 2 ]
Mundo 2/Ex46.py
legna7/Python
2
65855
<filename>Mundo 2/Ex46.py from time import sleep print(f'{"-=-" * 7}[CONTAGEM REGRESSIVA]{"-=-" * 7}') print('''Vai estourar os fogos de artifício daqui a 10 segundos, vamos começar a contar!''') sleep(1) for c in range(10, -1, -1): print(c) sleep(1) print('BOOM! POOW! BOOM!') print('AEEEEEE! OS FOGOS ESTOURARAM!!') print('-=-' * 20)
[ 1, 529, 9507, 29958, 29924, 6201, 29871, 29906, 29914, 1252, 29946, 29953, 29889, 2272, 13, 3166, 931, 1053, 8709, 13, 2158, 29898, 29888, 29915, 6377, 29899, 10457, 29908, 334, 29871, 29955, 4400, 6007, 6040, 1692, 29924, 5195, 29954, 26785, 5667, 29909, 3199, 29908, 29899, 10457, 29908, 334, 29871, 29955, 29913, 1495, 13, 2158, 877, 4907, 29963, 1794, 707, 473, 279, 2897, 16847, 359, 316, 1616, 361, 24394, 1146, 6578, 263, 29871, 29896, 29900, 2377, 870, 359, 29892, 13, 29894, 14054, 29435, 279, 263, 640, 279, 29991, 4907, 1495, 13, 17059, 29898, 29896, 29897, 13, 1454, 274, 297, 3464, 29898, 29896, 29900, 29892, 448, 29896, 29892, 448, 29896, 1125, 13, 1678, 1596, 29898, 29883, 29897, 13, 1678, 8709, 29898, 29896, 29897, 13, 2158, 877, 8456, 6488, 29991, 21521, 9806, 29991, 16437, 6488, 29991, 1495, 13, 2158, 877, 16036, 17896, 17896, 29923, 29991, 6570, 18322, 29954, 3267, 382, 1254, 22970, 1718, 5194, 6824, 1495, 13, 2158, 877, 29899, 10457, 29915, 334, 29871, 29906, 29900, 29897, 13, 2 ]
data/scaling/DataScaler.py
khoehlein/CNNs-for-Wind-Field-Downscaling
5
175030
import numpy as np import torch import torch.nn as nn class DataScaler(nn.Module): def __init__( self, bias=None, scale=None, channels=None, dtype=None, device=None, **kwargs ): super(DataScaler, self).__init__() if bias is None: assert scale is None assert channels is not None bias = torch.zeros(1, channels, 1, 1, dtype=dtype, device=device) scale = torch.ones(1, channels, 1, 1, dtype=dtype, device=device) else: assert isinstance(bias, torch.Tensor) assert isinstance(scale, torch.Tensor) assert bias.size() == scale.size() assert bias.size(1) == channels or channels is None assert bias.dtype == scale.dtype assert bias.device == scale.device channels = bias.size(1) self.channels = channels self.register_buffer('bias', bias) self.bias.requires_grad = False self.register_buffer('scale', scale) self.scale.requires_grad = False self.kwargs = kwargs if device is not None or dtype is not None: self.to(device=device, dtype=dtype) @classmethod def from_data(cls, data, **kwargs): assert len(data.shape) == 4 channels = data.shape[1] if isinstance(data, torch.Tensor): dtype = data.dtype, device = data.device elif isinstance(data, np.ndarray): dtype = torch.double device = torch.device('cpu') else: raise Exception('[ERROR] Unknown data type.') scaler = cls(channels=channels, dtype=dtype, device=device, **kwargs) scaler.fit(data) return scaler @classmethod def from_parameters(cls, bias, scale, **kwargs): scaler = cls(bias=bias, scale=scale, **kwargs) return scaler def fit(self, data, **kwargs): assert isinstance(data, (np.ndarray, torch.Tensor)) if len(kwargs) > 0: self.kwargs.update(kwargs) if isinstance(data, np.ndarray): self.cpu() bias, scale = self.compute_scalings_numpy(data, **self.kwargs) self.bias = torch.tensor(bias) self.scale = torch.tensor(scale) else: self.to(data.device) bias, scale = self.compute_scalings_torch(data, **self.kwargs) self.bias = bias self.scale = scale self.kwargs = kwargs self.bias.requires_grad = False self.scale.requires_grad = False return self.bias, self.scale def transform(self, data, offset=None): assert isinstance(data, (np.ndarray, torch.Tensor)) if offset is None or self.scale.numel() == 1: bias = self.bias scale = self.scale else: assert offset.shape == (data.shape[0], 2) patch_size = data.shape[-2:] bias = torch.cat( [self.bias[:, :, x[0]:(x[0] + patch_size[0]), x[1]:(x[1] + patch_size[1])] for x in offset], dim=0 ) scale = torch.cat( [self.scale[:, :, x[0]:(x[0] + patch_size[0]), x[1]:(x[1] + patch_size[1])] for x in offset], dim=0 ) is_numpy_array = isinstance(data, np.ndarray) if is_numpy_array: if bias.numel() > 0: bias = bias.cpu().numpy() data = data - bias if scale.numel() > 0: scale = scale.cpu().numpy() data = data / scale else: if bias.numel() > 0: if data.device != bias.device: bias = bias.to(data.device) data = data - bias if scale.numel() > 0: if data.device != scale.device: scale = scale.to(data.device) data = data / scale return data def transform_back(self, data, offset=None): assert isinstance(data, (np.ndarray, torch.Tensor)) if offset is None or self.scale.numel() == 1: bias = self.bias scale = self.scale else: assert offset.shape == (data.shape[0], 2) patch_size = data.shape[-2:] bias = torch.cat( [self.bias[:, :, x[0]:(x[0] + patch_size[0]), x[1]:(x[1] + patch_size[1])] for x in offset], dim=0 ) scale = torch.cat( [self.scale[:, :, x[0]:(x[0] + patch_size[0]), x[1]:(x[1] + patch_size[1])] for x in offset], dim=0 ) if isinstance(data, np.ndarray): if scale.numel() > 0: scale = scale.cpu().numpy() data = data * scale if bias.numel() > 0: bias = bias.cpu().numpy() data = data + bias else: if scale.numel() > 0: if data.device != scale.device: scale = scale.to(data.device) data = data * scale if bias.numel() > 0: if data.device != bias.device: bias = bias.to(data.device) data = data + bias return data def forward(self, data, mode=None): if mode == 'apply': data = self.transform(data) elif mode == 'revert': data = self.transform_back(data) else: raise NotImplementedError('[ERROR] Operation mode not available.') return data def compute_scalings_numpy(self, data: np.ndarray, **kwargs): raise NotImplementedError() def compute_scalings_torch(self, data: torch.Tensor, **kwargs): raise NotImplementedError()
[ 1, 1053, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 5215, 4842, 305, 29889, 15755, 408, 302, 29876, 13, 13, 13, 1990, 3630, 29636, 261, 29898, 15755, 29889, 7355, 1125, 13, 1678, 822, 4770, 2344, 12035, 13, 9651, 1583, 29892, 13, 9651, 24003, 29922, 8516, 29892, 6287, 29922, 8516, 29892, 13, 9651, 18196, 29922, 8516, 29892, 26688, 29922, 8516, 29892, 4742, 29922, 8516, 29892, 13, 9651, 3579, 19290, 13, 268, 1125, 13, 4706, 2428, 29898, 1469, 29636, 261, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 4706, 565, 24003, 338, 6213, 29901, 13, 9651, 4974, 6287, 338, 6213, 13, 9651, 4974, 18196, 338, 451, 6213, 13, 9651, 24003, 353, 4842, 305, 29889, 3298, 359, 29898, 29896, 29892, 18196, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29897, 13, 9651, 6287, 353, 4842, 305, 29889, 2873, 29898, 29896, 29892, 18196, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29897, 13, 4706, 1683, 29901, 13, 9651, 4974, 338, 8758, 29898, 29890, 3173, 29892, 4842, 305, 29889, 29911, 6073, 29897, 13, 9651, 4974, 338, 8758, 29898, 7052, 29892, 4842, 305, 29889, 29911, 6073, 29897, 13, 9651, 4974, 24003, 29889, 2311, 580, 1275, 6287, 29889, 2311, 580, 13, 9651, 4974, 24003, 29889, 2311, 29898, 29896, 29897, 1275, 18196, 470, 18196, 338, 6213, 13, 9651, 4974, 24003, 29889, 29881, 1853, 1275, 6287, 29889, 29881, 1853, 13, 9651, 4974, 24003, 29889, 10141, 1275, 6287, 29889, 10141, 13, 9651, 18196, 353, 24003, 29889, 2311, 29898, 29896, 29897, 13, 4706, 1583, 29889, 305, 12629, 353, 18196, 13, 4706, 1583, 29889, 9573, 29918, 9040, 877, 29890, 3173, 742, 24003, 29897, 13, 4706, 1583, 29889, 29890, 3173, 29889, 276, 339, 2658, 29918, 5105, 353, 7700, 13, 4706, 1583, 29889, 9573, 29918, 9040, 877, 7052, 742, 6287, 29897, 13, 4706, 1583, 29889, 7052, 29889, 276, 339, 2658, 29918, 5105, 353, 7700, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 565, 4742, 338, 451, 6213, 470, 26688, 338, 451, 6213, 29901, 13, 9651, 1583, 29889, 517, 29898, 10141, 29922, 10141, 29892, 26688, 29922, 29881, 1853, 29897, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 1272, 29898, 25932, 29892, 848, 29892, 3579, 19290, 1125, 13, 4706, 4974, 7431, 29898, 1272, 29889, 12181, 29897, 1275, 29871, 29946, 13, 4706, 18196, 353, 848, 29889, 12181, 29961, 29896, 29962, 13, 4706, 565, 338, 8758, 29898, 1272, 29892, 4842, 305, 29889, 29911, 6073, 1125, 13, 9651, 26688, 353, 848, 29889, 29881, 1853, 29892, 13, 9651, 4742, 353, 848, 29889, 10141, 13, 4706, 25342, 338, 8758, 29898, 1272, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 26688, 353, 4842, 305, 29889, 8896, 13, 9651, 4742, 353, 4842, 305, 29889, 10141, 877, 21970, 1495, 13, 4706, 1683, 29901, 13, 9651, 12020, 8960, 877, 29961, 11432, 29962, 853, 5203, 848, 1134, 29889, 1495, 13, 4706, 8716, 261, 353, 1067, 29879, 29898, 305, 12629, 29922, 305, 12629, 29892, 26688, 29922, 29881, 1853, 29892, 4742, 29922, 10141, 29892, 3579, 19290, 29897, 13, 4706, 8716, 261, 29889, 9202, 29898, 1272, 29897, 13, 4706, 736, 8716, 261, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 515, 29918, 16744, 29898, 25932, 29892, 24003, 29892, 6287, 29892, 3579, 19290, 1125, 13, 4706, 8716, 261, 353, 1067, 29879, 29898, 29890, 3173, 29922, 29890, 3173, 29892, 6287, 29922, 7052, 29892, 3579, 19290, 29897, 13, 4706, 736, 8716, 261, 13, 13, 1678, 822, 6216, 29898, 1311, 29892, 848, 29892, 3579, 19290, 1125, 13, 4706, 4974, 338, 8758, 29898, 1272, 29892, 313, 9302, 29889, 299, 2378, 29892, 4842, 305, 29889, 29911, 6073, 876, 13, 4706, 565, 7431, 29898, 19290, 29897, 1405, 29871, 29900, 29901, 13, 9651, 1583, 29889, 19290, 29889, 5504, 29898, 19290, 29897, 13, 4706, 565, 338, 8758, 29898, 1272, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 1583, 29889, 21970, 580, 13, 9651, 24003, 29892, 6287, 353, 1583, 29889, 26017, 29918, 19529, 886, 29918, 23749, 29898, 1272, 29892, 3579, 1311, 29889, 19290, 29897, 13, 9651, 1583, 29889, 29890, 3173, 353, 4842, 305, 29889, 20158, 29898, 29890, 3173, 29897, 13, 9651, 1583, 29889, 7052, 353, 4842, 305, 29889, 20158, 29898, 7052, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 517, 29898, 1272, 29889, 10141, 29897, 13, 9651, 24003, 29892, 6287, 353, 1583, 29889, 26017, 29918, 19529, 886, 29918, 7345, 305, 29898, 1272, 29892, 3579, 1311, 29889, 19290, 29897, 13, 9651, 1583, 29889, 29890, 3173, 353, 24003, 13, 9651, 1583, 29889, 7052, 353, 6287, 13, 4706, 1583, 29889, 19290, 353, 9049, 5085, 13, 4706, 1583, 29889, 29890, 3173, 29889, 276, 339, 2658, 29918, 5105, 353, 7700, 13, 4706, 1583, 29889, 7052, 29889, 276, 339, 2658, 29918, 5105, 353, 7700, 13, 4706, 736, 1583, 29889, 29890, 3173, 29892, 1583, 29889, 7052, 13, 13, 1678, 822, 4327, 29898, 1311, 29892, 848, 29892, 9210, 29922, 8516, 1125, 13, 4706, 4974, 338, 8758, 29898, 1272, 29892, 313, 9302, 29889, 299, 2378, 29892, 4842, 305, 29889, 29911, 6073, 876, 13, 4706, 565, 9210, 338, 6213, 470, 1583, 29889, 7052, 29889, 1949, 295, 580, 1275, 29871, 29896, 29901, 13, 9651, 24003, 353, 1583, 29889, 29890, 3173, 13, 9651, 6287, 353, 1583, 29889, 7052, 13, 4706, 1683, 29901, 13, 9651, 4974, 9210, 29889, 12181, 1275, 313, 1272, 29889, 12181, 29961, 29900, 1402, 29871, 29906, 29897, 13, 9651, 13261, 29918, 2311, 353, 848, 29889, 12181, 14352, 29906, 17531, 13, 9651, 24003, 353, 4842, 305, 29889, 4117, 29898, 13, 18884, 518, 1311, 29889, 29890, 3173, 7503, 29892, 584, 29892, 921, 29961, 29900, 5387, 29898, 29916, 29961, 29900, 29962, 718, 13261, 29918, 2311, 29961, 29900, 11724, 921, 29961, 29896, 5387, 29898, 29916, 29961, 29896, 29962, 718, 13261, 29918, 2311, 29961, 29896, 2314, 29962, 363, 921, 297, 9210, 1402, 13, 18884, 3964, 29922, 29900, 13, 9651, 1723, 13, 9651, 6287, 353, 4842, 305, 29889, 4117, 29898, 13, 18884, 518, 1311, 29889, 7052, 7503, 29892, 584, 29892, 921, 29961, 29900, 5387, 29898, 29916, 29961, 29900, 29962, 718, 13261, 29918, 2311, 29961, 29900, 11724, 921, 29961, 29896, 5387, 29898, 29916, 29961, 29896, 29962, 718, 13261, 29918, 2311, 29961, 29896, 2314, 29962, 363, 921, 297, 9210, 1402, 13, 18884, 3964, 29922, 29900, 13, 9651, 1723, 13, 4706, 338, 29918, 23749, 29918, 2378, 353, 338, 8758, 29898, 1272, 29892, 7442, 29889, 299, 2378, 29897, 13, 4706, 565, 338, 29918, 23749, 29918, 2378, 29901, 13, 9651, 565, 24003, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 24003, 353, 24003, 29889, 21970, 2141, 23749, 580, 13, 18884, 848, 353, 848, 448, 24003, 13, 9651, 565, 6287, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 6287, 353, 6287, 29889, 21970, 2141, 23749, 580, 13, 18884, 848, 353, 848, 847, 6287, 13, 4706, 1683, 29901, 13, 9651, 565, 24003, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 565, 848, 29889, 10141, 2804, 24003, 29889, 10141, 29901, 13, 462, 1678, 24003, 353, 24003, 29889, 517, 29898, 1272, 29889, 10141, 29897, 13, 18884, 848, 353, 848, 448, 24003, 13, 9651, 565, 6287, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 565, 848, 29889, 10141, 2804, 6287, 29889, 10141, 29901, 13, 462, 1678, 6287, 353, 6287, 29889, 517, 29898, 1272, 29889, 10141, 29897, 13, 18884, 848, 353, 848, 847, 6287, 13, 4706, 736, 848, 13, 13, 1678, 822, 4327, 29918, 1627, 29898, 1311, 29892, 848, 29892, 9210, 29922, 8516, 1125, 13, 4706, 4974, 338, 8758, 29898, 1272, 29892, 313, 9302, 29889, 299, 2378, 29892, 4842, 305, 29889, 29911, 6073, 876, 13, 4706, 565, 9210, 338, 6213, 470, 1583, 29889, 7052, 29889, 1949, 295, 580, 1275, 29871, 29896, 29901, 13, 9651, 24003, 353, 1583, 29889, 29890, 3173, 13, 9651, 6287, 353, 1583, 29889, 7052, 13, 4706, 1683, 29901, 13, 9651, 4974, 9210, 29889, 12181, 1275, 313, 1272, 29889, 12181, 29961, 29900, 1402, 29871, 29906, 29897, 13, 9651, 13261, 29918, 2311, 353, 848, 29889, 12181, 14352, 29906, 17531, 13, 9651, 24003, 353, 4842, 305, 29889, 4117, 29898, 13, 18884, 518, 1311, 29889, 29890, 3173, 7503, 29892, 584, 29892, 921, 29961, 29900, 5387, 29898, 29916, 29961, 29900, 29962, 718, 13261, 29918, 2311, 29961, 29900, 11724, 921, 29961, 29896, 5387, 29898, 29916, 29961, 29896, 29962, 718, 13261, 29918, 2311, 29961, 29896, 2314, 29962, 363, 921, 297, 9210, 1402, 13, 18884, 3964, 29922, 29900, 13, 9651, 1723, 13, 9651, 6287, 353, 4842, 305, 29889, 4117, 29898, 13, 18884, 518, 1311, 29889, 7052, 7503, 29892, 584, 29892, 921, 29961, 29900, 5387, 29898, 29916, 29961, 29900, 29962, 718, 13261, 29918, 2311, 29961, 29900, 11724, 921, 29961, 29896, 5387, 29898, 29916, 29961, 29896, 29962, 718, 13261, 29918, 2311, 29961, 29896, 2314, 29962, 363, 921, 297, 9210, 1402, 13, 18884, 3964, 29922, 29900, 13, 9651, 1723, 13, 4706, 565, 338, 8758, 29898, 1272, 29892, 7442, 29889, 299, 2378, 1125, 13, 9651, 565, 6287, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 6287, 353, 6287, 29889, 21970, 2141, 23749, 580, 13, 18884, 848, 353, 848, 334, 6287, 13, 9651, 565, 24003, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 24003, 353, 24003, 29889, 21970, 2141, 23749, 580, 13, 18884, 848, 353, 848, 718, 24003, 13, 4706, 1683, 29901, 13, 9651, 565, 6287, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 565, 848, 29889, 10141, 2804, 6287, 29889, 10141, 29901, 13, 462, 1678, 6287, 353, 6287, 29889, 517, 29898, 1272, 29889, 10141, 29897, 13, 18884, 848, 353, 848, 334, 6287, 13, 9651, 565, 24003, 29889, 1949, 295, 580, 1405, 29871, 29900, 29901, 13, 18884, 565, 848, 29889, 10141, 2804, 24003, 29889, 10141, 29901, 13, 462, 1678, 24003, 353, 24003, 29889, 517, 29898, 1272, 29889, 10141, 29897, 13, 18884, 848, 353, 848, 718, 24003, 13, 4706, 736, 848, 13, 13, 1678, 822, 6375, 29898, 1311, 29892, 848, 29892, 4464, 29922, 8516, 1125, 13, 4706, 565, 4464, 1275, 525, 7302, 2396, 13, 9651, 848, 353, 1583, 29889, 9067, 29898, 1272, 29897, 13, 4706, 25342, 4464, 1275, 525, 276, 1765, 2396, 13, 9651, 848, 353, 1583, 29889, 9067, 29918, 1627, 29898, 1272, 29897, 13, 4706, 1683, 29901, 13, 9651, 12020, 2216, 1888, 2037, 287, 2392, 877, 29961, 11432, 29962, 20462, 4464, 451, 3625, 29889, 1495, 13, 4706, 736, 848, 13, 13, 1678, 822, 10272, 29918, 19529, 886, 29918, 23749, 29898, 1311, 29892, 848, 29901, 7442, 29889, 299, 2378, 29892, 3579, 19290, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 13, 13, 1678, 822, 10272, 29918, 19529, 886, 29918, 7345, 305, 29898, 1311, 29892, 848, 29901, 4842, 305, 29889, 29911, 6073, 29892, 3579, 19290, 1125, 13, 4706, 12020, 2216, 1888, 2037, 287, 2392, 580, 2 ]
clusterval/validation.py
Nuno09/clusterval
3
125697
<filename>clusterval/validation.py """ Function evaluate does hierarchical clustering and validation of it's results. Validation can be done with external or internal indices, or both. """ from scipy.cluster.hierarchy import dendrogram, fcluster, cut_tree from fastcluster import linkage from scipy.spatial.distance import pdist from sklearn.cluster import KMeans from sklearn.neighbors import NearestCentroid from statistics import mean import pandas as pd from collections import defaultdict import matplotlib.pyplot as plt import itertools import numpy as np import math import random from clusterval.internal import calculate_internal from clusterval.external import calculate_external class Clusterval: """ min_k: int, optional minimum number of clusters to test. Default 2. max_k: int, optional maximum number of clusters to test. Default 8. algorithm: str, optional clustering algorithm to use. Accepts 'single', 'ward'(default), 'complete', 'centroid', 'average' and 'kmeans bootstrap_samples: int, optional number of bootstrap samples simulated. Default 250 index: list of str or str, optional what indices to be calculated. Accepts 'all' to calculate all, 'internal' to calculate only internal indices, 'external' to calculate external indices, or one of ['AR', 'FM', 'J', 'AW', 'VD', 'H', 'F', 'VI', 'K', 'Phi', 'RT', 'SS', 'CVNN', 'XB', 'SDbw', 'DB', 'S', 'SD', 'PBM', 'Dunn']. Default 'all'. """ def __init__(self, min_k=2, max_k=8, algorithm='ward', bootstrap_samples=250, index='all'): external_indices = ['AR', 'FM', 'J', 'AW', 'VD', 'H', 'F', 'VI', 'K', 'Phi', 'RT', 'SS'] internal_indices = ['CVNN', 'XB', 'SDbw', 'DB', 'S', 'SD', 'PBM', 'Dunn'] min_indices = ['VD', 'VI', 'MS', 'CVNN', 'XB', 'SDbw', 'DB', 'SD'] idx_distance_matrix = ['XB', 'SDbw', 'DB', 'SD', 'PBM'] indices = {'AR': ['AR'], 'FM': ['FM'], 'J': ['J'], 'AW': ['AW'], 'VD': ['VD'], 'H': ['H'], 'F': ['F'], 'K': ['K'], 'Phi': ['Phi'], 'RT': ['RT'], 'SS': ['SS'], 'VI': ['VI'], 'CVNN': ['CVNN'], 'XB': ['XB'], 'SDbw': ['SDbw'], 'DB': ['DB'], 'S': ['S'], 'SD': ['SD'],'PBM': ['PBM'], 'Dunn': ['Dunn'], 'all': external_indices + internal_indices, 'external': external_indices, 'internal': internal_indices } if isinstance(index, str): index = [x.strip() for x in index.split(',')] for idx in index: if idx not in indices.keys(): raise ValueError('{0} is not a valid index value, please check help(clusterval.Clusterval) to see acceptables indices'.format( idx)) self._external_indices = external_indices self._internal_indices = internal_indices self._min_indices = min_indices self._indices = indices self._idx_distance_matrix = idx_distance_matrix self.min_k = min_k self.max_k = max_k self.algorithm = algorithm self.bootstrap_samples = bootstrap_samples self.index = index columns = [] for i in self.index: columns = columns + self._indices[i] self.output_df = pd.DataFrame( index=range(self.min_k, self.max_k + 1), columns=columns, dtype=np.float64 ) self.final_k = None self.count_choice = None self.final_clusters = None self.Z= None self.long_info = None def __repr__(self): args = ['{}={}'.format(' ' + key, value) for key,value in self.__dict__.items() if key not in ['output_df', '_external_indices', '_internal_indices', '_min_indices', '_indices', '_data', 'final_k', 'count_choice', 'final_clusters', 'long_info', 'Z', '_idx_distance_matrix']] args = ','.join(args) return 'Clusterval(' + str(args) + ')\nfinal_k = {}'.format(self.final_k) def __str__(self): args = ['{} is {}'.format(' ' + key, value) for key, value in self.__dict__.items() if key not in ['output_df', '_external_indices', '_internal_indices', '_min_indices', '_indices', '_data', 'final_k', 'count_choice', 'final_clusters', 'long_info', 'Z', '_idx_distance_matrix']] args = ';\n'.join(args) return 'Clusterval: \n' + str(args) + '\n' def _cluster_indices(self, cluster_assignments, idx): ''' Transform cluster memebership array into array of clusters :param cluster_assignments: array :param idx: array with indices :return: array of clusters ''' n = int(cluster_assignments.max()) clusters = [] for cluster_number in range(0, n + 1): aux = np.where(cluster_assignments == cluster_number)[0].tolist() if aux: cluster = list(idx[i] for i in aux) clusters.append(cluster) return clusters def _distance_dict(self, data): """ Build dictionary that maps pairs to distance values :param data: ndarray m * (m - 1)) // 2 like returned by pdist :return: dictionary of tuples """ from itertools import combinations from sympy import Symbol, solve diss_matrix = False #check if distances already calculated if data.ndim == 1: pairwise_distances = [i for i in data] x = Symbol('x') n = solve(x ** 2 - x - 2*data.shape[0])[1] diss_matrix = True else: pairwise_distances = pdist(data) n = len(data) comb = list(combinations([i for i in range(0, n)], 2)) dist_dict = defaultdict(float) for pair, dist in zip(comb,pairwise_distances): dist_dict[pair] = dist return dist_dict, diss_matrix def _choose(self, choices_dict): for metrics in self.index: for metric in self._indices[metrics]: if metric in self.output_df.columns.values: if metric in self._min_indices: value = self.output_df.loc[self.output_df[metric].idxmin()] else: value = self.output_df.loc[self.output_df[metric].idxmax()] choices_dict[metric] = [value.name, value[metric]] return choices_dict def evaluate(self, data): """ Perform hierarchical clustering or Kmeans clustering on the data and calculate the validation indices :param data: array-like, n_samples x n_features or 1-d dissimilarity array Dataset to cluster :return: Clusterval object """ columns = [] for i in self.index: columns = columns + self._indices[i] self.output_df = pd.DataFrame( index=range(self.min_k, self.max_k + 1), columns=columns, dtype=np.float64 ) #convert data to numpy array data = np.array(data) #build dictionary with pairwise distances distances, diss_matrix = self._distance_dict(data) for metrics in self.index: for idx in self._indices[metrics]: if (diss_matrix) and (idx in self._idx_distance_matrix): self.output_df = self.output_df.drop([idx], axis=1) clustering = defaultdict(dict) # dictionary with all mean values of the metrics for every k choices_dict = defaultdict(list) self.count_choice = defaultdict(int) results = {k: {} for k in range(self.min_k, self.max_k + 1)} # build dictionaries that hold the calculations for k in range(self.min_k, self.max_k + 1): for metrics in self.index: for idx in self._indices[metrics]: if (diss_matrix) and (idx in self._idx_distance_matrix): continue else: results[k][idx] = [] if not any(self.output_df.columns.values): raise ValueError('No CVIs being evaluated. If inputing distance matrix, please be aware that SD, XB, SDbw, PBM and DB are not possible to calculate.') if self.algorithm in ['ward', 'single', 'complete', 'average', 'centroid']: self.Z = linkage(data, method=self.algorithm) for k in range(self.min_k, self.max_k + 1): if self.algorithm in ['ward', 'single', 'complete', 'average', 'centroid']: # builds a list of the hierarchical clusters # with cut_tree partition = cut_tree(self.Z, n_clusters=k) clusters = self._cluster_indices(partition, [i for i in range(0, len(data))]) clf = NearestCentroid() if not diss_matrix: try: clf.fit(data, list(itertools.chain.from_iterable(partition))) #if only one cluster formed, try with fcluster - this happened with centroid except ValueError as e: if isinstance(e, ValueError): partition = fcluster(self.Z, t=k, criterion='maxclust') clusters = self._cluster_indices(partition, [i for i in range(0, len(data))]) clf.fit(data, list(itertools.chain(partition))) centroids = clf.centroids_ else: centroids = None elif self.algorithm == 'kmeans': if diss_matrix: raise ValueError('k-means does not work with only pairwise distances as input. Please set another algorithm.') partition = KMeans(n_clusters=k, random_state=0).fit(data) clusters = self._cluster_indices(partition.labels_, [i for i in range(0, len(data))]) centroids = partition.cluster_centers_ else: raise ValueError(self.algorithm + ' is not an acceptable clustering algorithm, please choose \'single\',' ' \'ward\', \'centroid\', \'complete\', \'average\' or \'kmeans\'') # dictionary of clustering of each 'k', to be used in internal validation clustering[k] = {'clusters': clusters, 'centroids': centroids} if (self.index[0] in ['all', 'external']) or (set(self.index).intersection(self._external_indices)): # external validation step for i in range(self.bootstrap_samples): sample = random.sample(list(data), int(3 / 4 * len(data))) #check if combinations are good in case of data == distance matrix if diss_matrix: NN = len(sample) N = int(math.ceil(math.sqrt(NN*2))) comb = (N*(N-1)//2) if comb != NN: sample = sample[:-(abs(comb - NN))] if self.algorithm in ['ward', 'single', 'complete', 'average', 'centroid']: Z_sample = linkage(sample, method=self.algorithm) #clusters_sample = self._cluster_indices(fcluster(Z_sample, t=k, criterion='maxclust'), [i for i in range(0, len(sample))]) clusters_sample = self._cluster_indices(cut_tree(Z_sample, k), [i for i in range(0, len(sample))]) elif diss_matrix: raise ValueError('k-means does not work with only pairwise distances as input. Please set another algorithm.') else: clusters_sample = self._cluster_indices(KMeans(n_clusters=k, random_state=0).fit(sample).labels_, [i for i in range(0, len(sample))]) external = calculate_external(clusters, clusters_sample, indices=self.index) for key, metric in external.items(): if (key in self.index) or (self.index): results[k][key].append(metric) if (self.index[0] in ['all', 'internal']) or (set(self.index).intersection(self._internal_indices)): # dictionary of distance between pairs of data points, e.g, {(pair1,pair2) : dist(pair1,pair2)} # internal validation step if diss_matrix: internal = calculate_internal(clustering, data=data, distance_dict=distances, indices=['CVNN','S','Dunn']) else: internal = calculate_internal(clustering, data=data, distance_dict=distances, indices=self.index) for cvi, k_clust in internal.items(): for n_c, val in k_clust.items(): results[n_c][cvi] = val for k, keys in results.items(): for key, value in keys.items(): if key in self._external_indices: self.output_df.loc[k, key] = mean(value) else: self.output_df.loc[k, key] = value choices_dict = self._choose(choices_dict) for values in choices_dict.values(): self.count_choice[str(values[0])] += 1 max_value = 0 for key, value in self.count_choice.items(): if value > max_value: max_value = value final_k = key self.final_k = int(final_k) if self.algorithm in ['ward', 'single', 'complete', 'average', 'centroid']: #self.final_clusters = fcluster(self.Z, t=self.final_k, criterion='maxclust') self.final_clusters = np.concatenate(np.asarray(cut_tree(self.Z, self.final_k))) else: self.final_clusters = KMeans(n_clusters=self.final_k, random_state=0).fit(data).labels_ self.long_info = self.print_results() return self def print_results(self): ''' print detailed information on the clustering results conclusion :return: str with the results ''' output_str = '* Minimum number of clusters to test: ' + str(self.min_k) + '\n' output_str += '* Maximum number of clusters to test: ' + str(self.max_k) + '\n' output_str +='* Number of bootstrap samples generated: ' + str(self.bootstrap_samples) + '\n' output_str += '* Clustering algorithm used: ' + str(self.algorithm) + '\n' if self.index not in ['all', 'internal', 'external']: idx = list(self.output_df.columns.values) else: idx = self.index output_str +='\n* Validation Indices calculated: ' + str(idx) + '\n\n' output_str +="* Among all indices: \n\n" output_str +='\n\n* According to the majority rule, the best number of clusters is ' + str(self.final_k) + '\n\n\n' for k_num in sorted(self.count_choice): output_str +='* ' + str(self.count_choice[k_num]) + ' proposed ' + k_num + ' as the best number of clusters \n\n' output_str +='\t\t\t***** Conclusion *****\t\t\t\n' #Display all dataframe pd.set_option('display.max_rows', None) pd.set_option('display.max_columns', None) pd.set_option('display.width', None) pd.set_option('display.max_colwidth', None) output_str +=str(self.output_df) + '\n' output_str +='\n* The best partition is:\n' output_str +=str(self.final_clusters) + '\n' return output_str def _calculate_dendrogram(self, labels=None): ''' Calculate dendrogram for object linkage product :param labels: array-like, shape 1 x len(data.shape[0]) :return: dendrogram ''' dend = dendrogram( self.Z, # truncate_mode = 'lastp', # p=6, leaf_rotation=90., # rotates the x axis labels leaf_font_size=10, # font size for the x axis labels labels=labels ) return dend def plot(self, labels=None): ''' print the hierarchical clustering dendrogram using matplotlib :return: matplotlib image of dendrogram ''' fig = plt.figure(figsize=(40, 20)) plt.title('Hierarchical Clustering Dendrogram - Linkage: %s, Metrics: %s' % (self.algorithm, str(self.index)), fontsize=30) plt.xlabel('data point index', labelpad=20, fontsize=30) plt.ylabel('distance', labelpad=10, fontsize=30) plt.xticks(size=40) plt.yticks(size=40) self._calculate_dendrogram(labels) plt.show()
[ 1, 529, 9507, 29958, 19594, 791, 29914, 18157, 29889, 2272, 13, 15945, 29908, 13, 6678, 14707, 947, 6128, 1279, 936, 16993, 3241, 322, 8845, 310, 372, 29915, 29879, 2582, 29889, 13, 19448, 508, 367, 2309, 411, 7029, 470, 7463, 16285, 29892, 470, 1716, 29889, 13, 13, 13, 15945, 29908, 13, 13, 13, 3166, 4560, 2272, 29889, 19594, 29889, 29882, 631, 12040, 1053, 270, 355, 307, 1393, 29892, 285, 19594, 29892, 5700, 29918, 8336, 13, 3166, 5172, 19594, 1053, 1544, 482, 13, 3166, 4560, 2272, 29889, 1028, 15238, 29889, 19244, 1053, 282, 5721, 13, 3166, 2071, 19668, 29889, 19594, 1053, 476, 6816, 550, 13, 3166, 2071, 19668, 29889, 484, 1141, 29890, 943, 1053, 26206, 342, 23369, 1007, 13, 3166, 13964, 1053, 2099, 13, 5215, 11701, 408, 10518, 13, 3166, 16250, 1053, 2322, 8977, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 4256, 8504, 13, 5215, 12655, 408, 7442, 13, 5215, 5844, 13, 5215, 4036, 13, 13, 3166, 9867, 791, 29889, 7564, 1053, 8147, 29918, 7564, 13, 3166, 9867, 791, 29889, 23176, 1053, 8147, 29918, 23176, 13, 13, 13, 1990, 2233, 5402, 791, 29901, 13, 1678, 9995, 13, 1678, 1375, 29918, 29895, 29901, 938, 29892, 13136, 13, 1678, 9212, 1353, 310, 24554, 304, 1243, 29889, 13109, 29871, 29906, 29889, 13, 13, 1678, 4236, 29918, 29895, 29901, 938, 29892, 13136, 13, 1678, 7472, 1353, 310, 24554, 304, 1243, 29889, 13109, 29871, 29947, 29889, 13, 13, 1678, 5687, 29901, 851, 29892, 13136, 13, 1678, 16993, 3241, 5687, 304, 671, 29889, 29848, 29879, 525, 14369, 742, 525, 1328, 12215, 4381, 511, 525, 8835, 742, 525, 1760, 1007, 742, 525, 12483, 482, 29915, 322, 525, 29895, 1004, 550, 13, 13, 1678, 16087, 29918, 27736, 29901, 938, 29892, 13136, 13, 1678, 1353, 310, 16087, 11916, 1027, 7964, 29889, 13109, 29871, 29906, 29945, 29900, 13, 13, 1678, 2380, 29901, 1051, 310, 851, 470, 851, 29892, 13136, 13, 1678, 825, 16285, 304, 367, 12833, 29889, 29848, 29879, 525, 497, 29915, 304, 8147, 599, 29892, 525, 7564, 29915, 304, 8147, 871, 7463, 16285, 29892, 13, 268, 525, 23176, 29915, 304, 8147, 7029, 16285, 29892, 470, 697, 310, 6024, 1718, 742, 525, 22192, 742, 525, 29967, 742, 525, 29376, 742, 525, 10699, 742, 525, 29950, 742, 525, 29943, 742, 525, 18118, 742, 525, 29968, 742, 525, 9492, 742, 525, 13079, 742, 525, 1799, 742, 13, 268, 525, 15633, 10262, 742, 525, 29990, 29933, 742, 525, 7230, 29890, 29893, 742, 525, 4051, 742, 525, 29903, 742, 525, 7230, 742, 525, 29925, 29933, 29924, 742, 525, 29928, 5963, 13359, 13109, 525, 497, 4286, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 1375, 29918, 29895, 29922, 29906, 29892, 4236, 29918, 29895, 29922, 29947, 29892, 5687, 2433, 1328, 742, 16087, 29918, 27736, 29922, 29906, 29945, 29900, 29892, 2380, 2433, 497, 29374, 13, 13, 4706, 7029, 29918, 513, 1575, 353, 6024, 1718, 742, 525, 22192, 742, 525, 29967, 742, 525, 29376, 742, 525, 10699, 742, 525, 29950, 742, 525, 29943, 742, 525, 18118, 742, 525, 29968, 742, 525, 9492, 742, 525, 13079, 742, 525, 1799, 2033, 13, 13, 4706, 7463, 29918, 513, 1575, 353, 6024, 15633, 10262, 742, 525, 29990, 29933, 742, 525, 7230, 29890, 29893, 742, 525, 4051, 742, 525, 29903, 742, 525, 7230, 742, 525, 29925, 29933, 29924, 742, 525, 29928, 5963, 2033, 13, 13, 4706, 1375, 29918, 513, 1575, 353, 6024, 10699, 742, 525, 18118, 742, 525, 4345, 742, 525, 15633, 10262, 742, 525, 29990, 29933, 742, 525, 7230, 29890, 29893, 742, 525, 4051, 742, 525, 7230, 2033, 13, 13, 4706, 22645, 29918, 19244, 29918, 5344, 353, 6024, 29990, 29933, 742, 525, 7230, 29890, 29893, 742, 525, 4051, 742, 525, 7230, 742, 525, 29925, 29933, 29924, 2033, 13, 13, 4706, 16285, 353, 11117, 1718, 2396, 6024, 1718, 7464, 525, 22192, 2396, 6024, 22192, 7464, 525, 29967, 2396, 6024, 29967, 7464, 525, 29376, 2396, 6024, 29376, 7464, 525, 10699, 2396, 6024, 10699, 7464, 525, 29950, 2396, 6024, 29950, 7464, 13, 462, 259, 525, 29943, 2396, 6024, 29943, 7464, 525, 29968, 2396, 6024, 29968, 7464, 525, 9492, 2396, 6024, 9492, 7464, 525, 13079, 2396, 6024, 13079, 7464, 525, 1799, 2396, 6024, 1799, 7464, 13, 462, 259, 525, 18118, 2396, 6024, 18118, 7464, 525, 15633, 10262, 2396, 6024, 15633, 10262, 7464, 525, 29990, 29933, 2396, 6024, 29990, 29933, 7464, 13, 462, 259, 525, 7230, 29890, 29893, 2396, 6024, 7230, 29890, 29893, 7464, 525, 4051, 2396, 6024, 4051, 7464, 525, 29903, 2396, 6024, 29903, 7464, 525, 7230, 2396, 6024, 7230, 7464, 29915, 29925, 29933, 29924, 2396, 6024, 29925, 29933, 29924, 7464, 525, 29928, 5963, 2396, 6024, 29928, 5963, 7464, 13, 462, 259, 525, 497, 2396, 7029, 29918, 513, 1575, 718, 7463, 29918, 513, 1575, 29892, 525, 23176, 2396, 7029, 29918, 513, 1575, 29892, 13, 462, 259, 525, 7564, 2396, 7463, 29918, 513, 1575, 13, 462, 259, 500, 13, 13, 13, 4706, 565, 338, 8758, 29898, 2248, 29892, 851, 1125, 13, 9651, 2380, 353, 518, 29916, 29889, 17010, 580, 363, 921, 297, 2380, 29889, 5451, 29317, 1495, 29962, 13, 13, 4706, 363, 22645, 297, 2380, 29901, 13, 9651, 565, 22645, 451, 297, 16285, 29889, 8149, 7295, 13, 18884, 12020, 7865, 2392, 877, 29912, 29900, 29913, 338, 451, 263, 2854, 2380, 995, 29892, 3113, 1423, 1371, 29898, 19594, 791, 29889, 6821, 5402, 791, 29897, 304, 1074, 3544, 1849, 16285, 4286, 4830, 29898, 13, 462, 1678, 22645, 876, 13, 13, 4706, 1583, 3032, 23176, 29918, 513, 1575, 353, 7029, 29918, 513, 1575, 13, 4706, 1583, 3032, 7564, 29918, 513, 1575, 353, 7463, 29918, 513, 1575, 13, 4706, 1583, 3032, 1195, 29918, 513, 1575, 353, 1375, 29918, 513, 1575, 13, 4706, 1583, 3032, 513, 1575, 353, 16285, 13, 4706, 1583, 3032, 13140, 29918, 19244, 29918, 5344, 353, 22645, 29918, 19244, 29918, 5344, 13, 13, 4706, 1583, 29889, 1195, 29918, 29895, 353, 1375, 29918, 29895, 13, 4706, 1583, 29889, 3317, 29918, 29895, 353, 4236, 29918, 29895, 13, 4706, 1583, 29889, 20567, 353, 5687, 13, 4706, 1583, 29889, 8704, 29918, 27736, 353, 16087, 29918, 27736, 13, 4706, 1583, 29889, 2248, 353, 2380, 13, 13, 4706, 4341, 353, 5159, 13, 4706, 363, 474, 297, 1583, 29889, 2248, 29901, 13, 9651, 4341, 353, 4341, 718, 1583, 3032, 513, 1575, 29961, 29875, 29962, 13, 4706, 1583, 29889, 4905, 29918, 2176, 353, 10518, 29889, 17271, 29898, 13, 9651, 2380, 29922, 3881, 29898, 1311, 29889, 1195, 29918, 29895, 29892, 1583, 29889, 3317, 29918, 29895, 718, 29871, 29896, 511, 13, 9651, 4341, 29922, 13099, 29892, 13, 9651, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 13, 4706, 1723, 13, 4706, 1583, 29889, 8394, 29918, 29895, 353, 6213, 13, 4706, 1583, 29889, 2798, 29918, 16957, 353, 6213, 13, 4706, 1583, 29889, 8394, 29918, 695, 504, 414, 353, 6213, 13, 4706, 1583, 29889, 29999, 29922, 6213, 13, 13, 4706, 1583, 29889, 5426, 29918, 3888, 353, 6213, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 6389, 353, 6024, 8875, 3790, 29913, 4286, 4830, 877, 525, 718, 1820, 29892, 995, 29897, 363, 1820, 29892, 1767, 297, 1583, 17255, 8977, 26914, 7076, 580, 565, 1820, 451, 297, 6024, 4905, 29918, 2176, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 23176, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 7564, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 1195, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 1272, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 8394, 29918, 29895, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 2798, 29918, 16957, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 8394, 29918, 695, 504, 414, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 5426, 29918, 3888, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 29999, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 13140, 29918, 19244, 29918, 5344, 2033, 29962, 13, 4706, 6389, 353, 13420, 4286, 7122, 29898, 5085, 29897, 13, 4706, 736, 525, 6821, 5402, 791, 877, 718, 851, 29898, 5085, 29897, 718, 525, 2144, 29876, 8394, 29918, 29895, 353, 6571, 4286, 4830, 29898, 1311, 29889, 8394, 29918, 29895, 29897, 13, 13, 1678, 822, 4770, 710, 12035, 1311, 1125, 13, 4706, 6389, 353, 6024, 8875, 338, 6571, 4286, 4830, 877, 525, 718, 1820, 29892, 995, 29897, 363, 1820, 29892, 995, 297, 1583, 17255, 8977, 26914, 7076, 580, 565, 1820, 451, 297, 6024, 4905, 29918, 2176, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 23176, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 7564, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 1195, 29918, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 513, 1575, 742, 13, 462, 462, 462, 462, 462, 462, 539, 22868, 1272, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 8394, 29918, 29895, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 2798, 29918, 16957, 742, 13, 462, 462, 462, 462, 462, 462, 539, 525, 8394, 29918, 695, 504, 414, 742, 13, 462, 462, 462, 462, 462, 462, 4706, 525, 5426, 29918, 3888, 742, 13, 462, 462, 462, 462, 462, 462, 965, 525, 29999, 742, 13, 462, 462, 462, 462, 462, 462, 965, 22868, 13140, 29918, 19244, 29918, 5344, 2033, 29962, 13, 4706, 6389, 353, 525, 10436, 29876, 4286, 7122, 29898, 5085, 29897, 13, 4706, 736, 525, 6821, 5402, 791, 29901, 320, 29876, 29915, 718, 851, 29898, 5085, 29897, 718, 11297, 29876, 29915, 13, 13, 13, 1678, 822, 903, 19594, 29918, 513, 1575, 29898, 1311, 29892, 9867, 29918, 16645, 1860, 29892, 22645, 1125, 13, 4706, 14550, 13, 4706, 4103, 689, 9867, 2626, 774, 10475, 1409, 964, 1409, 310, 24554, 13, 4706, 584, 3207, 9867, 29918, 16645, 1860, 29901, 1409, 13, 4706, 584, 3207, 22645, 29901, 1409, 411, 16285, 13, 4706, 584, 2457, 29901, 1409, 310, 24554, 13, 4706, 14550, 13, 13, 4706, 302, 353, 938, 29898, 19594, 29918, 16645, 1860, 29889, 3317, 3101, 13, 4706, 24554, 353, 5159, 13, 4706, 363, 9867, 29918, 4537, 297, 3464, 29898, 29900, 29892, 302, 718, 29871, 29896, 1125, 13, 9651, 3479, 353, 7442, 29889, 3062, 29898, 19594, 29918, 16645, 1860, 1275, 9867, 29918, 4537, 9601, 29900, 1822, 25027, 391, 580, 13, 9651, 565, 3479, 29901, 13, 18884, 9867, 353, 1051, 29898, 13140, 29961, 29875, 29962, 363, 474, 297, 3479, 29897, 13, 18884, 24554, 29889, 4397, 29898, 19594, 29897, 13, 4706, 736, 24554, 13, 13, 1678, 822, 903, 19244, 29918, 8977, 29898, 1311, 29892, 848, 1125, 13, 4706, 9995, 13, 4706, 8878, 8600, 393, 11053, 11000, 304, 5418, 1819, 13, 4706, 584, 3207, 848, 29901, 29871, 299, 2378, 286, 334, 313, 29885, 448, 29871, 29896, 876, 849, 29871, 29906, 763, 4133, 491, 282, 5721, 13, 4706, 584, 2457, 29901, 8600, 310, 5291, 2701, 13, 4706, 9995, 13, 4706, 515, 4256, 8504, 1053, 18240, 13, 4706, 515, 5016, 2272, 1053, 23858, 29892, 4505, 13, 13, 4706, 16317, 29918, 5344, 353, 7700, 13, 4706, 396, 3198, 565, 24610, 2307, 12833, 13, 4706, 565, 848, 29889, 299, 326, 1275, 29871, 29896, 29901, 13, 9651, 5101, 3538, 29918, 5721, 2925, 353, 518, 29875, 363, 474, 297, 848, 29962, 13, 13, 9651, 921, 353, 23858, 877, 29916, 1495, 13, 9651, 302, 353, 4505, 29898, 29916, 3579, 29871, 29906, 448, 921, 448, 29871, 29906, 29930, 1272, 29889, 12181, 29961, 29900, 2314, 29961, 29896, 29962, 13, 13, 9651, 16317, 29918, 5344, 353, 5852, 13, 13, 4706, 1683, 29901, 13, 9651, 5101, 3538, 29918, 5721, 2925, 353, 282, 5721, 29898, 1272, 29897, 13, 9651, 302, 353, 7431, 29898, 1272, 29897, 13, 13, 4706, 4145, 353, 1051, 29898, 510, 2109, 800, 4197, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 302, 29897, 1402, 29871, 29906, 876, 13, 4706, 1320, 29918, 8977, 353, 2322, 8977, 29898, 7411, 29897, 13, 13, 4706, 363, 5101, 29892, 1320, 297, 14319, 29898, 17743, 29892, 18784, 3538, 29918, 5721, 2925, 1125, 13, 9651, 1320, 29918, 8977, 29961, 18784, 29962, 353, 1320, 13, 13, 4706, 736, 1320, 29918, 8977, 29892, 16317, 29918, 5344, 13, 13, 1678, 822, 903, 21803, 29898, 1311, 29892, 19995, 29918, 8977, 1125, 13, 13, 4706, 363, 21556, 297, 1583, 29889, 2248, 29901, 13, 9651, 363, 12714, 297, 1583, 3032, 513, 1575, 29961, 2527, 10817, 5387, 13, 18884, 565, 12714, 297, 1583, 29889, 4905, 29918, 2176, 29889, 13099, 29889, 5975, 29901, 13, 462, 1678, 565, 12714, 297, 1583, 3032, 1195, 29918, 513, 1575, 29901, 13, 462, 4706, 995, 353, 1583, 29889, 4905, 29918, 2176, 29889, 2029, 29961, 1311, 29889, 4905, 29918, 2176, 29961, 16414, 1822, 13140, 1195, 580, 29962, 13, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 995, 353, 1583, 29889, 4905, 29918, 2176, 29889, 2029, 29961, 1311, 29889, 4905, 29918, 2176, 29961, 16414, 1822, 13140, 3317, 580, 29962, 13, 462, 1678, 19995, 29918, 8977, 29961, 16414, 29962, 353, 518, 1767, 29889, 978, 29892, 995, 29961, 16414, 5262, 13, 13, 4706, 736, 19995, 29918, 8977, 13, 13, 13, 13, 13, 1678, 822, 14707, 29898, 1311, 29892, 848, 1125, 13, 4706, 9995, 13, 4706, 27313, 6128, 1279, 936, 16993, 3241, 470, 476, 1004, 550, 16993, 3241, 373, 278, 848, 322, 8147, 278, 8845, 16285, 13, 4706, 584, 3207, 848, 29901, 1409, 29899, 4561, 29892, 302, 29918, 27736, 921, 302, 29918, 22100, 470, 29871, 29896, 29899, 29881, 766, 29764, 537, 1409, 13, 4706, 13373, 24541, 304, 9867, 13, 4706, 584, 2457, 29901, 2233, 5402, 791, 1203, 13, 4706, 9995, 13, 13, 4706, 4341, 353, 5159, 13, 4706, 363, 474, 297, 1583, 29889, 2248, 29901, 13, 9651, 4341, 353, 4341, 718, 1583, 3032, 513, 1575, 29961, 29875, 29962, 13, 4706, 1583, 29889, 4905, 29918, 2176, 353, 10518, 29889, 17271, 29898, 13, 9651, 2380, 29922, 3881, 29898, 1311, 29889, 1195, 29918, 29895, 29892, 1583, 29889, 3317, 29918, 29895, 718, 29871, 29896, 511, 13, 9651, 4341, 29922, 13099, 29892, 13, 9651, 26688, 29922, 9302, 29889, 7411, 29953, 29946, 13, 4706, 1723, 13, 4706, 396, 13441, 848, 304, 12655, 1409, 13, 4706, 848, 353, 7442, 29889, 2378, 29898, 1272, 29897, 13, 4706, 396, 4282, 8600, 411, 5101, 3538, 24610, 13, 4706, 24610, 29892, 16317, 29918, 5344, 353, 1583, 3032, 19244, 29918, 8977, 29898, 1272, 29897, 13, 13, 4706, 363, 21556, 297, 1583, 29889, 2248, 29901, 13, 9651, 363, 22645, 297, 1583, 3032, 513, 1575, 29961, 2527, 10817, 5387, 13, 18884, 565, 313, 29881, 790, 29918, 5344, 29897, 322, 313, 13140, 297, 1583, 3032, 13140, 29918, 19244, 29918, 5344, 1125, 13, 462, 1678, 1583, 29889, 4905, 29918, 2176, 353, 1583, 29889, 4905, 29918, 2176, 29889, 8865, 4197, 13140, 1402, 9685, 29922, 29896, 29897, 13, 13, 4706, 16993, 3241, 353, 2322, 8977, 29898, 8977, 29897, 13, 4706, 396, 8600, 411, 599, 2099, 1819, 310, 278, 21556, 363, 1432, 413, 13, 4706, 19995, 29918, 8977, 353, 2322, 8977, 29898, 1761, 29897, 13, 4706, 1583, 29889, 2798, 29918, 16957, 353, 2322, 8977, 29898, 524, 29897, 13, 4706, 2582, 353, 426, 29895, 29901, 6571, 363, 413, 297, 3464, 29898, 1311, 29889, 1195, 29918, 29895, 29892, 1583, 29889, 3317, 29918, 29895, 718, 29871, 29896, 2915, 13, 13, 4706, 396, 2048, 21503, 4314, 393, 4808, 278, 17203, 13, 13, 4706, 363, 413, 297, 3464, 29898, 1311, 29889, 1195, 29918, 29895, 29892, 1583, 29889, 3317, 29918, 29895, 718, 29871, 29896, 1125, 13, 9651, 363, 21556, 297, 1583, 29889, 2248, 29901, 13, 18884, 363, 22645, 297, 1583, 3032, 513, 1575, 29961, 2527, 10817, 5387, 13, 462, 1678, 565, 313, 29881, 790, 29918, 5344, 29897, 322, 313, 13140, 297, 1583, 3032, 13140, 29918, 19244, 29918, 5344, 1125, 13, 462, 4706, 6773, 13, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 2582, 29961, 29895, 3816, 13140, 29962, 353, 5159, 13, 4706, 565, 451, 738, 29898, 1311, 29889, 4905, 29918, 2176, 29889, 13099, 29889, 5975, 1125, 13, 9651, 12020, 29871, 7865, 2392, 877, 3782, 25778, 3624, 1641, 19030, 29889, 960, 1881, 292, 5418, 4636, 29892, 3113, 367, 9543, 393, 8073, 29892, 1060, 29933, 29892, 8073, 29890, 29893, 29892, 349, 29933, 29924, 322, 6535, 526, 451, 1950, 304, 8147, 29889, 1495, 13, 13, 4706, 565, 1583, 29889, 20567, 297, 6024, 1328, 742, 525, 14369, 742, 525, 8835, 742, 525, 12483, 482, 742, 525, 1760, 1007, 2033, 29901, 13, 9651, 1583, 29889, 29999, 353, 1544, 482, 29898, 1272, 29892, 1158, 29922, 1311, 29889, 20567, 29897, 13, 13, 13, 4706, 363, 413, 297, 3464, 29898, 1311, 29889, 1195, 29918, 29895, 29892, 1583, 29889, 3317, 29918, 29895, 718, 29871, 29896, 1125, 13, 13, 9651, 565, 1583, 29889, 20567, 297, 6024, 1328, 742, 525, 14369, 742, 525, 8835, 742, 525, 12483, 482, 742, 525, 1760, 1007, 2033, 29901, 13, 18884, 396, 23315, 263, 1051, 310, 278, 6128, 1279, 936, 24554, 13, 13, 18884, 396, 411, 5700, 29918, 8336, 13, 18884, 8877, 353, 5700, 29918, 8336, 29898, 1311, 29889, 29999, 29892, 302, 29918, 695, 504, 414, 29922, 29895, 29897, 13, 18884, 24554, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 16707, 29892, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1272, 876, 2314, 13, 18884, 1067, 29888, 353, 26206, 342, 23369, 1007, 580, 13, 13, 18884, 565, 451, 16317, 29918, 5344, 29901, 13, 462, 1678, 1018, 29901, 13, 462, 4706, 1067, 29888, 29889, 9202, 29898, 1272, 29892, 1051, 29898, 1524, 8504, 29889, 14153, 29889, 3166, 29918, 1524, 519, 29898, 16707, 4961, 13, 13, 462, 1678, 396, 361, 871, 697, 9867, 8429, 29892, 1018, 411, 285, 19594, 448, 445, 9559, 411, 1644, 1007, 13, 462, 1678, 5174, 7865, 2392, 408, 321, 29901, 13, 462, 4706, 565, 338, 8758, 29898, 29872, 29892, 7865, 2392, 1125, 13, 462, 9651, 8877, 353, 285, 19594, 29898, 1311, 29889, 29999, 29892, 260, 29922, 29895, 29892, 28770, 291, 2433, 3317, 695, 504, 1495, 13, 462, 9651, 24554, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 16707, 29892, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1272, 876, 2314, 13, 462, 9651, 1067, 29888, 29889, 9202, 29898, 1272, 29892, 1051, 29898, 1524, 8504, 29889, 14153, 29898, 16707, 4961, 13, 13, 462, 1678, 1644, 1007, 29879, 353, 1067, 29888, 29889, 1760, 1007, 29879, 29918, 13, 18884, 1683, 29901, 13, 462, 1678, 1644, 1007, 29879, 353, 6213, 13, 13, 13, 13, 9651, 25342, 1583, 29889, 20567, 1275, 525, 29895, 1004, 550, 2396, 13, 13, 18884, 565, 16317, 29918, 5344, 29901, 13, 462, 1678, 12020, 7865, 2392, 877, 29895, 29899, 1004, 550, 947, 451, 664, 411, 871, 5101, 3538, 24610, 408, 1881, 29889, 3529, 731, 1790, 5687, 29889, 1495, 13, 13, 18884, 8877, 353, 476, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 29895, 29892, 4036, 29918, 3859, 29922, 29900, 467, 9202, 29898, 1272, 29897, 13, 18884, 24554, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 16707, 29889, 21134, 3383, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1272, 876, 2314, 13, 18884, 1644, 1007, 29879, 353, 8877, 29889, 19594, 29918, 1760, 414, 29918, 13, 13, 9651, 1683, 29901, 13, 18884, 12020, 7865, 2392, 29898, 1311, 29889, 20567, 718, 525, 338, 451, 385, 22691, 16993, 3241, 5687, 29892, 3113, 6755, 320, 29915, 14369, 29905, 3788, 13, 462, 462, 462, 29871, 525, 320, 29915, 1328, 29905, 742, 320, 29915, 1760, 1007, 29905, 742, 320, 29915, 8835, 29905, 742, 320, 29915, 12483, 482, 20333, 470, 320, 29915, 29895, 1004, 550, 20333, 1495, 13, 13, 13, 9651, 396, 8600, 310, 16993, 3241, 310, 1269, 525, 29895, 742, 304, 367, 1304, 297, 7463, 8845, 13, 9651, 16993, 3241, 29961, 29895, 29962, 353, 11117, 695, 504, 414, 2396, 24554, 29892, 525, 1760, 1007, 29879, 2396, 1644, 1007, 29879, 29913, 13, 9651, 565, 313, 1311, 29889, 2248, 29961, 29900, 29962, 297, 6024, 497, 742, 525, 23176, 11287, 470, 313, 842, 29898, 1311, 29889, 2248, 467, 1639, 2042, 29898, 1311, 3032, 23176, 29918, 513, 1575, 22164, 13, 13, 18884, 396, 7029, 8845, 4331, 13, 18884, 363, 474, 297, 3464, 29898, 1311, 29889, 8704, 29918, 27736, 1125, 13, 462, 1678, 4559, 353, 4036, 29889, 11249, 29898, 1761, 29898, 1272, 511, 938, 29898, 29941, 847, 29871, 29946, 334, 7431, 29898, 1272, 4961, 13, 462, 1678, 396, 3198, 565, 18240, 526, 1781, 297, 1206, 310, 848, 1275, 5418, 4636, 13, 462, 1678, 565, 16317, 29918, 5344, 29901, 13, 462, 4706, 405, 29940, 353, 7431, 29898, 11249, 29897, 13, 462, 4706, 405, 353, 938, 29898, 755, 29889, 27696, 29898, 755, 29889, 3676, 29898, 10262, 29930, 29906, 4961, 13, 462, 4706, 4145, 353, 313, 29940, 16395, 29940, 29899, 29896, 29897, 458, 29906, 29897, 13, 462, 4706, 565, 4145, 2804, 405, 29940, 29901, 13, 462, 9651, 4559, 353, 4559, 7503, 17722, 6897, 29898, 17743, 448, 405, 29940, 28166, 13, 13, 462, 1678, 565, 1583, 29889, 20567, 297, 6024, 1328, 742, 525, 14369, 742, 525, 8835, 742, 525, 12483, 482, 742, 525, 1760, 1007, 2033, 29901, 13, 13, 462, 4706, 796, 29918, 11249, 353, 1544, 482, 29898, 11249, 29892, 1158, 29922, 1311, 29889, 20567, 29897, 13, 13, 462, 4706, 396, 695, 504, 414, 29918, 11249, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 29888, 19594, 29898, 29999, 29918, 11249, 29892, 260, 29922, 29895, 29892, 28770, 291, 2433, 3317, 695, 504, 5477, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 11249, 876, 2314, 13, 13, 462, 4706, 24554, 29918, 11249, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 7582, 29918, 8336, 29898, 29999, 29918, 11249, 29892, 413, 511, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 11249, 876, 2314, 13, 13, 462, 1678, 25342, 16317, 29918, 5344, 29901, 13, 462, 4706, 12020, 7865, 2392, 877, 29895, 29899, 1004, 550, 947, 451, 664, 411, 871, 5101, 3538, 24610, 408, 1881, 29889, 3529, 731, 1790, 5687, 29889, 1495, 13, 13, 462, 1678, 1683, 29901, 13, 462, 4706, 24554, 29918, 11249, 353, 1583, 3032, 19594, 29918, 513, 1575, 29898, 29968, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 29895, 29892, 4036, 29918, 3859, 29922, 29900, 467, 9202, 29898, 11249, 467, 21134, 3383, 518, 29875, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 11249, 876, 2314, 13, 13, 462, 1678, 7029, 353, 8147, 29918, 23176, 29898, 695, 504, 414, 29892, 24554, 29918, 11249, 29892, 16285, 29922, 1311, 29889, 2248, 29897, 13, 13, 462, 1678, 363, 1820, 29892, 12714, 297, 7029, 29889, 7076, 7295, 13, 462, 4706, 565, 313, 1989, 297, 1583, 29889, 2248, 29897, 470, 313, 1311, 29889, 2248, 1125, 13, 462, 9651, 2582, 29961, 29895, 3816, 1989, 1822, 4397, 29898, 16414, 29897, 13, 13, 4706, 565, 313, 1311, 29889, 2248, 29961, 29900, 29962, 297, 6024, 497, 742, 525, 7564, 11287, 470, 313, 842, 29898, 1311, 29889, 2248, 467, 1639, 2042, 29898, 1311, 3032, 7564, 29918, 513, 1575, 22164, 13, 9651, 396, 8600, 310, 5418, 1546, 11000, 310, 848, 3291, 29892, 321, 29889, 29887, 29892, 426, 29898, 18784, 29896, 29892, 18784, 29906, 29897, 584, 1320, 29898, 18784, 29896, 29892, 18784, 29906, 2915, 13, 13, 9651, 396, 7463, 8845, 4331, 13, 9651, 565, 16317, 29918, 5344, 29901, 13, 18884, 7463, 353, 8147, 29918, 7564, 29898, 695, 504, 3241, 29892, 848, 29922, 1272, 29892, 5418, 29918, 8977, 29922, 5721, 2925, 29892, 16285, 29922, 1839, 15633, 10262, 3788, 29903, 3788, 29928, 5963, 11287, 13, 9651, 1683, 29901, 13, 18884, 7463, 353, 8147, 29918, 7564, 29898, 695, 504, 3241, 29892, 848, 29922, 1272, 29892, 5418, 29918, 8977, 29922, 5721, 2925, 29892, 16285, 29922, 1311, 29889, 2248, 29897, 13, 13, 9651, 363, 274, 1403, 29892, 413, 29918, 695, 504, 297, 7463, 29889, 7076, 7295, 13, 18884, 363, 302, 29918, 29883, 29892, 659, 297, 413, 29918, 695, 504, 29889, 7076, 7295, 13, 462, 1678, 2582, 29961, 29876, 29918, 29883, 3816, 29883, 1403, 29962, 353, 659, 13, 13, 4706, 363, 413, 29892, 6611, 297, 2582, 29889, 7076, 7295, 13, 9651, 363, 1820, 29892, 995, 297, 6611, 29889, 7076, 7295, 13, 18884, 565, 1820, 297, 1583, 3032, 23176, 29918, 513, 1575, 29901, 13, 462, 1678, 1583, 29889, 4905, 29918, 2176, 29889, 2029, 29961, 29895, 29892, 1820, 29962, 353, 2099, 29898, 1767, 29897, 13, 13, 18884, 1683, 29901, 13, 462, 1678, 1583, 29889, 4905, 29918, 2176, 29889, 2029, 29961, 29895, 29892, 1820, 29962, 353, 995, 13, 13, 4706, 19995, 29918, 8977, 353, 1583, 3032, 21803, 29898, 1859, 1575, 29918, 8977, 29897, 13, 4706, 363, 1819, 297, 19995, 29918, 8977, 29889, 5975, 7295, 13, 9651, 1583, 29889, 2798, 29918, 16957, 29961, 710, 29898, 5975, 29961, 29900, 2314, 29962, 4619, 29871, 29896, 13, 13, 4706, 4236, 29918, 1767, 353, 29871, 29900, 13, 4706, 363, 1820, 29892, 995, 297, 1583, 29889, 2798, 29918, 16957, 29889, 7076, 7295, 13, 9651, 565, 995, 1405, 4236, 29918, 1767, 29901, 13, 18884, 4236, 29918, 1767, 353, 995, 13, 18884, 2186, 29918, 29895, 353, 1820, 13, 4706, 1583, 29889, 8394, 29918, 29895, 353, 938, 29898, 8394, 29918, 29895, 29897, 13, 13, 4706, 565, 1583, 29889, 20567, 297, 6024, 1328, 742, 525, 14369, 742, 525, 8835, 742, 525, 12483, 482, 742, 525, 1760, 1007, 2033, 29901, 13, 9651, 396, 1311, 29889, 8394, 29918, 695, 504, 414, 353, 285, 19594, 29898, 1311, 29889, 29999, 29892, 260, 29922, 1311, 29889, 8394, 29918, 29895, 29892, 28770, 291, 2433, 3317, 695, 504, 1495, 13, 9651, 1583, 29889, 8394, 29918, 695, 504, 414, 353, 7442, 29889, 535, 29883, 2579, 403, 29898, 9302, 29889, 294, 2378, 29898, 7582, 29918, 8336, 29898, 1311, 29889, 29999, 29892, 1583, 29889, 8394, 29918, 29895, 4961, 13, 4706, 1683, 29901, 13, 9651, 1583, 29889, 8394, 29918, 695, 504, 414, 353, 476, 6816, 550, 29898, 29876, 29918, 695, 504, 414, 29922, 1311, 29889, 8394, 29918, 29895, 29892, 4036, 29918, 3859, 29922, 29900, 467, 9202, 29898, 1272, 467, 21134, 29918, 13, 4706, 1583, 29889, 5426, 29918, 3888, 353, 1583, 29889, 2158, 29918, 9902, 580, 13, 13, 4706, 736, 1583, 13, 13, 1678, 822, 1596, 29918, 9902, 29898, 1311, 1125, 13, 4706, 14550, 13, 4706, 1596, 13173, 2472, 373, 278, 16993, 3241, 2582, 15997, 13, 4706, 584, 2457, 29901, 851, 411, 278, 2582, 13, 4706, 14550, 13, 13, 4706, 1962, 29918, 710, 353, 525, 29930, 3080, 12539, 1353, 310, 24554, 304, 1243, 29901, 525, 718, 851, 29898, 1311, 29889, 1195, 29918, 29895, 29897, 718, 11297, 29876, 29915, 13, 4706, 1962, 29918, 710, 4619, 525, 29930, 5918, 12539, 1353, 310, 24554, 304, 1243, 29901, 525, 718, 851, 29898, 1311, 29889, 3317, 29918, 29895, 29897, 718, 11297, 29876, 29915, 13, 4706, 1962, 29918, 710, 718, 2433, 29930, 9681, 310, 16087, 11916, 5759, 29901, 525, 718, 851, 29898, 1311, 29889, 8704, 29918, 27736, 29897, 718, 11297, 29876, 29915, 13, 4706, 1962, 29918, 710, 4619, 525, 29930, 2233, 504, 3241, 5687, 1304, 29901, 525, 718, 851, 29898, 1311, 29889, 20567, 29897, 718, 11297, 29876, 29915, 13, 13, 4706, 565, 1583, 29889, 2248, 451, 297, 6024, 497, 742, 525, 7564, 742, 525, 23176, 2033, 29901, 13, 9651, 22645, 353, 1051, 29898, 1311, 29889, 4905, 29918, 2176, 29889, 13099, 29889, 5975, 29897, 13, 4706, 1683, 29901, 13, 9651, 22645, 353, 1583, 29889, 2248, 13, 4706, 1962, 29918, 710, 718, 2433, 29905, 29876, 29930, 15758, 362, 1894, 1575, 12833, 29901, 525, 718, 851, 29898, 13140, 29897, 718, 11297, 29876, 29905, 29876, 29915, 13, 13, 13, 4706, 1962, 29918, 710, 718, 543, 29930, 17302, 599, 16285, 29901, 320, 29876, 29905, 29876, 29908, 13, 13, 4706, 1962, 29918, 710, 718, 2433, 29905, 29876, 29905, 29876, 29930, 7579, 304, 278, 13638, 5751, 29892, 278, 1900, 1353, 310, 24554, 338, 525, 718, 851, 29898, 1311, 29889, 8394, 29918, 29895, 29897, 718, 11297, 29876, 29905, 29876, 29905, 29876, 29915, 13, 13, 4706, 363, 413, 29918, 1949, 297, 12705, 29898, 1311, 29889, 2798, 29918, 16957, 1125, 13, 9651, 1962, 29918, 710, 718, 2433, 29930, 525, 718, 851, 29898, 1311, 29889, 2798, 29918, 16957, 29961, 29895, 29918, 1949, 2314, 718, 525, 7972, 525, 718, 413, 29918, 1949, 718, 525, 408, 278, 1900, 1353, 310, 24554, 320, 29876, 29905, 29876, 29915, 13, 13, 4706, 1962, 29918, 710, 718, 2433, 29905, 29873, 29905, 29873, 29905, 29873, 2328, 29930, 1281, 10085, 334, 2328, 29905, 29873, 29905, 29873, 29905, 29873, 29905, 29876, 29915, 13, 13, 4706, 396, 9323, 599, 12205, 13, 4706, 10518, 29889, 842, 29918, 3385, 877, 4990, 29889, 3317, 29918, 5727, 742, 6213, 29897, 13, 4706, 10518, 29889, 842, 29918, 3385, 877, 4990, 29889, 3317, 29918, 13099, 742, 6213, 29897, 13, 4706, 10518, 29889, 842, 29918, 3385, 877, 4990, 29889, 2103, 742, 6213, 29897, 13, 4706, 10518, 29889, 842, 29918, 3385, 877, 4990, 29889, 3317, 29918, 1054, 2103, 742, 6213, 29897, 13, 13, 4706, 1962, 29918, 710, 4619, 710, 29898, 1311, 29889, 4905, 29918, 2176, 29897, 718, 11297, 29876, 29915, 13, 13, 4706, 1962, 29918, 710, 718, 2433, 29905, 29876, 29930, 450, 1900, 8877, 338, 3583, 29876, 29915, 13, 4706, 1962, 29918, 710, 4619, 710, 29898, 1311, 29889, 8394, 29918, 695, 504, 414, 29897, 718, 11297, 29876, 29915, 13, 13, 4706, 736, 1962, 29918, 710, 13, 13, 1678, 822, 903, 15807, 403, 29918, 29881, 355, 307, 1393, 29898, 1311, 29892, 11073, 29922, 8516, 1125, 13, 4706, 14550, 13, 4706, 20535, 403, 270, 355, 307, 1393, 363, 1203, 1544, 482, 3234, 13, 4706, 584, 3207, 11073, 29901, 1409, 29899, 4561, 29892, 8267, 29871, 29896, 921, 7431, 29898, 1272, 29889, 12181, 29961, 29900, 2314, 13, 4706, 584, 2457, 29901, 270, 355, 307, 1393, 13, 4706, 14550, 13, 13, 4706, 270, 355, 353, 270, 355, 307, 1393, 29898, 13, 13, 9651, 1583, 29889, 29999, 29892, 13, 9651, 396, 21022, 403, 29918, 8513, 353, 525, 4230, 29886, 742, 13, 9651, 396, 282, 29922, 29953, 29892, 13, 9651, 20447, 29918, 5450, 362, 29922, 29929, 29900, 1696, 29871, 396, 5731, 1078, 278, 921, 9685, 11073, 13, 9651, 20447, 29918, 5657, 29918, 2311, 29922, 29896, 29900, 29892, 29871, 396, 4079, 2159, 363, 278, 921, 9685, 11073, 13, 9651, 11073, 29922, 21134, 13, 4706, 1723, 13, 13, 4706, 736, 270, 355, 13, 13, 1678, 822, 6492, 29898, 1311, 29892, 11073, 29922, 8516, 1125, 13, 4706, 14550, 13, 4706, 1596, 278, 6128, 1279, 936, 16993, 3241, 270, 355, 307, 1393, 773, 22889, 13, 4706, 584, 2457, 29901, 22889, 1967, 310, 270, 355, 307, 1393, 13, 4706, 14550, 13, 13, 4706, 2537, 353, 14770, 29889, 4532, 29898, 1003, 2311, 7607, 29946, 29900, 29892, 29871, 29906, 29900, 876, 13, 4706, 14770, 29889, 3257, 877, 29950, 631, 1279, 936, 2233, 504, 3241, 360, 355, 307, 1393, 448, 6645, 482, 29901, 1273, 29879, 29892, 4737, 10817, 29901, 1273, 29879, 29915, 1273, 313, 1311, 29889, 20567, 29892, 851, 29898, 1311, 29889, 2248, 8243, 13, 462, 29871, 4079, 2311, 29922, 29941, 29900, 29897, 13, 4706, 14770, 29889, 29916, 1643, 877, 1272, 1298, 2380, 742, 3858, 8305, 29922, 29906, 29900, 29892, 4079, 2311, 29922, 29941, 29900, 29897, 13, 4706, 14770, 29889, 29891, 1643, 877, 19244, 742, 3858, 8305, 29922, 29896, 29900, 29892, 4079, 2311, 29922, 29941, 29900, 29897, 13, 4706, 14770, 29889, 486, 7358, 29898, 2311, 29922, 29946, 29900, 29897, 13, 4706, 14770, 29889, 3637, 7358, 29898, 2311, 29922, 29946, 29900, 29897, 13, 4706, 1583, 3032, 15807, 403, 29918, 29881, 355, 307, 1393, 29898, 21134, 29897, 13, 13, 4706, 14770, 29889, 4294, 580, 13, 13, 2 ]
auth-api/src/auth_api/resources/org_products.py
severinbeauvais/sbc-auth
0
273
<gh_stars>0 # Copyright © 2019 Province of British Columbia # # 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. """API endpoints for managing an Org resource.""" from flask import request from flask_restplus import Namespace, Resource, cors from auth_api import status as http_status from auth_api.exceptions import BusinessException from auth_api.jwt_wrapper import JWTWrapper from auth_api.schemas import ProductSubscriptionSchema from auth_api.schemas import utils as schema_utils from auth_api.services import Product as ProductService from auth_api.tracer import Tracer from auth_api.utils.roles import Role from auth_api.utils.util import cors_preflight API = Namespace('products', description='Endpoints for products management') TRACER = Tracer.get_instance() _JWT = JWTWrapper.get_instance() @cors_preflight('GET,POST,OPTIONS') @API.route('', methods=['GET', 'POST', 'OPTIONS']) class OrgProducts(Resource): """Resource for managing product subscriptions.""" @staticmethod @TRACER.trace() @cors.crossdomain(origin='*') @_JWT.has_one_of_roles([Role.STAFF_CREATE_ACCOUNTS.value]) def post(org_id): """Post a new product subscription to the org using the request body.""" request_json = request.get_json() valid_format, errors = schema_utils.validate(request_json, 'org_product_subscription') if not valid_format: return {'message': schema_utils.serialize(errors)}, http_status.HTTP_400_BAD_REQUEST try: subscriptions = ProductService.create_product_subscription(org_id, request_json) if subscriptions is None: response, status = {'message': 'Not authorized to perform this action'}, \ http_status.HTTP_401_UNAUTHORIZED else: response, status = {'subscriptions': ProductSubscriptionSchema().dump(subscriptions, many=True)}, \ http_status.HTTP_201_CREATED except BusinessException as exception: response, status = {'code': exception.code, 'message': exception.message}, exception.status_code return response, status
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14187, 1266, 29871, 30211, 29871, 29906, 29900, 29896, 29929, 17325, 310, 4908, 15411, 13, 29937, 13, 29937, 10413, 21144, 1090, 278, 13380, 19245, 29892, 10079, 29871, 29906, 29889, 29900, 313, 1552, 525, 29931, 293, 1947, 2157, 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, 525, 3289, 8519, 29915, 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, 8787, 1095, 9748, 363, 767, 6751, 385, 1394, 29887, 6503, 1213, 15945, 13, 13, 3166, 29784, 1053, 2009, 13, 3166, 29784, 29918, 5060, 11242, 1053, 14706, 3535, 29892, 18981, 29892, 27672, 13, 13, 3166, 4817, 29918, 2754, 1053, 4660, 408, 1732, 29918, 4882, 13, 3166, 4817, 29918, 2754, 29889, 11739, 29879, 1053, 15197, 2451, 13, 3166, 4817, 29918, 2754, 29889, 29926, 14554, 29918, 17699, 1053, 435, 17755, 15646, 13, 3166, 4817, 29918, 2754, 29889, 11993, 1053, 10969, 4035, 22371, 12763, 13, 3166, 4817, 29918, 2754, 29889, 11993, 1053, 3667, 29879, 408, 10938, 29918, 13239, 13, 3166, 4817, 29918, 2754, 29889, 9916, 1053, 10969, 408, 10969, 3170, 13, 3166, 4817, 29918, 2754, 29889, 29873, 945, 261, 1053, 323, 945, 261, 13, 3166, 4817, 29918, 2754, 29889, 13239, 29889, 307, 793, 1053, 1528, 280, 13, 3166, 4817, 29918, 2754, 29889, 13239, 29889, 4422, 1053, 27672, 29918, 29886, 999, 4366, 13, 13, 13, 8787, 353, 14706, 3535, 877, 14456, 742, 6139, 2433, 5044, 9748, 363, 9316, 10643, 1495, 13, 5659, 2477, 1001, 353, 323, 945, 261, 29889, 657, 29918, 8758, 580, 13, 29918, 29967, 17755, 353, 435, 17755, 15646, 29889, 657, 29918, 8758, 580, 13, 13, 13, 29992, 29883, 943, 29918, 29886, 999, 4366, 877, 7194, 29892, 5438, 29892, 14094, 27946, 1495, 13, 29992, 8787, 29889, 13134, 877, 742, 3519, 29922, 1839, 7194, 742, 525, 5438, 742, 525, 14094, 27946, 11287, 13, 1990, 1394, 29887, 25767, 29898, 6848, 1125, 13, 1678, 9995, 6848, 363, 767, 6751, 3234, 21696, 1980, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 732, 5659, 2477, 1001, 29889, 15003, 580, 13, 1678, 732, 29883, 943, 29889, 19128, 7247, 29898, 12574, 2433, 29930, 1495, 13, 1678, 732, 29918, 29967, 17755, 29889, 5349, 29918, 650, 29918, 974, 29918, 307, 793, 4197, 16727, 29889, 1254, 29909, 4198, 29918, 27045, 29918, 2477, 3217, 3904, 9375, 29889, 1767, 2314, 13, 1678, 822, 1400, 29898, 990, 29918, 333, 1125, 13, 4706, 9995, 6747, 263, 716, 3234, 25691, 304, 278, 1638, 773, 278, 2009, 3573, 1213, 15945, 13, 4706, 2009, 29918, 3126, 353, 2009, 29889, 657, 29918, 3126, 580, 13, 4706, 2854, 29918, 4830, 29892, 4436, 353, 10938, 29918, 13239, 29889, 15480, 29898, 3827, 29918, 3126, 29892, 525, 990, 29918, 4704, 29918, 1491, 22371, 1495, 13, 4706, 565, 451, 2854, 29918, 4830, 29901, 13, 9651, 736, 11117, 4906, 2396, 10938, 29918, 13239, 29889, 643, 6646, 29898, 12523, 19230, 1732, 29918, 4882, 29889, 10493, 29918, 29946, 29900, 29900, 29918, 29933, 3035, 29918, 16244, 13, 13, 4706, 1018, 29901, 13, 9651, 21696, 1980, 353, 10969, 3170, 29889, 3258, 29918, 4704, 29918, 1491, 22371, 29898, 990, 29918, 333, 29892, 2009, 29918, 3126, 29897, 13, 9651, 565, 21696, 1980, 338, 6213, 29901, 13, 18884, 2933, 29892, 4660, 353, 11117, 4906, 2396, 525, 3664, 4148, 1891, 304, 2189, 445, 3158, 16675, 320, 13, 462, 462, 259, 1732, 29918, 4882, 29889, 10493, 29918, 29946, 29900, 29896, 29918, 29965, 3521, 2692, 29950, 1955, 26664, 3352, 13, 9651, 1683, 29901, 13, 18884, 2933, 29892, 4660, 353, 11117, 1491, 7588, 1980, 2396, 10969, 4035, 22371, 12763, 2141, 15070, 29898, 1491, 7588, 1980, 29892, 1784, 29922, 5574, 19230, 320, 13, 462, 462, 259, 1732, 29918, 4882, 29889, 10493, 29918, 29906, 29900, 29896, 29918, 27045, 29928, 13, 4706, 5174, 15197, 2451, 408, 3682, 29901, 13, 9651, 2933, 29892, 4660, 353, 11117, 401, 2396, 3682, 29889, 401, 29892, 525, 4906, 2396, 3682, 29889, 4906, 1118, 3682, 29889, 4882, 29918, 401, 13, 4706, 736, 2933, 29892, 4660, 13, 2 ]
tests/game_utils_test.py
TylerYep/wolfbot
3
102079
<gh_stars>1-10 import pytest from tests.conftest import override_input, verify_output_string from wolfbot.enums import Role from wolfbot.game_utils import ( find_all_player_indices, get_center, get_numeric_input, get_player, print_roles, swap_characters, ) class TestPrintRoles: """Tests for the print_roles function.""" @staticmethod def test_print_roles( caplog: pytest.LogCaptureFixture, small_game_roles: tuple[Role, ...] ) -> None: """Correctly print and format roles.""" shuffled_roles = [Role.SEER, Role.VILLAGER, Role.WOLF, Role.ROBBER] print_roles(shuffled_roles, "Hidden") expected = ( "[Hidden] Player roles: [Seer, Villager, Wolf]\n" f"{' ' * 9}Center cards: [Robber]\n" ) verify_output_string(caplog, expected) @staticmethod def test_print_wolfbot_guesses( caplog: pytest.LogCaptureFixture, medium_game_roles: tuple[Role, ...] ) -> None: """Correctly print and format roles.""" print_roles(medium_game_roles, "WolfBot") expected = ( "[WolfBot] Player roles: [Robber, Drunk, Wolf, Troublemaker, Seer]\n" " Center cards: [Minion]\n" ) verify_output_string(caplog, expected) class TestSwapCharacters: """Tests for the swap_characters function.""" @staticmethod def test_same_index_error(small_game_roles: tuple[Role, ...]) -> None: """Don't attempt to swap the same index.""" with pytest.raises(RuntimeError): swap_characters(list(small_game_roles), 2, 2) @staticmethod def test_swap(small_game_roles: tuple[Role, ...]) -> None: """Correctly swap two players.""" roles = list(small_game_roles) swap_characters(roles, 0, 2) assert roles == [Role.ROBBER, Role.SEER, Role.VILLAGER] class TestFindAllPlayerIndices: """Tests for the find_all_player_indices function.""" @staticmethod def test_returns_correct_indices(large_game_roles: tuple[Role, ...]) -> None: """Don't attempt to swap the same index.""" result = find_all_player_indices(large_game_roles, Role.VILLAGER) assert result == (1, 4, 11) class TestGetPlayer: """Tests for the get_player function.""" @staticmethod def test_generates_random_indices(large_game_roles: tuple[Role, ...]) -> None: """Generated indices should be random.""" result = [get_player(is_user=False) for _ in range(10)] assert result == [6, 6, 0, 4, 8, 7, 6, 4, 7, 5] @staticmethod def test_random_excludes_values(large_game_roles: tuple[Role, ...]) -> None: """Generated indices should exclude specified values.""" exclude = (6, 7, 8) result = [get_player(is_user=False, exclude=exclude) for _ in range(10)] assert not set(result).intersection(exclude) assert result == [9, 9, 0, 4, 11, 10, 9, 4, 10, 5] @staticmethod def test_user_input_indices( monkeypatch: pytest.MonkeyPatch, large_game_roles: tuple[Role, ...] ) -> None: """Generated indices should be random.""" inputs = [0, 2, 20, 1] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_player(is_user=True) for _ in range(3)] assert result == [0, 2, 1] @staticmethod def test_user_excludes_values( monkeypatch: pytest.MonkeyPatch, large_game_roles: tuple[Role, ...] ) -> None: """Generated indices should exclude specified values.""" exclude = (6, 7, 8) inputs = [0, 20, 4, 7, 5, 6] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_player(is_user=True, exclude=exclude) for _ in range(3)] assert not set(result).intersection(exclude) assert result == [0, 4, 5] class TestGetCenter: """Tests for the get_center function.""" @staticmethod def test_generates_random_indices(large_game_roles: tuple[Role, ...]) -> None: """Generated indices should be random.""" result = [get_center(is_user=False) for _ in range(10)] assert result == [13, 13, 12, 13, 14, 13, 13, 13, 13, 13] @staticmethod def test_excludes_values(large_game_roles: tuple[str, ...]) -> None: """Generated indices should exclude specified values.""" exclude = (12, 13) result = [get_center(is_user=False, exclude=exclude) for _ in range(10)] assert not set(result).intersection(exclude) assert result == [14] * 10 @staticmethod def test_user_center_indices( monkeypatch: pytest.MonkeyPatch, large_game_roles: tuple[Role, ...] ) -> None: """Generated indices should be random.""" inputs = [1, 2, 0, 2] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_center(is_user=True) for _ in range(3)] assert result == [13, 14, 12] @staticmethod def test_user_excludes_values( monkeypatch: pytest.MonkeyPatch, large_game_roles: tuple[Role, ...] ) -> None: """Generated indices should exclude specified values.""" exclude = (12, 13) inputs = [2, 0, 4, 1, 2, 2] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_center(is_user=True, exclude=exclude) for _ in range(3)] assert not set(result).intersection(exclude) assert result == [14] * 3 class TestGetNumericInput: """Tests for the get_numeric_input function.""" @staticmethod def test_numeric_input(monkeypatch: pytest.MonkeyPatch) -> None: """Generated indices should be random.""" inputs = [1, 7, 10, 15, 2, 0] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_numeric_input(10) for _ in range(4)] assert result == [1, 7, 2, 0] @staticmethod def test_numeric_input_range(monkeypatch: pytest.MonkeyPatch) -> None: """Generated indices should be random.""" inputs = [1, 37, 30, 34, 0, 33] monkeypatch.setattr("builtins.input", override_input([str(i) for i in inputs])) result = [get_numeric_input(30, 34) for _ in range(2)] assert result == [30, 33]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 5215, 11451, 1688, 13, 13, 3166, 6987, 29889, 535, 615, 342, 1053, 5712, 29918, 2080, 29892, 11539, 29918, 4905, 29918, 1807, 13, 3166, 281, 4369, 7451, 29889, 264, 6762, 1053, 1528, 280, 13, 3166, 281, 4369, 7451, 29889, 11802, 29918, 13239, 1053, 313, 13, 1678, 1284, 29918, 497, 29918, 9106, 29918, 513, 1575, 29892, 13, 1678, 679, 29918, 5064, 29892, 13, 1678, 679, 29918, 21574, 29918, 2080, 29892, 13, 1678, 679, 29918, 9106, 29892, 13, 1678, 1596, 29918, 307, 793, 29892, 13, 1678, 17945, 29918, 3090, 21706, 29892, 13, 29897, 13, 13, 13, 1990, 4321, 11816, 29934, 6544, 29901, 13, 1678, 9995, 24376, 363, 278, 1596, 29918, 307, 793, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 2158, 29918, 307, 793, 29898, 13, 4706, 2117, 1188, 29901, 11451, 1688, 29889, 3403, 21133, 545, 18800, 15546, 29892, 2319, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 12521, 1621, 368, 1596, 322, 3402, 16178, 1213, 15945, 13, 4706, 528, 3096, 839, 29918, 307, 793, 353, 518, 16727, 29889, 1660, 1001, 29892, 1528, 280, 29889, 18118, 2208, 10051, 1001, 29892, 1528, 280, 29889, 29956, 5607, 29943, 29892, 1528, 280, 29889, 1672, 29933, 13635, 29962, 13, 13, 4706, 1596, 29918, 307, 793, 29898, 845, 3096, 839, 29918, 307, 793, 29892, 376, 25108, 1159, 13, 13, 4706, 3806, 353, 313, 13, 9651, 14704, 25108, 29962, 14574, 16178, 29901, 518, 2008, 261, 29892, 9887, 1875, 29892, 10441, 10725, 29876, 29908, 13, 9651, 285, 29908, 10998, 525, 334, 29871, 29929, 29913, 13409, 15889, 29901, 518, 21860, 495, 10725, 29876, 29908, 13, 4706, 1723, 13, 4706, 11539, 29918, 4905, 29918, 1807, 29898, 5030, 1188, 29892, 3806, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 2158, 29918, 29893, 4369, 7451, 29918, 2543, 15322, 29898, 13, 4706, 2117, 1188, 29901, 11451, 1688, 29889, 3403, 21133, 545, 18800, 15546, 29892, 18350, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 12521, 1621, 368, 1596, 322, 3402, 16178, 1213, 15945, 13, 4706, 1596, 29918, 307, 793, 29898, 27891, 29918, 11802, 29918, 307, 793, 29892, 376, 29956, 4369, 29933, 327, 1159, 13, 13, 4706, 3806, 353, 313, 13, 9651, 14704, 29956, 4369, 29933, 327, 29962, 14574, 16178, 29901, 518, 21860, 495, 29892, 4942, 2960, 29892, 10441, 29892, 1605, 283, 1031, 5790, 29892, 922, 261, 10725, 29876, 29908, 13, 9651, 376, 3986, 7817, 15889, 29901, 518, 8140, 291, 10725, 29876, 29908, 13, 4706, 1723, 13, 4706, 11539, 29918, 4905, 29918, 1807, 29898, 5030, 1188, 29892, 3806, 29897, 13, 13, 13, 1990, 4321, 10840, 481, 5914, 21706, 29901, 13, 1678, 9995, 24376, 363, 278, 17945, 29918, 3090, 21706, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 17642, 29918, 2248, 29918, 2704, 29898, 9278, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 10310, 29915, 29873, 4218, 304, 17945, 278, 1021, 2380, 1213, 15945, 13, 4706, 411, 11451, 1688, 29889, 336, 4637, 29898, 7944, 2392, 1125, 13, 9651, 17945, 29918, 3090, 21706, 29898, 1761, 29898, 9278, 29918, 11802, 29918, 307, 793, 511, 29871, 29906, 29892, 29871, 29906, 29897, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 26276, 29898, 9278, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 12521, 1621, 368, 17945, 1023, 10769, 1213, 15945, 13, 4706, 16178, 353, 1051, 29898, 9278, 29918, 11802, 29918, 307, 793, 29897, 13, 13, 4706, 17945, 29918, 3090, 21706, 29898, 307, 793, 29892, 29871, 29900, 29892, 29871, 29906, 29897, 13, 13, 4706, 4974, 16178, 1275, 518, 16727, 29889, 1672, 29933, 13635, 29892, 1528, 280, 29889, 1660, 1001, 29892, 1528, 280, 29889, 18118, 2208, 10051, 1001, 29962, 13, 13, 13, 1990, 4321, 12542, 3596, 9075, 2568, 1575, 29901, 13, 1678, 9995, 24376, 363, 278, 1284, 29918, 497, 29918, 9106, 29918, 513, 1575, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 18280, 29918, 15728, 29918, 513, 1575, 29898, 16961, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 10310, 29915, 29873, 4218, 304, 17945, 278, 1021, 2380, 1213, 15945, 13, 4706, 1121, 353, 1284, 29918, 497, 29918, 9106, 29918, 513, 1575, 29898, 16961, 29918, 11802, 29918, 307, 793, 29892, 1528, 280, 29889, 18118, 2208, 10051, 1001, 29897, 13, 13, 4706, 4974, 1121, 1275, 313, 29896, 29892, 29871, 29946, 29892, 29871, 29896, 29896, 29897, 13, 13, 13, 1990, 4321, 2577, 9075, 29901, 13, 1678, 9995, 24376, 363, 278, 679, 29918, 9106, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 4738, 1078, 29918, 8172, 29918, 513, 1575, 29898, 16961, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 1121, 353, 518, 657, 29918, 9106, 29898, 275, 29918, 1792, 29922, 8824, 29897, 363, 903, 297, 3464, 29898, 29896, 29900, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29953, 29892, 29871, 29953, 29892, 29871, 29900, 29892, 29871, 29946, 29892, 29871, 29947, 29892, 29871, 29955, 29892, 29871, 29953, 29892, 29871, 29946, 29892, 29871, 29955, 29892, 29871, 29945, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 8172, 29918, 735, 27722, 29918, 5975, 29898, 16961, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 19060, 6790, 1819, 1213, 15945, 13, 4706, 19060, 353, 313, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29897, 13, 13, 4706, 1121, 353, 518, 657, 29918, 9106, 29898, 275, 29918, 1792, 29922, 8824, 29892, 19060, 29922, 735, 2325, 29897, 363, 903, 297, 3464, 29898, 29896, 29900, 4638, 13, 13, 4706, 4974, 451, 731, 29898, 2914, 467, 1639, 2042, 29898, 735, 2325, 29897, 13, 4706, 4974, 1121, 1275, 518, 29929, 29892, 29871, 29929, 29892, 29871, 29900, 29892, 29871, 29946, 29892, 29871, 29896, 29896, 29892, 29871, 29896, 29900, 29892, 29871, 29929, 29892, 29871, 29946, 29892, 29871, 29896, 29900, 29892, 29871, 29945, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 1792, 29918, 2080, 29918, 513, 1575, 29898, 13, 4706, 1601, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29892, 2919, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 10970, 353, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29906, 29900, 29892, 29871, 29896, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 9106, 29898, 275, 29918, 1792, 29922, 5574, 29897, 363, 903, 297, 3464, 29898, 29941, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29900, 29892, 29871, 29906, 29892, 29871, 29896, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 1792, 29918, 735, 27722, 29918, 5975, 29898, 13, 4706, 1601, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29892, 2919, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 19060, 6790, 1819, 1213, 15945, 13, 4706, 19060, 353, 313, 29953, 29892, 29871, 29955, 29892, 29871, 29947, 29897, 13, 4706, 10970, 353, 518, 29900, 29892, 29871, 29906, 29900, 29892, 29871, 29946, 29892, 29871, 29955, 29892, 29871, 29945, 29892, 29871, 29953, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 9106, 29898, 275, 29918, 1792, 29922, 5574, 29892, 19060, 29922, 735, 2325, 29897, 363, 903, 297, 3464, 29898, 29941, 4638, 13, 13, 4706, 4974, 451, 731, 29898, 2914, 467, 1639, 2042, 29898, 735, 2325, 29897, 13, 4706, 4974, 1121, 1275, 518, 29900, 29892, 29871, 29946, 29892, 29871, 29945, 29962, 13, 13, 13, 1990, 4321, 2577, 13409, 29901, 13, 1678, 9995, 24376, 363, 278, 679, 29918, 5064, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 4738, 1078, 29918, 8172, 29918, 513, 1575, 29898, 16961, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 1121, 353, 518, 657, 29918, 5064, 29898, 275, 29918, 1792, 29922, 8824, 29897, 363, 903, 297, 3464, 29898, 29896, 29900, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29896, 29941, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29906, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29941, 29892, 29871, 29896, 29941, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 735, 27722, 29918, 5975, 29898, 16961, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 710, 29892, 2023, 2314, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 19060, 6790, 1819, 1213, 15945, 13, 4706, 19060, 353, 313, 29896, 29906, 29892, 29871, 29896, 29941, 29897, 13, 13, 4706, 1121, 353, 518, 657, 29918, 5064, 29898, 275, 29918, 1792, 29922, 8824, 29892, 19060, 29922, 735, 2325, 29897, 363, 903, 297, 3464, 29898, 29896, 29900, 4638, 13, 13, 4706, 4974, 451, 731, 29898, 2914, 467, 1639, 2042, 29898, 735, 2325, 29897, 13, 4706, 4974, 1121, 1275, 518, 29896, 29946, 29962, 334, 29871, 29896, 29900, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 1792, 29918, 5064, 29918, 513, 1575, 29898, 13, 4706, 1601, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29892, 2919, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 10970, 353, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29900, 29892, 29871, 29906, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 5064, 29898, 275, 29918, 1792, 29922, 5574, 29897, 363, 903, 297, 3464, 29898, 29941, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29896, 29941, 29892, 29871, 29896, 29946, 29892, 29871, 29896, 29906, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 1792, 29918, 735, 27722, 29918, 5975, 29898, 13, 4706, 1601, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29892, 2919, 29918, 11802, 29918, 307, 793, 29901, 18761, 29961, 16727, 29892, 2023, 29962, 13, 1678, 1723, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 19060, 6790, 1819, 1213, 15945, 13, 4706, 19060, 353, 313, 29896, 29906, 29892, 29871, 29896, 29941, 29897, 13, 4706, 10970, 353, 518, 29906, 29892, 29871, 29900, 29892, 29871, 29946, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29906, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 5064, 29898, 275, 29918, 1792, 29922, 5574, 29892, 19060, 29922, 735, 2325, 29897, 363, 903, 297, 3464, 29898, 29941, 4638, 13, 13, 4706, 4974, 451, 731, 29898, 2914, 467, 1639, 2042, 29898, 735, 2325, 29897, 13, 4706, 4974, 1121, 1275, 518, 29896, 29946, 29962, 334, 29871, 29941, 13, 13, 13, 1990, 4321, 2577, 29940, 25099, 4290, 29901, 13, 1678, 9995, 24376, 363, 278, 679, 29918, 21574, 29918, 2080, 740, 1213, 15945, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 21574, 29918, 2080, 29898, 3712, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29897, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 10970, 353, 518, 29896, 29892, 29871, 29955, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29945, 29892, 29871, 29906, 29892, 29871, 29900, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 21574, 29918, 2080, 29898, 29896, 29900, 29897, 363, 903, 297, 3464, 29898, 29946, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29896, 29892, 29871, 29955, 29892, 29871, 29906, 29892, 29871, 29900, 29962, 13, 13, 1678, 732, 7959, 5696, 13, 1678, 822, 1243, 29918, 21574, 29918, 2080, 29918, 3881, 29898, 3712, 446, 1478, 905, 29901, 11451, 1688, 29889, 7185, 1989, 29925, 905, 29897, 1599, 6213, 29901, 13, 4706, 9995, 24565, 16285, 881, 367, 4036, 1213, 15945, 13, 4706, 10970, 353, 518, 29896, 29892, 29871, 29941, 29955, 29892, 29871, 29941, 29900, 29892, 29871, 29941, 29946, 29892, 29871, 29900, 29892, 29871, 29941, 29941, 29962, 13, 4706, 1601, 446, 1478, 905, 29889, 842, 5552, 703, 16145, 1144, 29889, 2080, 613, 5712, 29918, 2080, 4197, 710, 29898, 29875, 29897, 363, 474, 297, 10970, 12622, 13, 13, 4706, 1121, 353, 518, 657, 29918, 21574, 29918, 2080, 29898, 29941, 29900, 29892, 29871, 29941, 29946, 29897, 363, 903, 297, 3464, 29898, 29906, 4638, 13, 13, 4706, 4974, 1121, 1275, 518, 29941, 29900, 29892, 29871, 29941, 29941, 29962, 13, 2 ]
Algorithms/5_Searching/11.py
abphilip-codes/Hackerrank_DSA
1
39374
<filename>Algorithms/5_Searching/11.py # https://www.hackerrank.com/challenges/short-palindrome/problem #!/bin/python3 import math import os import random import re import sys # # Complete the 'shortPalindrome' function below. # # The function is expected to return an INTEGER. # The function accepts STRING s as parameter. # def shortPalindrome(s): ans = mod = 10**9 + 7 a = [0] * 26 ** 1 b = [0] * 26 ** 2 c = [0] * 26 ** 3 for z in s: k = ord(z)-97 x = 26*k-1 y = k-26 for w in range(26): y+=26 x+=1 ans+=c[y] c[x]+=b[x] b[x]+=a[w] a[k]+=1 return ans%mod if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') s = input() result = shortPalindrome(s) fptr.write(str(result) + '\n') fptr.close()
[ 1, 529, 9507, 29958, 22461, 12404, 29914, 29945, 29918, 7974, 292, 29914, 29896, 29896, 29889, 2272, 13, 29937, 2045, 597, 1636, 29889, 29882, 28940, 10003, 29889, 510, 29914, 305, 16047, 267, 29914, 12759, 29899, 7830, 513, 4871, 29914, 17199, 13, 13, 29937, 14708, 2109, 29914, 4691, 29941, 13, 13, 5215, 5844, 13, 5215, 2897, 13, 5215, 4036, 13, 5215, 337, 13, 5215, 10876, 13, 13, 29937, 13, 29937, 25034, 278, 525, 12759, 18210, 513, 4871, 29915, 740, 2400, 29889, 13, 29937, 13, 29937, 450, 740, 338, 3806, 304, 736, 385, 2672, 4330, 17070, 29889, 13, 29937, 450, 740, 21486, 29486, 4214, 269, 408, 3443, 29889, 13, 29937, 13, 13, 1753, 3273, 18210, 513, 4871, 29898, 29879, 1125, 13, 1678, 6063, 353, 878, 353, 29871, 29896, 29900, 1068, 29929, 718, 29871, 29955, 13, 1678, 263, 353, 518, 29900, 29962, 334, 29871, 29906, 29953, 3579, 29871, 29896, 13, 1678, 289, 353, 518, 29900, 29962, 334, 29871, 29906, 29953, 3579, 29871, 29906, 13, 1678, 274, 353, 518, 29900, 29962, 334, 29871, 29906, 29953, 3579, 29871, 29941, 13, 1678, 363, 503, 297, 269, 29901, 13, 4706, 413, 353, 4356, 29898, 29920, 6817, 29929, 29955, 13, 4706, 921, 353, 29871, 29906, 29953, 29930, 29895, 29899, 29896, 13, 4706, 343, 353, 413, 29899, 29906, 29953, 13, 4706, 363, 281, 297, 3464, 29898, 29906, 29953, 1125, 13, 9651, 343, 23661, 29906, 29953, 13, 9651, 921, 23661, 29896, 13, 9651, 6063, 23661, 29883, 29961, 29891, 29962, 13, 9651, 274, 29961, 29916, 10062, 29922, 29890, 29961, 29916, 29962, 13, 9651, 289, 29961, 29916, 10062, 29922, 29874, 29961, 29893, 29962, 13, 4706, 263, 29961, 29895, 10062, 29922, 29896, 13, 1678, 736, 6063, 29995, 1545, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 285, 7414, 353, 1722, 29898, 359, 29889, 21813, 1839, 12015, 12336, 29918, 10145, 7464, 525, 29893, 1495, 13, 13, 1678, 269, 353, 1881, 580, 13, 13, 1678, 1121, 353, 3273, 18210, 513, 4871, 29898, 29879, 29897, 13, 13, 1678, 285, 7414, 29889, 3539, 29898, 710, 29898, 2914, 29897, 718, 11297, 29876, 1495, 13, 13, 1678, 285, 7414, 29889, 5358, 580, 2 ]
simulator/thruster_plotter.py
ErikRowe/Bachelor-E2205
1
48935
<reponame>ErikRowe/Bachelor-E2205 from mpl_toolkits.mplot3d import Axes3D import numpy as np import matplotlib.pyplot as plt lengths = np.array([ [0.156, 0.111, 0.085], [0.156, -0.111, 0.085], [-0.156, 0.111, 0.085], [-0.156, -0.111, 0.085], [0.12, 0.218, 0], [0.12, -0.218, 0], [-0.12, 0.218, 0], [-0.12, -0.218, 0]]) names = np.array(["T1","T2","T3","T4","T5","T6","T7","T8"]) angles = np.array([-45, 45, -135, 135, 0, 0, 0, 0, 0]) directions = np.array([1, 1, -1, -1, 1, -1, -1, 1]) fig = plt.figure(figsize=(5,5)) ax = fig.add_subplot(111, projection='3d') for i in range(4): point = lengths[i] x, y, z = point[0],-point[1],-point[2] ax.text(x,y,z, names[i], color='black') #ax.scatter(x, y, z, label = names[i]) if angles[i] == -45: u = 1 v = 1 if angles[i] == 45: u = 1 v = -1 if angles[i] == -135: u = 1 v = -1 if angles[i] == 135: u = 1 v = 1 w = 0 ax.quiver(x, y, z, u, v, w, length = 0.1, normalize = True) for i in range(4,8): point = lengths[i] x, y, z = point[0],-point[1],-point[2] ax.text(x,y,z, names[i], color='black') #ax.scatter(x, y, z, label = names[i]) u = 0 v = 0 w = directions[i] ax.quiver(x, y, z, u, v, w, length = 0.1, normalize = True) ax.set_xlim([-0.2,0.2]) ax.set_ylim([-0.2,0.2]) ax.set_zlim([-0.2,0.2]) ax.set_xticklabels([]) ax.set_yticklabels([]) ax.set_zticklabels([]) ax.quiver(0,0,0,1,0,0, length = .2, linewidth=2, color = "r") ax.quiver(0,0,0,0,-1,0, length = .2, linewidth=2, color = "b") ax.quiver(0,0,0,0,0,-1, length = .2, linewidth=2, color = "g") ax.text(.25,0,0, 'x', color='r') ax.text(0,-.25,0, 'y', color='b') ax.text(0,0,-.25, 'z', color='g') plt.show()
[ 1, 529, 276, 1112, 420, 29958, 29923, 5357, 4301, 29872, 29914, 29933, 496, 12779, 29899, 29923, 29906, 29906, 29900, 29945, 13, 3166, 286, 572, 29918, 10154, 29895, 1169, 29889, 29885, 5317, 29941, 29881, 1053, 319, 9100, 29941, 29928, 13, 5215, 12655, 408, 7442, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 13, 2848, 29879, 353, 7442, 29889, 2378, 4197, 13, 795, 518, 29900, 29889, 29896, 29945, 29953, 29892, 29871, 29900, 29889, 29896, 29896, 29896, 29892, 29871, 29900, 29889, 29900, 29947, 29945, 1402, 13, 795, 518, 29900, 29889, 29896, 29945, 29953, 29892, 448, 29900, 29889, 29896, 29896, 29896, 29892, 29871, 29900, 29889, 29900, 29947, 29945, 1402, 13, 795, 21069, 29900, 29889, 29896, 29945, 29953, 29892, 29871, 29900, 29889, 29896, 29896, 29896, 29892, 29871, 29900, 29889, 29900, 29947, 29945, 1402, 13, 795, 21069, 29900, 29889, 29896, 29945, 29953, 29892, 448, 29900, 29889, 29896, 29896, 29896, 29892, 29871, 29900, 29889, 29900, 29947, 29945, 1402, 13, 795, 518, 29900, 29889, 29896, 29906, 29892, 29871, 29900, 29889, 29906, 29896, 29947, 29892, 29871, 29900, 1402, 13, 795, 518, 29900, 29889, 29896, 29906, 29892, 448, 29900, 29889, 29906, 29896, 29947, 29892, 29871, 29900, 1402, 13, 795, 21069, 29900, 29889, 29896, 29906, 29892, 29871, 29900, 29889, 29906, 29896, 29947, 29892, 29871, 29900, 1402, 13, 795, 21069, 29900, 29889, 29896, 29906, 29892, 448, 29900, 29889, 29906, 29896, 29947, 29892, 29871, 29900, 24960, 13, 13, 7039, 353, 7442, 29889, 2378, 29898, 3366, 29911, 29896, 3284, 29911, 29906, 3284, 29911, 29941, 3284, 29911, 29946, 3284, 29911, 29945, 3284, 29911, 29953, 3284, 29911, 29955, 3284, 29911, 29947, 20068, 13, 19536, 353, 7442, 29889, 2378, 4197, 29899, 29946, 29945, 29892, 29871, 29946, 29945, 29892, 448, 29896, 29941, 29945, 29892, 29871, 29896, 29941, 29945, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 29892, 29871, 29900, 2314, 13, 20146, 1953, 353, 7442, 29889, 2378, 4197, 29896, 29892, 29871, 29896, 29892, 448, 29896, 29892, 448, 29896, 29892, 29871, 29896, 29892, 448, 29896, 29892, 448, 29896, 29892, 29871, 29896, 2314, 13, 13, 13, 1003, 353, 14770, 29889, 4532, 29898, 1003, 2311, 7607, 29945, 29892, 29945, 876, 13, 1165, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29896, 29896, 29896, 29892, 18246, 2433, 29941, 29881, 1495, 13, 13, 1454, 474, 297, 3464, 29898, 29946, 1125, 13, 1678, 1298, 353, 27497, 29961, 29875, 29962, 13, 1678, 921, 29892, 343, 29892, 503, 353, 1298, 29961, 29900, 1402, 29899, 3149, 29961, 29896, 1402, 29899, 3149, 29961, 29906, 29962, 13, 1678, 4853, 29889, 726, 29898, 29916, 29892, 29891, 29892, 29920, 29892, 2983, 29961, 29875, 1402, 2927, 2433, 8517, 1495, 13, 1678, 396, 1165, 29889, 1557, 2620, 29898, 29916, 29892, 343, 29892, 503, 29892, 3858, 353, 2983, 29961, 29875, 2314, 13, 1678, 565, 23619, 29961, 29875, 29962, 1275, 448, 29946, 29945, 29901, 13, 4706, 318, 353, 29871, 29896, 13, 4706, 325, 353, 29871, 29896, 13, 1678, 565, 23619, 29961, 29875, 29962, 1275, 29871, 29946, 29945, 29901, 13, 4706, 318, 353, 29871, 29896, 13, 4706, 325, 353, 448, 29896, 13, 1678, 565, 23619, 29961, 29875, 29962, 1275, 448, 29896, 29941, 29945, 29901, 13, 4706, 318, 353, 29871, 29896, 13, 4706, 325, 353, 448, 29896, 13, 1678, 565, 23619, 29961, 29875, 29962, 1275, 29871, 29896, 29941, 29945, 29901, 13, 4706, 318, 353, 29871, 29896, 13, 4706, 325, 353, 29871, 29896, 13, 1678, 281, 353, 29871, 29900, 13, 1678, 4853, 29889, 339, 2147, 29898, 29916, 29892, 343, 29892, 503, 29892, 318, 29892, 325, 29892, 281, 29892, 3309, 353, 29871, 29900, 29889, 29896, 29892, 4226, 675, 353, 5852, 29897, 13, 1454, 474, 297, 3464, 29898, 29946, 29892, 29947, 1125, 13, 1678, 1298, 353, 27497, 29961, 29875, 29962, 13, 1678, 921, 29892, 343, 29892, 503, 353, 1298, 29961, 29900, 1402, 29899, 3149, 29961, 29896, 1402, 29899, 3149, 29961, 29906, 29962, 13, 1678, 4853, 29889, 726, 29898, 29916, 29892, 29891, 29892, 29920, 29892, 2983, 29961, 29875, 1402, 2927, 2433, 8517, 1495, 13, 1678, 396, 1165, 29889, 1557, 2620, 29898, 29916, 29892, 343, 29892, 503, 29892, 3858, 353, 2983, 29961, 29875, 2314, 13, 1678, 318, 353, 29871, 29900, 13, 1678, 325, 353, 29871, 29900, 13, 1678, 281, 353, 18112, 29961, 29875, 29962, 13, 1678, 4853, 29889, 339, 2147, 29898, 29916, 29892, 343, 29892, 503, 29892, 318, 29892, 325, 29892, 281, 29892, 3309, 353, 29871, 29900, 29889, 29896, 29892, 4226, 675, 353, 5852, 29897, 13, 13, 13, 1165, 29889, 842, 29918, 29916, 2576, 4197, 29899, 29900, 29889, 29906, 29892, 29900, 29889, 29906, 2314, 13, 1165, 29889, 842, 29918, 29891, 2576, 4197, 29899, 29900, 29889, 29906, 29892, 29900, 29889, 29906, 2314, 13, 1165, 29889, 842, 29918, 29920, 2576, 4197, 29899, 29900, 29889, 29906, 29892, 29900, 29889, 29906, 2314, 13, 1165, 29889, 842, 29918, 486, 860, 21134, 4197, 2314, 13, 1165, 29889, 842, 29918, 3637, 860, 21134, 4197, 2314, 13, 1165, 29889, 842, 29918, 2065, 860, 21134, 4197, 2314, 13, 13, 1165, 29889, 339, 2147, 29898, 29900, 29892, 29900, 29892, 29900, 29892, 29896, 29892, 29900, 29892, 29900, 29892, 3309, 353, 869, 29906, 29892, 1196, 2103, 29922, 29906, 29892, 2927, 353, 376, 29878, 1159, 13, 1165, 29889, 339, 2147, 29898, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 6653, 29896, 29892, 29900, 29892, 3309, 353, 869, 29906, 29892, 1196, 2103, 29922, 29906, 29892, 2927, 353, 376, 29890, 1159, 13, 1165, 29889, 339, 2147, 29898, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 6653, 29896, 29892, 3309, 353, 869, 29906, 29892, 1196, 2103, 29922, 29906, 29892, 2927, 353, 376, 29887, 1159, 13, 1165, 29889, 726, 11891, 29906, 29945, 29892, 29900, 29892, 29900, 29892, 525, 29916, 742, 2927, 2433, 29878, 1495, 13, 1165, 29889, 726, 29898, 29900, 6653, 29889, 29906, 29945, 29892, 29900, 29892, 525, 29891, 742, 2927, 2433, 29890, 1495, 13, 1165, 29889, 726, 29898, 29900, 29892, 29900, 6653, 29889, 29906, 29945, 29892, 525, 29920, 742, 2927, 2433, 29887, 1495, 13, 572, 29873, 29889, 4294, 580, 13, 13, 13, 2 ]
homeassistant/components/tesla/device_tracker.py
domwillcode/home-assistant
23
61446
"""Support for tracking Tesla cars.""" import logging from homeassistant.components.device_tracker import SOURCE_TYPE_GPS from homeassistant.components.device_tracker.config_entry import TrackerEntity from . import DOMAIN as TESLA_DOMAIN, TeslaDevice _LOGGER = logging.getLogger(__name__) async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the Tesla binary_sensors by config_entry.""" entities = [ TeslaDeviceEntity( device, hass.data[TESLA_DOMAIN][config_entry.entry_id]["controller"], config_entry, ) for device in hass.data[TESLA_DOMAIN][config_entry.entry_id]["devices"][ "devices_tracker" ] ] async_add_entities(entities, True) class TeslaDeviceEntity(TeslaDevice, TrackerEntity): """A class representing a Tesla device.""" def __init__(self, tesla_device, controller, config_entry): """Initialize the Tesla device scanner.""" super().__init__(tesla_device, controller, config_entry) self._latitude = None self._longitude = None self._attributes = {"trackr_id": self.unique_id} self._listener = None async def async_update(self): """Update the device info.""" _LOGGER.debug("Updating device position: %s", self.name) await super().async_update() location = self.tesla_device.get_location() if location: self._latitude = location["latitude"] self._longitude = location["longitude"] self._attributes = { "trackr_id": self.unique_id, "heading": location["heading"], "speed": location["speed"], } @property def latitude(self) -> float: """Return latitude value of the device.""" return self._latitude @property def longitude(self) -> float: """Return longitude value of the device.""" return self._longitude @property def should_poll(self): """Return whether polling is needed.""" return True @property def source_type(self): """Return the source type, eg gps or router, of the device.""" return SOURCE_TYPE_GPS
[ 1, 9995, 14039, 363, 23110, 323, 267, 433, 18647, 1213, 15945, 13, 5215, 12183, 13, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 10141, 29918, 3018, 4937, 1053, 7791, 4574, 4741, 29918, 11116, 29918, 29954, 7024, 13, 3166, 3271, 465, 22137, 29889, 14036, 29889, 10141, 29918, 3018, 4937, 29889, 2917, 29918, 8269, 1053, 3201, 4937, 6691, 13, 13, 3166, 869, 1053, 11662, 29032, 408, 323, 2890, 4375, 29918, 3970, 29032, 29892, 323, 267, 433, 11501, 13, 13, 29918, 14480, 17070, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 13, 12674, 822, 7465, 29918, 14669, 29918, 8269, 29898, 29882, 465, 29892, 2295, 29918, 8269, 29892, 7465, 29918, 1202, 29918, 296, 1907, 1125, 13, 1678, 9995, 2697, 701, 278, 323, 267, 433, 7581, 29918, 23149, 943, 491, 2295, 29918, 8269, 1213, 15945, 13, 1678, 16212, 353, 518, 13, 4706, 323, 267, 433, 11501, 6691, 29898, 13, 9651, 4742, 29892, 13, 9651, 298, 465, 29889, 1272, 29961, 29911, 2890, 4375, 29918, 3970, 29032, 3816, 2917, 29918, 8269, 29889, 8269, 29918, 333, 29962, 3366, 8299, 12436, 13, 9651, 2295, 29918, 8269, 29892, 13, 4706, 1723, 13, 4706, 363, 4742, 297, 298, 465, 29889, 1272, 29961, 29911, 2890, 4375, 29918, 3970, 29032, 3816, 2917, 29918, 8269, 29889, 8269, 29918, 333, 29962, 3366, 3359, 1575, 3108, 29961, 13, 9651, 376, 3359, 1575, 29918, 3018, 4937, 29908, 13, 4706, 4514, 13, 1678, 4514, 13, 1678, 7465, 29918, 1202, 29918, 296, 1907, 29898, 296, 1907, 29892, 5852, 29897, 13, 13, 13, 1990, 323, 267, 433, 11501, 6691, 29898, 29911, 267, 433, 11501, 29892, 3201, 4937, 6691, 1125, 13, 1678, 9995, 29909, 770, 15783, 263, 323, 267, 433, 4742, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 260, 267, 433, 29918, 10141, 29892, 4701, 29892, 2295, 29918, 8269, 1125, 13, 4706, 9995, 6644, 6646, 278, 323, 267, 433, 4742, 885, 7310, 1213, 15945, 13, 4706, 2428, 2141, 1649, 2344, 12035, 2167, 433, 29918, 10141, 29892, 4701, 29892, 2295, 29918, 8269, 29897, 13, 4706, 1583, 3032, 5066, 4279, 353, 6213, 13, 4706, 1583, 3032, 5426, 4279, 353, 6213, 13, 4706, 1583, 3032, 15697, 353, 8853, 11294, 29878, 29918, 333, 1115, 1583, 29889, 13092, 29918, 333, 29913, 13, 4706, 1583, 3032, 25894, 353, 6213, 13, 13, 1678, 7465, 822, 7465, 29918, 5504, 29898, 1311, 1125, 13, 4706, 9995, 6422, 278, 4742, 5235, 1213, 15945, 13, 4706, 903, 14480, 17070, 29889, 8382, 703, 3373, 26747, 4742, 2602, 29901, 1273, 29879, 613, 1583, 29889, 978, 29897, 13, 4706, 7272, 2428, 2141, 12674, 29918, 5504, 580, 13, 4706, 4423, 353, 1583, 29889, 2167, 433, 29918, 10141, 29889, 657, 29918, 5479, 580, 13, 4706, 565, 4423, 29901, 13, 9651, 1583, 3032, 5066, 4279, 353, 4423, 3366, 5066, 4279, 3108, 13, 9651, 1583, 3032, 5426, 4279, 353, 4423, 3366, 5426, 4279, 3108, 13, 9651, 1583, 3032, 15697, 353, 426, 13, 18884, 376, 11294, 29878, 29918, 333, 1115, 1583, 29889, 13092, 29918, 333, 29892, 13, 18884, 376, 2813, 292, 1115, 4423, 3366, 2813, 292, 12436, 13, 18884, 376, 19322, 1115, 4423, 3366, 19322, 12436, 13, 9651, 500, 13, 13, 1678, 732, 6799, 13, 1678, 822, 26271, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 9995, 11609, 26271, 995, 310, 278, 4742, 1213, 15945, 13, 4706, 736, 1583, 3032, 5066, 4279, 13, 13, 1678, 732, 6799, 13, 1678, 822, 28745, 29898, 1311, 29897, 1599, 5785, 29901, 13, 4706, 9995, 11609, 28745, 995, 310, 278, 4742, 1213, 15945, 13, 4706, 736, 1583, 3032, 5426, 4279, 13, 13, 1678, 732, 6799, 13, 1678, 822, 881, 29918, 29886, 3028, 29898, 1311, 1125, 13, 4706, 9995, 11609, 3692, 1248, 1847, 338, 4312, 1213, 15945, 13, 4706, 736, 5852, 13, 13, 1678, 732, 6799, 13, 1678, 822, 2752, 29918, 1853, 29898, 1311, 1125, 13, 4706, 9995, 11609, 278, 2752, 1134, 29892, 8087, 330, 567, 470, 12876, 29892, 310, 278, 4742, 1213, 15945, 13, 4706, 736, 7791, 4574, 4741, 29918, 11116, 29918, 29954, 7024, 13, 2 ]
sandbox/grist/migrations.py
gristlabs/grist-core
2,667
79126
<filename>sandbox/grist/migrations.py import json import re import six from six.moves import xrange import actions import identifiers import schema import summary import table_data_set import logger log = logger.Logger(__name__, logger.INFO) # PHILOSOPHY OF MIGRATIONS. # # We should probably never remove, modify, or rename metadata tables or columns. # Instead, we should only add. # # We can mark old columns/tables as deprecated, which should be ignored except to prevent us from # adding same-named entities in the future. # # If we change the meaning of a column, we have to create a new column with a new name. # # This should make it at least barely possible to share documents by people who are not all on the # same Grist version (even so, it will require more work). It should also make it somewhat safe to # upgrade and then open the document with a previous version. all_migrations = {} def noop_migration(_all_tables): return [] # Each migration function includes a .need_all_tables attribute. See migration() decorator. noop_migration.need_all_tables = False def create_migrations(all_tables, metadata_only=False): """ Creates and returns a list of DocActions needed to bring this document to schema.SCHEMA_VERSION. all_tables: all tables or just the metadata tables (those named with _grist_ prefix) as a dictionary mapping table name to TableData. metadata_only: should be set if only metadata tables are passed in. If ALL tables are required to process migrations, this method will raise a "need all tables..." exception. """ try: doc_version = all_tables['_grist_DocInfo'].columns["schemaVersion"][0] except Exception: doc_version = 0 # We create a TableDataSet, and populate it with the subset of the current schema that matches # all_tables. For missing items, we make up tables and incomplete columns, which should be OK # since we would not be adding new records to deprecated columns. # Note that this approach makes it NOT OK to change column types. tdset = table_data_set.TableDataSet() # For each table in the provided metadata tables, create an AddTable action. user_schema = schema.build_schema(all_tables['_grist_Tables'], all_tables['_grist_Tables_column'], include_builtin=False) for t in six.itervalues(user_schema): tdset.apply_doc_action(actions.AddTable(t.tableId, schema.cols_to_dict_list(t.columns))) # For each old table/column, construct an AddTable action using the current schema. new_schema = {a.table_id: a for a in schema.schema_create_actions()} for table_id, data in sorted(six.iteritems(all_tables)): # User tables should already be in tdset; the rest must be metadata tables. # (If metadata_only is true, there is simply nothing to skip here.) if table_id not in tdset.all_tables: new_col_info = {} if table_id in new_schema: new_col_info = {c['id']: c for c in new_schema[table_id].columns} # Use an incomplete default for unknown (i.e. deprecated) columns; some uses of the column # would be invalid, such as adding a new record with missing values. col_info = sorted([new_col_info.get(col_id, {'id': col_id}) for col_id in data.columns], key=lambda c: list(six.iteritems(c))) tdset.apply_doc_action(actions.AddTable(table_id, col_info)) # And load in the original data, interpreting the TableData object as BulkAddRecord action. tdset.apply_doc_action(actions.BulkAddRecord(*data)) migration_actions = [] for version in xrange(doc_version + 1, schema.SCHEMA_VERSION + 1): migration_func = all_migrations.get(version, noop_migration) if migration_func.need_all_tables and metadata_only: raise Exception("need all tables for migration to %s" % version) migration_actions.extend(all_migrations.get(version, noop_migration)(tdset)) # Note that if we are downgrading versions (i.e. doc_version is higher), then the following is # the only action we include into the migration. migration_actions.append(actions.UpdateRecord('_grist_DocInfo', 1, { 'schemaVersion': schema.SCHEMA_VERSION })) return migration_actions def get_last_migration_version(): """ Returns the last schema version number for which we have a migration defined. """ return max(all_migrations) def migration(schema_version, need_all_tables=False): """ Decorator for migrations that associates the decorated migration function with the given schema_version. This decorated function will be run to migrate forward to schema_version. Migrations are first attempted with only metadata tables, but if any required migration function is marked with need_all_tables=True, then the migration will be retried with all tables. NOTE: new migrations should NOT set need_all_tables=True; it would require more work to process very large documents safely (incuding those containing on-demand tables). """ def add_migration(migration_func): migration_func.need_all_tables = need_all_tables all_migrations[schema_version] = migration_func return migration_func return add_migration # A little shorthand to make AddColumn actions more concise. def add_column(table_id, col_id, col_type, *args, **kwargs): return actions.AddColumn(table_id, col_id, schema.make_column(col_id, col_type, *args, **kwargs)) # Another shorthand to only add a column if it isn't already there. def maybe_add_column(tdset, table_id, col_id, col_type, *args, **kwargs): if col_id not in tdset.all_tables[table_id].columns: return add_column(table_id, col_id, col_type, *args, **kwargs) return None # Returns the next unused row id for the records of the table given by table_id. def next_id(tdset, table_id): row_ids = tdset.all_tables[table_id].row_ids return max(row_ids) + 1 if row_ids else 1 # Parses a json string, but returns an empty object for invalid json. def safe_parse(json_str): try: return json.loads(json_str) except ValueError: return {} @migration(schema_version=1) def migration1(tdset): """ Add TabItems table, and populate based on existing sections. """ doc_actions = [] # The very first migration is extra-lax, and creates some tables that are missing in some test # docs. That's only because we did not distinguish schema version before migrations were # implemented. Other migrations should not need such conditionals. if '_grist_Attachments' not in tdset.all_tables: doc_actions.append(actions.AddTable("_grist_Attachments", [ schema.make_column("fileIdent", "Text"), schema.make_column("fileName", "Text"), schema.make_column("fileType", "Text"), schema.make_column("fileSize", "Int"), schema.make_column("timeUploaded", "DateTime") ])) if '_grist_TabItems' not in tdset.all_tables: doc_actions.append(actions.AddTable("_grist_TabItems", [ schema.make_column("tableRef", "Ref:_grist_Tables"), schema.make_column("viewRef", "Ref:_grist_Views"), ])) if 'schemaVersion' not in tdset.all_tables['_grist_DocInfo'].columns: doc_actions.append(add_column('_grist_DocInfo', 'schemaVersion', 'Int')) doc_actions.extend([ add_column('_grist_Attachments', 'imageHeight', 'Int'), add_column('_grist_Attachments', 'imageWidth', 'Int'), ]) view_sections = actions.transpose_bulk_action(tdset.all_tables['_grist_Views_section']) rows = sorted({(s.tableRef, s.parentId) for s in view_sections}) if rows: values = {'tableRef': [r[0] for r in rows], 'viewRef': [r[1] for r in rows]} row_ids = list(xrange(1, len(rows) + 1)) doc_actions.append(actions.ReplaceTableData('_grist_TabItems', row_ids, values)) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=2) def migration2(tdset): """ Add TableViews table, and populate based on existing sections. Add TabBar table, and populate based on existing views. Add PrimaryViewId to Tables and populated using relatedViews """ # Maps tableRef to viewRef primary_views = {} # Associate each view with a single table; this dict includes primary views. views_to_table = {} # For each table, find a view to serve as the primary view. view_sections = actions.transpose_bulk_action(tdset.all_tables['_grist_Views_section']) for s in view_sections: if s.tableRef not in primary_views and s.parentKey == "record": # The view containing this section is a good candidate for primary view. primary_views[s.tableRef] = s.parentId if s.parentId not in views_to_table: # The first time we see a (view, table) combination, associate the view with that table. views_to_table[s.parentId] = s.tableRef def create_primary_views_action(primary_views): row_ids = sorted(primary_views.keys()) values = {'primaryViewId': [primary_views[r] for r in row_ids]} return actions.BulkUpdateRecord('_grist_Tables', row_ids, values) def create_tab_bar_action(views_to_table): row_ids = list(xrange(1, len(views_to_table) + 1)) return actions.ReplaceTableData('_grist_TabBar', row_ids, { 'viewRef': sorted(views_to_table.keys()) }) def create_table_views_action(views_to_table, primary_views): related_views = sorted(set(views_to_table.keys()) - set(primary_views.values())) row_ids = list(xrange(1, len(related_views) + 1)) return actions.ReplaceTableData('_grist_TableViews', row_ids, { 'tableRef': [views_to_table[v] for v in related_views], 'viewRef': related_views, }) return tdset.apply_doc_actions([ actions.AddTable('_grist_TabBar', [ schema.make_column('viewRef', 'Ref:_grist_Views'), ]), actions.AddTable('_grist_TableViews', [ schema.make_column('tableRef', 'Ref:_grist_Tables'), schema.make_column('viewRef', 'Ref:_grist_Views'), ]), add_column('_grist_Tables', 'primaryViewId', 'Ref:_grist_Views'), create_primary_views_action(primary_views), create_tab_bar_action(views_to_table), create_table_views_action(views_to_table, primary_views) ]) @migration(schema_version=3) def migration3(tdset): """ There is no longer a "Derived" type for columns, and summary tables use the type suitable for the column being summarized. For old documents, convert "Derived" type to "Any", and adjust the usage of "lookupOrAddDerived()" function. """ # Note that this is a complicated migration, and mainly acceptable because it is before our very # first release. For a released product, a change like this should be done in a backwards # compatible way: keep but deprecate 'Derived'; introduce a lookupOrAddDerived2() to use for new # summary tables, but keep the old interface as well for existing ones. The reason is that such # migrations are error-prone and may mess up customers' data. doc_actions = [] tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])) tables_map = {t.id: t for t in tables} columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column'])) # Convert columns from type 'Derived' to type 'Any' affected_cols = [c for c in columns if c.type == 'Derived'] if affected_cols: doc_actions.extend( actions.ModifyColumn(tables_map[c.parentId].tableId, c.colId, {'type': 'Any'}) for c in affected_cols ) doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables_column', [c.id for c in affected_cols], {'type': ['Any' for c in affected_cols]} )) # Convert formulas of the form '.lookupOrAddDerived($x,$y)' to '.lookupOrAddDerived(x=$x,y=$y)' formula_re = re.compile(r'(\w+).lookupOrAddDerived\((.*?)\)') arg_re = re.compile(r'^\$(\w+)$') def replace(match): args = ", ".join(arg_re.sub(r'\1=$\1', arg.strip()) for arg in match.group(2).split(",")) return '%s.lookupOrAddDerived(%s)' % (match.group(1), args) formula_updates = [] for c in columns: new_formula = c.formula and formula_re.sub(replace, c.formula) if new_formula != c.formula: formula_updates.append((c, new_formula)) if formula_updates: doc_actions.extend( actions.ModifyColumn(tables_map[c.parentId].tableId, c.colId, {'formula': f}) for c, f in formula_updates ) doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables_column', [c.id for c, f in formula_updates], {'formula': [f for c, f in formula_updates]} )) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=4) def migration4(tdset): """ Add TabPos column to TabBar table """ doc_actions = [] row_ids = tdset.all_tables['_grist_TabBar'].row_ids doc_actions.append(add_column('_grist_TabBar', 'tabPos', 'PositionNumber')) doc_actions.append(actions.BulkUpdateRecord('_grist_TabBar', row_ids, {'tabPos': row_ids})) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=5) def migration5(tdset): return tdset.apply_doc_actions([ add_column('_grist_Views', 'primaryViewTable', 'Ref:_grist_Tables', formula='_grist_Tables.lookupOne(primaryViewId=$id)', isFormula=True), ]) @migration(schema_version=6) def migration6(tdset): # This undoes the previous migration, since primaryViewTable is now a formula private to the # sandbox rather than part of the document schema. return tdset.apply_doc_actions([ actions.RemoveColumn('_grist_Views', 'primaryViewTable'), ]) @migration(schema_version=7) def migration7(tdset): """ Add summarySourceTable/summarySourceCol fields to metadata, and adjust existing summary tables to correspond to the new style. """ # Note: this migration has some faults. # - It doesn't delete viewSectionFields for columns it removes (if a user added some special # columns manually. # - It doesn't fix types of Reference columns that refer to old-style summary tables # (if the user created some such columns manually). doc_actions = [action for action in [ maybe_add_column(tdset, '_grist_Tables', 'summarySourceTable', 'Ref:_grist_Tables'), maybe_add_column(tdset, '_grist_Tables_column', 'summarySourceCol', 'Ref:_grist_Tables_column') ] if action] # Maps tableRef to Table object. tables_map = {t.id: t for t in actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])} # Maps tableName to tableRef table_name_to_ref = {t.tableId: t.id for t in six.itervalues(tables_map)} # List of Column objects columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column'])) # Maps columnRef to Column object. columns_map_by_ref = {c.id: c for c in columns} # Maps (tableRef, colName) to Column object. columns_map_by_table_colid = {(c.parentId, c.colId): c for c in columns} # Set of all tableNames. table_name_set = set(table_name_to_ref.keys()) remove_cols = [] # List of columns to remove formula_updates = [] # List of (column, new_table_name, new_formula) pairs table_renames = [] # List of (table, new_name) pairs source_tables = [] # List of (table, summarySourceTable) pairs source_cols = [] # List of (column, summarySourceColumn) pairs # Summary tables used to be named as "Summary_<SourceName>_<ColRef1>_<ColRef2>". This regular # expression parses that. summary_re = re.compile(r'^Summary_(\w+?)((?:_\d+)*)$') for t in six.itervalues(tables_map): m = summary_re.match(t.tableId) if not m or m.group(1) not in table_name_to_ref: continue # We have a valid summary table. source_table_name = m.group(1) source_table_ref = table_name_to_ref[source_table_name] groupby_colrefs = [int(x) for x in m.group(2).strip("_").split("_")] # Prepare a new-style name for the summary table. Be sure not to conflict with existing tables # or with each other (i.e. don't rename multiple tables to the same name). new_name = summary.encode_summary_table_name(source_table_name) new_name = identifiers.pick_table_ident(new_name, avoid=table_name_set) table_name_set.add(new_name) log.warn("Upgrading summary table %s for %s(%s) to %s" % ( t.tableId, source_table_name, groupby_colrefs, new_name)) # Remove the "lookupOrAddDerived" column from the source table (which is named using the # summary table name for its colId). remove_cols.extend(c for c in columns if c.parentId == source_table_ref and c.colId == t.tableId) # Upgrade the "group" formula in the summary table. expected_group_formula = "%s.lookupRecords(%s=$id)" % (source_table_name, t.tableId) new_formula = "table.getSummarySourceGroup(rec)" formula_updates.extend((c, new_name, new_formula) for c in columns if (c.parentId == t.id and c.colId == "group" and c.formula == expected_group_formula)) # Schedule a rename of the summary table. table_renames.append((t, new_name)) # Set summarySourceTable fields on the metadata. source_tables.append((t, source_table_ref)) # Set summarySourceCol fields in the metadata. We need to find the right summary column. groupby_cols = set() for col_ref in groupby_colrefs: src_col = columns_map_by_ref.get(col_ref) sum_col = columns_map_by_table_colid.get((t.id, src_col.colId)) if src_col else None if sum_col: groupby_cols.add(sum_col) source_cols.append((sum_col, src_col.id)) else: log.warn("Upgrading summary table %s: couldn't find column %s" % (t.tableId, col_ref)) # Finally, we have to remove all non-formula columns that are not groupby-columns (e.g. # 'manualSort'), because the new approach assumes ALL non-formula columns are for groupby. remove_cols.extend(c for c in columns if c.parentId == t.id and c not in groupby_cols and not c.isFormula) # Create all the doc actions from the arrays we prepared. # Process remove_cols doc_actions.extend( actions.RemoveColumn(tables_map[c.parentId].tableId, c.colId) for c in remove_cols) doc_actions.append(actions.BulkRemoveRecord( '_grist_Tables_column', [c.id for c in remove_cols])) # Process table_renames doc_actions.extend( actions.RenameTable(t.tableId, new) for (t, new) in table_renames) doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables', [t.id for t, new in table_renames], {'tableId': [new for t, new in table_renames]} )) # Process source_tables and source_cols doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables', [t.id for t, ref in source_tables], {'summarySourceTable': [ref for t, ref in source_tables]} )) doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables_column', [t.id for t, ref in source_cols], {'summarySourceCol': [ref for t, ref in source_cols]} )) # Process formula_updates. Do this last since recalculation of these may cause new records added # to summary tables, so we should have all the tables correctly set up by this time. doc_actions.extend( actions.ModifyColumn(table_id, c.colId, {'formula': f}) for c, table_id, f in formula_updates) doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables_column', [c.id for c, t, f in formula_updates], {'formula': [f for c, t, f in formula_updates]} )) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=8) def migration8(tdset): return tdset.apply_doc_actions([ add_column('_grist_Tables_column', 'untieColIdFromLabel', 'Bool'), ]) @migration(schema_version=9) def migration9(tdset): return tdset.apply_doc_actions([ add_column('_grist_Tables_column', 'displayCol', 'Ref:_grist_Tables_column'), add_column('_grist_Views_section_field', 'displayCol', 'Ref:_grist_Tables_column'), ]) @migration(schema_version=10) def migration10(tdset): """ Add displayCol to all reference cols, with formula $<ref_col_id>.<visible_col_id> (Note that displayCol field was added in the previous migration.) """ doc_actions = [] tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])) columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column'])) # Maps tableRef to tableId. tables_map = {t.id: t.tableId for t in tables} # Maps tableRef to sets of colIds in the tables. Used to prevent repeated colIds. table_col_ids = {t.id: set(tdset.all_tables[t.tableId].columns.keys()) for t in tables} # Get the next sequential column row id. row_id = next_id(tdset, '_grist_Tables_column') for c in columns: # If a column is a reference with an unset display column, add a display column. if c.type.startswith('Ref:') and not c.displayCol: # Get visible_col_id. If not found, row id is used and no display col is necessary. visible_col_id = "" try: visible_col_id = json.loads(c.widgetOptions).get('visibleCol') if not visible_col_id: continue except Exception: continue # If invalid widgetOptions, skip this column. # Set formula to use the current visibleCol in widgetOptions. formula = ("$%s.%s" % (c.colId, visible_col_id)) # Get a unique colId for the display column, and add it to the set of used ids. used_col_ids = table_col_ids[c.parentId] display_col_id = identifiers.pick_col_ident('gristHelper_Display', avoid=used_col_ids) used_col_ids.add(display_col_id) # Add all actions to the list. doc_actions.append(add_column(tables_map[c.parentId], 'gristHelper_Display', 'Any', formula=formula, isFormula=True)) doc_actions.append(actions.AddRecord('_grist_Tables_column', row_id, { 'parentPos': 1.0, 'label': 'gristHelper_Display', 'isFormula': True, 'parentId': c.parentId, 'colId': 'gristHelper_Display', 'formula': formula, 'widgetOptions': '', 'type': 'Any' })) doc_actions.append(actions.UpdateRecord('_grist_Tables_column', c.id, {'displayCol': row_id})) # Increment row id to the next unused. row_id += 1 return tdset.apply_doc_actions(doc_actions) @migration(schema_version=11) def migration11(tdset): return tdset.apply_doc_actions([ add_column('_grist_Views_section', 'embedId', 'Text'), ]) @migration(schema_version=12) def migration12(tdset): return tdset.apply_doc_actions([ add_column('_grist_Views_section', 'options', 'Text') ]) @migration(schema_version=13) def migration13(tdset): # Adds a basketId to the entire document to take advantage of basket functionality. # From this version on, embedId is deprecated. return tdset.apply_doc_actions([ add_column('_grist_DocInfo', 'basketId', 'Text') ]) @migration(schema_version=14) def migration14(tdset): # Create the ACL table AND also the default ACL groups, default resource, and the default rule. # These match the actions applied to new document by 'InitNewDoc' useraction (as of v14). return tdset.apply_doc_actions([ actions.AddTable('_grist_ACLMemberships', [ schema.make_column('parent', 'Ref:_grist_ACLPrincipals'), schema.make_column('child', 'Ref:_grist_ACLPrincipals'), ]), actions.AddTable('_grist_ACLPrincipals', [ schema.make_column('userName', 'Text'), schema.make_column('groupName', 'Text'), schema.make_column('userEmail', 'Text'), schema.make_column('instanceId', 'Text'), schema.make_column('type', 'Text'), ]), actions.AddTable('_grist_ACLResources', [ schema.make_column('colIds', 'Text'), schema.make_column('tableId', 'Text'), ]), actions.AddTable('_grist_ACLRules', [ schema.make_column('aclFormula', 'Text'), schema.make_column('principals', 'Text'), schema.make_column('resource', 'Ref:_grist_ACLResources'), schema.make_column('aclColumn', 'Ref:_grist_Tables_column'), schema.make_column('permissions', 'Int'), ]), # Set up initial ACL data. actions.BulkAddRecord('_grist_ACLPrincipals', [1,2,3,4], { 'type': ['group', 'group', 'group', 'group'], 'groupName': ['Owners', 'Admins', 'Editors', 'Viewers'], }), actions.AddRecord('_grist_ACLResources', 1, { 'tableId': '', 'colIds': '' }), actions.AddRecord('_grist_ACLRules', 1, { 'resource': 1, 'permissions': 0x3F, 'principals': '[1]' }), ]) @migration(schema_version=15) def migration15(tdset): # Adds a filter JSON property to each field. # From this version on, filterSpec in _grist_Views_section is deprecated. doc_actions = [ add_column('_grist_Views_section_field', 'filter', 'Text') ] # Get all section and field data to move section filter data to the fields sections = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Views_section'])) fields = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Views_section_field'])) specs = {s.id: safe_parse(s.filterSpec) for s in sections} # Move filter data from sections to fields for f in fields: # If the field belongs to the section and the field's colRef is in its filterSpec, # pull the filter setting from the section. filter_spec = specs.get(f.parentId) if filter_spec and str(f.colRef) in filter_spec: doc_actions.append(actions.UpdateRecord('_grist_Views_section_field', f.id, { 'filter': json.dumps(filter_spec[str(f.colRef)]) })) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=16) def migration16(tdset): # Add visibleCol to columns and view fields, and set it from columns' and fields' widgetOptions. doc_actions = [ add_column('_grist_Tables_column', 'visibleCol', 'Ref:_grist_Tables_column'), add_column('_grist_Views_section_field', 'visibleCol', 'Ref:_grist_Tables_column'), ] # Maps tableId to table, for looking up target table as listed in "Ref:*" types. tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])) tables_by_id = {t.tableId: t for t in tables} # Allow looking up columns by ref or by (tableRef, colId) columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column'])) columns_by_ref = {c.id: c for c in columns} columns_by_id = {(c.parentId, c.colId): c.id for c in columns} # Helper which returns the {'visibleCol', 'widgetOptions'} update visibleCol should be set. def convert_visible_col(col, widget_options): if not col.type.startswith('Ref:'): return None # To set visibleCol, we need to know the target table. Skip if we can't find it. target_table = tables_by_id.get(col.type[len('Ref:'):]) if not target_table: return None try: parsed_options = json.loads(widget_options) except Exception: return None # If invalid widgetOptions, skip this column. visible_col_id = parsed_options.pop('visibleCol', None) if not visible_col_id: return None # Find visible_col_id as the column name in the appropriate table. target_col_ref = (0 if visible_col_id == 'id' else columns_by_id.get((target_table.id, visible_col_id), None)) if target_col_ref is None: return None # Use compact separators without whitespace, to match how JS encodes JSON. return {'visibleCol': target_col_ref, 'widgetOptions': json.dumps(parsed_options, separators=(',', ':')) } for c in columns: new_values = convert_visible_col(c, c.widgetOptions) if new_values: doc_actions.append(actions.UpdateRecord('_grist_Tables_column', c.id, new_values)) fields = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Views_section_field'])) for f in fields: c = columns_by_ref.get(f.colRef) if c: new_values = convert_visible_col(c, f.widgetOptions) if new_values: doc_actions.append(actions.UpdateRecord('_grist_Views_section_field', f.id, new_values)) return tdset.apply_doc_actions(doc_actions) # This is actually the only migration that requires all tables because it modifies user data # (specifically, any columns of the deprecated "Image" type). @migration(schema_version=17, need_all_tables=True) def migration17(tdset): """ There is no longer an "Image" type for columns, as "Attachments" now serves as a display type for arbitrary files including images. Convert "Image" columns to "Attachments" columns. """ doc_actions = [] tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])) tables_map = {t.id: t for t in tables} columns = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables_column'])) # Convert columns from type 'Image' to type 'Attachments' affected_cols = [c for c in columns if c.type == 'Image'] conv = lambda val: [val] if isinstance(val, int) and val > 0 else [] if affected_cols: # Update the types in the data tables doc_actions.extend( actions.ModifyColumn(tables_map[c.parentId].tableId, c.colId, {'type': 'Attachments'}) for c in affected_cols ) # Update the values to lists for c in affected_cols: if c.isFormula: # Formula columns don't have data stored in DB, should not have data changes. continue table_id = tables_map[c.parentId].tableId table = tdset.all_tables[table_id] doc_actions.append( actions.BulkUpdateRecord(table_id, table.row_ids, {c.colId: [conv(val) for val in table.columns[c.colId]]}) ) # Update the types in the metadata tables doc_actions.append(actions.BulkUpdateRecord( '_grist_Tables_column', [c.id for c in affected_cols], {'type': ['Attachments' for c in affected_cols]} )) return tdset.apply_doc_actions(doc_actions) @migration(schema_version=18) def migration18(tdset): return tdset.apply_doc_actions([ add_column('_grist_DocInfo', 'timezone', 'Text'), # all documents prior to this migration have been created in New York actions.UpdateRecord('_grist_DocInfo', 1, {'timezone': 'America/New_York'}) ]) @migration(schema_version=19) def migration19(tdset): return tdset.apply_doc_actions([ add_column('_grist_Tables', 'onDemand', 'Bool'), ]) @migration(schema_version=20) def migration20(tdset): """ Add _grist_Pages table and populate based on existing TableViews entries, ie: tables are sorted alphabetically by their `tableId` and views are gathered within their corresponding table and sorted by their id. """ tables = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Tables'])) table_map = {t.id: t for t in tables} table_views = list(actions.transpose_bulk_action(tdset.all_tables['_grist_TableViews'])) # Old docs may include "Other views", not associated with any table. Don't include those in # table_views_map: they'll get included but not sorted or grouped by tableId. table_views_map = {tv.viewRef: table_map[tv.tableRef].tableId for tv in table_views if tv.tableRef in table_map} views = list(actions.transpose_bulk_action(tdset.all_tables['_grist_Views'])) def view_key(view): """ Returns ("Table1", 2) where "Table1" is the view's tableId and 2 the view id. For primary view (ie: not referenced in _grist_TableViews) returns ("Table1", -1). Useful to get the list of views sorted in the same way as in the Table side pane. We use -1 for primary view to make sure they come first among all the views of the same table. """ if view.id in table_views_map: return (table_views_map[view.id], view.id) # the name of primary view's is the same as the tableId return (view.name, -1) views.sort(key=view_key) row_ids = list(xrange(1, len(views) + 1)) return tdset.apply_doc_actions([ actions.AddTable('_grist_Pages', [ schema.make_column('viewRef', 'Ref:_grist_Views'), schema.make_column('pagePos', 'PositionNumber'), schema.make_column('indentation', 'Int'), ]), actions.ReplaceTableData('_grist_Pages', row_ids, { 'viewRef': [v.id for v in views], 'pagePos': row_ids, 'indentation': [1 if v.id in table_views_map else 0 for v in views] }) ]) @migration(schema_version=21) def migration21(tdset): return tdset.apply_doc_actions([ add_column('_grist_ACLRules', 'aclFormulaParsed', 'Text'), add_column('_grist_ACLRules', 'permissionsText', 'Text'), add_column('_grist_ACLRules', 'rulePos', 'PositionNumber'), add_column('_grist_ACLRules', 'userAttributes', 'Text'), ]) @migration(schema_version=22) def migration22(tdset): return tdset.apply_doc_actions([ add_column('_grist_Tables_column', 'recalcWhen', 'Int'), add_column('_grist_Tables_column', 'recalcDeps', 'RefList:_grist_Tables_column'), ]) @migration(schema_version=23) def migration23(tdset): return tdset.apply_doc_actions([ add_column('_grist_DocInfo', 'documentSettings', 'Text'), actions.UpdateRecord('_grist_DocInfo', 1, {'documentSettings': '{"locale":"en-US"}'}) ]) @migration(schema_version=24) def migration24(tdset): return tdset.apply_doc_actions([ actions.AddTable('_grist_Triggers', [ schema.make_column("tableRef", "Ref:_grist_Tables"), schema.make_column("eventTypes", "ChoiceList"), schema.make_column("isReadyColRef", "Ref:_grist_Tables_column"), schema.make_column("actions", "Text"), # JSON ]), ])
[ 1, 529, 9507, 29958, 29879, 26738, 29914, 629, 391, 29914, 26983, 800, 29889, 2272, 13, 5215, 4390, 13, 5215, 337, 13, 13, 5215, 4832, 13, 3166, 4832, 29889, 13529, 267, 1053, 921, 3881, 13, 13, 5215, 8820, 13, 5215, 2893, 14903, 13, 5215, 10938, 13, 5215, 15837, 13, 5215, 1591, 29918, 1272, 29918, 842, 13, 5215, 17927, 13, 1188, 353, 17927, 29889, 16363, 22168, 978, 1649, 29892, 17927, 29889, 11690, 29897, 13, 13, 29937, 349, 29950, 6227, 3267, 4590, 29950, 29979, 8079, 341, 6259, 29934, 8098, 29903, 29889, 13, 29937, 13, 29937, 1334, 881, 3117, 2360, 3349, 29892, 6623, 29892, 470, 19508, 15562, 6131, 470, 4341, 29889, 13, 29937, 8669, 29892, 591, 881, 871, 788, 29889, 13, 29937, 13, 29937, 1334, 508, 2791, 2030, 4341, 29914, 24051, 408, 18164, 29892, 607, 881, 367, 17262, 5174, 304, 5557, 502, 515, 13, 29937, 4417, 1021, 29899, 17514, 16212, 297, 278, 5434, 29889, 13, 29937, 13, 29937, 960, 591, 1735, 278, 6593, 310, 263, 1897, 29892, 591, 505, 304, 1653, 263, 716, 1897, 411, 263, 716, 1024, 29889, 13, 29937, 13, 29937, 910, 881, 1207, 372, 472, 3203, 16079, 368, 1950, 304, 6232, 10701, 491, 2305, 1058, 526, 451, 599, 373, 278, 13, 29937, 1021, 1632, 391, 1873, 313, 11884, 577, 29892, 372, 674, 1996, 901, 664, 467, 739, 881, 884, 1207, 372, 10579, 9109, 304, 13, 29937, 14955, 322, 769, 1722, 278, 1842, 411, 263, 3517, 1873, 29889, 13, 13, 497, 29918, 26983, 800, 353, 6571, 13, 13, 1753, 694, 459, 29918, 29885, 16783, 7373, 497, 29918, 24051, 1125, 13, 29871, 736, 5159, 13, 13, 29937, 7806, 20332, 740, 7805, 263, 869, 26180, 29918, 497, 29918, 24051, 5352, 29889, 2823, 20332, 580, 10200, 1061, 29889, 13, 1217, 459, 29918, 29885, 16783, 29889, 26180, 29918, 497, 29918, 24051, 353, 7700, 13, 13, 13, 1753, 1653, 29918, 26983, 800, 29898, 497, 29918, 24051, 29892, 15562, 29918, 6194, 29922, 8824, 1125, 13, 29871, 9995, 13, 29871, 6760, 1078, 322, 3639, 263, 1051, 310, 28197, 26525, 4312, 304, 6963, 445, 1842, 304, 13, 29871, 10938, 29889, 29903, 3210, 26862, 29918, 16358, 29889, 13, 1678, 599, 29918, 24051, 29901, 599, 6131, 470, 925, 278, 15562, 6131, 313, 386, 852, 4257, 411, 903, 629, 391, 29918, 10944, 29897, 408, 263, 13, 418, 8600, 10417, 1591, 1024, 304, 6137, 1469, 29889, 13, 1678, 15562, 29918, 6194, 29901, 881, 367, 731, 565, 871, 15562, 6131, 526, 4502, 297, 29889, 960, 15149, 6131, 526, 13, 418, 3734, 304, 1889, 9725, 800, 29892, 445, 1158, 674, 12020, 263, 376, 26180, 599, 6131, 17794, 3682, 29889, 13, 29871, 9995, 13, 29871, 1018, 29901, 13, 1678, 1574, 29918, 3259, 353, 599, 29918, 24051, 1839, 29918, 629, 391, 29918, 14526, 3401, 13359, 13099, 3366, 11010, 6594, 3108, 29961, 29900, 29962, 13, 29871, 5174, 8960, 29901, 13, 1678, 1574, 29918, 3259, 353, 29871, 29900, 13, 13, 29871, 396, 1334, 1653, 263, 6137, 28449, 29892, 322, 19450, 372, 411, 278, 11306, 310, 278, 1857, 10938, 393, 7087, 13, 29871, 396, 599, 29918, 24051, 29889, 1152, 4567, 4452, 29892, 591, 1207, 701, 6131, 322, 28907, 4341, 29892, 607, 881, 367, 9280, 13, 29871, 396, 1951, 591, 723, 451, 367, 4417, 716, 6475, 304, 18164, 4341, 29889, 13, 29871, 396, 3940, 393, 445, 2948, 3732, 372, 6058, 9280, 304, 1735, 1897, 4072, 29889, 13, 29871, 22599, 842, 353, 1591, 29918, 1272, 29918, 842, 29889, 3562, 28449, 580, 13, 13, 29871, 396, 1152, 1269, 1591, 297, 278, 4944, 15562, 6131, 29892, 1653, 385, 3462, 3562, 3158, 29889, 13, 29871, 1404, 29918, 11010, 353, 10938, 29889, 4282, 29918, 11010, 29898, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 7464, 13, 462, 462, 1678, 599, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 7464, 13, 462, 462, 1678, 3160, 29918, 16145, 262, 29922, 8824, 29897, 13, 29871, 363, 260, 297, 4832, 29889, 1524, 5975, 29898, 1792, 29918, 11010, 1125, 13, 1678, 22599, 842, 29889, 7302, 29918, 1514, 29918, 2467, 29898, 7387, 29889, 2528, 3562, 29898, 29873, 29889, 2371, 1204, 29892, 10938, 29889, 22724, 29918, 517, 29918, 8977, 29918, 1761, 29898, 29873, 29889, 13099, 4961, 13, 13, 29871, 396, 1152, 1269, 2030, 1591, 29914, 4914, 29892, 3386, 385, 3462, 3562, 3158, 773, 278, 1857, 10938, 29889, 13, 29871, 716, 29918, 11010, 353, 426, 29874, 29889, 2371, 29918, 333, 29901, 263, 363, 263, 297, 10938, 29889, 11010, 29918, 3258, 29918, 7387, 28296, 13, 29871, 363, 1591, 29918, 333, 29892, 848, 297, 12705, 29898, 28319, 29889, 1524, 7076, 29898, 497, 29918, 24051, 22164, 13, 1678, 396, 4911, 6131, 881, 2307, 367, 297, 22599, 842, 29936, 278, 1791, 1818, 367, 15562, 6131, 29889, 13, 1678, 396, 313, 3644, 15562, 29918, 6194, 338, 1565, 29892, 727, 338, 3763, 3078, 304, 14383, 1244, 1846, 13, 1678, 565, 1591, 29918, 333, 451, 297, 22599, 842, 29889, 497, 29918, 24051, 29901, 13, 418, 716, 29918, 1054, 29918, 3888, 353, 6571, 13, 418, 565, 1591, 29918, 333, 297, 716, 29918, 11010, 29901, 13, 4706, 716, 29918, 1054, 29918, 3888, 353, 426, 29883, 1839, 333, 2033, 29901, 274, 363, 274, 297, 716, 29918, 11010, 29961, 2371, 29918, 333, 1822, 13099, 29913, 13, 418, 396, 4803, 385, 28907, 2322, 363, 9815, 313, 29875, 29889, 29872, 29889, 18164, 29897, 4341, 29936, 777, 3913, 310, 278, 1897, 13, 418, 396, 723, 367, 8340, 29892, 1316, 408, 4417, 263, 716, 2407, 411, 4567, 1819, 29889, 13, 418, 784, 29918, 3888, 353, 12705, 4197, 1482, 29918, 1054, 29918, 3888, 29889, 657, 29898, 1054, 29918, 333, 29892, 11117, 333, 2396, 784, 29918, 333, 1800, 363, 784, 29918, 333, 297, 848, 29889, 13099, 1402, 13, 462, 4706, 1820, 29922, 2892, 274, 29901, 1051, 29898, 28319, 29889, 1524, 7076, 29898, 29883, 4961, 13, 418, 22599, 842, 29889, 7302, 29918, 1514, 29918, 2467, 29898, 7387, 29889, 2528, 3562, 29898, 2371, 29918, 333, 29892, 784, 29918, 3888, 876, 13, 13, 1678, 396, 1126, 2254, 297, 278, 2441, 848, 29892, 5133, 1259, 278, 6137, 1469, 1203, 408, 8313, 29895, 2528, 9182, 3158, 29889, 13, 1678, 22599, 842, 29889, 7302, 29918, 1514, 29918, 2467, 29898, 7387, 29889, 29933, 24456, 2528, 9182, 10456, 1272, 876, 13, 13, 29871, 20332, 29918, 7387, 353, 5159, 13, 29871, 363, 1873, 297, 921, 3881, 29898, 1514, 29918, 3259, 718, 29871, 29896, 29892, 10938, 29889, 29903, 3210, 26862, 29918, 16358, 718, 29871, 29896, 1125, 13, 1678, 20332, 29918, 9891, 353, 599, 29918, 26983, 800, 29889, 657, 29898, 3259, 29892, 694, 459, 29918, 29885, 16783, 29897, 13, 1678, 565, 20332, 29918, 9891, 29889, 26180, 29918, 497, 29918, 24051, 322, 15562, 29918, 6194, 29901, 13, 418, 12020, 8960, 703, 26180, 599, 6131, 363, 20332, 304, 1273, 29879, 29908, 1273, 1873, 29897, 13, 1678, 20332, 29918, 7387, 29889, 21843, 29898, 497, 29918, 26983, 800, 29889, 657, 29898, 3259, 29892, 694, 459, 29918, 29885, 16783, 5033, 1594, 842, 876, 13, 13, 29871, 396, 3940, 393, 565, 591, 526, 1623, 5105, 292, 6910, 313, 29875, 29889, 29872, 29889, 1574, 29918, 3259, 338, 6133, 511, 769, 278, 1494, 338, 13, 29871, 396, 278, 871, 3158, 591, 3160, 964, 278, 20332, 29889, 13, 29871, 20332, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 29871, 29896, 29892, 426, 13, 1678, 525, 11010, 6594, 2396, 10938, 29889, 29903, 3210, 26862, 29918, 16358, 13, 29871, 500, 876, 13, 29871, 736, 20332, 29918, 7387, 13, 13, 1753, 679, 29918, 4230, 29918, 29885, 16783, 29918, 3259, 7295, 13, 29871, 9995, 13, 29871, 16969, 278, 1833, 10938, 1873, 1353, 363, 607, 591, 505, 263, 20332, 3342, 29889, 13, 29871, 9995, 13, 29871, 736, 4236, 29898, 497, 29918, 26983, 800, 29897, 13, 13, 1753, 20332, 29898, 11010, 29918, 3259, 29892, 817, 29918, 497, 29918, 24051, 29922, 8824, 1125, 13, 29871, 9995, 13, 29871, 3826, 272, 1061, 363, 9725, 800, 393, 4067, 1078, 278, 10200, 630, 20332, 740, 411, 278, 2183, 13, 29871, 10938, 29918, 3259, 29889, 910, 10200, 630, 740, 674, 367, 1065, 304, 9725, 403, 6375, 304, 10938, 29918, 3259, 29889, 13, 13, 29871, 341, 4481, 800, 526, 937, 16388, 411, 871, 15562, 6131, 29892, 541, 565, 738, 3734, 20332, 740, 13, 29871, 338, 10902, 411, 817, 29918, 497, 29918, 24051, 29922, 5574, 29892, 769, 278, 20332, 674, 367, 3240, 1255, 411, 599, 6131, 29889, 13, 13, 29871, 6058, 29923, 29901, 716, 9725, 800, 881, 6058, 731, 817, 29918, 497, 29918, 24051, 29922, 5574, 29936, 372, 723, 1996, 901, 664, 304, 1889, 13, 29871, 1407, 2919, 10701, 23511, 313, 3742, 566, 292, 1906, 6943, 373, 29899, 2310, 392, 6131, 467, 13, 29871, 9995, 13, 29871, 822, 788, 29918, 29885, 16783, 29898, 29885, 16783, 29918, 9891, 1125, 13, 1678, 20332, 29918, 9891, 29889, 26180, 29918, 497, 29918, 24051, 353, 817, 29918, 497, 29918, 24051, 13, 1678, 599, 29918, 26983, 800, 29961, 11010, 29918, 3259, 29962, 353, 20332, 29918, 9891, 13, 1678, 736, 20332, 29918, 9891, 13, 29871, 736, 788, 29918, 29885, 16783, 13, 13, 29937, 319, 2217, 528, 2072, 392, 304, 1207, 3462, 4409, 8820, 901, 3022, 895, 29889, 13, 1753, 788, 29918, 4914, 29898, 2371, 29918, 333, 29892, 784, 29918, 333, 29892, 784, 29918, 1853, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 29871, 736, 8820, 29889, 2528, 4409, 29898, 2371, 29918, 333, 29892, 784, 29918, 333, 29892, 13, 462, 965, 10938, 29889, 5675, 29918, 4914, 29898, 1054, 29918, 333, 29892, 784, 29918, 1853, 29892, 334, 5085, 29892, 3579, 19290, 876, 13, 13, 29937, 7280, 528, 2072, 392, 304, 871, 788, 263, 1897, 565, 372, 3508, 29915, 29873, 2307, 727, 29889, 13, 1753, 5505, 29918, 1202, 29918, 4914, 29898, 1594, 842, 29892, 1591, 29918, 333, 29892, 784, 29918, 333, 29892, 784, 29918, 1853, 29892, 334, 5085, 29892, 3579, 19290, 1125, 13, 29871, 565, 784, 29918, 333, 451, 297, 22599, 842, 29889, 497, 29918, 24051, 29961, 2371, 29918, 333, 1822, 13099, 29901, 13, 1678, 736, 788, 29918, 4914, 29898, 2371, 29918, 333, 29892, 784, 29918, 333, 29892, 784, 29918, 1853, 29892, 334, 5085, 29892, 3579, 19290, 29897, 13, 29871, 736, 6213, 13, 13, 29937, 16969, 278, 2446, 443, 3880, 1948, 1178, 363, 278, 6475, 310, 278, 1591, 2183, 491, 1591, 29918, 333, 29889, 13, 1753, 2446, 29918, 333, 29898, 1594, 842, 29892, 1591, 29918, 333, 1125, 13, 29871, 1948, 29918, 4841, 353, 22599, 842, 29889, 497, 29918, 24051, 29961, 2371, 29918, 333, 1822, 798, 29918, 4841, 13, 29871, 736, 4236, 29898, 798, 29918, 4841, 29897, 718, 29871, 29896, 565, 1948, 29918, 4841, 1683, 29871, 29896, 13, 13, 29937, 1459, 29879, 267, 263, 4390, 1347, 29892, 541, 3639, 385, 4069, 1203, 363, 8340, 4390, 29889, 13, 1753, 9109, 29918, 5510, 29898, 3126, 29918, 710, 1125, 13, 29871, 1018, 29901, 13, 1678, 736, 4390, 29889, 18132, 29898, 3126, 29918, 710, 29897, 13, 29871, 5174, 7865, 2392, 29901, 13, 1678, 736, 6571, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29897, 13, 1753, 20332, 29896, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 11090, 6913, 1591, 29892, 322, 19450, 2729, 373, 5923, 13926, 29889, 13, 29871, 9995, 13, 29871, 1574, 29918, 7387, 353, 5159, 13, 13, 29871, 396, 450, 1407, 937, 20332, 338, 4805, 29899, 21222, 29892, 322, 10017, 777, 6131, 393, 526, 4567, 297, 777, 1243, 13, 29871, 396, 10561, 29889, 2193, 29915, 29879, 871, 1363, 591, 1258, 451, 20820, 10938, 1873, 1434, 9725, 800, 892, 13, 29871, 396, 8762, 29889, 5901, 9725, 800, 881, 451, 817, 1316, 4195, 1338, 29889, 13, 29871, 565, 22868, 629, 391, 29918, 4165, 496, 1860, 29915, 451, 297, 22599, 842, 29889, 497, 29918, 24051, 29901, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 2528, 3562, 703, 29918, 629, 391, 29918, 4165, 496, 1860, 613, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 1445, 7648, 613, 1678, 376, 1626, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 28926, 613, 268, 376, 1626, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 1445, 1542, 613, 268, 376, 1626, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 1445, 3505, 613, 268, 376, 2928, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 2230, 3373, 15638, 613, 376, 11384, 1159, 13, 1678, 4514, 876, 13, 13, 29871, 565, 22868, 629, 391, 29918, 8863, 6913, 29915, 451, 297, 22599, 842, 29889, 497, 29918, 24051, 29901, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 2528, 3562, 703, 29918, 629, 391, 29918, 8863, 6913, 613, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 2371, 5620, 613, 268, 376, 5620, 29901, 29918, 629, 391, 29918, 24924, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 1493, 5620, 613, 418, 376, 5620, 29901, 29918, 629, 391, 29918, 23825, 4968, 13, 1678, 4514, 876, 13, 13, 29871, 565, 525, 11010, 6594, 29915, 451, 297, 22599, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 14526, 3401, 13359, 13099, 29901, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 1202, 29918, 4914, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 525, 11010, 6594, 742, 525, 2928, 8785, 13, 13, 29871, 1574, 29918, 7387, 29889, 21843, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 4165, 496, 1860, 742, 525, 3027, 7011, 742, 525, 2928, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 4165, 496, 1860, 742, 525, 3027, 6110, 742, 525, 2928, 5477, 13, 259, 2314, 13, 13, 29871, 1776, 29918, 27117, 353, 8820, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 29918, 2042, 11287, 13, 29871, 4206, 353, 12705, 3319, 29898, 29879, 29889, 2371, 5620, 29892, 269, 29889, 3560, 1204, 29897, 363, 269, 297, 1776, 29918, 27117, 1800, 13, 29871, 565, 4206, 29901, 13, 1678, 1819, 353, 11117, 2371, 5620, 2396, 518, 29878, 29961, 29900, 29962, 363, 364, 297, 4206, 1402, 13, 795, 525, 1493, 5620, 2396, 29871, 518, 29878, 29961, 29896, 29962, 363, 364, 297, 4206, 12258, 13, 1678, 1948, 29918, 4841, 353, 1051, 29898, 29916, 3881, 29898, 29896, 29892, 7431, 29898, 5727, 29897, 718, 29871, 29896, 876, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 20083, 3562, 1469, 877, 29918, 629, 391, 29918, 8863, 6913, 742, 1948, 29918, 4841, 29892, 1819, 876, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29897, 13, 1753, 20332, 29906, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 6137, 23825, 1591, 29892, 322, 19450, 2729, 373, 5923, 13926, 29889, 13, 29871, 3462, 11090, 4297, 1591, 29892, 322, 19450, 2729, 373, 5923, 8386, 29889, 13, 29871, 3462, 28267, 1043, 1204, 304, 323, 1849, 322, 24146, 773, 4475, 23825, 13, 29871, 9995, 13, 29871, 396, 25846, 1591, 5620, 304, 1776, 5620, 13, 29871, 7601, 29918, 7406, 353, 6571, 13, 13, 29871, 396, 6853, 403, 1269, 1776, 411, 263, 2323, 1591, 29936, 445, 9657, 7805, 7601, 8386, 29889, 13, 29871, 8386, 29918, 517, 29918, 2371, 353, 6571, 13, 13, 29871, 396, 1152, 1269, 1591, 29892, 1284, 263, 1776, 304, 9080, 408, 278, 7601, 1776, 29889, 13, 29871, 1776, 29918, 27117, 353, 8820, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 29918, 2042, 11287, 13, 29871, 363, 269, 297, 1776, 29918, 27117, 29901, 13, 1678, 565, 269, 29889, 2371, 5620, 451, 297, 7601, 29918, 7406, 322, 269, 29889, 3560, 2558, 1275, 376, 11651, 1115, 13, 418, 396, 450, 1776, 6943, 445, 4004, 338, 263, 1781, 14020, 363, 7601, 1776, 29889, 13, 418, 7601, 29918, 7406, 29961, 29879, 29889, 2371, 5620, 29962, 353, 269, 29889, 3560, 1204, 13, 13, 1678, 565, 269, 29889, 3560, 1204, 451, 297, 8386, 29918, 517, 29918, 2371, 29901, 13, 418, 396, 450, 937, 931, 591, 1074, 263, 313, 1493, 29892, 1591, 29897, 10296, 29892, 25836, 278, 1776, 411, 393, 1591, 29889, 13, 418, 8386, 29918, 517, 29918, 2371, 29961, 29879, 29889, 3560, 1204, 29962, 353, 269, 29889, 2371, 5620, 13, 13, 29871, 822, 1653, 29918, 16072, 29918, 7406, 29918, 2467, 29898, 16072, 29918, 7406, 1125, 13, 1678, 1948, 29918, 4841, 353, 12705, 29898, 16072, 29918, 7406, 29889, 8149, 3101, 13, 1678, 1819, 353, 11117, 16072, 1043, 1204, 2396, 518, 16072, 29918, 7406, 29961, 29878, 29962, 363, 364, 297, 1948, 29918, 4841, 12258, 13, 1678, 736, 8820, 29889, 29933, 24456, 6422, 9182, 877, 29918, 629, 391, 29918, 24924, 742, 1948, 29918, 4841, 29892, 1819, 29897, 13, 13, 29871, 822, 1653, 29918, 3891, 29918, 1646, 29918, 2467, 29898, 7406, 29918, 517, 29918, 2371, 1125, 13, 1678, 1948, 29918, 4841, 353, 1051, 29898, 29916, 3881, 29898, 29896, 29892, 7431, 29898, 7406, 29918, 517, 29918, 2371, 29897, 718, 29871, 29896, 876, 13, 1678, 736, 8820, 29889, 20083, 3562, 1469, 877, 29918, 629, 391, 29918, 8863, 4297, 742, 1948, 29918, 4841, 29892, 426, 13, 418, 525, 1493, 5620, 2396, 12705, 29898, 7406, 29918, 517, 29918, 2371, 29889, 8149, 3101, 13, 1678, 5615, 13, 13, 29871, 822, 1653, 29918, 2371, 29918, 7406, 29918, 2467, 29898, 7406, 29918, 517, 29918, 2371, 29892, 7601, 29918, 7406, 1125, 13, 1678, 4475, 29918, 7406, 353, 12705, 29898, 842, 29898, 7406, 29918, 517, 29918, 2371, 29889, 8149, 3101, 448, 731, 29898, 16072, 29918, 7406, 29889, 5975, 22130, 13, 1678, 1948, 29918, 4841, 353, 1051, 29898, 29916, 3881, 29898, 29896, 29892, 7431, 29898, 12817, 29918, 7406, 29897, 718, 29871, 29896, 876, 13, 1678, 736, 8820, 29889, 20083, 3562, 1469, 877, 29918, 629, 391, 29918, 3562, 23825, 742, 1948, 29918, 4841, 29892, 426, 13, 418, 525, 2371, 5620, 2396, 518, 7406, 29918, 517, 29918, 2371, 29961, 29894, 29962, 363, 325, 297, 4475, 29918, 7406, 1402, 13, 418, 525, 1493, 5620, 2396, 29871, 4475, 29918, 7406, 29892, 13, 1678, 5615, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 8863, 4297, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1493, 5620, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 23825, 5477, 13, 1678, 4514, 511, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 3562, 23825, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 2371, 5620, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1493, 5620, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 23825, 5477, 13, 1678, 4514, 511, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 742, 525, 16072, 1043, 1204, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 23825, 5477, 13, 1678, 1653, 29918, 16072, 29918, 7406, 29918, 2467, 29898, 16072, 29918, 7406, 511, 13, 1678, 1653, 29918, 3891, 29918, 1646, 29918, 2467, 29898, 7406, 29918, 517, 29918, 2371, 511, 13, 1678, 1653, 29918, 2371, 29918, 7406, 29918, 2467, 29898, 7406, 29918, 517, 29918, 2371, 29892, 7601, 29918, 7406, 29897, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29941, 29897, 13, 1753, 20332, 29941, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 1670, 338, 694, 5520, 263, 376, 15383, 2347, 29908, 1134, 363, 4341, 29892, 322, 15837, 6131, 671, 278, 1134, 13907, 363, 13, 29871, 278, 1897, 1641, 19138, 1891, 29889, 1152, 2030, 10701, 29892, 3588, 376, 15383, 2347, 29908, 1134, 304, 376, 10773, 613, 322, 10365, 278, 13, 29871, 8744, 310, 376, 20401, 2816, 2528, 15383, 2347, 25318, 740, 29889, 13, 29871, 9995, 13, 29871, 396, 3940, 393, 445, 338, 263, 12092, 20332, 29892, 322, 14364, 22691, 1363, 372, 338, 1434, 1749, 1407, 13, 29871, 396, 937, 6507, 29889, 1152, 263, 5492, 3234, 29892, 263, 1735, 763, 445, 881, 367, 2309, 297, 263, 28953, 13, 29871, 396, 15878, 982, 29901, 3013, 541, 16460, 403, 525, 15383, 2347, 2670, 14944, 263, 16280, 2816, 2528, 15383, 2347, 29906, 580, 304, 671, 363, 716, 13, 29871, 396, 15837, 6131, 29892, 541, 3013, 278, 2030, 5067, 408, 1532, 363, 5923, 6743, 29889, 450, 2769, 338, 393, 1316, 13, 29871, 396, 9725, 800, 526, 1059, 29899, 558, 650, 322, 1122, 4473, 701, 20330, 29915, 848, 29889, 13, 29871, 1574, 29918, 7387, 353, 5159, 13, 29871, 6131, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 25901, 13, 29871, 6131, 29918, 1958, 353, 426, 29873, 29889, 333, 29901, 260, 363, 260, 297, 6131, 29913, 13, 29871, 4341, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 25901, 13, 13, 29871, 396, 14806, 4341, 515, 1134, 525, 15383, 2347, 29915, 304, 1134, 525, 10773, 29915, 13, 29871, 15201, 29918, 22724, 353, 518, 29883, 363, 274, 297, 4341, 565, 274, 29889, 1853, 1275, 525, 15383, 2347, 2033, 13, 29871, 565, 15201, 29918, 22724, 29901, 13, 1678, 1574, 29918, 7387, 29889, 21843, 29898, 13, 418, 8820, 29889, 2111, 1598, 4409, 29898, 24051, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1822, 2371, 1204, 29892, 274, 29889, 1054, 1204, 29892, 11117, 1853, 2396, 525, 10773, 29915, 1800, 13, 418, 363, 274, 297, 15201, 29918, 22724, 13, 1678, 1723, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 418, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 13, 418, 518, 29883, 29889, 333, 363, 274, 297, 15201, 29918, 22724, 1402, 13, 418, 11117, 1853, 2396, 6024, 10773, 29915, 363, 274, 297, 15201, 29918, 22724, 12258, 13, 268, 876, 13, 13, 29871, 396, 14806, 26760, 310, 278, 883, 15300, 20401, 2816, 2528, 15383, 2347, 1566, 29916, 8209, 29891, 16029, 304, 15300, 20401, 2816, 2528, 15383, 2347, 29898, 29916, 6080, 29916, 29892, 29891, 6080, 29891, 16029, 13, 29871, 7063, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 1194, 29893, 29974, 467, 20401, 2816, 2528, 15383, 2347, 29905, 3552, 5575, 29973, 27779, 1495, 13, 29871, 1852, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 3823, 29938, 1194, 29893, 29974, 1262, 1495, 13, 29871, 822, 5191, 29898, 4352, 1125, 13, 1678, 6389, 353, 9162, 11393, 7122, 29898, 1191, 29918, 276, 29889, 1491, 29898, 29878, 12764, 29896, 29922, 4535, 29896, 742, 1852, 29889, 17010, 3101, 363, 1852, 297, 1993, 29889, 2972, 29898, 29906, 467, 5451, 29898, 3284, 876, 13, 1678, 736, 14210, 29879, 29889, 20401, 2816, 2528, 15383, 2347, 29414, 29879, 16029, 1273, 313, 4352, 29889, 2972, 29898, 29896, 511, 6389, 29897, 13, 13, 29871, 7063, 29918, 786, 15190, 353, 5159, 13, 29871, 363, 274, 297, 4341, 29901, 13, 1678, 716, 29918, 689, 2497, 353, 274, 29889, 689, 2497, 322, 7063, 29918, 276, 29889, 1491, 29898, 6506, 29892, 274, 29889, 689, 2497, 29897, 13, 1678, 565, 716, 29918, 689, 2497, 2804, 274, 29889, 689, 2497, 29901, 13, 418, 7063, 29918, 786, 15190, 29889, 4397, 3552, 29883, 29892, 716, 29918, 689, 2497, 876, 13, 13, 29871, 565, 7063, 29918, 786, 15190, 29901, 13, 1678, 1574, 29918, 7387, 29889, 21843, 29898, 13, 418, 8820, 29889, 2111, 1598, 4409, 29898, 24051, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1822, 2371, 1204, 29892, 274, 29889, 1054, 1204, 29892, 11117, 689, 2497, 2396, 285, 1800, 13, 418, 363, 274, 29892, 285, 297, 7063, 29918, 786, 15190, 13, 1678, 1723, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 418, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 13, 418, 518, 29883, 29889, 333, 363, 274, 29892, 285, 297, 7063, 29918, 786, 15190, 1402, 13, 418, 11117, 689, 2497, 2396, 518, 29888, 363, 274, 29892, 285, 297, 7063, 29918, 786, 15190, 12258, 13, 268, 876, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29946, 29897, 13, 1753, 20332, 29946, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 11090, 9135, 1897, 304, 11090, 4297, 1591, 13, 29871, 9995, 13, 29871, 1574, 29918, 7387, 353, 5159, 13, 29871, 1948, 29918, 4841, 353, 22599, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 8863, 4297, 13359, 798, 29918, 4841, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 1202, 29918, 4914, 877, 29918, 629, 391, 29918, 8863, 4297, 742, 525, 3891, 9135, 742, 525, 8003, 4557, 8785, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 877, 29918, 629, 391, 29918, 8863, 4297, 742, 1948, 29918, 4841, 29892, 11117, 3891, 9135, 2396, 1948, 29918, 4841, 20073, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29945, 29897, 13, 1753, 20332, 29945, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 742, 525, 16072, 1043, 3562, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 742, 13, 1669, 7063, 2433, 29918, 629, 391, 29918, 24924, 29889, 20401, 6716, 29898, 16072, 1043, 1204, 6080, 333, 29897, 742, 338, 2500, 2497, 29922, 5574, 511, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29953, 29897, 13, 1753, 20332, 29953, 29898, 1594, 842, 1125, 13, 29871, 396, 910, 563, 29877, 267, 278, 3517, 20332, 29892, 1951, 7601, 1043, 3562, 338, 1286, 263, 7063, 2024, 304, 278, 13, 29871, 396, 11982, 1884, 3265, 1135, 760, 310, 278, 1842, 10938, 29889, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 8820, 29889, 15941, 4409, 877, 29918, 629, 391, 29918, 23825, 742, 525, 16072, 1043, 3562, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29955, 29897, 13, 1753, 20332, 29955, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 15837, 4435, 3562, 29914, 7727, 4435, 1625, 4235, 304, 15562, 29892, 322, 10365, 5923, 15837, 6131, 13, 29871, 304, 3928, 304, 278, 716, 3114, 29889, 13, 29871, 9995, 13, 29871, 396, 3940, 29901, 445, 20332, 756, 777, 12570, 29879, 29889, 13, 29871, 396, 448, 739, 1838, 29915, 29873, 5217, 1776, 13438, 14256, 363, 4341, 372, 25388, 313, 361, 263, 1404, 2715, 777, 4266, 13, 29871, 396, 259, 4341, 7522, 29889, 13, 29871, 396, 448, 739, 1838, 29915, 29873, 2329, 4072, 310, 12105, 4341, 393, 2737, 304, 2030, 29899, 3293, 15837, 6131, 13, 29871, 396, 259, 313, 361, 278, 1404, 2825, 777, 1316, 4341, 7522, 467, 13, 13, 29871, 1574, 29918, 7387, 353, 518, 2467, 363, 3158, 297, 518, 13, 1678, 5505, 29918, 1202, 29918, 4914, 29898, 1594, 842, 29892, 22868, 629, 391, 29918, 24924, 742, 525, 7727, 4435, 3562, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 5477, 13, 1678, 5505, 29918, 1202, 29918, 4914, 29898, 1594, 842, 29892, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 7727, 4435, 1625, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 1495, 13, 29871, 4514, 565, 3158, 29962, 13, 13, 29871, 396, 25846, 1591, 5620, 304, 6137, 1203, 29889, 13, 29871, 6131, 29918, 1958, 353, 426, 29873, 29889, 333, 29901, 260, 363, 260, 297, 8820, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 2033, 2915, 13, 13, 29871, 396, 25846, 1591, 1170, 304, 1591, 5620, 13, 29871, 1591, 29918, 978, 29918, 517, 29918, 999, 353, 426, 29873, 29889, 2371, 1204, 29901, 260, 29889, 333, 363, 260, 297, 4832, 29889, 1524, 5975, 29898, 24051, 29918, 1958, 2915, 13, 13, 29871, 396, 2391, 310, 12481, 3618, 13, 29871, 4341, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 25901, 13, 13, 29871, 396, 25846, 1897, 5620, 304, 12481, 1203, 29889, 13, 29871, 4341, 29918, 1958, 29918, 1609, 29918, 999, 353, 426, 29883, 29889, 333, 29901, 274, 363, 274, 297, 4341, 29913, 13, 13, 29871, 396, 25846, 313, 2371, 5620, 29892, 784, 1170, 29897, 304, 12481, 1203, 29889, 13, 29871, 4341, 29918, 1958, 29918, 1609, 29918, 2371, 29918, 1054, 333, 353, 426, 29898, 29883, 29889, 3560, 1204, 29892, 274, 29889, 1054, 1204, 1125, 274, 363, 274, 297, 4341, 29913, 13, 13, 29871, 396, 3789, 310, 599, 1591, 8659, 29889, 13, 29871, 1591, 29918, 978, 29918, 842, 353, 731, 29898, 2371, 29918, 978, 29918, 517, 29918, 999, 29889, 8149, 3101, 13, 13, 29871, 3349, 29918, 22724, 353, 5159, 4706, 396, 2391, 310, 4341, 304, 3349, 13, 29871, 7063, 29918, 786, 15190, 353, 5159, 1678, 396, 2391, 310, 313, 4914, 29892, 716, 29918, 2371, 29918, 978, 29892, 716, 29918, 689, 2497, 29897, 11000, 13, 29871, 1591, 29918, 1267, 1280, 353, 5159, 418, 396, 2391, 310, 313, 2371, 29892, 716, 29918, 978, 29897, 11000, 13, 29871, 2752, 29918, 24051, 353, 5159, 418, 396, 2391, 310, 313, 2371, 29892, 15837, 4435, 3562, 29897, 11000, 13, 29871, 2752, 29918, 22724, 353, 5159, 4706, 396, 2391, 310, 313, 4914, 29892, 15837, 4435, 4409, 29897, 11000, 13, 13, 29871, 396, 6991, 5219, 6131, 1304, 304, 367, 4257, 408, 376, 26289, 29918, 29966, 4435, 1170, 29958, 29918, 29966, 1625, 5620, 29896, 29958, 29918, 29966, 1625, 5620, 29906, 29958, 1642, 910, 4943, 13, 29871, 396, 4603, 610, 29879, 267, 393, 29889, 13, 29871, 15837, 29918, 276, 353, 337, 29889, 12198, 29898, 29878, 29915, 29985, 26289, 29918, 1194, 29893, 29974, 7897, 3552, 25825, 3187, 29881, 29974, 11877, 1262, 1495, 13, 29871, 363, 260, 297, 4832, 29889, 1524, 5975, 29898, 24051, 29918, 1958, 1125, 13, 1678, 286, 353, 15837, 29918, 276, 29889, 4352, 29898, 29873, 29889, 2371, 1204, 29897, 13, 1678, 565, 451, 286, 470, 286, 29889, 2972, 29898, 29896, 29897, 451, 297, 1591, 29918, 978, 29918, 517, 29918, 999, 29901, 13, 418, 6773, 13, 1678, 396, 1334, 505, 263, 2854, 15837, 1591, 29889, 13, 1678, 2752, 29918, 2371, 29918, 978, 353, 286, 29889, 2972, 29898, 29896, 29897, 13, 1678, 2752, 29918, 2371, 29918, 999, 353, 1591, 29918, 978, 29918, 517, 29918, 999, 29961, 4993, 29918, 2371, 29918, 978, 29962, 13, 1678, 2318, 1609, 29918, 1054, 24539, 353, 518, 524, 29898, 29916, 29897, 363, 921, 297, 286, 29889, 2972, 29898, 29906, 467, 17010, 703, 29918, 2564, 5451, 703, 29918, 13531, 13, 1678, 396, 349, 3445, 598, 263, 716, 29899, 3293, 1024, 363, 278, 15837, 1591, 29889, 1522, 1854, 451, 304, 14529, 411, 5923, 6131, 13, 1678, 396, 470, 411, 1269, 916, 313, 29875, 29889, 29872, 29889, 1016, 29915, 29873, 19508, 2999, 6131, 304, 278, 1021, 1024, 467, 13, 1678, 716, 29918, 978, 353, 15837, 29889, 12508, 29918, 7727, 29918, 2371, 29918, 978, 29898, 4993, 29918, 2371, 29918, 978, 29897, 13, 1678, 716, 29918, 978, 353, 2893, 14903, 29889, 23945, 29918, 2371, 29918, 1693, 29898, 1482, 29918, 978, 29892, 4772, 29922, 2371, 29918, 978, 29918, 842, 29897, 13, 1678, 1591, 29918, 978, 29918, 842, 29889, 1202, 29898, 1482, 29918, 978, 29897, 13, 1678, 1480, 29889, 25442, 703, 3373, 5105, 292, 15837, 1591, 1273, 29879, 363, 1273, 29879, 29414, 29879, 29897, 304, 1273, 29879, 29908, 1273, 313, 13, 418, 260, 29889, 2371, 1204, 29892, 2752, 29918, 2371, 29918, 978, 29892, 2318, 1609, 29918, 1054, 24539, 29892, 716, 29918, 978, 876, 13, 13, 1678, 396, 15154, 278, 376, 20401, 2816, 2528, 15383, 2347, 29908, 1897, 515, 278, 2752, 1591, 313, 4716, 338, 4257, 773, 278, 13, 1678, 396, 15837, 1591, 1024, 363, 967, 784, 1204, 467, 13, 1678, 3349, 29918, 22724, 29889, 21843, 29898, 29883, 363, 274, 297, 4341, 13, 462, 539, 565, 274, 29889, 3560, 1204, 1275, 2752, 29918, 2371, 29918, 999, 322, 274, 29889, 1054, 1204, 1275, 260, 29889, 2371, 1204, 29897, 13, 13, 1678, 396, 5020, 8228, 278, 376, 2972, 29908, 7063, 297, 278, 15837, 1591, 29889, 13, 1678, 3806, 29918, 2972, 29918, 689, 2497, 353, 11860, 29879, 29889, 20401, 4789, 4339, 29414, 29879, 6080, 333, 5513, 1273, 313, 4993, 29918, 2371, 29918, 978, 29892, 260, 29889, 2371, 1204, 29897, 13, 1678, 716, 29918, 689, 2497, 353, 376, 2371, 29889, 657, 26289, 4435, 4782, 29898, 3757, 5513, 13, 1678, 7063, 29918, 786, 15190, 29889, 21843, 3552, 29883, 29892, 716, 29918, 978, 29892, 716, 29918, 689, 2497, 29897, 363, 274, 297, 4341, 13, 462, 965, 565, 313, 29883, 29889, 3560, 1204, 1275, 260, 29889, 333, 322, 274, 29889, 1054, 1204, 1275, 376, 2972, 29908, 322, 13, 462, 1669, 274, 29889, 689, 2497, 1275, 3806, 29918, 2972, 29918, 689, 2497, 876, 13, 13, 1678, 396, 1102, 11272, 263, 19508, 310, 278, 15837, 1591, 29889, 13, 1678, 1591, 29918, 1267, 1280, 29889, 4397, 3552, 29873, 29892, 716, 29918, 978, 876, 13, 13, 1678, 396, 3789, 15837, 4435, 3562, 4235, 373, 278, 15562, 29889, 13, 1678, 2752, 29918, 24051, 29889, 4397, 3552, 29873, 29892, 2752, 29918, 2371, 29918, 999, 876, 13, 13, 1678, 396, 3789, 15837, 4435, 1625, 4235, 297, 278, 15562, 29889, 1334, 817, 304, 1284, 278, 1492, 15837, 1897, 29889, 13, 1678, 2318, 1609, 29918, 22724, 353, 731, 580, 13, 1678, 363, 784, 29918, 999, 297, 2318, 1609, 29918, 1054, 24539, 29901, 13, 418, 4765, 29918, 1054, 353, 4341, 29918, 1958, 29918, 1609, 29918, 999, 29889, 657, 29898, 1054, 29918, 999, 29897, 13, 418, 2533, 29918, 1054, 353, 4341, 29918, 1958, 29918, 1609, 29918, 2371, 29918, 1054, 333, 29889, 657, 3552, 29873, 29889, 333, 29892, 4765, 29918, 1054, 29889, 1054, 1204, 876, 565, 4765, 29918, 1054, 1683, 6213, 13, 418, 565, 2533, 29918, 1054, 29901, 13, 4706, 2318, 1609, 29918, 22724, 29889, 1202, 29898, 2083, 29918, 1054, 29897, 13, 4706, 2752, 29918, 22724, 29889, 4397, 3552, 2083, 29918, 1054, 29892, 4765, 29918, 1054, 29889, 333, 876, 13, 418, 1683, 29901, 13, 4706, 1480, 29889, 25442, 703, 3373, 5105, 292, 15837, 1591, 1273, 29879, 29901, 8496, 29915, 29873, 1284, 1897, 1273, 29879, 29908, 1273, 313, 29873, 29889, 2371, 1204, 29892, 784, 29918, 999, 876, 13, 13, 1678, 396, 9788, 29892, 591, 505, 304, 3349, 599, 1661, 29899, 689, 2497, 4341, 393, 526, 451, 2318, 1609, 29899, 13099, 313, 29872, 29889, 29887, 29889, 13, 1678, 396, 525, 11288, 13685, 5477, 1363, 278, 716, 2948, 15894, 15149, 1661, 29899, 689, 2497, 4341, 526, 363, 2318, 1609, 29889, 13, 1678, 3349, 29918, 22724, 29889, 21843, 29898, 29883, 363, 274, 297, 4341, 13, 462, 539, 565, 274, 29889, 3560, 1204, 1275, 260, 29889, 333, 322, 274, 451, 297, 2318, 1609, 29918, 22724, 322, 451, 274, 29889, 275, 2500, 2497, 29897, 13, 13, 29871, 396, 6204, 599, 278, 1574, 8820, 515, 278, 7049, 591, 13240, 29889, 13, 13, 29871, 396, 10554, 3349, 29918, 22724, 13, 29871, 1574, 29918, 7387, 29889, 21843, 29898, 13, 1678, 8820, 29889, 15941, 4409, 29898, 24051, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1822, 2371, 1204, 29892, 274, 29889, 1054, 1204, 29897, 363, 274, 297, 3349, 29918, 22724, 29897, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 15941, 9182, 29898, 13, 1678, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 518, 29883, 29889, 333, 363, 274, 297, 3349, 29918, 22724, 12622, 13, 13, 29871, 396, 10554, 1591, 29918, 1267, 1280, 13, 29871, 1574, 29918, 7387, 29889, 21843, 29898, 13, 1678, 8820, 29889, 29934, 3871, 3562, 29898, 29873, 29889, 2371, 1204, 29892, 716, 29897, 363, 313, 29873, 29892, 716, 29897, 297, 1591, 29918, 1267, 1280, 29897, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 1678, 22868, 629, 391, 29918, 24924, 742, 518, 29873, 29889, 333, 363, 260, 29892, 716, 297, 1591, 29918, 1267, 1280, 1402, 13, 1678, 11117, 2371, 1204, 2396, 518, 1482, 363, 260, 29892, 716, 297, 1591, 29918, 1267, 1280, 12258, 13, 259, 876, 13, 13, 29871, 396, 10554, 2752, 29918, 24051, 322, 2752, 29918, 22724, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 1678, 22868, 629, 391, 29918, 24924, 742, 518, 29873, 29889, 333, 363, 260, 29892, 2143, 297, 2752, 29918, 24051, 1402, 13, 1678, 11117, 7727, 4435, 3562, 2396, 518, 999, 363, 260, 29892, 2143, 297, 2752, 29918, 24051, 12258, 13, 259, 876, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 1678, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 518, 29873, 29889, 333, 363, 260, 29892, 2143, 297, 2752, 29918, 22724, 1402, 13, 1678, 11117, 7727, 4435, 1625, 2396, 518, 999, 363, 260, 29892, 2143, 297, 2752, 29918, 22724, 12258, 13, 259, 876, 13, 13, 29871, 396, 10554, 7063, 29918, 786, 15190, 29889, 1938, 445, 1833, 1951, 337, 15807, 362, 310, 1438, 1122, 4556, 716, 6475, 2715, 13, 29871, 396, 304, 15837, 6131, 29892, 577, 591, 881, 505, 599, 278, 6131, 5149, 731, 701, 491, 445, 931, 29889, 13, 29871, 1574, 29918, 7387, 29889, 21843, 29898, 13, 1678, 8820, 29889, 2111, 1598, 4409, 29898, 2371, 29918, 333, 29892, 274, 29889, 1054, 1204, 29892, 11117, 689, 2497, 2396, 285, 1800, 13, 1678, 363, 274, 29892, 1591, 29918, 333, 29892, 285, 297, 7063, 29918, 786, 15190, 29897, 13, 29871, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 1678, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 518, 29883, 29889, 333, 363, 274, 29892, 260, 29892, 285, 297, 7063, 29918, 786, 15190, 1402, 13, 1678, 11117, 689, 2497, 2396, 518, 29888, 363, 274, 29892, 260, 29892, 285, 297, 7063, 29918, 786, 15190, 12258, 13, 259, 876, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29947, 29897, 13, 1753, 20332, 29947, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 1657, 347, 1625, 1204, 4591, 4775, 742, 525, 24693, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29929, 29897, 13, 1753, 20332, 29929, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 4990, 1625, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 742, 525, 4990, 1625, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29900, 29897, 13, 1753, 20332, 29896, 29900, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 2479, 1625, 304, 599, 3407, 28730, 29892, 411, 7063, 395, 29966, 999, 29918, 1054, 29918, 333, 15513, 29966, 12872, 29918, 1054, 29918, 333, 29958, 13, 29871, 313, 9842, 393, 2479, 1625, 1746, 471, 2715, 297, 278, 3517, 20332, 1846, 13, 29871, 9995, 13, 29871, 1574, 29918, 7387, 353, 5159, 13, 29871, 6131, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 25901, 13, 29871, 4341, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 25901, 13, 13, 29871, 396, 25846, 1591, 5620, 304, 1591, 1204, 29889, 13, 29871, 6131, 29918, 1958, 353, 426, 29873, 29889, 333, 29901, 260, 29889, 2371, 1204, 363, 260, 297, 6131, 29913, 13, 13, 29871, 396, 25846, 1591, 5620, 304, 6166, 310, 784, 21943, 297, 278, 6131, 29889, 501, 8485, 304, 5557, 10324, 784, 21943, 29889, 13, 29871, 1591, 29918, 1054, 29918, 4841, 353, 426, 29873, 29889, 333, 29901, 731, 29898, 1594, 842, 29889, 497, 29918, 24051, 29961, 29873, 29889, 2371, 1204, 1822, 13099, 29889, 8149, 3101, 363, 260, 297, 6131, 29913, 13, 13, 29871, 396, 3617, 278, 2446, 8617, 2556, 1897, 1948, 1178, 29889, 13, 29871, 1948, 29918, 333, 353, 2446, 29918, 333, 29898, 1594, 842, 29892, 22868, 629, 391, 29918, 24924, 29918, 4914, 1495, 13, 13, 29871, 363, 274, 297, 4341, 29901, 13, 1678, 396, 960, 263, 1897, 338, 263, 3407, 411, 385, 443, 842, 2479, 1897, 29892, 788, 263, 2479, 1897, 29889, 13, 1678, 565, 274, 29889, 1853, 29889, 27382, 2541, 877, 5620, 29901, 1495, 322, 451, 274, 29889, 4990, 1625, 29901, 13, 418, 396, 3617, 7962, 29918, 1054, 29918, 333, 29889, 960, 451, 1476, 29892, 1948, 1178, 338, 1304, 322, 694, 2479, 784, 338, 5181, 29889, 13, 418, 7962, 29918, 1054, 29918, 333, 353, 5124, 13, 418, 1018, 29901, 13, 4706, 7962, 29918, 1054, 29918, 333, 353, 4390, 29889, 18132, 29898, 29883, 29889, 8030, 5856, 467, 657, 877, 12872, 1625, 1495, 13, 4706, 565, 451, 7962, 29918, 1054, 29918, 333, 29901, 13, 3986, 6773, 13, 418, 5174, 8960, 29901, 13, 4706, 6773, 259, 396, 960, 8340, 11109, 5856, 29892, 14383, 445, 1897, 29889, 13, 13, 418, 396, 3789, 7063, 304, 671, 278, 1857, 7962, 1625, 297, 11109, 5856, 29889, 13, 418, 7063, 353, 4852, 29938, 29995, 29879, 29889, 29995, 29879, 29908, 1273, 313, 29883, 29889, 1054, 1204, 29892, 7962, 29918, 1054, 29918, 333, 876, 13, 13, 418, 396, 3617, 263, 5412, 784, 1204, 363, 278, 2479, 1897, 29892, 322, 788, 372, 304, 278, 731, 310, 1304, 18999, 29889, 13, 418, 1304, 29918, 1054, 29918, 4841, 353, 1591, 29918, 1054, 29918, 4841, 29961, 29883, 29889, 3560, 1204, 29962, 13, 418, 2479, 29918, 1054, 29918, 333, 353, 2893, 14903, 29889, 23945, 29918, 1054, 29918, 1693, 877, 629, 391, 10739, 29918, 9323, 742, 4772, 29922, 3880, 29918, 1054, 29918, 4841, 29897, 13, 418, 1304, 29918, 1054, 29918, 4841, 29889, 1202, 29898, 4990, 29918, 1054, 29918, 333, 29897, 13, 13, 418, 396, 3462, 599, 8820, 304, 278, 1051, 29889, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 1202, 29918, 4914, 29898, 24051, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1402, 525, 629, 391, 10739, 29918, 9323, 742, 525, 10773, 742, 13, 4706, 7063, 29922, 689, 2497, 29892, 338, 2500, 2497, 29922, 5574, 876, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 2528, 9182, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 1948, 29918, 333, 29892, 426, 13, 4706, 525, 3560, 9135, 2396, 29871, 29896, 29889, 29900, 29892, 13, 4706, 525, 1643, 2396, 525, 629, 391, 10739, 29918, 9323, 742, 13, 4706, 525, 275, 2500, 2497, 2396, 5852, 29892, 13, 4706, 525, 3560, 1204, 2396, 274, 29889, 3560, 1204, 29892, 13, 4706, 525, 1054, 1204, 2396, 525, 629, 391, 10739, 29918, 9323, 742, 13, 4706, 525, 689, 2497, 2396, 7063, 29892, 13, 4706, 525, 8030, 5856, 2396, 15516, 13, 4706, 525, 1853, 2396, 525, 10773, 29915, 13, 418, 500, 876, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 274, 29889, 333, 29892, 11117, 4990, 1625, 2396, 1948, 29918, 333, 20073, 13, 13, 418, 396, 512, 17053, 1948, 1178, 304, 278, 2446, 443, 3880, 29889, 13, 418, 1948, 29918, 333, 4619, 29871, 29896, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29896, 29897, 13, 1753, 20332, 29896, 29896, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 742, 525, 17987, 1204, 742, 525, 1626, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29906, 29897, 13, 1753, 20332, 29896, 29906, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 742, 525, 6768, 742, 525, 1626, 1495, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29941, 29897, 13, 1753, 20332, 29896, 29941, 29898, 1594, 842, 1125, 13, 29871, 396, 3462, 29879, 263, 25972, 1204, 304, 278, 4152, 1842, 304, 2125, 10631, 310, 25972, 9863, 29889, 13, 29871, 396, 3645, 445, 1873, 373, 29892, 8297, 1204, 338, 18164, 29889, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 525, 29890, 7896, 1204, 742, 525, 1626, 1495, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29946, 29897, 13, 1753, 20332, 29896, 29946, 29898, 1594, 842, 1125, 13, 29871, 396, 6204, 278, 319, 6154, 1591, 5300, 884, 278, 2322, 319, 6154, 6471, 29892, 2322, 6503, 29892, 322, 278, 2322, 5751, 29889, 13, 29871, 396, 4525, 1993, 278, 8820, 7436, 304, 716, 1842, 491, 525, 6644, 4373, 14526, 29915, 1404, 2467, 313, 294, 310, 325, 29896, 29946, 467, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 2477, 26369, 13415, 14587, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 3560, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 2477, 29931, 4040, 2173, 29886, 1338, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 5145, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 2477, 29931, 4040, 2173, 29886, 1338, 5477, 13, 1678, 4514, 511, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 2477, 29931, 4040, 2173, 29886, 1338, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1792, 1170, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 2972, 1170, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1792, 9823, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 8758, 1204, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1853, 742, 525, 1626, 5477, 13, 1678, 4514, 511, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 2477, 29931, 13770, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1054, 21943, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 2371, 1204, 742, 525, 1626, 5477, 13, 1678, 4514, 511, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 562, 29880, 2500, 2497, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 558, 2173, 29886, 1338, 742, 525, 1626, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 10314, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 2477, 29931, 13770, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 562, 29880, 4409, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 17858, 6847, 742, 525, 2928, 5477, 13, 1678, 4514, 511, 13, 13, 1678, 396, 3789, 701, 2847, 319, 6154, 848, 29889, 13, 1678, 8820, 29889, 29933, 24456, 2528, 9182, 877, 29918, 629, 391, 29918, 2477, 29931, 4040, 2173, 29886, 1338, 742, 518, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 1402, 426, 13, 418, 525, 1853, 2396, 539, 6024, 2972, 742, 525, 2972, 742, 525, 2972, 742, 525, 2972, 7464, 13, 418, 525, 2972, 1170, 2396, 29871, 6024, 29949, 1233, 414, 742, 525, 3253, 29885, 1144, 742, 525, 6103, 943, 742, 525, 1043, 414, 7464, 13, 1678, 500, 511, 13, 1678, 8820, 29889, 2528, 9182, 877, 29918, 629, 391, 29918, 2477, 29931, 13770, 742, 29871, 29896, 29892, 426, 13, 418, 525, 2371, 1204, 2396, 15516, 525, 1054, 21943, 2396, 6629, 13, 1678, 500, 511, 13, 1678, 8820, 29889, 2528, 9182, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 29871, 29896, 29892, 426, 13, 418, 525, 10314, 2396, 29871, 29896, 29892, 525, 17858, 6847, 2396, 29871, 29900, 29916, 29941, 29943, 29892, 525, 558, 2173, 29886, 1338, 2396, 525, 29961, 29896, 29962, 29915, 13, 1678, 500, 511, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29945, 29897, 13, 1753, 20332, 29896, 29945, 29898, 1594, 842, 1125, 13, 29871, 396, 3462, 29879, 263, 4175, 4663, 2875, 304, 1269, 1746, 29889, 13, 29871, 396, 3645, 445, 1873, 373, 29892, 4175, 10299, 297, 903, 629, 391, 29918, 23825, 29918, 2042, 338, 18164, 29889, 13, 29871, 1574, 29918, 7387, 353, 518, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 742, 525, 4572, 742, 525, 1626, 1495, 13, 29871, 4514, 13, 13, 29871, 396, 3617, 599, 4004, 322, 1746, 848, 304, 4337, 4004, 4175, 848, 304, 278, 4235, 13, 29871, 13926, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 29918, 2042, 25901, 13, 29871, 4235, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 25901, 13, 13, 29871, 1580, 29879, 353, 426, 29879, 29889, 333, 29901, 9109, 29918, 5510, 29898, 29879, 29889, 4572, 10299, 29897, 363, 269, 297, 13926, 29913, 13, 13, 29871, 396, 25249, 4175, 848, 515, 13926, 304, 4235, 13, 29871, 363, 285, 297, 4235, 29901, 13, 1678, 396, 960, 278, 1746, 14393, 304, 278, 4004, 322, 278, 1746, 29915, 29879, 784, 5620, 338, 297, 967, 4175, 10299, 29892, 13, 1678, 396, 8206, 278, 4175, 4444, 515, 278, 4004, 29889, 13, 1678, 4175, 29918, 6550, 353, 1580, 29879, 29889, 657, 29898, 29888, 29889, 3560, 1204, 29897, 13, 1678, 565, 4175, 29918, 6550, 322, 851, 29898, 29888, 29889, 1054, 5620, 29897, 297, 4175, 29918, 6550, 29901, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 742, 285, 29889, 333, 29892, 426, 13, 4706, 525, 4572, 2396, 4390, 29889, 29881, 17204, 29898, 4572, 29918, 6550, 29961, 710, 29898, 29888, 29889, 1054, 5620, 29897, 2314, 13, 418, 500, 876, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29953, 29897, 13, 1753, 20332, 29896, 29953, 29898, 1594, 842, 1125, 13, 29871, 396, 3462, 7962, 1625, 304, 4341, 322, 1776, 4235, 29892, 322, 731, 372, 515, 4341, 29915, 322, 4235, 29915, 11109, 5856, 29889, 13, 29871, 1574, 29918, 7387, 353, 518, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 12872, 1625, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 742, 525, 12872, 1625, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 29871, 4514, 13, 13, 29871, 396, 25846, 1591, 1204, 304, 1591, 29892, 363, 3063, 701, 3646, 1591, 408, 9904, 297, 376, 5620, 29901, 20605, 4072, 29889, 13, 29871, 6131, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 25901, 13, 29871, 6131, 29918, 1609, 29918, 333, 353, 426, 29873, 29889, 2371, 1204, 29901, 260, 363, 260, 297, 6131, 29913, 13, 13, 29871, 396, 29408, 3063, 701, 4341, 491, 2143, 470, 491, 313, 2371, 5620, 29892, 784, 1204, 29897, 13, 29871, 4341, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 25901, 13, 29871, 4341, 29918, 1609, 29918, 999, 353, 426, 29883, 29889, 333, 29901, 274, 363, 274, 297, 4341, 29913, 13, 29871, 4341, 29918, 1609, 29918, 333, 353, 426, 29898, 29883, 29889, 3560, 1204, 29892, 274, 29889, 1054, 1204, 1125, 274, 29889, 333, 363, 274, 297, 4341, 29913, 13, 13, 29871, 396, 6162, 546, 607, 3639, 278, 11117, 12872, 1625, 742, 525, 8030, 5856, 10827, 2767, 7962, 1625, 881, 367, 731, 29889, 13, 29871, 822, 3588, 29918, 12872, 29918, 1054, 29898, 1054, 29892, 11109, 29918, 6768, 1125, 13, 1678, 565, 451, 784, 29889, 1853, 29889, 27382, 2541, 877, 5620, 11283, 1125, 13, 418, 736, 6213, 13, 13, 1678, 396, 1763, 731, 7962, 1625, 29892, 591, 817, 304, 1073, 278, 3646, 1591, 29889, 4971, 666, 565, 591, 508, 29915, 29873, 1284, 372, 29889, 13, 1678, 3646, 29918, 2371, 353, 6131, 29918, 1609, 29918, 333, 29889, 657, 29898, 1054, 29889, 1853, 29961, 2435, 877, 5620, 11283, 1125, 2314, 13, 1678, 565, 451, 3646, 29918, 2371, 29901, 13, 418, 736, 6213, 13, 13, 1678, 1018, 29901, 13, 418, 21213, 29918, 6768, 353, 4390, 29889, 18132, 29898, 8030, 29918, 6768, 29897, 13, 1678, 5174, 8960, 29901, 13, 418, 736, 6213, 259, 396, 960, 8340, 11109, 5856, 29892, 14383, 445, 1897, 29889, 13, 13, 1678, 7962, 29918, 1054, 29918, 333, 353, 21213, 29918, 6768, 29889, 7323, 877, 12872, 1625, 742, 6213, 29897, 13, 1678, 565, 451, 7962, 29918, 1054, 29918, 333, 29901, 13, 418, 736, 6213, 13, 13, 1678, 396, 10987, 7962, 29918, 1054, 29918, 333, 408, 278, 1897, 1024, 297, 278, 8210, 1591, 29889, 13, 1678, 3646, 29918, 1054, 29918, 999, 353, 313, 29900, 565, 7962, 29918, 1054, 29918, 333, 1275, 525, 333, 29915, 1683, 13, 462, 418, 4341, 29918, 1609, 29918, 333, 29889, 657, 3552, 5182, 29918, 2371, 29889, 333, 29892, 7962, 29918, 1054, 29918, 333, 511, 6213, 876, 13, 1678, 565, 3646, 29918, 1054, 29918, 999, 338, 6213, 29901, 13, 418, 736, 6213, 13, 13, 1678, 396, 4803, 11071, 2903, 4097, 1728, 24358, 29892, 304, 1993, 920, 7649, 2094, 2631, 4663, 29889, 13, 1678, 736, 11117, 12872, 1625, 2396, 3646, 29918, 1054, 29918, 999, 29892, 13, 9651, 525, 8030, 5856, 2396, 4390, 29889, 29881, 17204, 29898, 862, 8485, 29918, 6768, 29892, 2903, 4097, 7607, 742, 742, 525, 29901, 8785, 500, 13, 13, 29871, 363, 274, 297, 4341, 29901, 13, 1678, 716, 29918, 5975, 353, 3588, 29918, 12872, 29918, 1054, 29898, 29883, 29892, 274, 29889, 8030, 5856, 29897, 13, 1678, 565, 716, 29918, 5975, 29901, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 274, 29889, 333, 29892, 716, 29918, 5975, 876, 13, 13, 29871, 4235, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 25901, 13, 29871, 363, 285, 297, 4235, 29901, 13, 1678, 274, 353, 4341, 29918, 1609, 29918, 999, 29889, 657, 29898, 29888, 29889, 1054, 5620, 29897, 13, 1678, 565, 274, 29901, 13, 418, 716, 29918, 5975, 353, 3588, 29918, 12872, 29918, 1054, 29898, 29883, 29892, 285, 29889, 8030, 5856, 29897, 13, 418, 565, 716, 29918, 5975, 29901, 13, 4706, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 23825, 29918, 2042, 29918, 2671, 742, 285, 29889, 333, 29892, 716, 29918, 5975, 876, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29937, 910, 338, 2869, 278, 871, 20332, 393, 6858, 599, 6131, 1363, 372, 878, 11057, 1404, 848, 13, 29937, 313, 14940, 635, 29892, 738, 4341, 310, 278, 18164, 376, 2940, 29908, 1134, 467, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29955, 29892, 817, 29918, 497, 29918, 24051, 29922, 5574, 29897, 13, 1753, 20332, 29896, 29955, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 1670, 338, 694, 5520, 385, 376, 2940, 29908, 1134, 363, 4341, 29892, 408, 376, 4165, 496, 1860, 29908, 1286, 19700, 408, 263, 13, 29871, 2479, 1134, 363, 11472, 2066, 3704, 4558, 29889, 14806, 376, 2940, 29908, 4341, 304, 376, 4165, 496, 1860, 29908, 13, 29871, 4341, 29889, 13, 29871, 9995, 13, 29871, 1574, 29918, 7387, 353, 5159, 13, 29871, 6131, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 25901, 13, 29871, 6131, 29918, 1958, 353, 426, 29873, 29889, 333, 29901, 260, 363, 260, 297, 6131, 29913, 13, 29871, 4341, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 29918, 4914, 25901, 13, 13, 29871, 396, 14806, 4341, 515, 1134, 525, 2940, 29915, 304, 1134, 525, 4165, 496, 1860, 29915, 13, 29871, 15201, 29918, 22724, 353, 518, 29883, 363, 274, 297, 4341, 565, 274, 29889, 1853, 1275, 525, 2940, 2033, 13, 29871, 7602, 353, 14013, 659, 29901, 518, 791, 29962, 565, 338, 8758, 29898, 791, 29892, 938, 29897, 322, 659, 1405, 29871, 29900, 1683, 5159, 13, 29871, 565, 15201, 29918, 22724, 29901, 13, 1678, 396, 10318, 278, 4072, 297, 278, 848, 6131, 13, 1678, 1574, 29918, 7387, 29889, 21843, 29898, 13, 418, 8820, 29889, 2111, 1598, 4409, 29898, 24051, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1822, 2371, 1204, 29892, 274, 29889, 1054, 1204, 29892, 11117, 1853, 2396, 525, 4165, 496, 1860, 29915, 1800, 13, 418, 363, 274, 297, 15201, 29918, 22724, 13, 1678, 1723, 13, 1678, 396, 10318, 278, 1819, 304, 8857, 13, 1678, 363, 274, 297, 15201, 29918, 22724, 29901, 13, 418, 565, 274, 29889, 275, 2500, 2497, 29901, 13, 4706, 396, 25515, 4341, 1016, 29915, 29873, 505, 848, 6087, 297, 6535, 29892, 881, 451, 505, 848, 3620, 29889, 13, 4706, 6773, 13, 418, 1591, 29918, 333, 353, 6131, 29918, 1958, 29961, 29883, 29889, 3560, 1204, 1822, 2371, 1204, 13, 418, 1591, 353, 22599, 842, 29889, 497, 29918, 24051, 29961, 2371, 29918, 333, 29962, 13, 418, 1574, 29918, 7387, 29889, 4397, 29898, 13, 4706, 8820, 29889, 29933, 24456, 6422, 9182, 29898, 2371, 29918, 333, 29892, 1591, 29889, 798, 29918, 4841, 29892, 13, 3986, 426, 29883, 29889, 1054, 1204, 29901, 518, 20580, 29898, 791, 29897, 363, 659, 297, 1591, 29889, 13099, 29961, 29883, 29889, 1054, 1204, 5262, 1800, 13, 418, 1723, 13, 1678, 396, 10318, 278, 4072, 297, 278, 15562, 6131, 13, 1678, 1574, 29918, 7387, 29889, 4397, 29898, 7387, 29889, 29933, 24456, 6422, 9182, 29898, 13, 418, 22868, 629, 391, 29918, 24924, 29918, 4914, 742, 13, 418, 518, 29883, 29889, 333, 363, 274, 297, 15201, 29918, 22724, 1402, 13, 418, 11117, 1853, 2396, 6024, 4165, 496, 1860, 29915, 363, 274, 297, 15201, 29918, 22724, 12258, 13, 268, 876, 13, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 29898, 1514, 29918, 7387, 29897, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29947, 29897, 13, 1753, 20332, 29896, 29947, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 525, 2230, 8028, 742, 525, 1626, 5477, 13, 1678, 396, 599, 10701, 7536, 304, 445, 20332, 505, 1063, 2825, 297, 1570, 3088, 13, 1678, 8820, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 29871, 29896, 29892, 11117, 2230, 8028, 2396, 525, 29048, 29914, 4373, 29918, 29979, 548, 29915, 1800, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29896, 29929, 29897, 13, 1753, 20332, 29896, 29929, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 742, 525, 265, 29928, 331, 392, 742, 525, 24693, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29900, 29897, 13, 1753, 20332, 29906, 29900, 29898, 1594, 842, 1125, 13, 29871, 9995, 13, 29871, 3462, 903, 629, 391, 29918, 27514, 1591, 322, 19450, 2729, 373, 5923, 6137, 23825, 9976, 29892, 19282, 29901, 6131, 526, 12705, 13, 29871, 22968, 1711, 491, 1009, 421, 2371, 1204, 29952, 322, 8386, 526, 22229, 2629, 1009, 6590, 1591, 322, 13, 29871, 12705, 491, 1009, 1178, 29889, 13, 29871, 9995, 13, 29871, 6131, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 24924, 25901, 13, 29871, 1591, 29918, 1958, 353, 426, 29873, 29889, 333, 29901, 260, 363, 260, 297, 6131, 29913, 13, 29871, 1591, 29918, 7406, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 3562, 23825, 25901, 13, 29871, 396, 8198, 10561, 1122, 3160, 376, 16107, 8386, 613, 451, 6942, 411, 738, 1591, 29889, 3872, 29915, 29873, 3160, 1906, 297, 13, 29871, 396, 1591, 29918, 7406, 29918, 1958, 29901, 896, 29915, 645, 679, 5134, 541, 451, 12705, 470, 27831, 491, 1591, 1204, 29889, 13, 29871, 1591, 29918, 7406, 29918, 1958, 353, 426, 12427, 29889, 1493, 5620, 29901, 1591, 29918, 1958, 29961, 12427, 29889, 2371, 5620, 1822, 2371, 1204, 13, 462, 268, 363, 9631, 297, 1591, 29918, 7406, 565, 9631, 29889, 2371, 5620, 297, 1591, 29918, 1958, 29913, 13, 29871, 8386, 353, 1051, 29898, 7387, 29889, 3286, 4220, 29918, 8645, 29895, 29918, 2467, 29898, 1594, 842, 29889, 497, 29918, 24051, 1839, 29918, 629, 391, 29918, 23825, 25901, 13, 29871, 822, 1776, 29918, 1989, 29898, 1493, 1125, 13, 1678, 9995, 13, 1678, 16969, 4852, 3562, 29896, 613, 29871, 29906, 29897, 988, 376, 3562, 29896, 29908, 338, 278, 1776, 29915, 29879, 1591, 1204, 322, 29871, 29906, 278, 1776, 1178, 29889, 1152, 13, 1678, 7601, 1776, 313, 347, 29901, 451, 16180, 297, 903, 629, 391, 29918, 3562, 23825, 29897, 3639, 4852, 3562, 29896, 613, 448, 29896, 467, 4803, 1319, 13, 1678, 304, 679, 278, 1051, 310, 8386, 12705, 297, 278, 1021, 982, 408, 297, 278, 6137, 2625, 282, 1662, 29889, 1334, 671, 448, 29896, 13, 1678, 363, 7601, 1776, 304, 1207, 1854, 896, 2041, 937, 4249, 599, 278, 8386, 310, 278, 1021, 1591, 29889, 13, 1678, 9995, 13, 1678, 565, 1776, 29889, 333, 297, 1591, 29918, 7406, 29918, 1958, 29901, 13, 418, 736, 313, 2371, 29918, 7406, 29918, 1958, 29961, 1493, 29889, 333, 1402, 1776, 29889, 333, 29897, 13, 1678, 396, 278, 1024, 310, 7601, 1776, 29915, 29879, 338, 278, 1021, 408, 278, 1591, 1204, 13, 1678, 736, 313, 1493, 29889, 978, 29892, 448, 29896, 29897, 13, 29871, 8386, 29889, 6605, 29898, 1989, 29922, 1493, 29918, 1989, 29897, 13, 29871, 1948, 29918, 4841, 353, 1051, 29898, 29916, 3881, 29898, 29896, 29892, 7431, 29898, 7406, 29897, 718, 29871, 29896, 876, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 27514, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 1493, 5620, 742, 525, 5620, 29901, 29918, 629, 391, 29918, 23825, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 3488, 9135, 742, 525, 8003, 4557, 5477, 13, 418, 10938, 29889, 5675, 29918, 4914, 877, 513, 9233, 742, 525, 2928, 5477, 13, 1678, 4514, 511, 13, 1678, 8820, 29889, 20083, 3562, 1469, 877, 29918, 629, 391, 29918, 27514, 742, 1948, 29918, 4841, 29892, 426, 13, 418, 525, 1493, 5620, 2396, 518, 29894, 29889, 333, 363, 325, 297, 8386, 1402, 13, 418, 525, 3488, 9135, 2396, 1948, 29918, 4841, 29892, 13, 418, 525, 513, 9233, 2396, 518, 29896, 565, 325, 29889, 333, 297, 1591, 29918, 7406, 29918, 1958, 1683, 29871, 29900, 363, 325, 297, 8386, 29962, 13, 1678, 5615, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29896, 29897, 13, 1753, 20332, 29906, 29896, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 525, 562, 29880, 2500, 2497, 29925, 1503, 287, 742, 525, 1626, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 525, 17858, 6847, 1626, 742, 525, 1626, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 525, 7491, 9135, 742, 525, 8003, 4557, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 2477, 29519, 2540, 742, 525, 1792, 15801, 742, 525, 1626, 5477, 13, 259, 2314, 13, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29906, 29897, 13, 1753, 20332, 29906, 29906, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 276, 28667, 10401, 742, 525, 2928, 5477, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 24924, 29918, 4914, 742, 525, 276, 28667, 2772, 567, 742, 525, 5620, 1293, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 5477, 13, 259, 2314, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29941, 29897, 13, 1753, 20332, 29906, 29941, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 788, 29918, 4914, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 525, 3225, 9585, 742, 525, 1626, 5477, 13, 1678, 8820, 29889, 6422, 9182, 877, 29918, 629, 391, 29918, 14526, 3401, 742, 29871, 29896, 29892, 11117, 3225, 9585, 2396, 525, 6377, 23337, 4710, 264, 29899, 3308, 9092, 29915, 1800, 13, 259, 2314, 13, 13, 13, 29992, 29885, 16783, 29898, 11010, 29918, 3259, 29922, 29906, 29946, 29897, 13, 1753, 20332, 29906, 29946, 29898, 1594, 842, 1125, 13, 29871, 736, 22599, 842, 29889, 7302, 29918, 1514, 29918, 7387, 4197, 13, 1678, 8820, 29889, 2528, 3562, 877, 29918, 629, 391, 29918, 2308, 335, 5743, 742, 518, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 2371, 5620, 613, 376, 5620, 29901, 29918, 629, 391, 29918, 24924, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 3696, 10562, 613, 376, 29620, 1293, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 275, 28181, 1625, 5620, 613, 376, 5620, 29901, 29918, 629, 391, 29918, 24924, 29918, 4914, 4968, 13, 418, 10938, 29889, 5675, 29918, 4914, 703, 7387, 613, 376, 1626, 4968, 29871, 396, 4663, 13, 1678, 4514, 511, 13, 259, 2314, 13, 2 ]
tools/make_folders.py
leonzucchini/recipes
8
31509
<filename>tools/make_folders.py import os import sys import shutil import re def make_output_folder(folder_path, debug=False): """ Make folder for output, checking for previous results """ # Skip if debug (avoids replace prompt) if debug: print "FolderSetup warning: Not creating directory because debug = True" pass else: # If destination folder does not exist then create it if not os.path.exists(folder_path): os.mkdir(folder_path) else: # Otherwise give a choice to replace (overwrite), use, or exit confirm_prompt = "The following folder exists:" + "\n" + \ str(folder_path) + "\n" + \ "Would you like to add to it ('a'), overwrite ('o'), or exit ('e'): " confirm = raw_input(confirm_prompt) # Prompt for correctly formatted input (y/n) while not re.search(r'[aeo]', confirm): confirm_prompt = "Please confirm what you want to do." + "\n" + \ "Would you like to add to it ('a'), overwrite ('o'), or exit ('e'):" confirm = raw_input(confirm_prompt) # If exit if confirm == "e": print "OK exiting." sys.exit(1) # Else if overwrite elif confirm == "o": # Make folder path shutil.rmtree(folder_path) os.mkdir(folder_path) print "Created output folder: %s" %(folder_path) # Else if add elif confirm == "a": print "OK adding to folder" return None
[ 1, 529, 9507, 29958, 8504, 29914, 5675, 29918, 8771, 414, 29889, 2272, 13, 5215, 2897, 13, 5215, 10876, 13, 5215, 528, 4422, 13, 5215, 337, 13, 13, 1753, 1207, 29918, 4905, 29918, 12083, 29898, 12083, 29918, 2084, 29892, 4744, 29922, 8824, 1125, 13, 4706, 9995, 8561, 4138, 363, 1962, 29892, 8454, 363, 3517, 2582, 9995, 13, 13, 4706, 396, 4971, 666, 565, 4744, 313, 485, 3398, 29879, 5191, 9508, 29897, 13, 4706, 565, 4744, 29901, 13, 9651, 1596, 376, 12924, 26947, 9177, 29901, 2216, 4969, 3884, 1363, 4744, 353, 5852, 29908, 13, 9651, 1209, 13, 13, 4706, 1683, 29901, 13, 9651, 396, 960, 12551, 4138, 947, 451, 1863, 769, 1653, 372, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 12083, 29918, 2084, 1125, 13, 18884, 2897, 29889, 11256, 3972, 29898, 12083, 29918, 2084, 29897, 13, 13, 9651, 1683, 29901, 13, 18884, 396, 13466, 2367, 263, 7348, 304, 5191, 313, 957, 3539, 511, 671, 29892, 470, 6876, 13, 18884, 9659, 29918, 14032, 415, 353, 376, 1576, 1494, 4138, 4864, 6160, 718, 6634, 29876, 29908, 718, 320, 13, 462, 1678, 851, 29898, 12083, 29918, 2084, 29897, 718, 6634, 29876, 29908, 718, 320, 13, 462, 1678, 376, 29956, 483, 366, 763, 304, 788, 304, 372, 6702, 29874, 5477, 26556, 6702, 29877, 5477, 29871, 470, 6876, 6702, 29872, 29374, 376, 13, 18884, 9659, 353, 10650, 29918, 2080, 29898, 26897, 29918, 14032, 415, 29897, 13, 13, 18884, 396, 9705, 415, 363, 5149, 20917, 1881, 313, 29891, 29914, 29876, 29897, 13, 18884, 1550, 451, 337, 29889, 4478, 29898, 29878, 29915, 29961, 3660, 29877, 29962, 742, 9659, 1125, 13, 462, 1678, 9659, 29918, 14032, 415, 353, 376, 12148, 9659, 825, 366, 864, 304, 437, 1213, 718, 6634, 29876, 29908, 718, 320, 13, 462, 4706, 376, 29956, 483, 366, 763, 304, 788, 304, 372, 6702, 29874, 5477, 26556, 6702, 29877, 5477, 29871, 470, 6876, 6702, 29872, 29374, 29908, 13, 462, 1678, 9659, 353, 10650, 29918, 2080, 29898, 26897, 29918, 14032, 415, 29897, 13, 462, 13, 18884, 396, 960, 6876, 13, 18884, 565, 9659, 1275, 376, 29872, 1115, 13, 462, 1678, 1596, 376, 8949, 6876, 292, 1213, 13, 462, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 462, 13, 18884, 396, 15785, 565, 26556, 13, 18884, 25342, 9659, 1275, 376, 29877, 1115, 13, 13, 462, 1678, 396, 8561, 4138, 2224, 13, 462, 1678, 528, 4422, 29889, 1758, 8336, 29898, 12083, 29918, 2084, 29897, 13, 462, 1678, 2897, 29889, 11256, 3972, 29898, 12083, 29918, 2084, 29897, 13, 13, 462, 1678, 1596, 376, 20399, 1962, 4138, 29901, 1273, 29879, 29908, 1273, 29898, 12083, 29918, 2084, 29897, 13, 13, 18884, 396, 15785, 565, 788, 13, 18884, 25342, 9659, 1275, 376, 29874, 1115, 13, 462, 1678, 1596, 376, 8949, 4417, 304, 4138, 29908, 13, 13, 4706, 736, 6213, 2 ]
bounties_api/std_bounties/migrations/0003_bountystate_event.py
tenthirtyone/BountiesAPI
45
173151
<reponame>tenthirtyone/BountiesAPI # -*- coding: utf-8 -*- # Generated by Django 1.11.11 on 2018-04-18 22:15 from __future__ import unicode_literals import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('std_bounties', '0002_auto_20180409_2309'), ] operations = [ migrations.CreateModel( name='BountyState', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('bountyStage', models.IntegerField()), ('change_date', models.DateTimeField()), ('bounty', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='std_bounties.Bounty')), ], options={ 'get_latest_by': 'change_date', }, ), migrations.CreateModel( name='Event', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('event', models.CharField(max_length=128)), ('fulfillment_id', models.IntegerField(null=True)), ('transaction_hash', models.CharField(max_length=128)), ('transaction_from', models.CharField(max_length=128)), ('contract_inputs', django.contrib.postgres.fields.jsonb.JSONField(null=True)), ('event_date', models.DateTimeField()), ('bounty', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='std_bounties.Bounty')), ], ), ]
[ 1, 529, 276, 1112, 420, 29958, 29873, 9097, 13163, 650, 29914, 29933, 792, 583, 8787, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 3251, 630, 491, 15337, 29871, 29896, 29889, 29896, 29896, 29889, 29896, 29896, 373, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29896, 29947, 29871, 29906, 29906, 29901, 29896, 29945, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 5215, 9557, 29889, 21570, 29889, 2490, 7201, 29889, 9621, 29889, 3126, 29890, 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, 4172, 29918, 29890, 792, 583, 742, 525, 29900, 29900, 29900, 29906, 29918, 6921, 29918, 29906, 29900, 29896, 29947, 29900, 29946, 29900, 29929, 29918, 29906, 29941, 29900, 29929, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 29933, 792, 29891, 2792, 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, 29890, 792, 29891, 27276, 742, 4733, 29889, 7798, 3073, 25739, 13, 18884, 6702, 3167, 29918, 1256, 742, 4733, 29889, 11384, 3073, 25739, 13, 18884, 6702, 29890, 792, 29891, 742, 4733, 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, 4172, 29918, 29890, 792, 583, 29889, 29933, 792, 29891, 1495, 511, 13, 9651, 21251, 13, 9651, 3987, 3790, 13, 18884, 525, 657, 29918, 12333, 29918, 1609, 2396, 525, 3167, 29918, 1256, 742, 13, 9651, 2981, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 4391, 3195, 29898, 13, 9651, 1024, 2433, 2624, 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, 3696, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 1319, 5589, 358, 29918, 333, 742, 4733, 29889, 7798, 3073, 29898, 4304, 29922, 5574, 8243, 13, 18884, 6702, 20736, 29918, 8568, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 20736, 29918, 3166, 742, 4733, 29889, 27890, 29898, 3317, 29918, 2848, 29922, 29896, 29906, 29947, 8243, 13, 18884, 6702, 1285, 1461, 29918, 2080, 29879, 742, 9557, 29889, 21570, 29889, 2490, 7201, 29889, 9621, 29889, 3126, 29890, 29889, 7249, 3073, 29898, 4304, 29922, 5574, 8243, 13, 18884, 6702, 3696, 29918, 1256, 742, 4733, 29889, 11384, 3073, 25739, 13, 18884, 6702, 29890, 792, 29891, 742, 4733, 29889, 27755, 2558, 29898, 4304, 29922, 5574, 29892, 373, 29918, 8143, 29922, 14095, 29889, 2585, 29889, 9794, 29889, 311, 1026, 291, 29889, 29907, 3289, 5454, 2287, 29892, 304, 2433, 4172, 29918, 29890, 792, 583, 29889, 29933, 792, 29891, 1495, 511, 13, 9651, 21251, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
script/organiseTaskList.py
shawnwun/woz
13
86374
###################################################################### ###################################################################### # Copyright <NAME>, Cambridge Dialogue Systems Group, 2017 # ###################################################################### ###################################################################### import sys import os import operator import json import random random.seed(0) tasklist = sorted(os.listdir('tempTasks')) fin = file('tmp/finishedList') finished = [l.replace('\n','') for l in fin.readlines()][1:] fin.close() todos = [] for filename in tasklist: print filename fin = file('tempTasks/'+filename) task= json.load(fin) fin.close() if 'eod' in task['goal'] and task['goal']['eod'] and len(task['log'])!=0: # indicating it is finished if (len(task['log'])<10 and 'MUL' in filename) or\ (len(task['log'])<4 and 'SNG' in filename) or\ len(task['log'])%2==1: # if length is too short, not finished todos.append(filename) elif filename in finished: # if already in finished list pass else: # if cannot decide for i in range(len(task['log'])): print task['log'][i]['text'] ans = raw_input('%s is finished? (y/n), %d ' % (filename,len(task['log']))) print if ans=='n': # not finished todos.append(filename) if ans=='y': # finished finished.append(filename) else: todos.append(filename) fout = file('tmp/taskList','w') fout.write('0\n') fout.write('\n'.join(todos)) fout.close() fout = file('tmp/finishedList','w') fout.write('\n'.join(['0']+finished)) fout.close()
[ 1, 835, 13383, 13383, 13383, 13383, 2277, 29937, 13, 13383, 13383, 13383, 13383, 4136, 2277, 13, 29937, 29871, 14187, 1266, 529, 5813, 10202, 12585, 18878, 434, 23985, 6431, 29892, 29871, 29906, 29900, 29896, 29955, 396, 13, 13383, 13383, 13383, 13383, 4136, 2277, 13, 13383, 13383, 13383, 13383, 4136, 2277, 13, 5215, 10876, 13, 5215, 2897, 13, 5215, 5455, 13, 5215, 4390, 13, 5215, 4036, 13, 13, 8172, 29889, 26776, 29898, 29900, 29897, 13, 13, 7662, 1761, 353, 12705, 29898, 359, 29889, 1761, 3972, 877, 7382, 26249, 8785, 13, 4951, 353, 934, 877, 7050, 29914, 4951, 3276, 1293, 1495, 13, 4951, 3276, 353, 518, 29880, 29889, 6506, 28909, 29876, 3788, 1495, 363, 301, 297, 1436, 29889, 949, 9012, 580, 3816, 29896, 17531, 13, 4951, 29889, 5358, 580, 13, 13, 13, 20034, 359, 353, 5159, 13, 13, 1454, 10422, 297, 3414, 1761, 29901, 13, 268, 13, 1678, 1596, 10422, 13, 1678, 1436, 353, 934, 877, 7382, 26249, 29914, 18717, 9507, 29897, 13, 1678, 3414, 29922, 4390, 29889, 1359, 29898, 4951, 29897, 13, 1678, 1436, 29889, 5358, 580, 13, 1678, 565, 525, 29872, 397, 29915, 297, 3414, 1839, 28111, 2033, 322, 3414, 1839, 28111, 16215, 29872, 397, 2033, 322, 7431, 29898, 7662, 1839, 1188, 11287, 19216, 29900, 29901, 13, 4706, 396, 23941, 372, 338, 7743, 13, 4706, 565, 29871, 313, 2435, 29898, 7662, 1839, 1188, 11287, 29966, 29896, 29900, 322, 525, 29924, 13309, 29915, 297, 10422, 29897, 470, 29905, 13, 9651, 313, 2435, 29898, 7662, 1839, 1188, 11287, 29966, 29946, 29871, 322, 525, 29903, 9312, 29915, 297, 10422, 29897, 470, 29905, 13, 9651, 7431, 29898, 7662, 1839, 1188, 11287, 29995, 29906, 1360, 29896, 29901, 13, 9651, 396, 565, 3309, 338, 2086, 3273, 29892, 451, 7743, 13, 9651, 10843, 29889, 4397, 29898, 9507, 29897, 13, 4706, 25342, 10422, 297, 7743, 29901, 29871, 13, 9651, 396, 565, 2307, 297, 7743, 1051, 13, 9651, 1209, 13, 4706, 1683, 29901, 13, 9651, 396, 565, 2609, 11097, 13, 9651, 363, 474, 297, 3464, 29898, 2435, 29898, 7662, 1839, 1188, 2033, 22164, 13, 18884, 1596, 3414, 1839, 1188, 2033, 29961, 29875, 22322, 726, 2033, 13, 9651, 6063, 353, 10650, 29918, 2080, 877, 29995, 29879, 338, 7743, 29973, 313, 29891, 29914, 29876, 511, 1273, 29881, 525, 1273, 313, 9507, 29892, 2435, 29898, 7662, 1839, 1188, 2033, 4961, 29871, 13, 9651, 1596, 13, 9651, 565, 6063, 1360, 29915, 29876, 2396, 13, 18884, 396, 451, 7743, 13, 18884, 10843, 29889, 4397, 29898, 9507, 29897, 13, 9651, 565, 6063, 1360, 29915, 29891, 2396, 13, 18884, 396, 7743, 13, 18884, 7743, 29889, 4397, 29898, 9507, 29897, 13, 632, 13, 1678, 1683, 29901, 29871, 13, 4706, 10843, 29889, 4397, 29898, 9507, 29897, 13, 13, 13, 29888, 449, 353, 934, 877, 7050, 29914, 7662, 1293, 3788, 29893, 1495, 13, 29888, 449, 29889, 3539, 877, 29900, 29905, 29876, 1495, 13, 29888, 449, 29889, 3539, 28909, 29876, 4286, 7122, 29898, 20034, 359, 876, 13, 29888, 449, 29889, 5358, 580, 13, 13, 29888, 449, 353, 934, 877, 7050, 29914, 4951, 3276, 1293, 3788, 29893, 1495, 13, 29888, 449, 29889, 3539, 28909, 29876, 4286, 7122, 18959, 29900, 2033, 29974, 4951, 3276, 876, 13, 29888, 449, 29889, 5358, 580, 13, 13, 13, 2 ]
controller/controller_client.py
ZeBraHack0/ATP-Controller
1
1617122
<gh_stars>1-10 from socket import * import argparse parser = argparse.ArgumentParser(description='P4ML User Client') parser.add_argument('--model', type=str, default='vgg16', help='model to train') parser.add_argument('--dataset', type=str, default='benchmark', help='dataset to train') parser.add_argument('--gpus', type=int, default=1, help='number of training gpus') parser.add_argument('--num_iters', type=int, default=10, help='number of training iterations') args = parser.parse_args() host = '10.0.0.10' port = 8888 bufsize = 1024 addr = (host, port) client = socket(AF_INET, SOCK_STREAM) client.connect((host, port)) print("client up, enter your job") try: cmd = "control_" + str(args.gpus) + "_" + args.dataset + "_" + args.model + "_" + str(args.num_iters) client.send(cmd.encode('utf-8')) print("submit job successfully!") print("waiting for job finishing...") data = client.recv(bufsize) print(data.decode('utf-8')) except Exception as e: print(e) client.close()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 3166, 9909, 1053, 334, 13, 5215, 1852, 5510, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 29925, 29946, 1988, 4911, 12477, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 4299, 742, 1134, 29922, 710, 29892, 2322, 2433, 29894, 1505, 29896, 29953, 742, 13, 462, 1678, 1371, 2433, 4299, 304, 7945, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 24713, 742, 1134, 29922, 710, 29892, 2322, 2433, 1785, 16580, 742, 13, 462, 1678, 1371, 2433, 24713, 304, 7945, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 29887, 13364, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29892, 13, 462, 1678, 1371, 2433, 4537, 310, 6694, 330, 13364, 1495, 13, 16680, 29889, 1202, 29918, 23516, 877, 489, 1949, 29918, 277, 414, 742, 1134, 29922, 524, 29892, 2322, 29922, 29896, 29900, 29892, 13, 462, 1678, 1371, 2433, 4537, 310, 6694, 24372, 1495, 13, 5085, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 3069, 353, 525, 29896, 29900, 29889, 29900, 29889, 29900, 29889, 29896, 29900, 29915, 13, 637, 353, 29871, 29947, 29947, 29947, 29947, 13, 9721, 2311, 353, 29871, 29896, 29900, 29906, 29946, 13, 10030, 353, 313, 3069, 29892, 2011, 29897, 13, 4645, 353, 9909, 29898, 5098, 29918, 1177, 2544, 29892, 7791, 7077, 29918, 1254, 1525, 5194, 29897, 13, 4645, 29889, 6915, 3552, 3069, 29892, 2011, 876, 13, 2158, 703, 4645, 701, 29892, 3896, 596, 4982, 1159, 13, 13, 13, 2202, 29901, 13, 1678, 9920, 353, 376, 6451, 27508, 718, 851, 29898, 5085, 29889, 29887, 13364, 29897, 718, 11119, 29908, 718, 6389, 29889, 24713, 718, 11119, 29908, 718, 6389, 29889, 4299, 718, 11119, 29908, 718, 851, 29898, 5085, 29889, 1949, 29918, 277, 414, 29897, 13, 1678, 3132, 29889, 6717, 29898, 9006, 29889, 12508, 877, 9420, 29899, 29947, 8785, 13, 1678, 1596, 703, 7892, 4982, 8472, 29991, 1159, 13, 1678, 1596, 703, 10685, 292, 363, 4982, 28321, 856, 1159, 13, 1678, 848, 353, 3132, 29889, 3757, 29894, 29898, 9721, 2311, 29897, 13, 1678, 1596, 29898, 1272, 29889, 13808, 877, 9420, 29899, 29947, 8785, 13, 19499, 8960, 408, 321, 29901, 13, 1678, 1596, 29898, 29872, 29897, 13, 13, 4645, 29889, 5358, 580, 2 ]
focal_mech/demo/test6.py
blasscoc/FocalMechClassifier
12
12361
from numpy import array, rad2deg, pi, mgrid, argmin from matplotlib.pylab import contour import matplotlib.pyplot as plt import mplstereonet from obspy.imaging.beachball import aux_plane from focal_mech.lib.classify_mechanism import classify, translate_to_sphharm from focal_mech.io.read_hash import read_demo, read_hash_solutions from focal_mech.util.hash_routines import hash_to_classifier from focal_mech.lib.sph_harm import get_sph_harm from focal_mech.lib.correlate import corr_shear hash_solns = read_hash_solutions("example1.out") # we want solutions that are symetric polarity_data = read_demo("north1.phase", "scsn.reverse", reverse=True) inputs = hash_to_classifier(polarity_data, parity=1) event = 3146815 result = classify(*inputs[event], kernel_degree=2) Alm = translate_to_sphharm(*result, kernel_degree=2) coeffs = array([Alm[0,0], Alm[1,-1], Alm[1,0], Alm[1,1], Alm[2,-2], Alm[2,-1], Alm[2,0], Alm[2,1], Alm[2,2]]) svm_soln, f = corr_shear(Alm) resolution = (200,400) longi, lati, Z = get_sph_harm(resolution=resolution) mech = coeffs.dot(Z).real longi.shape = resolution lati.shape = resolution mech.shape = resolution c = contour(longi, lati, mech, [0]) pth1 = c.collections[0].get_paths()[0].vertices pth1 = rad2deg(pth1) pth2 = c.collections[0].get_paths()[1].vertices pth2 = rad2deg(pth2) hash_focal = rad2deg(hash_solns[event]) event2 = 3158361 result = classify(*inputs[event2], kernel_degree=2) Alm = translate_to_sphharm(*result, kernel_degree=2) coeffs = array([Alm[0,0], Alm[1,-1], Alm[1,0], Alm[1,1], Alm[2,-2], Alm[2,-1], Alm[2,0], Alm[2,1], Alm[2,2]]) svm_soln2, f = corr_shear(Alm) resolution = (200,400) longi, lati, Z = get_sph_harm(resolution=resolution) mech = coeffs.dot(Z).real longi.shape = resolution lati.shape = resolution mech.shape = resolution c = contour(longi, lati, mech, [0]) pth3 = c.collections[0].get_paths()[0].vertices pth3 = rad2deg(pth3) pth4 = c.collections[0].get_paths()[1].vertices pth4 = rad2deg(pth4) hash_focal2 = rad2deg(hash_solns[event2]) event3 = 3153955 result = classify(*inputs[event3], kernel_degree=2) Alm = translate_to_sphharm(*result, kernel_degree=2) coeffs = array([Alm[0,0], Alm[1,-1], Alm[1,0], Alm[1,1], Alm[2,-2], Alm[2,-1], Alm[2,0], Alm[2,1], Alm[2,2]]) svm_soln3, f = corr_shear(Alm) resolution = (200,400) longi, lati, Z = get_sph_harm(resolution=resolution) mech = coeffs.dot(Z).real longi.shape = resolution lati.shape = resolution mech.shape = resolution c = contour(longi, lati, mech, [0]) pth5 = c.collections[0].get_paths()[0].vertices pth5 = rad2deg(pth5) pth6 = c.collections[0].get_paths()[1].vertices pth6 = rad2deg(pth6) hash_focal3 = rad2deg(hash_solns[event3]) fig = plt.figure(facecolor="white", figsize=(10,20)) ax = fig.add_subplot(221, projection='stereonet') ax.rake(pth1[:,0], pth1[:,1] +90.0, 90.0, ':', color='red', linewidth=3) ax.rake(pth2[:,0], pth2[:,1] +90.0, 90.0, ':', color='red', linewidth=3) strike, dip, rake = svm_soln ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = aux_plane(*svm_soln) ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = hash_focal ax.plane(strike-90, dip, 'g-', linewidth=2) strike, dip, rake = aux_plane(*hash_focal) ax.plane(strike-90, dip,'g-', linewidth=2) azi = rad2deg(polarity_data[event][:,0]) toa = rad2deg(polarity_data[event][:,1]) polarity = polarity_data[event][:,2] for a, t, p in zip(azi, toa, polarity): if p > 0: ax.pole(a, t,'o', markeredgecolor='red', markerfacecolor='red') else: ax.pole(a, t,'o', markeredgecolor='blue', markerfacecolor='white') ax.grid() ax = fig.add_subplot(222, projection='stereonet') ax.rake(pth3[:,0], pth3[:,1] +90.0, 90.0, ':', color='red', linewidth=3) ax.rake(pth4[:,0], pth4[:,1] +90.0, 90.0, ':', color='red', linewidth=3) strike, dip, rake = svm_soln2 ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = aux_plane(*svm_soln2) ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = hash_focal2 ax.plane(strike-90, dip, 'g-', linewidth=2) strike, dip, rake = aux_plane(*hash_focal2) ax.plane(strike-90, dip,'g-', linewidth=2) azi = rad2deg(polarity_data[event2][:,0]) toa = rad2deg(polarity_data[event2][:,1]) polarity = polarity_data[event2][:,2] for a, t, p in zip(azi, toa, polarity): if p > 0: ax.pole(a, t,'o', markeredgecolor='red', markerfacecolor='red') else: ax.pole(a, t,'o', markeredgecolor='blue', markerfacecolor='white') ax.grid() ax = fig.add_subplot(224, projection='stereonet') ax.rake(pth5[:,0], pth5[:,1] +90.0, 90.0, ':', color='red', linewidth=3) ax.rake(pth6[:,0], pth6[:,1] +90.0, 90.0, ':', color='red', linewidth=3) strike, dip, rake = svm_soln3 ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = aux_plane(*svm_soln3) ax.plane(strike, dip, '-r', linewidth=2) strike, dip, rake = hash_focal3 ax.plane(strike-90, dip, 'g-', linewidth=2) strike, dip, rake = aux_plane(*hash_focal3) ax.plane(strike-90, dip,'g-', linewidth=2) azi = rad2deg(polarity_data[event3][:,0]) toa = rad2deg(polarity_data[event3][:,1]) polarity = polarity_data[event3][:,2] for a, t, p in zip(azi, toa, polarity): if p > 0: ax.pole(a, t,'o', markeredgecolor='red', markerfacecolor='red') else: ax.pole(a, t,'o', markeredgecolor='blue', markerfacecolor='white') ax.grid() plt.tight_layout(pad=4.0, h_pad=20.0) plt.show()
[ 1, 515, 12655, 1053, 1409, 29892, 2971, 29906, 12163, 29892, 2930, 29892, 286, 7720, 29892, 1852, 1195, 13, 13, 3166, 22889, 29889, 2272, 8205, 1053, 640, 473, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 286, 572, 303, 406, 265, 300, 13, 13, 3166, 704, 1028, 29891, 29889, 326, 6751, 29889, 915, 496, 2135, 1053, 3479, 29918, 22116, 13, 13, 3166, 12789, 284, 29918, 1004, 305, 29889, 1982, 29889, 1990, 1598, 29918, 1004, 5083, 1608, 1053, 770, 1598, 29892, 14240, 29918, 517, 29918, 29879, 561, 23024, 13, 3166, 12789, 284, 29918, 1004, 305, 29889, 601, 29889, 949, 29918, 8568, 1053, 1303, 29918, 17482, 29892, 1303, 29918, 8568, 29918, 2929, 17925, 13, 13, 3166, 12789, 284, 29918, 1004, 305, 29889, 4422, 29889, 8568, 29918, 14608, 1475, 1053, 6608, 29918, 517, 29918, 1990, 3709, 13, 3166, 12789, 284, 29918, 1004, 305, 29889, 1982, 29889, 29879, 561, 29918, 23024, 1053, 679, 29918, 29879, 561, 29918, 23024, 13, 3166, 12789, 284, 29918, 1004, 305, 29889, 1982, 29889, 2616, 2674, 403, 1053, 27760, 29918, 11360, 279, 13, 13, 8568, 29918, 2929, 1983, 353, 1303, 29918, 8568, 29918, 2929, 17925, 703, 4773, 29896, 29889, 449, 1159, 13, 13, 29937, 591, 864, 6851, 393, 526, 5016, 300, 2200, 13, 3733, 279, 537, 29918, 1272, 353, 1303, 29918, 17482, 703, 29876, 2072, 29896, 29889, 21646, 613, 376, 1557, 16586, 29889, 24244, 613, 11837, 29922, 5574, 29897, 13, 2080, 29879, 353, 6608, 29918, 517, 29918, 1990, 3709, 29898, 3733, 279, 537, 29918, 1272, 29892, 610, 537, 29922, 29896, 29897, 13, 13, 3696, 353, 29871, 29941, 29896, 29946, 29953, 29947, 29896, 29945, 13, 13, 2914, 353, 770, 1598, 10456, 2080, 29879, 29961, 3696, 1402, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 2499, 29885, 353, 14240, 29918, 517, 29918, 29879, 561, 23024, 10456, 2914, 29892, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 13, 1111, 12352, 29879, 353, 1409, 4197, 2499, 29885, 29961, 29900, 29892, 29900, 1402, 29871, 13, 18884, 838, 29885, 29961, 29896, 6653, 29896, 1402, 838, 29885, 29961, 29896, 29892, 29900, 1402, 838, 29885, 29961, 29896, 29892, 29896, 1402, 29871, 13, 18884, 838, 29885, 29961, 29906, 6653, 29906, 1402, 838, 29885, 29961, 29906, 6653, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29900, 1402, 838, 29885, 29961, 29906, 29892, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29906, 24960, 13, 13, 13, 4501, 29885, 29918, 2929, 29876, 29892, 285, 353, 27760, 29918, 11360, 279, 29898, 2499, 29885, 29897, 13, 13, 9778, 918, 353, 313, 29906, 29900, 29900, 29892, 29946, 29900, 29900, 29897, 13, 5426, 29875, 29892, 301, 2219, 29892, 796, 353, 679, 29918, 29879, 561, 29918, 23024, 29898, 9778, 918, 29922, 9778, 918, 29897, 13, 1004, 305, 353, 1302, 12352, 29879, 29889, 6333, 29898, 29999, 467, 6370, 13, 13, 5426, 29875, 29889, 12181, 353, 10104, 13, 29880, 2219, 29889, 12181, 353, 10104, 13, 1004, 305, 29889, 12181, 353, 10104, 13, 13, 29883, 353, 640, 473, 29898, 5426, 29875, 29892, 301, 2219, 29892, 592, 305, 29892, 518, 29900, 2314, 13, 29886, 386, 29896, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29900, 1822, 1765, 1575, 13, 29886, 386, 29896, 353, 2971, 29906, 12163, 29898, 29886, 386, 29896, 29897, 13, 13, 29886, 386, 29906, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29896, 1822, 1765, 1575, 13, 29886, 386, 29906, 353, 2971, 29906, 12163, 29898, 29886, 386, 29906, 29897, 13, 13, 8568, 29918, 29888, 18642, 353, 2971, 29906, 12163, 29898, 8568, 29918, 2929, 1983, 29961, 3696, 2314, 13, 13, 13, 3696, 29906, 353, 29871, 29941, 29896, 29945, 29947, 29941, 29953, 29896, 13, 13, 13, 2914, 353, 770, 1598, 10456, 2080, 29879, 29961, 3696, 29906, 1402, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 2499, 29885, 353, 14240, 29918, 517, 29918, 29879, 561, 23024, 10456, 2914, 29892, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 13, 1111, 12352, 29879, 353, 1409, 4197, 2499, 29885, 29961, 29900, 29892, 29900, 1402, 29871, 13, 18884, 838, 29885, 29961, 29896, 6653, 29896, 1402, 838, 29885, 29961, 29896, 29892, 29900, 1402, 838, 29885, 29961, 29896, 29892, 29896, 1402, 29871, 13, 18884, 838, 29885, 29961, 29906, 6653, 29906, 1402, 838, 29885, 29961, 29906, 6653, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29900, 1402, 838, 29885, 29961, 29906, 29892, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29906, 24960, 13, 13, 4501, 29885, 29918, 2929, 29876, 29906, 29892, 285, 353, 27760, 29918, 11360, 279, 29898, 2499, 29885, 29897, 13, 13, 9778, 918, 353, 313, 29906, 29900, 29900, 29892, 29946, 29900, 29900, 29897, 13, 5426, 29875, 29892, 301, 2219, 29892, 796, 353, 679, 29918, 29879, 561, 29918, 23024, 29898, 9778, 918, 29922, 9778, 918, 29897, 13, 1004, 305, 353, 1302, 12352, 29879, 29889, 6333, 29898, 29999, 467, 6370, 13, 13, 5426, 29875, 29889, 12181, 353, 10104, 13, 29880, 2219, 29889, 12181, 353, 10104, 13, 1004, 305, 29889, 12181, 353, 10104, 13, 13, 29883, 353, 640, 473, 29898, 5426, 29875, 29892, 301, 2219, 29892, 592, 305, 29892, 518, 29900, 2314, 13, 29886, 386, 29941, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29900, 1822, 1765, 1575, 13, 29886, 386, 29941, 353, 2971, 29906, 12163, 29898, 29886, 386, 29941, 29897, 13, 13, 29886, 386, 29946, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29896, 1822, 1765, 1575, 13, 29886, 386, 29946, 353, 2971, 29906, 12163, 29898, 29886, 386, 29946, 29897, 13, 13, 8568, 29918, 29888, 18642, 29906, 353, 2971, 29906, 12163, 29898, 8568, 29918, 2929, 1983, 29961, 3696, 29906, 2314, 13, 13, 13, 3696, 29941, 353, 29871, 29941, 29896, 29945, 29941, 29929, 29945, 29945, 13, 13, 13, 2914, 353, 770, 1598, 10456, 2080, 29879, 29961, 3696, 29941, 1402, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 2499, 29885, 353, 14240, 29918, 517, 29918, 29879, 561, 23024, 10456, 2914, 29892, 8466, 29918, 12163, 929, 29922, 29906, 29897, 13, 13, 1111, 12352, 29879, 353, 1409, 4197, 2499, 29885, 29961, 29900, 29892, 29900, 1402, 29871, 13, 18884, 838, 29885, 29961, 29896, 6653, 29896, 1402, 838, 29885, 29961, 29896, 29892, 29900, 1402, 838, 29885, 29961, 29896, 29892, 29896, 1402, 29871, 13, 18884, 838, 29885, 29961, 29906, 6653, 29906, 1402, 838, 29885, 29961, 29906, 6653, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29900, 1402, 838, 29885, 29961, 29906, 29892, 29896, 1402, 838, 29885, 29961, 29906, 29892, 29906, 24960, 13, 13, 4501, 29885, 29918, 2929, 29876, 29941, 29892, 285, 353, 27760, 29918, 11360, 279, 29898, 2499, 29885, 29897, 13, 13, 9778, 918, 353, 313, 29906, 29900, 29900, 29892, 29946, 29900, 29900, 29897, 13, 5426, 29875, 29892, 301, 2219, 29892, 796, 353, 679, 29918, 29879, 561, 29918, 23024, 29898, 9778, 918, 29922, 9778, 918, 29897, 13, 1004, 305, 353, 1302, 12352, 29879, 29889, 6333, 29898, 29999, 467, 6370, 13, 13, 5426, 29875, 29889, 12181, 353, 10104, 13, 29880, 2219, 29889, 12181, 353, 10104, 13, 1004, 305, 29889, 12181, 353, 10104, 13, 13, 29883, 353, 640, 473, 29898, 5426, 29875, 29892, 301, 2219, 29892, 592, 305, 29892, 518, 29900, 2314, 13, 29886, 386, 29945, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29900, 1822, 1765, 1575, 13, 29886, 386, 29945, 353, 2971, 29906, 12163, 29898, 29886, 386, 29945, 29897, 13, 13, 29886, 386, 29953, 353, 274, 29889, 29027, 29961, 29900, 1822, 657, 29918, 24772, 580, 29961, 29896, 1822, 1765, 1575, 13, 29886, 386, 29953, 353, 2971, 29906, 12163, 29898, 29886, 386, 29953, 29897, 13, 13, 8568, 29918, 29888, 18642, 29941, 353, 2971, 29906, 12163, 29898, 8568, 29918, 2929, 1983, 29961, 3696, 29941, 2314, 13, 13, 13, 1003, 353, 14770, 29889, 4532, 29898, 2161, 2780, 543, 10921, 613, 2537, 2311, 7607, 29896, 29900, 29892, 29906, 29900, 876, 13, 1165, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29906, 29906, 29896, 29892, 18246, 2433, 303, 406, 265, 300, 1495, 13, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29896, 7503, 29892, 29900, 1402, 282, 386, 29896, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29906, 7503, 29892, 29900, 1402, 282, 386, 29906, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3731, 29885, 29918, 2929, 29876, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 4501, 29885, 29918, 2929, 29876, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 6608, 29918, 29888, 18642, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 29892, 525, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 8568, 29918, 29888, 18642, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 5501, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 18861, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 3816, 29901, 29892, 29900, 2314, 13, 517, 29874, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 3816, 29901, 29892, 29896, 2314, 13, 13, 3733, 279, 537, 353, 16755, 537, 29918, 1272, 29961, 3696, 3816, 29901, 29892, 29906, 29962, 13, 1454, 263, 29892, 260, 29892, 282, 297, 14319, 29898, 18861, 29892, 304, 29874, 29892, 16755, 537, 1125, 13, 1678, 565, 282, 1405, 29871, 29900, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 1127, 742, 17456, 2161, 2780, 2433, 1127, 1495, 13, 1678, 1683, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 9539, 742, 17456, 2161, 2780, 2433, 10921, 1495, 13, 13, 1165, 29889, 7720, 580, 13, 13, 13, 1165, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29906, 29906, 29906, 29892, 18246, 2433, 303, 406, 265, 300, 1495, 13, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29941, 7503, 29892, 29900, 1402, 282, 386, 29941, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29946, 7503, 29892, 29900, 1402, 282, 386, 29946, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3731, 29885, 29918, 2929, 29876, 29906, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 4501, 29885, 29918, 2929, 29876, 29906, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 6608, 29918, 29888, 18642, 29906, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 29892, 525, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 8568, 29918, 29888, 18642, 29906, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 5501, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 18861, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 29906, 3816, 29901, 29892, 29900, 2314, 13, 517, 29874, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 29906, 3816, 29901, 29892, 29896, 2314, 13, 13, 3733, 279, 537, 353, 16755, 537, 29918, 1272, 29961, 3696, 29906, 3816, 29901, 29892, 29906, 29962, 13, 1454, 263, 29892, 260, 29892, 282, 297, 14319, 29898, 18861, 29892, 304, 29874, 29892, 16755, 537, 1125, 13, 1678, 565, 282, 1405, 29871, 29900, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 1127, 742, 17456, 2161, 2780, 2433, 1127, 1495, 13, 1678, 1683, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 9539, 742, 17456, 2161, 2780, 2433, 10921, 1495, 13, 13, 1165, 29889, 7720, 580, 13, 13, 13, 1165, 353, 2537, 29889, 1202, 29918, 1491, 5317, 29898, 29906, 29906, 29946, 29892, 18246, 2433, 303, 406, 265, 300, 1495, 13, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29945, 7503, 29892, 29900, 1402, 282, 386, 29945, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 1165, 29889, 336, 446, 29898, 29886, 386, 29953, 7503, 29892, 29900, 1402, 282, 386, 29953, 7503, 29892, 29896, 29962, 718, 29929, 29900, 29889, 29900, 29892, 29871, 29929, 29900, 29889, 29900, 29892, 525, 29901, 742, 2927, 2433, 1127, 742, 1196, 2103, 29922, 29941, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3731, 29885, 29918, 2929, 29876, 29941, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 4501, 29885, 29918, 2929, 29876, 29941, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29892, 28191, 29892, 17411, 29878, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 6608, 29918, 29888, 18642, 29941, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 29892, 525, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 303, 20995, 29892, 28191, 29892, 1153, 446, 353, 3479, 29918, 22116, 10456, 8568, 29918, 29888, 18642, 29941, 29897, 13, 1165, 29889, 22116, 29898, 303, 20995, 29899, 29929, 29900, 29892, 28191, 5501, 29887, 29899, 742, 1196, 2103, 29922, 29906, 29897, 13, 13, 18861, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 29941, 3816, 29901, 29892, 29900, 2314, 13, 517, 29874, 353, 2971, 29906, 12163, 29898, 3733, 279, 537, 29918, 1272, 29961, 3696, 29941, 3816, 29901, 29892, 29896, 2314, 13, 13, 3733, 279, 537, 353, 16755, 537, 29918, 1272, 29961, 3696, 29941, 3816, 29901, 29892, 29906, 29962, 13, 1454, 263, 29892, 260, 29892, 282, 297, 14319, 29898, 18861, 29892, 304, 29874, 29892, 16755, 537, 1125, 13, 1678, 565, 282, 1405, 29871, 29900, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 1127, 742, 17456, 2161, 2780, 2433, 1127, 1495, 13, 1678, 1683, 29901, 13, 4706, 4853, 29889, 15831, 29898, 29874, 29892, 260, 5501, 29877, 742, 17456, 12864, 2780, 2433, 9539, 742, 17456, 2161, 2780, 2433, 10921, 1495, 13, 13, 1165, 29889, 7720, 580, 13, 13, 13, 572, 29873, 29889, 29873, 523, 29918, 2680, 29898, 8305, 29922, 29946, 29889, 29900, 29892, 298, 29918, 8305, 29922, 29906, 29900, 29889, 29900, 29897, 13, 13, 572, 29873, 29889, 4294, 580, 13, 2 ]
tests/test_Methods.py
davidjsanders/python_cowbull_webapp
0
125004
<filename>tests/test_Methods.py import io import logging import os import unittest from app import app from GameSPA.GameSPA import GameSPA from initialization_package.set_config import set_config from unittest import TestCase class TestMethods(TestCase): def setUp(self): # Setup the environment to ensure any running cowbull # game server is ignored. os.environ['COWBULL_SERVER'] = '0' os.environ['COWBULL_PORT'] = '0' # Import the app and set the config. from app import app app.config['TESTING'] = True app.config['WTF_CSRF_ENABLED'] = False app.config['DEBUG'] = False self.app = app.test_client() def tearDown(self): pass def test_set_config(self): # Note: PASS the real app not the test app set_config(self.app.application) def test_set_config_custom_config(self): # Note: PASS the real app not the test app os.environ['COWBULL_PROTOCOL'] = "https" os.environ['COWBULL_SERVER'] = "foobar" os.environ['COWBULL_PORT'] = "8" os.environ['COWBULL_VERSION'] = "v2" os.environ['COWBULL_ENVIRONMENT'] = "UnitTest" os.environ['NAVBAR_COLOUR'] = "BLUE" os.environ['BUILD_NUMBER'] = "1.2.3.4" os.environ['FLASK_PORT'] = "80" os.environ['FLASK_HOST'] = "172.16.17.32" set_config(self.app.application) self.assertEqual(self.app.application.config['cowbull_protocol'], "https") self.assertEqual(self.app.application.config['cowbull_server'], "foobar") self.assertEqual(self.app.application.config['cowbull_port'], "8") self.assertEqual(self.app.application.config['cowbull_version'], "v2") self.assertEqual( self.app.application.config['cowbull_url'], "https://foobar:8/v2" ) self.assertEqual( self.app.application.config['cowbull_modes_url'], "https://foobar:8/v2/modes" ) self.assertEqual( self.app.application.config['cowbull_game_url'], "https://foobar:8/v2/game" ) self.assertEqual(self.app.application.config['environment'], "UnitTest") self.assertEqual(self.app.application.config['navbar_colour'], "BLUE") self.assertEqual(self.app.application.config['build_number'], "1.2.3.4") self.assertEqual(self.app.application.config['FLASK_PORT'], 80) self.assertEqual(self.app.application.config['FLASK_HOST'], '4.3.2.1') def test_set_config_bad_port(self): # Note: PASS the real app not the test app os.environ['FLASK_PORT'] = "BADINT" set_config(self.app.application) self.assertEqual(self.app.application.config['FLASK_PORT'], 8001) def test_set_config_value_error(self): with self.assertRaises(ValueError): set_config() # Expect the game to fail in unit test. Cowbull server should NOT be running # def test_no_game(self): # response = self.app.get('/', follow_redirects=True) # response_expected = "Game is unavailable" # self.assertTrue(response_expected in str(response.get_data()))
[ 1, 529, 9507, 29958, 21150, 29914, 1688, 29918, 26112, 29889, 2272, 13, 5215, 12013, 13, 5215, 12183, 13, 5215, 2897, 13, 5215, 443, 27958, 13, 3166, 623, 1053, 623, 13, 3166, 8448, 5550, 29909, 29889, 14199, 5550, 29909, 1053, 8448, 5550, 29909, 13, 3166, 17865, 29918, 5113, 29889, 842, 29918, 2917, 1053, 731, 29918, 2917, 13, 3166, 443, 27958, 1053, 4321, 8259, 13, 13, 1990, 4321, 26112, 29898, 3057, 8259, 1125, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 396, 3789, 786, 278, 5177, 304, 9801, 738, 2734, 21282, 29890, 913, 13, 4706, 396, 3748, 1923, 338, 17262, 29889, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 18603, 2033, 353, 525, 29900, 29915, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 15082, 2033, 353, 525, 29900, 29915, 13, 13, 4706, 396, 16032, 278, 623, 322, 731, 278, 2295, 29889, 13, 4706, 515, 623, 1053, 623, 13, 4706, 623, 29889, 2917, 1839, 18267, 4214, 2033, 353, 5852, 13, 4706, 623, 29889, 2917, 1839, 29956, 8969, 29918, 9295, 29934, 29943, 29918, 1430, 6181, 29928, 2033, 353, 7700, 13, 4706, 623, 29889, 2917, 1839, 18525, 2033, 353, 7700, 13, 4706, 1583, 29889, 932, 353, 623, 29889, 1688, 29918, 4645, 580, 13, 13, 1678, 822, 734, 279, 6767, 29898, 1311, 1125, 13, 4706, 1209, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 2917, 29898, 1311, 1125, 13, 4706, 396, 3940, 29901, 17687, 1799, 278, 1855, 623, 451, 278, 1243, 623, 13, 4706, 731, 29918, 2917, 29898, 1311, 29889, 932, 29889, 6214, 29897, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 2917, 29918, 6341, 29918, 2917, 29898, 1311, 1125, 13, 4706, 396, 3940, 29901, 17687, 1799, 278, 1855, 623, 451, 278, 1243, 623, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 8618, 4986, 15032, 2033, 353, 376, 991, 29908, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 18603, 2033, 353, 376, 1181, 22872, 29908, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 15082, 2033, 353, 376, 29947, 29908, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 16358, 2033, 353, 376, 29894, 29906, 29908, 13, 4706, 2897, 29889, 21813, 1839, 3217, 29956, 29933, 3299, 29918, 25838, 8193, 1164, 13780, 2033, 353, 376, 8325, 3057, 29908, 13, 4706, 2897, 29889, 21813, 1839, 3521, 24281, 1718, 29918, 3217, 3927, 4574, 2033, 353, 376, 13367, 4462, 29908, 13, 4706, 2897, 29889, 21813, 1839, 29933, 25282, 29918, 23207, 2033, 353, 376, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 29908, 13, 4706, 2897, 29889, 21813, 1839, 10536, 3289, 29968, 29918, 15082, 2033, 353, 376, 29947, 29900, 29908, 13, 4706, 2897, 29889, 21813, 1839, 10536, 3289, 29968, 29918, 20832, 2033, 353, 376, 29896, 29955, 29906, 29889, 29896, 29953, 29889, 29896, 29955, 29889, 29941, 29906, 29908, 13, 4706, 731, 29918, 2917, 29898, 1311, 29889, 932, 29889, 6214, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 20464, 7464, 376, 991, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 2974, 7464, 376, 1181, 22872, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 637, 7464, 376, 29947, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 3259, 7464, 376, 29894, 29906, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 2271, 7464, 29871, 13, 9651, 376, 991, 597, 1181, 22872, 29901, 29947, 29914, 29894, 29906, 29908, 13, 9651, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 1545, 267, 29918, 2271, 7464, 29871, 13, 9651, 376, 991, 597, 1181, 22872, 29901, 29947, 29914, 29894, 29906, 29914, 1545, 267, 29908, 13, 9651, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13, 9651, 1583, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20587, 29890, 913, 29918, 11802, 29918, 2271, 7464, 29871, 13, 9651, 376, 991, 597, 1181, 22872, 29901, 29947, 29914, 29894, 29906, 29914, 11802, 29908, 13, 9651, 1723, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 20944, 7464, 376, 8325, 3057, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 21890, 29918, 1054, 473, 7464, 376, 13367, 4462, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 4282, 29918, 4537, 7464, 376, 29896, 29889, 29906, 29889, 29941, 29889, 29946, 1159, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 10536, 3289, 29968, 29918, 15082, 7464, 29871, 29947, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 10536, 3289, 29968, 29918, 20832, 7464, 525, 29946, 29889, 29941, 29889, 29906, 29889, 29896, 1495, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 2917, 29918, 12313, 29918, 637, 29898, 1311, 1125, 13, 4706, 396, 3940, 29901, 17687, 1799, 278, 1855, 623, 451, 278, 1243, 623, 13, 4706, 2897, 29889, 21813, 1839, 10536, 3289, 29968, 29918, 15082, 2033, 353, 376, 29933, 3035, 10192, 29908, 13, 4706, 731, 29918, 2917, 29898, 1311, 29889, 932, 29889, 6214, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 1311, 29889, 932, 29889, 6214, 29889, 2917, 1839, 10536, 3289, 29968, 29918, 15082, 7464, 29871, 29947, 29900, 29900, 29896, 29897, 13, 13, 1678, 822, 1243, 29918, 842, 29918, 2917, 29918, 1767, 29918, 2704, 29898, 1311, 1125, 13, 4706, 411, 1583, 29889, 9294, 29934, 1759, 267, 29898, 1917, 2392, 1125, 13, 9651, 731, 29918, 2917, 580, 13, 13, 1678, 396, 1222, 1103, 278, 3748, 304, 4418, 297, 5190, 1243, 29889, 21638, 29890, 913, 1923, 881, 6058, 367, 2734, 13, 1678, 396, 822, 1243, 29918, 1217, 29918, 11802, 29898, 1311, 1125, 13, 1678, 396, 268, 2933, 353, 1583, 29889, 932, 29889, 657, 11219, 742, 1101, 29918, 17886, 29879, 29922, 5574, 29897, 13, 1678, 396, 268, 2933, 29918, 9684, 353, 376, 14199, 338, 443, 16515, 29908, 13, 1678, 396, 268, 1583, 29889, 9294, 5574, 29898, 5327, 29918, 9684, 297, 851, 29898, 5327, 29889, 657, 29918, 1272, 22130, 13, 2 ]
setup.py
viktorsapozhok/kubernetes-cronjob-tutorial
0
132236
from setuptools import setup def get_requirements(): r = [] with open("requirements.txt") as fp: for line in fp.read().split("\n"): if not line.startswith("#"): r += [line.strip()] return r setup( name="app", packages=["app"], include_package_data=True, zip_safe=False, install_requires=get_requirements(), entry_points={ "console_scripts": [ "myapp=app.cli:main", ] }, )
[ 1, 515, 731, 21245, 8789, 1053, 6230, 13, 13, 13, 1753, 679, 29918, 12277, 1860, 7295, 13, 1678, 364, 353, 5159, 13, 1678, 411, 1722, 703, 12277, 1860, 29889, 3945, 1159, 408, 285, 29886, 29901, 13, 4706, 363, 1196, 297, 285, 29886, 29889, 949, 2141, 5451, 14182, 29876, 29908, 1125, 13, 9651, 565, 451, 1196, 29889, 27382, 2541, 14822, 29908, 1125, 13, 18884, 364, 4619, 518, 1220, 29889, 17010, 580, 29962, 13, 1678, 736, 364, 13, 13, 13, 14669, 29898, 13, 1678, 1024, 543, 932, 613, 13, 1678, 9741, 29922, 3366, 932, 12436, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 14319, 29918, 11177, 29922, 8824, 29892, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 657, 29918, 12277, 1860, 3285, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 376, 11058, 29918, 16713, 1115, 518, 13, 9651, 376, 1357, 932, 29922, 932, 29889, 11303, 29901, 3396, 613, 13, 4706, 4514, 13, 1678, 2981, 13, 29897, 13, 2 ]
stubs/ssm.py
claytonbrown/troposphere
0
157658
<reponame>claytonbrown/troposphere from . import AWSObject, AWSProperty from .validators import * from .constants import * # ------------------------------------------- class SSMParameterValues(AWSProperty): """# ParameterValues - CloudFormationResourceSpecification version: 1.4.0 { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html", "Properties": { "ParameterValues": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html#cfn-ssm-association-parametervalues-parametervalues", "DuplicatesAllowed": false, "PrimitiveItemType": "String", "Required": true, "Type": "List", "UpdateType": "Mutable" } } } """ props = { 'ParameterValues': ([basestring], True, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-parametervalues.html#cfn-ssm-association-parametervalues-parametervalues') } # ------------------------------------------- class SSMTarget(AWSProperty): """# Target - CloudFormationResourceSpecification version: 1.4.0 { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html", "Properties": { "Key": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-key", "PrimitiveType": "String", "Required": true, "UpdateType": "Immutable" }, "Values": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-values", "DuplicatesAllowed": false, "PrimitiveItemType": "String", "Required": true, "Type": "List", "UpdateType": "Immutable" } } } """ props = { 'Key': (basestring, True, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-key'), 'Values': ([basestring], True, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ssm-association-target.html#cfn-ssm-association-target-values') } # ------------------------------------------- class SSMDocument(AWSObject): """# AWS::SSM::Document - CloudFormationResourceSpecification version: 1.4.0 { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html", "Properties": { "Content": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-content", "PrimitiveType": "Json", "Required": true, "UpdateType": "Immutable" }, "DocumentType": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-documenttype", "PrimitiveType": "String", "Required": false, "UpdateType": "Immutable" } } } """ resource_type = "AWS::SSM::Document" props = { 'Content': ((basestring, dict), True, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-content'), 'DocumentType': (basestring, False, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-document.html#cfn-ssm-document-documenttype') } # ------------------------------------------- class SSMParameter(AWSObject): """# AWS::SSM::Parameter - CloudFormationResourceSpecification version: 1.4.0 { "Attributes": { "Type": { "PrimitiveType": "String" }, "Value": { "PrimitiveType": "String" } }, "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html", "Properties": { "Description": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-description", "PrimitiveType": "String", "Required": false, "UpdateType": "Mutable" }, "Name": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-name", "PrimitiveType": "String", "Required": false, "UpdateType": "Immutable" }, "Type": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-type", "PrimitiveType": "String", "Required": true, "UpdateType": "Mutable" }, "Value": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-value", "PrimitiveType": "String", "Required": true, "UpdateType": "Mutable" } } } """ resource_type = "AWS::SSM::Parameter" props = { 'Type': (basestring, True, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-type'), 'Description': (basestring, False, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-description'), 'Value': (basestring, True, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-value'), 'Name': (basestring, False, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-parameter.html#cfn-ssm-parameter-name') } # ------------------------------------------- class SSMAssociation(AWSObject): """# AWS::SSM::Association - CloudFormationResourceSpecification version: 1.4.0 { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html", "Properties": { "DocumentVersion": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-documentversion", "PrimitiveType": "String", "Required": false, "UpdateType": "Mutable" }, "InstanceId": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-instanceid", "PrimitiveType": "String", "Required": false, "UpdateType": "Immutable" }, "Name": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-name", "PrimitiveType": "String", "Required": true, "UpdateType": "Immutable" }, "Parameters": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-parameters", "DuplicatesAllowed": false, "ItemType": "ParameterValues", "Required": false, "Type": "Map", "UpdateType": "Mutable" }, "ScheduleExpression": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-scheduleexpression", "PrimitiveType": "String", "Required": false, "UpdateType": "Mutable" }, "Targets": { "Documentation": "http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-targets", "DuplicatesAllowed": false, "ItemType": "Target", "Required": false, "Type": "List", "UpdateType": "Immutable" } } } """ resource_type = "AWS::SSM::Association" props = { 'DocumentVersion': (basestring, False, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-documentversion'), 'InstanceId': (basestring, False, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-instanceid'), 'Name': (basestring, True, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-name'), 'Parameters': (dict, False, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-parameters'), 'ScheduleExpression': (basestring, False, 'Mutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-scheduleexpression'), 'Targets': ([Target], False, 'Immutable', 'http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ssm-association.html#cfn-ssm-association-targets') }
[ 1, 529, 276, 1112, 420, 29958, 695, 388, 880, 29890, 4708, 29914, 29873, 307, 1066, 9085, 13, 3166, 869, 1053, 15540, 2061, 29892, 15540, 4854, 13, 3166, 869, 3084, 4097, 1053, 334, 13, 3166, 869, 3075, 1934, 1053, 334, 13, 13, 13, 29937, 448, 2683, 2683, 28400, 13, 1990, 5886, 29924, 9329, 9065, 29898, 29909, 7811, 4854, 1125, 13, 1678, 9995, 29937, 24953, 9065, 448, 14293, 2500, 362, 6848, 10299, 2450, 1873, 29901, 29871, 29896, 29889, 29946, 29889, 29900, 13, 13, 1678, 426, 13, 1678, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 15501, 5975, 29889, 1420, 613, 13, 1678, 376, 11857, 1115, 426, 13, 4706, 376, 9329, 9065, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 15501, 5975, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 15501, 5975, 29899, 15501, 5975, 613, 13, 9651, 376, 29928, 786, 15815, 15930, 287, 1115, 2089, 29892, 13, 9651, 376, 18213, 3321, 2001, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 1542, 1115, 376, 1293, 613, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 500, 13, 1678, 500, 13, 29913, 13, 1678, 9995, 13, 1678, 17761, 353, 426, 13, 4706, 525, 9329, 9065, 2396, 9310, 6500, 342, 5393, 1402, 5852, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 15501, 5975, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 15501, 5975, 29899, 15501, 5975, 1495, 13, 1678, 500, 13, 13, 29937, 448, 2683, 2683, 28400, 13, 1990, 5886, 29924, 8667, 29898, 29909, 7811, 4854, 1125, 13, 1678, 9995, 29937, 17157, 448, 14293, 2500, 362, 6848, 10299, 2450, 1873, 29901, 29871, 29896, 29889, 29946, 29889, 29900, 13, 13, 1678, 426, 13, 1678, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29889, 1420, 613, 13, 1678, 376, 11857, 1115, 426, 13, 4706, 376, 2558, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29899, 1989, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 2981, 13, 4706, 376, 9065, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29899, 5975, 613, 13, 9651, 376, 29928, 786, 15815, 15930, 287, 1115, 2089, 29892, 13, 9651, 376, 18213, 3321, 2001, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 1542, 1115, 376, 1293, 613, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 500, 13, 1678, 500, 13, 29913, 13, 1678, 9995, 13, 1678, 17761, 353, 426, 13, 4706, 525, 2558, 2396, 313, 6500, 342, 5393, 29892, 5852, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29899, 1989, 5477, 13, 4706, 525, 9065, 2396, 9310, 6500, 342, 5393, 1402, 5852, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 11330, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29899, 5975, 1495, 13, 1678, 500, 13, 13, 29937, 448, 2683, 2683, 28400, 13, 13, 1990, 5886, 5773, 4463, 29898, 29909, 7811, 2061, 1125, 13, 1678, 9995, 29937, 15540, 1057, 1799, 29924, 1057, 6268, 448, 14293, 2500, 362, 6848, 10299, 2450, 1873, 29901, 29871, 29896, 29889, 29946, 29889, 29900, 13, 13, 1678, 426, 13, 1678, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 3225, 29889, 1420, 613, 13, 1678, 376, 11857, 1115, 426, 13, 4706, 376, 3916, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 3225, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 3225, 29899, 3051, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 8148, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 2981, 13, 4706, 376, 6268, 1542, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 3225, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 3225, 29899, 3225, 1853, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 500, 13, 1678, 500, 13, 29913, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 376, 29909, 7811, 1057, 1799, 29924, 1057, 6268, 29908, 13, 13, 1678, 17761, 353, 426, 13, 4706, 525, 3916, 2396, 5135, 6500, 342, 5393, 29892, 9657, 511, 5852, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 3225, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 3225, 29899, 3051, 5477, 13, 4706, 525, 6268, 1542, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 3225, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 3225, 29899, 3225, 1853, 1495, 13, 1678, 500, 13, 13, 13, 29937, 448, 2683, 2683, 28400, 13, 13, 1990, 5886, 29924, 9329, 29898, 29909, 7811, 2061, 1125, 13, 1678, 9995, 29937, 15540, 1057, 1799, 29924, 1057, 9329, 448, 14293, 2500, 362, 6848, 10299, 2450, 1873, 29901, 29871, 29896, 29889, 29946, 29889, 29900, 13, 13, 1678, 426, 13, 1678, 376, 15801, 1115, 426, 13, 4706, 376, 1542, 1115, 426, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 29908, 13, 4706, 2981, 13, 4706, 376, 1917, 1115, 426, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 29908, 13, 4706, 500, 13, 1678, 2981, 13, 1678, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 613, 13, 1678, 376, 11857, 1115, 426, 13, 4706, 376, 9868, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 8216, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 2981, 13, 4706, 376, 1170, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 978, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 2981, 13, 4706, 376, 1542, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 1853, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 2981, 13, 4706, 376, 1917, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 1767, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 500, 13, 1678, 500, 13, 29913, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 376, 29909, 7811, 1057, 1799, 29924, 1057, 9329, 29908, 13, 13, 1678, 17761, 353, 426, 13, 4706, 525, 1542, 2396, 313, 6500, 342, 5393, 29892, 5852, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 1853, 5477, 13, 4706, 525, 9868, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 8216, 5477, 13, 4706, 525, 1917, 2396, 313, 6500, 342, 5393, 29892, 5852, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 1767, 5477, 13, 4706, 525, 1170, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 15501, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 15501, 29899, 978, 1495, 13, 1678, 500, 13, 13, 13, 29937, 448, 2683, 2683, 28400, 13, 13, 1990, 5886, 1529, 29879, 2839, 362, 29898, 29909, 7811, 2061, 1125, 13, 1678, 9995, 29937, 15540, 1057, 1799, 29924, 1057, 29254, 362, 448, 14293, 2500, 362, 6848, 10299, 2450, 1873, 29901, 29871, 29896, 29889, 29946, 29889, 29900, 13, 13, 1678, 426, 13, 1678, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 613, 13, 1678, 376, 11857, 1115, 426, 13, 4706, 376, 6268, 6594, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 3225, 3259, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 2981, 13, 4706, 376, 4998, 1204, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 8758, 333, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 2981, 13, 4706, 376, 1170, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 978, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 1565, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 2981, 13, 4706, 376, 11507, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 16744, 613, 13, 9651, 376, 29928, 786, 15815, 15930, 287, 1115, 2089, 29892, 13, 9651, 376, 2001, 1542, 1115, 376, 9329, 9065, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 1542, 1115, 376, 3388, 613, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 2981, 13, 4706, 376, 4504, 11272, 10960, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 816, 11272, 17471, 613, 13, 9651, 376, 18213, 3321, 1542, 1115, 376, 1231, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 6422, 1542, 1115, 376, 15211, 29908, 13, 4706, 2981, 13, 4706, 376, 8667, 29879, 1115, 426, 13, 9651, 376, 6268, 362, 1115, 376, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29879, 613, 13, 9651, 376, 29928, 786, 15815, 15930, 287, 1115, 2089, 29892, 13, 9651, 376, 2001, 1542, 1115, 376, 8667, 613, 13, 9651, 376, 19347, 1115, 2089, 29892, 13, 9651, 376, 1542, 1115, 376, 1293, 613, 13, 9651, 376, 6422, 1542, 1115, 376, 1888, 23975, 29908, 13, 4706, 500, 13, 1678, 500, 13, 29913, 13, 1678, 9995, 13, 13, 1678, 6503, 29918, 1853, 353, 376, 29909, 7811, 1057, 1799, 29924, 1057, 29254, 362, 29908, 13, 13, 1678, 17761, 353, 426, 13, 4706, 525, 6268, 6594, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 3225, 3259, 5477, 13, 4706, 525, 4998, 1204, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 8758, 333, 5477, 13, 4706, 525, 1170, 2396, 313, 6500, 342, 5393, 29892, 5852, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 978, 5477, 13, 4706, 525, 11507, 2396, 313, 8977, 29892, 7700, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 16744, 5477, 13, 4706, 525, 4504, 11272, 10960, 2396, 313, 6500, 342, 5393, 29892, 7700, 29892, 525, 15211, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 816, 11272, 17471, 5477, 13, 4706, 525, 8667, 29879, 2396, 9310, 8667, 1402, 7700, 29892, 525, 1888, 23975, 742, 525, 1124, 597, 2640, 29889, 10467, 29889, 17260, 29889, 510, 29914, 29909, 7811, 20442, 2500, 362, 29914, 12333, 29914, 2659, 9485, 680, 29914, 10467, 29899, 10314, 29899, 893, 29885, 29899, 21264, 362, 29889, 1420, 29937, 6854, 29876, 29899, 893, 29885, 29899, 21264, 362, 29899, 5182, 29879, 1495, 13, 1678, 500, 13, 13, 13, 2 ]
Python Fundamentals/Data types and Variables/Exercise/Task04.py
IvanTodorovBG/SoftUni
1
178390
n = int(input()) total_sum = 0 for x in range(1, n + 1): ascii_code = input() total_sum += ord(ascii_code) print(f"The sum equals: {total_sum}")
[ 1, 302, 353, 938, 29898, 2080, 3101, 13, 13, 7827, 29918, 2083, 353, 29871, 29900, 13, 13, 1454, 921, 297, 3464, 29898, 29896, 29892, 302, 718, 29871, 29896, 1125, 13, 1678, 408, 18869, 29918, 401, 353, 1881, 580, 13, 1678, 3001, 29918, 2083, 4619, 4356, 29898, 294, 18869, 29918, 401, 29897, 13, 13, 2158, 29898, 29888, 29908, 1576, 2533, 15743, 29901, 426, 7827, 29918, 2083, 27195, 2 ]
app/views/v1/search.py
daghan/Ostrich
0
17222
from app import webapp, mysql from app.models import Search , Utils, Collection, WebUtils from flask import request, jsonify from flask.ext.jsonpify import jsonify as jsonp import json ''' Generic search call @params q: search query page: the page number of search results (default 0) type: type of search: {default: free(all fields), category, isbn} @response List of search result objects(ES) ''' @webapp.route('/search') def searchString(): response = {'status': 'False'} results = {} query = Utils.getParam(request.args, 'q') page = Utils.getParam(request.args, 'page', var_type='int', default=1) search_type = Utils.getParam(request.args, 'type', default='free') user_id = Utils.getParam(request.args, 'userId', 'int') flow = Utils.getParam(request.args, 'flow', default='borrow') gcm_id = Utils.getParam(request.args, 'gcm_id', default=None) uuid = Utils.getParam(request.args, 'distinct_id', default=None) ref = Utils.getParam(request.args, 'ref', default='mobile') if not query: return Utils.errorResponse(response, 'HTTP_STATUS_CODE_DATA_MISSING') if ref == 'web': return jsonify(WebUtils.fetchSearchResults(query, search_type, page)) user_info = {'user_id': user_id, 'gcm_id': gcm_id, 'uuid': uuid} search = Search(query, user_info, flow) if search_type == 'free': results = search.basicSearch(page=page-1) elif search_type == 'category': results = search.categorySearch(page=page-1) elif search_type == 'collections': results = search.collectionsSearch(page=page-1) elif search_type == 'isbn': results = search.isbnSearch(page=page-1) elif search_type == 'auto': results = search.autoComplete() elif search_type == 'custom': results = search.customQuery() return results #log if user_id not in Utils.getAdmins(): Search.logSearch({_:request.args.get(_) for _ in request.args}, search_type) return jsonify(results) if flow != 'admin' else jsonp(results) @webapp.route('/getCategories') def getCategories(): categories = Search.getSearchCategoriesForApp() return jsonify(categories) @webapp.route('/getCollectionCategory') def getCollectionCategory(): return jsonify(Collection.getByCategory()) @webapp.route('/searchFail', methods=['POST']) def searchFail(): #NOTE deprecated. Done directly from backend return jsonify(status='true') user_id = Utils.getParam(request.form, 'user_id', 'int') q = Utils.getParam(request.form, 'q') q_type = Utils.getParam(request.form,'type') flow = Utils.getParam(request.form, 'flow', default='borrow') Search(q, {'user_id': user_id}, flow).reportFail(True,True,q_type) return jsonify(status='true') @webapp.route('/recommended', methods=['GET']) def recommended(): return jsonify(Search([]).mostRecommended()) @webapp.route('/mostSearched', methods=['GET']) def mostSearched(): return jsonify(Search([]).mostSearched()) @webapp.route('/getMultiplePanels') def getMultiplePanels(): cursor = mysql.connect().cursor() cursor.execute("""SELECT collection_id FROM collections WHERE active = 1 AND partial_order = 1 ORDER BY collection_id DESC""") panels = [] for col_id in cursor.fetchall(): panels.append(Collection(col_id).getObj()) return jsonify(panels)
[ 1, 515, 623, 1053, 1856, 932, 29892, 5749, 13, 3166, 623, 29889, 9794, 1053, 11856, 1919, 22310, 29879, 29892, 14348, 29892, 2563, 12177, 13, 3166, 29784, 1053, 2009, 29892, 4390, 1598, 13, 3166, 29784, 29889, 1062, 29889, 3126, 29886, 1598, 1053, 4390, 1598, 408, 4390, 29886, 13, 5215, 4390, 13, 13, 13, 12008, 13, 1678, 3251, 293, 2740, 1246, 13, 1678, 732, 7529, 13, 4706, 3855, 29901, 2740, 2346, 13, 4706, 1813, 29901, 278, 1813, 1353, 310, 2740, 2582, 313, 4381, 29871, 29900, 29897, 13, 4706, 1134, 29901, 1134, 310, 2740, 29901, 426, 4381, 29901, 3889, 29898, 497, 4235, 511, 7663, 29892, 338, 11197, 29913, 13, 13, 1678, 732, 5327, 13, 4706, 2391, 310, 2740, 1121, 3618, 29898, 2890, 29897, 13, 12008, 13, 29992, 2676, 932, 29889, 13134, 11219, 4478, 1495, 13, 1753, 2740, 1231, 7295, 13, 1678, 2933, 353, 11117, 4882, 2396, 525, 8824, 10827, 13, 1678, 2582, 353, 6571, 13, 13, 1678, 2346, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 29939, 1495, 29871, 13, 1678, 1813, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 3488, 742, 722, 29918, 1853, 2433, 524, 742, 2322, 29922, 29896, 29897, 13, 1678, 2740, 29918, 1853, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 1853, 742, 2322, 2433, 9021, 1495, 13, 1678, 1404, 29918, 333, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 29721, 742, 525, 524, 1495, 13, 1678, 4972, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 1731, 742, 2322, 2433, 4089, 798, 1495, 13, 1678, 330, 4912, 29918, 333, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 29887, 4912, 29918, 333, 742, 2322, 29922, 8516, 29897, 13, 1678, 318, 5416, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 5721, 5562, 29918, 333, 742, 2322, 29922, 8516, 29897, 13, 1678, 2143, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 5085, 29892, 525, 999, 742, 2322, 2433, 16769, 1495, 13, 13, 1678, 565, 451, 2346, 29901, 13, 4706, 736, 22310, 29879, 29889, 2704, 5103, 29898, 5327, 29892, 525, 10493, 29918, 27047, 29918, 16524, 29918, 14573, 29918, 10403, 1799, 4214, 1495, 13, 1678, 13, 1678, 565, 2143, 1275, 525, 2676, 2396, 13, 4706, 736, 4390, 1598, 29898, 3609, 12177, 29889, 9155, 7974, 12191, 29898, 1972, 29892, 2740, 29918, 1853, 29892, 1813, 876, 13, 13, 1678, 1404, 29918, 3888, 353, 11117, 1792, 29918, 333, 2396, 1404, 29918, 333, 29892, 525, 29887, 4912, 29918, 333, 2396, 330, 4912, 29918, 333, 29892, 525, 25118, 2396, 318, 5416, 29913, 13, 1678, 2740, 353, 11856, 29898, 1972, 29892, 1404, 29918, 3888, 29892, 4972, 29897, 13, 1678, 565, 2740, 29918, 1853, 1275, 525, 9021, 2396, 13, 4706, 2582, 353, 2740, 29889, 16121, 7974, 29898, 3488, 29922, 3488, 29899, 29896, 29897, 13, 1678, 25342, 2740, 29918, 1853, 1275, 525, 7320, 2396, 13, 4706, 2582, 353, 2740, 29889, 7320, 7974, 29898, 3488, 29922, 3488, 29899, 29896, 29897, 13, 1678, 25342, 2740, 29918, 1853, 1275, 525, 29027, 2396, 13, 4706, 2582, 353, 2740, 29889, 29027, 7974, 29898, 3488, 29922, 3488, 29899, 29896, 29897, 13, 1678, 25342, 2740, 29918, 1853, 1275, 525, 275, 11197, 2396, 13, 4706, 2582, 353, 2740, 29889, 275, 11197, 7974, 29898, 3488, 29922, 3488, 29899, 29896, 29897, 13, 1678, 25342, 2740, 29918, 1853, 1275, 525, 6921, 2396, 13, 4706, 2582, 353, 2740, 29889, 6921, 17813, 580, 13, 1678, 25342, 2740, 29918, 1853, 1275, 525, 6341, 2396, 13, 4706, 2582, 353, 2740, 29889, 6341, 3010, 580, 13, 4706, 736, 2582, 13, 1678, 396, 1188, 13, 1678, 565, 1404, 29918, 333, 451, 297, 22310, 29879, 29889, 657, 3253, 29885, 1144, 7295, 13, 4706, 11856, 29889, 1188, 7974, 3319, 29918, 29901, 3827, 29889, 5085, 29889, 657, 7373, 29897, 363, 903, 297, 2009, 29889, 5085, 1118, 2740, 29918, 1853, 29897, 13, 13, 1678, 736, 4390, 1598, 29898, 9902, 29897, 565, 4972, 2804, 525, 6406, 29915, 1683, 4390, 29886, 29898, 9902, 29897, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 657, 29907, 14404, 1495, 13, 1753, 679, 29907, 14404, 7295, 13, 1678, 13997, 353, 11856, 29889, 657, 7974, 29907, 14404, 2831, 2052, 580, 13, 1678, 736, 4390, 1598, 29898, 20683, 29897, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 657, 7196, 10900, 1495, 13, 1753, 679, 7196, 10900, 7295, 13, 259, 736, 4390, 1598, 29898, 7196, 29889, 657, 2059, 10900, 3101, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 4478, 16243, 742, 3519, 29922, 1839, 5438, 11287, 13, 1753, 2740, 16243, 7295, 13, 1678, 396, 12256, 29923, 18164, 29889, 25679, 4153, 515, 14998, 13, 1678, 736, 4390, 1598, 29898, 4882, 2433, 3009, 1495, 13, 268, 13, 1678, 1404, 29918, 333, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 689, 29892, 525, 1792, 29918, 333, 742, 525, 524, 1495, 13, 1678, 3855, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 689, 29892, 525, 29939, 1495, 13, 1678, 3855, 29918, 1853, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 689, 5501, 1853, 1495, 13, 1678, 4972, 353, 22310, 29879, 29889, 657, 4736, 29898, 3827, 29889, 689, 29892, 525, 1731, 742, 2322, 2433, 4089, 798, 1495, 13, 268, 13, 1678, 11856, 29898, 29939, 29892, 11117, 1792, 29918, 333, 2396, 1404, 29918, 333, 1118, 4972, 467, 12276, 16243, 29898, 5574, 29892, 5574, 29892, 29939, 29918, 1853, 29897, 13, 1678, 736, 4390, 1598, 29898, 4882, 2433, 3009, 1495, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 276, 2055, 2760, 742, 3519, 29922, 1839, 7194, 11287, 13, 1753, 13622, 7295, 13, 1678, 736, 4390, 1598, 29898, 7974, 29898, 2636, 467, 3242, 1123, 2055, 2760, 3101, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 3242, 7974, 287, 742, 3519, 29922, 1839, 7194, 11287, 13, 1753, 1556, 7974, 287, 7295, 13, 1678, 736, 4390, 1598, 29898, 7974, 29898, 2636, 467, 3242, 7974, 287, 3101, 13, 13, 29992, 2676, 932, 29889, 13134, 11219, 657, 15329, 552, 23684, 1379, 1495, 13, 1753, 679, 15329, 552, 23684, 1379, 7295, 13, 1678, 10677, 353, 5749, 29889, 6915, 2141, 18127, 580, 13, 1678, 10677, 29889, 7978, 703, 15945, 6404, 4333, 29918, 333, 3895, 16250, 5754, 6136, 353, 29871, 29896, 5300, 13, 4706, 7687, 29918, 2098, 353, 29871, 29896, 15606, 6770, 4333, 29918, 333, 23050, 15945, 1159, 13, 1678, 7243, 1379, 353, 5159, 13, 1678, 363, 784, 29918, 333, 297, 10677, 29889, 9155, 497, 7295, 13, 4706, 7243, 1379, 29889, 4397, 29898, 7196, 29898, 1054, 29918, 333, 467, 657, 9930, 3101, 13, 1678, 736, 4390, 1598, 29898, 8357, 1379, 29897, 13, 13, 2 ]
backtester.py
iamthejao/portfolioTools
0
176612
from portfolio import Portfolio, PM import datetime as dt from collections import OrderedDict import utility import copy import numpy as np class Backtester: def __init__(self, universeObj, start=None, end=None): if start is None: start = universeObj.dateRange[0] if end is None: end = universeObj.dateRange[1] self.universe = universeObj # Can still be None, None, which will be checked later self.dateRange = [start, end] if self.dateRange[0] is None or self.dateRange[1] is None: start, end = PM.getPortfolioDateRange(universeObj.assets) if self.dateRange[0] is None: self.dateRange[0] = start if self.dateRange[1] is None: self.dateRange[1] = end self.dateRange = tuple(copy.deepcopy(self.dateRange)) def load(self): self.universe.make() self.originals = copy.deepcopy(self.universe.data) def reduce(self, frame): return frame.loc[(frame.index >= self.visibility[0]) & (frame.index <= self.visibility[1])] def reduceVisibility(self, dateRange): self.visibility = (np.datetime64(dateRange[0]), np.datetime64(dateRange[1])) for key in self.universe.data.keys(): self.universe.data[key] = self.reduce(self.originals[key].copy()) def backtest(self, strategy, frequency, daysBeforeVisibility=360, inverse=False): """ Strategy function is a function that receives universeObj, start and end and should return assets, allocation, direction vectors frequency is the jump daysBeforeVisibility is the start and currentDay the end of which the strategy function should see """ history = OrderedDict() firstDayData = self.dateRange[0] - dt.timedelta(days=daysBeforeVisibility) self.universe.dateRange = (firstDayData, self.dateRange[1]) print("Loading universe data from {0} to {1}.".format(self.universe.dateRange[0], self.universe.dateRange[1])) self.load() print("Backtesting from {0} to {1}".format(self.dateRange[0], self.dateRange[1])) prevPi = None kwdict = {} currentDay = self.dateRange[0] while currentDay < self.dateRange[1]: startVisibility = currentDay - dt.timedelta(days=daysBeforeVisibility) self.reduceVisibility((startVisibility, currentDay)) print("") print('[BACKTESTER]: Running strategy with data from: \n {0} to {1}'.format(startVisibility, currentDay)) assets, allocation, direction, kwdict = strategy(self.universe, kwdict) if inverse: direction *= -1.0 nextRun = min(utility.next_weekday(currentDay + dt.timedelta(days=frequency)), self.dateRange[1]) print('[BACKTESTER]: Checking Portfolio from: \n {0} to {1}'.format(currentDay, nextRun)) print("") pi = Portfolio(assets, allocation, direction, self.universe.riskFree) if prevPi is None: pi.setDateRange(currentDay, nextRun) else: pi.setDateRange(prevPi.pReturn.index.max(), nextRun) pi.factors = self.universe.factors pi.make() pi.summarize() history[currentDay] = {'assets': assets, 'n_assets': len(assets), 'allocation': allocation, 'direction': direction, 'pi': pi} currentDay = nextRun prevPi = pi return history
[ 1, 515, 2011, 25648, 1053, 3371, 25648, 29892, 11278, 13, 5215, 12865, 408, 11636, 13, 3166, 16250, 1053, 8170, 287, 21533, 13, 5215, 19725, 13, 5215, 3509, 13, 5215, 12655, 408, 7442, 13, 13, 1990, 7437, 1688, 261, 29901, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 19859, 9930, 29892, 1369, 29922, 8516, 29892, 1095, 29922, 8516, 1125, 13, 13, 4706, 565, 1369, 338, 6213, 29901, 13, 9651, 1369, 353, 19859, 9930, 29889, 1256, 6069, 29961, 29900, 29962, 13, 4706, 565, 1095, 338, 6213, 29901, 13, 9651, 1095, 353, 19859, 9930, 29889, 1256, 6069, 29961, 29896, 29962, 13, 13, 4706, 1583, 29889, 348, 12193, 353, 19859, 9930, 13, 4706, 396, 1815, 1603, 367, 6213, 29892, 6213, 29892, 607, 674, 367, 7120, 2678, 13, 4706, 1583, 29889, 1256, 6069, 353, 518, 2962, 29892, 1095, 29962, 13, 4706, 565, 1583, 29889, 1256, 6069, 29961, 29900, 29962, 338, 6213, 470, 1583, 29889, 1256, 6069, 29961, 29896, 29962, 338, 6213, 29901, 13, 9651, 1369, 29892, 1095, 353, 11278, 29889, 657, 2290, 25648, 2539, 6069, 29898, 348, 12193, 9930, 29889, 16596, 29897, 13, 9651, 565, 1583, 29889, 1256, 6069, 29961, 29900, 29962, 338, 6213, 29901, 13, 18884, 1583, 29889, 1256, 6069, 29961, 29900, 29962, 353, 1369, 13, 9651, 565, 1583, 29889, 1256, 6069, 29961, 29896, 29962, 338, 6213, 29901, 13, 18884, 1583, 29889, 1256, 6069, 29961, 29896, 29962, 353, 1095, 13, 4706, 1583, 29889, 1256, 6069, 353, 18761, 29898, 8552, 29889, 24535, 8552, 29898, 1311, 29889, 1256, 6069, 876, 13, 13, 1678, 822, 2254, 29898, 1311, 1125, 13, 13, 4706, 1583, 29889, 348, 12193, 29889, 5675, 580, 13, 4706, 1583, 29889, 13492, 29879, 353, 3509, 29889, 24535, 8552, 29898, 1311, 29889, 348, 12193, 29889, 1272, 29897, 13, 13, 1678, 822, 10032, 29898, 1311, 29892, 3515, 1125, 13, 4706, 736, 3515, 29889, 2029, 15625, 2557, 29889, 2248, 6736, 1583, 29889, 28814, 29961, 29900, 2314, 669, 313, 2557, 29889, 2248, 5277, 1583, 29889, 28814, 29961, 29896, 2314, 29962, 13, 13, 1678, 822, 10032, 23318, 29898, 1311, 29892, 2635, 6069, 1125, 13, 13, 4706, 1583, 29889, 28814, 353, 313, 9302, 29889, 12673, 29953, 29946, 29898, 1256, 6069, 29961, 29900, 11724, 7442, 29889, 12673, 29953, 29946, 29898, 1256, 6069, 29961, 29896, 12622, 13, 4706, 363, 1820, 297, 1583, 29889, 348, 12193, 29889, 1272, 29889, 8149, 7295, 13, 9651, 1583, 29889, 348, 12193, 29889, 1272, 29961, 1989, 29962, 353, 1583, 29889, 17469, 29898, 1311, 29889, 13492, 29879, 29961, 1989, 1822, 8552, 3101, 13, 13, 13, 1678, 822, 1250, 1688, 29898, 1311, 29892, 13705, 29892, 10868, 29892, 3841, 18743, 23318, 29922, 29941, 29953, 29900, 29892, 16402, 29922, 8824, 1125, 13, 13, 4706, 9995, 13, 4706, 3767, 8963, 740, 338, 263, 740, 393, 20586, 19859, 9930, 29892, 1369, 322, 1095, 322, 881, 736, 13, 4706, 21608, 29892, 24082, 29892, 5305, 12047, 13, 13, 4706, 10868, 338, 278, 12500, 13, 13, 4706, 3841, 18743, 23318, 338, 278, 1369, 322, 1857, 12742, 278, 1095, 310, 607, 278, 13705, 740, 881, 1074, 13, 4706, 9995, 13, 13, 4706, 4955, 353, 8170, 287, 21533, 580, 13, 4706, 937, 12742, 1469, 353, 1583, 29889, 1256, 6069, 29961, 29900, 29962, 448, 11636, 29889, 9346, 287, 2554, 29898, 16700, 29922, 16700, 18743, 23318, 29897, 13, 4706, 1583, 29889, 348, 12193, 29889, 1256, 6069, 353, 313, 4102, 12742, 1469, 29892, 1583, 29889, 1256, 6069, 29961, 29896, 2314, 13, 4706, 1596, 703, 23456, 19859, 848, 515, 426, 29900, 29913, 304, 426, 29896, 29913, 1213, 29889, 4830, 29898, 1311, 29889, 348, 12193, 29889, 1256, 6069, 29961, 29900, 1402, 1583, 29889, 348, 12193, 29889, 1256, 6069, 29961, 29896, 12622, 13, 4706, 1583, 29889, 1359, 580, 13, 4706, 1596, 703, 5841, 13424, 515, 426, 29900, 29913, 304, 426, 29896, 29913, 1642, 4830, 29898, 1311, 29889, 1256, 6069, 29961, 29900, 1402, 1583, 29889, 1256, 6069, 29961, 29896, 12622, 13, 13, 4706, 12379, 12197, 353, 6213, 13, 4706, 9049, 8977, 353, 6571, 13, 4706, 1857, 12742, 353, 1583, 29889, 1256, 6069, 29961, 29900, 29962, 13, 4706, 1550, 1857, 12742, 529, 1583, 29889, 1256, 6069, 29961, 29896, 5387, 13, 13, 9651, 1369, 23318, 353, 1857, 12742, 448, 11636, 29889, 9346, 287, 2554, 29898, 16700, 29922, 16700, 18743, 23318, 29897, 13, 9651, 1583, 29889, 17469, 23318, 3552, 2962, 23318, 29892, 1857, 12742, 876, 13, 13, 9651, 1596, 703, 1159, 13, 9651, 1596, 877, 29961, 29933, 11375, 18267, 1001, 5387, 19509, 13705, 411, 848, 515, 29901, 320, 29876, 426, 29900, 29913, 304, 426, 29896, 29913, 4286, 4830, 29898, 2962, 23318, 29892, 1857, 12742, 876, 13, 13, 9651, 21608, 29892, 24082, 29892, 5305, 29892, 9049, 8977, 353, 13705, 29898, 1311, 29889, 348, 12193, 29892, 9049, 8977, 29897, 13, 13, 9651, 565, 16402, 29901, 13, 18884, 5305, 334, 29922, 448, 29896, 29889, 29900, 13, 9651, 2446, 6558, 353, 1375, 29898, 329, 1793, 29889, 4622, 29918, 18448, 3250, 29898, 3784, 12742, 718, 11636, 29889, 9346, 287, 2554, 29898, 16700, 29922, 10745, 23860, 8243, 1583, 29889, 1256, 6069, 29961, 29896, 2314, 13, 13, 9651, 1596, 877, 29961, 29933, 11375, 18267, 1001, 5387, 5399, 292, 3371, 25648, 515, 29901, 320, 29876, 426, 29900, 29913, 304, 426, 29896, 29913, 4286, 4830, 29898, 3784, 12742, 29892, 2446, 6558, 876, 13, 9651, 1596, 703, 1159, 13, 13, 9651, 2930, 353, 3371, 25648, 29898, 16596, 29892, 24082, 29892, 5305, 29892, 1583, 29889, 348, 12193, 29889, 3780, 29895, 20475, 29897, 13, 9651, 565, 12379, 12197, 338, 6213, 29901, 13, 18884, 2930, 29889, 842, 2539, 6069, 29898, 3784, 12742, 29892, 2446, 6558, 29897, 13, 9651, 1683, 29901, 13, 18884, 2930, 29889, 842, 2539, 6069, 29898, 16304, 12197, 29889, 29886, 11609, 29889, 2248, 29889, 3317, 3285, 2446, 6558, 29897, 13, 13, 9651, 2930, 29889, 17028, 943, 353, 1583, 29889, 348, 12193, 29889, 17028, 943, 13, 9651, 2930, 29889, 5675, 580, 13, 9651, 2930, 29889, 2083, 3034, 675, 580, 13, 13, 13, 9651, 4955, 29961, 3784, 12742, 29962, 353, 11117, 16596, 2396, 21608, 29892, 13, 462, 462, 259, 525, 29876, 29918, 16596, 2396, 7431, 29898, 16596, 511, 13, 462, 462, 259, 525, 284, 5479, 2396, 24082, 29892, 13, 462, 462, 259, 525, 20845, 2396, 5305, 29892, 13, 462, 462, 259, 525, 1631, 2396, 2930, 29913, 13, 13, 9651, 1857, 12742, 353, 2446, 6558, 13, 9651, 12379, 12197, 353, 2930, 13, 13, 4706, 736, 4955, 13, 2 ]
self driving/controls/kalman/EKF_dynamic.py
Systemx-ai/Pilot-X
1
131569
""" Code for the EKF Refactored """ import sympy from sympy import atan, pi, tan from sympy import symbols, Matrix from math import sqrt, tan, cos, sin, atan2 import matplotlib.pyplot as plt import numpy as np from numpy.random import randn from filterpy.kalman import ExtendedKalmanFilter as EKF from numpy import array, sqrt class RobotEKF(EKF): def __init__(self, dt, wheelbase, std_vel, std_steer): EKF.__init__(self, 3, 2, 2) self.dt = dt self.wheelbase = wheelbase self.std_vel = std_vel self.std_steer = std_steer a, x, y, v, w, theta, time = symbols( 'a, x, y, v, w, theta, t') d = v*time beta = (d/w)*sympy.tan(a) r = w/sympy.tan(a) self.fxu = Matrix( [[x-r*sympy.sin(theta)+r*sympy.sin(theta+beta)], [y+r*sympy.cos(theta)-r*sympy.cos(theta+beta)], [theta+beta]]) self.F_j = self.fxu.jacobian(Matrix([x, y, theta])) self.V_j = self.fxu.jacobian(Matrix([v, a])) # save dictionary and it's variables for later use self.subs = {x: 0, y: 0, v:0, a:0, time:dt, w:wheelbase, theta:0} self.x_x, self.x_y, = x, y self.v, self.a, self.theta = v, a, theta def predict(self, u): self.x = self.move(self.x, u, self.dt) self.subs[self.theta] = self.x[2, 0] self.subs[self.v] = u[0] self.subs[self.a] = u[1] F = array(self.F_j.evalf(subs=self.subs)).astype(float) V = array(self.V_j.evalf(subs=self.subs)).astype(float) # covariance of motion noise in control space M = array([[self.std_vel*u[0]**2, 0], [0, self.std_steer**2]]) self.P = np.dot(F, self.P).dot(F.T) + np.dot(V, M).dot(V.T) def move(self, x, u, dt): hdg = x[2, 0] vel = u[0] steering_angle = u[1] dist = vel * dt if abs(steering_angle) > 0.001: # is robot turning? beta = (dist / self.wheelbase) * tan(steering_angle) r = self.wheelbase / tan(steering_angle) # radius dx = np.array([[-r*sin(hdg) + r*sin(hdg + beta)], [r*cos(hdg) - r*cos(hdg + beta)], [beta]]) else: # moving in straight line dx = np.array([[dist*cos(hdg)], [dist*sin(hdg)], [0]]) return x + dx ##MIT license
[ 1, 9995, 5920, 363, 278, 382, 29968, 29943, 9897, 627, 4395, 9995, 13, 13, 5215, 5016, 2272, 13, 3166, 5016, 2272, 1053, 472, 273, 29892, 2930, 29892, 10345, 13, 3166, 5016, 2272, 1053, 15072, 29892, 22513, 13, 3166, 5844, 1053, 18074, 2273, 29892, 10345, 29892, 6776, 29892, 4457, 29892, 472, 273, 29906, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 5215, 12655, 408, 7442, 13, 3166, 12655, 29889, 8172, 1053, 20088, 29876, 13, 3166, 4175, 2272, 29889, 11311, 1171, 1053, 7338, 2760, 29968, 284, 1171, 5072, 408, 382, 29968, 29943, 13, 3166, 12655, 1053, 1409, 29892, 18074, 2273, 13, 13, 1990, 6417, 327, 29923, 29968, 29943, 29898, 29923, 29968, 29943, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 11636, 29892, 18875, 3188, 29892, 3659, 29918, 955, 29892, 3659, 29918, 1655, 261, 1125, 13, 4706, 382, 29968, 29943, 17255, 2344, 12035, 1311, 29892, 29871, 29941, 29892, 29871, 29906, 29892, 29871, 29906, 29897, 13, 4706, 1583, 29889, 6008, 353, 11636, 13, 4706, 1583, 29889, 29893, 10552, 3188, 353, 18875, 3188, 13, 4706, 1583, 29889, 4172, 29918, 955, 353, 3659, 29918, 955, 13, 4706, 1583, 29889, 4172, 29918, 1655, 261, 353, 3659, 29918, 1655, 261, 13, 13, 4706, 263, 29892, 921, 29892, 343, 29892, 325, 29892, 281, 29892, 278, 941, 29892, 931, 353, 15072, 29898, 13, 9651, 525, 29874, 29892, 921, 29892, 343, 29892, 325, 29892, 281, 29892, 278, 941, 29892, 260, 1495, 13, 4706, 270, 353, 325, 29930, 2230, 13, 4706, 21762, 353, 313, 29881, 29914, 29893, 11877, 11967, 2272, 29889, 13161, 29898, 29874, 29897, 13, 4706, 364, 353, 281, 29914, 11967, 2272, 29889, 13161, 29898, 29874, 29897, 13, 268, 13, 4706, 1583, 29889, 11093, 29884, 353, 22513, 29898, 13, 9651, 5519, 29916, 29899, 29878, 29930, 11967, 2272, 29889, 5223, 29898, 3416, 7240, 29878, 29930, 11967, 2272, 29889, 5223, 29898, 3416, 29974, 3571, 29897, 1402, 13, 632, 518, 29891, 29974, 29878, 29930, 11967, 2272, 29889, 3944, 29898, 3416, 6817, 29878, 29930, 11967, 2272, 29889, 3944, 29898, 3416, 29974, 3571, 29897, 1402, 13, 632, 518, 3416, 29974, 3571, 24960, 13, 13, 4706, 1583, 29889, 29943, 29918, 29926, 353, 1583, 29889, 11093, 29884, 29889, 29926, 562, 711, 713, 29898, 14609, 4197, 29916, 29892, 343, 29892, 278, 941, 12622, 13, 4706, 1583, 29889, 29963, 29918, 29926, 353, 1583, 29889, 11093, 29884, 29889, 29926, 562, 711, 713, 29898, 14609, 4197, 29894, 29892, 263, 12622, 13, 13, 4706, 396, 4078, 8600, 322, 372, 29915, 29879, 3651, 363, 2678, 671, 13, 4706, 1583, 29889, 1491, 29879, 353, 426, 29916, 29901, 29871, 29900, 29892, 343, 29901, 29871, 29900, 29892, 325, 29901, 29900, 29892, 263, 29901, 29900, 29892, 29871, 13, 462, 268, 931, 29901, 6008, 29892, 281, 29901, 29893, 10552, 3188, 29892, 278, 941, 29901, 29900, 29913, 13, 4706, 1583, 29889, 29916, 29918, 29916, 29892, 1583, 29889, 29916, 29918, 29891, 29892, 353, 921, 29892, 343, 29871, 13, 4706, 1583, 29889, 29894, 29892, 1583, 29889, 29874, 29892, 1583, 29889, 3416, 353, 325, 29892, 263, 29892, 278, 941, 13, 13, 1678, 822, 8500, 29898, 1311, 29892, 318, 1125, 13, 4706, 1583, 29889, 29916, 353, 1583, 29889, 11631, 29898, 1311, 29889, 29916, 29892, 318, 29892, 1583, 29889, 6008, 29897, 13, 13, 4706, 1583, 29889, 1491, 29879, 29961, 1311, 29889, 3416, 29962, 353, 1583, 29889, 29916, 29961, 29906, 29892, 29871, 29900, 29962, 13, 4706, 1583, 29889, 1491, 29879, 29961, 1311, 29889, 29894, 29962, 353, 318, 29961, 29900, 29962, 13, 4706, 1583, 29889, 1491, 29879, 29961, 1311, 29889, 29874, 29962, 353, 318, 29961, 29896, 29962, 13, 13, 4706, 383, 353, 1409, 29898, 1311, 29889, 29943, 29918, 29926, 29889, 14513, 29888, 29898, 1491, 29879, 29922, 1311, 29889, 1491, 29879, 8106, 579, 668, 29898, 7411, 29897, 13, 4706, 478, 353, 1409, 29898, 1311, 29889, 29963, 29918, 29926, 29889, 14513, 29888, 29898, 1491, 29879, 29922, 1311, 29889, 1491, 29879, 8106, 579, 668, 29898, 7411, 29897, 13, 13, 4706, 396, 18838, 279, 8837, 310, 10884, 11462, 297, 2761, 2913, 13, 4706, 341, 353, 1409, 4197, 29961, 1311, 29889, 4172, 29918, 955, 29930, 29884, 29961, 29900, 29962, 1068, 29906, 29892, 29871, 29900, 1402, 29871, 13, 462, 259, 518, 29900, 29892, 1583, 29889, 4172, 29918, 1655, 261, 1068, 29906, 24960, 13, 13, 4706, 1583, 29889, 29925, 353, 7442, 29889, 6333, 29898, 29943, 29892, 1583, 29889, 29925, 467, 6333, 29898, 29943, 29889, 29911, 29897, 718, 7442, 29889, 6333, 29898, 29963, 29892, 341, 467, 6333, 29898, 29963, 29889, 29911, 29897, 13, 13, 1678, 822, 4337, 29898, 1311, 29892, 921, 29892, 318, 29892, 11636, 1125, 13, 4706, 298, 20726, 353, 921, 29961, 29906, 29892, 29871, 29900, 29962, 13, 4706, 5343, 353, 318, 29961, 29900, 29962, 13, 4706, 1886, 3241, 29918, 2521, 353, 318, 29961, 29896, 29962, 13, 4706, 1320, 353, 5343, 334, 11636, 13, 13, 4706, 565, 6425, 29898, 1655, 3241, 29918, 2521, 29897, 1405, 29871, 29900, 29889, 29900, 29900, 29896, 29901, 396, 338, 19964, 14712, 29973, 13, 9651, 21762, 353, 313, 5721, 847, 1583, 29889, 29893, 10552, 3188, 29897, 334, 10345, 29898, 1655, 3241, 29918, 2521, 29897, 13, 9651, 364, 353, 1583, 29889, 29893, 10552, 3188, 847, 10345, 29898, 1655, 3241, 29918, 2521, 29897, 396, 11855, 13, 13, 9651, 15414, 353, 7442, 29889, 2378, 4197, 14352, 29878, 29930, 5223, 29898, 16440, 29887, 29897, 718, 364, 29930, 5223, 29898, 16440, 29887, 718, 21762, 29897, 1402, 29871, 13, 462, 965, 518, 29878, 29930, 3944, 29898, 16440, 29887, 29897, 448, 364, 29930, 3944, 29898, 16440, 29887, 718, 21762, 29897, 1402, 29871, 13, 462, 965, 518, 3571, 24960, 13, 4706, 1683, 29901, 396, 8401, 297, 7812, 1196, 13, 9651, 15414, 353, 7442, 29889, 2378, 4197, 29961, 5721, 29930, 3944, 29898, 16440, 29887, 29897, 1402, 29871, 13, 462, 965, 518, 5721, 29930, 5223, 29898, 16440, 29887, 29897, 1402, 29871, 13, 462, 965, 518, 29900, 24960, 13, 4706, 736, 921, 718, 15414, 13, 1678, 13, 13, 259, 444, 26349, 19405, 2 ]
examples/intro-example/dags/billomat-test.py
lukasdraheim/airflow-tutorial
0
142050
from datetime import timedelta import airflow from airflow.models import DAG from airflow.operators.python_operator import PythonOperator, BranchPythonOperator from airflow.operators.bash_operator import BashOperator import random import requests default_args = { 'owner': 'airflow', 'depends_on_past': False, 'start_date': airflow.utils.dates.days_ago(2), 'email': ['<EMAIL>'], 'email_on_failure': False, 'email_on_retry': False, 'retries': 1, 'retry_delay': timedelta(minutes=5), # 'queue': 'bash_queue', # 'pool': 'backfill', # 'priority_weight': 10, # 'end_date': datetime(2016, 1, 1), # 'wait_for_downstream': False, # 'dag': dag, # 'adhoc':False, # 'sla': timedelta(hours=2), # 'execution_timeout': timedelta(seconds=300), # 'on_failure_callback': some_function, # 'on_success_callback': some_other_function, # 'on_retry_callback': another_function, # 'trigger_rule': u'all_success' } dag = DAG('billomat', default_args=default_args, schedule_interval=None) def billomat_run(): url = 'https://helpcheck.billomat.net/api/invoices?api_key=1c06f5590c6c626b45a26ce30ebff7cd&format=json' r = requests.get(url) if r.status_code == 200: print('Success!') elif r.status_code == 404: print('Not Found.') else : print('No Success') def billomat_print(): print(r) with dag: run_billomat_run = PythonOperator( task_id='extract_json_from_billomat', python_callable=billomat_run # provide_context=True, # retries=10, # retry_delay=timedelta(seconds=10) ) run_billomat_print = PythonOperator( task_id='transform_json', python_callable=billomat_print ) run_billomat_run >> run_billomat_print
[ 1, 515, 12865, 1053, 5335, 287, 2554, 13, 13, 5215, 4799, 1731, 13, 3166, 4799, 1731, 29889, 9794, 1053, 360, 10051, 13, 3166, 4799, 1731, 29889, 3372, 4097, 29889, 4691, 29918, 6891, 1053, 5132, 26486, 29892, 25889, 11980, 26486, 13, 3166, 4799, 1731, 29889, 3372, 4097, 29889, 13067, 29918, 6891, 1053, 29677, 26486, 13, 5215, 4036, 13, 5215, 7274, 13, 13, 4381, 29918, 5085, 353, 426, 13, 1678, 525, 20348, 2396, 525, 1466, 1731, 742, 13, 1678, 525, 2716, 1975, 29918, 265, 29918, 29886, 579, 2396, 7700, 29892, 13, 1678, 525, 2962, 29918, 1256, 2396, 4799, 1731, 29889, 13239, 29889, 15190, 29889, 16700, 29918, 4425, 29898, 29906, 511, 13, 1678, 525, 5269, 2396, 6024, 29966, 26862, 6227, 29958, 7464, 13, 1678, 525, 5269, 29918, 265, 29918, 14057, 545, 2396, 7700, 29892, 13, 1678, 525, 5269, 29918, 265, 29918, 276, 2202, 2396, 7700, 29892, 13, 1678, 525, 2267, 2722, 2396, 29871, 29896, 29892, 13, 1678, 525, 276, 2202, 29918, 18829, 2396, 5335, 287, 2554, 29898, 1195, 2667, 29922, 29945, 511, 13, 1678, 396, 525, 9990, 2396, 525, 13067, 29918, 9990, 742, 13, 1678, 396, 525, 10109, 2396, 525, 1627, 5589, 742, 13, 1678, 396, 525, 29886, 21766, 29918, 7915, 2396, 29871, 29896, 29900, 29892, 13, 1678, 396, 525, 355, 29918, 1256, 2396, 12865, 29898, 29906, 29900, 29896, 29953, 29892, 29871, 29896, 29892, 29871, 29896, 511, 13, 1678, 396, 525, 10685, 29918, 1454, 29918, 3204, 5461, 2396, 7700, 29892, 13, 1678, 396, 525, 24157, 2396, 12136, 29892, 13, 1678, 396, 525, 328, 29882, 542, 2396, 8824, 29892, 13, 1678, 396, 525, 29879, 433, 2396, 5335, 287, 2554, 29898, 29882, 2470, 29922, 29906, 511, 13, 1678, 396, 525, 22256, 29918, 15619, 2396, 5335, 287, 2554, 29898, 23128, 29922, 29941, 29900, 29900, 511, 13, 1678, 396, 525, 265, 29918, 14057, 545, 29918, 14035, 2396, 777, 29918, 2220, 29892, 13, 1678, 396, 525, 265, 29918, 8698, 29918, 14035, 2396, 777, 29918, 1228, 29918, 2220, 29892, 13, 1678, 396, 525, 265, 29918, 276, 2202, 29918, 14035, 2396, 1790, 29918, 2220, 29892, 13, 1678, 396, 525, 21001, 29918, 7491, 2396, 318, 29915, 497, 29918, 8698, 29915, 13, 29913, 13, 13, 24157, 353, 360, 10051, 877, 29890, 453, 290, 271, 742, 2322, 29918, 5085, 29922, 4381, 29918, 5085, 29892, 20410, 29918, 19207, 29922, 8516, 29897, 13, 13, 1753, 11118, 290, 271, 29918, 3389, 7295, 13, 1678, 3142, 353, 525, 991, 597, 8477, 3198, 29889, 29890, 453, 290, 271, 29889, 1212, 29914, 2754, 29914, 262, 1365, 1575, 29973, 2754, 29918, 1989, 29922, 29896, 29883, 29900, 29953, 29888, 29945, 29945, 29929, 29900, 29883, 29953, 29883, 29953, 29906, 29953, 29890, 29946, 29945, 29874, 29906, 29953, 346, 29941, 29900, 774, 600, 29955, 2252, 29987, 4830, 29922, 3126, 29915, 13, 1678, 364, 353, 7274, 29889, 657, 29898, 2271, 29897, 13, 1678, 565, 364, 29889, 4882, 29918, 401, 1275, 29871, 29906, 29900, 29900, 29901, 13, 4706, 1596, 877, 14191, 29991, 1495, 13, 1678, 25342, 364, 29889, 4882, 29918, 401, 1275, 29871, 29946, 29900, 29946, 29901, 13, 4706, 1596, 877, 3664, 7460, 29889, 1495, 13, 1678, 1683, 584, 13, 4706, 1596, 877, 3782, 21397, 1495, 13, 13, 1753, 11118, 290, 271, 29918, 2158, 7295, 13, 1678, 1596, 29898, 29878, 29897, 13, 13, 2541, 12136, 29901, 13, 1678, 1065, 29918, 29890, 453, 290, 271, 29918, 3389, 353, 5132, 26486, 29898, 13, 4706, 3414, 29918, 333, 2433, 21111, 29918, 3126, 29918, 3166, 29918, 29890, 453, 290, 271, 742, 13, 4706, 3017, 29918, 4804, 519, 29922, 29890, 453, 290, 271, 29918, 3389, 13, 29937, 539, 3867, 29918, 4703, 29922, 5574, 29892, 13, 29937, 539, 3240, 2722, 29922, 29896, 29900, 29892, 13, 29937, 539, 337, 2202, 29918, 18829, 29922, 9346, 287, 2554, 29898, 23128, 29922, 29896, 29900, 29897, 13, 1678, 1723, 13, 13, 1678, 1065, 29918, 29890, 453, 290, 271, 29918, 2158, 353, 5132, 26486, 29898, 13, 4706, 3414, 29918, 333, 2433, 9067, 29918, 3126, 742, 13, 4706, 3017, 29918, 4804, 519, 29922, 29890, 453, 290, 271, 29918, 2158, 13, 4706, 1723, 13, 13, 1678, 1065, 29918, 29890, 453, 290, 271, 29918, 3389, 5099, 1065, 29918, 29890, 453, 290, 271, 29918, 2158, 13, 2 ]
analysis/copy_cluster_mat.py
JaerongA/lman-deafening
0
138646
<gh_stars>0 """ This program copy/pastes SpkInfo.mat from each cell root to the destination folder (InformationAnalysis) """ import os from summary import load project_path = load.project(load.config()) # load cluster summary file summary_df, nb_cluster = load.summary(load.config()) # load cluster summary file # Make a folder to save files # # save_path = 'InformationAnalysis' # # save.make_save_dir(save_path) save_path = os.path.join(project_path, r'Analysis\InformationAnalysis') # the data folder where SAP feature values are stored if not os.path.exists(save_path): os.mkdir(save_path) def copy_cluster_mat(summary_df): import shutil for cluster_run in range(0, nb_cluster): cluster = load.cluster(summary_df, cluster_run) if int(cluster.AnalysisOK): # print(cluster) session_id, cell_id, session_path, cell_path = load.cluster_info(cluster) # print('Accessing... ' + cell_root) os.chdir(cell_path) mat_file = [file for file in os.listdir(cell_path) if file.endswith('SpkInfo.mat')][0] # print(mat_file) # Make a new folder for individual neurons new_save_path = os.path.join(save_path, cell_id) print(new_save_path) if not os.path.exists(new_save_path): os.mkdir(new_save_path) shutil.copy(mat_file, new_save_path) if __name__ == '__main__': copy_cluster_mat(summary_df)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 15945, 29908, 13, 4013, 1824, 3509, 29914, 29886, 579, 267, 1706, 29895, 3401, 29889, 2922, 515, 1269, 3038, 3876, 304, 278, 12551, 4138, 313, 20350, 21067, 4848, 29897, 13, 15945, 29908, 13, 13, 5215, 2897, 13, 3166, 15837, 1053, 2254, 13, 13, 4836, 29918, 2084, 353, 2254, 29889, 4836, 29898, 1359, 29889, 2917, 3101, 29871, 396, 2254, 9867, 15837, 934, 13, 7727, 29918, 2176, 29892, 302, 29890, 29918, 19594, 353, 2254, 29889, 7727, 29898, 1359, 29889, 2917, 3101, 29871, 396, 2254, 9867, 15837, 934, 13, 13, 29937, 8561, 263, 4138, 304, 4078, 2066, 13, 29937, 396, 4078, 29918, 2084, 353, 525, 20350, 21067, 4848, 29915, 13, 29937, 396, 4078, 29889, 5675, 29918, 7620, 29918, 3972, 29898, 7620, 29918, 2084, 29897, 13, 13, 13, 7620, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 4836, 29918, 2084, 29892, 13, 462, 308, 364, 29915, 21067, 4848, 29905, 20350, 21067, 4848, 1495, 29871, 396, 278, 848, 4138, 988, 317, 3301, 4682, 1819, 526, 6087, 13, 361, 451, 2897, 29889, 2084, 29889, 9933, 29898, 7620, 29918, 2084, 1125, 13, 1678, 2897, 29889, 11256, 3972, 29898, 7620, 29918, 2084, 29897, 13, 13, 13, 1753, 3509, 29918, 19594, 29918, 2922, 29898, 7727, 29918, 2176, 1125, 13, 1678, 1053, 528, 4422, 13, 13, 1678, 363, 9867, 29918, 3389, 297, 3464, 29898, 29900, 29892, 302, 29890, 29918, 19594, 1125, 13, 4706, 9867, 353, 2254, 29889, 19594, 29898, 7727, 29918, 2176, 29892, 9867, 29918, 3389, 29897, 13, 13, 4706, 565, 938, 29898, 19594, 29889, 21067, 4848, 8949, 1125, 13, 9651, 396, 1596, 29898, 19594, 29897, 13, 9651, 4867, 29918, 333, 29892, 3038, 29918, 333, 29892, 4867, 29918, 2084, 29892, 3038, 29918, 2084, 353, 2254, 29889, 19594, 29918, 3888, 29898, 19594, 29897, 13, 9651, 396, 1596, 877, 6638, 292, 856, 525, 718, 3038, 29918, 4632, 29897, 13, 9651, 2897, 29889, 305, 3972, 29898, 3729, 29918, 2084, 29897, 13, 13, 9651, 1775, 29918, 1445, 353, 518, 1445, 363, 934, 297, 2897, 29889, 1761, 3972, 29898, 3729, 29918, 2084, 29897, 565, 934, 29889, 1975, 2541, 877, 5592, 29895, 3401, 29889, 2922, 1495, 3816, 29900, 29962, 13, 9651, 396, 1596, 29898, 2922, 29918, 1445, 29897, 13, 13, 9651, 396, 8561, 263, 716, 4138, 363, 5375, 26808, 787, 13, 9651, 716, 29918, 7620, 29918, 2084, 353, 2897, 29889, 2084, 29889, 7122, 29898, 7620, 29918, 2084, 29892, 3038, 29918, 333, 29897, 13, 9651, 1596, 29898, 1482, 29918, 7620, 29918, 2084, 29897, 13, 9651, 565, 451, 2897, 29889, 2084, 29889, 9933, 29898, 1482, 29918, 7620, 29918, 2084, 1125, 13, 18884, 2897, 29889, 11256, 3972, 29898, 1482, 29918, 7620, 29918, 2084, 29897, 13, 9651, 528, 4422, 29889, 8552, 29898, 2922, 29918, 1445, 29892, 716, 29918, 7620, 29918, 2084, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 3509, 29918, 19594, 29918, 2922, 29898, 7727, 29918, 2176, 29897, 13, 2 ]
zSPA/zSPA/spa/views.py
hawwestin/MSR.DjangoByExample
1
79578
from django.shortcuts import render from decouple import config from .models import Images # Create your views here. def index(request, **kwargs): """ Render single page application and provide context data. :param request: :param kwargs: :return: """ context = { 'images': Images.objects.filter(is_active=True), 'googleForm': config('googleForm', default=''), 'googleMaps': config('googleMaps', default=''), } return render(request, 'spa/main_SPA.html', context)
[ 1, 515, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 1602, 283, 552, 1053, 2295, 13, 13, 3166, 869, 9794, 1053, 1954, 1179, 13, 13, 13, 29937, 6204, 596, 8386, 1244, 29889, 13, 13, 1753, 2380, 29898, 3827, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 26000, 2323, 1813, 2280, 322, 3867, 3030, 848, 29889, 13, 1678, 584, 3207, 2009, 29901, 13, 1678, 584, 3207, 9049, 5085, 29901, 13, 1678, 584, 2457, 29901, 13, 1678, 9995, 13, 1678, 3030, 353, 426, 13, 4706, 525, 8346, 2396, 1954, 1179, 29889, 12650, 29889, 4572, 29898, 275, 29918, 4925, 29922, 5574, 511, 13, 4706, 525, 3608, 2500, 2396, 2295, 877, 3608, 2500, 742, 2322, 2433, 5477, 13, 4706, 525, 3608, 29924, 2547, 2396, 2295, 877, 3608, 29924, 2547, 742, 2322, 2433, 5477, 13, 1678, 500, 13, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 1028, 29874, 29914, 3396, 29918, 5550, 29909, 29889, 1420, 742, 3030, 29897, 13, 2 ]
avkapi/vk.py
JMarkin/aVKapi
7
77978
import asyncio import logging from aiohttp import ClientSession from .methods import Messages from .utils import json logger = logging.getLogger(__name__) API_URL = 'https://api.vk.com/method/' class VK: def __init__(self, confirmation_code=None, secret_key=None, access_token=None, loop=None): """ :type confirmation_code: str """ self.confirmation_code = confirmation_code self.secret_key = secret_key self.access_token = access_token self.api_version = '5.80' # asyncio loop instance if loop is None: loop = asyncio.get_event_loop() self.loop = loop self._session = ClientSession(loop=self.loop, json_serialize=json.dumps) self.messages = Messages(access_token=access_token, session=self._session, api_version=self.api_version) async def get_session(self): if not self._session: self._session = ClientSession() async def api_request(self, method_name, parameters): link = f'{API_URL}{method_name}?{parameters}' params = { 'access_token': self.access_token, 'v': self.api_version } params.update(**parameters) async with self._session.post(link) as resp: status = resp.status text = await resp.text() logger.info(f'Response: {status}, {text}') async def close(self): if isinstance(self._session, ClientSession) and not self._session.closed: await self._session.close()
[ 1, 1053, 408, 948, 3934, 13, 5215, 12183, 13, 13, 3166, 263, 601, 1124, 1053, 12477, 7317, 13, 13, 3166, 869, 23515, 1053, 11946, 1179, 13, 3166, 869, 13239, 1053, 4390, 13, 13, 21707, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 13, 8787, 29918, 4219, 353, 525, 991, 597, 2754, 29889, 29894, 29895, 29889, 510, 29914, 5696, 22208, 13, 13, 13, 1990, 478, 29968, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 9659, 362, 29918, 401, 29922, 8516, 29892, 7035, 29918, 1989, 29922, 8516, 29892, 2130, 29918, 6979, 29922, 8516, 29892, 2425, 29922, 8516, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 9659, 362, 29918, 401, 29901, 851, 13, 4706, 9995, 13, 4706, 1583, 29889, 26897, 362, 29918, 401, 353, 9659, 362, 29918, 401, 13, 4706, 1583, 29889, 19024, 29918, 1989, 353, 7035, 29918, 1989, 13, 4706, 1583, 29889, 5943, 29918, 6979, 353, 2130, 29918, 6979, 13, 4706, 1583, 29889, 2754, 29918, 3259, 353, 525, 29945, 29889, 29947, 29900, 29915, 13, 13, 4706, 396, 408, 948, 3934, 2425, 2777, 13, 4706, 565, 2425, 338, 6213, 29901, 13, 9651, 2425, 353, 408, 948, 3934, 29889, 657, 29918, 3696, 29918, 7888, 580, 13, 4706, 1583, 29889, 7888, 353, 2425, 13, 13, 4706, 1583, 3032, 7924, 353, 12477, 7317, 29898, 7888, 29922, 1311, 29889, 7888, 29892, 4390, 29918, 643, 6646, 29922, 3126, 29889, 29881, 17204, 29897, 13, 4706, 1583, 29889, 19158, 353, 11946, 1179, 29898, 5943, 29918, 6979, 29922, 5943, 29918, 6979, 29892, 4867, 29922, 1311, 3032, 7924, 29892, 7882, 29918, 3259, 29922, 1311, 29889, 2754, 29918, 3259, 29897, 13, 13, 1678, 7465, 822, 679, 29918, 7924, 29898, 1311, 1125, 13, 4706, 565, 451, 1583, 3032, 7924, 29901, 13, 9651, 1583, 3032, 7924, 353, 12477, 7317, 580, 13, 13, 1678, 7465, 822, 7882, 29918, 3827, 29898, 1311, 29892, 1158, 29918, 978, 29892, 4128, 1125, 13, 4706, 1544, 353, 285, 29915, 29912, 8787, 29918, 4219, 1157, 5696, 29918, 978, 29913, 29973, 29912, 16744, 10162, 13, 4706, 8636, 353, 426, 13, 9651, 525, 5943, 29918, 6979, 2396, 1583, 29889, 5943, 29918, 6979, 29892, 13, 9651, 525, 29894, 2396, 1583, 29889, 2754, 29918, 3259, 13, 4706, 500, 13, 4706, 8636, 29889, 5504, 29898, 1068, 16744, 29897, 13, 4706, 7465, 411, 1583, 3032, 7924, 29889, 2490, 29898, 2324, 29897, 408, 4613, 29901, 13, 9651, 4660, 353, 4613, 29889, 4882, 13, 9651, 1426, 353, 7272, 4613, 29889, 726, 580, 13, 9651, 17927, 29889, 3888, 29898, 29888, 29915, 5103, 29901, 426, 4882, 1118, 426, 726, 29913, 1495, 13, 13, 1678, 7465, 822, 3802, 29898, 1311, 1125, 13, 4706, 565, 338, 8758, 29898, 1311, 3032, 7924, 29892, 12477, 7317, 29897, 322, 451, 1583, 3032, 7924, 29889, 15603, 29901, 13, 9651, 7272, 1583, 3032, 7924, 29889, 5358, 580, 13, 2 ]
src/beefore/diff.py
pybee/beefore
24
80134
<reponame>pybee/beefore import os import re FILE_START = re.compile(r"diff --git a/(.*) b/(.*)") LINE_RANGE = re.compile(r"@@ -(\d+),(\d+) \+(\d+),(\d+) @@") def positions(directory, diff_content): """Given a diff payload, look for all the line ranges described for a given file. Returns a map of source file lines, mapped to the position in the diff that the line is referenced. """ directory = os.path.abspath(directory) mappings = {} current_file = None file_start = None block_start = None block_offset = None for i, d in enumerate(diff_content): match = FILE_START.match(d) if match: current_file = {} filename = os.path.abspath(match.group(2))[len(directory)+1:] mappings[filename] = current_file # Start of a new file; so reset the file andd block offsets. file_start = None block_start = None block_offset = None elif current_file is not None: match = LINE_RANGE.match(d) if match: # Found the start of a new range in the file first_line = int(match.group(3)) # If this is the first line range for a file, # then the line counter is also the starting index # for diff offsets. if file_start is None: file_start = i block_start = i + 1 block_offset = 1 if match.group(1) == '0' else 0 elif block_start and len(d) > 0: if d[0] == '-': block_offset += 1 else: current_file[i - block_start - block_offset + first_line] = i - file_start return mappings
[ 1, 529, 276, 1112, 420, 29958, 2272, 915, 29872, 29914, 915, 29872, 1079, 13, 5215, 2897, 13, 5215, 337, 13, 13, 7724, 29918, 25826, 353, 337, 29889, 12198, 29898, 29878, 29908, 12765, 1192, 5559, 263, 14571, 5575, 29897, 289, 14571, 5575, 25760, 13, 18521, 29918, 29934, 24336, 353, 337, 29889, 12198, 29898, 29878, 29908, 25380, 448, 1194, 29881, 29974, 511, 1194, 29881, 28135, 320, 29974, 1194, 29881, 29974, 511, 1194, 29881, 28135, 732, 29992, 1159, 13, 13, 13, 1753, 11909, 29898, 12322, 29892, 2923, 29918, 3051, 1125, 13, 1678, 9995, 29954, 5428, 263, 2923, 20092, 29892, 1106, 363, 599, 278, 1196, 20238, 5439, 363, 263, 2183, 934, 29889, 13, 13, 1678, 16969, 263, 2910, 310, 2752, 934, 3454, 29892, 20545, 304, 278, 2602, 297, 278, 2923, 13, 1678, 393, 278, 1196, 338, 16180, 29889, 13, 1678, 9995, 13, 1678, 3884, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 12322, 29897, 13, 1678, 611, 27775, 353, 6571, 13, 1678, 1857, 29918, 1445, 353, 6213, 13, 1678, 934, 29918, 2962, 353, 6213, 13, 1678, 2908, 29918, 2962, 353, 6213, 13, 1678, 2908, 29918, 10289, 353, 6213, 13, 1678, 363, 474, 29892, 270, 297, 26985, 29898, 12765, 29918, 3051, 1125, 13, 4706, 1993, 353, 24080, 29918, 25826, 29889, 4352, 29898, 29881, 29897, 13, 4706, 565, 1993, 29901, 13, 9651, 1857, 29918, 1445, 353, 6571, 13, 9651, 10422, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 4352, 29889, 2972, 29898, 29906, 876, 29961, 2435, 29898, 12322, 7240, 29896, 17531, 13, 9651, 611, 27775, 29961, 9507, 29962, 353, 1857, 29918, 1445, 13, 13, 9651, 396, 7370, 310, 263, 716, 934, 29936, 577, 10092, 278, 934, 322, 29881, 2908, 1283, 7224, 29889, 13, 9651, 934, 29918, 2962, 353, 6213, 13, 9651, 2908, 29918, 2962, 353, 6213, 13, 9651, 2908, 29918, 10289, 353, 6213, 13, 4706, 25342, 1857, 29918, 1445, 338, 451, 6213, 29901, 13, 9651, 1993, 353, 365, 8895, 29918, 29934, 24336, 29889, 4352, 29898, 29881, 29897, 13, 9651, 565, 1993, 29901, 13, 18884, 396, 7460, 278, 1369, 310, 263, 716, 3464, 297, 278, 934, 13, 18884, 937, 29918, 1220, 353, 938, 29898, 4352, 29889, 2972, 29898, 29941, 876, 13, 13, 18884, 396, 960, 445, 338, 278, 937, 1196, 3464, 363, 263, 934, 29892, 13, 18884, 396, 769, 278, 1196, 6795, 338, 884, 278, 6257, 2380, 13, 18884, 396, 363, 2923, 1283, 7224, 29889, 13, 18884, 565, 934, 29918, 2962, 338, 6213, 29901, 13, 462, 1678, 934, 29918, 2962, 353, 474, 13, 13, 18884, 2908, 29918, 2962, 353, 474, 718, 29871, 29896, 13, 18884, 2908, 29918, 10289, 353, 29871, 29896, 565, 1993, 29889, 2972, 29898, 29896, 29897, 1275, 525, 29900, 29915, 1683, 29871, 29900, 13, 9651, 25342, 2908, 29918, 2962, 322, 7431, 29898, 29881, 29897, 1405, 29871, 29900, 29901, 13, 18884, 565, 270, 29961, 29900, 29962, 1275, 17411, 2396, 13, 462, 1678, 2908, 29918, 10289, 4619, 29871, 29896, 13, 18884, 1683, 29901, 13, 462, 1678, 1857, 29918, 1445, 29961, 29875, 448, 2908, 29918, 2962, 448, 2908, 29918, 10289, 718, 937, 29918, 1220, 29962, 353, 474, 448, 934, 29918, 2962, 13, 13, 1678, 736, 611, 27775, 13, 2 ]
main.py
laMia482/tensorflow-example
0
178151
<reponame>laMia482/tensorflow-example<filename>main.py from config import cfg import kernel import tensorflow as tf def main(_): if cfg.is_train is True: kernel.train() if cfg.is_eval is True: kernel.eval() if __name__ == '__main__': tf.app.run()
[ 1, 529, 276, 1112, 420, 29958, 433, 29924, 423, 29946, 29947, 29906, 29914, 29056, 29899, 4773, 29966, 9507, 29958, 3396, 29889, 2272, 13, 3166, 2295, 1053, 274, 16434, 13, 5215, 8466, 13, 5215, 26110, 408, 15886, 13, 13, 1753, 1667, 7373, 1125, 13, 29871, 565, 274, 16434, 29889, 275, 29918, 14968, 338, 5852, 29901, 13, 1678, 8466, 29889, 14968, 580, 13, 29871, 565, 274, 16434, 29889, 275, 29918, 14513, 338, 5852, 29901, 13, 1678, 8466, 29889, 14513, 580, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 15886, 29889, 932, 29889, 3389, 580, 13, 2 ]
src_py/hat/syslog/server/ui.py
hat-open/hat-syslog
1
142420
"""Web server implementation""" from pathlib import Path import functools import logging import typing import urllib from hat import aio from hat import juggler from hat.syslog.server import common import hat.syslog.server.backend mlog: logging.Logger = logging.getLogger(__name__) """Module logger""" package_path: Path = Path(__file__).parent """Python package path""" ui_path: Path = package_path / 'ui' """UI directory path""" max_results_limit: int = 200 """Max results limit""" autoflush_delay: float = 0.2 """Juggler autoflush delay""" async def create_web_server(addr: str, pem: typing.Optional[Path], backend: hat.syslog.server.backend.Backend ) -> 'WebServer': """Create web server""" addr = urllib.parse.urlparse(addr) host = addr.hostname port = addr.port server = WebServer() server._backend = backend server._srv = await juggler.listen(host, port, server._on_connection, static_dir=ui_path, pem_file=pem, autoflush_delay=autoflush_delay) return server class WebServer(aio.Resource): @property def async_group(self) -> aio.Group: """Async group""" return self._srv.async_group def _on_connection(self, conn): self.async_group.spawn(self._connection_loop, conn) async def _connection_loop(self, conn): change_queue = aio.Queue() conn.async_group.spawn(_change_loop, self._backend, conn, change_queue) try: with self._backend.register_change_cb(change_queue.put_nowait): with conn.register_change_cb( functools.partial(change_queue.put_nowait, [])): await conn.wait_closing() finally: conn.close() async def _change_loop(backend, conn, change_queue): try: filter_json = _sanitize_filter(conn.remote_data) first_id = backend.first_id last_id = backend.last_id filter_changed = True new_entries_json = [] while True: if filter_changed: filter = common.filter_from_json(filter_json) while not change_queue.empty(): change_queue.get_nowait() entries = await backend.query(filter) entries_json = [common.entry_to_json(entry) for entry in entries] elif new_entries_json: previous_id = entries_json[0]['id'] if entries_json else 0 entries_json = [*_filter_entries(filter_json, previous_id, new_entries_json), *entries_json] entries_json = entries_json[:filter.max_results] conn.set_local_data({'filter': filter_json, 'entries': entries_json, 'first_id': first_id, 'last_id': last_id}) new_entries = await change_queue.get() new_entries_json = [common.entry_to_json(entry) for entry in new_entries] first_id = backend.first_id last_id = backend.last_id new_filter_json = _sanitize_filter(conn.remote_data) filter_changed = new_filter_json != filter_json filter_json = new_filter_json finally: conn.close() def _sanitize_filter(filter_json): if not filter_json: filter_json = common.filter_to_json( common.Filter(max_results=max_results_limit)) if (filter_json['max_results'] is None or filter_json['max_results'] > max_results_limit): filter_json = dict(filter_json, max_results=max_results_limit) return filter_json def _filter_entries(filter_json, previous_id, entries_json): for i in entries_json: if i['id'] <= previous_id: continue if (filter_json['last_id'] is not None and i['id'] > filter_json['last_id']): continue if (filter_json['entry_timestamp_from'] is not None and i['timestamp'] < filter_json['entry_timestamp_from']): continue if (filter_json['entry_timestamp_to'] is not None and i['timestamp'] > filter_json['entry_timestamp_to']): continue if (filter_json['facility'] is not None and i['msg']['facility'] != filter_json['facility']): continue if (filter_json['severity'] is not None and i['msg']['severity'] != filter_json['severity']): continue if not _match_str_filter(filter_json['hostname'], i['msg']['hostname']): continue if not _match_str_filter(filter_json['app_name'], i['msg']['app_name']): continue if not _match_str_filter(filter_json['procid'], i['msg']['procid']): continue if not _match_str_filter(filter_json['msgid'], i['msg']['msgid']): continue if not _match_str_filter(filter_json['msg'], i['msg']['msg']): continue yield i def _match_str_filter(filter, value): return not filter or filter in value
[ 1, 9995, 3609, 1923, 5314, 15945, 29908, 13, 13, 3166, 2224, 1982, 1053, 10802, 13, 5215, 2090, 312, 8789, 13, 5215, 12183, 13, 5215, 19229, 13, 5215, 3142, 1982, 13, 13, 3166, 3056, 1053, 263, 601, 13, 3166, 3056, 1053, 8740, 29887, 1358, 13, 13, 3166, 3056, 29889, 9675, 1188, 29889, 2974, 1053, 3619, 13, 5215, 3056, 29889, 9675, 1188, 29889, 2974, 29889, 27852, 13, 13, 13, 29885, 1188, 29901, 12183, 29889, 16363, 353, 12183, 29889, 657, 16363, 22168, 978, 1649, 29897, 13, 15945, 29908, 7355, 17927, 15945, 29908, 13, 13, 5113, 29918, 2084, 29901, 10802, 353, 10802, 22168, 1445, 1649, 467, 3560, 13, 15945, 29908, 11980, 3577, 2224, 15945, 29908, 13, 13, 1481, 29918, 2084, 29901, 10802, 353, 3577, 29918, 2084, 847, 525, 1481, 29915, 13, 15945, 29908, 3120, 3884, 2224, 15945, 29908, 13, 13, 3317, 29918, 9902, 29918, 13400, 29901, 938, 353, 29871, 29906, 29900, 29900, 13, 15945, 29908, 7976, 2582, 4046, 15945, 29908, 13, 13, 1300, 974, 29880, 1878, 29918, 18829, 29901, 5785, 353, 29871, 29900, 29889, 29906, 13, 15945, 29908, 29967, 12981, 1358, 1120, 974, 29880, 1878, 9055, 15945, 29908, 13, 13, 13, 12674, 822, 1653, 29918, 2676, 29918, 2974, 29898, 10030, 29901, 851, 29892, 13, 462, 9651, 282, 331, 29901, 19229, 29889, 27636, 29961, 2605, 1402, 13, 462, 9651, 14998, 29901, 3056, 29889, 9675, 1188, 29889, 2974, 29889, 27852, 29889, 5841, 355, 13, 462, 9651, 1723, 1599, 525, 3609, 6004, 2396, 13, 1678, 9995, 4391, 1856, 1923, 15945, 29908, 13, 1678, 28915, 353, 3142, 1982, 29889, 5510, 29889, 2271, 5510, 29898, 10030, 29897, 13, 1678, 3495, 353, 28915, 29889, 28988, 13, 1678, 2011, 353, 28915, 29889, 637, 13, 13, 1678, 1923, 353, 2563, 6004, 580, 13, 1678, 1923, 3032, 27852, 353, 14998, 13, 1678, 1923, 3032, 29879, 15291, 353, 7272, 8740, 29887, 1358, 29889, 20631, 29898, 3069, 29892, 2011, 29892, 1923, 3032, 265, 29918, 9965, 29892, 13, 462, 462, 539, 2294, 29918, 3972, 29922, 1481, 29918, 2084, 29892, 13, 462, 462, 539, 282, 331, 29918, 1445, 29922, 29886, 331, 29892, 13, 462, 462, 539, 1120, 974, 29880, 1878, 29918, 18829, 29922, 1300, 974, 29880, 1878, 29918, 18829, 29897, 13, 1678, 736, 1923, 13, 13, 13, 1990, 2563, 6004, 29898, 29874, 601, 29889, 6848, 1125, 13, 13, 1678, 732, 6799, 13, 1678, 822, 7465, 29918, 2972, 29898, 1311, 29897, 1599, 263, 601, 29889, 4782, 29901, 13, 4706, 9995, 8123, 2318, 15945, 29908, 13, 4706, 736, 1583, 3032, 29879, 15291, 29889, 12674, 29918, 2972, 13, 13, 1678, 822, 903, 265, 29918, 9965, 29898, 1311, 29892, 11009, 1125, 13, 4706, 1583, 29889, 12674, 29918, 2972, 29889, 1028, 18101, 29898, 1311, 3032, 9965, 29918, 7888, 29892, 11009, 29897, 13, 13, 1678, 7465, 822, 903, 9965, 29918, 7888, 29898, 1311, 29892, 11009, 1125, 13, 4706, 1735, 29918, 9990, 353, 263, 601, 29889, 10620, 580, 13, 4706, 11009, 29889, 12674, 29918, 2972, 29889, 1028, 18101, 7373, 3167, 29918, 7888, 29892, 1583, 3032, 27852, 29892, 11009, 29892, 1735, 29918, 9990, 29897, 13, 13, 4706, 1018, 29901, 13, 9651, 411, 1583, 3032, 27852, 29889, 9573, 29918, 3167, 29918, 10702, 29898, 3167, 29918, 9990, 29889, 649, 29918, 3707, 1249, 1125, 13, 18884, 411, 11009, 29889, 9573, 29918, 3167, 29918, 10702, 29898, 13, 462, 4706, 2090, 312, 8789, 29889, 3846, 29898, 3167, 29918, 9990, 29889, 649, 29918, 3707, 1249, 29892, 5159, 22164, 13, 462, 1678, 7272, 11009, 29889, 10685, 29918, 11291, 292, 580, 13, 13, 4706, 7146, 29901, 13, 9651, 11009, 29889, 5358, 580, 13, 13, 13, 12674, 822, 903, 3167, 29918, 7888, 29898, 27852, 29892, 11009, 29892, 1735, 29918, 9990, 1125, 13, 1678, 1018, 29901, 13, 4706, 4175, 29918, 3126, 353, 903, 28455, 277, 675, 29918, 4572, 29898, 13082, 29889, 16674, 29918, 1272, 29897, 13, 4706, 937, 29918, 333, 353, 14998, 29889, 4102, 29918, 333, 13, 4706, 1833, 29918, 333, 353, 14998, 29889, 4230, 29918, 333, 13, 4706, 4175, 29918, 15033, 353, 5852, 13, 4706, 716, 29918, 26586, 29918, 3126, 353, 5159, 13, 13, 4706, 1550, 5852, 29901, 13, 9651, 565, 4175, 29918, 15033, 29901, 13, 18884, 4175, 353, 3619, 29889, 4572, 29918, 3166, 29918, 3126, 29898, 4572, 29918, 3126, 29897, 13, 18884, 1550, 451, 1735, 29918, 9990, 29889, 6310, 7295, 13, 462, 1678, 1735, 29918, 9990, 29889, 657, 29918, 3707, 1249, 580, 13, 18884, 9976, 353, 7272, 14998, 29889, 1972, 29898, 4572, 29897, 13, 18884, 9976, 29918, 3126, 353, 518, 9435, 29889, 8269, 29918, 517, 29918, 3126, 29898, 8269, 29897, 13, 462, 18884, 363, 6251, 297, 9976, 29962, 13, 9651, 25342, 716, 29918, 26586, 29918, 3126, 29901, 13, 18884, 3517, 29918, 333, 353, 9976, 29918, 3126, 29961, 29900, 22322, 333, 2033, 565, 9976, 29918, 3126, 1683, 29871, 29900, 13, 18884, 9976, 29918, 3126, 353, 518, 29930, 29918, 4572, 29918, 26586, 29898, 4572, 29918, 3126, 29892, 3517, 29918, 333, 29892, 13, 462, 462, 462, 716, 29918, 26586, 29918, 3126, 511, 13, 462, 18884, 334, 26586, 29918, 3126, 29962, 13, 18884, 9976, 29918, 3126, 353, 9976, 29918, 3126, 7503, 4572, 29889, 3317, 29918, 9902, 29962, 13, 13, 9651, 11009, 29889, 842, 29918, 2997, 29918, 1272, 3319, 29915, 4572, 2396, 4175, 29918, 3126, 29892, 13, 462, 462, 525, 26586, 2396, 9976, 29918, 3126, 29892, 13, 462, 462, 525, 4102, 29918, 333, 2396, 937, 29918, 333, 29892, 13, 462, 462, 525, 4230, 29918, 333, 2396, 1833, 29918, 333, 1800, 13, 13, 9651, 716, 29918, 26586, 353, 7272, 1735, 29918, 9990, 29889, 657, 580, 13, 9651, 716, 29918, 26586, 29918, 3126, 353, 518, 9435, 29889, 8269, 29918, 517, 29918, 3126, 29898, 8269, 29897, 13, 462, 18884, 363, 6251, 297, 716, 29918, 26586, 29962, 13, 13, 9651, 937, 29918, 333, 353, 14998, 29889, 4102, 29918, 333, 13, 9651, 1833, 29918, 333, 353, 14998, 29889, 4230, 29918, 333, 13, 9651, 716, 29918, 4572, 29918, 3126, 353, 903, 28455, 277, 675, 29918, 4572, 29898, 13082, 29889, 16674, 29918, 1272, 29897, 13, 9651, 4175, 29918, 15033, 353, 716, 29918, 4572, 29918, 3126, 2804, 4175, 29918, 3126, 13, 9651, 4175, 29918, 3126, 353, 716, 29918, 4572, 29918, 3126, 13, 13, 1678, 7146, 29901, 13, 4706, 11009, 29889, 5358, 580, 13, 13, 13, 1753, 903, 28455, 277, 675, 29918, 4572, 29898, 4572, 29918, 3126, 1125, 13, 1678, 565, 451, 4175, 29918, 3126, 29901, 13, 4706, 4175, 29918, 3126, 353, 3619, 29889, 4572, 29918, 517, 29918, 3126, 29898, 13, 9651, 3619, 29889, 5072, 29898, 3317, 29918, 9902, 29922, 3317, 29918, 9902, 29918, 13400, 876, 13, 1678, 565, 313, 4572, 29918, 3126, 1839, 3317, 29918, 9902, 2033, 338, 6213, 470, 13, 9651, 4175, 29918, 3126, 1839, 3317, 29918, 9902, 2033, 1405, 4236, 29918, 9902, 29918, 13400, 1125, 13, 4706, 4175, 29918, 3126, 353, 9657, 29898, 4572, 29918, 3126, 29892, 4236, 29918, 9902, 29922, 3317, 29918, 9902, 29918, 13400, 29897, 13, 1678, 736, 4175, 29918, 3126, 13, 13, 13, 1753, 903, 4572, 29918, 26586, 29898, 4572, 29918, 3126, 29892, 3517, 29918, 333, 29892, 9976, 29918, 3126, 1125, 13, 1678, 363, 474, 297, 9976, 29918, 3126, 29901, 13, 4706, 565, 474, 1839, 333, 2033, 5277, 3517, 29918, 333, 29901, 13, 9651, 6773, 13, 4706, 565, 313, 4572, 29918, 3126, 1839, 4230, 29918, 333, 2033, 338, 451, 6213, 13, 18884, 322, 474, 1839, 333, 2033, 1405, 4175, 29918, 3126, 1839, 4230, 29918, 333, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 313, 4572, 29918, 3126, 1839, 8269, 29918, 16394, 29918, 3166, 2033, 338, 451, 6213, 13, 18884, 322, 474, 1839, 16394, 2033, 529, 4175, 29918, 3126, 1839, 8269, 29918, 16394, 29918, 3166, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 313, 4572, 29918, 3126, 1839, 8269, 29918, 16394, 29918, 517, 2033, 338, 451, 6213, 13, 18884, 322, 474, 1839, 16394, 2033, 1405, 4175, 29918, 3126, 1839, 8269, 29918, 16394, 29918, 517, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 313, 4572, 29918, 3126, 1839, 17470, 1793, 2033, 338, 451, 6213, 322, 13, 18884, 474, 1839, 7645, 16215, 17470, 1793, 2033, 2804, 4175, 29918, 3126, 1839, 17470, 1793, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 313, 4572, 29918, 3126, 1839, 344, 369, 537, 2033, 338, 451, 6213, 322, 13, 18884, 474, 1839, 7645, 16215, 344, 369, 537, 2033, 2804, 4175, 29918, 3126, 1839, 344, 369, 537, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 451, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29918, 3126, 1839, 28988, 7464, 13, 462, 462, 474, 1839, 7645, 16215, 28988, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 451, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29918, 3126, 1839, 932, 29918, 978, 7464, 13, 462, 462, 474, 1839, 7645, 16215, 932, 29918, 978, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 451, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29918, 3126, 1839, 15439, 333, 7464, 13, 462, 462, 474, 1839, 7645, 16215, 15439, 333, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 451, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29918, 3126, 1839, 7645, 333, 7464, 13, 462, 462, 474, 1839, 7645, 16215, 7645, 333, 2033, 1125, 13, 9651, 6773, 13, 4706, 565, 451, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29918, 3126, 1839, 7645, 7464, 13, 462, 462, 474, 1839, 7645, 16215, 7645, 2033, 1125, 13, 9651, 6773, 13, 4706, 7709, 474, 13, 13, 13, 1753, 903, 4352, 29918, 710, 29918, 4572, 29898, 4572, 29892, 995, 1125, 13, 1678, 736, 451, 4175, 470, 4175, 297, 995, 13, 2 ]
lstchain/visualization/camera.py
misabelber/cta-lstchain
0
14556
import numpy as np from ..reco.disp import disp_vector import astropy.units as u import matplotlib.pyplot as plt from ctapipe.visualization import CameraDisplay __all__ = [ 'overlay_disp_vector', 'overlay_hillas_major_axis', 'overlay_source', 'display_dl1_event', ] def display_dl1_event(event, camera_geometry, tel_id=1, axes=None, **kwargs): """ Display a DL1 event (image and pulse time map) side by side Parameters ---------- event: ctapipe event tel_id: int axes: list of `matplotlib.pyplot.axes` of shape (2,) or None kwargs: kwargs for `ctapipe.visualization.CameraDisplay` Returns ------- axes: `matplotlib.pyplot.axes` """ if axes is None: fig, axes = plt.subplots(1, 2, figsize=(12, 5)) image = event.dl1.tel[tel_id].image peak_time = event.dl1.tel[tel_id].peak_time if image is None or peak_time is None: raise Exception(f"There is no calibrated image or pulse time map for telescope {tel_id}") d1 = CameraDisplay(camera_geometry, image, ax=axes[0], **kwargs) d1.add_colorbar(ax=axes[0]) d2 = CameraDisplay(camera_geometry, peak_time, ax=axes[1], **kwargs) d2.add_colorbar(ax=axes[1]) return axes def overlay_source(display, source_pos_x, source_pos_y, **kwargs): """ Display the source (event) position in the camera Parameters ---------- display: `ctapipe.visualization.CameraDisplay` source_pos_x: `astropy.units.Quantity` source_pos_y: `astropy.units.Quantity` kwargs: args for `matplotlib.pyplot.scatter` Returns ------- `matplotlib.pyplot.axes` """ kwargs['marker'] = 'x' if 'marker' not in kwargs else kwargs['marker'] kwargs['color'] = 'red' if 'color' not in kwargs else kwargs['color'] display.axes.scatter(source_pos_x, source_pos_y, **kwargs) def overlay_disp_vector(display, disp, hillas, **kwargs): """ Overlay disp vector on a CameraDisplay Parameters ---------- display: `ctapipe.visualization.CameraDisplay` disp: `DispContainer` hillas: `ctapipe.containers.HillasParametersContainer` kwargs: args for `matplotlib.pyplot.quiver` """ assert np.isfinite([hillas.x.value, hillas.y.value]).all() if not np.isfinite([disp.dx.value, disp.dy.value]).all(): disp_vector(disp) display.axes.quiver(hillas.x, hillas.y, disp.dx, disp.dy, units='xy', scale=1*u.m, angles='xy', **kwargs, ) display.axes.quiver(hillas.x.value, hillas.y.value, disp.dx.value, disp.dy.value, units='xy', scale=1) def overlay_hillas_major_axis(display, hillas, **kwargs): """ Overlay hillas ellipse major axis on a CameraDisplay. Parameters ---------- display: `ctapipe.visualization.CameraDisplay` hillas: `ctapipe.containers.HillaParametersContainer` kwargs: args for `matplotlib.pyplot.plot` """ kwargs['color'] = 'black' if 'color' not in kwargs else kwargs['color'] length = hillas.length * 2 x = -length + 2 * length * np.arange(10) / 10 display.axes.plot(hillas.x + x * np.cos(hillas.psi.to(u.rad).value), hillas.y + x * np.sin(hillas.psi.to(u.rad).value), **kwargs, )
[ 1, 1053, 12655, 408, 7442, 13, 3166, 6317, 276, 1111, 29889, 2218, 29886, 1053, 12272, 29918, 8111, 13, 5215, 8717, 14441, 29889, 348, 1169, 408, 318, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 3166, 274, 29873, 2754, 412, 29889, 20119, 2133, 1053, 24321, 9323, 13, 13, 1649, 497, 1649, 353, 518, 13, 1678, 525, 957, 8387, 29918, 2218, 29886, 29918, 8111, 742, 13, 1678, 525, 957, 8387, 29918, 29882, 21338, 29918, 21355, 29918, 8990, 742, 13, 1678, 525, 957, 8387, 29918, 4993, 742, 13, 1678, 525, 4990, 29918, 11671, 29896, 29918, 3696, 742, 13, 29962, 13, 13, 1753, 2479, 29918, 11671, 29896, 29918, 3696, 29898, 3696, 29892, 10656, 29918, 19156, 29892, 13547, 29918, 333, 29922, 29896, 29892, 27815, 29922, 8516, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 17440, 263, 360, 29931, 29896, 1741, 313, 3027, 322, 9505, 344, 931, 2910, 29897, 2625, 491, 2625, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 1741, 29901, 274, 29873, 2754, 412, 1741, 13, 1678, 13547, 29918, 333, 29901, 938, 13, 1678, 27815, 29901, 1051, 310, 421, 2922, 17357, 29889, 2272, 5317, 29889, 1165, 267, 29952, 310, 8267, 313, 29906, 29892, 29897, 470, 6213, 13, 1678, 9049, 5085, 29901, 9049, 5085, 363, 421, 312, 2754, 412, 29889, 20119, 2133, 29889, 20717, 9323, 29952, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 27815, 29901, 421, 2922, 17357, 29889, 2272, 5317, 29889, 1165, 267, 29952, 13, 1678, 9995, 13, 13, 1678, 565, 27815, 338, 6213, 29901, 13, 4706, 2537, 29892, 27815, 353, 14770, 29889, 1491, 26762, 29898, 29896, 29892, 29871, 29906, 29892, 2537, 2311, 7607, 29896, 29906, 29892, 29871, 29945, 876, 13, 13, 1678, 1967, 353, 1741, 29889, 11671, 29896, 29889, 28497, 29961, 28497, 29918, 333, 1822, 3027, 13, 1678, 19224, 29918, 2230, 353, 1741, 29889, 11671, 29896, 29889, 28497, 29961, 28497, 29918, 333, 1822, 412, 557, 29918, 2230, 13, 13, 1678, 565, 1967, 338, 6213, 470, 19224, 29918, 2230, 338, 6213, 29901, 13, 4706, 12020, 8960, 29898, 29888, 29908, 8439, 338, 694, 1208, 4626, 630, 1967, 470, 9505, 344, 931, 2910, 363, 26503, 4338, 426, 28497, 29918, 333, 27195, 13, 13, 1678, 270, 29896, 353, 24321, 9323, 29898, 26065, 29918, 19156, 29892, 1967, 29892, 4853, 29922, 1165, 267, 29961, 29900, 1402, 3579, 19290, 29897, 13, 1678, 270, 29896, 29889, 1202, 29918, 2780, 1646, 29898, 1165, 29922, 1165, 267, 29961, 29900, 2314, 13, 1678, 270, 29906, 353, 24321, 9323, 29898, 26065, 29918, 19156, 29892, 19224, 29918, 2230, 29892, 4853, 29922, 1165, 267, 29961, 29896, 1402, 3579, 19290, 29897, 13, 1678, 270, 29906, 29889, 1202, 29918, 2780, 1646, 29898, 1165, 29922, 1165, 267, 29961, 29896, 2314, 13, 13, 1678, 736, 27815, 13, 13, 13, 1753, 27292, 29918, 4993, 29898, 4990, 29892, 2752, 29918, 1066, 29918, 29916, 29892, 2752, 29918, 1066, 29918, 29891, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 17440, 278, 2752, 313, 3696, 29897, 2602, 297, 278, 10656, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2479, 29901, 421, 312, 2754, 412, 29889, 20119, 2133, 29889, 20717, 9323, 29952, 13, 1678, 2752, 29918, 1066, 29918, 29916, 29901, 421, 579, 14441, 29889, 348, 1169, 29889, 22930, 537, 29952, 13, 1678, 2752, 29918, 1066, 29918, 29891, 29901, 421, 579, 14441, 29889, 348, 1169, 29889, 22930, 537, 29952, 13, 1678, 9049, 5085, 29901, 6389, 363, 421, 2922, 17357, 29889, 2272, 5317, 29889, 1557, 2620, 29952, 13, 13, 1678, 16969, 13, 1678, 448, 22158, 13, 1678, 421, 2922, 17357, 29889, 2272, 5317, 29889, 1165, 267, 29952, 13, 1678, 9995, 13, 1678, 9049, 5085, 1839, 22976, 2033, 353, 525, 29916, 29915, 565, 525, 22976, 29915, 451, 297, 9049, 5085, 1683, 9049, 5085, 1839, 22976, 2033, 13, 1678, 9049, 5085, 1839, 2780, 2033, 353, 525, 1127, 29915, 565, 525, 2780, 29915, 451, 297, 9049, 5085, 1683, 9049, 5085, 1839, 2780, 2033, 13, 1678, 2479, 29889, 1165, 267, 29889, 1557, 2620, 29898, 4993, 29918, 1066, 29918, 29916, 29892, 2752, 29918, 1066, 29918, 29891, 29892, 3579, 19290, 29897, 13, 13, 13, 1753, 27292, 29918, 2218, 29886, 29918, 8111, 29898, 4990, 29892, 12272, 29892, 17306, 294, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 6811, 8387, 12272, 4608, 373, 263, 24321, 9323, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2479, 29901, 421, 312, 2754, 412, 29889, 20119, 2133, 29889, 20717, 9323, 29952, 13, 1678, 12272, 29901, 421, 4205, 29886, 7895, 29952, 13, 1678, 17306, 294, 29901, 421, 312, 2754, 412, 29889, 1285, 475, 414, 29889, 29950, 21338, 11507, 7895, 29952, 13, 1678, 9049, 5085, 29901, 6389, 363, 421, 2922, 17357, 29889, 2272, 5317, 29889, 339, 2147, 29952, 13, 13, 1678, 9995, 13, 1678, 4974, 7442, 29889, 4492, 262, 568, 4197, 29882, 21338, 29889, 29916, 29889, 1767, 29892, 17306, 294, 29889, 29891, 29889, 1767, 14664, 497, 580, 13, 1678, 565, 451, 7442, 29889, 4492, 262, 568, 4197, 2218, 29886, 29889, 8235, 29889, 1767, 29892, 12272, 29889, 4518, 29889, 1767, 14664, 497, 7295, 13, 4706, 12272, 29918, 8111, 29898, 2218, 29886, 29897, 13, 13, 1678, 2479, 29889, 1165, 267, 29889, 339, 2147, 29898, 29882, 21338, 29889, 29916, 29892, 17306, 294, 29889, 29891, 29892, 13, 462, 4706, 12272, 29889, 8235, 29892, 12272, 29889, 4518, 29892, 13, 462, 4706, 10340, 2433, 3594, 742, 6287, 29922, 29896, 29930, 29884, 29889, 29885, 29892, 13, 462, 4706, 23619, 2433, 3594, 742, 13, 462, 4706, 3579, 19290, 29892, 13, 462, 4706, 1723, 13, 13, 1678, 2479, 29889, 1165, 267, 29889, 339, 2147, 29898, 29882, 21338, 29889, 29916, 29889, 1767, 29892, 17306, 294, 29889, 29891, 29889, 1767, 29892, 12272, 29889, 8235, 29889, 1767, 29892, 12272, 29889, 4518, 29889, 1767, 29892, 10340, 2433, 3594, 742, 6287, 29922, 29896, 29897, 13, 13, 13, 1753, 27292, 29918, 29882, 21338, 29918, 21355, 29918, 8990, 29898, 4990, 29892, 17306, 294, 29892, 3579, 19290, 1125, 13, 1678, 9995, 13, 1678, 6811, 8387, 17306, 294, 560, 5843, 4655, 9685, 373, 263, 24321, 9323, 29889, 13, 13, 1678, 12662, 2699, 13, 1678, 448, 1378, 29899, 13, 1678, 2479, 29901, 421, 312, 2754, 412, 29889, 20119, 2133, 29889, 20717, 9323, 29952, 13, 1678, 17306, 294, 29901, 421, 312, 2754, 412, 29889, 1285, 475, 414, 29889, 29950, 2911, 11507, 7895, 29952, 13, 1678, 9049, 5085, 29901, 6389, 363, 421, 2922, 17357, 29889, 2272, 5317, 29889, 5317, 29952, 13, 13, 1678, 9995, 13, 1678, 9049, 5085, 1839, 2780, 2033, 353, 525, 8517, 29915, 565, 525, 2780, 29915, 451, 297, 9049, 5085, 1683, 9049, 5085, 1839, 2780, 2033, 13, 13, 1678, 3309, 353, 17306, 294, 29889, 2848, 334, 29871, 29906, 13, 1678, 921, 353, 448, 2848, 718, 29871, 29906, 334, 3309, 334, 7442, 29889, 279, 927, 29898, 29896, 29900, 29897, 847, 29871, 29896, 29900, 13, 1678, 2479, 29889, 1165, 267, 29889, 5317, 29898, 29882, 21338, 29889, 29916, 718, 921, 334, 7442, 29889, 3944, 29898, 29882, 21338, 29889, 6134, 29889, 517, 29898, 29884, 29889, 3665, 467, 1767, 511, 13, 462, 418, 17306, 294, 29889, 29891, 718, 921, 334, 7442, 29889, 5223, 29898, 29882, 21338, 29889, 6134, 29889, 517, 29898, 29884, 29889, 3665, 467, 1767, 511, 13, 462, 418, 3579, 19290, 29892, 13, 462, 418, 1723, 13, 13, 2 ]
db_creator.py
Ksusha1319/stud_projects
0
71319
import datetime from sqlalchemy import create_engine, ForeignKey from sqlalchemy import Column, Date, Integer, String, DateTime, func from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import relationship, backref engine = create_engine('sqlite:///test.db', echo=True) Base = declarative_base() class Nickname(Base): __tablename__ = "nicknames" id = Column(Integer, primary_key=True) name = Column(String) def __repr__(self): return "<Nickname: {}>".format(self.name) class Report(Base): """""" __tablename__ = "reports" id = Column(Integer, primary_key=True) created_date = Column(DateTime(timezone=True), default=func.now()) comment = Column(String) incident_date = Column(String) incident_type = Column(String) game_type = Column(String) priority = Column(String) status = Column(String) resolution = Column(String) comment_soc = Column(String) service_login = Column(String) username = Column(String) ticket = Column(String) nickname_id = Column(Integer, ForeignKey("nicknames.id")) nickname = relationship("Nickname", backref=backref( "reports", order_by=id)) # create tables class Users(Base): __tablename__ = "Users" id = Column(Integer, primary_key=True) created_date = Column(DateTime(timezone=True), default=func.now()) username = Column(String) pass_hash = Column(String) email = Column(String) role = Column(String) about = Column(String) Base.metadata.create_all(engine)
[ 1, 1053, 12865, 13, 3166, 4576, 284, 305, 6764, 1053, 1653, 29918, 10599, 29892, 19358, 2558, 13, 3166, 4576, 284, 305, 6764, 1053, 12481, 29892, 4712, 29892, 8102, 29892, 1714, 29892, 12315, 29892, 3653, 13, 3166, 4576, 284, 305, 6764, 29889, 1062, 29889, 311, 16544, 1230, 1053, 7669, 1230, 29918, 3188, 13, 3166, 4576, 284, 305, 6764, 29889, 555, 1053, 9443, 29892, 1250, 999, 13, 13, 10599, 353, 1653, 29918, 10599, 877, 22793, 597, 29914, 1688, 29889, 2585, 742, 2916, 29922, 5574, 29897, 13, 5160, 353, 7669, 1230, 29918, 3188, 580, 13, 13, 13, 1990, 13853, 978, 29898, 5160, 1125, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 376, 19254, 7039, 29908, 13, 13, 1678, 1178, 353, 12481, 29898, 7798, 29892, 7601, 29918, 1989, 29922, 5574, 29897, 13, 1678, 1024, 353, 12481, 29898, 1231, 29897, 13, 13, 1678, 822, 4770, 276, 558, 12035, 1311, 1125, 13, 4706, 736, 9872, 29940, 860, 978, 29901, 6571, 29958, 1642, 4830, 29898, 1311, 29889, 978, 29897, 13, 13, 13, 1990, 13969, 29898, 5160, 1125, 13, 1678, 9995, 15945, 29908, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 376, 276, 4011, 29908, 13, 13, 1678, 1178, 353, 12481, 29898, 7798, 29892, 7601, 29918, 1989, 29922, 5574, 29897, 13, 1678, 2825, 29918, 1256, 353, 12481, 29898, 11384, 29898, 2230, 8028, 29922, 5574, 511, 2322, 29922, 9891, 29889, 3707, 3101, 13, 1678, 3440, 353, 12481, 29898, 1231, 29897, 13, 1678, 15134, 29918, 1256, 353, 12481, 29898, 1231, 29897, 13, 1678, 15134, 29918, 1853, 353, 12481, 29898, 1231, 29897, 13, 1678, 3748, 29918, 1853, 353, 12481, 29898, 1231, 29897, 13, 1678, 20136, 353, 12481, 29898, 1231, 29897, 13, 1678, 4660, 353, 12481, 29898, 1231, 29897, 13, 1678, 10104, 353, 12481, 29898, 1231, 29897, 13, 1678, 3440, 29918, 29879, 542, 353, 12481, 29898, 1231, 29897, 13, 1678, 2669, 29918, 7507, 353, 12481, 29898, 1231, 29897, 13, 1678, 8952, 353, 12481, 29898, 1231, 29897, 13, 1678, 23381, 353, 12481, 29898, 1231, 29897, 13, 268, 13, 1678, 25985, 978, 29918, 333, 353, 12481, 29898, 7798, 29892, 19358, 2558, 703, 19254, 7039, 29889, 333, 5783, 13, 1678, 25985, 978, 353, 9443, 703, 29940, 860, 978, 613, 1250, 999, 29922, 1627, 999, 29898, 13, 4706, 376, 276, 4011, 613, 1797, 29918, 1609, 29922, 333, 876, 13, 13, 13, 29937, 1653, 6131, 13, 1990, 23861, 29898, 5160, 1125, 13, 1678, 4770, 3891, 2435, 420, 1649, 353, 376, 5959, 29908, 13, 13, 1678, 1178, 353, 12481, 29898, 7798, 29892, 7601, 29918, 1989, 29922, 5574, 29897, 13, 1678, 2825, 29918, 1256, 353, 12481, 29898, 11384, 29898, 2230, 8028, 29922, 5574, 511, 2322, 29922, 9891, 29889, 3707, 3101, 13, 1678, 8952, 353, 12481, 29898, 1231, 29897, 13, 1678, 1209, 29918, 8568, 353, 12481, 29898, 1231, 29897, 13, 1678, 4876, 353, 12481, 29898, 1231, 29897, 13, 1678, 6297, 353, 12481, 29898, 1231, 29897, 13, 1678, 1048, 353, 12481, 29898, 1231, 29897, 13, 268, 13, 5160, 29889, 19635, 29889, 3258, 29918, 497, 29898, 10599, 29897, 13, 2 ]
app.py
tangingw/python_spotify
0
59212
<gh_stars>0 import hashlib import json import requests from flask import Flask from flask import request from flask import jsonify from flask import redirect from flask import url_for from utils import Handler from utils import auth from utils import config BASE_URL = "https://api.spotify.com" app = Flask(__name__) handler = Handler() @app.route("/") def hello_world(): return "Hello World!" @app.route("/authorize") def authorize(): client_id, _ = auth() config_content = config() authorize_url = "https://accounts.spotify.com/authorize/" params = { "client_id": client_id, "response_type": "code", "redirect_uri": config_content["callback_url"], "state": hashlib.sha256(config_content["state_msg"].encode('utf-8')).hexdigest(), "scope": config_content["scope"] } response = requests.get(authorize_url, params=params) return redirect(response.url) @app.route("/callback/") def callback(): callback_url = config()["callback_url"] callback_params = request.args if "error" in callback_params: return jsonify( error=callback_params.get("error"), state=callback_params.get("state") ) post_data = { "grant_type": "authorization_code", "code": callback_params.get("code"), "redirect_uri": callback_url, } return handler.write_file_handler(post_data) @app.route("/refresh_token") def refresh_token(): with open("token.json", "r") as file: data = json.loads(file.read()) if "refresh_token" not in data: return redirect(url_for("authorize")) post_data = { "grant_type": "refresh_token", "refresh_token": data["refresh_token"] } return handler.write_file_handler(post_data) @app.route("/spotify") def get_spotify(): player_info = handler.generic_handler(BASE_URL + "/v1/me/player", request.path) if player_info: return player_info return redirect(url_for("get_my_devices")) @app.route("/spotify/me/devices") def get_my_devices(): return handler.generic_handler(BASE_URL + "/v1/me/player/devices", request.path) @app.route("/spotify/me") def get_spotify_me(): return handler.generic_handler(BASE_URL + "/v1/me", request.path) @app.route("/spotify/me/following") def get_my_follow(): params = {"type": "artist"} return handler.generic_handler(BASE_URL + "/v1/me/following", request.path, params=params) @app.route("/spotify/me/playlists") def get_my_playlist(): return handler.generic_handler(BASE_URL + "/v1/me/playlists", request.path) @app.route("/spotify/search") def search_spotify(): callback_params = request.args return handler.generic_handler(BASE_URL + "/v1/search", request.path, params=callback_params) if __name__ == "__main__": app.run(host='0.0.0.0', port=8080)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 6608, 1982, 13, 5215, 4390, 13, 5215, 7274, 13, 3166, 29784, 1053, 2379, 1278, 13, 3166, 29784, 1053, 2009, 13, 3166, 29784, 1053, 4390, 1598, 13, 3166, 29784, 1053, 6684, 13, 3166, 29784, 1053, 3142, 29918, 1454, 13, 13, 3166, 3667, 29879, 1053, 5166, 1358, 13, 3166, 3667, 29879, 1053, 4817, 13, 3166, 3667, 29879, 1053, 2295, 13, 13, 13, 25416, 29918, 4219, 353, 376, 991, 597, 2754, 29889, 17500, 1598, 29889, 510, 29908, 13, 13, 13, 932, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13789, 353, 5166, 1358, 580, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 1159, 13, 1753, 22172, 29918, 11526, 7295, 13, 13, 1678, 736, 376, 10994, 2787, 3850, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 8921, 675, 1159, 13, 1753, 4148, 675, 7295, 13, 13, 1678, 3132, 29918, 333, 29892, 903, 353, 4817, 580, 13, 1678, 2295, 29918, 3051, 353, 2295, 580, 13, 13, 1678, 4148, 675, 29918, 2271, 353, 376, 991, 597, 10149, 29879, 29889, 17500, 1598, 29889, 510, 29914, 8921, 675, 12975, 13, 13, 1678, 8636, 353, 426, 13, 4706, 376, 4645, 29918, 333, 1115, 3132, 29918, 333, 29892, 13, 4706, 376, 5327, 29918, 1853, 1115, 376, 401, 613, 13, 4706, 376, 17886, 29918, 5338, 1115, 2295, 29918, 3051, 3366, 14035, 29918, 2271, 12436, 13, 4706, 376, 3859, 1115, 6608, 1982, 29889, 17051, 29906, 29945, 29953, 29898, 2917, 29918, 3051, 3366, 3859, 29918, 7645, 16862, 12508, 877, 9420, 29899, 29947, 1495, 467, 20970, 7501, 342, 3285, 13, 4706, 376, 6078, 1115, 2295, 29918, 3051, 3366, 6078, 3108, 13, 1678, 500, 13, 13, 1678, 2933, 353, 7274, 29889, 657, 29898, 8921, 675, 29918, 2271, 29892, 8636, 29922, 7529, 29897, 13, 13, 1678, 736, 6684, 29898, 5327, 29889, 2271, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 14035, 29914, 1159, 13, 1753, 6939, 7295, 13, 13, 1678, 6939, 29918, 2271, 353, 2295, 580, 3366, 14035, 29918, 2271, 3108, 13, 1678, 6939, 29918, 7529, 353, 2009, 29889, 5085, 13, 13, 1678, 565, 376, 2704, 29908, 297, 6939, 29918, 7529, 29901, 13, 13, 4706, 736, 4390, 1598, 29898, 13, 9651, 1059, 29922, 14035, 29918, 7529, 29889, 657, 703, 2704, 4968, 13, 9651, 2106, 29922, 14035, 29918, 7529, 29889, 657, 703, 3859, 1159, 13, 4706, 1723, 13, 13, 1678, 1400, 29918, 1272, 353, 426, 13, 4706, 376, 629, 424, 29918, 1853, 1115, 376, 8921, 2133, 29918, 401, 613, 13, 4706, 376, 401, 1115, 6939, 29918, 7529, 29889, 657, 703, 401, 4968, 13, 4706, 376, 17886, 29918, 5338, 1115, 6939, 29918, 2271, 29892, 13, 1678, 500, 13, 13, 1678, 736, 7834, 29889, 3539, 29918, 1445, 29918, 13789, 29898, 2490, 29918, 1272, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 22379, 29918, 6979, 1159, 13, 1753, 11086, 29918, 6979, 7295, 13, 13, 1678, 411, 1722, 703, 6979, 29889, 3126, 613, 376, 29878, 1159, 408, 934, 29901, 13, 13, 4706, 848, 353, 4390, 29889, 18132, 29898, 1445, 29889, 949, 3101, 13, 13, 1678, 565, 376, 22379, 29918, 6979, 29908, 451, 297, 848, 29901, 13, 13, 4706, 736, 6684, 29898, 2271, 29918, 1454, 703, 8921, 675, 5783, 13, 13, 1678, 1400, 29918, 1272, 353, 426, 13, 4706, 376, 629, 424, 29918, 1853, 1115, 376, 22379, 29918, 6979, 613, 13, 4706, 376, 22379, 29918, 6979, 1115, 848, 3366, 22379, 29918, 6979, 3108, 13, 1678, 500, 13, 13, 1678, 736, 7834, 29889, 3539, 29918, 1445, 29918, 13789, 29898, 2490, 29918, 1272, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 1159, 13, 1753, 679, 29918, 17500, 1598, 7295, 13, 13, 1678, 4847, 29918, 3888, 353, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 1004, 29914, 9106, 613, 2009, 29889, 2084, 29897, 13, 13, 1678, 565, 4847, 29918, 3888, 29901, 13, 13, 4706, 736, 4847, 29918, 3888, 13, 13, 1678, 736, 6684, 29898, 2271, 29918, 1454, 703, 657, 29918, 1357, 29918, 3359, 1575, 5783, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 29914, 1004, 29914, 3359, 1575, 1159, 13, 1753, 679, 29918, 1357, 29918, 3359, 1575, 7295, 13, 13, 1678, 736, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 1004, 29914, 9106, 29914, 3359, 1575, 613, 2009, 29889, 2084, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 29914, 1004, 1159, 13, 1753, 679, 29918, 17500, 1598, 29918, 1004, 7295, 13, 13, 1678, 736, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 1004, 613, 2009, 29889, 2084, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 29914, 1004, 29914, 23031, 292, 1159, 13, 1753, 679, 29918, 1357, 29918, 23031, 7295, 13, 13, 1678, 8636, 353, 8853, 1853, 1115, 376, 442, 391, 9092, 13, 1678, 736, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 1004, 29914, 23031, 292, 613, 2009, 29889, 2084, 29892, 8636, 29922, 7529, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 29914, 1004, 29914, 1456, 21513, 1159, 13, 1753, 679, 29918, 1357, 29918, 1456, 1761, 7295, 13, 13, 1678, 736, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 1004, 29914, 1456, 21513, 613, 2009, 29889, 2084, 29897, 13, 13, 13, 29992, 932, 29889, 13134, 11974, 17500, 1598, 29914, 4478, 1159, 13, 1753, 2740, 29918, 17500, 1598, 7295, 13, 13, 1678, 6939, 29918, 7529, 353, 2009, 29889, 5085, 13, 13, 1678, 736, 7834, 29889, 19206, 29918, 13789, 29898, 25416, 29918, 4219, 718, 5591, 29894, 29896, 29914, 4478, 613, 2009, 29889, 2084, 29892, 8636, 29922, 14035, 29918, 7529, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 13, 1678, 623, 29889, 3389, 29898, 3069, 2433, 29900, 29889, 29900, 29889, 29900, 29889, 29900, 742, 2011, 29922, 29947, 29900, 29947, 29900, 29897, 13, 2 ]
clkhash/benchmark.py
data61/clkhash
28
79255
<filename>clkhash/benchmark.py<gh_stars>10-100 import os import tempfile from timeit import default_timer as timer from clkhash.clk import generate_clk_from_csv from clkhash.randomnames import NameList def compute_hash_speed(num: int, quiet: bool = False, max_workers=None) -> float: """ Hash time. """ namelist = NameList(num) os_fd, tmpfile_name = tempfile.mkstemp(text=True) schema = NameList.SCHEMA header_row = ','.join([f.identifier for f in schema.fields]) with open(tmpfile_name, 'wt') as f: f.write(header_row) f.write('\n') for person in namelist.names: print(','.join([str(field) for field in person]), file=f) with open(tmpfile_name, 'rt') as f: start = timer() generate_clk_from_csv(f, 'secret', schema, progress_bar=not quiet, max_workers=max_workers) end = timer() os.close(os_fd) os.remove(tmpfile_name) elapsed_time = end - start if not quiet: print("{:6d} hashes in {:.6f} seconds. {:.2f} KH/s".format(num, elapsed_time, num / (1000 * elapsed_time))) return num / elapsed_time if __name__ == '__main__': for max_workers in [1, 2, 4, 8, 16]: print() if max_workers == 1: print("Without multiprocessing") sizes = [10_000] else: print(f"Using up to {max_workers} workers") sizes = [10_000, 50_000, 100_000] for n in sizes: compute_hash_speed(n, max_workers=max_workers)
[ 1, 529, 9507, 29958, 20495, 8568, 29914, 1785, 16580, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29899, 29896, 29900, 29900, 13, 5215, 2897, 13, 5215, 5694, 1445, 13, 3166, 931, 277, 1053, 2322, 29918, 20404, 408, 12237, 13, 13, 3166, 1067, 29895, 8568, 29889, 20495, 1053, 5706, 29918, 20495, 29918, 3166, 29918, 7638, 13, 3166, 1067, 29895, 8568, 29889, 8172, 7039, 1053, 4408, 1293, 13, 13, 13, 1753, 10272, 29918, 8568, 29918, 19322, 29898, 1949, 29901, 938, 29892, 11813, 29901, 6120, 353, 7700, 29892, 4236, 29918, 1287, 414, 29922, 8516, 29897, 1599, 5785, 29901, 13, 1678, 9995, 11874, 931, 29889, 13, 1678, 9995, 13, 1678, 6869, 295, 391, 353, 4408, 1293, 29898, 1949, 29897, 13, 1678, 2897, 29918, 11512, 29892, 13128, 1445, 29918, 978, 353, 5694, 1445, 29889, 11256, 303, 3451, 29898, 726, 29922, 5574, 29897, 13, 13, 1678, 10938, 353, 4408, 1293, 29889, 29903, 3210, 26862, 13, 1678, 4839, 29918, 798, 353, 13420, 4286, 7122, 4197, 29888, 29889, 25378, 363, 285, 297, 10938, 29889, 9621, 2314, 13, 13, 1678, 411, 1722, 29898, 7050, 1445, 29918, 978, 29892, 525, 14554, 1495, 408, 285, 29901, 13, 4706, 285, 29889, 3539, 29898, 6672, 29918, 798, 29897, 13, 4706, 285, 29889, 3539, 28909, 29876, 1495, 13, 4706, 363, 2022, 297, 6869, 295, 391, 29889, 7039, 29901, 13, 9651, 1596, 29898, 3788, 29889, 7122, 4197, 710, 29898, 2671, 29897, 363, 1746, 297, 2022, 11724, 934, 29922, 29888, 29897, 13, 13, 1678, 411, 1722, 29898, 7050, 1445, 29918, 978, 29892, 525, 2273, 1495, 408, 285, 29901, 13, 4706, 1369, 353, 12237, 580, 13, 4706, 5706, 29918, 20495, 29918, 3166, 29918, 7638, 29898, 29888, 29892, 525, 19024, 742, 10938, 29892, 6728, 29918, 1646, 29922, 1333, 11813, 29892, 4236, 29918, 1287, 414, 29922, 3317, 29918, 1287, 414, 29897, 13, 4706, 1095, 353, 12237, 580, 13, 13, 1678, 2897, 29889, 5358, 29898, 359, 29918, 11512, 29897, 13, 1678, 2897, 29889, 5992, 29898, 7050, 1445, 29918, 978, 29897, 13, 13, 1678, 560, 28170, 29918, 2230, 353, 1095, 448, 1369, 13, 1678, 565, 451, 11813, 29901, 13, 4706, 1596, 703, 25641, 29953, 29881, 29913, 6608, 267, 297, 12365, 29889, 29953, 29888, 29913, 6923, 29889, 12365, 29889, 29906, 29888, 29913, 476, 29950, 29914, 29879, 1642, 4830, 29898, 1949, 29892, 560, 28170, 29918, 2230, 29892, 954, 847, 313, 29896, 29900, 29900, 29900, 334, 560, 28170, 29918, 2230, 4961, 13, 1678, 736, 954, 847, 560, 28170, 29918, 2230, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 363, 4236, 29918, 1287, 414, 297, 518, 29896, 29892, 29871, 29906, 29892, 29871, 29946, 29892, 29871, 29947, 29892, 29871, 29896, 29953, 5387, 13, 4706, 1596, 580, 13, 4706, 565, 4236, 29918, 1287, 414, 1275, 29871, 29896, 29901, 13, 9651, 1596, 703, 3047, 449, 6674, 307, 985, 292, 1159, 13, 9651, 15786, 353, 518, 29896, 29900, 29918, 29900, 29900, 29900, 29962, 13, 4706, 1683, 29901, 13, 9651, 1596, 29898, 29888, 29908, 15156, 701, 304, 426, 3317, 29918, 1287, 414, 29913, 17162, 1159, 13, 9651, 15786, 353, 518, 29896, 29900, 29918, 29900, 29900, 29900, 29892, 29871, 29945, 29900, 29918, 29900, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29918, 29900, 29900, 29900, 29962, 13, 13, 4706, 363, 302, 297, 15786, 29901, 13, 9651, 10272, 29918, 8568, 29918, 19322, 29898, 29876, 29892, 4236, 29918, 1287, 414, 29922, 3317, 29918, 1287, 414, 29897, 13, 2 ]
polynomial_mixture/polynomial_mixture.py
sremes/polynomial-mixture
0
151879
"""Bayesian polynomial mixture model.""" # pylint: disable=invalid-name import numpy as np import tensorflow as tf import tensorflow_probability as tfp tfd = tfp.distributions tfb = tfp.bijectors class BayesianPolynomialMixture: # pylint: disable=too-few-public-methods """Handles creation of a polynomial mixture model.""" def __init__(self, num_components=5, polynomial_degree=3): """Creates polynomial mixture with given mixture components of given degree.""" self.num_components = num_components self.polynomial_degree = polynomial_degree self.coefficient_precisions = [10.0 ** x for x in range(self.polynomial_degree + 1)] self.concentration = np.array([0.1 for _ in range(self.num_components)]) self.wishart_df = self.polynomial_degree + 2.0 self.student_df = 2 def create_model(self, X): """Defines the joint distribution of the mixture model.""" precision_scale = np.repeat(np.expand_dims(self.coefficient_precisions, 0), self.num_components, axis=0) joint_distribution = tfd.JointDistributionNamed( dict( precision=tfd.Independent( tfd.WishartLinearOperator( df=self.wishart_df, scale=tf.linalg.LinearOperatorDiag(precision_scale), input_output_cholesky=True, name="precision", ), reinterpreted_batch_ndims=1, ), coefficients=lambda precision: tfd.Independent( tfd.MultivariateNormalTriL( loc=0, scale_tril=tfb.MatrixInverseTriL()(precision), name="coefficients" ), reinterpreted_batch_ndims=1, ), scale=tfd.HalfCauchy(loc=np.float64(0.0), scale=np.float64(1.0), name="noise_scale"), mixture_probs=tfd.Dirichlet(concentration=self.concentration, name="mixture_probs"), mixture=lambda mixture_probs, coefficients, scale: tfd.Sample( tfd.MixtureSameFamily( mixture_distribution=tfd.Categorical(probs=mixture_probs, name="mixture_distribution"), components_distribution=tfd.StudentT( df=self.student_df, loc=tf.linalg.matmul(X, coefficients, transpose_b=True), scale=scale, name="sample_likelihood", ), name="mixture_components", ), sample_shape=1, ), ), name="joint_distribution", ) return joint_distribution
[ 1, 9995, 29933, 388, 18970, 10159, 29544, 1904, 1213, 15945, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 20965, 29899, 978, 13, 13, 5215, 12655, 408, 7442, 13, 5215, 26110, 408, 15886, 13, 5215, 26110, 29918, 22795, 3097, 408, 15886, 29886, 13, 13, 29873, 11512, 353, 15886, 29886, 29889, 27691, 29879, 13, 13264, 29890, 353, 15886, 29886, 29889, 5365, 622, 943, 13, 13, 13, 1990, 6211, 18970, 7713, 9222, 29924, 29875, 15546, 29901, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 29888, 809, 29899, 3597, 29899, 23515, 13, 1678, 9995, 3481, 793, 11265, 310, 263, 10159, 29544, 1904, 1213, 15945, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 954, 29918, 14036, 29922, 29945, 29892, 10159, 29918, 12163, 929, 29922, 29941, 1125, 13, 4706, 9995, 9832, 1078, 10159, 29544, 411, 2183, 29544, 7117, 310, 2183, 7426, 1213, 15945, 13, 4706, 1583, 29889, 1949, 29918, 14036, 353, 954, 29918, 14036, 13, 4706, 1583, 29889, 3733, 9222, 29918, 12163, 929, 353, 10159, 29918, 12163, 929, 13, 4706, 1583, 29889, 1111, 8462, 29918, 1457, 3476, 1080, 353, 518, 29896, 29900, 29889, 29900, 3579, 921, 363, 921, 297, 3464, 29898, 1311, 29889, 3733, 9222, 29918, 12163, 929, 718, 29871, 29896, 4638, 13, 4706, 1583, 29889, 535, 1760, 29878, 362, 353, 7442, 29889, 2378, 4197, 29900, 29889, 29896, 363, 903, 297, 3464, 29898, 1311, 29889, 1949, 29918, 14036, 29897, 2314, 13, 4706, 1583, 29889, 29893, 728, 442, 29918, 2176, 353, 1583, 29889, 3733, 9222, 29918, 12163, 929, 718, 29871, 29906, 29889, 29900, 13, 4706, 1583, 29889, 18945, 29918, 2176, 353, 29871, 29906, 13, 13, 1678, 822, 1653, 29918, 4299, 29898, 1311, 29892, 1060, 1125, 13, 4706, 9995, 3206, 1475, 278, 14002, 4978, 310, 278, 29544, 1904, 1213, 15945, 13, 4706, 16716, 29918, 7052, 353, 7442, 29889, 14358, 29898, 9302, 29889, 18837, 29918, 6229, 29879, 29898, 1311, 29889, 1111, 8462, 29918, 1457, 3476, 1080, 29892, 29871, 29900, 511, 1583, 29889, 1949, 29918, 14036, 29892, 9685, 29922, 29900, 29897, 13, 4706, 14002, 29918, 27691, 353, 260, 11512, 29889, 29967, 2461, 13398, 3224, 22175, 29898, 13, 9651, 9657, 29898, 13, 18884, 16716, 29922, 29873, 11512, 29889, 2568, 1022, 3906, 29898, 13, 462, 1678, 260, 11512, 29889, 29956, 728, 442, 12697, 26486, 29898, 13, 462, 4706, 4489, 29922, 1311, 29889, 29893, 728, 442, 29918, 2176, 29892, 13, 462, 4706, 6287, 29922, 13264, 29889, 29880, 979, 29887, 29889, 12697, 26486, 12130, 351, 29898, 17990, 2459, 29918, 7052, 511, 13, 462, 4706, 1881, 29918, 4905, 29918, 305, 6544, 3459, 29922, 5574, 29892, 13, 462, 4706, 1024, 543, 17990, 2459, 613, 13, 462, 1678, 10353, 13, 462, 1678, 337, 1639, 1457, 9446, 29918, 16175, 29918, 299, 9893, 29922, 29896, 29892, 13, 18884, 10353, 13, 18884, 16127, 29922, 2892, 16716, 29901, 260, 11512, 29889, 2568, 1022, 3906, 29898, 13, 462, 1678, 260, 11512, 29889, 6857, 27432, 403, 19077, 29565, 29931, 29898, 13, 462, 4706, 1180, 29922, 29900, 29892, 6287, 29918, 509, 309, 29922, 13264, 29890, 29889, 14609, 797, 3901, 29565, 29931, 580, 29898, 17990, 2459, 511, 1024, 543, 1111, 8462, 29879, 29908, 13, 462, 1678, 10353, 13, 462, 1678, 337, 1639, 1457, 9446, 29918, 16175, 29918, 299, 9893, 29922, 29896, 29892, 13, 18884, 10353, 13, 18884, 6287, 29922, 29873, 11512, 29889, 29950, 3131, 29907, 13989, 29891, 29898, 2029, 29922, 9302, 29889, 7411, 29953, 29946, 29898, 29900, 29889, 29900, 511, 6287, 29922, 9302, 29889, 7411, 29953, 29946, 29898, 29896, 29889, 29900, 511, 1024, 543, 1217, 895, 29918, 7052, 4968, 13, 18884, 29544, 29918, 771, 5824, 29922, 29873, 11512, 29889, 9170, 436, 1026, 29898, 535, 1760, 29878, 362, 29922, 1311, 29889, 535, 1760, 29878, 362, 29892, 1024, 543, 2460, 15546, 29918, 771, 5824, 4968, 13, 18884, 29544, 29922, 2892, 29544, 29918, 771, 5824, 29892, 16127, 29892, 6287, 29901, 260, 11512, 29889, 17708, 29898, 13, 462, 1678, 260, 11512, 29889, 29924, 29875, 15546, 29903, 420, 27104, 29898, 13, 462, 4706, 29544, 29918, 27691, 29922, 29873, 11512, 29889, 29907, 20440, 936, 29898, 771, 5824, 29922, 2460, 15546, 29918, 771, 5824, 29892, 1024, 543, 2460, 15546, 29918, 27691, 4968, 13, 462, 4706, 7117, 29918, 27691, 29922, 29873, 11512, 29889, 20791, 29911, 29898, 13, 462, 9651, 4489, 29922, 1311, 29889, 18945, 29918, 2176, 29892, 13, 462, 9651, 1180, 29922, 13264, 29889, 29880, 979, 29887, 29889, 2922, 16109, 29898, 29990, 29892, 16127, 29892, 1301, 4220, 29918, 29890, 29922, 5574, 511, 13, 462, 9651, 6287, 29922, 7052, 29892, 13, 462, 9651, 1024, 543, 11249, 29918, 5081, 22342, 613, 13, 462, 4706, 10353, 13, 462, 4706, 1024, 543, 2460, 15546, 29918, 14036, 613, 13, 462, 1678, 10353, 13, 462, 1678, 4559, 29918, 12181, 29922, 29896, 29892, 13, 18884, 10353, 13, 9651, 10353, 13, 9651, 1024, 543, 12090, 29918, 27691, 613, 13, 4706, 1723, 13, 4706, 736, 14002, 29918, 27691, 13, 2 ]
yatube/posts/views.py
Ecmek/yatube_project
1
188706
<filename>yatube/posts/views.py from django.core.paginator import Paginator from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404, redirect, render from django.views.decorators.cache import cache_page from django.http import HttpResponseRedirect from .models import Follow, Post, Group, User, Ip from .forms import CommentForm, PostForm from .decorators import counted paginator_pages = 10 def get_client_ip(request): x_forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if x_forwarded_for: ip = x_forwarded_for.split(',')[0] else: ip = request.META.get('REMOTE_ADDR') return ip # @cache_page(5) @counted def index(request): latest = Post.objects.select_related('author', 'group').prefetch_related( 'comments', 'views') paginator = Paginator(latest, paginator_pages) page_number = request.GET.get('page') page = paginator.get_page(page_number) return render(request, 'index.html', {'page': page}) @counted def group_posts(request, slug): group = get_object_or_404(Group, slug=slug) posts = group.group_posts.select_related('author').prefetch_related( 'comments', 'views') paginator = Paginator(posts, paginator_pages) page_number = request.GET.get('page') page = paginator.get_page(page_number) return render(request, 'group.html', {'group': group, 'page': page}) @counted def profile(request, username): author = get_object_or_404(User, username=username) posts = author.posts.select_related('group').prefetch_related( 'comments', 'views') paginator = Paginator(posts, paginator_pages) page_number = request.GET.get('page') page = paginator.get_page(page_number) following = None if request.user.is_authenticated: following = author.following.filter(user=request.user).exists() context = { 'author': author, 'page': page, 'following': following, } return render(request, 'profile.html', context) @counted def post_view(request, username, post_id): post = get_object_or_404(Post, author__username=username, id=post_id) comments = post.comments.select_related('author') author = post.author form = CommentForm() ip = get_client_ip(request) Ip.objects.get_or_create(ip=ip) post.views.add(Ip.objects.get(ip=ip)) following = None if request.user.is_authenticated: following = author.following.filter(user=request.user).exists() context = { 'author': author, 'post': post, 'form': form, 'comments': comments, 'following': following, } return render(request, 'post.html', context) @login_required def add_comment(request, username, post_id): post = get_object_or_404(Post, author__username=username, id=post_id) form = CommentForm(request.POST or None) if form.is_valid(): comment = form.save(commit=False) comment.post = post comment.author = request.user comment.save() return redirect('posts:post', username, post_id) @login_required def new_post(request): form = PostForm(request.POST or None, files=request.FILES or None) if form.is_valid(): post = form.save(commit=False) post.author = request.user post.save() return redirect('posts:index') context = { 'header': 'Добавить запись', 'submit_text': 'Добавить', 'form': form, } return render(request, 'new_post.html', context) def post_edit(request, username, post_id): if request.user.username != username: return redirect('posts:post', username, post_id) post = get_object_or_404(Post, author__username=username, id=post_id) if not post.is_recently_pub: return HttpResponseRedirect(request.META.get('HTTP_REFERER')) form = PostForm( request.POST or None, files=request.FILES or None, instance=post ) if form.is_valid(): post = form.save(commit=False) post.save() return redirect('posts:post', username, post_id) context = { 'header': 'Редактировать запись', 'submit_text': 'Сохранить', 'form': form, 'post': post, } return render(request, 'new_post.html', context) @login_required @counted def follow_index(request): posts = Post.objects.filter( author__following__user=request.user ).select_related('author', 'group').prefetch_related('comments') paginator = Paginator(posts, paginator_pages) page_number = request.GET.get('page') page = paginator.get_page(page_number) return render(request, 'follow.html', {'page': page}) @login_required def profile_follow(request, username): if request.user.username == username: return HttpResponseRedirect(request.META.get('HTTP_REFERER')) author = get_object_or_404(User, username=username) Follow.objects.get_or_create(user=request.user, author=author) return HttpResponseRedirect(request.META.get('HTTP_REFERER')) @login_required def profile_unfollow(request, username): author = get_object_or_404(User, username=username) Follow.objects.filter(user=request.user, author=author).delete() return HttpResponseRedirect(request.META.get('HTTP_REFERER')) @login_required def post_delete(request, username, post_id): if request.user.username != username: return redirect('posts:post', username, post_id) post = get_object_or_404(Post, author__username=username, id=post_id) post.delete() return HttpResponseRedirect(request.META.get('HTTP_REFERER')) def page_not_found(request, exception): return render(request, 'misc/404.html', {'path': request.path}, status=404) def server_error(request): return render(request, 'misc/500.html', status=500)
[ 1, 529, 9507, 29958, 29891, 271, 4003, 29914, 14080, 29914, 7406, 29889, 2272, 13, 3166, 9557, 29889, 3221, 29889, 13573, 262, 1061, 1053, 349, 26584, 1061, 13, 3166, 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, 6684, 29892, 4050, 13, 3166, 9557, 29889, 7406, 29889, 19557, 4097, 29889, 8173, 1053, 7090, 29918, 3488, 13, 3166, 9557, 29889, 1124, 1053, 9056, 5103, 24735, 13, 13, 3166, 869, 9794, 1053, 10306, 29892, 4918, 29892, 6431, 29892, 4911, 29892, 306, 29886, 13, 3166, 869, 9514, 1053, 461, 2500, 29892, 4918, 2500, 13, 3166, 869, 19557, 4097, 1053, 29115, 13, 13, 13573, 262, 1061, 29918, 12292, 353, 29871, 29896, 29900, 13, 13, 13, 1753, 679, 29918, 4645, 29918, 666, 29898, 3827, 1125, 13, 1678, 921, 29918, 11333, 287, 29918, 1454, 353, 2009, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 29990, 29918, 22051, 29956, 1718, 2287, 29928, 29918, 22051, 1495, 13, 1678, 565, 921, 29918, 11333, 287, 29918, 1454, 29901, 13, 4706, 10377, 353, 921, 29918, 11333, 287, 29918, 1454, 29889, 5451, 29317, 29861, 29900, 29962, 13, 1678, 1683, 29901, 13, 4706, 10377, 353, 2009, 29889, 2303, 6040, 29889, 657, 877, 1525, 29924, 2891, 29923, 29918, 3035, 8353, 1495, 13, 1678, 736, 10377, 13, 13, 13, 29937, 732, 8173, 29918, 3488, 29898, 29945, 29897, 13, 29992, 2798, 287, 13, 1753, 2380, 29898, 3827, 1125, 13, 1678, 9281, 353, 4918, 29889, 12650, 29889, 2622, 29918, 12817, 877, 8921, 742, 525, 2972, 2824, 29886, 999, 3486, 29918, 12817, 29898, 13, 4706, 525, 21032, 742, 525, 7406, 1495, 13, 1678, 10203, 262, 1061, 353, 349, 26584, 1061, 29898, 12333, 29892, 10203, 262, 1061, 29918, 12292, 29897, 13, 1678, 1813, 29918, 4537, 353, 2009, 29889, 7194, 29889, 657, 877, 3488, 1495, 13, 1678, 1813, 353, 10203, 262, 1061, 29889, 657, 29918, 3488, 29898, 3488, 29918, 4537, 29897, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 2248, 29889, 1420, 742, 11117, 3488, 2396, 1813, 1800, 13, 13, 13, 29992, 2798, 287, 13, 1753, 2318, 29918, 14080, 29898, 3827, 29892, 2243, 688, 1125, 13, 1678, 2318, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 4782, 29892, 2243, 688, 29922, 29517, 29897, 13, 1678, 11803, 353, 2318, 29889, 2972, 29918, 14080, 29889, 2622, 29918, 12817, 877, 8921, 2824, 29886, 999, 3486, 29918, 12817, 29898, 13, 4706, 525, 21032, 742, 525, 7406, 1495, 13, 1678, 10203, 262, 1061, 353, 349, 26584, 1061, 29898, 14080, 29892, 10203, 262, 1061, 29918, 12292, 29897, 13, 1678, 1813, 29918, 4537, 353, 2009, 29889, 7194, 29889, 657, 877, 3488, 1495, 13, 1678, 1813, 353, 10203, 262, 1061, 29889, 657, 29918, 3488, 29898, 3488, 29918, 4537, 29897, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 2972, 29889, 1420, 742, 11117, 2972, 2396, 2318, 29892, 525, 3488, 2396, 1813, 1800, 13, 13, 13, 29992, 2798, 287, 13, 1753, 8722, 29898, 3827, 29892, 8952, 1125, 13, 1678, 4148, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 2659, 29892, 8952, 29922, 6786, 29897, 13, 1678, 11803, 353, 4148, 29889, 14080, 29889, 2622, 29918, 12817, 877, 2972, 2824, 29886, 999, 3486, 29918, 12817, 29898, 13, 4706, 525, 21032, 742, 525, 7406, 1495, 13, 1678, 10203, 262, 1061, 353, 349, 26584, 1061, 29898, 14080, 29892, 10203, 262, 1061, 29918, 12292, 29897, 13, 1678, 1813, 29918, 4537, 353, 2009, 29889, 7194, 29889, 657, 877, 3488, 1495, 13, 1678, 1813, 353, 10203, 262, 1061, 29889, 657, 29918, 3488, 29898, 3488, 29918, 4537, 29897, 13, 1678, 1494, 353, 6213, 13, 1678, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 29901, 13, 4706, 1494, 353, 4148, 29889, 23031, 292, 29889, 4572, 29898, 1792, 29922, 3827, 29889, 1792, 467, 9933, 580, 13, 1678, 3030, 353, 426, 13, 4706, 525, 8921, 2396, 4148, 29892, 13, 4706, 525, 3488, 2396, 1813, 29892, 13, 4706, 525, 23031, 292, 2396, 1494, 29892, 13, 1678, 500, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 10185, 29889, 1420, 742, 3030, 29897, 13, 13, 13, 29992, 2798, 287, 13, 1753, 1400, 29918, 1493, 29898, 3827, 29892, 8952, 29892, 1400, 29918, 333, 1125, 13, 1678, 1400, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 6747, 29892, 4148, 1649, 6786, 29922, 6786, 29892, 1178, 29922, 2490, 29918, 333, 29897, 13, 1678, 6589, 353, 1400, 29889, 21032, 29889, 2622, 29918, 12817, 877, 8921, 1495, 13, 1678, 4148, 353, 1400, 29889, 8921, 13, 1678, 883, 353, 461, 2500, 580, 13, 1678, 10377, 353, 679, 29918, 4645, 29918, 666, 29898, 3827, 29897, 13, 1678, 306, 29886, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 666, 29922, 666, 29897, 13, 1678, 1400, 29889, 7406, 29889, 1202, 29898, 29902, 29886, 29889, 12650, 29889, 657, 29898, 666, 29922, 666, 876, 13, 1678, 1494, 353, 6213, 13, 1678, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 29901, 13, 4706, 1494, 353, 4148, 29889, 23031, 292, 29889, 4572, 29898, 1792, 29922, 3827, 29889, 1792, 467, 9933, 580, 13, 1678, 3030, 353, 426, 13, 4706, 525, 8921, 2396, 4148, 29892, 13, 4706, 525, 2490, 2396, 1400, 29892, 13, 4706, 525, 689, 2396, 883, 29892, 13, 4706, 525, 21032, 2396, 6589, 29892, 13, 4706, 525, 23031, 292, 2396, 1494, 29892, 13, 1678, 500, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 2490, 29889, 1420, 742, 3030, 29897, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 788, 29918, 9342, 29898, 3827, 29892, 8952, 29892, 1400, 29918, 333, 1125, 13, 1678, 1400, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 6747, 29892, 4148, 1649, 6786, 29922, 6786, 29892, 1178, 29922, 2490, 29918, 333, 29897, 13, 1678, 883, 353, 461, 2500, 29898, 3827, 29889, 5438, 470, 6213, 29897, 13, 1678, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 4706, 3440, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 3440, 29889, 2490, 353, 1400, 13, 4706, 3440, 29889, 8921, 353, 2009, 29889, 1792, 13, 4706, 3440, 29889, 7620, 580, 13, 1678, 736, 6684, 877, 14080, 29901, 2490, 742, 8952, 29892, 1400, 29918, 333, 29897, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 716, 29918, 2490, 29898, 3827, 1125, 13, 1678, 883, 353, 4918, 2500, 29898, 3827, 29889, 5438, 470, 6213, 29892, 2066, 29922, 3827, 29889, 24483, 470, 6213, 29897, 13, 1678, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 4706, 1400, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 1400, 29889, 8921, 353, 2009, 29889, 1792, 13, 4706, 1400, 29889, 7620, 580, 13, 4706, 736, 6684, 877, 14080, 29901, 2248, 1495, 13, 1678, 3030, 353, 426, 13, 4706, 525, 6672, 2396, 525, 30032, 29904, 3102, 1221, 1413, 1077, 1668, 1210, 742, 13, 4706, 525, 7892, 29918, 726, 2396, 525, 30032, 29904, 3102, 1221, 1413, 742, 13, 4706, 525, 689, 2396, 883, 29892, 13, 1678, 500, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 1482, 29918, 2490, 29889, 1420, 742, 3030, 29897, 13, 13, 13, 1753, 1400, 29918, 5628, 29898, 3827, 29892, 8952, 29892, 1400, 29918, 333, 1125, 13, 1678, 565, 2009, 29889, 1792, 29889, 6786, 2804, 8952, 29901, 13, 4706, 736, 6684, 877, 14080, 29901, 2490, 742, 8952, 29892, 1400, 29918, 333, 29897, 13, 1678, 1400, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 6747, 29892, 4148, 1649, 6786, 29922, 6786, 29892, 1178, 29922, 2490, 29918, 333, 29897, 13, 1678, 565, 451, 1400, 29889, 275, 29918, 276, 1760, 368, 29918, 5467, 29901, 13, 4706, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 13, 1678, 883, 353, 4918, 2500, 29898, 13, 4706, 2009, 29889, 5438, 470, 6213, 29892, 2066, 29922, 3827, 29889, 24483, 470, 6213, 29892, 2777, 29922, 2490, 13, 1678, 1723, 13, 1678, 565, 883, 29889, 275, 29918, 3084, 7295, 13, 4706, 1400, 353, 883, 29889, 7620, 29898, 15060, 29922, 8824, 29897, 13, 4706, 1400, 29889, 7620, 580, 13, 4706, 736, 6684, 877, 14080, 29901, 2490, 742, 8952, 29892, 1400, 29918, 333, 29897, 13, 1678, 3030, 353, 426, 13, 4706, 525, 6672, 2396, 525, 30027, 29919, 840, 9054, 4962, 1413, 1077, 1668, 1210, 742, 13, 4706, 525, 7892, 29918, 726, 2396, 525, 30008, 29904, 15177, 507, 1413, 742, 13, 4706, 525, 689, 2396, 883, 29892, 13, 4706, 525, 2490, 2396, 1400, 29892, 13, 1678, 500, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 1482, 29918, 2490, 29889, 1420, 742, 3030, 29897, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 29992, 2798, 287, 13, 1753, 1101, 29918, 2248, 29898, 3827, 1125, 13, 1678, 11803, 353, 4918, 29889, 12650, 29889, 4572, 29898, 13, 4706, 4148, 1649, 23031, 292, 1649, 1792, 29922, 3827, 29889, 1792, 13, 1678, 13742, 2622, 29918, 12817, 877, 8921, 742, 525, 2972, 2824, 29886, 999, 3486, 29918, 12817, 877, 21032, 1495, 13, 1678, 10203, 262, 1061, 353, 349, 26584, 1061, 29898, 14080, 29892, 10203, 262, 1061, 29918, 12292, 29897, 13, 1678, 1813, 29918, 4537, 353, 2009, 29889, 7194, 29889, 657, 877, 3488, 1495, 13, 1678, 1813, 353, 10203, 262, 1061, 29889, 657, 29918, 3488, 29898, 3488, 29918, 4537, 29897, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 23031, 29889, 1420, 742, 11117, 3488, 2396, 1813, 1800, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 8722, 29918, 23031, 29898, 3827, 29892, 8952, 1125, 13, 1678, 565, 2009, 29889, 1792, 29889, 6786, 1275, 8952, 29901, 13, 4706, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 13, 1678, 4148, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 2659, 29892, 8952, 29922, 6786, 29897, 13, 1678, 10306, 29889, 12650, 29889, 657, 29918, 272, 29918, 3258, 29898, 1792, 29922, 3827, 29889, 1792, 29892, 4148, 29922, 8921, 29897, 13, 1678, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 8722, 29918, 348, 23031, 29898, 3827, 29892, 8952, 1125, 13, 1678, 4148, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 2659, 29892, 8952, 29922, 6786, 29897, 13, 1678, 10306, 29889, 12650, 29889, 4572, 29898, 1792, 29922, 3827, 29889, 1792, 29892, 4148, 29922, 8921, 467, 8143, 580, 13, 1678, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 13, 13, 13, 29992, 7507, 29918, 12403, 13, 1753, 1400, 29918, 8143, 29898, 3827, 29892, 8952, 29892, 1400, 29918, 333, 1125, 13, 1678, 565, 2009, 29889, 1792, 29889, 6786, 2804, 8952, 29901, 13, 4706, 736, 6684, 877, 14080, 29901, 2490, 742, 8952, 29892, 1400, 29918, 333, 29897, 13, 1678, 1400, 353, 679, 29918, 3318, 29918, 272, 29918, 29946, 29900, 29946, 29898, 6747, 29892, 4148, 1649, 6786, 29922, 6786, 29892, 1178, 29922, 2490, 29918, 333, 29897, 13, 1678, 1400, 29889, 8143, 580, 13, 1678, 736, 9056, 5103, 24735, 29898, 3827, 29889, 2303, 6040, 29889, 657, 877, 10493, 29918, 25866, 1001, 1001, 8785, 13, 13, 13, 1753, 1813, 29918, 1333, 29918, 11940, 29898, 3827, 29892, 3682, 1125, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 29885, 10669, 29914, 29946, 29900, 29946, 29889, 1420, 742, 11117, 2084, 2396, 2009, 29889, 2084, 1118, 4660, 29922, 29946, 29900, 29946, 29897, 13, 13, 13, 1753, 1923, 29918, 2704, 29898, 3827, 1125, 13, 1678, 736, 4050, 29898, 3827, 29892, 525, 29885, 10669, 29914, 29945, 29900, 29900, 29889, 1420, 742, 4660, 29922, 29945, 29900, 29900, 29897, 13, 2 ]
app/controllers/web/admin/dashboard.py
Clivern/Kraven
3
1612842
""" Dashboard Web Controller """ # standard library import os # Django from django.views import View from django.shortcuts import render from django.utils.translation import gettext as _ # local Django from app.modules.core.context import Context from app.modules.core.decorators import login_if_not_authenticated class Dashboard(View): template_name = 'templates/admin/dashboard.html' __context = Context() @login_if_not_authenticated def get(self, request): self.__context.autoload_options() self.__context.autoload_user(request.user.id if request.user.is_authenticated else None) self.__context.push({ "page_title": _("Dashboard · %s") % self.__context.get("app_name", os.getenv("APP_NAME", "Kraven")) }) return render(request, self.template_name, self.__context.get())
[ 1, 9995, 13, 29928, 1161, 3377, 2563, 15830, 13, 15945, 29908, 13, 13, 29937, 3918, 3489, 13, 5215, 2897, 13, 13, 29937, 15337, 13, 3166, 9557, 29889, 7406, 1053, 4533, 13, 3166, 9557, 29889, 12759, 7582, 29879, 1053, 4050, 13, 3166, 9557, 29889, 13239, 29889, 3286, 18411, 1053, 679, 726, 408, 903, 13, 13, 29937, 1887, 15337, 13, 3166, 623, 29889, 7576, 29889, 3221, 29889, 4703, 1053, 15228, 13, 3166, 623, 29889, 7576, 29889, 3221, 29889, 19557, 4097, 1053, 6464, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 13, 13, 1990, 360, 1161, 3377, 29898, 1043, 1125, 13, 13, 1678, 4472, 29918, 978, 353, 525, 20943, 29914, 6406, 29914, 14592, 3377, 29889, 1420, 29915, 13, 1678, 4770, 4703, 353, 15228, 580, 13, 13, 1678, 732, 7507, 29918, 361, 29918, 1333, 29918, 27218, 630, 13, 1678, 822, 679, 29898, 1311, 29892, 2009, 1125, 13, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 6768, 580, 13, 4706, 1583, 17255, 4703, 29889, 1300, 3543, 328, 29918, 1792, 29898, 3827, 29889, 1792, 29889, 333, 565, 2009, 29889, 1792, 29889, 275, 29918, 27218, 630, 1683, 6213, 29897, 13, 4706, 1583, 17255, 4703, 29889, 5910, 3319, 13, 9651, 376, 3488, 29918, 3257, 1115, 903, 703, 29928, 1161, 3377, 2880, 1273, 29879, 1159, 1273, 1583, 17255, 4703, 29889, 657, 703, 932, 29918, 978, 613, 2897, 29889, 657, 6272, 703, 20576, 29918, 5813, 613, 376, 29968, 336, 854, 5783, 13, 4706, 5615, 13, 13, 4706, 736, 4050, 29898, 3827, 29892, 1583, 29889, 6886, 29918, 978, 29892, 1583, 17255, 4703, 29889, 657, 3101, 13, 2 ]
Integrator.py
ganesh-cc/ticket_update
0
112320
import endpointGenerator import freshdeskService import processData import slackService from collections import defaultdict fd = defaultdict(list) def integrator_func(team): tag = endpointGenerator.url_generator_multiple(team) global fd for k,v in tag.items(): fd.clear() print('\n' + '\n' +'\n' +k) if k == "closed": fd = freshdeskService.trigger_filter(v) if fd != 0: fd = processData.dataMapper(fd) else: fd = freshdeskService.trigger(v) if fd != 0: fd = processData.dataMapper(fd) #slackService.post_slack(team, k, str(fd)) print(team, k, fd)
[ 1, 29871, 13, 5215, 16248, 21575, 13, 5215, 10849, 2783, 29895, 3170, 13, 5215, 1889, 1469, 13, 5215, 269, 2364, 3170, 13, 3166, 16250, 1053, 2322, 8977, 13, 13, 11512, 353, 2322, 8977, 29898, 1761, 29897, 13, 13, 1753, 3990, 1061, 29918, 9891, 29898, 14318, 1125, 13, 12, 4039, 353, 16248, 21575, 29889, 2271, 29918, 27959, 29918, 20787, 29898, 14318, 29897, 13, 12, 10945, 285, 29881, 13, 12, 1454, 413, 29892, 29894, 297, 4055, 29889, 7076, 7295, 13, 12, 12, 11512, 29889, 8551, 580, 13, 12, 12, 2158, 28909, 29876, 29915, 718, 11297, 29876, 29915, 718, 12764, 29876, 29915, 718, 29895, 29897, 13, 12, 12, 361, 413, 1275, 376, 15603, 1115, 13, 12, 12, 12, 11512, 353, 10849, 2783, 29895, 3170, 29889, 21001, 29918, 4572, 29898, 29894, 29897, 13, 12, 12, 12, 361, 285, 29881, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 12, 11512, 353, 1889, 1469, 29889, 1272, 19968, 29898, 11512, 29897, 13, 12, 12, 2870, 29901, 13, 12, 12, 12, 11512, 353, 10849, 2783, 29895, 3170, 29889, 21001, 29898, 29894, 29897, 13, 12, 12, 12, 361, 285, 29881, 2804, 29871, 29900, 29901, 13, 12, 12, 12, 12, 11512, 353, 1889, 1469, 29889, 1272, 19968, 29898, 11512, 29897, 13, 12, 12, 29937, 29879, 2364, 3170, 29889, 2490, 29918, 29879, 2364, 29898, 14318, 29892, 413, 29892, 851, 29898, 11512, 876, 13, 12, 12, 2158, 29898, 14318, 29892, 413, 29892, 285, 29881, 29897, 13, 13, 2 ]
src/get/download_nino34.py
jdossgollin/2018-paraguay-floods
2
1607353
<filename>src/get/download_nino34.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Download raw NINO 3.4 data from http://iridl.ldeo.columbia.edu/SOURCES/.Indices/.nino/.EXTENDED/.NINO34 and parse it """ import argparse import os import pandas as pd import numpy as np from datetime import datetime parser = argparse.ArgumentParser() # pylint: disable=C0103 parser.add_argument("--syear", help="the first year to retain") parser.add_argument("--eyear", help="the last year to retain") parser.add_argument("--outfile", help="the filename of the data to save") def download_data(sdate, edate, outfile): """Load in the NINO 3.4 Data """ url = "http://iridl.ldeo.columbia.edu/SOURCES/.Indices/.nino/.EXTENDED/.NINO34/gridtable.tsv" col_name = "nino_34" nino_34 = pd.read_table( url, delim_whitespace=True, index_col=None, skiprows=2, names=["time", "{}".format(col_name)], ) # the times don't make sense, parse them in nino_34["time"] = np.int_(np.floor(nino_34["time"])) nino_34["year"] = 1960 + nino_34["time"] // 12 nino_34["month"] = 1 + nino_34["time"] % 12 nino_34["day"] = 1 nino_34["time"] = pd.to_datetime(nino_34[["year", "month", "day"]]) nino_34.set_index("time", inplace=True) nino_34 = nino_34[["{}".format(col_name)]] nino_34 = nino_34.loc[sdate:edate] nino_34 = nino_34.to_xarray() # save to file if os.path.isfile(outfile): os.remove(outfile) nino_34.to_netcdf(outfile, format="NETCDF4", mode="w") def main(): """Parse the command line arguments and run download_data(). """ args = parser.parse_args() outfile = os.path.abspath(args.outfile) sdate = datetime(int(args.syear), 1, 1) edate = datetime(int(args.eyear), 12, 31) download_data(sdate=sdate, edate=edate, outfile=outfile) if __name__ == "__main__": main()
[ 1, 529, 9507, 29958, 4351, 29914, 657, 29914, 10382, 29918, 29876, 1789, 29941, 29946, 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, 15945, 29908, 22954, 10650, 405, 1177, 29949, 29871, 29941, 29889, 29946, 29871, 848, 515, 13, 1124, 597, 381, 333, 29880, 29889, 29880, 311, 29877, 29889, 1054, 3774, 423, 29889, 6085, 29914, 27839, 27266, 6294, 2568, 1575, 6294, 29876, 1789, 6294, 12194, 1430, 2287, 29928, 6294, 29940, 1177, 29949, 29941, 29946, 13, 392, 6088, 372, 13, 15945, 29908, 13, 13, 5215, 1852, 5510, 13, 5215, 2897, 13, 5215, 11701, 408, 10518, 13, 5215, 12655, 408, 7442, 13, 3166, 12865, 1053, 12865, 13, 13, 16680, 353, 1852, 5510, 29889, 15730, 11726, 580, 29871, 396, 282, 2904, 524, 29901, 11262, 29922, 29907, 29900, 29896, 29900, 29941, 13, 16680, 29889, 1202, 29918, 23516, 703, 489, 29879, 6360, 613, 1371, 543, 1552, 937, 1629, 304, 11551, 1159, 13, 16680, 29889, 1202, 29918, 23516, 703, 489, 1032, 799, 613, 1371, 543, 1552, 1833, 1629, 304, 11551, 1159, 13, 16680, 29889, 1202, 29918, 23516, 703, 489, 449, 1445, 613, 1371, 543, 1552, 10422, 310, 278, 848, 304, 4078, 1159, 13, 13, 13, 1753, 5142, 29918, 1272, 29898, 29879, 1256, 29892, 1226, 403, 29892, 714, 1445, 1125, 13, 1678, 9995, 5896, 297, 278, 405, 1177, 29949, 29871, 29941, 29889, 29946, 3630, 13, 1678, 9995, 13, 1678, 3142, 353, 376, 1124, 597, 381, 333, 29880, 29889, 29880, 311, 29877, 29889, 1054, 3774, 423, 29889, 6085, 29914, 27839, 27266, 6294, 2568, 1575, 6294, 29876, 1789, 6294, 12194, 1430, 2287, 29928, 6294, 29940, 1177, 29949, 29941, 29946, 29914, 7720, 2371, 29889, 1372, 29894, 29908, 13, 1678, 784, 29918, 978, 353, 376, 29876, 1789, 29918, 29941, 29946, 29908, 13, 1678, 302, 1789, 29918, 29941, 29946, 353, 10518, 29889, 949, 29918, 2371, 29898, 13, 4706, 3142, 29892, 13, 4706, 628, 326, 29918, 1332, 3246, 3535, 29922, 5574, 29892, 13, 4706, 2380, 29918, 1054, 29922, 8516, 29892, 13, 4706, 14383, 5727, 29922, 29906, 29892, 13, 4706, 2983, 29922, 3366, 2230, 613, 376, 8875, 1642, 4830, 29898, 1054, 29918, 978, 29897, 1402, 13, 1678, 1723, 13, 13, 1678, 396, 278, 3064, 1016, 29915, 29873, 1207, 4060, 29892, 6088, 963, 297, 13, 1678, 302, 1789, 29918, 29941, 29946, 3366, 2230, 3108, 353, 7442, 29889, 524, 23538, 9302, 29889, 14939, 29898, 29876, 1789, 29918, 29941, 29946, 3366, 2230, 3108, 876, 13, 1678, 302, 1789, 29918, 29941, 29946, 3366, 6360, 3108, 353, 29871, 29896, 29929, 29953, 29900, 718, 302, 1789, 29918, 29941, 29946, 3366, 2230, 3108, 849, 29871, 29896, 29906, 13, 1678, 302, 1789, 29918, 29941, 29946, 3366, 10874, 3108, 353, 29871, 29896, 718, 302, 1789, 29918, 29941, 29946, 3366, 2230, 3108, 1273, 29871, 29896, 29906, 13, 1678, 302, 1789, 29918, 29941, 29946, 3366, 3250, 3108, 353, 29871, 29896, 13, 1678, 302, 1789, 29918, 29941, 29946, 3366, 2230, 3108, 353, 10518, 29889, 517, 29918, 12673, 29898, 29876, 1789, 29918, 29941, 29946, 29961, 3366, 6360, 613, 376, 10874, 613, 376, 3250, 3108, 2314, 13, 1678, 302, 1789, 29918, 29941, 29946, 29889, 842, 29918, 2248, 703, 2230, 613, 297, 6689, 29922, 5574, 29897, 13, 1678, 302, 1789, 29918, 29941, 29946, 353, 302, 1789, 29918, 29941, 29946, 29961, 3366, 8875, 1642, 4830, 29898, 1054, 29918, 978, 4638, 29962, 13, 1678, 302, 1789, 29918, 29941, 29946, 353, 302, 1789, 29918, 29941, 29946, 29889, 2029, 29961, 29879, 1256, 29901, 287, 403, 29962, 13, 1678, 302, 1789, 29918, 29941, 29946, 353, 302, 1789, 29918, 29941, 29946, 29889, 517, 29918, 29916, 2378, 580, 13, 13, 1678, 396, 4078, 304, 934, 13, 1678, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 449, 1445, 1125, 13, 4706, 2897, 29889, 5992, 29898, 449, 1445, 29897, 13, 1678, 302, 1789, 29918, 29941, 29946, 29889, 517, 29918, 1212, 29883, 2176, 29898, 449, 1445, 29892, 3402, 543, 6006, 29907, 4037, 29946, 613, 4464, 543, 29893, 1159, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 9995, 12914, 278, 1899, 1196, 6273, 322, 1065, 5142, 29918, 1272, 2141, 13, 1678, 9995, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 1678, 714, 1445, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 5085, 29889, 449, 1445, 29897, 13, 1678, 269, 1256, 353, 12865, 29898, 524, 29898, 5085, 29889, 29879, 6360, 511, 29871, 29896, 29892, 29871, 29896, 29897, 13, 1678, 1226, 403, 353, 12865, 29898, 524, 29898, 5085, 29889, 1032, 799, 511, 29871, 29896, 29906, 29892, 29871, 29941, 29896, 29897, 13, 1678, 5142, 29918, 1272, 29898, 29879, 1256, 29922, 29879, 1256, 29892, 1226, 403, 29922, 287, 403, 29892, 714, 1445, 29922, 449, 1445, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 1667, 580, 13, 2 ]
nnet/run/srl/run.py
SaidehNK/sr
193
178992
from nnet.models.srl import * from nnet.run.runner import * from nnet.ml.voc import * from nnet.run.srl.run import * from nnet.run.srl.util import * from nnet.run.srl.decoder import * from functools import partial from nnet.run.srl.read_dependency import get_adj import nnet.run.srl.conll09_evaluation.eval def make_local_voc(labels): return {i: label for i, label in enumerate(labels)} def bio_reader(record): dbg_header, sent, pos_tags, dep_parsing, degree, frame, target, f_lemmas, f_targets, labels_voc, labels = record.split( '\t') labels_voc = labels_voc.split(' ') frame = [frame] * len(labels_voc) words = [] for word in sent.split(' '): words.append(word) pos_tags = pos_tags.split(' ') labels = labels.split(' ') assert (len(words) == len(labels)) local_voc = {v: k for k, v in make_local_voc(labels_voc).items()} labels = [local_voc[label] for label in labels] dep_parsing = dep_parsing.split() dep_parsing = [p.split('|') for p in dep_parsing] dep_parsing = [(p[0], int(p[1]), int(p[2])) for p in dep_parsing] f_lemmas = f_lemmas.split(' ') f_targets = f_targets.split(' ') return dbg_header, words, pos_tags, dep_parsing, np.int32(degree), frame, \ np.int32(target), f_lemmas, np.int32(f_targets), labels_voc, labels class BioSrlErrorComputer: def __init__(self, converter, do_labeling, data_partition, eval_dir): self.converter = converter self.do_labeling = do_labeling self.data_partition = data_partition self.labels1 = [] self.labels2 = [] self.predictions = [] self.eval_dir = eval_dir self.do_eval = nnet.run.srl.conll09_evaluation.eval.do_eval def pprint(self, record, voc, predictions, true_labels): n = 2 sent = record[1] predictions = [p[:len(voc.items())] for p in predictions.tolist()] predictions = predictions[:len(sent)] constraints = [] best_labeling = constrained_decoder(voc, predictions, 100, constraints) info = list() for word, prediction, true_label, best in zip(sent, predictions, true_labels, best_labeling): nbest = sorted(range(len(prediction)), key=lambda x: -prediction[x]) nbest = nbest[:n] probs = [prediction[l] for l in nbest] labels = [voc[label] for label in nbest if label in voc] labels = ' '.join(labels) info.append((word, labels, probs, voc[true_label], best)) return info def compute(self, model, batch): errors, errors_w = 0, 0.0 record_ids, batch = zip(*batch) model.test_mode_on() model_input = self.converter(batch) sent, \ p_sent, \ pos_tags,\ sent_mask, \ targets, \ frames, \ labels_voc, \ labels_voc_mask, \ freq, \ region_mark, sent_pred_lemmas_idx, \ adj_arcs_in, adj_arcs_out, adj_lab_in, adj_lab_out, \ mask_in, mask_out, mask_loop, \ true_labels \ = model_input predictions = model.predict(*model_input[:-1]) labels = np.argmax(predictions, axis=1) labels = np.reshape(labels, sent.shape) predictions = np.reshape(predictions, (sent.shape[0], sent.shape[1], labels_voc.shape[1])) for i, sent_labels in enumerate(labels): labels_voc = batch[i][-2] local_voc = make_local_voc(labels_voc) info = self.pprint(batch[i], local_voc, predictions[i], true_labels[i]) self.labels1.append([x[4] for x in info]) self.labels2.append([x[3] for x in info]) if self.do_labeling: sentence = [] for word, label, probs, true, best in info: single_pred = "%10s\t%10s\t%20s\t%40s\t%10s\t%10s\t%10s" % ( word, best, label, probs, true, batch[i][4], batch[i][3][0]) sentence.append( (word, best, label, probs, true, batch[i][4], batch[i][3][0])) print(single_pred) print('\n') self.predictions.append(sentence) else: sentence = [] for word, label, probs, true, best in info: sentence.append( (word, best, label, probs, true, batch[i][4], batch[i][3][0])) self.predictions.append(sentence) for word, label, probs, true, best in info: if true != best: errors += 1 errors_w += 1 / len(info) loss = np.sum(model.compute_loss(*model_input)) model.test_mode_off() return errors, errors, errors_w def final(self): if self.do_eval: results = self.do_eval(self.data_partition, self.predictions, self.eval_dir) else: evaluate(self.labels1, self.labels2) self.predictions = [] self.labels1, self.labels2 = [], [] return results[2] class SRLRunner(Runner): def __init__(self): super(SRLRunner, self).__init__() self.word_voc = create_voc('file', self.a.word_voc) self.word_voc.add_unks() self.freq_voc = frequency_voc(self.a.freq_voc) self.p_word_voc = create_voc('file', self.a.p_word_voc) self.p_word_voc.add_unks() self.role_voc = create_voc('file', self.a.role_voc) self.frame_voc = create_voc('file', self.a.frame_voc) self.pos_voc = create_voc('file', self.a.pos_voc) def add_special_args(self, parser): parser.add_argument( "--word-voc", required=True) parser.add_argument( "--p-word-voc", required=True) parser.add_argument( "--freq-voc", required=True) parser.add_argument( "--role-voc", required=True) parser.add_argument( "--frame-voc", required=True) parser.add_argument( "--pos-voc", required=True ) parser.add_argument( "--word-embeddings", required=True ) parser.add_argument( "--data_partition", required=True ) parser.add_argument( "--hps", help="model hyperparams", required=False ) parser.add_argument( "--eval-dir", help="path to dir with eval data and scripts", required=True ) def get_parser(self): return partial(bio_reader) def get_reader(self): return simple_reader def get_converter(self): def bio_converter(batch): headers, sent_, pos_tags, dep_parsing, degree, frames, \ targets, f_lemmas, f_targets, labels_voc, labels = list( zip(*batch)) sent = [self.word_voc.vocalize(w) for w in sent_] p_sent = [self.p_word_voc.vocalize(w) for w in sent_] freq = [[self.freq_voc[self.word_voc.direct[i]] if self.word_voc.direct[i] != '_UNK' else 0 for i in w] for w in sent] pos_tags = [self.pos_voc.vocalize(w) for w in pos_tags] frames = [self.frame_voc.vocalize(f) for f in frames] labels_voc = [self.role_voc.vocalize(r) for r in labels_voc] lemmas_idx = [self.frame_voc.vocalize(f) for f in f_lemmas] adj_arcs_in, adj_arcs_out, adj_lab_in, adj_lab_out, \ mask_in, mask_out, mask_loop = get_adj(dep_parsing, degree) sent_batch, sent_mask = mask_batch(sent) p_sent_batch, _ = mask_batch(p_sent) freq_batch, _ = mask_batch(freq) freq_batch = freq_batch.astype(dtype='float32') pos_batch, _ = mask_batch(pos_tags) labels_voc_batch, labels_voc_mask = mask_batch(labels_voc) labels_batch, _ = mask_batch(labels) frames_batch, _ = mask_batch(frames) region_mark = np.zeros(sent_batch.shape, dtype='float32') hps = eval(self.a.hps) rm = hps['rm'] if rm >= 0: for r, row in enumerate(region_mark): for c, column in enumerate(row): if targets[r] - rm <= c <= targets[r] + rm: region_mark[r][c] = 1 sent_pred_lemmas_idx = np.zeros(sent_batch.shape, dtype='int32') for r, row in enumerate(sent_pred_lemmas_idx): for c, column in enumerate(row): for t, tar in enumerate(f_targets[r]): if tar == c: sent_pred_lemmas_idx[r][c] = lemmas_idx[r][t] sent_pred_lemmas_idx = np.array(sent_pred_lemmas_idx, dtype='int32') assert (sent_batch.shape == sent_mask.shape) assert ( frames_batch.shape == labels_voc_batch.shape == labels_voc_mask.shape) assert (labels_batch.shape == sent_batch.shape) return sent_batch, p_sent_batch, pos_batch, sent_mask, targets, frames_batch, \ labels_voc_batch, \ labels_voc_mask, freq_batch, \ region_mark, \ sent_pred_lemmas_idx,\ adj_arcs_in, adj_arcs_out, adj_lab_in, adj_lab_out, \ mask_in, mask_out, mask_loop, \ labels_batch return bio_converter def get_tester(self): converter = self.get_converter() computer = BioSrlErrorComputer( converter, self.a.test_only, self.a.data_partition, self.a.eval_dir) corpus = Corpus( parser=partial(bio_reader), batch_size=self.a.batch, path=self.a.test, reader=self.get_reader() ) return ErrorRateTester(computer, self.a.out, corpus) def load_model(self): hps = eval(self.a.hps) hps['vframe'] = self.frame_voc.size() hps['vword'] = self.word_voc.size() hps['vbio'] = self.role_voc.size() hps['vpos'] = self.pos_voc.size() hps['word_embeddings'] = parse_word_embeddings(self.a.word_embeddings) hps['in_arcs']=True hps['out_arcs']=True return BioSRL(hps) if __name__ == '__main__': SRLRunner().run()
[ 1, 515, 302, 1212, 29889, 9794, 29889, 29879, 2096, 1053, 334, 13, 3166, 302, 1212, 29889, 3389, 29889, 27492, 1053, 334, 13, 3166, 302, 1212, 29889, 828, 29889, 29894, 542, 1053, 334, 13, 3166, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 3389, 1053, 334, 13, 3166, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 4422, 1053, 334, 13, 3166, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 7099, 6119, 1053, 334, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 13, 3166, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 949, 29918, 10836, 1053, 679, 29918, 26859, 13, 5215, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 535, 645, 29900, 29929, 29918, 24219, 362, 29889, 14513, 13, 13, 13, 1753, 1207, 29918, 2997, 29918, 29894, 542, 29898, 21134, 1125, 13, 1678, 736, 426, 29875, 29901, 3858, 363, 474, 29892, 3858, 297, 26985, 29898, 21134, 2915, 13, 13, 13, 1753, 17799, 29918, 16950, 29898, 11651, 1125, 13, 1678, 4833, 29887, 29918, 6672, 29892, 2665, 29892, 926, 29918, 11338, 29892, 1401, 29918, 862, 2976, 29892, 7426, 29892, 3515, 29892, 3646, 29892, 285, 29918, 2409, 8247, 29892, 285, 29918, 5182, 29879, 29892, 11073, 29918, 29894, 542, 29892, 11073, 353, 2407, 29889, 5451, 29898, 13, 4706, 11297, 29873, 1495, 13, 1678, 11073, 29918, 29894, 542, 353, 11073, 29918, 29894, 542, 29889, 5451, 877, 25710, 13, 13, 1678, 3515, 353, 518, 2557, 29962, 334, 7431, 29898, 21134, 29918, 29894, 542, 29897, 13, 1678, 3838, 353, 5159, 13, 1678, 363, 1734, 297, 2665, 29889, 5451, 877, 525, 1125, 13, 4706, 3838, 29889, 4397, 29898, 1742, 29897, 13, 308, 13, 13, 1678, 926, 29918, 11338, 353, 926, 29918, 11338, 29889, 5451, 877, 25710, 13, 1678, 11073, 353, 11073, 29889, 5451, 877, 25710, 13, 13, 1678, 4974, 313, 2435, 29898, 9303, 29897, 1275, 7431, 29898, 21134, 876, 13, 13, 1678, 1887, 29918, 29894, 542, 353, 426, 29894, 29901, 413, 363, 413, 29892, 325, 297, 1207, 29918, 2997, 29918, 29894, 542, 29898, 21134, 29918, 29894, 542, 467, 7076, 28296, 13, 1678, 11073, 353, 518, 2997, 29918, 29894, 542, 29961, 1643, 29962, 363, 3858, 297, 11073, 29962, 13, 13, 1678, 1401, 29918, 862, 2976, 353, 1401, 29918, 862, 2976, 29889, 5451, 580, 13, 1678, 1401, 29918, 862, 2976, 353, 518, 29886, 29889, 5451, 877, 29989, 1495, 363, 282, 297, 1401, 29918, 862, 2976, 29962, 13, 1678, 1401, 29918, 862, 2976, 353, 17288, 29886, 29961, 29900, 1402, 938, 29898, 29886, 29961, 29896, 11724, 938, 29898, 29886, 29961, 29906, 12622, 363, 282, 297, 1401, 29918, 862, 2976, 29962, 13, 13, 1678, 285, 29918, 2409, 8247, 353, 285, 29918, 2409, 8247, 29889, 5451, 877, 25710, 13, 1678, 285, 29918, 5182, 29879, 353, 285, 29918, 5182, 29879, 29889, 5451, 877, 25710, 13, 1678, 736, 4833, 29887, 29918, 6672, 29892, 3838, 29892, 926, 29918, 11338, 29892, 1401, 29918, 862, 2976, 29892, 7442, 29889, 524, 29941, 29906, 29898, 12163, 929, 511, 3515, 29892, 320, 13, 965, 7442, 29889, 524, 29941, 29906, 29898, 5182, 511, 285, 29918, 2409, 8247, 29892, 7442, 29889, 524, 29941, 29906, 29898, 29888, 29918, 5182, 29879, 511, 11073, 29918, 29894, 542, 29892, 11073, 13, 13, 13, 1990, 21184, 29903, 2096, 2392, 20606, 261, 29901, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 29105, 29892, 437, 29918, 1643, 292, 29892, 848, 29918, 16707, 29892, 13, 462, 19745, 29918, 3972, 1125, 13, 4706, 1583, 29889, 535, 13549, 353, 29105, 13, 4706, 1583, 29889, 1867, 29918, 1643, 292, 353, 437, 29918, 1643, 292, 13, 4706, 1583, 29889, 1272, 29918, 16707, 353, 848, 29918, 16707, 13, 4706, 1583, 29889, 21134, 29896, 353, 5159, 13, 4706, 1583, 29889, 21134, 29906, 353, 5159, 13, 4706, 1583, 29889, 27711, 1080, 353, 5159, 13, 4706, 1583, 29889, 14513, 29918, 3972, 353, 19745, 29918, 3972, 13, 13, 4706, 1583, 29889, 1867, 29918, 14513, 353, 302, 1212, 29889, 3389, 29889, 29879, 2096, 29889, 535, 645, 29900, 29929, 29918, 24219, 362, 29889, 14513, 29889, 1867, 29918, 14513, 13, 13, 13, 1678, 822, 282, 2158, 29898, 1311, 29892, 2407, 29892, 7931, 29892, 27303, 29892, 1565, 29918, 21134, 1125, 13, 4706, 302, 353, 29871, 29906, 13, 13, 4706, 2665, 353, 2407, 29961, 29896, 29962, 13, 13, 4706, 27303, 353, 518, 29886, 7503, 2435, 29898, 29894, 542, 29889, 7076, 3101, 29962, 363, 282, 297, 27303, 29889, 25027, 391, 580, 29962, 13, 4706, 27303, 353, 27303, 7503, 2435, 29898, 18616, 4638, 13, 13, 4706, 11938, 353, 5159, 13, 13, 4706, 1900, 29918, 1643, 292, 353, 1040, 22042, 29918, 7099, 6119, 29898, 29894, 542, 29892, 27303, 29892, 29871, 29896, 29900, 29900, 29892, 11938, 29897, 13, 4706, 5235, 353, 1051, 580, 13, 13, 4706, 363, 1734, 29892, 18988, 29892, 1565, 29918, 1643, 29892, 1900, 297, 14319, 29898, 18616, 29892, 27303, 29892, 13, 462, 462, 462, 418, 1565, 29918, 21134, 29892, 13, 462, 462, 462, 418, 1900, 29918, 1643, 292, 1125, 13, 9651, 302, 13318, 353, 12705, 29898, 3881, 29898, 2435, 29898, 11965, 2463, 8243, 13, 462, 965, 1820, 29922, 2892, 921, 29901, 448, 11965, 2463, 29961, 29916, 2314, 13, 13, 9651, 302, 13318, 353, 302, 13318, 7503, 29876, 29962, 13, 9651, 2070, 29879, 353, 518, 11965, 2463, 29961, 29880, 29962, 363, 301, 297, 302, 13318, 29962, 13, 13, 9651, 11073, 353, 518, 29894, 542, 29961, 1643, 29962, 363, 3858, 297, 302, 13318, 565, 3858, 297, 7931, 29962, 13, 9651, 11073, 353, 525, 15300, 7122, 29898, 21134, 29897, 13, 13, 9651, 5235, 29889, 4397, 3552, 1742, 29892, 11073, 29892, 2070, 29879, 29892, 7931, 29961, 3009, 29918, 1643, 1402, 1900, 876, 13, 13, 4706, 736, 5235, 13, 13, 1678, 822, 10272, 29898, 1311, 29892, 1904, 29892, 9853, 1125, 13, 4706, 4436, 29892, 4436, 29918, 29893, 353, 29871, 29900, 29892, 29871, 29900, 29889, 29900, 13, 4706, 2407, 29918, 4841, 29892, 9853, 353, 14319, 10456, 16175, 29897, 13, 13, 4706, 1904, 29889, 1688, 29918, 8513, 29918, 265, 580, 13, 13, 4706, 1904, 29918, 2080, 353, 1583, 29889, 535, 13549, 29898, 16175, 29897, 13, 13, 4706, 2665, 29892, 320, 13, 4706, 282, 29918, 18616, 29892, 320, 13, 4706, 926, 29918, 11338, 2053, 13, 4706, 2665, 29918, 13168, 29892, 320, 13, 4706, 22525, 29892, 320, 13, 4706, 16608, 29892, 320, 13, 4706, 11073, 29918, 29894, 542, 29892, 320, 13, 4706, 11073, 29918, 29894, 542, 29918, 13168, 29892, 320, 13, 4706, 3005, 29939, 29892, 320, 13, 4706, 5120, 29918, 3502, 29892, 2665, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 29892, 320, 13, 4706, 12109, 29918, 279, 2395, 29918, 262, 29892, 12109, 29918, 279, 2395, 29918, 449, 29892, 12109, 29918, 8205, 29918, 262, 29892, 12109, 29918, 8205, 29918, 449, 29892, 320, 13, 4706, 11105, 29918, 262, 29892, 11105, 29918, 449, 29892, 11105, 29918, 7888, 29892, 320, 13, 4706, 1565, 29918, 21134, 320, 13, 9651, 353, 1904, 29918, 2080, 13, 13, 4706, 27303, 353, 1904, 29889, 27711, 10456, 4299, 29918, 2080, 7503, 29899, 29896, 2314, 13, 13, 4706, 11073, 353, 7442, 29889, 1191, 3317, 29898, 27711, 1080, 29892, 9685, 29922, 29896, 29897, 13, 4706, 11073, 353, 7442, 29889, 690, 14443, 29898, 21134, 29892, 2665, 29889, 12181, 29897, 13, 13, 4706, 27303, 353, 7442, 29889, 690, 14443, 29898, 27711, 1080, 29892, 13, 462, 462, 313, 18616, 29889, 12181, 29961, 29900, 1402, 2665, 29889, 12181, 29961, 29896, 1402, 13, 462, 462, 29871, 11073, 29918, 29894, 542, 29889, 12181, 29961, 29896, 12622, 13, 13, 4706, 363, 474, 29892, 2665, 29918, 21134, 297, 26985, 29898, 21134, 1125, 13, 9651, 11073, 29918, 29894, 542, 353, 9853, 29961, 29875, 3816, 29899, 29906, 29962, 13, 9651, 1887, 29918, 29894, 542, 353, 1207, 29918, 2997, 29918, 29894, 542, 29898, 21134, 29918, 29894, 542, 29897, 13, 9651, 5235, 353, 1583, 29889, 407, 29878, 524, 29898, 16175, 29961, 29875, 1402, 1887, 29918, 29894, 542, 29892, 27303, 29961, 29875, 1402, 13, 462, 1669, 1565, 29918, 21134, 29961, 29875, 2314, 13, 13, 9651, 1583, 29889, 21134, 29896, 29889, 4397, 4197, 29916, 29961, 29946, 29962, 363, 921, 297, 5235, 2314, 13, 9651, 1583, 29889, 21134, 29906, 29889, 4397, 4197, 29916, 29961, 29941, 29962, 363, 921, 297, 5235, 2314, 13, 13, 9651, 565, 1583, 29889, 1867, 29918, 1643, 292, 29901, 13, 18884, 10541, 353, 5159, 13, 18884, 363, 1734, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 1900, 297, 5235, 29901, 13, 462, 1678, 2323, 29918, 11965, 353, 11860, 29896, 29900, 29879, 29905, 29873, 29995, 29896, 29900, 29879, 29905, 29873, 29995, 29906, 29900, 29879, 29905, 29873, 29995, 29946, 29900, 29879, 29905, 29873, 29995, 29896, 29900, 29879, 29905, 29873, 29995, 29896, 29900, 29879, 29905, 29873, 29995, 29896, 29900, 29879, 29908, 1273, 313, 13, 462, 4706, 1734, 29892, 1900, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 9853, 29961, 29875, 3816, 29946, 1402, 13, 462, 4706, 9853, 29961, 29875, 3816, 29941, 3816, 29900, 2314, 13, 462, 1678, 10541, 29889, 4397, 29898, 13, 462, 4706, 313, 1742, 29892, 1900, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 9853, 29961, 29875, 3816, 29946, 1402, 13, 462, 308, 9853, 29961, 29875, 3816, 29941, 3816, 29900, 12622, 13, 462, 1678, 1596, 29898, 14369, 29918, 11965, 29897, 13, 18884, 1596, 28909, 29876, 1495, 13, 18884, 1583, 29889, 27711, 1080, 29889, 4397, 29898, 18616, 663, 29897, 13, 9651, 1683, 29901, 13, 18884, 10541, 353, 5159, 13, 18884, 363, 1734, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 1900, 297, 5235, 29901, 13, 13, 462, 1678, 10541, 29889, 4397, 29898, 13, 462, 4706, 313, 1742, 29892, 1900, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 9853, 29961, 29875, 3816, 29946, 1402, 9853, 29961, 29875, 3816, 29941, 3816, 29900, 12622, 13, 18884, 1583, 29889, 27711, 1080, 29889, 4397, 29898, 18616, 663, 29897, 13, 13, 9651, 363, 1734, 29892, 3858, 29892, 2070, 29879, 29892, 1565, 29892, 1900, 297, 5235, 29901, 13, 18884, 565, 1565, 2804, 1900, 29901, 13, 462, 1678, 4436, 4619, 29871, 29896, 13, 462, 1678, 4436, 29918, 29893, 4619, 29871, 29896, 847, 7431, 29898, 3888, 29897, 13, 13, 4706, 6410, 353, 7442, 29889, 2083, 29898, 4299, 29889, 26017, 29918, 6758, 10456, 4299, 29918, 2080, 876, 13, 13, 4706, 1904, 29889, 1688, 29918, 8513, 29918, 2696, 580, 13, 13, 4706, 736, 4436, 29892, 4436, 29892, 4436, 29918, 29893, 13, 13, 1678, 822, 2186, 29898, 1311, 1125, 13, 4706, 565, 1583, 29889, 1867, 29918, 14513, 29901, 13, 9651, 2582, 353, 1583, 29889, 1867, 29918, 14513, 29898, 1311, 29889, 1272, 29918, 16707, 29892, 1583, 29889, 27711, 1080, 29892, 13, 462, 462, 259, 1583, 29889, 14513, 29918, 3972, 29897, 13, 4706, 1683, 29901, 13, 9651, 14707, 29898, 1311, 29889, 21134, 29896, 29892, 1583, 29889, 21134, 29906, 29897, 13, 4706, 1583, 29889, 27711, 1080, 353, 5159, 13, 4706, 1583, 29889, 21134, 29896, 29892, 1583, 29889, 21134, 29906, 353, 19997, 5159, 13, 4706, 736, 2582, 29961, 29906, 29962, 13, 13, 13, 1990, 317, 2241, 16802, 29898, 16802, 1125, 13, 1678, 822, 4770, 2344, 12035, 1311, 1125, 13, 4706, 2428, 29898, 29903, 2241, 16802, 29892, 1583, 467, 1649, 2344, 1649, 580, 13, 13, 4706, 1583, 29889, 1742, 29918, 29894, 542, 353, 1653, 29918, 29894, 542, 877, 1445, 742, 1583, 29889, 29874, 29889, 1742, 29918, 29894, 542, 29897, 13, 4706, 1583, 29889, 1742, 29918, 29894, 542, 29889, 1202, 29918, 18801, 580, 13, 4706, 1583, 29889, 29888, 7971, 29918, 29894, 542, 353, 10868, 29918, 29894, 542, 29898, 1311, 29889, 29874, 29889, 29888, 7971, 29918, 29894, 542, 29897, 13, 4706, 1583, 29889, 29886, 29918, 1742, 29918, 29894, 542, 353, 1653, 29918, 29894, 542, 877, 1445, 742, 1583, 29889, 29874, 29889, 29886, 29918, 1742, 29918, 29894, 542, 29897, 13, 4706, 1583, 29889, 29886, 29918, 1742, 29918, 29894, 542, 29889, 1202, 29918, 18801, 580, 13, 4706, 1583, 29889, 12154, 29918, 29894, 542, 353, 1653, 29918, 29894, 542, 877, 1445, 742, 1583, 29889, 29874, 29889, 12154, 29918, 29894, 542, 29897, 13, 4706, 1583, 29889, 2557, 29918, 29894, 542, 353, 1653, 29918, 29894, 542, 877, 1445, 742, 1583, 29889, 29874, 29889, 2557, 29918, 29894, 542, 29897, 13, 4706, 1583, 29889, 1066, 29918, 29894, 542, 353, 1653, 29918, 29894, 542, 877, 1445, 742, 1583, 29889, 29874, 29889, 1066, 29918, 29894, 542, 29897, 13, 13, 1678, 822, 788, 29918, 18732, 29918, 5085, 29898, 1311, 29892, 13812, 1125, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1742, 29899, 29894, 542, 613, 3734, 29922, 5574, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 29886, 29899, 1742, 29899, 29894, 542, 613, 3734, 29922, 5574, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 29888, 7971, 29899, 29894, 542, 613, 3734, 29922, 5574, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 12154, 29899, 29894, 542, 613, 3734, 29922, 5574, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 2557, 29899, 29894, 542, 613, 3734, 29922, 5574, 29897, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1066, 29899, 29894, 542, 613, 3734, 29922, 5574, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1742, 29899, 17987, 29881, 886, 613, 3734, 29922, 5574, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 1272, 29918, 16707, 613, 3734, 29922, 5574, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 29882, 567, 613, 1371, 543, 4299, 11266, 7529, 613, 3734, 29922, 8824, 13, 4706, 1723, 13, 4706, 13812, 29889, 1202, 29918, 23516, 29898, 13, 9651, 376, 489, 14513, 29899, 3972, 613, 1371, 543, 2084, 304, 4516, 411, 19745, 848, 322, 12078, 613, 13, 9651, 3734, 29922, 5574, 13, 4706, 1723, 13, 13, 13, 1678, 822, 679, 29918, 16680, 29898, 1311, 1125, 13, 4706, 736, 7687, 29898, 24840, 29918, 16950, 29897, 13, 13, 1678, 822, 679, 29918, 16950, 29898, 1311, 1125, 13, 4706, 736, 2560, 29918, 16950, 13, 13, 1678, 822, 679, 29918, 535, 13549, 29898, 1311, 1125, 13, 4706, 822, 17799, 29918, 535, 13549, 29898, 16175, 1125, 13, 9651, 9066, 29892, 2665, 3383, 926, 29918, 11338, 29892, 1401, 29918, 862, 2976, 29892, 7426, 29892, 16608, 29892, 320, 13, 9651, 22525, 29892, 285, 29918, 2409, 8247, 29892, 285, 29918, 5182, 29879, 29892, 11073, 29918, 29894, 542, 29892, 11073, 353, 1051, 29898, 13, 18884, 14319, 10456, 16175, 876, 13, 13, 9651, 2665, 353, 518, 1311, 29889, 1742, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29893, 29897, 363, 281, 297, 2665, 29918, 29962, 13, 9651, 282, 29918, 18616, 353, 518, 1311, 29889, 29886, 29918, 1742, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29893, 29897, 363, 281, 297, 2665, 29918, 29962, 13, 9651, 3005, 29939, 353, 5519, 1311, 29889, 29888, 7971, 29918, 29894, 542, 29961, 1311, 29889, 1742, 29918, 29894, 542, 29889, 11851, 29961, 29875, 5262, 565, 13, 462, 268, 1583, 29889, 1742, 29918, 29894, 542, 29889, 11851, 29961, 29875, 29962, 2804, 22868, 3904, 29968, 29915, 1683, 29871, 29900, 363, 474, 297, 281, 29962, 363, 13, 462, 1678, 281, 13, 462, 1678, 297, 2665, 29962, 13, 13, 9651, 926, 29918, 11338, 353, 518, 1311, 29889, 1066, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29893, 29897, 363, 281, 297, 926, 29918, 11338, 29962, 13, 9651, 16608, 353, 518, 1311, 29889, 2557, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29888, 29897, 363, 285, 297, 16608, 29962, 13, 9651, 11073, 29918, 29894, 542, 353, 518, 1311, 29889, 12154, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29878, 29897, 363, 364, 297, 11073, 29918, 29894, 542, 29962, 13, 13, 9651, 454, 4317, 294, 29918, 13140, 353, 518, 1311, 29889, 2557, 29918, 29894, 542, 29889, 29894, 18642, 675, 29898, 29888, 29897, 363, 285, 297, 285, 29918, 2409, 8247, 29962, 13, 13, 9651, 12109, 29918, 279, 2395, 29918, 262, 29892, 12109, 29918, 279, 2395, 29918, 449, 29892, 12109, 29918, 8205, 29918, 262, 29892, 12109, 29918, 8205, 29918, 449, 29892, 320, 13, 9651, 11105, 29918, 262, 29892, 11105, 29918, 449, 29892, 11105, 29918, 7888, 353, 679, 29918, 26859, 29898, 2716, 29918, 862, 2976, 29892, 7426, 29897, 13, 13, 9651, 2665, 29918, 16175, 29892, 2665, 29918, 13168, 353, 11105, 29918, 16175, 29898, 18616, 29897, 13, 9651, 282, 29918, 18616, 29918, 16175, 29892, 903, 353, 11105, 29918, 16175, 29898, 29886, 29918, 18616, 29897, 13, 9651, 3005, 29939, 29918, 16175, 29892, 903, 353, 11105, 29918, 16175, 29898, 29888, 7971, 29897, 13, 9651, 3005, 29939, 29918, 16175, 353, 3005, 29939, 29918, 16175, 29889, 579, 668, 29898, 29881, 1853, 2433, 7411, 29941, 29906, 1495, 13, 13, 9651, 926, 29918, 16175, 29892, 903, 353, 11105, 29918, 16175, 29898, 1066, 29918, 11338, 29897, 13, 9651, 11073, 29918, 29894, 542, 29918, 16175, 29892, 11073, 29918, 29894, 542, 29918, 13168, 353, 11105, 29918, 16175, 29898, 21134, 29918, 29894, 542, 29897, 13, 9651, 11073, 29918, 16175, 29892, 903, 353, 11105, 29918, 16175, 29898, 21134, 29897, 13, 9651, 16608, 29918, 16175, 29892, 903, 353, 11105, 29918, 16175, 29898, 19935, 29897, 13, 13, 9651, 5120, 29918, 3502, 353, 7442, 29889, 3298, 359, 29898, 18616, 29918, 16175, 29889, 12181, 29892, 26688, 2433, 7411, 29941, 29906, 1495, 13, 9651, 298, 567, 353, 19745, 29898, 1311, 29889, 29874, 29889, 29882, 567, 29897, 13, 9651, 20241, 353, 298, 567, 1839, 1758, 2033, 13, 9651, 565, 20241, 6736, 29871, 29900, 29901, 13, 18884, 363, 364, 29892, 1948, 297, 26985, 29898, 12803, 29918, 3502, 1125, 13, 462, 1678, 363, 274, 29892, 1897, 297, 26985, 29898, 798, 1125, 13, 462, 4706, 565, 22525, 29961, 29878, 29962, 448, 20241, 5277, 274, 5277, 22525, 29961, 29878, 29962, 718, 20241, 29901, 13, 462, 9651, 5120, 29918, 3502, 29961, 29878, 3816, 29883, 29962, 353, 29871, 29896, 13, 13, 13, 9651, 2665, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 353, 7442, 29889, 3298, 359, 29898, 18616, 29918, 16175, 29889, 12181, 29892, 26688, 2433, 524, 29941, 29906, 1495, 13, 9651, 363, 364, 29892, 1948, 297, 26985, 29898, 18616, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 1125, 13, 18884, 363, 274, 29892, 1897, 297, 26985, 29898, 798, 1125, 13, 462, 1678, 363, 260, 29892, 9913, 297, 26985, 29898, 29888, 29918, 5182, 29879, 29961, 29878, 29962, 1125, 13, 462, 4706, 565, 9913, 1275, 274, 29901, 13, 462, 9651, 2665, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 29961, 29878, 3816, 29883, 29962, 353, 454, 4317, 294, 29918, 13140, 29961, 29878, 3816, 29873, 29962, 13, 13, 9651, 2665, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 353, 7442, 29889, 2378, 29898, 18616, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 29892, 26688, 2433, 524, 29941, 29906, 1495, 13, 13, 9651, 4974, 313, 18616, 29918, 16175, 29889, 12181, 1275, 2665, 29918, 13168, 29889, 12181, 29897, 13, 9651, 4974, 313, 13, 18884, 16608, 29918, 16175, 29889, 12181, 1275, 11073, 29918, 29894, 542, 29918, 16175, 29889, 12181, 1275, 11073, 29918, 29894, 542, 29918, 13168, 29889, 12181, 29897, 13, 9651, 4974, 313, 21134, 29918, 16175, 29889, 12181, 1275, 2665, 29918, 16175, 29889, 12181, 29897, 13, 13, 9651, 736, 2665, 29918, 16175, 29892, 282, 29918, 18616, 29918, 16175, 29892, 926, 29918, 16175, 29892, 2665, 29918, 13168, 29892, 22525, 29892, 16608, 29918, 16175, 29892, 320, 13, 462, 259, 11073, 29918, 29894, 542, 29918, 16175, 29892, 320, 13, 462, 259, 11073, 29918, 29894, 542, 29918, 13168, 29892, 3005, 29939, 29918, 16175, 29892, 320, 13, 462, 259, 5120, 29918, 3502, 29892, 320, 13, 462, 259, 2665, 29918, 11965, 29918, 2409, 8247, 29918, 13140, 2053, 13, 462, 259, 12109, 29918, 279, 2395, 29918, 262, 29892, 12109, 29918, 279, 2395, 29918, 449, 29892, 12109, 29918, 8205, 29918, 262, 29892, 12109, 29918, 8205, 29918, 449, 29892, 320, 13, 462, 259, 11105, 29918, 262, 29892, 11105, 29918, 449, 29892, 11105, 29918, 7888, 29892, 320, 13, 462, 259, 11073, 29918, 16175, 13, 13, 4706, 736, 17799, 29918, 535, 13549, 13, 13, 1678, 822, 679, 29918, 1688, 261, 29898, 1311, 1125, 13, 4706, 29105, 353, 1583, 29889, 657, 29918, 535, 13549, 580, 13, 4706, 6601, 353, 21184, 29903, 2096, 2392, 20606, 261, 29898, 13, 9651, 29105, 29892, 1583, 29889, 29874, 29889, 1688, 29918, 6194, 29892, 1583, 29889, 29874, 29889, 1272, 29918, 16707, 29892, 13, 9651, 1583, 29889, 29874, 29889, 14513, 29918, 3972, 29897, 13, 4706, 1034, 13364, 353, 2994, 13364, 29898, 13, 9651, 13812, 29922, 3846, 29898, 24840, 29918, 16950, 511, 13, 9651, 9853, 29918, 2311, 29922, 1311, 29889, 29874, 29889, 16175, 29892, 13, 9651, 2224, 29922, 1311, 29889, 29874, 29889, 1688, 29892, 13, 9651, 9591, 29922, 1311, 29889, 657, 29918, 16950, 580, 13, 4706, 1723, 13, 13, 4706, 736, 4829, 19907, 3057, 261, 29898, 12097, 261, 29892, 1583, 29889, 29874, 29889, 449, 29892, 1034, 13364, 29897, 13, 13, 1678, 822, 2254, 29918, 4299, 29898, 1311, 1125, 13, 4706, 298, 567, 353, 19745, 29898, 1311, 29889, 29874, 29889, 29882, 567, 29897, 13, 13, 4706, 298, 567, 1839, 29894, 2557, 2033, 353, 1583, 29889, 2557, 29918, 29894, 542, 29889, 2311, 580, 13, 4706, 298, 567, 1839, 29894, 1742, 2033, 353, 1583, 29889, 1742, 29918, 29894, 542, 29889, 2311, 580, 13, 4706, 298, 567, 1839, 24666, 601, 2033, 353, 1583, 29889, 12154, 29918, 29894, 542, 29889, 2311, 580, 13, 4706, 298, 567, 1839, 29894, 1066, 2033, 353, 1583, 29889, 1066, 29918, 29894, 542, 29889, 2311, 580, 13, 4706, 298, 567, 1839, 1742, 29918, 17987, 29881, 886, 2033, 353, 6088, 29918, 1742, 29918, 17987, 29881, 886, 29898, 1311, 29889, 29874, 29889, 1742, 29918, 17987, 29881, 886, 29897, 13, 4706, 298, 567, 1839, 262, 29918, 279, 2395, 2033, 29922, 5574, 13, 4706, 298, 567, 1839, 449, 29918, 279, 2395, 2033, 29922, 5574, 13, 13, 4706, 736, 21184, 29903, 2241, 29898, 29882, 567, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 317, 2241, 16802, 2141, 3389, 580, 13, 2 ]
images/splunk/deployment/init_dmc.py
halr9000/docker-splunk-cluster
0
84697
def configurations(): return { "components": { "kvstore": False, "web": True, "indexing": False, "dmc": True } }
[ 1, 822, 22920, 7295, 13, 1678, 736, 426, 13, 4706, 376, 14036, 1115, 426, 13, 9651, 376, 27049, 8899, 1115, 7700, 29892, 13, 9651, 376, 2676, 1115, 5852, 29892, 13, 9651, 376, 2248, 292, 1115, 7700, 29892, 13, 9651, 376, 29881, 14047, 1115, 5852, 13, 4706, 500, 13, 1678, 500, 2 ]
windows/winproxy/apis/shlwapi.py
IMULMUL/PythonForWindows
479
182921
import ctypes import windows import windows.generated_def as gdef from ..apiproxy import ApiProxy, NeededParameter, is_implemented from ..error import fail_on_zero class ShlwapiProxy(ApiProxy): APIDLL = "Shlwapi" default_error_check = staticmethod(fail_on_zero) @ShlwapiProxy() def StrStrIW(pszFirst, pszSrch): return StrStrIW.ctypes_function(pszFirst, pszSrch) @ShlwapiProxy() def StrStrIA(pszFirst, pszSrch): return StrStrIA.ctypes_function(pszFirst, pszSrch) @ShlwapiProxy() def IsOS(dwOS): if not is_implemented(IsOS) and windows.system.version[0] < 6: # Before Vista: # If so use ordinal 437 from DOCUMENTATION # https://docs.microsoft.com/en-us/windows/desktop/api/shlwapi/nf-shlwapi-isos#remarks IsOS.proxy.func_name = 437 return IsOS.ctypes_function(dwOS)
[ 1, 1053, 274, 8768, 13, 5215, 5417, 13, 5215, 5417, 29889, 13525, 29918, 1753, 408, 330, 1753, 13, 13, 3166, 6317, 481, 666, 307, 3594, 1053, 29749, 14048, 29892, 2448, 19226, 9329, 29892, 338, 29918, 326, 2037, 287, 13, 3166, 6317, 2704, 1053, 4418, 29918, 265, 29918, 9171, 13, 13, 1990, 1383, 29880, 29893, 2754, 14048, 29898, 11713, 14048, 1125, 13, 1678, 12279, 1367, 2208, 353, 376, 2713, 29880, 29893, 2754, 29908, 13, 1678, 2322, 29918, 2704, 29918, 3198, 353, 2294, 5696, 29898, 14057, 29918, 265, 29918, 9171, 29897, 13, 13, 29992, 2713, 29880, 29893, 2754, 14048, 580, 13, 1753, 3767, 5015, 29902, 29956, 29898, 567, 29920, 6730, 29892, 282, 3616, 29903, 29878, 305, 1125, 13, 1678, 736, 3767, 5015, 29902, 29956, 29889, 312, 7384, 29918, 2220, 29898, 567, 29920, 6730, 29892, 282, 3616, 29903, 29878, 305, 29897, 13, 13, 29992, 2713, 29880, 29893, 2754, 14048, 580, 13, 1753, 3767, 5015, 10764, 29898, 567, 29920, 6730, 29892, 282, 3616, 29903, 29878, 305, 1125, 13, 1678, 736, 3767, 5015, 10764, 29889, 312, 7384, 29918, 2220, 29898, 567, 29920, 6730, 29892, 282, 3616, 29903, 29878, 305, 29897, 13, 13, 29992, 2713, 29880, 29893, 2754, 14048, 580, 13, 1753, 1317, 3267, 29898, 28012, 3267, 1125, 13, 1678, 565, 451, 338, 29918, 326, 2037, 287, 29898, 3624, 3267, 29897, 322, 5417, 29889, 5205, 29889, 3259, 29961, 29900, 29962, 529, 29871, 29953, 29901, 13, 4706, 396, 10949, 478, 2079, 29901, 13, 4706, 396, 960, 577, 671, 4356, 979, 29871, 29946, 29941, 29955, 515, 11662, 29907, 5005, 3919, 8098, 13, 4706, 396, 2045, 597, 2640, 29889, 4994, 29889, 510, 29914, 264, 29899, 375, 29914, 10499, 29914, 20858, 29914, 2754, 29914, 845, 29880, 29893, 2754, 29914, 29876, 29888, 29899, 845, 29880, 29893, 2754, 29899, 275, 359, 29937, 1745, 17862, 13, 4706, 1317, 3267, 29889, 14701, 29889, 9891, 29918, 978, 353, 29871, 29946, 29941, 29955, 13, 1678, 736, 1317, 3267, 29889, 312, 7384, 29918, 2220, 29898, 28012, 3267, 29897, 13, 2 ]
tutorial/simple_flowsheet.py
Nukleon84/pypedream
9
181624
#Hacked Path to find package. Would no be needed when package is installed via pip import sys import os sys.path.append(os.path.abspath('../pypedream')) from pypedream import MaterialStream, Flowsheet, ThermodynamicSystem import pypedream.database.purecomponents as pcdb sys= ThermodynamicSystem("Test", "NRTL") sys.addComponent(pcdb.Water()) sys.addComponent(pcdb.Ethanol()) sys.addComponent(pcdb.Methanol()) sys.addComponent(pcdb.Acetone()) sys.addComponent(pcdb.Isopropanol()) sys.addComponent(pcdb.Benzene()) sys.addComponent(pcdb.Toluene()) sys.fill() f= Flowsheet("Test",sys) S001=f.mstr("S001") #f.mstr("S001").fvpz(100, 0.5,1000,[ ("Water",0.5), ("Methanol",0.5) ]) print("\nFix Temperature\n\n") f.mstr("S001").ftpz(100, 82.5,1000,[ ("Water",0.5), ("Methanol",0.5) ]) f.solve() for v in S001.variables.values(): print(f"{v.fullName()} = {v.displayValue()} {v.displayUnit}") print("\nBubble Point\n\n") f.mstr("S001").fpx(100, 1000,[ ("Water",0.5), ("Methanol",0.5) ]) f.solve() for v in S001.variables.values(): print(f"{v.fullName()} = {v.displayValue()} {v.displayUnit}") print("\nDew Point\n\n") f.mstr("S001").fpy(100, 1000,[ ("Water",0.5), ("Methanol",0.5) ]) f.solve() for v in S001.variables.values(): print(f"{v.fullName()} = {v.displayValue()} {v.displayUnit}") print("\nFix Temperature 25°C\n\n") f.mstr("S001").ftpz(100,25,1000,[ ("Water",0.5), ("Methanol",0.5) ]) f.solve() for v in S001.variables.values(): print(f"{v.fullName()} = {v.displayValue()} {v.displayUnit}") for T in range(25,120): f.mstr("S001").ftpz(100,T,1000,[ ("Water",0.5), ("Methanol",0.5) ]) f.solve(silent=True) print(f"T = {S001.getVar('T').quantity()}, VF = {S001.getVar('VF').value}") #print(S001) ''' f= Flowsheet("Test",sys) F01= f.unit("F01", "Flash", [f.mstr("S001")],[f.mstr("S002"),f.mstr("S003")]) f.mstr("S001").ftpz(100, 25,1,[ ("Water",0.5), ("Methanol",0.5) ]) f.unit("F01").spec([ ("VF",0.5,SI.none), ("P",1,METRIC.bar) ]) f.init() f.solve() print(f.report()) print(f.streamtable()) '''
[ 1, 396, 29950, 547, 287, 10802, 304, 1284, 3577, 29889, 10878, 694, 367, 4312, 746, 3577, 338, 5130, 3025, 8450, 13, 5215, 10876, 13, 5215, 2897, 13, 9675, 29889, 2084, 29889, 4397, 29898, 359, 29889, 2084, 29889, 370, 1028, 493, 877, 6995, 29886, 1478, 287, 1633, 8785, 13, 3166, 282, 1478, 287, 1633, 1053, 17582, 3835, 29892, 22787, 9855, 29892, 498, 837, 397, 8739, 3924, 13, 5215, 282, 1478, 287, 1633, 29889, 9803, 29889, 29886, 545, 14036, 408, 282, 2252, 29890, 13, 13, 9675, 29922, 498, 837, 397, 8739, 3924, 703, 3057, 613, 376, 29940, 13079, 29931, 1159, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 29956, 1008, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 29923, 27603, 324, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 29924, 621, 273, 324, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 10644, 300, 650, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 3624, 459, 1336, 273, 324, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 29933, 4666, 1600, 3101, 13, 9675, 29889, 1202, 5308, 29898, 29886, 2252, 29890, 29889, 29911, 20424, 1600, 3101, 13, 9675, 29889, 5589, 580, 13, 29888, 29922, 22787, 9855, 703, 3057, 613, 9675, 29897, 13, 29903, 29900, 29900, 29896, 29922, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 1159, 13, 13, 29937, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 29888, 29894, 29886, 29920, 29898, 29896, 29900, 29900, 29892, 29871, 29900, 29889, 29945, 29892, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 13, 13, 2158, 14182, 29876, 29943, 861, 6789, 546, 1535, 29905, 29876, 29905, 29876, 1159, 13, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 23102, 29920, 29898, 29896, 29900, 29900, 29892, 29871, 29947, 29906, 29889, 29945, 29892, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 13, 29888, 29889, 2929, 345, 580, 13, 13, 1454, 325, 297, 317, 29900, 29900, 29896, 29889, 20897, 29889, 5975, 7295, 13, 1678, 1596, 29898, 29888, 29908, 29912, 29894, 29889, 8159, 1170, 28296, 353, 426, 29894, 29889, 4990, 1917, 28296, 426, 29894, 29889, 4990, 8325, 27195, 13, 13, 13, 2158, 14182, 29876, 29933, 23232, 8984, 29905, 29876, 29905, 29876, 1159, 13, 13, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 29888, 1756, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 29888, 29889, 2929, 345, 580, 13, 1454, 325, 297, 317, 29900, 29900, 29896, 29889, 20897, 29889, 5975, 7295, 13, 1678, 1596, 29898, 29888, 29908, 29912, 29894, 29889, 8159, 1170, 28296, 353, 426, 29894, 29889, 4990, 1917, 28296, 426, 29894, 29889, 4990, 8325, 27195, 13, 13, 2158, 14182, 29876, 29928, 809, 8984, 29905, 29876, 29905, 29876, 1159, 13, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 29888, 2272, 29898, 29896, 29900, 29900, 29892, 29871, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 29888, 29889, 2929, 345, 580, 13, 1454, 325, 297, 317, 29900, 29900, 29896, 29889, 20897, 29889, 5975, 7295, 13, 1678, 1596, 29898, 29888, 29908, 29912, 29894, 29889, 8159, 1170, 28296, 353, 426, 29894, 29889, 4990, 1917, 28296, 426, 29894, 29889, 4990, 8325, 27195, 13, 13, 13, 2158, 14182, 29876, 29943, 861, 6789, 546, 1535, 29871, 29906, 29945, 30073, 29907, 29905, 29876, 29905, 29876, 1159, 13, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 23102, 29920, 29898, 29896, 29900, 29900, 29892, 29906, 29945, 29892, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 13, 29888, 29889, 2929, 345, 580, 13, 13, 1454, 325, 297, 317, 29900, 29900, 29896, 29889, 20897, 29889, 5975, 7295, 13, 1678, 1596, 29898, 29888, 29908, 29912, 29894, 29889, 8159, 1170, 28296, 353, 426, 29894, 29889, 4990, 1917, 28296, 426, 29894, 29889, 4990, 8325, 27195, 13, 13, 13, 1454, 323, 297, 3464, 29898, 29906, 29945, 29892, 29896, 29906, 29900, 1125, 13, 1678, 285, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 23102, 29920, 29898, 29896, 29900, 29900, 29892, 29911, 29892, 29896, 29900, 29900, 29900, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 1678, 285, 29889, 2929, 345, 29898, 25590, 296, 29922, 5574, 29897, 13, 1678, 1596, 29898, 29888, 29908, 29911, 353, 426, 29903, 29900, 29900, 29896, 29889, 657, 9037, 877, 29911, 2824, 22640, 580, 1118, 478, 29943, 353, 426, 29903, 29900, 29900, 29896, 29889, 657, 9037, 877, 24460, 2824, 1767, 27195, 13, 13, 13, 13, 29937, 2158, 29898, 29903, 29900, 29900, 29896, 29897, 13, 13, 13, 12008, 13, 29888, 29922, 22787, 9855, 703, 3057, 613, 9675, 29897, 13, 29943, 29900, 29896, 29922, 285, 29889, 5441, 703, 29943, 29900, 29896, 613, 376, 8754, 1161, 613, 518, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 1159, 16272, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29906, 4968, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29941, 1159, 2314, 13, 29888, 29889, 29885, 710, 703, 29903, 29900, 29900, 29896, 2564, 23102, 29920, 29898, 29896, 29900, 29900, 29892, 29871, 29906, 29945, 29892, 29896, 17094, 4852, 29956, 1008, 613, 29900, 29889, 29945, 511, 4852, 29924, 621, 273, 324, 613, 29900, 29889, 29945, 29897, 29871, 2314, 13, 29888, 29889, 5441, 703, 29943, 29900, 29896, 2564, 6550, 4197, 4852, 24460, 613, 29900, 29889, 29945, 29892, 5425, 29889, 9290, 511, 4852, 29925, 613, 29896, 29892, 2303, 5659, 2965, 29889, 1646, 29897, 29871, 2314, 13, 29888, 29889, 2344, 580, 13, 29888, 29889, 2929, 345, 580, 13, 2158, 29898, 29888, 29889, 12276, 3101, 13, 2158, 29898, 29888, 29889, 5461, 2371, 3101, 13, 13, 12008, 2 ]
Python/Code/Thermal_Models/models/__init__.py
mhasoba/TPCFitting
0
96436
#!/usr/bin/env python3 """ This directory contains classes representing each growth model. """ from .linear_models import boltzmann_arrhenius, \ lm from .schoolfield_models import schoolfield_two_factor, \ schoolfield_two_factor_tpk, \ schoolfield_full, \ schoolfield_full_tpk from .weighted_models import boltzmann_arrhenius_two_weights_linear, \ boltzmann_arrhenius_two_weights_non_linear, \ boltzmann_arrhenius_two_weights_normalise_only, \ boltzmann_arrhenius_one_weight_linear, \ boltzmann_arrhenius_one_weight_non_linear
[ 1, 29871, 30143, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 15945, 29908, 13, 4013, 3884, 3743, 4413, 15783, 1269, 14321, 1904, 29889, 13, 15945, 29908, 13, 13, 3166, 869, 10660, 29918, 9794, 1053, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29892, 320, 13, 462, 965, 301, 29885, 13, 13, 3166, 869, 27041, 2671, 29918, 9794, 1053, 3762, 2671, 29918, 10184, 29918, 19790, 29892, 320, 13, 462, 18884, 3762, 2671, 29918, 10184, 29918, 19790, 29918, 9392, 29895, 29892, 320, 13, 462, 18884, 3762, 2671, 29918, 8159, 29892, 320, 13, 462, 18884, 3762, 2671, 29918, 8159, 29918, 9392, 29895, 13, 13, 3166, 869, 7915, 287, 29918, 9794, 1053, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29918, 10184, 29918, 705, 5861, 29918, 10660, 29892, 320, 13, 462, 632, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29918, 10184, 29918, 705, 5861, 29918, 5464, 29918, 10660, 29892, 320, 13, 462, 632, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29918, 10184, 29918, 705, 5861, 29918, 8945, 895, 29918, 6194, 29892, 320, 13, 462, 632, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29918, 650, 29918, 7915, 29918, 10660, 29892, 320, 13, 462, 632, 289, 14339, 29920, 4403, 29918, 2749, 3169, 2482, 29918, 650, 29918, 7915, 29918, 5464, 29918, 10660, 2 ]
tests/utilities/test_fetching.py
PeppeSaccardi/pytorch-lightning
1
94574
# Copyright The PyTorch Lightning team. # # 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 from torch import tensor from torch.utils.data import DataLoader, IterableDataset from pytorch_lightning.trainer.supporters import CombinedLoader from pytorch_lightning.utilities.exceptions import MisconfigurationException from pytorch_lightning.utilities.fetching import DataFetcher @pytest.mark.parametrize("use_combined_loader", [False, True]) def test_prefetch_iterator(use_combined_loader): """Test the DataFetcher with PyTorch IterableDataset.""" class IterDataset(IterableDataset): def __iter__(self): yield 1 yield 2 yield 3 for prefetch_batches in range(0, 4): if use_combined_loader: loader = CombinedLoader([DataLoader(IterDataset()), DataLoader(IterDataset())]) expected = [ ([tensor([1]), tensor([1])], False), ([tensor([2]), tensor([2])], False), ([tensor([3]), tensor([3])], True), ] else: loader = DataLoader(IterDataset()) expected = [(1, False), (2, False), (3, True)] iterator = DataFetcher(prefetch_batches=prefetch_batches) prefetch_batches += 1 assert iterator.prefetch_batches == prefetch_batches iterator.setup(loader) def generate(): generated = [] for idx, data in enumerate(iterator, 1): if iterator.done: assert iterator.fetched == 3 else: assert iterator.fetched == (idx + prefetch_batches) generated.append(data) return generated assert generate() == expected # validate reset works properly. assert generate() == expected assert iterator.fetched == 3 class EmptyIterDataset(IterableDataset): def __iter__(self): return iter([]) dataloader = DataLoader(EmptyIterDataset()) iterator = DataFetcher() iterator.setup(dataloader) assert list(iterator) == [] def test_misconfiguration_error(): fetcher = DataFetcher() with pytest.raises( MisconfigurationException, match="The `dataloader_iter` isn't available outside the __iter__ context." ): loader = DataLoader(range(10)) fetcher.setup(loader) assert fetcher.loaders[0] == loader fetcher.loader_iters iter(fetcher) assert fetcher.loader_iters
[ 1, 396, 14187, 1266, 450, 10772, 29911, 25350, 12790, 1076, 3815, 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, 5215, 11451, 1688, 13, 3166, 4842, 305, 1053, 12489, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 29892, 20504, 519, 16390, 24541, 13, 13, 3166, 282, 3637, 25350, 29918, 4366, 1076, 29889, 3018, 4983, 29889, 19303, 272, 2153, 1053, 422, 29890, 1312, 10036, 13, 3166, 282, 3637, 25350, 29918, 4366, 1076, 29889, 4422, 1907, 29889, 11739, 29879, 1053, 20929, 13305, 2451, 13, 3166, 282, 3637, 25350, 29918, 4366, 1076, 29889, 4422, 1907, 29889, 9155, 292, 1053, 3630, 20927, 261, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 703, 1509, 29918, 17743, 1312, 29918, 12657, 613, 518, 8824, 29892, 5852, 2314, 13, 1753, 1243, 29918, 29886, 999, 3486, 29918, 17609, 29898, 1509, 29918, 17743, 1312, 29918, 12657, 1125, 13, 1678, 9995, 3057, 278, 3630, 20927, 261, 411, 10772, 29911, 25350, 20504, 519, 16390, 24541, 1213, 15945, 13, 13, 1678, 770, 20504, 16390, 24541, 29898, 13463, 519, 16390, 24541, 1125, 13, 4706, 822, 4770, 1524, 12035, 1311, 1125, 13, 9651, 7709, 29871, 29896, 13, 9651, 7709, 29871, 29906, 13, 9651, 7709, 29871, 29941, 13, 13, 1678, 363, 758, 9155, 29918, 16175, 267, 297, 3464, 29898, 29900, 29892, 29871, 29946, 1125, 13, 4706, 565, 671, 29918, 17743, 1312, 29918, 12657, 29901, 13, 9651, 23466, 353, 422, 29890, 1312, 10036, 4197, 1469, 10036, 29898, 13463, 16390, 24541, 25739, 3630, 10036, 29898, 13463, 16390, 24541, 3101, 2314, 13, 9651, 3806, 353, 518, 13, 18884, 9310, 20158, 4197, 29896, 11724, 12489, 4197, 29896, 2314, 1402, 7700, 511, 13, 18884, 9310, 20158, 4197, 29906, 11724, 12489, 4197, 29906, 2314, 1402, 7700, 511, 13, 18884, 9310, 20158, 4197, 29941, 11724, 12489, 4197, 29941, 2314, 1402, 5852, 511, 13, 9651, 4514, 13, 4706, 1683, 29901, 13, 9651, 23466, 353, 3630, 10036, 29898, 13463, 16390, 24541, 3101, 13, 9651, 3806, 353, 17288, 29896, 29892, 7700, 511, 313, 29906, 29892, 7700, 511, 313, 29941, 29892, 5852, 4638, 13, 4706, 20380, 353, 3630, 20927, 261, 29898, 29886, 999, 3486, 29918, 16175, 267, 29922, 29886, 999, 3486, 29918, 16175, 267, 29897, 13, 4706, 758, 9155, 29918, 16175, 267, 4619, 29871, 29896, 13, 4706, 4974, 20380, 29889, 29886, 999, 3486, 29918, 16175, 267, 1275, 758, 9155, 29918, 16175, 267, 13, 4706, 20380, 29889, 14669, 29898, 12657, 29897, 13, 13, 4706, 822, 5706, 7295, 13, 9651, 5759, 353, 5159, 13, 9651, 363, 22645, 29892, 848, 297, 26985, 29898, 17609, 29892, 29871, 29896, 1125, 13, 18884, 565, 20380, 29889, 15091, 29901, 13, 462, 1678, 4974, 20380, 29889, 9155, 287, 1275, 29871, 29941, 13, 18884, 1683, 29901, 13, 462, 1678, 4974, 20380, 29889, 9155, 287, 1275, 313, 13140, 718, 758, 9155, 29918, 16175, 267, 29897, 13, 18884, 5759, 29889, 4397, 29898, 1272, 29897, 13, 9651, 736, 5759, 13, 13, 4706, 4974, 5706, 580, 1275, 3806, 13, 4706, 396, 12725, 10092, 1736, 6284, 29889, 13, 4706, 4974, 5706, 580, 1275, 3806, 13, 4706, 4974, 20380, 29889, 9155, 287, 1275, 29871, 29941, 13, 13, 1678, 770, 2812, 2349, 13463, 16390, 24541, 29898, 13463, 519, 16390, 24541, 1125, 13, 4706, 822, 4770, 1524, 12035, 1311, 1125, 13, 9651, 736, 4256, 4197, 2314, 13, 13, 1678, 1418, 7003, 1664, 353, 3630, 10036, 29898, 8915, 13463, 16390, 24541, 3101, 13, 1678, 20380, 353, 3630, 20927, 261, 580, 13, 1678, 20380, 29889, 14669, 29898, 29881, 2075, 29877, 1664, 29897, 13, 1678, 4974, 1051, 29898, 17609, 29897, 1275, 5159, 13, 13, 13, 1753, 1243, 29918, 26737, 13305, 29918, 2704, 7295, 13, 13, 1678, 6699, 261, 353, 3630, 20927, 261, 580, 13, 1678, 411, 11451, 1688, 29889, 336, 4637, 29898, 13, 4706, 20929, 13305, 2451, 29892, 1993, 543, 1576, 421, 29881, 2075, 29877, 1664, 29918, 1524, 29952, 3508, 29915, 29873, 3625, 5377, 278, 4770, 1524, 1649, 3030, 1213, 13, 268, 1125, 13, 4706, 23466, 353, 3630, 10036, 29898, 3881, 29898, 29896, 29900, 876, 13, 4706, 6699, 261, 29889, 14669, 29898, 12657, 29897, 13, 4706, 4974, 6699, 261, 29889, 1359, 414, 29961, 29900, 29962, 1275, 23466, 13, 4706, 6699, 261, 29889, 12657, 29918, 277, 414, 13, 13, 1678, 4256, 29898, 9155, 261, 29897, 13, 1678, 4974, 6699, 261, 29889, 12657, 29918, 277, 414, 13, 2 ]
setup.py
zuokangbo/strack-connect
0
168586
# :coding: utf-8 # :copyright: Copyright (c) 2021 strack """Describe the distribution to distutils.""" # Import third-party modules import os from setuptools import find_packages from setuptools import setup ROOT_PATH = os.path.dirname(os.path.realpath(__file__)) README_PATH = os.path.join(ROOT_PATH, 'README.md') requires = [ 'dayu_widgets >= 0.0.1', 'strack-api >=1.0.0', 'PyYAML >= 5.0' ] setup( name='strack-connect', author='weijer', url='https://github.com/cgpipline/strack-connect', license='Apache License (2.0)', version='0.0.1', author_email='<EMAIL>', description=('Connect for strack.'), long_description=open(README_PATH, 'r', encoding='UTF-8').read(), classifiers=[ 'Operating System :: OS Independent', 'Programming Language :: Python', 'Programming Language :: Python :: Implementation' ], packages=find_packages(), include_package_data=True, zip_safe=False, install_requires=requires, setup_requires=['pytest-runner'], tests_require=['pytest'] )
[ 1, 396, 584, 29883, 3689, 29901, 23616, 29899, 29947, 13, 29937, 584, 8552, 1266, 29901, 14187, 1266, 313, 29883, 29897, 29871, 29906, 29900, 29906, 29896, 5312, 384, 13, 13, 15945, 29908, 4002, 29581, 278, 4978, 304, 1320, 13239, 1213, 15945, 13, 13, 29937, 16032, 4654, 29899, 22633, 10585, 13, 5215, 2897, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 13, 3166, 731, 21245, 8789, 1053, 6230, 13, 13, 21289, 29918, 10145, 353, 2897, 29889, 2084, 29889, 25721, 29898, 359, 29889, 2084, 29889, 6370, 2084, 22168, 1445, 1649, 876, 13, 16310, 2303, 29918, 10145, 353, 2897, 29889, 2084, 29889, 7122, 29898, 21289, 29918, 10145, 29892, 525, 16310, 2303, 29889, 3487, 1495, 13, 13, 276, 339, 2658, 353, 518, 13, 1678, 525, 3250, 29884, 29918, 8030, 29879, 6736, 29871, 29900, 29889, 29900, 29889, 29896, 742, 13, 1678, 525, 4151, 384, 29899, 2754, 6736, 29896, 29889, 29900, 29889, 29900, 742, 13, 1678, 525, 19737, 29979, 23956, 6736, 29871, 29945, 29889, 29900, 29915, 13, 29962, 13, 13, 14669, 29898, 13, 1678, 1024, 2433, 4151, 384, 29899, 6915, 742, 13, 1678, 4148, 2433, 705, 823, 261, 742, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 29883, 29887, 1631, 572, 457, 29914, 4151, 384, 29899, 6915, 742, 13, 1678, 19405, 2433, 17396, 1829, 19245, 313, 29906, 29889, 29900, 29897, 742, 13, 1678, 1873, 2433, 29900, 29889, 29900, 29889, 29896, 742, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 1678, 6139, 29922, 877, 17918, 363, 5312, 384, 29889, 5477, 13, 1678, 1472, 29918, 8216, 29922, 3150, 29898, 16310, 2303, 29918, 10145, 29892, 525, 29878, 742, 8025, 2433, 10496, 29899, 29947, 2824, 949, 3285, 13, 1678, 770, 14903, 11759, 13, 4706, 525, 7094, 1218, 2184, 4761, 6570, 25266, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 4761, 1954, 14607, 29915, 13, 1678, 21251, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 1678, 3160, 29918, 5113, 29918, 1272, 29922, 5574, 29892, 13, 1678, 14319, 29918, 11177, 29922, 8824, 29892, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 276, 339, 2658, 29892, 13, 1678, 6230, 29918, 276, 339, 2658, 29922, 1839, 2272, 1688, 29899, 27492, 7464, 13, 1678, 6987, 29918, 12277, 29922, 1839, 2272, 1688, 2033, 13, 29897, 13, 2 ]
robot/migrations/0011_auto_20200105_1702.py
Misschl/wechat
1
183238
<filename>robot/migrations/0011_auto_20200105_1702.py # Generated by Django 2.1.5 on 2020-01-05 17:02 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('robot', '0010_auto_20200105_1342'), ] operations = [ migrations.AlterModelOptions( name='appmodel', options={'verbose_name': '对接应用', 'verbose_name_plural': '对接应用'}, ), migrations.AlterField( model_name='message', name='is_at', field=models.BooleanField(default=False, null=True), ), migrations.AlterField( model_name='wxuser', name='friend', field=models.BooleanField(null=True, verbose_name='我的好友'), ), migrations.AlterField( model_name='wxuser', name='is_friend', field=models.BooleanField(null=True, verbose_name='和我有好友关系'), ), migrations.AlterField( model_name='wxuser', name='puid', field=models.CharField(help_text='微信用户的外键', max_length=15, primary_key=True, serialize=False), ), ]
[ 1, 529, 9507, 29958, 307, 7451, 29914, 26983, 800, 29914, 29900, 29900, 29896, 29896, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29900, 29896, 29900, 29945, 29918, 29896, 29955, 29900, 29906, 29889, 2272, 13, 29937, 3251, 630, 491, 15337, 29871, 29906, 29889, 29896, 29889, 29945, 373, 29871, 29906, 29900, 29906, 29900, 29899, 29900, 29896, 29899, 29900, 29945, 29871, 29896, 29955, 29901, 29900, 29906, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 307, 7451, 742, 525, 29900, 29900, 29896, 29900, 29918, 6921, 29918, 29906, 29900, 29906, 29900, 29900, 29896, 29900, 29945, 29918, 29896, 29941, 29946, 29906, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3195, 5856, 29898, 13, 9651, 1024, 2433, 932, 4299, 742, 13, 9651, 3987, 3790, 29915, 369, 15828, 29918, 978, 2396, 525, 30783, 31092, 31370, 30406, 742, 525, 369, 15828, 29918, 978, 29918, 572, 3631, 2396, 525, 30783, 31092, 31370, 30406, 16675, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4906, 742, 13, 9651, 1024, 2433, 275, 29918, 271, 742, 13, 9651, 1746, 29922, 9794, 29889, 18146, 3073, 29898, 4381, 29922, 8824, 29892, 1870, 29922, 5574, 511, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 23310, 1792, 742, 13, 9651, 1024, 2433, 18326, 742, 13, 9651, 1746, 29922, 9794, 29889, 18146, 3073, 29898, 4304, 29922, 5574, 29892, 26952, 29918, 978, 2433, 30672, 30210, 31076, 31373, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 23310, 1792, 742, 13, 9651, 1024, 2433, 275, 29918, 18326, 742, 13, 9651, 1746, 29922, 9794, 29889, 18146, 3073, 29898, 4304, 29922, 5574, 29892, 26952, 29918, 978, 2433, 30503, 30672, 30417, 31076, 31373, 31057, 31185, 5477, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 23310, 1792, 742, 13, 9651, 1024, 2433, 3746, 333, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 8477, 29918, 726, 2433, 31935, 30689, 30406, 31229, 30210, 31066, 236, 151, 177, 742, 4236, 29918, 2848, 29922, 29896, 29945, 29892, 7601, 29918, 1989, 29922, 5574, 29892, 28755, 29922, 8824, 511, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
Python/maximum-candies-you-can-get-from-boxes.py
RideGreg/LeetCode
1
73255
<gh_stars>1-10 # Time: O(n^2) # Space: O(n) # 1298 weekly contest 168 12/21/2019 # Given n boxes, each box is given in the format [status, candies, keys, containedBoxes] where: # # status[i]: an integer which is 1 if box[i] is open and 0 if box[i] is closed. # candies[i]: an integer representing the number of candies in box[i]. # keys[i]: an array contains the indices of the boxes you can open with the key in box[i]. # containedBoxes[i]: an array contains the indices of the boxes found in box[i]. # You will start with some boxes given in initialBoxes array. You can take all the candies in any open box and you can use the keys in it to open new boxes and you also can use the boxes you find in it. # # Return the maximum number of candies you can get following the rules above. # Each box is contained in one box at most. # 1 <= status.length <= 1000 import collections class Solution(object): def maxCandies(self, status, candies, keys, containedBoxes, initialBoxes): """ :type status: List[int] :type candies: List[int] :type keys: List[List[int]] :type containedBoxes: List[List[int]] :type initialBoxes: List[int] :rtype: int """ result = 0 q = collections.deque(initialBoxes) while q: changed = False sz = len(q) for _ in range(sz): box = q.popleft() if not status[box]: q.append(box) else: changed = True result += candies[box] for contained_key in keys[box]: status[contained_key] = 1 q.extend(containedBoxes[box]) if not changed: break return result def maxCandies_ming(self, status, candies, keys, containedBoxes, initialBoxes): ans, cur, cont = 0, initialBoxes, True while cont: cont = False nxt = [] for i in cur: if status[i]: ans += candies[i] nxt.extend(containedBoxes[i]) for k in keys[i]: status[k] = 1 cont = True else: nxt.append(i) # 没打开的box统统留到下次处理 cur = nxt return ans ''' #已经意识到一次处理不完,试图作第二次处理。其实仍然不够,应该无限次循环加个退出条件 #key的作用就是改为open状态,维护myKey较麻烦,不如更新状态 oBox, cBox, myKey = [], [], set() q = collections.deque(initialBoxes) while q: i = q.popleft() if status[i] or i in myKey: oBox.append(i) myKey.update(keys[i]) for j in containedBoxes[i]: q.append(j) else: cBox.append(i) oBox2, cBox2 = [], [] q = collections.deque(oBox+cBox) while q: i = q.popleft() if status[i] or i in myKey: oBox2.append(i) myKey.update(keys[i]) else: cBox2.append(i) return sum(candies[i] for i in oBox2) ''' print(Solution().maxCandies([1,0,1,0], [7,5,4,100], [[],[],[1],[]], [[1,2],[3],[],[]], [0])) # 16 print(Solution().maxCandies([1,0,0,0,0,0], [1,1,1,1,1,1], [[1,2,3,4,5],[],[],[],[],[]], [[1,2,3,4,5],[],[],[],[],[]], [0])) # 6 print(Solution().maxCandies([1,1,1], [100,1,100], [[],[0,2],[]], [[],[],[]], [1])) # 1 print(Solution().maxCandies([1], [100], [[]], [[]], [])) # 0 print(Solution().maxCandies([1,1,1], [2,3,2], [[],[],[]], [[],[],[]], [2,1,0])) # 7
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 5974, 29901, 29871, 438, 29898, 29876, 29985, 29906, 29897, 13, 29937, 14121, 29901, 438, 29898, 29876, 29897, 13, 13, 29937, 29871, 29896, 29906, 29929, 29947, 4723, 368, 17793, 29871, 29896, 29953, 29947, 29871, 29896, 29906, 29914, 29906, 29896, 29914, 29906, 29900, 29896, 29929, 13, 13, 29937, 11221, 302, 16273, 29892, 1269, 3800, 338, 2183, 297, 278, 3402, 518, 4882, 29892, 23794, 583, 29892, 6611, 29892, 11122, 3313, 267, 29962, 988, 29901, 13, 29937, 13, 29937, 4660, 29961, 29875, 5387, 385, 6043, 607, 338, 29871, 29896, 565, 3800, 29961, 29875, 29962, 338, 1722, 322, 29871, 29900, 565, 3800, 29961, 29875, 29962, 338, 5764, 29889, 13, 29937, 23794, 583, 29961, 29875, 5387, 385, 6043, 15783, 278, 1353, 310, 23794, 583, 297, 3800, 29961, 29875, 1822, 13, 29937, 6611, 29961, 29875, 5387, 385, 1409, 3743, 278, 16285, 310, 278, 16273, 366, 508, 1722, 411, 278, 1820, 297, 3800, 29961, 29875, 1822, 13, 29937, 11122, 3313, 267, 29961, 29875, 5387, 385, 1409, 3743, 278, 16285, 310, 278, 16273, 1476, 297, 3800, 29961, 29875, 1822, 13, 29937, 887, 674, 1369, 411, 777, 16273, 2183, 297, 2847, 3313, 267, 1409, 29889, 887, 508, 2125, 599, 278, 23794, 583, 297, 738, 1722, 3800, 322, 366, 508, 671, 278, 6611, 297, 372, 304, 1722, 716, 16273, 322, 366, 884, 508, 671, 278, 16273, 366, 1284, 297, 372, 29889, 13, 29937, 13, 29937, 7106, 278, 7472, 1353, 310, 23794, 583, 366, 508, 679, 1494, 278, 6865, 2038, 29889, 13, 13, 29937, 7806, 3800, 338, 11122, 297, 697, 3800, 472, 1556, 29889, 13, 29937, 29871, 29896, 5277, 4660, 29889, 2848, 5277, 29871, 29896, 29900, 29900, 29900, 13, 13, 13, 5215, 16250, 13, 13, 13, 1990, 24380, 29898, 3318, 1125, 13, 1678, 822, 4236, 29907, 392, 583, 29898, 1311, 29892, 4660, 29892, 23794, 583, 29892, 6611, 29892, 11122, 3313, 267, 29892, 2847, 3313, 267, 1125, 13, 4706, 9995, 13, 4706, 584, 1853, 4660, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 1853, 23794, 583, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 1853, 6611, 29901, 2391, 29961, 1293, 29961, 524, 5262, 13, 4706, 584, 1853, 11122, 3313, 267, 29901, 2391, 29961, 1293, 29961, 524, 5262, 13, 4706, 584, 1853, 2847, 3313, 267, 29901, 2391, 29961, 524, 29962, 13, 4706, 584, 29878, 1853, 29901, 938, 13, 4706, 9995, 13, 4706, 1121, 353, 29871, 29900, 13, 4706, 3855, 353, 16250, 29889, 311, 802, 29898, 11228, 3313, 267, 29897, 13, 4706, 1550, 3855, 29901, 13, 9651, 3939, 353, 7700, 13, 9651, 2268, 353, 7431, 29898, 29939, 29897, 13, 9651, 363, 903, 297, 3464, 29898, 3616, 1125, 13, 18884, 3800, 353, 3855, 29889, 7323, 1563, 580, 13, 18884, 565, 451, 4660, 29961, 1884, 5387, 13, 462, 1678, 3855, 29889, 4397, 29898, 1884, 29897, 13, 18884, 1683, 29901, 13, 462, 1678, 3939, 353, 5852, 13, 462, 1678, 1121, 4619, 23794, 583, 29961, 1884, 29962, 13, 462, 1678, 363, 11122, 29918, 1989, 297, 6611, 29961, 1884, 5387, 13, 462, 4706, 4660, 29961, 1285, 7114, 29918, 1989, 29962, 353, 29871, 29896, 13, 462, 1678, 3855, 29889, 21843, 29898, 1285, 7114, 3313, 267, 29961, 1884, 2314, 13, 9651, 565, 451, 3939, 29901, 13, 18884, 2867, 13, 4706, 736, 1121, 13, 13, 1678, 822, 4236, 29907, 392, 583, 29918, 4056, 29898, 1311, 29892, 4660, 29892, 23794, 583, 29892, 6611, 29892, 11122, 3313, 267, 29892, 2847, 3313, 267, 1125, 13, 4706, 6063, 29892, 3151, 29892, 640, 353, 29871, 29900, 29892, 2847, 3313, 267, 29892, 5852, 13, 4706, 1550, 640, 29901, 13, 9651, 640, 353, 7700, 13, 9651, 302, 486, 353, 5159, 13, 9651, 363, 474, 297, 3151, 29901, 13, 18884, 565, 4660, 29961, 29875, 5387, 13, 462, 1678, 6063, 4619, 23794, 583, 29961, 29875, 29962, 13, 462, 1678, 302, 486, 29889, 21843, 29898, 1285, 7114, 3313, 267, 29961, 29875, 2314, 13, 462, 1678, 363, 413, 297, 6611, 29961, 29875, 5387, 13, 462, 4706, 4660, 29961, 29895, 29962, 353, 29871, 29896, 13, 462, 1678, 640, 353, 5852, 13, 18884, 1683, 29901, 13, 462, 1678, 302, 486, 29889, 4397, 29898, 29875, 29897, 396, 29871, 31423, 31656, 31026, 30210, 1884, 31675, 31675, 234, 152, 156, 30780, 30557, 30936, 31548, 30687, 13, 9651, 3151, 353, 302, 486, 13, 4706, 736, 6063, 13, 13, 4706, 14550, 13, 4706, 396, 31290, 31412, 31474, 235, 178, 137, 30780, 30287, 30936, 31548, 30687, 30413, 31366, 30214, 31787, 30861, 30732, 30622, 30685, 30936, 31548, 30687, 30267, 31149, 31195, 231, 190, 144, 31516, 30413, 232, 167, 162, 30214, 31370, 31751, 31352, 31175, 30936, 232, 193, 173, 234, 145, 178, 30666, 30502, 236, 131, 131, 30544, 31217, 30631, 13, 4706, 396, 1989, 30210, 30732, 30406, 31238, 30392, 31264, 30573, 3150, 31531, 31613, 30214, 234, 190, 183, 233, 141, 167, 1357, 2558, 235, 193, 134, 31846, 234, 134, 169, 30214, 30413, 30847, 31100, 30374, 31531, 31613, 13, 4706, 288, 3313, 29892, 274, 3313, 29892, 590, 2558, 353, 19997, 19997, 731, 580, 13, 4706, 3855, 353, 16250, 29889, 311, 802, 29898, 11228, 3313, 267, 29897, 13, 4706, 1550, 3855, 29901, 13, 9651, 474, 353, 3855, 29889, 7323, 1563, 580, 13, 9651, 565, 4660, 29961, 29875, 29962, 470, 474, 297, 590, 2558, 29901, 13, 18884, 288, 3313, 29889, 4397, 29898, 29875, 29897, 13, 18884, 590, 2558, 29889, 5504, 29898, 8149, 29961, 29875, 2314, 13, 18884, 363, 432, 297, 11122, 3313, 267, 29961, 29875, 5387, 13, 462, 1678, 3855, 29889, 4397, 29898, 29926, 29897, 13, 9651, 1683, 29901, 13, 18884, 274, 3313, 29889, 4397, 29898, 29875, 29897, 13, 4706, 288, 3313, 29906, 29892, 274, 3313, 29906, 353, 19997, 5159, 13, 4706, 3855, 353, 16250, 29889, 311, 802, 29898, 29877, 3313, 29974, 29883, 3313, 29897, 13, 4706, 1550, 3855, 29901, 13, 9651, 474, 353, 3855, 29889, 7323, 1563, 580, 13, 9651, 565, 4660, 29961, 29875, 29962, 470, 474, 297, 590, 2558, 29901, 13, 18884, 288, 3313, 29906, 29889, 4397, 29898, 29875, 29897, 13, 18884, 590, 2558, 29889, 5504, 29898, 8149, 29961, 29875, 2314, 13, 9651, 1683, 29901, 13, 18884, 274, 3313, 29906, 29889, 4397, 29898, 29875, 29897, 13, 13, 4706, 736, 2533, 29898, 29883, 392, 583, 29961, 29875, 29962, 363, 474, 297, 288, 3313, 29906, 29897, 13, 4706, 14550, 13, 13, 2158, 29898, 13296, 918, 2141, 3317, 29907, 392, 583, 4197, 29896, 29892, 29900, 29892, 29896, 29892, 29900, 1402, 518, 29955, 29892, 29945, 29892, 29946, 29892, 29896, 29900, 29900, 1402, 5519, 16272, 16272, 29896, 1402, 2636, 1402, 5519, 29896, 29892, 29906, 16272, 29941, 16272, 1402, 2636, 1402, 518, 29900, 12622, 396, 29871, 29896, 29953, 13, 2158, 29898, 13296, 918, 2141, 3317, 29907, 392, 583, 4197, 29896, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 29892, 29900, 1402, 518, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 29892, 29896, 1402, 5519, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 16272, 16272, 16272, 16272, 1402, 2636, 1402, 13, 462, 9651, 5519, 29896, 29892, 29906, 29892, 29941, 29892, 29946, 29892, 29945, 16272, 16272, 16272, 16272, 1402, 2636, 1402, 518, 29900, 12622, 29871, 396, 29871, 29953, 13, 2158, 29898, 13296, 918, 2141, 3317, 29907, 392, 583, 4197, 29896, 29892, 29896, 29892, 29896, 1402, 518, 29896, 29900, 29900, 29892, 29896, 29892, 29896, 29900, 29900, 1402, 5519, 16272, 29900, 29892, 29906, 1402, 2636, 1402, 5519, 16272, 1402, 2636, 1402, 518, 29896, 12622, 396, 29871, 29896, 13, 2158, 29898, 13296, 918, 2141, 3317, 29907, 392, 583, 4197, 29896, 1402, 518, 29896, 29900, 29900, 1402, 518, 2636, 1402, 518, 2636, 1402, 5159, 876, 396, 29871, 29900, 13, 2158, 29898, 13296, 918, 2141, 3317, 29907, 392, 583, 4197, 29896, 29892, 29896, 29892, 29896, 1402, 518, 29906, 29892, 29941, 29892, 29906, 1402, 5519, 16272, 1402, 2636, 1402, 5519, 16272, 1402, 2636, 1402, 518, 29906, 29892, 29896, 29892, 29900, 12622, 396, 29871, 29955, 13, 2 ]
model/data_module.py
ricardorei/lightning-convai
5
65786
# -*- coding: utf-8 -*- r""" DataModule ========== The DataModule encapsulates all the steps needed to process data: - Download / tokenize - Save to disk. - Apply transforms (tokenize, pad, batch creation, etc…). - Load inside Dataset. - Wrap inside a DataLoader. The most important function to understand inside the DataModule is the `build_input` which is responsible by building the inputs that will be used to train the PersonaGPT2 Model. This function receives a tokenized `persona`, `history` and `reply`, concatenates everything and builds the language model targets. It also keeps track of the possition of the token used to represent the entire sequence (the last one). Example: >>> tokenizer = GPT2Tokenizer.from_pretrained("gpt2") >>> DataModule.build_input( tokenizer=tokenizer, persona=[[72, 588], [1820, 318]], history=[[5303, 1804], [316, 20023]], reply=[276, 764], lm_labels=False ) {'input_ids': [50258, 72, 588, 1820, 318, 50260, 5303, 1804, 50261, 316, 20023, 50260, 276, 764, 50258], 'token_type_ids': [50260, 50260, 50260, 50260, 50260, 50261, 50261, 50261, 50260, 50260, 50260, 50261, 50261, 50261, 50261], 'mc_token_ids': 14, 'lm_labels': [-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100]} >>> DataModule.build_input( tokenizer=tokenizer, persona=[[72, 588], [1820, 318]], history=[[5303, 1804], [316, 20023]], reply=[276, 764], lm_labels=True ) {'input_ids': [50258, 72, 588, 1820, 318, 50260, 5303, 1804, 50261, 316, 20023, 50260, 276, 764, 50258], 'token_type_ids': [50260, 50260, 50260, 50260, 50260, 50261, 50261, 50261, 50260, 50260, 50260, 50261, 50261, 50261, 50261], 'mc_token_ids': 14, 'lm_labels': [-100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, -100, 276, 764, 50258]} """ import hashlib import json import multiprocessing import os from argparse import Namespace from collections import defaultdict from itertools import chain from typing import Dict, List import click import torch from torch.utils.data import DataLoader, TensorDataset import pytorch_lightning as pl from model.tokenizer import Tokenizer from torchnlp.download import download_file_maybe_extract PERSONACHAT_URL = "https://s3.amazonaws.com/datasets.huggingface.co/personachat/personachat_self_original.json" PADDED_INPUTS = ["input_ids", "lm_labels", "token_type_ids"] MODEL_INPUTS = ["input_ids", "mc_token_ids", "lm_labels", "mc_labels", "token_type_ids"] class DataModule(pl.LightningDataModule): """PyTorch Lightning DataModule. :param hparams: Namespace with data specific arguments. :param tokenizer: Model Tokenizer. """ def __init__(self, hparams: Namespace, tokenizer: Tokenizer): super().__init__() self.hparams = hparams self.tokenizer = tokenizer @classmethod def build_input( cls, tokenizer: Tokenizer, persona: List[List[int]], history: List[List[int]], reply: List[int] = [], lm_labels: bool = False, ) -> Dict[str, List[int]]: """Builds a model input. :param persona: List of persona sentences tokenized. :param history: List of history sentences tokenizes. :param reply: Tokenized answer. :param lm_labels: Flag to build LM labels for ground-truth replies. :return: Dictionary with model inputs. """ bos, eos, speaker1, speaker2 = ( tokenizer.bos_index, tokenizer.eos_index, tokenizer.speaker1_index, tokenizer.speaker2_index, ) sequence = ( [[bos] + list(chain(*persona))] # concats all persona sentences + history # concats history + [reply + [eos]] # concats reply ) sequence = [sequence[0]] + [ [speaker2 if (len(sequence) - i) % 2 else speaker1] + s for i, s in enumerate(sequence[1:]) ] instance = { "input_ids": list(chain(*sequence)), "token_type_ids": [ speaker2 if i % 2 else speaker1 for i, s in enumerate(sequence) for _ in s ], } instance["mc_token_ids"] = len(instance["input_ids"]) - 1 instance["lm_labels"] = [-100] * len(instance["input_ids"]) if lm_labels: instance["lm_labels"] = ( ([-100] * sum(len(s) for s in sequence[:-1])) + [-100] + sequence[-1][1:] ) return instance def _tokenize(self, obj): if isinstance(obj, str): return self.tokenizer.encode(obj) if isinstance(obj, dict): return dict((k, self._tokenize(o)) for k, o in obj.items()) return list(self._tokenize(o) for o in obj) def _get_dataset( self, dataset_path: str = "", data_folder: str = "data/", ): """Downloads PersonaChat corpus from S3 if no dataset_path is provided. :param dataset_path: Path to a json file containing the train and validation dataset. :param data_folder: Folder used to store data. :return: Returns a dictionary with the training and validation data. """ if not os.path.isfile(dataset_path): click.secho(f"Download dataset from {PERSONACHAT_URL}", fg="yellow") dataset_file = download_file_maybe_extract( PERSONACHAT_URL, directory=data_folder, check_files=["personachat_self_original.json"], ) dataset_path = "data/personachat_self_original.json" dataset_hash = ( int(hashlib.sha256(dataset_path.encode("utf-8")).hexdigest(), 16) % 10 ** 8 ) # To avoid using cache for different models # split(/) for microsoft/DialoGPT-small pretrained_model = ( self.hparams.pretrained_model.split("/")[1] if "/" in self.hparams.pretrained_model else self.hparams.pretrained_model ) dataset_cache = data_folder + ".dataset_" + str(dataset_hash) + pretrained_model if os.path.isfile(dataset_cache): click.secho(f"Loading tokenized dataset from cache: {dataset_cache}.") return torch.load(dataset_cache) else: dataset_file = dataset_path with open(dataset_file, "r", encoding="utf-8") as f: dataset = json.loads(f.read()) click.secho("Running tokenization: This might take some time!", fg="yellow") dataset = self._tokenize(dataset) torch.save(dataset, dataset_cache) return dataset @classmethod def pad_dataset( cls, dataset: dict, padding: int = 0, padded_inputs: List[str] = PADDED_INPUTS ): """ Pad the dataset. NOTE: This could be optimized by defining a Dataset class and padding at the batch level, but this is simpler. :param dataset: Dictionary with sequences to pad. :param padding: padding index. :param padded_inputs: """ max_l = max(len(x) for x in dataset["input_ids"]) for name in padded_inputs: dataset[name] = [ x + [padding if name != "lm_labels" else -100] * (max_l - len(x)) for x in dataset[name] ] return dataset def prepare_data(self): """ Lightning DataModule function that will be used to load/download data, build inputs with padding and to store everything as TensorDatasets. """ personachat = self._get_dataset(self.hparams.dataset_path) click.secho("Building inputs and labels.", fg="yellow") datasets = {"train": defaultdict(list), "valid": defaultdict(list)} for dataset_name, dataset in personachat.items(): num_candidates = len(dataset[0]["utterances"][0]["candidates"]) if self.hparams.num_candidates > 0 and dataset_name == "train": num_candidates = min(self.hparams.num_candidates, num_candidates) for dialog in dataset: persona = dialog["personality"].copy() for _ in range(self.hparams.personality_permutations): for utterance in dialog["utterances"]: history = utterance["history"][ -(2 * self.hparams.max_history + 1) : ] for j, candidate in enumerate( utterance["candidates"][-num_candidates:] ): lm_labels = bool(j == num_candidates - 1) instance = self.build_input( self.tokenizer, persona, history, candidate, lm_labels ) for input_name, input_array in instance.items(): datasets[dataset_name][input_name].append(input_array) datasets[dataset_name]["mc_labels"].append(num_candidates - 1) datasets[dataset_name]["n_candidates"] = num_candidates persona = [persona[-1]] + persona[:-1] # permuted personalities click.secho("Padding inputs and building tensors.", fg="yellow") tensor_datasets = {"train": [], "valid": []} for dataset_name, dataset in datasets.items(): dataset = self.pad_dataset(dataset, padding=self.tokenizer.pad_index) for input_name in MODEL_INPUTS: tensor = torch.tensor(dataset[input_name]) # MC labels contain the labels within the batch! # Thats why we have to split the data according to those batches. if input_name != "mc_labels": tensor = tensor.view( (-1, datasets[dataset_name]["n_candidates"]) + tensor.shape[1:] ) tensor_datasets[dataset_name].append(tensor) self.train_dataset = TensorDataset(*tensor_datasets["train"]) self.valid_dataset = TensorDataset(*tensor_datasets["valid"]) click.secho( "Train dataset (Batch, Candidates, Seq length): {}".format( self.train_dataset.tensors[0].shape ), fg="yellow", ) click.secho( "Valid dataset (Batch, Candidates, Seq length): {}".format( self.valid_dataset.tensors[0].shape ), fg="yellow", ) def train_dataloader(self) -> DataLoader: """ Function that loads the train set. """ return DataLoader( self.train_dataset, batch_size=self.hparams.batch_size, shuffle=True, num_workers=multiprocessing.cpu_count(), ) def val_dataloader(self) -> DataLoader: """ Function that loads the validation set. """ return DataLoader( self.valid_dataset, batch_size=self.hparams.batch_size, shuffle=False, num_workers=multiprocessing.cpu_count(), )
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29878, 15945, 29908, 29871, 13, 1469, 7355, 13, 4936, 1360, 13, 1678, 450, 3630, 7355, 2094, 2547, 352, 1078, 599, 278, 6576, 4312, 304, 1889, 848, 29901, 13, 1678, 448, 25553, 847, 5993, 675, 13, 1678, 448, 16913, 304, 8086, 29889, 13, 1678, 448, 2401, 368, 4327, 29879, 313, 6979, 675, 29892, 17132, 29892, 9853, 11265, 29892, 2992, 30098, 467, 13, 1678, 448, 16012, 2768, 13373, 24541, 29889, 13, 1678, 448, 399, 2390, 2768, 263, 3630, 10036, 29889, 13, 13, 1576, 1556, 4100, 740, 304, 2274, 2768, 278, 3630, 7355, 338, 278, 421, 4282, 29918, 2080, 29952, 607, 29871, 13, 275, 14040, 491, 5214, 278, 10970, 393, 674, 367, 1304, 304, 7945, 278, 5196, 29874, 29954, 7982, 29906, 8125, 29889, 13, 13, 4013, 740, 20586, 263, 5993, 1891, 421, 10532, 29874, 1673, 421, 18434, 29952, 322, 421, 3445, 368, 1673, 16125, 1078, 4129, 13, 392, 23315, 278, 4086, 1904, 22525, 29889, 739, 884, 14874, 5702, 310, 278, 3119, 654, 310, 278, 5993, 1304, 13, 517, 2755, 278, 4152, 5665, 313, 1552, 1833, 697, 467, 13, 13, 14023, 29901, 13, 6778, 29958, 30081, 6979, 3950, 353, 402, 7982, 29906, 6066, 3950, 29889, 3166, 29918, 1457, 3018, 1312, 703, 29887, 415, 29906, 1159, 13, 6778, 29958, 3630, 7355, 29889, 4282, 29918, 2080, 29898, 13, 1678, 5993, 3950, 29922, 6979, 3950, 29892, 13, 1678, 21411, 29922, 8999, 29955, 29906, 29892, 29871, 29945, 29947, 29947, 1402, 518, 29896, 29947, 29906, 29900, 29892, 29871, 29941, 29896, 29947, 20526, 13, 1678, 4955, 29922, 8999, 29945, 29941, 29900, 29941, 29892, 29871, 29896, 29947, 29900, 29946, 1402, 518, 29941, 29896, 29953, 29892, 29871, 29906, 29900, 29900, 29906, 29941, 20526, 13, 1678, 8908, 11759, 29906, 29955, 29953, 29892, 29871, 29955, 29953, 29946, 1402, 13, 1678, 301, 29885, 29918, 21134, 29922, 8824, 13, 29897, 13, 10998, 2080, 29918, 4841, 2396, 518, 29945, 29900, 29906, 29945, 29947, 29892, 29871, 29955, 29906, 29892, 29871, 29945, 29947, 29947, 29892, 29871, 29896, 29947, 29906, 29900, 29892, 29871, 29941, 29896, 29947, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29941, 29900, 29941, 29892, 29871, 29896, 29947, 29900, 29946, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29941, 29896, 29953, 29892, 29871, 29906, 29900, 29900, 29906, 29941, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 13, 29906, 29955, 29953, 29892, 29871, 29955, 29953, 29946, 29892, 29871, 29945, 29900, 29906, 29945, 29947, 1402, 525, 6979, 29918, 1853, 29918, 4841, 2396, 518, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 13, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 1402, 525, 14047, 29918, 6979, 29918, 4841, 2396, 29871, 29896, 29946, 29892, 525, 21457, 29918, 21134, 2396, 29871, 13, 14352, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 12258, 13, 13, 6778, 29958, 3630, 7355, 29889, 4282, 29918, 2080, 29898, 13, 1678, 5993, 3950, 29922, 6979, 3950, 29892, 13, 1678, 21411, 29922, 8999, 29955, 29906, 29892, 29871, 29945, 29947, 29947, 1402, 518, 29896, 29947, 29906, 29900, 29892, 29871, 29941, 29896, 29947, 20526, 13, 1678, 4955, 29922, 8999, 29945, 29941, 29900, 29941, 29892, 29871, 29896, 29947, 29900, 29946, 1402, 518, 29941, 29896, 29953, 29892, 29871, 29906, 29900, 29900, 29906, 29941, 20526, 13, 1678, 8908, 11759, 29906, 29955, 29953, 29892, 29871, 29955, 29953, 29946, 1402, 13, 1678, 301, 29885, 29918, 21134, 29922, 5574, 13, 29897, 13, 10998, 2080, 29918, 4841, 2396, 518, 29945, 29900, 29906, 29945, 29947, 29892, 29871, 29955, 29906, 29892, 29871, 29945, 29947, 29947, 29892, 29871, 29896, 29947, 29906, 29900, 29892, 29871, 29941, 29896, 29947, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29941, 29900, 29941, 29892, 29871, 29896, 29947, 29900, 29946, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29941, 29896, 29953, 29892, 29871, 29906, 29900, 29900, 29906, 29941, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 13, 29906, 29955, 29953, 29892, 29871, 29955, 29953, 29946, 29892, 29871, 29945, 29900, 29906, 29945, 29947, 1402, 29871, 525, 6979, 29918, 1853, 29918, 4841, 2396, 518, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 13, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29900, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 29892, 29871, 29945, 29900, 29906, 29953, 29896, 1402, 525, 14047, 29918, 6979, 29918, 4841, 2396, 29871, 29896, 29946, 29892, 525, 21457, 29918, 21134, 2396, 29871, 13, 14352, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 448, 29896, 29900, 29900, 29892, 29871, 29906, 29955, 29953, 29892, 29871, 29955, 29953, 29946, 29892, 29871, 29945, 29900, 29906, 29945, 29947, 12258, 13, 15945, 29908, 13, 5215, 6608, 1982, 13, 5215, 4390, 13, 5215, 6674, 307, 985, 292, 13, 5215, 2897, 13, 3166, 1852, 5510, 1053, 14706, 3535, 13, 3166, 16250, 1053, 2322, 8977, 13, 3166, 4256, 8504, 1053, 9704, 13, 3166, 19229, 1053, 360, 919, 29892, 2391, 13, 13, 5215, 2828, 13, 5215, 4842, 305, 13, 3166, 4842, 305, 29889, 13239, 29889, 1272, 1053, 3630, 10036, 29892, 323, 6073, 16390, 24541, 13, 13, 5215, 282, 3637, 25350, 29918, 4366, 1076, 408, 715, 13, 3166, 1904, 29889, 6979, 3950, 1053, 25159, 3950, 13, 3166, 4842, 3049, 22833, 29889, 10382, 1053, 5142, 29918, 1445, 29918, 26026, 29918, 21111, 13, 13, 13171, 3094, 2477, 29950, 1299, 29918, 4219, 353, 376, 991, 597, 29879, 29941, 29889, 17260, 10467, 29889, 510, 29914, 14538, 1691, 29889, 29882, 688, 3460, 2161, 29889, 1111, 29914, 10532, 496, 271, 29914, 10532, 496, 271, 29918, 1311, 29918, 13492, 29889, 3126, 29908, 13, 29925, 3035, 2287, 29928, 29918, 1177, 12336, 29903, 353, 6796, 2080, 29918, 4841, 613, 376, 21457, 29918, 21134, 613, 376, 6979, 29918, 1853, 29918, 4841, 3108, 13, 20387, 29931, 29918, 1177, 12336, 29903, 353, 6796, 2080, 29918, 4841, 613, 376, 14047, 29918, 6979, 29918, 4841, 613, 376, 21457, 29918, 21134, 613, 376, 14047, 29918, 21134, 613, 376, 6979, 29918, 1853, 29918, 4841, 3108, 13, 13, 13, 1990, 3630, 7355, 29898, 572, 29889, 20769, 1076, 1469, 7355, 1125, 13, 1678, 9995, 19737, 29911, 25350, 12790, 1076, 3630, 7355, 29889, 13, 13, 1678, 584, 3207, 298, 7529, 29901, 14706, 3535, 411, 848, 2702, 6273, 29889, 13, 1678, 584, 3207, 5993, 3950, 29901, 8125, 25159, 3950, 29889, 13, 13, 1678, 9995, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 298, 7529, 29901, 14706, 3535, 29892, 5993, 3950, 29901, 25159, 3950, 1125, 13, 4706, 2428, 2141, 1649, 2344, 1649, 580, 13, 4706, 1583, 29889, 29882, 7529, 353, 298, 7529, 13, 4706, 1583, 29889, 6979, 3950, 353, 5993, 3950, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 2048, 29918, 2080, 29898, 13, 4706, 1067, 29879, 29892, 13, 4706, 5993, 3950, 29901, 25159, 3950, 29892, 13, 4706, 21411, 29901, 2391, 29961, 1293, 29961, 524, 20526, 13, 4706, 4955, 29901, 2391, 29961, 1293, 29961, 524, 20526, 13, 4706, 8908, 29901, 2391, 29961, 524, 29962, 353, 19997, 13, 4706, 301, 29885, 29918, 21134, 29901, 6120, 353, 7700, 29892, 13, 1678, 1723, 1599, 360, 919, 29961, 710, 29892, 2391, 29961, 524, 5262, 29901, 13, 4706, 9995, 8893, 29879, 263, 1904, 1881, 29889, 13, 13, 4706, 584, 3207, 21411, 29901, 2391, 310, 21411, 25260, 5993, 1891, 29889, 13, 4706, 584, 3207, 4955, 29901, 2391, 310, 4955, 25260, 5993, 7093, 29889, 13, 4706, 584, 3207, 8908, 29901, 25159, 1891, 1234, 29889, 13, 4706, 584, 3207, 301, 29885, 29918, 21134, 29901, 28697, 304, 2048, 365, 29924, 11073, 363, 5962, 29899, 509, 2806, 1634, 3687, 29889, 13, 13, 4706, 584, 2457, 29901, 13343, 411, 1904, 10970, 29889, 13, 4706, 9995, 13, 4706, 13601, 29892, 321, 359, 29892, 25657, 29896, 29892, 25657, 29906, 353, 313, 13, 9651, 5993, 3950, 29889, 27737, 29918, 2248, 29892, 13, 9651, 5993, 3950, 29889, 29872, 359, 29918, 2248, 29892, 13, 9651, 5993, 3950, 29889, 5965, 5790, 29896, 29918, 2248, 29892, 13, 9651, 5993, 3950, 29889, 5965, 5790, 29906, 29918, 2248, 29892, 13, 4706, 1723, 13, 13, 4706, 5665, 353, 313, 13, 9651, 5519, 27737, 29962, 718, 1051, 29898, 14153, 10456, 10532, 29874, 28166, 29871, 396, 3022, 1446, 599, 21411, 25260, 13, 9651, 718, 4955, 29871, 396, 3022, 1446, 4955, 13, 9651, 718, 518, 3445, 368, 718, 518, 29872, 359, 5262, 29871, 396, 3022, 1446, 8908, 13, 4706, 1723, 13, 4706, 5665, 353, 518, 16506, 29961, 29900, 5262, 718, 518, 13, 9651, 518, 5965, 5790, 29906, 565, 313, 2435, 29898, 16506, 29897, 448, 474, 29897, 1273, 29871, 29906, 1683, 25657, 29896, 29962, 718, 269, 13, 9651, 363, 474, 29892, 269, 297, 26985, 29898, 16506, 29961, 29896, 29901, 2314, 13, 4706, 4514, 13, 13, 4706, 2777, 353, 426, 13, 9651, 376, 2080, 29918, 4841, 1115, 1051, 29898, 14153, 10456, 16506, 8243, 13, 9651, 376, 6979, 29918, 1853, 29918, 4841, 1115, 518, 13, 18884, 25657, 29906, 565, 474, 1273, 29871, 29906, 1683, 25657, 29896, 13, 18884, 363, 474, 29892, 269, 297, 26985, 29898, 16506, 29897, 13, 18884, 363, 903, 297, 269, 13, 9651, 21251, 13, 4706, 500, 13, 4706, 2777, 3366, 14047, 29918, 6979, 29918, 4841, 3108, 353, 7431, 29898, 8758, 3366, 2080, 29918, 4841, 20068, 448, 29871, 29896, 13, 13, 4706, 2777, 3366, 21457, 29918, 21134, 3108, 353, 21069, 29896, 29900, 29900, 29962, 334, 7431, 29898, 8758, 3366, 2080, 29918, 4841, 20068, 13, 4706, 565, 301, 29885, 29918, 21134, 29901, 13, 9651, 2777, 3366, 21457, 29918, 21134, 3108, 353, 313, 13, 18884, 9310, 29899, 29896, 29900, 29900, 29962, 334, 2533, 29898, 2435, 29898, 29879, 29897, 363, 269, 297, 5665, 7503, 29899, 29896, 12622, 13, 18884, 718, 21069, 29896, 29900, 29900, 29962, 13, 18884, 718, 5665, 14352, 29896, 3816, 29896, 17531, 13, 9651, 1723, 13, 4706, 736, 2777, 13, 13, 1678, 822, 903, 6979, 675, 29898, 1311, 29892, 5446, 1125, 13, 4706, 565, 338, 8758, 29898, 5415, 29892, 851, 1125, 13, 9651, 736, 1583, 29889, 6979, 3950, 29889, 12508, 29898, 5415, 29897, 13, 13, 4706, 565, 338, 8758, 29898, 5415, 29892, 9657, 1125, 13, 9651, 736, 9657, 3552, 29895, 29892, 1583, 3032, 6979, 675, 29898, 29877, 876, 363, 413, 29892, 288, 297, 5446, 29889, 7076, 3101, 13, 13, 4706, 736, 1051, 29898, 1311, 3032, 6979, 675, 29898, 29877, 29897, 363, 288, 297, 5446, 29897, 13, 13, 1678, 822, 903, 657, 29918, 24713, 29898, 13, 4706, 1583, 29892, 13, 4706, 8783, 29918, 2084, 29901, 851, 353, 12633, 13, 4706, 848, 29918, 12083, 29901, 851, 353, 376, 1272, 29914, 613, 13, 268, 1125, 13, 4706, 9995, 6767, 18132, 5196, 29874, 1451, 271, 1034, 13364, 515, 317, 29941, 565, 694, 8783, 29918, 2084, 338, 4944, 29889, 13, 13, 4706, 584, 3207, 8783, 29918, 2084, 29901, 10802, 304, 263, 4390, 934, 6943, 278, 7945, 322, 8845, 8783, 29889, 13, 4706, 584, 3207, 848, 29918, 12083, 29901, 383, 3194, 1304, 304, 3787, 848, 29889, 13, 13, 4706, 584, 2457, 29901, 16969, 263, 8600, 411, 278, 6694, 322, 8845, 848, 29889, 13, 4706, 9995, 13, 4706, 565, 451, 2897, 29889, 2084, 29889, 275, 1445, 29898, 24713, 29918, 2084, 1125, 13, 9651, 2828, 29889, 344, 1859, 29898, 29888, 29908, 22954, 8783, 515, 426, 13171, 3094, 2477, 29950, 1299, 29918, 4219, 17671, 285, 29887, 543, 29136, 1159, 13, 9651, 8783, 29918, 1445, 353, 5142, 29918, 1445, 29918, 26026, 29918, 21111, 29898, 13, 18884, 349, 1001, 3094, 2477, 29950, 1299, 29918, 4219, 29892, 13, 18884, 3884, 29922, 1272, 29918, 12083, 29892, 13, 18884, 1423, 29918, 5325, 29922, 3366, 10532, 496, 271, 29918, 1311, 29918, 13492, 29889, 3126, 12436, 13, 9651, 1723, 13, 9651, 8783, 29918, 2084, 353, 376, 1272, 29914, 10532, 496, 271, 29918, 1311, 29918, 13492, 29889, 3126, 29908, 13, 13, 4706, 8783, 29918, 8568, 353, 313, 13, 9651, 938, 29898, 8568, 1982, 29889, 17051, 29906, 29945, 29953, 29898, 24713, 29918, 2084, 29889, 12508, 703, 9420, 29899, 29947, 1159, 467, 20970, 7501, 342, 3285, 29871, 29896, 29953, 29897, 1273, 29871, 29896, 29900, 3579, 29871, 29947, 13, 4706, 1723, 13, 4706, 396, 1763, 4772, 773, 7090, 363, 1422, 4733, 13, 4706, 396, 6219, 29898, 4551, 363, 286, 2995, 29914, 29928, 616, 29877, 29954, 7982, 29899, 9278, 13, 4706, 758, 3018, 1312, 29918, 4299, 353, 313, 13, 9651, 1583, 29889, 29882, 7529, 29889, 1457, 3018, 1312, 29918, 4299, 29889, 5451, 11974, 1159, 29961, 29896, 29962, 13, 9651, 565, 5591, 29908, 297, 1583, 29889, 29882, 7529, 29889, 1457, 3018, 1312, 29918, 4299, 13, 9651, 1683, 1583, 29889, 29882, 7529, 29889, 1457, 3018, 1312, 29918, 4299, 13, 4706, 1723, 13, 4706, 8783, 29918, 8173, 353, 848, 29918, 12083, 718, 11393, 24713, 27508, 718, 851, 29898, 24713, 29918, 8568, 29897, 718, 758, 3018, 1312, 29918, 4299, 13, 13, 4706, 565, 2897, 29889, 2084, 29889, 275, 1445, 29898, 24713, 29918, 8173, 1125, 13, 9651, 2828, 29889, 344, 1859, 29898, 29888, 29908, 23456, 5993, 1891, 8783, 515, 7090, 29901, 426, 24713, 29918, 8173, 1836, 1159, 13, 9651, 736, 4842, 305, 29889, 1359, 29898, 24713, 29918, 8173, 29897, 13, 4706, 1683, 29901, 13, 9651, 8783, 29918, 1445, 353, 8783, 29918, 2084, 13, 13, 4706, 411, 1722, 29898, 24713, 29918, 1445, 29892, 376, 29878, 613, 8025, 543, 9420, 29899, 29947, 1159, 408, 285, 29901, 13, 9651, 8783, 353, 4390, 29889, 18132, 29898, 29888, 29889, 949, 3101, 13, 13, 4706, 2828, 29889, 344, 1859, 703, 27795, 5993, 2133, 29901, 910, 1795, 2125, 777, 931, 29991, 613, 285, 29887, 543, 29136, 1159, 13, 4706, 8783, 353, 1583, 3032, 6979, 675, 29898, 24713, 29897, 13, 4706, 4842, 305, 29889, 7620, 29898, 24713, 29892, 8783, 29918, 8173, 29897, 13, 13, 4706, 736, 8783, 13, 13, 1678, 732, 1990, 5696, 13, 1678, 822, 17132, 29918, 24713, 29898, 13, 4706, 1067, 29879, 29892, 8783, 29901, 9657, 29892, 7164, 29901, 938, 353, 29871, 29900, 29892, 282, 23959, 29918, 2080, 29879, 29901, 2391, 29961, 710, 29962, 353, 349, 3035, 2287, 29928, 29918, 1177, 12336, 29903, 13, 268, 1125, 13, 4706, 9995, 13, 4706, 18011, 278, 8783, 29889, 13, 4706, 6058, 29923, 29901, 910, 1033, 367, 27545, 491, 16184, 263, 13373, 24541, 770, 322, 13, 4706, 7164, 472, 278, 9853, 3233, 29892, 541, 445, 338, 13682, 29889, 13, 13, 4706, 584, 3207, 8783, 29901, 13343, 411, 15602, 304, 17132, 29889, 13, 4706, 584, 3207, 7164, 29901, 7164, 2380, 29889, 13, 4706, 584, 3207, 282, 23959, 29918, 2080, 29879, 29901, 13, 4706, 9995, 13, 4706, 4236, 29918, 29880, 353, 4236, 29898, 2435, 29898, 29916, 29897, 363, 921, 297, 8783, 3366, 2080, 29918, 4841, 20068, 13, 4706, 363, 1024, 297, 282, 23959, 29918, 2080, 29879, 29901, 13, 9651, 8783, 29961, 978, 29962, 353, 518, 13, 18884, 921, 718, 518, 12791, 565, 1024, 2804, 376, 21457, 29918, 21134, 29908, 1683, 448, 29896, 29900, 29900, 29962, 334, 313, 3317, 29918, 29880, 448, 7431, 29898, 29916, 876, 13, 18884, 363, 921, 297, 8783, 29961, 978, 29962, 13, 9651, 4514, 13, 4706, 736, 8783, 13, 13, 1678, 822, 19012, 29918, 1272, 29898, 1311, 1125, 13, 4706, 9995, 13, 4706, 12790, 1076, 3630, 7355, 740, 393, 674, 367, 1304, 304, 2254, 29914, 10382, 848, 29892, 13, 4706, 2048, 10970, 411, 7164, 322, 304, 3787, 4129, 408, 323, 6073, 16390, 294, 1691, 29889, 13, 4706, 9995, 13, 4706, 2022, 496, 271, 353, 1583, 3032, 657, 29918, 24713, 29898, 1311, 29889, 29882, 7529, 29889, 24713, 29918, 2084, 29897, 13, 13, 4706, 2828, 29889, 344, 1859, 703, 8893, 292, 10970, 322, 11073, 19602, 285, 29887, 543, 29136, 1159, 13, 4706, 20035, 353, 8853, 14968, 1115, 2322, 8977, 29898, 1761, 511, 376, 3084, 1115, 2322, 8977, 29898, 1761, 2915, 13, 4706, 363, 8783, 29918, 978, 29892, 8783, 297, 2022, 496, 271, 29889, 7076, 7295, 13, 9651, 954, 29918, 29883, 5380, 1078, 353, 7431, 29898, 24713, 29961, 29900, 29962, 3366, 6463, 2925, 3108, 29961, 29900, 29962, 3366, 29883, 5380, 1078, 20068, 13, 9651, 565, 1583, 29889, 29882, 7529, 29889, 1949, 29918, 29883, 5380, 1078, 1405, 29871, 29900, 322, 8783, 29918, 978, 1275, 376, 14968, 1115, 13, 18884, 954, 29918, 29883, 5380, 1078, 353, 1375, 29898, 1311, 29889, 29882, 7529, 29889, 1949, 29918, 29883, 5380, 1078, 29892, 954, 29918, 29883, 5380, 1078, 29897, 13, 13, 9651, 363, 7928, 297, 8783, 29901, 13, 18884, 21411, 353, 7928, 3366, 10532, 2877, 16862, 8552, 580, 13, 13, 18884, 363, 903, 297, 3464, 29898, 1311, 29889, 29882, 7529, 29889, 10532, 2877, 29918, 546, 6149, 800, 1125, 13, 13, 462, 1678, 363, 14401, 749, 297, 7928, 3366, 6463, 2925, 3108, 29901, 13, 462, 4706, 4955, 353, 14401, 749, 3366, 18434, 3108, 29961, 13, 462, 9651, 19691, 29906, 334, 1583, 29889, 29882, 7529, 29889, 3317, 29918, 18434, 718, 29871, 29896, 29897, 584, 13, 462, 4706, 4514, 13, 13, 462, 4706, 363, 432, 29892, 14020, 297, 26985, 29898, 13, 462, 9651, 14401, 749, 3366, 29883, 5380, 1078, 3108, 14352, 1949, 29918, 29883, 5380, 1078, 17531, 13, 462, 308, 1125, 13, 462, 9651, 301, 29885, 29918, 21134, 353, 6120, 29898, 29926, 1275, 954, 29918, 29883, 5380, 1078, 448, 29871, 29896, 29897, 13, 462, 9651, 2777, 353, 1583, 29889, 4282, 29918, 2080, 29898, 13, 462, 18884, 1583, 29889, 6979, 3950, 29892, 21411, 29892, 4955, 29892, 14020, 29892, 301, 29885, 29918, 21134, 13, 462, 9651, 1723, 13, 13, 462, 9651, 363, 1881, 29918, 978, 29892, 1881, 29918, 2378, 297, 2777, 29889, 7076, 7295, 13, 462, 18884, 20035, 29961, 24713, 29918, 978, 3816, 2080, 29918, 978, 1822, 4397, 29898, 2080, 29918, 2378, 29897, 13, 13, 462, 4706, 20035, 29961, 24713, 29918, 978, 29962, 3366, 14047, 29918, 21134, 16862, 4397, 29898, 1949, 29918, 29883, 5380, 1078, 448, 29871, 29896, 29897, 13, 462, 4706, 20035, 29961, 24713, 29918, 978, 29962, 3366, 29876, 29918, 29883, 5380, 1078, 3108, 353, 954, 29918, 29883, 5380, 1078, 13, 13, 462, 1678, 21411, 353, 518, 10532, 29874, 14352, 29896, 5262, 718, 21411, 7503, 29899, 29896, 29962, 29871, 396, 3635, 3860, 7333, 1907, 13, 13, 4706, 2828, 29889, 344, 1859, 703, 29925, 4676, 10970, 322, 5214, 25187, 943, 19602, 285, 29887, 543, 29136, 1159, 13, 4706, 12489, 29918, 14538, 1691, 353, 8853, 14968, 1115, 19997, 376, 3084, 1115, 5159, 29913, 13, 4706, 363, 8783, 29918, 978, 29892, 8783, 297, 20035, 29889, 7076, 7295, 13, 9651, 8783, 353, 1583, 29889, 8305, 29918, 24713, 29898, 24713, 29892, 7164, 29922, 1311, 29889, 6979, 3950, 29889, 8305, 29918, 2248, 29897, 13, 13, 9651, 363, 1881, 29918, 978, 297, 16999, 2287, 29931, 29918, 1177, 12336, 29903, 29901, 13, 18884, 12489, 353, 4842, 305, 29889, 20158, 29898, 24713, 29961, 2080, 29918, 978, 2314, 13, 13, 18884, 396, 21271, 11073, 1712, 278, 11073, 2629, 278, 9853, 29991, 13, 18884, 396, 498, 1446, 2020, 591, 505, 304, 6219, 278, 848, 5034, 304, 1906, 9853, 267, 29889, 13, 18884, 565, 1881, 29918, 978, 2804, 376, 14047, 29918, 21134, 1115, 13, 462, 1678, 12489, 353, 12489, 29889, 1493, 29898, 13, 462, 4706, 8521, 29896, 29892, 20035, 29961, 24713, 29918, 978, 29962, 3366, 29876, 29918, 29883, 5380, 1078, 20068, 718, 12489, 29889, 12181, 29961, 29896, 17531, 13, 462, 1678, 1723, 13, 13, 18884, 12489, 29918, 14538, 1691, 29961, 24713, 29918, 978, 1822, 4397, 29898, 20158, 29897, 13, 13, 4706, 1583, 29889, 14968, 29918, 24713, 353, 323, 6073, 16390, 24541, 10456, 20158, 29918, 14538, 1691, 3366, 14968, 20068, 13, 4706, 1583, 29889, 3084, 29918, 24713, 353, 323, 6073, 16390, 24541, 10456, 20158, 29918, 14538, 1691, 3366, 3084, 20068, 13, 4706, 2828, 29889, 344, 1859, 29898, 13, 9651, 376, 5323, 262, 8783, 313, 23145, 29892, 315, 5380, 1078, 29892, 25981, 3309, 1125, 6571, 1642, 4830, 29898, 13, 18884, 1583, 29889, 14968, 29918, 24713, 29889, 29873, 575, 943, 29961, 29900, 1822, 12181, 13, 9651, 10353, 13, 9651, 285, 29887, 543, 29136, 613, 13, 4706, 1723, 13, 4706, 2828, 29889, 344, 1859, 29898, 13, 9651, 376, 7211, 8783, 313, 23145, 29892, 315, 5380, 1078, 29892, 25981, 3309, 1125, 6571, 1642, 4830, 29898, 13, 18884, 1583, 29889, 3084, 29918, 24713, 29889, 29873, 575, 943, 29961, 29900, 1822, 12181, 13, 9651, 10353, 13, 9651, 285, 29887, 543, 29136, 613, 13, 4706, 1723, 13, 13, 1678, 822, 7945, 29918, 29881, 2075, 29877, 1664, 29898, 1311, 29897, 1599, 3630, 10036, 29901, 13, 4706, 9995, 6680, 393, 15376, 278, 7945, 731, 29889, 9995, 13, 4706, 736, 3630, 10036, 29898, 13, 9651, 1583, 29889, 14968, 29918, 24713, 29892, 13, 9651, 9853, 29918, 2311, 29922, 1311, 29889, 29882, 7529, 29889, 16175, 29918, 2311, 29892, 13, 9651, 528, 21897, 29922, 5574, 29892, 13, 9651, 954, 29918, 1287, 414, 29922, 18056, 307, 985, 292, 29889, 21970, 29918, 2798, 3285, 13, 4706, 1723, 13, 13, 1678, 822, 659, 29918, 29881, 2075, 29877, 1664, 29898, 1311, 29897, 1599, 3630, 10036, 29901, 13, 4706, 9995, 6680, 393, 15376, 278, 8845, 731, 29889, 9995, 13, 4706, 736, 3630, 10036, 29898, 13, 9651, 1583, 29889, 3084, 29918, 24713, 29892, 13, 9651, 9853, 29918, 2311, 29922, 1311, 29889, 29882, 7529, 29889, 16175, 29918, 2311, 29892, 13, 9651, 528, 21897, 29922, 8824, 29892, 13, 9651, 954, 29918, 1287, 414, 29922, 18056, 307, 985, 292, 29889, 21970, 29918, 2798, 3285, 13, 4706, 1723, 13, 2 ]
Ex_Files_Python_EssT/Exercise Files/Chap01/rockPaperScissors.py
cinthiatengan/Basic-Python
0
39773
<reponame>cinthiatengan/Basic-Python """ Rock Paper Scissors -------------------------------------------------------------- """ import random import os import re os.system('cls' if os.name=='nt' else clear) while (1< 2): print ("\n") print ("Rock, Paper, Scissors - Shoot!") userChoice = input("Choose your weapon [R]ock, [P]aper, or [S]cissors: ") if not re.match("[SsRrPp]", userChoice): print ("Please choose a letter: ") print ("[R]ock, [P]aper, or [S]cissors.") continue # Echo the user's choice print ("You choose: " + userChoice) choices = ['R', 'P', 'S'] opponentChoice = random.choice(choices) print ("I choose: " + opponentChoice) if opponentChoice == str.upper(userChoice): print ("Tie!") elif opponentChoice == 'R' and userChoice.upper() == 'S': print ("Rock beats Scissors, I lose") continue elif opponentChoice == 'S' and userChoice.upper() == 'P': print ("Scissors beats paper, I lose") continue elif opponentChoice == 'P' and userChoice.upper() == 'R': print ("Paper beats rock, I lose") continue else: print ("I win!")
[ 1, 529, 276, 1112, 420, 29958, 16381, 386, 7163, 996, 273, 29914, 16616, 29899, 11980, 13, 15945, 29908, 8027, 349, 7202, 2522, 790, 943, 13, 2683, 2683, 2683, 9072, 489, 13, 15945, 29908, 13, 13, 5215, 4036, 13, 5215, 2897, 13, 5215, 337, 13, 359, 29889, 5205, 877, 25932, 29915, 565, 2897, 29889, 978, 1360, 29915, 593, 29915, 1683, 2821, 29897, 13, 8000, 313, 29896, 29966, 29871, 29906, 1125, 13, 1678, 1596, 4852, 29905, 29876, 1159, 13, 1678, 1596, 4852, 29934, 1698, 29892, 349, 7202, 29892, 2522, 790, 943, 448, 17550, 327, 29991, 1159, 13, 1678, 1404, 29620, 353, 1881, 703, 15954, 852, 596, 28639, 518, 29934, 29962, 1698, 29892, 518, 29925, 29962, 7202, 29892, 470, 518, 29903, 29962, 29883, 790, 943, 29901, 16521, 13, 1678, 565, 451, 337, 29889, 4352, 703, 29961, 29903, 29879, 29934, 29878, 29925, 29886, 29962, 613, 1404, 29620, 1125, 13, 4706, 1596, 4852, 12148, 6755, 263, 5497, 29901, 16521, 13, 4706, 1596, 4852, 29961, 29934, 29962, 1698, 29892, 518, 29925, 29962, 7202, 29892, 470, 518, 29903, 29962, 29883, 790, 943, 23157, 13, 4706, 6773, 13, 1678, 396, 382, 1859, 278, 1404, 29915, 29879, 7348, 13, 1678, 1596, 4852, 3492, 6755, 29901, 376, 718, 1404, 29620, 29897, 13, 1678, 19995, 353, 6024, 29934, 742, 525, 29925, 742, 525, 29903, 2033, 13, 1678, 23995, 296, 29620, 353, 4036, 29889, 16957, 29898, 1859, 1575, 29897, 13, 1678, 1596, 4852, 29902, 6755, 29901, 376, 718, 23995, 296, 29620, 29897, 13, 1678, 565, 23995, 296, 29620, 1275, 851, 29889, 21064, 29898, 1792, 29620, 1125, 13, 4706, 1596, 4852, 29911, 347, 29991, 1159, 13, 1678, 25342, 23995, 296, 29620, 1275, 525, 29934, 29915, 322, 1404, 29620, 29889, 21064, 580, 1275, 525, 29903, 2396, 13, 4706, 1596, 4852, 29934, 1698, 367, 1446, 2522, 790, 943, 29892, 306, 14074, 1159, 13, 4706, 6773, 13, 1678, 25342, 23995, 296, 29620, 1275, 525, 29903, 29915, 322, 1404, 29620, 29889, 21064, 580, 1275, 525, 29925, 2396, 13, 4706, 1596, 4852, 4421, 790, 943, 367, 1446, 5650, 29892, 306, 14074, 1159, 13, 4706, 6773, 13, 1678, 25342, 23995, 296, 29620, 1275, 525, 29925, 29915, 322, 1404, 29620, 29889, 21064, 580, 1275, 525, 29934, 2396, 13, 4706, 1596, 4852, 29925, 7202, 367, 1446, 7679, 29892, 306, 14074, 1159, 13, 4706, 6773, 13, 1678, 1683, 29901, 13, 4706, 1596, 4852, 29902, 5401, 29991, 1159, 2 ]
algDev/visualization/plot_indicators.py
ajmal017/ralph-usa
0
34953
from models.indicators import Indicators import numpy as np import matplotlib.pyplot as plt def plot_prices(ax, prices, line_style): i = np.arange(len(prices)) ax.plot(ax, prices, line_style) return ax def plot_macd(ax, prices, slow_period, fast_period, line_style='k-'): macd = Indicators.macd(prices, slow_period, fast_period)[slow_period - 1:] i = np.arange(len(prices))[slow_period-1:] ax.plot(i, macd, line_style) return ax def plot_ema(ax, prices, period, line_style='k-'): ema = Indicators.ema(prices, period)[period-1:] i = np.arange(len(prices))[period-1:] ax.plot(i, ema, line_style) return ax
[ 1, 515, 4733, 29889, 513, 293, 4097, 1053, 1894, 293, 4097, 13, 5215, 12655, 408, 7442, 13, 5215, 29871, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 1753, 6492, 29918, 558, 1575, 29898, 1165, 29892, 26094, 29892, 1196, 29918, 3293, 1125, 13, 1678, 474, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 558, 1575, 876, 13, 1678, 4853, 29889, 5317, 29898, 1165, 29892, 26094, 29892, 1196, 29918, 3293, 29897, 13, 13, 1678, 736, 4853, 13, 13, 1753, 6492, 29918, 8628, 29881, 29898, 1165, 29892, 26094, 29892, 5232, 29918, 19145, 29892, 5172, 29918, 19145, 29892, 1196, 29918, 3293, 2433, 29895, 29899, 29374, 13, 1678, 5825, 29881, 353, 1894, 293, 4097, 29889, 8628, 29881, 29898, 558, 1575, 29892, 5232, 29918, 19145, 29892, 5172, 29918, 19145, 9601, 28544, 29918, 19145, 448, 29871, 29896, 17531, 13, 1678, 474, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 558, 1575, 876, 29961, 28544, 29918, 19145, 29899, 29896, 17531, 13, 1678, 4853, 29889, 5317, 29898, 29875, 29892, 5825, 29881, 29892, 1196, 29918, 3293, 29897, 13, 13, 1678, 736, 4853, 13, 13, 1753, 6492, 29918, 2603, 29898, 1165, 29892, 26094, 29892, 3785, 29892, 1196, 29918, 3293, 2433, 29895, 29899, 29374, 13, 1678, 321, 655, 353, 1894, 293, 4097, 29889, 2603, 29898, 558, 1575, 29892, 3785, 9601, 19145, 29899, 29896, 17531, 13, 1678, 474, 353, 7442, 29889, 279, 927, 29898, 2435, 29898, 558, 1575, 876, 29961, 19145, 29899, 29896, 17531, 13, 13, 1678, 4853, 29889, 5317, 29898, 29875, 29892, 321, 655, 29892, 1196, 29918, 3293, 29897, 13, 13, 1678, 736, 4853, 13, 2 ]
serve.py
uwmisl/purpledrop-driver
0
27038
from gevent import monkey monkey.patch_all() import sys import purpledrop.server as server from purpledrop.purpledrop import list_purpledrop_devices, PurpleDropDevice, PurpleDropController devices = list_purpledrop_devices() if(len(devices) == 0): print("No PurpleDrop USB device found") sys.exit(1) elif len(devices) > 1: print("Multiple PurpleDrop devices found. Please ammend software to allow selection by serial number") for d in devices: print(f"{d.device}: Serial {d.serial_number}") sys.exit(1) dev = PurpleDropDevice(devices[0].device) controller = PurpleDropController(dev) server.run_server(controller, "localhost:5000")
[ 1, 29871, 13, 3166, 1737, 794, 1053, 1601, 1989, 13, 3712, 1989, 29889, 5041, 29918, 497, 580, 13, 5215, 10876, 13, 5215, 3708, 552, 8865, 29889, 2974, 408, 1923, 13, 3166, 3708, 552, 8865, 29889, 15503, 552, 8865, 1053, 1051, 29918, 15503, 552, 8865, 29918, 3359, 1575, 29892, 15247, 552, 15063, 11501, 29892, 15247, 552, 15063, 2956, 13, 13, 3359, 1575, 353, 1051, 29918, 15503, 552, 8865, 29918, 3359, 1575, 580, 13, 361, 29898, 2435, 29898, 3359, 1575, 29897, 1275, 29871, 29900, 1125, 13, 1678, 1596, 703, 3782, 15247, 552, 15063, 12951, 4742, 1476, 1159, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 23681, 7431, 29898, 3359, 1575, 29897, 1405, 29871, 29896, 29901, 29871, 13, 1678, 1596, 703, 15329, 552, 15247, 552, 15063, 9224, 1476, 29889, 3529, 626, 29885, 355, 7047, 304, 2758, 9262, 491, 7797, 1353, 1159, 13, 1678, 363, 270, 297, 9224, 29901, 13, 4706, 1596, 29898, 29888, 29908, 29912, 29881, 29889, 10141, 6177, 18896, 426, 29881, 29889, 15550, 29918, 4537, 27195, 13, 1678, 10876, 29889, 13322, 29898, 29896, 29897, 13, 3359, 353, 15247, 552, 15063, 11501, 29898, 3359, 1575, 29961, 29900, 1822, 10141, 29897, 13, 8299, 353, 15247, 552, 15063, 2956, 29898, 3359, 29897, 13, 13, 2974, 29889, 3389, 29918, 2974, 29898, 8299, 29892, 376, 7640, 29901, 29945, 29900, 29900, 29900, 1159, 13, 2 ]
pybabylonjs/babylonjs.py
TileDB-Inc/TileDB-PyBabylonJS
2
50179
<filename>pybabylonjs/babylonjs.py<gh_stars>1-10 #!/usr/bin/env python # coding: utf-8 # Copyright (c) TileDB, Inc.. # Distributed under the terms of the Modified BSD License. """ BabylonJS Jupyter Widget """ from ipywidgets import DOMWidget import json import os from traitlets import CInt, Float, Dict, List, TraitError, Unicode, validate from ._frontend import module_name, module_version class BabylonJS(DOMWidget): """BabylonJS""" _model_name = Unicode("BabylonJSModel").tag(sync=True) _model_module = Unicode(module_name).tag(sync=True) _model_module_version = Unicode(module_version).tag(sync=True) _view_name = Unicode("BabylonJSView").tag(sync=True) _view_module = Unicode(module_name).tag(sync=True) _view_module_version = Unicode(module_version).tag(sync=True) extents = List().tag(sync=True) width = CInt(700).tag(sync=True) height = CInt(500).tag(sync=True) query = Dict().tag(sync=True) token = Unicode(os.getenv("TILEDB_REST_TOKEN", "")).tag(sync=True) uri = Unicode().tag(sync=True) value = Dict().tag(sync=True) wheel_precision = Float(50.0).tag(sync=True) z_scale = Float(0.5).tag(sync=True) @validate("value") def _valid_value(self, proposal): if proposal.value: reqd = ["X", "Y", "Z", "Red", "Green", "Blue"] if not all(key in proposal.value.keys() for key in reqd): raise TraitError(f"Missing one of {reqd} in input") data = {} data["X"] = proposal.value["X"].tolist() data["Y"] = proposal.value["Y"].tolist() data["Z"] = proposal.value["Z"].tolist() data["Red"] = proposal.value["Red"].tolist() data["Green"] = proposal.value["Green"].tolist() data["Blue"] = proposal.value["Blue"].tolist() self.extents = [ min(data["X"]), max(data["X"]), min(data["Y"]), max(data["Y"]), min(data["Z"]), max(data["Z"]), ] return json.dumps(data) else: return proposal.value
[ 1, 529, 9507, 29958, 2272, 29890, 370, 2904, 265, 1315, 29914, 29890, 370, 2904, 265, 1315, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 6272, 3017, 13, 29937, 14137, 29901, 23616, 29899, 29947, 13, 13, 29937, 14187, 1266, 313, 29883, 29897, 323, 488, 4051, 29892, 9266, 636, 13, 29937, 6652, 7541, 1090, 278, 4958, 310, 278, 3382, 2164, 350, 7230, 19245, 29889, 13, 13, 15945, 29908, 13, 29933, 370, 2904, 265, 8700, 27441, 25547, 27080, 13, 15945, 29908, 13, 13, 3166, 474, 2272, 8030, 29879, 1053, 12369, 8801, 13, 5215, 4390, 13, 5215, 2897, 13, 3166, 22917, 10376, 1053, 315, 2928, 29892, 27842, 29892, 360, 919, 29892, 2391, 29892, 3201, 277, 2392, 29892, 23862, 29892, 12725, 13, 3166, 869, 29918, 8862, 355, 1053, 3883, 29918, 978, 29892, 3883, 29918, 3259, 13, 13, 13, 1990, 14525, 2904, 265, 8700, 29898, 22141, 8801, 1125, 13, 1678, 9995, 29933, 370, 2904, 265, 8700, 15945, 29908, 13, 13, 1678, 903, 4299, 29918, 978, 353, 23862, 703, 29933, 370, 2904, 265, 8700, 3195, 2564, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 903, 4299, 29918, 5453, 353, 23862, 29898, 5453, 29918, 978, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 903, 4299, 29918, 5453, 29918, 3259, 353, 23862, 29898, 5453, 29918, 3259, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 903, 1493, 29918, 978, 353, 23862, 703, 29933, 370, 2904, 265, 8700, 1043, 2564, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 903, 1493, 29918, 5453, 353, 23862, 29898, 5453, 29918, 978, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 903, 1493, 29918, 5453, 29918, 3259, 353, 23862, 29898, 5453, 29918, 3259, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 13, 1678, 1294, 1237, 353, 2391, 2141, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 2920, 353, 315, 2928, 29898, 29955, 29900, 29900, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 3171, 353, 315, 2928, 29898, 29945, 29900, 29900, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 2346, 353, 360, 919, 2141, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 5993, 353, 23862, 29898, 359, 29889, 657, 6272, 703, 24301, 1307, 4051, 29918, 1525, 1254, 29918, 4986, 29968, 1430, 613, 20569, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 21333, 353, 23862, 2141, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 995, 353, 360, 919, 2141, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 18875, 29918, 17990, 2459, 353, 27842, 29898, 29945, 29900, 29889, 29900, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 1678, 503, 29918, 7052, 353, 27842, 29898, 29900, 29889, 29945, 467, 4039, 29898, 16593, 29922, 5574, 29897, 13, 13, 1678, 732, 15480, 703, 1767, 1159, 13, 1678, 822, 903, 3084, 29918, 1767, 29898, 1311, 29892, 24963, 1125, 13, 4706, 565, 24963, 29889, 1767, 29901, 13, 9651, 12428, 29881, 353, 6796, 29990, 613, 376, 29979, 613, 376, 29999, 613, 376, 9039, 613, 376, 24599, 613, 376, 21319, 3108, 13, 13, 9651, 565, 451, 599, 29898, 1989, 297, 24963, 29889, 1767, 29889, 8149, 580, 363, 1820, 297, 12428, 29881, 1125, 13, 18884, 12020, 3201, 277, 2392, 29898, 29888, 29908, 18552, 292, 697, 310, 426, 7971, 29881, 29913, 297, 1881, 1159, 13, 13, 9651, 848, 353, 6571, 13, 9651, 848, 3366, 29990, 3108, 353, 24963, 29889, 1767, 3366, 29990, 16862, 25027, 391, 580, 13, 9651, 848, 3366, 29979, 3108, 353, 24963, 29889, 1767, 3366, 29979, 16862, 25027, 391, 580, 13, 9651, 848, 3366, 29999, 3108, 353, 24963, 29889, 1767, 3366, 29999, 16862, 25027, 391, 580, 13, 9651, 848, 3366, 9039, 3108, 353, 24963, 29889, 1767, 3366, 9039, 16862, 25027, 391, 580, 13, 9651, 848, 3366, 24599, 3108, 353, 24963, 29889, 1767, 3366, 24599, 16862, 25027, 391, 580, 13, 9651, 848, 3366, 21319, 3108, 353, 24963, 29889, 1767, 3366, 21319, 16862, 25027, 391, 580, 13, 13, 9651, 1583, 29889, 1062, 1237, 353, 518, 13, 18884, 1375, 29898, 1272, 3366, 29990, 3108, 511, 13, 18884, 4236, 29898, 1272, 3366, 29990, 3108, 511, 13, 18884, 1375, 29898, 1272, 3366, 29979, 3108, 511, 13, 18884, 4236, 29898, 1272, 3366, 29979, 3108, 511, 13, 18884, 1375, 29898, 1272, 3366, 29999, 3108, 511, 13, 18884, 4236, 29898, 1272, 3366, 29999, 3108, 511, 13, 9651, 4514, 13, 13, 9651, 736, 4390, 29889, 29881, 17204, 29898, 1272, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 24963, 29889, 1767, 13, 2 ]
pylearn2/sampling/replace_samples.py
CKehl/pylearn2
0
38827
<gh_stars>0 ''' Created on Apr 16, 2015 @author: christian ''' from optparse import OptionParser import numpy import os from os import listdir from os.path import isfile, join import cPickle import glob def unpickle(file): fo = open(file, 'rb') dictionary = cPickle.load(fo) fo.close() return dictionary if __name__ == '__main__': optionParser = OptionParser("usage: %prog -i INPUT_FILE -m META_FILE -t SOURCE_TAG -r DESTINATION_TAG") optionParser.add_option("-i", "--input", action="store", dest="input", type="string", metavar="FILE", help="pickled python dataset file") optionParser.add_option("-m", "--meta", action="store", dest="meta", type="string", metavar="FILE", help="pickled python metadata file") optionParser.add_option("-t", "--tag", action="store", dest="tag", type="int", help="selected tag to add the image", default = 0) optionParser.add_option("-r", "--replace_tag", action="store", dest="rtag", type="int", help="replacement tag number for <tag>", default = 0) (options, args) = optionParser.parse_args() my_obj = dict() meta_obj = dict() label_str = '' meta_label_str = '' test_img_array = None test_array = [] test_classes = [] test_obj = dict() if options.input != None: my_obj = unpickle(options.input) in_dir = os.path.dirname(options.input) test_obj = unpickle(os.path.join(in_dir, "test")) else: exit() ds = 0 if("fine_labels" in my_obj.keys()): ds = 1 #CIFAR-100 label_str = 'fine_labels' meta_label_str = 'fine_label_names' else: ds = 0 #CIFAR-10 and combined label_str = 'labels' meta_label_str = 'label_names' meta_inputs = [] if(options.meta == None) or (options.meta == ""): meta_inputs = glob.glob(os.path.dirname(options.input)+os.path.sep+"*meta*") else: meta_inputs.append(options.meta) meta_obj = unpickle(meta_inputs[0]) num_img_base_array = [0]*(len(my_obj[label_str])) img_base_array = [[0]*3072]*(my_obj['data'].shape[0]) img_array = numpy.array(img_base_array, dtype=numpy.uint8) class_array = [0]*(my_obj['data'].shape[0]) for i in range(0, my_obj['data'].shape[0]): data_entry = my_obj['data'][i] tag_no = my_obj[label_str][i] img_array[i] = data_entry class_array[i] = tag_no num_img_base_array[tag_no]+=1 # Test array generation tcursor_point = 0 #print "Test Data fieldsize: "+str(test_obj['data'].shape[0]) for i in range(0, test_obj['data'].shape[0]): data_entry = test_obj['data'][i] tag_no = test_obj['labels'][i] #print "Test Image: "+str(i)+" => Tag: "+str(tag_no) test_array.append(data_entry.tolist()) test_classes.append(tag_no) tcursor_point+=1 tag_img_number = num_img_base_array[options.tag] img_of_tag = [] for i in range(0, len(class_array)): if(class_array[i] == options.tag): img_of_tag.append(i) print "Data with selected tag: "+str(img_of_tag)+" ("+str(tag_img_number)+")" print "Dataset size before replacement: "+str(len(class_array))+" | "+str(img_array.shape[0]) for i in range(0, len(img_of_tag)): class_array[img_of_tag[i]]=options.rtag del num_img_base_array[options.tag] print "Dataset size after replacement: "+str(len(class_array))+" | "+str(img_array.shape[0]) print "Label dictionary before replacement: "+str(len(meta_obj[meta_label_str])) del meta_obj[meta_label_str][options.tag] print "Label dictionary after replacement: "+str(len(meta_obj[meta_label_str])) # re-adapt mapping for i in range(0, len(class_array)): if(class_array[i] > options.tag): class_array[i]-=1 ################ # TESTING DATA # ################ del img_of_tag[:] for i in range(0, len(test_classes)): if(test_classes[i] == options.tag): img_of_tag.append(i) for i in range(0, len(img_of_tag)): test_classes[img_of_tag[i]]=options.rtag # re-adapt mapping for i in range(0, len(test_classes)): if(test_classes[i] > options.tag): test_classes[i]-=1 out_obj = dict() out_obj['data']=img_array out_obj['labels']=class_array out_dir = os.path.dirname(options.input) #fo = open(os.path.join(options.output,"experiment"), 'wb') cPickle.dump(out_obj, open(os.path.join(out_dir,"experiment_rp"), "wb"), protocol=2) test_n_obj = dict() test_img_array = numpy.array(test_array, dtype=numpy.uint8) test_n_obj['data']=test_img_array test_n_obj['labels']=test_classes cPickle.dump(test_n_obj, open(os.path.join(out_dir,"test_rp"), "wb"), protocol=2) meta_obj_out = dict() meta_obj_out['label_names'] = meta_obj[meta_label_str] cPickle.dump(meta_obj_out, open(os.path.join(out_dir,"meta_rp"), "wb"), protocol=2)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 12008, 13, 20399, 373, 319, 558, 29871, 29896, 29953, 29892, 29871, 29906, 29900, 29896, 29945, 13, 13, 29992, 8921, 29901, 25542, 713, 13, 12008, 13, 13, 3166, 3523, 5510, 1053, 10831, 11726, 13, 5215, 12655, 13, 13, 5215, 2897, 13, 3166, 2897, 1053, 1051, 3972, 13, 3166, 2897, 29889, 2084, 1053, 338, 1445, 29892, 5988, 13, 5215, 274, 29925, 860, 280, 13, 5215, 13149, 13, 13, 1753, 443, 23945, 280, 29898, 1445, 1125, 13, 1678, 1701, 353, 1722, 29898, 1445, 29892, 525, 6050, 1495, 13, 1678, 8600, 353, 274, 29925, 860, 280, 29889, 1359, 29898, 1181, 29897, 13, 1678, 1701, 29889, 5358, 580, 13, 1678, 736, 8600, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 2984, 11726, 353, 10831, 11726, 703, 21125, 29901, 1273, 29097, 448, 29875, 2672, 12336, 29918, 7724, 448, 29885, 341, 2544, 29909, 29918, 7724, 448, 29873, 7791, 4574, 4741, 29918, 16881, 448, 29878, 5012, 1254, 1177, 8098, 29918, 16881, 1159, 13, 1678, 2984, 11726, 29889, 1202, 29918, 3385, 703, 29899, 29875, 613, 376, 489, 2080, 613, 3158, 543, 8899, 613, 2731, 543, 2080, 613, 1134, 543, 1807, 613, 1539, 485, 279, 543, 7724, 613, 1371, 543, 23945, 839, 3017, 8783, 934, 1159, 13, 1678, 2984, 11726, 29889, 1202, 29918, 3385, 703, 29899, 29885, 613, 376, 489, 7299, 613, 3158, 543, 8899, 613, 2731, 543, 7299, 613, 1134, 543, 1807, 613, 1539, 485, 279, 543, 7724, 613, 1371, 543, 23945, 839, 3017, 15562, 934, 1159, 13, 1678, 2984, 11726, 29889, 1202, 29918, 3385, 703, 29899, 29873, 613, 376, 489, 4039, 613, 3158, 543, 8899, 613, 2731, 543, 4039, 613, 1134, 543, 524, 613, 1371, 543, 8391, 4055, 304, 788, 278, 1967, 613, 2322, 353, 29871, 29900, 29897, 13, 1678, 2984, 11726, 29889, 1202, 29918, 3385, 703, 29899, 29878, 613, 376, 489, 6506, 29918, 4039, 613, 3158, 543, 8899, 613, 2731, 543, 2273, 351, 613, 1134, 543, 524, 613, 1371, 543, 3445, 9552, 4055, 1353, 363, 529, 4039, 28341, 2322, 353, 29871, 29900, 29897, 13, 13, 1678, 313, 6768, 29892, 6389, 29897, 353, 2984, 11726, 29889, 5510, 29918, 5085, 580, 13, 268, 13, 1678, 590, 29918, 5415, 353, 9657, 580, 13, 1678, 12700, 29918, 5415, 353, 9657, 580, 13, 1678, 3858, 29918, 710, 353, 6629, 13, 1678, 12700, 29918, 1643, 29918, 710, 353, 6629, 13, 1678, 1243, 29918, 2492, 29918, 2378, 353, 6213, 13, 1678, 1243, 29918, 2378, 353, 5159, 13, 1678, 1243, 29918, 13203, 353, 5159, 13, 1678, 1243, 29918, 5415, 353, 9657, 580, 13, 268, 13, 13, 1678, 565, 3987, 29889, 2080, 2804, 6213, 29901, 13, 4706, 590, 29918, 5415, 353, 443, 23945, 280, 29898, 6768, 29889, 2080, 29897, 13, 4706, 297, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 6768, 29889, 2080, 29897, 13, 4706, 1243, 29918, 5415, 353, 443, 23945, 280, 29898, 359, 29889, 2084, 29889, 7122, 29898, 262, 29918, 3972, 29892, 376, 1688, 5783, 13, 1678, 1683, 29901, 13, 4706, 6876, 580, 13, 268, 13, 1678, 18031, 353, 29871, 29900, 13, 1678, 565, 703, 29888, 457, 29918, 21134, 29908, 297, 590, 29918, 5415, 29889, 8149, 580, 1125, 13, 4706, 18031, 353, 29871, 29896, 396, 29907, 6545, 1718, 29899, 29896, 29900, 29900, 13, 4706, 3858, 29918, 710, 353, 525, 29888, 457, 29918, 21134, 29915, 13, 4706, 12700, 29918, 1643, 29918, 710, 353, 525, 29888, 457, 29918, 1643, 29918, 7039, 29915, 13, 1678, 1683, 29901, 13, 4706, 18031, 353, 29871, 29900, 396, 29907, 6545, 1718, 29899, 29896, 29900, 322, 12420, 13, 4706, 3858, 29918, 710, 353, 525, 21134, 29915, 13, 4706, 12700, 29918, 1643, 29918, 710, 353, 525, 1643, 29918, 7039, 29915, 13, 13, 1678, 12700, 29918, 2080, 29879, 353, 5159, 13, 1678, 565, 29898, 6768, 29889, 7299, 1275, 6213, 29897, 470, 313, 6768, 29889, 7299, 1275, 5124, 1125, 13, 4706, 12700, 29918, 2080, 29879, 353, 13149, 29889, 23705, 29898, 359, 29889, 2084, 29889, 25721, 29898, 6768, 29889, 2080, 7240, 359, 29889, 2084, 29889, 19570, 13578, 29930, 7299, 29930, 1159, 13, 1678, 1683, 29901, 13, 4706, 12700, 29918, 2080, 29879, 29889, 4397, 29898, 6768, 29889, 7299, 29897, 13, 1678, 12700, 29918, 5415, 353, 443, 23945, 280, 29898, 7299, 29918, 2080, 29879, 29961, 29900, 2314, 13, 13, 13, 1678, 954, 29918, 2492, 29918, 3188, 29918, 2378, 353, 518, 29900, 14178, 29898, 2435, 29898, 1357, 29918, 5415, 29961, 1643, 29918, 710, 12622, 13, 1678, 10153, 29918, 3188, 29918, 2378, 353, 5519, 29900, 14178, 29941, 29900, 29955, 29906, 14178, 29898, 1357, 29918, 5415, 1839, 1272, 13359, 12181, 29961, 29900, 2314, 13, 1678, 10153, 29918, 2378, 353, 12655, 29889, 2378, 29898, 2492, 29918, 3188, 29918, 2378, 29892, 26688, 29922, 23749, 29889, 13470, 29947, 29897, 13, 1678, 770, 29918, 2378, 353, 518, 29900, 14178, 29898, 1357, 29918, 5415, 1839, 1272, 13359, 12181, 29961, 29900, 2314, 13, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 590, 29918, 5415, 1839, 1272, 13359, 12181, 29961, 29900, 29962, 1125, 13, 4706, 848, 29918, 8269, 353, 590, 29918, 5415, 1839, 1272, 2033, 29961, 29875, 29962, 13, 4706, 4055, 29918, 1217, 353, 590, 29918, 5415, 29961, 1643, 29918, 710, 3816, 29875, 29962, 13, 4706, 10153, 29918, 2378, 29961, 29875, 29962, 353, 848, 29918, 8269, 13, 4706, 770, 29918, 2378, 29961, 29875, 29962, 353, 4055, 29918, 1217, 13, 4706, 954, 29918, 2492, 29918, 3188, 29918, 2378, 29961, 4039, 29918, 1217, 10062, 29922, 29896, 13, 13, 1678, 396, 4321, 1409, 12623, 13, 1678, 260, 18127, 29918, 3149, 353, 29871, 29900, 13, 1678, 396, 2158, 376, 3057, 3630, 1746, 2311, 29901, 15691, 710, 29898, 1688, 29918, 5415, 1839, 1272, 13359, 12181, 29961, 29900, 2314, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 1243, 29918, 5415, 1839, 1272, 13359, 12181, 29961, 29900, 29962, 1125, 13, 4706, 848, 29918, 8269, 353, 1243, 29918, 5415, 1839, 1272, 2033, 29961, 29875, 29962, 13, 4706, 4055, 29918, 1217, 353, 1243, 29918, 5415, 1839, 21134, 2033, 29961, 29875, 29962, 13, 4706, 396, 2158, 376, 3057, 7084, 29901, 15691, 710, 29898, 29875, 7240, 29908, 1149, 10522, 29901, 15691, 710, 29898, 4039, 29918, 1217, 29897, 13, 4706, 1243, 29918, 2378, 29889, 4397, 29898, 1272, 29918, 8269, 29889, 25027, 391, 3101, 13, 4706, 1243, 29918, 13203, 29889, 4397, 29898, 4039, 29918, 1217, 29897, 13, 4706, 260, 18127, 29918, 3149, 23661, 29896, 13, 13, 1678, 4055, 29918, 2492, 29918, 4537, 353, 954, 29918, 2492, 29918, 3188, 29918, 2378, 29961, 6768, 29889, 4039, 29962, 13, 1678, 10153, 29918, 974, 29918, 4039, 353, 5159, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1990, 29918, 2378, 22164, 13, 4706, 565, 29898, 1990, 29918, 2378, 29961, 29875, 29962, 1275, 3987, 29889, 4039, 1125, 13, 9651, 10153, 29918, 974, 29918, 4039, 29889, 4397, 29898, 29875, 29897, 13, 1678, 1596, 376, 1469, 411, 4629, 4055, 29901, 15691, 710, 29898, 2492, 29918, 974, 29918, 4039, 7240, 29908, 4852, 29974, 710, 29898, 4039, 29918, 2492, 29918, 4537, 7240, 1159, 29908, 13, 13, 1678, 1596, 376, 16390, 24541, 2159, 1434, 16920, 29901, 15691, 710, 29898, 2435, 29898, 1990, 29918, 2378, 876, 13578, 891, 15691, 710, 29898, 2492, 29918, 2378, 29889, 12181, 29961, 29900, 2314, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 2492, 29918, 974, 29918, 4039, 22164, 13, 4706, 770, 29918, 2378, 29961, 2492, 29918, 974, 29918, 4039, 29961, 29875, 5262, 29922, 6768, 29889, 2273, 351, 13, 1678, 628, 954, 29918, 2492, 29918, 3188, 29918, 2378, 29961, 6768, 29889, 4039, 29962, 13, 1678, 1596, 376, 16390, 24541, 2159, 1156, 16920, 29901, 15691, 710, 29898, 2435, 29898, 1990, 29918, 2378, 876, 13578, 891, 15691, 710, 29898, 2492, 29918, 2378, 29889, 12181, 29961, 29900, 2314, 13, 13, 1678, 1596, 376, 4775, 8600, 1434, 16920, 29901, 15691, 710, 29898, 2435, 29898, 7299, 29918, 5415, 29961, 7299, 29918, 1643, 29918, 710, 12622, 1678, 13, 1678, 628, 12700, 29918, 5415, 29961, 7299, 29918, 1643, 29918, 710, 3816, 6768, 29889, 4039, 29962, 13, 1678, 1596, 376, 4775, 8600, 1156, 16920, 29901, 15691, 710, 29898, 2435, 29898, 7299, 29918, 5415, 29961, 7299, 29918, 1643, 29918, 710, 12622, 13, 13, 1678, 396, 337, 29899, 1114, 415, 10417, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1990, 29918, 2378, 22164, 13, 4706, 565, 29898, 1990, 29918, 2378, 29961, 29875, 29962, 1405, 3987, 29889, 4039, 1125, 13, 9651, 770, 29918, 2378, 29961, 29875, 29962, 29899, 29922, 29896, 13, 13, 1678, 835, 7346, 4136, 29937, 13, 1678, 396, 17067, 1254, 4214, 360, 8254, 396, 13, 1678, 835, 7346, 4136, 29937, 13, 1678, 628, 10153, 29918, 974, 29918, 4039, 7503, 29962, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1688, 29918, 13203, 22164, 13, 4706, 565, 29898, 1688, 29918, 13203, 29961, 29875, 29962, 1275, 3987, 29889, 4039, 1125, 13, 9651, 10153, 29918, 974, 29918, 4039, 29889, 4397, 29898, 29875, 29897, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 2492, 29918, 974, 29918, 4039, 22164, 13, 4706, 1243, 29918, 13203, 29961, 2492, 29918, 974, 29918, 4039, 29961, 29875, 5262, 29922, 6768, 29889, 2273, 351, 13, 1678, 396, 337, 29899, 1114, 415, 10417, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 1688, 29918, 13203, 22164, 13, 4706, 565, 29898, 1688, 29918, 13203, 29961, 29875, 29962, 1405, 3987, 29889, 4039, 1125, 13, 9651, 1243, 29918, 13203, 29961, 29875, 29962, 29899, 29922, 29896, 13, 13, 1678, 714, 29918, 5415, 353, 9657, 580, 13, 1678, 714, 29918, 5415, 1839, 1272, 2033, 29922, 2492, 29918, 2378, 13, 1678, 714, 29918, 5415, 1839, 21134, 2033, 29922, 1990, 29918, 2378, 13, 1678, 714, 29918, 3972, 353, 2897, 29889, 2084, 29889, 25721, 29898, 6768, 29889, 2080, 29897, 13, 1678, 396, 1181, 353, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 6768, 29889, 4905, 1699, 735, 15362, 4968, 525, 29893, 29890, 1495, 13, 1678, 274, 29925, 860, 280, 29889, 15070, 29898, 449, 29918, 5415, 29892, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 449, 29918, 3972, 1699, 735, 15362, 29918, 19080, 4968, 376, 29893, 29890, 4968, 9608, 29922, 29906, 29897, 13, 13, 1678, 1243, 29918, 29876, 29918, 5415, 353, 9657, 580, 13, 1678, 1243, 29918, 2492, 29918, 2378, 353, 12655, 29889, 2378, 29898, 1688, 29918, 2378, 29892, 26688, 29922, 23749, 29889, 13470, 29947, 29897, 13, 1678, 1243, 29918, 29876, 29918, 5415, 1839, 1272, 2033, 29922, 1688, 29918, 2492, 29918, 2378, 13, 1678, 1243, 29918, 29876, 29918, 5415, 1839, 21134, 2033, 29922, 1688, 29918, 13203, 13, 1678, 274, 29925, 860, 280, 29889, 15070, 29898, 1688, 29918, 29876, 29918, 5415, 29892, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 449, 29918, 3972, 1699, 1688, 29918, 19080, 4968, 376, 29893, 29890, 4968, 9608, 29922, 29906, 29897, 13, 13, 1678, 12700, 29918, 5415, 29918, 449, 353, 9657, 580, 13, 1678, 12700, 29918, 5415, 29918, 449, 1839, 1643, 29918, 7039, 2033, 353, 12700, 29918, 5415, 29961, 7299, 29918, 1643, 29918, 710, 29962, 13, 1678, 274, 29925, 860, 280, 29889, 15070, 29898, 7299, 29918, 5415, 29918, 449, 29892, 1722, 29898, 359, 29889, 2084, 29889, 7122, 29898, 449, 29918, 3972, 1699, 7299, 29918, 19080, 4968, 376, 29893, 29890, 4968, 9608, 29922, 29906, 29897, 13, 13, 13, 2 ]
app/__init__.py
VirginiaNdungu1/ugatuzi
1
190352
from flask import Flask from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy from config import config_options from flask_login import LoginManager bootstrap = Bootstrap() db = SQLAlchemy() login_manager = LoginManager() login_manager.session_protection = 'strong' login_manager.login_message = "You must be logged in to access this page." login_manager.login_view = 'auth.login' def create_app(config_name): app = Flask(__name__) # creating configurations app.config.from_object(config_options[config_name]) # config_options[config_name].init_app(app) # initializing flask extensions bootstrap.init_app(app) db.init_app(app) login_manager.init_app(app) # registering main blueprint from .main import main as main_blueprint app.register_blueprint(main_blueprint) # registering auth blueprint from .auth import auth as auth_blueprint app.register_blueprint(auth_blueprint, url_prefix='/authenticate') # # registering api blueprint # from .api import api as api_blueprint # app.register_blueprint(api_blueprint) return app
[ 1, 515, 29784, 1053, 2379, 1278, 13, 3166, 29784, 29918, 8704, 1053, 25746, 13, 3166, 29784, 29918, 2850, 284, 305, 6764, 1053, 3758, 2499, 305, 6764, 13, 3166, 2295, 1053, 2295, 29918, 6768, 13, 13, 3166, 29784, 29918, 7507, 1053, 19130, 3260, 13, 13, 13, 8704, 353, 25746, 580, 13, 2585, 353, 3758, 2499, 305, 6764, 580, 13, 7507, 29918, 12847, 353, 19130, 3260, 580, 13, 7507, 29918, 12847, 29889, 7924, 29918, 14676, 428, 353, 525, 1110, 29915, 13, 7507, 29918, 12847, 29889, 7507, 29918, 4906, 353, 376, 3492, 1818, 367, 13817, 297, 304, 2130, 445, 1813, 1213, 13, 7507, 29918, 12847, 29889, 7507, 29918, 1493, 353, 525, 5150, 29889, 7507, 29915, 13, 13, 13, 1753, 1653, 29918, 932, 29898, 2917, 29918, 978, 1125, 13, 13, 1678, 623, 353, 2379, 1278, 22168, 978, 1649, 29897, 13, 13, 1678, 396, 4969, 22920, 13, 1678, 623, 29889, 2917, 29889, 3166, 29918, 3318, 29898, 2917, 29918, 6768, 29961, 2917, 29918, 978, 2314, 13, 1678, 396, 2295, 29918, 6768, 29961, 2917, 29918, 978, 1822, 2344, 29918, 932, 29898, 932, 29897, 13, 13, 1678, 396, 2847, 5281, 29784, 17752, 13, 1678, 16087, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 1678, 4833, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 1678, 6464, 29918, 12847, 29889, 2344, 29918, 932, 29898, 932, 29897, 13, 13, 1678, 396, 6036, 292, 1667, 7254, 2158, 13, 1678, 515, 869, 3396, 1053, 1667, 408, 1667, 29918, 9539, 2158, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 3396, 29918, 9539, 2158, 29897, 13, 13, 1678, 396, 6036, 292, 4817, 7254, 2158, 13, 1678, 515, 869, 5150, 1053, 4817, 408, 4817, 29918, 9539, 2158, 13, 1678, 623, 29889, 9573, 29918, 9539, 2158, 29898, 5150, 29918, 9539, 2158, 29892, 3142, 29918, 13506, 2433, 29914, 27218, 403, 1495, 13, 1678, 13, 1678, 396, 396, 6036, 292, 7882, 7254, 2158, 13, 1678, 396, 515, 869, 2754, 1053, 7882, 408, 7882, 29918, 9539, 2158, 13, 1678, 396, 623, 29889, 9573, 29918, 9539, 2158, 29898, 2754, 29918, 9539, 2158, 29897, 13, 1678, 736, 623, 13, 2 ]
server.py
palmpilot71/CMPUT404-assignment-webserver
0
113360
<reponame>palmpilot71/CMPUT404-assignment-webserver # coding: utf-8 import SocketServer, os # Copyright 2013 <NAME>, <NAME>, <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. # # # Furthermore it is derived from the Python documentation examples thus # some of the code is Copyright © 2001-2013 Python Software # Foundation; All Rights Reserved # # http://docs.python.org/2/library/socketserver.html # # run: python freetests.py # try: curl -v -X GET http://127.0.0.1:8080/ class MyWebServer(SocketServer.BaseRequestHandler): def _check_resource_location(self, requested_resource): current_directory = os.path.abspath(os.curdir) data_directory = current_directory + "/www" return os.path.abspath(requested_resource).startswith(data_directory) def _adjust_resource(self, requested_resource): current_directory = os.path.abspath(os.curdir) requested_resource = current_directory + "/www" + requested_resource return requested_resource def _create_headers(self): return "HTTP/1.1 200 OK\r\n" def _send_404(self, requested_resource): headers = "HTTP/1.1 404 Not Found\r\n" close = "Connection: close\r\n\r\n" body = ("<html>\n<body>404 - Could not find resource at " + requested_resource + " </body>\n</html>") self.request.send(headers + close + body) def _get_mime(self, adjusted_resource): if (adjusted_resource[-4:] == ".css"): return "Content-Type: text/css\r\n" elif (adjusted_resource[-5:] == ".html"): return "Content-Type: text/html\r\n" else: return "Content Type: \r\n" def _send_302(self, requested_resource): headers = "HTTP/1.1 302 Found\r\n" location = "Location: http://127.0.0.1:8080" + requested_resource + "index.html\r\n" close = "Connection: close\r\n\r\n" self.request.send(headers + location + close) def _handle_directory_redirect(self, adjusted_resource): return os.path.isdir(adjusted_resource) def handle(self): self.data = self.request.recv(1024).strip() #print("Got a request of: %s\n" % self.data) if (self.data): split_data = self.data.split(" ") else: return requested_resource = split_data[1] adjusted_resource = self._adjust_resource(requested_resource) if (adjusted_resource.endswith("/")): self._send_302(requested_resource) elif (self._check_resource_location(adjusted_resource)): if (self._handle_directory_redirect(adjusted_resource)): self._send_302(requested_resource + "/") else: try: resource = open(adjusted_resource).read() headers = self._create_headers() content_type = self._get_mime(adjusted_resource) close = "Connection: close\r\n\r\n" self.request.send(headers + content_type + close + resource) except: self._send_404(requested_resource) else: self._send_404(requested_resource) if __name__ == "__main__": HOST, PORT = "localhost", 8080 SocketServer.TCPServer.allow_reuse_address = True # Create the server, binding to localhost on port 8080 server = SocketServer.TCPServer((HOST, PORT), MyWebServer) # Activate the server; this will keep running until you # interrupt the program with Ctrl-C server.serve_forever()
[ 1, 529, 276, 1112, 420, 29958, 7830, 1526, 309, 327, 29955, 29896, 29914, 29907, 3580, 2692, 29946, 29900, 29946, 29899, 465, 10194, 29899, 2676, 2974, 13, 29937, 29871, 14137, 29901, 23616, 29899, 29947, 13, 5215, 29141, 6004, 29892, 2897, 13, 13, 29937, 14187, 1266, 29871, 29906, 29900, 29896, 29941, 529, 5813, 10202, 529, 5813, 10202, 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, 268, 1732, 597, 1636, 29889, 4288, 29889, 990, 29914, 506, 11259, 29914, 27888, 1430, 1660, 29899, 29906, 29889, 29900, 13, 29937, 13, 29937, 25870, 3734, 491, 22903, 4307, 470, 15502, 304, 297, 5007, 29892, 7047, 13, 29937, 13235, 1090, 278, 19245, 338, 13235, 373, 385, 376, 3289, 8519, 29908, 350, 3289, 3235, 29892, 13, 29937, 399, 1806, 8187, 2692, 399, 1718, 29934, 13566, 29059, 6323, 8707, 29928, 22122, 29903, 8079, 13764, 29979, 476, 22255, 29892, 2845, 4653, 470, 2411, 2957, 29889, 13, 29937, 2823, 278, 19245, 363, 278, 2702, 4086, 14765, 1076, 11239, 322, 13, 29937, 27028, 1090, 278, 19245, 29889, 13, 29937, 13, 29937, 13, 29937, 16478, 372, 338, 10723, 515, 278, 5132, 5106, 6455, 4550, 13, 29937, 777, 310, 278, 775, 338, 14187, 1266, 29871, 30211, 29871, 29906, 29900, 29900, 29896, 29899, 29906, 29900, 29896, 29941, 5132, 18540, 13, 29937, 10606, 29936, 2178, 26863, 2538, 9841, 13, 29937, 13, 29937, 1732, 597, 2640, 29889, 4691, 29889, 990, 29914, 29906, 29914, 5258, 29914, 11514, 2974, 29889, 1420, 13, 29937, 13, 29937, 1065, 29901, 3017, 3005, 300, 9197, 29889, 2272, 13, 13, 29937, 1018, 29901, 11051, 448, 29894, 448, 29990, 12354, 1732, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29947, 29900, 29947, 29900, 29914, 13, 13, 13, 1990, 1619, 3609, 6004, 29898, 11373, 6004, 29889, 5160, 3089, 4598, 1125, 13, 13, 1678, 822, 903, 3198, 29918, 10314, 29918, 5479, 29898, 1311, 29892, 13877, 29918, 10314, 1125, 13, 4706, 1857, 29918, 12322, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2764, 3972, 29897, 13, 4706, 848, 29918, 12322, 353, 1857, 29918, 12322, 718, 5591, 1636, 29908, 13, 4706, 736, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 3827, 287, 29918, 10314, 467, 27382, 2541, 29898, 1272, 29918, 12322, 29897, 13, 13, 1678, 822, 903, 328, 5143, 29918, 10314, 29898, 1311, 29892, 13877, 29918, 10314, 1125, 13, 4706, 1857, 29918, 12322, 353, 2897, 29889, 2084, 29889, 370, 1028, 493, 29898, 359, 29889, 2764, 3972, 29897, 13, 4706, 13877, 29918, 10314, 353, 1857, 29918, 12322, 718, 5591, 1636, 29908, 718, 13877, 29918, 10314, 13, 4706, 736, 13877, 29918, 10314, 13, 13, 1678, 822, 903, 3258, 29918, 13662, 29898, 1311, 1125, 13, 4706, 736, 376, 10493, 29914, 29896, 29889, 29896, 29871, 29906, 29900, 29900, 9280, 29905, 29878, 29905, 29876, 29908, 13, 13, 1678, 822, 903, 6717, 29918, 29946, 29900, 29946, 29898, 1311, 29892, 13877, 29918, 10314, 1125, 13, 4706, 9066, 353, 376, 10493, 29914, 29896, 29889, 29896, 29871, 29946, 29900, 29946, 2216, 7460, 29905, 29878, 29905, 29876, 29908, 13, 13, 4706, 3802, 353, 376, 5350, 29901, 3802, 29905, 29878, 29905, 29876, 29905, 29878, 29905, 29876, 29908, 13, 13, 4706, 3573, 353, 4852, 29966, 1420, 14247, 29876, 29966, 2587, 29958, 29946, 29900, 29946, 448, 6527, 451, 1284, 6503, 472, 376, 13, 18884, 718, 13877, 29918, 10314, 13, 18884, 718, 376, 1533, 2587, 14247, 29876, 829, 1420, 29958, 1159, 13, 13, 4706, 1583, 29889, 3827, 29889, 6717, 29898, 13662, 718, 3802, 718, 3573, 29897, 13, 13, 1678, 822, 903, 657, 29918, 29885, 603, 29898, 1311, 29892, 10365, 287, 29918, 10314, 1125, 13, 4706, 565, 313, 328, 5143, 287, 29918, 10314, 14352, 29946, 17531, 1275, 11393, 4268, 29908, 1125, 13, 9651, 736, 376, 3916, 29899, 1542, 29901, 1426, 29914, 4268, 29905, 29878, 29905, 29876, 29908, 13, 4706, 25342, 313, 328, 5143, 287, 29918, 10314, 14352, 29945, 17531, 1275, 11393, 1420, 29908, 1125, 13, 9651, 736, 376, 3916, 29899, 1542, 29901, 1426, 29914, 1420, 29905, 29878, 29905, 29876, 29908, 13, 4706, 1683, 29901, 13, 9651, 736, 376, 3916, 5167, 29901, 320, 29878, 29905, 29876, 29908, 13, 13, 1678, 822, 903, 6717, 29918, 29941, 29900, 29906, 29898, 1311, 29892, 13877, 29918, 10314, 1125, 13, 4706, 9066, 353, 376, 10493, 29914, 29896, 29889, 29896, 29871, 29941, 29900, 29906, 7460, 29905, 29878, 29905, 29876, 29908, 13, 4706, 4423, 353, 376, 6508, 29901, 1732, 597, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 29901, 29947, 29900, 29947, 29900, 29908, 718, 13877, 29918, 10314, 718, 376, 2248, 29889, 1420, 29905, 29878, 29905, 29876, 29908, 13, 4706, 3802, 353, 376, 5350, 29901, 3802, 29905, 29878, 29905, 29876, 29905, 29878, 29905, 29876, 29908, 13, 13, 4706, 1583, 29889, 3827, 29889, 6717, 29898, 13662, 718, 4423, 718, 3802, 29897, 13, 13, 1678, 822, 903, 8411, 29918, 12322, 29918, 17886, 29898, 1311, 29892, 10365, 287, 29918, 10314, 1125, 13, 4706, 736, 2897, 29889, 2084, 29889, 275, 3972, 29898, 328, 5143, 287, 29918, 10314, 29897, 13, 13, 1678, 822, 4386, 29898, 1311, 1125, 13, 4706, 1583, 29889, 1272, 353, 1583, 29889, 3827, 29889, 3757, 29894, 29898, 29896, 29900, 29906, 29946, 467, 17010, 580, 13, 4706, 396, 2158, 703, 29954, 327, 263, 2009, 310, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 1583, 29889, 1272, 29897, 13, 13, 12, 361, 313, 1311, 29889, 1272, 1125, 13, 12, 4706, 6219, 29918, 1272, 353, 1583, 29889, 1272, 29889, 5451, 703, 16521, 13, 12, 2870, 29901, 13, 12, 12, 2457, 13, 4706, 13877, 29918, 10314, 353, 6219, 29918, 1272, 29961, 29896, 29962, 13, 4706, 10365, 287, 29918, 10314, 353, 1583, 3032, 328, 5143, 29918, 10314, 29898, 3827, 287, 29918, 10314, 29897, 13, 4706, 565, 313, 328, 5143, 287, 29918, 10314, 29889, 1975, 2541, 11974, 5783, 29901, 13, 9651, 1583, 3032, 6717, 29918, 29941, 29900, 29906, 29898, 3827, 287, 29918, 10314, 29897, 13, 13, 4706, 25342, 313, 1311, 3032, 3198, 29918, 10314, 29918, 5479, 29898, 328, 5143, 287, 29918, 10314, 22164, 13, 9651, 565, 313, 1311, 3032, 8411, 29918, 12322, 29918, 17886, 29898, 328, 5143, 287, 29918, 10314, 22164, 13, 18884, 1583, 3032, 6717, 29918, 29941, 29900, 29906, 29898, 3827, 287, 29918, 10314, 718, 5591, 1159, 13, 9651, 1683, 29901, 13, 18884, 1018, 29901, 13, 462, 1678, 6503, 353, 1722, 29898, 328, 5143, 287, 29918, 10314, 467, 949, 580, 13, 13, 462, 1678, 9066, 353, 1583, 3032, 3258, 29918, 13662, 580, 13, 13, 462, 1678, 2793, 29918, 1853, 353, 1583, 3032, 657, 29918, 29885, 603, 29898, 328, 5143, 287, 29918, 10314, 29897, 13, 13, 462, 1678, 3802, 353, 376, 5350, 29901, 3802, 29905, 29878, 29905, 29876, 29905, 29878, 29905, 29876, 29908, 13, 13, 462, 1678, 1583, 29889, 3827, 29889, 6717, 29898, 13662, 718, 2793, 29918, 1853, 718, 3802, 718, 6503, 29897, 13, 18884, 5174, 29901, 13, 462, 1678, 1583, 3032, 6717, 29918, 29946, 29900, 29946, 29898, 3827, 287, 29918, 10314, 29897, 13, 4706, 1683, 29901, 13, 9651, 1583, 3032, 6717, 29918, 29946, 29900, 29946, 29898, 3827, 287, 29918, 10314, 29897, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 1678, 379, 3718, 29892, 349, 8476, 353, 376, 7640, 613, 29871, 29947, 29900, 29947, 29900, 13, 13, 1678, 29141, 6004, 29889, 29911, 6271, 6004, 29889, 9536, 29918, 276, 1509, 29918, 7328, 353, 5852, 13, 1678, 396, 6204, 278, 1923, 29892, 9956, 304, 15683, 373, 2011, 29871, 29947, 29900, 29947, 29900, 13, 1678, 1923, 353, 29141, 6004, 29889, 29911, 6271, 6004, 3552, 20832, 29892, 349, 8476, 511, 1619, 3609, 6004, 29897, 13, 13, 1678, 396, 21775, 403, 278, 1923, 29936, 445, 674, 3013, 2734, 2745, 366, 13, 1678, 396, 23754, 278, 1824, 411, 315, 11742, 29899, 29907, 13, 1678, 1923, 29889, 16349, 29918, 1079, 369, 580, 13, 2 ]
tests/test_timeout.py
MattBBaker/ucx-py
0
123999
import pytest import asyncio import ucp import time async def talk_to_server(ip, port, timeout): try: ep = await ucp.get_endpoint(ip, port, timeout) except TimeoutError: pass @pytest.mark.asyncio async def test_timeout(): ucp.init() ip = ucp.get_address() await asyncio.gather(talk_to_server(ip.encode(), 9999, timeout=0.1)) ucp.fin()
[ 1, 1053, 11451, 1688, 13, 5215, 408, 948, 3934, 13, 5215, 318, 6814, 13, 5215, 931, 13, 13, 13, 12674, 822, 5193, 29918, 517, 29918, 2974, 29898, 666, 29892, 2011, 29892, 11815, 1125, 13, 1678, 1018, 29901, 13, 4706, 9358, 353, 7272, 318, 6814, 29889, 657, 29918, 29734, 29898, 666, 29892, 2011, 29892, 11815, 29897, 13, 1678, 5174, 5974, 449, 2392, 29901, 13, 4706, 1209, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 294, 948, 3934, 13, 12674, 822, 1243, 29918, 15619, 7295, 13, 1678, 318, 6814, 29889, 2344, 580, 13, 1678, 10377, 353, 318, 6814, 29889, 657, 29918, 7328, 580, 13, 1678, 7272, 408, 948, 3934, 29889, 29887, 1624, 29898, 29873, 2235, 29918, 517, 29918, 2974, 29898, 666, 29889, 12508, 3285, 29871, 29929, 29929, 29929, 29929, 29892, 11815, 29922, 29900, 29889, 29896, 876, 13, 1678, 318, 6814, 29889, 4951, 580, 13, 2 ]
instrumentserver/apps.py
Coughman058/instrumentserver
0
177766
import os import argparse import logging from . import QtWidgets, QtCore from .log import setupLogging from .server.application import startServerGuiApplication from .server.core import startServer from .client import Client from .gui import widgetDialog from .gui.instruments import ParameterManagerGui setupLogging(addStreamHandler=True, logFile=os.path.abspath('instrumentserver.log')) logger = logging.getLogger('instrumentserver') logger.setLevel(logging.DEBUG) def server(port, user_shutdown): app = QtCore.QCoreApplication([]) server, thread = startServer(port, user_shutdown) thread.finished.connect(app.quit) return app.exec_() def serverWithGui(port): app = QtWidgets.QApplication([]) window = startServerGuiApplication(port) return app.exec_() def serverScript() -> None: parser = argparse.ArgumentParser(description='Starting the instrumentserver') parser.add_argument("--port", default=5555) parser.add_argument("--gui", default=True) parser.add_argument("--allow_user_shutdown", default=False) args = parser.parse_args() if args.gui: serverWithGui(args.port) else: server(args.port, args.allow_user_shutdown) def parameterManagerScript() -> None: parser = argparse.ArgumentParser(description='Starting a parameter manager instrument GUI') parser.add_argument("--name", default="parameter_manager") parser.add_argument("--port", default=5555) args = parser.parse_args() app = QtWidgets.QApplication([]) # open a client to a server using default address (localhost) and port. cli = Client(port=args.port) if args.name in cli.list_instruments(): pm = cli.get_instrument(args.name) else: pm = cli.create_instrument( 'instrumentserver.params.ParameterManager', args.name) pm.fromFile() _ = widgetDialog(ParameterManagerGui(pm)) app.exec_()
[ 1, 1053, 2897, 13, 5215, 1852, 5510, 13, 5215, 12183, 13, 13, 3166, 869, 1053, 14705, 8801, 29879, 29892, 14705, 9203, 13, 3166, 869, 1188, 1053, 6230, 3403, 3460, 13, 3166, 869, 2974, 29889, 6214, 1053, 1369, 6004, 28707, 4873, 13, 3166, 869, 2974, 29889, 3221, 1053, 1369, 6004, 13, 3166, 869, 4645, 1053, 12477, 13, 3166, 869, 23569, 1053, 11109, 7647, 13, 3166, 869, 23569, 29889, 2611, 582, 1860, 1053, 24953, 3260, 28707, 13, 13, 14669, 3403, 3460, 29898, 1202, 3835, 4598, 29922, 5574, 29892, 13, 632, 1480, 2283, 29922, 359, 29889, 2084, 29889, 370, 1028, 493, 877, 2611, 15461, 2974, 29889, 1188, 8785, 13, 21707, 353, 12183, 29889, 657, 16363, 877, 2611, 15461, 2974, 1495, 13, 21707, 29889, 842, 10108, 29898, 21027, 29889, 18525, 29897, 13, 13, 13, 1753, 1923, 29898, 637, 29892, 1404, 29918, 845, 329, 3204, 1125, 13, 1678, 623, 353, 14705, 9203, 29889, 29984, 9203, 4873, 4197, 2314, 13, 1678, 1923, 29892, 3244, 353, 1369, 6004, 29898, 637, 29892, 1404, 29918, 845, 329, 3204, 29897, 13, 1678, 3244, 29889, 4951, 3276, 29889, 6915, 29898, 932, 29889, 28358, 29897, 13, 1678, 736, 623, 29889, 4258, 29918, 580, 13, 13, 13, 1753, 1923, 3047, 28707, 29898, 637, 1125, 13, 1678, 623, 353, 14705, 8801, 29879, 29889, 29984, 4873, 4197, 2314, 13, 1678, 3474, 353, 1369, 6004, 28707, 4873, 29898, 637, 29897, 13, 1678, 736, 623, 29889, 4258, 29918, 580, 13, 13, 13, 1753, 1923, 4081, 580, 1599, 6213, 29901, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 4763, 292, 278, 11395, 2974, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 637, 613, 2322, 29922, 29945, 29945, 29945, 29945, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 23569, 613, 2322, 29922, 5574, 29897, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 9536, 29918, 1792, 29918, 845, 329, 3204, 613, 2322, 29922, 8824, 29897, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 565, 6389, 29889, 23569, 29901, 13, 4706, 1923, 3047, 28707, 29898, 5085, 29889, 637, 29897, 13, 1678, 1683, 29901, 13, 4706, 1923, 29898, 5085, 29889, 637, 29892, 6389, 29889, 9536, 29918, 1792, 29918, 845, 329, 3204, 29897, 13, 13, 1753, 3443, 3260, 4081, 580, 1599, 6213, 29901, 13, 1678, 13812, 353, 1852, 5510, 29889, 15730, 11726, 29898, 8216, 2433, 4763, 292, 263, 3443, 8455, 11395, 14839, 1495, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 978, 613, 2322, 543, 15501, 29918, 12847, 1159, 13, 1678, 13812, 29889, 1202, 29918, 23516, 703, 489, 637, 613, 2322, 29922, 29945, 29945, 29945, 29945, 29897, 13, 1678, 6389, 353, 13812, 29889, 5510, 29918, 5085, 580, 13, 13, 1678, 623, 353, 14705, 8801, 29879, 29889, 29984, 4873, 4197, 2314, 13, 13, 1678, 396, 1722, 263, 3132, 304, 263, 1923, 773, 2322, 3211, 313, 7640, 29897, 322, 2011, 29889, 13, 1678, 9335, 353, 12477, 29898, 637, 29922, 5085, 29889, 637, 29897, 13, 13, 1678, 565, 6389, 29889, 978, 297, 9335, 29889, 1761, 29918, 2611, 582, 1860, 7295, 13, 4706, 26354, 353, 9335, 29889, 657, 29918, 2611, 15461, 29898, 5085, 29889, 978, 29897, 13, 1678, 1683, 29901, 13, 4706, 26354, 353, 9335, 29889, 3258, 29918, 2611, 15461, 29898, 13, 9651, 525, 2611, 15461, 2974, 29889, 7529, 29889, 9329, 3260, 742, 6389, 29889, 978, 29897, 13, 4706, 26354, 29889, 3166, 2283, 580, 13, 13, 1678, 903, 353, 11109, 7647, 29898, 9329, 3260, 28707, 29898, 3358, 876, 13, 1678, 623, 29889, 4258, 29918, 580, 13, 2 ]
common/Request_Package.py
Four-sun/Requests_Load
0
44479
<gh_stars>0 # -*- coding: utf-8 -*- """ Created: on 2018-04-11 @author: Four Project: common\Request_Package.py Request重新封装 """ import json import time from common.log import Logger Logger_Message = Logger() send_time=time.strftime("%Y-%m-%d-%H_%M_%S",time.localtime(time.time())) #获取当前时间 def send_requests(s, testdata, cookie=None,): '''封装requests请求''' method = testdata["method"] description = testdata["description"] url = testdata["url"] # url后面的params参数d try: params = eval(testdata["params"]) except: params = None # 请求头部headers try: headers = eval(testdata["headers"]) except: headers = None # post请求body类型 type = testdata["type"] test_nub = testdata['caseid'] Logger_Message.loginfo("-------------正在执行用例:%s 描述:%s -------------" % (test_nub,description)) print("-------------正在执行用例:%s 描述:%s -------------" % (test_nub,description)) print("%s\n 请求头部:%s \n 请求方式:%s\n 请求url:%s \n 请求参数:%s" % (send_time,headers,method, url,params)) Logger_Message.loginfo("%s\n 请求头部:%s \n 请求方式:%s\n 请求url:%s \n 请求参数:%s" % (send_time,headers,method, url,params)) # post请求body内容 try: bodydata = eval(testdata["body"]) except: bodydata = {} # post上传files内容 try: files = eval(testdata["files"]) except: files = {} # 判断传data数据还是json if type == "data": body = bodydata elif type == "json": body = json.dumps(bodydata) else: body = bodydata if method == "post": if type == "files": print("%s\n post请求body类型为:%s \tfiles内容为:%s" % (send_time, type, files)) Logger_Message.loginfo("%s\n post请求body类型为:%s \tfiles内容为:%s" % (send_time,type, files)) else: print("%s\n post请求body类型为:%s \tbody内容为:%s" % (send_time, type, body)) Logger_Message.loginfo("%s\n post请求body类型为:%s \tbody内容为:%s" % (send_time,type, body)) verify = False # 是否检验 res = {} # 接受返回数据 try: r = s.request(method=method, cookies=cookie, url=url, params=params, headers=headers, data=body, verify=verify) print("页面返回信息:%s" % r.content.decode("utf-8")) Logger_Message.loginfo("页面返回信息:%s" % r.content.decode("utf-8")) res["statuscode"] = str(r.status_code) # 状态码转成str res["text"] = r.content.decode("utf-8") res["times"] = str(r.elapsed.total_seconds()) # 接口请求时间转str if res["statuscode"] != "200": res["error"] = res["text"] return False else: res["error"] = "" res["msg"] = "" if testdata["checkpoint"] in res["text"]: res["result"] = "pass" res["text"] = r.content.decode("utf-8") print("%s \t接口请求时间:%ss \t用例测试结果:%s---->%s " % (send_time,res["times"],test_nub, res["result"])) Logger_Message.loginfo("%s \t接口请求时间:%ss \t用例测试结果:%s---->%s " % (send_time,res["times"],test_nub, res["result"])) return True else: res["result"] = "fail" print("%s \t 接口请求时间:%ss \t用例测试结果:%s---->%s %s Not in %s" % (send_time,res["times"],test_nub, res["result"],testdata["checkpoint"],res["text"])) Logger_Message.loginfo("%s \t 接口请求时间:%ss \t用例测试结果:%s---->%s %s Not in %s" % (send_time,res["times"],test_nub, res["result"],testdata["checkpoint"],res["text"])) return False except Exception as msg: res["msg"] = str(msg) Logger_Message.logwarning("%s\t%s" % (send_time, msg)) return res
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 15945, 29908, 13, 20399, 29901, 373, 29871, 29906, 29900, 29896, 29947, 29899, 29900, 29946, 29899, 29896, 29896, 13, 29992, 8921, 29901, 12458, 13, 7653, 29901, 3619, 29905, 3089, 29918, 14459, 29889, 2272, 13, 3089, 30908, 30374, 232, 179, 132, 31905, 13, 15945, 29908, 13, 13, 5215, 4390, 13, 5215, 931, 13, 3166, 3619, 29889, 1188, 1053, 28468, 13, 13, 16363, 29918, 3728, 353, 28468, 580, 13, 6717, 29918, 2230, 29922, 2230, 29889, 710, 615, 603, 11702, 29979, 19222, 29885, 19222, 29881, 19222, 29950, 29918, 29995, 29924, 29918, 29995, 29903, 613, 2230, 29889, 2997, 2230, 29898, 2230, 29889, 2230, 22130, 29871, 396, 31024, 30683, 30948, 30658, 30594, 31016, 13, 13, 13, 1753, 3638, 29918, 24830, 29898, 29879, 29892, 1243, 1272, 29892, 15327, 29922, 8516, 29892, 1125, 13, 1678, 14550, 232, 179, 132, 31905, 24830, 31088, 31376, 12008, 13, 1678, 1158, 353, 1243, 1272, 3366, 5696, 3108, 13, 1678, 6139, 353, 1243, 1272, 3366, 8216, 3108, 13, 1678, 3142, 353, 1243, 1272, 3366, 2271, 3108, 13, 1678, 396, 3142, 30822, 30806, 30210, 7529, 31125, 30354, 29881, 13, 1678, 1018, 29901, 13, 4706, 8636, 353, 19745, 29898, 1688, 1272, 3366, 7529, 20068, 13, 1678, 5174, 29901, 13, 4706, 8636, 353, 6213, 13, 1678, 396, 29871, 31088, 31376, 31584, 30636, 13662, 13, 1678, 1018, 29901, 13, 4706, 9066, 353, 19745, 29898, 1688, 1272, 3366, 13662, 20068, 13, 1678, 5174, 29901, 13, 4706, 9066, 353, 6213, 13, 1678, 396, 1400, 31088, 31376, 2587, 30832, 30883, 13, 1678, 1134, 353, 1243, 1272, 3366, 1853, 3108, 13, 13, 1678, 1243, 29918, 29876, 431, 353, 1243, 1272, 1839, 4878, 333, 2033, 13, 13, 1678, 28468, 29918, 3728, 29889, 1188, 3888, 703, 9072, 29899, 30724, 30505, 233, 140, 170, 30448, 30406, 31507, 30383, 29995, 29879, 29871, 233, 146, 146, 235, 194, 179, 30383, 29995, 29879, 29871, 448, 9072, 29908, 1273, 313, 1688, 29918, 29876, 431, 29892, 8216, 876, 13, 1678, 1596, 703, 9072, 29899, 30724, 30505, 233, 140, 170, 30448, 30406, 31507, 30383, 29995, 29879, 29871, 233, 146, 146, 235, 194, 179, 30383, 29995, 29879, 29871, 448, 9072, 29908, 1273, 313, 1688, 29918, 29876, 431, 29892, 8216, 876, 13, 1678, 1596, 11702, 29879, 29905, 29876, 29871, 31088, 31376, 31584, 30636, 30383, 29995, 29879, 320, 29876, 29871, 31088, 31376, 30525, 30607, 30383, 29995, 29879, 29905, 29876, 29871, 31088, 31376, 2271, 16664, 29879, 320, 29876, 29871, 31088, 31376, 31125, 30354, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 13662, 29892, 5696, 29892, 3142, 29892, 7529, 876, 13, 1678, 28468, 29918, 3728, 29889, 1188, 3888, 11702, 29879, 29905, 29876, 29871, 31088, 31376, 31584, 30636, 30383, 29995, 29879, 320, 29876, 29871, 31088, 31376, 30525, 30607, 30383, 29995, 29879, 29905, 29876, 29871, 31088, 31376, 2271, 16664, 29879, 320, 29876, 29871, 31088, 31376, 31125, 30354, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 13662, 29892, 5696, 29892, 3142, 29892, 7529, 876, 13, 13, 1678, 396, 1400, 31088, 31376, 2587, 30728, 31294, 13, 1678, 1018, 29901, 13, 4706, 3573, 1272, 353, 19745, 29898, 1688, 1272, 3366, 2587, 20068, 13, 1678, 5174, 29901, 13, 4706, 3573, 1272, 353, 6571, 13, 13, 1678, 396, 1400, 30429, 31471, 5325, 30728, 31294, 13, 1678, 1018, 29901, 13, 4706, 2066, 353, 19745, 29898, 1688, 1272, 3366, 5325, 20068, 13, 1678, 5174, 29901, 13, 4706, 2066, 353, 6571, 13, 13, 1678, 396, 29871, 31791, 31683, 31471, 1272, 30354, 30763, 31994, 30392, 3126, 13, 1678, 565, 1134, 1275, 376, 1272, 1115, 13, 4706, 3573, 353, 3573, 1272, 13, 1678, 25342, 1134, 1275, 376, 3126, 1115, 13, 4706, 3573, 353, 4390, 29889, 29881, 17204, 29898, 2587, 1272, 29897, 13, 1678, 1683, 29901, 13, 4706, 3573, 353, 3573, 1272, 13, 13, 1678, 565, 1158, 1275, 376, 2490, 1115, 13, 13, 4706, 565, 1134, 1275, 376, 5325, 1115, 13, 9651, 1596, 11702, 29879, 29905, 29876, 1400, 31088, 31376, 2587, 30832, 30883, 30573, 30383, 29995, 29879, 320, 29873, 5325, 30728, 31294, 30573, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 1134, 29892, 2066, 876, 13, 9651, 28468, 29918, 3728, 29889, 1188, 3888, 11702, 29879, 29905, 29876, 1400, 31088, 31376, 2587, 30832, 30883, 30573, 30383, 29995, 29879, 320, 29873, 5325, 30728, 31294, 30573, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 1853, 29892, 2066, 876, 13, 4706, 1683, 29901, 13, 9651, 1596, 11702, 29879, 29905, 29876, 1400, 31088, 31376, 2587, 30832, 30883, 30573, 30383, 29995, 29879, 320, 15370, 30728, 31294, 30573, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 1134, 29892, 3573, 876, 13, 9651, 28468, 29918, 3728, 29889, 1188, 3888, 11702, 29879, 29905, 29876, 1400, 31088, 31376, 2587, 30832, 30883, 30573, 30383, 29995, 29879, 320, 15370, 30728, 31294, 30573, 30383, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 1853, 29892, 3573, 876, 13, 13, 1678, 11539, 353, 7700, 29871, 396, 29871, 30392, 31191, 233, 166, 131, 236, 173, 143, 13, 1678, 620, 353, 6571, 259, 396, 29871, 31092, 232, 146, 154, 31086, 30742, 30354, 30763, 13, 13, 1678, 1018, 29901, 13, 4706, 364, 353, 269, 29889, 3827, 29898, 5696, 29922, 5696, 29892, 13, 462, 418, 21046, 29922, 21509, 29892, 13, 462, 418, 3142, 29922, 2271, 29892, 13, 462, 418, 8636, 29922, 7529, 29892, 13, 462, 418, 9066, 29922, 13662, 29892, 13, 462, 418, 848, 29922, 2587, 29892, 13, 462, 418, 11539, 29922, 27902, 29897, 13, 4706, 1596, 703, 31610, 30806, 31086, 30742, 30689, 31021, 30383, 29995, 29879, 29908, 1273, 364, 29889, 3051, 29889, 13808, 703, 9420, 29899, 29947, 5783, 13, 4706, 28468, 29918, 3728, 29889, 1188, 3888, 703, 31610, 30806, 31086, 30742, 30689, 31021, 30383, 29995, 29879, 29908, 1273, 364, 29889, 3051, 29889, 13808, 703, 9420, 29899, 29947, 5783, 13, 4706, 620, 3366, 4882, 401, 3108, 353, 851, 29898, 29878, 29889, 4882, 29918, 401, 29897, 29871, 396, 29871, 31531, 31613, 31183, 31415, 30494, 710, 13, 4706, 620, 3366, 726, 3108, 353, 364, 29889, 3051, 29889, 13808, 703, 9420, 29899, 29947, 1159, 13, 4706, 620, 3366, 3706, 3108, 353, 851, 29898, 29878, 29889, 295, 28170, 29889, 7827, 29918, 23128, 3101, 259, 396, 29871, 31092, 30856, 31088, 31376, 30594, 31016, 31415, 710, 13, 4706, 565, 620, 3366, 4882, 401, 3108, 2804, 376, 29906, 29900, 29900, 1115, 13, 9651, 620, 3366, 2704, 3108, 353, 620, 3366, 726, 3108, 13, 9651, 736, 7700, 13, 4706, 1683, 29901, 13, 9651, 620, 3366, 2704, 3108, 353, 5124, 13, 4706, 620, 3366, 7645, 3108, 353, 5124, 13, 4706, 565, 1243, 1272, 3366, 3198, 3149, 3108, 297, 620, 3366, 726, 3108, 29901, 13, 9651, 620, 3366, 2914, 3108, 353, 376, 3364, 29908, 13, 9651, 620, 3366, 726, 3108, 353, 364, 29889, 3051, 29889, 13808, 703, 9420, 29899, 29947, 1159, 13, 9651, 1596, 11702, 29879, 320, 29873, 31092, 30856, 31088, 31376, 30594, 31016, 30383, 29995, 893, 320, 29873, 30406, 31507, 31851, 31787, 31320, 30801, 16664, 29879, 807, 29958, 29995, 29879, 376, 1273, 313, 6717, 29918, 2230, 29892, 690, 3366, 3706, 12436, 1688, 29918, 29876, 431, 29892, 620, 3366, 2914, 3108, 876, 13, 9651, 28468, 29918, 3728, 29889, 1188, 3888, 11702, 29879, 320, 29873, 31092, 30856, 31088, 31376, 30594, 31016, 30383, 29995, 893, 320, 29873, 30406, 31507, 31851, 31787, 31320, 30801, 16664, 29879, 807, 29958, 29995, 29879, 376, 1273, 313, 6717, 29918, 2230, 29892, 690, 3366, 3706, 12436, 1688, 29918, 29876, 431, 29892, 620, 3366, 2914, 3108, 876, 13, 9651, 736, 5852, 13, 4706, 1683, 29901, 13, 9651, 620, 3366, 2914, 3108, 353, 376, 14057, 29908, 13, 9651, 1596, 11702, 29879, 320, 29873, 29871, 31092, 30856, 31088, 31376, 30594, 31016, 30383, 29995, 893, 320, 29873, 30406, 31507, 31851, 31787, 31320, 30801, 16664, 29879, 807, 29958, 29995, 29879, 29871, 1273, 29879, 2216, 297, 1273, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 690, 3366, 3706, 12436, 1688, 29918, 29876, 431, 29892, 620, 3366, 2914, 12436, 1688, 1272, 3366, 3198, 3149, 12436, 690, 3366, 726, 3108, 876, 13, 9651, 28468, 29918, 3728, 29889, 1188, 3888, 11702, 29879, 320, 29873, 29871, 31092, 30856, 31088, 31376, 30594, 31016, 30383, 29995, 893, 320, 29873, 30406, 31507, 31851, 31787, 31320, 30801, 16664, 29879, 807, 29958, 29995, 29879, 29871, 1273, 29879, 2216, 297, 1273, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 690, 3366, 3706, 12436, 1688, 29918, 29876, 431, 29892, 620, 3366, 2914, 12436, 1688, 1272, 3366, 3198, 3149, 12436, 690, 3366, 726, 3108, 876, 13, 9651, 736, 7700, 13, 13, 1678, 5174, 8960, 408, 10191, 29901, 13, 4706, 620, 3366, 7645, 3108, 353, 851, 29898, 7645, 29897, 13, 4706, 28468, 29918, 3728, 29889, 1188, 27392, 11702, 29879, 29905, 29873, 29995, 29879, 29908, 1273, 313, 6717, 29918, 2230, 29892, 10191, 876, 13, 4706, 736, 620, 13, 13, 2 ]
searchBar/basicapp/tests.py
rajvijen/Industry-Visit-Planning-and-Booking
0
128868
<filename>searchBar/basicapp/tests.py from django.test import TestCase ,Client from django.http import HttpRequest from django.urls import reverse from .models import UserProfileInfo from django.contrib.auth.models import User class ListView_Testing(TestCase): @classmethod def setUpTestData(cls): cls.client = Client() cls.user = User.objects.create_user(username = "hemanth",email='<EMAIL>', password='<PASSWORD>') cls.profile = UserProfileInfo.objects.create(user = cls.user,name = "hemanth",gender = "M") def test_view_uses_correct_template_index(self): response = self.client.get(reverse('index')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'searchBarApp/index.html') def test_view_register(self): response = self.client.get(reverse('basicapp:register')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/registration.html') def test_user_login(self): response = self.client.get(reverse('basicapp:user_login')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/login.html') def test_user_profile(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:profile')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/profile.html') def test_user_profile_update(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:update')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/update_profile.html') def test_visited_industries(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:visited_industries')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/visited.html') def test_Booked_industries(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:booked_to_visit')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/booked_to_visit.html') ''' def test_charge1(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:charge1')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/booking_charge.html') def test_charge2(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:charge2')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/booking_charge.html') def test_Cancelticket(self): self.client.force_login(self.user) response = self.client.get(reverse('basicapp:cancel_ticket')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/booked_to_visit.html') def test_activate(self,**kwargs,**kwargs1): response = self.client.get(reverse('basicapp:activate',**kwargs,**kwargs1)) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'searchBarApp/index.html') class Forms_Testing(TestCase): def test_UserProfileInfoForms(self): invalid_data = { 'username':"Hemanth", 'email':"<EMAIL>", 'password':<PASSWORD>, 'name':'hemanth', 'gender':"K" } form = UserProfileInfo(data = invalid_data) form.is_valid() self.assertTrue(form.errors) ''' #URL-Testing class URL_testing(TestCase): @classmethod def setUpTestData(cls): cls.client = Client() cls.user = User.objects.create_user(username = "hemanth",email='<EMAIL>', password='<PASSWORD>') cls.profile = UserProfileInfo.objects.create(user = cls.user,name = "hemanth",gender = "M") def test_URL_register(self): response = self.client.get(reverse('basicapp:register')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/registration.html') def test_URL_user_login(self): response = self.client.get(reverse('basicapp:user_login')) self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'basicapp/login.html') def test_URL_profile(self): #self.client.force_login(self.user) response = self.client.get(reverse('basicapp:profile')) self.assertEqual(response.status_code, 302) #self.assertTemplateUsed(response, 'basicapp/profile.html') def test_URL_profile_update(self): response = self.client.get(reverse('basicapp:update')) self.assertEqual(response.status_code, 302) def test_URL_visited_industries(self): response = self.client.get(reverse('basicapp:visited_industries')) self.assertEqual(response.status_code, 302) def test_URL_bookinglist_update(self): response = self.client.get(reverse('basicapp:booked_to_visit')) self.assertEqual(response.status_code, 302) ''' def test_URL_charge1(self): response = self.client.get(reverse('basicapp:charge1')) self.assertEqual(response.status_code, 302) def test_URL_charge2(self): response = self.client.get(reverse('basicapp:charge2')) self.assertEqual(response.status_code, 302) '''
[ 1, 529, 9507, 29958, 4478, 4297, 29914, 16121, 932, 29914, 21150, 29889, 2272, 13, 3166, 9557, 29889, 1688, 1053, 4321, 8259, 1919, 4032, 30004, 13, 3166, 9557, 29889, 1124, 1053, 9056, 3089, 30004, 13, 3166, 9557, 29889, 26045, 1053, 11837, 30004, 13, 3166, 869, 9794, 1053, 4911, 13909, 3401, 30004, 13, 3166, 9557, 29889, 21570, 29889, 5150, 29889, 9794, 1053, 4911, 30004, 13, 30004, 13, 1990, 22184, 29918, 3057, 292, 29898, 3057, 8259, 1125, 30004, 13, 1678, 732, 1990, 5696, 30004, 13, 1678, 822, 731, 3373, 3057, 1469, 29898, 25932, 1125, 30004, 13, 4706, 1067, 29879, 29889, 4645, 353, 12477, 26471, 13, 4706, 1067, 29879, 29889, 1792, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 29898, 6786, 353, 376, 8008, 9716, 613, 5269, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 29966, 25711, 17013, 29958, 1495, 30004, 13, 4706, 1067, 29879, 29889, 10185, 353, 4911, 13909, 3401, 29889, 12650, 29889, 3258, 29898, 1792, 353, 1067, 29879, 29889, 1792, 29892, 978, 353, 376, 8008, 9716, 613, 26098, 353, 376, 29924, 1159, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1493, 29918, 6394, 29918, 15728, 29918, 6886, 29918, 2248, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 2248, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 4478, 4297, 2052, 29914, 2248, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1493, 29918, 9573, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 9573, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 1727, 8306, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1792, 29918, 7507, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 1792, 29918, 7507, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 7507, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1792, 29918, 10185, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 10185, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 10185, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1792, 29918, 10185, 29918, 5504, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 5504, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 5504, 29918, 10185, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 1730, 1573, 29918, 20041, 2722, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 1730, 1573, 29918, 20041, 2722, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 1730, 1573, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 10967, 287, 29918, 20041, 2722, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 2909, 287, 29918, 517, 29918, 1730, 277, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 2909, 287, 29918, 517, 29918, 1730, 277, 29889, 1420, 1495, 30004, 13, 12008, 30004, 13, 1678, 822, 1243, 29918, 23367, 29896, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 23367, 29896, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 2909, 292, 29918, 23367, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 23367, 29906, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 23367, 29906, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 2909, 292, 29918, 23367, 29889, 1420, 1495, 30004, 13, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 29907, 4564, 2152, 8522, 29898, 1311, 1125, 30004, 13, 4706, 1583, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 20713, 29918, 29873, 8522, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 2909, 287, 29918, 517, 29918, 1730, 277, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 11236, 403, 29898, 1311, 29892, 1068, 19290, 29892, 1068, 19290, 29896, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 11236, 403, 742, 1068, 19290, 29892, 1068, 19290, 29896, 876, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 4478, 4297, 2052, 29914, 2248, 29889, 1420, 1495, 30004, 13, 30004, 13, 30004, 13, 1990, 3812, 29879, 29918, 3057, 292, 29898, 3057, 8259, 1125, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 2659, 13909, 3401, 12605, 29898, 1311, 1125, 30004, 13, 4706, 8340, 29918, 1272, 353, 3336, 13, 18884, 525, 6786, 2396, 29908, 29950, 331, 9716, 15231, 13, 18884, 525, 5269, 2396, 29908, 29966, 26862, 6227, 29958, 15231, 13, 18884, 525, 5630, 2396, 29966, 25711, 17013, 10202, 30004, 13, 18884, 525, 978, 22099, 8008, 9716, 23592, 13, 18884, 525, 26098, 2396, 29908, 29968, 19451, 13, 9651, 4970, 13, 4706, 883, 353, 4911, 13909, 3401, 29898, 1272, 353, 8340, 29918, 1272, 8443, 13, 4706, 883, 29889, 275, 29918, 3084, 26471, 13, 4706, 1583, 29889, 9294, 5574, 29898, 689, 29889, 12523, 8443, 13, 12008, 30004, 13, 30004, 13, 29937, 4219, 29899, 3057, 292, 30004, 13, 1990, 3988, 29918, 13424, 29898, 3057, 8259, 1125, 30004, 13, 1678, 732, 1990, 5696, 30004, 13, 1678, 822, 731, 3373, 3057, 1469, 29898, 25932, 1125, 30004, 13, 4706, 1067, 29879, 29889, 4645, 353, 12477, 26471, 13, 4706, 1067, 29879, 29889, 1792, 353, 4911, 29889, 12650, 29889, 3258, 29918, 1792, 29898, 6786, 353, 376, 8008, 9716, 613, 5269, 2433, 29966, 26862, 6227, 29958, 742, 4800, 2433, 29966, 25711, 17013, 29958, 1495, 30004, 13, 4706, 1067, 29879, 29889, 10185, 353, 4911, 13909, 3401, 29889, 12650, 29889, 3258, 29898, 1792, 353, 1067, 29879, 29889, 1792, 29892, 978, 353, 376, 8008, 9716, 613, 26098, 353, 376, 29924, 1159, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 9573, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 9573, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 1727, 8306, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 1792, 29918, 7507, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 1792, 29918, 7507, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 8443, 13, 4706, 1583, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 7507, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 10185, 29898, 1311, 1125, 30004, 13, 4706, 396, 1311, 29889, 4645, 29889, 10118, 29918, 7507, 29898, 1311, 29889, 1792, 8443, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 10185, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 4706, 396, 1311, 29889, 9294, 6733, 29965, 8485, 29898, 5327, 29892, 525, 16121, 932, 29914, 10185, 29889, 1420, 1495, 30004, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 10185, 29918, 5504, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 5504, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 1730, 1573, 29918, 20041, 2722, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 1730, 1573, 29918, 20041, 2722, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 2909, 292, 1761, 29918, 5504, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 2909, 287, 29918, 517, 29918, 1730, 277, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 12008, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 23367, 29896, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 23367, 29896, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 30004, 13, 1678, 822, 1243, 29918, 4219, 29918, 23367, 29906, 29898, 1311, 1125, 30004, 13, 4706, 2933, 353, 1583, 29889, 4645, 29889, 657, 29898, 24244, 877, 16121, 932, 29901, 23367, 29906, 8785, 30004, 13, 4706, 1583, 29889, 9294, 9843, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29941, 29900, 29906, 8443, 13, 12008, 2 ]
examples/canvas/stencil_canvas.py
Sentient07/kivy
0
1610690
''' Stencil demo ============ This is a test of the stencil graphics instruction inside the stencil view widget. When you use a stencil, every draw outside the bounding box of the stencil view will be avoid. All the graphics will draw only in the stencil view. You can "draw" a stencil view by touch & draw. The touch down will set the position, and the drag will set the size. ''' from kivy.app import App from kivy.core.window import Window from kivy.graphics import Color, Rectangle from kivy.uix.boxlayout import BoxLayout from kivy.uix.floatlayout import FloatLayout from kivy.uix.button import Button from kivy.uix.label import Label from kivy.uix.stencilview import StencilView from random import random as r from functools import partial class StencilTestWidget(StencilView): '''Drag to define stencil area ''' def on_touch_down(self, touch): self.pos = touch.pos self.size = (1, 1) def on_touch_move(self, touch): self.size = (touch.x - touch.ox, touch.y - touch.oy) class StencilCanvasApp(App): def add_rects(self, label, wid, count, *largs): label.text = str(int(label.text) + count) with wid.canvas: for x in range(count): Color(r(), 1, 1, mode='hsv') Rectangle(pos=(r() * wid.width + wid.x, r() * wid.height + wid.y), size=(10, 10)) def reset_stencil(self, wid, *largs): wid.pos = (0, 0) wid.size = Window.size def reset_rects(self, label, wid, *largs): label.text = '0' wid.canvas.clear() def build(self): wid = StencilTestWidget(size_hint=(None, None), size=Window.size) label = Label(text='0') btn_add500 = Button(text='+ 200 rects') btn_add500.bind(on_press=partial(self.add_rects, label, wid, 200)) btn_reset = Button(text='Reset Rectangles') btn_reset.bind(on_press=partial(self.reset_rects, label, wid)) btn_stencil = Button(text='Reset Stencil') btn_stencil.bind(on_press=partial(self.reset_stencil, wid)) layout = BoxLayout(size_hint=(1, None), height=50) layout.add_widget(btn_add500) layout.add_widget(btn_reset) layout.add_widget(btn_stencil) layout.add_widget(label) root = BoxLayout(orientation='vertical') rfl = FloatLayout() rfl.add_widget(wid) root.add_widget(rfl) root.add_widget(layout) return root if __name__ == '__main__': StencilCanvasApp().run()
[ 1, 14550, 13, 29903, 841, 5553, 13455, 13, 4936, 2751, 13, 13, 4013, 338, 263, 1243, 310, 278, 380, 3977, 309, 18533, 15278, 2768, 278, 380, 3977, 309, 1776, 13, 8030, 29889, 1932, 366, 671, 263, 380, 3977, 309, 29892, 1432, 4216, 5377, 278, 3216, 292, 3800, 310, 278, 13, 3510, 5553, 1776, 674, 367, 4772, 29889, 2178, 278, 18533, 674, 4216, 871, 297, 278, 380, 3977, 309, 1776, 29889, 13, 13, 3492, 508, 376, 4012, 29908, 263, 380, 3977, 309, 1776, 491, 6023, 669, 4216, 29889, 450, 6023, 1623, 674, 731, 278, 13, 3283, 29892, 322, 278, 8338, 674, 731, 278, 2159, 29889, 13, 12008, 13, 13, 3166, 413, 440, 29891, 29889, 932, 1053, 2401, 13, 3166, 413, 440, 29891, 29889, 3221, 29889, 7165, 1053, 18379, 13, 3166, 413, 440, 29891, 29889, 6420, 1053, 9159, 29892, 22914, 2521, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 1884, 2680, 1053, 11773, 3453, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 7411, 2680, 1053, 27842, 3453, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 3092, 1053, 11025, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 1643, 1053, 15796, 13, 3166, 413, 440, 29891, 29889, 29884, 861, 29889, 3510, 5553, 1493, 1053, 624, 3977, 309, 1043, 13, 3166, 4036, 1053, 4036, 408, 364, 13, 3166, 2090, 312, 8789, 1053, 7687, 13, 13, 13, 1990, 624, 3977, 309, 3057, 8801, 29898, 29903, 841, 5553, 1043, 1125, 13, 1678, 14550, 23978, 304, 4529, 380, 3977, 309, 4038, 13, 1678, 14550, 13, 13, 1678, 822, 373, 29918, 16747, 29918, 3204, 29898, 1311, 29892, 6023, 1125, 13, 4706, 1583, 29889, 1066, 353, 6023, 29889, 1066, 13, 4706, 1583, 29889, 2311, 353, 313, 29896, 29892, 29871, 29896, 29897, 13, 13, 1678, 822, 373, 29918, 16747, 29918, 11631, 29898, 1311, 29892, 6023, 1125, 13, 4706, 1583, 29889, 2311, 353, 313, 16747, 29889, 29916, 448, 6023, 29889, 2251, 29892, 6023, 29889, 29891, 448, 6023, 29889, 12602, 29897, 13, 13, 13, 1990, 624, 3977, 309, 21960, 2052, 29898, 2052, 1125, 13, 13, 1678, 822, 788, 29918, 1621, 29879, 29898, 1311, 29892, 3858, 29892, 9449, 29892, 2302, 29892, 334, 29880, 5085, 1125, 13, 4706, 3858, 29889, 726, 353, 851, 29898, 524, 29898, 1643, 29889, 726, 29897, 718, 2302, 29897, 13, 4706, 411, 9449, 29889, 15257, 29901, 13, 9651, 363, 921, 297, 3464, 29898, 2798, 1125, 13, 18884, 9159, 29898, 29878, 3285, 29871, 29896, 29892, 29871, 29896, 29892, 4464, 2433, 29882, 4501, 1495, 13, 18884, 22914, 2521, 29898, 1066, 7607, 29878, 580, 334, 9449, 29889, 2103, 718, 9449, 29889, 29916, 29892, 13, 462, 1669, 364, 580, 334, 9449, 29889, 3545, 718, 9449, 29889, 29891, 511, 2159, 7607, 29896, 29900, 29892, 29871, 29896, 29900, 876, 13, 13, 1678, 822, 10092, 29918, 3510, 5553, 29898, 1311, 29892, 9449, 29892, 334, 29880, 5085, 1125, 13, 4706, 9449, 29889, 1066, 353, 313, 29900, 29892, 29871, 29900, 29897, 13, 4706, 9449, 29889, 2311, 353, 18379, 29889, 2311, 13, 13, 1678, 822, 10092, 29918, 1621, 29879, 29898, 1311, 29892, 3858, 29892, 9449, 29892, 334, 29880, 5085, 1125, 13, 4706, 3858, 29889, 726, 353, 525, 29900, 29915, 13, 4706, 9449, 29889, 15257, 29889, 8551, 580, 13, 13, 1678, 822, 2048, 29898, 1311, 1125, 13, 4706, 9449, 353, 624, 3977, 309, 3057, 8801, 29898, 2311, 29918, 29882, 524, 7607, 8516, 29892, 6213, 511, 2159, 29922, 5907, 29889, 2311, 29897, 13, 13, 4706, 3858, 353, 15796, 29898, 726, 2433, 29900, 1495, 13, 13, 4706, 9503, 29918, 1202, 29945, 29900, 29900, 353, 11025, 29898, 726, 2433, 29974, 29871, 29906, 29900, 29900, 7705, 29879, 1495, 13, 4706, 9503, 29918, 1202, 29945, 29900, 29900, 29889, 5355, 29898, 265, 29918, 2139, 29922, 3846, 29898, 1311, 29889, 1202, 29918, 1621, 29879, 29892, 3858, 29892, 9449, 29892, 29871, 29906, 29900, 29900, 876, 13, 13, 4706, 9503, 29918, 12071, 353, 11025, 29898, 726, 2433, 27175, 22914, 19536, 1495, 13, 4706, 9503, 29918, 12071, 29889, 5355, 29898, 265, 29918, 2139, 29922, 3846, 29898, 1311, 29889, 12071, 29918, 1621, 29879, 29892, 3858, 29892, 9449, 876, 13, 13, 4706, 9503, 29918, 3510, 5553, 353, 11025, 29898, 726, 2433, 27175, 624, 3977, 309, 1495, 13, 4706, 9503, 29918, 3510, 5553, 29889, 5355, 29898, 265, 29918, 2139, 29922, 3846, 29898, 1311, 29889, 12071, 29918, 3510, 5553, 29892, 9449, 876, 13, 13, 4706, 5912, 353, 11773, 3453, 29898, 2311, 29918, 29882, 524, 7607, 29896, 29892, 6213, 511, 3171, 29922, 29945, 29900, 29897, 13, 4706, 5912, 29889, 1202, 29918, 8030, 29898, 7290, 29918, 1202, 29945, 29900, 29900, 29897, 13, 4706, 5912, 29889, 1202, 29918, 8030, 29898, 7290, 29918, 12071, 29897, 13, 4706, 5912, 29889, 1202, 29918, 8030, 29898, 7290, 29918, 3510, 5553, 29897, 13, 4706, 5912, 29889, 1202, 29918, 8030, 29898, 1643, 29897, 13, 13, 4706, 3876, 353, 11773, 3453, 29898, 20659, 2433, 18575, 1495, 13, 4706, 364, 1579, 353, 27842, 3453, 580, 13, 4706, 364, 1579, 29889, 1202, 29918, 8030, 29898, 9163, 29897, 13, 4706, 3876, 29889, 1202, 29918, 8030, 29898, 29878, 1579, 29897, 13, 4706, 3876, 29889, 1202, 29918, 8030, 29898, 2680, 29897, 13, 13, 4706, 736, 3876, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 624, 3977, 309, 21960, 2052, 2141, 3389, 580, 13, 2 ]
models/base.py
neural-reckoning/decoding_sound_location
1
129979
<reponame>neural-reckoning/decoding_sound_location from brian import * from brian.hears import * from matplotlib import cm, rcParams import sys, os, glob sys.path = [os.path.normpath(os.path.join(os.path.split(__file__)[0], '../'))]+sys.path from common import *
[ 1, 529, 276, 1112, 420, 29958, 484, 3631, 29899, 18217, 28259, 29914, 7099, 3689, 29918, 29802, 29918, 5479, 13, 3166, 289, 6392, 1053, 334, 13, 3166, 289, 6392, 29889, 354, 1503, 1053, 334, 13, 3166, 22889, 1053, 7477, 29892, 364, 29883, 9629, 13, 5215, 10876, 29892, 2897, 29892, 13149, 13, 9675, 29889, 2084, 353, 518, 359, 29889, 2084, 29889, 12324, 2084, 29898, 359, 29889, 2084, 29889, 7122, 29898, 359, 29889, 2084, 29889, 5451, 22168, 1445, 1649, 9601, 29900, 1402, 525, 6995, 8785, 10062, 9675, 29889, 2084, 13, 3166, 3619, 1053, 334, 13, 2 ]
identipy_app/migrations/0016_auto_20191025_1622.py
levitsky/identipy_server
0
94735
<gh_stars>0 # -*- coding: utf-8 -*- # Generated by Django 1.11.25 on 2019-10-25 13:22 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('identipy_app', '0015_auto_20190719_2316'), ] operations = [ migrations.AlterField( model_name='resimagefile', name='imgtype', field=models.CharField(choices=[(b'S', b'PSM'), (b'P', b'Peptide'), (b'R', b'Protein'), (b'O', b'Feature')], default=b'O', max_length=1), ), migrations.AlterField( model_name='searchrun', name='status', field=models.CharField(choices=[(b'W', b'Waiting'), (b'R', b'Running'), (b'V', b'Postsearch processing'), (b'F', b'Finished'), (b'D', b'Dead'), (b'E', b'Error')], default=b'D', max_length=1), ), ]
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 29937, 3251, 630, 491, 15337, 29871, 29896, 29889, 29896, 29896, 29889, 29906, 29945, 373, 29871, 29906, 29900, 29896, 29929, 29899, 29896, 29900, 29899, 29906, 29945, 29871, 29896, 29941, 29901, 29906, 29906, 13, 3166, 4770, 29888, 9130, 1649, 1053, 29104, 29918, 20889, 1338, 13, 13, 3166, 9557, 29889, 2585, 1053, 9725, 800, 29892, 4733, 13, 13, 13, 1990, 341, 16783, 29898, 26983, 800, 29889, 29924, 16783, 1125, 13, 13, 1678, 9962, 353, 518, 13, 4706, 6702, 1693, 666, 29891, 29918, 932, 742, 525, 29900, 29900, 29896, 29945, 29918, 6921, 29918, 29906, 29900, 29896, 29929, 29900, 29955, 29896, 29929, 29918, 29906, 29941, 29896, 29953, 5477, 13, 1678, 4514, 13, 13, 1678, 6931, 353, 518, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 690, 3027, 1445, 742, 13, 9651, 1024, 2433, 2492, 1853, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 1859, 1575, 11759, 29898, 29890, 29915, 29903, 742, 289, 29915, 7024, 29924, 5477, 313, 29890, 29915, 29925, 742, 289, 29915, 15666, 415, 680, 5477, 313, 29890, 29915, 29934, 742, 289, 29915, 1184, 371, 262, 5477, 313, 29890, 29915, 29949, 742, 289, 29915, 19132, 1495, 1402, 2322, 29922, 29890, 29915, 29949, 742, 4236, 29918, 2848, 29922, 29896, 511, 13, 4706, 10353, 13, 4706, 9725, 800, 29889, 2499, 357, 3073, 29898, 13, 9651, 1904, 29918, 978, 2433, 4478, 3389, 742, 13, 9651, 1024, 2433, 4882, 742, 13, 9651, 1746, 29922, 9794, 29889, 27890, 29898, 1859, 1575, 11759, 29898, 29890, 29915, 29956, 742, 289, 29915, 15716, 292, 5477, 313, 29890, 29915, 29934, 742, 289, 29915, 27795, 5477, 313, 29890, 29915, 29963, 742, 289, 29915, 6747, 4478, 9068, 5477, 313, 29890, 29915, 29943, 742, 289, 29915, 12881, 3276, 5477, 313, 29890, 29915, 29928, 742, 289, 29915, 29928, 1479, 5477, 313, 29890, 29915, 29923, 742, 289, 29915, 2392, 1495, 1402, 2322, 29922, 29890, 29915, 29928, 742, 4236, 29918, 2848, 29922, 29896, 511, 13, 4706, 10353, 13, 1678, 4514, 13, 2 ]
common_logger/utils1.py
NathanKr/python-logger-playground
0
183955
<reponame>NathanKr/python-logger-playground import logging def add(num1 : float,num2 : float)->float: logging.warning(f'args : {num1} , {num2}') return num1+num2
[ 1, 529, 276, 1112, 420, 29958, 29940, 11385, 29968, 29878, 29914, 4691, 29899, 21707, 29899, 1456, 2057, 13, 5215, 12183, 13, 13, 1753, 788, 29898, 1949, 29896, 584, 5785, 29892, 1949, 29906, 584, 5785, 19969, 7411, 29901, 13, 1678, 12183, 29889, 27392, 29898, 29888, 29915, 5085, 584, 426, 1949, 29896, 29913, 1919, 426, 1949, 29906, 29913, 1495, 13, 1678, 736, 954, 29896, 29974, 1949, 29906, 2 ]
python/python_challenge/25/25.py
yunyu2019/blog
0
27951
<reponame>yunyu2019/blog<filename>python/python_challenge/25/25.py<gh_stars>0 #!/usr/bin/python # -*- coding: utf-8 -*- # @Date : 2016-05-17 16:36:18 # @Author : Yunyu2019 (<EMAIL>) # @Link : http://www.pythonchallenge.com/pc/hex/lake.html import os import wave import time import Image import requests def download(urls): filename=os.path.basename(urls) try: req=requests.get(urls,auth=('butter','fly')) fp=open(filename,'wb') fp.write(req.content) fp.close() print 'download:%s' % filename except: print 'fail download:%s' % filename def getdatas(files): fp=open(files,'rb') data=fp.read()[44:] fp.close() img=Image.new('RGB',(60,60)) img.fromstring(data) return img """ for i in range(1,26): urls='http://www.pythonchallenge.com/pc/hex/lake%s.wav' % i download(urls) time.sleep(1) """ img=Image.new('RGB',(300,300)) for i in range(25): y,x=divmod(i,5) files='lake{0}.wav'.format(i+1) pices=getdatas(files) img.paste(pices,(x*60,y*60)) img.save('lake.jpg')
[ 1, 529, 276, 1112, 420, 29958, 29891, 348, 29891, 29884, 29906, 29900, 29896, 29929, 29914, 7312, 29966, 9507, 29958, 4691, 29914, 4691, 29918, 305, 11768, 29914, 29906, 29945, 29914, 29906, 29945, 29889, 2272, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 29937, 14708, 4855, 29914, 2109, 29914, 4691, 30004, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 29937, 732, 2539, 1678, 584, 29871, 29906, 29900, 29896, 29953, 29899, 29900, 29945, 29899, 29896, 29955, 29871, 29896, 29953, 29901, 29941, 29953, 29901, 29896, 29947, 30004, 13, 29937, 732, 13720, 29871, 584, 612, 348, 29891, 29884, 29906, 29900, 29896, 29929, 313, 29966, 26862, 6227, 29958, 8443, 13, 29937, 732, 6595, 1678, 584, 1732, 597, 1636, 29889, 4691, 305, 11768, 29889, 510, 29914, 6739, 29914, 20970, 29914, 433, 446, 29889, 1420, 30004, 13, 30004, 13, 5215, 2897, 30004, 13, 5215, 10742, 30004, 13, 5215, 931, 30004, 13, 5215, 7084, 30004, 13, 5215, 7274, 30004, 13, 30004, 13, 1753, 5142, 29898, 26045, 1125, 29871, 6756, 13, 1678, 10422, 29922, 359, 29889, 2084, 29889, 6500, 3871, 29898, 26045, 8443, 13, 1678, 1018, 29901, 30004, 13, 4706, 12428, 29922, 24830, 29889, 657, 29898, 26045, 29892, 5150, 29922, 877, 4187, 357, 3788, 17652, 8785, 30004, 13, 4706, 285, 29886, 29922, 3150, 29898, 9507, 5501, 29893, 29890, 1495, 30004, 13, 4706, 285, 29886, 29889, 3539, 29898, 7971, 29889, 3051, 8443, 13, 4706, 285, 29886, 29889, 5358, 26471, 13, 4706, 1596, 525, 10382, 16664, 29879, 29915, 1273, 10422, 30004, 13, 1678, 5174, 29901, 30004, 13, 4706, 1596, 525, 14057, 5142, 16664, 29879, 29915, 1273, 10422, 30004, 13, 30004, 13, 30004, 13, 1753, 679, 14538, 29898, 5325, 1125, 30004, 13, 1678, 285, 29886, 29922, 3150, 29898, 5325, 5501, 6050, 1495, 30004, 13, 1678, 848, 29922, 18091, 29889, 949, 580, 29961, 29946, 29946, 17531, 30004, 13, 1678, 285, 29886, 29889, 5358, 26471, 13, 1678, 10153, 29922, 2940, 29889, 1482, 877, 28212, 742, 29898, 29953, 29900, 29892, 29953, 29900, 876, 30004, 13, 1678, 10153, 29889, 3166, 1807, 29898, 1272, 8443, 13, 1678, 736, 10153, 30004, 13, 15945, 19451, 13, 1454, 474, 297, 3464, 29898, 29896, 29892, 29906, 29953, 1125, 30004, 13, 1678, 23942, 2433, 1124, 597, 1636, 29889, 4691, 305, 11768, 29889, 510, 29914, 6739, 29914, 20970, 29914, 433, 446, 29995, 29879, 29889, 29893, 485, 29915, 1273, 474, 30004, 13, 1678, 5142, 29898, 26045, 8443, 13, 1678, 931, 29889, 17059, 29898, 29896, 8443, 13, 15945, 19451, 13, 2492, 29922, 2940, 29889, 1482, 877, 28212, 742, 29898, 29941, 29900, 29900, 29892, 29941, 29900, 29900, 876, 30004, 13, 1454, 474, 297, 3464, 29898, 29906, 29945, 1125, 30004, 13, 1678, 343, 29892, 29916, 29922, 4563, 1545, 29898, 29875, 29892, 29945, 8443, 13, 1678, 2066, 2433, 433, 446, 29912, 29900, 1836, 29893, 485, 4286, 4830, 29898, 29875, 29974, 29896, 8443, 13, 1678, 282, 1575, 29922, 657, 14538, 29898, 5325, 8443, 13, 1678, 10153, 29889, 16179, 29898, 29886, 1575, 22657, 29916, 29930, 29953, 29900, 29892, 29891, 29930, 29953, 29900, 876, 30004, 13, 2492, 29889, 7620, 877, 433, 446, 29889, 6173, 1495, 2 ]
nvmexplorer_src/input_defs/nvsim_interface.py
lpentecost/NVMExplorer
5
87048
<reponame>lpentecost/NVMExplorer #initialize class for nvsim output class, to be extracted from parsed nvsim results and pickled as input to the analytical model #per-technology specifications can be inherit from nvmexplorer_src.input_defs.cell_cfgs import * class NVSimInputConfig: def __init__(self, mem_cfg_file_path="../../data/mem_cfgs/test_SRAM.cfg", #path to nvsim cfg input process_node=45, #chosen node in nm opt_target="ReadLatency", #optimization target word_width=64, #word width in bits capacity=4, #capacity in MB cell_type=SRAMCellConfig() #pass the cell configuration ): self.mem_cfg_file_path = mem_cfg_file_path self.process_node = process_node self.opt_target = opt_target self.word_width = word_width self.capacity = capacity self.cell_type = cell_type def generate_mem_cfg(self): """ Creates a memory config file using characteristics of :class:`NVSimInputConfig` object to be used as an input to NVSim """ cfg_file = open(self.mem_cfg_file_path, "w+") cfg_file.write(self.cell_type.mem_cfg_base) cfg_file.write("-ProcessNode: %d\n" % self.process_node+"\n") cfg_file.write("-OptimizationTarget: "+self.opt_target+"\n") cfg_file.write("-WordWidth (bit): %d\n" % self.word_width+"\n") cfg_file.write("-Capacity (MB): %d\n" % self.capacity+"\n") if self.cell_type.mlc > 1: cell_levels = 2**(self.cell_type.mlc) cfg_file.write("-CellLevels: %d\n" % cell_levels+"\n") cfg_file.close() class NVSimOutputConfig: #initialized to 16nm SRAM, 4MB def __init__(self, exp_name="default", #name or ID #retain relevant NVSim configs input_cfg = NVSimInputConfig(), #also define all relevant outputs read_latency=-1, #ns read_bw=-1, #GB/s read_energy=-1, #pJ/access write_latency=-1, #ns write_bw=-1, #GB/s write_energy=-1, #nJ/access leakage_power=-1, #mW area=-1, #mm^2 area_efficiency=-1 #percentage ): # define all parameters self.exp_name = exp_name self.input_cfg = input_cfg self.read_latency = read_latency self.read_bw = read_bw self.read_energy = read_energy self.write_latency = write_latency self.write_bw = write_bw self.write_energy = write_energy self.leakage_power = leakage_power self.area = area self.area_efficiency = area_efficiency def print_summary(self): """ Prints a summary of the parsed NVSim output results """ print("Experiment Name: "+self.exp_name) print("Read Latency (ns): %f" % self.read_latency) print("Read BW (GB/s): %f" % self.read_bw) print("Write Latency (ns): %f" % self.write_latency) print("Write BW (GB/s): %f" % self.write_bw) print("Read Energy (pJ): %f" % self.read_energy) print("Write Energy (pJ): %f" % self.write_energy) print("Leakage Power (mW): %f" % self.leakage_power) print("Area (mm^2): %f" % self.area) print("Area Efficiency (percent): %f" % self.area_efficiency) def parse_nvsim_output(filepath='output_examples/sram_0', input_cfg=NVSimInputConfig()): """ Returns a :class:`NVSimOutputConfig` object which gets populated with the output results in parsed from file_path. :param filepath: path to NVSim output file :type filepath: String :param input_cfg: :class:`NVSimIntputConfig` object that was used to create the NVSim output :type input_cfg: :class:`NVSimInputConfig` object :return: :class:`NVSimOutputConfig` object containing parsed NVSim results :rtype: :class:`NVSimOutputConfig` """ #initialize base base = NVSimOutputConfig(input_cfg=input_cfg) with open(filepath, 'r') as f: lines = f.readlines() # Get rid of new lines lines = map(lambda x: x.rstrip(), lines) for line in lines: if ' - Total Area =' in line and (base.area == -1): # sloppy fix, skip to end of line if "=" in line[line.index("=")+1:]: line = line[line.index("=")+1:] base.area = float(line[line.index("=")+1:][:-4]) if line[-4:] == "um^2": base.area = base.area / (1000.)**2 elif ' - Read Latency' in line and (base.read_latency == -1): base.read_latency = float(line[line.index("=")+1:][:-2]) if line[-2:] == "us": #scale to ns base.read_latency = base.read_latency * 1000. if line[-2:] == "ps": #scale to ns base.read_latency = base.read_latency / 1000. if line[-2:] == "ms": #scale to ns (yikes!) base.read_latency = base.read_latency * 1000000. elif ' - Area Efficiency =' in line: base.area_efficiency = float(line[line.index("=")+1:][:-1]) elif ' - Read Bandwidth' in line: base.read_bw = float(line[line.index("=")+1:][:-4]) if line[-4:] == "MB/s": #scale to GB/s base.read_bw = base.read_bw / 1024. if line[-4:] == "KB/s": #scale to GB/s base.read_bw = base.read_bw / 1024. / 1024. elif ' - Write Bandwidth' in line: base.write_bw = float(line[line.index("=")+1:][:-4]) if line[-4:] == "MB/s": #scale to GB/s base.write_bw = base.write_bw / 1024. if line[-4:] == "KB/s": #scale to GB/s base.write_bw = base.write_bw / 1024. / 1024. elif ' - Read Dynamic Energy ' in line: base.read_energy = float(line[line.index("=")+1:][:-2]) if line[-2:] == "nJ": #scale to pJ base.read_energy = base.read_energy * 1000. if line[-2:] == "uJ": #scale to pJ base.read_energy = base.read_energy * 1000. * 1000. elif ' - Leakage Power ' in line: base.leakage_power = float(line[line.index("=")+1:][:-2]) if line[-2:] == "uW": #scale to mW base.leakage_power = base.leakage_power / 1000. elif ' - Write Latency' in line and (base.write_latency == -1): base.write_latency = float(line[line.index("=")+1:][:-2]) if line[-2:] == "us": #scale to ns base.write_latency = base.write_latency * 1000. if line[-2:] == "ps": #scale to ns base.write_latency = base.write_latency / 1000. if line[-2:] == "ms": #scale to ns (yikes!) base.write_latency = base.write_latency * 1000000. elif ' - Write Dynamic Energy ' in line: base.write_energy = float(line[line.index("=")+1:][:-2]) if line[-2:] == "nJ": #scale to pJ base.write_energy = base.write_energy * 1000. if line[-2:] == "uJ": #scale to pJ base.write_energy = base.write_energy * 1000. * 1000. #separately detect any tech-specific quantities if input_cfg.cell_type.mem_cell_type == "SRAM": continue #FIXME set vs. reset for RRAM, support for other cells else: if ' - SET Latency' in line: base.write_latency = float(line[line.index("=")+1:][:-2]) if line[-2:] == "us": #scale to ns base.write_latency = base.write_latency * 1000. if line[-2:] == "ps": #scale to ns base.write_latency = base.write_latency / 1000. if line[-2:] == "ms": #scale to ns (yikes!) base.write_latency = base.write_latency * 1000000. elif ' - SET Dynamic Energy ' in line: base.write_energy = float(line[line.index("=")+1:][:-2]) if line[-2:] == "nJ": #scale to pJ base.write_energy = base.write_energy * 1000. if line[-2:] == "uJ": #scale to pJ base.write_energy = base.write_energy * 1000. * 1000. return base if __name__ == '__main__': #test mem cfg definition and output parsing test_input_cfg = NVSimInputConfig() test_input_cfg.cell_type.generate_cell_file() test_input_cfg.cell_type.append_cell_file() test_input_cfg.generate_mem_cfg() print("Memory config generation test complete.")
[ 1, 529, 276, 1112, 420, 29958, 29880, 22825, 687, 520, 29914, 29940, 9219, 1252, 14716, 13, 29937, 24926, 770, 363, 302, 29894, 3601, 1962, 770, 29892, 304, 367, 23892, 515, 21213, 302, 29894, 3601, 2582, 322, 5839, 839, 408, 1881, 304, 278, 16114, 936, 1904, 13, 29937, 546, 29899, 21695, 3002, 2702, 800, 508, 367, 13125, 13, 3166, 302, 6925, 735, 14716, 29918, 4351, 29889, 2080, 29918, 1753, 29879, 29889, 3729, 29918, 6854, 3174, 1053, 334, 13, 13, 1990, 405, 29963, 8942, 4290, 3991, 29901, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 13, 18884, 2626, 29918, 16859, 29918, 1445, 29918, 2084, 543, 21546, 1272, 29914, 6954, 29918, 6854, 3174, 29914, 1688, 29918, 29903, 25058, 29889, 16859, 613, 396, 2084, 304, 302, 29894, 3601, 274, 16434, 1881, 13, 12, 12, 5014, 29918, 3177, 29922, 29946, 29945, 29892, 396, 305, 7749, 2943, 297, 302, 29885, 13, 12, 12, 3670, 29918, 5182, 543, 6359, 29931, 2579, 1270, 613, 396, 20640, 2133, 3646, 13, 12, 12, 1742, 29918, 2103, 29922, 29953, 29946, 29892, 396, 1742, 2920, 297, 9978, 13, 12, 12, 5030, 5946, 29922, 29946, 29892, 396, 5030, 5946, 297, 13232, 13, 12, 12, 3729, 29918, 1853, 29922, 29903, 25058, 4617, 3991, 580, 396, 3364, 278, 3038, 5285, 13, 12, 12, 1125, 13, 1678, 1583, 29889, 6954, 29918, 16859, 29918, 1445, 29918, 2084, 353, 2626, 29918, 16859, 29918, 1445, 29918, 2084, 13, 1678, 1583, 29889, 5014, 29918, 3177, 353, 1889, 29918, 3177, 13, 1678, 1583, 29889, 3670, 29918, 5182, 353, 3523, 29918, 5182, 13, 1678, 1583, 29889, 1742, 29918, 2103, 353, 1734, 29918, 2103, 13, 1678, 1583, 29889, 5030, 5946, 353, 13284, 13, 1678, 1583, 29889, 3729, 29918, 1853, 353, 3038, 29918, 1853, 13, 13, 29871, 822, 5706, 29918, 6954, 29918, 16859, 29898, 1311, 1125, 13, 1678, 9995, 6760, 1078, 263, 3370, 2295, 934, 773, 21862, 310, 584, 1990, 18078, 29940, 29963, 8942, 4290, 3991, 29952, 1203, 29871, 13, 1678, 304, 367, 1304, 408, 385, 1881, 304, 405, 29963, 8942, 13, 1678, 9995, 13, 1678, 274, 16434, 29918, 1445, 353, 1722, 29898, 1311, 29889, 6954, 29918, 16859, 29918, 1445, 29918, 2084, 29892, 376, 29893, 29974, 1159, 13, 1678, 274, 16434, 29918, 1445, 29889, 3539, 29898, 1311, 29889, 3729, 29918, 1853, 29889, 6954, 29918, 16859, 29918, 3188, 29897, 13, 1678, 274, 16434, 29918, 1445, 29889, 3539, 703, 29899, 7032, 4247, 29901, 1273, 29881, 29905, 29876, 29908, 1273, 1583, 29889, 5014, 29918, 3177, 13578, 29905, 29876, 1159, 13, 1678, 274, 16434, 29918, 1445, 29889, 3539, 703, 29899, 20624, 326, 2133, 8667, 29901, 15691, 1311, 29889, 3670, 29918, 5182, 13578, 29905, 29876, 1159, 13, 1678, 274, 16434, 29918, 1445, 29889, 3539, 703, 29899, 14463, 6110, 313, 2966, 1125, 1273, 29881, 29905, 29876, 29908, 1273, 1583, 29889, 1742, 29918, 2103, 13578, 29905, 29876, 1159, 13, 1678, 274, 16434, 29918, 1445, 29889, 3539, 703, 29899, 12415, 5946, 313, 9486, 1125, 1273, 29881, 29905, 29876, 29908, 1273, 1583, 29889, 5030, 5946, 13578, 29905, 29876, 1159, 29871, 13, 1678, 565, 1583, 29889, 3729, 29918, 1853, 29889, 828, 29883, 1405, 29871, 29896, 29901, 13, 418, 3038, 29918, 5563, 29879, 353, 29871, 29906, 1068, 29898, 1311, 29889, 3729, 29918, 1853, 29889, 828, 29883, 29897, 13, 418, 274, 16434, 29918, 1445, 29889, 3539, 703, 29899, 4617, 10108, 29879, 29901, 1273, 29881, 29905, 29876, 29908, 1273, 3038, 29918, 5563, 29879, 13578, 29905, 29876, 1159, 13, 1678, 274, 16434, 29918, 1445, 29889, 5358, 580, 13, 13, 1990, 405, 29963, 8942, 6466, 3991, 29901, 396, 11228, 1891, 304, 29871, 29896, 29953, 22882, 317, 25058, 29892, 29871, 29946, 9486, 13, 29871, 822, 4770, 2344, 12035, 1311, 29892, 13, 12, 12, 4548, 29918, 978, 543, 4381, 613, 396, 978, 470, 3553, 13, 12, 12, 29937, 2267, 475, 8018, 405, 29963, 8942, 2295, 29879, 13, 12, 12, 2080, 29918, 16859, 353, 405, 29963, 8942, 4290, 3991, 3285, 13, 12, 12, 29937, 15189, 4529, 599, 8018, 14391, 13, 12, 12, 949, 29918, 29880, 2579, 1270, 10457, 29896, 29892, 396, 1983, 13, 12, 12, 949, 29918, 29890, 29893, 10457, 29896, 29892, 396, 7210, 29914, 29879, 13, 12, 12, 949, 29918, 27548, 10457, 29896, 29892, 396, 29886, 29967, 29914, 5943, 13, 12, 12, 3539, 29918, 29880, 2579, 1270, 10457, 29896, 29892, 396, 1983, 13, 12, 12, 3539, 29918, 29890, 29893, 10457, 29896, 29892, 396, 7210, 29914, 29879, 13, 12, 12, 3539, 29918, 27548, 10457, 29896, 29892, 396, 29876, 29967, 29914, 5943, 13, 12, 12, 280, 557, 482, 29918, 13519, 10457, 29896, 29892, 396, 29885, 29956, 13, 12, 12, 6203, 10457, 29896, 29892, 396, 4317, 29985, 29906, 13, 12, 12, 6203, 29918, 29872, 2416, 13396, 10457, 29896, 396, 25376, 482, 13, 12, 12, 1125, 13, 1678, 396, 4529, 599, 4128, 13, 1678, 1583, 29889, 4548, 29918, 978, 353, 1518, 29918, 978, 13, 1678, 1583, 29889, 2080, 29918, 16859, 353, 1881, 29918, 16859, 13, 1678, 1583, 29889, 949, 29918, 29880, 2579, 1270, 353, 1303, 29918, 29880, 2579, 1270, 13, 1678, 1583, 29889, 949, 29918, 29890, 29893, 353, 1303, 29918, 29890, 29893, 13, 1678, 1583, 29889, 949, 29918, 27548, 353, 1303, 29918, 27548, 13, 1678, 1583, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2436, 29918, 29880, 2579, 1270, 13, 1678, 1583, 29889, 3539, 29918, 29890, 29893, 353, 2436, 29918, 29890, 29893, 13, 1678, 1583, 29889, 3539, 29918, 27548, 353, 2436, 29918, 27548, 13, 1678, 1583, 29889, 280, 557, 482, 29918, 13519, 353, 24993, 482, 29918, 13519, 13, 1678, 1583, 29889, 6203, 353, 4038, 13, 1678, 1583, 29889, 6203, 29918, 29872, 2416, 13396, 353, 4038, 29918, 29872, 2416, 13396, 13, 13, 29871, 822, 1596, 29918, 7727, 29898, 1311, 1125, 13, 1678, 9995, 1588, 9466, 263, 15837, 310, 278, 21213, 405, 29963, 8942, 1962, 2582, 13, 1678, 9995, 13, 1678, 1596, 703, 1252, 15362, 4408, 29901, 15691, 1311, 29889, 4548, 29918, 978, 29897, 13, 1678, 1596, 703, 6359, 365, 2579, 1270, 313, 1983, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 949, 29918, 29880, 2579, 1270, 29897, 13, 1678, 1596, 703, 6359, 350, 29956, 313, 7210, 29914, 29879, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 949, 29918, 29890, 29893, 29897, 13, 1678, 1596, 703, 6113, 365, 2579, 1270, 313, 1983, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 3539, 29918, 29880, 2579, 1270, 29897, 13, 1678, 1596, 703, 6113, 350, 29956, 313, 7210, 29914, 29879, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 3539, 29918, 29890, 29893, 29897, 13, 1678, 1596, 703, 6359, 24836, 313, 29886, 29967, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 949, 29918, 27548, 29897, 13, 1678, 1596, 703, 6113, 24836, 313, 29886, 29967, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 3539, 29918, 27548, 29897, 13, 1678, 1596, 703, 3226, 557, 482, 9206, 313, 29885, 29956, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 280, 557, 482, 29918, 13519, 29897, 13, 1678, 1596, 703, 13799, 313, 4317, 29985, 29906, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 6203, 29897, 13, 1678, 1596, 703, 13799, 382, 2416, 13396, 313, 25376, 1125, 1273, 29888, 29908, 1273, 1583, 29889, 6203, 29918, 29872, 2416, 13396, 29897, 13, 13, 1753, 6088, 29918, 29876, 29894, 3601, 29918, 4905, 29898, 1445, 2084, 2433, 4905, 29918, 19057, 29914, 29879, 2572, 29918, 29900, 742, 1881, 29918, 16859, 29922, 29940, 29963, 8942, 4290, 3991, 580, 1125, 13, 29871, 9995, 16969, 263, 584, 1990, 18078, 29940, 29963, 8942, 6466, 3991, 29952, 1203, 607, 4947, 24146, 411, 278, 1962, 2582, 297, 13, 29871, 21213, 515, 934, 29918, 2084, 29889, 29871, 13, 13, 29871, 584, 3207, 934, 2084, 29901, 2224, 304, 405, 29963, 8942, 1962, 934, 13, 29871, 584, 1853, 934, 2084, 29901, 1714, 13, 29871, 584, 3207, 1881, 29918, 16859, 29901, 584, 1990, 18078, 29940, 29963, 8942, 2928, 649, 3991, 29952, 1203, 393, 471, 1304, 304, 1653, 278, 405, 29963, 8942, 1962, 29871, 13, 29871, 584, 1853, 1881, 29918, 16859, 29901, 584, 1990, 18078, 29940, 29963, 8942, 4290, 3991, 29952, 1203, 13, 29871, 584, 2457, 29901, 584, 1990, 18078, 29940, 29963, 8942, 6466, 3991, 29952, 1203, 6943, 21213, 405, 29963, 8942, 2582, 13, 29871, 584, 29878, 1853, 29901, 584, 1990, 18078, 29940, 29963, 8942, 6466, 3991, 29952, 13, 29871, 9995, 13, 29871, 396, 24926, 2967, 13, 29871, 2967, 353, 405, 29963, 8942, 6466, 3991, 29898, 2080, 29918, 16859, 29922, 2080, 29918, 16859, 29897, 13, 13, 29871, 411, 1722, 29898, 1445, 2084, 29892, 525, 29878, 1495, 408, 285, 29901, 13, 1678, 3454, 353, 285, 29889, 949, 9012, 580, 13, 13, 29871, 396, 3617, 8177, 310, 716, 3454, 13, 29871, 3454, 353, 2910, 29898, 2892, 921, 29901, 921, 29889, 29878, 17010, 3285, 3454, 29897, 13, 13, 29871, 363, 1196, 297, 3454, 29901, 13, 1678, 565, 525, 448, 14990, 18320, 353, 29915, 297, 1196, 322, 313, 3188, 29889, 6203, 1275, 448, 29896, 1125, 13, 418, 396, 14216, 23717, 2329, 29892, 14383, 304, 1095, 310, 1196, 13, 418, 565, 376, 543, 297, 1196, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 5387, 13, 4706, 1196, 353, 1196, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 17531, 13, 418, 2967, 29889, 6203, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29946, 2314, 13, 418, 565, 1196, 14352, 29946, 17531, 1275, 376, 398, 29985, 29906, 1115, 13, 4706, 2967, 29889, 6203, 353, 2967, 29889, 6203, 847, 313, 29896, 29900, 29900, 29900, 1846, 1068, 29906, 13, 1678, 25342, 525, 448, 29871, 7523, 365, 2579, 1270, 29915, 297, 1196, 322, 313, 3188, 29889, 949, 29918, 29880, 2579, 1270, 1275, 448, 29896, 1125, 13, 418, 2967, 29889, 949, 29918, 29880, 2579, 1270, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 375, 1115, 396, 7052, 304, 17534, 13, 4706, 2967, 29889, 949, 29918, 29880, 2579, 1270, 353, 2967, 29889, 949, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 567, 1115, 396, 7052, 304, 17534, 13, 4706, 2967, 29889, 949, 29918, 29880, 2579, 1270, 353, 2967, 29889, 949, 29918, 29880, 2579, 1270, 847, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 1516, 1115, 396, 7052, 304, 17534, 313, 29891, 29379, 14366, 13, 4706, 2967, 29889, 949, 29918, 29880, 2579, 1270, 353, 2967, 29889, 949, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29889, 13, 1678, 25342, 525, 448, 18320, 382, 2416, 13396, 353, 29915, 297, 1196, 29901, 13, 418, 2967, 29889, 6203, 29918, 29872, 2416, 13396, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29896, 2314, 13, 1678, 25342, 525, 448, 7523, 5158, 2103, 29915, 297, 1196, 29901, 13, 418, 2967, 29889, 949, 29918, 29890, 29893, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29946, 2314, 13, 418, 565, 1196, 14352, 29946, 17531, 1275, 376, 9486, 29914, 29879, 1115, 396, 7052, 304, 19289, 29914, 29879, 13, 4706, 2967, 29889, 949, 29918, 29890, 29893, 353, 2967, 29889, 949, 29918, 29890, 29893, 847, 29871, 29896, 29900, 29906, 29946, 29889, 13, 418, 565, 1196, 14352, 29946, 17531, 1275, 376, 26067, 29914, 29879, 1115, 396, 7052, 304, 19289, 29914, 29879, 13, 4706, 2967, 29889, 949, 29918, 29890, 29893, 353, 2967, 29889, 949, 29918, 29890, 29893, 847, 29871, 29896, 29900, 29906, 29946, 29889, 847, 29871, 29896, 29900, 29906, 29946, 29889, 13, 1678, 25342, 525, 448, 14350, 5158, 2103, 29915, 297, 1196, 29901, 13, 418, 2967, 29889, 3539, 29918, 29890, 29893, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29946, 2314, 13, 418, 565, 1196, 14352, 29946, 17531, 1275, 376, 9486, 29914, 29879, 1115, 396, 7052, 304, 19289, 29914, 29879, 13, 4706, 2967, 29889, 3539, 29918, 29890, 29893, 353, 2967, 29889, 3539, 29918, 29890, 29893, 847, 29871, 29896, 29900, 29906, 29946, 29889, 13, 418, 565, 1196, 14352, 29946, 17531, 1275, 376, 26067, 29914, 29879, 1115, 396, 7052, 304, 19289, 29914, 29879, 13, 4706, 2967, 29889, 3539, 29918, 29890, 29893, 353, 2967, 29889, 3539, 29918, 29890, 29893, 847, 29871, 29896, 29900, 29906, 29946, 29889, 847, 29871, 29896, 29900, 29906, 29946, 29889, 13, 1678, 25342, 525, 448, 29871, 7523, 27747, 24836, 525, 297, 1196, 29901, 13, 418, 2967, 29889, 949, 29918, 27548, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 29876, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 4706, 2967, 29889, 949, 29918, 27548, 353, 2967, 29889, 949, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 29884, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 4706, 2967, 29889, 949, 29918, 27548, 353, 2967, 29889, 949, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 1678, 25342, 525, 448, 951, 557, 482, 9206, 525, 297, 1196, 29901, 13, 418, 2967, 29889, 280, 557, 482, 29918, 13519, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 29884, 29956, 1115, 396, 7052, 304, 286, 29956, 13, 4706, 2967, 29889, 280, 557, 482, 29918, 13519, 353, 2967, 29889, 280, 557, 482, 29918, 13519, 847, 29871, 29896, 29900, 29900, 29900, 29889, 13, 1678, 25342, 525, 448, 14350, 365, 2579, 1270, 29915, 297, 1196, 322, 313, 3188, 29889, 3539, 29918, 29880, 2579, 1270, 1275, 448, 29896, 1125, 13, 418, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 375, 1115, 396, 7052, 304, 17534, 13, 4706, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 567, 1115, 396, 7052, 304, 17534, 13, 4706, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 847, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 1516, 1115, 396, 7052, 304, 17534, 313, 29891, 29379, 14366, 13, 4706, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29889, 13, 1678, 25342, 525, 448, 14350, 27747, 24836, 525, 297, 1196, 29901, 13, 418, 2967, 29889, 3539, 29918, 27548, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 29876, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 4706, 2967, 29889, 3539, 29918, 27548, 353, 2967, 29889, 3539, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 418, 565, 1196, 14352, 29906, 17531, 1275, 376, 29884, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 4706, 2967, 29889, 3539, 29918, 27548, 353, 2967, 29889, 3539, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 13, 13, 1678, 396, 25048, 2486, 6459, 738, 734, 305, 29899, 14940, 26855, 13, 1678, 565, 1881, 29918, 16859, 29889, 3729, 29918, 1853, 29889, 6954, 29918, 3729, 29918, 1853, 1275, 376, 29903, 25058, 1115, 13, 418, 6773, 13, 1678, 396, 25634, 2303, 731, 7186, 29889, 10092, 363, 390, 25058, 29892, 2304, 363, 916, 9101, 13, 1678, 1683, 29901, 13, 418, 565, 525, 448, 11368, 365, 2579, 1270, 29915, 297, 1196, 29901, 13, 4706, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 4706, 565, 1196, 14352, 29906, 17531, 1275, 376, 375, 1115, 396, 7052, 304, 17534, 13, 3986, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 565, 1196, 14352, 29906, 17531, 1275, 376, 567, 1115, 396, 7052, 304, 17534, 13, 3986, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 847, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 565, 1196, 14352, 29906, 17531, 1275, 376, 1516, 1115, 396, 7052, 304, 17534, 313, 29891, 29379, 14366, 13, 3986, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 353, 2967, 29889, 3539, 29918, 29880, 2579, 1270, 334, 29871, 29896, 29900, 29900, 29900, 29900, 29900, 29900, 29889, 13, 418, 25342, 525, 448, 11368, 27747, 24836, 525, 297, 1196, 29901, 13, 4706, 2967, 29889, 3539, 29918, 27548, 353, 5785, 29898, 1220, 29961, 1220, 29889, 2248, 703, 543, 7240, 29896, 29901, 3816, 13018, 29906, 2314, 13, 4706, 565, 1196, 14352, 29906, 17531, 1275, 376, 29876, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 3986, 2967, 29889, 3539, 29918, 27548, 353, 2967, 29889, 3539, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 4706, 565, 1196, 14352, 29906, 17531, 1275, 376, 29884, 29967, 1115, 396, 7052, 304, 282, 29967, 13, 3986, 2967, 29889, 3539, 29918, 27548, 353, 2967, 29889, 3539, 29918, 27548, 334, 29871, 29896, 29900, 29900, 29900, 29889, 334, 29871, 29896, 29900, 29900, 29900, 29889, 13, 308, 13, 29871, 736, 2967, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 29871, 396, 1688, 2626, 274, 16434, 5023, 322, 1962, 13755, 13, 29871, 1243, 29918, 2080, 29918, 16859, 353, 405, 29963, 8942, 4290, 3991, 580, 13, 29871, 1243, 29918, 2080, 29918, 16859, 29889, 3729, 29918, 1853, 29889, 17158, 29918, 3729, 29918, 1445, 580, 13, 29871, 1243, 29918, 2080, 29918, 16859, 29889, 3729, 29918, 1853, 29889, 4397, 29918, 3729, 29918, 1445, 580, 13, 259, 13, 29871, 1243, 29918, 2080, 29918, 16859, 29889, 17158, 29918, 6954, 29918, 16859, 580, 13, 13, 29871, 1596, 703, 16015, 2295, 12623, 1243, 4866, 23157, 13, 13, 13, 13, 2 ]
labdrivers/labdrivers/lakeshore/__init__.py
RMUlti/Alex
0
54807
<gh_stars>0 from .ls332 import Ls332
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 3166, 869, 3137, 29941, 29941, 29906, 1053, 365, 29879, 29941, 29941, 29906, 30004, 13, 2 ]
python/thread/writing_thread.py
y2ghost/study
0
190687
<gh_stars>0 import random import time from threading import Thread class WritingThread(Thread): def __init__(self, filename: str, number_of_lines: int, work_time: int = 1) -> None: Thread.__init__(self) self.filename = filename self.number_of_lines = number_of_lines self.work_time = work_time def run(self) -> None: """ Run the thread """ print(f'Writing {self.number_of_lines} lines of text to ' f'{self.filename}') with open(self.filename, 'w') as f: for line in range(self.number_of_lines): text = f'This is line {line+1}\n' f.write(text) time.sleep(self.work_time) print(f'Finished writing {self.filename}') if __name__ == '__main__': files = [f'test{x}.txt' for x in range(1, 6)] for filename in files: work_time = random.choice(range(1, 3)) number_of_lines = random.choice(range(5, 20)) thread = WritingThread(filename, number_of_lines, work_time) thread.start()
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 4036, 13, 5215, 931, 13, 3166, 3244, 292, 1053, 10480, 13, 13, 13, 1990, 28676, 4899, 29898, 4899, 1125, 13, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 10422, 29901, 851, 29892, 1353, 29918, 974, 29918, 9012, 29901, 938, 29892, 13, 462, 664, 29918, 2230, 29901, 938, 353, 29871, 29896, 29897, 1599, 6213, 29901, 13, 4706, 10480, 17255, 2344, 12035, 1311, 29897, 13, 4706, 1583, 29889, 9507, 353, 10422, 13, 4706, 1583, 29889, 4537, 29918, 974, 29918, 9012, 353, 1353, 29918, 974, 29918, 9012, 13, 4706, 1583, 29889, 1287, 29918, 2230, 353, 664, 29918, 2230, 13, 13, 1678, 822, 1065, 29898, 1311, 29897, 1599, 6213, 29901, 13, 4706, 9995, 13, 4706, 7525, 278, 3244, 13, 4706, 9995, 13, 4706, 1596, 29898, 29888, 29915, 29956, 768, 292, 426, 1311, 29889, 4537, 29918, 974, 29918, 9012, 29913, 3454, 310, 1426, 304, 525, 13, 795, 285, 29915, 29912, 1311, 29889, 9507, 29913, 1495, 13, 4706, 411, 1722, 29898, 1311, 29889, 9507, 29892, 525, 29893, 1495, 408, 285, 29901, 13, 9651, 363, 1196, 297, 3464, 29898, 1311, 29889, 4537, 29918, 974, 29918, 9012, 1125, 13, 18884, 1426, 353, 285, 29915, 4013, 338, 1196, 426, 1220, 29974, 29896, 1012, 29876, 29915, 13, 18884, 285, 29889, 3539, 29898, 726, 29897, 13, 18884, 931, 29889, 17059, 29898, 1311, 29889, 1287, 29918, 2230, 29897, 13, 4706, 1596, 29898, 29888, 29915, 12881, 3276, 5007, 426, 1311, 29889, 9507, 29913, 1495, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 2066, 353, 518, 29888, 29915, 1688, 29912, 29916, 1836, 3945, 29915, 363, 921, 297, 3464, 29898, 29896, 29892, 29871, 29953, 4638, 13, 1678, 363, 10422, 297, 2066, 29901, 13, 4706, 664, 29918, 2230, 353, 4036, 29889, 16957, 29898, 3881, 29898, 29896, 29892, 29871, 29941, 876, 13, 4706, 1353, 29918, 974, 29918, 9012, 353, 4036, 29889, 16957, 29898, 3881, 29898, 29945, 29892, 29871, 29906, 29900, 876, 13, 4706, 3244, 353, 28676, 4899, 29898, 9507, 29892, 1353, 29918, 974, 29918, 9012, 29892, 664, 29918, 2230, 29897, 13, 4706, 3244, 29889, 2962, 580, 13, 2 ]
src/hcb/artifacts/make_threshold_breakdown_plots.py
Strilanc/honeycomb-boundaries
0
164636
import pathlib import sys from typing import List, Tuple, Dict, Any import matplotlib.colors as mcolors import matplotlib.pyplot as plt from hcb.artifacts.make_lambda_plots import DesiredLineFit, project_intersection_of_both_observables from hcb.artifacts.make_threshold_plots import make_threshold_plots from hcb.tools.analysis.collecting import MultiStats OUT_DIR = pathlib.Path(__file__).parent.parent.parent.parent / "out" MARKERS = "ov*sp^<>8PhH+xXDd|" * 100 COLORS = list(mcolors.TABLEAU_COLORS) * 3 def main(): if len(sys.argv) == 1: raise ValueError("Specify csv files to include as command line arguments.") csvs = [] for path in sys.argv[1:]: p = pathlib.Path(path) if p.is_dir(): csvs.extend(p.glob("*.csv")) else: csvs.append(p) all_data = MultiStats.from_recorded_data(*csvs).filter(lambda e: 'PC3' not in e.circuit_style) gate_sets = { 'SD6': 'SD6', 'SI1000': 'SI1000', 'EM3': 'EM3_v3', } layouts = { ('planar honeycomb code\n(correlated MWPM decoding)', 'bounded_honeycomb_memory', 'internal_correlated', 'H'), ('planar honeycomb code\n(correlated MWPM decoding)', 'bounded_honeycomb_memory', 'internal_correlated', 'V'), ('planar honeycomb code\n(MWPM decoding)', 'bounded_honeycomb_memory', 'internal', 'H'), ('planar honeycomb code\n(MWPM decoding)', 'bounded_honeycomb_memory', 'internal', 'V'), } groups = { gate_set_caption: [ DesiredLineFit( legend_caption=layout_caption, marker=MARKERS[k], color=COLORS[k], observable=obs, filter_circuit_style=f"{gate_set_prefix}_{gate_set_suffix}", filter_decoder=decoder, ) for k, (layout_caption, gate_set_prefix, decoder, obs) in enumerate(layouts) ] for gate_set_caption, gate_set_suffix in gate_sets.items() } fig, _ = make_threshold_plots(data=all_data, groups=groups) fig.set_size_inches(18, 18) fig.savefig(OUT_DIR / "threshold_breakdown.png", bbox_inches='tight', dpi=200) plt.show() if __name__ == '__main__': main()
[ 1, 1053, 2224, 1982, 13, 5215, 10876, 13, 3166, 19229, 1053, 2391, 29892, 12603, 552, 29892, 360, 919, 29892, 3139, 13, 13, 5215, 22889, 29889, 27703, 408, 286, 27703, 13, 5215, 22889, 29889, 2272, 5317, 408, 14770, 13, 13, 3166, 298, 10702, 29889, 8813, 29879, 29889, 5675, 29918, 2892, 29918, 26762, 1053, 2726, 2859, 3542, 29943, 277, 29892, 2060, 29918, 1639, 2042, 29918, 974, 29918, 20313, 29918, 26739, 1849, 13, 3166, 298, 10702, 29889, 8813, 29879, 29889, 5675, 29918, 386, 12268, 29918, 26762, 1053, 1207, 29918, 386, 12268, 29918, 26762, 13, 3166, 298, 10702, 29889, 8504, 29889, 15916, 29889, 15914, 292, 1053, 14974, 25060, 13, 13, 12015, 29918, 9464, 353, 2224, 1982, 29889, 2605, 22168, 1445, 1649, 467, 3560, 29889, 3560, 29889, 3560, 29889, 3560, 847, 376, 449, 29908, 13, 13, 1529, 29934, 29968, 23598, 353, 376, 586, 29930, 1028, 29985, 25299, 29947, 4819, 29950, 29974, 29916, 29990, 29928, 29881, 29989, 29908, 334, 29871, 29896, 29900, 29900, 13, 15032, 24125, 353, 1051, 29898, 29885, 27703, 29889, 21009, 25951, 29918, 15032, 24125, 29897, 334, 29871, 29941, 13, 13, 13, 1753, 1667, 7295, 13, 1678, 565, 7431, 29898, 9675, 29889, 19218, 29897, 1275, 29871, 29896, 29901, 13, 4706, 12020, 7865, 2392, 703, 10299, 1598, 11799, 2066, 304, 3160, 408, 1899, 1196, 6273, 23157, 13, 13, 1678, 5939, 4270, 353, 5159, 13, 1678, 363, 2224, 297, 10876, 29889, 19218, 29961, 29896, 29901, 5387, 13, 4706, 282, 353, 2224, 1982, 29889, 2605, 29898, 2084, 29897, 13, 4706, 565, 282, 29889, 275, 29918, 3972, 7295, 13, 9651, 5939, 4270, 29889, 21843, 29898, 29886, 29889, 23705, 703, 10521, 7638, 5783, 13, 4706, 1683, 29901, 13, 9651, 5939, 4270, 29889, 4397, 29898, 29886, 29897, 13, 13, 1678, 599, 29918, 1272, 353, 14974, 25060, 29889, 3166, 29918, 11651, 287, 29918, 1272, 10456, 2395, 4270, 467, 4572, 29898, 2892, 321, 29901, 525, 9026, 29941, 29915, 451, 297, 321, 29889, 6034, 3121, 29918, 3293, 29897, 13, 13, 1678, 12417, 29918, 7224, 353, 426, 13, 4706, 525, 7230, 29953, 2396, 525, 7230, 29953, 742, 13, 4706, 525, 5425, 29896, 29900, 29900, 29900, 2396, 525, 5425, 29896, 29900, 29900, 29900, 742, 13, 4706, 525, 12665, 29941, 2396, 525, 12665, 29941, 29918, 29894, 29941, 742, 13, 1678, 500, 13, 1678, 5912, 29879, 353, 426, 13, 4706, 6702, 9018, 279, 298, 4992, 17743, 775, 29905, 29876, 29898, 2616, 12817, 341, 29956, 13427, 1602, 3689, 29897, 742, 525, 29306, 29918, 29882, 4992, 17743, 29918, 14834, 742, 525, 7564, 29918, 2616, 12817, 742, 525, 29950, 5477, 13, 4706, 6702, 9018, 279, 298, 4992, 17743, 775, 29905, 29876, 29898, 2616, 12817, 341, 29956, 13427, 1602, 3689, 29897, 742, 525, 29306, 29918, 29882, 4992, 17743, 29918, 14834, 742, 525, 7564, 29918, 2616, 12817, 742, 525, 29963, 5477, 13, 4706, 6702, 9018, 279, 298, 4992, 17743, 775, 29905, 29876, 29898, 25365, 13427, 1602, 3689, 29897, 742, 525, 29306, 29918, 29882, 4992, 17743, 29918, 14834, 742, 525, 7564, 742, 525, 29950, 5477, 13, 4706, 6702, 9018, 279, 298, 4992, 17743, 775, 29905, 29876, 29898, 25365, 13427, 1602, 3689, 29897, 742, 525, 29306, 29918, 29882, 4992, 17743, 29918, 14834, 742, 525, 7564, 742, 525, 29963, 5477, 13, 1678, 500, 13, 1678, 6471, 353, 426, 13, 4706, 12417, 29918, 842, 29918, 6671, 29901, 518, 13, 9651, 2726, 2859, 3542, 29943, 277, 29898, 13, 18884, 15983, 29918, 6671, 29922, 2680, 29918, 6671, 29892, 13, 18884, 17456, 29922, 1529, 29934, 29968, 23598, 29961, 29895, 1402, 13, 18884, 2927, 29922, 15032, 24125, 29961, 29895, 1402, 13, 18884, 25209, 29922, 26290, 29892, 13, 18884, 4175, 29918, 6034, 3121, 29918, 3293, 29922, 29888, 29908, 29912, 17062, 29918, 842, 29918, 13506, 3227, 17062, 29918, 842, 29918, 2146, 600, 861, 17671, 13, 18884, 4175, 29918, 7099, 6119, 29922, 7099, 6119, 29892, 13, 9651, 1723, 13, 9651, 363, 413, 29892, 313, 2680, 29918, 6671, 29892, 12417, 29918, 842, 29918, 13506, 29892, 1602, 6119, 29892, 20881, 29897, 297, 26985, 29898, 2680, 29879, 29897, 13, 4706, 4514, 13, 4706, 363, 12417, 29918, 842, 29918, 6671, 29892, 12417, 29918, 842, 29918, 2146, 600, 861, 297, 12417, 29918, 7224, 29889, 7076, 580, 13, 1678, 500, 13, 13, 1678, 2537, 29892, 903, 353, 1207, 29918, 386, 12268, 29918, 26762, 29898, 1272, 29922, 497, 29918, 1272, 29892, 6471, 29922, 13155, 29897, 13, 1678, 2537, 29889, 842, 29918, 2311, 29918, 262, 6609, 29898, 29896, 29947, 29892, 29871, 29896, 29947, 29897, 13, 1678, 2537, 29889, 7620, 1003, 29898, 12015, 29918, 9464, 847, 376, 386, 12268, 29918, 8690, 3204, 29889, 2732, 613, 289, 1884, 29918, 262, 6609, 2433, 29873, 523, 742, 270, 1631, 29922, 29906, 29900, 29900, 29897, 13, 13, 1678, 14770, 29889, 4294, 580, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 1667, 580, 13, 2 ]
examples/test_feasibility.py
OllieBoyne/sslap
7
24581
"""Check the feasibility of a bipartite graph by using SSLAP's feasibility module""" import numpy as np from sslap import hopcroft_solve # All 3 methods will use the same input bipartite graph: # i = 0 connects to j = 0, 1 # i = 1 connects to j = 1, 2 # i = 2 connects to j = 1, 4 # i = 3 connects to j = 2 # i = 4 connects to j = 3 # which has a maximum matching of 5 # eg i:j of 0:0, 1:1, 2:4, 3:2, 4:3 def dict_usage(): lookup = {0: [0, 1], 1: [1, 2], 2: [1, 4], 3: [2], 4: [3]} res = hopcroft_solve(lookup=lookup) print(res) def mat_usage(): mat = - np.ones((5, 5)) # all invalid, except mat[[0, 0, 1, 1, 2, 2, 3, 4], [0, 1, 1, 2, 1, 4, 2, 3]] = 1 # for valid edges res = hopcroft_solve(mat=mat) print(res) def loc_usage(): loc = np.array([[0, 0], [0, 1], [1, 1], [1, 2], [2, 1], [2, 4], [3, 2], [4, 3]]) # (i, j) for each edge res = hopcroft_solve(loc=loc) print(res) if __name__ == "__main__": dict_usage() mat_usage() loc_usage()
[ 1, 9995, 5596, 278, 28326, 4127, 310, 263, 289, 27494, 568, 3983, 491, 773, 17122, 3301, 29915, 29879, 28326, 4127, 3883, 15945, 29908, 13, 5215, 12655, 408, 7442, 13, 3166, 17971, 6984, 1053, 8171, 24077, 615, 29918, 2929, 345, 13, 13, 13, 29937, 2178, 29871, 29941, 3519, 674, 671, 278, 1021, 1881, 289, 27494, 568, 3983, 29901, 13, 29937, 474, 353, 29871, 29900, 4511, 29879, 304, 432, 353, 29871, 29900, 29892, 29871, 29896, 13, 29937, 474, 353, 29871, 29896, 4511, 29879, 304, 432, 353, 29871, 29896, 29892, 29871, 29906, 13, 29937, 474, 353, 29871, 29906, 4511, 29879, 304, 432, 353, 29871, 29896, 29892, 29871, 29946, 13, 29937, 474, 353, 29871, 29941, 4511, 29879, 304, 432, 353, 29871, 29906, 13, 29937, 474, 353, 29871, 29946, 4511, 29879, 304, 432, 353, 29871, 29941, 13, 29937, 607, 756, 263, 7472, 9686, 310, 29871, 29945, 13, 29937, 8087, 474, 29901, 29926, 310, 29871, 29900, 29901, 29900, 29892, 29871, 29896, 29901, 29896, 29892, 29871, 29906, 29901, 29946, 29892, 29871, 29941, 29901, 29906, 29892, 29871, 29946, 29901, 29941, 13, 13, 13, 1753, 9657, 29918, 21125, 7295, 13, 12, 20401, 353, 426, 29900, 29901, 518, 29900, 29892, 29871, 29896, 1402, 29871, 29896, 29901, 518, 29896, 29892, 29871, 29906, 1402, 29871, 29906, 29901, 518, 29896, 29892, 29871, 29946, 1402, 29871, 29941, 29901, 518, 29906, 1402, 29871, 29946, 29901, 518, 29941, 12258, 13, 12, 690, 353, 8171, 24077, 615, 29918, 2929, 345, 29898, 20401, 29922, 20401, 29897, 13, 12, 2158, 29898, 690, 29897, 13, 13, 13, 1753, 1775, 29918, 21125, 7295, 13, 12, 2922, 353, 448, 7442, 29889, 2873, 3552, 29945, 29892, 29871, 29945, 876, 29871, 396, 599, 8340, 29892, 5174, 13, 12, 2922, 8999, 29900, 29892, 29871, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29906, 29892, 29871, 29941, 29892, 29871, 29946, 1402, 518, 29900, 29892, 29871, 29896, 29892, 29871, 29896, 29892, 29871, 29906, 29892, 29871, 29896, 29892, 29871, 29946, 29892, 29871, 29906, 29892, 29871, 29941, 5262, 353, 29871, 29896, 29871, 396, 363, 2854, 12770, 13, 12, 690, 353, 8171, 24077, 615, 29918, 2929, 345, 29898, 2922, 29922, 2922, 29897, 13, 12, 2158, 29898, 690, 29897, 13, 13, 13, 1753, 1180, 29918, 21125, 7295, 13, 12, 2029, 353, 7442, 29889, 2378, 4197, 29961, 29900, 29892, 29871, 29900, 1402, 518, 29900, 29892, 29871, 29896, 1402, 518, 29896, 29892, 29871, 29896, 1402, 518, 29896, 29892, 29871, 29906, 1402, 518, 29906, 29892, 29871, 29896, 1402, 518, 29906, 29892, 29871, 29946, 1402, 518, 29941, 29892, 29871, 29906, 1402, 518, 29946, 29892, 29871, 29941, 24960, 29871, 396, 313, 29875, 29892, 432, 29897, 363, 1269, 7636, 13, 12, 690, 353, 8171, 24077, 615, 29918, 2929, 345, 29898, 2029, 29922, 2029, 29897, 13, 12, 2158, 29898, 690, 29897, 13, 13, 13, 361, 4770, 978, 1649, 1275, 376, 1649, 3396, 1649, 1115, 13, 12, 8977, 29918, 21125, 580, 13, 12, 2922, 29918, 21125, 580, 13, 12, 2029, 29918, 21125, 580, 13, 2 ]
demo/part_1.py
eric6239/HeartsEnv
6
101256
<reponame>eric6239/HeartsEnv from gym import spaces table_space = spaces.Tuple([ spaces.Discrete(13), # n_round spaces.Discrete(4), # start_pos spaces.Discrete(4), # cur_pos spaces.Discrete(1), # exchanged spaces.Discrete(1), # heart_occured spaces.Discrete(100), # n_games spaces.Tuple([ # board spaces.MultiDiscrete([13, 4]) ] * 4), spaces.Tuple([ # first_draw spaces.MultiDiscrete([13, 4]) ]), spaces.Tuple([ # bank spaces.Tuple([ spaces.MultiDiscrete([13, 4]) ] * 3), ] * 4) ]) player_space = spaces.Tuple([ spaces.Discrete(200), # score spaces.Tuple([ # hand spaces.MultiDiscrete([13, 4]) ] * 13), spaces.Tuple([ # income spaces.MultiDiscrete([13, 4]) ] * 52), ] * 4) p_space = spaces.Tuple([ spaces.Discrete(200), # score spaces.Tuple([ # hand spaces.MultiDiscrete([13, 4]) ] * 13), spaces.Tuple([ # income spaces.MultiDiscrete([13, 4]) ] * 52), ])
[ 1, 529, 276, 1112, 420, 29958, 261, 293, 29953, 29906, 29941, 29929, 29914, 3868, 5708, 21745, 13, 3166, 330, 962, 1053, 8162, 13, 2371, 29918, 3493, 353, 8162, 29889, 23215, 552, 4197, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29896, 29941, 511, 396, 302, 29918, 14486, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29946, 511, 396, 1369, 29918, 1066, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29946, 511, 396, 3151, 29918, 1066, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29896, 511, 396, 429, 15033, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29896, 511, 396, 5192, 29918, 15693, 2955, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29896, 29900, 29900, 511, 396, 302, 29918, 29887, 1280, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 7613, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 334, 29871, 29946, 511, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 937, 29918, 4012, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 511, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 9124, 13, 4706, 8162, 29889, 23215, 552, 4197, 13, 9651, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 4706, 4514, 334, 29871, 29941, 511, 13, 1678, 4514, 334, 29871, 29946, 29897, 13, 2314, 13, 13, 9106, 29918, 3493, 353, 8162, 29889, 23215, 552, 4197, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29906, 29900, 29900, 511, 396, 8158, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 1361, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 334, 29871, 29896, 29941, 511, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 17869, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 334, 29871, 29945, 29906, 511, 13, 29962, 334, 29871, 29946, 29897, 13, 13, 29886, 29918, 3493, 353, 8162, 29889, 23215, 552, 4197, 13, 1678, 8162, 29889, 4205, 9084, 29898, 29906, 29900, 29900, 511, 396, 8158, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 1361, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 334, 29871, 29896, 29941, 511, 13, 1678, 8162, 29889, 23215, 552, 4197, 396, 17869, 13, 4706, 8162, 29889, 15329, 4205, 9084, 4197, 29896, 29941, 29892, 29871, 29946, 2314, 13, 1678, 4514, 334, 29871, 29945, 29906, 511, 13, 2314, 13, 13, 2 ]
Quiron/users/admin.py
CesarNav/Quiron
0
91209
# Django from django.contrib import admin # Import our models to the admin from users.models import Profile # Register the model profile in the admin @admin.register(Profile) class ProfileAdmin(admin.ModelAdmin): list_display = ['pk', 'user','prof_register','picture'] list_display_links = ('pk', 'prof_register',) list_editable = ('picture',) search_fields = ('user__first_name', 'user__last_name', )
[ 1, 396, 15337, 13, 3166, 9557, 29889, 21570, 1053, 4113, 13, 13, 29937, 16032, 1749, 4733, 304, 278, 4113, 13, 3166, 4160, 29889, 9794, 1053, 20802, 13, 13, 29937, 12577, 278, 1904, 8722, 297, 278, 4113, 13, 13, 29992, 6406, 29889, 9573, 29898, 13909, 29897, 13, 1990, 20802, 12754, 29898, 6406, 29889, 3195, 12754, 1125, 13, 1678, 1051, 29918, 4990, 353, 6024, 20571, 742, 525, 1792, 3788, 23221, 29918, 9573, 3788, 12095, 2033, 13, 1678, 1051, 29918, 4990, 29918, 4965, 353, 6702, 20571, 742, 525, 23221, 29918, 9573, 742, 29897, 13, 1678, 1051, 29918, 5628, 519, 353, 6702, 12095, 742, 29897, 13, 1678, 2740, 29918, 9621, 353, 6702, 1792, 1649, 4102, 29918, 978, 742, 525, 1792, 1649, 4230, 29918, 978, 742, 1723, 13, 13, 2 ]
jccli/jc_api_v1.py
zaro0508/jccli
0
57510
# -*- coding: utf-8 -*- """ .. currentmodule:: jccli.jc_api_v1.py .. moduleauthor:: zaro0508 <<EMAIL>> This is a utility library for the jumpcloud version 1 api .. note:: To learn more about the jumpcloud api 1 `project website <https://github.com/TheJumpCloud/jcapi-python/tree/master/jcapiv1>`_. """ from distutils.util import strtobool import jcapiv1 from jcapiv1 import Systemuserput from jcapiv1.rest import ApiException from jccli.errors import SystemUserNotFoundError from jccli.helpers import class_to_dict # pylint: disable=too-many-arguments class JumpcloudApiV1: """ Wrapper for Jumpcloud API v1 """ def __init__(self, api_key): configuration = jcapiv1.Configuration() configuration.api_key['x-api-key'] = api_key self.system_users_api = jcapiv1.SystemusersApi(jcapiv1.ApiClient(configuration)) self.search_api = jcapiv1.SearchApi(jcapiv1.ApiClient(configuration)) def retrieve_users(self, user_ids=[]): """ Retrieve a list of users corresponding to ids """ # FIXME: This is not an ideal way to do this, but search_systemusers_post doesn't seem to allow filtering on ID all_users = self.get_users() return [user for user in all_users if user['id'] in user_ids] def search_users(self, filter={}): """ Search for users on jumpcloud. :param filter: (dict) an object used to filter search results for various fields. E.g.: `{"firstname": "David"}` :return: """ query_filter = {'and': []} for field, value in filter.items(): query_filter['and'].append({field: value}) if not filter: query_filter = None try: api_response = self.search_api.search_systemusers_post( content_type='application/json', accept='application/json', body={ 'filter': query_filter } ) users = [user.to_dict() for user in api_response.results] return users except ApiException as error: raise "Exception when calling SystemusersApi->systemusers_list: %s\n" % error def get_users(self, limit='100', skip=0, search='', filter='', sort='', fields=''): """ Get users from jumpcloud :param limit: :param skip: :param search: :param filter: :param sort: :param fields: :return: a list of users with dict of settings """ try: api_response = self.system_users_api.systemusers_list(content_type='application/json', accept='application/json', limit=limit, skip=skip, sort=sort, fields=fields, x_org_id='', search=search, filter=filter) users = [user.to_dict() for user in class_to_dict(api_response.results)] return users except ApiException as error: raise "Exception when calling SystemusersApi->systemusers_list: %s\n" % error def create_user(self, systemuser): """ Create a new user in jumpcloud :param systemuser: a dictoionary of Systemuser properties https://github.com/TheJumpCloud/jcapi-java/blob/master/jcapiv1/docs/Systemuser.md :return: The api response """ body = jcapiv1.Systemuserputpost(username=systemuser['username'], email=systemuser['email'], firstname=systemuser.get('firstname', ''), lastname=systemuser.get('lastname', ''), allow_public_key=strtobool( systemuser.get('allow_public_key', 'True')), ldap_binding_user=strtobool( systemuser.get('ldap_binding_user', 'False')), passwordless_sudo=strtobool( systemuser.get('passwordless_sudo', 'False')), sudo=strtobool(systemuser.get('sudo', 'False'))) try: api_response = self.system_users_api.systemusers_post(content_type='application/json', accept='application/json', body=body, x_org_id='') return api_response.to_dict() except ApiException as error: # FIXME: What should this behavior actually be? raise Exception("Exception when calling SystemusersApi->systemusers_post: %s\n" % error) def delete_user(self, username): """ Delete a user from jumpcloud :param id: The jumpcloud id of the user :return: """ user_id = self.get_user_id(username) if user_id is None: raise SystemUserNotFoundError(f"System user {username} not found") try: api_response = self.system_users_api.systemusers_delete(user_id, content_type='application/json', accept='application/json', x_org_id='') return api_response except ApiException as error: raise "Exception when calling SystemusersApi->systemusers_post: %s\n" % error def get_user_id(self, username): """ Get the jumpcloud user id from the user name :param username :return: the user id """ users = self.get_users(limit='', fields="username") for user in users: if user['username'] == username: return user['id'] raise SystemUserNotFoundError('No user found for username: %s' % (username,)) def get_user(self, username): """ Get detail view of a user object. :param user_id: :return: user properties dict """ # FIXME: As soon as we figure out how the `filter` parameter works on systemusers_list(), we should start # filtering based on username users = self.system_users_api.systemusers_list( accept='application/json', content_type='application/json' ).results for user in users: if user.username == username: return user.to_dict() raise SystemUserNotFoundError('No user found for username: %s' % (username,)) def set_user(self, username, attributes): user_id = self.get_user_id(username) api_response = self.system_users_api.systemusers_put( accept='application/json', content_type='application/json', id=user_id, body=Systemuserput(**attributes) ) return api_response.to_dict()
[ 1, 396, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 13, 13, 15945, 29908, 13, 636, 1857, 5453, 1057, 432, 617, 492, 29889, 29926, 29883, 29918, 2754, 29918, 29894, 29896, 29889, 2272, 13, 636, 3883, 8921, 1057, 503, 8854, 29900, 29945, 29900, 29947, 3532, 26862, 6227, 6778, 13, 13, 4013, 338, 263, 19725, 3489, 363, 278, 12500, 9274, 1873, 29871, 29896, 7882, 13, 13, 636, 4443, 1057, 13, 13, 1678, 1763, 5110, 901, 1048, 278, 12500, 9274, 7882, 29871, 29896, 13, 1678, 421, 4836, 4700, 529, 991, 597, 3292, 29889, 510, 29914, 1576, 29967, 3427, 20442, 29914, 29926, 29883, 2754, 29899, 4691, 29914, 8336, 29914, 6207, 29914, 29926, 5030, 440, 29896, 13885, 5396, 13, 15945, 29908, 13, 3166, 1320, 13239, 29889, 4422, 1053, 851, 517, 11227, 13, 13, 5215, 432, 5030, 440, 29896, 13, 3166, 432, 5030, 440, 29896, 1053, 2184, 1792, 649, 13, 3166, 432, 5030, 440, 29896, 29889, 5060, 1053, 29749, 2451, 13, 3166, 432, 617, 492, 29889, 12523, 1053, 2184, 2659, 17413, 2392, 13, 13, 3166, 432, 617, 492, 29889, 3952, 6774, 1053, 770, 29918, 517, 29918, 8977, 13, 13, 29937, 282, 2904, 524, 29901, 11262, 29922, 517, 29877, 29899, 13011, 29899, 25699, 13, 1990, 435, 3427, 9274, 11713, 29963, 29896, 29901, 13, 1678, 9995, 13, 4706, 399, 6794, 363, 435, 3427, 9274, 3450, 325, 29896, 13, 1678, 9995, 13, 1678, 822, 4770, 2344, 12035, 1311, 29892, 7882, 29918, 1989, 1125, 13, 4706, 5285, 353, 432, 5030, 440, 29896, 29889, 8614, 580, 13, 4706, 5285, 29889, 2754, 29918, 1989, 1839, 29916, 29899, 2754, 29899, 1989, 2033, 353, 7882, 29918, 1989, 13, 4706, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 353, 432, 5030, 440, 29896, 29889, 3924, 7193, 11713, 29898, 29926, 5030, 440, 29896, 29889, 11713, 4032, 29898, 13305, 876, 13, 4706, 1583, 29889, 4478, 29918, 2754, 353, 432, 5030, 440, 29896, 29889, 7974, 11713, 29898, 29926, 5030, 440, 29896, 29889, 11713, 4032, 29898, 13305, 876, 13, 13, 1678, 822, 10563, 29918, 7193, 29898, 1311, 29892, 1404, 29918, 4841, 29922, 2636, 1125, 13, 4706, 9995, 13, 4706, 4649, 29878, 2418, 263, 1051, 310, 4160, 6590, 304, 18999, 13, 4706, 9995, 13, 4706, 396, 383, 6415, 2303, 29901, 910, 338, 451, 385, 10839, 982, 304, 437, 445, 29892, 541, 2740, 29918, 5205, 7193, 29918, 2490, 1838, 29915, 29873, 2833, 304, 2758, 21166, 373, 3553, 13, 4706, 599, 29918, 7193, 353, 1583, 29889, 657, 29918, 7193, 580, 13, 4706, 736, 518, 1792, 363, 1404, 297, 599, 29918, 7193, 565, 1404, 1839, 333, 2033, 297, 1404, 29918, 4841, 29962, 13, 13, 1678, 822, 2740, 29918, 7193, 29898, 1311, 29892, 4175, 3790, 29913, 1125, 13, 4706, 9995, 13, 4706, 11856, 363, 4160, 373, 12500, 9274, 29889, 13, 13, 4706, 584, 3207, 4175, 29901, 313, 8977, 29897, 385, 1203, 1304, 304, 4175, 2740, 2582, 363, 5164, 4235, 29889, 382, 29889, 29887, 4898, 421, 6377, 4102, 978, 1115, 376, 19504, 9092, 29952, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 2346, 29918, 4572, 353, 11117, 392, 2396, 5159, 29913, 13, 4706, 363, 1746, 29892, 995, 297, 4175, 29889, 7076, 7295, 13, 9651, 2346, 29918, 4572, 1839, 392, 13359, 4397, 3319, 2671, 29901, 995, 1800, 13, 4706, 565, 451, 4175, 29901, 13, 9651, 2346, 29918, 4572, 353, 6213, 13, 13, 4706, 1018, 29901, 13, 9651, 7882, 29918, 5327, 353, 1583, 29889, 4478, 29918, 2754, 29889, 4478, 29918, 5205, 7193, 29918, 2490, 29898, 13, 18884, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 18884, 3544, 2433, 6214, 29914, 3126, 742, 13, 18884, 3573, 3790, 13, 462, 1678, 525, 4572, 2396, 2346, 29918, 4572, 13, 18884, 500, 13, 9651, 1723, 13, 9651, 4160, 353, 518, 1792, 29889, 517, 29918, 8977, 580, 363, 1404, 297, 7882, 29918, 5327, 29889, 9902, 29962, 13, 9651, 736, 4160, 13, 4706, 5174, 29749, 2451, 408, 1059, 29901, 13, 9651, 12020, 376, 2451, 746, 5432, 2184, 7193, 11713, 976, 5205, 7193, 29918, 1761, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 1059, 13, 13, 1678, 822, 679, 29918, 7193, 29898, 1311, 29892, 4046, 2433, 29896, 29900, 29900, 742, 14383, 29922, 29900, 29892, 2740, 2433, 742, 4175, 2433, 742, 2656, 2433, 742, 4235, 2433, 29374, 13, 4706, 9995, 13, 4706, 3617, 4160, 515, 12500, 9274, 13, 4706, 584, 3207, 4046, 29901, 13, 4706, 584, 3207, 14383, 29901, 13, 4706, 584, 3207, 2740, 29901, 13, 4706, 584, 3207, 4175, 29901, 13, 4706, 584, 3207, 2656, 29901, 13, 4706, 584, 3207, 4235, 29901, 13, 4706, 584, 2457, 29901, 263, 1051, 310, 4160, 411, 9657, 310, 6055, 13, 4706, 9995, 13, 4706, 1018, 29901, 13, 9651, 7882, 29918, 5327, 353, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 29889, 5205, 7193, 29918, 1761, 29898, 3051, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 29871, 3544, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 29871, 4046, 29922, 13400, 29892, 13, 462, 462, 462, 462, 29871, 14383, 29922, 11014, 29892, 13, 462, 462, 462, 462, 29871, 2656, 29922, 6605, 29892, 13, 462, 462, 462, 462, 29871, 4235, 29922, 9621, 29892, 13, 462, 462, 462, 462, 29871, 921, 29918, 990, 29918, 333, 2433, 742, 13, 462, 462, 462, 462, 29871, 2740, 29922, 4478, 29892, 13, 462, 462, 462, 462, 29871, 4175, 29922, 4572, 29897, 13, 9651, 4160, 353, 518, 1792, 29889, 517, 29918, 8977, 580, 363, 1404, 297, 770, 29918, 517, 29918, 8977, 29898, 2754, 29918, 5327, 29889, 9902, 4638, 13, 9651, 736, 4160, 13, 4706, 5174, 29749, 2451, 408, 1059, 29901, 13, 9651, 12020, 376, 2451, 746, 5432, 2184, 7193, 11713, 976, 5205, 7193, 29918, 1761, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 1059, 13, 13, 1678, 822, 1653, 29918, 1792, 29898, 1311, 29892, 1788, 1792, 1125, 13, 4706, 9995, 13, 4706, 6204, 263, 716, 1404, 297, 12500, 9274, 13, 4706, 584, 3207, 1788, 1792, 29901, 263, 12124, 517, 291, 653, 310, 2184, 1792, 4426, 13, 1669, 2045, 597, 3292, 29889, 510, 29914, 1576, 29967, 3427, 20442, 29914, 29926, 29883, 2754, 29899, 1645, 29914, 10054, 29914, 6207, 29914, 29926, 5030, 440, 29896, 29914, 2640, 29914, 3924, 1792, 29889, 3487, 13, 4706, 584, 2457, 29901, 450, 7882, 2933, 13, 4706, 9995, 13, 4706, 3573, 353, 432, 5030, 440, 29896, 29889, 3924, 1792, 649, 2490, 29898, 6786, 29922, 5205, 1792, 1839, 6786, 7464, 13, 462, 462, 308, 4876, 29922, 5205, 1792, 1839, 5269, 7464, 13, 462, 462, 308, 937, 978, 29922, 5205, 1792, 29889, 657, 877, 4102, 978, 742, 525, 5477, 13, 462, 462, 308, 1833, 978, 29922, 5205, 1792, 29889, 657, 877, 4230, 978, 742, 525, 5477, 13, 462, 462, 308, 2758, 29918, 3597, 29918, 1989, 29922, 710, 517, 11227, 29898, 13, 462, 462, 632, 1788, 1792, 29889, 657, 877, 9536, 29918, 3597, 29918, 1989, 742, 525, 5574, 1495, 511, 13, 462, 462, 308, 301, 29881, 481, 29918, 19672, 29918, 1792, 29922, 710, 517, 11227, 29898, 13, 462, 462, 632, 1788, 1792, 29889, 657, 877, 430, 481, 29918, 19672, 29918, 1792, 742, 525, 8824, 1495, 511, 13, 462, 462, 308, 4800, 2222, 29918, 15360, 29922, 710, 517, 11227, 29898, 13, 462, 462, 632, 1788, 1792, 29889, 657, 877, 5630, 2222, 29918, 15360, 742, 525, 8824, 1495, 511, 13, 462, 462, 308, 9196, 29922, 710, 517, 11227, 29898, 5205, 1792, 29889, 657, 877, 15360, 742, 525, 8824, 29915, 4961, 13, 4706, 1018, 29901, 13, 9651, 7882, 29918, 5327, 353, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 29889, 5205, 7193, 29918, 2490, 29898, 3051, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 29871, 3544, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 29871, 3573, 29922, 2587, 29892, 13, 462, 462, 462, 462, 29871, 921, 29918, 990, 29918, 333, 2433, 1495, 13, 9651, 736, 7882, 29918, 5327, 29889, 517, 29918, 8977, 580, 13, 4706, 5174, 29749, 2451, 408, 1059, 29901, 13, 9651, 396, 383, 6415, 2303, 29901, 1724, 881, 445, 6030, 2869, 367, 29973, 13, 9651, 12020, 8960, 703, 2451, 746, 5432, 2184, 7193, 11713, 976, 5205, 7193, 29918, 2490, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 1059, 29897, 13, 13, 1678, 822, 5217, 29918, 1792, 29898, 1311, 29892, 8952, 1125, 13, 4706, 9995, 13, 4706, 21267, 263, 1404, 515, 12500, 9274, 13, 4706, 584, 3207, 1178, 29901, 450, 12500, 9274, 1178, 310, 278, 1404, 13, 4706, 584, 2457, 29901, 13, 4706, 9995, 13, 4706, 1404, 29918, 333, 353, 1583, 29889, 657, 29918, 1792, 29918, 333, 29898, 6786, 29897, 13, 4706, 565, 1404, 29918, 333, 338, 6213, 29901, 13, 9651, 12020, 2184, 2659, 17413, 2392, 29898, 29888, 29908, 3924, 1404, 426, 6786, 29913, 451, 1476, 1159, 13, 13, 4706, 1018, 29901, 13, 9651, 7882, 29918, 5327, 353, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 29889, 5205, 7193, 29918, 8143, 29898, 1792, 29918, 333, 29892, 13, 462, 462, 462, 462, 1678, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 1678, 3544, 2433, 6214, 29914, 3126, 742, 13, 462, 462, 462, 462, 1678, 921, 29918, 990, 29918, 333, 2433, 1495, 13, 9651, 736, 7882, 29918, 5327, 13, 4706, 5174, 29749, 2451, 408, 1059, 29901, 13, 9651, 12020, 376, 2451, 746, 5432, 2184, 7193, 11713, 976, 5205, 7193, 29918, 2490, 29901, 1273, 29879, 29905, 29876, 29908, 1273, 1059, 13, 13, 1678, 822, 679, 29918, 1792, 29918, 333, 29898, 1311, 29892, 8952, 1125, 13, 4706, 9995, 13, 4706, 3617, 278, 12500, 9274, 1404, 1178, 515, 278, 1404, 1024, 13, 4706, 584, 3207, 8952, 13, 4706, 584, 2457, 29901, 29871, 278, 1404, 1178, 13, 4706, 9995, 13, 4706, 4160, 353, 1583, 29889, 657, 29918, 7193, 29898, 13400, 2433, 742, 4235, 543, 6786, 1159, 13, 13, 4706, 363, 1404, 297, 4160, 29901, 13, 9651, 565, 1404, 1839, 6786, 2033, 1275, 8952, 29901, 13, 18884, 736, 1404, 1839, 333, 2033, 13, 13, 4706, 12020, 2184, 2659, 17413, 2392, 877, 3782, 1404, 1476, 363, 8952, 29901, 1273, 29879, 29915, 1273, 313, 6786, 29892, 876, 13, 13, 1678, 822, 679, 29918, 1792, 29898, 1311, 29892, 8952, 1125, 13, 4706, 9995, 13, 4706, 3617, 9493, 1776, 310, 263, 1404, 1203, 29889, 13, 4706, 584, 3207, 1404, 29918, 333, 29901, 13, 4706, 584, 2457, 29901, 1404, 4426, 9657, 13, 4706, 9995, 13, 4706, 396, 383, 6415, 2303, 29901, 1094, 4720, 408, 591, 4377, 714, 920, 278, 421, 4572, 29952, 3443, 1736, 373, 1788, 7193, 29918, 1761, 3285, 591, 881, 1369, 13, 4706, 396, 29871, 21166, 2729, 373, 8952, 13, 4706, 4160, 353, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 29889, 5205, 7193, 29918, 1761, 29898, 13, 9651, 3544, 2433, 6214, 29914, 3126, 742, 13, 9651, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 29915, 13, 4706, 13742, 9902, 13, 13, 4706, 363, 1404, 297, 4160, 29901, 13, 9651, 565, 1404, 29889, 6786, 1275, 8952, 29901, 13, 18884, 736, 1404, 29889, 517, 29918, 8977, 580, 13, 13, 4706, 12020, 2184, 2659, 17413, 2392, 877, 3782, 1404, 1476, 363, 8952, 29901, 1273, 29879, 29915, 1273, 313, 6786, 29892, 876, 13, 13, 1678, 822, 731, 29918, 1792, 29898, 1311, 29892, 8952, 29892, 8393, 1125, 13, 4706, 1404, 29918, 333, 353, 1583, 29889, 657, 29918, 1792, 29918, 333, 29898, 6786, 29897, 13, 4706, 7882, 29918, 5327, 353, 1583, 29889, 5205, 29918, 7193, 29918, 2754, 29889, 5205, 7193, 29918, 649, 29898, 13, 9651, 3544, 2433, 6214, 29914, 3126, 742, 13, 9651, 2793, 29918, 1853, 2433, 6214, 29914, 3126, 742, 13, 9651, 1178, 29922, 1792, 29918, 333, 29892, 13, 9651, 3573, 29922, 3924, 1792, 649, 29898, 1068, 15697, 29897, 13, 4706, 1723, 13, 4706, 736, 7882, 29918, 5327, 29889, 517, 29918, 8977, 580, 13, 2 ]
lib/spack/spack/test/cache_fetch.py
LiamBindle/spack
2,360
8325
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import os import pytest from llnl.util.filesystem import mkdirp, touch import spack.config from spack.fetch_strategy import CacheURLFetchStrategy, NoCacheError from spack.stage import Stage @pytest.mark.parametrize('_fetch_method', ['curl', 'urllib']) def test_fetch_missing_cache(tmpdir, _fetch_method): """Ensure raise a missing cache file.""" testpath = str(tmpdir) with spack.config.override('config:url_fetch_method', _fetch_method): fetcher = CacheURLFetchStrategy(url='file:///not-a-real-cache-file') with Stage(fetcher, path=testpath): with pytest.raises(NoCacheError, match=r'No cache'): fetcher.fetch() @pytest.mark.parametrize('_fetch_method', ['curl', 'urllib']) def test_fetch(tmpdir, _fetch_method): """Ensure a fetch after expanding is effectively a no-op.""" testpath = str(tmpdir) cache = os.path.join(testpath, 'cache.tar.gz') touch(cache) url = 'file:///{0}'.format(cache) with spack.config.override('config:url_fetch_method', _fetch_method): fetcher = CacheURLFetchStrategy(url=url) with Stage(fetcher, path=testpath) as stage: source_path = stage.source_path mkdirp(source_path) fetcher.fetch()
[ 1, 396, 14187, 1266, 29871, 29906, 29900, 29896, 29941, 29899, 29906, 29900, 29906, 29896, 19520, 22469, 5514, 3086, 14223, 29892, 365, 12182, 322, 916, 13, 29937, 1706, 547, 8010, 10682, 414, 29889, 2823, 278, 2246, 29899, 5563, 315, 4590, 29979, 22789, 3912, 934, 363, 4902, 29889, 13, 29937, 13, 29937, 10937, 29928, 29990, 29899, 29931, 293, 1947, 29899, 12889, 29901, 313, 17396, 1829, 29899, 29906, 29889, 29900, 6323, 341, 1806, 29897, 13, 13, 5215, 2897, 13, 13, 5215, 11451, 1688, 13, 13, 3166, 301, 3083, 29880, 29889, 4422, 29889, 5325, 973, 1053, 29356, 29886, 29892, 6023, 13, 13, 5215, 805, 547, 29889, 2917, 13, 3166, 805, 547, 29889, 9155, 29918, 710, 8963, 1053, 28540, 4219, 20927, 26910, 29892, 1939, 10408, 2392, 13, 3166, 805, 547, 29889, 19190, 1053, 24906, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 29918, 9155, 29918, 5696, 742, 6024, 18963, 742, 525, 2271, 1982, 11287, 13, 1753, 1243, 29918, 9155, 29918, 27259, 29918, 8173, 29898, 7050, 3972, 29892, 903, 9155, 29918, 5696, 1125, 13, 1678, 9995, 29923, 1983, 545, 12020, 263, 4567, 7090, 934, 1213, 15945, 13, 1678, 1243, 2084, 353, 851, 29898, 7050, 3972, 29897, 13, 1678, 411, 805, 547, 29889, 2917, 29889, 15752, 877, 2917, 29901, 2271, 29918, 9155, 29918, 5696, 742, 903, 9155, 29918, 5696, 1125, 13, 4706, 6699, 261, 353, 28540, 4219, 20927, 26910, 29898, 2271, 2433, 1445, 597, 29914, 1333, 29899, 29874, 29899, 6370, 29899, 8173, 29899, 1445, 1495, 13, 4706, 411, 24906, 29898, 9155, 261, 29892, 2224, 29922, 1688, 2084, 1125, 13, 9651, 411, 11451, 1688, 29889, 336, 4637, 29898, 3782, 10408, 2392, 29892, 1993, 29922, 29878, 29915, 3782, 7090, 29374, 13, 18884, 6699, 261, 29889, 9155, 580, 13, 13, 13, 29992, 2272, 1688, 29889, 3502, 29889, 3207, 300, 374, 911, 877, 29918, 9155, 29918, 5696, 742, 6024, 18963, 742, 525, 2271, 1982, 11287, 13, 1753, 1243, 29918, 9155, 29898, 7050, 3972, 29892, 903, 9155, 29918, 5696, 1125, 13, 1678, 9995, 29923, 1983, 545, 263, 6699, 1156, 7985, 292, 338, 17583, 263, 694, 29899, 459, 1213, 15945, 13, 1678, 1243, 2084, 353, 851, 29898, 7050, 3972, 29897, 13, 1678, 7090, 353, 2897, 29889, 2084, 29889, 7122, 29898, 1688, 2084, 29892, 525, 8173, 29889, 12637, 29889, 18828, 1495, 13, 1678, 6023, 29898, 8173, 29897, 13, 1678, 3142, 353, 525, 1445, 597, 19248, 29900, 29913, 4286, 4830, 29898, 8173, 29897, 13, 1678, 411, 805, 547, 29889, 2917, 29889, 15752, 877, 2917, 29901, 2271, 29918, 9155, 29918, 5696, 742, 903, 9155, 29918, 5696, 1125, 13, 4706, 6699, 261, 353, 28540, 4219, 20927, 26910, 29898, 2271, 29922, 2271, 29897, 13, 4706, 411, 24906, 29898, 9155, 261, 29892, 2224, 29922, 1688, 2084, 29897, 408, 7408, 29901, 13, 9651, 2752, 29918, 2084, 353, 7408, 29889, 4993, 29918, 2084, 13, 9651, 29356, 29886, 29898, 4993, 29918, 2084, 29897, 13, 9651, 6699, 261, 29889, 9155, 580, 13, 2 ]
plus_factory.py
dlb123/pipebend-caculate
0
179133
<filename>plus_factory.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'plus_factory.ui' # # Created by: PyQt5 UI code generator 5.15.2 # # WARNING: Any manual changes made to this file will be lost when pyuic5 is # run again. Do not edit this file unless you know what you are doing. from PyQt5 import QtCore, QtGui, QtWidgets class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(664, 379) Dialog.setFixedSize(664, 379) #Dialog.setWindowModify(QtCore.Qt.ApplicationModal) self.buttonBox = QtWidgets.QDialogButtonBox(Dialog) self.buttonBox.setGeometry(QtCore.QRect(240, 320, 191, 31)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.verticalLayoutWidget = QtWidgets.QWidget(Dialog) self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 10, 331, 161)) self.verticalLayoutWidget.setObjectName("verticalLayoutWidget") self.verticalLayout = QtWidgets.QVBoxLayout(self.verticalLayoutWidget) self.verticalLayout.setContentsMargins(10, 10, 10, 10) self.verticalLayout.setObjectName("verticalLayout") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setContentsMargins(20, -1, 20, -1) self.horizontalLayout.setObjectName("horizontalLayout") self.label = QtWidgets.QLabel(self.verticalLayoutWidget) self.label.setObjectName("label") self.horizontalLayout.addWidget(self.label) self.lineEdit = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.lineEdit.setObjectName("lineEdit") self.horizontalLayout.addWidget(self.lineEdit) self.verticalLayout.addLayout(self.horizontalLayout) self.horizontalLayout_2 = QtWidgets.QHBoxLayout() self.horizontalLayout_2.setContentsMargins(20, -1, 20, -1) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.label_2 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_2.setObjectName("label_2") self.horizontalLayout_2.addWidget(self.label_2) self.lineEdit_2 = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.lineEdit_2.setObjectName("lineEdit_2") self.horizontalLayout_2.addWidget(self.lineEdit_2) self.verticalLayout.addLayout(self.horizontalLayout_2) self.horizontalLayout_4 = QtWidgets.QHBoxLayout() self.horizontalLayout_4.setContentsMargins(20, -1, 20, -1) self.horizontalLayout_4.setObjectName("horizontalLayout_4") self.label_4 = QtWidgets.QLabel(self.verticalLayoutWidget) self.label_4.setObjectName("label_4") self.horizontalLayout_4.addWidget(self.label_4) self.lineEdit_4 = QtWidgets.QLineEdit(self.verticalLayoutWidget) self.lineEdit_4.setObjectName("lineEdit_4") self.horizontalLayout_4.addWidget(self.lineEdit_4) self.verticalLayout.addLayout(self.horizontalLayout_4) self.verticalLayoutWidget_2 = QtWidgets.QWidget(Dialog) self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(460, 10, 181, 111)) self.verticalLayoutWidget_2.setObjectName("verticalLayoutWidget_2") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2) self.verticalLayout_2.setContentsMargins(10, 10, 10, 10) self.verticalLayout_2.setObjectName("verticalLayout_2") self.horizontalLayout_3 = QtWidgets.QHBoxLayout() self.horizontalLayout_3.setObjectName("horizontalLayout_3") self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setContentsMargins(10, 10, 10, 10) self.horizontalLayout_5.setObjectName("horizontalLayout_5") self.label_5 = QtWidgets.QLabel(self.verticalLayoutWidget_2) self.label_5.setObjectName("label_5") self.horizontalLayout_5.addWidget(self.label_5) self.lineEdit_3 = QtWidgets.QLineEdit(self.verticalLayoutWidget_2) self.lineEdit_3.setObjectName("lineEdit_3") self.horizontalLayout_5.addWidget(self.lineEdit_3) self.horizontalLayout_3.addLayout(self.horizontalLayout_5) self.verticalLayout_2.addLayout(self.horizontalLayout_3) self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setContentsMargins(10, 10, 10, 10) self.horizontalLayout_6.setObjectName("horizontalLayout_6") self.label_6 = QtWidgets.QLabel(self.verticalLayoutWidget_2) self.label_6.setObjectName("label_6") self.horizontalLayout_6.addWidget(self.label_6) self.lineEdit_5 = QtWidgets.QLineEdit(self.verticalLayoutWidget_2) self.lineEdit_5.setObjectName("lineEdit_5") self.horizontalLayout_6.addWidget(self.lineEdit_5) self.verticalLayout_2.addLayout(self.horizontalLayout_6) self.pushButton = QtWidgets.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(490, 130, 61, 28)) self.pushButton.setObjectName("pushButton") self.tableWidget = QtWidgets.QTableWidget(Dialog) self.tableWidget.setGeometry(QtCore.QRect(40, 200, 581, 97)) self.tableWidget.setRowCount(2) self.tableWidget.setObjectName("tableWidget") self.tableWidget.setColumnCount(0) self.pushButton_2 = QtWidgets.QPushButton(Dialog) self.pushButton_2.setGeometry(QtCore.QRect(330, 130, 61, 28)) self.pushButton_2.setObjectName("pushButton_2") self.pushButton_3 = QtWidgets.QPushButton(Dialog) self.pushButton_3.setGeometry((QtCore.QRect(560, 130, 61, 28))) self.pushButton_3.setObjectName('清除') self.retranslateUi(Dialog) self.buttonBox.accepted.connect(Dialog.accept) self.buttonBox.rejected.connect(Dialog.reject) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Dialog")) self.label.setText(_translate("Dialog", "设备型号:")) self.label_2.setText(_translate("Dialog", "模具规格:")) self.label_4.setText(_translate("Dialog", " 材质 :")) self.label_5.setText(_translate("Dialog", "理论值:")) self.label_6.setText(_translate("Dialog", "修正值:")) self.pushButton.setText(_translate("Dialog", "添加")) self.pushButton_2.setText(_translate("Dialog", "确认")) self.pushButton_3.setText(_translate("Dialog", "清除"))
[ 1, 529, 9507, 29958, 11242, 29918, 14399, 29889, 2272, 13, 29937, 448, 29930, 29899, 14137, 29901, 23616, 29899, 29947, 448, 29930, 29899, 30004, 13, 30004, 13, 29937, 3812, 5314, 5759, 515, 5183, 14313, 934, 525, 11242, 29918, 14399, 29889, 1481, 29915, 30004, 13, 29937, 30004, 13, 29937, 6760, 630, 491, 29901, 10772, 17303, 29945, 3740, 775, 15299, 29871, 29945, 29889, 29896, 29945, 29889, 29906, 30004, 13, 29937, 30004, 13, 29937, 399, 25614, 29901, 3139, 12219, 3620, 1754, 304, 445, 934, 674, 367, 5714, 746, 11451, 29884, 293, 29945, 338, 30004, 13, 29937, 1065, 1449, 29889, 29871, 1938, 451, 3863, 445, 934, 6521, 366, 1073, 825, 366, 526, 2599, 22993, 13, 30004, 13, 30004, 13, 3166, 10772, 17303, 29945, 1053, 14705, 9203, 29892, 14705, 28707, 29892, 14705, 8801, 29879, 30004, 13, 30004, 13, 30004, 13, 1990, 501, 29875, 29918, 7647, 29898, 3318, 1125, 30004, 13, 1678, 822, 6230, 29965, 29875, 29898, 1311, 29892, 18878, 1125, 30004, 13, 4706, 18878, 29889, 842, 2061, 1170, 703, 7647, 1159, 30004, 13, 4706, 18878, 29889, 21476, 29898, 29953, 29953, 29946, 29892, 29871, 29941, 29955, 29929, 8443, 13, 4706, 18878, 29889, 842, 26262, 3505, 29898, 29953, 29953, 29946, 29892, 29871, 29941, 29955, 29929, 8443, 13, 4706, 396, 7647, 29889, 842, 5907, 2111, 1598, 29898, 17303, 9203, 29889, 17303, 29889, 4873, 19751, 8443, 13, 4706, 1583, 29889, 3092, 3313, 353, 14705, 8801, 29879, 29889, 29984, 7647, 3125, 3313, 29898, 7647, 8443, 13, 4706, 1583, 29889, 3092, 3313, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29906, 29946, 29900, 29892, 29871, 29941, 29906, 29900, 29892, 29871, 29896, 29929, 29896, 29892, 29871, 29941, 29896, 876, 30004, 13, 4706, 1583, 29889, 3092, 3313, 29889, 842, 25231, 29898, 17303, 9203, 29889, 17303, 29889, 24932, 8443, 13, 4706, 1583, 29889, 3092, 3313, 29889, 842, 15449, 29819, 787, 29898, 17303, 8801, 29879, 29889, 29984, 7647, 3125, 3313, 29889, 19420, 29989, 17303, 8801, 29879, 29889, 29984, 7647, 3125, 3313, 29889, 20434, 8443, 13, 4706, 1583, 29889, 3092, 3313, 29889, 842, 2061, 1170, 703, 3092, 3313, 1159, 30004, 13, 4706, 1583, 29889, 18575, 3453, 8801, 353, 14705, 8801, 29879, 29889, 29984, 8801, 29898, 7647, 8443, 13, 4706, 1583, 29889, 18575, 3453, 8801, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29941, 29941, 29896, 29892, 29871, 29896, 29953, 29896, 876, 30004, 13, 4706, 1583, 29889, 18575, 3453, 8801, 29889, 842, 2061, 1170, 703, 18575, 3453, 8801, 1159, 30004, 13, 4706, 1583, 29889, 18575, 3453, 353, 14705, 8801, 29879, 29889, 29984, 29963, 3313, 3453, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29889, 842, 2061, 1170, 703, 18575, 3453, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29906, 29900, 29892, 448, 29896, 29892, 29871, 29906, 29900, 29892, 448, 29896, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29889, 842, 2061, 1170, 703, 22672, 3453, 1159, 30004, 13, 4706, 1583, 29889, 1643, 353, 14705, 8801, 29879, 29889, 2239, 1107, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1643, 29889, 842, 2061, 1170, 703, 1643, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29889, 1202, 8801, 29898, 1311, 29889, 1643, 8443, 13, 4706, 1583, 29889, 1220, 6103, 353, 14705, 8801, 29879, 29889, 2239, 457, 6103, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29889, 842, 2061, 1170, 703, 1220, 6103, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29889, 1202, 8801, 29898, 1311, 29889, 1220, 6103, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29906, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29906, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29906, 29900, 29892, 448, 29896, 29892, 29871, 29906, 29900, 29892, 448, 29896, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29906, 29889, 842, 2061, 1170, 703, 22672, 3453, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29906, 353, 14705, 8801, 29879, 29889, 2239, 1107, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1643, 29918, 29906, 29889, 842, 2061, 1170, 703, 1643, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29906, 29889, 1202, 8801, 29898, 1311, 29889, 1643, 29918, 29906, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29906, 353, 14705, 8801, 29879, 29889, 2239, 457, 6103, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29906, 29889, 842, 2061, 1170, 703, 1220, 6103, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29906, 29889, 1202, 8801, 29898, 1311, 29889, 1220, 6103, 29918, 29906, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 29918, 29906, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29946, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29946, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29906, 29900, 29892, 448, 29896, 29892, 29871, 29906, 29900, 29892, 448, 29896, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29946, 29889, 842, 2061, 1170, 703, 22672, 3453, 29918, 29946, 1159, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29946, 353, 14705, 8801, 29879, 29889, 2239, 1107, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1643, 29918, 29946, 29889, 842, 2061, 1170, 703, 1643, 29918, 29946, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29946, 29889, 1202, 8801, 29898, 1311, 29889, 1643, 29918, 29946, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29946, 353, 14705, 8801, 29879, 29889, 2239, 457, 6103, 29898, 1311, 29889, 18575, 3453, 8801, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29946, 29889, 842, 2061, 1170, 703, 1220, 6103, 29918, 29946, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29946, 29889, 1202, 8801, 29898, 1311, 29889, 1220, 6103, 29918, 29946, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 29918, 29946, 8443, 13, 4706, 1583, 29889, 18575, 3453, 8801, 29918, 29906, 353, 14705, 8801, 29879, 29889, 29984, 8801, 29898, 7647, 8443, 13, 4706, 1583, 29889, 18575, 3453, 8801, 29918, 29906, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29946, 29953, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29947, 29896, 29892, 29871, 29896, 29896, 29896, 876, 30004, 13, 4706, 1583, 29889, 18575, 3453, 8801, 29918, 29906, 29889, 842, 2061, 1170, 703, 18575, 3453, 8801, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 18575, 3453, 29918, 29906, 353, 14705, 8801, 29879, 29889, 29984, 29963, 3313, 3453, 29898, 1311, 29889, 18575, 3453, 8801, 29918, 29906, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29918, 29906, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29918, 29906, 29889, 842, 2061, 1170, 703, 18575, 3453, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29941, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29941, 29889, 842, 2061, 1170, 703, 22672, 3453, 29918, 29941, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29945, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29945, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29945, 29889, 842, 2061, 1170, 703, 22672, 3453, 29918, 29945, 1159, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29945, 353, 14705, 8801, 29879, 29889, 2239, 1107, 29898, 1311, 29889, 18575, 3453, 8801, 29918, 29906, 8443, 13, 4706, 1583, 29889, 1643, 29918, 29945, 29889, 842, 2061, 1170, 703, 1643, 29918, 29945, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29945, 29889, 1202, 8801, 29898, 1311, 29889, 1643, 29918, 29945, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29941, 353, 14705, 8801, 29879, 29889, 2239, 457, 6103, 29898, 1311, 29889, 18575, 3453, 8801, 29918, 29906, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29941, 29889, 842, 2061, 1170, 703, 1220, 6103, 29918, 29941, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29945, 29889, 1202, 8801, 29898, 1311, 29889, 1220, 6103, 29918, 29941, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29941, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 29918, 29945, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29918, 29906, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 29918, 29941, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29953, 353, 14705, 8801, 29879, 29889, 29984, 29950, 3313, 3453, 26471, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29953, 29889, 842, 21002, 29924, 1191, 1144, 29898, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 29892, 29871, 29896, 29900, 8443, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29953, 29889, 842, 2061, 1170, 703, 22672, 3453, 29918, 29953, 1159, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29953, 353, 14705, 8801, 29879, 29889, 2239, 1107, 29898, 1311, 29889, 18575, 3453, 8801, 29918, 29906, 8443, 13, 4706, 1583, 29889, 1643, 29918, 29953, 29889, 842, 2061, 1170, 703, 1643, 29918, 29953, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29953, 29889, 1202, 8801, 29898, 1311, 29889, 1643, 29918, 29953, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29945, 353, 14705, 8801, 29879, 29889, 2239, 457, 6103, 29898, 1311, 29889, 18575, 3453, 8801, 29918, 29906, 8443, 13, 4706, 1583, 29889, 1220, 6103, 29918, 29945, 29889, 842, 2061, 1170, 703, 1220, 6103, 29918, 29945, 1159, 30004, 13, 4706, 1583, 29889, 22672, 3453, 29918, 29953, 29889, 1202, 8801, 29898, 1311, 29889, 1220, 6103, 29918, 29945, 8443, 13, 4706, 1583, 29889, 18575, 3453, 29918, 29906, 29889, 1202, 3453, 29898, 1311, 29889, 22672, 3453, 29918, 29953, 8443, 13, 4706, 1583, 29889, 5910, 3125, 353, 14705, 8801, 29879, 29889, 29984, 27031, 3125, 29898, 7647, 8443, 13, 4706, 1583, 29889, 5910, 3125, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29946, 29929, 29900, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29953, 29896, 29892, 29871, 29906, 29947, 876, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29889, 842, 2061, 1170, 703, 5910, 3125, 1159, 30004, 13, 4706, 1583, 29889, 2371, 8801, 353, 14705, 8801, 29879, 29889, 29984, 3562, 8801, 29898, 7647, 8443, 13, 4706, 1583, 29889, 2371, 8801, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29946, 29900, 29892, 29871, 29906, 29900, 29900, 29892, 29871, 29945, 29947, 29896, 29892, 29871, 29929, 29955, 876, 30004, 13, 4706, 1583, 29889, 2371, 8801, 29889, 842, 4301, 3981, 29898, 29906, 8443, 13, 4706, 1583, 29889, 2371, 8801, 29889, 842, 2061, 1170, 703, 2371, 8801, 1159, 30004, 13, 4706, 1583, 29889, 2371, 8801, 29889, 842, 4409, 3981, 29898, 29900, 8443, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29906, 353, 14705, 8801, 29879, 29889, 29984, 27031, 3125, 29898, 7647, 8443, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29906, 29889, 842, 7999, 7843, 29898, 17303, 9203, 29889, 29984, 7364, 29898, 29941, 29941, 29900, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29953, 29896, 29892, 29871, 29906, 29947, 876, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29906, 29889, 842, 2061, 1170, 703, 5910, 3125, 29918, 29906, 1159, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29941, 353, 14705, 8801, 29879, 29889, 29984, 27031, 3125, 29898, 7647, 8443, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29941, 29889, 842, 7999, 7843, 3552, 17303, 9203, 29889, 29984, 7364, 29898, 29945, 29953, 29900, 29892, 29871, 29896, 29941, 29900, 29892, 29871, 29953, 29896, 29892, 29871, 29906, 29947, 4961, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29941, 29889, 842, 2061, 1170, 877, 30989, 31152, 1495, 30004, 13, 4706, 1583, 29889, 276, 21652, 29965, 29875, 29898, 7647, 8443, 13, 4706, 1583, 29889, 3092, 3313, 29889, 16044, 287, 29889, 6915, 29898, 7647, 29889, 16044, 8443, 13, 4706, 1583, 29889, 3092, 3313, 29889, 276, 622, 287, 29889, 6915, 29898, 7647, 29889, 276, 622, 8443, 13, 4706, 14705, 9203, 29889, 29984, 19346, 2061, 29889, 6915, 16973, 1862, 2059, 1170, 29898, 7647, 8443, 13, 30004, 13, 1678, 822, 337, 21652, 29965, 29875, 29898, 1311, 29892, 18878, 1125, 30004, 13, 4706, 903, 21652, 353, 14705, 9203, 29889, 29984, 9203, 4873, 29889, 21652, 30004, 13, 4706, 18878, 29889, 842, 5907, 7030, 7373, 21652, 703, 7647, 613, 376, 7647, 5783, 30004, 13, 4706, 1583, 29889, 1643, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 30872, 232, 167, 138, 30883, 30850, 29901, 5783, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29906, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 31382, 232, 136, 186, 235, 170, 135, 31168, 29901, 5783, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29946, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 268, 233, 160, 147, 235, 183, 171, 29871, 584, 5783, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29945, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 30687, 235, 177, 189, 30959, 29901, 5783, 30004, 13, 4706, 1583, 29889, 1643, 29918, 29953, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 31273, 30724, 30959, 29901, 5783, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 31538, 30666, 5783, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29906, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 31835, 31439, 5783, 30004, 13, 4706, 1583, 29889, 5910, 3125, 29918, 29941, 29889, 12038, 7373, 21652, 703, 7647, 613, 376, 30989, 31152, 5783, 2 ]
auth/tests/test_views.py
asb29/Redundant
0
3689
from django.test import TestCase from django.test import Client class RegisterTestCase(TestCase): def test_register(self): c = Client() # on success redirects to / response = c.post('/accounts/register/', { 'username': 'asdas', 'password1': '<PASSWORD>', 'password2': '<PASSWORD>' }) self.assertRedirects(response, '/') # passwords don't match response = c.post('/accounts/register/', { 'username': 'asdasdasd1', 'password1': '<PASSWORD>', 'password2': '<PASSWORD>' }) self.assertEquals(response.status_code, 200) # username is empty response = c.post('/accounts/register/', { 'username': '', 'password1': '<PASSWORD>', 'password2': '<PASSWORD>' }) self.assertEquals(response.status_code, 200) # no password response = c.post('/accounts/register/', { 'username': 'asdasdasd', 'password1': '', 'password2': '' }) self.assertEquals(response.status_code, 200) # username and password are similar response = c.post('/accounts/register/', { 'username': 'asdasdasd0', 'password1': '<PASSWORD>', 'password2': '<PASSWORD>' }) self.assertEquals(response.status_code, 200)
[ 1, 515, 9557, 29889, 1688, 1053, 4321, 8259, 13, 3166, 9557, 29889, 1688, 1053, 12477, 13, 13, 13, 1990, 12577, 3057, 8259, 29898, 3057, 8259, 1125, 13, 1678, 822, 1243, 29918, 9573, 29898, 1311, 1125, 13, 4706, 274, 353, 12477, 580, 13, 13, 4706, 396, 373, 2551, 28937, 304, 847, 13, 4706, 2933, 353, 274, 29889, 2490, 11219, 10149, 29879, 29914, 9573, 29914, 742, 426, 13, 9651, 525, 6786, 2396, 525, 294, 17370, 742, 13, 9651, 525, 5630, 29896, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 5630, 29906, 2396, 12801, 25711, 17013, 16299, 13, 9651, 5615, 13, 4706, 1583, 29889, 9294, 24735, 29879, 29898, 5327, 29892, 8207, 1495, 13, 13, 4706, 396, 27630, 1016, 29915, 29873, 1993, 13, 4706, 2933, 353, 274, 29889, 2490, 11219, 10149, 29879, 29914, 9573, 29914, 742, 426, 13, 9651, 525, 6786, 2396, 525, 294, 17370, 17370, 29881, 29896, 742, 13, 9651, 525, 5630, 29896, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 5630, 29906, 2396, 12801, 25711, 17013, 16299, 13, 9651, 5615, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 396, 8952, 338, 4069, 13, 4706, 2933, 353, 274, 29889, 2490, 11219, 10149, 29879, 29914, 9573, 29914, 742, 426, 13, 9651, 525, 6786, 2396, 15516, 13, 9651, 525, 5630, 29896, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 5630, 29906, 2396, 12801, 25711, 17013, 16299, 13, 9651, 5615, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 396, 694, 4800, 13, 4706, 2933, 353, 274, 29889, 2490, 11219, 10149, 29879, 29914, 9573, 29914, 742, 426, 13, 9651, 525, 6786, 2396, 525, 294, 17370, 17370, 29881, 742, 13, 9651, 525, 5630, 29896, 2396, 15516, 13, 9651, 525, 5630, 29906, 2396, 6629, 13, 9651, 5615, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 13, 4706, 396, 8952, 322, 4800, 526, 2788, 13, 4706, 2933, 353, 274, 29889, 2490, 11219, 10149, 29879, 29914, 9573, 29914, 742, 426, 13, 9651, 525, 6786, 2396, 525, 294, 17370, 17370, 29881, 29900, 742, 13, 9651, 525, 5630, 29896, 2396, 12801, 25711, 17013, 29958, 742, 13, 9651, 525, 5630, 29906, 2396, 12801, 25711, 17013, 16299, 13, 9651, 5615, 13, 4706, 1583, 29889, 9294, 14776, 29898, 5327, 29889, 4882, 29918, 401, 29892, 29871, 29906, 29900, 29900, 29897, 13, 2 ]
scripts/misc/redis_test.py
cclauss/archai
344
45288
import redis redis_client = redis.StrictRedis(host="127.0.0.1", port=6379) input("")
[ 1, 1053, 29825, 13, 13, 1127, 275, 29918, 4645, 353, 29825, 29889, 5015, 919, 9039, 275, 29898, 3069, 543, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 613, 2011, 29922, 29953, 29941, 29955, 29929, 29897, 13, 13, 2080, 703, 1159, 2 ]
clickhouse_proxy/auth.py
kfzteile24/clickhouse-proxy
1
126043
<reponame>kfzteile24/clickhouse-proxy<filename>clickhouse_proxy/auth.py from clickhouse_proxy.config import config from typing import Dict def is_ipv6(ip: str) -> bool: return ip.find(':') > -1 def ip_to_bits(ip: str) -> int: # See what kind of IP this is and set parsing parameters if is_ipv6(ip): separator = ':' chunks = [''] * 8 bytes_per_chunk = 2 base = 16 else: separator = '.' chunks = [''] * 4 bytes_per_chunk = 1 base = 10 # tokenize str_chunks = ip.split(separator) src_chunk_id = 0 for i in range(0, len(chunks) - 1): chunk = str_chunks[src_chunk_id] if chunk: chunks[i] = chunk src_chunk_id += 1 else: chunks[i] = '0' chunks[-1] = str_chunks[-1] or 0 # fmt is just for fancy viewing # fmt = f'{{:0>{bytes_per_chunk * 2}}}' # fancy_viewing = [fmt.format(c) for c in chunks] int_chunks = [int(c, base) for c in chunks] bit_ip: int = 0 for chunk in int_chunks: bit_ip = bit_ip << (8 * bytes_per_chunk) bit_ip = bit_ip | chunk return bit_ip def address_in_network(ip: str, net: str) -> bool: """Is an address in a network """ # If IP and net mask are not compatible, return False if is_ipv6(ip) != is_ipv6(net): return False # Convert ips to int i_ip = ip_to_bits(ip) total_bits = 32 if not is_ipv6(ip) else 128 netparts = net.split('/') netaddr = netparts[0] bits = int(netparts[1]) if len(netparts) == 2 else total_bits i_net = ip_to_bits(netaddr) # get a mask of bits of "1" of the length of total_bits mask_all = (2 << total_bits) - 1 # Compute significant bitmask (each bit is 1 except for the last, insignificant ones) bits = total_bits - int(bits) bitmask = mask_all ^ ((1 << bits) - 1) # Check whether significant bits match return i_ip & bitmask == i_net & bitmask def authorize(params: Dict[str, str], remote_addr: str) -> str: user = params.get('user', 'default') if user not in config.users: return f"User '{user}' is not authorised to access the ClickHouse ODBC Proxy" authorized = False for ip in config.users[user].get('ips', []): if address_in_network(remote_addr, ip): authorized = True break if not authorized: return f"User '{user}' is not authorised to access the ClickHouse ODBC Proxy from IP {remote_addr}" return '' if __name__ == '__main__': # TODO: need more tests maybe assert is_ipv6('fd00:a516:7c1b:17cd:6d81:2137:bd2a:2c5b') assert not is_ipv6('127.0.0.1') assert address_in_network('192.0.0.0.129', '192.0.0.0.128/31')
[ 1, 529, 276, 1112, 420, 29958, 29895, 29888, 8832, 488, 29906, 29946, 29914, 3808, 8697, 29899, 14701, 29966, 9507, 29958, 3808, 8697, 29918, 14701, 29914, 5150, 29889, 2272, 13, 3166, 2828, 8697, 29918, 14701, 29889, 2917, 1053, 2295, 13, 3166, 19229, 1053, 360, 919, 13, 13, 13, 1753, 338, 29918, 666, 29894, 29953, 29898, 666, 29901, 851, 29897, 1599, 6120, 29901, 13, 1678, 736, 10377, 29889, 2886, 877, 29901, 1495, 1405, 448, 29896, 13, 13, 13, 1753, 10377, 29918, 517, 29918, 14836, 29898, 666, 29901, 851, 29897, 1599, 938, 29901, 13, 1678, 396, 2823, 825, 2924, 310, 5641, 445, 338, 322, 731, 13755, 4128, 13, 1678, 565, 338, 29918, 666, 29894, 29953, 29898, 666, 1125, 13, 4706, 28128, 353, 525, 11283, 13, 4706, 521, 18801, 353, 6024, 2033, 334, 29871, 29947, 13, 4706, 6262, 29918, 546, 29918, 29812, 353, 29871, 29906, 13, 4706, 2967, 353, 29871, 29896, 29953, 13, 1678, 1683, 29901, 13, 4706, 28128, 353, 525, 6169, 13, 4706, 521, 18801, 353, 6024, 2033, 334, 29871, 29946, 13, 4706, 6262, 29918, 546, 29918, 29812, 353, 29871, 29896, 13, 4706, 2967, 353, 29871, 29896, 29900, 13, 268, 13, 1678, 396, 5993, 675, 13, 1678, 851, 29918, 305, 18801, 353, 10377, 29889, 5451, 29898, 344, 17954, 29897, 13, 1678, 4765, 29918, 29812, 29918, 333, 353, 29871, 29900, 13, 1678, 363, 474, 297, 3464, 29898, 29900, 29892, 7431, 29898, 305, 18801, 29897, 448, 29871, 29896, 1125, 13, 4706, 19875, 353, 851, 29918, 305, 18801, 29961, 4351, 29918, 29812, 29918, 333, 29962, 13, 4706, 565, 19875, 29901, 13, 9651, 521, 18801, 29961, 29875, 29962, 353, 19875, 13, 9651, 4765, 29918, 29812, 29918, 333, 4619, 29871, 29896, 13, 4706, 1683, 29901, 13, 9651, 521, 18801, 29961, 29875, 29962, 353, 525, 29900, 29915, 13, 1678, 521, 18801, 14352, 29896, 29962, 353, 851, 29918, 305, 18801, 14352, 29896, 29962, 470, 29871, 29900, 13, 1678, 396, 19200, 338, 925, 363, 19231, 1776, 292, 13, 1678, 396, 19200, 353, 285, 29915, 6224, 29901, 29900, 26208, 13193, 29918, 546, 29918, 29812, 334, 29871, 29906, 930, 10162, 13, 1678, 396, 19231, 29918, 1493, 292, 353, 518, 23479, 29889, 4830, 29898, 29883, 29897, 363, 274, 297, 521, 18801, 29962, 13, 1678, 938, 29918, 305, 18801, 353, 518, 524, 29898, 29883, 29892, 2967, 29897, 363, 274, 297, 521, 18801, 29962, 13, 1678, 2586, 29918, 666, 29901, 938, 353, 29871, 29900, 13, 1678, 363, 19875, 297, 938, 29918, 305, 18801, 29901, 13, 4706, 2586, 29918, 666, 353, 2586, 29918, 666, 3532, 313, 29947, 334, 6262, 29918, 546, 29918, 29812, 29897, 13, 4706, 2586, 29918, 666, 353, 2586, 29918, 666, 891, 19875, 13, 1678, 736, 2586, 29918, 666, 13, 13, 13, 1753, 3211, 29918, 262, 29918, 11618, 29898, 666, 29901, 851, 29892, 7787, 29901, 851, 29897, 1599, 6120, 29901, 13, 1678, 9995, 3624, 385, 3211, 297, 263, 3564, 13, 1678, 9995, 13, 1678, 396, 960, 5641, 322, 7787, 11105, 526, 451, 15878, 29892, 736, 7700, 13, 1678, 565, 338, 29918, 666, 29894, 29953, 29898, 666, 29897, 2804, 338, 29918, 666, 29894, 29953, 29898, 1212, 1125, 13, 4706, 736, 7700, 13, 13, 1678, 396, 14806, 474, 567, 304, 938, 13, 1678, 474, 29918, 666, 353, 10377, 29918, 517, 29918, 14836, 29898, 666, 29897, 13, 1678, 3001, 29918, 14836, 353, 29871, 29941, 29906, 565, 451, 338, 29918, 666, 29894, 29953, 29898, 666, 29897, 1683, 29871, 29896, 29906, 29947, 13, 13, 1678, 7787, 20895, 353, 7787, 29889, 5451, 11219, 1495, 13, 1678, 7787, 10030, 353, 7787, 20895, 29961, 29900, 29962, 13, 1678, 9978, 353, 938, 29898, 1212, 20895, 29961, 29896, 2314, 565, 7431, 29898, 1212, 20895, 29897, 1275, 29871, 29906, 1683, 3001, 29918, 14836, 13, 1678, 474, 29918, 1212, 353, 10377, 29918, 517, 29918, 14836, 29898, 1212, 10030, 29897, 13, 13, 1678, 396, 679, 263, 11105, 310, 9978, 310, 376, 29896, 29908, 310, 278, 3309, 310, 3001, 29918, 14836, 13, 1678, 11105, 29918, 497, 353, 313, 29906, 3532, 3001, 29918, 14836, 29897, 448, 29871, 29896, 13, 1678, 396, 11796, 29872, 7282, 2586, 13168, 313, 4204, 2586, 338, 29871, 29896, 5174, 363, 278, 1833, 29892, 1663, 647, 928, 424, 6743, 29897, 13, 1678, 9978, 353, 3001, 29918, 14836, 448, 938, 29898, 14836, 29897, 13, 1678, 2586, 13168, 353, 11105, 29918, 497, 6228, 5135, 29896, 3532, 9978, 29897, 448, 29871, 29896, 29897, 13, 13, 1678, 396, 5399, 3692, 7282, 9978, 1993, 13, 1678, 736, 474, 29918, 666, 669, 2586, 13168, 1275, 474, 29918, 1212, 669, 2586, 13168, 13, 13, 13, 1753, 4148, 675, 29898, 7529, 29901, 360, 919, 29961, 710, 29892, 851, 1402, 7592, 29918, 10030, 29901, 851, 29897, 1599, 851, 29901, 13, 1678, 1404, 353, 8636, 29889, 657, 877, 1792, 742, 525, 4381, 1495, 13, 13, 1678, 565, 1404, 451, 297, 2295, 29889, 7193, 29901, 13, 4706, 736, 285, 29908, 2659, 22372, 1792, 10162, 338, 451, 4148, 3368, 304, 2130, 278, 16297, 29950, 1709, 438, 22840, 1019, 3594, 29908, 13, 13, 1678, 4148, 1891, 353, 7700, 13, 1678, 363, 10377, 297, 2295, 29889, 7193, 29961, 1792, 1822, 657, 877, 4512, 742, 5159, 1125, 13, 4706, 565, 3211, 29918, 262, 29918, 11618, 29898, 16674, 29918, 10030, 29892, 10377, 1125, 13, 9651, 4148, 1891, 353, 5852, 13, 9651, 2867, 13, 1678, 565, 451, 4148, 1891, 29901, 13, 4706, 736, 285, 29908, 2659, 22372, 1792, 10162, 338, 451, 4148, 3368, 304, 2130, 278, 16297, 29950, 1709, 438, 22840, 1019, 3594, 515, 5641, 426, 16674, 29918, 10030, 5038, 13, 13, 1678, 736, 6629, 13, 13, 13, 361, 4770, 978, 1649, 1275, 525, 1649, 3396, 1649, 2396, 13, 1678, 396, 14402, 29901, 817, 901, 6987, 5505, 13, 1678, 4974, 338, 29918, 666, 29894, 29953, 877, 11512, 29900, 29900, 29901, 29874, 29945, 29896, 29953, 29901, 29955, 29883, 29896, 29890, 29901, 29896, 29955, 2252, 29901, 29953, 29881, 29947, 29896, 29901, 29906, 29896, 29941, 29955, 29901, 6448, 29906, 29874, 29901, 29906, 29883, 29945, 29890, 1495, 13, 1678, 4974, 451, 338, 29918, 666, 29894, 29953, 877, 29896, 29906, 29955, 29889, 29900, 29889, 29900, 29889, 29896, 1495, 13, 1678, 4974, 3211, 29918, 262, 29918, 11618, 877, 29896, 29929, 29906, 29889, 29900, 29889, 29900, 29889, 29900, 29889, 29896, 29906, 29929, 742, 525, 29896, 29929, 29906, 29889, 29900, 29889, 29900, 29889, 29900, 29889, 29896, 29906, 29947, 29914, 29941, 29896, 1495, 13, 13, 2 ]
everything_db.py
muondu/Nesh-hotel
1
1605545
import sqlite3 donn = sqlite3.connect('bill.db') d = donn.cursor() conn = sqlite3.connect('everything.db') c = conn.cursor() def rooms(): c.execute('CREATE TABLE IF NOT EXISTS hotel_rooms(hotelnumber INTEGER)') c.execute('INSERT INTO hotel_rooms VALUES(15)') c.execute('INSERT INTO hotel_rooms VALUES(13)') c.execute('INSERT INTO hotel_rooms VALUES(10)') c.execute('INSERT INTO hotel_rooms VALUES(23)') c.execute('SELECT * FROM hotel_rooms') # print(c.fetchall()) rooms() def bill(): d.execute('CREATE TABLE IF NOT EXISTS breakfast_bill(price INTEGER)') d.execute('CREATE TABLE IF NOT EXISTS lunch_bill(price INTEGER)') d.execute('CREATE TABLE IF NOT EXISTS supper_bill(price INTEGER)') d.execute('CREATE TABLE IF NOT EXISTS room_bill(price INTEGER)') bill() def breakfast(): c.execute('CREATE TABLE IF NOT EXISTS breakfast(name TEXT)') c.execute('INSERT INTO breakfast VALUES("Eggs")') c.execute('INSERT INTO breakfast VALUES("Bread")') breakfast() def lunch(): c.execute('CREATE TABLE IF NOT EXISTS lunch(name TEXT)') c.execute('INSERT INTO lunch VALUES("Chips")') c.execute('INSERT INTO lunch VALUES("Fish")') lunch() def supper(): c.execute('CREATE TABLE IF NOT EXISTS dinner(name TEXT)') c.execute('INSERT INTO dinner VALUES("Rice")') c.execute('INSERT INTO dinner VALUES("Ugali")') supper() def desert(): c.execute('CREATE TABLE IF NOT EXISTS desert(name TEXT)') c.execute('INSERT INTO desert VALUES("Ice cream")') c.execute('INSERT INTO desert VALUES("Cake")') desert() c.execute('CREATE TABLE IF NOT EXISTS movies(name TEXT)') c.execute('INSERT INTO movies VALUES("Megamind")') c.execute('INSERT INTO movies VALUES("Nesh movie")') c.execute('CREATE TABLE IF NOT EXISTS sport(name TEXT)') c.execute('INSERT INTO sport VALUES("Tennis")') c.execute('INSERT INTO sport VALUES("Golf")')
[ 1, 1053, 21120, 29941, 13, 13, 13, 29881, 3409, 353, 21120, 29941, 29889, 6915, 877, 29890, 453, 29889, 2585, 1495, 13, 29881, 353, 14735, 29889, 18127, 580, 13, 13082, 353, 21120, 29941, 29889, 6915, 877, 17991, 1918, 29889, 2585, 1495, 13, 29883, 353, 11009, 29889, 18127, 580, 13, 13, 13, 1753, 19600, 7295, 13, 1678, 274, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 16730, 29918, 18901, 29898, 8711, 295, 4537, 2672, 4330, 17070, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 16730, 29918, 18901, 15673, 29898, 29896, 29945, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 16730, 29918, 18901, 15673, 29898, 29896, 29941, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 16730, 29918, 18901, 15673, 29898, 29896, 29900, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 16730, 29918, 18901, 15673, 29898, 29906, 29941, 29897, 1495, 13, 13, 1678, 274, 29889, 7978, 877, 6404, 334, 3895, 16730, 29918, 18901, 1495, 13, 1678, 396, 1596, 29898, 29883, 29889, 9155, 497, 3101, 13, 18901, 580, 13, 13, 13, 13, 1753, 11118, 7295, 13, 1678, 270, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 26044, 29918, 29890, 453, 29898, 9175, 2672, 4330, 17070, 29897, 1495, 13, 1678, 270, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 301, 3322, 29918, 29890, 453, 29898, 9175, 2672, 4330, 17070, 29897, 1495, 13, 1678, 270, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 1462, 261, 29918, 29890, 453, 29898, 9175, 2672, 4330, 17070, 29897, 1495, 13, 1678, 270, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 5716, 29918, 29890, 453, 29898, 9175, 2672, 4330, 17070, 29897, 1495, 13, 29890, 453, 580, 13, 13, 13, 13, 13, 13, 13, 13, 13, 1753, 26044, 7295, 13, 1678, 274, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 26044, 29898, 978, 323, 12194, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 26044, 15673, 703, 29923, 1505, 29879, 1159, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 26044, 15673, 703, 29933, 949, 1159, 1495, 13, 8690, 11255, 580, 13, 13, 1753, 301, 3322, 7295, 13, 1678, 274, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 301, 3322, 29898, 978, 323, 12194, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 301, 3322, 15673, 703, 1451, 4512, 1159, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 301, 3322, 15673, 703, 29943, 728, 1159, 1495, 13, 29880, 3322, 580, 13, 13, 1753, 1462, 261, 7295, 13, 1678, 274, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 17803, 29898, 978, 323, 12194, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 17803, 15673, 703, 29934, 625, 1159, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 17803, 15673, 703, 29965, 29887, 2606, 1159, 1495, 13, 2146, 2496, 580, 13, 1753, 18197, 7295, 13, 1678, 274, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 18197, 29898, 978, 323, 12194, 29897, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 18197, 15673, 703, 29902, 346, 907, 314, 1159, 1495, 13, 1678, 274, 29889, 7978, 877, 19460, 11646, 18197, 15673, 703, 29907, 1296, 1159, 1495, 13, 2783, 814, 580, 13, 13, 29883, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 2351, 583, 29898, 978, 323, 12194, 29897, 1495, 13, 29883, 29889, 7978, 877, 19460, 11646, 2351, 583, 15673, 703, 29924, 387, 314, 513, 1159, 1495, 13, 29883, 29889, 7978, 877, 19460, 11646, 2351, 583, 15673, 703, 29940, 12094, 14064, 1159, 1495, 13, 13, 29883, 29889, 7978, 877, 27045, 10911, 10762, 6058, 28731, 7980, 29898, 978, 323, 12194, 29897, 1495, 13, 29883, 29889, 7978, 877, 19460, 11646, 7980, 15673, 703, 29911, 9517, 1159, 1495, 13, 29883, 29889, 7978, 877, 19460, 11646, 7980, 15673, 703, 29954, 4369, 1159, 1495, 13, 13, 2 ]
setup.py
meeas/sqlite
1
66041
#!/usr/bin/env python3 """ SQLite Clinet written in python3 """ # Always prefer setuptools over distutils import re import sys # To use a consistent encoding from codecs import open from os import path from setuptools import find_packages, setup here = path.abspath(path.dirname(__file__)) # Get the long description from the README file with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() setup( name='sqlite', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html version='0.2.0', description='SQLite Clinet written in python3', long_description=long_description, # The project's main homepage. url='https://github.com/nl253/SQLiteREPL', # Author details author='<NAME>', author_email='<EMAIL>', # Choose your license license='MIT', classifiers=[ 'Development Status :: 3 - Alpha', 'Intended Audience :: Developers', 'Topic :: Database :: Front-Ends', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.6', ], keywords='database sqllite3 sqlite clinet SQLite prompt-toolkit prompt_toolkit', packages=find_packages(), # List run-time dependencies here. These will be installed by pip when # your project is installed. For an analysis of "install_requires" vs pip's # requirements files see: # https://packaging.python.org/en/latest/requirements.html install_requires=['prompt_toolkit', 'tabulate', 'pygments'], entry_points={ 'console_scripts': ['sqlite = sqlite.main:main'] })
[ 1, 18787, 4855, 29914, 2109, 29914, 6272, 3017, 29941, 13, 13, 15945, 29908, 13, 4176, 568, 315, 1915, 300, 3971, 297, 3017, 29941, 13, 15945, 29908, 13, 13, 29937, 29849, 5821, 731, 21245, 8789, 975, 1320, 13239, 13, 5215, 337, 13, 5215, 10876, 13, 29937, 1763, 671, 263, 13747, 8025, 13, 3166, 775, 2395, 1053, 1722, 13, 3166, 2897, 1053, 2224, 13, 13, 3166, 731, 21245, 8789, 1053, 1284, 29918, 8318, 29892, 6230, 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, 29878, 303, 5477, 8025, 2433, 9420, 29899, 29947, 1495, 408, 285, 29901, 13, 1678, 1472, 29918, 8216, 353, 285, 29889, 949, 580, 13, 13, 14669, 29898, 13, 13, 1678, 1024, 2433, 22793, 742, 13, 13, 1678, 396, 10138, 1080, 881, 752, 368, 411, 349, 15488, 29946, 29946, 29900, 29889, 29871, 1152, 263, 10679, 373, 2323, 29899, 29879, 473, 3277, 13, 1678, 396, 278, 1873, 4822, 6230, 29889, 2272, 322, 278, 2060, 775, 29892, 1074, 13, 1678, 396, 2045, 597, 4058, 6751, 29889, 4691, 29889, 990, 29914, 264, 29914, 12333, 29914, 14369, 29918, 4993, 29918, 3259, 29889, 1420, 13, 1678, 1873, 2433, 29900, 29889, 29906, 29889, 29900, 742, 13, 13, 1678, 6139, 2433, 4176, 568, 315, 1915, 300, 3971, 297, 3017, 29941, 742, 13, 13, 1678, 1472, 29918, 8216, 29922, 5426, 29918, 8216, 29892, 13, 13, 1678, 396, 450, 2060, 29915, 29879, 1667, 3271, 3488, 29889, 13, 1678, 3142, 2433, 991, 597, 3292, 29889, 510, 29914, 12938, 29906, 29945, 29941, 29914, 4176, 568, 1525, 7390, 742, 13, 13, 1678, 396, 13361, 4902, 13, 1678, 4148, 2433, 29966, 5813, 29958, 742, 13, 13, 1678, 4148, 29918, 5269, 2433, 29966, 26862, 6227, 29958, 742, 13, 13, 1678, 396, 14542, 852, 596, 19405, 13, 1678, 19405, 2433, 26349, 742, 13, 13, 1678, 770, 14903, 11759, 13, 4706, 525, 21956, 358, 16034, 4761, 29871, 29941, 448, 838, 2026, 742, 13, 4706, 525, 2928, 2760, 319, 4749, 663, 4761, 10682, 414, 742, 13, 4706, 525, 7031, 293, 4761, 5470, 4761, 13960, 29899, 5044, 29879, 742, 13, 4706, 525, 29931, 293, 1947, 4761, 438, 5425, 28268, 1490, 4761, 341, 1806, 19245, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29945, 742, 13, 4706, 525, 9283, 4056, 17088, 4761, 5132, 4761, 29871, 29941, 29889, 29953, 742, 13, 1678, 21251, 13, 13, 1678, 29361, 2433, 9803, 18074, 645, 568, 29941, 21120, 1067, 10157, 23299, 9508, 29899, 10154, 7354, 9508, 29918, 10154, 7354, 742, 13, 13, 1678, 9741, 29922, 2886, 29918, 8318, 3285, 13, 13, 1678, 396, 2391, 1065, 29899, 2230, 9962, 1244, 29889, 29871, 4525, 674, 367, 5130, 491, 8450, 746, 13, 1678, 396, 596, 2060, 338, 5130, 29889, 1152, 385, 7418, 310, 376, 6252, 29918, 276, 339, 2658, 29908, 7186, 8450, 29915, 29879, 13, 1678, 396, 11780, 2066, 1074, 29901, 13, 1678, 396, 2045, 597, 4058, 6751, 29889, 4691, 29889, 990, 29914, 264, 29914, 12333, 29914, 12277, 1860, 29889, 1420, 13, 13, 1678, 2601, 29918, 276, 339, 2658, 29922, 1839, 14032, 415, 29918, 10154, 7354, 742, 525, 3891, 5987, 742, 525, 2272, 29887, 1860, 7464, 13, 13, 1678, 6251, 29918, 9748, 3790, 13, 4706, 525, 11058, 29918, 16713, 2396, 6024, 22793, 353, 21120, 29889, 3396, 29901, 3396, 2033, 13, 4706, 5615, 13, 2 ]
tools/go_generics/defs.bzl
Exhorder6/gvisor
12,536
90835
<reponame>Exhorder6/gvisor<gh_stars>1000+ """Generics support via go_generics. A Go template is similar to a go library, except that it has certain types that can be replaced before usage. For example, one could define a templatized List struct, whose elements are of type T, then instantiate that template for T=segment, where "segment" is the concrete type. """ TemplateInfo = provider( "Information about a go_generics template.", fields = { "unsafe": "whether the template requires unsafe code", "types": "required types", "opt_types": "optional types", "consts": "required consts", "opt_consts": "optional consts", "deps": "package dependencies", "template": "merged template source file", }, ) def _go_template_impl(ctx): srcs = ctx.files.srcs template = ctx.actions.declare_file(ctx.label.name + "_template.go") args = ["-o=%s" % template.path] + [f.path for f in srcs] ctx.actions.run( inputs = srcs, outputs = [template], mnemonic = "GoGenericsTemplate", progress_message = "Building Go template %s" % ctx.label, arguments = args, executable = ctx.executable._tool, ) return [TemplateInfo( types = ctx.attr.types, opt_types = ctx.attr.opt_types, consts = ctx.attr.consts, opt_consts = ctx.attr.opt_consts, deps = ctx.attr.deps, template = template, )] go_template = rule( implementation = _go_template_impl, attrs = { "srcs": attr.label_list(doc = "the list of source files that comprise the template", mandatory = True, allow_files = True), "deps": attr.label_list(doc = "the standard dependency list", allow_files = True, cfg = "target"), "types": attr.string_list(doc = "the list of generic types in the template that are required to be specified"), "opt_types": attr.string_list(doc = "the list of generic types in the template that can but aren't required to be specified"), "consts": attr.string_list(doc = "the list of constants in the template that are required to be specified"), "opt_consts": attr.string_list(doc = "the list of constants in the template that can but aren't required to be specified"), "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_generics/go_merge")), }, ) def _go_template_instance_impl(ctx): info = ctx.attr.template[TemplateInfo] output = ctx.outputs.out # Check that all required types are defined. for t in info.types: if t not in ctx.attr.types: fail("Missing value for type %s in %s" % (t, ctx.attr.template.label)) # Check that all defined types are expected by the template. for t in ctx.attr.types: if (t not in info.types) and (t not in info.opt_types): fail("Type %s is not a parameter to %s" % (t, ctx.attr.template.label)) # Check that all required consts are defined. for t in info.consts: if t not in ctx.attr.consts: fail("Missing value for constant %s in %s" % (t, ctx.attr.template.label)) # Check that all defined consts are expected by the template. for t in ctx.attr.consts: if (t not in info.consts) and (t not in info.opt_consts): fail("Const %s is not a parameter to %s" % (t, ctx.attr.template.label)) # Build the argument list. args = ["-i=%s" % info.template.path, "-o=%s" % output.path] if ctx.attr.package: args.append("-p=%s" % ctx.attr.package) if len(ctx.attr.prefix) > 0: args.append("-prefix=%s" % ctx.attr.prefix) if len(ctx.attr.suffix) > 0: args.append("-suffix=%s" % ctx.attr.suffix) args += [("-t=%s=%s" % (p[0], p[1])) for p in ctx.attr.types.items()] args += [("-c=%s=%s" % (p[0], p[1])) for p in ctx.attr.consts.items()] args += [("-import=%s=%s" % (p[0], p[1])) for p in ctx.attr.imports.items()] if ctx.attr.anon: args.append("-anon") ctx.actions.run( inputs = [info.template], outputs = [output], mnemonic = "GoGenericsInstance", progress_message = "Building Go template instance %s" % ctx.label, arguments = args, executable = ctx.executable._tool, ) return [DefaultInfo( files = depset([output]), )] go_template_instance = rule( implementation = _go_template_instance_impl, attrs = { "template": attr.label(doc = "the label of the template to be instantiated", mandatory = True), "prefix": attr.string(doc = "a prefix to be added to globals in the template"), "suffix": attr.string(doc = "a suffix to be added to globals in the template"), "types": attr.string_dict(doc = "the map from generic type names to concrete ones"), "consts": attr.string_dict(doc = "the map from constant names to their values"), "imports": attr.string_dict(doc = "the map from imports used in types/consts to their import paths"), "anon": attr.bool(doc = "whether anoymous fields should be processed", mandatory = False, default = False), "package": attr.string(doc = "the package for the generated source file", mandatory = False), "out": attr.output(doc = "output file", mandatory = True), "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_generics")), }, )
[ 1, 529, 276, 1112, 420, 29958, 1252, 29882, 2098, 29953, 29914, 29887, 19188, 29966, 12443, 29918, 303, 1503, 29958, 29896, 29900, 29900, 29900, 29974, 13, 15945, 29908, 5631, 1199, 2304, 3025, 748, 29918, 4738, 1199, 29889, 13, 13, 29909, 2921, 4472, 338, 2788, 304, 263, 748, 3489, 29892, 5174, 393, 372, 756, 3058, 4072, 393, 13, 3068, 367, 8611, 1434, 8744, 29889, 1152, 1342, 29892, 697, 1033, 4529, 263, 1350, 572, 271, 1891, 2391, 13, 4984, 29892, 5069, 3161, 526, 310, 1134, 323, 29892, 769, 25112, 393, 4472, 363, 13, 29911, 29922, 28192, 29892, 988, 376, 28192, 29908, 338, 278, 18387, 1134, 29889, 13, 15945, 29908, 13, 13, 6733, 3401, 353, 13113, 29898, 13, 1678, 376, 20350, 1048, 263, 748, 29918, 4738, 1199, 4472, 19602, 13, 1678, 4235, 353, 426, 13, 4706, 376, 348, 11177, 1115, 376, 1332, 1979, 278, 4472, 6858, 25110, 775, 613, 13, 4706, 376, 8768, 1115, 376, 12403, 4072, 613, 13, 4706, 376, 3670, 29918, 8768, 1115, 376, 25253, 4072, 613, 13, 4706, 376, 3075, 29879, 1115, 376, 12403, 1040, 29879, 613, 13, 4706, 376, 3670, 29918, 3075, 29879, 1115, 376, 25253, 1040, 29879, 613, 13, 4706, 376, 311, 567, 1115, 376, 5113, 9962, 613, 13, 4706, 376, 6886, 1115, 376, 1050, 3192, 4472, 2752, 934, 613, 13, 1678, 2981, 13, 29897, 13, 13, 1753, 903, 1484, 29918, 6886, 29918, 13699, 29898, 13073, 1125, 13, 1678, 4765, 29879, 353, 12893, 29889, 5325, 29889, 4351, 29879, 13, 1678, 4472, 353, 12893, 29889, 7387, 29889, 7099, 8663, 29918, 1445, 29898, 13073, 29889, 1643, 29889, 978, 718, 11119, 6886, 29889, 1484, 1159, 13, 1678, 6389, 353, 6796, 29899, 29877, 16328, 29879, 29908, 1273, 4472, 29889, 2084, 29962, 718, 518, 29888, 29889, 2084, 363, 285, 297, 4765, 29879, 29962, 13, 13, 1678, 12893, 29889, 7387, 29889, 3389, 29898, 13, 4706, 10970, 353, 4765, 29879, 29892, 13, 4706, 14391, 353, 518, 6886, 1402, 13, 4706, 286, 15344, 8927, 353, 376, 8120, 5631, 1199, 6733, 613, 13, 4706, 6728, 29918, 4906, 353, 376, 8893, 292, 2921, 4472, 1273, 29879, 29908, 1273, 12893, 29889, 1643, 29892, 13, 4706, 6273, 353, 6389, 29892, 13, 4706, 16813, 353, 12893, 29889, 4258, 9246, 3032, 10154, 29892, 13, 1678, 1723, 13, 13, 1678, 736, 518, 6733, 3401, 29898, 13, 4706, 4072, 353, 12893, 29889, 5552, 29889, 8768, 29892, 13, 4706, 3523, 29918, 8768, 353, 12893, 29889, 5552, 29889, 3670, 29918, 8768, 29892, 13, 4706, 1040, 29879, 353, 12893, 29889, 5552, 29889, 3075, 29879, 29892, 13, 4706, 3523, 29918, 3075, 29879, 353, 12893, 29889, 5552, 29889, 3670, 29918, 3075, 29879, 29892, 13, 4706, 316, 567, 353, 12893, 29889, 5552, 29889, 311, 567, 29892, 13, 4706, 4472, 353, 4472, 29892, 13, 1678, 1723, 29962, 13, 13, 1484, 29918, 6886, 353, 5751, 29898, 13, 1678, 5314, 353, 903, 1484, 29918, 6886, 29918, 13699, 29892, 13, 1678, 12421, 29879, 353, 426, 13, 4706, 376, 4351, 29879, 1115, 12421, 29889, 1643, 29918, 1761, 29898, 1514, 353, 376, 1552, 1051, 310, 2752, 2066, 393, 7199, 895, 278, 4472, 613, 9619, 7606, 353, 5852, 29892, 2758, 29918, 5325, 353, 5852, 511, 13, 4706, 376, 311, 567, 1115, 12421, 29889, 1643, 29918, 1761, 29898, 1514, 353, 376, 1552, 3918, 10609, 1051, 613, 2758, 29918, 5325, 353, 5852, 29892, 274, 16434, 353, 376, 5182, 4968, 13, 4706, 376, 8768, 1115, 12421, 29889, 1807, 29918, 1761, 29898, 1514, 353, 376, 1552, 1051, 310, 10035, 4072, 297, 278, 4472, 393, 526, 3734, 304, 367, 6790, 4968, 13, 4706, 376, 3670, 29918, 8768, 1115, 12421, 29889, 1807, 29918, 1761, 29898, 1514, 353, 376, 1552, 1051, 310, 10035, 4072, 297, 278, 4472, 393, 508, 541, 9455, 29915, 29873, 3734, 304, 367, 6790, 4968, 13, 4706, 376, 3075, 29879, 1115, 12421, 29889, 1807, 29918, 1761, 29898, 1514, 353, 376, 1552, 1051, 310, 17727, 297, 278, 4472, 393, 526, 3734, 304, 367, 6790, 4968, 13, 4706, 376, 3670, 29918, 3075, 29879, 1115, 12421, 29889, 1807, 29918, 1761, 29898, 1514, 353, 376, 1552, 1051, 310, 17727, 297, 278, 4472, 393, 508, 541, 9455, 29915, 29873, 3734, 304, 367, 6790, 4968, 13, 4706, 11119, 10154, 1115, 12421, 29889, 1643, 29898, 4258, 9246, 353, 5852, 29892, 274, 16434, 353, 376, 3069, 613, 2322, 353, 15796, 703, 458, 8504, 29914, 1484, 29918, 4738, 1199, 29914, 1484, 29918, 14634, 1159, 511, 13, 1678, 2981, 13, 29897, 13, 13, 1753, 903, 1484, 29918, 6886, 29918, 8758, 29918, 13699, 29898, 13073, 1125, 13, 1678, 5235, 353, 12893, 29889, 5552, 29889, 6886, 29961, 6733, 3401, 29962, 13, 1678, 1962, 353, 12893, 29889, 4905, 29879, 29889, 449, 13, 13, 1678, 396, 5399, 393, 599, 3734, 4072, 526, 3342, 29889, 13, 1678, 363, 260, 297, 5235, 29889, 8768, 29901, 13, 4706, 565, 260, 451, 297, 12893, 29889, 5552, 29889, 8768, 29901, 13, 9651, 4418, 703, 18552, 292, 995, 363, 1134, 1273, 29879, 297, 1273, 29879, 29908, 1273, 313, 29873, 29892, 12893, 29889, 5552, 29889, 6886, 29889, 1643, 876, 13, 13, 1678, 396, 5399, 393, 599, 3342, 4072, 526, 3806, 491, 278, 4472, 29889, 13, 1678, 363, 260, 297, 12893, 29889, 5552, 29889, 8768, 29901, 13, 4706, 565, 313, 29873, 451, 297, 5235, 29889, 8768, 29897, 322, 313, 29873, 451, 297, 5235, 29889, 3670, 29918, 8768, 1125, 13, 9651, 4418, 703, 1542, 1273, 29879, 338, 451, 263, 3443, 304, 1273, 29879, 29908, 1273, 313, 29873, 29892, 12893, 29889, 5552, 29889, 6886, 29889, 1643, 876, 13, 13, 1678, 396, 5399, 393, 599, 3734, 1040, 29879, 526, 3342, 29889, 13, 1678, 363, 260, 297, 5235, 29889, 3075, 29879, 29901, 13, 4706, 565, 260, 451, 297, 12893, 29889, 5552, 29889, 3075, 29879, 29901, 13, 9651, 4418, 703, 18552, 292, 995, 363, 4868, 1273, 29879, 297, 1273, 29879, 29908, 1273, 313, 29873, 29892, 12893, 29889, 5552, 29889, 6886, 29889, 1643, 876, 13, 13, 1678, 396, 5399, 393, 599, 3342, 1040, 29879, 526, 3806, 491, 278, 4472, 29889, 13, 1678, 363, 260, 297, 12893, 29889, 5552, 29889, 3075, 29879, 29901, 13, 4706, 565, 313, 29873, 451, 297, 5235, 29889, 3075, 29879, 29897, 322, 313, 29873, 451, 297, 5235, 29889, 3670, 29918, 3075, 29879, 1125, 13, 9651, 4418, 703, 12075, 1273, 29879, 338, 451, 263, 3443, 304, 1273, 29879, 29908, 1273, 313, 29873, 29892, 12893, 29889, 5552, 29889, 6886, 29889, 1643, 876, 13, 13, 1678, 396, 8878, 278, 2980, 1051, 29889, 13, 1678, 6389, 353, 6796, 29899, 29875, 16328, 29879, 29908, 1273, 5235, 29889, 6886, 29889, 2084, 29892, 11663, 29877, 16328, 29879, 29908, 1273, 1962, 29889, 2084, 29962, 13, 1678, 565, 12893, 29889, 5552, 29889, 5113, 29901, 13, 4706, 6389, 29889, 4397, 703, 29899, 29886, 16328, 29879, 29908, 1273, 12893, 29889, 5552, 29889, 5113, 29897, 13, 13, 1678, 565, 7431, 29898, 13073, 29889, 5552, 29889, 13506, 29897, 1405, 29871, 29900, 29901, 13, 4706, 6389, 29889, 4397, 703, 29899, 13506, 16328, 29879, 29908, 1273, 12893, 29889, 5552, 29889, 13506, 29897, 13, 13, 1678, 565, 7431, 29898, 13073, 29889, 5552, 29889, 2146, 600, 861, 29897, 1405, 29871, 29900, 29901, 13, 4706, 6389, 29889, 4397, 703, 29899, 2146, 600, 861, 16328, 29879, 29908, 1273, 12893, 29889, 5552, 29889, 2146, 600, 861, 29897, 13, 13, 1678, 6389, 4619, 518, 703, 29899, 29873, 16328, 29879, 16328, 29879, 29908, 1273, 313, 29886, 29961, 29900, 1402, 282, 29961, 29896, 12622, 363, 282, 297, 12893, 29889, 5552, 29889, 8768, 29889, 7076, 580, 29962, 13, 1678, 6389, 4619, 518, 703, 29899, 29883, 16328, 29879, 16328, 29879, 29908, 1273, 313, 29886, 29961, 29900, 1402, 282, 29961, 29896, 12622, 363, 282, 297, 12893, 29889, 5552, 29889, 3075, 29879, 29889, 7076, 580, 29962, 13, 1678, 6389, 4619, 518, 703, 29899, 5215, 16328, 29879, 16328, 29879, 29908, 1273, 313, 29886, 29961, 29900, 1402, 282, 29961, 29896, 12622, 363, 282, 297, 12893, 29889, 5552, 29889, 326, 4011, 29889, 7076, 580, 29962, 13, 13, 1678, 565, 12893, 29889, 5552, 29889, 19930, 29901, 13, 4706, 6389, 29889, 4397, 703, 29899, 19930, 1159, 13, 13, 1678, 12893, 29889, 7387, 29889, 3389, 29898, 13, 4706, 10970, 353, 518, 3888, 29889, 6886, 1402, 13, 4706, 14391, 353, 518, 4905, 1402, 13, 4706, 286, 15344, 8927, 353, 376, 8120, 5631, 1199, 4998, 613, 13, 4706, 6728, 29918, 4906, 353, 376, 8893, 292, 2921, 4472, 2777, 1273, 29879, 29908, 1273, 12893, 29889, 1643, 29892, 13, 4706, 6273, 353, 6389, 29892, 13, 4706, 16813, 353, 12893, 29889, 4258, 9246, 3032, 10154, 29892, 13, 1678, 1723, 13, 13, 1678, 736, 518, 4592, 3401, 29898, 13, 4706, 2066, 353, 316, 567, 300, 4197, 4905, 11724, 13, 1678, 1723, 29962, 13, 13, 1484, 29918, 6886, 29918, 8758, 353, 5751, 29898, 13, 1678, 5314, 353, 903, 1484, 29918, 6886, 29918, 8758, 29918, 13699, 29892, 13, 1678, 12421, 29879, 353, 426, 13, 4706, 376, 6886, 1115, 12421, 29889, 1643, 29898, 1514, 353, 376, 1552, 3858, 310, 278, 4472, 304, 367, 13213, 630, 613, 9619, 7606, 353, 5852, 511, 13, 4706, 376, 13506, 1115, 12421, 29889, 1807, 29898, 1514, 353, 376, 29874, 10944, 304, 367, 2715, 304, 13149, 1338, 297, 278, 4472, 4968, 13, 4706, 376, 2146, 600, 861, 1115, 12421, 29889, 1807, 29898, 1514, 353, 376, 29874, 25557, 304, 367, 2715, 304, 13149, 1338, 297, 278, 4472, 4968, 13, 4706, 376, 8768, 1115, 12421, 29889, 1807, 29918, 8977, 29898, 1514, 353, 376, 1552, 2910, 515, 10035, 1134, 2983, 304, 18387, 6743, 4968, 13, 4706, 376, 3075, 29879, 1115, 12421, 29889, 1807, 29918, 8977, 29898, 1514, 353, 376, 1552, 2910, 515, 4868, 2983, 304, 1009, 1819, 4968, 13, 4706, 376, 326, 4011, 1115, 12421, 29889, 1807, 29918, 8977, 29898, 1514, 353, 376, 1552, 2910, 515, 24802, 1304, 297, 4072, 29914, 3075, 29879, 304, 1009, 1053, 10898, 4968, 13, 4706, 376, 19930, 1115, 12421, 29889, 11227, 29898, 1514, 353, 376, 1332, 1979, 19410, 962, 681, 4235, 881, 367, 19356, 613, 9619, 7606, 353, 7700, 29892, 2322, 353, 7700, 511, 13, 4706, 376, 5113, 1115, 12421, 29889, 1807, 29898, 1514, 353, 376, 1552, 3577, 363, 278, 5759, 2752, 934, 613, 9619, 7606, 353, 7700, 511, 13, 4706, 376, 449, 1115, 12421, 29889, 4905, 29898, 1514, 353, 376, 4905, 934, 613, 9619, 7606, 353, 5852, 511, 13, 4706, 11119, 10154, 1115, 12421, 29889, 1643, 29898, 4258, 9246, 353, 5852, 29892, 274, 16434, 353, 376, 3069, 613, 2322, 353, 15796, 703, 458, 8504, 29914, 1484, 29918, 4738, 1199, 1159, 511, 13, 1678, 2981, 13, 29897, 13, 2 ]
help_functions.py
markozeman/TransformerSuperposition
0
131508
<reponame>markozeman/TransformerSuperposition<gh_stars>0 import numpy as np import torch from sklearn.metrics import roc_auc_score, classification_report, confusion_matrix from sklearn.metrics import average_precision_score ''' def load_data(dataset): """ Load ELMo embeddings for 'dataset'. :param dataset: string name of the datast :return: X_train, y_train, X_test, y_test """ X_train = np.load('ELMo_embeddings/%s/X_train_all.npy' % dataset, allow_pickle=True) y_train = np.load('ELMo_embeddings/%s/train_labels.npy' % dataset, allow_pickle=True) X_test = np.load('ELMo_embeddings/%s/X_test_all.npy' % dataset, allow_pickle=True) y_test = np.load('ELMo_embeddings/%s/test_labels.npy' % dataset, allow_pickle=True) return X_train, y_train, X_test, y_test ''' def count_trainable_parameters(model): """ Count the number of trainable model parameters. :param model: torch model instance :return: the number of trainable model parameters """ return sum(p.numel() for p in model.parameters() if p.requires_grad) def get_stats(outputs, y): """ Get statistics for given model outputs and true predictions 'y'. :param outputs: list of model predictions, each element of the list has a size (batch_size, 2) :param y: tensor of true labels (size equals to number of samples) :return: (accuracy, AUROC, AUPRC) """ outputs = torch.cat(outputs, dim=0) probs = torch.squeeze(torch.softmax(outputs, dim=1)) probs = probs.cpu().detach().numpy() true = y.cpu().detach().numpy() auroc = roc_auc_score(true, probs[:, 1]) auprc = average_precision_score(true, probs[:, 1]) predicted = np.argmax(outputs.cpu().detach().numpy(), axis=1).ravel() acc = np.sum(true == predicted) / true.shape[0] return acc, auroc, auprc def remove_empty_values(metric_epoch, num_tasks, num_epochs): """ Remove empty values from 'metric_epoch', where there are zeros at some epochs (because of early stopping). :param metric_epoch: array of size (num_runs, num_tasks * num_epochs) with 0 values where early stopping occured :param num_tasks: number of tasks :param num_epochs: number of epochs per task :return: array of size (num_runs, num_tasks) with final metric value for each task in each run """ epoch_no0 = [] for row_i in range(len(metric_epoch)): row = metric_epoch[row_i] epoch_no0_row = [] for task_i in range(num_tasks): index = ((task_i + 1) * num_epochs) - 1 # index of the last measured metric for each task while row[index] == 0: index -= 1 epoch_no0_row.append(row[index]) epoch_no0.append(epoch_no0_row) return epoch_no0 def get_model_outputs(model, batch_X, batch_mask, use_MLP, use_PSP, contexts, task_index): """ Get model outputs with the forward pass of the batch of input data (batch_X). :param model: torch model instance :param batch_X: a batch of input data :param batch_mask: a batch of input data masks if used :param use_MLP: boolean - if True use MLP, else use Transformer :param use_PSP: boolean - if True, PSP method is used, meaning we need set of contexts for each task (including the first) :param contexts: contexts: binary context vectors :param task_index: index of the current task, which is being learned :return: batch model output """ if use_PSP: if use_MLP: return model.forward(batch_X, use_PSP, contexts, task_index) else: return model.forward(batch_X, batch_mask, use_PSP, contexts, task_index) else: if use_MLP: return model.forward(batch_X) else: return model.forward(batch_X, batch_mask)
[ 1, 529, 276, 1112, 420, 29958, 3502, 2112, 11422, 29914, 13372, 261, 19111, 3283, 29966, 12443, 29918, 303, 1503, 29958, 29900, 13, 5215, 12655, 408, 7442, 13, 5215, 4842, 305, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 696, 29883, 29918, 14766, 29918, 13628, 29892, 12965, 29918, 12276, 29892, 14679, 29918, 5344, 13, 3166, 2071, 19668, 29889, 2527, 10817, 1053, 6588, 29918, 17990, 2459, 29918, 13628, 13, 13, 13, 12008, 13, 1753, 2254, 29918, 1272, 29898, 24713, 1125, 13, 1678, 9995, 13, 1678, 16012, 14845, 22638, 8297, 29881, 886, 363, 525, 24713, 4286, 13, 13, 1678, 584, 3207, 8783, 29901, 1347, 1024, 310, 278, 1418, 579, 13, 1678, 584, 2457, 29901, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 13, 1678, 9995, 13, 1678, 1060, 29918, 14968, 353, 7442, 29889, 1359, 877, 6670, 22638, 29918, 17987, 29881, 886, 22584, 29879, 29914, 29990, 29918, 14968, 29918, 497, 29889, 29876, 2272, 29915, 1273, 8783, 29892, 2758, 29918, 23945, 280, 29922, 5574, 29897, 13, 1678, 343, 29918, 14968, 353, 7442, 29889, 1359, 877, 6670, 22638, 29918, 17987, 29881, 886, 22584, 29879, 29914, 14968, 29918, 21134, 29889, 29876, 2272, 29915, 1273, 8783, 29892, 2758, 29918, 23945, 280, 29922, 5574, 29897, 13, 1678, 1060, 29918, 1688, 353, 7442, 29889, 1359, 877, 6670, 22638, 29918, 17987, 29881, 886, 22584, 29879, 29914, 29990, 29918, 1688, 29918, 497, 29889, 29876, 2272, 29915, 1273, 8783, 29892, 2758, 29918, 23945, 280, 29922, 5574, 29897, 13, 1678, 343, 29918, 1688, 353, 7442, 29889, 1359, 877, 6670, 22638, 29918, 17987, 29881, 886, 22584, 29879, 29914, 1688, 29918, 21134, 29889, 29876, 2272, 29915, 1273, 8783, 29892, 2758, 29918, 23945, 280, 29922, 5574, 29897, 13, 1678, 736, 1060, 29918, 14968, 29892, 343, 29918, 14968, 29892, 1060, 29918, 1688, 29892, 343, 29918, 1688, 13, 12008, 13, 13, 13, 1753, 2302, 29918, 14968, 519, 29918, 16744, 29898, 4299, 1125, 13, 1678, 9995, 13, 1678, 3917, 278, 1353, 310, 7945, 519, 1904, 4128, 29889, 13, 13, 1678, 584, 3207, 1904, 29901, 4842, 305, 1904, 2777, 13, 1678, 584, 2457, 29901, 278, 1353, 310, 7945, 519, 1904, 4128, 13, 1678, 9995, 13, 1678, 736, 2533, 29898, 29886, 29889, 1949, 295, 580, 363, 282, 297, 1904, 29889, 16744, 580, 565, 282, 29889, 276, 339, 2658, 29918, 5105, 29897, 13, 13, 13, 1753, 679, 29918, 16202, 29898, 4905, 29879, 29892, 343, 1125, 13, 1678, 9995, 13, 1678, 3617, 13964, 363, 2183, 1904, 14391, 322, 1565, 27303, 525, 29891, 4286, 13, 13, 1678, 584, 3207, 14391, 29901, 1051, 310, 1904, 27303, 29892, 1269, 1543, 310, 278, 1051, 756, 263, 2159, 313, 16175, 29918, 2311, 29892, 29871, 29906, 29897, 13, 1678, 584, 3207, 343, 29901, 12489, 310, 1565, 11073, 313, 2311, 15743, 304, 1353, 310, 11916, 29897, 13, 1678, 584, 2457, 29901, 313, 562, 2764, 4135, 29892, 319, 29965, 1672, 29907, 29892, 319, 4897, 10363, 29897, 13, 1678, 9995, 13, 1678, 14391, 353, 4842, 305, 29889, 4117, 29898, 4905, 29879, 29892, 3964, 29922, 29900, 29897, 13, 1678, 2070, 29879, 353, 4842, 305, 29889, 29879, 802, 29872, 911, 29898, 7345, 305, 29889, 2695, 3317, 29898, 4905, 29879, 29892, 3964, 29922, 29896, 876, 13, 1678, 2070, 29879, 353, 2070, 29879, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 1565, 353, 343, 29889, 21970, 2141, 4801, 496, 2141, 23749, 580, 13, 1678, 782, 10198, 353, 696, 29883, 29918, 14766, 29918, 13628, 29898, 3009, 29892, 2070, 29879, 7503, 29892, 29871, 29896, 2314, 13, 1678, 782, 558, 29883, 353, 6588, 29918, 17990, 2459, 29918, 13628, 29898, 3009, 29892, 2070, 29879, 7503, 29892, 29871, 29896, 2314, 13, 1678, 25383, 353, 7442, 29889, 1191, 3317, 29898, 4905, 29879, 29889, 21970, 2141, 4801, 496, 2141, 23749, 3285, 9685, 29922, 29896, 467, 336, 955, 580, 13, 1678, 1035, 353, 7442, 29889, 2083, 29898, 3009, 1275, 25383, 29897, 847, 1565, 29889, 12181, 29961, 29900, 29962, 13, 1678, 736, 1035, 29892, 782, 10198, 29892, 782, 558, 29883, 13, 13, 13, 1753, 3349, 29918, 6310, 29918, 5975, 29898, 16414, 29918, 1022, 2878, 29892, 954, 29918, 20673, 29892, 954, 29918, 1022, 2878, 29879, 1125, 13, 1678, 9995, 13, 1678, 15154, 4069, 1819, 515, 525, 16414, 29918, 1022, 2878, 742, 988, 727, 526, 24786, 472, 777, 21502, 12168, 313, 18103, 310, 4688, 25480, 467, 13, 13, 1678, 584, 3207, 12714, 29918, 1022, 2878, 29901, 1409, 310, 2159, 313, 1949, 29918, 3389, 29879, 29892, 954, 29918, 20673, 334, 954, 29918, 1022, 2878, 29879, 29897, 411, 29871, 29900, 1819, 988, 4688, 25480, 2179, 2955, 13, 1678, 584, 3207, 954, 29918, 20673, 29901, 1353, 310, 9595, 13, 1678, 584, 3207, 954, 29918, 1022, 2878, 29879, 29901, 1353, 310, 21502, 12168, 639, 3414, 13, 1678, 584, 2457, 29901, 1409, 310, 2159, 313, 1949, 29918, 3389, 29879, 29892, 954, 29918, 20673, 29897, 411, 2186, 12714, 995, 363, 1269, 3414, 297, 1269, 1065, 13, 1678, 9995, 13, 1678, 21502, 305, 29918, 1217, 29900, 353, 5159, 13, 1678, 363, 1948, 29918, 29875, 297, 3464, 29898, 2435, 29898, 16414, 29918, 1022, 2878, 22164, 13, 4706, 1948, 353, 12714, 29918, 1022, 2878, 29961, 798, 29918, 29875, 29962, 13, 4706, 21502, 305, 29918, 1217, 29900, 29918, 798, 353, 5159, 13, 4706, 363, 3414, 29918, 29875, 297, 3464, 29898, 1949, 29918, 20673, 1125, 13, 9651, 2380, 353, 5135, 7662, 29918, 29875, 718, 29871, 29896, 29897, 334, 954, 29918, 1022, 2878, 29879, 29897, 448, 29871, 29896, 29871, 396, 2380, 310, 278, 1833, 17005, 12714, 363, 1269, 3414, 13, 9651, 1550, 1948, 29961, 2248, 29962, 1275, 29871, 29900, 29901, 13, 18884, 2380, 22361, 29871, 29896, 13, 9651, 21502, 305, 29918, 1217, 29900, 29918, 798, 29889, 4397, 29898, 798, 29961, 2248, 2314, 13, 4706, 21502, 305, 29918, 1217, 29900, 29889, 4397, 29898, 1022, 2878, 29918, 1217, 29900, 29918, 798, 29897, 13, 1678, 736, 21502, 305, 29918, 1217, 29900, 13, 13, 13, 1753, 679, 29918, 4299, 29918, 4905, 29879, 29898, 4299, 29892, 9853, 29918, 29990, 29892, 9853, 29918, 13168, 29892, 671, 29918, 1988, 29925, 29892, 671, 29918, 29925, 5550, 29892, 3030, 29879, 29892, 3414, 29918, 2248, 1125, 13, 1678, 9995, 13, 1678, 3617, 1904, 14391, 411, 278, 6375, 1209, 310, 278, 9853, 310, 1881, 848, 313, 16175, 29918, 29990, 467, 13, 13, 1678, 584, 3207, 1904, 29901, 4842, 305, 1904, 2777, 13, 1678, 584, 3207, 9853, 29918, 29990, 29901, 263, 9853, 310, 1881, 848, 13, 1678, 584, 3207, 9853, 29918, 13168, 29901, 263, 9853, 310, 1881, 848, 11105, 29879, 565, 1304, 13, 1678, 584, 3207, 671, 29918, 1988, 29925, 29901, 7223, 448, 565, 5852, 671, 341, 13208, 29892, 1683, 671, 4103, 24784, 13, 1678, 584, 3207, 671, 29918, 29925, 5550, 29901, 7223, 448, 565, 5852, 29892, 349, 5550, 1158, 338, 1304, 29892, 6593, 591, 817, 731, 310, 3030, 29879, 363, 1269, 3414, 313, 18271, 278, 937, 29897, 13, 1678, 584, 3207, 3030, 29879, 29901, 3030, 29879, 29901, 7581, 3030, 12047, 13, 1678, 584, 3207, 3414, 29918, 2248, 29901, 2380, 310, 278, 1857, 3414, 29892, 607, 338, 1641, 10972, 13, 1678, 584, 2457, 29901, 9853, 1904, 1962, 13, 1678, 9995, 13, 1678, 565, 671, 29918, 29925, 5550, 29901, 13, 4706, 565, 671, 29918, 1988, 29925, 29901, 13, 9651, 736, 1904, 29889, 11333, 29898, 16175, 29918, 29990, 29892, 671, 29918, 29925, 5550, 29892, 3030, 29879, 29892, 3414, 29918, 2248, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1904, 29889, 11333, 29898, 16175, 29918, 29990, 29892, 9853, 29918, 13168, 29892, 671, 29918, 29925, 5550, 29892, 3030, 29879, 29892, 3414, 29918, 2248, 29897, 13, 1678, 1683, 29901, 13, 4706, 565, 671, 29918, 1988, 29925, 29901, 13, 9651, 736, 1904, 29889, 11333, 29898, 16175, 29918, 29990, 29897, 13, 4706, 1683, 29901, 13, 9651, 736, 1904, 29889, 11333, 29898, 16175, 29918, 29990, 29892, 9853, 29918, 13168, 29897, 13, 13, 2 ]
malaysiaflights/tests/test_mas.py
azam-a/malaysiaflights
2
80377
<gh_stars>1-10 import unittest import datetime import httpretty as HP import json from malaysiaflights.mas import MAS class MASRequestTests(unittest.TestCase): def url_helper(self, from_, to, date): host = 'https://flymh.mobi' path = ("/TravelAPI/travelapi/shop/1/mh/" "{from_}/{to}/1/0/0/Economy/{date}/").format(from_=from_, to=to, date=date) headers = {'X-apiKey': '52e6d6d613d3a3e825ac02253fe6b5a4', 'Accept': 'application/json'} return host, path, headers @HP.activate def test_search_calls_api_using_correct_path_and_headers(self): host, path, headers = self.url_helper('KUL', 'TGG', '2015-06-15') HP.register_uri(HP.GET, host+path, status=200) d = datetime.datetime(2015, 6, 15) MAS.search('KUL', 'TGG', d) mocked_request = HP.last_request() self.assertEqual(path, mocked_request.path) self.assertEqual(headers['X-apiKey'], mocked_request.headers['X-apiKey']) self.assertEqual(headers['Accept'], mocked_request.headers['Accept']) class ResponseExtractionTests(unittest.TestCase): def fixture_loader(self, path): prefix = 'malaysiaflights/fixtures/' with open(prefix + path, 'r') as file_: return json.loads(file_.read()) def setUp(self): self.single = self.fixture_loader('mas-single-econ.json') self.zero = self.fixture_loader('mas-no-flights.json') self.connecting = self.fixture_loader('mas-connecting.json') def test_get_number_of_results_for_valid_response(self): json = self.single actual = MAS.get_number_of_results(json) self.assertEqual(2, actual) def test_get_number_of_results_for_no_flights_on_date(self): json = self.zero actual = MAS.get_number_of_results(json) self.assertEqual(0, actual) def test_get_flight_details_using_index_0_should_return_results(self): json = self.single expected = { 'flight_number': 'MH1326', 'departure_airport': 'KUL', 'arrival_airport': 'TGG', 'departure_time': '2015-06-15T07:25:00.000+08:00', 'arrival_time': '2015-06-15T08:20:00.000+08:00', 'total_fare': '255.45', 'fare_currency': 'MYR'} actual = MAS.get_direct_flight_details(json, 0) self.assertEqual(expected, actual) def test_get_flight_details_using_index_1_should_return_results(self): json = self.single expected = { 'flight_number': 'MH1336', 'departure_airport': 'KUL', 'arrival_airport': 'TGG', 'departure_time': '2015-06-15T14:40:00.000+08:00', 'arrival_time': '2015-06-15T15:35:00.000+08:00', 'total_fare': '255.45', 'fare_currency': 'MYR'} actual = MAS.get_direct_flight_details(json, 1) self.assertEqual(expected, actual) def test_is_connecting_flights_should_return_true_for_connecting(self): json = self.connecting actual = MAS.is_connecting_flights(json, 0) self.assertTrue(actual) def test_is_connecting_flights_should_return_false_for_direct(self): json = self.connecting actual = MAS.is_connecting_flights(json, 2) self.assertFalse(actual) def test_get_connecting_flights_details_return_results(self): json = self.connecting expected = { 'flight_number': 'MH5305 + MH5396', 'departure_airport': 'KBR', 'arrival_airport': 'PEN', 'departure_time': '2015-06-20T13:25:00.000+08:00', 'arrival_time': '2015-06-20T18:10:00.000+08:00', 'total_fare': '313.20', 'fare_currency': 'MYR'} actual = MAS.get_connecting_flight_details(json, 5) self.assertEqual(expected, actual) class TimeConversionTest(unittest.TestCase): def test_convert_to_api_format_returns_correct_output(self): date_object = datetime.datetime(2015, 9, 25) expected = '2015-09-25' actual = MAS.to_api(date_object) self.assertEqual(expected, actual) def test_convert_extracted_time_to_datetime_returns_correct_object(self): offset = datetime.timedelta(hours=8) expected = datetime.datetime(2015, 6, 15, 14, 40, tzinfo=datetime.timezone(offset)) actual = MAS.to_datetime('2015-06-15T14:40:00.000+08:00') self.assertEqual(expected, actual)
[ 1, 529, 12443, 29918, 303, 1503, 29958, 29896, 29899, 29896, 29900, 13, 13, 5215, 443, 27958, 13, 5215, 12865, 13, 5215, 1143, 1457, 4349, 408, 379, 29925, 13, 5215, 4390, 13, 13, 3166, 4439, 1036, 423, 1579, 5861, 29889, 8247, 1053, 341, 3289, 13, 13, 13, 1990, 341, 3289, 3089, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 3142, 29918, 20907, 29898, 1311, 29892, 515, 3383, 304, 29892, 2635, 1125, 13, 13, 4706, 3495, 353, 525, 991, 597, 17652, 29885, 29882, 29889, 29885, 15647, 29915, 13, 4706, 2224, 353, 4852, 29914, 5323, 955, 8787, 29914, 3018, 955, 2754, 29914, 19032, 29914, 29896, 29914, 29885, 29882, 12975, 13, 18884, 29850, 3166, 29918, 6822, 29912, 517, 6822, 29896, 29914, 29900, 29914, 29900, 29914, 29923, 4599, 29891, 19248, 1256, 6822, 2564, 4830, 29898, 3166, 29918, 29922, 3166, 3383, 13, 462, 462, 462, 632, 304, 29922, 517, 29892, 2635, 29922, 1256, 29897, 13, 13, 4706, 9066, 353, 11117, 29990, 29899, 2754, 2558, 2396, 525, 29945, 29906, 29872, 29953, 29881, 29953, 29881, 29953, 29896, 29941, 29881, 29941, 29874, 29941, 29872, 29947, 29906, 29945, 562, 29900, 29906, 29906, 29945, 29941, 1725, 29953, 29890, 29945, 29874, 29946, 742, 13, 462, 259, 525, 23965, 2396, 525, 6214, 29914, 3126, 10827, 13, 13, 4706, 736, 3495, 29892, 2224, 29892, 9066, 13, 13, 1678, 732, 3954, 29889, 11236, 403, 13, 1678, 822, 1243, 29918, 4478, 29918, 29883, 4293, 29918, 2754, 29918, 4746, 29918, 15728, 29918, 2084, 29918, 392, 29918, 13662, 29898, 1311, 1125, 13, 4706, 3495, 29892, 2224, 29892, 9066, 353, 1583, 29889, 2271, 29918, 20907, 877, 29968, 13309, 742, 525, 29911, 26788, 742, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 1495, 13, 4706, 379, 29925, 29889, 9573, 29918, 5338, 29898, 3954, 29889, 7194, 29892, 3495, 29974, 2084, 29892, 4660, 29922, 29906, 29900, 29900, 29897, 13, 13, 4706, 270, 353, 12865, 29889, 12673, 29898, 29906, 29900, 29896, 29945, 29892, 29871, 29953, 29892, 29871, 29896, 29945, 29897, 13, 13, 4706, 341, 3289, 29889, 4478, 877, 29968, 13309, 742, 525, 29911, 26788, 742, 270, 29897, 13, 4706, 11187, 287, 29918, 3827, 353, 379, 29925, 29889, 4230, 29918, 3827, 580, 13, 13, 4706, 1583, 29889, 9294, 9843, 29898, 2084, 29892, 11187, 287, 29918, 3827, 29889, 2084, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 29990, 29899, 2754, 2558, 7464, 13, 462, 308, 11187, 287, 29918, 3827, 29889, 13662, 1839, 29990, 29899, 2754, 2558, 11287, 13, 4706, 1583, 29889, 9294, 9843, 29898, 13662, 1839, 23965, 7464, 13, 462, 308, 11187, 287, 29918, 3827, 29889, 13662, 1839, 23965, 11287, 13, 13, 13, 1990, 13291, 5647, 13857, 24376, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 5713, 15546, 29918, 12657, 29898, 1311, 29892, 2224, 1125, 13, 4706, 10944, 353, 525, 5156, 1036, 423, 1579, 5861, 29914, 7241, 486, 1973, 22208, 13, 4706, 411, 1722, 29898, 13506, 718, 2224, 29892, 525, 29878, 1495, 408, 934, 29918, 29901, 13, 9651, 736, 4390, 29889, 18132, 29898, 1445, 5396, 949, 3101, 13, 13, 1678, 822, 731, 3373, 29898, 1311, 1125, 13, 4706, 1583, 29889, 14369, 353, 1583, 29889, 7241, 15546, 29918, 12657, 877, 8247, 29899, 14369, 29899, 29872, 535, 29889, 3126, 1495, 13, 4706, 1583, 29889, 9171, 353, 1583, 29889, 7241, 15546, 29918, 12657, 877, 8247, 29899, 1217, 29899, 1579, 5861, 29889, 3126, 1495, 13, 4706, 1583, 29889, 6915, 292, 353, 1583, 29889, 7241, 15546, 29918, 12657, 877, 8247, 29899, 6915, 292, 29889, 3126, 1495, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 4537, 29918, 974, 29918, 9902, 29918, 1454, 29918, 3084, 29918, 5327, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 14369, 13, 4706, 3935, 353, 341, 3289, 29889, 657, 29918, 4537, 29918, 974, 29918, 9902, 29898, 3126, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29906, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 4537, 29918, 974, 29918, 9902, 29918, 1454, 29918, 1217, 29918, 1579, 5861, 29918, 265, 29918, 1256, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 9171, 13, 4706, 3935, 353, 341, 3289, 29889, 657, 29918, 4537, 29918, 974, 29918, 9902, 29898, 3126, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 29900, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 1579, 523, 29918, 14144, 29918, 4746, 29918, 2248, 29918, 29900, 29918, 9344, 29918, 2457, 29918, 9902, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 14369, 13, 4706, 3806, 353, 426, 13, 9651, 525, 1579, 523, 29918, 4537, 2396, 525, 29924, 29950, 29896, 29941, 29906, 29953, 742, 13, 9651, 525, 311, 1595, 545, 29918, 1466, 637, 2396, 525, 29968, 13309, 742, 13, 9651, 525, 279, 15081, 29918, 1466, 637, 2396, 525, 29911, 26788, 742, 13, 9651, 525, 311, 1595, 545, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 29911, 29900, 29955, 29901, 29906, 29945, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 279, 15081, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 29911, 29900, 29947, 29901, 29906, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 7827, 29918, 24658, 2396, 525, 29906, 29945, 29945, 29889, 29946, 29945, 742, 13, 9651, 525, 24658, 29918, 26095, 2396, 525, 17870, 29934, 10827, 13, 4706, 3935, 353, 341, 3289, 29889, 657, 29918, 11851, 29918, 1579, 523, 29918, 14144, 29898, 3126, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 1579, 523, 29918, 14144, 29918, 4746, 29918, 2248, 29918, 29896, 29918, 9344, 29918, 2457, 29918, 9902, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 14369, 13, 4706, 3806, 353, 426, 13, 9651, 525, 1579, 523, 29918, 4537, 2396, 525, 29924, 29950, 29896, 29941, 29941, 29953, 742, 13, 9651, 525, 311, 1595, 545, 29918, 1466, 637, 2396, 525, 29968, 13309, 742, 13, 9651, 525, 279, 15081, 29918, 1466, 637, 2396, 525, 29911, 26788, 742, 13, 9651, 525, 311, 1595, 545, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 29911, 29896, 29946, 29901, 29946, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 279, 15081, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 29911, 29896, 29945, 29901, 29941, 29945, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 7827, 29918, 24658, 2396, 525, 29906, 29945, 29945, 29889, 29946, 29945, 742, 13, 9651, 525, 24658, 29918, 26095, 2396, 525, 17870, 29934, 10827, 13, 4706, 3935, 353, 341, 3289, 29889, 657, 29918, 11851, 29918, 1579, 523, 29918, 14144, 29898, 3126, 29892, 29871, 29896, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 275, 29918, 6915, 292, 29918, 1579, 5861, 29918, 9344, 29918, 2457, 29918, 3009, 29918, 1454, 29918, 6915, 292, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 6915, 292, 13, 4706, 3935, 353, 341, 3289, 29889, 275, 29918, 6915, 292, 29918, 1579, 5861, 29898, 3126, 29892, 29871, 29900, 29897, 13, 4706, 1583, 29889, 9294, 5574, 29898, 19304, 29897, 13, 13, 1678, 822, 1243, 29918, 275, 29918, 6915, 292, 29918, 1579, 5861, 29918, 9344, 29918, 2457, 29918, 4541, 29918, 1454, 29918, 11851, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 6915, 292, 13, 4706, 3935, 353, 341, 3289, 29889, 275, 29918, 6915, 292, 29918, 1579, 5861, 29898, 3126, 29892, 29871, 29906, 29897, 13, 4706, 1583, 29889, 9294, 8824, 29898, 19304, 29897, 13, 13, 1678, 822, 1243, 29918, 657, 29918, 6915, 292, 29918, 1579, 5861, 29918, 14144, 29918, 2457, 29918, 9902, 29898, 1311, 1125, 13, 4706, 4390, 353, 1583, 29889, 6915, 292, 13, 4706, 3806, 353, 426, 13, 9651, 525, 1579, 523, 29918, 4537, 2396, 525, 29924, 29950, 29945, 29941, 29900, 29945, 718, 341, 29950, 29945, 29941, 29929, 29953, 742, 13, 9651, 525, 311, 1595, 545, 29918, 1466, 637, 2396, 525, 29968, 15176, 742, 13, 9651, 525, 279, 15081, 29918, 1466, 637, 2396, 525, 29925, 1430, 742, 13, 9651, 525, 311, 1595, 545, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29906, 29900, 29911, 29896, 29941, 29901, 29906, 29945, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 279, 15081, 29918, 2230, 2396, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29906, 29900, 29911, 29896, 29947, 29901, 29896, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 742, 13, 9651, 525, 7827, 29918, 24658, 2396, 525, 29941, 29896, 29941, 29889, 29906, 29900, 742, 13, 9651, 525, 24658, 29918, 26095, 2396, 525, 17870, 29934, 10827, 13, 4706, 3935, 353, 341, 3289, 29889, 657, 29918, 6915, 292, 29918, 1579, 523, 29918, 14144, 29898, 3126, 29892, 29871, 29945, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 13, 13, 1990, 5974, 1168, 3259, 3057, 29898, 348, 27958, 29889, 3057, 8259, 1125, 13, 13, 1678, 822, 1243, 29918, 13441, 29918, 517, 29918, 2754, 29918, 4830, 29918, 18280, 29918, 15728, 29918, 4905, 29898, 1311, 1125, 13, 4706, 2635, 29918, 3318, 353, 12865, 29889, 12673, 29898, 29906, 29900, 29896, 29945, 29892, 29871, 29929, 29892, 29871, 29906, 29945, 29897, 13, 4706, 3806, 353, 525, 29906, 29900, 29896, 29945, 29899, 29900, 29929, 29899, 29906, 29945, 29915, 13, 4706, 3935, 353, 341, 3289, 29889, 517, 29918, 2754, 29898, 1256, 29918, 3318, 29897, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 13, 1678, 822, 1243, 29918, 13441, 29918, 21111, 287, 29918, 2230, 29918, 517, 29918, 12673, 29918, 18280, 29918, 15728, 29918, 3318, 29898, 1311, 1125, 13, 4706, 9210, 353, 12865, 29889, 9346, 287, 2554, 29898, 29882, 2470, 29922, 29947, 29897, 13, 4706, 3806, 353, 12865, 29889, 12673, 29898, 29906, 29900, 29896, 29945, 29892, 29871, 29953, 29892, 29871, 29896, 29945, 29892, 29871, 29896, 29946, 29892, 29871, 29946, 29900, 29892, 13, 462, 462, 268, 260, 29920, 3888, 29922, 12673, 29889, 2230, 8028, 29898, 10289, 876, 13, 4706, 3935, 353, 341, 3289, 29889, 517, 29918, 12673, 877, 29906, 29900, 29896, 29945, 29899, 29900, 29953, 29899, 29896, 29945, 29911, 29896, 29946, 29901, 29946, 29900, 29901, 29900, 29900, 29889, 29900, 29900, 29900, 29974, 29900, 29947, 29901, 29900, 29900, 1495, 13, 4706, 1583, 29889, 9294, 9843, 29898, 9684, 29892, 3935, 29897, 13, 2 ]